MaterialGeneratorContext Class
              
              
              Namespace: Stride.Rendering.Materials
              Assembly: Stride.Rendering.dll
              
              
              
              
              
              
              
                 Derived from MaterialGeneratorContext: 
              
              
              
              
              
                public class MaterialGeneratorContext : ShaderGeneratorContext, IDisposable, IComponent, IReferencable, ICollectorHolder
               
              
              
              
              
              
                
                  
                    | Name | 
                    Description | 
                    
                        
                  
                      
                         
              
                      | Constructors
               | 
              
                          
                          | 
                              
                           | 
                          MaterialGeneratorContext(Material, GraphicsDevice) | 
                          Initializes a new instance of MaterialGeneratorContext. 
 | 
                          
              
                     
              
                      | Fields
               | 
              
                          
                          | 
                              
                           | 
                          DefaultFinalCallbackOrder | 
                           | 
                          
              
                     
              
                      | Properties
               | 
              
                          
                          | 
                              
                           | 
                          CurrentMaterialDescriptor | 
                          The current material descriptor on the material stack 
 | 
                          
                          
                          | 
                              
                           | 
                          GraphicsProfile | 
                          The graphics profile this material will be compatiable with. 
 | 
                          
                          
                          | 
                              
                           | 
                          Material | 
                          Gets the compiled Material. 
 | 
                          
                          
                          | 
                              
                           | 
                          MaterialPass | 
                          Gets the compiled MaterialPass. Only valid during GenerateShader. 
 | 
                          
                          
                          | 
                              
                           | 
                          PassCount | 
                          In case of multi pass materials, this describe the number of passes. 
 | 
                          
                          
                          | 
                              
                           | 
                          PassIndex | 
                          The current pass (used by multipass materials). Only valid during GenerateShader. 
 | 
                          
                          
                          | 
                              
                           | 
                          Step | 
                          The current step of material generation. 
 | 
                          
              
                     
              
                      | Methods
               | 
              
                          
                          | 
                              
                           | 
                          AddFinalCallback(MaterialShaderStage, MaterialGeneratorContext.MaterialGeneratorCallback, Int32) | 
                           | 
                          
                          
                          | 
                              
                           | 
                          AddShaderSource(MaterialShaderStage, ShaderSource) | 
                           | 
                          
                          
                          | 
                              
                           | 
                          AddShading<T>(T) | 
                           | 
                          
                          
                          | 
                              
                           | 
                          AddStreamInitializer(MaterialShaderStage, String) | 
                           | 
                          
                          
                          | 
                              
                           | 
                          ComputeShaderSource(MaterialShaderStage) | 
                           | 
                          
                          
                          | 
                              
                           | 
                          GenerateStreamInitializers(MaterialShaderStage) | 
                           | 
                          
                          
                          | 
                              
                           | 
                          GetShading<T>(T) | 
                           | 
                          
                          
                          | 
                              
                           | 
                          GetStreamBlendShaderSource(String) | 
                           | 
                          
                          
                          | 
                              
                           | 
                          GetStreamFinalModifier<T>(MaterialShaderStage) | 
                           | 
                          
                          
                          | 
                              
                           | 
                          HasShaderSources(MaterialShaderStage) | 
                           | 
                          
                          
                          | 
                              
                           | 
                          PopLayer() | 
                          Pops the current layer. 
 | 
                          
                          
                          | 
                              
                           | 
                          PopMaterial() | 
                           | 
                          
                          
                          | 
                              
                           | 
                          PopPass() | 
                           | 
                          
                          
                          | 
                              
                           | 
                          PushLayer(IComputeScalar) | 
                          Pushes a new layer with the specified blend map. 
 | 
                          
                          
                          | 
                              
                           | 
                          PushMaterial(IMaterialDescriptor, String) | 
                          Push a material for processing. 
 | 
                          
                          
                          | 
                              
                           | 
                          PushPass() | 
                           | 
                          
                          
                          | 
                              
                           | 
                          SetMultiplePasses(String, Int32) | 
                          Register this material with multiple passes. This is only possible once. 
 | 
                          
                          
                          | 
                              
                           | 
                          SetStream(MaterialShaderStage, String, IComputeNode, ObjectParameterKey<Texture>, ParameterKey, Nullable<Color>) | 
                           | 
                          
                          
                          | 
                              
                           | 
                          SetStream(MaterialShaderStage, String, MaterialStreamType, ShaderSource) | 
                           | 
                          
                          
                          | 
                              
                           | 
                          SetStream(String, IComputeNode, ObjectParameterKey<Texture>, ParameterKey, Nullable<Color>) | 
                           | 
                          
                          
                          | 
                              
                           | 
                          SetStreamFinalModifier<T>(MaterialShaderStage, ShaderSource) | 
                           | 
                          
                          
                          | 
                              
                           | 
                          UseStream(MaterialShaderStage, String) | 
                           | 
                          
                          
                          | 
                              
                           | 
                          UseStreamWithCustomBlend(MaterialShaderStage, String, ShaderSource) | 
                           | 
                          
                          
                          | 
                              
                           | 
                          Visit(IMaterialFeature) | 
                           | 
                          
              
              
                  
                
  
              
                     
              
                
                  |
                  Improve this Doc
                
                
                  View Source
                
              
              
                Constructors
              
                
              
              
              
              
              
              MaterialGeneratorContext(Material, GraphicsDevice)
              
              
              
              
              
                public MaterialGeneratorContext(Material material = null, GraphicsDevice graphicsDevice = null)
               
              
              Parameters
              
                     
              
                
                  |
                  Improve this Doc
                
                
                  View Source
                
              
              
                Fields
              
                
              
              
              
              
              DefaultFinalCallbackOrder
              
              
              
              
              
                public const int DefaultFinalCallbackOrder = 0
               
              
              Field Value
              
                
                  
                    | Type | 
                    Description | 
                  
                
                
                  
                    | System.Int32 | 
                     | 
                  
                
              
                     
              
                
                  |
                  Improve this Doc
                
                
                  View Source
                
              
              
                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
              
              
              
              
              
                public Material Material { get; }
               
              
              Property Value
              
              
              
              
              
              
              MaterialPass
              
              
              
              
              
                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
              
                
                  
                    | Type | 
                    Description | 
                  
                
                
                  
                    | System.Int32 | 
                     | 
                  
                
              
              
              
              
              
              
              PassIndex
              
              The current pass (used by multipass materials). Only valid during GenerateShader.
 
              
              
              
                public int PassIndex { get; set; }
               
              
              Property Value
              
                
                  
                    | Type | 
                    Description | 
                  
                
                
                  
                    | System.Int32 | 
                     | 
                  
                
              
              
              
              
              
              
              Step
              
              The current step of material generation.
 
              
              
              
                public MaterialGeneratorStep Step { get; set; }
               
              
              Property Value
              
                     
              
                
                  |
                  Improve this Doc
                
                
                  View Source
                
              
              
                Methods
              
                
              
              
              
              
              
              AddFinalCallback(MaterialShaderStage, MaterialGeneratorContext.MaterialGeneratorCallback, Int32)
              
              
              
              
              
                public void AddFinalCallback(MaterialShaderStage stage, MaterialGeneratorContext.MaterialGeneratorCallback callback, int order = 0)
               
              
              Parameters
              
              
              
              
              
              
              AddShaderSource(MaterialShaderStage, ShaderSource)
              
              
              
              
              
                public void AddShaderSource(MaterialShaderStage stage, ShaderSource shaderSource)
               
              
              Parameters
              
              
              
              
              
              
              AddShading<T>(T)
              
              
              
              
              
                public ShadingModelShaderBuilder AddShading<T>(T shadingModel)
    where T : class, IMaterialShadingModelFeature
               
              
              Parameters
              
                
                  
                    | Type | 
                    Name | 
                    Description | 
                  
                
                
                  
                    | T | 
                    shadingModel | 
                     | 
                  
                
              
              Returns
              
              Type Parameters
              
              
              
              
              
              
              AddStreamInitializer(MaterialShaderStage, String)
              
              
              
              
              
                public void AddStreamInitializer(MaterialShaderStage stage, string streamInitilizerSource)
               
              
              Parameters
              
              
              
              
              
              
              ComputeShaderSource(MaterialShaderStage)
              
              
              
              
              
                public ShaderSource ComputeShaderSource(MaterialShaderStage stage)
               
              
              Parameters
              
              Returns
              
              
              
              
              
              
              GenerateStreamInitializers(MaterialShaderStage)
              
              
              
              
              
                public ShaderSource GenerateStreamInitializers(MaterialShaderStage stage)
               
              
              Parameters
              
              Returns
              
              
              
              
              
              
              GetShading<T>(T)
              
              
              
              
              
                public ShadingModelShaderBuilder GetShading<T>(T shadingModel)
    where T : class, IMaterialShadingModelFeature
               
              
              Parameters
              
                
                  
                    | Type | 
                    Name | 
                    Description | 
                  
                
                
                  
                    | T | 
                    shadingModel | 
                     | 
                  
                
              
              Returns
              
              Type Parameters
              
              
              
              
              
              
              GetStreamBlendShaderSource(String)
              
              
              
              
              
                public ShaderSource GetStreamBlendShaderSource(string stream)
               
              
              Parameters
              
                
                  
                    | Type | 
                    Name | 
                    Description | 
                  
                
                
                  
                    | System.String | 
                    stream | 
                     | 
                  
                
              
              Returns
              
              
              
              
              
              
              GetStreamFinalModifier<T>(MaterialShaderStage)
              
              
              
              
              
                public ShaderSource GetStreamFinalModifier<T>(MaterialShaderStage stage)
               
              
              Parameters
              
              Returns
              
              Type Parameters
              
              
              
              
              
              
              HasShaderSources(MaterialShaderStage)
              
              
              
              
              
                public bool HasShaderSources(MaterialShaderStage stage)
               
              
              Parameters
              
              Returns
              
                
                  
                    | Type | 
                    Description | 
                  
                
                
                  
                    | System.Boolean | 
                     | 
                  
                
              
              
              
              
              
              
              PopLayer()
              
              
              
              
              
              
              
              
              
              
              
              PopMaterial()
              
              
              
              
              
                public IMaterialDescriptor PopMaterial()
               
              
              Returns
              
              
              
              
              
              
              PopPass()
              
              
              
              
              
              
              
              
              
              
              
              PushLayer(IComputeScalar)
              
              Pushes a new layer with the specified blend map.
 
              
              
              
                public void PushLayer(IComputeScalar blendMap)
               
              
              Parameters
              
                
                  
                    | Type | 
                    Name | 
                    Description | 
                  
                
                
                  
                    | IComputeScalar | 
                    blendMap | 
                    The blend map used by this layer. 
 | 
                  
                
              
              
              
              
              
              
              PushMaterial(IMaterialDescriptor, String)
              
              Push a material for processing.
 
              
              
              
                public bool PushMaterial(IMaterialDescriptor materialDescriptor, string materialName)
               
              
              Parameters
              
                
                  
                    | Type | 
                    Name | 
                    Description | 
                  
                
                
                  
                    | IMaterialDescriptor | 
                    materialDescriptor | 
                    The material descriptor. 
 | 
                  
                  
                    | System.String | 
                    materialName | 
                    Friendly name of the material. 
 | 
                  
                
              
              Returns
              
                
                  
                    | Type | 
                    Description | 
                  
                
                
                  
                    | System.Boolean | 
                    true if the material is valid and can be visited, false otherwise. 
 | 
                  
                
              
              Exceptions
              
                
                  
                    | Type | 
                    Condition | 
                  
                
                
                  
                    | System.ArgumentNullException | 
                    materialDescriptor 
 | 
                  
                
              
              
              
              
              
              
              PushPass()
              
              
              
              
              
                public MaterialPass PushPass()
               
              
              Returns
              
              
              
              
              
              
              SetMultiplePasses(String, Int32)
              
              Register this material with multiple passes. This is only possible once.
 
              
              
              
                public void SetMultiplePasses(string module, int passCount)
               
              
              Parameters
              
                
                  
                    | Type | 
                    Name | 
                    Description | 
                  
                
                
                  
                    | System.String | 
                    module | 
                    The module 
 | 
                  
                  
                    | System.Int32 | 
                    passCount | 
                     | 
                  
                
              
              
              
              
              
              
              SetStream(MaterialShaderStage, String, IComputeNode, ObjectParameterKey<Texture>, ParameterKey, Nullable<Color>)
              
              
              
              
              
                public void SetStream(MaterialShaderStage stage, string stream, IComputeNode computeNode, ObjectParameterKey<Texture> defaultTexturingKey, ParameterKey defaultValueKey, Color? defaultTextureValue = null)
               
              
              Parameters
              
              
              
              
              
              
              SetStream(MaterialShaderStage, String, MaterialStreamType, ShaderSource)
              
              
              
              
              
                public void SetStream(MaterialShaderStage stage, string stream, MaterialStreamType streamType, ShaderSource shaderSource)
               
              
              Parameters
              
              
              
              
              
              
              SetStream(String, IComputeNode, ObjectParameterKey<Texture>, ParameterKey, Nullable<Color>)
              
              
              
              
              
                public void SetStream(string stream, IComputeNode computeNode, ObjectParameterKey<Texture> defaultTexturingKey, ParameterKey defaultValueKey, Color? defaultTextureValue = null)
               
              
              Parameters
              
              
              
              
              
              
              SetStreamFinalModifier<T>(MaterialShaderStage, ShaderSource)
              
              
              
              
              
                public void SetStreamFinalModifier<T>(MaterialShaderStage stage, ShaderSource shaderSource)
               
              
              Parameters
              
              Type Parameters
              
              
              
              
              
              
              UseStream(MaterialShaderStage, String)
              
              
              
              
              
                public void UseStream(MaterialShaderStage stage, string stream)
               
              
              Parameters
              
              
              
              
              
              
              UseStreamWithCustomBlend(MaterialShaderStage, String, ShaderSource)
              
              
              
              
              
                public void UseStreamWithCustomBlend(MaterialShaderStage stage, string stream, ShaderSource blendStream)
               
              
              Parameters
              
              
              
              
              
              
              Visit(IMaterialFeature)
              
              
              
              
              
                public void Visit(IMaterialFeature feature)
               
              
              Parameters
              
              
              
 
              
               
              
              
              
              
              
              
              Extension Methods