CrystalSpace

Public API Reference

CS::RenderManager::StandardPortalSetup< RenderTreeType, ContextSetup > Class Template Reference

Standard setup functor for portals. More...

#include <csplugincommon/rendermanager/portalsetup.h>

Inheritance diagram for CS::RenderManager::StandardPortalSetup< RenderTreeType, ContextSetup >:

List of all members.

Classes

struct  ContextSetupData
 Data that needs to be passed between portal setup steps by the context setup function. More...

Public Member Functions

void operator() (typename RenderTreeType::ContextNode &context, ContextSetupData &setupData)
 Operator doing the actual work.
 StandardPortalSetup (PersistentData &persistentData, ContextSetup &cfun)
 Constructor.

Detailed Description

template<typename RenderTreeType, typename ContextSetup>
class CS::RenderManager::StandardPortalSetup< RenderTreeType, ContextSetup >

Standard setup functor for portals.

Iterates over all portals in a context and sets up new contexts to render the part of the scene "behind" the portal. Depending on the settings of a portal, it is either rendered to the same target as the context or a new texture (in which case the original context is augmented with a mesh rendering that texture).

Usage: instiate. Application after the visible meshes were determined, but before mesh sorting. Example:

  // Type for portal setup
  typedef CS::RenderManager::StandardPortalSetup<RenderTreeType,
    ContextSetupType> PortalSetupType;

 // Assumes there is an argument 'PortalSetupType::ContextSetupData& portalSetupData'
 // to the current method, taking data from the previous portal (if any)

 // Keep track of the portal recursions to avoid infinite portal recursions
 if (recurseCount > 30) return;

 // Set up all portals
 {
   recurseCount++;
   // Data needed to be passed between portal setup steps
   PortalSetupType portalSetup (rmanager->portalPersistent, *this);
   // Actual setup
   portalSetup (context, portalSetupData);
   recurseCount--;
 }

The template parameter RenderTree gives the render tree type. The parameter ContextSetup gives a class used to set up the contexts for the rendering of the scene behind a portal. It must provide an implementation of operator() (RenderTree::ContextNode& context, PortalSetupType::ContextSetupData& portalSetupData).

Internal workings
The standard setup will classify portals into simple and heavy portals respectively where simple portals can be rendered directly without clipping while heavy portals requires render-to-texture.

Definition at line 283 of file portalsetup.h.


Constructor & Destructor Documentation

template<typename RenderTreeType , typename ContextSetup >
CS::RenderManager::StandardPortalSetup< RenderTreeType, ContextSetup >::StandardPortalSetup ( PersistentData persistentData,
ContextSetup &  cfun 
) [inline]

Constructor.

Definition at line 303 of file portalsetup.h.


Member Function Documentation

template<typename RenderTreeType , typename ContextSetup >
void CS::RenderManager::StandardPortalSetup< RenderTreeType, ContextSetup >::operator() ( typename RenderTreeType::ContextNode &  context,
ContextSetupData setupData 
) [inline]

Operator doing the actual work.

Goes over the portals in the given context and sets up rendering of behind the portals.

Definition at line 311 of file portalsetup.h.


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

Generated for Crystal Space 2.1 by doxygen 1.6.1