Merge pull request #96880 from zeux/fix-vcache-nontri

Fix a crash in `ImporterMesh::create_shadow_mesh` for non-triangle surfaces
This commit is contained in:
Rémi Verschelde 2024-09-12 09:26:01 +02:00
commit b214aa8faf
No known key found for this signature in database
GPG Key ID: C3336907360768E1
1 changed files with 2 additions and 2 deletions

View File

@ -859,7 +859,7 @@ void ImporterMesh::create_shadow_mesh() {
index_wptr[j] = vertex_remap[index];
}
if (SurfaceTool::optimize_vertex_cache_func) {
if (SurfaceTool::optimize_vertex_cache_func && surfaces[i].primitive == Mesh::PRIMITIVE_TRIANGLES) {
SurfaceTool::optimize_vertex_cache_func((unsigned int *)index_wptr, (const unsigned int *)index_wptr, index_count, new_vertices.size());
}
@ -881,7 +881,7 @@ void ImporterMesh::create_shadow_mesh() {
index_wptr[k] = vertex_remap[index];
}
if (SurfaceTool::optimize_vertex_cache_func) {
if (SurfaceTool::optimize_vertex_cache_func && surfaces[i].primitive == Mesh::PRIMITIVE_TRIANGLES) {
SurfaceTool::optimize_vertex_cache_func((unsigned int *)index_wptr, (const unsigned int *)index_wptr, index_count, new_vertices.size());
}