Skyscraper 2.0
xr::math Namespace Reference

Namespaces

namespace  detail
 
namespace  Pose
 
namespace  Quaternion
 

Classes

struct  NearFar
 
struct  ViewProjection
 

Functions

template<typename X , typename Y >
constexpr const X & cast (const Y &value)=delete
 
DirectX::XMVECTOR XM_CALLCONV LoadXrVector2 (const XrVector2f &vector)
 
DirectX::XMVECTOR XM_CALLCONV LoadXrVector3 (const XrVector3f &vector)
 
DirectX::XMVECTOR XM_CALLCONV LoadXrVector4 (const XrVector4f &vector)
 
DirectX::XMVECTOR XM_CALLCONV LoadXrQuaternion (const XrQuaternionf &quaternion)
 
DirectX::XMMATRIX XM_CALLCONV LoadXrPose (const XrPosef &rigidTransform)
 
DirectX::XMMATRIX XM_CALLCONV LoadInvertedXrPose (const XrPosef &rigidTransform)
 
DirectX::XMVECTOR XM_CALLCONV LoadXrExtent (const XrExtent2Df &extend)
 
void XM_CALLCONV StoreXrVector2 (XrVector2f *outVec, DirectX::FXMVECTOR inVec)
 
void XM_CALLCONV StoreXrVector3 (XrVector3f *outVec, DirectX::FXMVECTOR inVec)
 
void XM_CALLCONV StoreXrVector4 (XrVector4f *outVec, DirectX::FXMVECTOR inVec)
 
void XM_CALLCONV StoreXrQuaternion (XrQuaternionf *outQuat, DirectX::FXMVECTOR inQuat)
 
bool XM_CALLCONV StoreXrPose (XrPosef *out, DirectX::FXMMATRIX matrix)
 
void XM_CALLCONV StoreXrExtent (XrExtent2Df *extend, DirectX::FXMVECTOR inVec)
 
DirectX::XMMATRIX ComposeProjectionMatrix (const XrFovf &fov, const NearFar &nearFar)
 
NearFar GetProjectionNearFar (const DirectX::XMFLOAT4X4 &projectionMatrix)
 
XrFovf DecomposeProjectionMatrix (const DirectX::XMFLOAT4X4 &projectionMatrix)
 
 DEFINE_CAST (XrVector2f, DirectX::XMFLOAT2)
 
 DEFINE_CAST (DirectX::XMFLOAT2, XrVector2f)
 
 DEFINE_CAST (XrVector3f, DirectX::XMFLOAT3)
 
 DEFINE_CAST (DirectX::XMFLOAT3, XrVector3f)
 
 DEFINE_CAST (XrVector4f, DirectX::XMFLOAT4)
 
 DEFINE_CAST (DirectX::XMFLOAT4, XrVector4f)
 
 DEFINE_CAST (XrQuaternionf, DirectX::XMFLOAT4)
 
 DEFINE_CAST (DirectX::XMFLOAT4, XrQuaternionf)
 
 DEFINE_CAST (XrExtent2Di, DirectX::XMINT2)
 
 DEFINE_CAST (DirectX::XMINT2, XrExtent2Di)
 
 DEFINE_CAST (XrExtent2Df, DirectX::XMFLOAT2)
 
 DEFINE_CAST (DirectX::XMFLOAT2, XrExtent2Df)
 
 DEFINE_CAST (XrColor4f, DirectX::XMFLOAT4)
 
 DEFINE_CAST (DirectX::XMFLOAT4, XrColor4f)
 
 VECTOR2F_OPERATOR (+)
 
 VECTOR2F_OPERATOR (-)
 
VECTOR2F_OPERATOR * VECTOR2F_OPERATOR (/);#define VECTOR2F_OPERATOR(op) \ \ \ VECTOR2F_OPERATOR(+
 
 VECTOR3F_OPERATOR (-)
 
VECTOR3F_OPERATOR * VECTOR3F_OPERATOR (/);#define VECTOR3F_OPERATOR(op) \ \ \ VECTOR3F_OPERATOR(+
 
XrPosef operator* (const XrPosef &a, const XrPosef &b)
 
float Dot (const XrVector3f &a, const XrVector3f &b)
 
float Length (const XrVector3f &v)
 
XrVector3f Normalize (const XrVector3f &a)
 
bool IsInfiniteNearPlaneProjectionMatrix (const DirectX::XMFLOAT4X4 &p)
 
bool IsInfiniteFarPlaneProjectionMatrix (const DirectX::XMFLOAT4X4 &p)
 
void ValidateProjectionMatrix (const DirectX::XMFLOAT4X4 &p)
 
template<uint32_t alignment>
constexpr uint32_t AlignTo (uint32_t n)
 
constexpr uint32_t DivideRoundingUp (uint32_t x, uint32_t y)
 

Variables

constexpr float QuaternionEpsilon = 0.01f
 
constexpr float OneOverFloatEpsilon = 1.0f / std::numeric_limits<float>::epsilon()
 

Function Documentation

◆ AlignTo()

template<uint32_t alignment>
uint32_t xr::math::AlignTo ( uint32_t n)
inlineconstexpr

Definition at line 599 of file XrMath.h.

◆ cast()

template<typename X , typename Y >
const X & xr::math::cast ( const Y & value)
constexprdelete

◆ ComposeProjectionMatrix()

DirectX::XMMATRIX xr::math::ComposeProjectionMatrix ( const XrFovf & fov,
const NearFar & nearFar )
inline

Definition at line 460 of file XrMath.h.

References xr::math::NearFar::Far, and xr::math::NearFar::Near.

◆ DecomposeProjectionMatrix()

XrFovf xr::math::DecomposeProjectionMatrix ( const DirectX::XMFLOAT4X4 & projectionMatrix)
inline

Definition at line 581 of file XrMath.h.

References ValidateProjectionMatrix().

Here is the call graph for this function:

◆ DEFINE_CAST() [1/14]

xr::math::DEFINE_CAST ( DirectX::XMFLOAT2 ,
XrExtent2Df  )

◆ DEFINE_CAST() [2/14]

xr::math::DEFINE_CAST ( DirectX::XMFLOAT2 ,
XrVector2f  )

◆ DEFINE_CAST() [3/14]

xr::math::DEFINE_CAST ( DirectX::XMFLOAT3 ,
XrVector3f  )

◆ DEFINE_CAST() [4/14]

xr::math::DEFINE_CAST ( DirectX::XMFLOAT4 ,
XrColor4f  )

◆ DEFINE_CAST() [5/14]

xr::math::DEFINE_CAST ( DirectX::XMFLOAT4 ,
XrQuaternionf  )

◆ DEFINE_CAST() [6/14]

xr::math::DEFINE_CAST ( DirectX::XMFLOAT4 ,
XrVector4f  )

◆ DEFINE_CAST() [7/14]

xr::math::DEFINE_CAST ( DirectX::XMINT2 ,
XrExtent2Di  )

◆ DEFINE_CAST() [8/14]

xr::math::DEFINE_CAST ( XrColor4f ,
DirectX::XMFLOAT4  )

◆ DEFINE_CAST() [9/14]

xr::math::DEFINE_CAST ( XrExtent2Df ,
DirectX::XMFLOAT2  )

◆ DEFINE_CAST() [10/14]

xr::math::DEFINE_CAST ( XrExtent2Di ,
DirectX::XMINT2  )

◆ DEFINE_CAST() [11/14]

xr::math::DEFINE_CAST ( XrQuaternionf ,
DirectX::XMFLOAT4  )

◆ DEFINE_CAST() [12/14]

xr::math::DEFINE_CAST ( XrVector2f ,
DirectX::XMFLOAT2  )

◆ DEFINE_CAST() [13/14]

xr::math::DEFINE_CAST ( XrVector3f ,
DirectX::XMFLOAT3  )

◆ DEFINE_CAST() [14/14]

xr::math::DEFINE_CAST ( XrVector4f ,
DirectX::XMFLOAT4  )

◆ DivideRoundingUp()

uint32_t xr::math::DivideRoundingUp ( uint32_t x,
uint32_t y )
inlineconstexpr

Definition at line 604 of file XrMath.h.

◆ Dot()

float xr::math::Dot ( const XrVector3f & a,
const XrVector3f & b )
inline

Definition at line 444 of file XrMath.h.

Referenced by Length(), and Normalize().

◆ GetProjectionNearFar()

NearFar xr::math::GetProjectionNearFar ( const DirectX::XMFLOAT4X4 & projectionMatrix)
inline

◆ IsInfiniteFarPlaneProjectionMatrix()

bool xr::math::IsInfiniteFarPlaneProjectionMatrix ( const DirectX::XMFLOAT4X4 & p)
inline

Definition at line 546 of file XrMath.h.

Referenced by GetProjectionNearFar().

◆ IsInfiniteNearPlaneProjectionMatrix()

bool xr::math::IsInfiniteNearPlaneProjectionMatrix ( const DirectX::XMFLOAT4X4 & p)
inline

Definition at line 542 of file XrMath.h.

Referenced by GetProjectionNearFar().

◆ Length()

float xr::math::Length ( const XrVector3f & v)
inline

Definition at line 448 of file XrMath.h.

References Dot().

Here is the call graph for this function:

◆ LoadInvertedXrPose()

DirectX::XMMATRIX XM_CALLCONV xr::math::LoadInvertedXrPose ( const XrPosef & rigidTransform)
inline

Definition at line 263 of file XrMath.h.

References xr::math::Pose::Invert(), and LoadXrPose().

Here is the call graph for this function:

◆ LoadXrExtent()

DirectX::XMVECTOR XM_CALLCONV xr::math::LoadXrExtent ( const XrExtent2Df & extend)
inline

Definition at line 251 of file XrMath.h.

References cast().

Here is the call graph for this function:

◆ LoadXrPose()

DirectX::XMMATRIX XM_CALLCONV xr::math::LoadXrPose ( const XrPosef & rigidTransform)
inline

Definition at line 255 of file XrMath.h.

References LoadXrQuaternion(), and LoadXrVector3().

Referenced by Ogre::OpenXRRenderWindow::_beginUpdate(), and LoadInvertedXrPose().

Here is the call graph for this function:

◆ LoadXrQuaternion()

DirectX::XMVECTOR XM_CALLCONV xr::math::LoadXrQuaternion ( const XrQuaternionf & quaternion)
inline

Definition at line 247 of file XrMath.h.

References cast().

Referenced by xr::math::Pose::Invert(), xr::math::Quaternion::Length(), LoadXrPose(), xr::math::Pose::Multiply(), and xr::math::Quaternion::Slerp().

Here is the call graph for this function:

◆ LoadXrVector2()

DirectX::XMVECTOR XM_CALLCONV xr::math::LoadXrVector2 ( const XrVector2f & vector)

◆ LoadXrVector3()

DirectX::XMVECTOR XM_CALLCONV xr::math::LoadXrVector3 ( const XrVector3f & vector)
inline

Definition at line 239 of file XrMath.h.

References cast().

Referenced by xr::math::Pose::Invert(), LoadXrPose(), xr::math::Pose::LookAt(), xr::math::Pose::Multiply(), and xr::math::Quaternion::RotationAxisAngle().

Here is the call graph for this function:

◆ LoadXrVector4()

DirectX::XMVECTOR XM_CALLCONV xr::math::LoadXrVector4 ( const XrVector4f & vector)
inline

Definition at line 243 of file XrMath.h.

References cast().

Here is the call graph for this function:

◆ Normalize()

XrVector3f xr::math::Normalize ( const XrVector3f & a)
inline

Definition at line 452 of file XrMath.h.

References Dot().

Here is the call graph for this function:

◆ operator*()

XrPosef xr::math::operator* ( const XrPosef & a,
const XrPosef & b )
inline

Definition at line 440 of file XrMath.h.

References xr::math::Pose::Multiply().

Here is the call graph for this function:

◆ StoreXrExtent()

void XM_CALLCONV xr::math::StoreXrExtent ( XrExtent2Df * extend,
DirectX::FXMVECTOR inVec )
inline

Definition at line 283 of file XrMath.h.

References xr::math::detail::implement_math_cast().

Here is the call graph for this function:

◆ StoreXrPose()

bool XM_CALLCONV xr::math::StoreXrPose ( XrPosef * out,
DirectX::FXMMATRIX matrix )
inline

Definition at line 287 of file XrMath.h.

References StoreXrQuaternion(), and StoreXrVector3().

Referenced by xr::math::Pose::LookAt().

Here is the call graph for this function:

◆ StoreXrQuaternion()

void XM_CALLCONV xr::math::StoreXrQuaternion ( XrQuaternionf * outQuat,
DirectX::FXMVECTOR inQuat )
inline

◆ StoreXrVector2()

void XM_CALLCONV xr::math::StoreXrVector2 ( XrVector2f * outVec,
DirectX::FXMVECTOR inVec )
inline

Definition at line 267 of file XrMath.h.

References xr::math::detail::implement_math_cast().

Here is the call graph for this function:

◆ StoreXrVector3()

void XM_CALLCONV xr::math::StoreXrVector3 ( XrVector3f * outVec,
DirectX::FXMVECTOR inVec )
inline

Definition at line 271 of file XrMath.h.

References xr::math::detail::implement_math_cast().

Referenced by xr::math::Pose::Invert(), xr::math::Pose::Multiply(), and StoreXrPose().

Here is the call graph for this function:

◆ StoreXrVector4()

void XM_CALLCONV xr::math::StoreXrVector4 ( XrVector4f * outVec,
DirectX::FXMVECTOR inVec )
inline

Definition at line 275 of file XrMath.h.

References xr::math::detail::implement_math_cast().

Here is the call graph for this function:

◆ ValidateProjectionMatrix()

void xr::math::ValidateProjectionMatrix ( const DirectX::XMFLOAT4X4 & p)
inline

Definition at line 550 of file XrMath.h.

Referenced by DecomposeProjectionMatrix(), and GetProjectionNearFar().

◆ VECTOR2F_OPERATOR() [1/3]

xr::math::VECTOR2F_OPERATOR ( + )

◆ VECTOR2F_OPERATOR() [2/3]

xr::math::VECTOR2F_OPERATOR ( - )

◆ VECTOR2F_OPERATOR() [3/3]

VECTOR2F_OPERATOR * xr::math::VECTOR2F_OPERATOR ( / )

◆ VECTOR3F_OPERATOR() [1/2]

xr::math::VECTOR3F_OPERATOR ( - )

◆ VECTOR3F_OPERATOR() [2/2]

VECTOR3F_OPERATOR * xr::math::VECTOR3F_OPERATOR ( / )

Definition at line 231 of file XrMath.h.

Variable Documentation

◆ OneOverFloatEpsilon

float xr::math::OneOverFloatEpsilon = 1.0f / std::numeric_limits<float>::epsilon()
constexpr

Definition at line 15 of file XrMath.h.

◆ QuaternionEpsilon

float xr::math::QuaternionEpsilon = 0.01f
constexpr

Definition at line 12 of file XrMath.h.

Referenced by xr::math::Quaternion::IsNormalized().