Classes | Public Member Functions | Protected Member Functions | Protected Attributes

sp::video::DeferredRenderer Class Reference

#include <spDeferredRenderer.hpp>

List of all members.

Classes

struct  SDebugVPL
struct  SLight
struct  SLightDesc
struct  SLightEx

Public Member Functions

 DeferredRenderer ()
virtual ~DeferredRenderer ()
virtual bool generateResources (s32 Flags, s32 ShadowTexSize, u32 MaxPointLightCount, u32 MaxSpotLightCount, s32 MultiSampling=0)
virtual void renderScene (scene::SceneGraph *Graph, scene::Camera *ActiveCamera=0, Texture *RenderTarget=0, bool UseDefaultGBufferShader=true)
bool generateResources (s32 Flags=0)
const GBuffergetGBuffer () const
 Returns a constant pointer to the g-buffer. This will never return a null pointer.
GBuffergetGBuffer ()
 Returns a pointer to the g-buffer. This will never return a null pointer.
const ShadowMappergetShadowMapper () const
 Returns a constant pointer to the shadow mapper. This will never return a null pointer.
ShadowMappergetShadowMapper ()
 Returns a pointer to the shadow mapper. This will never return a null pointer.
const BloomEffectgetBloomEffect () const
 Returns a constant pointer to the bloom effect. This will never return a null pointer.
BloomEffectgetBloomEffect ()
 Returns a pointer to the bloom effect. This will never return a null pointer.
ShaderClassgetGBufferShader () const
 Returns the g-buffer shader class. This shader is used to render the scene into the g-buffer.
ShaderClassgetDeferredShader () const
 Returns the deferred shader class. This shader is used to render the g-buffer into the pixel buffer with deferred lighting.
const VertexFormatUniversalgetVertexFormat () const
 Returns the vertex format which must be used for the objects which should be rendered with this deferred renderer.
const STextureLayerModelgetTextureLayerModel () const
void setAmbientColor (const dim::vector3df &ColorVec)
dim::vector3df getAmbientColor () const
 Returns the ambient color for the deferred shading. By default (0.1, 0.1, 0.1).
void setDebugVPL (bool Enable)
bool getDebugVPL () const

Protected Member Functions

virtual void updateLightSources (scene::SceneGraph *Graph, scene::Camera *ActiveCamera)
virtual void renderSceneIntoGBuffer (scene::SceneGraph *Graph, scene::Camera *ActiveCamera, bool UseDefaultGBufferShader)
virtual void renderDeferredShading (Texture *RenderTarget)
void renderDebugVirtualPointLights (scene::Camera *ActiveCamera)
bool buildShader (const io::stringc &Name, ShaderClass *&ShdClass, VertexFormat *VertFmt, const std::list< io::stringc > *ShdBufferVertex, const std::list< io::stringc > *ShdBufferPixel, const io::stringc &VertexMain="VertexMain", const io::stringc &PixelMain="PixelMain", s32 Flags=SHADERBUILD_CG)
void deleteShaders ()
void createVertexFormats ()
void setupCompilerOptions (std::list< io::stringc > &GBufferCompilerOp, std::list< io::stringc > &DeferredCompilerOp)
void setupGBufferSampler (Shader *ShaderObj)
void setupDeferredSampler (Shader *ShaderObj)
void setupDebugVPLSampler (Shader *ShaderObj)
void setupLightShaderConstants ()
void setupJitteredOffsets ()
void setupVPLOffsets (Shader *ShaderObj, const io::stringc &BufferName, u32 OffsetCount, s32 Rings=5, s32 Rotations=5)

Protected Attributes

struct SP_EXPORT
sp::video::DeferredRenderer::SLight 
SP_PACK_STRUCT
struct SP_EXPORT
sp::video::DeferredRenderer::SLightEx 
SP_PACK_STRUCT
GBuffer GBuffer_
ShadowMapper ShadowMapper_
BloomEffect BloomEffect_
ShaderClassGBufferShader_
 G-Buffer rendering shader class.
ShaderClassDeferredShader_
 Deferred lighting shader class.
ShaderClassShadowShader_
 Shadow map rendering shader class.
VertexFormatUniversal VertexFormat_
 Object vertex format.
VertexFormatUniversal ImageVertexFormat_
 2D image vertex format.
s32 Flags_
STextureLayerModel LayerModel_
SLightDesc LightDesc_
std::vector< SLightLights_
std::vector< SLightExLightsEx_
dim::vector3df AmbientColor_
SDebugVPL DebugVPL_
 Debug virtual-point-light data.

Detailed Description

Integrated deferred-renderer which supports normal- and parallax-occlision mapping.

Since:
Version 3.2

Constructor & Destructor Documentation

sp::video::DeferredRenderer::DeferredRenderer (  ) 
virtual sp::video::DeferredRenderer::~DeferredRenderer (  )  [virtual]

Member Function Documentation

bool sp::video::DeferredRenderer::buildShader ( const io::stringc Name,
ShaderClass *&  ShdClass,
VertexFormat VertFmt,
const std::list< io::stringc > *  ShdBufferVertex,
const std::list< io::stringc > *  ShdBufferPixel,
const io::stringc VertexMain = "VertexMain",
const io::stringc PixelMain = "PixelMain",
s32  Flags = SHADERBUILD_CG 
) [protected]
void sp::video::DeferredRenderer::createVertexFormats (  )  [protected]
void sp::video::DeferredRenderer::deleteShaders (  )  [protected]
virtual bool sp::video::DeferredRenderer::generateResources ( s32  Flags,
s32  ShadowTexSize,
u32  MaxPointLightCount,
u32  MaxSpotLightCount,
s32  MultiSampling = 0 
) [virtual]

Generates the deferred rendering shaders and builds the g-buffer.

Parameters:
[in] Flags Specifies the shader generation flags.
[in] ShadowTexSize Specifies the texture size for shadow maps. By default 256.
[in] MaxPointLightCount Specifies the maximal count of point lights used for shadow maps. By default 8.
[in] MaxSpotLightCount Specifies the maximal count of spot lights used for shadow maps. By default 8.
[in] MultiSampling Specifies the count of multi-samples. By default 0.
Returns:
True on success otherwise false.
Note:
The last three parameters have no effect if shadow mapping is disabled (DEFERREDFLAG_SHADOW_MAPPING).
See also:
EDeferredRenderFlags
bool sp::video::DeferredRenderer::generateResources ( s32  Flags = 0  )  [inline]

Generates the deferred rendering shaders and builds the g-buffer. This is just an overloaded version of the function with less parameters. The default settings are:

        generateResources(Flags, 256, 8, 8);
dim::vector3df sp::video::DeferredRenderer::getAmbientColor (  )  const [inline]

Returns the ambient color for the deferred shading. By default (0.1, 0.1, 0.1).

BloomEffect* sp::video::DeferredRenderer::getBloomEffect (  )  [inline]

Returns a pointer to the bloom effect. This will never return a null pointer.

const BloomEffect* sp::video::DeferredRenderer::getBloomEffect (  )  const [inline]

Returns a constant pointer to the bloom effect. This will never return a null pointer.

bool sp::video::DeferredRenderer::getDebugVPL (  )  const [inline]

Returns ture if virtual-point-light (VPL) debugging is enabled.

See also:
setDebugVPL
ShaderClass* sp::video::DeferredRenderer::getDeferredShader (  )  const [inline]

Returns the deferred shader class. This shader is used to render the g-buffer into the pixel buffer with deferred lighting.

const GBuffer* sp::video::DeferredRenderer::getGBuffer (  )  const [inline]

Returns a constant pointer to the g-buffer. This will never return a null pointer.

GBuffer* sp::video::DeferredRenderer::getGBuffer (  )  [inline]

Returns a pointer to the g-buffer. This will never return a null pointer.

ShaderClass* sp::video::DeferredRenderer::getGBufferShader (  )  const [inline]

Returns the g-buffer shader class. This shader is used to render the scene into the g-buffer.

const ShadowMapper* sp::video::DeferredRenderer::getShadowMapper (  )  const [inline]

Returns a constant pointer to the shadow mapper. This will never return a null pointer.

ShadowMapper* sp::video::DeferredRenderer::getShadowMapper (  )  [inline]

Returns a pointer to the shadow mapper. This will never return a null pointer.

const STextureLayerModel& sp::video::DeferredRenderer::getTextureLayerModel (  )  const [inline]

Returns the texture layer model. Use this to determine how the texture layers are constructed. These texture layers are used for the g-buffer.

See also:
STextureLayerModel
const VertexFormatUniversal* sp::video::DeferredRenderer::getVertexFormat (  )  const [inline]

Returns the vertex format which must be used for the objects which should be rendered with this deferred renderer.

void sp::video::DeferredRenderer::renderDebugVirtualPointLights ( scene::Camera ActiveCamera  )  [protected]
virtual void sp::video::DeferredRenderer::renderDeferredShading ( Texture RenderTarget  )  [protected, virtual]
virtual void sp::video::DeferredRenderer::renderScene ( scene::SceneGraph Graph,
scene::Camera ActiveCamera = 0,
Texture RenderTarget = 0,
bool  UseDefaultGBufferShader = true 
) [virtual]

Renders the whole given scene with deferred shading onto the screen or into the render target if specified.

Parameters:
Graph,: Specifies the scene graph which is to be rendered.
ActiveCamera,: Specifies the active camera for which the scene is to be rendered. This can also be 0 to render the scene for all cameras with their individual viewports.
RenderTarget,: Specifies a render target texture where the whole scene will be rendered in. When this parameter is 0 the result will be rendered directly onto the screen. This texture must be a valid render target otherwise nothing will be rendered.
UseDefaultGBufferShader,: Specifies whether the default g-buffer shader is to be used or not. If false each rendered object must have a valid shader class which renders into the g-buffer textures.
Note:
First of all a valid g-buffer- and deferred shader must be set.
See also:
Texture::setRenderTarget
setGBufferShader
setDeferredShader
virtual void sp::video::DeferredRenderer::renderSceneIntoGBuffer ( scene::SceneGraph Graph,
scene::Camera ActiveCamera,
bool  UseDefaultGBufferShader 
) [protected, virtual]
Warning:
Does not check for null pointers!
void sp::video::DeferredRenderer::setAmbientColor ( const dim::vector3df ColorVec  )  [inline]

Sets the ambient color for the deferred shading. This is a 3-component vector whose values are used to be in the range [0.0 .. 1.0]. The default value is (0.1, 0.1, 0.1).

void sp::video::DeferredRenderer::setDebugVPL ( bool  Enable  )  [inline]

Enables or disables virtual-point-light (VPL) debugging. By default enabled. This requires that the deferred-renderer resources have been generated with the debug VPL flag (DEFERREDFLAG_DEBUG_VIRTUALPOINTLIGHTS).

See also:
EDeferredRenderFlags
void sp::video::DeferredRenderer::setupCompilerOptions ( std::list< io::stringc > &  GBufferCompilerOp,
std::list< io::stringc > &  DeferredCompilerOp 
) [protected]
void sp::video::DeferredRenderer::setupDebugVPLSampler ( Shader ShaderObj  )  [protected]
void sp::video::DeferredRenderer::setupDeferredSampler ( Shader ShaderObj  )  [protected]
void sp::video::DeferredRenderer::setupGBufferSampler ( Shader ShaderObj  )  [protected]
void sp::video::DeferredRenderer::setupJitteredOffsets (  )  [protected]
void sp::video::DeferredRenderer::setupLightShaderConstants (  )  [protected]
void sp::video::DeferredRenderer::setupVPLOffsets ( Shader ShaderObj,
const io::stringc BufferName,
u32  OffsetCount,
s32  Rings = 5,
s32  Rotations = 5 
) [protected]
virtual void sp::video::DeferredRenderer::updateLightSources ( scene::SceneGraph Graph,
scene::Camera ActiveCamera 
) [protected, virtual]
Warning:
Does not check for null pointers!

Member Data Documentation

Debug virtual-point-light data.

Deferred lighting shader class.

G-Buffer rendering shader class.

2D image vertex format.

std::vector<SLight> sp::video::DeferredRenderer::Lights_ [protected]

Shadow map rendering shader class.

Object vertex format.


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