1
0

Add IMeshBufffer::clone for buffer copies, use it in CMeshManipulator::createMeshCopy

CMeshManipulator::createMeshCopy creates new meshes which have copies of the actual meshbuffers instead of copying everything into SMeshBuffers (which didn't support 32 bit or any of the other special features).



git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6335 dfc29bdd-3216-0410-991c-e03cc46cb475
This commit is contained in:
cutealien
2022-04-14 16:54:06 +00:00
parent 8447d3f531
commit c5b349ddb0
11 changed files with 151 additions and 71 deletions

View File

@@ -172,9 +172,16 @@ namespace scene
}
//! append the vertices and indices to the current buffer
virtual void append(const void* const vertices, u32 numVertices, const u16* const indices, u32 numIndices) IRR_OVERRIDE {}
virtual void append(const void* const vertices, u32 numVertices, const u16* const indices, u32 numIndices) IRR_OVERRIDE
{
// can't do that as it doesn't own the vertex memory
}
//! append the meshbuffer to the current buffer
virtual void append(const IMeshBuffer* const other) IRR_OVERRIDE {}
virtual void append(const IMeshBuffer* const other) IRR_OVERRIDE
{
// can't do that as it doesn't own the vertex memory
}
//! get the current hardware mapping hint
virtual E_HARDWARE_MAPPING getHardwareMappingHint_Vertex() const IRR_OVERRIDE
@@ -232,6 +239,30 @@ namespace scene
return EMBT_SHARED;
}
//! Create copy of the meshbuffer
virtual IMeshBuffer* createClone(int cloneFlags) const IRR_OVERRIDE
{
SSharedMeshBuffer * clone = new SSharedMeshBuffer();
if (cloneFlags & ECF_VERTICES)
{
clone->Vertices = Vertices;
clone->BoundingBox = BoundingBox;
}
if (cloneFlags & ECF_INDICES)
{
clone->Indices = Indices;
}
clone->Material = Material;
clone->MappingHintVertex = MappingHintVertex;
clone->MappingHintIndex = MappingHintIndex;
clone->PrimitiveType = PrimitiveType;
return clone;
}
//! Material of this meshBuffer
video::SMaterial Material;