This is the documentation for Enlighten.

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Current »

Functions

Name Description
Abs(v128Param)

Returns a vector with the Abs function applied to all 4 elements.

EqualWithinEpsilon(v128Param, v128Param, v128Param)

Returns true if all elements of a and b are within g_VecEpsilon of each other.

GetV128FromString(const C *)

Parses a v128 from the given string.

GetV128FromStringXYZ(const C *, float)

Parses a v128 from the given string, ignoring the W-component and instead setting it to the given value.

IsFinite(v128Param)

Returns true if all of the 4 elements of v are finite.

IsNan(v128Param)

Returns true if any of the 4 elements of v are NANs.

Lerp(v128Param, v128Param, v128Param)

Linearly interpolated between the corresponding components of a and b.

Max(const v128 &, const v128 &)

Returns a vector where each element has the maximum value of the corresponding values in a and b NOTE - the Min3 template function will work with the v128 type as well.

Min(const v128 &, const v128 &)

Returns a vector where each element has the minimum value of the corresponding values in a and b NOTE - the Min3 template function will work with the v128 type as well.

operator-(Geo::v128Param, Geo::v128Param)

Operator - (component-wise subtraction)

operator-(Geo::v128Param)

The unary - operator. Equivalent to (VZero() - v);.

operator*(Geo::v128Param, Geo::v128Param)

Operator * (component-wise multiplication)

operator*=(Geo::v128 &, Geo::v128Param)

Inplace *.

operator/(Geo::v128Param, Geo::v128Param)

Operator / (component-wise division)

operator/=(Geo::v128 &, Geo::v128Param)

Inplace /.

operator+(Geo::v128Param, Geo::v128Param)

Operator + (component-wise addition)

operator+(Geo::v128Param)

The unary + operator (effectively a no-op)

operator+=(Geo::v128 &, Geo::v128Param)

Inplace +.

operator-=(Geo::v128 &, Geo::v128Param)

Inplace -.

V128ToUtf8String(const Geo::v128 &)

Creates a GeoString representation of the vector (space-separated).

V128ToUtf8StringXYZ(const Geo::v128 &)

Creates a GeoString representation of the vector (space-separated).

VBroadcast(float)

Construct a v128 by broadcasting a float into all elements.

VBroadcastInt(s32)

Construct a v128 by converting an integer to a float and broadcasting it into all elements.

VCeil(v128Param)

Return ceil(v).

VCompareEquals(v128Param, v128Param)

Compares all corresponding elements to see if a == b (exact equals).

VCompareGE(v128Param, v128Param)

Compares all corresponding elements to see if a >= b.

VCompareGT(v128Param, v128Param)

Compares all corresponding elements to see if a > b.

VCompareIsFinite(v128Param)

Tests all elements of v to see if they are finite or not.

VCompareIsNan(v128Param)

Tests all elements of v to see if any of them are NANs.

VCompareLE(v128Param, v128Param)

Compares all corresponding elements to see if a <= b.

VCompareLT(v128Param, v128Param)

Compares all corresponding elements to see if a < b.

VCompareWithFlagsEquals(v128Param, v128Param, u32 &)

Compares all corresponding elements to see if a == b (exact equals).

VCompareWithFlagsGE(v128Param, v128Param, u32 &)

Compares all corresponding elements to see if a >= b.

VCompareWithFlagsGT(v128Param, v128Param, u32 &)

Compares all corresponding elements to see if a > b.

VCompareWithFlagsLE(v128Param, v128Param, u32 &)

Compares all corresponding elements to see if a <= b.

VCompareWithFlagsLT(v128Param, v128Param, u32 &)

Compares all corresponding elements to see if a < b.

VConstruct(float, float, float, float)

Construct a v128 from 4 floats. Fairly slow.

VConstructBitwise(u32, u32, u32, u32)

Re-intreprets 4 ints as floats and construct a vector from them.

VCross3(v128Param, v128Param)

Cross the first 3 elements of each.

VCross3ZeroW(v128Param, v128Param)

Cross the first 3 elements of each.

VFrac(Geo::v128Param)

Returns the fractional part of each element of v.

VGetMaskNotSignBit()

Returns a mask with everything but the 4 sign bits set.

VGetMaskSignBit()

Returns a mask with just the 4 sign bits set.

VLoadAligned(const float *)

Load a 4-float array from 16-byte aligned memory.

VLoadUnaligned(const float *)

Load a 4-float array from arbitrarily aligned memory. Cannot be null.

VMadd(Geo::v128Param, Geo::v128Param, Geo::v128Param)

This is a vector multiply accumulate operation returning (a * b) + c.

VNegate(v128Param)

Return -v. You can use the operator overload instead if you prefer.

VOpAnd(Geo::v128Param, Geo::v128Param)

This is a bitwise & operation.

VOpOnesCompl(Geo::v128Param)

This is a bitwise ~ operation.

VOpOr(Geo::v128Param, Geo::v128Param)

This is a bitwise | operation.

VOpXor(Geo::v128Param, Geo::v128Param)

This is a bitwise ^ operation.

VPackX4(const Geo::v128 &, const Geo::v128 &, const Geo::v128 &, const Geo::v128 &)

Packs the X component from each of the four vectors into a single vector.

VPerpendicular(v128Param, float)

Returns a vector perpendicular to v (with one of its components being zero).

VRecip(v128Param)

Return 1.f / v. (inaccurate)

VRecipFast(v128Param)

Return 1.f / v. (fast approximate where available. If not, implemented as VRecip)

VRecipSqrt(v128Param)

Return 1.f / sqrt(v). (inaccurate)

VRecipSqrtAccurate(v128Param)

Return 1.f / sqrt(v). (more accurate)

VRecipSqrtFast(v128Param)

Return 1.f / sqrt(v). (inaccurate)

VReverse(v128Param)

Reverses the order of the components from xyzw to wzyx.

VShuffle(v128Param, int, int, int, int)

Returns the specified permutation of the parameter vector. Any permutation is valid.

VSqrt(v128Param)

Return sqrt(v). (more inaccurate than the reciprocal version on non-sse hardware)

VTestFlagsAllFalse(u32)

Tests the flags produced by the VCompareWithFlags* operations.

VTestFlagsAllTrue(u32)

Tests the flags produced by the VCompareWithFlags* operations.

VTestFlagsSomeFalse(u32)

Tests the flags produced by the VCompareWithFlags* operations.

VTestFlagsSomeTrue(u32)

Tests the flags produced by the VCompareWithFlags* operations.

VZero()

A fully-zeroed out vector.

Variables

Name Description
const v128 g_VecEpsilon = VBroadcast(0.001f)

This has the value of g_VecEpsilonF broadcast into all elements.

const float g_VecEpsilonF = 0.001f

A general epsilon for use with the IsUnitLength function.

const u32 g_VecMaskFalse = 0x00000000

A mask value of 'false' = 0x00000000.

const u32 g_VecMaskTrue = 0xffffffff

A mask value of 'true' = 0xffffffff.

const v128 g_VecNormaliseEpsilon = VBroadcast(1e-35f)

An internal epsilon used inside the vector normalisation functions.

const Geo::v128 g_VFours

Some common useful constants.

const Geo::v128 g_VHalves

Some common useful constants.

const Geo::v128 g_VMinusOnes

Some common useful constants.

const Geo::v128 g_VMinusOneTwoEights

Some common useful constants.

const Geo::v128 g_VOneOverOneTwoSevens

Some common useful constants.

const Geo::v128 g_VOneOverPi

Some common useful constants.

const Geo::v128 g_VOneOverTwoFives

Some common useful constants.

const Geo::v128 g_VOneOverTwoPi

Some common useful constants.

const Geo::v128 g_VOnes

Some common useful constants.

const Geo::v128 g_VOneTwoSevens

Some common useful constants.

const Geo::v128 g_VPi

Some common useful constants.

const Geo::v128 g_VQuarters

Some common useful constants.

const Geo::v128 g_VThirds

Some common useful constants.

const Geo::v128 g_VThrees

Some common useful constants.

const Geo::v128 g_VTwoFiveFives

Some common useful constants.

const Geo::v128 g_VTwos

Some common useful constants.

const Geo::v128 g_VZero

Some common useful constants.

Enums

Name Description
eVShufflePosition

Shuffle constants for the GEO_VSHUFFLE macro.

Defines

Name Description
GEO_VSHUFFLE VShuffle(v, x, y, z, w)

Returns the specified permutation of the parameter vector.


GEO_FORCE_INLINE v128 Geo::Abs


public: v128 Abs
(
    v128Param a
)


Returns a vector with the Abs function applied to all 4 elements.


bool Geo::EqualWithinEpsilon


public: bool EqualWithinEpsilon
(
    v128Param a,
    v128Param b,
    v128Param epsilon
)


Returns true if all elements of a and b are within g_VecEpsilon of each other.

You may specify an epsilon vector that contains different epsilon values in each element if you wish.


Geo::v128 GEO_CALL Geo::GetV128FromString


public: Geo::v128GEO_CALL GetV128FromString
(
    const C * str
)


Parses a v128 from the given string.


Geo::v128 GEO_CALL Geo::GetV128FromStringXYZ


public: Geo::v128GEO_CALL GetV128FromStringXYZ
(
    const C * str,
    float w
)


Parses a v128 from the given string, ignoring the W-component and instead setting it to the given value.


bool Geo::IsFinite


public: bool IsFinite
(
    v128Param v
)


Returns true if all of the 4 elements of v are finite.

TODO - this function doesn't detect INFs yet!


bool Geo::IsNan


public: bool IsNan
(
    v128Param v
)


Returns true if any of the 4 elements of v are NANs.


v128 Geo::Lerp


public: v128 Lerp
(
    v128Param a,
    v128Param b,
    v128Param s
)


Linearly interpolated between the corresponding components of a and b.

s is the interpolation factor, typically having values between 0 -> 1.


GEO_FORCE_INLINE v128 Geo::Max


public: v128 Max
(
    const v128 & a,
    const v128 & b
)


Returns a vector where each element has the maximum value of the corresponding values in a and b NOTE - the Min3 template function will work with the v128 type as well.


GEO_FORCE_INLINE v128 Geo::Min


public: v128 Min
(
    const v128 & a,
    const v128 & b
)


Returns a vector where each element has the minimum value of the corresponding values in a and b NOTE - the Min3 template function will work with the v128 type as well.


GEO_FORCE_INLINE Geo::v128 Geo::operator-


public: Geo::v128 operator-
(
    Geo::v128Param lhs,
    Geo::v128Param rhs
)


Operator - (component-wise subtraction)


GEO_FORCE_INLINE Geo::v128 Geo::operator-


public: Geo::v128 operator-
(
    Geo::v128Param v
)


The unary - operator. Equivalent to (VZero() - v);.


GEO_FORCE_INLINE Geo::v128 Geo::operator*


public: Geo::v128 operator*
(
    Geo::v128Param lhs,
    Geo::v128Param rhs
)


Operator * (component-wise multiplication)


GEO_FORCE_INLINE Geo::v128 & Geo::operator*=


public: Geo::v128 & operator*=
(
    Geo::v128 & lhs,
    Geo::v128Param rhs
)


Inplace *.


GEO_FORCE_INLINE Geo::v128 Geo::operator/


public: Geo::v128 operator/
(
    Geo::v128Param lhs,
    Geo::v128Param rhs
)


Operator / (component-wise division)


GEO_FORCE_INLINE Geo::v128 & Geo::operator/=


public: Geo::v128 & operator/=
(
    Geo::v128 & lhs,
    Geo::v128Param rhs
)


Inplace /.


GEO_FORCE_INLINE Geo::v128 Geo::operator+


public: Geo::v128 operator+
(
    Geo::v128Param lhs,
    Geo::v128Param rhs
)


Operator + (component-wise addition)


GEO_FORCE_INLINE Geo::v128 Geo::operator+


public: Geo::v128 operator+
(
    Geo::v128Param v
)


The unary + operator (effectively a no-op)


GEO_FORCE_INLINE Geo::v128 & Geo::operator+=


public: Geo::v128 & operator+=
(
    Geo::v128 & lhs,
    Geo::v128Param rhs
)


Inplace +.


GEO_FORCE_INLINE Geo::v128 & Geo::operator-=


public: Geo::v128 & operator-=
(
    Geo::v128 & lhs,
    Geo::v128Param rhs
)


Inplace -.


Geo::GeoString<char> GEO_CALL Geo::V128ToUtf8String


public: Geo::GeoString< char > GEO_CALL V128ToUtf8String
(
    const Geo::v128 & v
)


Creates a GeoString representation of the vector (space-separated).

The ..XYZ versions return a string containing only the X, Y and Z components of the vector, the others include W.


Geo::GeoString<char> GEO_CALL Geo::V128ToUtf8StringXYZ


public: Geo::GeoString< char > GEO_CALL V128ToUtf8StringXYZ
(
    const Geo::v128 & v
)


Creates a GeoString representation of the vector (space-separated).

The ..XYZ versions return a string containing only the X, Y and Z components of the vector, the others include W.


GEO_FORCE_INLINE v128 Geo::VBroadcast


public: v128 VBroadcast
(
    float x
)


Construct a v128 by broadcasting a float into all elements.

This is particularly handy when you want to use the vpu to do regular fpu operations.


GEO_FORCE_INLINE v128 Geo::VBroadcastInt


public: v128 VBroadcastInt
(
    s32 x
)


Construct a v128 by converting an integer to a float and broadcasting it into all elements.


GEO_FORCE_INLINE v128 Geo::VCeil


public: v128 VCeil
(
    v128Param v
)


Return ceil(v).


v128 Geo::VCompareEquals


public: v128 VCompareEquals
(
    v128Param a,
    v128Param b
)


Compares all corresponding elements to see if a == b (exact equals).

Returns a mask with the result of all comparisons as true/false mask values.


v128 Geo::VCompareGE


public: v128 VCompareGE
(
    v128Param a,
    v128Param b
)


Compares all corresponding elements to see if a >= b.

Returns a mask with the result of all comparisons as true/false mask values.


v128 Geo::VCompareGT


public: v128 VCompareGT
(
    v128Param a,
    v128Param b
)


Compares all corresponding elements to see if a > b.

Returns a mask with the result of all comparisons as true/false mask values.


v128 Geo::VCompareIsFinite


public: v128 VCompareIsFinite
(
    v128Param v
)


Tests all elements of v to see if they are finite or not.

It returns a mask with true/false mask values with the result of these 4 tests. TODO - this function isn't complete yet as it doesn't detect INF values yet!


v128 Geo::VCompareIsNan


public: v128 VCompareIsNan
(
    v128Param v
)


Tests all elements of v to see if any of them are NANs.

It returns a mask with true/false mask values with the result of these 4 tests.


v128 Geo::VCompareLE


public: v128 VCompareLE
(
    v128Param a,
    v128Param b
)


Compares all corresponding elements to see if a <= b.

Returns a mask with the result of all comparisons as true/false mask values.


v128 Geo::VCompareLT


public: v128 VCompareLT
(
    v128Param a,
    v128Param b
)


Compares all corresponding elements to see if a < b.

Returns a mask with the result of all comparisons as true/false mask values.


v128 Geo::VCompareWithFlagsEquals


public: v128 VCompareWithFlagsEquals
(
    v128Param a,
    v128Param b,
    u32 & flags
)


Compares all corresponding elements to see if a == b (exact equals).

Returns a mask with the result of all comparisons as true/false mask values. It additionally sets flags to be a platform dependent value that encodes the result of the 4 comparisons. You can only use this flag value with the VTestFlags* functions. Do not assume any particular values of the flags as they vary between platforms. The flags enable you to branch from the result of a vpu comparison operation.


v128 Geo::VCompareWithFlagsGE


public: v128 VCompareWithFlagsGE
(
    v128Param a,
    v128Param b,
    u32 & flags
)


Compares all corresponding elements to see if a >= b.

Returns a mask with the result of all comparisons as true/false mask values. It additionally sets flags to be a platform dependent value that encodes the result of the 4 comparisions. You can only use this flag value with the VTestFlags* functions. Do not assume any particular values of the flags as they vary between platforms. The flags enable you to branch from the result of a vpu comparison operation.


v128 Geo::VCompareWithFlagsGT


public: v128 VCompareWithFlagsGT
(
    v128Param a,
    v128Param b,
    u32 & flags
)


Compares all corresponding elements to see if a > b.

Returns a mask with the result of all comparisons as true/false mask values. It additionally sets flags to be a platform dependent value that encodes the result of the 4 comparisons. You can only use this flag value with the VTestFlags* functions. Do not assume any particular values of the flags as they vary between platforms. The flags enable you to branch from the result of a vpu comparison operation.


v128 Geo::VCompareWithFlagsLE


public: v128 VCompareWithFlagsLE
(
    v128Param a,
    v128Param b,
    u32 & flags
)


Compares all corresponding elements to see if a <= b.

Returns a mask with the result of all comparisons as true/false mask values. It additionally sets flags to be a platform dependent value that encodes the result of the 4 comparisons. You can only use this flag value with the VTestFlags* functions. Do not assume any particular values of the flags as they vary between platforms. The flags enable you to branch from the result of a vpu comparison operation.


v128 Geo::VCompareWithFlagsLT


public: v128 VCompareWithFlagsLT
(
    v128Param a,
    v128Param b,
    u32 & flags
)


Compares all corresponding elements to see if a < b.

Returns a mask with the result of all comparisons as true/false mask values. It additionally sets flags to be a platform dependent value that encodes the result of the 4 comparisons. You can only use this flag value with the VTestFlags* functions. Do not assume any particular values of the flags as they vary between platforms. The flags enable you to branch from the result of a vpu comparison operation.


GEO_FORCE_INLINE v128 Geo::VConstruct


public: v128 VConstruct
(
    float x,
    float y,
    float z,
    float w
)


Construct a v128 from 4 floats. Fairly slow.


GEO_FORCE_INLINE v128 Geo::VConstructBitwise


public: v128 VConstructBitwise
(
    u32 x,
    u32 y,
    u32 z,
    u32 w
)


Re-intreprets 4 ints as floats and construct a vector from them.

This is for building a mask if you need one that this file doesn't provide (see below). It's also quite slow, so if you use the mask regularly you might want to declare a static aligned bit of memory and load the vector from that.


v128 Geo::VCross3


public: v128 VCross3
(
    v128Param lhs,
    v128Param rhs
)


Cross the first 3 elements of each.

Providing the w element of both is finite the resulting w will be 0. If it is not finite the nan or inf will be passed through to the w. (NB: on PPU, w is just cleared.)


GEO_FORCE_INLINE v128 Geo::VCross3ZeroW


public: v128 VCross3ZeroW
(
    v128Param lhs,
    v128Param rhs
)


Cross the first 3 elements of each.

The w element will be set to zero. The w elements of the parameters are not considered. Prefer this if you are not sure if the w elements of your parameters are finite or not.


GEO_FORCE_INLINE Geo::v128 Geo::VFrac


public: Geo::v128 VFrac
(
    Geo::v128Param v
)


Returns the fractional part of each element of v.


v128 Geo::VGetMaskNotSignBit


public: v128 VGetMaskNotSignBit()


Returns a mask with everything but the 4 sign bits set.


v128 Geo::VGetMaskSignBit


public: v128 VGetMaskSignBit()


Returns a mask with just the 4 sign bits set.


GEO_FORCE_INLINE v128 Geo::VLoadAligned


public: v128 VLoadAligned
(
    const float * vecToLoad
)


Load a 4-float array from 16-byte aligned memory.

Cannot be null. NOTE: the memory must be aligned or this will crash.


GEO_FORCE_INLINE v128 Geo::VLoadUnaligned


public: v128 VLoadUnaligned
(
    const float * vecToLoad
)


Load a 4-float array from arbitrarily aligned memory. Cannot be null.


GEO_FORCE_INLINE v128 Geo::VMadd


public: Geo::v128 VMadd
(
    Geo::v128Param a,
    Geo::v128Param b,
    Geo::v128Param c
)


This is a vector multiply accumulate operation returning (a * b) + c.


GEO_FORCE_INLINE v128 Geo::VNegate


public: v128 VNegate
(
    v128Param v
)


Return -v. You can use the operator overload instead if you prefer.


GEO_FORCE_INLINE v128 Geo::VOpAnd


public: Geo::v128 VOpAnd
(
    Geo::v128Param lhs,
    Geo::v128Param rhs
)


This is a bitwise & operation.

You can use this with masks to perform a number of useful operations, including zeroing elements. For example: v128 xz = myVec & VGetMaskXZ();


GEO_FORCE_INLINE v128 Geo::VOpOnesCompl


public: Geo::v128 VOpOnesCompl
(
    Geo::v128Param v
)


This is a bitwise ~ operation.

You can use this with masks generate the opposite mask.


GEO_FORCE_INLINE v128 Geo::VOpOr


public: Geo::v128 VOpOr
(
    Geo::v128Param lhs,
    Geo::v128Param rhs
)


This is a bitwise | operation.

You can use this with masks to perform a number of useful operations, including combining vectors and setting sign bits. For example: v128 xyzw = xyonly | zwonly; v128 xznegated = myVec | (VGetMaskSignBit() & VGetMaskXZ());


GEO_FORCE_INLINE v128 Geo::VOpXor


public: Geo::v128 VOpXor
(
    Geo::v128Param lhs,
    Geo::v128Param rhs
)


This is a bitwise ^ operation.

You can use this with masks to perform a number of useful operations, including toggling sign bits and building masks. For example: v128 xySignsSwapped = myVec ^ (VGetMaskSignBit() & VGetMaskXY());


GEO_FORCE_INLINE v128 Geo::VPackX4


public: GEO_FORCE_INLINEGeo::v128 VPackX4
(
    const Geo::v128 & x,
    const Geo::v128 & y,
    const Geo::v128 & z,
    const Geo::v128 & w
)


Packs the X component from each of the four vectors into a single vector.


v128 Geo::VPerpendicular


public: v128 VPerpendicular
(
    v128Param v,
    float ep
)


Returns a vector perpendicular to v (with one of its components being zero).

Must pass a vector with at least one component > g_VecEpsilonF to avoid nasty interactions with VNormalise.


v128 Geo::VRecip


public: v128 VRecip
(
    v128Param v
)


Return 1.f / v. (inaccurate)


GEO_FORCE_INLINE v128 Geo::VRecipFast


public: v128 VRecipFast
(
    v128Param v
)


Return 1.f / v. (fast approximate where available. If not, implemented as VRecip)


v128 Geo::VRecipSqrt


public: v128 VRecipSqrt
(
    v128Param v
)


Return 1.f / sqrt(v). (inaccurate)


v128 Geo::VRecipSqrtAccurate


public: v128 VRecipSqrtAccurate
(
    v128Param v
)


Return 1.f / sqrt(v). (more accurate)


v128 Geo::VRecipSqrtFast


public: v128 VRecipSqrtFast
(
    v128Param v
)


Return 1.f / sqrt(v). (inaccurate)


v128 Geo::VReverse


public: v128 VReverse
(
    v128Param v
)


Reverses the order of the components from xyzw to wzyx.


v128 Geo::VShuffle


public: v128 VShuffle
(
    v128Param v,
    int x,
    int y,
    int z,
    int w
)


Returns the specified permutation of the parameter vector. Any permutation is valid.


GEO_FORCE_INLINE v128 Geo::VSqrt


public: v128 VSqrt
(
    v128Param v
)


Return sqrt(v). (more inaccurate than the reciprocal version on non-sse hardware)


bool Geo::VTestFlagsAllFalse


public: bool VTestFlagsAllFalse
(
    u32 flags
)


Tests the flags produced by the VCompareWithFlags* operations.

This returns true if all 4 comparisons were false.


bool Geo::VTestFlagsAllTrue


public: bool VTestFlagsAllTrue
(
    u32 flags
)


Tests the flags produced by the VCompareWithFlags* operations.

This returns true if all 4 comparisons were true.


bool Geo::VTestFlagsSomeFalse


public: bool VTestFlagsSomeFalse
(
    u32 flags
)


Tests the flags produced by the VCompareWithFlags* operations.

This returns true if one or more of the 4 comparisons were false.


bool Geo::VTestFlagsSomeTrue


public: bool VTestFlagsSomeTrue
(
    u32 flags
)


Tests the flags produced by the VCompareWithFlags* operations.

This returns true if one or more of the 4 comparisons were true.


GEO_FORCE_INLINE v128 Geo::VZero


public: v128 VZero()


A fully-zeroed out vector.


eVShufflePosition


public: enum eVShufflePosition
{
    VSHUF_X = 0,
    VSHUF_Y = 1,
    VSHUF_Z = 2,
    VSHUF_W = 3
}


Shuffle constants for the GEO_VSHUFFLE macro.

enumerators
VSHUF_X
VSHUF_Y
VSHUF_Z
VSHUF_W
  • No labels