Oxygen Engine
Modern C++ 3D Engine using OpenGL
Loading...
Searching...
No Matches
oe::scene::Scene Class Reference

Logical scene manager. More...

#include <OxygenEngine/scene/scene.h>

+ Collaboration diagram for oe::scene::Scene:

Public Member Functions

 Scene ()
 Default Constructor.
 
 Scene (const Camera &camera)
 Constructor where Camera settings are filled from a reference one.
 
NodePtr addNode ()
 Generate a new root node in the the scene.
 
NodePtr addNamedNode (const std::string &name)
 Generate a new root node in the the scene and set a name.
 
NodegetNodeById (uint64_t id_node)
 Get pointer to a node from its id.
 
const NodegetNodeById (uint64_t id_node) const
 Get pointer to a node from its id.
 
void deleteNode (NodePtr node)
 
const std::vector< NodePtrgetAllNodes () const
 Get all nodes in the scene.
 
const std::vector< NodePtrgetRootNodes () const
 Get root nodes of the scene.
 
NodePtr search (const std::string path, const std::string separator="/") const
 Search for a node using a name path.
 
template<typename ComponentType >
void setCameraFromComponent (ComponentType &component)
 Set scene camera using a component providing a camera.
 
void resetCameraToDefault ()
 Reset scene camera to the default camera.
 
void addNodeInGroup (NodePtr node, const NodeType type)
 Add a node in a group (For example nodes that need to be in specific pass)
 
std::vector< NodePtrgetNodesByType (const NodeType type) const
 Get nodes belonging to a type (For exemple nodes that need to be in specific pass)
 
void removeNodeFromGroup (NodePtr node, const NodeType type)
 Remove node from specified group.
 
void removeNodeFromAllGroups (NodePtr node)
 Remove node from all of its groups.
 

Public Attributes

Camera default_camera
 
Cameracamera = nullptr
 
void * user_data = 0
 Custom user data, you can use it to store flags / pointer / physics / etc... related to this scene.
 

Detailed Description

Logical scene manager.

Constructor & Destructor Documentation

◆ Scene() [1/2]

oe::scene::Scene::Scene ( )

Default Constructor.

Note
a 4:3 perspective Camera is used as default one

◆ Scene() [2/2]

oe::scene::Scene::Scene ( const Camera camera)

Constructor where Camera settings are filled from a reference one.

Parameters
cameraCamera used as source for settings (Position, Projection, etc...)
Note
The camera parameter is sent as const because it won't be used as the default camera (only its settings are copied)

Member Function Documentation

◆ addNamedNode()

NodePtr oe::scene::Scene::addNamedNode ( const std::string &  name)
inline

Generate a new root node in the the scene and set a name.

Parameters
nameNode name

◆ addNodeInGroup()

void oe::scene::Scene::addNodeInGroup ( NodePtr  node,
const NodeType  type 
)
inline

Add a node in a group (For example nodes that need to be in specific pass)

Note
A node can be in multiple groups You can call this function multiple times on the same Node

◆ getNodeById() [1/2]

Node * oe::scene::Scene::getNodeById ( uint64_t  id_node)
inline

Get pointer to a node from its id.

Note
It is not recomended to store the resulting pointer as the node address may change during the scene lifetime
See also
NodePtr

◆ getNodeById() [2/2]

const Node * oe::scene::Scene::getNodeById ( uint64_t  id_node) const
inline

Get pointer to a node from its id.

Note
It is not recomended to store the resulting pointer as the node address may change during the scene lifetime
See also
NodePtr

◆ removeNodeFromAllGroups()

void oe::scene::Scene::removeNodeFromAllGroups ( NodePtr  node)
inline

Remove node from all of its groups.

Note
No errors raised if the node isn't part of any group

◆ removeNodeFromGroup()

void oe::scene::Scene::removeNodeFromGroup ( NodePtr  node,
const NodeType  type 
)
inline

Remove node from specified group.

Note
No errors raised if the node isn't part of the group

◆ search()

NodePtr oe::scene::Scene::search ( const std::string  path,
const std::string  separator = "/" 
) const
inline

Search for a node using a name path.

Note
if multiple nodes at same level has same name, only the first one is returned

◆ setCameraFromComponent()

template<typename ComponentType >
void oe::scene::Scene::setCameraFromComponent ( ComponentType &  component)
inline

Set scene camera using a component providing a camera.

Note
If no camera component found on node, this function will silently fail and keep the old camera

Member Data Documentation

◆ user_data

void* oe::scene::Scene::user_data = 0

Custom user data, you can use it to store flags / pointer / physics / etc... related to this scene.

Note
OxygenEngine won't touch this member

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