private void ExtractMeshDataThread() { while (IsThreadRunning == true) { try { if (IsMeshUpdate == false && ViveSR_RigidReconstruction.IsScanning == true) { bool result = ViveSR_RigidReconstruction.GetRigidReconstructionFrame(ref ProcessedFrame); if (ProcessedFrame != LastProcessedFrame && result == true) { LastProcessedFrame = ProcessedFrame; float[] _camPose; result = ViveSR_RigidReconstruction.GetRigidReconstructionData(ref ProcessedFrame, out _camPose, ref VertexNum, out VertexData, ref VertStrideInFloat, out SectorIDList, ref SectorNum, out SectorVertNum, out SectorMeshIdNum, ref IndexNum, out IndexData); if (result == true) { NumSubMeshes = 0; LastProcessedFrame = ProcessedFrame; RenderWithEnableSector = EnableSector; if (LiveMeshDisplayMode != ReconstructionDisplayMode.ADAPTIVE_MESH) { UpdatePointCloudDataList(); } else if (IndexNum > 0) { UpdateMeshesDataList(); } } } } } catch (System.Exception e) { NumSubMeshes = 0; Debug.LogWarning(e.Message); } Thread.Sleep(ThreadPeriod); //Avoid too fast get data from SR SDK DLL } }
private void ExtractMeshDataThread() { while (IsThreadRunning == true) { try { if (IsMeshUpdate == false && ViveSR_RigidReconstruction.IsDuringScannedMeshPreview) { if (RigidReconstruction.SRWork_Rigid_Reconstruciton.UpdateData()) { bool result = ViveSR_RigidReconstruction.GetScannedModelPreviewData( ref ModelChunkNum, ref ModelChunkIdx, ref VertexNum, out VertexData, ref IndexNum, out IndexData); if (result) { lock (MeshLock) { if (VertexNum > 0) { UpdateMeshesDataList(); } if (ModelPreviewIsCompleted()) { SRWorkModule_API.SetReconstructionParameterBool((int)(ReconstructionCmd.MODEL_PREVIEW_FINISH), true); // to stop getting data from SRWorks ModelChunkNum = 0; } else { SRWorkModule_API.SetReconstructionParameterBool((int)(ReconstructionCmd.MODEL_PREVIEW_NEXT_CHUNK), true); } } } } } else if (IsMeshUpdate == false && ViveSR_RigidReconstruction.IsScanning == true) { if (RigidReconstruction.SRWork_Rigid_Reconstruciton.UpdateData()) { bool result = ViveSR_RigidReconstruction.GetRigidReconstructionFrame(ref ProcessedFrame); if (ProcessedFrame != LastProcessedFrame && result == true) { LastProcessedFrame = ProcessedFrame; float[] _camPose; result = ViveSR_RigidReconstruction.GetRigidReconstructionData( ref ProcessedFrame, out _camPose, ref VertexNum, out VertexData, ref VertStrideInFloat, out SectorIDList, ref SectorNum, out SectorVertNum, out SectorMeshIdNum, ref IndexNum, out IndexData); if (result == true) { lock (MeshLock) { NumSubMeshes = 0; LastProcessedFrame = ProcessedFrame; if (LiveMeshDisplayMode != ReconstructionDisplayMode.ADAPTIVE_MESH) { UpdatePointCloudDataList(); } else if (IndexNum > 0) { UpdateMeshesDataList(); } } } } } } } catch (System.Exception e) { NumSubMeshes = 0; Debug.LogWarning(e.Message); } Thread.Sleep(ThreadPeriod); //Avoid too fast get data from SR SDK DLL } }