SLProject
4.2.000
A platform independent 3D computer graphics framework for desktop OS, Android, iOS and online in web browsers
|
Scenegraph in Data Oriented Design with flat std::vector of SLEntity. More...
#include <SLEntities.h>
Public Member Functions | |
void | addChildEntity (SLint myParentID, SLEntity entity) |
Adds a child into the vector nodes right after its parent. More... | |
void | deleteEntity (SLint id) |
Deletes a node at index id with all its children. More... | |
void | deleteChildren (SLint id) |
Deletes all children of an entity with index id. More... | |
SLint | updateWMRec (SLint id, SLMat4f &parentWM) |
Updates all world matrices and returns no. of updated. More... | |
SLEntity * | getEntity (SLint id) |
Returns the pointer to a node if id is valid else a nullptr. More... | |
SLint | getEntityID (SLNode *node) |
Returns the ID of the entity with a SLNode pointer. More... | |
SLEntity * | getParent (SLint id) |
Returns the pointer to the parent of a node if id is valid else a nullptr. More... | |
SLint | getParentID (SLNode *node) |
Returns the parentID of a SLNode pointer. More... | |
void | dump (SLbool doTreeDump) |
Dump scenegraph as a flat vector or as a tree. More... | |
SLuint | size () |
Returns the size of the entity vector. More... | |
void | clear () |
Clears the the entities vector. More... | |
Private Attributes | |
SLVEntity | _graph |
Vector of SLEntity of entire scenegraph. More... | |
Scenegraph in Data Oriented Design with flat std::vector of SLEntity.
Definition at line 46 of file SLEntities.h.
Adds a child into the vector nodes right after its parent.
addChild adds a child node by inserting an SLEntities into a vector in Depth First Search order. The root node gets the parent ID -1. The child is inserted right after the parent node.
myParentID | Index of the parent node |
entity | The entity to add as child of the parent |
Definition at line 21 of file SLEntities.cpp.
|
inline |
Deletes all children of an entity with index id.
Deletes all children of an entity with the index id. Also sub-children of those children get deleted.
id | Index of the parent entity |
Definition at line 277 of file SLEntities.cpp.
Deletes a node at index id with all its children.
Deletes a node at index id with all with all children
id | Index of node to delete |
Definition at line 244 of file SLEntities.cpp.
Dump scenegraph as a flat vector or as a tree.
Prints the scenegraph vector flat or as hierarchical tree as follows:
doTreeDump | Flag if dump as a tree or flat |
Pattern: ID.Parent.childCount Example from SLEntities::addChild: 00.-1.04 +–01.00.01 | +–02.01.00 +–03.00.00 +–04.00.02 | +–05.04.00 | +–06.04.01 | | +–07.06.01 | | | +–08.07.00 +–09.00.00
Definition at line 188 of file SLEntities.cpp.
Returns the pointer to a node if id is valid else a nullptr.
Returns the pointer to the node at id
id | The index of the node to return as a pointer |
Definition at line 89 of file SLEntities.cpp.
Returns the pointer to the parent of a node if id is valid else a nullptr.
Returns the pointer to the parent of the node at id
id | The index of the node in the scenegraph vector |
Definition at line 111 of file SLEntities.cpp.
|
inline |
Returns the size of the entity vector.
Definition at line 77 of file SLEntities.h.
Updates all world matrices and returns no. of updated.
Updates the world matrix recursively
id | Index of the current node to update |
parentWM | World transform matrix of the parent |
Definition at line 134 of file SLEntities.cpp.
|
private |
Vector of SLEntity of entire scenegraph.
Definition at line 83 of file SLEntities.h.