Factory class for creating common scene objects with primitive meshes.
More...
#include <SceneObjectFactory.h>
|
static std::shared_ptr< SceneObject > | CreateCube (const std::string &name="Cube", float size=1.0f) |
| Creates a cube scene object.
|
|
static std::shared_ptr< SceneObject > | CreateSphere (const std::string &name="Sphere", float radius=0.5f, int widthSegments=32, int heightSegments=16) |
| Creates a sphere scene object.
|
|
static std::shared_ptr< SceneObject > | CreatePlane (const std::string &name="Plane", float width=1.0f, float height=1.0f, int widthSegments=1, int heightSegments=1) |
| Creates a plane scene object.
|
|
static std::shared_ptr< SceneObject > | CreateCylinder (const std::string &name="Cylinder", float radiusTop=0.5f, float radiusBottom=0.5f, float height=1.0f, int radialSegments=32, int heightSegments=1) |
| Creates a cylinder scene object.
|
|
static std::shared_ptr< SceneObject > | CreateTriangle (const std::string &name="Triangle", float size=1.0f) |
| Creates a triangle scene object.
|
|
static std::shared_ptr< SceneObject > | LoadFromFile (const std::string &filepath, const std::string &name="") |
| Load a scene object from an external mesh file (OBJ, FBX, etc.).
|
|
static std::vector< std::shared_ptr< SceneObject > > | LoadAllFromFile (const std::string &filepath) |
| Load all meshes from a file as separate scene objects.
|
|
static std::shared_ptr< SceneObject > | CreateFromMesh (std::shared_ptr< Mesh > mesh, const std::string &name="CustomMesh") |
| Create a scene object from an existing mesh.
|
|
Factory class for creating common scene objects with primitive meshes.
SceneObjectFactory provides convenient methods to create scene objects with pre-generated primitive meshes, making it easy to add common shapes to the scene without manually creating meshes and objects.
◆ CreateCube()
std::shared_ptr< SceneObject > SceneObjectFactory::CreateCube |
( |
const std::string & |
name = "Cube" , |
|
|
float |
size = 1.0f |
|
) |
| |
|
static |
Creates a cube scene object.
- Parameters
-
name | Name of the object. |
size | Size of the cube. |
- Returns
- Shared pointer to the created scene object.
◆ CreateCylinder()
std::shared_ptr< SceneObject > SceneObjectFactory::CreateCylinder |
( |
const std::string & |
name = "Cylinder" , |
|
|
float |
radiusTop = 0.5f , |
|
|
float |
radiusBottom = 0.5f , |
|
|
float |
height = 1.0f , |
|
|
int |
radialSegments = 32 , |
|
|
int |
heightSegments = 1 |
|
) |
| |
|
static |
Creates a cylinder scene object.
- Parameters
-
name | Name of the object. |
radiusTop | Radius at the top. |
radiusBottom | Radius at the bottom. |
height | Height of the cylinder. |
radialSegments | Number of radial segments. |
heightSegments | Number of height segments. |
- Returns
- Shared pointer to the created scene object.
◆ CreateFromMesh()
std::shared_ptr< SceneObject > SceneObjectFactory::CreateFromMesh |
( |
std::shared_ptr< Mesh > |
mesh, |
|
|
const std::string & |
name = "CustomMesh" |
|
) |
| |
|
static |
Create a scene object from an existing mesh.
- Parameters
-
mesh | Shared pointer to the mesh. |
name | Name of the object. |
- Returns
- Shared pointer to the created scene object.
◆ CreatePlane()
std::shared_ptr< SceneObject > SceneObjectFactory::CreatePlane |
( |
const std::string & |
name = "Plane" , |
|
|
float |
width = 1.0f , |
|
|
float |
height = 1.0f , |
|
|
int |
widthSegments = 1 , |
|
|
int |
heightSegments = 1 |
|
) |
| |
|
static |
Creates a plane scene object.
- Parameters
-
name | Name of the object. |
width | Width of the plane. |
height | Height of the plane. |
widthSegments | Number of width segments. |
heightSegments | Number of height segments. |
- Returns
- Shared pointer to the created scene object.
◆ CreateSphere()
std::shared_ptr< SceneObject > SceneObjectFactory::CreateSphere |
( |
const std::string & |
name = "Sphere" , |
|
|
float |
radius = 0.5f , |
|
|
int |
widthSegments = 32 , |
|
|
int |
heightSegments = 16 |
|
) |
| |
|
static |
Creates a sphere scene object.
- Parameters
-
name | Name of the object. |
radius | Radius of the sphere. |
widthSegments | Number of horizontal segments. |
heightSegments | Number of vertical segments. |
- Returns
- Shared pointer to the created scene object.
◆ CreateTriangle()
std::shared_ptr< SceneObject > SceneObjectFactory::CreateTriangle |
( |
const std::string & |
name = "Triangle" , |
|
|
float |
size = 1.0f |
|
) |
| |
|
static |
Creates a triangle scene object.
- Parameters
-
name | Name of the object. |
size | Size of the triangle. |
- Returns
- Shared pointer to the created scene object.
◆ LoadAllFromFile()
std::vector< std::shared_ptr< SceneObject > > SceneObjectFactory::LoadAllFromFile |
( |
const std::string & |
filepath | ) |
|
|
static |
Load all meshes from a file as separate scene objects.
- Parameters
-
filepath | Path to the mesh file. |
- Returns
- Vector of shared pointers to all created scene objects.
◆ LoadFromFile()
std::shared_ptr< SceneObject > SceneObjectFactory::LoadFromFile |
( |
const std::string & |
filepath, |
|
|
const std::string & |
name = "" |
|
) |
| |
|
static |
Load a scene object from an external mesh file (OBJ, FBX, etc.).
- Parameters
-
filepath | Path to the mesh file. |
name | Name of the object (defaults to filename if empty). |
- Returns
- Shared pointer to the created scene object, or nullptr if failed.
The documentation for this class was generated from the following files: