Occlusion
APIs for the Occlusion system. \experimental This is an experimental API which may be modified or removed without any prior notice. More...
Classes
Name | |
---|---|
struct | MLOcclusionSettings Mesh Settings for the underlying system. |
struct | MLOcclusionMesh Structure for occlusion mesh data. |
struct | MLOcclusionMeshQuery Structure for occlusion mesh query. |
Types
Name | |
---|---|
typedef struct MLOcclusionSettings | MLOcclusionSettings Mesh Settings for the underlying system. |
typedef struct MLOcclusionMesh | MLOcclusionMesh Structure for occlusion mesh data. |
typedef struct MLOcclusionMeshQuery | MLOcclusionMeshQuery Structure for occlusion mesh query. |
Functions
Name | |
---|---|
void | MLOcclusionSettingsInit(MLOcclusionSettings * inout_settings) Initialize the occlusion settings with system defaults. |
void | MLOcclusionMeshInit(MLOcclusionMesh * inout_mesh) Initialize the occlusion mesh with system defaults. |
void | MLOcclusionMeshQueryInit(MLOcclusionMeshQuery * inout_mesh_query) Initialize the occlusion mesh query with system defaults. |
MLResult | MLOcclusionCreateClient(const MLOcclusionSettings settings, MLHandle out_client_handle) Create the occlusion client. |
MLResult | MLOcclusionDestroyClient(MLHandle client_handle) Free the client resources. |
MLResult | MLOcclusionUpdateSettings(MLHandle handle, const MLOcclusionSettings * settings) Update the occlusion settings at runtime. |
MLResult | MLOcclusionGetLatestMesh(MLHandle handle, const MLOcclusionMeshQuery mesh_query, MLOcclusionMesh out_mesh_data) Get the latest occlusion mesh. |
MLResult | MLOcclusionReleaseMesh(MLHandle handle, MLOcclusionMesh * mesh_data) Releases specified MLOcclusionMesh object. |
Detailed Description
APIs for the Occlusion system. \experimental This is an experimental API which may be modified or removed without any prior notice.
Shared Object:
perception.magicleap*
The Occlusion system is for generating a mesh representation of the near field objects, so they can be easily used for occlusion of in-app objects for greater immersion.
By default occlusion system generates the mesh representation of the near field objects at 5Hz. When MLOcclusionSettings::max_distance is set to be less or equal to 0.9m the mesh is generated at 30Hz.
Types Documentation
MLOcclusionSettings
typedef struct MLOcclusionSettings MLOcclusionSettings;
Mesh Settings for the underlying system.
API Level:
- 28
MLOcclusionMesh
typedef struct MLOcclusionMesh MLOcclusionMesh;
Structure for occlusion mesh data.
API Level:
- 28
MLOcclusionMeshQuery
typedef struct MLOcclusionMeshQuery MLOcclusionMeshQuery;
Structure for occlusion mesh query.
API Level:
- 28
Functions Documentation
MLOcclusionSettingsInit
static inline void MLOcclusionSettingsInit(
MLOcclusionSettings * inout_settings
)
Initialize the occlusion settings with system defaults.
Parameters
MLOcclusionSettings * | inout_settings | The initial settings to be used for occlusion. |
Required Permissions:
- None
API Level:
- 28
MLOcclusionMeshInit
static inline void MLOcclusionMeshInit(
MLOcclusionMesh * inout_mesh
)
Initialize the occlusion mesh with system defaults.
Parameters
MLOcclusionMesh * | inout_mesh | The initial mesh structure. |
Required Permissions:
- None
API Level:
- 28
MLOcclusionMeshQueryInit
static inline void MLOcclusionMeshQueryInit(
MLOcclusionMeshQuery * inout_mesh_query
)
Initialize the occlusion mesh query with system defaults.
Parameters
MLOcclusionMeshQuery * | inout_mesh_query | The initial mesh query structure. |
Required Permissions:
- None
API Level:
- 28
MLOcclusionCreateClient
MLResult MLOcclusionCreateClient(
const MLOcclusionSettings * settings,
MLHandle * out_client_handle
)
Create the occlusion client.
Parameters
const MLOcclusionSettings * | settings | The initial settings to be used for occlusion. |
MLHandle * | out_client_handle | The handle to the created client. |
Returns
MLResult | MLResult_InvalidParam | Occlusion client was not created due to an invalid parameter. |
MLResult | MLResult_Ok | Occlusion client was created successfully. |
MLResult | MLResult_PerceptionSystemNotStarted | Perception System has not been started. |
MLResult | MLResult_PermissionDenied | Missing required permission(s). |
MLResult | MLResult_UnspecifiedFailure | Occlusion client was not created due to an unknown error. |
Required Permissions:
- com.magicleap.permission.SPATIAL_MAPPING (protection level: dangerous)
API Level:
- 28
MLOcclusionDestroyClient
MLResult MLOcclusionDestroyClient(
MLHandle client_handle
)
Free the client resources.
Parameters
MLHandle | client_handle | The client to destroy. |
Returns
MLResult | MLResult_InvalidParam | Occlusion client was not destroyed due to an invalid parameter. |
MLResult | MLResult_Ok | Occlusion client was destroyed successfully. |
MLResult | MLResult_PerceptionSystemNotStarted | Perception System has not been started. |
Required Permissions:
- None
API Level:
- 28
MLOcclusionUpdateSettings
MLResult MLOcclusionUpdateSettings(
MLHandle handle,
const MLOcclusionSettings * settings
)
Update the occlusion settings at runtime.
Parameters
MLHandle | handle | The handle to the created client. |
const MLOcclusionSettings * | settings | The updated settings to be used for occlusion. |
Returns
MLResult | MLResult_InvalidParam | Settings were not updated due to an invalid parameter. |
MLResult | MLResult_Ok | Settings were updated successfully. |
MLResult | MLResult_PerceptionSystemNotStarted | Perception System has not been started. |
Required Permissions:
- None
API Level:
- 28
MLOcclusionGetLatestMesh
MLResult MLOcclusionGetLatestMesh(
MLHandle handle,
const MLOcclusionMeshQuery * mesh_query,
MLOcclusionMesh * out_mesh_data
)
Get the latest occlusion mesh.
Parameters
MLHandle | handle | The handle to the created client. |
const MLOcclusionMeshQuery * | mesh_query | The pointer to intialized MLOcclusionMeshQuery struct. |
MLOcclusionMesh * | out_mesh_data | The pointer to intialized MLOcclusionMesh struct. |
Returns
MLResult | MLResult_IllegalState | Current mesh must be released before acquiring the next one. |
MLResult | MLResult_InvalidParam | Mesh data was not returned due to an invalid parameter. |
MLResult | MLResult_Ok | Mesh data was returned successfully. |
MLResult | MLResult_PerceptionSystemNotStarted | Perception System has not been started. |
Required Permissions:
- None
Returns MLOcclusionMesh with its latest data. When doing consecutive calls and there was no mesh update, the same data will be returned. The memory is owned by the system. Application should copy the data it needs to cache.
Every call to MLOcclusionGetLatestMesh() must be followed by a matching call to MLOcclusionReleaseMesh(), otherwise this method will return an error.
API Level:
- 28
MLOcclusionReleaseMesh
MLResult MLOcclusionReleaseMesh(
MLHandle handle,
MLOcclusionMesh * mesh_data
)
Releases specified MLOcclusionMesh object.
Parameters
MLHandle | handle | The handle to the created client. |
MLOcclusionMesh * | mesh_data | Pointer to a filled MLOcclusionMesh struct. |
Returns
MLResult | MLResult_InvalidParam | One of the parameters is invalid. |
MLResult | MLResult_Ok | Successfully released mesh data. |
MLResult | MLResult_UnspecifiedFailure | Failed due to an internal error. |
Required Permissions:
- None
This function should be called exactly once for each call to MLOcclusionGetLatestMesh(). After a successful call, the contents of #mesh_data are no longer valid and should not be used.
API Level:
- 28