Skip to main content
Version: 21 Aug 2024

Meshing2

APIs for the Meshing system. More...

Classes

Name
structMLMeshingSettings
structMLMeshingExtents
structMLMeshingBlockInfo
structMLMeshingMeshInfo
structMLMeshingBlockRequest
structMLMeshingMeshRequest
structMLMeshingBlockMesh
structMLMeshingMesh

Types

Name
typedef struct MLMeshingSettingsMLMeshingSettings
typedef struct MLMeshingExtentsMLMeshingExtents
typedef struct MLMeshingBlockInfoMLMeshingBlockInfo
typedef struct MLMeshingMeshInfoMLMeshingMeshInfo
typedef struct MLMeshingBlockRequestMLMeshingBlockRequest
typedef struct MLMeshingMeshRequestMLMeshingMeshRequest
typedef struct MLMeshingBlockMeshMLMeshingBlockMesh
typedef struct MLMeshingMeshMLMeshingMesh

Enums

Name
enumMLMeshingFlags
{
MLMeshingFlags_PointCloud = 1 << 0,
MLMeshingFlags_ComputeNormals = 1 << 1,
MLMeshingFlags_ComputeConfidence = 1 << 2,
MLMeshingFlags_Planarize = 1 << 3,
MLMeshingFlags_RemoveMeshSkirt = 1 << 4,
MLMeshingFlags_IndexOrderCW = 1 << 5,
MLMeshingFlags_Ensure32Bits = 0x7FFFFFFF
}
enumMLMeshingLOD
{
MLMeshingLOD_Minimum,
MLMeshingLOD_Medium,
MLMeshingLOD_Maximum,
MLMeshingLOD_Ensure32Bits = 0x7FFFFFFF
}
enumMLMeshingResult
{
MLMeshingResult_Success,
MLMeshingResult_Failed,
MLMeshingResult_Pending,
MLMeshingResult_PartialUpdate,
MLMeshingResult_Ensure32Bits = 0x7FFFFFFF
}
enumMLMeshingMeshState
{
MLMeshingMeshState_New,
MLMeshingMeshState_Updated,
MLMeshingMeshState_Deleted,
MLMeshingMeshState_Unchanged,
MLMeshingMeshState_Ensure32Bits = 0x7FFFFFFF
}

Functions

Name
MLResultMLMeshingCreateClient(MLHandle out_client_handle, const MLMeshingSettings settings)
Create the meshing client.
MLResultMLMeshingDestroyClient(MLHandle client_handle)
Free the client resources.
MLResultMLMeshingInitSettings(MLMeshingSettings * out_settings)
Initialize the meshing settings with system defaults.
MLResultMLMeshingUpdateSettings(MLHandle client_handle, const MLMeshingSettings * settings)
Update the meshing settings at runtime.
MLResultMLMeshingRequestMeshInfo(MLHandle client_handle, const MLMeshingExtents extents, MLHandle out_request_handle)
Request the Mesh Info which includes CFUIDs and bounding extents of the blocks.
MLResultMLMeshingGetMeshInfoResult(MLHandle client_handle, MLHandle request_handle, MLMeshingMeshInfo * out_info)
Get the Result of a previous MeshInfo request.
MLResultMLMeshingRequestMesh(MLHandle client_handle, const MLMeshingMeshRequest request, MLHandle out_request_handle)
Request the Mesh for all CFUIDs populated in request.
MLResultMLMeshingGetMeshResult(MLHandle client_handle, MLHandle request_handle, MLMeshingMesh * out_mesh)
Get the Result of a previous Mesh request.
MLResultMLMeshingFreeResource(MLHandle client_handle, MLHandle * request_handle)
Free resources created by the meshing APIS. Needs to be called whenever MLMeshingGetMeshInfoResult, MLMeshingGetMeshResult return a success.

Detailed Description

APIs for the Meshing system.

Shared Object:

  • perception.magicleap*

  • The Meshing system is for generating a mesh representation of the real world.


Enums Documentation

MLMeshingFlags

EnumeratorValueDescription
MLMeshingFlags_PointCloud1 << 0If set, will return a point cloud instead of a triangle mesh.
MLMeshingFlags_ComputeNormals1 << 1If set, the system will compute the normals for the triangle vertices.
MLMeshingFlags_ComputeConfidence1 << 2If set, the system will compute the confidence values.
MLMeshingFlags_Planarize1 << 3If set, the system will planarize the returned mesh (planar regions will be smoothed out).
MLMeshingFlags_RemoveMeshSkirt1 << 4If set, the mesh skirt (overlapping area between two mesh blocks) will be removed.
MLMeshingFlags_IndexOrderCW1 << 5If set, winding order of indices will be be changed from counter clockwise to clockwise. This could be useful for face culling process in different engines.
MLMeshingFlags_Ensure32Bits0x7FFFFFFFEnsure enum is represented as 32 bits.

Request flags for the meshing system.


MLMeshingLOD

EnumeratorValueDescription
MLMeshingLOD_MinimumMinimum Level of Detail (LOD) for the mesh.
MLMeshingLOD_MediumMedium Level of Detail (LOD) for the mesh.
MLMeshingLOD_MaximumMaximum Level of Detail (LOD) for the mesh.
MLMeshingLOD_Ensure32Bits0x7FFFFFFFEnsure enum is represented as 32 bits.

Level of detail of the block mesh.


MLMeshingResult

EnumeratorValueDescription
MLMeshingResult_SuccessMesh request has succeeded.
MLMeshingResult_FailedMesh request has failed.
MLMeshingResult_PendingMesh request is pending.
MLMeshingResult_PartialUpdateThere are partial updates on the mesh request.
MLMeshingResult_Ensure32Bits0x7FFFFFFFEnsure enum is represented as 32 bits.

Result of a mesh request.


MLMeshingMeshState

EnumeratorValueDescription
MLMeshingMeshState_NewMesh has been created.
MLMeshingMeshState_UpdatedMesh has been updated.
MLMeshingMeshState_DeletedMesh has been deleted.
MLMeshingMeshState_UnchangedMesh is unchanged.
MLMeshingMeshState_Ensure32Bits0x7FFFFFFFEnsure enum is represented as 32 bits.

State of a block mesh.


Types Documentation

MLMeshingSettings

typedef struct MLMeshingSettings MLMeshingSettings;

Mesh Settings for the underlying system.

More Info


MLMeshingExtents

typedef struct MLMeshingExtents MLMeshingExtents;

Axis aligned bounding box for querying updated mesh info.

More Info


MLMeshingBlockInfo

typedef struct MLMeshingBlockInfo MLMeshingBlockInfo;

Representation of a mesh block.

More Info


MLMeshingMeshInfo

typedef struct MLMeshingMeshInfo MLMeshingMeshInfo;

Response structure for the mesh block info.

More Info


MLMeshingBlockRequest

typedef struct MLMeshingBlockRequest MLMeshingBlockRequest;

Request structure to get the actual mesh for a block.

More Info


MLMeshingMeshRequest

typedef struct MLMeshingMeshRequest MLMeshingMeshRequest;

Request structure to get the actual mesh for a set of blocks.

More Info


MLMeshingBlockMesh

typedef struct MLMeshingBlockMesh MLMeshingBlockMesh;

Final structure for a block mesh.

More Info


MLMeshingMesh

typedef struct MLMeshingMesh MLMeshingMesh;

Result of a Mesh request. See MLMeshingGetMeshResult() for details.

More Info


Functions Documentation

MLMeshingCreateClient

MLResult MLMeshingCreateClient(
MLHandle * out_client_handle,
const MLMeshingSettings * settings
)

Create the meshing client.

Parameters

MLHandle *out_client_handleThe handle to the created client.
const MLMeshingSettings *settingsThe initial settings to be used for meshing.

Returns

MLResultMLResult_InvalidParamMeshing Client was not created due to an invalid parameter.
MLResultMLResult_OkMeshing Client was created successfully.
MLResultMLResult_PerceptionSystemNotStartedPerception System has not been started.
MLResultMLResult_PermissionDeniedMissing required permission(s).
MLResultMLResult_UnspecifiedFailureMeshing Client was not created due to an unknown error.

Required Permissions:

  • com.magicleap.permission.SPATIAL_MAPPING (protection level: dangerous)

Note that this will be the only function in the meshing API that will return MLResult_PermissionDenied. Trying to call the other functions with an invalid MLHandle will result in MLResult_InvalidParam.


MLMeshingDestroyClient

MLResult MLMeshingDestroyClient(
MLHandle client_handle
)

Free the client resources.

Parameters

MLHandleclient_handleThe client to destroy.

Returns

MLResultMLResult_InvalidParamMeshing Client was not destroyed due to an invalid parameter.
MLResultMLResult_OkMeshing Client was destroyed successfully.
MLResultMLResult_PerceptionSystemNotStartedPerception System has not been started.

Required Permissions:

  • None

MLMeshingInitSettings

MLResult MLMeshingInitSettings(
MLMeshingSettings * out_settings
)

Initialize the meshing settings with system defaults.

Parameters

MLMeshingSettings *out_settingsThe initial settings to be used for meshing.

Returns

MLResultMLResult_InvalidParamMesh Settings were not initialized due to an invalid parameter.
MLResultMLResult_OkMesh Settings were initialized successfully.
MLResultMLResult_PerceptionSystemNotStartedPerception System has not been started.

Required Permissions:

  • None

MLMeshingUpdateSettings

MLResult MLMeshingUpdateSettings(
MLHandle client_handle,
const MLMeshingSettings * settings
)

Update the meshing settings at runtime.

Parameters

MLHandleclient_handleThe handle to the created client.
const MLMeshingSettings *settingsThe updated settings to be used for meshing.

Returns

MLResultMLResult_InvalidParamMesh Settings were not updated due to an invalid parameter.
MLResultMLResult_OkMesh Settings were updated successfully.
MLResultMLResult_PerceptionSystemNotStartedPerception System has not been started.

Required Permissions:

  • None

MLMeshingRequestMeshInfo

MLResult MLMeshingRequestMeshInfo(
MLHandle client_handle,
const MLMeshingExtents * extents,
MLHandle * out_request_handle
)

Request the Mesh Info which includes CFUIDs and bounding extents of the blocks.

Parameters

MLHandleclient_handleThe handle to the created client.
const MLMeshingExtents *extentsThe region of interest for meshing.
MLHandle *out_request_handleThe handle for the current request. Needs to be passed to query the result of the request.

Returns

MLResultMLResult_InvalidParamMesh info was not requested due to an invalid parameter.
MLResultMLResult_OkMesh Info was requested successfully.
MLResultMLResult_PerceptionSystemNotStartedPerception System has not been started.

Required Permissions:

  • None

MLMeshingGetMeshInfoResult

MLResult MLMeshingGetMeshInfoResult(
MLHandle client_handle,
MLHandle request_handle,
MLMeshingMeshInfo * out_info
)

Get the Result of a previous MeshInfo request.

Parameters

MLHandleclient_handleThe handle to the created client.
MLHandlerequest_handleThe handle populated in a prev MLMeshingGetMeshInfo.
MLMeshingMeshInfo *out_infoThe final result which will be populated only if the result is successful.

Returns

MLResultMLResult_InvalidParamMesh Settings were not updated due to an invalid parameter.
MLResultMLResult_OkMesh Info was populated successfully.
MLResultMLResult_PedingMesh Info is pending update.
MLResultMLResult_PerceptionSystemNotStartedPerception System has not been started.

Required Permissions:

  • None

MLMeshingRequestMesh

MLResult MLMeshingRequestMesh(
MLHandle client_handle,
const MLMeshingMeshRequest * request,
MLHandle * out_request_handle
)

Request the Mesh for all CFUIDs populated in request.

Parameters

MLHandleclient_handleThe handle to the created client.
const MLMeshingMeshRequest *requestThe request for meshes of interest.
MLHandle *out_request_handleThe handle for the current request. Needs to be passed to query the result of the request.

Returns

MLResultMLResult_InvalidParamMeshes were not requested due to an invalid parameter.
MLResultMLResult_OkMeshes were requested successfully.
MLResultMLResult_PerceptionSystemNotStartedPerception System has not been started.

Required Permissions:

  • None

MLMeshingGetMeshResult

MLResult MLMeshingGetMeshResult(
MLHandle client_handle,
MLHandle request_handle,
MLMeshingMesh * out_mesh
)

Get the Result of a previous Mesh request.

Parameters

MLHandleclient_handleThe handle to the created client.
MLHandlerequest_handleThe handle populated in a prev MLMeshingGetMesh.
MLMeshingMesh *out_meshThe final result which will be populated only if the result is successful.

Returns

MLResultMLResult_InvalidParamMeshes were not updated due to an invalid parameter.
MLResultMLResult_OkMeshes was populated successfully.
MLResultMLResult_PedingMeshes pending update.
MLResultMLResult_PerceptionSystemNotStartedPerception System has not been started.

Required Permissions:

  • None

MLMeshingFreeResource

MLResult MLMeshingFreeResource(
MLHandle client_handle,
MLHandle * request_handle
)

Free resources created by the meshing APIS. Needs to be called whenever MLMeshingGetMeshInfoResult, MLMeshingGetMeshResult return a success.

Parameters

MLHandleclient_handleThe handle to the created client.
MLHandle *request_handleThe handle populated in a prev request.

Returns

MLResultMLResult_InvalidParamResources were not freed due to an invalid parameter.
MLResultMLResult_OkResources were freed successfully.
MLResultMLResult_PerceptionSystemNotStartedPerception System has not been started.

Required Permissions:

  • None