コード例 #1
0
        public static bool StartStream(Record3DDevice device /*, OnNewFrame onNewFrameCallback, OnStreamStopped onStreamStoppedCallback*/)
        {
            var _frameMetadata = frameMetadata;
            int rgbBuffLength  = _frameMetadata.width * _frameMetadata.height * _frameMetadata.numComponentsPerColorTexturePixel;
            int posBuffLength  = _frameMetadata.width * _frameMetadata.height * _frameMetadata.numComponentsPerPositionTexturePixel;

            rgbBuffer       = new byte[rgbBuffLength];
            positionsBuffer = new float[posBuffLength];

            _OnNewFrame newFrameCallback = (data) =>
            {
                frameWidth  = data.frameWidth;
                frameHeight = data.frameHeight;
                Marshal.Copy(data.rgbFrameBufferPtr, rgbBuffer, 0, rgbBuffer.Length);
                Marshal.Copy(data.depthFrameBufferPtr, positionsBuffer, 0, positionsBuffer.Length);
            };

            _OnStreamStopped streamStoppedCallback = () =>
            {
            };

            bool connectionEstablished = StartStreaming(device, newFrameCallback, streamStoppedCallback);

            return(connectionEstablished);
        }
コード例 #2
0
 private static extern bool StartStreaming(Record3DDevice device, _OnNewFrame onNewFrameCallback, _OnStreamStopped onStreamStoppedCallback);