Update mesh config defines to match a single format
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -108,7 +108,7 @@ bool MeshBase::Init(uint32 vertices, uint32 triangles, const Array<const void*,
|
||||
goto ERROR_LOAD_END;
|
||||
|
||||
// Init collision proxy
|
||||
#if USE_PRECISE_MESH_INTERSECTS
|
||||
#if MODEL_USE_PRECISE_MESH_INTERSECTS
|
||||
if (!_collisionProxy.HasData())
|
||||
{
|
||||
if (use16BitIndexBuffer)
|
||||
@@ -148,6 +148,9 @@ void MeshBase::Release()
|
||||
SAFE_DELETE_GPU_RESOURCE(_vertexBuffers[1]);
|
||||
SAFE_DELETE_GPU_RESOURCE(_vertexBuffers[2]);
|
||||
SAFE_DELETE_GPU_RESOURCE(_indexBuffer);
|
||||
#if MODEL_USE_PRECISE_MESH_INTERSECTS
|
||||
_collisionProxy.Clear();
|
||||
#endif
|
||||
_triangles = 0;
|
||||
_vertices = 0;
|
||||
_use16BitIndexBuffer = false;
|
||||
@@ -194,7 +197,7 @@ bool MeshBase::Intersects(const Ray& ray, const Matrix& world, Real& distance, V
|
||||
const BoundingBox transformedBox(min, max);
|
||||
|
||||
// Test ray on box
|
||||
#if USE_PRECISE_MESH_INTERSECTS
|
||||
#if MODEL_USE_PRECISE_MESH_INTERSECTS
|
||||
if (transformedBox.Intersects(ray, distance))
|
||||
{
|
||||
// Use exact test on raw geometry
|
||||
@@ -226,7 +229,7 @@ bool MeshBase::Intersects(const Ray& ray, const Transform& transform, Real& dist
|
||||
const BoundingBox transformedBox(min, max);
|
||||
|
||||
// Test ray on box
|
||||
#if USE_PRECISE_MESH_INTERSECTS
|
||||
#if MODEL_USE_PRECISE_MESH_INTERSECTS
|
||||
if (transformedBox.Intersects(ray, distance))
|
||||
{
|
||||
// Use exact test on raw geometry
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include "Engine/Level/Types.h"
|
||||
#include "Engine/Scripting/ScriptingObject.h"
|
||||
#include "Config.h"
|
||||
#if USE_PRECISE_MESH_INTERSECTS
|
||||
#if MODEL_USE_PRECISE_MESH_INTERSECTS
|
||||
#include "CollisionProxy.h"
|
||||
#endif
|
||||
|
||||
@@ -54,7 +54,7 @@ protected:
|
||||
mutable Array<byte> _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
|
||||
/// <summary>
|
||||
/// Gets the collision proxy used by the mesh.
|
||||
/// </summary>
|
||||
|
||||
@@ -214,7 +214,7 @@ void Cloth::SetPaint(Span<const float> 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
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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<DrawChunk, InlinedAllocation<8>> _drawChunks;
|
||||
@@ -143,7 +143,7 @@ public:
|
||||
/// </summary>
|
||||
API_FUNCTION() void UpdateLayout();
|
||||
|
||||
#if USE_PRECISE_MESH_INTERSECTS
|
||||
#if MODEL_USE_PRECISE_MESH_INTERSECTS
|
||||
/// <summary>
|
||||
/// Gets the collision proxy used by the text geometry.
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user