diff --git a/Source/Engine/Graphics/Models/Config.h b/Source/Engine/Graphics/Models/Config.h index f48dae903..c9488ad9c 100644 --- a/Source/Engine/Graphics/Models/Config.h +++ b/Source/Engine/Graphics/Models/Config.h @@ -5,7 +5,9 @@ #include "../Config.h" // The maximum allowed amount of material slots per model resource -#define MAX_MATERIAL_SLOTS 4096 +#define MODEL_MAX_MATERIAL_SLOTS 4096 +// [Deprecated in v1.10] Use MODEL_MAX_MATERIAL_SLOTS +#define MAX_MATERIAL_SLOTS MODEL_MAX_MATERIAL_SLOTS // Maximum amount of levels of detail for the model #define MODEL_MAX_LODS 6 @@ -13,11 +15,20 @@ // Maximum amount of meshes per model LOD #define MODEL_MAX_MESHES 4096 +// Maximum amount of texture channels (UVs) per vertex +#define MODEL_MAX_UVS 4 + // Enable/disable precise mesh collision testing (with in-build vertex buffer caching, this will increase memory usage) -#define USE_PRECISE_MESH_INTERSECTS (USE_EDITOR) +#define MODEL_USE_PRECISE_MESH_INTERSECTS (USE_EDITOR) +// [Deprecated in v1.10] Use MODEL_USE_PRECISE_MESH_INTERSECTS +#define USE_PRECISE_MESH_INTERSECTS MODEL_USE_PRECISE_MESH_INTERSECTS // Defines the maximum amount of bones affecting every vertex of the skinned mesh -#define MAX_BONES_PER_VERTEX 4 +#define MODEL_MAX_BONES_PER_VERTEX 4 +// [Deprecated in v1.10] Use MODEL_MAX_BONES_PER_VERTEX +#define MAX_BONES_PER_VERTEX MODEL_MAX_BONES_PER_VERTEX // Defines the maximum allowed amount of skeleton bones to be used with skinned model -#define MAX_BONES_PER_MODEL 256 +#define MODEL_MAX_BONES_PER_MODEL 256 +// [Deprecated in v1.10] Use MODEL_MAX_BONES_PER_MODEL +#define MAX_BONES_PER_MODEL MODEL_MAX_BONES_PER_MODEL diff --git a/Source/Engine/Graphics/Models/MeshBase.cpp b/Source/Engine/Graphics/Models/MeshBase.cpp index f58527337..e9b4b1493 100644 --- a/Source/Engine/Graphics/Models/MeshBase.cpp +++ b/Source/Engine/Graphics/Models/MeshBase.cpp @@ -108,7 +108,7 @@ bool MeshBase::Init(uint32 vertices, uint32 triangles, const Array _cachedIndexBuffer; mutable int32 _cachedIndexBufferCount = 0; -#if USE_PRECISE_MESH_INTERSECTS +#if MODEL_USE_PRECISE_MESH_INTERSECTS CollisionProxy _collisionProxy; #endif @@ -137,7 +137,7 @@ public: return _use16BitIndexBuffer; } -#if USE_PRECISE_MESH_INTERSECTS +#if MODEL_USE_PRECISE_MESH_INTERSECTS /// /// Gets the collision proxy used by the mesh. /// diff --git a/Source/Engine/Physics/Actors/Cloth.cpp b/Source/Engine/Physics/Actors/Cloth.cpp index 2781cb161..4dd1f56f5 100644 --- a/Source/Engine/Physics/Actors/Cloth.cpp +++ b/Source/Engine/Physics/Actors/Cloth.cpp @@ -214,7 +214,7 @@ void Cloth::SetPaint(Span value) bool Cloth::IntersectsItself(const Ray& ray, Real& distance, Vector3& normal) { -#if USE_PRECISE_MESH_INTERSECTS +#if MODEL_USE_PRECISE_MESH_INTERSECTS if (!Actor::IntersectsItself(ray, distance, normal)) return false; #if WITH_CLOTH diff --git a/Source/Engine/Tools/ModelTool/ModelTool.cpp b/Source/Engine/Tools/ModelTool/ModelTool.cpp index 91c2edc06..641ab1990 100644 --- a/Source/Engine/Tools/ModelTool/ModelTool.cpp +++ b/Source/Engine/Tools/ModelTool/ModelTool.cpp @@ -1184,7 +1184,7 @@ bool ModelTool::ImportModel(const String& path, ModelData& data, Options& option // Special case if imported model has no bones but has valid skeleton and meshes. // We assume that every mesh uses a single bone. Copy nodes to bones. - if (data.Skeleton.Bones.IsEmpty() && Math::IsInRange(data.Skeleton.Nodes.Count(), 1, MAX_BONES_PER_MODEL)) + if (data.Skeleton.Bones.IsEmpty() && Math::IsInRange(data.Skeleton.Nodes.Count(), 1, MODEL_MAX_BONES_PER_MODEL)) { data.Skeleton.Bones.Resize(data.Skeleton.Nodes.Count()); for (int32 i = 0; i < data.Skeleton.Nodes.Count(); i++) @@ -1209,9 +1209,9 @@ bool ModelTool::ImportModel(const String& path, ModelData& data, Options& option } // Check bones limit currently supported by the engine - if (data.Skeleton.Bones.Count() > MAX_BONES_PER_MODEL) + if (data.Skeleton.Bones.Count() > MODEL_MAX_BONES_PER_MODEL) { - errorMsg = String::Format(TEXT("Imported model skeleton has too many bones. Imported: {0}, maximum supported: {1}. Please optimize your asset."), data.Skeleton.Bones.Count(), MAX_BONES_PER_MODEL); + errorMsg = String::Format(TEXT("Imported model skeleton has too many bones. Imported: {0}, maximum supported: {1}. Please optimize your asset."), data.Skeleton.Bones.Count(), MODEL_MAX_BONES_PER_MODEL); return true; } @@ -1317,7 +1317,7 @@ bool ModelTool::ImportModel(const String& path, ModelData& data, Options& option // Check if use a single bone for skinning auto nodeIndex = data.Skeleton.FindNode(mesh->Name); auto boneIndex = data.Skeleton.FindBone(nodeIndex); - if (boneIndex == -1 && nodeIndex != -1 && data.Skeleton.Bones.Count() < MAX_BONES_PER_MODEL) + if (boneIndex == -1 && nodeIndex != -1 && data.Skeleton.Bones.Count() < MODEL_MAX_BONES_PER_MODEL) { // Add missing bone to be used by skinned model from animated nodes pose boneIndex = data.Skeleton.Bones.Count(); diff --git a/Source/Engine/UI/TextRender.cpp b/Source/Engine/UI/TextRender.cpp index 9edb322f5..e1d0f5316 100644 --- a/Source/Engine/UI/TextRender.cpp +++ b/Source/Engine/UI/TextRender.cpp @@ -108,7 +108,7 @@ void TextRender::UpdateLayout() _localBox = BoundingBox(Vector3::Zero); BoundingBox::Transform(_localBox, _transform, _box); BoundingSphere::FromBox(_box, _sphere); -#if USE_PRECISE_MESH_INTERSECTS +#if MODEL_USE_PRECISE_MESH_INTERSECTS _collisionProxy.Clear(); #endif @@ -314,7 +314,7 @@ void TextRender::UpdateLayout() _drawChunks.Add(drawChunk); } -#if USE_PRECISE_MESH_INTERSECTS +#if MODEL_USE_PRECISE_MESH_INTERSECTS // Setup collision proxy for detailed collision detection for triangles const int32 totalIndicesCount = _ib.Data.Count() / sizeof(uint16); _collisionProxy.Init(_vb0.Data.Count() / sizeof(Float3), totalIndicesCount / 3, (Float3*)_vb0.Data.Get(), (uint16*)_ib.Data.Get()); @@ -420,7 +420,7 @@ void TextRender::OnLayerChanged() bool TextRender::IntersectsItself(const Ray& ray, Real& distance, Vector3& normal) { -#if USE_PRECISE_MESH_INTERSECTS +#if MODEL_USE_PRECISE_MESH_INTERSECTS if (_box.Intersects(ray)) { return _collisionProxy.Intersects(ray, _transform, distance, normal); diff --git a/Source/Engine/UI/TextRender.h b/Source/Engine/UI/TextRender.h index 57e48ac9b..d842a9531 100644 --- a/Source/Engine/UI/TextRender.h +++ b/Source/Engine/UI/TextRender.h @@ -11,7 +11,7 @@ #include "Engine/Graphics/DynamicBuffer.h" #include "Engine/Graphics/Models/Config.h" #include "Engine/Localization/LocalizedString.h" -#if USE_PRECISE_MESH_INTERSECTS +#if MODEL_USE_PRECISE_MESH_INTERSECTS #include "Engine/Graphics/Models/CollisionProxy.h" #endif @@ -47,7 +47,7 @@ private: DynamicVertexBuffer _vb0; DynamicVertexBuffer _vb1; DynamicVertexBuffer _vb2; -#if USE_PRECISE_MESH_INTERSECTS +#if MODEL_USE_PRECISE_MESH_INTERSECTS CollisionProxy _collisionProxy; #endif Array> _drawChunks; @@ -143,7 +143,7 @@ public: /// API_FUNCTION() void UpdateLayout(); -#if USE_PRECISE_MESH_INTERSECTS +#if MODEL_USE_PRECISE_MESH_INTERSECTS /// /// Gets the collision proxy used by the text geometry. ///