public void OnNewDepthFrame(Astra.DepthFrame frame)
    {
        if (frame.Width == 0 ||
            frame.Height == 0)
        {
            return;
        }

        if (_lastFrameIndex == frame.FrameIndex)
        {
            return;
        }

        _lastFrameIndex = frame.FrameIndex;
        frame.CopyData(ref _depthFrameData);
        // unfortunately we have to convert from short[] to float[]
        // as compute shaders don't support short data type
        for (int i = 0; i < _depthFrameDataFloat.Length; i++)
        {
            _depthFrameDataFloat[i] = _depthFrameData[i];
        }
        _depthBuffer.SetData(_depthFrameDataFloat);

        RunShader();
        BakeShaderData();
    }
Exemplo n.º 2
0
    public void OnNewFrame(Astra.DepthFrame frame)
    {
        if (frame.Width == 0 ||
            frame.Height == 0)
        {
            return;
        }
        //This is default, but I would assume astra only calls "onNewFrame" once fram index has changed in the first place??
        if (_lastFrameIndex == frame.FrameIndex)
        {
            return;
        }

        _lastFrameIndex = frame.FrameIndex;

        EnsureBuffers(frame.Width, frame.Height);
        frame.CopyData(ref _depthFrameData);

        MapDepthToTexture(_depthFrameData);
    }
Exemplo n.º 3
0
    public void OnNewFrame(Astra.DepthFrame frame)
    {
        if (frame.Width == 0 ||
            frame.Height == 0)
        {
            return;
        }

        if (_lastFrameIndex == frame.FrameIndex)
        {
            return;
        }

        _lastFrameIndex = frame.FrameIndex;

        EnsureBuffers(frame.Width, frame.Height);
        frame.CopyData(ref _depthFrameData);

        MapDepthToTexture(_depthFrameData);
    }
Exemplo n.º 4
0
    public void OnNewDepthFrame(Astra.DepthFrame depthFrame)
    {
        //TODO: I think this should guarantee that there is data, but should make sure
        if (depthFrame.Width == 0 ||
            depthFrame.Height == 0)
        {
            return;
        }
        //This is default, but I would assume astra only calls "onNewFrame" once fram index has changed in the first place??
        if (_lastFrameIndex == depthFrame.FrameIndex)
        {
            return;
        }
        _lastFrameIndex = depthFrame.FrameIndex;
        //print("Depth frame x: " + depthFrame.Width + "y: " + depthFrame.Height);
        //EnsureBuffers(depthFrame.Width, depthFrame.Height);
        depthFrame.CopyData(ref _depthFrameData);

        //MapParticlesToBody(_depthFrameData);
    }