Procedural mesh generators — no file I/O, no asset manager needed.
More...
#include <kmeshgenerator.h>
|
| static kMesh * | generatePlane (float size=2.0f) |
| | Generate a flat quad in the XZ plane, facing +Y.
|
| static kMesh * | generateCube (float size=2.0f) |
| | Generate an axis-aligned cube centred at the origin.
|
| static kMesh * | generateSphere (float radius=1.0f, int stacks=18, int slices=36) |
| | Generate a UV sphere centred at the origin.
|
| static kMesh * | generateCylinder (float radius=1.0f, float height=2.0f, int slices=36) |
| | Generate an upright cylinder with flat top and bottom caps.
|
| static kMesh * | generateCapsule (float radius=1.0f, float height=2.0f, int slices=36, int hemiStacks=8) |
| | Generate a capsule: a cylinder closed with hemispherical caps.
|
Procedural mesh generators — no file I/O, no asset manager needed.
All methods return a heap-allocated kMesh with vertex data already uploaded to the GPU (generateVbo() has been called). The caller is responsible for adding the mesh to a scene and assigning a material.
◆ generateCapsule()
| kMesh * kemena::kMeshGenerator::generateCapsule |
( |
float | radius = 1.0f, |
|
|
float | height = 2.0f, |
|
|
int | slices = 36, |
|
|
int | hemiStacks = 8 ) |
|
static |
Generate a capsule: a cylinder closed with hemispherical caps.
The total height of the resulting mesh is height + 2*radius.
- Parameters
-
| radius | Radius of the cylindrical body and hemispherical caps. |
| height | Height of the straight cylindrical section (excluding caps). |
| slices | Number of radial subdivisions around the circumference. |
| hemiStacks | Number of stacks per hemispherical cap. |
- Returns
- Heap-allocated, GPU-uploaded kMesh; caller takes ownership.
◆ generateCube()
| kMesh * kemena::kMeshGenerator::generateCube |
( |
float | size = 2.0f | ) |
|
|
static |
Generate an axis-aligned cube centred at the origin.
- Parameters
-
| size | Edge length of the cube along each axis. |
- Returns
- Heap-allocated, GPU-uploaded kMesh; caller takes ownership.
◆ generateCylinder()
| kMesh * kemena::kMeshGenerator::generateCylinder |
( |
float | radius = 1.0f, |
|
|
float | height = 2.0f, |
|
|
int | slices = 36 ) |
|
static |
Generate an upright cylinder with flat top and bottom caps.
- Parameters
-
| radius | Radius of the cylinder. |
| height | Height of the cylindrical body along the Y axis. |
| slices | Number of radial subdivisions around the circumference. |
- Returns
- Heap-allocated, GPU-uploaded kMesh; caller takes ownership.
◆ generatePlane()
| kMesh * kemena::kMeshGenerator::generatePlane |
( |
float | size = 2.0f | ) |
|
|
static |
Generate a flat quad in the XZ plane, facing +Y.
- Parameters
-
| size | Edge length of the quad along both X and Z (defaults to a 2×2 quad). |
- Returns
- Heap-allocated, GPU-uploaded kMesh; caller takes ownership.
◆ generateSphere()
| kMesh * kemena::kMeshGenerator::generateSphere |
( |
float | radius = 1.0f, |
|
|
int | stacks = 18, |
|
|
int | slices = 36 ) |
|
static |
Generate a UV sphere centred at the origin.
- Parameters
-
| radius | Sphere radius. |
| stacks | Number of horizontal subdivisions (latitude bands). |
| slices | Number of vertical subdivisions (longitude segments). |
- Returns
- Heap-allocated, GPU-uploaded kMesh; caller takes ownership.
The documentation for this class was generated from the following file: