public static bool GetDepthColliderFrameInfo() { int result = (int)Error.FAILED; if (!InitialDepthColliderPtrSize) { result = ViveSR_Framework.GetMultiDataSize(ViveSR_Framework.MODULE_ID_DEPTH, DataInfoDepthCollider, DataInfoDepthCollider.Length); InitialDepthColliderPtrSize = (result == (int)Error.WORK); } DataInfo[] dataInfoFrame = new DataInfo[] { DataInfoDepthCollider[(int)DepthDataMask.TIME_STP] }; result = ViveSR_Framework.GetMultiData(ViveSR_Framework.MODULE_ID_DEPTH, dataInfoFrame, dataInfoFrame.Length); if (result != (int)Error.WORK) { return(false); } Marshal.Copy(DataInfoDepthCollider[(int)DepthDataMask.TIME_STP].ptr, RawDepthColliderTimeIndex, 0, RawDepthColliderTimeIndex.Length); if (LastDepthColliderTimeIndex == DepthColliderTimeIndex) { return(false); } else { LastDepthColliderTimeIndex = DepthColliderTimeIndex; } return(true); }
/// <summary> /// Update the buffer of depth texture, frame index and time index. /// </summary> public static void UpdateDepthImage() { int result = (int)Error.FAILED; if (!InitialDepthPtrSize) { result = ViveSR_Framework.GetMultiDataSize(ViveSR_Framework.MODULE_ID_DEPTH, DataInfoDepth, DataInfoDepth.Length); InitialDepthPtrSize = (result == (int)Error.WORK); } DataInfo[] dataInfoFrame = new DataInfo[] { DataInfoDepth[(int)DepthDataMask.FRAME_SEQ] }; result = ViveSR_Framework.GetMultiData(ViveSR_Framework.MODULE_ID_DEPTH, dataInfoFrame, dataInfoFrame.Length); if (result != (int)Error.WORK) { return; } Marshal.Copy(DataInfoDepth[(int)DepthDataMask.FRAME_SEQ].ptr, RawDepthFrameIndex, 0, RawDepthFrameIndex.Length); if (LastDepthFrameIndex == DepthFrameIndex) { return; } else { LastDepthFrameIndex = DepthFrameIndex; } result = ViveSR_Framework.GetMultiData(ViveSR_Framework.MODULE_ID_DEPTH, DataInfoDepth, DataInfoDepth.Length); if (result == (int)Error.WORK) { ParseDepthPtrData(); } }
/// <summary> /// Update the buffer of undistorted texture, frame index and time index. /// </summary> public static void UpdateUndistortedImage() { int result = (int)Error.FAILED; if (!InitialUndistortedPtrSize) { result = ViveSR_Framework.GetMultiDataSize(ViveSR_Framework.MODULE_ID_SEETHROUGH, DataInfoUndistorted, DataInfoUndistorted.Length); InitialUndistortedPtrSize = (result == (int)Error.WORK); } DataInfo[] dataInfoFrame = new DataInfo[] { DataInfoUndistorted[(int)SeeThroughDataMask.FRAME_SEQ] }; result = ViveSR_Framework.GetMultiData(ViveSR_Framework.MODULE_ID_SEETHROUGH, dataInfoFrame, dataInfoFrame.Length); if (result != (int)Error.WORK) { return; } Marshal.Copy(DataInfoUndistorted[(int)SeeThroughDataMask.FRAME_SEQ].ptr, RawUndistortedFrameIndex, 0, RawUndistortedFrameIndex.Length); if (LastUndistortedFrameIndex == UndistortedFrameIndex) { return; } else { LastUndistortedFrameIndex = UndistortedFrameIndex; } result = ViveSR_Framework.GetMultiData(ViveSR_Framework.MODULE_ID_SEETHROUGH, DataInfoUndistorted, DataInfoUndistorted.Length); if (result == (int)Error.WORK) { ParseUndistortedPtrData(); } }
public static bool GetRigidReconstructionData(ref int frame, out float[] pose, ref int verticesNum, out float[] verticesBuff, ref int vertStrideInFloat, out int[] sectorIDList, ref int sectorNum, out int[] sectorVertNum, out int[] sectorMeshIdNum, ref int indicesNum, out int[] indicesBuff) { if (!UsingCallback) { int result = (int)Error.FAILED; if (!InitialPointCloudPtrSize) { result = ViveSR_Framework.GetMultiDataSize(ViveSR_Framework.MODULE_ID_RIGID_RECONSTRUCTION, DataInfoPointCloud, DataInfoPointCloud.Length); InitialPointCloudPtrSize = (result == (int)Error.WORK); } result = ViveSR_Framework.GetMultiData(ViveSR_Framework.MODULE_ID_RIGID_RECONSTRUCTION, DataInfoPointCloud, DataInfoPointCloud.Length); if (result == (int)Error.WORK) { ParseReconstructionPtrData(); } } bool isUpdated = (verticesNum != VertNum); verticesNum = VertNum; indicesNum = IdxNum; frame = FrameSeq; vertStrideInFloat = VertStrideInByte / 4; verticesBuff = OutVertex; indicesBuff = OutIndex; pose = TrackedPose; sectorIDList = SectorIDList; sectorNum = SectorNum; sectorVertNum = SectorVertNum; sectorMeshIdNum = SectorMeshIdNum; return(isUpdated); }
public static bool GetRigidReconstructionFrame(ref int frame) { int result = (int)Error.FAILED; if (!UsingCallback) { if (!InitialPointCloudPtrSize) { result = ViveSR_Framework.GetMultiDataSize(ViveSR_Framework.MODULE_ID_RIGID_RECONSTRUCTION, DataInfoPointCloud, DataInfoPointCloud.Length); InitialPointCloudPtrSize = (result == (int)Error.WORK); } DataInfo[] dataInfoFrame = new DataInfo[] { DataInfoPointCloud[(int)ReconstructionDataMask.FRAME_SEQ] }; result = ViveSR_Framework.GetMultiData(ViveSR_Framework.MODULE_ID_RIGID_RECONSTRUCTION, dataInfoFrame, dataInfoFrame.Length); if (result != (int)Error.WORK) { return(false); } Marshal.Copy(DataInfoPointCloud[(int)ReconstructionDataMask.FRAME_SEQ].ptr, RawPointCloudFrameIndex, 0, RawPointCloudFrameIndex.Length); } frame = RawPointCloudFrameIndex[0]; return(true); }