Voltray Engine Docs
Loading...
Searching...
No Matches
SceneObjectFactory.h
Go to the documentation of this file.
1#pragma once
2
3#include "SceneObject.h"
5#include <memory>
6#include <string>
7
17{
18public:
25 static std::shared_ptr<SceneObject> CreateCube(const std::string &name = "Cube", float size = 1.0f);
26
35 static std::shared_ptr<SceneObject> CreateSphere(const std::string &name = "Sphere", float radius = 0.5f,
36 int widthSegments = 32, int heightSegments = 16);
37
47 static std::shared_ptr<SceneObject> CreatePlane(const std::string &name = "Plane", float width = 1.0f,
48 float height = 1.0f, int widthSegments = 1, int heightSegments = 1);
49
60 static std::shared_ptr<SceneObject> CreateCylinder(const std::string &name = "Cylinder", float radiusTop = 0.5f,
61 float radiusBottom = 0.5f, float height = 1.0f,
62 int radialSegments = 32, int heightSegments = 1);
68 static std::shared_ptr<SceneObject> CreateTriangle(const std::string &name = "Triangle", float size = 1.0f);
69
76 static std::shared_ptr<SceneObject> LoadFromFile(const std::string &filepath, const std::string &name = "");
77
83 static std::vector<std::shared_ptr<SceneObject>> LoadAllFromFile(const std::string &filepath);
84
91 static std::shared_ptr<SceneObject> CreateFromMesh(std::shared_ptr<Mesh> mesh, const std::string &name = "CustomMesh");
92};
Factory class for creating common scene objects with primitive meshes.
Definition SceneObjectFactory.h:17
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.
Definition SceneObjectFactory.cpp:26
static std::shared_ptr< SceneObject > CreateFromMesh(std::shared_ptr< Mesh > mesh, const std::string &name="CustomMesh")
Create a scene object from an existing mesh.
Definition SceneObjectFactory.cpp:90
static std::shared_ptr< SceneObject > CreateTriangle(const std::string &name="Triangle", float size=1.0f)
Creates a triangle scene object.
Definition SceneObjectFactory.cpp:34
static std::shared_ptr< SceneObject > CreateCube(const std::string &name="Cube", float size=1.0f)
Creates a cube scene object.
Definition SceneObjectFactory.cpp:6
static std::vector< std::shared_ptr< SceneObject > > LoadAllFromFile(const std::string &filepath)
Load all meshes from a file as separate scene objects.
Definition SceneObjectFactory.cpp:60
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.).
Definition SceneObjectFactory.cpp:40
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.
Definition SceneObjectFactory.cpp:19
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.
Definition SceneObjectFactory.cpp:12