Visualization Library v1.0.3

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

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:
vl::Object vl::SceneManagerBVH< ActorKdTree > vl::SceneManagerBVH< ActorTree > vl::SceneManagerBVH< T > vl::SceneManagerPortals vl::SceneManagerVectorGraphics vl::SceneManagerActorKdTree vl::SceneManagerActorTree vl::Terrain

List of all members.

Public Member Functions

 SceneManager ()
 Constructor.
virtual void extractVisibleActors (ActorCollection &list, const Camera *camera)=0
 Performs frustum culling and appends the enabled and visible Actor[s] to the given ActorCollection.
virtual void extractActors (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 SphereboundingSphere () 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 AABBboundingBox () 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) const
 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: extractVisibleActors(), extractActors().

See also:

Definition at line 72 of file SceneManager.hpp.


Constructor & Destructor Documentation

SceneManager::SceneManager (  )

Constructor.

Definition at line 43 of file SceneManager.cpp.

References mBoundsDirty, mCullingEnabled, mEnableMask, and VL_DEBUG_SET_OBJECT_NAME.


Member Function Documentation

virtual void vl::SceneManager::extractVisibleActors ( ActorCollection list,
const Camera camera 
) [pure virtual]
virtual void vl::SceneManager::extractActors ( ActorCollection list ) [pure virtual]
void SceneManager::computeBounds (  ) [virtual]
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().

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

Returns the scene manager's bounding sphere.

Definition at line 93 of file SceneManager.hpp.

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().

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().

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().

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.

Referenced by vl::Rendering::render().

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.

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::SceneManagerVectorGraphics::extractVisibleActors(), vl::SceneManagerPortals::extractVisibleActors(), and vl::Rendering::render().

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

Definition at line 110 of file SceneManager.hpp.

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

Definition at line 111 of file SceneManager.hpp.

Referenced by isEnabled().

bool SceneManager::isEnabled ( Actor a ) const

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

Definition at line 84 of file SceneManager.cpp.

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

Referenced by vl::SceneManagerPortals::visitSector().


Member Data Documentation

Definition at line 116 of file SceneManager.hpp.

Definition at line 117 of file SceneManager.hpp.

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

Definition at line 118 of file SceneManager.hpp.

Referenced by SceneManager().

Definition at line 119 of file SceneManager.hpp.

Referenced by SceneManager().

Definition at line 120 of file SceneManager.hpp.

Referenced by SceneManager().


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

Visualization Library v1.0.3 Reference Documentation
Copyright Michele Bosi. All rights reserved.
Updated on Tue Feb 7 2017 00:55:11.
Permission is granted to use this page to write and publish articles regarding Visualization Library.