Stride

OPEN / CLOSE
  • Features
  • Blog
  • Documentation
  • Community
(icon) Download

  • Discord
  • Facebook
  • Twitter
  • YouTube

LANGUAGE

OPEN / CLOSE
  • English
  • 日本語
    Show / Hide Table of Contents

    ShaderGeneratorContext Class

    Namespace: Stride.Rendering.Materials
    Assembly: Stride.Rendering.dll

    Base class for generating shader class source with associated parameters.

    System.Object → DisposeBase → ComponentBase → ShaderGeneratorContext
    Derived from ShaderGeneratorContext: MaterialGeneratorContext

    public class ShaderGeneratorContext : ComponentBase, IDisposable, IComponent, IReferencable, ICollectorHolder
    Name Description
    Constructors
    ShaderGeneratorContext(GraphicsDevice)
    Properties
    ColorSpace
    Content

    Gets or sets the asset manager.

    CurrentOverrides
    FindAsset
    GetAssetFriendlyName
    IsNotPixelStage
    Log
    OptimizeMaterials

    Gets or sets a value indicating whether materials will be optimized (textures blended together, generate optimized shader permutations, etc...).

    Parameters
    Methods
    GenerateTextureFromColor(Color)
    GetParameterKey(ParameterKey)
    GetSamplerKey(SamplerStateDescription, GraphicsDevice)
    GetSamplerKey(ComputeColorParameterSampler)
    GetTextureKey(Texture, ObjectParameterKey<Texture>, Nullable<Color>)
    GetTextureKey(ComputeTextureBase, MaterialComputeColorKeys)
    PopOverrides()
    PushOverrides(MaterialOverrides)
    ResetParameterKeys()
    | Improve this Doc View Source

    Constructors


    ShaderGeneratorContext(GraphicsDevice)

    public ShaderGeneratorContext(GraphicsDevice graphicsDevice = null)
    Parameters
    Type Name Description
    GraphicsDevice graphicsDevice
    | Improve this Doc View Source

    Properties


    ColorSpace

    public ColorSpace ColorSpace { get; set; }
    Property Value
    Type Description
    ColorSpace

    Content

    Gets or sets the asset manager.

    public ContentManager Content { get; set; }
    Property Value
    Type Description
    ContentManager

    The asset manager.


    CurrentOverrides

    public MaterialOverrides CurrentOverrides { get; }
    Property Value
    Type Description
    MaterialOverrides

    FindAsset

    public ShaderGeneratorContext.FindAssetDelegate FindAsset { get; set; }
    Property Value
    Type Description
    ShaderGeneratorContext.FindAssetDelegate

    GetAssetFriendlyName

    public ShaderGeneratorContext.GetAssetFriendlyNameDelegate GetAssetFriendlyName { get; set; }
    Property Value
    Type Description
    ShaderGeneratorContext.GetAssetFriendlyNameDelegate

    IsNotPixelStage

    public bool IsNotPixelStage { get; set; }
    Property Value
    Type Description
    System.Boolean

    Log

    public LoggerResult Log { get; set; }
    Property Value
    Type Description
    LoggerResult

    OptimizeMaterials

    Gets or sets a value indicating whether materials will be optimized (textures blended together, generate optimized shader permutations, etc...).

    public bool OptimizeMaterials { get; set; }
    Property Value
    Type Description
    System.Boolean

    true if [materials are optimized]; otherwise, false.


    Parameters

    public ParameterCollection Parameters { get; set; }
    Property Value
    Type Description
    ParameterCollection
    | Improve this Doc View Source

    Methods


    GenerateTextureFromColor(Color)

    public Texture GenerateTextureFromColor(Color color)
    Parameters
    Type Name Description
    Color color
    Returns
    Type Description
    Texture

    GetParameterKey(ParameterKey)

    public ParameterKey GetParameterKey(ParameterKey key)
    Parameters
    Type Name Description
    ParameterKey key
    Returns
    Type Description
    ParameterKey

    GetSamplerKey(SamplerStateDescription, GraphicsDevice)

    public ObjectParameterKey<SamplerState> GetSamplerKey(SamplerStateDescription samplerStateDesc, GraphicsDevice graphicsDevice)
    Parameters
    Type Name Description
    SamplerStateDescription samplerStateDesc
    GraphicsDevice graphicsDevice
    Returns
    Type Description
    ObjectParameterKey<SamplerState>

    GetSamplerKey(ComputeColorParameterSampler)

    public ObjectParameterKey<SamplerState> GetSamplerKey(ComputeColorParameterSampler sampler)
    Parameters
    Type Name Description
    ComputeColorParameterSampler sampler
    Returns
    Type Description
    ObjectParameterKey<SamplerState>

    GetTextureKey(Texture, ObjectParameterKey<Texture>, Nullable<Color>)

    public ObjectParameterKey<Texture> GetTextureKey(Texture texture, ObjectParameterKey<Texture> key, Color? defaultTextureValue = null)
    Parameters
    Type Name Description
    Texture texture
    ObjectParameterKey<Texture> key
    System.Nullable<Color> defaultTextureValue
    Returns
    Type Description
    ObjectParameterKey<Texture>

    GetTextureKey(ComputeTextureBase, MaterialComputeColorKeys)

    public ObjectParameterKey<Texture> GetTextureKey(ComputeTextureBase computeTexture, MaterialComputeColorKeys baseKeys)
    Parameters
    Type Name Description
    ComputeTextureBase computeTexture
    MaterialComputeColorKeys baseKeys
    Returns
    Type Description
    ObjectParameterKey<Texture>

    PopOverrides()

    public void PopOverrides()

    PushOverrides(MaterialOverrides)

    public void PushOverrides(MaterialOverrides overrides)
    Parameters
    Type Name Description
    MaterialOverrides overrides

    ResetParameterKeys()

    protected void ResetParameterKeys()

    Inherited Members

    ComponentBase.Tags
    ComponentBase.Name
    ComponentBase.Destroy()
    ComponentBase.ICollectorHolder.Collector
    ComponentBase.OnNameChanged()
    ComponentBase.ToString()
    DisposeBase.Dispose()
    DisposeBase.IsDisposed
    DisposeBase.IReferencable.ReferenceCount
    DisposeBase.IReferencable.AddReference()
    DisposeBase.IReferencable.Release()
    DisposeBase.OnAddReference()
    DisposeBase.OnReleaseReference()

    Extension Methods

    ComponentBaseExtensions.DisposeBy<T>(T, ICollectorHolder)
    ComponentBaseExtensions.RemoveDisposeBy<T>(T, ICollectorHolder)
    • Improve this Doc
    • View Source
    In This Article

    Back to top

    Copyright © 2019-2021 .NET Foundation and Contributors
    Supported by the .NET Foundation