class ARScanningManager
(Niantic.Lightship.AR.Scanning.ARScanningManager)
Overview
A manager for recording scans of the AR scene for Playback. The recording will start when the manager is enabled. Use SaveScan() to stop and save the recording into the ScanPath.
class ARScanningManager: SubsystemLifecycleManager< XRScanningSubsystem, XRScanningSubsystemDescriptor, XRScanningSubsystem.Provider > {
public:
// fields
NativeArray<Vector3> VoxelPositions => _voxelPositions;
NativeArray<Color32> VoxelColors => _voxelColors;
NativeArray<Vector3> VoxelNormals => _voxelNormals;
float LatestVoxelSize => _latestVoxelSize;
// properties
string ScanPath;
bool FullResolutionEnabled;
int FullResolutionFramerate;
string ScanTargetId;
int ScanRecordingFramerate;
bool EnableRaycastVisualization;
bool EnableVoxelVisualization;
bool UseEstimatedDepth;
float MinimumVoxelSize;
float NearDepth;
float FarDepth;
// methods
Texture2D GetRaycastColorTexture();
Texture2D GetRaycastNormalTexture();
Texture2D GetRaycastPositionTexture();
ScanStore GetScanStore();
async Task SaveScan();
async Task DiscardScan();
string GetCurrentScanId();
void RequestVoxelUpdate();
bool TryGetVoxelBuffer();
protected:
// methods
override void OnBeforeStart();
override void OnDisable();
};
Detailed Documentation
A manager for recording scans of the AR scene for Playback. The recording will start when the manager is enabled. Use SaveScan() to stop and save the recording into the ScanPath.
Fields
VoxelPositions
NativeArray<Vector3> VoxelPositions => _voxelPositions
The positions of voxels scanned with the camera. Each entry in the array corresponds to an entry in VoxelColors at the same index. These values can only be updated when EnableVoxelVisualization is true and scanning is in the XRScanningState.Started state. Call RequestVoxelUpdate to update the underlying map, and then call TryGetVoxelBuffer to populate with the latest values.
VoxelColors
NativeArray<Color32> VoxelColors => _voxelColors
The color of each voxel. Each entry in the array corresponds to an entry in VoxelPositions at the same index. These values can only be updated when EnableVoxelVisualization is true and scanning is in the XRScanningState.Started state. Call RequestVoxelUpdate to update the underlying map, and then call TryGetVoxelBuffer to populate with the latest values.
VoxelNormals
NativeArray<Vector3> VoxelNormals => _voxelNormals
The normal vector of each voxel. Each entry in the array corresponds to an entry in VoxelPositions at the same index. These values can only be updated when EnableVoxelVisualization is true and scanning is in the XRScanningState.Started state. Call RequestVoxelUpdate to update the underlying map, and then call TryGetVoxelBuffer to populate with the latest values.
LatestVoxelSize
float LatestVoxelSize => _latestVoxelSize
The size of the voxels in VoxelPositions, in meters. The voxel visualizer attempts to use the voxel size requested by the MinimumVoxelSize parameter. As the number of voxels grows, the voxel visualizer periodically doubles the voxel size to keep memory use in check. This value should be used for rendering the voxels with the correct dimensions.
Properties
ScanPath
string ScanPath
The scan path to store the scan data. If an absolute path is provided (starting with '/', '', or a drive name), the directory must be writable, and the application must have permissions to write to the folder. Otherwise, the path will be interpreted as relative to Application.persistentDataPath.
FullResolutionEnabled
bool FullResolutionEnabled
Record full resolution images for scan reconstruction. Must be set before scanning starts to take effect.
FullResolutionFramerate
int FullResolutionFramerate
The framerate for full resolution frame recording. A framerate of zero means the system will use the default framerate of 2 FPS. Must be set before scanning starts to take effect.