Mitsuba Renderer  0.5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
mitsuba::ShadowMapGenerator Class Reference

Utility class for creating different kinds of shadow maps (cube, directional, and paraboloid shadow maps) using hardware rasterization. More...

#include <mitsuba/hw/shadow.h>

+ Inheritance diagram for mitsuba::ShadowMapGenerator:

Public Types

enum  EShadowMapType {
  EDirectional = 0, EParaboloid, ECube, ECubeSinglePass,
  EHemicube, EHemicubeSinglePass, ETypeCount
}
 

Public Member Functions

 ShadowMapGenerator (Renderer *renderer)
 Create a new shadow map generator. More...
 
void init ()
 Register the associated GPU programs. More...
 
ref< GPUTextureallocate (Renderer *renderer, EShadowMapType type, int resolution)
 Allocate a texture that is suitable for storing the requested type of shadow map and return it. More...
 
void render (Renderer *renderer, GPUTexture *shadowMap, EShadowMapType type, const Transform &trafo, Float minDepth, Float maxDepth, const std::vector< Renderer::TransformedGPUGeometry > &geo)
 Render a shadow map using the desired technique. More...
 
Transform directionalFindGoodFrame (const AABB &aabb, const Vector &d) const
 Convenience function for computing a transformation that is suitable for creating a directional shadow map. More...
 
void cleanup ()
 Release allocated resources. More...
 
size_t getShaderCount () const
 Return the number of resident shaders. More...
 
virtual const ClassgetClass () const
 Retrieve this object's class. More...
 
- Public Member Functions inherited from Object
 Object ()
 Construct a new object. More...
 
int getRefCount () const
 Return the current reference count. More...
 
void incRef () const
 Increase the reference count of the object by one. More...
 
void decRef (bool autoDeallocate=true) const
 Decrease the reference count of the object and possibly deallocate it. More...
 
virtual std::string toString () const
 Return a human-readable string representation of the object's contents. More...
 

Static Public Attributes

static Classm_theClass
 
- Static Public Attributes inherited from Object
static Classm_theClass
 Pointer to the object's class descriptor. More...
 

Protected Member Functions

virtual ~ShadowMapGenerator ()
 Virtual destructor. More...
 
- Protected Member Functions inherited from Object
virtual ~Object ()
 Virtual private deconstructor. (Will only be called by ref) More...
 

Protected Attributes

ref< GPUProgramm_program [ETypeCount]
 
bool m_cubeDepthMapsSupported
 
int m_cubeTransform
 
int m_cubeProjDir
 
int m_cubeSinglePassTransform [6]
 
int m_cubeSinglePassProjDir [6]
 
int m_hemicubeSinglePassTransform [5]
 
int m_hemicubeSinglePassProjDir [5]
 
int m_paraboloidMinDepth
 
int m_paraboloidInvDepthRange
 

Additional Inherited Members

- Static Public Member Functions inherited from Object
static void staticInitialization ()
 Initializes the built-in reference count debugger (if enabled) More...
 
static void staticShutdown ()
 Free the memory taken by staticInitialization() More...
 

Detailed Description

Utility class for creating different kinds of shadow maps (cube, directional, and paraboloid shadow maps) using hardware rasterization.

Member Enumeration Documentation

Enumerator
EDirectional 

Directional (orthographic) shadow map.

EParaboloid 

Nonlinear paraboloid shadow map (captures one hemisphere)

ECube 

Omnidirectional shadow map, 6 passes.

ECubeSinglePass 

Omnidirectional shadow map, 1 pass with geometry shader.

EHemicube 

Hemispherical cube shadow map, 5 passes.

EHemicubeSinglePass 

Hemispherical cube shadow map, 1 pass with geometry shader.

ETypeCount 

Unused.

Constructor & Destructor Documentation

mitsuba::ShadowMapGenerator::ShadowMapGenerator ( Renderer renderer)

Create a new shadow map generator.

virtual mitsuba::ShadowMapGenerator::~ShadowMapGenerator ( )
inlineprotectedvirtual

Virtual destructor.

Member Function Documentation

ref<GPUTexture> mitsuba::ShadowMapGenerator::allocate ( Renderer renderer,
EShadowMapType  type,
int  resolution 
)

Allocate a texture that is suitable for storing the requested type of shadow map and return it.

void mitsuba::ShadowMapGenerator::cleanup ( )

Release allocated resources.

Transform mitsuba::ShadowMapGenerator::directionalFindGoodFrame ( const AABB aabb,
const Vector d 
) const

Convenience function for computing a transformation that is suitable for creating a directional shadow map.

Parameters
aabbAxis-aligned bounding box of the world-space content that should be covered
dViewing direction of the shadow map
virtual const Class* mitsuba::ShadowMapGenerator::getClass ( ) const
virtual

Retrieve this object's class.

Reimplemented from Object.

size_t mitsuba::ShadowMapGenerator::getShaderCount ( ) const

Return the number of resident shaders.

void mitsuba::ShadowMapGenerator::init ( )

Register the associated GPU programs.

void mitsuba::ShadowMapGenerator::render ( Renderer renderer,
GPUTexture shadowMap,
EShadowMapType  type,
const Transform trafo,
Float  minDepth,
Float  maxDepth,
const std::vector< Renderer::TransformedGPUGeometry > &  geo 
)

Render a shadow map using the desired technique.

Parameters
rendererUnderlying Renderer instance
shadowMapTarget texture, which was previously created using allocate()
typeDesired shadow map type
trafoView transformation of the source

Member Data Documentation

bool mitsuba::ShadowMapGenerator::m_cubeDepthMapsSupported
protected
int mitsuba::ShadowMapGenerator::m_cubeProjDir
protected
int mitsuba::ShadowMapGenerator::m_cubeSinglePassProjDir[6]
protected
int mitsuba::ShadowMapGenerator::m_cubeSinglePassTransform[6]
protected
int mitsuba::ShadowMapGenerator::m_cubeTransform
protected
int mitsuba::ShadowMapGenerator::m_hemicubeSinglePassProjDir[5]
protected
int mitsuba::ShadowMapGenerator::m_hemicubeSinglePassTransform[5]
protected
int mitsuba::ShadowMapGenerator::m_paraboloidInvDepthRange
protected
int mitsuba::ShadowMapGenerator::m_paraboloidMinDepth
protected
ref<GPUProgram> mitsuba::ShadowMapGenerator::m_program[ETypeCount]
protected
Class* mitsuba::ShadowMapGenerator::m_theClass
static

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