Classes | Private Member Functions | Private Attributes | Static Private Attributes | Friends

VR3ShadowController Class Reference

The shadow controller class. More...

#include <VR3ShadowController.h>

Collaboration diagram for VR3ShadowController:
Collaboration graph
[legend]

List of all members.

Classes

struct  ShadowSource
 Structure representing a single shadow source. More...

Public Member Functions

Constructor and Destructor
 VR3ShadowController (int mode=VR3SDOWCTRL_AUTOMATIC)
 Shadow controller constructor.
 ~VR3ShadowController ()
 Shadow controller destructor.
Sources Management Functions
void InitSource (int id, GLfloat srcposX, GLfloat srcposY, GLfloat srcposZ, GLfloat srcupX, GLfloat srcupY, GLfloat srcupZ, GLfloat srctargetX, GLfloat srctargetY, GLfloat srctargetZ, GLfloat fovy, GLfloat aspect, GLfloat znear, GLfloat zfar, GLsizei width, GLsizei height, GLint filtersize=VR3SDOW_DEF_FILTERSIZE, GLfloat intensity=VR3SDOW_DEF_INTENSITY, GLfloat minvariance=VR3SDOW_DEF_MINVARIANCE, GLfloat bleedred=VR3SDOW_DEF_BLEEDREDUCTION, GLfloat depthscale=VR3SDOW_DEF_DEPTHSCALE)
 Initializes a shadow source.
void DeinitSource (int id)
 Deinitializes a shadow source.
void SetFrustumParam (int id, GLfloat srcposX, GLfloat srcposY, GLfloat srcposZ, GLfloat srcupX, GLfloat srcupY, GLfloat srcupZ, GLfloat srctargetX, GLfloat srctargetY, GLfloat srctargetZ, GLfloat fovy, GLfloat aspect, GLfloat znear, GLfloat zfar)
 Sets some shadow source parameters (frustum parameters)
void SetMapParam (int id, GLsizei width, GLsizei height)
 Sets some shadow source parameters (map image parameters)
void SetAlgorithmParam (int id, GLint filtersize=VR3SDOW_DEF_FILTERSIZE, GLfloat intensity=VR3SDOW_DEF_INTENSITY, GLfloat minvariance=VR3SDOW_DEF_MINVARIANCE, GLfloat bleedred=VR3SDOW_DEF_BLEEDREDUCTION, GLfloat depthscale=VR3SDOW_DEF_DEPTHSCALE)
 Sets some shadow source parameters (algorithm parameters)
Enable and Disable Scene Components
void Enable (int feature, int optional_param=0)
 Enables a specific shadow controller feature.
void Disable (int feature, int optional_param=0)
 Disables a specific shadow controller feature.
bool IsEnabled (int feature, int optional_param=0)
 Checks if a particular shadow controller feature is active.
bool CheckVFCulling ()
 Checks whether shadow view frustum culling is enabled or not.
Shadow Properties Discovery Functions and Controller Notification
const VR3ShadowShaderParamsFetchParameters ()
 Rendering shaders uniform discovery function.
const GLfloat * FetchViewMat ()
 Shadow source viewing matrix discovery function.
const GLfloat * FetchProjMat ()
 Shadow source projection matrix discovery function.
void IncMeshCounter ()
 Shadow controller notification function.
Uniform Locations
const GLint * GetUniforms ()
 Gets a pointer to the array of uniform locations.

Private Member Functions

 VR3ShadowController (const VR3ShadowController &)
 Disable default copy constructor.
VR3ShadowControlleroperator= (const VR3ShadowController &)
 Disable default assignment operator.
VAO and VBOs Preparation Function
void PrepareVAO ()
 Prepares the VAO for the plane used when blurring the shadow map.
Source Visibility Testing Function
bool SourceVisibilityTest (const ShadowSource *src)
 Checks if a source shadow projection volume is visible.
Shadow Map Drawing Method
void DrawShadowMaps ()
 Shadow map drawing method.

Private Attributes

int m_mode
 Shadow controller mode.
ShadowSource m_sources [VR3SDOW_NUM_SOURCES]
 Array of shadow sources (active or not)
std::unordered_set< VR3Obj * > m_receivers
 Set of shadow receiver objects (O(1) access time)
std::unordered_set< VR3Obj * > m_casters
 list of shadow caster objects
GLuint m_shadowmap_program
 Shadow map rendering shader program.
const GLint * m_shadowmap_unilocs
 Pointer to the uniform location array defined for the program.
GLuint m_blur_programs [2]
 Shadow map blur shader programs (horizontal - vertical)
const GLint * m_blur_unilocs [2]
 Pointer to the uniform location arrays defined for the programs (horizontal - vertical)
GLuint m_VAO
 VAO associated with the plane used when filtering.
GLuint m_VBO
 Mesh VBO associated with the above VAO (vertex positions)
VR3ShadowShaderParams m_shadparams
 Rendeirng shader parameters values.
const GLfloat * m_cursrcviewmat
 Shadow mapping shader parameter.
const GLfloat * m_cursrcprojmat
 Shadow mapping shader parameter.
int m_meshcounter
 Number of meshes drawn in the shadow map.
bool m_face_culling
 Backface culling enabled flag.
bool m_vf_culling
 View frustum culling enabled flag.
bool m_source_culling
 Shadow source culling enabled flag.

Static Private Attributes

static VR3ShadowControllerms_activecontroller
 Pointer to the currently active VR3ShadowController object.

Friends

class VR3Scene
 Friend class VR3Scene to access the DrawShadowMaps() method.
class VR3Obj
 Friend class VR3Obj to access the private AutoCastShadows() and AutoReceiveShadows() methods.

Casters and Receivers Management Functions

void AutoCastShadows (VR3Obj *obj, bool cast)
 Adds or removes an object from the casters set (auto-called)
void AutoReceiveShadows (VR3Obj *obj, bool receive)
 Adds or removes an object from the receivers set (auto-called)
void CastShadows (VR3Obj *obj, bool cast)
 Adds or removes an object from the casters set (user-called)
void ReceiveShadows (VR3Obj *obj, bool receive)
 Adds or removes an object from the receivers set (user-called)
bool InCasters (VR3Obj *obj)
 Discovers if the given object is in the casters set.
bool InReceivers (VR3Obj *obj)
 Discovers if the given object is in the receivers set.

Active Shadow Controller Management

static VR3ShadowControllerGetActiveController ()
 Gets the currently active VR3ShadowController object.
void Activate ()
 Activates the current controller as the active shadow controller.
void Deactivate ()
 Deactivates the current controller.

Detailed Description

The shadow controller class.

This class controls our built-in shadow mapping implementation and provides the functionalities used to draw the shadow maps and apply them on the scene objects.

A shadow controller can be configured as:

The shadow controller mantains a set of shadow caster objects, to be used to render the shadow maps. The shadow controller also mantains a set of shadow receiver objects, to be used to understand if an object should receive a shadow while shading.

The above sets are kept updated during VR3Obj creation and deletion in the currently active shadow controller if configured as automatic. Usually, an automatic VR3ShadowController is created at initialization time just after the VR3Scene object. Alternatively, objects may be created before a VR3ShadowController and the user may add them as casters and receivers. This is allowed only if the shadow controller is manual and in this case there is no automatic object management. When using a manual shadow controller, objects are never automatically added or removed from the sets, even when the object is deleted from dynamic memory (all operations are user-commanded).

Also note that, when drawing the shadow map, parental relations between objects always apply. To obtain the same effect as in standard scene rendering, we have to make sure that only root objects belong to the casters and receivers set by default in automatic controllers, this way we have that:

If the user wants to render both in the scene and in the shadow map a son object as a stand-alone object, she will have to add it to the receivers and casters sets manually and this can be done only in non-automatic shadow controllers.

When the user desires to use our built-in shadow mapping functionality, she must create an instance of the VR3ShadowController object. By default the object is automatically made the active one and is used to perform shadow mapping.

When a shadow controller object is enabled (active) the shadow maps will be automatically rendered when entering a Begin()...End() block (except from particular Begin() flags and will automatically be used when shading objects configured as receivers. It is also possible to specify a particular flag in the Begin() function that disables shadow maps rendering for the incoming Begin()...End() block. This may be useful if each frame contains more than one Begin()...End() block, but no changes take place between the blocks.

We use a specific shadow mapping algorithm to render convincing soft shadows which is called EVSM (Exponential Variance Shadow Mapping). As in any shadow mapping algorithm, shadows originate from what we call a shadow source (usually a light). One or more shadow projection sources may be configured, but keep in mind that a distinct shadow map will be rendered and used for shading for each light active as shadow source. If the number of lights active as shadow source grows, it is very unlikely to obtain high frame rates.

The concept of shadow source is different from a VR3Light object (a scene light), indeed they are not correlated. If a user wants a light source to cast shadows from the lit objects, she must make sure that the shadow source is kept synchronous with the light (e.g. in terms of position).

The shadow controller holds an array of active shadows sources, there is a fixed limit on the number of possible active shadows sources defined by the VRLib. Each shadow source is identified by an id, in the current implementation the VR3Scene object maps its light id directly on the shadow ids.

By default, the following is true:

The number of active sources we may handle at once is given by the following calculation:

  min( GL_MAX_TEXTURE_IMAGE_UNITS-VR3TEX_RESERVED_UNITS, VR3SDOW_NUM_SOURCES )

And the above value is stored in VR3Globals::max_shadow_sources when the VR3Scene object is first created.

Shadow sources must be thought as oriented lights which instead of lighting the objects, make them cast shadows onto other objects. A shadow source has a specific "shadow frustum" that is the volume where shadow casting and reception may take place. To define the shadow volume, when initializing the shadow source the user must provide:

Please note that shadows will never be casted on fragments whose distance from the shadow source is above zfar (even if they are in the shadow frustum). This is a safety measure to avoid numerical problems.

We use an implementation of the Exponential Variance Shadow Mapping algorithm to produce soft shadows, the shadows produced by each of the shadow sources may be tuned using the algorithm parameters:

  1. Depth Scale (VR3SDOW_DEF_DEPTHSCALE by default) - This constant affect the exponential warp, the default value is used to obtain optimal EVSM quality without numerical precision issues. If the user experiments numerical precision issues (that is, small and sharp shadow acnes or evident and flashing shadows at the far clipping distance in the shadow frustum), it means that hardware single precision filtering is not working properly or 32-bit floating point format is not correctly supported by the GL implementation. In this situation, lowering the depth scale value may solve the problem; we also strongly recommend to use a shadow frustum such that all shadowed objects are well-fitted in the volume: it must not be too tight nor too loose.
  2. Minimum Variance (VR3SDOW_DEF_MINVARIANCE by default) - Usually it is not necessary to change the value from the default, sometimes (rare cases) it may need to be tuned to remove shadow acne artefacts.
  3. Shadow Intensity (VR3SDOW_DEF_INTENSITY by default) - This parameter affect how dark objects become when in shadows: if a value of 1.0 is set as shadow intensity, a completely occluded object will be totally black (except in case of ambient lighting).
  4. Bleeding Reduction Factor (VR3SDOW_DEF_BLEEDREDUCTION by default) - With the EVSM algorithm, an artifact called light bleeding may appear when regions of completely occluded objects present bright "cuts", this parameter may be used to reduce light bleeding, but the quality of the penumbra areas decreases as the bleeding reduction factor increases.
  5. Filter Size (VR3SDOW_DEF_FILTERSIZE by default) - When the shadow map is rendered first, before proceeding with the standard objects draw calls, the shadow map is blurred using a GPU-powered separable gaussian blur filter. This parameter may assume a value between 1 and 10 and affects the number of pixels blurred to produce a single output blurred pixel. The radius of the gaussian blur filter is given by Filter Size, that is, from 1 to 10 pixels.

The shadow controller also allows the user to tune some optimization features, the available shadow controller features are the following:

Definition at line 230 of file VR3ShadowController.h.


Constructor & Destructor Documentation

VR3ShadowController::VR3ShadowController ( const VR3ShadowController  ) [private]

Disable default copy constructor.

VR3ShadowController::VR3ShadowController ( int  mode = VR3SDOWCTRL_AUTOMATIC )

Shadow controller constructor.

Builds a new shadow controller setting all available shadow sources as inactive. This constructor also makes this controller object the active one and stores the specified controller mode.

Parameters:
[in]modeShadow controller mode, one of:

VR3ShadowController::~VR3ShadowController (  )

Shadow controller destructor.

Destroys the shadow controller and any source that has been initialized. It also deactivates the currently active controller if it was the destroyed one.


Member Function Documentation

void VR3ShadowController::Activate (  )

Activates the current controller as the active shadow controller.

Sets this controller as the active controller, possibly overwriting other controllers.

void VR3ShadowController::AutoCastShadows ( VR3Obj obj,
bool  cast 
) [private]

Adds or removes an object from the casters set (auto-called)

By default the casters set contains any root object the user creates in automatic shadow controllers, this function is used to add or remove an object from the casters set. If called on a non-automatic shadow controller, this function has no effect.

Parameters:
[in]objThe object to remove or add
[in]casttrue if the object is to be added, false otherways
void VR3ShadowController::AutoReceiveShadows ( VR3Obj obj,
bool  receive 
) [private]

Adds or removes an object from the receivers set (auto-called)

By default the receivers set contains any root object the user creates in automatic shadow controllers, this function is used to add or remove an object from the receivers set. If called on a non-automatic shadow controller, this function has no effect.

Parameters:
[in]objThe object to remove or add
[in]receivetrue if the object is to be added, false otherways
void VR3ShadowController::CastShadows ( VR3Obj obj,
bool  cast 
)

Adds or removes an object from the casters set (user-called)

By default the casters set contains no object in manual shadow controllers, this function is used to add or remove an object from the casters set. This function may be used only in manual shadow controllers.

Parameters:
[in]objThe object to remove or add
[in]casttrue if the object is to be added, false otherways
bool VR3ShadowController::CheckVFCulling (  ) [inline]

Checks whether shadow view frustum culling is enabled or not.

This function is used at rendering time and is not to be called by the user. It simply checks if the view frustum culling feature is enabled.

Returns:
true if shadow view frustum culling is enabled, false otherways

Definition at line 778 of file VR3ShadowController.h.

void VR3ShadowController::Deactivate (  )

Deactivates the current controller.

If the current shadow controller is the currently active controller, it is deactivated and the active controller is set tu NULL.

void VR3ShadowController::DeinitSource ( int  id )

Deinitializes a shadow source.

A shadow source may not be simply activated like a scene light, the user must provide quite a lot of parameters before being able to "switch" the source on. This function is used to deinitialize the shadow source. If the source was not initialized, the function notifies a warning.

Parameters:
[in]idThe source id to initialize
void VR3ShadowController::Disable ( int  feature,
int  optional_param = 0 
)

Disables a specific shadow controller feature.

This function is used to disable a feature of the controller, currently the user may disable the following features specified through the feature parameter:

Parameters:
[in]featureThe desired feature
[in]optional_paramAn additional argument
void VR3ShadowController::DrawShadowMaps (  ) [private]

Shadow map drawing method.

This method is called when a Begin() operation is commanded on a VR3Scene object. It renders a shadow map for each active source and binds them to the correct texture image units to be used during true object rendering. User has no direct access to this method. While shadow maps are rendered on the respective textures, uniform parameter values are prepared for the shaders to be used while performing the true object rendering to project the shadows. Note that, because all active registered objects are considered while tracing the shadow maps, if not all registered objects are effectively rendered in the Begin()...End() block the scene will present "invisible" objects' shadows. While rendering the shadow map, alpha blending is disabled in order to use the alpha channel of the shadow map texture unit as a standard color channel.

void VR3ShadowController::Enable ( int  feature,
int  optional_param = 0 
)

Enables a specific shadow controller feature.

This function is used to enable a feature of the controller, currently the user may enable the following features specified through the feature parameter:

Parameters:
[in]featureThe desired feature
[in]optional_paramAn additional argument
const VR3ShadowShaderParams* VR3ShadowController::FetchParameters (  ) [inline]

Rendering shaders uniform discovery function.

This function is used during rendering to retrieve the values of some shadow controller properties consumed by the shaders as uniform parameters (source properties).

Definition at line 793 of file VR3ShadowController.h.

const GLfloat* VR3ShadowController::FetchProjMat (  ) [inline]

Shadow source projection matrix discovery function.

This function may be used during shadow map drawing to retrieve the projection matrix of the currently active shadow source (the one whose map is being rendered).

Definition at line 809 of file VR3ShadowController.h.

const GLfloat* VR3ShadowController::FetchViewMat (  ) [inline]

Shadow source viewing matrix discovery function.

This function is used during shadow map drawing to retrieve the viewing matrix of the currently active shadow source (the one whose map is being rendered).

Definition at line 801 of file VR3ShadowController.h.

static VR3ShadowController* VR3ShadowController::GetActiveController (  ) [inline, static]

Gets the currently active VR3ShadowController object.

This static method gets the currently shadow controller, notice that just one controller may be active at any given time.

Returns:
The active shadow controller

Definition at line 496 of file VR3ShadowController.h.

const GLint* VR3ShadowController::GetUniforms (  ) [inline]

Gets a pointer to the array of uniform locations.

This function is used by the VR3Mesh class during rendering of the shadow maps to access the locations of uniform parameters, an array is returned containing the locations of all shadow mapping uniforms.

Returns:
The array of uniform locations

Definition at line 834 of file VR3ShadowController.h.

bool VR3ShadowController::InCasters ( VR3Obj obj ) [inline]

Discovers if the given object is in the casters set.

This function is only a discovery functions and merely returns a boolean value.

Parameters:
[in]objThe object ot find

Definition at line 597 of file VR3ShadowController.h.

void VR3ShadowController::IncMeshCounter (  ) [inline]

Shadow controller notification function.

This function is used during mesh rendering to notify the shadow controller that a new mesh has been rendered (passing the shadow view frustum test - if enabled).

Definition at line 817 of file VR3ShadowController.h.

void VR3ShadowController::InitSource ( int  id,
GLfloat  srcposX,
GLfloat  srcposY,
GLfloat  srcposZ,
GLfloat  srcupX,
GLfloat  srcupY,
GLfloat  srcupZ,
GLfloat  srctargetX,
GLfloat  srctargetY,
GLfloat  srctargetZ,
GLfloat  fovy,
GLfloat  aspect,
GLfloat  znear,
GLfloat  zfar,
GLsizei  width,
GLsizei  height,
GLint  filtersize = VR3SDOW_DEF_FILTERSIZE,
GLfloat  intensity = VR3SDOW_DEF_INTENSITY,
GLfloat  minvariance = VR3SDOW_DEF_MINVARIANCE,
GLfloat  bleedred = VR3SDOW_DEF_BLEEDREDUCTION,
GLfloat  depthscale = VR3SDOW_DEF_DEPTHSCALE 
)

Initializes a shadow source.

A shadow source may not be simply activated like a scene light, the user must provide quite a lot of parameters before being able to "switch" the source on. This function is used to initialize the shadow source. If the source was already initialized, the function notifies a warning.

Parameters:
[in]idThe source id to initialize
[in]srcposX,srcposY,srcposZPosition of the shadow source
[in]srcupX,srcupY,srcupZUp vector of the shadow source viewport
[in]srctargetX,srctargetY,srctargetZCentral point in the shadow source viewport
[in]fovyField of view in the y direction
[in]aspectAspect ratio of the shadow view port
[in]znearNear clipping distance
[in]zfarFar clipping distance
[in]widthWidth of the shadow map (in pixels)
[in]heightHeight of the shadow map (in pixels)
[in]filtersize,intensity,minvariance,bleedred,depthscaleEVSM algorithm parameters
bool VR3ShadowController::InReceivers ( VR3Obj obj ) [inline]

Discovers if the given object is in the receivers set.

This function is only a discovery functions and merely returns a boolean value.

Parameters:
[in]objThe object ot find

Definition at line 606 of file VR3ShadowController.h.

bool VR3ShadowController::IsEnabled ( int  feature,
int  optional_param = 0 
)

Checks if a particular shadow controller feature is active.

This function is used to check if a feature of the controller is active, currently the user may check the following features through the feature parameter:

Parameters:
[in]featureThe desired feature
[in]optional_paramAn additional argument
Returns:
true if the feature is enabled, false otherways
VR3ShadowController& VR3ShadowController::operator= ( const VR3ShadowController  ) [private]

Disable default assignment operator.

void VR3ShadowController::PrepareVAO (  ) [private]

Prepares the VAO for the plane used when blurring the shadow map.

The VAO to used to blur the shadow maps will always have the vertex positions and the shadow map texture coordinates. This function is used to prepare the VAO with the two required VBOs and send the data to the GL.

void VR3ShadowController::ReceiveShadows ( VR3Obj obj,
bool  receive 
)

Adds or removes an object from the receivers set (user-called)

By default the receivers set contains no object in manual shadow controllers, this function is used to add or remove an object from the receivers set. This function may be used only in manual shadow controllers.

Parameters:
[in]objThe object to remove or add
[in]receivetrue if the object is to be added, false otherways
void VR3ShadowController::SetAlgorithmParam ( int  id,
GLint  filtersize = VR3SDOW_DEF_FILTERSIZE,
GLfloat  intensity = VR3SDOW_DEF_INTENSITY,
GLfloat  minvariance = VR3SDOW_DEF_MINVARIANCE,
GLfloat  bleedred = VR3SDOW_DEF_BLEEDREDUCTION,
GLfloat  depthscale = VR3SDOW_DEF_DEPTHSCALE 
)

Sets some shadow source parameters (algorithm parameters)

This function may be used after shadow source initialization to change the values of some shadow source parameters, it is used to change the properties of the EVSM algorithm for the specified source. An error arises if the shadow source has not been initialized yet.

Parameters:
[in]idThe shadow source id
[in]filtersize,intensity,minvariance,bleedred,depthscaleEVSM algorithm parameters
void VR3ShadowController::SetFrustumParam ( int  id,
GLfloat  srcposX,
GLfloat  srcposY,
GLfloat  srcposZ,
GLfloat  srcupX,
GLfloat  srcupY,
GLfloat  srcupZ,
GLfloat  srctargetX,
GLfloat  srctargetY,
GLfloat  srctargetZ,
GLfloat  fovy,
GLfloat  aspect,
GLfloat  znear,
GLfloat  zfar 
)

Sets some shadow source parameters (frustum parameters)

This function may be used after shadow source initialization to change the values of some shadow source parameters, it is used to change the shape and position of the shadow volume where shadow projection takes place. An error arises if the shadow source has not been initialized yet.

Parameters:
[in]idThe source id to initialize
[in]srcposX,srcposY,srcposZPosition of the shadow source
[in]srcupX,srcupY,srcupZUp vector of the shadow source viewport
[in]srctargetX,srctargetY,srctargetZCentral point in the shadow source viewport
[in]fovyField of view in the y direction
[in]aspectAspect ratio of the shadow view port
[in]znearNear clipping distance
[in]zfarFar clipping distance
void VR3ShadowController::SetMapParam ( int  id,
GLsizei  width,
GLsizei  height 
)

Sets some shadow source parameters (map image parameters)

This function may be used after shadow source initialization to change the values of some shadow source parameters, it is used to change the properties of the produced shadow map texture image. An error arises if the shadow source has not been initialized yet.

Parameters:
[in]idThe shadow source id
[in]widthWidth of the shadow map (in pixels)
[in]heightHeight of the shadow map (in pixels)
bool VR3ShadowController::SourceVisibilityTest ( const ShadowSource src ) [private]

Checks if a source shadow projection volume is visible.

During shadow map rendering, a source visibility test is carried out to understand if the map effectively needs to be drawn. The test will always succeed if shadow source culling is disabled in the controller and the map will always be drawn. We use a low cost test similar to the mesh bounding box text performed when view frustum culling is enabled. In some cases, even if the shadow source's shadows are not visible, the shadow map will be drawn. This happens because our low-cost test is not a full test and may (rarely) fail to recognise a cullable source.

Parameters:
[in]srcPointer to the shadow source to test
Returns:
false is the source is to be culled, true if it weren't possible to determine if the source's shadows are effectively visible.

Friends And Related Function Documentation

friend class VR3Obj [friend]

Friend class VR3Obj to access the private AutoCastShadows() and AutoReceiveShadows() methods.

Definition at line 234 of file VR3ShadowController.h.

friend class VR3Scene [friend]

Friend class VR3Scene to access the DrawShadowMaps() method.

Definition at line 232 of file VR3ShadowController.h.


Member Data Documentation

Shadow map blur shader programs (horizontal - vertical)

Definition at line 369 of file VR3ShadowController.h.

const GLint* VR3ShadowController::m_blur_unilocs[2] [private]

Pointer to the uniform location arrays defined for the programs (horizontal - vertical)

Definition at line 371 of file VR3ShadowController.h.

std::unordered_set<VR3Obj*> VR3ShadowController::m_casters [private]

list of shadow caster objects

In the caster set, we don't need access efficiency because each time the shadow maps are drawn all elements will be accessed (O(n)). We use again a very efficient structure because fast random access may be needed if user's operations depend on the objects being a casters. Fast access is not needed when considering only VR3Lib's operations.

Definition at line 360 of file VR3ShadowController.h.

const GLfloat* VR3ShadowController::m_cursrcprojmat [private]

Shadow mapping shader parameter.

When using the shaders to draw the shadow maps, the projection matrix of the current source may be used while rendering the objects in order to obtain view frustum culling while rendering the shadow maps. This pointer will be used to point to the correct matrix.

Definition at line 395 of file VR3ShadowController.h.

const GLfloat* VR3ShadowController::m_cursrcviewmat [private]

Shadow mapping shader parameter.

When using the shaders to draw the shadow maps, the viewmatrix of the current source must be used while rendering the objects in order to compute the modelview matrix before entering the vertex shader. This pointer will be used to point to the correct matrix.

Definition at line 387 of file VR3ShadowController.h.

Backface culling enabled flag.

Backface culling is directly supported by the GL.

Definition at line 406 of file VR3ShadowController.h.

Number of meshes drawn in the shadow map.

This counter is returned to 0 every time a new shadow map is being drawn and is incremented each time a mesh is effectively rendered inside the shadow map (after the eventual shadow view frustum check).

Definition at line 402 of file VR3ShadowController.h.

Shadow controller mode.

Currently, only two modes are supported:

Definition at line 243 of file VR3ShadowController.h.

std::unordered_set<VR3Obj*> VR3ShadowController::m_receivers [private]

Set of shadow receiver objects (O(1) access time)

Each object must check if it belongs to the set during rendering, this is needed to enable shadow mapping in the rendering shader and pass the required uniforms parameters.

Definition at line 350 of file VR3ShadowController.h.

Shadow map rendering shader program.

Definition at line 364 of file VR3ShadowController.h.

Pointer to the uniform location array defined for the program.

Definition at line 366 of file VR3ShadowController.h.

Rendeirng shader parameters values.

Definition at line 379 of file VR3ShadowController.h.

Shadow source culling enabled flag.

Definition at line 410 of file VR3ShadowController.h.

ShadowSource VR3ShadowController::m_sources[VR3SDOW_NUM_SOURCES] [private]

Array of shadow sources (active or not)

Definition at line 343 of file VR3ShadowController.h.

GLuint VR3ShadowController::m_VAO [private]

VAO associated with the plane used when filtering.

Definition at line 374 of file VR3ShadowController.h.

GLuint VR3ShadowController::m_VBO [private]

Mesh VBO associated with the above VAO (vertex positions)

Definition at line 376 of file VR3ShadowController.h.

View frustum culling enabled flag.

Definition at line 408 of file VR3ShadowController.h.

Pointer to the currently active VR3ShadowController object.

Definition at line 246 of file VR3ShadowController.h.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Friends Defines