Skip to content

Commit 8240af0

Browse files
#4465 modify vertex limit threshold for starting splitting
1 parent a33fda4 commit 8240af0

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

indra/newview/gltf/llgltfloader.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,8 @@ static const glm::mat4 coord_system_rotationxy(
8787
0.f, 0.f, 0.f, 1.f
8888
);
8989

90-
static const S32 VERTICIES_LIMIT = USHRT_MAX - 2;
90+
static const S32 VERTEX_SPLIT_SAFETY_MARGIN = 3 * 3 + 1; // 10 vertices: 3 complete triangles plus remapping overhead
91+
static const S32 VERTEX_LIMIT = USHRT_MAX - VERTEX_SPLIT_SAFETY_MARGIN;
9192

9293
LLGLTFLoader::LLGLTFLoader(std::string filename,
9394
S32 lod,
@@ -951,7 +952,7 @@ bool LLGLTFLoader::populateModelFromMesh(LLModel* pModel, const std::string& bas
951952
}
952953

953954
// Indices handling
954-
if (faceVertices.size() >= VERTICIES_LIMIT)
955+
if (faceVertices.size() >= VERTEX_LIMIT)
955956
{
956957
// Will have to remap 32 bit indices into 16 bit indices
957958
// For the sake of simplicity build vector of 32 bit indices first
@@ -1036,7 +1037,7 @@ bool LLGLTFLoader::populateModelFromMesh(LLModel* pModel, const std::string& bas
10361037
}
10371038
indices_16.push_back((U16)vert_index);
10381039

1039-
if (indices_16.size() % 3 == 0 && face_verts.size() >= VERTICIES_LIMIT - 1)
1040+
if (indices_16.size() % 3 == 0 && face_verts.size() >= VERTEX_LIMIT)
10401041
{
10411042
LLVolumeFace face;
10421043
face.fillFromLegacyData(face_verts, indices_16);

0 commit comments

Comments
 (0)