Visualization Library 2.1.0

A lightweight C++ OpenGL middleware for 2D/3D graphics

VL     Star     Watch     Fork     Issue

[Download] [Tutorials] [All Classes] [Grouped Classes]
Public Member Functions | Protected Attributes | List of all members
vl::SceneManager Class Referenceabstract

The SceneManager class is the base class for all the scene managers. More...

#include <SceneManager.hpp>

+ Inheritance diagram for vl::SceneManager:

Public Member Functions

 SceneManager ()
 Constructor. More...
 
virtual void extractActors (ActorCollection &list)=0
 Appends all the Actors contained in the scene manager without performing frustum culling or checking enable masks. More...
 
virtual void extractVisibleActors (ActorCollection &list, const Camera *camera)=0
 Extracts all the enabled and visible Actors contained in the ActorTree hierarchy and appends them to the given ActorCollection. More...
 
virtual void computeBounds ()
 Computes the bounding box and bounding sphere of the scene manager and of all the Actors contained in the SceneManager. More...
 
void setBoundingSphere (const Sphere &sphere)
 Explicitly set the scene manager's bounding sphere. See also computeBounds(). More...
 
const SphereboundingSphere () const
 Returns the scene manager's bounding sphere. More...
 
void setBoundingBox (const AABB &bbox)
 Explicitly set the scene manager's bounding sphere. See also computeBounds(). More...
 
const AABBboundingBox () const
 Returns the scene manager's bounding box. More...
 
void setBoundsDirty (bool dirty)
 Flags a scene manager's bounding box and bounding sphere as dirty. The bounds will be recomputed using computeBounds() at the next rendering frame. More...
 
bool boundsDirty () const
 Returns true if the scene manager's bounds should be recomputed at the next rendering frame. More...
 
void setCullingEnabled (bool enable)
 Used to enable or disable frustum culling or whichever culling system the scene manager implements. More...
 
bool cullingEnabled () const
 Used to enable or disable frustum culling or whichever culling system the scene manager implements. More...
 
void setEnableMask (unsigned int enabled)
 The enable mask to be used by extractVisibleActors() More...
 
unsigned int enableMask () const
 The enable mask to be used by extractVisibleActors() More...
 
bool isEnabled (Actor *a) const
 Returns true if "a->enableMask() & enableMask()) != 0". More...
 
- Public Member Functions inherited from vl::Object
 Object ()
 Constructor. More...
 
 Object (const Object &other)
 Copy constructor: copies the name, ref count mutex and user data. More...
 
Objectoperator= (const Object &other)
 Copy operator: copies the object's name, ref count mutex and user data. More...
 
const std::string & objectName () const
 The name of the object, by default set to the object's class name. More...
 
void setObjectName (const char *name)
 The name of the object, by default set to the object's class name in debug builds. More...
 
void setObjectName (const std::string &name)
 The name of the object, by default set to the object's class name in debug builds. More...
 
void setRefCountMutex (IMutex *mutex)
 The mutex used to protect the reference counting of an Object across multiple threads. More...
 
IMutexrefCountMutex ()
 The mutex used to protect the reference counting of an Object across multiple threads. More...
 
const IMutexrefCountMutex () const
 The mutex used to protect the reference counting of an Object across multiple threads. More...
 
int referenceCount () const
 Returns the number of references of an object. More...
 
void incReference () const
 Increments the reference count of an object. More...
 
void decReference ()
 Decrements the reference count of an object and deletes it if both automaticDelete() is true the count reaches 0. More...
 
void setAutomaticDelete (bool autodel_on)
 If set to true the Object is deleted when its reference count reaches 0. More...
 
bool automaticDelete () const
 If set to true the Object is deleted when its reference count reaches 0. More...
 
template<class T >
T * as ()
 Casts an Object to the specified class. More...
 
template<class T >
const T * as () const
 Casts an Object to the specified class. More...
 

Protected Attributes

Sphere mSphere
 
AABB mAABB
 
unsigned int mEnableMask
 
bool mBoundsDirty
 
bool mCullingEnabled
 
- Protected Attributes inherited from vl::Object
std::string mObjectName
 
IMutexmRefCountMutex
 
int mReferenceCount
 
bool mAutomaticDelete
 

Additional Inherited Members

- Protected Member Functions inherited from vl::Object
virtual ~Object ()
 

Detailed Description

The SceneManager class is the base class for all the scene managers.

A SceneManager implements an algorithm used to quickly identify which objects are visible and which ones are not. The algorithm can be a space partitioning scheme like a BSP, Kd-Tree, Octree etc. or a visibility based scheme like sector/portals, precomputed PVS etc. or a mix of them. The set of SceneManager[s] attached to a Rendering defines the scene. In fact, if an Actor does not belong to any SceneManager it will not have any chance of being rendered.

Visualization Library allows you to bind and use multiple SceneManagers at the same time within the same Rendering. Note that an Actor should belong to one and only one SceneManager otherwise you might end up rendering twice the same Actor thus wasting computational resources.

In order to implement your own scene manager you will have to dirive from the SceneManager class and provide an appropriate implementation for the following methods: extractVisibleActors(), extractActors().

See also

Definition at line 72 of file SceneManager.hpp.

Constructor & Destructor Documentation

◆ SceneManager()

SceneManager::SceneManager ( )

Constructor.

Definition at line 43 of file SceneManager.cpp.

References mBoundsDirty, mCullingEnabled, and mEnableMask.

Member Function Documentation

◆ boundingBox()

const AABB& vl::SceneManager::boundingBox ( ) const
inline

Returns the scene manager's bounding box.

Definition at line 98 of file SceneManager.hpp.

Referenced by computeBounds().

◆ boundingSphere()

const Sphere& vl::SceneManager::boundingSphere ( ) const
inline

Returns the scene manager's bounding sphere.

Definition at line 93 of file SceneManager.hpp.

◆ boundsDirty()

bool vl::SceneManager::boundsDirty ( ) const
inline

Returns true if the scene manager's bounds should be recomputed at the next rendering frame.

Definition at line 103 of file SceneManager.hpp.

◆ computeBounds()

void SceneManager::computeBounds ( )
virtual

◆ cullingEnabled()

bool vl::SceneManager::cullingEnabled ( ) const
inline

Used to enable or disable frustum culling or whichever culling system the scene manager implements.

Definition at line 108 of file SceneManager.hpp.

Referenced by vl::SceneManagerBVH< ActorTree >::extractVisibleActors(), and vl::SceneManagerVectorGraphics::extractVisibleActors().

◆ enableMask()

unsigned int vl::SceneManager::enableMask ( ) const
inline

◆ extractActors()

virtual void vl::SceneManager::extractActors ( ActorCollection list)
pure virtual

Appends all the Actors contained in the scene manager without performing frustum culling or checking enable masks.

Implemented in vl::SceneManagerPortals, vl::SceneManagerVectorGraphics, vl::SceneManagerBVH< T >, vl::SceneManagerBVH< ActorKdTree >, and vl::SceneManagerBVH< ActorTree >.

Referenced by computeBounds().

◆ extractVisibleActors()

virtual void vl::SceneManager::extractVisibleActors ( ActorCollection list,
const Camera camera 
)
pure virtual

◆ isEnabled()

bool SceneManager::isEnabled ( Actor a) const

Returns true if "a->enableMask() & enableMask()) != 0".

Definition at line 84 of file SceneManager.cpp.

References enableMask(), vl::Actor::enableMask(), and vl::Actor::isEnabled().

◆ setBoundingBox()

void vl::SceneManager::setBoundingBox ( const AABB bbox)
inline

Explicitly set the scene manager's bounding sphere. See also computeBounds().

Definition at line 96 of file SceneManager.hpp.

Referenced by computeBounds().

◆ setBoundingSphere()

void vl::SceneManager::setBoundingSphere ( const Sphere sphere)
inline

Explicitly set the scene manager's bounding sphere. See also computeBounds().

Definition at line 91 of file SceneManager.hpp.

Referenced by computeBounds().

◆ setBoundsDirty()

void vl::SceneManager::setBoundsDirty ( bool  dirty)
inline

Flags a scene manager's bounding box and bounding sphere as dirty. The bounds will be recomputed using computeBounds() at the next rendering frame.

Definition at line 101 of file SceneManager.hpp.

Referenced by computeBounds().

◆ setCullingEnabled()

void vl::SceneManager::setCullingEnabled ( bool  enable)
inline

Used to enable or disable frustum culling or whichever culling system the scene manager implements.

Definition at line 106 of file SceneManager.hpp.

◆ setEnableMask()

void vl::SceneManager::setEnableMask ( unsigned int  enabled)
inline

Member Data Documentation

◆ mAABB

AABB vl::SceneManager::mAABB
protected

Definition at line 122 of file SceneManager.hpp.

◆ mBoundsDirty

bool vl::SceneManager::mBoundsDirty
protected

Definition at line 124 of file SceneManager.hpp.

Referenced by SceneManager().

◆ mCullingEnabled

bool vl::SceneManager::mCullingEnabled
protected

Definition at line 125 of file SceneManager.hpp.

Referenced by SceneManager().

◆ mEnableMask

unsigned int vl::SceneManager::mEnableMask
protected

Definition at line 123 of file SceneManager.hpp.

Referenced by SceneManager().

◆ mSphere

Sphere vl::SceneManager::mSphere
protected

Definition at line 121 of file SceneManager.hpp.


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