natiny.mesh.cube
Lua
natiny.mesh.cube([w [, h [, d [, subdiv]]]]) -> mesh
Builds a one-part box centred on the origin. The generated mesh has normals and
UV coordinates but no texture.
Parameters
| Name |
Type |
Default |
Description |
w |
number |
1 |
Width, the full size along X |
h |
number |
w |
Height, the full size along Y |
d |
number |
w |
Depth, the full size along Z |
subdiv |
integer |
1 |
Quads along each edge of a face; values below 1 are clamped |
Returns
| Type |
Description |
number |
Mesh handle |
Example
Lua
local cube = natiny.mesh.cube(1)
Notes
- Sizes are full extents. In Lua,
h and d default to w; subdiv defaults
to 1 and 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².