From 2056679e98cf00592a92ef87fcc76a94d7509ac8 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Wed, 7 May 2025 10:15:54 +0200 Subject: [PATCH] Fix: Support uint16 indices in OpenGEX as well (#6137) Co-authored-by: Kim Kulling --- code/AssetLib/OpenGEX/OpenGEXImporter.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/code/AssetLib/OpenGEX/OpenGEXImporter.cpp b/code/AssetLib/OpenGEX/OpenGEXImporter.cpp index e01253fee..8f6ef54d5 100644 --- a/code/AssetLib/OpenGEX/OpenGEXImporter.cpp +++ b/code/AssetLib/OpenGEX/OpenGEXImporter.cpp @@ -913,7 +913,13 @@ void OpenGEXImporter::handleIndexArrayNode(ODDLParser::DDLNode *node, aiScene * current.mIndices = new unsigned int[current.mNumIndices]; Value *next(vaList->m_dataList); for (size_t indices = 0; indices < current.mNumIndices; indices++) { - const int idx(next->getUnsignedInt32()); + int idx = -1; + if (next->m_type == Value::ValueType::ddl_unsigned_int16) { + idx = next->getUnsignedInt16(); + } else if (next->m_type == Value::ValueType::ddl_unsigned_int32) { + idx = next->getUnsignedInt32(); + } + ai_assert(static_cast(idx) <= m_currentVertices.m_vertices.size()); ai_assert(index < m_currentMesh->mNumVertices); aiVector3D &pos = (m_currentVertices.m_vertices[idx]);