Move mesh and skinned mesh options into shared base

This commit is contained in:
Wojtek Figat
2021-11-05 12:07:00 +01:00
parent 18f9d782ae
commit 1f12e37412
3 changed files with 20 additions and 31 deletions

View File

@@ -23,8 +23,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;
GPUBuffer* _vertexBuffers[3];
GPUBuffer* _indexBuffer;
@@ -60,26 +58,9 @@ public:
return (Model*)_model;
}
/// <summary>
/// Gets the mesh parent LOD index.
/// </summary>
FORCE_INLINE int32 GetLODIndex() const
{
return _lodIndex;
}
/// <summary>
/// Gets the mesh index.
/// </summary>
FORCE_INLINE int32 GetIndex() const
{
return _index;
}
/// <summary>
/// Gets the index buffer.
/// </summary>
/// <returns>The buffer.</returns>
FORCE_INLINE GPUBuffer* GetIndexBuffer() const
{
return _indexBuffer;

View File

@@ -20,12 +20,14 @@ DECLARE_SCRIPTING_TYPE_MINIMAL(MeshBase);
protected:
ModelBase* _model;
bool _use16BitIndexBuffer;
BoundingBox _box;
BoundingSphere _sphere;
int32 _index;
int32 _lodIndex;
uint32 _vertices;
uint32 _triangles;
int32 _materialSlotIndex;
bool _use16BitIndexBuffer;
explicit MeshBase(const SpawnParams& params)
: PersistentScriptingObject(params)
@@ -37,11 +39,27 @@ public:
/// <summary>
/// Gets the model owning this mesh.
/// </summary>
FORCE_INLINE ModelBase* GetModelBase() const
API_PROPERTY() FORCE_INLINE ModelBase* GetModelBase() const
{
return _model;
}
/// <summary>
/// Gets the mesh parent LOD index.
/// </summary>
API_PROPERTY() FORCE_INLINE int32 GetLODIndex() const
{
return _lodIndex;
}
/// <summary>
/// Gets the mesh index.
/// </summary>
API_PROPERTY() FORCE_INLINE int32 GetIndex() const
{
return _index;
}
/// <summary>
/// Gets the triangle count.
/// </summary>

View File

@@ -19,8 +19,6 @@ API_CLASS(NoSpawn) class FLAXENGINE_API SkinnedMesh : public MeshBase
DECLARE_SCRIPTING_TYPE_WITH_CONSTRUCTOR_IMPL(SkinnedMesh, MeshBase);
protected:
int32 _index;
int32 _lodIndex;
GPUBuffer* _vertexBuffer;
GPUBuffer* _indexBuffer;
mutable Array<byte> _cachedIndexBuffer;
@@ -52,14 +50,6 @@ public:
return (SkinnedModel*)_model;
}
/// <summary>
/// Gets the mesh index.
/// </summary>
FORCE_INLINE int32 GetIndex() const
{
return _index;
}
/// <summary>
/// Determines whether this mesh is initialized (has vertex and index buffers initialized).
/// </summary>