Fix check for type of mesh index.

The index type does not only depend on the number of geometry vertices,
but also on the number of conditional line vertices. Check the stored
type, not the number of vertices.
This commit is contained in:
Johannes Sixt
2021-03-13 11:59:57 +01:00
parent 57c4f2912d
commit 19bc2f4f90
+2 -2
View File
@@ -1123,7 +1123,7 @@ lcMesh* lcLibraryMeshData::CreateMesh()
if (DstSection.Texture)
DstSection.Texture->AddRef();
if (Mesh->mNumVertices < 0x10000)
if (Mesh->mIndexType == GL_UNSIGNED_SHORT)
{
DstSection.IndexOffset = NumIndices * 2;
@@ -1294,7 +1294,7 @@ void lcLibraryMeshData::UpdateMeshBoundingBox(lcMesh* Mesh)
lcMeshSection& Section = Lod.Sections[SectionIdx];
lcVector3 SectionMin(FLT_MAX, FLT_MAX, FLT_MAX), SectionMax(-FLT_MAX, -FLT_MAX, -FLT_MAX);
if (Mesh->mNumVertices < 0x10000)
if (Mesh->mIndexType == GL_UNSIGNED_SHORT)
UpdateMeshSectionBoundingBox<quint16>(Mesh, Section, SectionMin, SectionMax);
else
UpdateMeshSectionBoundingBox<quint32>(Mesh, Section, SectionMin, SectionMax);