Exemplo n.º 1
0
        protected virtual void LateUpdate()
        {
            if (context.Data == null)
            {
                return;
            }

            timeSinceLastDevicePoll += Time.deltaTime;
            if (timeSinceLastDevicePoll >= POLLING_DELAY + (isResettingCamera ? POLLING_MIN_CLEAR_WAIT : 0f))
            {
                bool isConnected = FeedDeviceManager.IsVideoDeviceConnected(context.Data.deviceAltName);
                if (wasCameraConnected && !isConnected)
                {
                    isResettingCamera = true;
                    ClearTexture();
                    context.Data.unplugged  = true;
                    lastValidMode           = context.Data.outputMode;
                    context.Data.outputMode = MixCastData.OutputMode.Immediate;
                }
                else if (!wasCameraConnected && isConnected)
                {
                    timeSinceLastDevicePoll = 0f;
                    FeedDeviceManager.BuildDeviceList();
                    SetTexture();
                    context.Data.unplugged  = false;
                    isResettingCamera       = false;
                    context.Data.outputMode = lastValidMode;
                }
                else
                {
                    timeSinceLastDevicePoll = 0f;
                }
                wasCameraConnected = isConnected;
            }
        }
Exemplo n.º 2
0
        protected override void OnEnable()
        {
            if (gameCamera != null)
            {
                gameCamera.stereoTargetEye = StereoTargetEyeMask.None;
                gameCamera.enabled         = false;
            }

            base.OnEnable();

            if (context.Data != null)
            {
                if (string.IsNullOrEmpty(context.Data.deviceName))
                {
                    context.Data.deviceUseAutoFoV = false; // resolve edge case where someone with old 1.5.2 data with autofov = true and no cam input, would see auto fov enabled by default on first virtual camera created in 2.0
                }
                BuildOutput();
            }

            HandleDataChanged();

            ActiveCameras.Add(this);

            if (context.Data != null)
            {
                context.Data.unplugged = !FeedDeviceManager.IsVideoDeviceConnected(context.Data.deviceAltName);
            }
        }