Ocular Engine
|
#include <Scene.hpp>
Public Member Functions | |
void | initialize () |
void | addObject (SceneObject *object) |
void | addObjects (std::vector< SceneObject * > const &objects) |
void | removeObject (SceneObject *object) |
void | removeObjects (std::vector< SceneObject * > const &objects) |
void | removeAllObjects () |
void | update () |
void | render () |
void | getVisibleSceneObjects (std::vector< SceneObject * > &objects, Math::Frustum const &frustum) |
void | setStaticTreeType (SceneTreeType type) |
SceneTreeType const & | getStaticTreeType () const |
void | setDynamicTreeType (SceneTreeType type) |
SceneTreeType const & | getDynamicTreeType () const |
void | setRendererType (std::string const &string) |
std::string const & | getRendererType () const |
Protected Member Functions | |
void | updateTrees () |
void | updateRoutines () |
void | sortRoutines () |
void | objectTreeChanged (SceneObject *object) |
void | objectParentChanged (SceneObject *object, SceneObject *oldParent) |
void | routineAdded (ARoutine *routine) |
void | routineRemoved (ARoutine *routine) |
void | triggerObjectDirty (UUID const &uuid, bool staticObject) |
Friends | |
class | SceneManager |
A Scene owns the dual-SceneTrees which control all active SceneObjects. The system of dual trees is used in order to separate static and dynamic objects, and to aid in object caching and other performance improving techniques.
By default, the static tree uses a (yet to be created) QuadTree implementation while the dynamic tree employs a BVH implementation.
In addition to managing object addition, removal, and movement within the trees, the Scene is also responsible for retrieving the set of all non-culled SceneObjects and handing them off to the dedicated renderer which will sort them and envoke their render methods.
void Ocular::Core::Scene::addObject | ( | SceneObject * | object | ) |
Adds the specified object to the scene's tree.
[in] | object |
void Ocular::Core::Scene::addObjects | ( | std::vector< SceneObject * > const & | objects | ) |
Adds a collection of objects to the scene's tree.
[in] | objects |
void Ocular::Core::Scene::getVisibleSceneObjects | ( | std::vector< SceneObject * > & | objects, |
Math::Frustum const & | frustum | ||
) |
Returns a collection of all SceneObjects visible to the specified view frustum (see Camera::getFrustum).
The returned collection is a flat list meaning all visible SceneObjects are returned, not just top-level parents. Thus there is no need to check child visibility, as visible children will also be stored in the returned collection.
[out] | objects | All visible SceneObjects |
[in] | frustum | View frustum to perform frustum-culling against |
|
protected |
Alerts when the SceneObject's parent has been changed. This happens when the SceneObject::SetParent() method is called.
[in] | object | |
[in] | oldParent |
A change in object parentage can have an effect on the SceneTrees.
If the old parent is null, then the object used to be a top-level object and thus the appropriate SceneTree will need to be updated. As far as the tree is concerned, the object was removed as they only deal with top-level parents.
The the new parent is null, then the appropriate SceneTree will need to add the object as a new top-level parent.
If neither the old parent or the new parent are null, then the SceneTrees do not need to do anything as they do not interact while child objects.
|
protected |
Alerts that the SceneObject needs to be placed in a different SceneTree. This happens when the SceneObject::SetStatic() method is called.
[in] | object |
void Ocular::Core::Scene::removeAllObjects | ( | ) |
Removes all objects from the scene's tree.
void Ocular::Core::Scene::removeObject | ( | SceneObject * | object | ) |
Removes the specified object from the scene's tree.
[in] | object |
void Ocular::Core::Scene::removeObjects | ( | std::vector< SceneObject * > const & | objects | ) |
Removes a collection of objects from the scene's tree.
[in] | objects |
void Ocular::Core::Scene::render | ( | ) |
Retrieves all non-culled SceneObjects and passes them to the dedicated renderer.
|
protected |
Alerts when a new routine has been created and added to a SceneObject.
[in] | routine |
|
protected |
Alerts when a routine is being destroyed and removed from a SceneObject.
[in] | routine |
void Ocular::Core::Scene::setDynamicTreeType | ( | SceneTreeType | type | ) |
[in] | type |
void Ocular::Core::Scene::setStaticTreeType | ( | SceneTreeType | type | ) |
[in] | type |
void Ocular::Core::Scene::update | ( | ) |
Updates the SceneTrees (calls their member restructure methods).