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 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(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 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; } }