Voltray Engine Docs
Loading...
Searching...
No Matches
PrimitiveGenerator.h
Go to the documentation of this file.
1#pragma once
2
3#include "Graphics/Mesh.h"
4#include <memory>
5
15{
16public:
22 static std::shared_ptr<Mesh> CreateCube(float size = 1.0f);
23
32 static std::shared_ptr<Mesh> CreatePlane(float width = 1.0f, float height = 1.0f,
33 int widthSegments = 1, int heightSegments = 1);
34
42 static std::shared_ptr<Mesh> CreateSphere(float radius = 0.5f, int widthSegments = 32, int heightSegments = 16);
43
53 static std::shared_ptr<Mesh> CreateCylinder(float radiusTop = 0.5f, float radiusBottom = 0.5f,
54 float height = 1.0f, int radialSegments = 32, int heightSegments = 1);
55
61 static std::shared_ptr<Mesh> CreateTriangle(float size = 1.0f);
62
63private:
64 // Helper methods
65 static void AddVertex(std::vector<float> &vertices, float x, float y, float z, float nx, float ny, float nz, float u, float v);
66 static void AddTriangle(std::vector<unsigned int> &indices, unsigned int a, unsigned int b, unsigned int c);
67};
Static utility class for generating primitive mesh shapes.
Definition PrimitiveGenerator.h:15
static std::shared_ptr< Mesh > CreateTriangle(float size=1.0f)
Creates a triangle mesh.
Definition PrimitiveGenerator.cpp:215
static std::shared_ptr< Mesh > CreateCylinder(float radiusTop=0.5f, float radiusBottom=0.5f, float height=1.0f, int radialSegments=32, int heightSegments=1)
Creates a cylinder mesh.
Definition PrimitiveGenerator.cpp:162
static std::shared_ptr< Mesh > CreateCube(float size=1.0f)
Creates a cube mesh.
Definition PrimitiveGenerator.cpp:8
static std::shared_ptr< Mesh > CreateSphere(float radius=0.5f, int widthSegments=32, int heightSegments=16)
Creates a sphere mesh.
Definition PrimitiveGenerator.cpp:108
static std::shared_ptr< Mesh > CreatePlane(float width=1.0f, float height=1.0f, int widthSegments=1, int heightSegments=1)
Creates a plane mesh.
Definition PrimitiveGenerator.cpp:67