From 19bc2f4f90586b902a010bd7ccd189e3088e35e3 Mon Sep 17 00:00:00 2001 From: Johannes Sixt Date: Sat, 13 Mar 2021 11:59:57 +0100 Subject: [PATCH] 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. --- common/lc_meshloader.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/lc_meshloader.cpp b/common/lc_meshloader.cpp index 89c2caef..5787c538 100644 --- a/common/lc_meshloader.cpp +++ b/common/lc_meshloader.cpp @@ -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(Mesh, Section, SectionMin, SectionMax); else UpdateMeshSectionBoundingBox(Mesh, Section, SectionMin, SectionMax);