mirror of
https://github.com/minetest/irrlicht.git
synced 2025-07-01 15:50:27 +02:00
Fix gltf static mesh loading issues (#14)
* Support u8 / u32 indices * Skip primitives without vertices * Add support for non-indexed geometry & skipping primitives * Fix possible memory leak on error * Use SSkinnedMesh * Check indices * Properly mirror node hierarchy * Update .gitignore * Reorder includes * Add some throws for logic errors * Fix non-indexed geometry winding order, add unit test * Address code review comments * Add matrix transform unit test
This commit is contained in:
committed by
Josiah VanderZee
parent
0faf1320c5
commit
036b40a9d8
@ -301,7 +301,31 @@ struct SSkinMeshBuffer : public IMeshBuffer
|
||||
}
|
||||
|
||||
//! append the vertices and indices to the current buffer
|
||||
void append(const void *const vertices, u32 numVertices, const u16 *const indices, u32 numIndices) override {}
|
||||
void append(const void* const vertices, u32 numVertices, const u16* const indices, u32 numIndices) override {
|
||||
if (vertices == getVertices())
|
||||
throw std::logic_error("can't append own vertices");
|
||||
|
||||
if (VertexType != video::EVT_STANDARD)
|
||||
throw std::logic_error("invalid vertex type");
|
||||
|
||||
const u32 prevVertexCount = getVertexCount();
|
||||
|
||||
Vertices_Standard.reallocate(prevVertexCount + numVertices);
|
||||
for (u32 i=0; i < numVertices; ++i) {
|
||||
Vertices_Standard.push_back(static_cast<const video::S3DVertex* const>(vertices)[i]);
|
||||
BoundingBox.addInternalPoint(static_cast<const video::S3DVertex* const>(vertices)[i].Pos);
|
||||
}
|
||||
|
||||
Indices.reallocate(getIndexCount() + numIndices);
|
||||
for (u32 i=0; i < numIndices; ++i) {
|
||||
Indices.push_back(indices[i] + prevVertexCount);
|
||||
}
|
||||
}
|
||||
|
||||
//! NOT IMPLEMENTED YET: append the meshbuffer to the current buffer
|
||||
void append(const IMeshBuffer* const other) override {
|
||||
throw std::logic_error("not implemented yet");
|
||||
}
|
||||
|
||||
//! get the current hardware mapping hint for vertex buffers
|
||||
E_HARDWARE_MAPPING getHardwareMappingHint_Vertex() const override
|
||||
|
Reference in New Issue
Block a user