浏览代码

(wip) reflection probe ui

/feature-ReflectionProbeFit
Frédéric Vauchelles 7 年前
当前提交
0b7f1dc2
共有 2 个文件被更改,包括 53 次插入12 次删除
  1. 59
      ScriptableRenderPipeline/HDRenderPipeline/Editor/Lighting/HDReflectionProbeEditor.cs
  2. 6
      ScriptableRenderPipeline/HDRenderPipeline/Editor/Lighting/HDReflectionProbeEditorOld.cs

59
ScriptableRenderPipeline/HDRenderPipeline/Editor/Lighting/HDReflectionProbeEditor.cs


using UnityEditor.Experimental.Rendering;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.Experimental.Rendering;
using UnityEngine.Experimental.Rendering.HDPipeline;
using UnityEngine.Rendering;

{
internal SerializedProperty mode;
internal SerializedProperty renderDynamicObjects;
internal SerializedProperty customBakedTexture;
internal SerializedProperty refreshMode;
internal SerializedProperty timeSlicingMode;
internal SerializedProperty intensityMultiplier;
public SerializedReflectionProbe(ReflectionProbe target, SerializedObject so)
internal SerializedProperty influenceShape;
public SerializedReflectionProbe(SerializedObject so, SerializedObject addso)
var o = new PropertyFetcher<HDAdditionalReflectionData>(addso);
customBakedTexture = so.FindProperty("m_CustomBakedTexture");
refreshMode = so.FindProperty("m_RefreshMode");
timeSlicingMode = so.FindProperty("m_TimeSlicingMode");
intensityMultiplier = so.FindProperty("m_IntensityMultiplier");
influenceShape = o.Find(d => d.m_InfluenceShape);
}
}

SerializedReflectionProbe m_SerializedReflectionProbe;
ReflectionProbe m_ReflectionProbe;
SerializedObject m_AdditionalDataSerializedObject;
m_ReflectionProbe = (ReflectionProbe)target;
m_SerializedReflectionProbe = new SerializedReflectionProbe(m_ReflectionProbe, serializedObject);
m_UIState.Reset(Repaint, m_ReflectionProbe.mode);
var additionalData = CoreEditorUtils.GetAdditionalData<HDAdditionalReflectionData>(targets);
m_AdditionalDataSerializedObject = new SerializedObject(additionalData);
m_SerializedReflectionProbe = new SerializedReflectionProbe(serializedObject, m_AdditionalDataSerializedObject);
m_UIState.Reset(Repaint, (ReflectionProbeMode)m_SerializedReflectionProbe.mode.enumValueIndex);
m_AdditionalDataSerializedObject.Update();
var s = m_UIState;
var p = m_SerializedReflectionProbe;
Drawer_ReflectionProbeMode(m_UIState, m_SerializedReflectionProbe);
Drawer_ModeSettings(m_UIState, m_SerializedReflectionProbe);
Drawer_ReflectionProbeMode(s, p);
Drawer_ModeSettings(s, p);
EditorGUILayout.Space();
Drawer_InfluenceShape(s, p);
Drawer_IntensityMultiplier(s, p);
m_AdditionalDataSerializedObject.ApplyModifiedProperties();
static void Drawer_NOOP(UIState s, SerializedReflectionProbe p) { }
// Mode
static readonly GUIContent[] k_Content_ReflectionProbeMode = { new GUIContent("Baked"), new GUIContent("Custom"), new GUIContent("Realtime") };
static readonly int[] k_Content_ReflectionProbeModeValues = { (int)ReflectionProbeMode.Baked, (int)ReflectionProbeMode.Custom, (int)ReflectionProbeMode.Realtime };
static void Drawer_ReflectionProbeMode(UIState s, SerializedReflectionProbe p)

}
static void Drawer_NOOP(UIState s, SerializedReflectionProbe p) { }
static void Drawer_InfluenceShape(UIState s, SerializedReflectionProbe p)
{
EditorGUILayout.PropertyField(p.influenceShape, CoreEditorUtils.GetContent("Shape"));
}
static void Drawer_IntensityMultiplier(UIState s, SerializedReflectionProbe p)
{
EditorGUILayout.PropertyField(p.intensityMultiplier, CoreEditorUtils.GetContent("Intensity"));
}
// Mode specific settings
static void Drawer_ModeSettings(UIState s, SerializedReflectionProbe p)
{
for (var i = 0; i < k_ModeDrawers.Length; ++i)

static void Drawer_ModeCustom(UIState s, SerializedReflectionProbe p)
{
EditorGUILayout.PropertyField(p.renderDynamicObjects, CoreEditorUtils.GetContent("Dynamic Objects|If enabled dynamic objects are also rendered into the cubemap"));
p.customBakedTexture.objectReferenceValue = EditorGUILayout.ObjectField(CoreEditorUtils.GetContent("Cubemap"), p.customBakedTexture.objectReferenceValue, typeof(Cubemap), false);
static void Drawer_ModeRealtime(UIState s, SerializedReflectionProbe p) { }
static void Drawer_ModeRealtime(UIState s, SerializedReflectionProbe p)
{
EditorGUILayout.PropertyField(p.refreshMode, CoreEditorUtils.GetContent("Refresh Mode|Controls how this probe refreshes in the Player"));
EditorGUILayout.PropertyField(p.timeSlicingMode, CoreEditorUtils.GetContent("Time Slicing|If enabled this probe will update over several frames, to help reduce the impact on the frame rate"));
}
}
}

6
ScriptableRenderPipeline/HDRenderPipeline/Editor/Lighting/HDReflectionProbeEditorOld.cs


}
//Editing Gizmo
[DrawGizmo(GizmoType.Active)]
//[DrawGizmo(GizmoType.Active)]
static void RenderGizmo(ReflectionProbe reflectionProbe, GizmoType gizmoType)
{
HDAdditionalReflectionData reflectionData = reflectionProbe.GetComponent<HDAdditionalReflectionData>();

}
}
[DrawGizmo(GizmoType.Selected)]
//[DrawGizmo(GizmoType.Selected)]
static void DrawSelectedGizmo(ReflectionProbe reflectionProbe, GizmoType gizmoType)
{
Color oldColor = Gizmos.color;

}
}
[DrawGizmo(GizmoType.NonSelected)]
//[DrawGizmo(GizmoType.NonSelected)]
static void DrawNonSelectedGizmo(ReflectionProbe reflectionProbe, GizmoType gizmoType)
{
var reflectionData = reflectionProbe.GetComponent<HDAdditionalReflectionData>();

正在加载...
取消
保存