Ejemplo n.º 1
0
        void ProcessFrame(nuitrack.DepthFrame depthFrame, nuitrack.ColorFrame colorFrame, nuitrack.UserFrame userFrame)
        {
            for (int i = 0; i < parts; i++)
            {
                if (!visualizationParts[i].activeSelf)
                {
                    visualizationParts[i].SetActive(true);
                }
            }

            if (userFrame != null)
            {
                if (issuesProcessor.userIssues != null)
                {
                    for (int i = 1; i < userCurrentCols.Length; i++)
                    {
                        if (issuesProcessor.userIssues.ContainsKey(i))
                        {
                            userCurrentCols[i] =
                                (issuesProcessor.userIssues[i].isOccluded ||
                                 issuesProcessor.userIssues[i].onBorderLeft ||
                                 issuesProcessor.userIssues[i].onBorderRight ||
                                 issuesProcessor.userIssues[i].onBorderTop) ?
                                occludedUserCols[i] : userCols[i];
                        }
                    }
                }
            }

            if (colorFrame == null)
            {
                rgbTexture = depthFrame.ToRenderTexture();
            }
            else
            {
                rgbTexture = colorFrame.ToRenderTexture();
            }

            depthTexture        = depthFrame.ToRenderTexture(depthGradient, depthCache);
            segmentationTexture = userFrame.ToRenderTexture(userCurrentCols, textureCache);

            if (!showBackground)
            {
                FrameUtils.TextureUtils.Cut(rgbTexture, segmentationTexture, ref rgbRenderTexture);
                visMat.SetTexture("_RGBTex", rgbRenderTexture);
            }
            else
            {
                visMat.SetTexture("_RGBTex", rgbTexture);
            }

            visMat.SetFloat("_maxSensorDepth", FrameUtils.DepthToTexture.MaxSensorDepth);
            visMat.SetTexture("_DepthTex", depthTexture);
            visMat.SetTexture("_SegmentationTex", segmentationTexture);
        }
        void ProcessFrame(nuitrack.DepthFrame depthFrame, nuitrack.ColorFrame colorFrame, nuitrack.UserFrame userFrame)
        {
            for (int i = 0; i < visualizationParts.Length; i++)
            {
                if (!visualizationParts[i].activeSelf)
                {
                    visualizationParts[i].SetActive(true);
                }
            }

            if (colorFrame == null)
            {
                rgbTexture = depthFrame.ToRenderTexture();
            }
            else
            {
                rgbTexture = colorFrame.ToRenderTexture();
            }

            if (!showBackground)
            {
                FrameUtils.TextureUtils.Cut(rgbTexture, segmentationTexture, ref rgbRenderTexture);
                meshMat.SetTexture("_RGBTex", rgbRenderTexture);
            }
            else
            {
                meshMat.SetTexture("_RGBTex", rgbTexture);
            }

            depthTexture        = depthFrame.ToRenderTexture(depthGradient, depthCache);
            segmentationTexture = userFrame.ToRenderTexture(userCols, textureCache);

            meshMat.SetTexture("_DepthTex", depthTexture);
            meshMat.SetTexture("_SegmentationTex", segmentationTexture);


            meshMat.SetFloat("_maxSensorDepth", FrameUtils.DepthToTexture.MaxSensorDepth);
        }