Class MaterialGeneratorContext
Main entry point class for generating shaders from a MaterialDescriptor
public class MaterialGeneratorContext : ShaderGeneratorContext, IDisposable, IComponent, IReferencable, ICollectorHolder- Inheritance
- 
      objectMaterialGeneratorContext
- Implements
- Inherited Members
- Extension Methods
Constructors
MaterialGeneratorContext(Material, GraphicsDevice)
Initializes a new instance of MaterialGeneratorContext.
public MaterialGeneratorContext(Material material = null, GraphicsDevice graphicsDevice = null)Parameters
- materialMaterial
- graphicsDeviceGraphicsDevice
Fields
DefaultFinalCallbackOrder
public const int DefaultFinalCallbackOrder = 0Field Value
Properties
CurrentMaterialDescriptor
The current material descriptor on the material stack
public IMaterialDescriptor CurrentMaterialDescriptor { get; }Property Value
GraphicsProfile
The graphics profile this material will be compatiable with.
public GraphicsProfile GraphicsProfile { get; set; }Property Value
Material
Gets the compiled Material.
public Material Material { get; }Property Value
MaterialPass
Gets the compiled MaterialPass. Only valid during GenerateShader.
public MaterialPass MaterialPass { get; set; }Property Value
PassCount
In case of multi pass materials, this describe the number of passes.
public int PassCount { get; }Property Value
PassIndex
The current pass (used by multipass materials). Only valid during GenerateShader.
public int PassIndex { get; set; }Property Value
Step
The current step of material generation.
public MaterialGeneratorStep Step { get; set; }Property Value
Methods
AddFinalCallback(MaterialShaderStage, MaterialGeneratorCallback, int)
public void AddFinalCallback(MaterialShaderStage stage, MaterialGeneratorContext.MaterialGeneratorCallback callback, int order = 0)Parameters
- stageMaterialShaderStage
- callbackMaterialGeneratorContext.MaterialGeneratorCallback
- orderint
AddShaderSource(MaterialShaderStage, ShaderSource)
public void AddShaderSource(MaterialShaderStage stage, ShaderSource shaderSource)Parameters
- stageMaterialShaderStage
- shaderSourceShaderSource
AddShading<T>(T)
public ShadingModelShaderBuilder AddShading<T>(T shadingModel) where T : class, IMaterialShadingModelFeatureParameters
- shadingModelT
Returns
Type Parameters
- T
AddStreamInitializer(MaterialShaderStage, string)
public void AddStreamInitializer(MaterialShaderStage stage, string streamInitilizerSource)Parameters
- stageMaterialShaderStage
- streamInitilizerSourcestring
ComputeShaderSource(MaterialShaderStage)
public ShaderSource ComputeShaderSource(MaterialShaderStage stage)Parameters
- stageMaterialShaderStage
Returns
GenerateStreamInitializers(MaterialShaderStage)
public ShaderSource GenerateStreamInitializers(MaterialShaderStage stage)Parameters
- stageMaterialShaderStage
Returns
GetShading<T>(T)
public ShadingModelShaderBuilder GetShading<T>(T shadingModel) where T : class, IMaterialShadingModelFeatureParameters
- shadingModelT
Returns
Type Parameters
- T
GetStreamBlendShaderSource(string)
public ShaderSource GetStreamBlendShaderSource(string stream)Parameters
- streamstring
Returns
GetStreamFinalModifier<T>(MaterialShaderStage)
public ShaderSource GetStreamFinalModifier<T>(MaterialShaderStage stage)Parameters
- stageMaterialShaderStage
Returns
Type Parameters
- T
HasShaderSources(MaterialShaderStage)
public bool HasShaderSources(MaterialShaderStage stage)Parameters
- stageMaterialShaderStage
Returns
PopLayer()
Pops the current layer.
public void PopLayer()PopMaterial()
public IMaterialDescriptor PopMaterial()Returns
PopPass()
public void PopPass()PushLayer(IComputeScalar)
Pushes a new layer with the specified blend map.
public void PushLayer(IComputeScalar blendMap)Parameters
- blendMapIComputeScalar
- The blend map used by this layer. 
PushMaterial(IMaterialDescriptor, string)
Push a material for processing.
public bool PushMaterial(IMaterialDescriptor materialDescriptor, string materialName)Parameters
- materialDescriptorIMaterialDescriptor
- The material descriptor. 
- materialNamestring
- Friendly name of the material. 
Returns
- bool
- trueif the material is valid and can be visited,- falseotherwise.
Exceptions
- ArgumentNullException
- materialDescriptor 
PushPass()
public MaterialPass PushPass()Returns
SetMultiplePasses(string, int)
Register this material with multiple passes. This is only possible once.
public void SetMultiplePasses(string module, int passCount)Parameters
SetStream(MaterialShaderStage, string, IComputeNode, ObjectParameterKey<Texture>, ParameterKey, Color?)
public void SetStream(MaterialShaderStage stage, string stream, IComputeNode computeNode, ObjectParameterKey<Texture> defaultTexturingKey, ParameterKey defaultValueKey, Color? defaultTextureValue = null)Parameters
- stageMaterialShaderStage
- streamstring
- computeNodeIComputeNode
- defaultTexturingKeyObjectParameterKey<Texture>
- defaultValueKeyParameterKey
- defaultTextureValueColor?
SetStream(MaterialShaderStage, string, MaterialStreamType, ShaderSource)
public void SetStream(MaterialShaderStage stage, string stream, MaterialStreamType streamType, ShaderSource shaderSource)Parameters
- stageMaterialShaderStage
- streamstring
- streamTypeMaterialStreamType
- shaderSourceShaderSource
SetStream(string, IComputeNode, ObjectParameterKey<Texture>, ParameterKey, Color?)
public void SetStream(string stream, IComputeNode computeNode, ObjectParameterKey<Texture> defaultTexturingKey, ParameterKey defaultValueKey, Color? defaultTextureValue = null)Parameters
- streamstring
- computeNodeIComputeNode
- defaultTexturingKeyObjectParameterKey<Texture>
- defaultValueKeyParameterKey
- defaultTextureValueColor?
SetStreamFinalModifier<T>(MaterialShaderStage, ShaderSource)
public void SetStreamFinalModifier<T>(MaterialShaderStage stage, ShaderSource shaderSource)Parameters
- stageMaterialShaderStage
- shaderSourceShaderSource
Type Parameters
- T
UseStream(MaterialShaderStage, string)
public void UseStream(MaterialShaderStage stage, string stream)Parameters
- stageMaterialShaderStage
- streamstring
UseStreamWithCustomBlend(MaterialShaderStage, string, ShaderSource)
public void UseStreamWithCustomBlend(MaterialShaderStage stage, string stream, ShaderSource blendStream)Parameters
- stageMaterialShaderStage
- streamstring
- blendStreamShaderSource
Visit(IMaterialFeature)
public void Visit(IMaterialFeature feature)Parameters
- featureIMaterialFeature