protected override void PostPipelineStageCallback(CinemachineVirtualCameraBase vcam, CinemachineCore.Stage stage, ref CameraState state, float deltaTime) { if (stage == CinemachineCore.Stage.Aim) { if (!this.IsValid) { this.DestroyProfileCopy(); } else { if (!this.m_FocusTracksTarget || !state.HasLookAt) { this.DestroyProfileCopy(); } else { if (this.mProfileCopy == null || this.mCachedProfileIsInvalid) { this.CreateProfileCopy(); } DepthOfField depthOfField; if (this.mProfileCopy.TryGetSettings <DepthOfField>(out depthOfField)) { depthOfField.focusDistance.value = (state.FinalPosition - state.ReferenceLookAt).magnitude + this.m_FocusOffset; } } state.AddCustomBlendable(new CameraState.CustomBlendable(this, 1f)); } } }
protected override void PostPipelineStageCallback( CinemachineVirtualCameraBase vcam, CinemachineCore.Stage stage, ref CameraState state, float deltaTime) { //UnityEngine.Profiling.Profiler.BeginSample("CinemachinePostProcessing.PostPipelineStageCallback"); // Set the focus after the camera has been fully positioned. // GML todo: what about collider? if (stage == CinemachineCore.Stage.Aim) { if (!IsValid) { DestroyProfileCopy(); } else { // Handle Follow Focus if (!m_FocusTracksTarget) { DestroyProfileCopy(); } else { if (mProfileCopy == null || mCachedProfileIsInvalid) { CreateProfileCopy(); } DepthOfField dof; if (mProfileCopy.TryGetSettings(out dof)) { float focusDistance = m_FocusOffset; if (state.HasLookAt) { focusDistance += (state.FinalPosition - state.ReferenceLookAt).magnitude; } dof.focusDistance.value = Mathf.Max(0, focusDistance); } } // Apply the post-processing state.AddCustomBlendable(new CameraState.CustomBlendable(this, 1)); } } //UnityEngine.Profiling.Profiler.EndSample(); }