Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions indra/newview/gltf/llgltfloader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ static const glm::mat4 coord_system_rotationxy(
0.f, 0.f, 0.f, 1.f
);

static const S32 VERTICIES_LIMIT = USHRT_MAX - 2;

LLGLTFLoader::LLGLTFLoader(std::string filename,
S32 lod,
LLModelLoader::load_callback_t load_cb,
Expand Down Expand Up @@ -889,7 +891,7 @@ bool LLGLTFLoader::populateModelFromMesh(LLModel* pModel, const LL::GLTF::Mesh&
mats[materialName] = impMat;

// Indices handling
if (faceVertices.size() >= USHRT_MAX)
if (faceVertices.size() >= VERTICIES_LIMIT)
{
// Will have to remap 32 bit indices into 16 bit indices
// For the sake of simplicity build vector of 32 bit indices first
Expand Down Expand Up @@ -957,7 +959,7 @@ bool LLGLTFLoader::populateModelFromMesh(LLModel* pModel, const LL::GLTF::Mesh&
}
indices_16.push_back((U16)vert_index);

if (indices_16.size() % 3 == 0 && face_verts.size() >= 65532)
if (indices_16.size() % 3 == 0 && face_verts.size() >= VERTICIES_LIMIT - 1)
{
LLVolumeFace face;
face.fillFromLegacyData(face_verts, indices_16);
Expand Down
Loading