WVR_ShowPassthroughUnderlay

WVR_EXPORT WVR_Result WVR_ShowPassthroughUnderlay(bool show)

Function to show the passthrough underlay.

Use this function to also decide whether the passthrough underlay should be shown or not. 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 passthrough underlay. 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 underlay passthrough:

#include <wvr/wvr_system.h>

bool gShowPassthroughAvailable = true;

void pollEvent() {
    WVR_Event_t event;
    while(WVR_PollEventQueue(&event)) {
        if (event.common.type == WVR_EventType_PassthroughOverlayShownBySystem) {
            gShowPassthroughAvailable = false;
        } else if (event.common.type == WVR_EventType_PassthroughOverlayHiddenBySystem) {
            gShowPassthroughAvailable = true;
            showPassthrough();
        }
    }
}

void showPassthrough() {
    uint64_t support = WVR_GetSupportedFeatures();
    if (support & WVR_SupportedFeature_PassthroughOverlay && gShowPassthroughAvailable) {
        WVR_ShowPassthroughUnderlay(true);
    }
}