pub struct Mesh3D { /* private fields */ }Expand description
Indexed triangle mesh with local axis-aligned bounding box, Nanite-style meshlet clusters, and default PBR material.
Implementations§
Source§impl Mesh3D
Mesh construction, Nanite-style meshlet clustering, decimation, and procedural asset generators for Mesh3D.
impl Mesh3D
Mesh construction, Nanite-style meshlet clustering, decimation, and procedural asset generators for Mesh3D.
Sourcepub fn build_meshlets_from_parts(
vertices: &[Vertex3D],
indices: &[[u32; 3]],
) -> Vec<Meshlet3D>
pub fn build_meshlets_from_parts( vertices: &[Vertex3D], indices: &[[u32; 3]], ) -> Vec<Meshlet3D>
Sourcepub fn from_parts(
name: String,
vertices: Vec<Vertex3D>,
indices: Vec<[u32; 3]>,
material: PbrMaterial,
) -> Mesh3D
pub fn from_parts( name: String, vertices: Vec<Vertex3D>, indices: Vec<[u32; 3]>, material: PbrMaterial, ) -> Mesh3D
Sourcepub fn compute_smooth_normals(&mut self)
pub fn compute_smooth_normals(&mut self)
Recomputes area-weighted smooth per-vertex normals across all indexed triangles.
§Arguments
&Self- Mutable 3D mesh.
Sourcepub fn compute_lengyel_tangents(&mut self)
pub fn compute_lengyel_tangents(&mut self)
Computes MikkTSpace-compatible Lengyel tangent-space vectors (tx, ty, tz, handedness) from positions, normals, and uv0.
§Arguments
&Self- Mutable 3D mesh.
Sourcepub fn resolve_triangle_material(
&self,
tri_index: usize,
primary_material: PbrMaterial,
) -> (PbrMaterial, u16)
pub fn resolve_triangle_material( &self, tri_index: usize, primary_material: PbrMaterial, ) -> (PbrMaterial, u16)
Sourcepub fn box_mesh(
name: &str,
width_val: f32,
height_val: f32,
delta_val: f32,
ground_pivot: bool,
material: PbrMaterial,
) -> Mesh3D
pub fn box_mesh( name: &str, width_val: f32, height_val: f32, delta_val: f32, ground_pivot: bool, material: PbrMaterial, ) -> Mesh3D
Generates an axis-aligned box mesh of dimensions (w, h, d) resting on y = 0 or centered.
§Arguments
&str- Mesh name.f32- Width along X.f32- Height along Y.f32- Depth along Z.bool- Whentrue, base rests ony = 0; otherwise centered at origin.PbrMaterial- Surface PBR material.
§Returns
Self- Indexed 12-triangle box mesh with crisp flat face normals.
Sourcepub fn ground_plane(
name: &str,
width_val: f32,
delta_val: f32,
subdivisions: usize,
material: PbrMaterial,
) -> Mesh3D
pub fn ground_plane( name: &str, width_val: f32, delta_val: f32, subdivisions: usize, material: PbrMaterial, ) -> Mesh3D
Sourcepub fn coastal_ocean_ring(
name: &str,
outer_span: f32,
inner_half_x: f32,
inner_half_z: f32,
subdivisions: usize,
material: PbrMaterial,
) -> Mesh3D
pub fn coastal_ocean_ring( name: &str, outer_span: f32, inner_half_x: f32, inner_half_z: f32, subdivisions: usize, material: PbrMaterial, ) -> Mesh3D
Builds a subdivided coastal ocean water ring mesh spanning outer_span while omitting submerged interior quads strictly inside the solid island footprint and grouping triangles into spatially coherent 4x4 blocks for Nanite frustum culling.
§Arguments
&str- Mesh asset name.f32- Total horizontal outer span in meters along X and Z.f32- Solid island half-width along X in meters.f32- Solid island half-depth along Z in meters.usize- Grid subdivisions along each axis (8..=32).PbrMaterial- Ocean water PBR material.
§Returns
Self- Watertight coastal ocean ring mesh with spatial meshlets.
Sourcepub fn sports_car(name: &str, material: PbrMaterial) -> Mesh3D
pub fn sports_car(name: &str, material: PbrMaterial) -> Mesh3D
Builds a sculpted widebody multi-material GT supercar mesh with smoked glass greenhouse, carbon aero splitter/diffuser/wing, crimson LED taillight bar, xenon headlights, dark undercarriage contact shadow, and round cylindrical wheels with metallic alloy rims.
§Arguments
&str- Asset name.PbrMaterial- Primary car body clearcoat paint PBR material.
§Returns
Self- Composite multi-material vehicle mesh.