XII Release 0.1.0
Loading...
Searching...
No Matches
xiiGraphicsUtils Namespace Reference

Copyright (c) Theophilus Eriata. All Rights Reserved. More...

Enumerations

enum class  FrustumPlaneInterpolation { LeftToRight , BottomToTop , NearToFar }

Functions

XII_FOUNDATION_DLL void ConvertScreenPixelPosToNormalizedPos (const xiiUInt32 uiViewportX, const xiiUInt32 uiViewportY, const xiiUInt32 uiViewportWidth, const xiiUInt32 uiViewportHeight, xiiVec3 &inout_vPixelPos)
 Converts a screen-space position from pixel coordinates to normalized coordinates.
XII_FOUNDATION_DLL void ConvertScreenNormalizedPosToPixelPos (const xiiUInt32 uiViewportX, const xiiUInt32 uiViewportY, const xiiUInt32 uiViewportWidth, const xiiUInt32 uiViewportHeight, xiiVec3 &inout_vNormalizedPos)
 Converts a screen-space position from normalized coordinates to pixel coordinates.
XII_FOUNDATION_DLL xiiResult ConvertWorldPosToScreenPos (const xiiMat4 &mModelViewProjection, const xiiUInt32 uiViewportX, const xiiUInt32 uiViewportY, const xiiUInt32 uiViewportWidth, const xiiUInt32 uiViewportHeight, const xiiVec3 &vPoint, xiiVec3 &out_vScreenPos, xiiClipSpaceDepthRange::Enum depthRange=xiiClipSpaceDepthRange::Default)
XII_FOUNDATION_DLL xiiResult ConvertWorldPosToScreenPos (const xiiMat4 &mModelViewProjection, const xiiVec3 &vPoint, xiiVec3 &out_vScreenPosNormalized, xiiClipSpaceDepthRange::Enum depthRange=xiiClipSpaceDepthRange::Default)
 Overload of ConvertWorldPosToScreenPos() that returns the screen position in normalized space ([0; 1] range) and therefore doesn't require the viewport dimensions.
XII_FOUNDATION_DLL xiiResult ConvertScreenPosToWorldPos (const xiiMat4 &mInverseModelViewProjection, const xiiUInt32 uiViewportX, const xiiUInt32 uiViewportY, const xiiUInt32 uiViewportWidth, const xiiUInt32 uiViewportHeight, const xiiVec3 &vScreenPixelPos, xiiVec3 &out_vPoint, xiiVec3 *out_pDirection=nullptr, xiiClipSpaceDepthRange::Enum depthRange=xiiClipSpaceDepthRange::Default)
XII_FOUNDATION_DLL xiiResult ConvertScreenPosToWorldPos (const xiiMat4 &mInverseModelViewProjection, const xiiVec3 &vNormalizedScreenPos, xiiVec3 &out_vPoint, xiiVec3 *out_pDirection=nullptr, xiiClipSpaceDepthRange::Enum depthRange=xiiClipSpaceDepthRange::Default)
 Overload of ConvertScreenPosToWorldPos() that takes the coordinate in normalized space ([0; 1]) and therefore doesn't require the viewport dimensions.
XII_FOUNDATION_DLL xiiResult ConvertScreenPosToWorldPos (const xiiMat4d &mInverseModelViewProjection, const xiiUInt32 uiViewportX, const xiiUInt32 uiViewportY, const xiiUInt32 uiViewportWidth, const xiiUInt32 uiViewportHeight, const xiiVec3 &vScreenPixelPos, xiiVec3 &out_vPoint, xiiVec3 *out_pDirection=nullptr, xiiClipSpaceDepthRange::Enum depthRange=xiiClipSpaceDepthRange::Default)
 A double-precision version of ConvertScreenPosToWorldPos().
XII_FOUNDATION_DLL xiiResult ConvertScreenPosToWorldPos (const xiiMat4d &mInverseModelViewProjection, const xiiVec3 &vNormalizedScreenPos, xiiVec3 &out_vPoint, xiiVec3 *out_pDirection=nullptr, xiiClipSpaceDepthRange::Enum depthRange=xiiClipSpaceDepthRange::Default)
 Double-precision overload of ConvertScreenPosToWorldPos() that takes the coordinate in normalized space ([0; 1]) and therefore doesn't require the viewport dimensions.
XII_FOUNDATION_DLL bool IsTriangleFlipRequired (const xiiMat3 &mTransformation)
XII_FOUNDATION_DLL void ConvertProjectionMatrixDepthRange (xiiMat4 &inout_mMatrix, xiiClipSpaceDepthRange::Enum srcDepthRange, xiiClipSpaceDepthRange::Enum dstDepthRange)
 Converts a projection or view-projection matrix from one depth-range convention to another.
XII_FOUNDATION_DLL void ExtractPerspectiveMatrixFieldOfView (const xiiMat4 &mProjectionMatrix, xiiAngle &out_fovX, xiiAngle &out_fovY)
XII_FOUNDATION_DLL void ExtractPerspectiveMatrixFieldOfView (const xiiMat4 &mProjectionMatrix, xiiAngle &out_fovLeft, xiiAngle &out_fovRight, xiiAngle &out_fovBottom, xiiAngle &out_fovTop, xiiClipSpaceYMode::Enum range=xiiClipSpaceYMode::Regular)
XII_FOUNDATION_DLL xiiResult ExtractPerspectiveMatrixFieldOfView (const xiiMat4 &mProjectionMatrix, float &out_fLeft, float &out_fRight, float &out_fBottom, float &out_fTop, xiiClipSpaceDepthRange::Enum depthRange=xiiClipSpaceDepthRange::Default, xiiClipSpaceYMode::Enum range=xiiClipSpaceYMode::Regular)
XII_FOUNDATION_DLL xiiResult ExtractNearAndFarClipPlaneDistances (float &out_fNear, float &out_fFar, const xiiMat4 &mProjectionMatrix, xiiClipSpaceDepthRange::Enum depthRange=xiiClipSpaceDepthRange::Default)
XII_FOUNDATION_DLL xiiPlane ComputeInterpolatedFrustumPlane (FrustumPlaneInterpolation dir, float fLerpFactor, const xiiMat4 &mProjectionMatrix, xiiClipSpaceDepthRange::Enum depthRange=xiiClipSpaceDepthRange::Default)
XII_FOUNDATION_DLL xiiMat4 CreatePerspectiveProjectionMatrix (float fViewWidth, float fViewHeight, float fNearZ, float fFarZ, xiiClipSpaceDepthRange::Enum depthRange=xiiClipSpaceDepthRange::Default, xiiClipSpaceYMode::Enum range=xiiClipSpaceYMode::Regular, xiiHandedness::Enum handedness=xiiHandedness::Default)
XII_FOUNDATION_DLL xiiMat4 CreatePerspectiveProjectionMatrix (float fLeft, float fRight, float fBottom, float fTop, float fNearZ, float fFarZ, xiiClipSpaceDepthRange::Enum depthRange=xiiClipSpaceDepthRange::Default, xiiClipSpaceYMode::Enum range=xiiClipSpaceYMode::Regular, xiiHandedness::Enum handedness=xiiHandedness::Default)
 Creates a perspective projection matrix.
XII_FOUNDATION_DLL xiiMat4 CreatePerspectiveProjectionMatrixFromFovX (xiiAngle fieldOfViewX, float fAspectRatioWidthDivHeight, float fNearZ, float fFarZ, xiiClipSpaceDepthRange::Enum depthRange=xiiClipSpaceDepthRange::Default, xiiClipSpaceYMode::Enum range=xiiClipSpaceYMode::Regular, xiiHandedness::Enum handedness=xiiHandedness::Default)
XII_FOUNDATION_DLL xiiMat4 CreatePerspectiveProjectionMatrixFromFovY (xiiAngle fieldOfViewY, float fAspectRatioWidthDivHeight, float fNearZ, float fFarZ, xiiClipSpaceDepthRange::Enum depthRange=xiiClipSpaceDepthRange::Default, xiiClipSpaceYMode::Enum range=xiiClipSpaceYMode::Regular, xiiHandedness::Enum handedness=xiiHandedness::Default)
XII_FOUNDATION_DLL xiiMat4 CreateOrthographicProjectionMatrix (float fViewWidth, float fViewHeight, float fNearZ, float fFarZ, xiiClipSpaceDepthRange::Enum depthRange=xiiClipSpaceDepthRange::Default, xiiClipSpaceYMode::Enum range=xiiClipSpaceYMode::Regular, xiiHandedness::Enum handedness=xiiHandedness::Default)
XII_FOUNDATION_DLL xiiMat4 CreateOrthographicProjectionMatrix (float fLeft, float fRight, float fBottom, float fTop, float fNearZ, float fFarZ, xiiClipSpaceDepthRange::Enum depthRange=xiiClipSpaceDepthRange::Default, xiiClipSpaceYMode::Enum range=xiiClipSpaceYMode::Regular, xiiHandedness::Enum handedness=xiiHandedness::Default)
 Creates an orthographic projection matrix.
XII_FOUNDATION_DLL xiiMat3 CreateLookAtViewMatrix (const xiiVec3 &vTarget, const xiiVec3 &vUpDir, xiiHandedness::Enum handedness=xiiHandedness::Default)
XII_FOUNDATION_DLL xiiMat3 CreateInverseLookAtViewMatrix (const xiiVec3 &vTarget, const xiiVec3 &vUpDir, xiiHandedness::Enum handedness=xiiHandedness::Default)
 Same as CreateLookAtViewMatrix() but returns the inverse matrix.
XII_FOUNDATION_DLL xiiMat4 CreateLookAtViewMatrix (const xiiVec3 &vEyePos, const xiiVec3 &vLookAtPos, const xiiVec3 &vUpDir, xiiHandedness::Enum handedness=xiiHandedness::Default)
 Returns a look-at matrix with both rotation and translation.
XII_FOUNDATION_DLL xiiMat4 CreateInverseLookAtViewMatrix (const xiiVec3 &vEyePos, const xiiVec3 &vLookAtPos, const xiiVec3 &vUpDir, xiiHandedness::Enum handedness=xiiHandedness::Default)
 Same as CreateLookAtViewMatrix() but returns the inverse matrix.
XII_FOUNDATION_DLL xiiMat4 CreateViewMatrix (const xiiVec3 &vPosition, const xiiVec3 &vForwardDir, const xiiVec3 &vRightDir, const xiiVec3 &vUpDir, xiiHandedness::Enum handedness=xiiHandedness::Default)
XII_FOUNDATION_DLL xiiMat4 CreateInverseViewMatrix (const xiiVec3 &vPosition, const xiiVec3 &vForwardDir, const xiiVec3 &vRightDir, const xiiVec3 &vUpDir, xiiHandedness::Enum handedness=xiiHandedness::Default)
 Similar to CreateViewMatrix() but creates the inverse matrix.
XII_FOUNDATION_DLL void DecomposeViewMatrix (xiiVec3 &out_vPosition, xiiVec3 &out_vForwardDir, xiiVec3 &out_vRightDir, xiiVec3 &out_vUpDir, const xiiMat4 &mViewMatrix, xiiHandedness::Enum handedness=xiiHandedness::Default)
XII_FOUNDATION_DLL xiiResult ComputeBarycentricCoordinates (xiiVec3 &out_vCoordinates, const xiiVec3 &v0, const xiiVec3 &v1, const xiiVec3 &v2, const xiiVec3 &vPos)
XII_FOUNDATION_DLL xiiResult ComputeBarycentricCoordinates (xiiVec3 &out_vCoordinates, const xiiVec2 &v0, const xiiVec2 &v1, const xiiVec2 &v2, const xiiVec2 &vPos)
float CalculateSphereScreenCoverage (const xiiBoundingSphere &sphere, const xiiVec3 &vCameraPosition, xiiAngle perspectiveCameraFov)
float CalculateSphereScreenCoverage (float fSphereRadius, float fOrthoCameraDimensions)
XII_GRAPHICSCORE_DLL void CreateSimpleASCIIFontTexture (xiiImage &ref_img, bool bSetEmptyToUnknown=false)

Detailed Description

Copyright (c) Theophilus Eriata. All Rights Reserved.

Function Documentation

◆ CalculateSphereScreenCoverage() [1/2]

float xiiGraphicsUtils::CalculateSphereScreenCoverage ( const xiiBoundingSphere & sphere,
const xiiVec3 & vCameraPosition,
xiiAngle perspectiveCameraFov )
inline

Returns a coverage value of how much space a sphere at a given location would take up on screen using a perspective projection.

The coverage value is close to 0 for very small or far away spheres and approaches 1 when the projected sphere would take up the entire screen. The calculation is resolution independent and also doesn't take into account whether the sphere is inside the view frustum at all. Thus the value doesn't change depending on camera view direction, it only depends on distance and the camera's field-of-view. Values (much) larger than 1 are possible.

Note
Only one camera FOV angle is used for the calculation, pass in either the horizontal or vertical FOV angle, depending on what is most relevant to you. Typically the 'fixed' angle is used (usually the vertical one) since the other one depends on the window size.

◆ CalculateSphereScreenCoverage() [2/2]

float xiiGraphicsUtils::CalculateSphereScreenCoverage ( float fSphereRadius,
float fOrthoCameraDimensions )
inline

Returns a coverage value of how much space a sphere of a given size would take up on screen using an orthographic projection.

The coverage value is close to 0 for very small spheres and approaches 1 when the projected sphere would take up the entire screen. The calculation is resolution independent and also doesn't take into account whether the sphere is inside the view frustum at all. Thus the value doesn't change depending on camera view direction. In orthographic projections even the distance to the camera is irrelevant, only the dimensions of the ortho camera are needed. Values (much) larger than 1 are possible.

Note
Only one camera dimension is used for the calculation, pass in either the X or Y dimension, depending on what is most relevant to you. Typically the 'fixed' dimension is used (usually Y) since the other one depends on the window size.

◆ ComputeBarycentricCoordinates() [1/2]

xiiResult xiiGraphicsUtils::ComputeBarycentricCoordinates ( xiiVec3 & out_vCoordinates,
const xiiVec2 & v0,
const xiiVec2 & v1,
const xiiVec2 & v2,
const xiiVec2 & vPos )

Computes the barycentric coordinates of a point in a 2D triangle.

Returns
If the triangle is degenerate (all points on a line, or two points identical), the function returns XII_FAILURE.

◆ ComputeBarycentricCoordinates() [2/2]

xiiResult xiiGraphicsUtils::ComputeBarycentricCoordinates ( xiiVec3 & out_vCoordinates,
const xiiVec3 & v0,
const xiiVec3 & v1,
const xiiVec3 & v2,
const xiiVec3 & vPos )

Computes the barycentric coordinates of a point in a 3D triangle.

Returns
If the triangle is degenerate (all points on a line, or two points identical), the function returns XII_FAILURE.

◆ ComputeInterpolatedFrustumPlane()

xiiPlane xiiGraphicsUtils::ComputeInterpolatedFrustumPlane ( FrustumPlaneInterpolation dir,
float fLerpFactor,
const xiiMat4 & mProjectionMatrix,
xiiClipSpaceDepthRange::Enum depthRange = xiiClipSpaceDepthRange::Default )

Computes an interpolated frustum plane by using linear interpolation in normalized clip space.

Along left/right, up/down this makes it easy to create a regular grid of planes. Along near/far creating planes at regular intervals will result in planes in world-space that represent the same amount of depth-precision.

Parameters
dirSpecifies which planes to interpolate.
fLerpFactorThe interpolation coefficient (usually in the interval [0;1]).

◆ ConvertScreenPixelPosToNormalizedPos()

void xiiGraphicsUtils::ConvertScreenPixelPosToNormalizedPos ( const xiiUInt32 uiViewportX,
const xiiUInt32 uiViewportY,
const xiiUInt32 uiViewportWidth,
const xiiUInt32 uiViewportHeight,
xiiVec3 & inout_vPixelPos )

Converts a screen-space position from pixel coordinates to normalized coordinates.

Copyright (c) Theophilus Eriata. All Rights Reserved.

◆ ConvertScreenPosToWorldPos()

xiiResult xiiGraphicsUtils::ConvertScreenPosToWorldPos ( const xiiMat4 & mInverseModelViewProjection,
const xiiUInt32 uiViewportX,
const xiiUInt32 uiViewportY,
const xiiUInt32 uiViewportWidth,
const xiiUInt32 uiViewportHeight,
const xiiVec3 & vScreenPixelPos,
xiiVec3 & out_vPoint,
xiiVec3 * out_pDirection = nullptr,
xiiClipSpaceDepthRange::Enum depthRange = xiiClipSpaceDepthRange::Default )

Takes the screen space position (including depth in [0;1] range) and converts it into a world space position.

Parameters
InverseModelViewProjectionThe inverse of the Model-View-Projection matrix that is used by the camera.
DepthRangeThe depth range that is used by this projection matrix.
See also
xiiClipSpaceDepthRange

Returns XII_FAILURE when the screen coordinate could not be converted to a world position, which should generally not be possible as long as the coordinate is actually inside the viewport.

Optionally this function also computes the direction vector through the world space position, that should be used for picking operations. Note that for perspective cameras this is the same as the direction from the camera position to the computed point, but for orthographic cameras it is not (it's simply the forward vector of the camera). This function handles both cases properly.

The z value of vScreenPixelPos is always expected to be in [0; 1] range (meaning 0 is at the near plane, 1 at the far plane), even on platforms that use [-1; +1] range for clip-space z values. The DepthRange parameter needs to be correct to handle this case properly.

vScreenPixelPos is expected to be in range [viewport x/y; viewport width/height]. There is an overload below that takes just a normalized value in range [0; 1].

◆ ConvertWorldPosToScreenPos()

xiiResult xiiGraphicsUtils::ConvertWorldPosToScreenPos ( const xiiMat4 & mModelViewProjection,
const xiiUInt32 uiViewportX,
const xiiUInt32 uiViewportY,
const xiiUInt32 uiViewportWidth,
const xiiUInt32 uiViewportHeight,
const xiiVec3 & vPoint,
xiiVec3 & out_vScreenPos,
xiiClipSpaceDepthRange::Enum depthRange = xiiClipSpaceDepthRange::Default )

Projects the given point from 3D world space into screen space, if possible.

Parameters
ModelViewProjectionThe Model-View-Projection matrix that is used by the camera.
DepthRangeThe depth range that is used by this projection matrix.
See also
xiiClipSpaceDepthRange

Returns XII_FAILURE, if the point could not be projected into screen space.

Note
The function reports XII_SUCCESS, when the point could be projected, however, that does not mean that the point actually lies within the viewport, it might still be outside the viewport.

out_vScreenPos.z is the depth of the point in [0;1] range. The z value is always 'normalized' to this range (as long as the DepthRange parameter is correct), to make it easier to make subsequent code platform independent.

◆ CreateLookAtViewMatrix()

xiiMat3 xiiGraphicsUtils::CreateLookAtViewMatrix ( const xiiVec3 & vTarget,
const xiiVec3 & vUpDir,
xiiHandedness::Enum handedness = xiiHandedness::Default )

Returns a look-at matrix (only direction, no translation).

Since this only creates a rotation matrix, vTarget can be interpreted both as a position or a direction.

◆ CreateOrthographicProjectionMatrix()

xiiMat4 xiiGraphicsUtils::CreateOrthographicProjectionMatrix ( float fViewWidth,
float fViewHeight,
float fNearZ,
float fFarZ,
xiiClipSpaceDepthRange::Enum depthRange = xiiClipSpaceDepthRange::Default,
xiiClipSpaceYMode::Enum range = xiiClipSpaceYMode::Regular,
xiiHandedness::Enum handedness = xiiHandedness::Default )

Creates an orthographic projection matrix with Left = -fViewWidth/2, Right = +fViewWidth/2, Bottom = -fViewHeight/2, Top = +fViewHeight/2.

◆ CreatePerspectiveProjectionMatrix()

xiiMat4 xiiGraphicsUtils::CreatePerspectiveProjectionMatrix ( float fViewWidth,
float fViewHeight,
float fNearZ,
float fFarZ,
xiiClipSpaceDepthRange::Enum depthRange = xiiClipSpaceDepthRange::Default,
xiiClipSpaceYMode::Enum range = xiiClipSpaceYMode::Regular,
xiiHandedness::Enum handedness = xiiHandedness::Default )

Creates a perspective projection matrix with Left = -fViewWidth/2, Right = +fViewWidth/2, Bottom = -fViewHeight/2, Top = +fViewHeight/2.

◆ CreatePerspectiveProjectionMatrixFromFovX()

xiiMat4 xiiGraphicsUtils::CreatePerspectiveProjectionMatrixFromFovX ( xiiAngle fieldOfViewX,
float fAspectRatioWidthDivHeight,
float fNearZ,
float fFarZ,
xiiClipSpaceDepthRange::Enum depthRange = xiiClipSpaceDepthRange::Default,
xiiClipSpaceYMode::Enum range = xiiClipSpaceYMode::Regular,
xiiHandedness::Enum handedness = xiiHandedness::Default )

Creates a perspective projection matrix.

Parameters
fFieldOfViewXHorizontal field of view.

◆ CreatePerspectiveProjectionMatrixFromFovY()

xiiMat4 xiiGraphicsUtils::CreatePerspectiveProjectionMatrixFromFovY ( xiiAngle fieldOfViewY,
float fAspectRatioWidthDivHeight,
float fNearZ,
float fFarZ,
xiiClipSpaceDepthRange::Enum depthRange = xiiClipSpaceDepthRange::Default,
xiiClipSpaceYMode::Enum range = xiiClipSpaceYMode::Regular,
xiiHandedness::Enum handedness = xiiHandedness::Default )

Creates a perspective projection matrix.

Parameters
fFieldOfViewYVertical field of view.

◆ CreateSimpleASCIIFontTexture()

void xiiGraphicsUtils::CreateSimpleASCIIFontTexture ( xiiImage & ref_img,
bool bSetEmptyToUnknown = false )

Creates a 256*128 RGBA greyscale font texture that contains the 96 most important ASCII characters.

Each character is embedded in a 16x16 cell, but only uses the center 10x10 pixels, leaving a 3 pixel black boundary. Each row contains 16 characters, each column contains 8 characters. The characters are sorted in the order in that they appear in ASCII code, starting at the top left, going to the right and then down. Since the first 32 ASCII characters are not very useful, the first two rows are left black, except for the very first character, which is an upside down question mark. This character can be used for unknown characters (e.g. when Utf8 is printed as ASCII and thus characters above 127 are possible).

◆ CreateViewMatrix()

xiiMat4 xiiGraphicsUtils::CreateViewMatrix ( const xiiVec3 & vPosition,
const xiiVec3 & vForwardDir,
const xiiVec3 & vRightDir,
const xiiVec3 & vUpDir,
xiiHandedness::Enum handedness = xiiHandedness::Default )

Creates a view matrix from the given camera vectors.

The vectors are put into the appropriate matrix rows and depending on the handedness negated where necessary.

◆ DecomposeViewMatrix()

void xiiGraphicsUtils::DecomposeViewMatrix ( xiiVec3 & out_vPosition,
xiiVec3 & out_vForwardDir,
xiiVec3 & out_vRightDir,
xiiVec3 & out_vUpDir,
const xiiMat4 & mViewMatrix,
xiiHandedness::Enum handedness = xiiHandedness::Default )

Extracts the forward, right and up dir and camera position from the given view matrix.

The handedness should be the same as used in CreateViewMatrix() or CreateLookAtViewMatrix().

◆ ExtractNearAndFarClipPlaneDistances()

xiiResult xiiGraphicsUtils::ExtractNearAndFarClipPlaneDistances ( float & out_fNear,
float & out_fFar,
const xiiMat4 & mProjectionMatrix,
xiiClipSpaceDepthRange::Enum depthRange = xiiClipSpaceDepthRange::Default )

Computes the distances of the near and far clip planes from the given perspective projection matrix.

Returns XII_FAILURE when one of the values could not be computed, because it would result in a "division by zero".

◆ ExtractPerspectiveMatrixFieldOfView() [1/3]

xiiResult xiiGraphicsUtils::ExtractPerspectiveMatrixFieldOfView ( const xiiMat4 & mProjectionMatrix,
float & out_fLeft,
float & out_fRight,
float & out_fBottom,
float & out_fTop,
xiiClipSpaceDepthRange::Enum depthRange = xiiClipSpaceDepthRange::Default,
xiiClipSpaceYMode::Enum range = xiiClipSpaceYMode::Regular )

Extracts the field of view distances on the near plane from a perspective matrix.

Convenience function that also extracts near / far values and returns the distances on the near plane to be the inverse of xiiGraphicsUtils::CreatePerspectiveProjectionMatrix.

See also
xiiGraphicsUtils::CreatePerspectiveProjectionMatrix

◆ ExtractPerspectiveMatrixFieldOfView() [2/3]

void xiiGraphicsUtils::ExtractPerspectiveMatrixFieldOfView ( const xiiMat4 & mProjectionMatrix,
xiiAngle & out_fovLeft,
xiiAngle & out_fovRight,
xiiAngle & out_fovBottom,
xiiAngle & out_fovTop,
xiiClipSpaceYMode::Enum range = xiiClipSpaceYMode::Regular )

Extracts the field of view angles from a perspective matrix.

Parameters
ProjectionMatrixPerspective projection matrix to be decomposed.
out_fFovLeftLeft angle of the frustum. Negative in symmetric projection.
out_fFovRightRight angle of the frustum.
out_fFovBottomBottom angle of the frustum. Negative in symmetric projection.
out_fFovTopTop angle of the frustum.
yRangeThe Y range used to construct the perspective matrix.

◆ ExtractPerspectiveMatrixFieldOfView() [3/3]

void xiiGraphicsUtils::ExtractPerspectiveMatrixFieldOfView ( const xiiMat4 & mProjectionMatrix,
xiiAngle & out_fovX,
xiiAngle & out_fovY )

Retrieves the horizontal and vertical field-of-view angles from the perspective matrix.

Note
If an orthographic projection matrix is passed in, the returned angle values will be zero.

◆ IsTriangleFlipRequired()

bool xiiGraphicsUtils::IsTriangleFlipRequired ( const xiiMat3 & mTransformation)

Checks whether the given transformation matrix would change the winding order of a triangle's vertices and thus requires that the vertex order gets reversed to compensate.