FBShader Class Reference


Detailed Description

Shader class.

Inheritance diagram for FBShader:
Inheritance graph
[legend]

List of all members.

Public Member Functions

  ShaderPassTypeBegin (FBRenderOptions pRenderOptions, FBRenderingPass pPass)
  For all the shader instances of the same type, to setup the common state for all this type of shaders.
  ShaderPassTypeEnd (FBRenderOptions pRenderOptions, FBRenderingPass pPass)
  For all the shader instances of the same type, to clean the common state for all this type of shaders.
  ShaderPassInstanceBegin (FBRenderOptions pRenderOptions, FBRenderingPass pPass)
  For all the models associated with this shader instance, to setup the common state for this shader instance.
  ShaderPassInstanceEnd (FBRenderOptions pRenderOptions, FBRenderingPass pPass)
  For all the models associated with this shader instance, to clean the common state for this shader instance.
  ShaderPassMaterialBegin (FBRenderOptions pRenderOptions, FBRenderingPass pPass, HFBShaderModelInfo pInfo)
  For all the models mapped with this material and associated with this shader instance, to setup the common material state for this shader instance.
  ShaderPassMaterialEnd (FBRenderOptions pRenderOptions, FBRenderingPass pPass, HFBShaderModelInfo pInfo)
  For all the models mapped with this material and associated with this shader instance, to clean the common material state for this shader instance.
  ShaderPassGeometryBegin (FBRenderOptions pRenderOptions, FBRenderingPass pPass, HFBShaderModelInfo pInfo)
  For all the models instanced from the same geometry, to setup the common VBO state for this shader instance.
  ShaderPassGeometryEnd (FBRenderOptions pRenderOptions, FBRenderingPass pPass, HFBShaderModelInfo pInfo)
  For all the models instanced from the same geometry, to clean the common VBO state for this shader instance.
  ShaderPassModelsDraw (FBRenderOptions pRenderOptions, FBRenderingPass pPass, tuple pInfoArray)
  For all the models with the same material/geometry mappings, inside this functions, we only need to setup modelview matrix, and draw the meshes.
  ShaderPassModelDraw (FBRenderOptions pRenderOptions, FBRenderingPass pPass, HFBShaderModelInfo pInfo)
  Callback for Cg/CgFx shader to setup WorldMaitrx/WorldMatrixIT parameters.
  ShaderPassDrawShadowBegin (FBRenderOptions pRenderOptions)
  Shadow draw pass begin notify for shader with kFBShaderCapacityMaterialEffect and kFBShaderCapacityDrawShow.
  ShaderPassDrawShadowEnd (FBRenderOptions pRenderOptions)
  Shadow draw pass end notify for shader with kFBShaderCapacityMaterialEffect and kFBShaderCapacityDrawShow.
FBShaderPassActionCallback  GetShaderPassActionCallback ()
  Get Shader Pass Action Callback registration;.
  SetShaderPassActionCallback (FBShaderPassActionCallback pCallback)
  Set Shader Pass Action Callback registration;.
  __init__ (str pName, object pObject=None)
  Protected constructor.
  IObject_Declare (Implementation)
HFBShaderModelInfo  NewShaderModelInfo (HKModelRenderInfo pModelRenderInfo, int pSubRegionIndex)
  Create a new shader-model information object.
  UpdateModelShaderInfo (FBRenderOptions pOptions, HFBShaderModelInfo pInfo)
  Update shader-model information when model, material & texture mapping or shader setting change.
  DestroyShaderModelInfo (FBRenderOptions pOptions, HFBShaderModelInfo pInfo)
  Destroy shader-model information object callback.
  ReplaceAll (FBModel pModel)
  Replace all shader in pModel.
  Append (FBModel pModel)
  Append shader to pModel.
bool  ShaderNeedBeginRender ()
  Does the shader need a begin render call.
  ShaderBeginRender (FBRenderOptions pOptions, HFBShaderModelInfo pInfo)
  Pre-rendering of shaders that is called only one time for a shader instance.
  ShadeModel (FBRenderOptions pOptions, HFBShaderModelInfo pInfo, FBRenderingPass pPass)
  Real-time shading callback for shader without kFBShaderCapacityMaterialEffect.
  ShadeModelShadow (FBRenderOptions pRenderOptions, HFBShaderModelInfo pInfo)
  Draw custom shadow shape callback for shader with kFBShaderCapacityDrawShadow but without kFBShaderCapacityMaterialEffect.
  CloneShaderParameter (HFBShader pNewShader)
  Clone shader.
  DetachDisplayContext (FBRenderOptions pOptions, HFBShaderModelInfo pInfo)
  Detach the display context from the shader.
bool  FbxStore (FBFbxObject pFbxObject)
  Storage of information into the FBX file format.
bool  FbxRetrieve (FBFbxObject pFbxObject, HFBRenderer pRenderer)
  Retrieval of information into the FBX file format.
  InvalidateShaderVersion ()
  Invalidate Shader version to trigger model-shader informaton to be updated.
int  GetShaderVersion ()
  Return Shader Version.
FBShaderCapacity  GetShaderCapacity ()
  Return Shader Capacity (bitwise value).
bool  HasShaderCapacity (FBShaderCapacity pCapacity)
  Return true if shader has certain capacity.
  SetShaderCapacity (FBShaderCapacity pCapacity, bool pOn)
  Set Shader Capacity (bitwise value).
int  GetDrawInstancedMaximumSize ()
  Get shader maximum size for draw instanced.
  SetDrawInstancedMaximumSize (int pMaxSize)
  Set shader maximum size for draw instanced.
  UploadModelViewMatrixArrayForDrawInstanced (float pModelViewMatrixArray, int pCount)
  Callback for uploading the modelview array when draw instanced.

Public Attributes

str  ShaderDescription
  Description.
FBPropertyBase  Enable
  Read Write Property: Is the shader Enabled.
FBPropertyRenderingPass  RenderingPass
  Read Write Property: Rendering pass object are shaded in.

Protected Member Functions

FBRenderingPass  GetRenderingPassNeededForAlpha (FBAlphaSource pTransparency)
  In order to be called at the right passes, a shader must set the result of GetRenderingPassNeededForAlpha() to RenderingPass for a given transparency type.

Member Function Documentation

ShaderPassTypeBegin ( FBRenderOptions  pRenderOptions,
FBRenderingPass  pPass 
)

For all the shader instances of the same type, to setup the common state for all this type of shaders.

Parameters:
pOptions Render options.
pPass Rendering pass.
pInfo Shader-model information.
ShaderPassTypeEnd ( FBRenderOptions  pRenderOptions,
FBRenderingPass  pPass 
)

For all the shader instances of the same type, to clean the common state for all this type of shaders.

Parameters:
pOptions Render options.
pPass Rendering pass.
ShaderPassInstanceBegin ( FBRenderOptions  pRenderOptions,
FBRenderingPass  pPass 
)

For all the models associated with this shader instance, to setup the common state for this shader instance.

Parameters:
pOptions Render options.
pPass Rendering pass.
ShaderPassInstanceEnd ( FBRenderOptions  pRenderOptions,
FBRenderingPass  pPass 
)

For all the models associated with this shader instance, to clean the common state for this shader instance.

Parameters:
pOptions Render options.
pPass Rendering pass.
ShaderPassMaterialBegin ( FBRenderOptions  pRenderOptions,
FBRenderingPass  pPass,
HFBShaderModelInfo  pInfo 
)

For all the models mapped with this material and associated with this shader instance, to setup the common material state for this shader instance.

Parameters:
pOptions Render options.
pPass Rendering pass.
pInfo Shader-model information.
ShaderPassMaterialEnd ( FBRenderOptions  pRenderOptions,
FBRenderingPass  pPass,
HFBShaderModelInfo  pInfo 
)

For all the models mapped with this material and associated with this shader instance, to clean the common material state for this shader instance.

Parameters:
pOptions Render options.
pPass Rendering pass.
pInfo Shader-model information.
ShaderPassGeometryBegin ( FBRenderOptions  pRenderOptions,
FBRenderingPass  pPass,
HFBShaderModelInfo  pInfo 
)

For all the models instanced from the same geometry, to setup the common VBO state for this shader instance.

Parameters:
pOptions Render options.
pPass Rendering pass.
pInfo Shader-model information.
ShaderPassGeometryEnd ( FBRenderOptions  pRenderOptions,
FBRenderingPass  pPass,
HFBShaderModelInfo  pInfo 
)

For all the models instanced from the same geometry, to clean the common VBO state for this shader instance.

Parameters:
pOptions Render options.
pPass Rendering pass.
pInfo Shader-model information.
ShaderPassModelsDraw ( FBRenderOptions  pRenderOptions,
FBRenderingPass  pPass,
tuple  pInfoArray 
)

For all the models with the same material/geometry mappings, inside this functions, we only need to setup modelview matrix, and draw the meshes.

Parameters:
pOptions Render options.
pPass Rendering pass.
pInfoArray An array of Shader-model information to be displayed.
ShaderPassModelDraw ( FBRenderOptions  pRenderOptions,
FBRenderingPass  pPass,
HFBShaderModelInfo  pInfo 
)

Callback for Cg/CgFx shader to setup WorldMaitrx/WorldMatrixIT parameters.

Parameters:
pOptions Render options.
pPass Rendering pass.
pInfo Shader-model information.
ShaderPassDrawShadowBegin ( FBRenderOptions  pRenderOptions )

Shadow draw pass begin notify for shader with kFBShaderCapacityMaterialEffect and kFBShaderCapacityDrawShow.

Parameters:
pOptions Render options.
pPass Rendering pass.
ShaderPassDrawShadowEnd ( FBRenderOptions  pRenderOptions )

Shadow draw pass end notify for shader with kFBShaderCapacityMaterialEffect and kFBShaderCapacityDrawShow.

Parameters:
pOptions Render options.
FBShaderPassActionCallback GetShaderPassActionCallback ( )

Get Shader Pass Action Callback registration;.

SetShaderPassActionCallback ( FBShaderPassActionCallback  pCallback )

Set Shader Pass Action Callback registration;.

__init__ ( str  pName,
object  pObject = None 
)

Protected constructor.

Parameters:
pName Shader name.
pObject Internal parent object to own shader(default=NULL).

Reimplemented from FBBox.

Reimplemented in FBShaderLighted, and FBShaderShadowLive.

IObject_Declare ( Implementation  )

Reimplemented from FBBox.

HFBShaderModelInfo NewShaderModelInfo ( HKModelRenderInfo  pModelRenderInfo,
int  pSubRegionIndex 
)

Create a new shader-model information object.

Parameters:
pOptions Render options.
pModelRenderInfo Internal Model Render Info.
Returns:
Newly allocated shader-model information object.
UpdateModelShaderInfo ( FBRenderOptions  pOptions,
HFBShaderModelInfo  pInfo 
)

Update shader-model information when model, material & texture mapping or shader setting change.

Parameters:
pOptions Render options.
pInfo Shader-model information object to be updated.
DestroyShaderModelInfo ( FBRenderOptions  pOptions,
HFBShaderModelInfo  pInfo 
)

Destroy shader-model information object callback.

Parameters:
pOptions Render options.
pInfo Shader-model information object to destroy.
ReplaceAll ( FBModel  pModel )

Replace all shader in pModel.

Parameters:
pModel Model to replace all shader to.
Append ( FBModel  pModel )

Append shader to pModel.

Parameters:
pModel Model to append shader to.
bool ShaderNeedBeginRender ( )

Does the shader need a begin render call.

Remarks:
Re-implement this function and return true if you need it. This method is called once per shader on each render pass.
ShaderBeginRender ( FBRenderOptions  pOptions,
HFBShaderModelInfo  pInfo 
)

Pre-rendering of shaders that is called only one time for a shader instance.

Remarks:
ShaderBeginRender is called as many times as the number of models affected by the instance of the shader in a given render pass. (ShaderNeedBeginRender must return true for this function to be called).
ShadeModel ( FBRenderOptions  pOptions,
HFBShaderModelInfo  pInfo,
FBRenderingPass  pPass 
)

Real-time shading callback for shader without kFBShaderCapacityMaterialEffect.

This is called after all the calls to ShaderBeginRender.

Parameters:
pOptions Render options.
pPass Rendering pass.
pInfo Shader-model information.
ShadeModelShadow ( FBRenderOptions  pRenderOptions,
HFBShaderModelInfo  pInfo 
)

Draw custom shadow shape callback for shader with kFBShaderCapacityDrawShadow but without kFBShaderCapacityMaterialEffect.

Parameters:
pOptions Render options.
pInfo Shader-model information.
CloneShaderParameter ( HFBShader  pNewShader )

Clone shader.

Parameters:
pNewShader Shader to copy data to.
DetachDisplayContext ( FBRenderOptions  pOptions,
HFBShaderModelInfo  pInfo 
)

Detach the display context from the shader.

Parameters:
pOptions Render options.
pInfo Shader-model information object.
bool FbxStore ( FBFbxObject  pFbxObject )

Storage of information into the FBX file format.

Parameters:
pFbxObject Object to interface with FBX file format.
Returns:
true if successful, false otherwise.
bool FbxRetrieve ( FBFbxObject  pFbxObject,
HFBRenderer  pRenderer 
)

Retrieval of information into the FBX file format.

Parameters:
pFbxObject Object to interface with FBX file format.
pRenderer Renderer being restored.
Returns:
true if successful, false otherwise.
InvalidateShaderVersion ( )

Invalidate Shader version to trigger model-shader informaton to be updated.

int GetShaderVersion ( )

Return Shader Version.

FBShaderCapacity GetShaderCapacity ( )

Return Shader Capacity (bitwise value).

bool HasShaderCapacity ( FBShaderCapacity  pCapacity )

Return true if shader has certain capacity.

SetShaderCapacity ( FBShaderCapacity  pCapacity,
bool  pOn 
)

Set Shader Capacity (bitwise value).

Only when the shader is not connected to any model, this function will take effect. otherwise, it will be ignored.

int GetDrawInstancedMaximumSize ( )

Get shader maximum size for draw instanced.

SetDrawInstancedMaximumSize ( int  pMaxSize )

Set shader maximum size for draw instanced.

UploadModelViewMatrixArrayForDrawInstanced ( float  pModelViewMatrixArray,
int  pCount 
)

Callback for uploading the modelview array when draw instanced.

Parameters:
pModelViewMatrixArray pointer of 4x4 column major modelview matrix array, length is 4*4*pCount;
pCount number of modelview matrixs in the array.
FBRenderingPass GetRenderingPassNeededForAlpha ( FBAlphaSource  pTransparency ) [protected]

In order to be called at the right passes, a shader must set the result of GetRenderingPassNeededForAlpha() to RenderingPass for a given transparency type.

It should not be called at rendering time.

Parameters:
pTransparency Transparency type.
Returns:
a mask of all rendering passes needed for DrawGeometry() to work correctly.

Member Data Documentation

FBPropertyBase Enable

Read Write Property: Is the shader Enabled.

FBPropertyRenderingPass RenderingPass

Read Write Property: Rendering pass object are shaded in.

Set the property to kFBPassFlat if you want to be called at the first pass, kFBPassPostRender at the second pass, kFBPassFlat | kFBPassPostRender at both. The current pass will be the third argument of ShadeModel()


FBShader FBShader FBShader FBShader FBShader FBShader FBShader FBShader FBShader FBShader
FBShader FBShader FBShader FBShader FBShader FBShader FBShader FBShader FBShader FBShader