This is the documentation for Enlighten.

module Colours

Classes

Name Description
Geo::GeoFloat3SE
Geo::GeoFloatAsBits

Allow safe conversion between a float and its representative bit pattern.

Functions

Name Description
ConstructFloatPow2(int)

Constructs a float which is exactly equal to 1x2^exponent.

ConvertColourToV(GeoColour)

The 4 float components of v128 correspond to the native ordering of the 4 byte components of u32.

ConvertVToColour(v128)

The 4 float components of v128 correspond to the native ordering of the 4 byte components of u32.

ConvertVToIntensity(v128)

The 4 float components of v128 correspond to the native ordering of the 4 byte components of u32.

GetFloatExponent(float)

Extract the exponent of the given float, accounting for the bias (i.e. the result is in the range -127 to +128).

GetFloatMantissa(float)

Extracts the mantissa of the given float.

PackFloatToFixedWidth(float)

Packs a single-precision floating point number into a floating point number with the given number of exponent and mantissa bits.

PackFloatToRgbm(v128, bool)

Pack a v128 colour value into a u32 in RGBM format.

PackFloatToSharedExponent999e5(v128)

Packs a 4-vector of single-precision floating point numbers into a "shared exponent" 999e5 format.

UnpackFloatFromFixedWidth(u32)

Unacks a single-precision floating point number from a floating point number with the given number of exponent and mantissa bits.

UnpackFloatFromSharedExponent999e5(u32)

Unpacks a 4-vector of single-precision floating point numbers from a "shared exponent" 999e5 format.

UnpackRgbmToFloat(u32)

Unpack an rgbm colour into a v128.

VNormaliseLuminance(v128)

Normalise the intensity of a colour vector to have unit luminance.

Typedefs

Name Description
u32 GeoColour

An 8-bit colour.

Variables

Name Description
const Geo::v128 g_LuminanceCoefficients = Geo::VConstruct(0.2126f, 0.7152f, 0.0722f, 0.0f)

The coefficients to calculate the luminance from a colour specified in linear sRGB space These values are determined by the CIE 1931 colour space standard and the definition of the sRGB primaries.


GEO_FORCE_INLINE float Geo::ConstructFloatPow2


public: GEO_FORCE_INLINE float ConstructFloatPow2
(
    int exponent
)


Constructs a float which is exactly equal to 1x2^exponent.


v128 GEO_CALL Geo::ConvertColourToV


public: v128 GEO_CALL ConvertColourToV
(
    GeoColour colour
)


The 4 float components of v128 correspond to the native ordering of the 4 byte components of u32.


GeoColour GEO_CALL Geo::ConvertVToColour


public: GeoColour GEO_CALL ConvertVToColour
(
    v128 colour
)


The 4 float components of v128 correspond to the native ordering of the 4 byte components of u32.


float GEO_CALL Geo::ConvertVToIntensity


public: float GEO_CALL ConvertVToIntensity
(
    v128 colour
)


The 4 float components of v128 correspond to the native ordering of the 4 byte components of u32.


GEO_FORCE_INLINE int Geo::GetFloatExponent


public: GEO_FORCE_INLINE int GetFloatExponent
(
    float f
)


Extract the exponent of the given float, accounting for the bias (i.e. the result is in the range -127 to +128).


GEO_FORCE_INLINE u32 Geo::GetFloatMantissa


public: GEO_FORCE_INLINE u32 GetFloatMantissa
(
    float f
)


Extracts the mantissa of the given float.


GEO_FORCE_INLINE u32 Geo::PackFloatToFixedWidth


public: GEO_FORCE_INLINE u32 PackFloatToFixedWidth
(
    float in
)


Packs a single-precision floating point number into a floating point number with the given number of exponent and mantissa bits.


GEO_FORCE_INLINE u32 Geo::PackFloatToRgbm


public: GEO_FORCE_INLINE u32 PackFloatToRgbm
(
    v128 inputValue,
    bool isRgbaByteOrder
)


Pack a v128 colour value into a u32 in RGBM format.


GEO_FORCE_INLINE u32 Geo::PackFloatToSharedExponent999e5


public: GEO_FORCE_INLINE u32 PackFloatToSharedExponent999e5
(
    v128 colour
)


Packs a 4-vector of single-precision floating point numbers into a "shared exponent" 999e5 format.


GEO_FORCE_INLINE float Geo::UnpackFloatFromFixedWidth


public: GEO_FORCE_INLINE float UnpackFloatFromFixedWidth
(
    u32 in
)


Unacks a single-precision floating point number from a floating point number with the given number of exponent and mantissa bits.


GEO_FORCE_INLINE v128 Geo::UnpackFloatFromSharedExponent999e5


public: GEO_FORCE_INLINE v128 UnpackFloatFromSharedExponent999e5
(
    u32 colour
)


Unpacks a 4-vector of single-precision floating point numbers from a "shared exponent" 999e5 format.


GEO_FORCE_INLINE v128 Geo::UnpackRgbmToFloat


public: GEO_FORCE_INLINE v128 UnpackRgbmToFloat
(
    u32 rgbm
)


Unpack an rgbm colour into a v128.


v128 Geo::VNormaliseLuminance


public: v128 VNormaliseLuminance
(
    v128 colour
)


Normalise the intensity of a colour vector to have unit luminance.

If colour has no luminance (black, or infs/nans) then this returns black The alpha is always preserved.