Scene is a container for Items. Items are introduced, modified or erased in the scene through Transaction. Once per Frame, the Transaction are all flushed. During the flush the standard buckets are updated. Items are notified accordingly on any update message happening. More...
#include <Scene.h>
Public Member Functions | |
| Scene (glm::vec3 origin, float size) | |
| ItemID | allocateID () |
| Get a new, unique item ID. More... | |
| bool | isAllocatedID (const ItemID &id) const |
| Check that the ID is valid and allocated for this scene, this a threadsafe call. More... | |
| size_t | getNumItems () const |
| Get the total number of allocated items, this a threadsafe call. More... | |
| void | enqueueTransaction (const Transaction &transaction) |
| Enqueue transaction to the scene. More... | |
| void | enqueueTransactionMove (Transaction &&transaction) |
| Enqueue transaction to the scene by moving it. More... | |
| uint32_t | enqueueFrame () |
| Enqueue end of frame transactions boundary. More... | |
| void | processTransactionQueue () |
| Process the pending transactions queued. More... | |
| Selection | getSelection (const Selection::Name &name) const |
| Access a particular selection (empty if doesn't exist) More... | |
| bool | isSelectionEmpty (const Selection::Name &name) const |
| Check if a particular selection is empty (returns ). More... | |
| void | addItemToSelection (const std::string &selectionName, ItemID itemID) |
| Add a single item to a selection by name. More... | |
| void | removeSelection (const std::string &selectionName) |
| Remove a selection by name. More... | |
| const Item & | getItem (const ItemID &id) const |
| Access a particular item from its ID. More... | |
| const Item | getItemSafe (const ItemID &id) const |
| Same as getItem, checking if the id is valid. More... | |
| const ItemSpatialTree & | getSpatialTree () const |
| Access the spatialized items. More... | |
| const ItemIDSet & | getNonspatialSet () const |
| Access non-spatialized items (layered objects, backgrounds). More... | |
| StagePointer | getStage (const Stage::Name &name) const |
| Access a particular Stage (empty pointer if it doesn't exist). More... | |
| template<class T > | |
| std::shared_ptr< T > | getStage (const Stage::Name &name=T::getName()) const |
| Access stage of a given type. More... | |
| void | resetStage (const Stage::Name &name, const StagePointer &stage) |
| Assign a given instance of a stage object to a given name. More... | |
| void | simulate (ItemID id, RenderArgs *args) |
| Perform renderer-side simulation of a given item. More... | |
| HighlightStyle | getOutlineStyle (ItemID id, const ViewFrustum &viewFrustum, uint16_t height) |
| Returns outline style properties for a given item. More... | |
Scene is a container for Items. Items are introduced, modified or erased in the scene through Transaction. Once per Frame, the Transaction are all flushed. During the flush the standard buckets are updated. Items are notified accordingly on any update message happening.
| Scene::Scene | ( | glm::vec3 | origin, |
| float | size | ||
| ) |
| origin | Coordinates of the beginning point of the octree. Minimum X, Y and Z position that an item may have. |
| size | Size of the octree. All rendered entities must fit inside. |
| void Scene::addItemToSelection | ( | const std::string & | selectionName, |
| ItemID | itemID | ||
| ) |
Add a single item to a selection by name.
Thread safe
| selectionName | Unique name of the selection. |
| itemID | Item ID. |
| ItemID Scene::allocateID | ( | ) |
Get a new, unique item ID.
This call is thread safe, can be called from anywhere to allocate a new ID
| uint32_t Scene::enqueueFrame | ( | ) |
Enqueue end of frame transactions boundary.
This is a thread-safe call.
| void Scene::enqueueTransaction | ( | const Transaction & | transaction | ) |
Enqueue transaction to the scene.
Enqueue change batch to the scene.
This is a thread-safe call.
| transaction | Transaction to enqueue. |
| void Scene::enqueueTransactionMove | ( | Transaction && | transaction | ) |
Enqueue transaction to the scene by moving it.
This is a thread-safe call.
| transaction | Transaction to enqueue. |
|
inline |
Access a particular item from its ID.
Not thread safe. WARNING, There is no check on the validity of the ID, so this could return a bad Item.
| id | Item ID, must be valid. |
|
inline |
Same as getItem, checking if the id is valid.
Not thread safe.
| id | Item ID. |
|
inline |
Access non-spatialized items (layered objects, backgrounds).
Not thread safe.
|
inline |
Get the total number of allocated items, this a threadsafe call.
|
inline |
Returns outline style properties for a given item.
Not thread-safe.
| id | Item ID. |
| viewFrustum | Current view frustum from render args. |
| height | Framebuffer height in pixels. |
| Selection Scene::getSelection | ( | const Selection::Name & | name | ) | const |
Access a particular selection (empty if doesn't exist)
Thread safe.
| name | Unique name of the selection. |
|
inline |
Access the spatialized items.
Not thread safe.
| StagePointer Scene::getStage | ( | const Stage::Name & | name | ) | const |
Access a particular Stage (empty pointer if it doesn't exist).
Thread safe.
| name | Stage name, as returned by getName() static function of a given stage type. |
|
inline |
Access stage of a given type.
Thread safe.
| T | Type of the stage. |
| name | Stage name, typically as returned by getName() static function of a given stage type. |
| bool Scene::isAllocatedID | ( | const ItemID & | id | ) | const |
Check that the ID is valid and allocated for this scene, this a threadsafe call.
| id | ID to be checked. |
true if ID was already assigned. | bool Scene::isSelectionEmpty | ( | const Selection::Name & | name | ) | const |
Check if a particular selection is empty (returns ).
Thread safe.
| name | Unique name of the selection. |
true if selection doesn't exist. | void Scene::processTransactionQueue | ( | ) |
Process the pending transactions queued.
Processes all queued frames. Called on render thread on every frame and also on main thread during shutdown.
| void Scene::removeSelection | ( | const std::string & | selectionName | ) |
Remove a selection by name.
Thread safe
| selectionName | Unique name of the selection. |
| void Scene::resetStage | ( | const Stage::Name & | name, |
| const StagePointer & | stage | ||
| ) |
Assign a given instance of a stage object to a given name.
Used during setup when creating instances of the stage objects.
| name | Stage name, typically as returned by getName() static function of a given stage type. |
| stage | Shared pointer to a stage object. |
|
inline |
Perform renderer-side simulation of a given item.
Not thread-safe. Used for effects such as animating particle systems.
| id | Item ID. |
| args | See Render::Args class documentation. |