Skip to main content
Version: 14 Oct 2024

MeshingSubsystemComponent

NameSpace: MagicLeap

Inherits from:
MonoBehaviour

Public Fields

PrefabRenderer


public MeshRenderer PrefabRenderer { get; set; }


batchSize

How many meshes to update per batch. Larger values are more efficient, but have higher latency.


public int batchSize { get; set; }


computeNormals

When enabled, the system will compute the normals for the triangle vertices.


public bool computeNormals { get; set; }


density


public float density { get; set; }


disconnectedComponentArea

Any component that is disconnected from the main mesh and which has an area less than this size will be removed.


public float disconnectedComponentArea { get; set; }


fillHoleLength

Boundary distance (in meters) of holes you wish to have filled.


public float fillHoleLength { get; set; }


meshIdToGameObjectMap

A Dictionary which maps mesh ids to their GameObject s.


public Dictionary< MeshId, GameObject > meshIdToGameObjectMap { get; set; }


meshParent

The parent transform for generated meshes.


public Transform meshParent { get; set; }


meshPrefab

Get or set the prefab which should be instantiated to create individual mesh instances. May have a mesh renderer and an optional mesh collider for physics.


public GameObject meshPrefab { get; set; }


meshQueueSize

Controls the number of meshes to queue for generation at once. Larger numbers will lead to higher CPU usage.


public uint meshQueueSize { get; set; }


planarize

When enabled, the system will planarize the returned mesh (planar regions will be smoothed out).


public bool planarize { get; set; }


pollingRate

How often to check for updates, in seconds. More frequent updates will increase CPU usage.


public float pollingRate { get; set; }


removeMeshSkirt

When enabled, the mesh skirt (overlapping area between two mesh blocks) will be removed. This field is only valid when the Mesh Type is Blocks.


public bool removeMeshSkirt { get; set; }


requestVertexConfidence

When enabled, the system will generate confidence values for each vertex, ranging from 0-1.


public bool requestVertexConfidence { get; set; }

See: TryGetConfidence(MeshId, List<float>)


requestedMeshType

Request Magic Leap to generate a triangle mesh or point cloud points.


public MeshType requestedMeshType { get; set; }

TypeDescription
MeshTypeWhat type of mesh to generate: a triangle mesh or a point cloud

Public Methods

void DestroyAllMeshes

Destroy all mesh GameObject s created by this MeshingSubsystemComponent. The meshIdToGameObjectMap will also be cleared.

public void DestroyAllMeshes()

MeshingSubsystem.Extensions.MLMeshing.LevelOfDetail FromDensityToLevelOfDetail

public static MeshingSubsystem.Extensions.MLMeshing.LevelOfDetail FromDensityToLevelOfDetail(
float density
)

Parameters

TypeNameDescription
floatdensity

float FromLevelOfDetailToDensity

public static float FromLevelOfDetailToDensity(
MeshingSubsystem.Extensions.MLMeshing.LevelOfDetail lod
)

Parameters

TypeNameDescription
MeshingSubsystem.Extensions.MLMeshing.LevelOfDetaillodLevel of detail of the block mesh.

void OnMeshingPropertyChanged

public void OnMeshingPropertyChanged()

void RefreshAllMeshes

'Refresh' all known meshes (meshes that are in meshIdToGameObjectMap). This will force all meshes to be regenerated with the current settings.

public void RefreshAllMeshes()

void RefreshMesh

'Refresh' a single mesh. This forces the mesh to be regenerated with the current settings.

public void RefreshMesh(
MeshId meshId
)

Parameters

TypeNameDescription
MeshIdmeshIdThe MeshId of the mesh to regenerate.

void SetCustomMeshBlockRequests

public static void SetCustomMeshBlockRequests(
MeshingSubsystem.Extensions.MLMeshing.OnMeshBlockRequests onBlockRequests
)

Parameters

TypeNameDescription
MeshingSubsystem.Extensions.MLMeshing.OnMeshBlockRequestsonBlockRequests

bool TryGetConfidence

Retrieve the confidence values associated with a mesh. Confidence values range from 0..1. requestVertexConfidence must be enabled.

public bool TryGetConfidence(
MeshId meshId,
List< float > confidenceOut
)

Parameters

TypeNameDescription
MeshIdmeshIdThe unique MeshId of the mesh.
List< float >confidenceOutA List of floats, one for each vertex in the mesh.

See: requestVertexConfidence

Returns: True if confidence values were successfully retrieved for the mesh with id meshId .


Public Attributes

currentMeshType

The current mesh type being surfaced by the subsystem provider.


public MeshType currentMeshType => SubsystemFeatures.currentFeatures.HasFlag(Feature.Meshing) ? MeshType.Triangles : MeshType.PointCloud;

TypeDescription
MeshTypeWhat type of mesh to generate: a triangle mesh or a point cloud

Public Events

meshAdded

An event which is invoked whenever a new mesh is added

public Action< MeshId > meshAdded()

meshRemoved

An event which is invoked whenever an existing mesh is removed.

public Action< MeshId > meshRemoved()

meshUpdated

An event which is invoked whenever an existing mesh is updated (regenerated).

public Action< MeshId > meshUpdated()

Public Enums

MeshType

What type of mesh to generate: a triangle mesh or a point cloud

EnumeratorValueDescription
TrianglesGenerate triangle meshes
PointCloudGenerate a point cloud (a mesh with MeshTopology.Points )