Voltray Engine Docs
Loading...
Searching...
No Matches
PrimitiveGenerator Class Reference

Static utility class for generating primitive mesh shapes. More...

#include <PrimitiveGenerator.h>

Static Public Member Functions

static std::shared_ptr< MeshCreateCube (float size=1.0f)
 Creates a cube mesh.
 
static std::shared_ptr< MeshCreatePlane (float width=1.0f, float height=1.0f, int widthSegments=1, int heightSegments=1)
 Creates a plane mesh.
 
static std::shared_ptr< MeshCreateSphere (float radius=0.5f, int widthSegments=32, int heightSegments=16)
 Creates a sphere mesh.
 
static std::shared_ptr< MeshCreateCylinder (float radiusTop=0.5f, float radiusBottom=0.5f, float height=1.0f, int radialSegments=32, int heightSegments=1)
 Creates a cylinder mesh.
 
static std::shared_ptr< MeshCreateTriangle (float size=1.0f)
 Creates a triangle mesh.
 

Detailed Description

Static utility class for generating primitive mesh shapes.

PrimitiveGenerator provides methods to create common 3D primitive shapes such as cubes, spheres, planes, cylinders, etc. Each method returns a shared pointer to a Mesh object that can be used with scene objects.

Member Function Documentation

◆ CreateCube()

std::shared_ptr< Mesh > PrimitiveGenerator::CreateCube ( float  size = 1.0f)
static

Creates a cube mesh.

Parameters
sizeThe size of the cube (default: 1.0).
Returns
Shared pointer to the cube mesh.

◆ CreateCylinder()

std::shared_ptr< Mesh > PrimitiveGenerator::CreateCylinder ( float  radiusTop = 0.5f,
float  radiusBottom = 0.5f,
float  height = 1.0f,
int  radialSegments = 32,
int  heightSegments = 1 
)
static

Creates a cylinder mesh.

Parameters
radiusTopThe radius at the top (default: 0.5).
radiusBottomThe radius at the bottom (default: 0.5).
heightThe height of the cylinder (default: 1.0).
radialSegmentsNumber of radial segments (default: 32).
heightSegmentsNumber of height segments (default: 1).
Returns
Shared pointer to the cylinder mesh.

◆ CreatePlane()

std::shared_ptr< Mesh > PrimitiveGenerator::CreatePlane ( float  width = 1.0f,
float  height = 1.0f,
int  widthSegments = 1,
int  heightSegments = 1 
)
static

Creates a plane mesh.

Parameters
widthThe width of the plane (default: 1.0).
heightThe height of the plane (default: 1.0).
widthSegmentsNumber of width segments (default: 1).
heightSegmentsNumber of height segments (default: 1).
Returns
Shared pointer to the plane mesh.

◆ CreateSphere()

std::shared_ptr< Mesh > PrimitiveGenerator::CreateSphere ( float  radius = 0.5f,
int  widthSegments = 32,
int  heightSegments = 16 
)
static

Creates a sphere mesh.

Parameters
radiusThe radius of the sphere (default: 0.5).
widthSegmentsNumber of horizontal segments (default: 32).
heightSegmentsNumber of vertical segments (default: 16).
Returns
Shared pointer to the sphere mesh.

◆ CreateTriangle()

std::shared_ptr< Mesh > PrimitiveGenerator::CreateTriangle ( float  size = 1.0f)
static

Creates a triangle mesh.

Parameters
sizeThe size of the triangle (default: 1.0).
Returns
Shared pointer to the triangle mesh.

The documentation for this class was generated from the following files: