Contents User Forum Source Index APIs by Task APIs by Level Data


G3D::SuperShader Class Reference

A one-size-fits-all shader that combines most common illumination effects efficiently. More...

#include <SuperShader.h>

List of all members.

Static Public Member Functions

static void configureShaderArgs (const LightingRef &lighting, const Material &material, VertexAndPixelShader::ArgList &args)
static void configureShaderExtraLightArgs (const Array< GLight > &lightArray, int lightIndex, VertexAndPixelShader::ArgList &args)
static void configureShadowShaderArgs (const GLight &light, const Matrix4 &lightMVP, const Texture::Ref &shadowMap, const Material &material, VertexAndPixelShader::ArgList &args)
static void createShaders (const Material &material, ShaderRef &nonShadowedShader, ShaderRef &shadowMappedShader)

Classes

class  Cache
class  Component
 Material property coefficients are specified as a constant color times a texture map. More...
class  Material
 Describes the properties of a material to be used with SuperShader. More...


Detailed Description

A one-size-fits-all shader that combines most common illumination effects efficiently.

To use SuperShader you will need the four files in the current directory at runtime:

  • ShadowMappedLightPass.vrt
  • ShadowMappedLightPass.pix
  • NonShadowedPass.vrt
  • NonShadowedPass.pix

    these are located in the data/SuperShader directory of the G3D distribution.

    Example of using with a PosedModel:

         members:
        SuperShader::Material material;
        ShaderRef nonshadowShader;
        ShaderRef shadowShader;

         in constructor:
        ... set fields of material ...
        SuperShader::createShaders(material, nonshadowShader, shadowShader);

         in onGraphics:

        rd->pushState();
            SuperShader::configureShaderArgs(localLighting, material, shader->args);
            rd->setShader(shader);
            rd->setObjectToWorldMatrix(posed->coordinateFrame());
            rd->setShadeMode(RenderDevice::SHADE_SMOOTH);
            posed->sendGeometry(rd);
        rd->popState();
     

    Referenced Code:
    McGuire, The SuperShader. Chapter 8.1, 485--498, in ShaderX4, W. Engel ed., 2005.


Member Function Documentation

static void G3D::SuperShader::configureShaderArgs ( const LightingRef lighting,
const Material material,
VertexAndPixelShader::ArgList args 
) [static]

Configures the material arguments on a SuperShader NonShadowed shader for the opaque pass with 0, 1, or 2 lights.

static void G3D::SuperShader::configureShaderExtraLightArgs ( const Array< GLight > &  lightArray,
int  lightIndex,
VertexAndPixelShader::ArgList args 
) [static]

Configures a SuperShader NonShadowed shader for an additive light pass using lights lightArray[lightIndex] and lightArray[lightIndex+1] (if both are in bounds.

)

static void G3D::SuperShader::configureShadowShaderArgs ( const GLight light,
const Matrix4 lightMVP,
const Texture::Ref shadowMap,
const Material material,
VertexAndPixelShader::ArgList args 
) [static]

static void G3D::SuperShader::createShaders ( const Material material,
ShaderRef nonShadowedShader,
ShaderRef shadowMappedShader 
) [static]


The documentation for this class was generated from the following file:
Generated on Thu Aug 2 11:40:47 2007 for G3D by doxygen 1.5.2
Hosted by SourceForge.net Logo