WVR_GetTransformFromEyeToHead

WVR_EXPORT WVR_Matrix4f_t WVR_GetTransformFromEyeToHead(WVR_Eye eye, WVR_NumDoF dof = WVR_NumDoF_6DoF)

Function to return the transform from eye space to the head space.

Eye space is the per-eye flavor of view space that provides stereo disparity. Instead of Model * View * Projection the model is Model * View * Eye * Projection. Normally View and Eye will be multiplied together and treated as View in your application.

This matrix incorporates the user’s interpupillary distance (IPD).

Return
The transform between the view space and eye space.
Parameters
  • eye -

    Determines which eye the function should return the eye matrix for.

  • dof -

    Specify the DoF of current content. 6DoF transform considers the depth of eye to head but 3DoF not.

Struct and enumeration

struct WVR_Matrix4f

The basic matrix (4x4 floats) struct to be used in pose.

Public Members

float m[4][4]

Matrix form (4X4) to represent rotation and position of pose data.

How to use

Here is an example for the function:

void exampleFun() {
    WVR_Matrix4f_t matLeft = WVR_GetTransformFromEyeToHead(WVR_Eye_Left);
    WVR_Matrix4f_t matRight = WVR_GetTransformFromEyeToHead(WVR_Eye_Right);

    Matrix4 transLeft = Matrix4(
        matLeft.m[0][0], matLeft.m[1][0], matLeft.m[2][0], matLeft.m[3][0],
        matLeft.m[0][1], matLeft.m[1][1], matLeft.m[2][1], matLeft.m[3][1],
        matLeft.m[0][2], matLeft.m[1][2], matLeft.m[2][2], matLeft.m[3][2],
        matLeft.m[0][3], matLeft.m[1][3], matLeft.m[2][3], matLeft.m[3][3]
    );
    Matrix4 transRight = Matrix4(
        matRight.m[0][0], matRight.m[1][0], matRight.m[2][0], matRight.m[3][0],
        matRight.m[0][1], matRight.m[1][1], matRight.m[2][1], matRight.m[3][1],
        matRight.m[0][2], matRight.m[1][2], matRight.m[2][2], matRight.m[3][2],
        matRight.m[0][3], matRight.m[1][3], matRight.m[2][3], matRight.m[3][3]
    );

    Matrix4 transFromHeadToLeftEye = transLeft.invert();
    Matrix4 transFromHeadToRightEye = transRight.invert();
}