MCPcopy Create free account
hub / github.com/PerroEngine/Perro / meshlet_bounds

Function meshlet_bounds

perro_source/render_stack/perro_meshlets/src/lib.rs:718–736  ·  view source on GitHub ↗
(positions: &[[f32; 3]], indices: &[u32])

Source from the content-addressed store, hash-verified

716 };
717 let mut q = quadrics.get(keep as usize).copied().unwrap_or([0.0; 10]);
718 let rq = quadrics.get(remove as usize).copied().unwrap_or([0.0; 10]);
719 for (dst, src) in q.iter_mut().zip(rq.iter()) {
720 *dst += *src;
721 }
722 let p = [
723 keep_v.position[0] as f64,
724 keep_v.position[1] as f64,
725 keep_v.position[2] as f64,
726 ];
727 let qem = eval_quadric(q, p);
728 let uv = dist2_2(keep_v.uv, remove_v.uv) as f64;
729 let normal = (1.0 - dot3(keep_v.normal, remove_v.normal).clamp(-1.0, 1.0) as f64).max(0.0);
730 let len = dist2_3(keep_v.position, remove_v.position) as f64;
731 let uv_scale = metric.position_extent2 / metric.uv_extent2;
732 qem + len * 0.001 + uv * uv_scale * 0.1 + normal * metric.position_extent2 * 0.5
733}
734
735fn collapse_preserves_normals(
736 vertices: &[LodVertex],
737 triangles: &[[u32; 3]],
738 adjacency: &[Vec<usize>],
739 tri_normals: &[Option<[f32; 3]>],

Callers 1

Calls 4

getMethod · 0.45
minMethod · 0.45
maxMethod · 0.45
to_arrayMethod · 0.45

Tested by

no test coverage detected