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

Function build_surface_lods

perro_source/render_stack/perro_meshlets/src/lib.rs:248–269  ·  view source on GitHub ↗
(
    vertices: &[LodVertex],
    surface_indices: &[u32],
    ratios: &[f32],
)

Source from the content-addressed store, hash-verified

246 vertices: &[LodVertex],
247 indices: &[u32],
248 surface_ranges: &[LodSurfaceRange],
249 target_ratios: &[f32],
250) -> Vec<LodSet> {
251 try_build_lod_sets(vertices, indices, surface_ranges, target_ratios).unwrap_or_else(|_| {
252 vec![LodSet {
253 indices: indices.to_vec(),
254 surface_ranges: vec![LodSurfaceRange {
255 index_start: 0,
256 index_count: u32::try_from(indices.len()).unwrap_or(u32::MAX),
257 }],
258 }]
259 })
260}
261
262pub fn try_build_lod_sets(
263 vertices: &[LodVertex],
264 indices: &[u32],
265 surface_ranges: &[LodSurfaceRange],
266 target_ratios: &[f32],
267) -> Result<Vec<LodSet>, MeshletBuildError> {
268 let base_surfaces = if surface_ranges.is_empty() {
269 vec![LodSurfaceRange {
270 index_start: 0,
271 index_count: indices.len() as u32,
272 }]

Callers 1

build_lod_setsFunction · 0.85

Calls 7

simplify_surfaceFunction · 0.85
to_vecMethod · 0.80
cloneMethod · 0.80
lenMethod · 0.45
iterMethod · 0.45
clampMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected