Kemena3D
Loading...
Searching...
No Matches
kemena::kMeshGenerator Class Reference

Procedural mesh generators — no file I/O, no asset manager needed. More...

#include <kmeshgenerator.h>

Static Public Member Functions

static kMeshgeneratePlane (float size=2.0f)
 Generate a flat quad in the XZ plane, facing +Y.
static kMeshgenerateCube (float size=2.0f)
 Generate an axis-aligned cube centred at the origin.
static kMeshgenerateSphere (float radius=1.0f, int stacks=18, int slices=36)
 Generate a UV sphere centred at the origin.
static kMeshgenerateCylinder (float radius=1.0f, float height=2.0f, int slices=36)
 Generate an upright cylinder with flat top and bottom caps.
static kMeshgenerateCapsule (float radius=1.0f, float height=2.0f, int slices=36, int hemiStacks=8)
 Generate a capsule: a cylinder closed with hemispherical caps.

Detailed Description

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.

Member Function Documentation

◆ 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
radiusRadius of the cylindrical body and hemispherical caps.
heightHeight of the straight cylindrical section (excluding caps).
slicesNumber of radial subdivisions around the circumference.
hemiStacksNumber 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
sizeEdge 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
radiusRadius of the cylinder.
heightHeight of the cylindrical body along the Y axis.
slicesNumber 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
sizeEdge 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
radiusSphere radius.
stacksNumber of horizontal subdivisions (latitude bands).
slicesNumber 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: