Public Types | Public Member Functions

sp::video::GBuffer Class Reference

#include <spGBuffer.hpp>

List of all members.

Public Types


GBuffer render target names.


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.

Version 3.2

Member Enumeration Documentation

GBuffer render target names.


Diffuse (RGB) and specular (A).


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


Illumination (R) from light maps.


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;
             = 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.

[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.
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.

Type,: Specifies the texture name which is to be returned. This must not be RENDERTARGET_COUNT!
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