ProcessedMaterial
Engine/source/materials/processedMaterial.h
This is an abstract base class which provides the external interface all subclasses must implement.
State setting functions
setShaderMacros(const Vector< GFXShaderMacro > & macros)
Set the user defined shader macros.
setTextureStages(SceneRenderState * , const SceneData & sgData, U32 pass)
Sets the textures needed for rendering the current pass.
setTransforms(const MatrixSet & matrixSet, SceneRenderState * state, const U32 pass)
Sets the transformation matrix, i.e. Model * View * Projection.
setCustomShaderData(Vector< CustomShaderBindingData > & shaderData, const U32 pass)
Sets any custom shader data.
setSceneInfo(SceneRenderState * , const SceneData & sgData, U32 pass)
Sets the scene info like lights for the given pass.
setBuffers(GFXVertexBufferHandleBase * vertBuffer, GFXPrimitiveBufferHandle * primBuffer)
Sets the given vertex and primitive buffers so we can render geometry.
setUserObject(SimObject * userObject)
bool
State blocks
_initStateBlockTemplates(GFXStateBlockDesc & stateTranslucent, GFXStateBlockDesc & stateGlow, GFXStateBlockDesc & stateReflect)
Creates the default state block templates, used by initStateBlocks.
_initPassStateBlock(RenderPassData * rpd, GFXStateBlockDesc & result)
Does the base render state block setting, normally per pass.
Creates the default state blocks for a list of render states.
Creates the default state blocks for each RenderPassData item.
_getRenderStateIndex(const SceneRenderState * state, const SceneData & sgData)
This returns the index into the renderState array based on the sgData passed in.
_setRenderState(const SceneRenderState * state, const SceneData & sgData, U32 pass)
Activates the correct mPasses[currPass].renderState based on scene graph info.
Protected Attributes
The active features in use by this material.
bool
If we have accumulation.
bool
If we glow.
bool
If we've already loaded the stage data.
Number of stages (not to be confused with number of passes)
Vector< RenderPassData * >
Our passes.
mStages [Material::MAX_STAGES]
Material::StageData is used here because the shader generator throws a fit if it's passed anything else.
The state hint used for material sorting and quick equality comparision.
Set by addStateBlockDesc, should be considered when initPassStateBlock is called.
The user defined macros to pass to the shader initialization.
The user defined object to pass to ShaderFeature::createConstHandles.
The vertex format on which this material will render.
Public Functions
Dump shader info, or FF texture info?
Returns the active features in use by this material.
Material *
Returns the source material.
getMaterialInfo(GuiTreeViewCtrl * tree, U32 item)
Returns the number of passes we are rendering (not to be confused with the number of stages).
Returns the number of stages we're rendering (not to be confused with the number of passes).
getStageFromPass(U32 pass)
Gets the stage number for a pass.
getStageTexture(U32 stage, const FeatureType & type)
Returns the texture used by a stage.
Returns the state hint which can be used for sorting and fast comparisions of the equality of a material instance.
bool
Returns true if any pass accumulates.
bool
hasGlow()
Returns true if any pass glows.
bool
init(const FeatureSet & features, const GFXVertexFormat * vertexFormat, const MatFeaturesDelegate & featuresDelegate)
Initializes us (eg. loads textures, creates passes, generates shaders)
setMaterialParameters(MaterialParameters * param, S32 pass)
bool
setupPass(SceneRenderState * , const SceneData & sgData, U32 pass)
Sets up the given pass.
Protected Functions
_createCompositeTexture(const char * filenameR, const char * filenameG, const char * filenameB, const char * filenameA, U32 inputKey, GFXTextureProfile * profile)
_createTexture(const char * filename, GFXTextureProfile * profile)
Loads the texture located at _getTexturePath(filename) and gives it the specified profile.
_getTexturePath(const String & filename)
Returns the path the material will attempt to load for a given texture filename.
_setBlendState(Material::BlendOp blendOp, GFXStateBlockDesc & desc)
Sets the blend state for rendering
Loads all the textures for all of the stages in the Material.
Detailed Description
This is an abstract base class which provides the external interface all subclasses must implement.
This interface primarily consists of setting state. Pass creation is implementation specific, and internal, thus it is not in this base class.
State setting functions
addStateBlockDesc(const GFXStateBlockDesc & sb)
Reimplemented by: ProcessedDeferredMaterial
updateStateBlocks()
setShaderMacros(const Vector< GFXShaderMacro > & macros)
Set the user defined shader macros.
setTextureStages(SceneRenderState * , const SceneData & sgData, U32 pass)
Sets the textures needed for rendering the current pass.
Reimplemented by: ProcessedCustomMaterial, ProcessedShaderMaterial
setTransforms(const MatrixSet & matrixSet, SceneRenderState * state, const U32 pass)
Sets the transformation matrix, i.e. Model * View * Projection.
Reimplemented by: ProcessedShaderMaterial
setNodeTransforms(const MatrixF * address, const U32 numTransforms, const U32 pass)
Sets the node transforms for HW Skinning.
Reimplemented by: ProcessedShaderMaterial
setCustomShaderData(Vector< CustomShaderBindingData > & shaderData, const U32 pass)
Sets any custom shader data.
Reimplemented by: ProcessedShaderMaterial
setSceneInfo(SceneRenderState * , const SceneData & sgData, U32 pass)
Sets the scene info like lights for the given pass.
Reimplemented by: ProcessedShaderMaterial
setBuffers(GFXVertexBufferHandleBase * vertBuffer, GFXPrimitiveBufferHandle * primBuffer)
Sets the given vertex and primitive buffers so we can render geometry.
Reimplemented by: ProcessedShaderMaterial
setUserObject(SimObject * userObject)
stepInstance()
Reimplemented by: ProcessedShaderMaterial
State blocks
_initStateBlockTemplates(GFXStateBlockDesc & stateTranslucent, GFXStateBlockDesc & stateGlow, GFXStateBlockDesc & stateReflect)
Creates the default state block templates, used by initStateBlocks.
_initPassStateBlock(RenderPassData * rpd, GFXStateBlockDesc & result)
Does the base render state block setting, normally per pass.
Reimplemented by: ProcessedCustomMaterial
_initRenderStateStateBlocks(RenderPassData * rpd)
Creates the default state blocks for a list of render states.
_initRenderPassDataStateBlocks()
Creates the default state blocks for each RenderPassData item.
_getRenderStateIndex(const SceneRenderState * state, const SceneData & sgData)
This returns the index into the renderState array based on the sgData passed in.
_setRenderState(const SceneRenderState * state, const SceneData & sgData, U32 pass)
Activates the correct mPasses[currPass].renderState based on scene graph info.
Protected Attributes
MaterialParameters * mCurrentParams
FeatureSet mFeatures
The active features in use by this material.
bool mHasAccumulation
If we have accumulation.
bool mHasGlow
If we glow.
bool mHasSetStageData
If we've already loaded the stage data.
Material * mMaterial
The material which we are processing.
U32 mMaxStages
Number of stages (not to be confused with number of passes)
Vector< RenderPassData * > mPasses
Our passes.
Material::StageData mStages [Material::MAX_STAGES]
Material::StageData is used here because the shader generator throws a fit if it's passed anything else.
MatStateHint mStateHint
The state hint used for material sorting and quick equality comparision.
GFXStateBlockDesc mUserDefined
Set by addStateBlockDesc, should be considered when initPassStateBlock is called.
Vector< GFXShaderMacro > mUserMacros
The user defined macros to pass to the shader initialization.
SimObject * mUserObject
The user defined object to pass to ShaderFeature::createConstHandles.
const GFXVertexFormat * mVertexFormat
The vertex format on which this material will render.
Public Functions
ProcessedMaterial()
~ProcessedMaterial()
allocMaterialParameters()
Reimplemented by: ProcessedCustomMaterial, ProcessedShaderMaterial
dumpMaterialInfo()
Dump shader info, or FF texture info?
Reimplemented by: ProcessedShaderMaterial
getDefaultMaterialParameters()
Reimplemented by: ProcessedShaderMaterial
getFeatures()
Returns the active features in use by this material.
getMaterial()
Returns the source material.
getMaterialInfo(GuiTreeViewCtrl * tree, U32 item)
Reimplemented by: ProcessedShaderMaterial
getMaterialParameterHandle(const String & name)
Reimplemented by: ProcessedShaderMaterial
getMaterialParameters()
getNumPasses()
Returns the number of passes we are rendering (not to be confused with the number of stages).
getNumStages()
Returns the number of stages we're rendering (not to be confused with the number of passes).
Reimplemented by: ProcessedShaderMaterial, ProcessedDeferredMaterial
getPass(U32 pass)
Returns the pass data for the given pass.
getPass(U32 pass)
Returns the pass data for the given pass.
getStageFromPass(U32 pass)
Gets the stage number for a pass.
getStageTexture(U32 stage, const FeatureType & type)
Returns the texture used by a stage.
getStateHint()
Returns the state hint which can be used for sorting and fast comparisions of the equality of a material instance.
hasAccumulation()
Returns true if any pass accumulates.
hasGlow()
Returns true if any pass glows.
init(const FeatureSet & features, const GFXVertexFormat * vertexFormat, const MatFeaturesDelegate & featuresDelegate)
Initializes us (eg. loads textures, creates passes, generates shaders)
Reimplemented by: ProcessedCustomMaterial, ProcessedShaderMaterial
setMaterialParameters(MaterialParameters * param, S32 pass)
setupPass(SceneRenderState * , const SceneData & sgData, U32 pass)
Sets up the given pass.
Returns true if the pass was set up, false if there was an error or if the specified pass is out of bounds.
Reimplemented by: ProcessedCustomMaterial, ProcessedShaderMaterial
Protected Functions
_createCompositeTexture(const char * filenameR, const char * filenameG, const char * filenameB, const char * filenameA, U32 inputKey, GFXTextureProfile * profile)
_createTexture(const char * filename, GFXTextureProfile * profile)
Loads the texture located at _getTexturePath(filename) and gives it the specified profile.
_getTexturePath(const String & filename)
Returns the path the material will attempt to load for a given texture filename.
_setBlendState(Material::BlendOp blendOp, GFXStateBlockDesc & desc)
Sets the blend state for rendering
_setStageData()
Loads all the textures for all of the stages in the Material.
Reimplemented by: ProcessedCustomMaterial