예제 #1
0
        private void Start()
        {
            this.fov                     = this.sceneCamera.fieldOfView;
            this.aspectRatio             = this.sceneCamera.aspect;
            this.nearPlane               = this.sceneCamera.nearClipPlane;
            this.farPlane                = this.sceneCamera.farClipPlane;
            this.defaultCameraProjection =
                UnityEngine.Matrix4x4.Perspective(this.fov, this.aspectRatio, this.nearPlane, this.farPlane);

            this.sceneCamera.projectionMatrix = this.defaultCameraProjection;
        }
예제 #2
0
        private void LateUpdate()
        {
            if (this.compositorMaterial == null || this.videoTexture == null || mRunningTextureName == "")  //*LKH* - 추가, mRunningTextureName == null
            {
                return;
            }

            // set the camera transforms
            CameraPose?currentCameraPose
                = this.cameraTransform.ConvertWorldViewMatrix();

            if (currentCameraPose == null)
            {
                currentCameraPose = this.lastGoodCameraTransform.ConvertWorldViewMatrix();
            }

            if (currentCameraPose != null)
            {
                this.transform.position = currentCameraPose.Value.Position;
                this.transform.rotation = currentCameraPose.Value.Rotation;
            }

            // swap the projection for the one sent to us
            UnityEngine.Matrix4x4?currentCameraProjection
                = this.cameraProjection.ConvertCameraProjectionMatrix(this.nearPlane, this.farPlane);
            if (currentCameraProjection == null)
            {
                currentCameraProjection
                    = this.lastGoodCameraProjection.ConvertCameraProjectionMatrix(this.nearPlane, this.farPlane);
            }

            if (currentCameraProjection != null)
            {
                this.sceneCamera.projectionMatrix = currentCameraProjection.Value;
            }

            // if screen dimensions have changed, adjust the viewport
            if (Screen.width != this.lastScreenWidth || Screen.height != this.lastScreenHeight)
            {
                this.OnResolutionChanged(this.videoTexture.width, this.videoTexture.height);

                this.defaultCameraProjection =
                    UnityEngine.Matrix4x4.Perspective(this.fov, this.aspectRatio, this.nearPlane, this.farPlane);
            }
        }