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 Member Functions | Protected Attributes | List of all members
vl::SceneManagerPortals Class Reference

The SceneManagerPortals calss implements a portal-based hidden surface removal algorithm to efficently render highly occluded scenes. More...

#include <SceneManagerPortals.hpp>

+ Inheritance diagram for vl::SceneManagerPortals:

Public Member Functions

 SceneManagerPortals ()
 Constructor. More...
 
void extractActors (ActorCollection &list)
 Appends to the given list all the Actors contained in the scene regardless of their visibility. More...
 
void extractVisibleActors (ActorCollection &list, const Camera *camera)
 Appends to the given list all the visible Actors using the portal culling algorithm. More...
 
std::vector< ref< Sector > > & sectors ()
 The Sectors that are part of the scene. More...
 
const std::vector< ref< Sector > > & sectors () const
 The Sectors that are part of the scene. More...
 
SectorexternalSector ()
 Returns the external sector. More...
 
const SectorexternalSector () const
 Returns the external sector. More...
 
void computePortalNormals ()
 Compute the normal of the sectors. More...
 
void initialize ()
 Calls computePortalNormals() and performs some error checking. More...
 
bool showPortals () const
 Whether portals should be shown in the rendering or not. More...
 
void setShowPortals (bool show)
 Whether portals should be shown in the rendering or not. More...
 
void invalidatePortalActors ()
 Regenerates the portal actors next time their rendering is requested. More...
 
const std::vector< Frustum > & frustumStack () const
 The stack of frustums active at a given point during sector discovery. More...
 
- Public Member Functions inherited from vl::SceneManager
 SceneManager ()
 Constructor. 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 Member Functions

void renderPortal (Portal *portal)
 
void visitSector (Sector *prev, Sector *sector, const vec3 &eye, const Camera *camera)
 
SectorcomputeStartingSector (const Camera *camera)
 
- Protected Member Functions inherited from vl::Object
virtual ~Object ()
 

Protected Attributes

ref< SectormExternalSector
 
std::vector< ref< Sector > > mSectors
 
std::vector< ref< Actor > > mTempActors
 
std::map< Portal *, ref< Actor > > mPortalActorMap
 
std::vector< FrustummFrustumStack
 
unsigned mVisitTick
 
bool mShowPortals
 
- Protected Attributes inherited from vl::SceneManager
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
 

Detailed Description

The SceneManagerPortals calss implements a portal-based hidden surface removal algorithm to efficently render highly occluded scenes.

See also

Definition at line 184 of file SceneManagerPortals.hpp.

Constructor & Destructor Documentation

◆ SceneManagerPortals()

vl::SceneManagerPortals::SceneManagerPortals ( )
inline

Constructor.

Definition at line 190 of file SceneManagerPortals.hpp.

Member Function Documentation

◆ computePortalNormals()

void SceneManagerPortals::computePortalNormals ( )

Compute the normal of the sectors.

Definition at line 229 of file SceneManagerPortals.cpp.

◆ computeStartingSector()

Sector * SceneManagerPortals::computeStartingSector ( const Camera camera)
protected

◆ externalSector() [1/2]

Sector* vl::SceneManagerPortals::externalSector ( )
inline

Returns the external sector.

The external sector is a special sector that is considered visible when the camera is not inside any other sector. The external sector can be used to contain objects that are outside the indoor environment defined by the other "normal" sectors. For example, you could use the SceneManagerPortals to model a house and put in the external sector all the objects that are outside the house. The portals inside the house can point to the external sector so that the objects outside the house are rendered only if they are visible through a door or a window for maximum performances. Of course you can also go from an external sector to an internal sector just as well using one or more portals.

Definition at line 212 of file SceneManagerPortals.hpp.

◆ externalSector() [2/2]

const Sector* vl::SceneManagerPortals::externalSector ( ) const
inline

Returns the external sector.

Definition at line 214 of file SceneManagerPortals.hpp.

◆ extractActors()

void SceneManagerPortals::extractActors ( ActorCollection list)
virtual

Appends to the given list all the Actors contained in the scene regardless of their visibility.

Implements vl::SceneManager.

Definition at line 129 of file SceneManagerPortals.cpp.

References vl::Collection< T >::push_back().

◆ extractVisibleActors()

void SceneManagerPortals::extractVisibleActors ( ActorCollection list,
const Camera camera 
)
virtual

Appends to the given list all the visible Actors using the portal culling algorithm.

Implements vl::SceneManager.

Definition at line 136 of file SceneManagerPortals.cpp.

References vl::Sector::executeCallbacks(), vl::Camera::frustum(), vl::Matrix4< T_Scalar >::getT(), vl::Camera::modelingMatrix(), vl::Portal::mVisitTick, NULL, and vl::Collection< T >::push_back().

◆ frustumStack()

const std::vector<Frustum>& vl::SceneManagerPortals::frustumStack ( ) const
inline

The stack of frustums active at a given point during sector discovery.

Definition at line 230 of file SceneManagerPortals.hpp.

◆ initialize()

void SceneManagerPortals::initialize ( )

Calls computePortalNormals() and performs some error checking.

Definition at line 85 of file SceneManagerPortals.cpp.

References vl::Log::error().

◆ invalidatePortalActors()

void vl::SceneManagerPortals::invalidatePortalActors ( )
inline

Regenerates the portal actors next time their rendering is requested.

Definition at line 227 of file SceneManagerPortals.hpp.

◆ renderPortal()

void SceneManagerPortals::renderPortal ( Portal portal)
protected

◆ sectors() [1/2]

std::vector< ref<Sector> >& vl::SceneManagerPortals::sectors ( )
inline

The Sectors that are part of the scene.

Definition at line 201 of file SceneManagerPortals.hpp.

◆ sectors() [2/2]

const std::vector< ref<Sector> >& vl::SceneManagerPortals::sectors ( ) const
inline

The Sectors that are part of the scene.

Definition at line 203 of file SceneManagerPortals.hpp.

◆ setShowPortals()

void vl::SceneManagerPortals::setShowPortals ( bool  show)
inline

Whether portals should be shown in the rendering or not.

Definition at line 225 of file SceneManagerPortals.hpp.

◆ showPortals()

bool vl::SceneManagerPortals::showPortals ( ) const
inline

Whether portals should be shown in the rendering or not.

Definition at line 223 of file SceneManagerPortals.hpp.

◆ visitSector()

void SceneManagerPortals::visitSector ( Sector prev,
Sector sector,
const vec3 eye,
const Camera camera 
)
protected

Member Data Documentation

◆ mExternalSector

ref<Sector> vl::SceneManagerPortals::mExternalSector
protected

Definition at line 238 of file SceneManagerPortals.hpp.

◆ mFrustumStack

std::vector<Frustum> vl::SceneManagerPortals::mFrustumStack
protected

Definition at line 242 of file SceneManagerPortals.hpp.

◆ mPortalActorMap

std::map<Portal*, ref<Actor> > vl::SceneManagerPortals::mPortalActorMap
protected

Definition at line 241 of file SceneManagerPortals.hpp.

◆ mSectors

std::vector< ref<Sector> > vl::SceneManagerPortals::mSectors
protected

Definition at line 239 of file SceneManagerPortals.hpp.

◆ mShowPortals

bool vl::SceneManagerPortals::mShowPortals
protected

Definition at line 244 of file SceneManagerPortals.hpp.

◆ mTempActors

std::vector< ref<Actor> > vl::SceneManagerPortals::mTempActors
protected

Definition at line 240 of file SceneManagerPortals.hpp.

◆ mVisitTick

unsigned vl::SceneManagerPortals::mVisitTick
protected

Definition at line 243 of file SceneManagerPortals.hpp.


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