Пример #1
0
        void Update()
        {
            if (sensorData == null)
            {
                return;
            }

            if (!bBackgroundRemovalInited || lastColorW != sensorData.colorImageWidth || lastColorH != sensorData.colorImageHeight)
            {
                lastColorW = sensorData.colorImageWidth;
                lastColorH = sensorData.colorImageHeight;

                if (bBackgroundRemovalInited)
                {
                    FinishBackgroundRemoval(sensorData);
                    if (foregroundImage != null)
                    {
                        foregroundImage.texture = null;
                    }
                    //bBackgroundRemovalInited = false;

                    // dispose the used shaders & buffers, as well
                    if (sensorInt != null)
                    {
                        sensorInt.UpdateTransformedFrameTextures(sensorData, kinectManager);
                    }
                }

                bBackgroundRemovalInited = InitBackgroundRemoval(sensorData);

                if (bBackgroundRemovalInited)
                {
                    if (debugText != null)
                    {
                        debugText.text = string.Empty;
                    }
                }
            }

            if (bBackgroundRemovalInited)
            {
                // update the background removal
                UpdateBackgroundRemoval(sensorData);

                // check for valid foreground image texture
                if (foregroundImage != null && foregroundImage.texture == null)
                {
                    foregroundImage.texture = foregroundTexture;
                    foregroundImage.rectTransform.localScale = kinectManager.GetColorImageScale(sensorIndex);
                    foregroundImage.color = Color.white;
                }
            }
        }
Пример #2
0
        void Update()
        {
            if (bBackgroundRemovalInited)
            {
                // update the background removal
                UpdateBackgroundRemoval(sensorData);

                // check for valid foreground image texture
                if (foregroundImage != null && foregroundImage.texture == null)
                {
                    foregroundImage.texture = foregroundTexture;
                    foregroundImage.rectTransform.localScale = kinectManager.GetColorImageScale(sensorIndex);
                    foregroundImage.color = Color.white;
                }
            }
        }