ShaderData

consoledoc.h

Special type of data block that stores information about a handwritten shader.

More...

Public Attributes

string

String of case-sensitive defines passed to the shader compiler.

filename

Path to the DirectX pixel shader file to use for this ShaderData.

filename

Path to the DirectX vertex shader file to use for this ShaderData.

filename

Path to an OpenGL pixel shader file to use for this ShaderData.

filename

Path to an OpenGL vertex shader file to use for this ShaderData.

float

Indicates target level the shader should be compiled.

bool
string

Indicates names of samplers present in shader. Order is important.

bool

If true, the maximum pixel shader version offered by the graphics card will be used.

Public Functions

void

Rebuilds all the vertex and pixel shader instances created from this ShaderData.

Detailed Description

Special type of data block that stores information about a handwritten shader.

To use hand written shaders, a ShaderData datablock must be used. This datablock refers only to the vertex and pixel shader filenames and a hardware target level. Shaders are API specific, so DirectX and OpenGL shaders must be explicitly identified.

// Used for the procedural clould system
singleton ShaderData( CloudLayerShader )
{
   DXVertexShaderFile   = $Core::CommonShaderPath @ "/cloudLayerV.hlsl";
   DXPixelShaderFile    = $Core::CommonShaderPath @ "/cloudLayerP.hlsl";
   OGLVertexShaderFile = $Core::CommonShaderPath @ "/gl/cloudLayerV.glsl";
   OGLPixelShaderFile = $Core::CommonShaderPath @ "/gl/cloudLayerP.glsl";
   pixVersion = 2.0;
};

Public Attributes

string defines 

String of case-sensitive defines passed to the shader compiler.

The string should be delimited by a semicolon, tab, or newline character.

singleton ShaderData( FlashShader )
{
DXVertexShaderFile   = $shaderGen::cachePath @ "/postFx/flashV.hlsl";
DXPixelShaderFile    = $shaderGen::cachePath @ "/postFx/flashP.hlsl";

 //Define setting the color of WHITE_COLOR.
defines = "WHITE_COLOR=float4(1.0,1.0,1.0,0.0)";

pixVersion = 2.0
}

filename DXPixelShaderFile 

Path to the DirectX pixel shader file to use for this ShaderData.

It must contain only one program and no vertex shader, just the pixel shader. It can be either an HLSL or assembly level shader. HLSL's must have a filename extension of .hlsl, otherwise its assumed to be an assembly file.

filename DXVertexShaderFile 

Path to the DirectX vertex shader file to use for this ShaderData.

It must contain only one program and no pixel shader, just the vertex shader.It can be either an HLSL or assembly level shader. HLSL's must have a filename extension of .hlsl, otherwise its assumed to be an assembly file.

filename OGLPixelShaderFile 

Path to an OpenGL pixel shader file to use for this ShaderData.

It must contain only one program and no vertex shader, just the pixel shader.

filename OGLVertexShaderFile 

Path to an OpenGL vertex shader file to use for this ShaderData.

It must contain only one program and no pixel shader, just the vertex shader.

float pixVersion 

Indicates target level the shader should be compiled.

Valid numbers at the time of this writing are 1.1, 1.4, 2.0, and 3.0. The shader will not run properly if the hardware does not support the level of shader compiled.

bool rtParams [8]
string samplerNames [8]

Indicates names of samplers present in shader. Order is important.

Order of sampler names are used to assert correct sampler register/locationOther objects (GFXStateBlockData, PostEffect...) use index number to link samplers.

bool useDevicePixVersion 

If true, the maximum pixel shader version offered by the graphics card will be used.

Otherwise, the script-defined pixel shader version will be used.

Public Functions

reload()

Rebuilds all the vertex and pixel shader instances created from this ShaderData.

// Rebuild the shader instances from ShaderData CloudLayerShader
CloudLayerShader.reload();