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

@@ -292,9 +292,33 @@ namespace scene
return getTypeT();
}
//! Create copy of the meshbuffer
virtual IMeshBuffer* createClone(int cloneFlags) const IRR_OVERRIDE
{
CMeshBuffer<T> * clone = new CMeshBuffer<T>();
if (cloneFlags & ECF_VERTICES)
{
clone->Vertices = Vertices;
clone->BoundingBox = BoundingBox;
}
if (cloneFlags & ECF_INDICES)
{
clone->Indices = Indices;
}
clone->PrimitiveType = PrimitiveType;
clone->Material = getMaterial();
clone->MappingHint_Vertex = MappingHint_Vertex;
clone->MappingHint_Index = MappingHint_Index;
return clone;
}
//! Returns type of the class implementing the IMeshBuffer for template specialization
// Minor note: Some compilers (VS) allow directly specializating the virtual function,
// but this will fail on other compilers (GCC).
// Minor note: Some compilers (VS) allow directly specializing the virtual function,
// but this will fail on other compilers (GCC). So using a helper function.
EMESH_BUFFER_TYPE getTypeT() const;
u32 ChangedID_Vertex;