# Visualization Library

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

[Home] [Tutorials] [All Classes] [Grouped Classes]

Public Member Functions | Protected Member Functions | Protected Attributes

# 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:

List of all members.

## Public Member Functions

virtual const char * | className ()
| Returns the name of the class.
| SceneManagerPortals ()
| Constructor.
void | extractActors (ActorCollection &list)
| Appends to the given list all the Actor[s] contained in the scene regardless of their visibility.
void | extractVisibleActors (ActorCollection &list, const Camera *camera)
| Appends to the given list all the visible Actor[s] using the portal culling algorithm.
std::vector< ref< Sector > > & | sectors ()
| The Sectors that are part of the scene.
const std::vector< ref< Sector > > & | sectors () const
| The Sectors that are part of the scene.
Sector * | externalSector ()
| Returns the external sector.
const Sector * | externalSector () const
| Returns the external sector.
void | computePortalNormals ()
| Compute the normal of the sectors.
void | initialize ()
| Calls computePortalNormals() and performs some error checking.
bool | showPortals () const
| Whether portals should be shown in the rendering or not.
void | setShowPortals (bool show)
| Whether portals should be shown in the rendering or not.
const std::vector< Frustum > & | frustumStack () const
| The stack of frustums active at a given point during sector discovery.

## Protected Member Functions

void | renderPortal (Portal *portal)
void | visitSector (Sector *prev, Sector *sector, const vec3 &eye, const Camera *camera)
Sector * | computeStartingSector (const Camera *camera)

## Protected Attributes

ref< Sector > | mExternalSector
std::vector< ref< Sector > > | mSectors
std::vector< ref< Actor > > | mTempActors
std::map< Portal *, ref< Actor > > | mPortalActorMap
std::vector< Frustum > | mFrustumStack
unsigned | mVisitTick
bool | mShowPortals

## Detailed Description

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

See also:
  - Portal-Based Culling and Scene Management Tutorial
  - Portal
  - Sector
  - Actor
  - ActorKdTree
  - ActorTree
  - SceneManager
  - SceneManagerBVH
  - SceneManagerActorKdTree
  - SceneManagerActorTree

Definition at line 183 of file SceneManagerPortals.hpp.

## Constructor & Destructor Documentation

vl::SceneManagerPortals::SceneManagerPortals | ( | ) | `[inline]`

Constructor.

Definition at line 189 of file SceneManagerPortals.hpp.

References VL_DEBUG_SET_OBJECT_NAME.

## Member Function Documentation

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

Returns the name of the class.

Reimplemented from vl::SceneManager.

Definition at line 186 of file SceneManagerPortals.hpp.

void SceneManagerPortals::extractActors | ( | ActorCollection & | list ) | `[virtual]`

Appends to the given list all the Actor[s] contained in the scene regardless of their visibility.

Implements vl::SceneManager.

Definition at line 125 of file SceneManagerPortals.cpp.

References mSectors, and vl::Collection< T >::push_back().

Referenced by extractVisibleActors().

void SceneManagerPortals::extractVisibleActors | ( | ActorCollection & | list,
|  | const Camera * | camera
| ) |  | `[virtual]`

Appends to the given list all the visible Actor[s] using the portal culling algorithm.

Implements vl::SceneManager.

Definition at line 132 of file SceneManagerPortals.cpp.

References computeStartingSector(), vl::SceneManager::cullingEnabled(), vl::Sector::executeCallbacks(), extractActors(), vl::Camera::frustum(), vl::Matrix4< T_Scalar >::getT(), vl::Camera::inverseViewMatrix(), mFrustumStack, mPortalActorMap, mTempActors, mVisitTick, vl::Collection< T >::push_back(), and visitSector().

std::vector< ref<Sector> >& vl::SceneManagerPortals::sectors | ( | ) | `[inline]`

The Sectors that are part of the scene.

Definition at line 200 of file SceneManagerPortals.hpp.

Referenced by computeStartingSector().

const std::vector< ref<Sector> >& vl::SceneManagerPortals::sectors | ( | ) | const`[inline]`

The Sectors that are part of the scene.

Definition at line 202 of file SceneManagerPortals.hpp.

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 211 of file SceneManagerPortals.hpp.

Referenced by computeStartingSector().

const Sector* vl::SceneManagerPortals::externalSector | ( | ) | const`[inline]`

Returns the external sector.

Definition at line 213 of file SceneManagerPortals.hpp.

void SceneManagerPortals::computePortalNormals | ( | ) |

Compute the normal of the sectors.

Definition at line 226 of file SceneManagerPortals.cpp.

References mSectors.

Referenced by initialize().

void SceneManagerPortals::initialize | ( | ) |

Calls computePortalNormals() and performs some error checking.

Definition at line 85 of file SceneManagerPortals.cpp.

References computePortalNormals(), vl::Log::error(), and mSectors.

bool vl::SceneManagerPortals::showPortals | ( | ) | const`[inline]`

Whether portals should be shown in the rendering or not.

Definition at line 222 of file SceneManagerPortals.hpp.

Referenced by visitSector().

void vl::SceneManagerPortals::setShowPortals | ( | bool | show ) | `[inline]`

Whether portals should be shown in the rendering or not.

Definition at line 224 of file SceneManagerPortals.hpp.

const std::vector<Frustum>& vl::SceneManagerPortals::frustumStack | ( | ) | const`[inline]`

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

Definition at line 227 of file SceneManagerPortals.hpp.

void SceneManagerPortals::renderPortal | ( | Portal * | portal ) | `[protected]`

Definition at line 98 of file SceneManagerPortals.cpp.

References vl::EN_BLEND, vl::Portal::geometry(), vl::ref< T >::get(), mPortalActorMap, mTempActors, vl::PT_LINE_LOOP, and vl::PT_POLYGON.

Referenced by visitSector().

void SceneManagerPortals::visitSector | ( | Sector * | prev,
|  | Sector * | sector,
|  | const vec3 & | eye,
|  | const Camera * | camera
| ) |  | `[protected]`

Definition at line 161 of file SceneManagerPortals.cpp.

References vl::Sector::actors(), vl::Collection< T >::at(), vl::Actor::boundingBox(), vl::Actor::computeBounds(), vl::cross(), vl::dot(), vl::Sector::executeCallbacks(), vl::SceneManager::isEnabled(), mFrustumStack, mTempActors, mVisitTick, vl::Vector3< T_Scalar >::normalize(), vl::Frustum::planes(), vl::Sector::portals(), renderPortal(), vl::Frustum::setPlane(), showPortals(), vl::Collection< T >::size(), and VL_CHECK.

Referenced by extractVisibleActors().

Sector * SceneManagerPortals::computeStartingSector | ( | const Camera * | camera ) | `[protected]`

Definition at line 233 of file SceneManagerPortals.cpp.

References externalSector(), vl::Matrix4< T_Scalar >::getT(), vl::Camera::inverseViewMatrix(), mSectors, and sectors().

Referenced by extractVisibleActors().

## Member Data Documentation

ref<Sector> vl::SceneManagerPortals::mExternalSector`[protected]`

Definition at line 235 of file SceneManagerPortals.hpp.

std::vector< ref<Sector> > vl::SceneManagerPortals::mSectors`[protected]`

Definition at line 236 of file SceneManagerPortals.hpp.

Referenced by computePortalNormals(), computeStartingSector(), extractActors(), and initialize().

std::vector< ref<Actor> > vl::SceneManagerPortals::mTempActors`[protected]`

Definition at line 237 of file SceneManagerPortals.hpp.

Referenced by extractVisibleActors(), renderPortal(), and visitSector().

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

Definition at line 238 of file SceneManagerPortals.hpp.

Referenced by extractVisibleActors(), and renderPortal().

std::vector<Frustum> vl::SceneManagerPortals::mFrustumStack`[protected]`

Definition at line 239 of file SceneManagerPortals.hpp.

Referenced by extractVisibleActors(), and visitSector().

unsigned vl::SceneManagerPortals::mVisitTick`[protected]`

Definition at line 240 of file SceneManagerPortals.hpp.

Referenced by extractVisibleActors(), and visitSector().

bool vl::SceneManagerPortals::mShowPortals`[protected]`

Definition at line 241 of file SceneManagerPortals.hpp.

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

- D:/VL/BuildSystem/VL_DISTRO/Visualization_Library_SDK/src/vlGraphics/SceneManagerPortals.hpp
- D:/VL/BuildSystem/VL_DISTRO/Visualization_Library_SDK/src/vlGraphics/SceneManagerPortals.cpp

Visualization Library v2011.05.1142 Reference Documentation
Copyright 2005-2011 Michele Bosi. All rights reserved.
Updated on Thu May 26 2011 22:51:45.
Permission is granted to use this page to write and publish articles regarding Visualization Library.