|
|
|
|
|
|
using System.Linq; |
|
|
|
using System.Reflection; |
|
|
|
using UnityEngine.Experimental.Rendering; |
|
|
|
using UnityEngine.Experimental.Rendering.HDPipeline; |
|
|
|
|
|
|
using CED = CoreEditorDrawer<SerializedFrameSettingsUI, SerializedFrameSettings>; |
|
|
|
|
|
|
|
static readonly CED.IDrawer[] k_FrameSettings = new[] |
|
|
|
{ |
|
|
|
SerializedFrameSettingsUI.SectionRenderingPasses, |
|
|
|
SerializedFrameSettingsUI.SectionRenderingSettings |
|
|
|
}.Concat(CED.Select( |
|
|
|
(s, d, o) => s.serializedLightLoopSettingsUI, |
|
|
|
(s, d, o) => d.lightLoopSettings, |
|
|
|
SerializedLightLoopSettingsUI.SectionLightLoopSettings)) |
|
|
|
.Concat(new[] |
|
|
|
{ |
|
|
|
SerializedFrameSettingsUI.SectionXRSettings |
|
|
|
}) |
|
|
|
.ToArray(); |
|
|
|
|
|
|
|
SerializedProperty m_RenderPipelineResources; |
|
|
|
|
|
|
|
// Global Frame Settings
|
|
|
|
|
|
|
// Subsurface Scattering Settings
|
|
|
|
SerializedProperty m_SubsurfaceScatteringSettings; |
|
|
|
|
|
|
|
SerializedFrameSettings serializedFrameSettings = null; |
|
|
|
SerializedFrameSettingsUI SerializedFrameSettingsUI = new SerializedFrameSettingsUI(); |
|
|
|
|
|
|
|
void InitializeProperties() |
|
|
|
{ |
|
|
|
m_RenderPipelineResources = properties.Find("m_RenderPipelineResources"); |
|
|
|
|
|
|
|
|
|
|
// Subsurface Scattering Settings
|
|
|
|
m_SubsurfaceScatteringSettings = properties.Find(x => x.sssSettings); |
|
|
|
|
|
|
|
serializedFrameSettings = new SerializedFrameSettings(properties.Find(x => x.serializedFrameSettings)); |
|
|
|
|
|
|
|
SerializedFrameSettingsUI.Reset(serializedFrameSettings, Repaint); |
|
|
|
} |
|
|
|
|
|
|
|
static void HackSetDirty(RenderPipelineAsset asset) |
|
|
|
|
|
|
EditorGUI.indentLevel--; |
|
|
|
} |
|
|
|
|
|
|
|
void LightLoopSettingsUI(HDRenderPipelineAsset hdAsset) |
|
|
|
{ |
|
|
|
EditorGUILayout.Space(); |
|
|
|
EditorGUILayout.LabelField(s_Styles.lightLoopSettings); |
|
|
|
EditorGUI.indentLevel++; |
|
|
|
EditorGUI.BeginChangeCheck(); |
|
|
|
EditorGUILayout.PropertyField(m_enableTileAndCluster, s_Styles.enableTileAndCluster); |
|
|
|
if (m_enableTileAndCluster.boolValue) |
|
|
|
{ |
|
|
|
EditorGUI.indentLevel++; |
|
|
|
EditorGUILayout.PropertyField(m_enableBigTilePrepass, s_Styles.enableBigTilePrepass); |
|
|
|
// Allow to disable cluster for forward opaque when in forward only (option have no effect when MSAA is enabled)
|
|
|
|
// Deferred opaque are always tiled
|
|
|
|
EditorGUILayout.PropertyField(m_enableFptlForForwardOpaque, s_Styles.enableFptlForForwardOpaque); |
|
|
|
EditorGUILayout.PropertyField(m_enableComputeLightEvaluation, s_Styles.enableComputeLightEvaluation); |
|
|
|
if (m_enableComputeLightEvaluation.boolValue) |
|
|
|
{ |
|
|
|
EditorGUI.indentLevel++; |
|
|
|
EditorGUILayout.PropertyField(m_enableComputeLightVariants, s_Styles.enableComputeLightVariants); |
|
|
|
EditorGUILayout.PropertyField(m_enableComputeMaterialVariants, s_Styles.enableComputeMaterialVariants); |
|
|
|
EditorGUI.indentLevel--; |
|
|
|
} |
|
|
|
} |
|
|
|
if (EditorGUI.EndChangeCheck()) |
|
|
|
{ |
|
|
|
HackSetDirty(hdAsset); // Repaint
|
|
|
|
} |
|
|
|
EditorGUI.indentLevel--; |
|
|
|
} |
|
|
|
|
|
|
|
void RendereringSettingsUI(HDRenderPipelineAsset hdAsset) |
|
|
|
{ |
|
|
|
EditorGUILayout.Space(); |
|
|
|
EditorGUILayout.LabelField(s_Styles.renderingSettingsLabel); |
|
|
|
EditorGUI.indentLevel++; |
|
|
|
|
|
|
|
EditorGUILayout.PropertyField(m_RenderingUseForwardOnly, s_Styles.useForwardRenderingOnly); |
|
|
|
if (!m_RenderingUseForwardOnly.boolValue) // If we are deferred
|
|
|
|
{ |
|
|
|
EditorGUILayout.PropertyField(m_RenderingUseDepthPrepass, s_Styles.useDepthPrepassWithDeferredRendering); |
|
|
|
if (m_RenderingUseDepthPrepass.boolValue) |
|
|
|
{ |
|
|
|
EditorGUI.indentLevel++; |
|
|
|
EditorGUILayout.PropertyField(m_RenderingUseDepthPrepassAlphaTestOnly, s_Styles.renderAlphaTestOnlyInDeferredPrepass); |
|
|
|
EditorGUI.indentLevel--; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
EditorGUILayout.PropertyField(m_enableAsyncCompute, s_Styles.enableAsyncCompute); |
|
|
|
EditorGUILayout.PropertyField(m_enableShadowMask, s_Styles.enableShadowMask); |
|
|
|
|
|
|
|
EditorGUI.indentLevel--; |
|
|
|
} |
|
|
|
|
|
|
|
void SettingsUI(HDRenderPipelineAsset hdAsset) |
|
|
|
{ |
|
|
|
EditorGUILayout.LabelField(s_Styles.renderPipelineSettings, EditorStyles.boldLabel); |
|
|
|
|
|
|
|
|
|
|
EditorGUILayout.Space(); |
|
|
|
EditorGUILayout.LabelField(s_Styles.defaultFrameSettings, EditorStyles.boldLabel); |
|
|
|
|
|
|
|
RendereringSettingsUI(hdAsset); |
|
|
|
LightLoopSettingsUI(hdAsset); |
|
|
|
} |
|
|
|
|
|
|
|
protected override void OnEnable() |
|
|
|
|
|
|
EditorGUILayout.Space(); |
|
|
|
|
|
|
|
SettingsUI(m_Target); |
|
|
|
|
|
|
|
k_FrameSettings.Draw(SerializedFrameSettingsUI, serializedFrameSettings, this); |
|
|
|
|
|
|
|
serializedObject.ApplyModifiedProperties(); |
|
|
|
} |