summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxim Nikolenko <maximnproductengine@lindenlab.com>2025-07-31 19:55:28 +0300
committerGitHub <noreply@github.com>2025-07-31 19:55:28 +0300
commit8240af03b9c64572ce0594052e18d374d6e8941c (patch)
treef9e310ae9f8c332afa04a7f7a806429df5a87cbc
parenta33fda4f288859222a1d2409e340f42b5aa5dd20 (diff)
#4465 modify vertex limit threshold for starting splitting
-rw-r--r--indra/newview/gltf/llgltfloader.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/indra/newview/gltf/llgltfloader.cpp b/indra/newview/gltf/llgltfloader.cpp
index 950e98c96d..dd1d327683 100644
--- a/indra/newview/gltf/llgltfloader.cpp
+++ b/indra/newview/gltf/llgltfloader.cpp
@@ -87,7 +87,8 @@ static const glm::mat4 coord_system_rotationxy(
0.f, 0.f, 0.f, 1.f
);
-static const S32 VERTICIES_LIMIT = USHRT_MAX - 2;
+static const S32 VERTEX_SPLIT_SAFETY_MARGIN = 3 * 3 + 1; // 10 vertices: 3 complete triangles plus remapping overhead
+static const S32 VERTEX_LIMIT = USHRT_MAX - VERTEX_SPLIT_SAFETY_MARGIN;
LLGLTFLoader::LLGLTFLoader(std::string filename,
S32 lod,
@@ -951,7 +952,7 @@ bool LLGLTFLoader::populateModelFromMesh(LLModel* pModel, const std::string& bas
}
// Indices handling
- if (faceVertices.size() >= VERTICIES_LIMIT)
+ if (faceVertices.size() >= VERTEX_LIMIT)
{
// Will have to remap 32 bit indices into 16 bit indices
// 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
}
indices_16.push_back((U16)vert_index);
- if (indices_16.size() % 3 == 0 && face_verts.size() >= VERTICIES_LIMIT - 1)
+ if (indices_16.size() % 3 == 0 && face_verts.size() >= VERTEX_LIMIT)
{
LLVolumeFace face;
face.fillFromLegacyData(face_verts, indices_16);