#include <spDeferredRenderer.hpp>
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 GBuffer * | getGBuffer () const |
Returns a constant pointer to the g-buffer. This will never return a null pointer. | |
GBuffer * | getGBuffer () |
Returns a pointer to the g-buffer. This will never return a null pointer. | |
const ShadowMapper * | getShadowMapper () const |
Returns a constant pointer to the shadow mapper. This will never return a null pointer. | |
ShadowMapper * | getShadowMapper () |
Returns a pointer to the shadow mapper. This will never return a null pointer. | |
const BloomEffect * | getBloomEffect () const |
Returns a constant pointer to the bloom effect. This will never return a null pointer. | |
BloomEffect * | getBloomEffect () |
Returns a pointer to the bloom effect. This will never return a null pointer. | |
ShaderClass * | getGBufferShader () const |
Returns the g-buffer shader class. This shader is used to render the scene into the g-buffer. | |
ShaderClass * | getDeferredShader () const |
Returns the deferred shader class. This shader is used to render the g-buffer into the pixel buffer with deferred lighting. | |
const VertexFormatUniversal * | getVertexFormat () const |
Returns the vertex format which must be used for the objects which should be rendered with this deferred renderer. | |
const STextureLayerModel & | getTextureLayerModel () 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_ |
ShaderClass * | GBufferShader_ |
G-Buffer rendering shader class. | |
ShaderClass * | DeferredShader_ |
Deferred lighting shader class. | |
ShaderClass * | ShadowShader_ |
Shadow map rendering shader class. | |
VertexFormatUniversal | VertexFormat_ |
Object vertex format. | |
VertexFormatUniversal | ImageVertexFormat_ |
2D image vertex format. | |
s32 | Flags_ |
STextureLayerModel | LayerModel_ |
SLightDesc | LightDesc_ |
std::vector< SLight > | Lights_ |
std::vector< SLightEx > | LightsEx_ |
dim::vector3df | AmbientColor_ |
SDebugVPL | DebugVPL_ |
Debug virtual-point-light data. |
Integrated deferred-renderer which supports normal- and parallax-occlision mapping.
sp::video::DeferredRenderer::DeferredRenderer | ( | ) |
virtual sp::video::DeferredRenderer::~DeferredRenderer | ( | ) | [virtual] |
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.
[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. |
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.
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.
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.
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. |
virtual void sp::video::DeferredRenderer::renderSceneIntoGBuffer | ( | scene::SceneGraph * | Graph, | |
scene::Camera * | ActiveCamera, | |||
bool | UseDefaultGBufferShader | |||
) | [protected, virtual] |
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).
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] |
BloomEffect sp::video::DeferredRenderer::BloomEffect_ [protected] |
SDebugVPL sp::video::DeferredRenderer::DebugVPL_ [protected] |
Debug virtual-point-light data.
ShaderClass* sp::video::DeferredRenderer::DeferredShader_ [protected] |
Deferred lighting shader class.
s32 sp::video::DeferredRenderer::Flags_ [protected] |
GBuffer sp::video::DeferredRenderer::GBuffer_ [protected] |
ShaderClass* sp::video::DeferredRenderer::GBufferShader_ [protected] |
G-Buffer rendering shader class.
2D image vertex format.
SLightDesc sp::video::DeferredRenderer::LightDesc_ [protected] |
std::vector<SLight> sp::video::DeferredRenderer::Lights_ [protected] |
std::vector<SLightEx> sp::video::DeferredRenderer::LightsEx_ [protected] |
ShaderClass* sp::video::DeferredRenderer::ShadowShader_ [protected] |
Shadow map rendering shader class.
struct SP_EXPORT sp::video::DeferredRenderer::SLightEx
sp::video::DeferredRenderer::SP_PACK_STRUCT [protected] |
struct SP_EXPORT sp::video::DeferredRenderer::SLight
sp::video::DeferredRenderer::SP_PACK_STRUCT [protected] |
Object vertex format.