struct TColorDistribution

template<class T>
Inherits: IScriptExportable

Specifies a color as a distribution, which can include a constant color, random color range or a color gradient.

Public

Constructors

TColorDistribution<T>

Creates a new empty distribution.

TColorDistribution<T>

TColorDistribution<T>(const Color &color)

Creates a new distribution that returns a constant color.

TColorDistribution<T>

TColorDistribution<T>(const Color &minColor, const Color &maxColor)

Creates a new distribution that returns a random color in the specified range.

TColorDistribution<T>

TColorDistribution<T>(const T &gradient)

Creates a new distribution that evaluates a color gradient.

TColorDistribution<T>

TColorDistribution<T>(const T &minGradient, const T &maxGradient)

Creates a new distribution that returns a random color in a range determined by two gradients.

TColorDistribution

TColorDistribution()

Creates a new empty distribution.

TColorDistribution

TColorDistribution(const Color &color)

Creates a new distribution that returns a constant color.

TColorDistribution

TColorDistribution(const Color &minColor, const Color &maxColor)

Creates a new distribution that returns a random color in the specified range.

TColorDistribution

TColorDistribution(const ColorGradient &gradient)

Creates a new distribution that evaluates a color gradient.

TColorDistribution

TColorDistribution(const ColorGradient &minGradient, const ColorGradient &maxGradient)

Creates a new distribution that returns a random color in a range determined by two gradients.

TColorDistribution

TColorDistribution()

Creates a new empty distribution.

TColorDistribution

TColorDistribution(const Color &color)

Creates a new distribution that returns a constant color.

TColorDistribution

TColorDistribution(const Color &minColor, const Color &maxColor)

Creates a new distribution that returns a random color in the specified range.

TColorDistribution

TColorDistribution(const ColorGradientHDR &gradient)

Creates a new distribution that evaluates a color gradient.

TColorDistribution

TColorDistribution(const ColorGradientHDR &minGradient, const ColorGradientHDR &maxGradient)

Creates a new distribution that returns a random color in a range determined by two gradients.

Methods

GetType

PropertyDistributionType GetType() const

Returns the type of the represented distribution.

GetMinConstant

Color GetMinConstant() const

Returns the constant value of the distribution, or the minimal value of a constant range.

Undefined if the distribution is represented by a gradient.

GetMaxConstant

Color GetMaxConstant() const

Returns the maximum value of a constant range.

Only defined if the distribution represents a non-gradient range.

GetMinGradient

const T &GetMinGradient() const

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.

GetMaxGradient

const T &GetMaxGradient() const

Returns the curve representing the second gradient of a gradient range.

Only defined if the distribution represents a gradient range.

Evaluate

typename T::ColorType Evaluate(float t, float factor) const

Evaluates the value of the distribution.

t
Time at which to evaluate the distribution. This is only relevant if the distribution contains gradients.
factor
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.

Returns: Evaluated color.

Evaluate

typename T::ColorType Evaluate(float t, const Random &factor) const

Evaluates the value of the distribution.

t
Time at which to evaluate the distribution. This is only relevant if the distribution contains gradients.
factor
Random number generator that determines the factor. Factor determines how to interpolate between min/max value, if the distribution represents a range.

Returns: Evaluated color.

ToLookupTable

LookupTable ToLookupTable(u32 numSamples = 128, bool ignoreRange = false) const

Converts the distribution into a lookup table that's faster to access.

The distribution will be resampled using a fixed sample rate with equidistant samples.

numSamples
Determines how many samples to output in the lookup table. This value is ignored for non-curve distributions in which case there is always just one sample.
ignoreRange
If the curve represents a range (either between constants or curves), this determines should the other value of the range be included in the lookup table. If true, only the minimum constant/curve will be included, and if false then the maximum curve values will follow the minimum curve values of each sample.

Returns: Resampled lookup table.

GetType

PropertyDistributionType GetType() const

Returns the type of the represented distribution.

GetMinConstant

Color GetMinConstant() const

Returns the constant value of the distribution, or the minimal value of a constant range.

Undefined if the distribution is represented by a gradient.

GetMaxConstant

Color GetMaxConstant() const

Returns the maximum value of a constant range.

Only defined if the distribution represents a non-gradient range.

GetMinGradient

const ColorGradient &GetMinGradient() const

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.

GetMaxGradient

const ColorGradient &GetMaxGradient() const

Returns the curve representing the second gradient of a gradient range.

Only defined if the distribution represents a gradient range.

Evaluate

typename ColorGradient::ColorType Evaluate(float t, float factor) const

Evaluates the value of the distribution.

t
Time at which to evaluate the distribution. This is only relevant if the distribution contains gradients.
factor
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.

Returns: Evaluated color.

Evaluate

typename ColorGradient::ColorType Evaluate(float t, const Random &factor) const

Evaluates the value of the distribution.

t
Time at which to evaluate the distribution. This is only relevant if the distribution contains gradients.
factor
Random number generator that determines the factor. Factor determines how to interpolate between min/max value, if the distribution represents a range.

Returns: Evaluated color.

ToLookupTable

LookupTable ToLookupTable(u32 numSamples, bool ignoreRange) const

Converts the distribution into a lookup table that's faster to access.

The distribution will be resampled using a fixed sample rate with equidistant samples.

numSamples
Determines how many samples to output in the lookup table. This value is ignored for non-curve distributions in which case there is always just one sample.
ignoreRange
If the curve represents a range (either between constants or curves), this determines should the other value of the range be included in the lookup table. If true, only the minimum constant/curve will be included, and if false then the maximum curve values will follow the minimum curve values of each sample.

Returns: Resampled lookup table.

GetType

PropertyDistributionType GetType() const

Returns the type of the represented distribution.

GetMinConstant

Color GetMinConstant() const

Returns the constant value of the distribution, or the minimal value of a constant range.

Undefined if the distribution is represented by a gradient.

GetMaxConstant

Color GetMaxConstant() const

Returns the maximum value of a constant range.

Only defined if the distribution represents a non-gradient range.

GetMinGradient

const ColorGradientHDR &GetMinGradient() const

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.

GetMaxGradient

const ColorGradientHDR &GetMaxGradient() const

Returns the curve representing the second gradient of a gradient range.

Only defined if the distribution represents a gradient range.

Evaluate

typename ColorGradientHDR::ColorType Evaluate(float t, float factor) const

Evaluates the value of the distribution.

t
Time at which to evaluate the distribution. This is only relevant if the distribution contains gradients.
factor
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.

Returns: Evaluated color.

Evaluate

typename ColorGradientHDR::ColorType Evaluate(float t, const Random &factor) const

Evaluates the value of the distribution.

t
Time at which to evaluate the distribution. This is only relevant if the distribution contains gradients.
factor
Random number generator that determines the factor. Factor determines how to interpolate between min/max value, if the distribution represents a range.

Returns: Evaluated color.

ToLookupTable

LookupTable ToLookupTable(u32 numSamples, bool ignoreRange) const

Converts the distribution into a lookup table that's faster to access.

The distribution will be resampled using a fixed sample rate with equidistant samples.

numSamples
Determines how many samples to output in the lookup table. This value is ignored for non-curve distributions in which case there is always just one sample.
ignoreRange
If the curve represents a range (either between constants or curves), this determines should the other value of the range be included in the lookup table. If true, only the minimum constant/curve will be included, and if false then the maximum curve values will follow the minimum curve values of each sample.

Returns: Resampled lookup table.

Operators

operator==

bool operator==(const TColorDistribution<T> &rhs) const

operator!=

bool operator!=(const TColorDistribution<T> &rhs) const

operator==

bool operator==(const TColorDistribution<ColorGradient> &rhs) const

operator!=

bool operator!=(const TColorDistribution<ColorGradient> &rhs) const

operator==

bool operator==(const TColorDistribution<ColorGradientHDR> &rhs) const

operator!=

bool operator!=(const TColorDistribution<ColorGradientHDR> &rhs) const

Private

Fields

mMinGradient

T mMinGradient

mMaxGradient

T mMaxGradient

mMinGradient

ColorGradient mMinGradient

mMaxGradient

ColorGradient mMaxGradient

mMinGradient

ColorGradientHDR mMinGradient

mMaxGradient

ColorGradientHDR mMaxGradient