pub struct MeshFactory;Expand description
Procedural mesh constructors.
Notes:
- The shapes here are intentionally simple and low-poly.
- Winding order: We return counter-clockwise triangles in object space for “front faces”.
Implementations§
Source§impl MeshFactory
impl MeshFactory
Sourcepub fn triangle_2d() -> CpuMesh
pub fn triangle_2d() -> CpuMesh
2D equilateral triangle centered at origin.
Sourcepub fn cube() -> CpuMesh
pub fn cube() -> CpuMesh
Unit-ish cube centered at origin.
This is a cube with per-face vertices (24 vertices, 12 triangles) so normals are flat.
Sourcepub fn wireframe_box(thickness: f32) -> CpuMesh
pub fn wireframe_box(thickness: f32) -> CpuMesh
Unit wireframe box centered at the origin, represented by twelve solid edge prisms.
thickness is relative to the unit box dimensions and is clamped to (0, 1]. Using
triangles instead of line primitives keeps the geometry compatible with the normal mesh
rendering path and gives the edges visible thickness from every view direction.
Sourcepub fn tetrahedron() -> CpuMesh
pub fn tetrahedron() -> CpuMesh
Simple tetrahedron (4 vertices, 4 faces).
Sourcepub fn icosahedron(tessellations: u32, sphericalness: f32) -> CpuMesh
pub fn icosahedron(tessellations: u32, sphericalness: f32) -> CpuMesh
Icosahedron with optional recursive tessellation and spherical blending.
tessellations is the number of recursive 4-way triangle splits.
sphericalness blends from planar face subdivision (0.0) to an icosphere (1.0).
Sourcepub fn sphere() -> CpuMesh
pub fn sphere() -> CpuMesh
UV sphere centered at origin.
Radius is 0.5 to match the unit-ish cube extents.
Sourcepub fn cone(number_of_segments: u32) -> CpuMesh
pub fn cone(number_of_segments: u32) -> CpuMesh
Cone centered at origin, axis-aligned along +Z.
Geometry:
- height = 1.0 (z in [-0.5, +0.5])
- base radius = 0.5 (at z = -0.5)
number_of_segments controls radial tessellation.
Sourcepub fn circle_2d(
inner_radius: f32,
outer_radius: f32,
number_of_segments: u32,
) -> CpuMesh
pub fn circle_2d( inner_radius: f32, outer_radius: f32, number_of_segments: u32, ) -> CpuMesh
2D ring/annulus in the XY plane (normal +Z).
inner_radius and outer_radius are in object-space units.
Sourcepub fn partial_annulus_2d(
inner_radius: f32,
outer_radius: f32,
start_angle_radians: f32,
sweep_angle_radians: f32,
number_of_segments: u32,
) -> CpuMesh
pub fn partial_annulus_2d( inner_radius: f32, outer_radius: f32, start_angle_radians: f32, sweep_angle_radians: f32, number_of_segments: u32, ) -> CpuMesh
2D partial ring/annulus in the XY plane (normal +Z).
start_angle_radians is the arc start angle in standard polar coordinates.
sweep_angle_radians is the angular span; negative values are accepted and
are normalized to the equivalent positive arc.
Auto Trait Implementations§
impl Freeze for MeshFactory
impl RefUnwindSafe for MeshFactory
impl Send for MeshFactory
impl Sync for MeshFactory
impl Unpin for MeshFactory
impl UnsafeUnpin for MeshFactory
impl UnwindSafe for MeshFactory
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.