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

Irrlicht cleanups (mostly getting rid of core::array)

Co-authored-by: Lars Müller <34514239+appgurueu@users.noreply.github.com>
This commit is contained in:
sfan5 2024-08-17 19:49:11 +02:00 committed by GitHub
parent 5acc2736db
commit 5d226268df
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
45 changed files with 308 additions and 1227 deletions

View file

@ -273,12 +273,12 @@ bool CXMeshFileLoader::load(io::IReadFile *file)
}
if (mesh->TCoords2.size()) {
for (i = 0; i != mesh->Buffers.size(); ++i) {
mesh->Buffers[i]->Vertices_2TCoords.reallocate(vCountArray[i]);
mesh->Buffers[i]->Vertices_2TCoords.reserve(vCountArray[i]);
mesh->Buffers[i]->VertexType = video::EVT_2TCOORDS;
}
} else {
for (i = 0; i != mesh->Buffers.size(); ++i)
mesh->Buffers[i]->Vertices_Standard.reallocate(vCountArray[i]);
mesh->Buffers[i]->Vertices_Standard.reserve(vCountArray[i]);
}
verticesLinkIndex.set_used(mesh->Vertices.size());
@ -291,10 +291,10 @@ bool CXMeshFileLoader::load(io::IReadFile *file)
if (mesh->TCoords2.size()) {
verticesLinkIndex[i] = buffer->Vertices_2TCoords.size();
buffer->Vertices_2TCoords.push_back(mesh->Vertices[i]);
buffer->Vertices_2TCoords.emplace_back(mesh->Vertices[i]);
// We have a problem with correct tcoord2 handling here
// crash fixed for now by checking the values
buffer->Vertices_2TCoords.getLast().TCoords2 = (i < mesh->TCoords2.size()) ? mesh->TCoords2[i] : mesh->Vertices[i].TCoords;
buffer->Vertices_2TCoords.back().TCoords2 = (i < mesh->TCoords2.size()) ? mesh->TCoords2[i] : mesh->Vertices[i].TCoords;
} else {
verticesLinkIndex[i] = buffer->Vertices_Standard.size();
buffer->Vertices_Standard.push_back(mesh->Vertices[i]);
@ -306,7 +306,7 @@ bool CXMeshFileLoader::load(io::IReadFile *file)
for (i = 0; i < mesh->FaceMaterialIndices.size(); ++i)
++vCountArray[mesh->FaceMaterialIndices[i]];
for (i = 0; i != mesh->Buffers.size(); ++i)
mesh->Buffers[i]->Indices.reallocate(vCountArray[i]);
mesh->Buffers[i]->Indices.reserve(vCountArray[i]);
delete[] vCountArray;
// create indices per buffer
for (i = 0; i < mesh->FaceMaterialIndices.size(); ++i) {