ImporterMesh: Validate triangle indices array size is a multiple of 3

This commit is contained in:
Aaron Franke
2025-08-16 00:33:06 -07:00
parent 0c51ede243
commit ba92af7d07
3 changed files with 23 additions and 19 deletions

View File

@ -322,6 +322,7 @@ void ImporterMesh::generate_lods(float p_normal_merge_angle, Array p_bone_transf
if (index_count == 0) {
continue; //no lods if no indices
}
ERR_FAIL_COND_MSG(index_count % 3 != 0, "ImporterMesh::generate_lods: Indexed triangle meshes MUST have an index array with a size that is a multiple of 3, but got " + itos(index_count) + " indices. Cannot generate LODs for this invalid mesh.");
const Vector3 *vertices_ptr = vertices.ptr();
const int *indices_ptr = indices.ptr();