Optimize C++ compilation time
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
#include "Editor/Editor.h"
|
||||
#include "Editor/ProjectInfo.h"
|
||||
#include "Engine/Engine/EngineService.h"
|
||||
#include "Engine/Engine/Globals.h"
|
||||
#include "Engine/Graphics/GPUDevice.h"
|
||||
#include "Engine/Utilities/StringConverter.h"
|
||||
#include "FlaxEngine.Gen.h"
|
||||
|
||||
@@ -76,7 +76,7 @@ void PreviewsCache::FlushTask::OnEnd()
|
||||
ThreadPoolTask::OnEnd();
|
||||
}
|
||||
|
||||
REGISTER_BINARY_ASSET(PreviewsCache, "FlaxEditor.PreviewsCache", ::New<TextureAssetUpgrader>(), false);
|
||||
REGISTER_BINARY_ASSET_WITH_UPGRADER(PreviewsCache, "FlaxEditor.PreviewsCache", TextureAssetUpgrader, false);
|
||||
|
||||
PreviewsCache::PreviewsCache(const SpawnParams& params, const AssetInfo* info)
|
||||
: SpriteAtlas(params, info)
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include "Engine/Serialization/JsonTools.h"
|
||||
#include "Engine/Content/Content.h"
|
||||
#include "Engine/Engine/EngineService.h"
|
||||
#include "Engine/Engine/Globals.h"
|
||||
#include "Engine/Threading/ThreadSpawner.h"
|
||||
#include "Engine/Platform/FileSystem.h"
|
||||
#include "Steps/ValidateStep.h"
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include "Engine/Graphics/RenderTools.h"
|
||||
#include "Engine/Graphics/Textures/TextureData.h"
|
||||
#include "Engine/Engine/Base/GameBase.h"
|
||||
#include "Engine/Engine/Globals.h"
|
||||
#include "Engine/Tools/TextureTool/TextureTool.h"
|
||||
#if PLATFORM_TOOLS_WINDOWS
|
||||
#include "Engine/Platform/Windows/WindowsPlatformSettings.h"
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include "Engine/Core/Config/GameSettings.h"
|
||||
#include "Engine/Renderer/ReflectionsPass.h"
|
||||
#include "Engine/Renderer/AntiAliasing/SMAA.h"
|
||||
#include "Engine/Engine/Globals.h"
|
||||
|
||||
bool DeployDataStep::Perform(CookingData& data)
|
||||
{
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include "CustomEditorsUtil.h"
|
||||
#include "Engine/Core/Log.h"
|
||||
#include "Engine/Core/Types/DateTime.h"
|
||||
#include "Engine/Core/Types/TimeSpan.h"
|
||||
#include "Engine/Core/Collections/Dictionary.h"
|
||||
#include "Engine/Engine/EngineService.h"
|
||||
#include "Engine/Scripting/Scripting.h"
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "Engine/Core/Types/StringBuilder.h"
|
||||
#include "Engine/Debug/Exceptions/FileNotFoundException.h"
|
||||
#include "Engine/Engine/Engine.h"
|
||||
#include "Engine/Engine/Globals.h"
|
||||
#include "Engine/Platform/FileSystem.h"
|
||||
#include "Engine/Platform/FileSystemWatcher.h"
|
||||
#include "Engine/Threading/ThreadPool.h"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// Copyright (c) 2012-2021 Wojciech Figat. All rights reserved.
|
||||
|
||||
#include "EditorUtilities.h"
|
||||
#include "Engine/Engine/Globals.h"
|
||||
#include "Engine/Platform/File.h"
|
||||
#include "Engine/Platform/FileSystem.h"
|
||||
#include "Engine/Core/Log.h"
|
||||
|
||||
@@ -2,7 +2,9 @@
|
||||
|
||||
#include "SplashScreen.h"
|
||||
#include "Engine/Core/Log.h"
|
||||
#include "Engine/Core/Types/TimeSpan.h"
|
||||
#include "Engine/Engine/CommandLine.h"
|
||||
#include "Engine/Engine/Globals.h"
|
||||
#include "Engine/Render2D/FontAsset.h"
|
||||
#include "Engine/Render2D/Font.h"
|
||||
#include "Engine/Render2D/TextLayoutOptions.h"
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include "Engine/Scripting/ManagedCLR/MUtils.h"
|
||||
#include "Engine/Scripting/Scripting.h"
|
||||
#include "Engine/Scripting/MException.h"
|
||||
#include "Engine/Content/Assets/SkinnedModel.h"
|
||||
#include <ThirdParty/mono-2.0/mono/metadata/appdomain.h>
|
||||
|
||||
struct InternalInitData
|
||||
@@ -144,6 +145,17 @@ void AnimGraphExecutor::ProcessGroupCustom(Box* boxBase, Node* nodeBase, Value&
|
||||
box->Cache = value;
|
||||
}
|
||||
|
||||
bool AnimGraph::IsReady() const
|
||||
{
|
||||
return BaseModel && BaseModel->IsLoaded();
|
||||
}
|
||||
|
||||
bool AnimGraph::CanUseWithSkeleton(SkinnedModel* other) const
|
||||
{
|
||||
// All data loaded and bones count the same
|
||||
return IsReady() && other && other->IsLoaded() && other->Skeleton.Bones.Count() == BaseModel->Skeleton.Bones.Count();
|
||||
}
|
||||
|
||||
void AnimGraph::ClearCustomNode(Node* node)
|
||||
{
|
||||
// Clear data
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
// Copyright (c) 2012-2021 Wojciech Figat. All rights reserved.
|
||||
|
||||
#include "AnimGraph.h"
|
||||
#include "Engine/Engine/Time.h"
|
||||
#include "Engine/Content/Assets/SkinnedModel.h"
|
||||
#include "Engine/Graphics/Models/SkeletonData.h"
|
||||
#include "Engine/Scripting/Scripting.h"
|
||||
#include "Engine/Engine/Time.h"
|
||||
|
||||
RootMotionData RootMotionData::Identity = { Vector3(0.0f), Quaternion(0.0f, 0.0f, 0.0f, 1.0f) };
|
||||
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
#pragma once
|
||||
|
||||
#include "Engine/Visject/VisjectGraph.h"
|
||||
#include "Engine/Content/Assets/SkinnedModel.h"
|
||||
#include "Engine/Content/Assets/Animation.h"
|
||||
#include "Engine/Animations/AlphaBlend.h"
|
||||
#include "Engine/Core/Math/Matrix.h"
|
||||
#include "../Config.h"
|
||||
|
||||
#define ANIM_GRAPH_PARAM_BASE_MODEL_ID Guid(1000, 0, 0, 0)
|
||||
@@ -21,6 +21,8 @@ class AnimSubGraph;
|
||||
class AnimGraphBase;
|
||||
class AnimGraphNode;
|
||||
class AnimGraphExecutor;
|
||||
class SkinnedModel;
|
||||
class SkeletonData;
|
||||
|
||||
/// <summary>
|
||||
/// The root motion data container. Supports displacement and rotation (no scale component).
|
||||
@@ -777,22 +779,14 @@ public:
|
||||
/// <summary>
|
||||
/// Determines whether this graph is ready for the animation evaluation.
|
||||
/// </summary>
|
||||
/// <returns>True if is ready and can be used for the animation evaluation, otherwise false.</returns>
|
||||
bool IsReady() const
|
||||
{
|
||||
return BaseModel && BaseModel->IsLoaded();
|
||||
}
|
||||
bool IsReady() const;
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether this graph can be used with the specified skeleton.
|
||||
/// </summary>
|
||||
/// <param name="other">The other skinned model to check.</param>
|
||||
/// <returns>True if can perform the update, otherwise false.</returns>
|
||||
bool CanUseWithSkeleton(SkinnedModel* other) const
|
||||
{
|
||||
// All data loaded and bones count the same
|
||||
return IsReady() && other && other->IsLoaded() && other->Skeleton.Bones.Count() == BaseModel->Skeleton.Bones.Count();
|
||||
}
|
||||
bool CanUseWithSkeleton(SkinnedModel* other) const;
|
||||
|
||||
private:
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include "Engine/Audio/AudioClip.h"
|
||||
#include "Engine/Graphics/PostProcessSettings.h"
|
||||
|
||||
REGISTER_BINARY_ASSET(SceneAnimation, "FlaxEngine.SceneAnimation", nullptr, false);
|
||||
REGISTER_BINARY_ASSET(SceneAnimation, "FlaxEngine.SceneAnimation", false);
|
||||
|
||||
SceneAnimation::SceneAnimation(const SpawnParams& params, const AssetInfo* info)
|
||||
: BinaryAsset(params, info)
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "Engine/Serialization/Serialization.h"
|
||||
#include "Engine/Audio/AudioClip.h"
|
||||
#include "Engine/Audio/AudioSource.h"
|
||||
#include "Engine/Graphics/RenderTask.h"
|
||||
#include "Engine/Renderer/RenderList.h"
|
||||
#include "Engine/Scripting/Scripting.h"
|
||||
#include "Engine/Scripting/Script.h"
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "Engine/Level/Actor.h"
|
||||
#include "Engine/Core/Collections/Dictionary.h"
|
||||
#include "Engine/Content/AssetReference.h"
|
||||
#include "Engine/Level/Actors/PostFxVolume.h"
|
||||
#include "SceneAnimation.h"
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "Audio.h"
|
||||
#include "AudioSource.h"
|
||||
#include "AudioBackend.h"
|
||||
#include "Engine/Core/Log.h"
|
||||
#include "Engine/Content/Upgraders/AudioClipUpgrader.h"
|
||||
#include "Engine/Content/Factories/BinaryAssetFactory.h"
|
||||
#include "Engine/Scripting/ManagedCLR/MUtils.h"
|
||||
@@ -12,7 +13,7 @@
|
||||
#include "Engine/Tools/AudioTool/OggVorbisDecoder.h"
|
||||
#include "Engine/Tools/AudioTool/AudioTool.h"
|
||||
|
||||
REGISTER_BINARY_ASSET(AudioClip, "FlaxEngine.AudioClip", ::New<AudioClipUpgrader>(), false);
|
||||
REGISTER_BINARY_ASSET_WITH_UPGRADER(AudioClip, "FlaxEngine.AudioClip", AudioClipUpgrader, false);
|
||||
|
||||
bool AudioClip::StreamingTask::Run()
|
||||
{
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include "Engine/Level/SceneQuery.h"
|
||||
#include "Engine/Level/Actor.h"
|
||||
#include "Engine/Core/Log.h"
|
||||
#include "Engine/Core/Types/TimeSpan.h"
|
||||
#include "Engine/Graphics/Models/ModelData.h"
|
||||
#include "Engine/Content/Content.h"
|
||||
#include "Engine/Content/Assets/Model.h"
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include "Engine/Serialization/MemoryWriteStream.h"
|
||||
#endif
|
||||
|
||||
REGISTER_BINARY_ASSET(Animation, "FlaxEngine.Animation", nullptr, false);
|
||||
REGISTER_BINARY_ASSET(Animation, "FlaxEngine.Animation", false);
|
||||
|
||||
Animation::Animation(const SpawnParams& params, const AssetInfo* info)
|
||||
: BinaryAsset(params, info)
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include "Engine/Serialization/MemoryReadStream.h"
|
||||
#include "Engine/Content/Factories/BinaryAssetFactory.h"
|
||||
|
||||
REGISTER_BINARY_ASSET(AnimationGraph, "FlaxEngine.AnimationGraph", nullptr, false);
|
||||
REGISTER_BINARY_ASSET(AnimationGraph, "FlaxEngine.AnimationGraph", false);
|
||||
|
||||
AnimationGraph::AnimationGraph(const SpawnParams& params, const AssetInfo* info)
|
||||
: BinaryAsset(params, info)
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include "Engine/Serialization/MemoryReadStream.h"
|
||||
#include "Engine/Content/Factories/BinaryAssetFactory.h"
|
||||
|
||||
REGISTER_BINARY_ASSET(AnimationGraphFunction, "FlaxEngine.AnimationGraphFunction", nullptr, false);
|
||||
REGISTER_BINARY_ASSET(AnimationGraphFunction, "FlaxEngine.AnimationGraphFunction", false);
|
||||
|
||||
AnimationGraphFunction::AnimationGraphFunction(const SpawnParams& params, const AssetInfo* info)
|
||||
: BinaryAsset(params, info)
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include "Engine/Content/Factories/BinaryAssetFactory.h"
|
||||
#include "Engine/Content/Upgraders/TextureAssetUpgrader.h"
|
||||
|
||||
REGISTER_BINARY_ASSET(CubeTexture, "FlaxEngine.CubeTexture", ::New<TextureAssetUpgrader>(), true);
|
||||
REGISTER_BINARY_ASSET_WITH_UPGRADER(CubeTexture, "FlaxEngine.CubeTexture", TextureAssetUpgrader, true);
|
||||
|
||||
CubeTexture::CubeTexture(const SpawnParams& params, const AssetInfo* info)
|
||||
: TextureBase(params, info)
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include "Engine/Content/Factories/BinaryAssetFactory.h"
|
||||
#include "Engine/Content/Upgraders/TextureAssetUpgrader.h"
|
||||
|
||||
REGISTER_BINARY_ASSET(IESProfile, "FlaxEngine.IESProfile", ::New<TextureAssetUpgrader>(), false);
|
||||
REGISTER_BINARY_ASSET_WITH_UPGRADER(IESProfile, "FlaxEngine.IESProfile", TextureAssetUpgrader, false);
|
||||
|
||||
IESProfile::IESProfile(const SpawnParams& params, const AssetInfo* info)
|
||||
: TextureBase(params, info)
|
||||
|
||||
@@ -16,6 +16,9 @@
|
||||
#include "Engine/Utilities/Encryption.h"
|
||||
#include "Engine/Tools/MaterialGenerator/MaterialGenerator.h"
|
||||
#include "Engine/ShadersCompilation/Config.h"
|
||||
#if BUILD_DEBUG
|
||||
#include "Engine/Engine/Globals.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
@@ -23,7 +26,7 @@
|
||||
/// </summary>
|
||||
#define MATERIAL_AUTO_GENERATE_MISSING_SOURCE (USE_EDITOR)
|
||||
|
||||
REGISTER_BINARY_ASSET(Material, "FlaxEngine.Material", ::New<ShaderAssetUpgrader>(), false);
|
||||
REGISTER_BINARY_ASSET_WITH_UPGRADER(Material, "FlaxEngine.Material", ShaderAssetUpgrader, false);
|
||||
|
||||
Material::Material(const SpawnParams& params, const AssetInfo* info)
|
||||
: ShaderAssetTypeBase<MaterialBase>(params, info)
|
||||
@@ -116,7 +119,7 @@ Asset::LoadResult Material::load()
|
||||
FlaxChunk* materialParamsChunk;
|
||||
|
||||
// Special case for Null renderer
|
||||
if (GPUDevice::Instance->GetRendererType() == RendererType::Null)
|
||||
if (IsNullRenderer())
|
||||
{
|
||||
// Hack loading
|
||||
MemoryReadStream shaderCacheStream(nullptr, 0);
|
||||
@@ -152,18 +155,16 @@ Asset::LoadResult Material::load()
|
||||
// - If material version is not supported then material cannot be loaded
|
||||
#if COMPILE_WITH_SHADER_COMPILER
|
||||
|
||||
#if BUILD_DEBUG
|
||||
// Materials force reload!
|
||||
Globals::ConvertLoadedMaterialsByForce = false;
|
||||
#endif
|
||||
|
||||
// Check if current engine has different materials version or convert it by force or has no source generated at all
|
||||
if (_shaderHeader.Material.GraphVersion != MATERIAL_GRAPH_VERSION
|
||||
|| Globals::ConvertLoadedMaterialsByForce
|
||||
#if MATERIAL_AUTO_GENERATE_MISSING_SOURCE
|
||||
|| !HasChunk(SHADER_FILE_CHUNK_SOURCE)
|
||||
#endif
|
||||
|| HasDependenciesModified()
|
||||
#if COMPILE_WITH_DEV_ENV
|
||||
// Set to true to enable force GPU shader regeneration (don't commit it)
|
||||
|| false
|
||||
#endif
|
||||
)
|
||||
{
|
||||
// Prepare
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#endif
|
||||
#include "Engine/Content/Factories/BinaryAssetFactory.h"
|
||||
|
||||
REGISTER_BINARY_ASSET(MaterialFunction, "FlaxEngine.MaterialFunction", nullptr, false);
|
||||
REGISTER_BINARY_ASSET(MaterialFunction, "FlaxEngine.MaterialFunction", false);
|
||||
|
||||
MaterialFunction::MaterialFunction(const SpawnParams& params, const AssetInfo* info)
|
||||
: BinaryAsset(params, info)
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include "Engine/Content/Factories/BinaryAssetFactory.h"
|
||||
#include "Engine/Serialization/MemoryReadStream.h"
|
||||
|
||||
REGISTER_BINARY_ASSET(MaterialInstance, "FlaxEngine.MaterialInstance", ::New<MaterialInstanceUpgrader>(), true);
|
||||
REGISTER_BINARY_ASSET_WITH_UPGRADER(MaterialInstance, "FlaxEngine.MaterialInstance", MaterialInstanceUpgrader, true);
|
||||
|
||||
MaterialInstance::MaterialInstance(const SpawnParams& params, const AssetInfo* info)
|
||||
: MaterialBase(params, info)
|
||||
|
||||
@@ -8,9 +8,11 @@
|
||||
#include "Engine/Content/Upgraders/ModelAssetUpgrader.h"
|
||||
#include "Engine/Content/Factories/BinaryAssetFactory.h"
|
||||
#include "Engine/Graphics/RenderTools.h"
|
||||
#include "Engine/Graphics/RenderTask.h"
|
||||
#include "Engine/Graphics/Models/ModelInstanceEntry.h"
|
||||
#include "Engine/Streaming/StreamingGroup.h"
|
||||
#include "Engine/Debug/Exceptions/ArgumentOutOfRangeException.h"
|
||||
#include "Engine/Renderer/DrawCall.h"
|
||||
#if GPU_ENABLE_ASYNC_RESOURCES_CREATION
|
||||
#include "Engine/Threading/ThreadPoolTask.h"
|
||||
#define STREAM_TASK_BASE ThreadPoolTask
|
||||
@@ -113,7 +115,7 @@ protected:
|
||||
}
|
||||
};
|
||||
|
||||
REGISTER_BINARY_ASSET(Model, "FlaxEngine.Model", ::New<ModelAssetUpgrader>(), true);
|
||||
REGISTER_BINARY_ASSET_WITH_UPGRADER(Model, "FlaxEngine.Model", ModelAssetUpgrader, true);
|
||||
|
||||
Model::Model(const SpawnParams& params, const AssetInfo* info)
|
||||
: ModelBase(params, info, StreamingGroups::Instance()->Models())
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include "Engine/Content/Factories/BinaryAssetFactory.h"
|
||||
#include "Engine/Platform/FileSystem.h"
|
||||
|
||||
REGISTER_BINARY_ASSET(RawDataAsset, "FlaxEngine.RawDataAsset", nullptr, true);
|
||||
REGISTER_BINARY_ASSET(RawDataAsset, "FlaxEngine.RawDataAsset", true);
|
||||
|
||||
RawDataAsset::RawDataAsset(const SpawnParams& params, const AssetInfo* info)
|
||||
: BinaryAsset(params, info)
|
||||
|
||||
@@ -2,11 +2,13 @@
|
||||
|
||||
#include "Shader.h"
|
||||
#include "Engine/Core/Log.h"
|
||||
#include "Engine/Graphics/GPUDevice.h"
|
||||
#include "Engine/Graphics/Shaders/GPUShader.h"
|
||||
#include "Engine/Content/Upgraders/ShaderAssetUpgrader.h"
|
||||
#include "Engine/Content/Factories/BinaryAssetFactory.h"
|
||||
#include "Engine/Serialization/MemoryReadStream.h"
|
||||
|
||||
REGISTER_BINARY_ASSET(Shader, "FlaxEngine.Shader", ::New<ShaderAssetUpgrader>(), false);
|
||||
REGISTER_BINARY_ASSET_WITH_UPGRADER(Shader, "FlaxEngine.Shader", ShaderAssetUpgrader, false);
|
||||
|
||||
Shader::Shader(const SpawnParams& params, const AssetInfo* info)
|
||||
: ShaderAssetTypeBase<BinaryAsset>(params, info)
|
||||
@@ -25,7 +27,7 @@ Shader::~Shader()
|
||||
Asset::LoadResult Shader::load()
|
||||
{
|
||||
// Special case for Null renderer that doesn't need shaders
|
||||
if (GPUDevice::Instance->GetRendererType() == RendererType::Null)
|
||||
if (IsNullRenderer())
|
||||
{
|
||||
return LoadResult::Ok;
|
||||
}
|
||||
|
||||
@@ -3,9 +3,10 @@
|
||||
#pragma once
|
||||
|
||||
#include "../BinaryAsset.h"
|
||||
#include "Engine/Graphics/Shaders/GPUShader.h"
|
||||
#include "Engine/Graphics/Shaders/Cache/ShaderAssetBase.h"
|
||||
|
||||
class GPUShader;
|
||||
|
||||
/// <summary>
|
||||
/// The shader asset. Contains a program that runs on the GPU and is able to perform rendering calculation using textures, vertices and other resources.
|
||||
/// </summary>
|
||||
@@ -33,7 +34,6 @@ public:
|
||||
/// <summary>
|
||||
/// Gets the GPU shader object.
|
||||
/// </summary>
|
||||
/// <returns>The GPU shader object.</returns>
|
||||
FORCE_INLINE GPUShader* GetShader() const
|
||||
{
|
||||
return GPU;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include "Engine/Content/Factories/BinaryAssetFactory.h"
|
||||
#include "Engine/Content/Upgraders/SkeletonMaskUpgrader.h"
|
||||
|
||||
REGISTER_BINARY_ASSET(SkeletonMask, "FlaxEngine.SkeletonMask", ::New<SkeletonMaskUpgrader>(), true);
|
||||
REGISTER_BINARY_ASSET_WITH_UPGRADER(SkeletonMask, "FlaxEngine.SkeletonMask", SkeletonMaskUpgrader, true);
|
||||
|
||||
SkeletonMask::SkeletonMask(const SpawnParams& params, const AssetInfo* info)
|
||||
: BinaryAsset(params, info)
|
||||
|
||||
@@ -7,12 +7,14 @@
|
||||
#include "Engine/Streaming/StreamingGroup.h"
|
||||
#include "Engine/Threading/ThreadPoolTask.h"
|
||||
#include "Engine/Graphics/RenderTools.h"
|
||||
#include "Engine/Graphics/RenderTask.h"
|
||||
#include "Engine/Graphics/Models/ModelInstanceEntry.h"
|
||||
#include "Engine/Graphics/Models/Config.h"
|
||||
#include "Engine/Content/WeakAssetReference.h"
|
||||
#include "Engine/Content/Factories/BinaryAssetFactory.h"
|
||||
#include "Engine/Content/Upgraders/SkinnedModelAssetUpgrader.h"
|
||||
#include "Engine/Debug/Exceptions/ArgumentOutOfRangeException.h"
|
||||
#include "Engine/Renderer/DrawCall.h"
|
||||
|
||||
#define CHECK_INVALID_BUFFER(buffer) \
|
||||
if (buffer->IsValidFor(this) == false) \
|
||||
@@ -106,7 +108,7 @@ protected:
|
||||
}
|
||||
};
|
||||
|
||||
REGISTER_BINARY_ASSET(SkinnedModel, "FlaxEngine.SkinnedModel", ::New<SkinnedModelAssetUpgrader>(), true);
|
||||
REGISTER_BINARY_ASSET_WITH_UPGRADER(SkinnedModel, "FlaxEngine.SkinnedModel", SkinnedModelAssetUpgrader, true);
|
||||
|
||||
SkinnedModel::SkinnedModel(const SpawnParams& params, const AssetInfo* info)
|
||||
: ModelBase(params, info, StreamingGroups::Instance()->SkinnedModels())
|
||||
@@ -120,6 +122,11 @@ SkinnedModel::~SkinnedModel()
|
||||
ASSERT(_streamingTask == nullptr);
|
||||
}
|
||||
|
||||
bool SkinnedModel::HasAnyLODInitialized() const
|
||||
{
|
||||
return LODs.HasItems() && LODs.Last().HasAnyMeshInitialized();
|
||||
}
|
||||
|
||||
Array<String> SkinnedModel::GetBlendShapes()
|
||||
{
|
||||
Array<String> result;
|
||||
|
||||
@@ -103,10 +103,7 @@ public:
|
||||
/// Determines whether any LOD has been initialized.
|
||||
/// </summary>
|
||||
/// <returns>True if any LOD has been initialized, otherwise false.</returns>
|
||||
FORCE_INLINE bool HasAnyLODInitialized() const
|
||||
{
|
||||
return LODs.HasItems() && LODs.Last().HasAnyMeshInitialized();
|
||||
}
|
||||
bool HasAnyLODInitialized() const;
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether this model can be rendered.
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include "Engine/Scripting/MainThreadManagedInvokeAction.h"
|
||||
#include "Engine/Tools/TextureTool/TextureTool.h"
|
||||
|
||||
REGISTER_BINARY_ASSET(Texture, "FlaxEngine.Texture", ::New<TextureAssetUpgrader>(), true);
|
||||
REGISTER_BINARY_ASSET_WITH_UPGRADER(Texture, "FlaxEngine.Texture", TextureAssetUpgrader, true);
|
||||
|
||||
Texture::Texture(const SpawnParams& params, const AssetInfo* info)
|
||||
: TextureBase(params, info)
|
||||
|
||||
@@ -1276,7 +1276,7 @@ void VisualScriptExecutor::ProcessGroupFlow(Box* boxBase, Node* node, Value& val
|
||||
}
|
||||
}
|
||||
|
||||
REGISTER_BINARY_ASSET(VisualScript, "FlaxEngine.VisualScript", nullptr, false);
|
||||
REGISTER_BINARY_ASSET(VisualScript, "FlaxEngine.VisualScript", false);
|
||||
|
||||
VisualScript::VisualScript(const SpawnParams& params, const AssetInfo* info)
|
||||
: BinaryAsset(params, info)
|
||||
|
||||
@@ -132,6 +132,13 @@ void BinaryAsset::GetImportMetadata(String& path, String& username) const
|
||||
}
|
||||
}
|
||||
|
||||
String BinaryAsset::GetImportPath() const
|
||||
{
|
||||
String path, username;
|
||||
GetImportMetadata(path, username);
|
||||
return path;
|
||||
}
|
||||
|
||||
void BinaryAsset::ClearDependencies()
|
||||
{
|
||||
for (auto& e : Dependencies)
|
||||
@@ -492,7 +499,6 @@ protected:
|
||||
|
||||
return Result::Ok;
|
||||
}
|
||||
|
||||
void OnEnd() override
|
||||
{
|
||||
_dataLock.Release();
|
||||
|
||||
@@ -109,13 +109,7 @@ public:
|
||||
/// <summary>
|
||||
/// Gets the imported file path from the asset metadata (can be empty if not available).
|
||||
/// </summary>
|
||||
/// <returns>The imported source file path.</returns>
|
||||
API_PROPERTY() String GetImportPath() const
|
||||
{
|
||||
String path, username;
|
||||
GetImportMetadata(path, username);
|
||||
return path;
|
||||
}
|
||||
API_PROPERTY() String GetImportPath() const;
|
||||
|
||||
/// <summary>
|
||||
/// Clears the asset dependencies list and unregisters from tracking their changes.
|
||||
@@ -131,7 +125,6 @@ public:
|
||||
/// <summary>
|
||||
/// Determines whether any of the dependency assets was modified after last modification time of this asset (last file write time check).
|
||||
/// </summary>
|
||||
/// <returns><c>true</c> if one or more dependencies were modified; otherwise, <c>false</c>.</returns>
|
||||
bool HasDependenciesModified() const;
|
||||
|
||||
protected:
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include "AssetsCache.h"
|
||||
#include "Engine/Core/Log.h"
|
||||
#include "Engine/Core/DeleteMe.h"
|
||||
#include "Engine/Core/Types/TimeSpan.h"
|
||||
#include "Engine/Platform/FileSystem.h"
|
||||
#include "Engine/Serialization/FileWriteStream.h"
|
||||
#include "Engine/Serialization/FileReadStream.h"
|
||||
@@ -10,6 +11,7 @@
|
||||
#include "Engine/Content/Storage/ContentStorageManager.h"
|
||||
#include "Engine/Content/Storage/JsonStorageProxy.h"
|
||||
#include "Engine/Profiler/ProfilerCPU.h"
|
||||
#include "Engine/Engine/Globals.h"
|
||||
#include "FlaxEngine.Gen.h"
|
||||
|
||||
AssetsCache::AssetsCache()
|
||||
@@ -402,6 +404,16 @@ void AssetsCache::RegisterAssets(FlaxStorage* storage)
|
||||
_isDirty = true;
|
||||
}
|
||||
|
||||
void AssetsCache::RegisterAsset(const AssetHeader& header, const StringView& path)
|
||||
{
|
||||
RegisterAsset(header.ID, header.TypeName, path);
|
||||
}
|
||||
|
||||
void AssetsCache::RegisterAssets(const FlaxStorageReference& storage)
|
||||
{
|
||||
RegisterAssets(storage.Get());
|
||||
}
|
||||
|
||||
void AssetsCache::RegisterAsset(const Guid& id, const String& typeName, const StringView& path)
|
||||
{
|
||||
PROFILE_CPU();
|
||||
|
||||
@@ -2,13 +2,19 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "../AssetInfo.h"
|
||||
#include "../Config.h"
|
||||
#include "Engine/Core/Types/Guid.h"
|
||||
#if ENABLE_ASSETS_DISCOVERY
|
||||
#include "Engine/Core/Types/DateTime.h"
|
||||
#endif
|
||||
#include "Engine/Core/Types/String.h"
|
||||
#include "Engine/Core/Collections/Dictionary.h"
|
||||
#include "Engine/Platform/CriticalSection.h"
|
||||
#include "Engine/Content/Storage/FlaxStorageReference.h"
|
||||
#include "../AssetInfo.h"
|
||||
#include "../Config.h"
|
||||
|
||||
struct AssetHeader;
|
||||
struct FlaxStorageReference;
|
||||
class FlaxStorage;
|
||||
|
||||
/// <summary>
|
||||
/// Assets cache flags.
|
||||
@@ -46,19 +52,17 @@ public:
|
||||
AssetInfo Info;
|
||||
|
||||
#if ENABLE_ASSETS_DISCOVERY
|
||||
|
||||
/// <summary>
|
||||
/// The file modified date.
|
||||
/// </summary>
|
||||
DateTime FileModified;
|
||||
|
||||
#endif
|
||||
|
||||
Entry()
|
||||
{
|
||||
}
|
||||
|
||||
Entry(const Guid& id, const String& typeName, const StringView& path)
|
||||
Entry(const Guid& id, const StringView& typeName, const StringView& path)
|
||||
: Info(id, typeName, path)
|
||||
#if ENABLE_ASSETS_DISCOVERY
|
||||
, FileModified(DateTime::NowUTC())
|
||||
@@ -167,16 +171,13 @@ public:
|
||||
/// </summary>
|
||||
/// <param name="typeName">The asset typename.</param>
|
||||
/// <param name="result">The result array.</param>
|
||||
void GetAllByTypeName(const StringView& typeName, Array<Guid>& result) const;
|
||||
void GetAllByTypeName(const StringView& typeName, Array<Guid, HeapAllocation>& result) const;
|
||||
|
||||
/// <summary>
|
||||
/// Register assets in the cache
|
||||
/// </summary>
|
||||
/// <param name="storage">Flax assets container reference</param>
|
||||
FORCE_INLINE void RegisterAssets(const FlaxStorageReference& storage)
|
||||
{
|
||||
RegisterAssets(storage.Get());
|
||||
}
|
||||
void RegisterAssets(const FlaxStorageReference& storage);
|
||||
|
||||
/// <summary>
|
||||
/// Register assets in the cache
|
||||
@@ -189,10 +190,7 @@ public:
|
||||
/// </summary>
|
||||
/// <param name="header">Flax asset file header</param>
|
||||
/// <param name="path">Asset path</param>
|
||||
FORCE_INLINE void RegisterAsset(const AssetHeader& header, const StringView& path)
|
||||
{
|
||||
RegisterAsset(header.ID, header.TypeName, path);
|
||||
}
|
||||
void RegisterAsset(const AssetHeader& header, const StringView& path);
|
||||
|
||||
/// <summary>
|
||||
/// Register asset in the cache
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#include "Engine/Threading/Threading.h"
|
||||
#include "Engine/Graphics/Graphics.h"
|
||||
#include "Engine/Engine/Time.h"
|
||||
#include "Engine/Engine/Globals.h"
|
||||
#include "Engine/Level/Types.h"
|
||||
#include "Engine/Profiler/ProfilerCPU.h"
|
||||
#include "Engine/Scripting/ManagedCLR/MClass.h"
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "../BinaryAsset.h"
|
||||
#include "Engine/Core/Log.h"
|
||||
#include "Engine/Core/Math/Math.h"
|
||||
#include "Engine/Core/Types/TimeSpan.h"
|
||||
#include "Engine/Platform/FileSystem.h"
|
||||
#include "Engine/Content/Storage/ContentStorageManager.h"
|
||||
#if USE_EDITOR
|
||||
@@ -30,7 +31,7 @@ bool BinaryAssetFactoryBase::Init(BinaryAsset* asset)
|
||||
return true;
|
||||
}
|
||||
|
||||
#if COMPILE_WITH_ASSET_UPGRADERS
|
||||
#if USE_EDITOR
|
||||
// Check if need to perform data conversion to the newer version (only in Editor)
|
||||
const auto upgrader = GetUpgrader();
|
||||
if (storage->AllowDataModifications() && upgrader && upgrader->ShouldUpgrade(initData.SerializedVersion))
|
||||
@@ -113,7 +114,7 @@ bool BinaryAssetFactoryBase::Init(BinaryAsset* asset)
|
||||
return false;
|
||||
}
|
||||
|
||||
#if COMPILE_WITH_ASSET_UPGRADERS
|
||||
#if USE_EDITOR
|
||||
|
||||
bool BinaryAssetFactoryBase::UpgradeAsset(const AssetInfo& info, FlaxStorage* storage, AssetMigrationContext& context)
|
||||
{
|
||||
|
||||
@@ -3,7 +3,9 @@
|
||||
#pragma once
|
||||
|
||||
#include "IAssetFactory.h"
|
||||
#if USE_EDITOR
|
||||
#include "Engine/Content/Upgraders/BinaryAssetUpgrader.h"
|
||||
#endif
|
||||
#include "Engine/Content/AssetInfo.h"
|
||||
#include "Engine/Scripting/ScriptingObject.h"
|
||||
|
||||
@@ -29,7 +31,7 @@ protected:
|
||||
|
||||
virtual BinaryAsset* Create(const AssetInfo& info) = 0;
|
||||
virtual bool IsVersionSupported(uint32 serializedVersion) const = 0;
|
||||
#if COMPILE_WITH_ASSET_UPGRADERS
|
||||
#if USE_EDITOR
|
||||
bool UpgradeAsset(const AssetInfo& info, FlaxStorage* storage, AssetMigrationContext& context);
|
||||
#endif
|
||||
|
||||
@@ -65,16 +67,31 @@ protected:
|
||||
}
|
||||
};
|
||||
|
||||
#define REGISTER_BINARY_ASSET(type, typeName, upgrader, supportsVirtualAssets) \
|
||||
#define REGISTER_BINARY_ASSET(type, typeName, supportsVirtualAssets) \
|
||||
const String type::TypeName = TEXT(typeName); \
|
||||
class CONCAT_MACROS(Factory, type) : public BinaryAssetFactory<type> \
|
||||
{ \
|
||||
public: \
|
||||
CONCAT_MACROS(Factory, type)() { IAssetFactory::Get().Add(type::TypeName, this); } \
|
||||
~CONCAT_MACROS(Factory, type)() { IAssetFactory::Get().Remove(type::TypeName); } \
|
||||
bool SupportsVirtualAssets() const override { return supportsVirtualAssets; } \
|
||||
}; \
|
||||
static CONCAT_MACROS(Factory, type) CONCAT_MACROS(CFactory, type)
|
||||
|
||||
#if USE_EDITOR
|
||||
#define REGISTER_BINARY_ASSET_WITH_UPGRADER(type, typeName, upgrader, supportsVirtualAssets) \
|
||||
const String type::TypeName = TEXT(typeName); \
|
||||
class CONCAT_MACROS(Factory, type) : public BinaryAssetFactory<type> \
|
||||
{ \
|
||||
private: \
|
||||
IAssetUpgrader* _upgrader = upgrader; \
|
||||
IAssetUpgrader* _upgrader = ::New<upgrader>(); \
|
||||
public: \
|
||||
CONCAT_MACROS(Factory, type)() { IAssetFactory::Get().Add(type::TypeName, this); } \
|
||||
~CONCAT_MACROS(Factory, type)() { if (_upgrader) Delete(_upgrader); IAssetFactory::Get().Remove(type::TypeName); } \
|
||||
~CONCAT_MACROS(Factory, type)() { Delete(_upgrader); IAssetFactory::Get().Remove(type::TypeName); } \
|
||||
bool SupportsVirtualAssets() const override { return supportsVirtualAssets; } \
|
||||
IAssetUpgrader* GetUpgrader() const override { return _upgrader; } \
|
||||
}; \
|
||||
static CONCAT_MACROS(Factory, type) CONCAT_MACROS(CFactory, type)
|
||||
#else
|
||||
#define REGISTER_BINARY_ASSET_WITH_UPGRADER(type, typeName, upgrader, supportsVirtualAssets) REGISTER_BINARY_ASSET(type, typeName, supportsVirtualAssets)
|
||||
#endif
|
||||
|
||||
@@ -9,9 +9,6 @@ struct AssetInfo;
|
||||
class Asset;
|
||||
class IAssetUpgrader;
|
||||
|
||||
// Enables upgrading asset files from the older version format
|
||||
#define COMPILE_WITH_ASSET_UPGRADERS (USE_EDITOR)
|
||||
|
||||
/// <summary>
|
||||
/// The asset objects factory.
|
||||
/// </summary>
|
||||
|
||||
@@ -5,7 +5,9 @@
|
||||
#include "Engine/Core/Types/Guid.h"
|
||||
#include "Engine/Core/Types/Pair.h"
|
||||
#include "Engine/Core/Types/String.h"
|
||||
#include "Engine/Core/Types/DataContainer.h"
|
||||
#if USE_EDITOR
|
||||
#include "Engine/Core/Collections/Array.h"
|
||||
#endif
|
||||
#include "FlaxChunk.h"
|
||||
|
||||
/// <summary>
|
||||
@@ -54,7 +56,8 @@ public:
|
||||
/// Gets the chunks.
|
||||
/// </summary>
|
||||
/// <param name="output">The output data.</param>
|
||||
void GetChunks(Array<FlaxChunk*>& output) const
|
||||
template<typename AllocationType = HeapAllocation>
|
||||
void GetChunks(Array<FlaxChunk*, AllocationType>& output) const
|
||||
{
|
||||
for (int32 i = 0; i < ASSET_FILE_DATA_CHUNKS; i++)
|
||||
{
|
||||
@@ -67,7 +70,8 @@ public:
|
||||
/// Gets the chunks that are loaded.
|
||||
/// </summary>
|
||||
/// <param name="output">The output data.</param>
|
||||
void GetLoadedChunks(Array<FlaxChunk*>& output) const
|
||||
template<typename AllocationType = HeapAllocation>
|
||||
void GetLoadedChunks(Array<FlaxChunk*, AllocationType>& output) const
|
||||
{
|
||||
for (int32 i = 0; i < ASSET_FILE_DATA_CHUNKS; i++)
|
||||
{
|
||||
@@ -130,7 +134,7 @@ struct FLAXENGINE_API AssetInitData
|
||||
/// <summary>
|
||||
/// The serialized asset version
|
||||
/// </summary>
|
||||
uint32 SerializedVersion;
|
||||
uint32 SerializedVersion = 0;
|
||||
|
||||
/// <summary>
|
||||
/// The custom asset data (should be small, for eg. texture description structure).
|
||||
@@ -138,7 +142,6 @@ struct FLAXENGINE_API AssetInitData
|
||||
BytesContainer CustomData;
|
||||
|
||||
#if USE_EDITOR
|
||||
|
||||
/// <summary>
|
||||
/// The asset metadata information. Stored in a Json format.
|
||||
/// </summary>
|
||||
@@ -148,24 +151,16 @@ struct FLAXENGINE_API AssetInitData
|
||||
/// Asset dependencies list used by the asset for tracking (eg. material functions used by material asset). The pair of asset ID and cached file edit time (for tracking modification).
|
||||
/// </summary>
|
||||
Array<Pair<Guid, DateTime>> Dependencies;
|
||||
|
||||
#endif
|
||||
|
||||
public:
|
||||
|
||||
AssetInitData()
|
||||
: SerializedVersion(0)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the hash code.
|
||||
/// </summary>
|
||||
/// <returns>Hash Code</returns>
|
||||
uint32 GetHashCode() const
|
||||
{
|
||||
// Note: do not use Metadata/Dependencies because it may not be loaded (it's optional)
|
||||
|
||||
uint32 hashCode = GetHash(Header.ID);
|
||||
hashCode = (hashCode * 397) ^ SerializedVersion;
|
||||
hashCode = (hashCode * 397) ^ CustomData.Length();
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "FlaxStorageReference.h"
|
||||
#include "Engine/Core/Types/TimeSpan.h"
|
||||
|
||||
class FlaxFile;
|
||||
class FlaxPackage;
|
||||
|
||||
@@ -5,10 +5,15 @@
|
||||
#include "FlaxPackage.h"
|
||||
#include "ContentStorageManager.h"
|
||||
#include "Engine/Core/Log.h"
|
||||
#include "Engine/Core/Types/TimeSpan.h"
|
||||
#include "Engine/Platform/File.h"
|
||||
#include "Engine/Serialization/FileWriteStream.h"
|
||||
#if USE_EDITOR
|
||||
#include "Engine/Serialization/JsonWriter.h"
|
||||
#include "Engine/Serialization/JsonWriters.h"
|
||||
#else
|
||||
#include "Engine/Engine/Globals.h"
|
||||
#endif
|
||||
#include <ThirdParty/LZ4/lz4.h>
|
||||
|
||||
String AssetHeader::ToString() const
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include "FlaxStorage.h"
|
||||
|
||||
/// <summary>
|
||||
/// Flax Storage Container Reference
|
||||
/// Flax Storage container reference.
|
||||
/// </summary>
|
||||
struct FLAXENGINE_API FlaxStorageReference
|
||||
{
|
||||
@@ -44,10 +44,8 @@ public:
|
||||
|
||||
public:
|
||||
|
||||
// Assignment operator
|
||||
FlaxStorageReference& operator=(const FlaxStorageReference& other)
|
||||
{
|
||||
// Protect against invalid self-assignment
|
||||
if (this != &other)
|
||||
{
|
||||
if (_storage)
|
||||
@@ -56,7 +54,6 @@ public:
|
||||
if (_storage)
|
||||
_storage->AddRef();
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#if USE_EDITOR
|
||||
|
||||
#include "BinaryAssetUpgrader.h"
|
||||
#include "Engine/Audio/AudioClip.h"
|
||||
#include "Engine/Tools/AudioTool/OggVorbisDecoder.h"
|
||||
@@ -130,3 +132,5 @@ private:
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#if USE_EDITOR
|
||||
|
||||
#include "IAssetUpgrader.h"
|
||||
#include "Engine/Content/Storage/AssetHeader.h"
|
||||
#include "Engine/Core/Log.h"
|
||||
@@ -205,3 +207,5 @@ public:
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#if USE_EDITOR
|
||||
|
||||
#include "BinaryAssetUpgrader.h"
|
||||
#include "Engine/Render2D/FontAsset.h"
|
||||
|
||||
@@ -71,3 +73,5 @@ private:
|
||||
return CopyChunk(context, 0);
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#if USE_EDITOR
|
||||
|
||||
#include "Engine/Core/Types/BaseTypes.h"
|
||||
|
||||
/// <summary>
|
||||
@@ -27,3 +29,5 @@ public:
|
||||
/// <returns>True if perform conversion, otherwise false.</returns>
|
||||
virtual bool ShouldUpgrade(uint32 serializedVersion) const = 0;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#if USE_EDITOR
|
||||
|
||||
#include "BinaryAssetUpgrader.h"
|
||||
#include "Engine/Core/Core.h"
|
||||
#include "Engine/Platform/Platform.h"
|
||||
@@ -105,3 +107,5 @@ private:
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#if USE_EDITOR
|
||||
|
||||
#include "BinaryAssetUpgrader.h"
|
||||
#include "Engine/Core/Core.h"
|
||||
#include "Engine/Platform/Platform.h"
|
||||
@@ -1223,3 +1225,5 @@ private:
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#if USE_EDITOR
|
||||
|
||||
#include "BinaryAssetUpgrader.h"
|
||||
#include "Engine/Platform/Platform.h"
|
||||
#include "Engine/Graphics/Shaders/Cache/ShaderStorage.h"
|
||||
@@ -86,3 +88,5 @@ private:
|
||||
return CopyChunks(context);
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#if USE_EDITOR
|
||||
|
||||
#include "BinaryAssetUpgrader.h"
|
||||
#include "Engine/Content/Assets/SkinnedModel.h"
|
||||
#include "Engine/Serialization/MemoryReadStream.h"
|
||||
@@ -97,3 +99,5 @@ private:
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#if USE_EDITOR
|
||||
|
||||
#include "BinaryAssetUpgrader.h"
|
||||
#include "Engine/Platform/Platform.h"
|
||||
#include "Engine/Serialization/MemoryReadStream.h"
|
||||
@@ -423,3 +425,5 @@ private:
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#if USE_EDITOR
|
||||
|
||||
#include "BinaryAssetUpgrader.h"
|
||||
#include "Engine/Core/Core.h"
|
||||
#include "Engine/Platform/Platform.h"
|
||||
@@ -825,3 +827,5 @@ private:
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#if COMPILE_WITH_ASSETS_IMPORTER
|
||||
|
||||
#include "Engine/Core/Log.h"
|
||||
#include "Engine/Core/Math/Math.h"
|
||||
#include "Engine/Platform/File.h"
|
||||
#include "Engine/Platform/FileSystem.h"
|
||||
#include "Engine/Content/Content.h"
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Engine/Core/Collections/Array.h"
|
||||
#include "Engine/Core/Memory/Memory.h"
|
||||
#include "Engine/Core/Collections/HashFunctions.h"
|
||||
#include "Engine/Core/Collections/Config.h"
|
||||
|
||||
@@ -781,7 +781,8 @@ public:
|
||||
/// Gets the keys collection to the output array (will contain unique items).
|
||||
/// </summary>
|
||||
/// <param name="result">The result.</param>
|
||||
void GetKeys(Array<KeyType>& result) const
|
||||
template<typename AllocationType>
|
||||
void GetKeys(Array<KeyType, AllocationType>& result) const
|
||||
{
|
||||
for (auto i = Begin(); i.IsNotEnd(); ++i)
|
||||
result.Add(i->Key);
|
||||
@@ -791,7 +792,8 @@ public:
|
||||
/// Gets the values collection to the output array (may contain duplicates).
|
||||
/// </summary>
|
||||
/// <param name="result">The result.</param>
|
||||
void GetValues(Array<ValueType>& result) const
|
||||
template<typename AllocationType>
|
||||
void GetValues(Array<ValueType, AllocationType>& result) const
|
||||
{
|
||||
for (auto i = Begin(); i.IsNotEnd(); ++i)
|
||||
result.Add(i->Value);
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
#pragma once
|
||||
|
||||
#include "Engine/Core/Templates.h"
|
||||
#include "Engine/Platform/Platform.h"
|
||||
#include <new>
|
||||
|
||||
#include "CrtAllocator.h"
|
||||
typedef CrtAllocator Allocator;
|
||||
|
||||
@@ -3,10 +3,9 @@
|
||||
#pragma once
|
||||
|
||||
#include "Span.h"
|
||||
#include "Engine/Core/Collections/Array.h"
|
||||
#include "Engine/Core/Templates.h"
|
||||
#include "Engine/Core/Memory/Memory.h"
|
||||
#include "Engine/Platform/Platform.h"
|
||||
#include "Engine/Serialization/WriteStream.h"
|
||||
#include "Engine/Serialization/ReadStream.h"
|
||||
|
||||
/// <summary>
|
||||
/// Universal utility class that can store the chunk of data or just reference to the memory.
|
||||
@@ -49,7 +48,8 @@ public:
|
||||
/// Initializes a new instance of the <see cref="DataContainer"/> class.
|
||||
/// </summary>
|
||||
/// <param name="data">The data array to link.</param>
|
||||
DataContainer(const Array<T>& data)
|
||||
template<typename AllocationType>
|
||||
DataContainer(const Array<T, AllocationType>& data)
|
||||
: Base((T*)data.Get(), data.Count())
|
||||
, _isAllocated(false)
|
||||
{
|
||||
@@ -147,7 +147,8 @@ public:
|
||||
/// Link external data
|
||||
/// </summary>
|
||||
/// <param name="data">Data array to link</param>
|
||||
void Link(const Array<T>& data)
|
||||
template<typename AllocationType>
|
||||
void Link(const Array<T, AllocationType>& data)
|
||||
{
|
||||
Link(data.Get(), data.Count());
|
||||
}
|
||||
@@ -217,7 +218,8 @@ public:
|
||||
/// Copies the data to a new allocated chunk
|
||||
/// </summary>
|
||||
/// <param name="data">Data array to copy</param>
|
||||
FORCE_INLINE void Copy(const Array<T>& data)
|
||||
template<typename AllocationType>
|
||||
FORCE_INLINE void Copy(const Array<T, AllocationType>& data)
|
||||
{
|
||||
if (data.HasItems())
|
||||
Copy(data.Get(), data.Count());
|
||||
@@ -347,10 +349,9 @@ public:
|
||||
|
||||
public:
|
||||
|
||||
template<typename ReadStream>
|
||||
void Read(ReadStream* stream, int32 length)
|
||||
{
|
||||
// Note: this may not work for the objects, use with primitive types and structures
|
||||
|
||||
ASSERT(stream != nullptr);
|
||||
Allocate(length);
|
||||
if (length > 0)
|
||||
@@ -359,10 +360,9 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
template<typename WriteStream>
|
||||
void Write(WriteStream* stream) const
|
||||
{
|
||||
// Note: this may not work for the objects, use with primitive types and structures
|
||||
|
||||
ASSERT(stream != nullptr);
|
||||
if (Base::_length > 0)
|
||||
{
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
#include "Engine/Platform/Platform.h"
|
||||
#include "Engine/Core/Math/Math.h"
|
||||
|
||||
const int32 DateTime::CachedDaysPerMonth[] = { 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
|
||||
const int32 DateTime::CachedDaysToMonth[] = { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 };
|
||||
const int32 CachedDaysPerMonth[] = { 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
|
||||
const int32 CachedDaysToMonth[] = { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 };
|
||||
|
||||
DateTime::DateTime(int32 year, int32 month, int32 day, int32 hour, int32 minute, int32 second, int32 millisecond)
|
||||
{
|
||||
@@ -25,6 +25,11 @@ DateTime::DateTime(int32 year, int32 month, int32 day, int32 hour, int32 minute,
|
||||
+ millisecond * Constants::TicksPerMillisecond;
|
||||
}
|
||||
|
||||
DateTime DateTime::GetDate() const
|
||||
{
|
||||
return DateTime(Ticks - Ticks % Constants::TicksPerDay);
|
||||
}
|
||||
|
||||
void DateTime::GetDate(int32& year, int32& month, int32& day) const
|
||||
{
|
||||
// Based on:
|
||||
@@ -68,6 +73,11 @@ int32 DateTime::GetDayOfYear() const
|
||||
return day;
|
||||
}
|
||||
|
||||
int32 DateTime::GetHour() const
|
||||
{
|
||||
return static_cast<int32>(Ticks / Constants::TicksPerHour % 24);
|
||||
}
|
||||
|
||||
int32 DateTime::GetHour12() const
|
||||
{
|
||||
const int32 hour = GetHour();
|
||||
@@ -78,6 +88,26 @@ int32 DateTime::GetHour12() const
|
||||
return hour;
|
||||
}
|
||||
|
||||
double DateTime::GetJulianDay() const
|
||||
{
|
||||
return 1721425.5 + static_cast<double>(Ticks) / Constants::TicksPerDay;
|
||||
}
|
||||
|
||||
double DateTime::GetModifiedJulianDay() const
|
||||
{
|
||||
return GetJulianDay() - 2400000.5;
|
||||
}
|
||||
|
||||
int32 DateTime::GetMillisecond() const
|
||||
{
|
||||
return static_cast<int32>(Ticks / Constants::TicksPerMillisecond % 1000);
|
||||
}
|
||||
|
||||
int32 DateTime::GetMinute() const
|
||||
{
|
||||
return static_cast<int32>(Ticks / Constants::TicksPerMinute % 60);
|
||||
}
|
||||
|
||||
int32 DateTime::GetMonth() const
|
||||
{
|
||||
int32 year, month, day;
|
||||
@@ -85,6 +115,21 @@ int32 DateTime::GetMonth() const
|
||||
return month;
|
||||
}
|
||||
|
||||
MonthOfYear DateTime::GetMonthOfYear() const
|
||||
{
|
||||
return static_cast<MonthOfYear>(GetMonth());
|
||||
}
|
||||
|
||||
int32 DateTime::GetSecond() const
|
||||
{
|
||||
return static_cast<int32>(Ticks / Constants::TicksPerSecond % 60);
|
||||
}
|
||||
|
||||
TimeSpan DateTime::GetTimeOfDay() const
|
||||
{
|
||||
return TimeSpan(Ticks % Constants::TicksPerDay);
|
||||
}
|
||||
|
||||
int32 DateTime::GetYear() const
|
||||
{
|
||||
int32 year, month, day;
|
||||
@@ -92,6 +137,11 @@ int32 DateTime::GetYear() const
|
||||
return year;
|
||||
}
|
||||
|
||||
int32 DateTime::ToUnixTimestamp() const
|
||||
{
|
||||
return static_cast<int32>((Ticks - DateTime(1970, 1, 1).Ticks) / Constants::TicksPerSecond);
|
||||
}
|
||||
|
||||
int32 DateTime::DaysInMonth(int32 year, int32 month)
|
||||
{
|
||||
ASSERT_LOW_LAYER((month >= 1) && (month <= 12));
|
||||
@@ -105,6 +155,16 @@ int32 DateTime::DaysInYear(int32 year)
|
||||
return IsLeapYear(year) ? 366 : 365;
|
||||
}
|
||||
|
||||
DateTime DateTime::FromJulianDay(double julianDay)
|
||||
{
|
||||
return DateTime(static_cast<int64>((julianDay - 1721425.5) * Constants::TicksPerDay));
|
||||
}
|
||||
|
||||
DateTime DateTime::FromUnixTimestamp(int32 unixTime)
|
||||
{
|
||||
return DateTime(1970, 1, 1) + TimeSpan(static_cast<int64>(unixTime) * Constants::TicksPerSecond);
|
||||
}
|
||||
|
||||
bool DateTime::IsLeapYear(int32 year)
|
||||
{
|
||||
if ((year % 4) == 0)
|
||||
@@ -114,6 +174,11 @@ bool DateTime::IsLeapYear(int32 year)
|
||||
return false;
|
||||
}
|
||||
|
||||
DateTime DateTime::MaxValue()
|
||||
{
|
||||
return DateTime(3652059 * Constants::TicksPerDay - 1);
|
||||
}
|
||||
|
||||
DateTime DateTime::Now()
|
||||
{
|
||||
int32 year, month, day, dayOfWeek, hour, minute, second, millisecond;
|
||||
@@ -144,3 +209,30 @@ String DateTime::ToFileNameString() const
|
||||
GetDate(year, month, day);
|
||||
return String::Format(TEXT("{0}_{1:0>2}_{2:0>2}_{3:0>2}_{4:0>2}_{5:0>2}"), year, month, day, GetHour(), GetMinute(), GetSecond());
|
||||
}
|
||||
|
||||
DateTime DateTime::operator+(const TimeSpan& other) const
|
||||
{
|
||||
return DateTime(Ticks + other.Ticks);
|
||||
}
|
||||
|
||||
DateTime& DateTime::operator+=(const TimeSpan& other)
|
||||
{
|
||||
Ticks += other.Ticks;
|
||||
return *this;
|
||||
}
|
||||
|
||||
TimeSpan DateTime::operator-(const DateTime& other) const
|
||||
{
|
||||
return TimeSpan(Ticks - other.Ticks);
|
||||
}
|
||||
|
||||
DateTime DateTime::operator-(const TimeSpan& other) const
|
||||
{
|
||||
return DateTime(Ticks - other.Ticks);
|
||||
}
|
||||
|
||||
DateTime& DateTime::operator-=(const TimeSpan& other)
|
||||
{
|
||||
Ticks -= other.Ticks;
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
#pragma once
|
||||
|
||||
#include "BaseTypes.h"
|
||||
#include "TimeSpan.h"
|
||||
#include "Engine/Core/Formatting.h"
|
||||
#include "Engine/Core/Templates.h"
|
||||
#include "Engine/Core/Enums.h"
|
||||
|
||||
/// <summary>
|
||||
@@ -21,11 +22,6 @@ DECLARE_ENUM_EX_12(MonthOfYear, int32, 1, January, February, March, April, May,
|
||||
/// </summary>
|
||||
API_STRUCT(InBuild, Namespace="System") struct FLAXENGINE_API DateTime
|
||||
{
|
||||
private:
|
||||
|
||||
static const int32 CachedDaysPerMonth[];
|
||||
static const int32 CachedDaysToMonth[];
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
@@ -77,32 +73,11 @@ public:
|
||||
|
||||
public:
|
||||
|
||||
DateTime operator+(const TimeSpan& other) const
|
||||
{
|
||||
return DateTime(Ticks + other.Ticks);
|
||||
}
|
||||
|
||||
DateTime& operator+=(const TimeSpan& other)
|
||||
{
|
||||
Ticks += other.Ticks;
|
||||
return *this;
|
||||
}
|
||||
|
||||
TimeSpan operator-(const DateTime& other) const
|
||||
{
|
||||
return TimeSpan(Ticks - other.Ticks);
|
||||
}
|
||||
|
||||
DateTime operator-(const TimeSpan& other) const
|
||||
{
|
||||
return DateTime(Ticks - other.Ticks);
|
||||
}
|
||||
|
||||
DateTime& operator-=(const TimeSpan& other)
|
||||
{
|
||||
Ticks -= other.Ticks;
|
||||
return *this;
|
||||
}
|
||||
DateTime operator+(const TimeSpan& other) const;
|
||||
DateTime& operator+=(const TimeSpan& other);
|
||||
TimeSpan operator-(const DateTime& other) const;
|
||||
DateTime operator-(const TimeSpan& other) const;
|
||||
DateTime& operator-=(const TimeSpan& other);
|
||||
|
||||
bool operator==(const DateTime& other) const
|
||||
{
|
||||
@@ -139,11 +114,7 @@ public:
|
||||
/// <summary>
|
||||
/// Gets the date part of this date. The time part is truncated and becomes 00:00:00.000.
|
||||
/// </summary>
|
||||
/// <returns>A DateTime object containing the date.</returns>
|
||||
DateTime GetDate() const
|
||||
{
|
||||
return DateTime(Ticks - Ticks % Constants::TicksPerDay);
|
||||
}
|
||||
DateTime GetDate() const;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the date components of this date.
|
||||
@@ -156,106 +127,68 @@ public:
|
||||
/// <summary>
|
||||
/// Gets this date's day part (1 to 31).
|
||||
/// </summary>
|
||||
/// <returns>The day of the month.</returns>
|
||||
int32 GetDay() const;
|
||||
|
||||
/// <summary>
|
||||
/// Calculates this date's day of the week (Sunday - Saturday).
|
||||
/// </summary>
|
||||
/// <returns>The week day.</returns>
|
||||
DayOfWeek GetDayOfWeek() const;
|
||||
|
||||
/// <summary>
|
||||
/// Gets this date's day of the year.
|
||||
/// </summary>
|
||||
/// <returns>The day of year.</returns>
|
||||
int32 GetDayOfYear() const;
|
||||
|
||||
/// <summary>
|
||||
/// Gets this date's hour part in 24-hour clock format (0 to 23).
|
||||
/// </summary>
|
||||
/// <returns>The hour.</returns>
|
||||
int32 GetHour() const
|
||||
{
|
||||
return static_cast<int32>(Ticks / Constants::TicksPerHour % 24);
|
||||
}
|
||||
int32 GetHour() const;
|
||||
|
||||
/// <summary>
|
||||
/// Gets this date's hour part in 12-hour clock format (1 to 12).
|
||||
/// </summary>
|
||||
/// <returns>The hour in AM/PM format.</returns>
|
||||
int32 GetHour12() const;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Julian Day for this date.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The Julian Day is the number of days since the inception of the Julian calendar at noon on Monday, January 1, 4713 B.C.E. The minimum Julian Day that can be represented in DateTime is 1721425.5, which corresponds to Monday, January 1, 0001 in the Gregorian calendar.
|
||||
/// </remarks>
|
||||
/// <returns>Julian Day.</returns>
|
||||
double GetJulianDay() const
|
||||
{
|
||||
return 1721425.5 + static_cast<double>(Ticks) / Constants::TicksPerDay;
|
||||
}
|
||||
/// <remarks>The Julian Day is the number of days since the inception of the Julian calendar at noon on Monday, January 1, 4713 B.C.E. The minimum Julian Day that can be represented in DateTime is 1721425.5, which corresponds to Monday, January 1, 0001 in the Gregorian calendar.</remarks>
|
||||
double GetJulianDay() const;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Modified Julian day.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The Modified Julian Day is calculated by subtracting 2400000.5, which corresponds to midnight UTC on November 17, 1858 in the Gregorian calendar.
|
||||
/// </remarks>
|
||||
/// <returns>The Modified Julian Day.</returns>
|
||||
double GetModifiedJulianDay() const
|
||||
{
|
||||
return GetJulianDay() - 2400000.5;
|
||||
}
|
||||
/// <remarks>The Modified Julian Day is calculated by subtracting 2400000.5, which corresponds to midnight UTC on November 17, 1858 in the Gregorian calendar.</remarks>
|
||||
double GetModifiedJulianDay() const;
|
||||
|
||||
/// <summary>
|
||||
/// Gets this date's millisecond part (0 to 999).
|
||||
/// </summary>
|
||||
/// <returns>The millisecond.</returns>
|
||||
int32 GetMillisecond() const
|
||||
{
|
||||
return static_cast<int32>(Ticks / Constants::TicksPerMillisecond % 1000);
|
||||
}
|
||||
int32 GetMillisecond() const;
|
||||
|
||||
/// <summary>
|
||||
/// Gets this date's minute part (0 to 59).
|
||||
/// </summary>
|
||||
/// <returns>The minute.</returns>
|
||||
int32 GetMinute() const
|
||||
{
|
||||
return static_cast<int32>(Ticks / Constants::TicksPerMinute % 60);
|
||||
}
|
||||
int32 GetMinute() const;
|
||||
|
||||
/// <summary>
|
||||
/// Gets this date's the month part (1 to 12).
|
||||
/// </summary>
|
||||
/// <returns>The month.</returns>
|
||||
int32 GetMonth() const;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the date's month of the year (January to December).
|
||||
/// </summary>
|
||||
/// <returns>The month of year.</returns>
|
||||
MonthOfYear GetMonthOfYear() const
|
||||
{
|
||||
return static_cast<MonthOfYear>(GetMonth());
|
||||
}
|
||||
MonthOfYear GetMonthOfYear() const;
|
||||
|
||||
/// <summary>
|
||||
/// Gets this date's second part.
|
||||
/// </summary>
|
||||
/// <returns>The second.</returns>
|
||||
int32 GetSecond() const
|
||||
{
|
||||
return static_cast<int32>(Ticks / Constants::TicksPerSecond % 60);
|
||||
}
|
||||
int32 GetSecond() const;
|
||||
|
||||
/// <summary>
|
||||
/// Gets this date's representation as number of ticks.
|
||||
/// Gets this date's representation as number of ticks since midnight, January 1, 0001.
|
||||
/// </summary>
|
||||
/// <returns>The number of ticks since midnight, January 1, 0001.</returns>
|
||||
int64 GetTicks() const
|
||||
{
|
||||
return Ticks;
|
||||
@@ -264,26 +197,17 @@ public:
|
||||
/// <summary>
|
||||
/// Gets the time elapsed since midnight of this date.
|
||||
/// </summary>
|
||||
/// <returns>The time span since midnight.</returns>
|
||||
TimeSpan GetTimeOfDay() const
|
||||
{
|
||||
return TimeSpan(Ticks % Constants::TicksPerDay);
|
||||
}
|
||||
TimeSpan GetTimeOfDay() const;
|
||||
|
||||
/// <summary>
|
||||
/// Gets this date's year part.
|
||||
/// </summary>
|
||||
/// <returns>The year.</returns>
|
||||
int32 GetYear() const;
|
||||
|
||||
/// <summary>
|
||||
/// Gets this date as the number of seconds since the Unix Epoch (January 1st of 1970).
|
||||
/// </summary>
|
||||
/// <returns>The time.</returns>
|
||||
int32 ToUnixTimestamp() const
|
||||
{
|
||||
return static_cast<int32>((Ticks - DateTime(1970, 1, 1).Ticks) / Constants::TicksPerSecond);
|
||||
}
|
||||
int32 ToUnixTimestamp() const;
|
||||
|
||||
public:
|
||||
|
||||
@@ -307,27 +231,19 @@ public:
|
||||
/// </summary>
|
||||
/// <param name="julianDay">The Julian Day.</param>
|
||||
/// <returns>Gregorian date and time.</returns>
|
||||
static DateTime FromJulianDay(double julianDay)
|
||||
{
|
||||
return DateTime(static_cast<int64>((julianDay - 1721425.5) * Constants::TicksPerDay));
|
||||
}
|
||||
static DateTime FromJulianDay(double julianDay);
|
||||
|
||||
/// <summary>
|
||||
/// Returns the date from Unix time (seconds from midnight 1970-01-01).
|
||||
/// </summary>
|
||||
/// <param name="unixTime">The Unix time (seconds from midnight 1970-01-01).</param>
|
||||
/// <returns>The Gregorian date and time.</returns>
|
||||
static DateTime FromUnixTimestamp(int32 unixTime)
|
||||
{
|
||||
return DateTime(1970, 1, 1) + TimeSpan(static_cast<int64>(unixTime) * Constants::TicksPerSecond);
|
||||
}
|
||||
static DateTime FromUnixTimestamp(int32 unixTime);
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the specified year is a leap year.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// A leap year is a year containing one additional day in order to keep the calendar synchronized with the astronomical year.
|
||||
/// </remarks>
|
||||
/// <remarks>A leap year is a year containing one additional day in order to keep the calendar synchronized with the astronomical year.</remarks>
|
||||
/// <param name="year">The year.</param>
|
||||
/// <returns><c>true</c> if the specified year os a leap year; otherwise, <c>false</c>.</returns>
|
||||
static bool IsLeapYear(int32 year);
|
||||
@@ -335,22 +251,15 @@ public:
|
||||
/// <summary>
|
||||
/// Returns the maximum date value.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The maximum date value is December 31, 9999, 23:59:59.9999999.
|
||||
/// </remarks>
|
||||
/// <returns>The date.</returns>
|
||||
static DateTime MaxValue()
|
||||
{
|
||||
return DateTime(3652059 * Constants::TicksPerDay - 1);
|
||||
}
|
||||
/// <remarks>The maximum date value is December 31, 9999, 23:59:59.9999999.</remarks>
|
||||
/// <returns>The maximum valid date.</returns>
|
||||
static DateTime MaxValue();
|
||||
|
||||
/// <summary>
|
||||
/// Returns the minimum date value.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The minimum date value is January 1, 0001, 00:00:00.0.
|
||||
/// </remarks>
|
||||
/// <returns>The date.</returns>
|
||||
/// <remarks>The minimum date value is January 1, 0001, 00:00:00.0.</remarks>
|
||||
/// <returns>The minimum valid date.</returns>
|
||||
static DateTime MinValue()
|
||||
{
|
||||
return DateTime(1, 1, 1, 0, 0, 0, 0);
|
||||
@@ -359,18 +268,14 @@ public:
|
||||
/// <summary>
|
||||
/// Gets the local date and time on this computer.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
///This method takes into account the local computer's time zone and daylight saving settings. For time zone independent time comparisons, and when comparing times between different computers, use NowUTC() instead.
|
||||
/// </remarks>
|
||||
/// <remarks>This method takes into account the local computer's time zone and daylight saving settings. For time zone independent time comparisons, and when comparing times between different computers, use NowUTC() instead.</remarks>
|
||||
/// <returns>The current date and time.</returns>
|
||||
static DateTime Now();
|
||||
|
||||
/// <summary>
|
||||
/// Gets the UTC date and time on this computer.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This method returns the Coordinated Universal Time (UTC), which does not take the local computer's time zone and daylight savings settings into account. It should be used when comparing dates and times that should be independent of the user's locale. To get the date and time in the current locale, use Now() instead.
|
||||
/// </remarks>
|
||||
/// <remarks>This method returns the Coordinated Universal Time (UTC), which does not take the local computer's time zone and daylight savings settings into account. It should be used when comparing dates and times that should be independent of the user's locale. To get the date and time in the current locale, use Now() instead.</remarks>
|
||||
/// <returns>The current date and time.</returns>
|
||||
static DateTime NowUTC();
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "Engine/Platform/Platform.h"
|
||||
#include "Engine/Platform/StringUtils.h"
|
||||
#include "Engine/Core/Formatting.h"
|
||||
#include "Engine/Core/Templates.h"
|
||||
|
||||
/// <summary>
|
||||
/// Represents text as a sequence of characters. Container uses a single dynamic memory allocation to store the characters data. Characters sequence is always null-terminated.
|
||||
|
||||
@@ -66,7 +66,6 @@ public:
|
||||
/// <summary>
|
||||
/// Returns true if string is empty.
|
||||
/// </summary>
|
||||
/// <returns>True if string is empty, otherwise false.</returns>
|
||||
FORCE_INLINE bool IsEmpty() const
|
||||
{
|
||||
return _length == 0;
|
||||
@@ -75,7 +74,6 @@ public:
|
||||
/// <summary>
|
||||
/// Returns true if string isn't empty.
|
||||
/// </summary>
|
||||
/// <returns>True if string isn't empty, otherwise false.</returns>
|
||||
FORCE_INLINE bool HasChars() const
|
||||
{
|
||||
return _length != 0;
|
||||
@@ -84,7 +82,6 @@ public:
|
||||
/// <summary>
|
||||
/// Gets the length of the string.
|
||||
/// </summary>
|
||||
/// <returns>The string length.</returns>
|
||||
FORCE_INLINE int32 Length() const
|
||||
{
|
||||
return _length;
|
||||
@@ -93,7 +90,6 @@ public:
|
||||
/// <summary>
|
||||
/// Gets the pointer to the string.
|
||||
/// </summary>
|
||||
/// <returns>The string.</returns>
|
||||
FORCE_INLINE const T* operator*() const
|
||||
{
|
||||
return _data;
|
||||
@@ -102,7 +98,6 @@ public:
|
||||
/// <summary>
|
||||
/// Gets the pointer to the string.
|
||||
/// </summary>
|
||||
/// <returns>The string.</returns>
|
||||
FORCE_INLINE const T* Get() const
|
||||
{
|
||||
return _data;
|
||||
@@ -111,7 +106,6 @@ public:
|
||||
/// <summary>
|
||||
/// Gets the pointer to the string or to the static empty text if string is null. Returned pointer is always valid (read-only).
|
||||
/// </summary>
|
||||
/// <returns>The string handle.</returns>
|
||||
FORCE_INLINE const T* GetText() const
|
||||
{
|
||||
return _data ? _data : (const T*)TEXT("");
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "BaseTypes.h"
|
||||
#include "Engine/Platform/Platform.h"
|
||||
#include "Engine/Core/Formatting.h"
|
||||
#include "Engine/Core/Templates.h"
|
||||
|
||||
|
||||
@@ -12,11 +12,13 @@
|
||||
#include "Engine/Content/Assets/Shader.h"
|
||||
#include "Engine/Content/AssetReference.h"
|
||||
#include "Engine/Graphics/GPUContext.h"
|
||||
#include "Engine/Graphics/RenderTask.h"
|
||||
#include "Engine/Graphics/DynamicBuffer.h"
|
||||
#include "Engine/Graphics/GPUDevice.h"
|
||||
#include "Engine/Graphics/GPUPipelineState.h"
|
||||
#include "Engine/Graphics/Shaders/GPUConstantBuffer.h"
|
||||
#include "Engine/Graphics/RenderTask.h"
|
||||
#include "Engine/Graphics/RenderBuffers.h"
|
||||
#include "Engine/Graphics/DynamicBuffer.h"
|
||||
#include "Engine/Graphics/Shaders/GPUConstantBuffer.h"
|
||||
#include "Engine/Graphics/Shaders/GPUShader.h"
|
||||
#include "Engine/Animations/AnimationUtils.h"
|
||||
#include "Engine/Profiler/Profiler.h"
|
||||
#include "Engine/Debug/DebugLog.h"
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include "Engine/Scripting/ManagedCLR/MDomain.h"
|
||||
#include "Engine/Scripting/ManagedCLR/MAssembly.h"
|
||||
#include "Engine/Scripting/ManagedCLR/MClass.h"
|
||||
#include "Engine/Threading/Threading.h"
|
||||
#include "FlaxEngine.Gen.h"
|
||||
#include <ThirdParty/mono-2.0/mono/metadata/exception.h>
|
||||
#include <ThirdParty/mono-2.0/mono/metadata/appdomain.h>
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
#include "Engine/Engine/Time.h"
|
||||
#include "Engine/Engine/Engine.h"
|
||||
#include "Engine/Engine/Globals.h"
|
||||
#include "Engine/Platform/Window.h"
|
||||
#include "Engine/Profiler/Profiler.h"
|
||||
#include "Engine/Level/Level.h"
|
||||
@@ -17,6 +18,7 @@
|
||||
#include "Engine/Graphics/RenderTask.h"
|
||||
#include "Engine/Render2D/Render2D.h"
|
||||
#include "Engine/Graphics/GPUDevice.h"
|
||||
#include "Engine/Graphics/Textures/GPUTexture.h"
|
||||
#include "Engine/Utilities/Encryption.h"
|
||||
#include "Engine/Core/Log.h"
|
||||
#include "FlaxEngine.Gen.h"
|
||||
@@ -241,7 +243,7 @@ void GameBaseImpl::OnPostRender(GPUContext* context, RenderContext& renderContex
|
||||
const Rectangle screenRect(viewport.X, viewport.Y, viewport.Width, viewport.Height);
|
||||
Rectangle imageArea = screenRect;
|
||||
imageArea.Scale(0.6f);
|
||||
const float aspectRatio = static_cast<float>(splashScreen->Width()) / splashScreen->Height();
|
||||
const float aspectRatio = static_cast<float>(splashScreen->Width()) / static_cast<float>(splashScreen->Height());
|
||||
const float height = imageArea.GetWidth() / aspectRatio;
|
||||
imageArea.Location.Y += (imageArea.GetHeight() - height) * 0.5f;
|
||||
imageArea.Size.Y = height;
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
#include "Engine/Content/Factories/BinaryAssetFactory.h"
|
||||
#include "Engine/Content/Upgraders/BinaryAssetUpgrader.h"
|
||||
|
||||
#if USE_EDITOR
|
||||
|
||||
class GameplayGlobalsUpgrader : public BinaryAssetUpgrader
|
||||
{
|
||||
public:
|
||||
@@ -50,7 +52,9 @@ private:
|
||||
}
|
||||
};
|
||||
|
||||
REGISTER_BINARY_ASSET(GameplayGlobals, "FlaxEngine.GameplayGlobals", ::New<GameplayGlobalsUpgrader>(), true);
|
||||
#endif
|
||||
|
||||
REGISTER_BINARY_ASSET_WITH_UPGRADER(GameplayGlobals, "FlaxEngine.GameplayGlobals", GameplayGlobalsUpgrader, true);
|
||||
|
||||
GameplayGlobals::GameplayGlobals(const SpawnParams& params, const AssetInfo* info)
|
||||
: BinaryAsset(params, info)
|
||||
|
||||
@@ -25,4 +25,3 @@ int32 Globals::EngineBuildNumber = FLAXENGINE_VERSION_BUILD;
|
||||
String Globals::ProductName;
|
||||
String Globals::CompanyName;
|
||||
int32 Globals::ContentKey;
|
||||
bool Globals::ConvertLoadedMaterialsByForce;
|
||||
|
||||
@@ -94,7 +94,4 @@ DECLARE_SCRIPTING_TYPE_NO_SPAWN(Globals);
|
||||
/// The content data keycode.
|
||||
/// </summary>
|
||||
static int32 ContentKey;
|
||||
|
||||
// True if convert all loaded material by force
|
||||
static bool ConvertLoadedMaterialsByForce;
|
||||
};
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "FoliageCluster.h"
|
||||
#include "Engine/Core/Random.h"
|
||||
#include "Engine/Engine/Engine.h"
|
||||
#include "Engine/Graphics/RenderTask.h"
|
||||
#include "Engine/Level/Scene/Scene.h"
|
||||
#include "Engine/Level/SceneQuery.h"
|
||||
#include "Engine/Profiler/ProfilerCPU.h"
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include "RenderTask.h"
|
||||
#include "RenderTools.h"
|
||||
#include "Graphics.h"
|
||||
#include "Shaders/GPUShader.h"
|
||||
#include "Async/DefaultGPUTasksExecutor.h"
|
||||
#include "Engine/Content/Assets/Shader.h"
|
||||
#include "Engine/Content/Assets/Material.h"
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
#include "MaterialParams.h"
|
||||
#include "MaterialInfo.h"
|
||||
#include "Engine/Core/Math/Vector4.h"
|
||||
#include "Engine/Core/Math/Matrix.h"
|
||||
#include "Engine/Content/Content.h"
|
||||
#include "Engine/Graphics/GPUContext.h"
|
||||
#include "Engine/Engine/GameplayGlobals.h"
|
||||
@@ -96,11 +98,11 @@ Variant MaterialParameter::GetValue() const
|
||||
case MaterialParameterType::Vector3:
|
||||
return _asVector3;
|
||||
case MaterialParameterType::Vector4:
|
||||
return _asVector4;
|
||||
return *(Vector4*)&AsData;
|
||||
case MaterialParameterType::Color:
|
||||
return _asColor;
|
||||
case MaterialParameterType::Matrix:
|
||||
return Variant(_asMatrix);
|
||||
return Variant(*(Matrix*)&AsData);
|
||||
case MaterialParameterType::NormalMap:
|
||||
case MaterialParameterType::Texture:
|
||||
case MaterialParameterType::CubeTexture:
|
||||
@@ -140,13 +142,13 @@ void MaterialParameter::SetValue(const Variant& value)
|
||||
_asVector3 = (Vector3)value;
|
||||
break;
|
||||
case MaterialParameterType::Vector4:
|
||||
_asVector4 = (Vector4)value;
|
||||
*(Vector4*)&AsData = (Vector4)value;
|
||||
break;
|
||||
case MaterialParameterType::Color:
|
||||
_asColor = (Color)value;
|
||||
break;
|
||||
case MaterialParameterType::Matrix:
|
||||
_asMatrix = (Matrix)value;
|
||||
*(Matrix*)&AsData = (Matrix)value;
|
||||
break;
|
||||
case MaterialParameterType::NormalMap:
|
||||
case MaterialParameterType::Texture:
|
||||
@@ -245,13 +247,13 @@ void MaterialParameter::Bind(BindMeta& meta) const
|
||||
*((Vector3*)(meta.Constants + _offset)) = _asVector3;
|
||||
break;
|
||||
case MaterialParameterType::Vector4:
|
||||
*((Vector4*)(meta.Constants + _offset)) = _asVector4;
|
||||
*((Vector4*)(meta.Constants + _offset)) = *(Vector4*)&AsData;
|
||||
break;
|
||||
case MaterialParameterType::Color:
|
||||
*((Color*)(meta.Constants + _offset)) = _asColor;
|
||||
break;
|
||||
case MaterialParameterType::Matrix:
|
||||
Matrix::Transpose(_asMatrix, *(Matrix*)(meta.Constants + _offset));
|
||||
Matrix::Transpose(*(Matrix*)&AsData, *(Matrix*)(meta.Constants + _offset));
|
||||
break;
|
||||
case MaterialParameterType::NormalMap:
|
||||
{
|
||||
@@ -406,13 +408,13 @@ void MaterialParameter::clone(const MaterialParameter* param)
|
||||
_asVector3 = param->_asVector3;
|
||||
break;
|
||||
case MaterialParameterType::Vector4:
|
||||
_asVector4 = param->_asVector4;
|
||||
*(Vector4*)&AsData = *(Vector4*)¶m->AsData;
|
||||
break;
|
||||
case MaterialParameterType::Color:
|
||||
_asColor = param->_asColor;
|
||||
break;
|
||||
case MaterialParameterType::Matrix:
|
||||
_asMatrix = param->_asMatrix;
|
||||
*(Matrix*)&AsData = *(Matrix*)¶m->AsData;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -585,13 +587,13 @@ bool MaterialParams::Load(ReadStream* stream)
|
||||
stream->Read(¶m->_asVector3);
|
||||
break;
|
||||
case MaterialParameterType::Vector4:
|
||||
stream->Read(¶m->_asVector4);
|
||||
stream->Read((Vector4*)¶m->AsData);
|
||||
break;
|
||||
case MaterialParameterType::Color:
|
||||
stream->Read(¶m->_asColor);
|
||||
break;
|
||||
case MaterialParameterType::Matrix:
|
||||
stream->Read(¶m->_asMatrix);
|
||||
stream->Read((Matrix*)¶m->AsData);
|
||||
break;
|
||||
case MaterialParameterType::NormalMap:
|
||||
case MaterialParameterType::Texture:
|
||||
@@ -658,13 +660,13 @@ bool MaterialParams::Load(ReadStream* stream)
|
||||
stream->Read(¶m->_asVector3);
|
||||
break;
|
||||
case MaterialParameterType::Vector4:
|
||||
stream->Read(¶m->_asVector4);
|
||||
stream->Read((Vector4*)¶m->AsData);
|
||||
break;
|
||||
case MaterialParameterType::Color:
|
||||
stream->Read(¶m->_asColor);
|
||||
break;
|
||||
case MaterialParameterType::Matrix:
|
||||
stream->Read(¶m->_asMatrix);
|
||||
stream->Read((Matrix*)¶m->AsData);
|
||||
break;
|
||||
case MaterialParameterType::NormalMap:
|
||||
case MaterialParameterType::Texture:
|
||||
@@ -732,13 +734,13 @@ bool MaterialParams::Load(ReadStream* stream)
|
||||
stream->Read(¶m->_asVector3);
|
||||
break;
|
||||
case MaterialParameterType::Vector4:
|
||||
stream->Read(¶m->_asVector4);
|
||||
stream->Read((Vector4*)¶m->AsData);
|
||||
break;
|
||||
case MaterialParameterType::Color:
|
||||
stream->Read(¶m->_asColor);
|
||||
break;
|
||||
case MaterialParameterType::Matrix:
|
||||
stream->Read(¶m->_asMatrix);
|
||||
stream->Read((Matrix*)¶m->AsData);
|
||||
break;
|
||||
case MaterialParameterType::NormalMap:
|
||||
case MaterialParameterType::Texture:
|
||||
@@ -824,13 +826,13 @@ void MaterialParams::Save(WriteStream* stream)
|
||||
stream->Write(¶m->_asVector3);
|
||||
break;
|
||||
case MaterialParameterType::Vector4:
|
||||
stream->Write(¶m->_asVector4);
|
||||
stream->Write((Vector4*)¶m->AsData);
|
||||
break;
|
||||
case MaterialParameterType::Color:
|
||||
stream->Write(¶m->_asColor);
|
||||
break;
|
||||
case MaterialParameterType::Matrix:
|
||||
stream->Write(¶m->_asMatrix);
|
||||
stream->Write((Matrix*)¶m->AsData);
|
||||
break;
|
||||
case MaterialParameterType::NormalMap:
|
||||
case MaterialParameterType::Texture:
|
||||
@@ -898,13 +900,13 @@ void MaterialParams::Save(WriteStream* stream, const Array<SerializedMaterialPar
|
||||
stream->Write(¶m.AsVector3);
|
||||
break;
|
||||
case MaterialParameterType::Vector4:
|
||||
stream->Write(¶m.AsVector4);
|
||||
stream->Write((Vector4*)¶m.AsData);
|
||||
break;
|
||||
case MaterialParameterType::Color:
|
||||
stream->Write(¶m.AsColor);
|
||||
break;
|
||||
case MaterialParameterType::Matrix:
|
||||
stream->Write(¶m.AsMatrix);
|
||||
stream->Write((Matrix*)¶m.AsData);
|
||||
break;
|
||||
case MaterialParameterType::NormalMap:
|
||||
case MaterialParameterType::Texture:
|
||||
|
||||
@@ -2,7 +2,9 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Engine/Core/Math/Matrix.h"
|
||||
#include "Engine/Core/Math/Color.h"
|
||||
#include "Engine/Core/Math/Vector2.h"
|
||||
#include "Engine/Core/Math/Vector3.h"
|
||||
#include "Engine/Core/Types/StringView.h"
|
||||
#include "Engine/Core/Collections/Array.h"
|
||||
#include "Engine/Scripting/ScriptingObjectReference.h"
|
||||
@@ -12,6 +14,7 @@
|
||||
class MaterialInstance;
|
||||
class MaterialParams;
|
||||
class GPUContext;
|
||||
class GPUTextureView;
|
||||
class RenderBuffers;
|
||||
|
||||
struct MaterialParamsLink
|
||||
@@ -143,10 +146,9 @@ struct SerializedMaterialParam
|
||||
float AsFloat;
|
||||
Vector2 AsVector2;
|
||||
Vector3 AsVector3;
|
||||
Vector4 AsVector4;
|
||||
Color AsColor;
|
||||
Guid AsGuid;
|
||||
Matrix AsMatrix;
|
||||
byte AsData[16 * 4];
|
||||
};
|
||||
|
||||
byte RegisterIndex;
|
||||
@@ -181,9 +183,8 @@ private:
|
||||
float _asFloat;
|
||||
Vector2 _asVector2;
|
||||
Vector3 _asVector3;
|
||||
Vector4 _asVector4;
|
||||
Color _asColor;
|
||||
Matrix _asMatrix;
|
||||
byte AsData[16 * 4];
|
||||
};
|
||||
|
||||
AssetReference<Asset> _asAsset;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
#include "MaterialShaderFeatures.h"
|
||||
#include "Engine/Graphics/RenderTask.h"
|
||||
#include "Engine/Graphics/Textures/GPUTexture.h"
|
||||
#include "Engine/Renderer/RenderList.h"
|
||||
#include "Engine/Renderer/ShadowsPass.h"
|
||||
#if USE_EDITOR
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
#include "Engine/Content/Assets/Material.h"
|
||||
#include "Engine/Content/Assets/Model.h"
|
||||
#include "Engine/Graphics/GPUContext.h"
|
||||
#include "Engine/Graphics/GPUDevice.h"
|
||||
#include "Engine/Graphics/RenderTask.h"
|
||||
#include "Engine/Level/Scene/Scene.h"
|
||||
#include "Engine/Renderer/RenderList.h"
|
||||
#include "Engine/Serialization/MemoryReadStream.h"
|
||||
@@ -131,6 +133,11 @@ namespace
|
||||
}
|
||||
}
|
||||
|
||||
bool Mesh::HasVertexColors() const
|
||||
{
|
||||
return _vertexBuffers[2] != nullptr && _vertexBuffers[2]->IsAllocated();
|
||||
}
|
||||
|
||||
bool Mesh::UpdateMesh(uint32 vertexCount, uint32 triangleCount, VB0ElementType* vb0, VB1ElementType* vb1, VB2ElementType* vb2, void* ib, bool use16BitIndices)
|
||||
{
|
||||
auto model = (Model*)_model;
|
||||
|
||||
@@ -3,15 +3,16 @@
|
||||
#pragma once
|
||||
|
||||
#include "MeshBase.h"
|
||||
#include "Engine/Renderer/RenderList.h"
|
||||
#include "Engine/Graphics/RenderTask.h"
|
||||
#include "ModelInstanceEntry.h"
|
||||
#include "Config.h"
|
||||
#include "Types.h"
|
||||
#include "Engine/Level/Types.h"
|
||||
#if USE_PRECISE_MESH_INTERSECTS
|
||||
#include "CollisionProxy.h"
|
||||
#endif
|
||||
|
||||
struct GeometryDrawStateData;
|
||||
class Lightmap;
|
||||
class GPUBuffer;
|
||||
|
||||
/// <summary>
|
||||
@@ -21,7 +22,6 @@ API_CLASS(NoSpawn) class FLAXENGINE_API Mesh : public MeshBase
|
||||
{
|
||||
DECLARE_SCRIPTING_TYPE_WITH_CONSTRUCTOR_IMPL(Mesh, MeshBase);
|
||||
protected:
|
||||
|
||||
int32 _index;
|
||||
int32 _lodIndex;
|
||||
bool _hasLightmapUVs;
|
||||
@@ -32,7 +32,6 @@ protected:
|
||||
#endif
|
||||
|
||||
public:
|
||||
|
||||
Mesh(const Mesh& other)
|
||||
: Mesh()
|
||||
{
|
||||
@@ -47,7 +46,6 @@ public:
|
||||
~Mesh();
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Gets the model owning this mesh.
|
||||
/// </summary>
|
||||
@@ -104,10 +102,7 @@ public:
|
||||
/// Determines whether this mesh has a vertex colors buffer.
|
||||
/// </summary>
|
||||
/// <returns>True if this mesh has a vertex colors buffers.</returns>
|
||||
API_PROPERTY() FORCE_INLINE bool HasVertexColors() const
|
||||
{
|
||||
return _vertexBuffers[2] != nullptr && _vertexBuffers[2]->IsAllocated();
|
||||
}
|
||||
API_PROPERTY() bool HasVertexColors() const;
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether this mesh contains valid lightmap texture coordinates data.
|
||||
@@ -132,7 +127,6 @@ public:
|
||||
#endif
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Updates the model mesh (used by the virtual models created with Init rather than Load).
|
||||
/// </summary>
|
||||
@@ -211,7 +205,6 @@ public:
|
||||
bool UpdateMesh(uint32 vertexCount, uint32 triangleCount, Vector3* vertices, uint32* triangles, Vector3* normals = nullptr, Vector3* tangents = nullptr, Vector2* uvs = nullptr, Color32* colors = nullptr);
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Updates the model mesh index buffer (used by the virtual models created with Init rather than Load).
|
||||
/// </summary>
|
||||
@@ -244,7 +237,6 @@ public:
|
||||
bool UpdateTriangles(uint32 triangleCount, void* ib, bool use16BitIndices);
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Initializes instance of the <see cref="Mesh"/> class.
|
||||
/// </summary>
|
||||
@@ -276,7 +268,6 @@ public:
|
||||
void Unload();
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Determines if there is an intersection between the mesh and a ray in given world
|
||||
/// </summary>
|
||||
@@ -297,7 +288,6 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Gets the draw call geometry for this mesh. Sets the index and vertex buffers.
|
||||
/// </summary>
|
||||
@@ -397,14 +387,12 @@ public:
|
||||
void Draw(const RenderContext& renderContext, const DrawInfo& info, float lodDitherFactor) const;
|
||||
|
||||
public:
|
||||
|
||||
// [MeshBase]
|
||||
bool DownloadDataGPU(MeshBufferType type, BytesContainer& result) const override;
|
||||
Task* DownloadDataGPUAsync(MeshBufferType type, BytesContainer& result) const override;
|
||||
bool DownloadDataCPU(MeshBufferType type, BytesContainer& result) const override;
|
||||
|
||||
private:
|
||||
|
||||
// Internal bindings
|
||||
API_FUNCTION(NoProxy) ScriptingObject* GetParentModel();
|
||||
API_FUNCTION(NoProxy) bool UpdateMeshInt(int32 vertexCount, int32 triangleCount, MonoArray* verticesObj, MonoArray* trianglesObj, MonoArray* normalsObj, MonoArray* tangentsObj, MonoArray* uvObj, MonoArray* colorsObj);
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include "Engine/Core/Log.h"
|
||||
#include "Engine/Core/Utilities.h"
|
||||
#include "Engine/Core/Types/DateTime.h"
|
||||
#include "Engine/Core/Types/TimeSpan.h"
|
||||
#include "Engine/Core/Collections/BitArray.h"
|
||||
#include "Engine/Tools/ModelTool/ModelTool.h"
|
||||
#include "Engine/Tools/ModelTool/VertexTriangleAdjacency.h"
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
#include "ModelInstanceEntry.h"
|
||||
#include "Engine/Content/Assets/Material.h"
|
||||
#include "Engine/Content/Assets/SkinnedModel.h"
|
||||
#include "Engine/Graphics/GPUDevice.h"
|
||||
#include "Engine/Graphics/RenderTask.h"
|
||||
#include "Engine/Level/Scene/Scene.h"
|
||||
#include "Engine/Renderer/RenderList.h"
|
||||
#include "Engine/Serialization/MemoryReadStream.h"
|
||||
|
||||
@@ -3,13 +3,13 @@
|
||||
#pragma once
|
||||
|
||||
#include "MeshBase.h"
|
||||
#include "Engine/Renderer/RenderList.h"
|
||||
#include "Engine/Graphics/RenderTask.h"
|
||||
#include "ModelInstanceEntry.h"
|
||||
#include "Types.h"
|
||||
#include "BlendShape.h"
|
||||
|
||||
struct GeometryDrawStateData;
|
||||
struct RenderContext;
|
||||
class GPUBuffer;
|
||||
class SkinnedMeshDrawData;
|
||||
|
||||
/// <summary>
|
||||
/// Represents part of the skinned model that is made of vertices and can be rendered using custom material, transformation and skeleton bones hierarchy.
|
||||
|
||||
@@ -5,6 +5,12 @@
|
||||
#include "Engine/Content/Assets/Model.h"
|
||||
#include "Engine/Serialization/MemoryReadStream.h"
|
||||
|
||||
bool SkinnedModelLOD::HasAnyMeshInitialized() const
|
||||
{
|
||||
// Note: we initialize all meshes at once so the last one can be used to check it.
|
||||
return Meshes.HasItems() && Meshes.Last().IsInitialized();
|
||||
}
|
||||
|
||||
bool SkinnedModelLOD::Load(MemoryReadStream& stream)
|
||||
{
|
||||
// Load LOD for each mesh
|
||||
|
||||
@@ -33,12 +33,7 @@ public:
|
||||
/// <summary>
|
||||
/// Determines whether any mesh has been initialized.
|
||||
/// </summary>
|
||||
/// <returns>True if any mesh has been initialized, otherwise false.</returns>
|
||||
FORCE_INLINE bool HasAnyMeshInitialized() const
|
||||
{
|
||||
// Note: we initialize all meshes at once so the last one can be used to check it.
|
||||
return Meshes.HasItems() && Meshes.Last().IsInitialized();
|
||||
}
|
||||
bool HasAnyMeshInitialized() const;
|
||||
|
||||
public:
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "Engine/Core/Math/Vector3.h"
|
||||
#include "Engine/Core/Math/Vector4.h"
|
||||
#include "Engine/Content/AssetReference.h"
|
||||
#include "Engine/Serialization/ISerializable.h"
|
||||
#include "Engine/Content/Assets/Texture.h"
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include "PixelFormat.h"
|
||||
#include "RenderView.h"
|
||||
#include "GPUDevice.h"
|
||||
#include "RenderTask.h"
|
||||
#include "Engine/Content/Assets/Model.h"
|
||||
#include "Engine/Content/Assets/SkinnedModel.h"
|
||||
#include "Engine/Engine/Time.h"
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
#include "ShaderStorage.h"
|
||||
#include "ShaderCacheManager.h"
|
||||
#include "Engine/Engine/CommandLine.h"
|
||||
#include "Engine/Graphics/GPUDevice.h"
|
||||
#include "Engine/Graphics/Shaders/GPUShader.h"
|
||||
#include "Engine/Serialization/MemoryReadStream.h"
|
||||
#include "Engine/ShadowsOfMordor/AtlasChartsPacker.h"
|
||||
|
||||
@@ -31,6 +33,16 @@ ShaderStorage::CachingMode ShaderStorage::GetCachingMode()
|
||||
|
||||
#endif
|
||||
|
||||
bool ShaderAssetBase::IsNullRenderer()
|
||||
{
|
||||
return GPUDevice::Instance->GetRendererType() == RendererType::Null;
|
||||
}
|
||||
|
||||
int32 ShaderAssetBase::GetCacheChunkIndex()
|
||||
{
|
||||
return GetCacheChunkIndex(GPUDevice::Instance->GetShaderProfile());
|
||||
}
|
||||
|
||||
int32 ShaderAssetBase::GetCacheChunkIndex(ShaderProfile profile)
|
||||
{
|
||||
int32 result;
|
||||
@@ -61,6 +73,28 @@ int32 ShaderAssetBase::GetCacheChunkIndex(ShaderProfile profile)
|
||||
return result;
|
||||
}
|
||||
|
||||
bool ShaderAssetBase::initBase(AssetInitData& initData)
|
||||
{
|
||||
// Validate version
|
||||
if (initData.SerializedVersion != ShaderStorage::Header::Version)
|
||||
{
|
||||
LOG(Warning, "Invalid shader serialized version.");
|
||||
return true;
|
||||
}
|
||||
|
||||
// Validate data
|
||||
if (initData.CustomData.Length() != sizeof(_shaderHeader))
|
||||
{
|
||||
LOG(Warning, "Invalid shader header.");
|
||||
return true;
|
||||
}
|
||||
|
||||
// Load header 'as-is'
|
||||
Platform::MemoryCopy(&_shaderHeader, initData.CustomData.Get(), sizeof(_shaderHeader));
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
#if USE_EDITOR
|
||||
|
||||
bool ShaderAssetBase::Save()
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
|
||||
#include "Engine/Core/Types/DataContainer.h"
|
||||
#include "Engine/Content/BinaryAsset.h"
|
||||
#include "Engine/Graphics/GPUDevice.h"
|
||||
#include "ShaderStorage.h"
|
||||
|
||||
/// <summary>
|
||||
@@ -18,17 +17,15 @@ protected:
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Gets internal shader cache chunk index
|
||||
/// </summary>
|
||||
/// <returns>Chunk index</returns>
|
||||
FORCE_INLINE static int32 GetCacheChunkIndex()
|
||||
{
|
||||
return GetCacheChunkIndex(GPUDevice::Instance->GetShaderProfile());
|
||||
}
|
||||
static bool IsNullRenderer();
|
||||
|
||||
/// <summary>
|
||||
/// Gets internal shader cache chunk index
|
||||
/// Gets internal shader cache chunk index (for current GPU device shader profile).
|
||||
/// </summary>
|
||||
static int32 GetCacheChunkIndex();
|
||||
|
||||
/// <summary>
|
||||
/// Gets internal shader cache chunk index.
|
||||
/// </summary>
|
||||
/// <param name="profile">Shader profile</param>
|
||||
/// <returns>Chunk index</returns>
|
||||
@@ -48,10 +45,11 @@ public:
|
||||
|
||||
protected:
|
||||
|
||||
bool initBase(AssetInitData& initData);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the parent asset.
|
||||
/// </summary>
|
||||
/// <returns>The asset.</returns>
|
||||
virtual BinaryAsset* GetShaderAsset() const = 0;
|
||||
|
||||
#if USE_EDITOR
|
||||
@@ -110,7 +108,7 @@ protected:
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Base class for assets that can contain shader
|
||||
/// Base class for binary assets that can contain shader.
|
||||
/// </summary>
|
||||
template<typename BaseType>
|
||||
class ShaderAssetTypeBase : public BaseType, public ShaderAssetBase
|
||||
@@ -121,11 +119,6 @@ public:
|
||||
|
||||
protected:
|
||||
|
||||
/// <summary>
|
||||
/// Init
|
||||
/// </summary>
|
||||
/// <param name="params">Asset scripting class metadata</param>
|
||||
/// <param name="info">Asset information</param>
|
||||
explicit ShaderAssetTypeBase(const ScriptingObjectSpawnParams& params, const AssetInfo* info)
|
||||
: BaseType(params, info)
|
||||
{
|
||||
@@ -134,38 +127,22 @@ protected:
|
||||
protected:
|
||||
|
||||
// [BaseType]
|
||||
BinaryAsset* GetShaderAsset() const override
|
||||
{
|
||||
return (BinaryAsset*)this;
|
||||
}
|
||||
bool init(AssetInitData& initData) override
|
||||
{
|
||||
// Validate version
|
||||
if (initData.SerializedVersion != ShadersSerializedVersion)
|
||||
{
|
||||
LOG(Warning, "Invalid shader serialized version.");
|
||||
return true;
|
||||
return initBase(initData);
|
||||
}
|
||||
|
||||
// Validate data
|
||||
if (initData.CustomData.Length() != sizeof(_shaderHeader))
|
||||
{
|
||||
LOG(Warning, "Invalid shader header.");
|
||||
return true;
|
||||
}
|
||||
|
||||
// Load header 'as-is'
|
||||
Platform::MemoryCopy(&_shaderHeader, initData.CustomData.Get(), sizeof(_shaderHeader));
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
AssetChunksFlag getChunksToPreload() const override
|
||||
{
|
||||
AssetChunksFlag result = 0;
|
||||
const auto cachingMode = ShaderStorage::GetCachingMode();
|
||||
if (cachingMode == ShaderStorage::CachingMode::AssetInternal && GPUDevice::Instance->GetRendererType() != RendererType::Null)
|
||||
if (cachingMode == ShaderStorage::CachingMode::AssetInternal && IsNullRenderer())
|
||||
result |= GET_CHUNK_FLAG(GetCacheChunkIndex());
|
||||
return result;
|
||||
}
|
||||
|
||||
// [ShaderAssetBase]
|
||||
BinaryAsset* GetShaderAsset() const override
|
||||
{
|
||||
return (BinaryAsset*)this;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -18,8 +18,7 @@ public:
|
||||
/// <summary>
|
||||
/// Gets the texture owner mutex used to synchronize texture logic.
|
||||
/// </summary>
|
||||
/// <returns>The mutex.</returns>
|
||||
virtual CriticalSection* GetOwnerLocker() const = 0;
|
||||
virtual CriticalSection& GetOwnerLocker() const = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Get texture mip map data
|
||||
|
||||
@@ -33,6 +33,23 @@ StreamingTexture::~StreamingTexture()
|
||||
ASSERT(_streamingTasksCount == 0);
|
||||
}
|
||||
|
||||
Vector2 StreamingTexture::Size() const
|
||||
{
|
||||
return _texture->Size();
|
||||
}
|
||||
|
||||
int32 StreamingTexture::TextureMipIndexToTotalIndex(int32 textureMipIndex) const
|
||||
{
|
||||
const int32 missingMips = TotalMipLevels() - _texture->MipLevels();
|
||||
return textureMipIndex + missingMips;
|
||||
}
|
||||
|
||||
int32 StreamingTexture::TotalIndexToTextureMipIndex(int32 mipIndex) const
|
||||
{
|
||||
const int32 missingMips = TotalMipLevels() - _texture->MipLevels();
|
||||
return mipIndex - missingMips;
|
||||
}
|
||||
|
||||
bool StreamingTexture::Create(const TextureHeader& header)
|
||||
{
|
||||
// Validate header (further validation is performed by the Texture.Init)
|
||||
@@ -90,13 +107,27 @@ uint64 StreamingTexture::GetTotalMemoryUsage() const
|
||||
return CalculateTextureMemoryUsage(_header.Format, _header.Width, _header.Height, _header.MipLevels) * arraySize;
|
||||
}
|
||||
|
||||
String StreamingTexture::ToString() const
|
||||
{
|
||||
return _texture->ToString();
|
||||
}
|
||||
|
||||
int32 StreamingTexture::GetCurrentResidency() const
|
||||
{
|
||||
return _texture->ResidentMipLevels();
|
||||
}
|
||||
|
||||
int32 StreamingTexture::GetAllocatedResidency() const
|
||||
{
|
||||
return _texture->MipLevels();
|
||||
}
|
||||
|
||||
bool StreamingTexture::CanBeUpdated() const
|
||||
{
|
||||
// Streaming Texture cannot be updated if:
|
||||
// - is not initialized
|
||||
// - mip data uploading job running
|
||||
// - resize texture job running
|
||||
|
||||
return IsInitialized() && Platform::AtomicRead(&_streamingTasksCount) == 0;
|
||||
}
|
||||
|
||||
@@ -146,7 +177,6 @@ protected:
|
||||
|
||||
return Result::Ok;
|
||||
}
|
||||
|
||||
void OnEnd() override
|
||||
{
|
||||
Platform::InterlockedDecrement(&_streamingTexture->_streamingTasksCount);
|
||||
@@ -154,7 +184,6 @@ protected:
|
||||
// Base
|
||||
GPUTask::OnEnd();
|
||||
}
|
||||
|
||||
void OnSync() override
|
||||
{
|
||||
Swap(_streamingTexture->_texture, _newTexture);
|
||||
@@ -298,7 +327,6 @@ protected:
|
||||
|
||||
return Result::Ok;
|
||||
}
|
||||
|
||||
void OnEnd() override
|
||||
{
|
||||
_dataLock.Release();
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "GPUTexture.h"
|
||||
#include "ITextureOwner.h"
|
||||
#include "Engine/Streaming/StreamableResource.h"
|
||||
#include "Types.h"
|
||||
@@ -14,7 +13,6 @@ class FLAXENGINE_API StreamingTexture : public Object, public StreamableResource
|
||||
{
|
||||
friend class StreamTextureMipTask;
|
||||
friend class StreamTextureResizeTask;
|
||||
|
||||
protected:
|
||||
|
||||
ITextureOwner* _owner;
|
||||
@@ -25,16 +23,7 @@ protected:
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Init
|
||||
/// </summary>
|
||||
/// <param name="owner">Parent object</param>
|
||||
/// <param name="name">Texture object name</param>
|
||||
StreamingTexture(ITextureOwner* owner, const String& name);
|
||||
|
||||
/// <summary>
|
||||
/// Destructor
|
||||
/// </summary>
|
||||
~StreamingTexture();
|
||||
|
||||
public:
|
||||
@@ -42,31 +31,23 @@ public:
|
||||
/// <summary>
|
||||
/// Gets the owner.
|
||||
/// </summary>
|
||||
/// <returns>The owner.</returns>
|
||||
FORCE_INLINE ITextureOwner* GetOwner() const
|
||||
{
|
||||
return _owner;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets texture object handle
|
||||
/// Gets texture object handle.
|
||||
/// </summary>
|
||||
/// <returns>Texture object</returns>
|
||||
FORCE_INLINE GPUTexture* GetTexture() const
|
||||
{
|
||||
return _texture;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets texture size of Vector2::Zero if not loaded
|
||||
/// Gets texture size of Vector2::Zero if not loaded.
|
||||
/// </summary>
|
||||
/// <returns>Texture size</returns>
|
||||
FORCE_INLINE Vector2 Size() const
|
||||
{
|
||||
return _texture->Size();
|
||||
}
|
||||
|
||||
public:
|
||||
Vector2 Size() const;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether this instance is initialized.
|
||||
@@ -88,7 +69,6 @@ public:
|
||||
/// <summary>
|
||||
/// Gets total texture height (in texels)
|
||||
/// </summary>
|
||||
/// <returns>Texture width</returns>
|
||||
FORCE_INLINE int32 TotalHeight() const
|
||||
{
|
||||
return _header.Height;
|
||||
@@ -97,7 +77,6 @@ public:
|
||||
/// <summary>
|
||||
/// Gets total texture array size
|
||||
/// </summary>
|
||||
/// <returns>Texture array size</returns>
|
||||
FORCE_INLINE int32 TotalArraySize() const
|
||||
{
|
||||
return IsCubeMap() ? 6 : 1;
|
||||
@@ -106,7 +85,6 @@ public:
|
||||
/// <summary>
|
||||
/// Gets total texture mip levels count
|
||||
/// </summary>
|
||||
/// <returns>Texture mip levels</returns>
|
||||
FORCE_INLINE int32 TotalMipLevels() const
|
||||
{
|
||||
return _header.MipLevels;
|
||||
@@ -115,7 +93,6 @@ public:
|
||||
/// <summary>
|
||||
/// Returns texture format type
|
||||
/// </summary>
|
||||
/// <returns>Texture format type</returns>
|
||||
FORCE_INLINE TextureFormatType GetFormatType() const
|
||||
{
|
||||
return _header.Type;
|
||||
@@ -124,7 +101,6 @@ public:
|
||||
/// <summary>
|
||||
/// Returns true if it's a cube map texture
|
||||
/// </summary>
|
||||
/// <returns>True if i's a cubemap</returns>
|
||||
FORCE_INLINE bool IsCubeMap() const
|
||||
{
|
||||
return _header.IsCubeMap;
|
||||
@@ -133,7 +109,6 @@ public:
|
||||
/// <summary>
|
||||
/// Returns true if texture cannot be used during GPU resources streaming system
|
||||
/// </summary>
|
||||
/// <returns>True if texture cannot be used during GPU resources streaming system</returns>
|
||||
FORCE_INLINE bool NeverStream() const
|
||||
{
|
||||
return _header.NeverStream;
|
||||
@@ -142,7 +117,6 @@ public:
|
||||
/// <summary>
|
||||
/// Gets the texture header.
|
||||
/// </summary>
|
||||
/// <returns>Header</returns>
|
||||
FORCE_INLINE const TextureHeader* GetHeader() const
|
||||
{
|
||||
return &_header;
|
||||
@@ -163,22 +137,14 @@ public:
|
||||
/// </summary>
|
||||
/// <param name="textureMipIndex">Index of the texture mip.</param>
|
||||
/// <returns>The index of the mip map.</returns>
|
||||
FORCE_INLINE int32 TextureMipIndexToTotalIndex(int32 textureMipIndex) const
|
||||
{
|
||||
const int32 missingMips = TotalMipLevels() - _texture->MipLevels();
|
||||
return textureMipIndex + missingMips;
|
||||
}
|
||||
int32 TextureMipIndexToTotalIndex(int32 textureMipIndex) const;
|
||||
|
||||
/// <summary>
|
||||
/// Converts absolute mip map index to the allocated texture mip index.
|
||||
/// </summary>
|
||||
/// <param name="mipIndex">Index of the texture mip.</param>
|
||||
/// <returns>The index of the mip map.</returns>
|
||||
FORCE_INLINE int32 TotalIndexToTextureMipIndex(int32 mipIndex) const
|
||||
{
|
||||
const int32 missingMips = TotalMipLevels() - _texture->MipLevels();
|
||||
return mipIndex - missingMips;
|
||||
}
|
||||
int32 TotalIndexToTextureMipIndex(int32 mipIndex) const;
|
||||
|
||||
public:
|
||||
|
||||
@@ -211,27 +177,15 @@ public:
|
||||
public:
|
||||
|
||||
// [Object]
|
||||
String ToString() const override
|
||||
{
|
||||
return _texture->ToString();
|
||||
}
|
||||
String ToString() const override;
|
||||
|
||||
// [StreamableResource]
|
||||
int32 GetMaxResidency() const override
|
||||
{
|
||||
return _header.MipLevels;
|
||||
}
|
||||
|
||||
int32 GetCurrentResidency() const override
|
||||
{
|
||||
return _texture->ResidentMipLevels();
|
||||
}
|
||||
|
||||
int32 GetAllocatedResidency() const override
|
||||
{
|
||||
return _texture->MipLevels();
|
||||
}
|
||||
|
||||
int32 GetCurrentResidency() const override;
|
||||
int32 GetAllocatedResidency() const override;
|
||||
bool CanBeUpdated() const override;
|
||||
Task* UpdateAllocation(int32 residency) override;
|
||||
Task* CreateStreamingTask(int32 residency) override;
|
||||
|
||||
@@ -3,10 +3,11 @@
|
||||
#include "TextureBase.h"
|
||||
#include "TextureData.h"
|
||||
#include "Engine/Graphics/GPUDevice.h"
|
||||
#include "Engine/Debug/Exceptions/ArgumentOutOfRangeException.h"
|
||||
#include "Engine/Debug/Exceptions/InvalidOperationException.h"
|
||||
#include "Engine/Graphics/Textures/GPUTexture.h"
|
||||
#include "Engine/Graphics/RenderTools.h"
|
||||
#include "Engine/Graphics/PixelFormatExtensions.h"
|
||||
#include "Engine/Debug/Exceptions/ArgumentOutOfRangeException.h"
|
||||
#include "Engine/Debug/Exceptions/InvalidOperationException.h"
|
||||
#include "Engine/Core/Math/Color32.h"
|
||||
#include "Engine/Profiler/ProfilerCPU.h"
|
||||
#include "Engine/Content/Factories/BinaryAssetFactory.h"
|
||||
@@ -22,6 +23,36 @@ TextureBase::TextureBase(const SpawnParams& params, const AssetInfo* info)
|
||||
{
|
||||
}
|
||||
|
||||
Vector2 TextureBase::Size() const
|
||||
{
|
||||
return Vector2(static_cast<float>(_texture.TotalWidth()), static_cast<float>(_texture.TotalHeight()));
|
||||
}
|
||||
|
||||
int32 TextureBase::GetArraySize() const
|
||||
{
|
||||
return StreamingTexture()->TotalArraySize();
|
||||
}
|
||||
|
||||
int32 TextureBase::GetMipLevels() const
|
||||
{
|
||||
return StreamingTexture()->TotalMipLevels();
|
||||
}
|
||||
|
||||
int32 TextureBase::GetResidentMipLevels() const
|
||||
{
|
||||
return GetTexture()->ResidentMipLevels();
|
||||
}
|
||||
|
||||
uint64 TextureBase::GetCurrentMemoryUsage() const
|
||||
{
|
||||
return GetTexture()->GetMemoryUsage();
|
||||
}
|
||||
|
||||
uint64 TextureBase::GetTotalMemoryUsage() const
|
||||
{
|
||||
return StreamingTexture()->GetTotalMemoryUsage();
|
||||
}
|
||||
|
||||
BytesContainer TextureBase::GetMipData(int32 mipIndex, int32& rowPitch, int32& slicePitch)
|
||||
{
|
||||
BytesContainer result;
|
||||
@@ -193,9 +224,9 @@ int32 TextureBase::calculateChunkIndex(int32 mipIndex) const
|
||||
return mipIndex;
|
||||
}
|
||||
|
||||
CriticalSection* TextureBase::GetOwnerLocker() const
|
||||
CriticalSection& TextureBase::GetOwnerLocker() const
|
||||
{
|
||||
return &_parent->Locker;
|
||||
return _parent->Locker;
|
||||
}
|
||||
|
||||
void TextureBase::unload(bool isReloading)
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
#include "StreamingTexture.h"
|
||||
#include "Engine/Core/Log.h"
|
||||
|
||||
class TextureData;
|
||||
|
||||
/// <summary>
|
||||
/// Base class for <see cref="Texture"/>, <see cref="SpriteAtlas"/>, <see cref="IESProfile"/> and other assets that can contain texture data.
|
||||
/// </summary>
|
||||
@@ -103,50 +105,32 @@ public:
|
||||
/// <summary>
|
||||
/// Gets the total size of the texture. Actual resident size may be different due to dynamic content streaming. Returns Vector2::Zero if texture is not loaded.
|
||||
/// </summary>
|
||||
API_PROPERTY() FORCE_INLINE Vector2 Size() const
|
||||
{
|
||||
return Vector2(static_cast<float>(_texture.TotalWidth()), static_cast<float>(_texture.TotalHeight()));
|
||||
}
|
||||
API_PROPERTY() Vector2 Size() const;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the total array size of the texture.
|
||||
/// </summary>
|
||||
API_PROPERTY() int32 GetArraySize() const
|
||||
{
|
||||
return StreamingTexture()->TotalArraySize();
|
||||
}
|
||||
API_PROPERTY() int32 GetArraySize() const;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the total mip levels count of the texture. Actual resident mipmaps count may be different due to dynamic content streaming.
|
||||
/// </summary>
|
||||
API_PROPERTY() int32 GetMipLevels() const
|
||||
{
|
||||
return StreamingTexture()->TotalMipLevels();
|
||||
}
|
||||
API_PROPERTY() int32 GetMipLevels() const;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the current mip levels count of the texture that are on GPU ready to use.
|
||||
/// </summary>
|
||||
API_PROPERTY() int32 GetResidentMipLevels() const
|
||||
{
|
||||
return GetTexture()->ResidentMipLevels();
|
||||
}
|
||||
API_PROPERTY() int32 GetResidentMipLevels() const;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the amount of the memory used by this resource. Exact value may differ due to memory alignment and resource allocation policy.
|
||||
/// </summary>
|
||||
API_PROPERTY() uint64 GetCurrentMemoryUsage() const
|
||||
{
|
||||
return GetTexture()->GetMemoryUsage();
|
||||
}
|
||||
API_PROPERTY() uint64 GetCurrentMemoryUsage() const;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the total memory usage that texture may have in use (if loaded to the maximum quality). Exact value may differ due to memory alignment and resource allocation policy.
|
||||
/// </summary>
|
||||
API_PROPERTY() uint64 GetTotalMemoryUsage() const
|
||||
{
|
||||
return StreamingTexture()->GetTotalMemoryUsage();
|
||||
}
|
||||
API_PROPERTY() uint64 GetTotalMemoryUsage() const;
|
||||
|
||||
public:
|
||||
|
||||
@@ -186,7 +170,7 @@ private:
|
||||
public:
|
||||
|
||||
// [ITextureOwner]
|
||||
CriticalSection* GetOwnerLocker() const override;
|
||||
CriticalSection& GetOwnerLocker() const override;
|
||||
Task* RequestMipDataAsync(int32 mipIndex) override;
|
||||
FlaxStorage::LockData LockData() override;
|
||||
void GetMipData(int32 mipIndex, BytesContainer& data) const override;
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include "Engine/Core/Utilities.h"
|
||||
#include "Engine/Core/Math/Color32.h"
|
||||
#include "Engine/Engine/Engine.h"
|
||||
#include "Engine/Engine/Globals.h"
|
||||
#include "Engine/Engine/CommandLine.h"
|
||||
#include "Engine/Utilities/StringConverter.h"
|
||||
#include "Engine/Profiler/ProfilerCPU.h"
|
||||
@@ -352,7 +353,7 @@ DeferredDeletionQueueVulkan::~DeferredDeletionQueueVulkan()
|
||||
|
||||
void DeferredDeletionQueueVulkan::ReleaseResources(bool deleteImmediately)
|
||||
{
|
||||
ScopeLock lock(&_locker);
|
||||
ScopeLock lock(_locker);
|
||||
const uint64 checkFrame = Engine::FrameCount - VULKAN_RESOURCE_DELETE_SAFE_FRAMES_COUNT;
|
||||
for (int32 i = 0; i < _entries.Count(); i++)
|
||||
{
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#include "Engine/Core/Cache.h"
|
||||
#include "Engine/Core/Collections/CollectionPoolCache.h"
|
||||
#include "Engine/Debug/Exceptions/JsonParseException.h"
|
||||
#include "Engine/Graphics/RenderTask.h"
|
||||
#include "Engine/Graphics/RenderView.h"
|
||||
#include "Engine/Profiler/ProfilerCPU.h"
|
||||
#include "Engine/Scripting/Scripting.h"
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include "Editor/Editor.h"
|
||||
#endif
|
||||
#include "Engine/Graphics/GPUDevice.h"
|
||||
#include "Engine/Graphics/RenderTask.h"
|
||||
#include "Engine/Level/Scene/Scene.h"
|
||||
#include "Engine/Level/SceneObjectsFactory.h"
|
||||
#include "Engine/Serialization/Serialization.h"
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include "Engine/Content/Assets/SkinnedModel.h"
|
||||
#include "Engine/Content/Assets/AnimationGraph.h"
|
||||
#include "Engine/Graphics/Models/SkinnedMeshDrawData.h"
|
||||
#include "Engine/Renderer/DrawCall.h"
|
||||
|
||||
/// <summary>
|
||||
/// Performs an animation and renders a skinned model.
|
||||
|
||||
@@ -5,14 +5,16 @@
|
||||
#include "Engine/Core/Math/Viewport.h"
|
||||
#include "Engine/Content/Assets/Model.h"
|
||||
#include "Engine/Content/Content.h"
|
||||
#include "Engine/Platform/Window.h"
|
||||
#include "Engine/Serialization/Serialization.h"
|
||||
#include "Engine/Level/Scene/SceneRendering.h"
|
||||
#if USE_EDITOR
|
||||
#include "Editor/Editor.h"
|
||||
#include "Editor/Managed/ManagedEditor.h"
|
||||
#include "Engine/Renderer/DrawCall.h"
|
||||
#include "Engine/Graphics/RenderTask.h"
|
||||
#include "Engine/Level/Scene/SceneRendering.h"
|
||||
#else
|
||||
#include "Engine/Engine/Engine.h"
|
||||
#include "Engine/Platform/Window.h"
|
||||
#endif
|
||||
|
||||
Array<Camera*> Camera::Cameras;
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include "EnvironmentProbe.h"
|
||||
#include "Engine/Platform/FileSystem.h"
|
||||
#include "Engine/Graphics/RenderView.h"
|
||||
#include "Engine/Graphics/RenderTask.h"
|
||||
#include "Engine/Graphics/Textures/TextureData.h"
|
||||
#include "Engine/Renderer/RenderList.h"
|
||||
#include "Engine/Renderer/ProbesRenderer.h"
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
|
||||
#include "Light.h"
|
||||
#include "../Scene/Scene.h"
|
||||
#if USE_EDITOR
|
||||
#include "Engine/Graphics/RenderView.h"
|
||||
#endif
|
||||
#include "Engine/Serialization/Serialization.h"
|
||||
|
||||
Light::Light(const SpawnParams& params)
|
||||
|
||||
@@ -4,14 +4,17 @@
|
||||
#include "DirectionalLight.h"
|
||||
#include "Engine/Core/Math/Color.h"
|
||||
#include "Engine/Content/Content.h"
|
||||
#include "Engine/Graphics/RenderView.h"
|
||||
#include "Engine/Renderer/RenderList.h"
|
||||
#include "Engine/Renderer/AtmospherePreCompute.h"
|
||||
#include "Engine/Renderer/GBufferPass.h"
|
||||
#include "Engine/Graphics/RenderBuffers.h"
|
||||
#include "Engine/Graphics/RenderView.h"
|
||||
#include "Engine/Graphics/RenderTask.h"
|
||||
#include "Engine/Graphics/GPUContext.h"
|
||||
#include "Engine/Serialization/Serialization.h"
|
||||
#include "Engine/Graphics/GPUDevice.h"
|
||||
#include "Engine/Graphics/Shaders/GPUConstantBuffer.h"
|
||||
#include "Engine/Graphics/Shaders/GPUShader.h"
|
||||
#include "Engine/Serialization/Serialization.h"
|
||||
#include "Engine/Level/Scene/SceneRendering.h"
|
||||
|
||||
PACK_STRUCT(struct Data {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user