Umbra::CameraTransform class

A camera view frustum and the associated world transformation.

Queries that resolve the visibility from a camera viewpoint take an instance of the CameraTransform class as input. The CameraTransform object contains the full transformation matrix from world space to clip space coordinates, as well as any additional clip planes. Helpers are provided for constructing the transformation from the modelview and projection components.

Public types

enum DepthRange { DEPTHRANGE_ZERO_TO_ONE = 0, DEPTHRANGE_MINUS_ONE_TO_ONE }
The produced depth range of the transformation matrix.

Constructors, destructors, conversion operators

CameraTransform(void)
Construct an empty CameraTransform object.
CameraTransform(const Float4_4& worldToClip, const Float3& position, DepthRange range = DEPTHRANGE_ZERO_TO_ONE, MatrixFormat mf = MF_COLUMN_MAJOR)
Construct a CameraTransform object with a full world to clip transform and an exact camera position.
CameraTransform(const CameraTransform& rhs)
Copy constructor.

Public functions

auto operator=(const CameraTransform& rhs) -> CameraTransform&
Assignment operator.
void set(const Float4_4& worldToClip, const Float3& position, DepthRange range = DEPTHRANGE_ZERO_TO_ONE, MatrixFormat mf = MF_COLUMN_MAJOR)
Populate this CameraTransform with a full world to clip transform an an exact camera position.
void get(Float4_4& outWorldToClip, DepthRange inRange = DEPTHRANGE_ZERO_TO_ONE, MatrixFormat inMatrixFormat = MF_COLUMN_MAJOR) const
Get the transformation matrix.
void setUserClipPlanes(const Float4* planes, int planeCount)
Set user clip planes for further culling geometry contained in the Camera frustum.
void getUserClipPlanes(Float4 outPlanes[UMBRA_MAX_USER_CLIP_PLANES], int& outPlaneCount)
Get the user clip planes for further culling geometry contained in the Camera frustum.

Public variables

uint8_t m_mem

Enum details

enum Umbra::CameraTransform::DepthRange

The produced depth range of the transformation matrix.

Enumerators
DEPTHRANGE_ZERO_TO_ONE

The D3D convention, depth range after w division [0,1].

This is the default.

DEPTHRANGE_MINUS_ONE_TO_ONE

The OpenGL convention, depth range after w division [-1,1].

Function details

Umbra::CameraTransform::CameraTransform(void)

Construct an empty CameraTransform object.

Use set() to populate this object since the empty object is not usable for anything as such.

Umbra::CameraTransform::CameraTransform(const Float4_4& worldToClip, const Float3& position, DepthRange range = DEPTHRANGE_ZERO_TO_ONE, MatrixFormat mf = MF_COLUMN_MAJOR)

Construct a CameraTransform object with a full world to clip transform and an exact camera position.

Parameters
worldToClip The full transformation matrix. Storage format defined by parameter 'mf'. Multiply the modelview matrix with the projection matrix to obtain the combined worldToClip matrix.
position The camera position.
range The depth range convention used.
mf The storage format (packed rows or packed columns) of 'worldToClip'.

void Umbra::CameraTransform::set(const Float4_4& worldToClip, const Float3& position, DepthRange range = DEPTHRANGE_ZERO_TO_ONE, MatrixFormat mf = MF_COLUMN_MAJOR)

Populate this CameraTransform with a full world to clip transform an an exact camera position.

Parameters
worldToClip The full transformation matrix. Storage format defined by parameter 'mf'. Multiply the modelview matrix with the projection matrix to obtain the combined worldToClip matrix.
position The camera position.
range The depth range convention used.
mf The storage format (packed rows or packed columns) of 'worldToClip'.

void Umbra::CameraTransform::get(Float4_4& outWorldToClip, DepthRange inRange = DEPTHRANGE_ZERO_TO_ONE, MatrixFormat inMatrixFormat = MF_COLUMN_MAJOR) const

Get the transformation matrix.

Parameters
outWorldToClip The full transformation matrix. Storage format defined by parameter 'mf'. Multiply the modelview matrix with the projection matrix to obtain the combined worldToClip matrix.
inRange The depth range convention used.
inMatrixFormat The storage format (packed rows or packed columns) of 'worldToClip'.

void Umbra::CameraTransform::setUserClipPlanes(const Float4* planes, int planeCount)

Set user clip planes for further culling geometry contained in the Camera frustum.

Parameters
planes An array of 4-component plane equations describing the user clip planes. Clip planes are given in world space coordinates, and the direction of the plane normal points to the 'in' halfspace.
planeCount Number of planes in the plane array.

User clip planes cause overhead in occlusion culling queries and should be used only when needed. In particular, never pass in the planes of the camera frustum itself as clipping against the frustum is already handled by the implementation.

void Umbra::CameraTransform::getUserClipPlanes(Float4 outPlanes[UMBRA_MAX_USER_CLIP_PLANES], int& outPlaneCount)

Get the user clip planes for further culling geometry contained in the Camera frustum.

Parameters
outPlanes An array of 4-component plane equations describing the user clip planes. Clip planes are given in world space coordinates, and the direction of the plane normal points to the 'in' halfspace.
outPlaneCount Number of planes in the plane array.