WVR_ShowProjectedPassthrough

WVR_EXPORT WVR_Result WVR_ShowProjectedPassthrough(bool show)

Function to show or hide the projected passthrough.

This function must be called after calling WVR_RenderInit().

Version
API Level 7
Note
Supported from Runtime version 7 or higher (certain devices only). Calling this API on render thread is not recommended due to IPC with Passthrough service.
Parameters
  • show: Show or hide the projected passthrough. The system passthrough(surrounding or out-of-boundary) would be disabled if the param show is true.
Return Value
  • WVR_SUCCESS: The setting is valid.
  • WVR_Error_RuntimeVersionNotSupport: This feature is supported from Runtime version 7 or higher.
  • WVR_Error_FeatureNotSupport: This feature is not supported on this device.

How to use

The following example shows the projected passthrough by pressing button A, and would follow the right controller:

#include <wvr/wvr_system.h>

void pollEvent() {
    if (event.common.type == WVR_EventType_ButtonUnpressed) {
        if (event.input.inputId == WVR_InputId_Alias1_A) {
            float size = 0.125f;
            std::vector<float> vertex = { -size, -size, 0.0f,
                                          size, -size, 0.0f,
                                          size, size, 0.0f,
                                          -size, size, 0.0f };
            std::vector<uint32_t> indices = { 0, 1, 2, 0, 2, 3 };
            WVR_SetProjectedPassthroughMesh(&vertex[0], vertex.size(), &indices[0], indices.size());
            float alpha = 1.0f;
            WVR_SetProjectedPassthroughAlpha(alpha);
            WVR_ShowProjectedPassthrough(true);
        }
    }
}

void renderFrame() {
    for (int nDevice = 0; nDevice < WVR_DEVICE_COUNT_LEVEL_1; ++nDevice) {
        if (mVRDevicePairs[nDevice].type == WVR_DeviceType_Controller_Right && mVRDevicePairs[nDevice].pose.isValidPose) {
            WVR_Pose_t pose;
            q_type quat;
            Matrix4 mat = mDevicePoseArray[nDevice];
            mat.ToQuat(quat);
            pose.rotation.w = quat[Q_W];
            pose.rotation.x = quat[Q_X];
            pose.rotation.y = quat[Q_Y];
            pose.rotation.z = quat[Q_Z];
            pose.position.v[0] = mat[12];
            pose.position.v[1] = mat[13];
            pose.position.v[2] = mat[14];

            WVR_SetProjectedPassthroughPose(&pose);
            break;
        }
    }
}