savoiardi/geometry
Geometry construction and geometry asset loading.
This module provides constructors for common primitive meshes together with helpers for text and STL geometry loading.
Types
Values
pub fn box(
width width: Float,
height height: Float,
depth depth: Float,
) -> Geometry
Creates a box geometry.
pub fn capsule(
radius radius: Float,
length length: Float,
cap_segments cap_segments: Int,
radial_segments radial_segments: Int,
) -> Geometry
Creates a capsule geometry.
pub fn circle(
radius radius: Float,
segments segments: Int,
) -> Geometry
Creates a circle geometry.
pub fn compute_bounding_box(geometry: Geometry) -> Geometry
Computes the bounding box of a geometry.
pub fn compute_bounding_sphere(geometry: Geometry) -> Geometry
Computes the bounding sphere of a geometry.
pub fn compute_vertex_normals(geometry: Geometry) -> Geometry
Computes vertex normals for a geometry.
pub fn cone(
radius radius: Float,
height height: Float,
segments segments: Int,
) -> Geometry
Creates a cone geometry.
pub fn cylinder(
top_radius top_radius: Float,
bottom_radius bottom_radius: Float,
height height: Float,
segments segments: Int,
) -> Geometry
Creates a cylinder geometry.
pub fn line_points(points: List(vec3.Vec3(Float))) -> Geometry
Creates a line geometry from a list of points.
pub fn load_font(
loader: loader.FontLoader,
url url: String,
on_result on_result: fn(Result(Font, loader.LoadError)) -> Nil,
) -> Nil
Loads a font and reports the result through a callback.
pub fn load_font_async(
loader: loader.FontLoader,
url url: String,
) -> promise.Promise(Result(Font, loader.LoadError))
Loads a font asynchronously.
pub fn load_stl(
loader: loader.STLLoader,
url url: String,
on_result on_result: fn(Result(Geometry, loader.LoadError)) -> Nil,
) -> Nil
Loads STL geometry and reports the result through a callback.
pub fn load_stl_async(
loader: loader.STLLoader,
url url: String,
) -> promise.Promise(Result(Geometry, loader.LoadError))
Loads STL geometry asynchronously.
pub fn normalize_normals(geometry: Geometry) -> Geometry
Normalizes the existing normals of a geometry.
pub fn plane(
width width: Float,
height height: Float,
width_segments width_segments: Int,
height_segments height_segments: Int,
) -> Geometry
Creates a plane geometry.
pub fn ring(
inner_radius inner_radius: Float,
outer_radius outer_radius: Float,
segments segments: Int,
) -> Geometry
Creates a ring geometry.
pub fn sphere(
radius radius: Float,
width_segments width_segments: Int,
height_segments height_segments: Int,
) -> Geometry
Creates a sphere geometry.
pub fn text(
text text: String,
font font: Font,
size size: Float,
depth depth: Float,
curve_segments curve_segments: Int,
bevel_enabled bevel_enabled: Bool,
bevel_thickness bevel_thickness: Float,
bevel_size bevel_size: Float,
) -> Geometry
Creates text geometry from a loaded font.
pub fn torus(
radius radius: Float,
tube tube: Float,
radial_segments radial_segments: Int,
tubular_segments tubular_segments: Int,
) -> Geometry
Creates a torus geometry.
pub fn torus_knot(
radius radius: Float,
tube tube: Float,
tubular_segments tubular_segments: Int,
radial_segments radial_segments: Int,
) -> Geometry
Creates a torus knot geometry.