using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; namespace BansheeEngine { /** @addtogroup Particles * @{ */ /// /// Specifies a color as a distribution, which can include a constant color, random color range or a color gradient. /// [ShowInInspector] public partial class ColorDistribution : ScriptObject { private ColorDistribution(bool __dummy0) { } /// Creates a new empty distribution. public ColorDistribution() { Internal_ColorDistribution(this); } /// Creates a new distribution that returns a constant color. public ColorDistribution(Color color) { Internal_ColorDistribution0(this, ref color); } /// Creates a new distribution that returns a random color in the specified range. public ColorDistribution(Color minColor, Color maxColor) { Internal_ColorDistribution1(this, ref minColor, ref maxColor); } /// Creates a new distribution that evaluates a color gradient. public ColorDistribution(ColorGradient gradient) { Internal_ColorDistribution2(this, gradient); } /// Creates a new distribution that returns a random color in a range determined by two gradients. public ColorDistribution(ColorGradient minGradient, ColorGradient maxGradient) { Internal_ColorDistribution3(this, minGradient, maxGradient); } /// Returns the type of the represented distribution. [ShowInInspector] [NativeWrapper] public PropertyDistributionType DistributionType { get { return Internal_getType(mCachedPtr); } } /// /// Returns the constant value of the distribution, or the minimal value of a constant range. Undefined if the /// distribution is represented by a gradient. /// public Color GetMinConstant() { Color temp; Internal_getMinConstant(mCachedPtr, out temp); return temp; } /// /// Returns the maximum value of a constant range. Only defined if the distribution represents a non-gradient range. /// public Color GetMaxConstant() { Color temp; Internal_getMaxConstant(mCachedPtr, out temp); return temp; } /// /// Returns the gradient representing the distribution, or the first gradient representing a gradient range. Undefined /// if the distribution is represented by a constant or a non-gradient range. /// public ColorGradient GetMinGradient() { return Internal_getMinGradient(mCachedPtr); } /// /// Returns the curve representing the second gradient of a gradient range. Only defined if the distribution represents /// a gradient range. /// public ColorGradient GetMaxGradient() { return Internal_getMaxGradient(mCachedPtr); } /// Evaluates the value of the distribution. /// /// Time at which to evaluate the distribution. This is only relevant if the distribution contains gradients. /// /// /// Value in range [0, 1] that determines how to interpolate between min/max value, if the distribution represents a /// range. Value of 0 will return the minimum value, while value of 1 will return the maximum value, and interpolate the /// values in-between. /// /// Evaluated color. public Color Evaluate(float t, float factor) { Color temp; Internal_evaluate(mCachedPtr, t, factor, out temp); return temp; } /// Evaluates the value of the distribution. /// /// Time at which to evaluate the distribution. This is only relevant if the distribution contains gradients. /// /// /// Random number generator that determines the factor. Factor determines how to interpolate between min/max value, if /// the distribution represents a range. /// /// Evaluated color. public Color Evaluate(float t, out Random factor) { Color temp; Internal_evaluate0(mCachedPtr, t, out factor, out temp); return temp; } [MethodImpl(MethodImplOptions.InternalCall)] private static extern void Internal_ColorDistribution(ColorDistribution managedInstance); [MethodImpl(MethodImplOptions.InternalCall)] private static extern void Internal_ColorDistribution0(ColorDistribution managedInstance, ref Color color); [MethodImpl(MethodImplOptions.InternalCall)] private static extern void Internal_ColorDistribution1(ColorDistribution managedInstance, ref Color minColor, ref Color maxColor); [MethodImpl(MethodImplOptions.InternalCall)] private static extern void Internal_ColorDistribution2(ColorDistribution managedInstance, ColorGradient gradient); [MethodImpl(MethodImplOptions.InternalCall)] private static extern void Internal_ColorDistribution3(ColorDistribution managedInstance, ColorGradient minGradient, ColorGradient maxGradient); [MethodImpl(MethodImplOptions.InternalCall)] private static extern PropertyDistributionType Internal_getType(IntPtr thisPtr); [MethodImpl(MethodImplOptions.InternalCall)] private static extern void Internal_getMinConstant(IntPtr thisPtr, out Color __output); [MethodImpl(MethodImplOptions.InternalCall)] private static extern void Internal_getMaxConstant(IntPtr thisPtr, out Color __output); [MethodImpl(MethodImplOptions.InternalCall)] private static extern ColorGradient Internal_getMinGradient(IntPtr thisPtr); [MethodImpl(MethodImplOptions.InternalCall)] private static extern ColorGradient Internal_getMaxGradient(IntPtr thisPtr); [MethodImpl(MethodImplOptions.InternalCall)] private static extern void Internal_evaluate(IntPtr thisPtr, float t, float factor, out Color __output); [MethodImpl(MethodImplOptions.InternalCall)] private static extern void Internal_evaluate0(IntPtr thisPtr, float t, out Random factor, out Color __output); } /** @} */ }