Skip to main content

class XRScanningSubsystem

(Niantic.Lightship.AR.XRSubsystems.XRScanningSubsystem)

Overview​

Defines an interface for interacting with scanning functionality.

	class XRScanningSubsystem: SubsystemWithProvider< XRScanningSubsystem, XRScanningSubsystemDescriptor, XRScanningSubsystem.Provider > {
public:

class Provider;

// properties

XRScanningConfiguration CurrentConfiguration;

// methods

XRScanningSubsystem();
XRScanningState GetState();

bool TryGetRaycastBuffer(
out XRTextureDescriptor colorBufferDescriptor,
out XRTextureDescriptor normalBufferDescriptor,
out XRTextureDescriptor positionTextureDescriptor
);

void ComputeVoxels();
bool TryGetVoxelBuffer(out XRScanningVoxelData voxelData);
void DisposeVoxelBuffer(XRScanningVoxelData voxelData);
float GetVoxelSize();
string GetScanId();
void SaveCurrentScan();
void DiscardCurrentScan();
};

Detailed Documentation​

Defines an interface for interacting with scanning functionality.

This abstract class should be implemented by an XR provider and instantiated using the SubsystemManager to enumerate the available XRScanningSubsystemDescriptor s.

Properties​

CurrentConfiguration​

XRScanningConfiguration CurrentConfiguration

Get or set configuration with <name> XRScanningConfiguration </name>

Methods​

XRScanningSubsystem​

XRScanningSubsystem()

Constructor. Do not invoke directly; use the SubsystemManager to enumerate the available XRScanningSubsystemDescriptor s and call Create on the desired descriptor.

GetState​

XRScanningState GetState()

Get the current state of the scanning subsystem.

TryGetRaycastBuffer​

bool TryGetRaycastBuffer(
out XRTextureDescriptor colorBufferDescriptor,
out XRTextureDescriptor normalBufferDescriptor,
out XRTextureDescriptor positionTextureDescriptor
)

Get the latest raycast textures.

ComputeVoxels​

void ComputeVoxels()

Request a voxel buffer to be computed. This is an async operation that takes some time. Obtain the result with TryGetVoxels. "enableVoxels" must be set to true on the XRScanningConfiguration

TryGetVoxelBuffer​

bool TryGetVoxelBuffer(out XRScanningVoxelData voxelData)

Get latest computed voxel buffer. This then must be later disposed with DisposeVoxelBuffer

DisposeVoxelBuffer​

void DisposeVoxelBuffer(XRScanningVoxelData voxelData)

Dispose a voxel buffer previously obtained from TryGetVoxelBuffer

GetVoxelSize​

float GetVoxelSize()

Get the current voxel size in meters.

    Returns:

    The current voxel size in meters, or 0 if voxel visualization is not enabled.

GetScanId​

string GetScanId()

Get the current scan's ID.

SaveCurrentScan​

void SaveCurrentScan()

Save the current scan. Recording will stop after save. ScanID will be reset.

DiscardCurrentScan​

void DiscardCurrentScan()

Discards the current scan. Anything previously saved will be deleted. Recording will stop after discard. ScanID will be reset.