StevEngine
StevEngine is a customizable C++ game engine.
Loading...
Searching...
No Matches
StevEngine::Scene Class Reference

Container for game objects and scene state. More...

#include <main/Scene.hpp>

Public Member Functions

Utilities::ID CreateObject ()
 Create empty GameObject.
 
Utilities::ID CreateObject (std::string name, Utilities::Vector3 position=Utilities::Vector3(), Utilities::Quaternion rotation=Utilities::Quaternion(), Utilities::Vector3 scale=Utilities::Vector3(1, 1, 1))
 Create GameObject with transform.
 
Utilities::ID CreateObject (Resources::Resource file, Utilities::StreamType type)
 Create GameObject from resource file.
 
Utilities::ID CreateObject (Utilities::Stream &stream)
 Create GameObject from serialized data.
 
bool Exists (Utilities::ID id)
 Checks if an object with the specified id exists.
 
GameObjectGetObject (Utilities::ID id)
 Get object by ID.
 
Visuals::CameraGetCamera ()
 Get main camera component.
 
GameObjectGetCameraObject ()
 Get camera object.
 
std::vector< Utilities::IDGetAllObjects ()
 Get IDs of all objects in scene.
 
std::vector< Utilities::IDGetAllParentObjects ()
 Get IDs of all root objects (no parent)
 
void DestroyObject (Utilities::ID id)
 Destroy object and all children.
 
Utilities::Stream Export (Utilities::StreamType type)
 Export entire scene.
 
 Scene (std::string name)
 Should never be called directly, use SceneManager::CreateScene.
 
 Scene (std::string name, Utilities::Stream &stream)
 Should never be called directly, use SceneManager::CreateScene.
 

Public Attributes

const std::string name
 Scene name/identifier.
 

Friends

class Engine
 
class SceneManager
 

Detailed Description

Container for game objects and scene state.

Manages a collection of GameObjects and their relationships. Handles object creation, destruction and lookup within the scene.

Constructor & Destructor Documentation

◆ Scene() [1/2]

StevEngine::Scene::Scene ( std::string name)

Should never be called directly, use SceneManager::CreateScene.

Create new scene

Parameters
nameScene identifier

◆ Scene() [2/2]

StevEngine::Scene::Scene ( std::string name,
Utilities::Stream & stream )

Should never be called directly, use SceneManager::CreateScene.

Create scene from serialized data

Parameters
nameName of the scene
streamStream containing serialized object data

Member Function Documentation

◆ CreateObject() [1/4]

ID StevEngine::Scene::CreateObject ( )

Create empty GameObject.

Returns
ID of created object

◆ CreateObject() [2/4]

Utilities::ID StevEngine::Scene::CreateObject ( Resources::Resource file,
Utilities::StreamType type )

Create GameObject from resource file.

Parameters
fileResource containing serialized object data
Returns
ID of created object

◆ CreateObject() [3/4]

ID StevEngine::Scene::CreateObject ( std::string name,
Utilities::Vector3 position = Utilities::Vector3(),
Utilities::Quaternion rotation = Utilities::Quaternion(),
Utilities::Vector3 scale = Utilities::Vector3(1, 1, 1) )

Create GameObject with transform.

Parameters
nameObject name
positionInitial position
rotationInitial rotation
scaleInitial scale
Returns
ID of created object

◆ CreateObject() [4/4]

Utilities::ID StevEngine::Scene::CreateObject ( Utilities::Stream & stream)

Create GameObject from serialized data.

Parameters
streamStream containing serialized object data
Returns
ID of created object

◆ DestroyObject()

void StevEngine::Scene::DestroyObject ( Utilities::ID id)

Destroy object and all children.

Parameters
idID of object to destroy

◆ Exists()

bool StevEngine::Scene::Exists ( Utilities::ID id)

Checks if an object with the specified id exists.

Parameters
idObject identifier
Returns
true if object exists, otherwise false

◆ Export()

Utilities::Stream StevEngine::Scene::Export ( Utilities::StreamType type)

Export entire scene.

Parameters
typeType of stream to export to
Returns
Stream containing serialized object data

◆ GetAllObjects()

std::vector< ID > StevEngine::Scene::GetAllObjects ( )

Get IDs of all objects in scene.

Returns
Vector of object IDs

◆ GetAllParentObjects()

std::vector< ID > StevEngine::Scene::GetAllParentObjects ( )

Get IDs of all root objects (no parent)

Returns
Vector of root object IDs

◆ GetCamera()

Visuals::Camera * StevEngine::Scene::GetCamera ( )
inline

Get main camera component.

Returns
Pointer to camera component

◆ GetCameraObject()

GameObject & StevEngine::Scene::GetCameraObject ( )
inline

Get camera object.

Returns
Pointer to camera GameObject

◆ GetObject()

GameObject & StevEngine::Scene::GetObject ( Utilities::ID id)

Get object by ID.

Parameters
idObject identifier
Returns
Pointer to object or nullptr if not found

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