public void CopyFrom(FastFrame src) { // assuming initialized with same values //Buffer.BlockCopy(src.DXT1_colors, 0, DXT1_colors, 0, DXT1_colors.Length); if (src.JPEG_colors != null) { JPEG_colors = src.JPEG_colors;// (byte[]) src.JPEG_colors.Clone(); } if (src.BodyIndexJPEG_colors != null) { BodyIndexJPEG_colors = src.JPEG_colors; } src.positions.CopyTo(positions, 0); }
public override void HandleDepthData(ushort sr, ushort er, ulong timestamp, ref byte[] data, int dataOffset) { try { if (timestamp < _newestTimestamp) { continuousSmallerSeqAm++; if (continuousSmallerSeqAm > 1000) // { _newestTimestamp = timestamp - 1; } else { return; } } continuousSmallerSeqAm = 0; FastFrame ff = null; lock (_frameBufferLock) { if (_frameBuffer.Count < 2) { Debug.LogWarning("Renderer not fast enough, dropping a frame."); return; } _frameBuffer.Peek().LoadDepthData(sr, er, ref data, dataOffset); if (er == TotalHeight && timestamp > _newestTimestamp) { _newestTimestamp = timestamp; ff = _frameBuffer.Dequeue(); _frameBuffer.Peek().CopyFrom(ff); } } if (ff != null) { ff.cameraPos = FrameSource.cameraPosition; ff.cameraRot = FrameSource.cameraRotation; FrameSource.frameQueue.Enqueue(ff); } } catch (Exception e) { Debug.LogError(e); } }
public void ReturnFromRender(FastFrame ff) { lock (_frameBufferLock) { _frameBuffer.Enqueue(ff); } }