WVR_CacheSpatialAnchor¶
-
WVR_EXPORT WVR_Result WVR_CacheSpatialAnchor(const WVR_SpatialAnchorCacheInfo * spatialAnchorCacheInfo)
Function is used to build and store a cache anchor from previous created spatial anchor.
Developers use this API to build and store a cache anchor on runtime. The cached anchors is SLAM tracking map dependent. They will be effected by runtime once the SLAM map is reset and re-create for this room.
Note: Once the cached spatial anchor list has been changed, the corresponding event (WVR_EventType) will be fired. This API will cause WVR_EventType_CachedAnchor_Changed event.
- Version
- API Level 14
- Parameters
spatialAnchorCacheInfo
: creation information from previous created spatial anchor and give a cachedSpatialAnchorName, refer to WVR_SpatialAnchorCacheInfo
- Return Value
WVR_Success
: Build and store a cache anchor successfully.others
: WVR_Result mean failure.
How to use¶
Sample function:
// the anchor is WVR_SpatialAnchor handle, which is created before
WVR_SpatialAnchorCacheInfo cacheInfo = {anchor, "uniqueCacheName"};
if (WVR_CacheSpatialAnchor(&cacheInfo) == WVR_Success) {
// cache the anchor successfully
}
// somewhere to listen cached spatial anchor list change event
void ProcessEvent() {
WVR_Event_t event;
while(WVR_PollEventQueue(&event)) {
switch (event.common.type) {
case WVR_EventType_CachedAnchor_Changed: {
// .....
break;
}
}
}
}