Merge pull request #2010 from Domanffe/perf/skip-lookup-once

🤖 Agent: contrib-gate-17 verified this head (26.3 sources, integration tree build, clippy, tests, parity; details in the PR comment). Thanks @Domanffe!
This commit is contained in:
Ludovic Marie
2026-10-26 14:13:29 +01:00
committed by GitHub
+5 -1
View File
@@ -951,7 +951,10 @@ fn draw_normals(
return; return;
} }
let normals = normals.part(p); let normals = normals.part(p);
for poly in part.polygons.iter().filter(|_| !poses.skips(part)) { // `skips` is a name lookup: ask once per part, not once per polygon. A part
// hidden this way still draws its children, so only the polygons are gated.
if !poses.skips(part) {
for poly in &part.polygons {
let normal = poly.vertex_normal(normals); let normal = poly.vertex_normal(normals);
for v in poly.vertices { for v in poly.vertices {
let pos = m.transform_point3(glam::Vec3::new(v[0], v[1], v[2]) / 16.0); let pos = m.transform_point3(glam::Vec3::new(v[0], v[1], v[2]) / 16.0);
@@ -968,6 +971,7 @@ fn draw_normals(
}); });
} }
} }
}
for c in &part.children { for c in &part.children {
draw_normals(c, m, normals, poses, uv, color, light, overlay, out); draw_normals(c, m, normals, poses, uv, color, light, overlay, out);
} }