Skip to content

Commit

Permalink
Merge pull request #96880 from zeux/fix-vcache-nontri
Browse files Browse the repository at this point in the history
Fix a crash in `ImporterMesh::create_shadow_mesh` for non-triangle surfaces
  • Loading branch information
akien-mga committed Sep 12, 2024
2 parents ae50e9e + 7d7b43b commit b214aa8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions scene/resources/3d/importer_mesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}

Expand All @@ -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());
}

Expand Down

0 comments on commit b214aa8

Please sign in to comment.