pub const MESH: &str = "type Mesh { positions: Tensor[f32] = tensor[f32]([], [0, 3])?; indices: Tensor[u32] = tensor[u32]([], [0, 3])?; }";Expand description
Indexed triangle geometry.
The spatial adapter requires 3..=16384 positions and 1..=32768 triangles, validates indices, and computes normals when it builds a render mesh.
§Declaration
type Mesh { positions: Tensor[f32] = tensor[f32]([], [0, 3])?; indices: Tensor[u32] = tensor[u32]([], [0, 3])?; }§Fields and methods
-
positions: An N by 3 Tensorf32 of local XYZ coordinates in meters. The empty default is not renderable. -
indices: An M by 3 Tensoru32; each row is a triangle and every index must address a position.
§Define one triangle
Indices address positions in triples.
let entity = spawn(Mesh { positions: tensor[f32]([0, 0, 0, 1, 0, 0, 0, 1, 0], [3, 3])?, indices: tensor[u32]([0, 1, 2], [1, 3])? });
print(get[Mesh](entity).indices.len());§Inspect an unfilled schema
Construction itself does not invoke the mesh adapter.
let value = Mesh {};
print(value.positions.len());