diff options
| author | Andrey Lihatskiy <alihatskiy@productengine.com> | 2025-05-26 17:43:56 +0300 |
|---|---|---|
| committer | Andrey Lihatskiy <alihatskiy@productengine.com> | 2025-05-26 17:45:57 +0300 |
| commit | a364b5ee1d4c009b2e571fde66272ae06e434c21 (patch) | |
| tree | e3cdbcd83535068a419ff8601e1d978bf75393c2 /indra/newview/gltf/llgltfloader.cpp | |
| parent | d342aa79c24fe20d06a018eabdb03912d11d4702 (diff) | |
#4109 Add validation for non-triangulated geometry in GLTF loader
Diffstat (limited to 'indra/newview/gltf/llgltfloader.cpp')
| -rw-r--r-- | indra/newview/gltf/llgltfloader.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/indra/newview/gltf/llgltfloader.cpp b/indra/newview/gltf/llgltfloader.cpp index de7c341cdf..93ed904f2e 100644 --- a/indra/newview/gltf/llgltfloader.cpp +++ b/indra/newview/gltf/llgltfloader.cpp @@ -461,6 +461,16 @@ bool LLGLTFLoader::populateModelFromMesh(LLModel* pModel, const LL::GLTF::Mesh& vertices.push_back(vert); } + if (prim.getIndexCount() % 3 != 0) + { + LL_WARNS("GLTF_IMPORT") << "Invalid primitive: index count " << prim.getIndexCount() + << " is not divisible by 3. GLTF files must contain triangulated geometry." << LL_ENDL; + LLSD args; + args["Message"] = "InvalidGeometryNonTriangulated"; + mWarningsArray.append(args); + continue; // Skip this primitive + } + // When processing indices, flip winding order if needed for (U32 i = 0; i < prim.getIndexCount(); i += 3) { |
