Skip to main content

CLASS

ArdkMeshingSession

public final class ArdkMeshingSession: ArdkSession.IDisposable, ArdkFeatureSession

A session for real-time 3D mesh generation from AR camera frames.

The meshing feature provides capabilities for processing AR session data and generating a triangle mesh representation of the physical environment in real-time. The mesh is divided into chunks that can be individually queried and updated as the environment is scanned.

Methods​

featureStatus()​

public func featureStatus() -> ArdkFeatureStatus

Reports errors that have occurred within processes running inside this feature.

Check this periodically to see if any errors have occurred with processes running inside this feature. Once an error has been flagged, it will remain flagged until the culprit process has been run again and completed successfully.

  • Returns: Feature status flags for any issues that have occurred

configure(with:)​

public func configure(with config: Configuration) throws

Configures the meshing feature with the specified settings.

  • Attention: If this method is called while meshing is running, the meshing feature will restart with the new configuration, and any mesh data that has been produced will be lost.

  • Parameter config: An object that defines the meshing behavior.

  • Throws: ArdkError.invalidArgument if the configuration is invalid. Check ARDK's C logs for more information.

Parameters​

NameDescription
configAn object that defines the meshing behavior.

start()​

public func start()

Starts the meshing feature.

The feature will begin processing AR frame data and building a mesh according to the currently applied configuration.

stop()​

public func stop()

Stops the meshing feature.

  • Note: This will clear previously generated mesh data.

updatedMeshInfos()​

public func updatedMeshInfos() -> MeshUpdateInfo?

Gets the ids of all chunks in the current mesh and their update status.

The returned information contains the ids and update status for all chunks currently in the mesh. If a chunk's updated flag is true, the mesh chunk has been updated since the last time its data was read with meshDataById(id:).

To retrieve the data for a specific chunk, call meshDataById(id:).

  • Returns: A buffer containing updated mesh chunk ids, nil if there are no chunks.

meshDataById(id:)​

public func meshDataById(id: Int64) -> MeshData?

Retrieves the mesh data for a specified chunk.

  • Note: This method resets the updated flag for the specified chunk. Subsequent calls to updatedMeshInfos() will only mark the chunk as updated if its mesh data has changed since the mesh chunk's data was last retrieved.

  • Parameter id: The ID of the mesh chunk to retrieve, obtained from updatedMeshInfos().

  • Returns: The mesh data for the specified chunk, or nil if no chunk with the given ID exists.

Parameters​

NameDescription
idThe ID of the mesh chunk to retrieve, obtained from updatedMeshInfos().

lastMeshUpdateTime()​

public func lastMeshUpdateTime() -> UInt64?

Gets the timestamp of the latest mesh update.

  • Returns: The timestamp in milliseconds, or nil if no mesh data has been produced yet.