浏览代码

Use Gizmo6FacesBox in PlanarReflectionProbe

/main
RSlysz 6 年前
当前提交
c3a60224
共有 3 个文件被更改,包括 44 次插入16 次删除
  1. 24
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/Volume/InfluenceVolumeUI.Gizmos.cs
  2. 5
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/Volume/InfluenceVolumeUI.Handles.cs
  3. 31
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/Volume/InfluenceVolumeUI.cs

24
com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/Volume/InfluenceVolumeUI.Gizmos.cs


using System;
using UnityEngine;
using UnityEngine.Experimental.Rendering.HDPipeline;
using UnityEngine.Experimental.Gizmo;
namespace UnityEditor.Experimental.Rendering.HDPipeline
{

d.boxInfluenceOffset, d.boxInfluenceSizeOffset,
d.sphereInfluenceRadiusOffset,
(editedHandle & HandleType.Influence) != 0,
k_GizmoThemeColorInfluence);
k_GizmoThemeColorInfluence,
false);
if ((showedHandle & HandleType.InfluenceNormal) != 0)
DrawGizmos_FadeHandle(

(editedHandle & HandleType.InfluenceNormal) != 0,
k_GizmoThemeColorInfluenceNormal);
k_GizmoThemeColorInfluenceNormal,
true);
}
static void DrawGizmos_BaseHandle(

{
case ShapeType.Box:
{
if (isSolid)
Gizmos.DrawCube(d.boxBaseOffset, d.boxBaseSize);
else
Gizmos.DrawWireCube(d.boxBaseOffset, d.boxBaseSize);
s.boxBaseHandle.center = d.boxBaseOffset;
s.boxBaseHandle.size = d.boxBaseSize;
s.boxBaseHandle.DrawHull(isSolid);
break;
}
case ShapeType.Sphere:

InfluenceVolumeUI s, InfluenceVolume d, Matrix4x4 matrix,
Vector3 boxOffset, Vector3 boxSizeOffset,
float sphereOffset,
bool isSolid, Color color)
bool isSolid, Color color, bool isNormal)
{
var mat = Gizmos.matrix;
var c = Gizmos.color;

{
case ShapeType.Box:
{
if (isSolid)
Gizmos.DrawCube(d.boxBaseOffset + boxOffset, d.boxBaseSize + boxSizeOffset);
else
Gizmos.DrawWireCube(d.boxBaseOffset + boxOffset, d.boxBaseSize + boxSizeOffset);
Gizmo6FacesBox refBox = isNormal ? s.boxInfluenceNormalHandle : s.boxInfluenceHandle;
refBox.center = d.boxBaseOffset + boxOffset;
refBox.size = d.boxBaseSize + boxSizeOffset;
refBox.DrawHull(isSolid);
break;
}
case ShapeType.Sphere:

5
com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/Volume/InfluenceVolumeUI.Handles.cs


using UnityEngine;
using UnityEngine.Experimental.Rendering.HDPipeline;
using Object = UnityEngine.Object;
using UnityEngine.Experimental.Gizmo;
namespace UnityEditor.Experimental.Rendering.HDPipeline
{

static void DrawBoxHandle(
InfluenceVolumeUI s, InfluenceVolume d, Editor o, Object sourceAsset,
Func<InfluenceVolumeUI, BoxBoundsHandle> boundsGetter,
Func<InfluenceVolumeUI, Gizmo6FacesBox> boundsGetter,
ref Vector3 center, ref Vector3 size)
{
var b = boundsGetter(s);

static void DrawBoxFadeHandle(
InfluenceVolumeUI s, InfluenceVolume d, Editor o, Object sourceAsset,
Func<InfluenceVolumeUI, BoxBoundsHandle> boundsGetter,
Func<InfluenceVolumeUI, Gizmo6FacesBox> boundsGetter,
Vector3 baseOffset, Vector3 baseSize,
ref Vector3 positive, ref Vector3 negative)
{

31
com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/Volume/InfluenceVolumeUI.cs


using UnityEditor.IMGUI.Controls;
using UnityEngine;
using UnityEngine.Experimental.Rendering.HDPipeline;
using UnityEngine.Experimental.Gizmo;
namespace UnityEditor.Experimental.Rendering.HDPipeline
{

static readonly int k_ShapeCount = Enum.GetValues(typeof(ShapeType)).Length;
public BoxBoundsHandle boxBaseHandle = new BoxBoundsHandle();
public BoxBoundsHandle boxInfluenceHandle = new BoxBoundsHandle();
public BoxBoundsHandle boxInfluenceNormalHandle = new BoxBoundsHandle();
public Gizmo6FacesBox boxBaseHandle;
public Gizmo6FacesBoxContained boxInfluenceHandle;
public Gizmo6FacesBoxContained boxInfluenceNormalHandle;
public SphereBoundsHandle sphereBaseHandle = new SphereBoundsHandle();
public SphereBoundsHandle sphereInfluenceHandle = new SphereBoundsHandle();

: base(k_ShapeCount + k_AnimBoolFields)
{
isSectionAdvancedInfluenceSettings.value = false;
boxBaseHandle = new Gizmo6FacesBox(monochromeFace:true, monochromeSelectedFace:true);
boxInfluenceHandle = new Gizmo6FacesBoxContained(boxBaseHandle, monochromeFace:true, monochromeSelectedFace:true);
boxInfluenceNormalHandle = new Gizmo6FacesBoxContained(boxBaseHandle, monochromeFace:true, monochromeSelectedFace:true);
Color[] handleColors = new Color[]
{
HDReflectionProbeEditor.k_handlesColor[0][0],
HDReflectionProbeEditor.k_handlesColor[0][1],
HDReflectionProbeEditor.k_handlesColor[0][2],
HDReflectionProbeEditor.k_handlesColor[1][0],
HDReflectionProbeEditor.k_handlesColor[1][1],
HDReflectionProbeEditor.k_handlesColor[1][2]
};
boxBaseHandle.handleColors = handleColors;
boxInfluenceHandle.handleColors = handleColors;
boxInfluenceNormalHandle.handleColors = handleColors;
boxBaseHandle.faceColors = new Color[] { HDReflectionProbeEditor.k_GizmoThemeColorExtent };
boxBaseHandle.faceColorsSelected = new Color[] { HDReflectionProbeEditor.k_GizmoThemeColorExtentFace };
boxInfluenceHandle.faceColors = new Color[] { HDReflectionProbeEditor.k_GizmoThemeColorInfluenceBlend };
boxInfluenceHandle.faceColorsSelected = new Color[] { HDReflectionProbeEditor.k_GizmoThemeColorInfluenceBlendFace };
boxInfluenceNormalHandle.faceColors = new Color[] { HDReflectionProbeEditor.k_GizmoThemeColorInfluenceNormalBlend };
boxInfluenceNormalHandle.faceColorsSelected = new Color[] { HDReflectionProbeEditor.k_GizmoThemeColorInfluenceNormalBlendFace };
}
public override void Update()

正在加载...
取消
保存