Public API Reference

CS::RenderManager::AutoFX::ReflectRefract< RenderTree, ContextSetupReflect, ContextSetupRefract > Class Template Reference

Render manager helper for automatic plane reflection/refraction textures. More...

#include <csplugincommon/rendermanager/autofx_reflrefr.h>

Inheritance diagram for CS::RenderManager::AutoFX::ReflectRefract< RenderTree, ContextSetupReflect, ContextSetupRefract >:

List of all members.

Public Member Functions

void operator() (typename RenderTree::MeshNode *node, size_t layer, typename RenderTree::MeshNode::SingleMesh &mesh, const csBitArray &names)
 Operator doing the actual work.

Detailed Description

template<typename RenderTree, typename ContextSetupReflect, typename ContextSetupRefract = ContextSetupReflect>
class CS::RenderManager::AutoFX::ReflectRefract< RenderTree, ContextSetupReflect, ContextSetupRefract >

Render manager helper for automatic plane reflection/refraction textures.

When some shader used in a render tree context uses a planar reflection texture (SV name tex plane reflect), refraction texture (tex plane refract) or matching depth textures (tex plane reflect depth, tex plane refract depth) new contexts are set up to render the scene with the appropriate settings to textures.

The reflection/refraction is planar. The reflection texture will contain the scene from the context's view, but mirrored at and clipped to the reflection plane (everything "above" the reflecting planar surface). The refraction texture will contain the scene from the context's view, but clipped to the reflection plane (everything "below" the reflecting planar surface).

The reflection plane can be specified in object space of a mesh object by attach an SV plane reflection to it. If no such SV is attached, a reflection plane is computed from the object space bounding box: the plane's origin is the origin of the mesh, the plane's normal points into the positive direction of the smallest dimension of the bounding box.

Usage: Functor for TraverseUsedSVSets. Application must happen after shader and ticket setup (e.g. SetupStandardTicket()). Example:

 // Define type using rendermanager-dependent render tree and context setup
 typedef CS::RenderManager::AutoFX::ReflectRefract<RenderTreeType, 
   ContextSetupType> AutoReflectRefractType;

 // Instantiate helper in rendering
 RenderManagerType::AutoReflectRefractType fxRR (
   rmanager->reflectRefractPersistent, *this);
 // Set up a traverser for the sets of shader vars used over each mesh
 typedef TraverseUsedSVSets<RenderTreeType,
   RenderManagerType::AutoReflectRefractType> SVTraverseType;
 SVTraverseType svTraverser
   (fxRR, shaderManager->GetSVNameStringset ()->GetSize (), fxRR.svUserFlags);
 // Do the actual traversal.
 ForEachMeshNode (context, svTraverser);

The template parameter RenderTree gives the render tree type. The parameter ContextSetupReflect and ContextSetupRefract give classes used to set up the contexts for the reflection resp. refraction rendering. They must provide an implementation of operator() (RenderTree::ContextNode&).

Automatic reflections and refractions have a number of configuration settings; see data/config-plugins/engine.cfg.

Definition at line 192 of file autofx_reflrefr.h.

Member Function Documentation

template<typename RenderTree , typename ContextSetupReflect , typename ContextSetupRefract = ContextSetupReflect>
void CS::RenderManager::AutoFX::ReflectRefract< RenderTree, ContextSetupReflect, ContextSetupRefract >::operator() ( typename RenderTree::MeshNode node,
size_t  layer,
typename RenderTree::MeshNode::SingleMesh mesh,
const csBitArray names 
) [inline]

Operator doing the actual work.

If one of the reflection or refraction textures is detected in the set of shader vars used (names) by mesh textures are set up.

Definition at line 214 of file autofx_reflrefr.h.

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

Generated for Crystal Space 2.0 by doxygen 1.6.1