void OnBeginFrameRendering(ScriptableRenderContext context, Camera[] cameras) { var rtSize = cameraRTSize; m_Internal.CalculateCameraProperties(rtSize.x, rtSize.y); PixelSnap(); if (m_Internal.useOffscreenRT) { m_Camera.pixelRect = m_Internal.CalculateFinalBlitPixelRect(rtSize.x, rtSize.y); } else { m_Camera.rect = new Rect(0.0f, 0.0f, 1.0f, 1.0f); } // In Cinemachine compatibility mode the control over orthographic size should // be given to the virtual cameras, whose orthographic sizes will be corrected to // be pixel-perfect. This way when there's blending between virtual cameras, we // can have temporary not-pixel-perfect but smooth transitions. if (!m_CinemachineCompatibilityMode) { m_Camera.orthographicSize = m_Internal.orthoSize; } }
void OnBeginCameraRendering(ScriptableRenderContext context, Camera camera) { if (camera != m_Camera) { return; } var targetTexture = m_Camera.targetTexture; Vector2Int rtSize = targetTexture == null ? new Vector2Int(Screen.width, Screen.height) : new Vector2Int(targetTexture.width, targetTexture.height); m_Internal.CalculateCameraProperties(rtSize.x, rtSize.y); PixelSnap(); if (m_Internal.useOffscreenRT) { m_Camera.pixelRect = m_Internal.CalculateFinalBlitPixelRect(rtSize.x, rtSize.y); } else { m_Camera.rect = new Rect(0.0f, 0.0f, 1.0f, 1.0f); } // In Cinemachine compatibility mode the control over orthographic size should // be given to the virtual cameras, whose orthographic sizes will be corrected to // be pixel-perfect. This way when there's blending between virtual cameras, we // can have temporary not-pixel-perfect but smooth transitions. if (!m_CinemachineCompatibilityMode) { m_Camera.orthographicSize = m_Internal.orthoSize; } UnityEngine.U2D.PixelPerfectRendering.pixelSnapSpacing = m_Internal.unitsPerPixel; }
void OnBeginCameraRendering(ScriptableRenderContext context, Camera camera) { if (camera != m_Camera) { return; } var targetTexture = m_Camera.targetTexture; Vector2Int rtSize = targetTexture == null ? new Vector2Int(Screen.width, Screen.height) : new Vector2Int(targetTexture.width, targetTexture.height); m_Internal.CalculateCameraProperties(rtSize.x, rtSize.y); PixelSnap(); if (m_Internal.useOffscreenRT) { m_Camera.pixelRect = m_Internal.CalculateFinalBlitPixelRect(m_Camera.aspect, rtSize.x, rtSize.y); } else { m_Camera.rect = new Rect(0.0f, 0.0f, 1.0f, 1.0f); } m_Camera.orthographicSize = m_Internal.orthoSize; UnityEngine.U2D.PixelPerfectRendering.pixelSnapSpacing = m_Internal.unitsPerPixel; }
void Awake() { m_Camera = GetComponent <Camera>(); m_Internal = new PixelPerfectCameraInternal(this); // Case 1249076: Initialize internals immediately after the scene is loaded, // as the Cinemachine extension may need them before OnBeginContextRendering is called. var rtSize = cameraRTSize; m_Internal.CalculateCameraProperties(rtSize.x, rtSize.y); }
void UpdateCameraProperties() { var rtSize = cameraRTSize; m_Internal.CalculateCameraProperties(rtSize.x, rtSize.y); if (m_Internal.useOffscreenRT) { m_Camera.pixelRect = m_Internal.CalculateFinalBlitPixelRect(rtSize.x, rtSize.y); } else { m_Camera.rect = new Rect(0.0f, 0.0f, 1.0f, 1.0f); } }
void OnBeginContextRendering(ScriptableRenderContext context, List <Camera> cameras) { var rtSize = cameraRTSize; m_Internal.CalculateCameraProperties(rtSize.x, rtSize.y); PixelSnap(); if (m_Internal.useOffscreenRT) { m_Camera.pixelRect = m_Internal.CalculateFinalBlitPixelRect(rtSize.x, rtSize.y); } else { m_Camera.rect = new Rect(0.0f, 0.0f, 1.0f, 1.0f); } if (!m_CinemachineCompatibilityMode) { m_Camera.orthographicSize = m_Internal.orthoSize; } }
void OnBeginCameraRendering(ScriptableRenderContext context, Camera camera) { if (camera != m_Camera) { return; } m_Internal.CalculateCameraProperties(Screen.width, Screen.height); PixelSnap(); if (m_Internal.pixelRect != Rect.zero) { m_Camera.pixelRect = m_Internal.pixelRect; } else { m_Camera.rect = new Rect(0.0f, 0.0f, 1.0f, 1.0f); } m_Camera.orthographicSize = m_Internal.orthoSize; UnityEngine.U2D.PixelPerfectRendering.pixelSnapSpacing = m_Internal.unitsPerPixel; }