Triangles to upload: vertices, u32 indices and parts.
vertices is a binary of 48-byte vertices, each twelve little-endian floats:
x, y, z, u, nx, ny, nz, v, lu, lv, s01, s23 — position, normal, texture coordinates
{u, v}, lightmap coordinates {lu, lv}, and the vertex's four light styles as
s0 + 256 * s1 and s2 + 256 * s3 (255 for none; see CauldronGPU.Material). indices is a binary of little-endian
u32, three per counter-clockwise triangle. A part is {first_index, index_count};
an instance gives one material per part. No parts means one part covering every index.
skin, for meshes posed with bones (CauldronGPU.Pose), is 8 bytes a vertex: four bone
indices, then four weights out of 255 that sum to 255; nil for a rigid mesh.
colors, 4 bytes a vertex (RGBA, display colour), multiplies each vertex's material base
colour and alpha, blended across each triangle; nil for none.
CauldronGPU.Mesh.cube(1.0)
CauldronGPU.Mesh.new(vertices, [0, 1, 2], parts: [{0, 3}])
Summary
Functions
A cube size across, centred on the origin, each face with its own 0..1 texture square.
The number of indices in mesh.
A mesh from vertex maps and a flat list of indices.
A flat square size across on the XZ plane facing +Y, its texture repeated repeat times.
A UV sphere of radius with rings bands and twice as many segments.
The number of vertices in mesh.
Types
Functions
A cube size across, centred on the origin, each face with its own 0..1 texture square.
@spec index_count(t()) :: non_neg_integer()
The number of indices in mesh.
@spec new([vertex()], [non_neg_integer()], keyword()) :: t()
A mesh from vertex maps and a flat list of indices.
A flat square size across on the XZ plane facing +Y, its texture repeated repeat times.
@spec sphere(number(), pos_integer()) :: t()
A UV sphere of radius with rings bands and twice as many segments.
@spec vertex_count(t()) :: non_neg_integer()
The number of vertices in mesh.