|
The Table Engine
|
Manages a tree structure of SceneNodes, facilitating scene graph operations. More...
#include <scene.h>
Collaboration diagram for SceneTree:Public Member Functions | |
| SceneTree () | |
| Constructor for creating a root node of the scene tree. More... | |
| ~SceneTree () | |
| Destructor, cleans up the tree resources. More... | |
| void | addChild (GameObject *child, bool isBackground=false) |
| Adds a child GameObject to the scene tree. More... | |
| void | traverseTree (std::function< void(SceneNode *)> callback) |
| Traverses the entire tree, executing a callback on each node. More... | |
| void | traverseTree (SceneNode *node, std::function< void(SceneNode *)> callback) |
| Traverses the tree from a specific node, executing a callback on each node. More... | |
| GameObject * | findGameObjectById (std::string id) |
| Finds a GameObject by its ID. More... | |
| std::vector< GameObject * > | findGameObjectsByTag (std::string tag) |
| Finds GameObjects by a tag. More... | |
| std::vector< GameObject * > & | findCachedGameObjectsInFrame (std::string tag) |
| Retrieves the game objects cached by tag. More... | |
| void | resetCachedGameObjectsInFrame () |
| Resets the cached game objects for a new frame, clearing the current frame's cache. More... | |
| int | gameStatus () |
| Retrieves the current game status. More... | |
Private Attributes | |
| SceneNode * | m_root |
| Root node of the scene tree. More... | |
| std::unordered_map< std::string, GameObject * > | m_cachedGameObjects |
| Cache for faster lookup of GameObjects by ID. More... | |
| std::unordered_map< std::string, std::vector< GameObject * > > | m_cachedGameObjectsInFrame |
| Cache for faster lookup of GameObjects by tag within a frame. More... | |
Manages a tree structure of SceneNodes, facilitating scene graph operations.
SceneTree provides mechanisms to add children, traverse the tree, and perform lookups for game objects based on IDs and tags.
| SceneTree::SceneTree | ( | ) |
| SceneTree::~SceneTree | ( | ) |
| void SceneTree::addChild | ( | GameObject * | child, |
| bool | isBackground = false |
||
| ) |
Adds a child GameObject to the scene tree.
| child | Pointer to the GameObject to add. |
| isBackground | Flag indicating if the child is part of the background. |
| std::vector< GameObject * > & SceneTree::findCachedGameObjectsInFrame | ( | std::string | tag | ) |
| GameObject * SceneTree::findGameObjectById | ( | std::string | id | ) |
Finds a GameObject by its ID.
| id | The ID string of the GameObject to find. |
| std::vector< GameObject * > SceneTree::findGameObjectsByTag | ( | std::string | tag | ) |
| int SceneTree::gameStatus | ( | ) |
| void SceneTree::resetCachedGameObjectsInFrame | ( | ) |
| void SceneTree::traverseTree | ( | std::function< void(SceneNode *)> | callback | ) |
|
private |
|
private |
|
private |