diff --git a/Source/Editor/Surface/SurfaceUtils.cs b/Source/Editor/Surface/SurfaceUtils.cs
index d6a5c5199..08b9c6d63 100644
--- a/Source/Editor/Surface/SurfaceUtils.cs
+++ b/Source/Editor/Surface/SurfaceUtils.cs
@@ -95,6 +95,7 @@ namespace FlaxEditor.Surface
case MaterialParameterType.ChannelMask: return typeof(ChannelMask);
case MaterialParameterType.GameplayGlobal: return typeof(GameplayGlobals);
case MaterialParameterType.TextureGroupSampler: return typeof(int);
+ case MaterialParameterType.GlobalSDF: return typeof(object);
default: throw new ArgumentOutOfRangeException(nameof(type), type, null);
}
}
diff --git a/Source/Engine/Graphics/MaterialParams.cs b/Source/Engine/Graphics/MaterialParams.cs
deleted file mode 100644
index fcb4b7cdd..000000000
--- a/Source/Engine/Graphics/MaterialParams.cs
+++ /dev/null
@@ -1,110 +0,0 @@
-// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved.
-
-namespace FlaxEngine
-{
- ///
- /// Material parameters types.
- ///
- public enum MaterialParameterType : byte
- {
- ///
- /// The invalid type.
- ///
- Invalid = 0,
-
- ///
- /// The bool.
- ///
- Bool = 1,
-
- ///
- /// The integer.
- ///
- Integer = 2,
-
- ///
- /// The float.
- ///
- Float = 3,
-
- ///
- /// The vector2
- ///
- Vector2 = 4,
-
- ///
- /// The vector3.
- ///
- Vector3 = 5,
-
- ///
- /// The vector4.
- ///
- Vector4 = 6,
-
- ///
- /// The color.
- ///
- Color = 7,
-
- ///
- /// The texture.
- ///
- Texture = 8,
-
- ///
- /// The cube texture.
- ///
- CubeTexture = 9,
-
- ///
- /// The normal map texture.
- ///
- NormalMap = 10,
-
- ///
- /// The scene texture.
- ///
- SceneTexture = 11,
-
- ///
- /// The GPU texture (created from code).
- ///
- GPUTexture = 12,
-
- ///
- /// The matrix.
- ///
- Matrix = 13,
-
- ///
- /// The GPU texture array (created from code).
- ///
- GPUTextureArray = 14,
-
- ///
- /// The GPU volume texture (created from code).
- ///
- GPUTextureVolume = 15,
-
- ///
- /// The GPU cube texture (created from code).
- ///
- GPUTextureCube = 16,
-
- ///
- /// The RGBA channel selection mask.
- ///
- ChannelMask = 17,
-
- ///
- /// The gameplay global.
- ///
- GameplayGlobal = 18,
-
- ///
- /// The texture sampler derived from texture group settings.
- ///
- TextureGroupSampler = 19,
- }
-}
diff --git a/Source/Engine/Graphics/Materials/MaterialParams.cpp b/Source/Engine/Graphics/Materials/MaterialParams.cpp
index 5baf611ff..0788a59ab 100644
--- a/Source/Engine/Graphics/Materials/MaterialParams.cpp
+++ b/Source/Engine/Graphics/Materials/MaterialParams.cpp
@@ -12,6 +12,7 @@
#include "Engine/Graphics/GPUDevice.h"
#include "Engine/Graphics/RenderTask.h"
#include "Engine/Renderer/GlobalSignDistanceFieldPass.h"
+#include "Engine/Scripting/Enums.h"
#include "Engine/Streaming/Streaming.h"
bool MaterialInfo8::operator==(const MaterialInfo8& other) const
@@ -127,81 +128,6 @@ bool MaterialInfo::operator==(const MaterialInfo& other) const
&& MaxTessellationFactor == other.MaxTessellationFactor;
}
-const Char* ToString(MaterialParameterType value)
-{
- const Char* result;
- switch (value)
- {
- case MaterialParameterType::Invalid:
- result = TEXT("Invalid");
- break;
- case MaterialParameterType::Bool:
- result = TEXT("Bool");
- break;
- case MaterialParameterType::Integer:
- result = TEXT("Integer");
- break;
- case MaterialParameterType::Float:
- result = TEXT("Float");
- break;
- case MaterialParameterType::Vector2:
- result = TEXT("Vector2");
- break;
- case MaterialParameterType::Vector3:
- result = TEXT("Vector3");
- break;
- case MaterialParameterType::Vector4:
- result = TEXT("Vector4");
- break;
- case MaterialParameterType::Color:
- result = TEXT("Color");
- break;
- case MaterialParameterType::Texture:
- result = TEXT("Texture");
- break;
- case MaterialParameterType::CubeTexture:
- result = TEXT("CubeTexture");
- break;
- case MaterialParameterType::NormalMap:
- result = TEXT("NormalMap");
- break;
- case MaterialParameterType::SceneTexture:
- result = TEXT("SceneTexture");
- break;
- case MaterialParameterType::GPUTexture:
- result = TEXT("GPUTexture");
- break;
- case MaterialParameterType::Matrix:
- result = TEXT("Matrix");
- break;
- case MaterialParameterType::GPUTextureArray:
- result = TEXT("GPUTextureArray");
- break;
- case MaterialParameterType::GPUTextureVolume:
- result = TEXT("GPUTextureVolume");
- break;
- case MaterialParameterType::GPUTextureCube:
- result = TEXT("GPUTextureCube");
- break;
- case MaterialParameterType::ChannelMask:
- result = TEXT("ChannelMask");
- break;
- case MaterialParameterType::GameplayGlobal:
- result = TEXT("GameplayGlobal");
- break;
- case MaterialParameterType::TextureGroupSampler:
- result = TEXT("TextureGroupSampler");
- break;
- case MaterialParameterType::GlobalSDF:
- result = TEXT("GlobalSDF");
- break;
- default:
- result = TEXT("");
- break;
- }
- return result;
-}
-
Variant MaterialParameter::GetValue() const
{
switch (_type)
@@ -347,7 +273,7 @@ void MaterialParameter::SetValue(const Variant& value)
}
if (invalidType)
{
- LOG(Error, "Invalid material parameter value type {0} to set (param type: {1})", value.Type, ::ToString(_type));
+ LOG(Error, "Invalid material parameter value type {0} to set (param type: {1})", value.Type, ScriptingEnum::ToString(_type));
}
}
@@ -604,7 +530,7 @@ bool MaterialParameter::operator==(const MaterialParameter& other) const
String MaterialParameter::ToString() const
{
- return String::Format(TEXT("\'{0}\' ({1}:{2}:{3})"), _name, ::ToString(_type), _paramId, _isPublic);
+ return String::Format(TEXT("\'{0}\' ({1}:{2}:{3})"), _name, ScriptingEnum::ToString(_type), _paramId, _isPublic);
}
MaterialParameter* MaterialParams::Get(const Guid& id)
diff --git a/Source/Engine/Graphics/Materials/MaterialParams.h b/Source/Engine/Graphics/Materials/MaterialParams.h
index 083eec59a..c3ec8625c 100644
--- a/Source/Engine/Graphics/Materials/MaterialParams.h
+++ b/Source/Engine/Graphics/Materials/MaterialParams.h
@@ -27,7 +27,7 @@ struct MaterialParamsLink
///
/// The material parameter types.
///
-enum class MaterialParameterType : byte
+API_ENUM() enum class MaterialParameterType : byte
{
///
/// The invalid type.
@@ -135,8 +135,6 @@ enum class MaterialParameterType : byte
GlobalSDF = 20,
};
-const Char* ToString(MaterialParameterType value);
-
///
/// Structure of serialized material parameter data.
///