Public Member Functions

IRTShaderParameterBinding Class Reference

Search for all occurrences

Detailed Description

Interface for setting parameters in a compiled effect file.

A IRTShaderNode would implement this new interface to allow setting of parameters to the underlying graphics subsystem. When a shade tree is created a Microsoft Effect file is generated that contains all the parameters exposed during compiling of the tree. At runtime the subsystem needs to set values to these parameters. At this level it knows nothing about the underlying material structure, and simply has a bunch parameter names and data types. To aid this, at render time the hardware renderer will query the host for the IRTShaderParameterBinding interface, and will call BindParameter to have the data assigned to the effect frame work. The "value" passed to the method is the correct size for the underlying data type, so the BindParameter method must understand the data request. In general this would either be a float, or a D3DXVECTOR (or D3DCOLORVALUE) type for colors. This value is assigned directly to the effect framework. An example of setting a value can be seen below - taken from the Architectural and Design Material

if(_tcscmp(paramName,_M("mia_material_1_diffuse"))==0)
{
    AColor val;
    val = m_mainPB->GetAColor(kPar_Diffuse, t);
    *(D3DCOLORVALUE*)value = GetD3DColor(val);
}

This checks the name of the parameter, accesses the correct data item from the paramblock, and sets the value correctly.

#include <IRTShaderParameterBinding.h>

Inheritance diagram for IRTShaderParameterBinding:
Inheritance graph
[legend]

List of all members.

Public Member Functions

virtual Interface_ID  GetID ()
virtual void  BindParameter (const MCHAR *paramName, LPVOID value)=0
  Assign the correct value based on the name parsed from the effect file.
virtual void  BindParameter (const TimeValue t, const MCHAR *paramName, LPVOID value)=0
  Assign the correct value based on the name parsed from the effect file.
virtual void  InitializeBinding ()=0
  Called once before the parameter list is parsed.

Member Function Documentation

virtual Interface_ID GetID ( ) [inline, virtual]
Remarks:
This method returns the unique interface ID.

Reimplemented from BaseInterface.

{ return IRTSHADERPARAMETERBINDING_INTERFACE_ID; }
virtual void BindParameter ( const MCHAR *  paramName,
LPVOID  value 
) [pure virtual]

Assign the correct value based on the name parsed from the effect file.

This method will be called for every parameter parsed from the effect file that the renderer doesn't understand

Parameters:
[in] paramName The name of the parameter as parsed from the effect file
[out] The pointer to a data structure that will receive the value to set
virtual void BindParameter ( const TimeValue  t,
const MCHAR *  paramName,
LPVOID  value 
) [pure virtual]

Assign the correct value based on the name parsed from the effect file.

This method will be called for every parameter parsed from the effect file that the renderer doesn't understand

Parameters:
[in] t Current time value
[in] paramName The name of the parameter as parsed from the effect file
[out] The pointer to a data structure that will receive the value to set
virtual void InitializeBinding ( ) [pure virtual]

Called once before the parameter list is parsed.

Allows for one time setup of data. This could be used to make sure all parameters are valid before being queried


IRTShaderParameterBinding IRTShaderParameterBinding IRTShaderParameterBinding IRTShaderParameterBinding IRTShaderParameterBinding IRTShaderParameterBinding IRTShaderParameterBinding IRTShaderParameterBinding IRTShaderParameterBinding IRTShaderParameterBinding
IRTShaderParameterBinding IRTShaderParameterBinding IRTShaderParameterBinding IRTShaderParameterBinding IRTShaderParameterBinding IRTShaderParameterBinding IRTShaderParameterBinding IRTShaderParameterBinding IRTShaderParameterBinding IRTShaderParameterBinding