BaseMatInstance
Engine/source/materials/baseMatInstance.h
Material Hook functions
addHook(MatInstanceHook * hook)
HOOK *
getHook()
Helper function for getting a hook.
getHook(const MatInstanceHookType & type)
deleteHook(const MatInstanceHookType & type)
Protected Attributes
bool
This is set by initialization and used by the deferred.
Vector< MatInstanceHook * >
The array of active material hooks indexed by a MatInstanceHookType.
bool
Should be true if init has been called and it succeeded.
bool
This material makes use of bone transforms.
bool
Public Functions
addShaderMacro(const String & name, const String & value)
Adds a shader macro which will be passed to the shader during initialization.
addStateBlockDesc(const GFXStateBlockDesc & desc)
Adds this stateblock to the base state block used during initialization.
Get a MaterialParameters block for this BaseMatInstance, caller is responsible for freeing it.
Returns the active features in use by this material.
Returns the material this instance is based on.
getMaterialParameterHandle(const String & name)
Returns a MaterialParameterHandle for name.
Get the current parameters for this BaseMatInstance (BaseMatInstances are created with a default active MaterialParameters which is managed by BaseMatInstance.
Returns the features that were requested at material creation time which may differ from the active features.
getShaderInfo(GuiTreeViewCtrl * tree, U32 item)
Returns the state hint which can be used for sorting and fast comparisions of the equality of a material instance.
bool
bool
hasGlow()
bool
Fast test for use of normal maps in this material.
bool
init(const FeatureSet & features, const GFXVertexFormat * vertexFormat)
bool
Returns true if this MatInstance is built from a CustomMaterial.
bool
Returns true if the material is forward lit and requires a list of lights which affect it when rendering.
bool
Returns true if this material is instanced.
bool
isValid()
Returns true if init has been successfully called.
bool
bool
reInit()
Reinitializes the material using the previous initialization parameters.
setBuffers(GFXVertexBufferHandleBase * vertBuffer, GFXPrimitiveBufferHandle * primBuffer)
Sets the vertex and primitive buffers as well as the instancing stream buffer for the current material if the material is instanced.
setCustomShaderData(Vector< CustomShaderBindingData > & shaderData)
Sets custom shader data.
setMaterialParameters(MaterialParameters * param)
Set the current parameters for this BaseMatInstance.
setNodeTransforms(const MatrixF * address, const U32 numTransforms)
Sets node transforms for the current stage. Used for hardware skinning.
setSceneInfo(SceneRenderState * state, const SceneData & sgData)
This initializes various material scene state settings and should be called after setupPass() within the pass loop.
setSelectionHighlighting(bool flag)
setTextureStages(SceneRenderState * , const SceneData & sgData)
This is normally called from within setupPass() automatically, so its unnecessary to do so manually unless a texture stage has changed.
setTransforms(const MatrixSet & matrixSet, SceneRenderState * state)
This initializes the material transforms and should be called after setupPass() within the pass loop.
bool
setupPass(SceneRenderState * state, const SceneData & sgData)
Sets up the next rendering pass for this material.
setUserObject(SimObject * userObject)
Sets a SimObject which will passed into ShaderFeature::createConstHandles.
bool
Used to increment the instance buffer for this material.
Updates the state blocks for this material.
bool
Detailed Description
Material Hook functions
addHook(MatInstanceHook * hook)
getHook()
Helper function for getting a hook.
getHook(const MatInstanceHookType & type)
deleteHook(const MatInstanceHookType & type)
deleteAllHooks()
Protected Attributes
MatFeaturesDelegate mFeaturesDelegate
bool mHasNormalMaps
This is set by initialization and used by the deferred.
Vector< MatInstanceHook * > mHooks
The array of active material hooks indexed by a MatInstanceHookType.
bool mIsValid
Should be true if init has been called and it succeeded.
It is up to the derived class to set this variable appropriately.
bool mUsesHardwareSkinning
This material makes use of bone transforms.
bool needsHighlighting
Public Functions
~BaseMatInstance()
addShaderMacro(const String & name, const String & value)
Adds a shader macro which will be passed to the shader during initialization.
Reimplemented by: MatInstance
addStateBlockDesc(const GFXStateBlockDesc & desc)
Adds this stateblock to the base state block used during initialization.
Reimplemented by: MatInstance
allocMaterialParameters()
Get a MaterialParameters block for this BaseMatInstance, caller is responsible for freeing it.
Reimplemented by: MatInstance
dumpShaderInfo()
Reimplemented by: MatInstance
getCurPass()
Reimplemented by: MatInstance
getCurStageNum()
Reimplemented by: MatInstance
getFeatures()
Returns the active features in use by this material.
Reimplemented by: MatInstance
getFeaturesDelegate()
getMaterial()
Returns the material this instance is based on.
Reimplemented by: MatInstance
getMaterialParameterHandle(const String & name)
Returns a MaterialParameterHandle for name.
Reimplemented by: MatInstance
getMaterialParameters()
Get the current parameters for this BaseMatInstance (BaseMatInstances are created with a default active MaterialParameters which is managed by BaseMatInstance.
Reimplemented by: MatInstance
getPass(U32 pass)
Reimplemented by: MatInstance
getRequestedFeatures()
Returns the features that were requested at material creation time which may differ from the active features.
Reimplemented by: MatInstance
getShaderInfo(GuiTreeViewCtrl * tree, U32 item)
Reimplemented by: MatInstance
getStateHint()
Returns the state hint which can be used for sorting and fast comparisions of the equality of a material instance.
Reimplemented by: MatInstance
getUserObject()
Reimplemented by: MatInstance
getUserStateBlock()
Reimplemented by: MatInstance
getVertexFormat()
Reimplemented by: MatInstance
hasAccumulation()
Reimplemented by: MatInstance
hasGlow()
Reimplemented by: MatInstance
hasNormalMap()
Fast test for use of normal maps in this material.
init(const FeatureSet & features, const GFXVertexFormat * vertexFormat)
Parameters:
features | The features you want to allow for this material. |
vertexFormat | The vertex format on which this material will be rendered. |
Reimplemented by: LightMatInstance, MatInstance, DeferredMatInstance
isCustomMaterial()
Returns true if this MatInstance is built from a CustomMaterial.
Reimplemented by: MatInstance
isForwardLit()
Returns true if the material is forward lit and requires a list of lights which affect it when rendering.
Reimplemented by: MatInstance
isInstanced()
Returns true if this material is instanced.
Reimplemented by: MatInstance
isValid()
Returns true if init has been successfully called.
It is up to the derived class to set this value properly.
needsSelectionHighlighting()
reInit()
Reinitializes the material using the previous initialization parameters.
Reimplemented by: MatInstance
setBuffers(GFXVertexBufferHandleBase * vertBuffer, GFXPrimitiveBufferHandle * primBuffer)
Sets the vertex and primitive buffers as well as the instancing stream buffer for the current material if the material is instanced.
Reimplemented by: MatInstance
setCustomShaderData(Vector< CustomShaderBindingData > & shaderData)
Sets custom shader data.
Reimplemented by: MatInstance
setMaterialParameters(MaterialParameters * param)
Set the current parameters for this BaseMatInstance.
Reimplemented by: MatInstance
setNodeTransforms(const MatrixF * address, const U32 numTransforms)
Sets node transforms for the current stage. Used for hardware skinning.
Reimplemented by: MatInstance
setSceneInfo(SceneRenderState * state, const SceneData & sgData)
This initializes various material scene state settings and should be called after setupPass() within the pass loop.
Reimplemented by: MatInstance
setSelectionHighlighting(bool flag)
setTextureStages(SceneRenderState * , const SceneData & sgData)
This is normally called from within setupPass() automatically, so its unnecessary to do so manually unless a texture stage has changed.
If so it should be called after setupPass() within the pass loop.
Reimplemented by: MatInstance
setTransforms(const MatrixSet & matrixSet, SceneRenderState * state)
This initializes the material transforms and should be called after setupPass() within the pass loop.
Reimplemented by: MatInstance
setupPass(SceneRenderState * state, const SceneData & sgData)
Sets up the next rendering pass for this material.
It is typically called like so...
while( mat->setupPass( state, sgData ) ) { mat->setTransforms(...); mat->setSceneInfo(...); ... GFX->drawPrimitive(); }
Reimplemented by: MatInstance, LightMatInstance, ShadowMatInstance, ReflectionMatInstance
setUserObject(SimObject * userObject)
Sets a SimObject which will passed into ShaderFeature::createConstHandles.
Normal features do not make use of this, it is for special class specific or user designed features.
Reimplemented by: MatInstance
stepInstance()
Used to increment the instance buffer for this material.
Reimplemented by: MatInstance
updateStateBlocks()
Updates the state blocks for this material.
Reimplemented by: MatInstance
usesHardwareSkinning()