Frédéric Vauchelles
7 年前
当前提交
3376b15f
共有 13 个文件被更改,包括 377 次插入 和 9 次删除
-
14ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/PlanarReflectionProbe.cs
-
8ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/Volumes/InfluenceVolume.cs
-
4ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/Volumes/ProjectionVolume.cs
-
53ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/Lighting/PlanarReflectionProbeEditor.cs
-
11ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/Lighting/PlanarReflectionProbeEditor.cs.meta
-
44ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/Lighting/PlanarReflectionProbeUI.cs
-
11ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/Lighting/PlanarReflectionProbeUI.cs.meta
-
31ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/Lighting/SerializedPlanarReflectionProbe.cs
-
11ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/Lighting/SerializedPlanarReflectionProbe.cs.meta
-
139ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/Lighting/Volume/InfluenceVolumeUI.cs
-
11ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/Lighting/Volume/InfluenceVolumeUI.cs.meta
-
38ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/Lighting/Volume/SerializedInfluenceVolume.cs
-
11ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/Lighting/Volume/SerializedInfluenceVolume.cs.meta
|
|||
namespace UnityEngine.Experimental.Rendering |
|||
using UnityEngine.Experimental.Rendering.HDPipeline; |
|||
|
|||
namespace UnityEngine.Experimental.Rendering |
|||
class PlanarReflectionProbe |
|||
public class PlanarReflectionProbe : MonoBehaviour |
|||
|
|||
[SerializeField] |
|||
ProjectionVolumeComponent m_ProjectionVolumeReference; |
|||
[SerializeField] |
|||
InfluenceVolume m_InfluenceVolume; |
|||
|
|||
public ProjectionVolumeComponent projectionVolumeReference { get { return m_ProjectionVolumeReference; } } |
|||
public InfluenceVolume influenceVolume { get { return m_InfluenceVolume; } } |
|||
} |
|||
} |
|
|||
using System.Collections.Generic; |
|||
using System.IO; |
|||
using System.Linq; |
|||
using System.Reflection; |
|||
using UnityEditor.Experimental.Rendering.HDPipeline; |
|||
using UnityEditorInternal; |
|||
using UnityEngine; |
|||
using UnityEngine.Experimental.Rendering; |
|||
using UnityEngine.Experimental.Rendering.HDPipeline; |
|||
using UnityEngine.Rendering; |
|||
using UnityEngine.SceneManagement; |
|||
|
|||
namespace UnityEditor.Experimental.Rendering.HDPipeline |
|||
{ |
|||
[CustomEditorForRenderPipeline(typeof(PlanarReflectionProbe), typeof(HDRenderPipelineAsset))] |
|||
[CanEditMultipleObjects] |
|||
class PlanarReflectionProbeEditor : Editor |
|||
{ |
|||
SerializedPlanarReflectionProbe m_SerializedAsset; |
|||
PlanarReflectionProbeUI m_UIState = new PlanarReflectionProbeUI(); |
|||
PlanarReflectionProbeUI[] m_UIHandleState; |
|||
PlanarReflectionProbe[] m_TypedTargets; |
|||
|
|||
void OnEnable() |
|||
{ |
|||
m_SerializedAsset = new SerializedPlanarReflectionProbe(serializedObject); |
|||
m_UIState.Reset(m_SerializedAsset, Repaint); |
|||
|
|||
m_TypedTargets = new PlanarReflectionProbe[targets.Length]; |
|||
m_UIHandleState = new PlanarReflectionProbeUI[m_TypedTargets.Length]; |
|||
for (var i = 0; i < m_TypedTargets.Length; i++) |
|||
{ |
|||
m_TypedTargets[i] = (PlanarReflectionProbe)targets[i]; |
|||
m_UIHandleState[i] = new PlanarReflectionProbeUI(); |
|||
m_UIHandleState[i].Reset(m_SerializedAsset, Repaint); |
|||
} |
|||
} |
|||
|
|||
public override void OnInspectorGUI() |
|||
{ |
|||
var s = m_UIState; |
|||
var d = m_SerializedAsset; |
|||
var o = this; |
|||
|
|||
s.Update(); |
|||
d.Update(); |
|||
|
|||
PlanarReflectionProbeUI.Inspector.Draw(s, d, o); |
|||
|
|||
d.Apply(); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 7f189b572cf7bf04d9f1976dcc75c942 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using UnityEngine.Events; |
|||
|
|||
namespace UnityEditor.Experimental.Rendering.HDPipeline |
|||
{ |
|||
using _ = CoreEditorUtils; |
|||
using CED = CoreEditorDrawer<PlanarReflectionProbeUI, SerializedPlanarReflectionProbe>; |
|||
|
|||
class PlanarReflectionProbeUI : BaseUI<SerializedPlanarReflectionProbe> |
|||
{ |
|||
public static readonly CED.IDrawer Inspector = CED.Group( |
|||
CED.Action(Drawer_FieldProjectionVolumeReference), |
|||
CED.Select( |
|||
(s, d, o) => s.influenceVolume, |
|||
(s, d, o) => d.influenceVolume, |
|||
InfluenceVolumeUI.SectionShapeBox |
|||
) |
|||
); |
|||
|
|||
public InfluenceVolumeUI influenceVolume = new InfluenceVolumeUI(); |
|||
|
|||
public PlanarReflectionProbeUI() |
|||
: base(0) |
|||
{ |
|||
|
|||
} |
|||
|
|||
public override void Reset(SerializedPlanarReflectionProbe data, UnityAction repaint) |
|||
{ |
|||
influenceVolume.Reset(data.influenceVolume, repaint); |
|||
base.Reset(data, repaint); |
|||
} |
|||
|
|||
public override void Update() |
|||
{ |
|||
influenceVolume.Update(); |
|||
base.Update(); |
|||
} |
|||
|
|||
static void Drawer_FieldProjectionVolumeReference(PlanarReflectionProbeUI s, SerializedPlanarReflectionProbe d, Editor o) |
|||
{ |
|||
EditorGUILayout.PropertyField(d.projectionVolumeReference, _.GetContent("Projection Volume Reference")); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: f23cf1efede7335468bfa23bd1838cd2 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using UnityEditor.Experimental.Rendering.HDPipeline; |
|||
using UnityEngine.Experimental.Rendering; |
|||
|
|||
namespace UnityEditor.Experimental.Rendering |
|||
{ |
|||
public class SerializedPlanarReflectionProbe |
|||
{ |
|||
public SerializedObject serializedObject; |
|||
|
|||
public SerializedProperty projectionVolumeReference; |
|||
public SerializedInfluenceVolume influenceVolume; |
|||
|
|||
public SerializedPlanarReflectionProbe(SerializedObject serializedObject) |
|||
{ |
|||
this.serializedObject = serializedObject; |
|||
|
|||
projectionVolumeReference = serializedObject.Find((PlanarReflectionProbe p) => p.projectionVolumeReference); |
|||
influenceVolume = new SerializedInfluenceVolume(serializedObject.Find((PlanarReflectionProbe p) => p.influenceVolume)); |
|||
} |
|||
|
|||
public void Update() |
|||
{ |
|||
serializedObject.Update(); |
|||
} |
|||
|
|||
public void Apply() |
|||
{ |
|||
serializedObject.ApplyModifiedProperties(); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 6cc29d508eccabc489d9ea9f9aedf824 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System; |
|||
using UnityEditor.AnimatedValues; |
|||
using UnityEngine; |
|||
using UnityEngine.Experimental.Rendering.HDPipeline; |
|||
using Object = UnityEngine.Object; |
|||
|
|||
namespace UnityEditor.Experimental.Rendering.HDPipeline |
|||
{ |
|||
using _ = CoreEditorUtils; |
|||
using CED = CoreEditorDrawer<InfluenceVolumeUI, SerializedInfluenceVolume>; |
|||
|
|||
class InfluenceVolumeUI : BaseUI<SerializedInfluenceVolume> |
|||
{ |
|||
static readonly int k_ShapeCount = Enum.GetValues(typeof(ShapeType)).Length; |
|||
|
|||
public static readonly CED.IDrawer SectionShape; |
|||
|
|||
public static readonly CED.IDrawer SectionShapeBox = CED.Action(Drawer_SectionShapeBox); |
|||
public static readonly CED.IDrawer SectionShapeSphere = CED.Action(Drawer_SectionShapeSphere); |
|||
|
|||
static InfluenceVolumeUI() |
|||
{ |
|||
SectionShape = CED.Group( |
|||
CED.Action(Drawer_FieldShapeType), |
|||
CED.FadeGroup( |
|||
(s, d, o, i) => s.IsSectionExpanded_Shape((ShapeType)i), |
|||
true, |
|||
SectionShapeBox, |
|||
SectionShapeSphere |
|||
) |
|||
); |
|||
} |
|||
|
|||
public InfluenceVolumeUI() |
|||
: base(k_ShapeCount) |
|||
{ |
|||
|
|||
} |
|||
|
|||
public override void Update() |
|||
{ |
|||
base.Update(); |
|||
SetIsSectionExpanded_Shape((ShapeType)data.shapeType.intValue); |
|||
} |
|||
|
|||
void SetIsSectionExpanded_Shape(ShapeType shape) |
|||
{ |
|||
for (var i = 0; i < k_ShapeCount; i++) |
|||
m_AnimBools[i].target = (int)shape == i; |
|||
} |
|||
|
|||
public AnimBool IsSectionExpanded_Shape(ShapeType shapeType) |
|||
{ |
|||
return m_AnimBools[(int)shapeType]; |
|||
} |
|||
|
|||
static void Drawer_FieldShapeType(InfluenceVolumeUI s, SerializedInfluenceVolume d, Editor o) |
|||
{ |
|||
EditorGUILayout.PropertyField(d.shapeType, _.GetContent("Shape Type")); |
|||
} |
|||
|
|||
static void Drawer_SectionShapeBox(InfluenceVolumeUI s, SerializedInfluenceVolume d, Editor o) |
|||
{ |
|||
EditorGUILayout.PropertyField(d.boxBaseSize, _.GetContent("Box Size")); |
|||
EditorGUILayout.PropertyField(d.boxBaseOffset, _.GetContent("Box Offset")); |
|||
EditorGUILayout.PropertyField(d.boxInfluencePositiveFade, _.GetContent("Influence Fade (Positive)")); |
|||
EditorGUILayout.PropertyField(d.boxInfluenceNegativeFade, _.GetContent("Influence Fade (Negative)")); |
|||
EditorGUILayout.PropertyField(d.boxInfluenceNormalPositiveFade, _.GetContent("Influence Normal Fade (Positive)")); |
|||
EditorGUILayout.PropertyField(d.boxInfluenceNormalNegativeFade, _.GetContent("Influence Normal Fade (Negative)")); |
|||
} |
|||
|
|||
static void Drawer_SectionShapeSphere(InfluenceVolumeUI s, SerializedInfluenceVolume d, Editor o) |
|||
{ |
|||
EditorGUILayout.PropertyField(d.sphereBaseRadius, _.GetContent("Radius")); |
|||
EditorGUILayout.PropertyField(d.sphereBaseOffset, _.GetContent("Offset")); |
|||
EditorGUILayout.PropertyField(d.sphereInfluenceRadius, _.GetContent("Influence Radius")); |
|||
EditorGUILayout.PropertyField(d.sphereInfluenceNormalRadius, _.GetContent("Influence Normal Radius")); |
|||
} |
|||
|
|||
public static void DrawHandles(Transform transform, ProjectionVolume projectionVolume, InfluenceVolumeUI ui, Object sourceAsset) |
|||
{ |
|||
switch (projectionVolume.shapeType) |
|||
{ |
|||
case ShapeType.Box: |
|||
Handles_Box(transform, projectionVolume, ui, sourceAsset); |
|||
break; |
|||
case ShapeType.Sphere: |
|||
Handles_Sphere(transform, projectionVolume, ui, sourceAsset); |
|||
break; |
|||
} |
|||
} |
|||
|
|||
static void Handles_Sphere(Transform transform, ProjectionVolume projectionVolume, InfluenceVolumeUI s, Object sourceAsset) |
|||
{ |
|||
//s.sphereProjectionHandle.center = projectionVolume.sphereOffset;
|
|||
//s.sphereProjectionHandle.radius = projectionVolume.sphereRadius;
|
|||
|
|||
//var mat = Handles.matrix;
|
|||
//Handles.matrix = transform.localToWorldMatrix;
|
|||
//Handles.color = k_GizmoThemeColorProjection;
|
|||
//EditorGUI.BeginChangeCheck();
|
|||
//s.sphereProjectionHandle.DrawHandle();
|
|||
//if (EditorGUI.EndChangeCheck())
|
|||
//{
|
|||
// Undo.RecordObject(sourceAsset, "Modified Projection Volume");
|
|||
|
|||
// projectionVolume.sphereOffset = s.sphereProjectionHandle.center;
|
|||
// projectionVolume.sphereRadius = s.sphereProjectionHandle.radius;
|
|||
|
|||
// EditorUtility.SetDirty(sourceAsset);
|
|||
//}
|
|||
//Handles.matrix = mat;
|
|||
} |
|||
|
|||
static void Handles_Box(Transform transform, ProjectionVolume projectionVolume, InfluenceVolumeUI s, Object sourceAsset) |
|||
{ |
|||
//s.boxProjectionHandle.center = projectionVolume.boxOffset;
|
|||
//s.boxProjectionHandle.size = projectionVolume.boxSize;
|
|||
|
|||
//var mat = Handles.matrix;
|
|||
//Handles.matrix = transform.localToWorldMatrix;
|
|||
|
|||
//Handles.color = k_GizmoThemeColorProjection;
|
|||
//EditorGUI.BeginChangeCheck();
|
|||
//s.boxProjectionHandle.DrawHandle();
|
|||
//if (EditorGUI.EndChangeCheck())
|
|||
//{
|
|||
// Undo.RecordObject(sourceAsset, "Modified Projection Volume AABB");
|
|||
|
|||
// projectionVolume.boxOffset = s.boxProjectionHandle.center;
|
|||
// projectionVolume.boxSize = s.boxProjectionHandle.size;
|
|||
|
|||
// EditorUtility.SetDirty(sourceAsset);
|
|||
//}
|
|||
|
|||
//Handles.matrix = mat;
|
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 209229d43c8d5ae49aa240ce1887172e |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using UnityEngine.Experimental.Rendering.HDPipeline; |
|||
|
|||
namespace UnityEditor.Experimental.Rendering.HDPipeline |
|||
{ |
|||
public class SerializedInfluenceVolume |
|||
{ |
|||
public SerializedProperty root; |
|||
|
|||
public SerializedProperty shapeType; |
|||
public SerializedProperty boxBaseSize; |
|||
public SerializedProperty boxBaseOffset; |
|||
public SerializedProperty boxInfluencePositiveFade; |
|||
public SerializedProperty boxInfluenceNegativeFade; |
|||
public SerializedProperty boxInfluenceNormalPositiveFade; |
|||
public SerializedProperty boxInfluenceNormalNegativeFade; |
|||
public SerializedProperty sphereBaseRadius; |
|||
public SerializedProperty sphereBaseOffset; |
|||
public SerializedProperty sphereInfluenceRadius; |
|||
public SerializedProperty sphereInfluenceNormalRadius; |
|||
|
|||
public SerializedInfluenceVolume(SerializedProperty root) |
|||
{ |
|||
this.root = root; |
|||
|
|||
shapeType = root.Find((InfluenceVolume i) => i.shapeType); |
|||
boxBaseSize = root.Find((InfluenceVolume i) => i.boxBaseSize); |
|||
boxBaseOffset = root.Find((InfluenceVolume i) => i.boxBaseOffset); |
|||
boxInfluencePositiveFade = root.Find((InfluenceVolume i) => i.boxInfluencePositiveFade); |
|||
boxInfluenceNegativeFade = root.Find((InfluenceVolume i) => i.boxInfluenceNegativeFade); |
|||
boxInfluenceNormalPositiveFade = root.Find((InfluenceVolume i) => i.boxInfluenceNormalPositiveFade); |
|||
boxInfluenceNormalNegativeFade = root.Find((InfluenceVolume i) => i.boxInfluenceNormalNegativeFade); |
|||
sphereBaseRadius = root.Find((InfluenceVolume i) => i.sphereBaseRadius); |
|||
sphereBaseOffset = root.Find((InfluenceVolume i) => i.sphereBaseOffset); |
|||
sphereInfluenceRadius = root.Find((InfluenceVolume i) => i.sphereInfluenceRadius); |
|||
sphereInfluenceNormalRadius = root.Find((InfluenceVolume i) => i.sphereInfluenceNormalRadius); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: ff8a4842b1ed1d64dabb9efaf52bceb4 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
撰写
预览
正在加载...
取消
保存
Reference in new issue