浏览代码

Rename ProxyShape and InfluenceShape

/main
RSlysz 6 年前
当前提交
3843183e
共有 15 个文件被更改,包括 74 次插入74 次删除
  1. 6
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDReflectionProbeEditor.cs
  2. 10
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDReflectionProbeUI.Drawers.cs
  3. 4
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDReflectionProbeUI.cs
  4. 4
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/Volume/InfluenceVolumeUI.Drawers.cs
  5. 8
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/Volume/InfluenceVolumeUI.Gizmos.cs
  6. 12
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/Volume/InfluenceVolumeUI.Handles.cs
  7. 8
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/Volume/InfluenceVolumeUI.cs
  8. 18
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/Volume/ProxyVolumeUI.cs
  9. 6
      com.unity.render-pipelines.high-definition/HDRP/Lighting/LightLoop/LightLoop.cs
  10. 4
      com.unity.render-pipelines.high-definition/HDRP/Lighting/Reflection/HDAdditionalReflectionData.cs
  11. 6
      com.unity.render-pipelines.high-definition/HDRP/Lighting/Reflection/PlanarReflectionProbe.cs
  12. 26
      com.unity.render-pipelines.high-definition/HDRP/Lighting/Reflection/ProbeWrapper.cs
  13. 18
      com.unity.render-pipelines.high-definition/HDRP/Lighting/Reflection/Volumes/InfluenceVolume.cs
  14. 14
      com.unity.render-pipelines.high-definition/HDRP/Lighting/Reflection/Volumes/ProxyVolume.cs
  15. 4
      com.unity.render-pipelines.high-definition/HDRP/Lighting/Reflection/Volumes/ShapeType.cs

6
com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDReflectionProbeEditor.cs


static void ApplyConstraintsOnTargets(HDReflectionProbeUI s, SerializedHDReflectionProbe sp, Editor o)
{
switch ((Shape)sp.influenceVolume.shape.enumValueIndex)
switch ((InfluenceShape)sp.influenceVolume.shape.enumValueIndex)
case Shape.Box:
case InfluenceShape.Box:
{
var maxBlendDistance = sp.influenceVolume.boxSize.vector3Value;
sp.targetData.influenceVolume.boxBlendDistancePositive = Vector3.Min(sp.targetData.influenceVolume.boxBlendDistancePositive, maxBlendDistance);

break;
}
case Shape.Sphere:
case InfluenceShape.Sphere:
{
var maxBlendDistance = Vector3.one * sp.influenceVolume.sphereRadius.floatValue;
sp.targetData.influenceVolume.boxBlendDistancePositive = Vector3.Min(sp.targetData.influenceVolume.boxBlendDistancePositive, maxBlendDistance);

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


if (EditorGUI.EndChangeCheck())
s.SetShapeTarget(p.influenceVolume.shape.intValue);
switch ((Shape)p.influenceVolume.shape.enumValueIndex)
switch ((InfluenceShape)p.influenceVolume.shape.enumValueIndex)
case Shape.Box:
case InfluenceShape.Box:
case Shape.Sphere:
case InfluenceShape.Sphere:
Drawer_InfluenceShapeSphereSettings(s, p, owner);
break;
}

static void Drawer_InfluenceAreas(HDReflectionProbeUI s, SerializedHDReflectionProbe p, Editor owner)
{
if (s.IsSectionExpandedShape(Shape.Box).value)
if (s.IsSectionExpandedShape(InfluenceShape.Box).value)
if (s.IsSectionExpandedShape(Shape.Sphere).value)
if (s.IsSectionExpandedShape(InfluenceShape.Sphere).value)
{
Drawer_InfluenceSphereSettings(s, p, owner);
}

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


{
const int k_AnimBoolSingleFieldCount = 4;
static readonly int k_ReflectionProbeModeCount = Enum.GetValues(typeof(ReflectionProbeMode)).Length;
static readonly int k_ReflectionInfluenceShapeCount = Enum.GetValues(typeof(Shape)).Length;
static readonly int k_ReflectionInfluenceShapeCount = Enum.GetValues(typeof(InfluenceShape)).Length;
static readonly int k_AnimBoolsCount = k_ReflectionProbeModeCount + k_ReflectionInfluenceShapeCount + k_AnimBoolSingleFieldCount;
public InfluenceVolumeUI influenceVolume = new InfluenceVolumeUI();

GetReflectionProbeModeBool(i).target = i == value;
}
public AnimBool IsSectionExpandedShape(Shape value)
public AnimBool IsSectionExpandedShape(InfluenceShape value)
{
return m_AnimBools[k_AnimBoolSingleFieldCount + k_ReflectionProbeModeCount + (int)value];
}

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


CED.space,
CED.Action(Drawer_FieldShapeType),
CED.FadeGroup(
(s, d, o, i) => s.IsSectionExpanded_Shape((Shape)i),
(s, d, o, i) => s.IsSectionExpanded_Shape((InfluenceShape)i),
FadeOption.None,
SectionShapeBoxPlanar,
SectionShapeSpherePlanar

CED.space,
CED.Action(Drawer_FieldShapeType),
CED.FadeGroup(
(s, d, o, i) => s.IsSectionExpanded_Shape((Shape)i),
(s, d, o, i) => s.IsSectionExpanded_Shape((InfluenceShape)i),
FadeOption.None,
SectionShapeBox,
SectionShapeSphere

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


Gizmos.color = color;
switch (d.shape)
{
case Shape.Box:
case InfluenceShape.Box:
{
s.boxBaseHandle.center = d.offset;
s.boxBaseHandle.size = d.boxSize;

case Shape.Sphere:
case InfluenceShape.Sphere:
{
if (isSolid)
Gizmos.DrawSphere(d.offset, d.sphereRadius);

Gizmos.color = color;
switch (d.shape)
{
case Shape.Box:
case InfluenceShape.Box:
{
Gizmo6FacesBox refBox = isNormal ? s.boxInfluenceNormalHandle : s.boxInfluenceHandle;
refBox.center = d.offset + boxOffset;

}
case Shape.Sphere:
case InfluenceShape.Sphere:
{
if (isSolid)
Gizmos.DrawSphere(d.offset, d.sphereRadius + sphereOffset);

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


Handles.color = k_GizmoThemeColorBase;
switch (d.shape)
{
case Shape.Box:
case InfluenceShape.Box:
{
var center = d.offset;
var size = d.boxSize;

d.boxSize = size;
break;
}
case Shape.Sphere:
case InfluenceShape.Sphere:
{
var center = d.offset;
var radius = d.sphereRadius;

Handles.color = k_GizmoThemeColorInfluence;
switch (d.shape)
{
case Shape.Box:
case InfluenceShape.Box:
{
var positive = d.boxBlendDistancePositive;
var negative = d.boxBlendDistanceNegative;

s.data.Apply();
break;
}
case Shape.Sphere:
case InfluenceShape.Sphere:
{
var fade = d.sphereBlendDistance;
DrawSphereFadeHandle(

Handles.color = k_GizmoThemeColorInfluenceNormal;
switch (d.shape)
{
case Shape.Box:
case InfluenceShape.Box:
{
Vector3 positive = d.boxBlendNormalDistancePositive;

s.data.Apply();
break;
}
case Shape.Sphere:
case InfluenceShape.Sphere:
{
var fade = d.sphereBlendNormalDistance;
DrawSphereFadeHandle(

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


internal static readonly Color k_GizmoThemeColorDisabled = new Color(0x99 / 255f, 0x89 / 255f, 0x59 / 255f, 0x10 / 255f);
internal static readonly Color k_GizmoThemeColorDisabledFace = new Color(0x99 / 255f, 0x89 / 255f, 0x59 / 255f, 0x10 / 255f);
static readonly int k_ShapeCount = Enum.GetValues(typeof(Shape)).Length;
static readonly int k_ShapeCount = Enum.GetValues(typeof(InfluenceShape)).Length;
public Gizmo6FacesBox boxBaseHandle;
public Gizmo6FacesBoxContained boxInfluenceHandle;

public override void Update()
{
base.Update();
SetIsSectionExpanded_Shape((Shape)data.shape.intValue);
SetIsSectionExpanded_Shape((InfluenceShape)data.shape.intValue);
void SetIsSectionExpanded_Shape(Shape shape)
void SetIsSectionExpanded_Shape(InfluenceShape shape)
public AnimBool IsSectionExpanded_Shape(Shape shapeType)
public AnimBool IsSectionExpanded_Shape(InfluenceShape shapeType)
{
return m_AnimBools[(int)shapeType];
}

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


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);
static readonly int k_ShapeCount = Enum.GetValues(typeof(Shape)).Length;
static readonly int k_ShapeCount = Enum.GetValues(typeof(InfluenceShape)).Length;
public static readonly CED.IDrawer SectionShape;

SectionShape = CED.Group(
CED.Action(Drawer_FieldShapeType),
CED.FadeGroup(
(s, d, o, i) => s.IsSectionExpanded_Shape((Shape)i),
(s, d, o, i) => s.IsSectionExpanded_Shape((InfluenceShape)i),
FadeOption.Indent,
SectionShapeBox,
SectionShapeSphere

{
base.Update();
if (data != null)
SetIsSectionExpanded_Shape((Shape)data.shape.intValue);
SetIsSectionExpanded_Shape((InfluenceShape)data.shape.intValue);
void SetIsSectionExpanded_Shape(Shape shape)
void SetIsSectionExpanded_Shape(InfluenceShape shape)
public AnimBool IsSectionExpanded_Shape(Shape shapeType)
public AnimBool IsSectionExpanded_Shape(InfluenceShape shapeType)
{
return m_AnimBools[(int)shapeType];
}

{
switch (proxyVolume.shape)
{
case ShapeOrInfinite.Box:
case ProxyShape.Box:
case ShapeOrInfinite.Sphere:
case ProxyShape.Sphere:
Handles_EditBase_Sphere(transform, proxyVolume, ui, sourceAsset);
break;
}

{
switch (proxyVolume.shape)
{
case ShapeOrInfinite.Box:
case ProxyShape.Box:
case ShapeOrInfinite.Sphere:
case ProxyShape.Sphere:
Gizmos_EditNone_Sphere(transform, proxyVolume, ui, sourceAsset);
break;
}

6
com.unity.render-pipelines.high-definition/HDRP/Lighting/LightLoop/LightLoop.cs


}
LightVolumeType lightVolumeType = LightVolumeType.Box;
if (additional != null && additional.influenceVolume.shape == Shape.Sphere)
if (additional != null && additional.influenceVolume.shape == InfluenceShape.Sphere)
lightVolumeType = LightVolumeType.Sphere;
++envLightCount;

continue;
var lightVolumeType = LightVolumeType.Box;
if (probe.influenceVolume.shape == Shape.Sphere)
if (probe.influenceVolume.shape == InfluenceShape.Sphere)
lightVolumeType = LightVolumeType.Sphere;
++envLightCount;

Vector3 distance = Vector3.one * probe.blendDistance;
add.influenceVolume.boxBlendDistancePositive = distance;
add.influenceVolume.boxBlendDistanceNegative = distance;
add.influenceVolume.shape = Shape.Box;
add.influenceVolume.shape = InfluenceShape.Box;
}
return add;
}

4
com.unity.render-pipelines.high-definition/HDRP/Lighting/Reflection/HDAdditionalReflectionData.cs


UseInfluenceVolume,
// Add new version here and they will automatically be the Current one
Max,
Current = Max - 1
Current = Max - 1
}
[SerializeField, FormerlySerializedAs("version")]

#pragma warning disable 649 //never assigned
//data only kept for migration, to be removed in future version
[SerializeField, System.Obsolete("influenceShape is deprecated, use influenceVolume parameters instead")]
Shape influenceShape;
InfluenceShape influenceShape;
[SerializeField, System.Obsolete("influenceSphereRadius is deprecated, use influenceVolume parameters instead")]
float influenceSphereRadius = 3.0f;
[SerializeField, System.Obsolete("blendDistancePositive is deprecated, use influenceVolume parameters instead")]

6
com.unity.render-pipelines.high-definition/HDRP/Lighting/Reflection/PlanarReflectionProbe.cs


: influenceToWorld;
}
}
public ShapeOrInfinite proxyShape
public ProxyShape proxyShape
: (ShapeOrInfinite)influenceVolume.shape;
: (ProxyShape)influenceVolume.shape;
}
}
public Vector3 proxyExtents

get
{
return proxyVolume != null
&& proxyVolume.proxyVolume.shape == ShapeOrInfinite.Infinite;
&& proxyVolume.proxyVolume.shape == ProxyShape.Infinite;
}
}

26
com.unity.render-pipelines.high-definition/HDRP/Lighting/Reflection/ProbeWrapper.cs


throw new ArgumentException();
}
protected static EnvShapeType ConvertShape(Shape shape)
protected static EnvShapeType ConvertShape(InfluenceShape shape)
case Shape.Box:
case InfluenceShape.Box:
case Shape.Sphere:
case InfluenceShape.Sphere:
protected static EnvShapeType ConvertShape(ShapeOrInfinite shape)
protected static EnvShapeType ConvertShape(ProxyShape shape)
case ShapeOrInfinite.Infinite:
case ShapeOrInfinite.Box:
case ProxyShape.Infinite:
case ProxyShape.Box:
case ShapeOrInfinite.Sphere:
case ProxyShape.Sphere:
return EnvShapeType.Sphere;
}
}

Vector3 distance = Vector3.one * probe.blendDistance;
add.influenceVolume.boxBlendDistancePositive = distance;
add.influenceVolume.boxBlendDistanceNegative = distance;
add.influenceVolume.shape= Shape.Box;
add.influenceVolume.shape= InfluenceShape.Box;
}
return add;
}

switch (additional.influenceVolume.shape)
{
default:
case Shape.Box:
case InfluenceShape.Box:
case Shape.Sphere:
case InfluenceShape.Sphere:
return Vector3.one * additional.influenceVolume.sphereRadius;
}
}

get
{
return additional.proxyVolume != null
? additional.proxyVolume.proxyVolume.shape == ShapeOrInfinite.Infinite
? additional.proxyVolume.proxyVolume.shape == ProxyShape.Infinite
: probe.boxProjection == 0;
}
}

switch (planarReflectionProbe.influenceVolume.shape)
{
default:
case Shape.Box:
case InfluenceShape.Box:
case Shape.Sphere:
case InfluenceShape.Sphere:
return planarReflectionProbe.influenceVolume.sphereRadius * Vector3.one;
}
}

18
com.unity.render-pipelines.high-definition/HDRP/Lighting/Reflection/Volumes/InfluenceVolume.cs


HDProbe probe;
[SerializeField, FormerlySerializedAs("m_ShapeType")]
Shape m_Shape = Shape.Box;
InfluenceShape m_Shape = InfluenceShape.Box;
[SerializeField, FormerlySerializedAs("m_BoxBaseOffset")]
Vector3 m_Offset;
#pragma warning disable 649 //never assigned

float m_SphereBlendNormalDistance;
/// <summary>Shape of this InfluenceVolume.</summary>
public Shape shape
public InfluenceShape shape
{
get { return m_Shape; }
set

{
case Shape.Box:
case InfluenceShape.Box:
case Shape.Sphere:
case InfluenceShape.Sphere:
probe.UpdatedInfluenceVolumeShape(Vector3.one * (2 * m_SphereRadius), offset);
break;
}

switch (shape)
{
default:
case Shape.Sphere:
case InfluenceShape.Sphere:
case Shape.Box:
case InfluenceShape.Box:
{
var position = probeTransform.TransformPoint(offset);
var radius = Mathf.Max(boxSize.x, Mathf.Max(boxSize.y, boxSize.z));

switch (shape)
{
default:
case Shape.Sphere:
case InfluenceShape.Sphere:
case Shape.Box:
case InfluenceShape.Box:
{
var position = probeTransform.TransformPoint(offset);
return new Bounds(position, boxSize);

internal void MigrateOffsetSphere()
{
if (shape == Shape.Sphere)
if (shape == InfluenceShape.Sphere)
{
#pragma warning disable CS0618 // Type or member is obsolete
m_Offset = m_SphereBaseOffset;

14
com.unity.render-pipelines.high-definition/HDRP/Lighting/Reflection/Volumes/ProxyVolume.cs


public class ProxyVolume
{
[SerializeField, FormerlySerializedAs("m_ShapeType")]
ShapeOrInfinite m_Shape = ShapeOrInfinite.Box;
ProxyShape m_Shape = ProxyShape.Box;
// Box
[SerializeField]

bool m_SphereInfiniteProjection = false;
/// <summary>The shape of the proxy</summary>
public ShapeOrInfinite shape { get { return m_Shape; } private set { m_Shape = value; } }
public ProxyShape shape { get { return m_Shape; } private set { m_Shape = value; } }
/// <summary>The size of the proxy if it as a shape Box</summary>
public Vector3 boxSize { get { return m_BoxSize; } set { m_BoxSize = value; } }

{
switch (shape)
{
case ShapeOrInfinite.Box: return m_BoxSize * 0.5f;
case ShapeOrInfinite.Sphere: return Vector3.one * m_SphereRadius;
case ProxyShape.Box: return m_BoxSize * 0.5f;
case ProxyShape.Sphere: return Vector3.one * m_SphereRadius;
default: return Vector3.one;
}
}

{
#pragma warning disable CS0618 // Type or member is obsolete
if (shape == ShapeOrInfinite.Sphere && m_SphereInfiniteProjection
|| shape == ShapeOrInfinite.Box && m_BoxInfiniteProjection)
if (shape == ProxyShape.Sphere && m_SphereInfiniteProjection
|| shape == ProxyShape.Box && m_BoxInfiniteProjection)
shape = ShapeOrInfinite.Infinite;
shape = ProxyShape.Infinite;
}
}
}

4
com.unity.render-pipelines.high-definition/HDRP/Lighting/Reflection/Volumes/ShapeType.cs


namespace UnityEngine.Experimental.Rendering.HDPipeline
{
public enum Shape
public enum InfluenceShape
public enum ShapeOrInfinite
public enum ProxyShape
{
Box,
Sphere,

正在加载...
取消
保存