WVR_GetTransformFromEyeToHead

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

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

Eye space is respective to the left or right eye. By applying the returned transform matrix, it adjusts the View matrix for each eye, and therefore creates stereo disparity. Instead of the Model View Projection model, the model is Model View Eye Projection. Usually, View and Eye are multiplied together to get the View in your app.

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

Return
The transform between the view space and eye space.
Version
API Level 1
Parameters
  • eye: Determines which eye the function should return the eye matrix for.
  • dof: Specify the DoF of the current content. A 6DoF transform considers the eye to head depth but 3DoF does 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();
}