浏览代码

Add monochrome support for new gizmo

/main
RSlysz 6 年前
当前提交
a28801d0
共有 4 个文件被更改,包括 66 次插入36 次删除
  1. 2
      com.unity.render-pipelines.core/CoreRP/Editor/CoreEditorUtils.cs
  2. 97
      com.unity.render-pipelines.core/CoreRP/Tool/Gizmo6FacesBox.cs
  3. 1
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDReflectionProbeUI.Drawers.cs
  4. 2
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDReflectionProbeUI.cs

2
com.unity.render-pipelines.core/CoreRP/Editor/CoreEditorUtils.cs


if (colors != null && (colors.Length != 2 || colors[0].Length != 3 || colors[1].Length != 3))
throw new System.ArgumentException("Colors must be a 2x3 array.");
Debug.Log(colors);
GUILayout.BeginVertical();
if(label != GUIContent.none)
EditorGUILayout.LabelField(label);

97
com.unity.render-pipelines.core/CoreRP/Tool/Gizmo6FacesBox.cs


new Color(0f, 1f, 0f, .15f),
new Color(0f, 0f, 1f, .15f)
});
return m_faceColorsSelected ?? (m_faceColorsSelected = monochromeSelectedFace
? new Color[]
{
new Color(1f, 1f, 1f, .15f)
}
: new Color[]
{
new Color(1f, 0f, 0f, .15f),
new Color(0f, 1f, 0f, .15f),
new Color(0f, 0f, 1f, .15f),
new Color(1f, 0f, 0f, .15f),
new Color(0f, 1f, 0f, .15f),
new Color(0f, 0f, 1f, .15f)
});
}
set
{

}
if (value.Length != 6)
if (value.Length != (monochromeSelectedFace ? 1 : 6))
throw new ArgumentException("FaceColor must have 6 entries: X Y Z -X -Y -Z");
throw new ArgumentException("FaceColor must have 6 entries: X Y Z -X -Y -Z or only one in monochrome mode");
}
m_faceColorsSelected = value;
}

{
get
{
return m_faceColors ?? (m_faceColors = new Color[]
{
new Color(1f, .9f, .58f, .17f),
new Color(1f, .9f, .58f, .17f),
new Color(1f, .9f, .58f, .17f),
new Color(1f, .9f, .58f, .17f),
new Color(1f, .9f, .58f, .17f),
new Color(1f, .9f, .58f, .17f)
});
return m_faceColors ?? (m_faceColors = monochromeFace
? new Color[]
{
new Color(.5f, .5f, .5f, .15f)
}
: new Color[]
{
new Color(.5f, 0f, 0f, .15f),
new Color(0f, .5f, 0f, .15f),
new Color(0f, 0f, .5f, .15f),
new Color(.5f, 0f, 0f, .15f),
new Color(0f, .5f, 0f, .15f),
new Color(0f, 0f, .5f, .15f)
});
}
set
{

}
if (value.Length != 6)
if (value.Length != (monochromeFace ? 1 : 6))
throw new ArgumentException("FaceColor must have 6 entries: X Y Z -X -Y -Z");
throw new ArgumentException("FaceColor must have 6 entries: X Y Z -X -Y -Z or only one in monochrome mode");
Color[] m_handleColors;
public Color[] handleColors

return m_handleColors ?? (m_handleColors = new Color[]
{
new Color(1f, 0f, 0f, 1f),
new Color(0f, 1f, 0f, 1f),
new Color(0f, 0f, 1f, 1f),
new Color(1f, 0f, 0f, 1f),
new Color(0f, 1f, 0f, 1f),
new Color(0f, 0f, 1f, 1f)
});
return m_handleColors ?? (m_handleColors = monochromeHandle
? new Color[]
{
new Color(1f, 0f, 0f, 1f)
}
: new Color[]
{
new Color(1f, 0f, 0f, 1f),
new Color(0f, 1f, 0f, 1f),
new Color(0f, 0f, 1f, 1f),
new Color(1f, 0f, 0f, 1f),
new Color(0f, 1f, 0f, 1f),
new Color(0f, 0f, 1f, 1f)
});
}
set
{

}
if (value.Length != 6)
if (value.Length != (monochromeHandle ? 1 : 6))
throw new ArgumentException("HandleColor must have 6 entries: X Y Z -X -Y -Z");
throw new ArgumentException("HandleColor must have 6 entries: X Y Z -X -Y -Z or only one in monochrome mode");
public readonly bool monochromeHandle;
public readonly bool monochromeFace;
public readonly bool monochromeSelectedFace;
public int[] m_ControlIDs = new int[6] { 0, 0, 0, 0, 0, 0 };
public Vector3 center { get; set; }

public Gizmo6FacesBox()
{ }
public Gizmo6FacesBox(bool monochromeHandle = false, bool monochromeFace = false, bool monochromeSelectedFace = false)
{
this.monochromeHandle = monochromeHandle;
this.monochromeFace = monochromeFace;
this.monochromeSelectedFace = monochromeSelectedFace;
}
return (element == Element.Face ? faceColors : element == Element.Handle ? handleColors : faceColorsSelected)[(int)name];
switch(element)
{
default:
case Element.Face: return faceColors[monochromeFace ? 0 : (int)name];
case Element.SelectedFace: return faceColorsSelected[monochromeSelectedFace ? 0 : (int)name];
case Element.Handle: return handleColors[monochromeHandle ? 0 : (int)name];
}
}
public virtual void DrawHull(bool selected)

}
}
public Gizmo6FacesBoxContained(Gizmo6FacesBox container)
public Gizmo6FacesBoxContained(Gizmo6FacesBox container, bool monochromeHandle = false, bool monochromeFace = false, bool monochromeSelectedFace = false) : base(monochromeHandle, monochromeFace, monochromeSelectedFace)
{
m_container = container;
}

Gizmos.DrawLine(m_container.center + zRecal + m_container.size.z * .5f * Vector3.back, center + size.z * .5f * Vector3.back);
}
Debug.Log(m_container.size);
Gizmos.color = colorGizmo;
}

1
com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDReflectionProbeUI.Drawers.cs


static void Drawer_InfluenceSettings(HDReflectionProbeUI s, SerializedHDReflectionProbe p, Editor owner)
{
EditorGUILayout.PropertyField(p.boxProjection, CoreEditorUtils.GetContent("Parallax Correction|Parallax Correction causes reflections to appear to change based on the object's position within the probe's box, while still using a single probe as the source of the reflection. This works well for reflections on objects that are moving through enclosed spaces such as corridors and rooms. Setting Parallax Correction to False and the cubemap reflection will be treated as coming from infinitely far away. Note that this feature can be globally disabled from Graphics Settings -> Tier Settings"));
s.useNewGizmo = EditorGUILayout.Toggle(CoreEditorUtils.GetContent("New Gizmo"), s.useNewGizmo);
}
static void Drawer_IntensityMultiplier(HDReflectionProbeUI s, SerializedHDReflectionProbe p, Editor owner)

2
com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDReflectionProbeUI.cs


public void ClearOperation(Operation op) { operations &= ~op; }
public void AddOperation(Operation op) { operations |= op; }
public bool useNewGizmo = false;
public BoxBoundsHandle boxInfluenceHandle = new BoxBoundsHandle();
public BoxBoundsHandle boxProjectionHandle = new BoxBoundsHandle();
public BoxBoundsHandle boxBlendHandle = new BoxBoundsHandle();

正在加载...
取消
保存