This is the documentation for Enlighten.
module Colours
Classes
Name | Description |
|---|---|
| |
Allow safe conversion between a float and its representative bit pattern. |
Functions
Name | Description |
|---|---|
Constructs a float which is exactly equal to 1x2^exponent. | |
The 4 float components of v128 correspond to the native ordering of the 4 byte components of u32. | |
The 4 float components of v128 correspond to the native ordering of the 4 byte components of u32. | |
The 4 float components of v128 correspond to the native ordering of the 4 byte components of u32. | |
Extract the exponent of the given float, accounting for the bias (i.e. the result is in the range -127 to +128). | |
Extracts the mantissa of the given float. | |
Packs a single-precision floating point number into a floating point number with the given number of exponent and mantissa bits. | |
Pack a v128 colour value into a u32 in RGBM format. | |
Packs a 4-vector of single-precision floating point numbers into a "shared exponent" 999e5 format. | |
Unacks a single-precision floating point number from a floating point number with the given number of exponent and mantissa bits. | |
Unpacks a 4-vector of single-precision floating point numbers from a "shared exponent" 999e5 format. | |
Unpack an rgbm colour into a 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.