Ocular Engine
Ocular::Core::Scene Class Reference

#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
 

Detailed Description

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.

Member Function Documentation

void Ocular::Core::Scene::addObject ( SceneObject object)

Adds the specified object to the scene's tree.

Parameters
[in]object
void Ocular::Core::Scene::addObjects ( std::vector< SceneObject * > const &  objects)

Adds a collection of objects to the scene's tree.

Parameters
[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.

Parameters
[out]objectsAll visible SceneObjects
[in]frustumView frustum to perform frustum-culling against
void Ocular::Core::Scene::objectParentChanged ( SceneObject object,
SceneObject oldParent 
)
protected

Alerts when the SceneObject's parent has been changed. This happens when the SceneObject::SetParent() method is called.

Parameters
[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.

void Ocular::Core::Scene::objectTreeChanged ( SceneObject object)
protected

Alerts that the SceneObject needs to be placed in a different SceneTree. This happens when the SceneObject::SetStatic() method is called.

Parameters
[in]object
void Ocular::Core::Scene::removeAllObjects ( )

Removes all objects from the scene's tree.

Note
That this does not destroy any of the objects. Only the SceneManager can/should perform object destruction.
void Ocular::Core::Scene::removeObject ( SceneObject object)

Removes the specified object from the scene's tree.

Note
This does not destroy the object itself. Only the SceneManager can/should perform object destruction.
Parameters
[in]object
Todo:
Remove renderables
void Ocular::Core::Scene::removeObjects ( std::vector< SceneObject * > const &  objects)

Removes a collection of objects from the scene's tree.

Note
This does not destroy any of the objects. Only the SceneManager can/should perform object destruction.
Parameters
[in]objects
void Ocular::Core::Scene::render ( )

Retrieves all non-culled SceneObjects and passes them to the dedicated renderer.

void Ocular::Core::Scene::routineAdded ( ARoutine routine)
protected

Alerts when a new routine has been created and added to a SceneObject.

Parameters
[in]routine
void Ocular::Core::Scene::routineRemoved ( ARoutine routine)
protected

Alerts when a routine is being destroyed and removed from a SceneObject.

Parameters
[in]routine
void Ocular::Core::Scene::setDynamicTreeType ( SceneTreeType  type)
Parameters
[in]type
void Ocular::Core::Scene::setStaticTreeType ( SceneTreeType  type)
Parameters
[in]type
void Ocular::Core::Scene::update ( )

Updates the SceneTrees (calls their member restructure methods).


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