hx3d  1
2D/3D Simple Game Framework
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
hx3d::ecs::SceneGraph Class Reference

Node management in hierarchy. More...

#include <scene_graph.hpp>

Public Member Functions

template<class T , class... Args>
Ptr< T > createAtRoot (Args...args)
 Create a game object at the root. More...
 
template<class T , class... Args>
Ptr< T > create (const std::string path, Args...args)
 Create a game object at a path. More...
 
void remove (const std::string path)
 Remove a game object from a path. More...
 
template<class T >
Ptr< T > fetch (const std::string path)
 Fetch a game object from a path. More...
 
Ptr< NodegetRoot ()
 Get the root. More...
 
unsigned int getNodeCount ()
 Get the number of nodes. More...
 
void showIndices ()
 Show the graph indices.
 
void draw (graphics::BaseBatch &batch)
 Draw the nodes. More...
 
void update (const float delta)
 Update the nodes. More...
 
void setEntityMode (bool enabled)
 Activate/Deactivate the entity management mode. More...
 

Protected Member Functions

void addIndex (const Ptr< Node > &object)
 Add an index to the graph. More...
 
Ptr< NodepathExists (const std::string path)
 Test if the path exists and returns the node. More...
 
void internalRemove (const Ptr< Node > &node)
 Remove a node. More...
 
template<class T , class... Args>
Ptr< T > createNodeChild (const Ptr< Node > &container, Args...args)
 Create a child for a container Node. More...
 

Protected Attributes

Ptr< Node_root
 Graph root.
 
std::map< std::string, Ptr< Node > > _indices
 Node indices.
 
Engine _engine
 Engine for entity management.
 
bool _entityEnabled
 Is entity management enabled ?
 

Detailed Description

Node management in hierarchy.

The SceneGraph is merged with an Engine, to do cross-entity management. It is activable with setEntityMode.

Definition at line 43 of file scene_graph.hpp.

Member Function Documentation

void hx3d::ecs::SceneGraph::addIndex ( const Ptr< Node > &  object)
protected

Add an index to the graph.

Parameters
objectNode (Ptr)

Definition at line 49 of file scene_graph.cpp.

template<class T , class... Args>
Ptr< T > hx3d::ecs::SceneGraph::create ( const std::string  path,
Args...  args 
)

Create a game object at a path.

Parameters
pathPath
argsArguments
Returns
T (Ptr)

Definition at line 33 of file scene_graph.inl.hpp.

template<class T , class... Args>
Ptr< T > hx3d::ecs::SceneGraph::createAtRoot ( Args...  args)

Create a game object at the root.

Parameters
argsArguments
Returns
T (Ptr)

Definition at line 27 of file scene_graph.inl.hpp.

template<class T , class... Args>
Ptr< T > hx3d::ecs::SceneGraph::createNodeChild ( const Ptr< Node > &  container,
Args...  args 
)
protected

Create a child for a container Node.

Parameters
containerContainer node
argsArguments
Returns
Node (Ptr)

Definition at line 50 of file scene_graph.inl.hpp.

void hx3d::ecs::SceneGraph::draw ( graphics::BaseBatch batch)

Draw the nodes.

Parameters
batchBatch

Definition at line 68 of file scene_graph.cpp.

template<class T >
Ptr< T > hx3d::ecs::SceneGraph::fetch ( const std::string  path)

Fetch a game object from a path.

Parameters
pathPath
Returns
T (Ptr)

Definition at line 45 of file scene_graph.inl.hpp.

unsigned int hx3d::ecs::SceneGraph::getNodeCount ( )

Get the number of nodes.

Returns
Number of nodes

Definition at line 45 of file scene_graph.cpp.

Ptr< Node > hx3d::ecs::SceneGraph::getRoot ( )

Get the root.

Returns
Node (Ptr)

Definition at line 41 of file scene_graph.cpp.

void hx3d::ecs::SceneGraph::internalRemove ( const Ptr< Node > &  node)
protected

Remove a node.

Parameters
nodeNode (Ptr)

Definition at line 121 of file scene_graph.cpp.

Ptr< Node > hx3d::ecs::SceneGraph::pathExists ( const std::string  path)
protected

Test if the path exists and returns the node.

Parameters
pathPath
Returns
Node (Ptr)

Definition at line 142 of file scene_graph.cpp.

void hx3d::ecs::SceneGraph::remove ( const std::string  path)

Remove a game object from a path.

Parameters
pathPath

Definition at line 106 of file scene_graph.cpp.

void hx3d::ecs::SceneGraph::setEntityMode ( bool  enabled)

Activate/Deactivate the entity management mode.

Parameters
enabledEnabled ?

Definition at line 37 of file scene_graph.cpp.

void hx3d::ecs::SceneGraph::update ( const float  delta)

Update the nodes.

Parameters
deltaDelta time

Definition at line 84 of file scene_graph.cpp.


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