WVR_GetSceneMeshes

WVR_EXPORT WVR_Result WVR_GetSceneMeshes(WVR_SceneMeshType meshType, uint32_t meshCapacityInput, uint32_t * meshCountOutput, WVR_SceneMesh * meshes)

Function is used to retrieve scene meshes after perception process is finished.

This is two calls API. Developers should call this API with the value of meshCapacityInput equals to 0 to retrieve the size of meshes from meshCountOutput. Then developers allocate the array of WVR_SceneMesh and assign the meshCapacityInput and call the API in the second time. Then runtime will fill the meshes array.

Version
API Level 11
Parameters
  • meshType: input scene mesh type, refer to WVR_SceneMeshType
  • meshCapacityInput: the capacity of meshes array, or 0 to indicate a request to retrieve the required capacity
  • meshCountOutput: a pointer to the count of meshes written, or a pointer to the required capacity in the case that meshCapacityInput
  • meshes: An array of WVR_SceneMesh will be filled by the runtime.
Return Value
  • WVR_Success: Get meshes successfully.
  • others: WVR_Result mean failure.

How to use

Sample function:

#include <wvr/wvr_scene.h>

if (WVR_StartScene() == WVR_Success) {
    if (WVR_StartScenePerception(WVR_ScenePerceptionTarget_SceneMesh) == WVR_Success) {
        WVR_ScenePerceptionState state;
        if (WVR_GetScenePerceptionState(WVR_ScenePerceptionTarget_SceneMesh, &state) == WVR_Success) {
            // wait until state is WVR_ScenePerceptionState_Completed
            if (state == WVR_ScenePerceptionState_Completed) {
                // Start scene perception with WVR_ScenePerceptionTarget_SceneMesh successfully and get the state as completed.
                // Developers can call WVR_GetSceneMeshes to get scene meshes array
                uint32_t sceneCount = 0;
                WVR_SceneMesh *sceneMesh;
                if (WVR_GetSceneMeshes(WVR_SceneMeshType_VisualMesh, 0, &sceneCount, nullptr) == WVR_Success) {
                    sceneMesh = (WVR_SceneMesh*)malloc(sizeof(WVR_SceneMesh)*sceneCount);
                    if (WVR_GetSceneMeshes(WVR_SceneMeshType_VisualMesh, sceneCount, &sceneCount, sceneMesh) == WVR_Success) {
                       // get scene mesh successfully
                    }
                }

            }
        }
    } else {
        // start perception with WVR_ScenePerceptionTarget_SceneMesh failed
    }
    // ...
    WVR_StopScenePerception(WVR_ScenePerceptionTarget_SceneMesh);
    WVR_StopScene();
} else {
    // start scene failed!
}