1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Put all pieces together and clean up leftover code

This commit is contained in:
sfan5 2024-08-28 21:46:52 +02:00
parent 6b7fc1e9fe
commit 62131fe295
11 changed files with 105 additions and 169 deletions

View file

@ -192,6 +192,7 @@ IAnimatedMesh *COBJMeshFileLoader::createMesh(io::IReadFile *file)
faceCorners.set_used(0); // fast clear
// read in all vertices
auto &Vertices = currMtl->Meshbuffer->Vertices->Data;
linePtr = goNextWord(linePtr, endPtr);
while (0 != linePtr[0]) {
// Array to communicate with retrieveVertexIndices()
@ -228,8 +229,8 @@ IAnimatedMesh *COBJMeshFileLoader::createMesh(io::IReadFile *file)
if (n != currMtl->VertMap.end()) {
vertLocation = n->second;
} else {
currMtl->Meshbuffer->VertexBuffer().push_back(v);
vertLocation = currMtl->Meshbuffer->VertexBuffer().size() - 1;
Vertices.push_back(v);
vertLocation = Vertices.size() - 1;
currMtl->VertMap.emplace(v, vertLocation);
}
@ -247,7 +248,7 @@ IAnimatedMesh *COBJMeshFileLoader::createMesh(io::IReadFile *file)
}
// triangulate the face
auto &Indices = currMtl->Meshbuffer->IndexBuffer();
auto &Indices = currMtl->Meshbuffer->Indices->Data;
const int c = faceCorners[0];
for (u32 i = 1; i < faceCorners.size() - 1; ++i) {
// Add a triangle