浏览代码

clean ProxyVolumeUI

/main
RSlysz 6 年前
当前提交
704979d8
共有 2 个文件被更改,包括 74 次插入68 次删除
  1. 133
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/Volume/ProxyVolumeUI.cs
  2. 9
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/Volume/ReflectionProxyVolumeComponentUI.cs

133
com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/Volume/ProxyVolumeUI.cs


namespace UnityEditor.Experimental.Rendering.HDPipeline
{
using _ = CoreEditorUtils;
//Skin
internal static Color k_GizmoThemeColorProjectionFace = new Color(0x00 / 255f, 0xE5 / 255f, 0xFF / 255f, 0x20 / 255f);
internal static Color k_GizmoThemeColorDisabled = new Color(0x99 / 255f, 0x89 / 255f, 0x59 / 255f, 0x10 / 255f);
internal static Color k_GizmoThemeColorDisabledFace = new Color(0x99 / 255f, 0x89 / 255f, 0x59 / 255f, 0x10 / 255f);
//internal static Color k_GizmoThemeColorProjectionFace = new Color(0x00 / 255f, 0xE5 / 255f, 0xFF / 255f, 0x20 / 255f);
//internal static Color k_GizmoThemeColorDisabled = new Color(0x99 / 255f, 0x89 / 255f, 0x59 / 255f, 0x10 / 255f);
//internal static Color k_GizmoThemeColorDisabledFace = new Color(0x99 / 255f, 0x89 / 255f, 0x59 / 255f, 0x10 / 255f);
internal static GUIContent shapeContent = CoreEditorUtils.GetContent("Shape|The shape of the Proxy.\nInfinite is compatible with any kind of InfluenceShape.");
internal static GUIContent boxSizeContent = CoreEditorUtils.GetContent("Box Size|The size of the box.");
internal static GUIContent sphereRadiusContent = CoreEditorUtils.GetContent("Sphere Radius|The radius of the sphere.");
//logic
public static readonly CED.IDrawer SectionShapeBox = CED.Action(Drawer_SectionShapeBox);
public static readonly CED.IDrawer SectionShapeSphere = CED.Action(Drawer_SectionShapeSphere);

);
}
public BoxBoundsHandle boxProjectionHandle = new BoxBoundsHandle();
public SphereBoundsHandle sphereProjectionHandle = new SphereBoundsHandle();
public ProxyVolumeUI()
: base(k_ShapeCount)
{

return m_AnimBools[(int)shapeType];
}
//gizmo
public static void DrawGizmos(Transform transform, ProxyVolume proxyVolume)
{
switch (proxyVolume.shape)
{
case ProxyShape.Box:
Gizmos_Box(transform, proxyVolume);
break;
case ProxyShape.Sphere:
Gizmos_Sphere(transform, proxyVolume);
break;
}
}
static void Gizmos_Sphere(Transform t, ProxyVolume d)
{
var mat = Gizmos.matrix;
Color col = Gizmos.color;
Gizmos.matrix = t.localToWorldMatrix;
Gizmos.color = k_GizmoThemeColorProjection;
Gizmos.DrawWireSphere(Vector3.zero, d.sphereRadius);
Gizmos.color = col;
Gizmos.matrix = mat;
}
static void Gizmos_Box(Transform t, ProxyVolume d)
{
var mat = Gizmos.matrix;
Color col = Gizmos.color;
Gizmos.matrix = t.localToWorldMatrix;
Gizmos.color = k_GizmoThemeColorProjection;
Gizmos.DrawWireCube(Vector3.zero, d.boxSize);
Gizmos.color = col;
Gizmos.matrix = mat;
}
//handles
public BoxBoundsHandle boxProjectionHandle = new BoxBoundsHandle();
public SphereBoundsHandle sphereProjectionHandle = new SphereBoundsHandle();
EditorGUILayout.PropertyField(d.shape, _.GetContent("Shape Type"));
EditorGUILayout.PropertyField(d.shape, shapeContent);
EditorGUILayout.PropertyField(d.boxSize, _.GetContent("Box Size"));
EditorGUILayout.PropertyField(d.boxSize, boxSizeContent);
EditorGUILayout.PropertyField(d.sphereRadius, _.GetContent("Sphere Radius"));
EditorGUILayout.PropertyField(d.sphereRadius, sphereRadiusContent);
}
public static void DrawHandles_EditBase(Transform transform, ProxyVolume proxyVolume, ProxyVolumeUI ui, Object sourceAsset)

Handles_EditBase_Sphere(transform, proxyVolume, ui, sourceAsset);
break;
}
}
public static void DrawHandles_EditNone(Transform transform, ProxyVolume proxyVolume, ProxyVolumeUI ui, Object sourceAsset)
{
}
static void Handles_EditBase_Sphere(Transform transform, ProxyVolume proxyVolume, ProxyVolumeUI s, Object sourceAsset)

Matrix4x4 mat = Matrix4x4.TRS(transform.position, transform.rotation, Vector3.one);
var mat = Handles.matrix;
Handles.matrix = Matrix4x4.TRS(transform.position, transform.rotation, Vector3.one);
Handles.color = k_GizmoThemeColorProjection;
s.sphereProjectionHandle.DrawHandle();
using (new Handles.DrawingScope(k_GizmoThemeColorProjection, mat))
{
s.sphereProjectionHandle.DrawHandle();
}
if (EditorGUI.EndChangeCheck())
{
Undo.RecordObject(sourceAsset, "Modified Projection Volume");

EditorUtility.SetDirty(sourceAsset);
}
Handles.matrix = mat;
}
static void Handles_EditBase_Box(Transform transform, ProxyVolume proxyVolume, ProxyVolumeUI s, Object sourceAsset)

var mat = Handles.matrix;
Handles.matrix = Matrix4x4.TRS(transform.position, transform.rotation, Vector3.one);
Matrix4x4 mat = Matrix4x4.TRS(transform.position, transform.rotation, Vector3.one);
Handles.color = k_GizmoThemeColorProjection;
s.boxProjectionHandle.DrawHandle();
using (new Handles.DrawingScope(k_GizmoThemeColorProjection, mat))
{
s.boxProjectionHandle.DrawHandle();
}
if (EditorGUI.EndChangeCheck())
{
Undo.RecordObject(sourceAsset, "Modified Projection Volume AABB");

EditorUtility.SetDirty(sourceAsset);
}
Handles.matrix = mat;
}
public static void DrawGizmos_EditNone(Transform transform, ProxyVolume proxyVolume, ProxyVolumeUI ui, Object sourceAsset)
{
switch (proxyVolume.shape)
{
case ProxyShape.Box:
Gizmos_EditNone_Box(transform, proxyVolume, ui, sourceAsset);
break;
case ProxyShape.Sphere:
Gizmos_EditNone_Sphere(transform, proxyVolume, ui, sourceAsset);
break;
}
}
static void Gizmos_EditNone_Sphere(Transform t, ProxyVolume d, ProxyVolumeUI s, Object o)
{
var mat = Gizmos.matrix;
Gizmos.matrix = Matrix4x4.TRS(t.position, t.rotation, Vector3.one);
Gizmos.color = k_GizmoThemeColorProjection;
Gizmos.DrawWireSphere(Vector3.zero, d.sphereRadius);
Gizmos.matrix = mat;
}
static void Gizmos_EditNone_Box(Transform t, ProxyVolume d, ProxyVolumeUI s, Object o)
{
var mat = Gizmos.matrix;
Gizmos.matrix = Matrix4x4.TRS(t.position, t.rotation, Vector3.one);
Gizmos.color = k_GizmoThemeColorProjection;
Gizmos.DrawWireCube(Vector3.zero, d.boxSize);
Gizmos.matrix = mat;
}
}
}

9
com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/Volume/ReflectionProxyVolumeComponentUI.cs


ProxyVolumeUI.DrawHandles_EditBase(target.transform, target.proxyVolume, ui.proxyVolume, target);
}
public static void DrawHandles_EditNone(ReflectionProxyVolumeComponentUI ui, ReflectionProxyVolumeComponent target)
public static void DrawGizmos_EditNone(ReflectionProxyVolumeComponent target)
ProxyVolumeUI.DrawHandles_EditNone(target.transform, target.proxyVolume, ui.proxyVolume, target);
}
public static void DrawGizmos_EditNone(ReflectionProxyVolumeComponentUI ui, ReflectionProxyVolumeComponent target)
{
ProxyVolumeUI.DrawGizmos_EditNone(target.transform, target.proxyVolume, ui.proxyVolume, target);
ProxyVolumeUI.DrawGizmos(target.transform, target.proxyVolume);
}
}
}
正在加载...
取消
保存