Skip to content

stdlib/meshView source ↗

mesh

18 items · generated by scribe fromstdlib/mesh.fd· synced 2026-11-15

stdlib/mesh18 items

Contents

Vertex

pub struct Vertex {

Fields:

NameType
xf64
yf64
zf64

Defined at line 21


TexCoord

pub struct TexCoord {

Fields:

NameType
uf64
vf64

Defined at line 27


Face

pub struct Face {

Fields:

NameType
v0i64
v1i64
v2i64
t0i64
t1i64
t2i64
n0i64
n1i64
n2i64

Defined at line 32


Mesh

pub struct Mesh {

Fields:

NameType
verticesVec<Vertex>
normalsVec<Vertex>
texcoordsVec<TexCoord>
facesVec<Face>
validbool
namestr

Defined at line 46


mesh_create

pub fn mesh_create() -> Mesh {

Returns: Mesh

Defined at line 61


vertex_create

Create a Vertex.

pub fn vertex_create(x: f64, y: f64, z: f64) -> Vertex {

Parameters:

  • x: f64
  • y: f64
  • z: f64

Returns: Vertex

Defined at line 68


texcoord_create

Create a TexCoord.

pub fn texcoord_create(u: f64, v: f64) -> TexCoord {

Parameters:

  • u: f64
  • v: f64

Returns: TexCoord

Defined at line 75


face_create

Create a Face.

pub fn face_create(v0: i64, v1: i64, v2: i64) -> Face {

Parameters:

  • v0: i64
  • v1: i64
  • v2: i64

Returns: Face

Defined at line 82


mesh_create_cube

Create a cube mesh (24 vertices, 12 triangles).

pub fn mesh_create_cube(size: f64) -> Mesh {

Parameters:

  • size: f64

Returns: Mesh

Defined at line 89


mesh_create_plane

Create a plane mesh (in XZ plane, centered at origin).

pub fn mesh_create_plane(width: f64, depth: f64) -> Mesh {

Parameters:

  • width: f64
  • depth: f64

Returns: Mesh

Defined at line 171


mesh_load_obj

Load a mesh from an OBJ file. In the interpreter, this returns an invalid mesh (no file I/O). In native builds, the runtime reads the file and parses OBJ format.

pub fn mesh_load_obj(path: str) -> Mesh {

Parameters:

  • path: str

Returns: Mesh

Defined at line 217


mesh_compute_normals

Compute per-face normals and store them as per-vertex normals. This is a flat (non-smoothed) normal computation.

pub fn mesh_compute_normals(m: & mut Mesh) -> void {

Parameters:

  • m: & mut Mesh

Returns: void

Defined at line 385


mesh_transform

Transform all vertices by a mat4.

pub fn mesh_transform(m: & mut Mesh, mat: mat4) -> void {

Parameters:

  • m: & mut Mesh
  • mat: mat4

Returns: void

Defined at line 437


mesh_triangle_count

Get the number of triangles in the mesh.

pub fn mesh_triangle_count(m: & Mesh) -> i64 {

Parameters:

  • m: & Mesh

Returns: i64

Defined at line 454


mesh_vertex_count

Get the number of vertices in the mesh.

pub fn mesh_vertex_count(m: & Mesh) -> i64 {

Parameters:

  • m: & Mesh

Returns: i64

Defined at line 459


mesh_free

Free mesh data.

pub fn mesh_free(m: & mut Mesh) -> void {

Parameters:

  • m: & mut Mesh

Returns: void

Defined at line 464


Generated by scribe, the Fides documentation generator