pub struct Geometry;Expand description
Primitive geometry generator. Call a static method, get back
vertices + indices ready for MeshData.
Implementations§
Source§impl Geometry
impl Geometry
Sourcepub fn box_(width: f32, height: f32, depth: f32) -> (Vec<Vertex>, Vec<u32>)
pub fn box_(width: f32, height: f32, depth: f32) -> (Vec<Vertex>, Vec<u32>)
Axis-aligned box with independent dimensions, centered at origin.
Sourcepub fn sphere(radius: f32, segments: u32) -> (Vec<Vertex>, Vec<u32>)
pub fn sphere(radius: f32, segments: u32) -> (Vec<Vertex>, Vec<u32>)
UV sphere centered at origin.
segments controls both horizontal (longitude) and vertical
(latitude) subdivisions. 16 is low-poly, 32 is smooth, 64 is
high quality. Total triangles ≈ 2 × segments².
Sourcepub fn plane(width: f32, depth: f32) -> (Vec<Vertex>, Vec<u32>)
pub fn plane(width: f32, depth: f32) -> (Vec<Vertex>, Vec<u32>)
Flat plane on the XZ plane (Y = 0), centered at origin.
Sourcepub fn cylinder(
radius: f32,
height: f32,
segments: u32,
) -> (Vec<Vertex>, Vec<u32>)
pub fn cylinder( radius: f32, height: f32, segments: u32, ) -> (Vec<Vertex>, Vec<u32>)
Cylinder along the Y axis, centered at origin.
Sourcepub fn torus(
major_radius: f32,
minor_radius: f32,
major_segments: u32,
minor_segments: u32,
) -> (Vec<Vertex>, Vec<u32>)
pub fn torus( major_radius: f32, minor_radius: f32, major_segments: u32, minor_segments: u32, ) -> (Vec<Vertex>, Vec<u32>)
Torus (donut) centered at origin on the XZ plane.
major_radius is the distance from the center to the tube center.
minor_radius is the tube thickness.
Sourcepub fn grid(
size: f32,
divisions: u32,
subdivisions: u32,
line_width: f32,
) -> (Vec<Vertex>, Vec<u32>)
pub fn grid( size: f32, divisions: u32, subdivisions: u32, line_width: f32, ) -> (Vec<Vertex>, Vec<u32>)
Flat grid on the XZ plane (Y = 0) centered at origin.
Generates thin quad strips for each grid line — both major and minor subdivisions. Lines have vertex color baked in (gray for minor, brighter for major, red for X axis, blue for Z axis).
size is the total extent (grid goes from -size/2 to +size/2).
divisions is the number of cells along each axis.
subdivisions is the number of minor lines per cell.
line_width is the thickness of each line quad.