浏览代码

[PlanarReflection] Updated UI

/main
Frédéric Vauchelles 7 年前
当前提交
98ee4ecf
共有 7 个文件被更改,包括 61 次插入15 次删除
  1. 6
      SampleScenes/HDTest/PlanarReflectionTests.unity
  2. 2
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/Lighting/HDReflectionProbeUI.Drawers.cs
  3. 37
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/Lighting/PlanarReflectionProbeUI.Drawers.cs
  4. 9
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/Lighting/PlanarReflectionProbeUI.cs
  5. 6
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/Lighting/SerializedPlanarReflectionProbe.cs
  6. 8
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/PlanarReflectionProbe.cs
  7. 8
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/ReflectionSystemInternal.cs

6
SampleScenes/HDTest/PlanarReflectionTests.unity


m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 4294967295
m_IsActive: 0
m_IsActive: 1
--- !u!4 &599505013
Transform:
m_ObjectHideFlags: 0

m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1561776757}
m_Enabled: 0
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: a4ee7c3a3b205a14a94094d01ff91d6b, type: 3}
m_Name:

m_CapturePositionMode: 1
m_CaptureMirrorPlaneLocalPosition: {x: 0, y: 0, z: 0}
m_CaptureMirrorPlaneLocalNormal: {x: 1, y: 0, z: 0}
m_OverrideFieldOfView: 0
m_FieldOfViewOverride: 90
--- !u!1 &1562837666
GameObject:
m_ObjectHideFlags: 0

2
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/Lighting/HDReflectionProbeUI.Drawers.cs


using System;
using System;
using System.Reflection;
using UnityEditor.Experimental.Rendering.HDPipeline;
using UnityEditorInternal;

37
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/Lighting/PlanarReflectionProbeUI.Drawers.cs


public static readonly CED.IDrawer SectionFoldoutCaptureSettings;
public static readonly CED.IDrawer SectionCaptureMirrorSettings = CED.Action(Drawer_SectionCaptureMirror);
public static readonly CED.IDrawer SectionCaptureStaticSettings = CED.Action(Drawer_SectionCaptureStatic);
static PlanarReflectionProbeUI()
{

true,
CED.Action(Drawer_SectionCaptureSettings),
CED.FadeGroup(
(s, d, o, i) => s.isSectionExpandedCaptureMirrorSettings,
(s, d, o, i) =>
{
switch (i)
{
default:
case 0: return s.isSectionExpandedCaptureMirrorSettings;
case 1: return s.isSectionExpandedCaptureStaticSettings;
}
},
SectionCaptureMirrorSettings)
SectionCaptureMirrorSettings,
SectionCaptureStaticSettings)
);
SectionProbeModeSettings = CED.Group(

const EditMode.SceneViewEditMode EditInfluenceNormalShape = EditMode.SceneViewEditMode.Collider;
const EditMode.SceneViewEditMode EditCenter = EditMode.SceneViewEditMode.ReflectionProbeOrigin;
static void Drawer_SectionCaptureStatic(PlanarReflectionProbeUI s, SerializedPlanarReflectionProbe d, Editor o)
{
EditorGUILayout.PropertyField(d.captureLocalPosition, _.GetContent("Capture Local Position"));
_.DrawMultipleFields(
"Clipping Planes",
new[] { d.captureNearPlane, d.captureFarPlane },
new[] { _.GetContent("Near|The closest point relative to the camera that drawing will occur."), _.GetContent("Far|The furthest point relative to the camera that drawing will occur.\n") });
}
static void Drawer_SectionCaptureMirror(PlanarReflectionProbeUI s, SerializedPlanarReflectionProbe d, Editor o)
{
EditorGUILayout.PropertyField(d.captureMirrorPlaneLocalPosition, _.GetContent("Plane Position"));

hdrp.renderPipelineSettings.lightLoopSettings.planarReflectionCacheCompressed);
GUI.enabled = true;
EditorGUILayout.PropertyField(d.captureLocalPosition, _.GetContent("Capture Local Position"));
_.DrawMultipleFields(
"Clipping Planes",
new[] { d.captureNearPlane, d.captureFarPlane },
new[] { _.GetContent("Near|The closest point relative to the camera that drawing will occur."), _.GetContent("Far|The furthest point relative to the camera that drawing will occur.\n") });
EditorGUILayout.PropertyField(d.overrideFieldOfView, _.GetContent("Override FOV"));
if (d.overrideFieldOfView.boolValue)
{
++EditorGUI.indentLevel;
EditorGUILayout.PropertyField(d.fieldOfViewOverride, _.GetContent("Field Of View"));
--EditorGUI.indentLevel;
}
}
static void Drawer_SectionProbeModeCustomSettings(PlanarReflectionProbeUI s, SerializedPlanarReflectionProbe d, Editor o)

9
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/Lighting/PlanarReflectionProbeUI.cs


using System;
using UnityEditor.AnimatedValues;
using UnityEngine.Events;
using UnityEngine.Experimental.Rendering.HDPipeline;
using UnityEngine.Rendering;
namespace UnityEditor.Experimental.Rendering.HDPipeline

const int k_AnimBoolFields = 3;
const int k_AnimBoolFields = 4;
static readonly int k_ReflectionProbeModeModeCount = Enum.GetValues(typeof(ReflectionProbeMode)).Length;
static readonly int k_AnimBoolTotal = k_AnimBoolFields + k_ReflectionProbeModeModeCount;

public AnimBool isSectionExpandedCaptureSettings { get { return m_AnimBools[k_ReflectionProbeModeModeCount + 1]; } }
public AnimBool isSectionExpandedCaptureMirrorSettings { get { return m_AnimBools[k_ReflectionProbeModeModeCount + 2]; } }
public AnimBool isSectionExpandedCaptureStaticSettings { get { return m_AnimBools[k_ReflectionProbeModeModeCount + 3]; } }
public bool showCaptureHandles { get; set; }

for (var i = 0; i < k_ReflectionProbeModeModeCount; i++)
m_AnimBools[i].target = i == data.mode.intValue;
isSectionExpandedCaptureMirrorSettings.target = data.refreshMode.intValue == (int)ReflectionProbeRefreshMode.EveryFrame && data.mode.intValue == (int)ReflectionProbeMode.Realtime;
isSectionExpandedCaptureMirrorSettings.target = data.refreshMode.intValue == (int)ReflectionProbeRefreshMode.EveryFrame
&& data.mode.intValue == (int)ReflectionProbeMode.Realtime
&& data.capturePositionMode.intValue == (int)PlanarReflectionProbe.CapturePositionMode.MirrorCamera;
isSectionExpandedCaptureStaticSettings.target = !isSectionExpandedCaptureMirrorSettings.target;
proxyVolume.Update();
frameSettings.Update();

6
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/Lighting/SerializedPlanarReflectionProbe.cs


public SerializedProperty refreshMode;
public SerializedProperty customTexture;
public SerializedProperty overrideFieldOfView;
public SerializedProperty fieldOfViewOverride;
public SerializedFrameSettings frameSettings;
public PlanarReflectionProbe target { get { return serializedObject.targetObject as PlanarReflectionProbe; } }

mode = serializedObject.Find((PlanarReflectionProbe p) => p.mode);
refreshMode = serializedObject.Find((PlanarReflectionProbe p) => p.refreshMode);
customTexture = serializedObject.Find((PlanarReflectionProbe p) => p.customTexture);
overrideFieldOfView = serializedObject.Find((PlanarReflectionProbe p) => p.overrideFieldOfView);
fieldOfViewOverride = serializedObject.Find((PlanarReflectionProbe p) => p.fieldOfViewOverride);
frameSettings = new SerializedFrameSettings(serializedObject.Find((PlanarReflectionProbe p) => p.frameSettings));

8
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/PlanarReflectionProbe.cs


Vector3 m_CaptureMirrorPlaneLocalPosition;
[SerializeField]
Vector3 m_CaptureMirrorPlaneLocalNormal = Vector3.forward;
[SerializeField]
bool m_OverrideFieldOfView = false;
[SerializeField]
[Range(0, 180)]
float m_FieldOfViewOverride = 90;
public bool overrideFieldOfView { get { return m_OverrideFieldOfView; } }
public float fieldOfViewOverride { get { return m_FieldOfViewOverride; } }
public ProxyVolumeComponent proxyVolumeReference { get { return m_ProxyVolumeReference; } }
public InfluenceVolume influenceVolume { get { return m_InfluenceVolume; } }

8
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/ReflectionSystemInternal.cs


nearClipPlane = probe.captureNearPlane;
farClipPlane = probe.captureFarPlane;
aspect = 1f;
fov = 90f;
fov = probe.overrideFieldOfView
? probe.fieldOfViewOverride
: 90f;
clearFlags = CameraClearFlags.Nothing;
backgroundColor = Color.white;

nearClipPlane = viewerCamera.nearClipPlane;
farClipPlane = viewerCamera.farClipPlane;
aspect = 1;
fov = Mathf.Max(viewerCamera.fieldOfView, viewerCamera.fieldOfView * viewerCamera.aspect);
fov = probe.overrideFieldOfView
? probe.fieldOfViewOverride
: Mathf.Max(viewerCamera.fieldOfView, viewerCamera.fieldOfView * viewerCamera.aspect);
clearFlags = viewerCamera.clearFlags;
backgroundColor = viewerCamera.backgroundColor;

正在加载...
取消
保存