Public Types | Public Member Functions

sp::video::GBuffer Class Reference

#include <spGBuffer.hpp>

List of all members.

Public Types

enum  ERenderTargets { RENDERTARGET_DIFFUSE_AND_SPECULAR = 0, RENDERTARGET_NORMAL_AND_DEPTH, RENDERTARGET_ILLUMINATION, RENDERTARGET_COUNT }
 

GBuffer render target names.

More...

Public Member Functions

 GBuffer ()
virtual ~GBuffer ()
bool createGBuffer (const dim::size2di &Resolution, s32 MultiSampling=0, bool UseIllumination=false)
void deleteGBuffer ()
 Deletes the GBuffer textures. When creating a new GBuffer the old textures will be deleted automatically.
void bindRenderTargets ()
void drawDeferredShading ()
const dim::size2digetResolution () const
 Returns the resolution set after creating the GBuffer textures.
TexturegetTexture (const ERenderTargets Type)
bool useIllumination () const

Detailed Description

A geometry buffer (G-Buffer) contains all textures which are required for a deferred renderer. It conatins at least the diffuse- and normal map. It contains optionally an illumination map when pre-computed, static light-maps are used in combination with dynamic light sources. Specular information is stored in the alpha-channel of the diffuse map, that's because transparency can anyway not be used within a deferred renderer.

Since:
Version 3.2

Member Enumeration Documentation

GBuffer render target names.

Enumerator:
RENDERTARGET_DIFFUSE_AND_SPECULAR 

Diffuse (RGB) and specular (A).

RENDERTARGET_NORMAL_AND_DEPTH 

Normal vectors (RGB) and depth distance (A).

RENDERTARGET_ILLUMINATION 

Illumination (R) from light maps.

RENDERTARGET_COUNT 

Internal count constant. Don't use it to access a texture!


Constructor & Destructor Documentation

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

Member Function Documentation

void sp::video::GBuffer::bindRenderTargets (  ) 

Binds the g-buffer's render targets. The following pixel shader pseudo code illustrates that:

        struct SPixelOutput
        {
            float4 DiffuseAndSpecular : COLOR0;
            float4 NormalAndDepth     : COLOR1;
        };
        
        // ...
        
        Out.DiffuseAndSpecular.rgb  = FinalPixelColor;
        Out.DiffuseAndSpecular.a    = FinalPixelSpecularFactor;
        
        Out.NormalAndDepth.xyz      = FinalPixelNormal;
        Out.NormalAndDepth.a        = distance(GlobalViewPosition, GlobalPixelPosition);
bool sp::video::GBuffer::createGBuffer ( const dim::size2di Resolution,
s32  MultiSampling = 0,
bool  UseIllumination = false 
)

Creates the GBuffer textures.

Parameters:
[in] Resolution Specifies the resolution. This should be the same as specified for the engine's graphics device.
[in] MultiSampling Specifies the count of multi-samples. By default 0.
[in] UseIllumination Specifies whether illumination should be used or not. This is used to combine dynamic lights with pre-computed static light-maps. By default false.
Returns:
True if the g-buffer could be created successful.
void sp::video::GBuffer::deleteGBuffer (  ) 

Deletes the GBuffer textures. When creating a new GBuffer the old textures will be deleted automatically.

void sp::video::GBuffer::drawDeferredShading (  ) 
const dim::size2di& sp::video::GBuffer::getResolution (  )  const [inline]

Returns the resolution set after creating the GBuffer textures.

Texture* sp::video::GBuffer::getTexture ( const ERenderTargets  Type  )  [inline]

Returns the specified GBuffer texture.

Parameters:
Type,: Specifies the texture name which is to be returned. This must not be RENDERTARGET_COUNT!
Returns:
Pointer to the specified Texture object.
bool sp::video::GBuffer::useIllumination (  )  const [inline]

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