浏览代码

Moved buffered history system to HDCamera

/main
Frédéric Vauchelles 7 年前
当前提交
e8ed630b
共有 2 个文件被更改,包括 13 次插入29 次删除
  1. 14
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Camera/HDAdditionalCameraData.cs
  2. 28
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Camera/HDCamera.cs

14
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Camera/HDAdditionalCameraData.cs


bool m_IsDebugRegistered = false;
string m_CameraRegisterName;
BufferedRTHandleSystem m_HistoryRTSystem;
public BufferedRTHandleSystem historyRTSystem { get { return m_HistoryRTSystem; } }
// This is the function use outside to access FrameSettings. It return the current state of FrameSettings for the camera
// taking into account the customization via the debug menu
public FrameSettings GetFrameSettings()

}
}
void Awake()
{
m_HistoryRTSystem = new BufferedRTHandleSystem();
}
void OnEnable()
{
// Be sure legacy HDR option is disable on camera as it cause banding in SceneView. Yes, it is a contradiction, but well, Unity...

void OnDisable()
{
UnRegisterDebug();
}
void OnDestroy()
{
m_HistoryRTSystem.Dispose();
m_HistoryRTSystem = null;
}
public void OnBeforeSerialize()

28
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Camera/HDCamera.cs


HDAdditionalCameraData m_AdditionalCameraData;
// Fallback used when the HDAdditionalCameraData is missing
BufferedRTHandleSystem m_HistoryRTSystemFallback = null;
public BufferedRTHandleSystem historyRTSystem
BufferedRTHandleSystem m_HistoryRTSystem = null;
BufferedRTHandleSystem historyRTSystem
if (m_AdditionalCameraData == null)
{
if (m_HistoryRTSystemFallback == null)
m_HistoryRTSystemFallback = new BufferedRTHandleSystem();
return m_HistoryRTSystemFallback;
}
return m_AdditionalCameraData.historyRTSystem;
if (m_HistoryRTSystem == null)
m_HistoryRTSystem = new BufferedRTHandleSystem();
return m_HistoryRTSystem;
}
}

// Unfortunately sometime (like in the HDCameraEditor) HDUtils.hdrpSettings can be null because of scripts that change the current pipeline...
m_msaaSamples = HDUtils.hdrpSettings != null ? HDUtils.hdrpSettings.msaaSampleCount : MSAASamples.None;
RTHandles.SetReferenceSize(m_ActualWidth, m_ActualHeight, frameSettings.enableMSAA, m_msaaSamples);
historyRTSystem.SetReferenceSize(m_ActualWidth, m_ActualHeight, frameSettings.enableMSAA, m_msaaSamples);
historyRTSystem.Swap();
if (m_HistoryRTSystem != null)
{
m_HistoryRTSystem.SetReferenceSize(m_ActualWidth, m_ActualHeight, frameSettings.enableMSAA, m_msaaSamples);
m_HistoryRTSystem.Swap();
}
int maxWidth = RTHandles.maxWidth;
int maxHeight = RTHandles.maxHeight;

foreach (var cam in s_Cleanup)
{
var hdCam = s_Cameras[cam];
if (hdCam.m_HistoryRTSystemFallback != null)
if (hdCam.m_HistoryRTSystem != null)
hdCam.m_HistoryRTSystemFallback.Dispose();
hdCam.m_HistoryRTSystemFallback = null;
hdCam.m_HistoryRTSystem.Dispose();
hdCam.m_HistoryRTSystem = null;
}
s_Cameras.Remove(cam);
}

正在加载...
取消
保存