# Visualization Library A lightweight C++ OpenGL middleware for 2D/3D graphics | [Home] [Tutorials] [All Classes] [Grouped Classes]

# vl::SceneManager Class Reference

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

`#include <SceneManager.hpp>`

Inheritance diagram for vl::SceneManager:

List of all members.

## Public Member Functions
virtual const char * | className ()
| Returns the name of the class.
| SceneManager ()
| Constructor.
virtual void | appendVisibleActors (ActorCollection &list, const Camera *camera)=0
| Performs frustum culling and appends the enabled and visible Actor[s] to the given ActorCollection.
virtual void | appendActors (ActorCollection &list)=0
| Appends all the Actor[s] contained in the scene manager without performing frustum culling or checking enable masks.
virtual void | computeBounds ()
| Computes the bounding box and bounding sphere of the scene manager and of all the Actor[s] contained in the SceneManager.
void | setBoundingSphere (const Sphere &sphere)
| Explicitly set the scene manager's bounding sphere. See also computeBounds().
const Sphere & | boundingSphere () const
| Returns the scene manager's bounding sphere.
void | setBoundingBox (const AABB &bbox)
| Explicitly set the scene manager's bounding sphere. See also computeBounds().
const AABB & | boundingBox () const
| Returns the scene manager's bounding box.
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.
bool | boundsDirty () const
| Returns true if the scene manager's bounds should be recomputed at the next rendering frame.
void | setCullingEnabled (bool enable)
| Used to enable or disable frustum culling or whichever culling system the scene manager implements.
bool | cullingEnabled () const
| Used to enable or disable frustum culling or whichever culling system the scene manager implements.
void | setEnableMask (unsigned int enabled)
unsigned int | enableMask () const
bool | isEnabled (Actor *a)
| Returns `true` if `"a->enableMask() & enableMask()) != 0"`.
## Protected Attributes
Sphere | mSphere
AABB | mAABB
unsigned int | mEnableMask
bool | mBoundsDirty
bool | mCullingEnabled

## 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: appendVisibleActors(), appendActors().

See also:
  - ActorKdTree
  - ActorTree
  - SceneManager
  - SceneManagerActorKdTree
  - SceneManagerActorTree
  - SceneManagerPortals
  - Actor

## Constructor & Destructor Documentation

SceneManager::SceneManager | ( |  | ) |

Constructor.

## Member Function Documentation

virtual const char* vl::SceneManager::className | ( |  | ) | `[inline, virtual]`

Returns the name of the class.

Reimplemented from vl::Object.

Reimplemented in vl::SceneManagerActorKdTree, vl::SceneManagerActorTree, vl::SceneManagerBVH< T >, vl::Terrain, vlVG::SceneManagerVectorGraphics, vl::SceneManagerBVH< ActorKdTree >, and vl::SceneManagerBVH< ActorTree >.

virtual void vl::SceneManager::appendVisibleActors | ( | ActorCollection & | list,
|  | const Camera * | camera |
| ) |  |  | `[pure virtual]`

Performs frustum culling and appends the enabled and visible Actor[s] to the given ActorCollection.

See also enableMask(), Actor::enableMask()

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

virtual void vl::SceneManager::appendActors | ( | ActorCollection & | list | ) | `[pure virtual]`

Appends all the Actor[s] contained in the scene manager without performing frustum culling or checking enable masks.

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

void SceneManager::computeBounds | ( |  | ) | `[virtual]`

Computes the bounding box and bounding sphere of the scene manager and of all the Actor[s] contained in the SceneManager.

void vl::SceneManager::setBoundingSphere | ( | const Sphere & | sphere | ) | `[inline]`

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

const Sphere& vl::SceneManager::boundingSphere | ( |  | ) | const`[inline]`

Returns the scene manager's bounding sphere.

void vl::SceneManager::setBoundingBox | ( | const AABB & | bbox | ) | `[inline]`

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

const AABB& vl::SceneManager::boundingBox | ( |  | ) | const`[inline]`

Returns the scene manager's bounding box.

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.

bool vl::SceneManager::boundsDirty | ( |  | ) | const`[inline]`

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

void vl::SceneManager::setCullingEnabled | ( | bool | enable | ) | `[inline]`

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

bool vl::SceneManager::cullingEnabled | ( |  | ) | const`[inline]`

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

void vl::SceneManager::setEnableMask | ( | unsigned int | enabled | ) | `[inline]`

unsigned int vl::SceneManager::enableMask | ( |  | ) | const`[inline]`

bool vl::SceneManager::isEnabled | ( | Actor * | a | ) | `[inline]`

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

## Member Data Documentation

Sphere vl::SceneManager::mSphere`[protected]`

AABB vl::SceneManager::mAABB`[protected]`

unsigned int vl::SceneManager::mEnableMask`[protected]`

bool vl::SceneManager::mBoundsDirty`[protected]`

bool vl::SceneManager::mCullingEnabled`[protected]`

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

- E:/VisualizationLibrary/BuildSystem/VL_DISTRO/Visualization_Library_SDK/src/vl/SceneManager.hpp
- E:/VisualizationLibrary/BuildSystem/VL_DISTRO/Visualization_Library_SDK/src/vl/SceneManager.cpp

Visualization Library v2009.08 Reference Documentation
Copyright 2005-2009 Michele Bosi. All rights reserved.
Updated on Sun Nov 29 11:11:50 2009.
Permission is granted to use this page to write and publish articles regarding Visualization Library.