Skip to content

Commit

Permalink
Truncate vertices and triangles when building meshlets
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexanderEkdahl authored and Uriopass committed Nov 30, 2024
1 parent 73405cb commit 2727315
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/clusterize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,14 @@ pub fn build_meshlets(
cone_weight,
)
};

let last_meshlet = meshlets[count - 1];
meshlet_verts
.truncate(last_meshlet.vertex_offset as usize + last_meshlet.vertex_count as usize);
meshlet_tris.truncate(
last_meshlet.triangle_offset as usize
+ ((last_meshlet.triangle_count as usize * 3 + 3) & !3),
);
meshlets.truncate(count);

for meshlet in meshlets.iter_mut().take(count) {
Expand Down

0 comments on commit 2727315

Please sign in to comment.