Add default Deformable material for splines
This commit is contained in:
BIN
Content/Editor/Particles/Particle Material Color.flax
(Stored with Git LFS)
BIN
Content/Editor/Particles/Particle Material Color.flax
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Engine/DefaultDeformableMaterial.flax
(Stored with Git LFS)
Normal file
BIN
Content/Engine/DefaultDeformableMaterial.flax
(Stored with Git LFS)
Normal file
Binary file not shown.
@@ -74,6 +74,7 @@ bool DeployDataStep::Perform(CookingData& data)
|
||||
data.AddRootEngineAsset(TEXT("Shaders/SSR"));
|
||||
data.AddRootEngineAsset(TEXT("Shaders/VolumetricFog"));
|
||||
data.AddRootEngineAsset(TEXT("Engine/DefaultMaterial"));
|
||||
data.AddRootEngineAsset(TEXT("Engine/DefaultDeformableMaterial"));
|
||||
data.AddRootEngineAsset(TEXT("Engine/DefaultTerrainMaterial"));
|
||||
if (!gameSettings->NoSplashScreen && !gameSettings->SplashScreen.IsValid())
|
||||
data.AddRootEngineAsset(TEXT("Engine/Textures/Logo"));
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include "Engine/Profiler/Profiler.h"
|
||||
#include "Engine/Renderer/RenderList.h"
|
||||
#include "Engine/Core/Utilities.h"
|
||||
#include "Engine/Scripting/SoftObjectReference.h"
|
||||
|
||||
GPUPipelineState* GPUPipelineState::Spawn(const SpawnParams& params)
|
||||
{
|
||||
@@ -127,6 +128,7 @@ struct GPUDevice::PrivateData
|
||||
GPUPipelineState* PS_Clear = nullptr;
|
||||
GPUBuffer* FullscreenTriangleVB = nullptr;
|
||||
AssetReference<Material> DefaultMaterial;
|
||||
SoftObjectReference<Material> DefaultDeformableMaterial;
|
||||
AssetReference<Texture> DefaultNormalMap;
|
||||
AssetReference<Texture> DefaultWhiteTexture;
|
||||
AssetReference<Texture> DefaultBlackTexture;
|
||||
@@ -206,6 +208,7 @@ bool GPUDevice::LoadContent()
|
||||
_res->DefaultMaterial = Content::LoadAsyncInternal<Material>(TEXT("Engine/DefaultMaterial"));
|
||||
if (_res->DefaultMaterial == nullptr)
|
||||
return true;
|
||||
_res->DefaultDeformableMaterial = Guid(0x639e12c0, 0x42d34bae, 0x89dd8b81, 0x7e1efc2d);
|
||||
|
||||
// Load default normal map
|
||||
_res->DefaultNormalMap = Content::LoadAsyncInternal<Texture>(TEXT("Engine/Textures/NormalTexture"));
|
||||
@@ -231,6 +234,7 @@ void GPUDevice::preDispose()
|
||||
|
||||
// Release resources
|
||||
_res->DefaultMaterial = nullptr;
|
||||
_res->DefaultDeformableMaterial = nullptr;
|
||||
_res->DefaultNormalMap = nullptr;
|
||||
_res->DefaultWhiteTexture = nullptr;
|
||||
_res->DefaultBlackTexture = nullptr;
|
||||
@@ -380,6 +384,11 @@ MaterialBase* GPUDevice::GetDefaultMaterial() const
|
||||
return _res->DefaultMaterial;
|
||||
}
|
||||
|
||||
MaterialBase* GPUDevice::GetDefaultDeformableMaterial() const
|
||||
{
|
||||
return _res->DefaultDeformableMaterial.Get();
|
||||
}
|
||||
|
||||
GPUTexture* GPUDevice::GetDefaultNormalMap() const
|
||||
{
|
||||
return _res->DefaultNormalMap ? _res->DefaultNormalMap->GetTexture() : nullptr;
|
||||
|
||||
@@ -234,6 +234,11 @@ public:
|
||||
/// </summary>
|
||||
MaterialBase* GetDefaultMaterial() const;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the default material (Deformable domain).
|
||||
/// </summary>
|
||||
MaterialBase* GetDefaultDeformableMaterial() const;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the default normal map texture.
|
||||
/// </summary>
|
||||
|
||||
@@ -408,7 +408,7 @@ void SplineModel::Draw(RenderContext& renderContext)
|
||||
else if (slot.Material && slot.Material->IsLoaded())
|
||||
material = slot.Material;
|
||||
else
|
||||
material = nullptr;
|
||||
material = GPUDevice::Instance->GetDefaultDeformableMaterial();
|
||||
if (!material || !material->IsDeformable())
|
||||
continue;
|
||||
|
||||
|
||||
@@ -311,9 +311,10 @@ public:
|
||||
/// Sets the object.
|
||||
/// </summary>
|
||||
/// <param name="id">The object ID. Uses Scripting to find the registered object of the given ID.</param>
|
||||
FORCE_INLINE void Set(const Guid& id)
|
||||
void Set(const Guid& id)
|
||||
{
|
||||
Set(static_cast<T*>(FindObject(id, T::GetStaticClass())));
|
||||
_id = id;
|
||||
_object = nullptr;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user