docs.unity3d.com
    Show / Hide Table of Contents

    Class VolumeParameter<T>

    A generic implementation of VolumeParameter. Custom parameters should derive from this class and implement their own behavior.

    Inheritance
    Object
    VolumeParameter
    VolumeParameter<T>
    AnimationCurveParameter
    BoolParameter
    ColorParameter
    CubemapParameter
    FloatParameter
    FloatRangeParameter
    IntParameter
    LayerMaskParameter
    NoInterpClampedFloatParameter
    NoInterpClampedIntParameter
    NoInterpColorParameter
    NoInterpCubemapParameter
    NoInterpFloatParameter
    NoInterpFloatRangeParameter
    NoInterpIntParameter
    NoInterpMaxFloatParameter
    NoInterpMaxIntParameter
    NoInterpMinFloatParameter
    NoInterpMinIntParameter
    NoInterpRenderTextureParameter
    NoInterpTextureParameter
    NoInterpVector2Parameter
    NoInterpVector3Parameter
    NoInterpVector4Parameter
    ObjectParameter<T>
    RenderTextureParameter
    Texture2DParameter
    Texture3DParameter
    TextureCurveParameter
    TextureParameter
    Vector2Parameter
    Vector3Parameter
    Vector4Parameter
    Inherited Members
    VolumeParameter.k_DebuggerDisplay
    VolumeParameter.m_OverrideState
    VolumeParameter.overrideState
    VolumeParameter.GetValue<T>()
    VolumeParameter.OnEnable()
    VolumeParameter.OnDisable()
    VolumeParameter.IsObjectParameter(Type)
    VolumeParameter.Release()
    Namespace: UnityEngine.Rendering
    Syntax
    [Serializable]
    public class VolumeParameter<T> : VolumeParameter, IEquatable<VolumeParameter<T>>
    Type Parameters
    Name Description
    T

    The type of value to hold in this parameter.

    Remarks

    T should a serializable type. Due to limitations with the serialization system in Unity, you should not use this class directly to declare parameters in a VolumeComponent. Instead, use one of the pre-flatten types (like FloatParameter, or make your own by extending this class.

    Examples

    This sample code shows how to make a custom parameter holding a float:

    using UnityEngine.Rendering;
    
    [Serializable]
    public sealed class MyFloatParameter : VolumeParameter<float>
    {
        public MyFloatParameter(float value, bool overrideState = false)
            : base(value, overrideState) { }
    
        public sealed override void Interp(float from, float to, float t)
        {
            m_Value = from + (to - from) * t;
        }
    }

    Constructors

    VolumeParameter()

    Creates a new VolumeParameter<T> instance.

    Declaration
    public VolumeParameter()

    VolumeParameter(T, Boolean)

    Creates a new VolumeParameter<T> instance.

    Declaration
    protected VolumeParameter(T value, bool overrideState)
    Parameters
    Type Name Description
    T value

    The initial value to store in the parameter.

    Boolean overrideState

    The initial override state for the parameter.

    Fields

    m_Value

    The value stored and serialized by this parameter.

    Declaration
    [SerializeField]
    protected T m_Value
    Field Value
    Type Description
    T

    Properties

    value

    The value that this parameter stores.

    Declaration
    public virtual T value { get; set; }
    Property Value
    Type Description
    T
    Remarks

    You can override this property to define custom behaviors when the value is changed.

    Methods

    Equals(Object)

    Determines whether two object instances are equal.

    Declaration
    public override bool Equals(object obj)
    Parameters
    Type Name Description
    Object obj

    The object to compare with the current object.

    Returns
    Type Description
    Boolean

    true if the specified object is equal to the current object, false otherwise.

    Overrides
    Object.Equals(Object)

    Equals(VolumeParameter<T>)

    Checks if this parameter is equal to another.

    Declaration
    public bool Equals(VolumeParameter<T> other)
    Parameters
    Type Name Description
    VolumeParameter<T> other

    The other parameter to check against.

    Returns
    Type Description
    Boolean

    true if both parameters are equal, false otherwise

    GetHashCode()

    Returns a hash code for the current object.

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    Int32

    A hash code for the current object.

    Overrides
    Object.GetHashCode()

    Interp(T, T, Single)

    Interpolates two values using a factor t.

    Declaration
    public virtual void Interp(T from, T to, float t)
    Parameters
    Type Name Description
    T from

    The start value.

    T to

    The end value.

    Single t

    The interpolation factor in range [0,1].

    Remarks

    By default, this method does a "snap" interpolation, meaning it returns the value to if t is higher than 0, and from otherwise.

    Override(T)

    Sets the value for this parameter and sets its override state to true.

    Declaration
    public void Override(T x)
    Parameters
    Type Name Description
    T x

    The value to assign to this parameter.

    SetValue(VolumeParameter)

    Sets the value of this parameter to the value in parameter.

    Declaration
    public override void SetValue(VolumeParameter parameter)
    Parameters
    Type Name Description
    VolumeParameter parameter

    The VolumeParameter to copy the value from.

    Overrides
    VolumeParameter.SetValue(VolumeParameter)

    ToString()

    Returns a string that represents the current object.

    Declaration
    public override string ToString()
    Returns
    Type Description
    String

    A string that represents the current object.

    Overrides
    Object.ToString()

    Operators

    Equality(VolumeParameter<T>, T)

    Compares the value in a parameter with another value of the same type.

    Declaration
    public static bool operator ==(VolumeParameter<T> lhs, T rhs)
    Parameters
    Type Name Description
    VolumeParameter<T> lhs

    The first value in a VolumeParameter.

    T rhs

    The second value.

    Returns
    Type Description
    Boolean

    true if both values are equal, false otherwise.

    Explicit(VolumeParameter<T> to T)

    Explicitly downcast a VolumeParameter<T> to a value of type T.

    Declaration
    public static explicit operator T(VolumeParameter<T> prop)
    Parameters
    Type Name Description
    VolumeParameter<T> prop

    The parameter to downcast.

    Returns
    Type Description
    T

    A value of type T.

    Inequality(VolumeParameter<T>, T)

    Compares the value store in a parameter with another value of the same type.

    Declaration
    public static bool operator !=(VolumeParameter<T> lhs, T rhs)
    Parameters
    Type Name Description
    VolumeParameter<T> lhs

    The first value in a VolumeParameter.

    T rhs

    The second value.

    Returns
    Type Description
    Boolean

    false if both values are equal, true otherwise

    Extension Methods

    ReflectionUtils.Invoke(Object, String, Object[])
    ReflectionUtils.SetField(Object, String, Object)
    ReflectionUtils.GetField(Object, String)
    ReflectionUtils.GetFields(Object)

    See Also

    VolumeParameter
    Back to top
    Terms of use
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023