A factory to create geometry cores.
More...
#include "GeometryCoreFactory.h"
|
| GeometryCoreFactory () |
|
| GeometryCoreFactory (const std::string &filePath) |
|
virtual | ~GeometryCoreFactory () |
|
void | addFilePath (const std::string &filePath) |
|
GeometryCoreSP | createModelFromOBJFile (const std::string &fileName) |
|
GeometryCoreSP | createRectangle (glm::vec2 sizeXY) |
|
GeometryCoreSP | createCube (GLfloat size) |
|
GeometryCoreSP | createCuboid (glm::vec3 sizeXYZ) |
|
GeometryCoreSP | createSphere (GLfloat radius, int nSlices, int nStacks) |
|
GeometryCoreSP | createCone (GLfloat radius, GLfloat height, int nSlices, int nStacks, bool hasCap=true) |
|
GeometryCoreSP | createCylinder (GLfloat radius, GLfloat height, int nSlices, int nStacks, bool hasCaps=true) |
|
GeometryCoreSP | createConicalFrustum (GLfloat baseRadius, GLfloat topRadius, GLfloat height, int nSlices, int nStacks, bool hasCaps=true) |
|
GeometryCoreSP | createTeapot (GLfloat size) |
|
GeometryCoreSP | createTeapotFlat (GLfloat size) |
|
GeometryCoreSP | createXYZAxes (GLfloat size) |
|
GeometryCoreSP | createRGBCube (GLfloat size) |
|
A factory to create geometry cores.
- Examples
- scg3_minimal_example.cpp, and scg3_table_scene_example.cpp.
Definition at line 40 of file GeometryCoreFactory.h.
◆ GeometryCoreFactory() [1/2]
scg::GeometryCoreFactory::GeometryCoreFactory |
( |
| ) |
|
◆ GeometryCoreFactory() [2/2]
scg::GeometryCoreFactory::GeometryCoreFactory |
( |
const std::string & |
filePath | ) |
|
Constructor with one or more file paths to be searched for model files. More than one file paths can be defined using ';' or ',' as delimiter.
Example: addFilePath("../models1;../models2")
◆ ~GeometryCoreFactory()
virtual scg::GeometryCoreFactory::~GeometryCoreFactory |
( |
| ) |
|
|
virtual |
◆ addFilePath()
void scg::GeometryCoreFactory::addFilePath |
( |
const std::string & |
filePath | ) |
|
Add one or more file paths to be searched for model files. More than one file paths can be defined using ';' or ',' as delimiter.
Example: addFilePath("../textures1;../textures2")
◆ createCone()
GeometryCoreSP scg::GeometryCoreFactory::createCone |
( |
GLfloat |
radius, |
|
|
GLfloat |
height, |
|
|
int |
nSlices, |
|
|
int |
nStacks, |
|
|
bool |
hasCap = true |
|
) |
| |
Create cone along z axis and centered at origin with normals, tangents, binormals, and texture coordinates (2 * nSlices * nStacks triangles for lateral surface plus nSlices triangles for cap).
- Parameters
-
radius | base radius in xy plane |
height | height in z direction |
nSlices | number of slices, i.e., rectangular faces in circumference direction |
nStacks | number of stacks, i.e., rectangular faces in height direction |
hasCap | true if base cap shall be modeled (default: true) |
◆ createConicalFrustum()
GeometryCoreSP scg::GeometryCoreFactory::createConicalFrustum |
( |
GLfloat |
baseRadius, |
|
|
GLfloat |
topRadius, |
|
|
GLfloat |
height, |
|
|
int |
nSlices, |
|
|
int |
nStacks, |
|
|
bool |
hasCaps = true |
|
) |
| |
Create conical frustum (or cylinder for baseRadius = topRadius) along z axis and centered at origin with normals, tangents, binormals, and texture coordinates (2 * nSlices * nStacks triangles for lateral surface plus nSlices triangles per cap). Called by createCone() and createCylinder().
- Parameters
-
baseRadius | base radius in x and y direction |
topRadius | top radius in x and y direction (must be <= baseRadius) |
height | height in z direction |
nSlices | number of slices, i.e., rectangular faces in circumference direction |
nStacks | number of stacks, i.e., rectangular faces in height direction |
hasCaps | true if base and top caps shall be modeled (default: true) |
◆ createCube()
Create cube with normals, tangents, binormals, and texture coordinates (12 triangles).
- Parameters
-
◆ createCuboid()
GeometryCoreSP scg::GeometryCoreFactory::createCuboid |
( |
glm::vec3 |
sizeXYZ | ) |
|
Create cuboid with normals, tangents, binormals, and texture coordinates (12 triangles).
- Parameters
-
sizeXYZ | edge length in xyz directions |
- Examples
- scg3_table_scene_example.cpp.
◆ createCylinder()
GeometryCoreSP scg::GeometryCoreFactory::createCylinder |
( |
GLfloat |
radius, |
|
|
GLfloat |
height, |
|
|
int |
nSlices, |
|
|
int |
nStacks, |
|
|
bool |
hasCaps = true |
|
) |
| |
Create cylinder along z axis and centered at origin with normals, tangents, binormals, and texture coordinates (2 * nSlices * nStacks triangles for lateral surface plus nSlices triangles per cap).
- Parameters
-
radius | radius in xy plane |
height | height in z direction |
nSlices | number of slices, i.e., rectangular faces in circumference direction |
nStacks | number of stacks, i.e., rectangular faces in height direction |
hasCaps | true if base and top caps shall be modeled (default: true) |
◆ createModelFromOBJFile()
GeometryCoreSP scg::GeometryCoreFactory::createModelFromOBJFile |
( |
const std::string & |
fileName | ) |
|
Load model from OBJ Wavefront file.
Only the follwoing OBJ tags are used: v, vt, vn, f. If normals are not definied explicitly, they are created separately for each triangle (as in the case of flat shading); no smoothing of normals is applied.
- Parameters
-
fileName | file name to be searched for in known file paths |
◆ createRectangle()
GeometryCoreSP scg::GeometryCoreFactory::createRectangle |
( |
glm::vec2 |
sizeXY | ) |
|
Create rectangle in xy plane with normals, tangents, binormals, and texture coordinates (2 triangles).
- Parameters
-
sizeXY | edge length in xy directions |
◆ createRGBCube()
GeometryCoreSP scg::GeometryCoreFactory::createRGBCube |
( |
GLfloat |
size | ) |
|
Create RGB cube with vertex colors (12 triangles).
- Parameters
-
◆ createSphere()
GeometryCoreSP scg::GeometryCoreFactory::createSphere |
( |
GLfloat |
radius, |
|
|
int |
nSlices, |
|
|
int |
nStacks |
|
) |
| |
Create sphere centered at origin with normals, tangents, binormals, and texture coordinates (2 * nSlices * nStacks triangles).
- Parameters
-
radius | sphere radius |
nSlices | number of slices, i.e., rectangular faces in longitudinal direction |
nStacks | number of stacks, i.e., rectangular faces in latitudinal direction |
◆ createTeapot()
◆ createTeapotFlat()
GeometryCoreSP scg::GeometryCoreFactory::createTeapotFlat |
( |
GLfloat |
size | ) |
|
◆ createXYZAxes()
GeometryCoreSP scg::GeometryCoreFactory::createXYZAxes |
( |
GLfloat |
size | ) |
|
Create xyz coordinate axes with vertex colors (3 lines).
- Parameters
-
◆ loadOBJFile_()
int scg::GeometryCoreFactory::loadOBJFile_ |
( |
const std::string & |
fileName, |
|
|
OBJModel & |
model |
|
) |
| const |
|
protected |
Load and parse an OBJ Wavefront file and create a model.
Only the follwoing OBJ tags are used: v, vt, vn, f. If normals are not definied explicitly, they are created separately for each triangle (as in the case of flat shading); no smoothing of normals is applied.
◆ filePaths_
std::vector<std::string> scg::GeometryCoreFactory::filePaths_ |
|
protected |
The documentation for this class was generated from the following file: