natiny_mesh_cube

C
NatinyMesh natiny_mesh_cube(float w, float h, float d, uint32_t subdiv);

Builds a one-part box centred on the origin. The generated mesh has normals and UV coordinates but no texture.

Parameters

Name Type Description
w float Width, the full size along X
h float Height, the full size along Y
d float Depth, the full size along Z
subdiv uint32_t Quads along each edge of a face; clamped up to 1

Returns

Type Description
NatinyMesh Mesh handle

Example

C
NatinyMesh cube = natiny_mesh_cube(1.0f, 1.0f, 1.0f, 1);

Notes

  • Sizes are full extents and subdiv is clamped to at least 1.
  • Every face has outward winding, a flat face normal and UV coordinates spanning 0..1. Vertex count is 36 * subdiv².