Merge pull request #657 from j6t/fix-indextype-in-meshloader

Fix check for type of mesh index.
This commit is contained in:
Leonardo Zide 2021-03-13 09:20:30 -08:00 committed by GitHub
commit 2f664f5a1c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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);