public void CopyFrom(FastFrame src) { // assuming initialized with same values //Buffer.BlockCopy(src.DXT1_colors, 0, DXT1_colors, 0, DXT1_colors.Length); JPEG_colors = src.JPEG_colors;// (byte[]) src.JPEG_colors.Clone(); src.positions.CopyTo(positions, 0); }
public override void HandleDepthData(ushort sr, ushort er, UInt32 seq, ref byte[] data, int dataOffset) { try { if (seq < _newestSequence) { continuousSmallerSeqAm++; if (continuousSmallerSeqAm > 30) { _newestSequence = seq - 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 && seq > _newestSequence) { _newestSequence = seq; 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); } }