chai3d::cShadowMap Class Reference

This class implements a shadow map for spot lights (cSpotLight). More...

#include <CShadowMap.h>

Inheritance diagram for chai3d::cShadowMap:

Public Member Functions

 cShadowMap ()
 Constructor of cShadowMap. More...
 
virtual ~cShadowMap ()
 Destructor of cShadowMap. More...
 
void setEnabled (bool a_enabled)
 This method enables or disables this shadow map. More...
 
bool getEnabled () const
 This method returns true if the this shadow map is enabled, false otherwise. More...
 
void setQualityVeryLow ()
 This method sets the quality resolution of the shadow map to 256 x 256 pixels. More...
 
void setQualityLow ()
 This method sets the quality resolution of the shadow map to 512 x 512 pixels. More...
 
void setQualityMedium ()
 This method sets the quality resolution of the shadow map to 1024 x 1024 pixels. More...
 
void setQualityHigh ()
 This method sets the quality resolution of the shadow map to 2048 x 2048 pixels. More...
 
void setQualityVeryHigh ()
 This method sets the quality resolution of the shadow map to 4096 x 4096 pixels. More...
 
virtual void render (cRenderOptions &a_options)
 This method contains the OpenGL rendering code for shadow maps. (Do not call this code directly.) More...
 
bool updateMap (cWorld *a_world, const cVector3d &a_lightPos, const cVector3d &a_lightLookat, const cVector3d &a_lightUp, const double a_lightFieldViewAngle, const double a_distanceNear, const double a_distanceFar, const double a_mirrorH, const double a_mirrorV)
 This method updates the shadow map. (Do not call this code directly.) More...
 
- Public Member Functions inherited from chai3d::cFrameBuffer
 cFrameBuffer ()
 Constructor of cFrameBuffer. More...
 
virtual ~cFrameBuffer ()
 Destructor of cFrameBuffer. More...
 
void setup (cCamera *a_camera=NULL, const unsigned int a_width=0, const unsigned int a_height=0, const bool a_enableImageBuffer=true, const bool a_enableDepthBuffer=true)
 This method initializes the framebuffer. More...
 
void renderView (const cEyeMode a_eyeMode=C_STEREO_LEFT_EYE)
 This method renders the framebuffer view. More...
 
void copyImageBuffer (cImagePtr a_image)
 This method copies the framebuffer content to an image. More...
 
void copyDepthBuffer (cImagePtr a_image)
 This method copies the depth buffer content to an image. More...
 
void setCamera (cCamera *a_camera)
 This method attaches a camera to the framebuffer. More...
 
cCameragetCamera ()
 This method returns a pointer to the camera attached to the framebuffer. More...
 
unsigned int getWidth () const
 This method returns the width in pixels of the framebuffer. More...
 
unsigned int getHeight () const
 This method returns the height in pixels of the framebuffer. More...
 
void setSize (const unsigned int a_width, const unsigned int a_height)
 This method sets the resolution of the framebuffer by defining its width and height in pixels. More...
 
bool renderInitialize ()
 This method initializes rendering to the framebuffer. More...
 
bool renderFinalize ()
 This method finalizes the rendering to the framebuffer. More...
 

Public Attributes

cTransform m_lightProjectionMatrix
 Projection matrix of the light source creating this shadow. More...
 
cTransform m_lightViewMatrix
 View matrix of the light source creating this shadow. More...
 
- Public Attributes inherited from chai3d::cFrameBuffer
cTexture2dPtr m_imageBuffer
 Image buffer. More...
 
cTexture2dPtr m_depthBuffer
 Depth buffer. More...
 

Protected Attributes

bool m_enabled
 If true, then shadow map is enabled, false otherwise. More...
 
- Protected Attributes inherited from chai3d::cFrameBuffer
bool m_useImageBuffer
 If true then image buffer is enabled, false otherwise. More...
 
bool m_useDepthBuffer
 If true then image buffer is enabled, false otherwise. More...
 
unsigned int m_width
 Width in pixels of the frame buffer. More...
 
unsigned int m_height
 Height in pixels of the frame buffer. More...
 
unsigned int m_prevWidth
 Last width value that was used when allocating texture size. More...
 
unsigned int m_prevHeight
 Last height value that was used when allocating texture size. More...
 
cCameram_camera
 Camera associated with this framebuffer. More...
 
GLuint m_fbo
 OpenGL frame buffer object. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from chai3d::cFrameBuffer
static cFrameBufferPtr create ()
 Shared cFrameBuffer allocator. More...
 

Detailed Description

This class implements a shadow map texture for spot lights (cSpotLight).

Constructor & Destructor Documentation

chai3d::cShadowMap::cShadowMap ( )

Constructor of cShadowMap.

virtual chai3d::cShadowMap::~cShadowMap ( )
inlinevirtual

Member Function Documentation

void chai3d::cShadowMap::setEnabled ( bool  a_enabled)
inline
bool chai3d::cShadowMap::getEnabled ( ) const
inline
void chai3d::cShadowMap::setQualityVeryLow ( )
inline
void chai3d::cShadowMap::setQualityLow ( )
inline
void chai3d::cShadowMap::setQualityMedium ( )
inline
void chai3d::cShadowMap::setQualityHigh ( )
inline
void chai3d::cShadowMap::setQualityVeryHigh ( )
inline
void chai3d::cShadowMap::render ( cRenderOptions a_options)
virtual

This method contains the OpenGL rendering code for the shadowmap. This code is called internally by CHAI3D. Do not call this method directly.

Parameters
a_optionsRendering options.
bool chai3d::cShadowMap::updateMap ( cWorld a_world,
const cVector3d a_lightPos,
const cVector3d a_lightLookat,
const cVector3d a_lightUp,
const double  a_lightFieldViewAngle,
const double  a_distanceNear,
const double  a_distanceFar,
const double  a_mirrorH,
const double  a_mirrorV 
)

This method creates a shadow map by providing a world and view point information.

Parameters
a_worldWorld in which to create shadow
a_lightPosPosition of eye.
a_lightLookatEye lookat position
a_lightUpEye orientation (up vector).
a_lightFieldViewAngleField of view of light source
a_distanceNearDistance to near clipping plane.
a_distanceFarDistance to far clipping plane.
a_mirrorHScale factor for horizontal mirroring (-1.0 or 1.0)
a_mirrorVScale factor for vertical mirroring (-1.0 or 1.0)
Returns
true if shadow map was created successfully. false otherwise.

Member Data Documentation

cTransform chai3d::cShadowMap::m_lightProjectionMatrix
cTransform chai3d::cShadowMap::m_lightViewMatrix
bool chai3d::cShadowMap::m_enabled
protected

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