浏览代码

Merge pull request #1771 from Unity-Technologies/HDRP/refactor-reflectionProbe/clean-proxy-volume

Hdrp/refactor reflection probe/clean proxy volume
/main
GitHub 6 年前
当前提交
f1d3b9dd
共有 21 个文件被更改,包括 1234 次插入123 次删除
  1. 6
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDReflectionProbeEditor.cs
  2. 12
      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/PlanarReflectionProbeUI.Drawers.cs
  5. 4
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/Volume/InfluenceVolumeUI.Drawers.cs
  6. 8
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/Volume/InfluenceVolumeUI.Gizmos.cs
  7. 12
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/Volume/InfluenceVolumeUI.Handles.cs
  8. 8
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/Volume/InfluenceVolumeUI.cs
  9. 38
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/Volume/ProxyVolumeUI.cs
  10. 12
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/Volume/SerializedProxyVolume.cs
  11. 4
      com.unity.render-pipelines.high-definition/HDRP/Lighting/LightLoop/LightLoop.cs
  12. 4
      com.unity.render-pipelines.high-definition/HDRP/Lighting/Reflection/HDAdditionalReflectionData.cs
  13. 7
      com.unity.render-pipelines.high-definition/HDRP/Lighting/Reflection/HDProbe.cs
  14. 15
      com.unity.render-pipelines.high-definition/HDRP/Lighting/Reflection/PlanarReflectionProbe.cs
  15. 35
      com.unity.render-pipelines.high-definition/HDRP/Lighting/Reflection/ProbeWrapper.cs
  16. 25
      com.unity.render-pipelines.high-definition/HDRP/Lighting/Reflection/Volumes/InfluenceVolume.cs
  17. 42
      com.unity.render-pipelines.high-definition/HDRP/Lighting/Reflection/Volumes/ProxyVolume.cs
  18. 32
      com.unity.render-pipelines.high-definition/HDRP/Lighting/Reflection/Volumes/ReflectionProxyVolumeComponent.cs
  19. 9
      com.unity.render-pipelines.high-definition/HDRP/Lighting/Reflection/Volumes/ShapeType.cs
  20. 1001
      com.unity.render-pipelines.high-definition/HDRP/Lighting/LightLoop/LightLoop.cs.orig
  21. 75
      com.unity.render-pipelines.high-definition/HDRP/Lighting/Reflection/HDProbe.cs.orig

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);

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


if (p.proxyVolumeComponent.objectReferenceValue != null)
{
var proxy = (ReflectionProxyVolumeComponent)p.proxyVolumeComponent.objectReferenceValue;
if ((int)proxy.proxyVolume.shapeType != p.influenceVolume.shape.enumValueIndex)
if ((int)proxy.proxyVolume.shape != p.influenceVolume.shape.enumValueIndex)
EditorGUILayout.HelpBox(
"Proxy volume and influence volume have different shape types, this is not supported.",
MessageType.Error,

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/PlanarReflectionProbeUI.Drawers.cs


static void Drawer_DifferentShapeError(PlanarReflectionProbeUI s, SerializedPlanarReflectionProbe d, Editor o)
{
var proxy = d.proxyVolumeReference.objectReferenceValue as ReflectionProxyVolumeComponent;
if (proxy != null && (int)proxy.proxyVolume.shapeType != d.influenceVolume.shape.enumValueIndex)
if (proxy != null && (int)proxy.proxyVolume.shape != d.influenceVolume.shape.enumValueIndex)
{
EditorGUILayout.HelpBox(
"Proxy volume and influence volume have different shape types, this is not supported.",

if (d.proxyVolumeReference.objectReferenceValue != null)
{
var proxy = (ReflectionProxyVolumeComponent)d.proxyVolumeReference.objectReferenceValue;
if ((int)proxy.proxyVolume.shapeType != d.influenceVolume.shape.enumValueIndex)
if ((int)proxy.proxyVolume.shape != d.influenceVolume.shape.enumValueIndex)
EditorGUILayout.HelpBox(
"Proxy volume and influence volume have different shape types, this is not supported.",
MessageType.Error,

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];
}

38
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.shapeType.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];
}

EditorGUILayout.PropertyField(d.shapeType, _.GetContent("Shape Type"));
EditorGUILayout.PropertyField(d.shape, _.GetContent("Shape Type"));
EditorGUILayout.PropertyField(d.boxOffset, _.GetContent("Box Offset"));
EditorGUILayout.PropertyField(d.boxInfiniteProjection, _.GetContent("Infinite Projection"));
EditorGUILayout.PropertyField(d.sphereOffset, _.GetContent("Sphere Offset"));
EditorGUILayout.PropertyField(d.sphereInfiniteProjection, _.GetContent("Infinite Projection"));
switch (proxyVolume.shapeType)
switch (proxyVolume.shape)
case Shape.Box:
case ProxyShape.Box:
case Shape.Sphere:
case ProxyShape.Sphere:
Handles_EditBase_Sphere(transform, proxyVolume, ui, sourceAsset);
break;
}

static void Handles_EditBase_Sphere(Transform transform, ProxyVolume proxyVolume, ProxyVolumeUI s, Object sourceAsset)
{
s.sphereProjectionHandle.center = proxyVolume.sphereOffset;
s.sphereProjectionHandle.center = Vector3.zero;
s.sphereProjectionHandle.radius = proxyVolume.sphereRadius;
var mat = Handles.matrix;

{
Undo.RecordObject(sourceAsset, "Modified Projection Volume");
proxyVolume.sphereOffset = s.sphereProjectionHandle.center;
proxyVolume.sphereRadius = s.sphereProjectionHandle.radius;
EditorUtility.SetDirty(sourceAsset);

static void Handles_EditBase_Box(Transform transform, ProxyVolume proxyVolume, ProxyVolumeUI s, Object sourceAsset)
{
s.boxProjectionHandle.center = proxyVolume.boxOffset;
s.boxProjectionHandle.center = Vector3.zero;
s.boxProjectionHandle.size = proxyVolume.boxSize;
var mat = Handles.matrix;

{
Undo.RecordObject(sourceAsset, "Modified Projection Volume AABB");
proxyVolume.boxOffset = s.boxProjectionHandle.center;
proxyVolume.boxSize = s.boxProjectionHandle.size;
EditorUtility.SetDirty(sourceAsset);

public static void DrawGizmos_EditNone(Transform transform, ProxyVolume proxyVolume, ProxyVolumeUI ui, Object sourceAsset)
{
switch (proxyVolume.shapeType)
switch (proxyVolume.shape)
case Shape.Box:
case ProxyShape.Box:
case Shape.Sphere:
case ProxyShape.Sphere:
Gizmos_EditNone_Sphere(transform, proxyVolume, ui, sourceAsset);
break;
}

Gizmos.matrix = t.localToWorldMatrix;
Gizmos.color = k_GizmoThemeColorProjection;
Gizmos.DrawWireSphere(d.sphereOffset, d.sphereRadius);
Gizmos.DrawWireSphere(Vector3.zero, d.sphereRadius);
Gizmos.matrix = mat;
}

Gizmos.matrix = t.localToWorldMatrix;
Gizmos.color = k_GizmoThemeColorProjection;
Gizmos.DrawWireCube(d.boxOffset, d.boxSize);
Gizmos.DrawWireCube(Vector3.zero, d.boxSize);
Gizmos.matrix = mat;
}

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


{
public SerializedProperty root;
public SerializedProperty shapeType;
public SerializedProperty shape;
public SerializedProperty boxOffset;
public SerializedProperty boxInfiniteProjection;
public SerializedProperty sphereOffset;
public SerializedProperty sphereInfiniteProjection;
shapeType = root.Find((ProxyVolume p) => p.shapeType);
shape = root.Find((ProxyVolume p) => p.shape);
boxOffset = root.Find((ProxyVolume p) => p.boxOffset);
boxInfiniteProjection = root.Find((ProxyVolume p) => p.boxInfiniteProjection);
sphereOffset = root.Find((ProxyVolume p) => p.sphereOffset);
sphereInfiniteProjection = root.Find((ProxyVolume p) => p.sphereInfiniteProjection);
}
}
}

4
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;

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")]

7
com.unity.render-pipelines.high-definition/HDRP/Lighting/Reflection/HDProbe.cs


get { return m_RefreshMode; }
set { m_RefreshMode = value; }
}
influenceVolume = new InfluenceVolume(this);
else
influenceVolume.Init(this);
influenceVolume = new InfluenceVolume();
influenceVolume.Init(this);
}
void ISerializationCallbackReceiver.OnBeforeSerialize()

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


: influenceToWorld;
}
}
public Shape proxyShape
public ProxyShape proxyShape
? proxyVolume.proxyVolume.shapeType
: influenceVolume.shape;
? proxyVolume.proxyVolume.shape
: (ProxyShape)influenceVolume.shape;
}
}
public Vector3 proxyExtents

: influenceVolume.boxSize;
}
}
public bool infiniteProjection { get { return proxyVolume != null && proxyVolume.proxyVolume.infiniteProjection; } }
public bool infiniteProjection
{
get
{
return proxyVolume != null
&& proxyVolume.proxyVolume.shape == ProxyShape.Infinite;
}
}
public bool useMirrorPlane
{

35
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:
return EnvShapeType.Sphere;
}
}
protected static EnvShapeType ConvertShape(ProxyShape shape)
{
switch (shape)
{
case ProxyShape.Box:
return EnvShapeType.Box;
default:
case ProxyShape.Infinite:
case ProxyShape.Sphere:
return EnvShapeType.Sphere;
}
}

add = HDUtils.s_DefaultHDAdditionalReflectionData;
if (add.influenceVolume == null)
{
add.Awake();
add.Awake(); // We need to init the 'default' data if it isn't
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
? ConvertShape(additional.proxyVolume.proxyVolume.shapeType)
? ConvertShape(additional.proxyVolume.proxyVolume.shape)
: influenceShapeType;
}
}

get
{
return additional.proxyVolume != null
? additional.proxyVolume.proxyVolume.infiniteProjection
? 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;
}
}

25
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;
}

/// Value between 0 (on InfluenceVolume hull) and sphereRadius (fade sub volume reduced to a point).
/// </summary>
public float sphereBlendNormalDistance { get { return m_SphereBlendNormalDistance; } set { m_SphereBlendNormalDistance = value; } }
internal InfluenceVolume(HDProbe probe)
{
Init(probe);
}
internal void Init(HDProbe probe)
{
this.probe = probe;

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;

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


using System;
using UnityEngine.Serialization;
namespace UnityEngine.Experimental.Rendering.HDPipeline
{

[SerializeField]
Shape m_ShapeType = Shape.Box;
[SerializeField, FormerlySerializedAs("m_ShapeType")]
ProxyShape m_Shape = ProxyShape.Box;
[SerializeField]
Vector3 m_BoxOffset;
[SerializeField]
[SerializeField, Obsolete("Kept only for compatibility. Use m_Shape instead")]
[SerializeField]
Vector3 m_SphereOffset;
[SerializeField]
[SerializeField, Obsolete("Kept only for compatibility. Use m_Shape instead")]
public Shape shapeType { get { return m_ShapeType; } }
/// <summary>The shape of the proxy</summary>
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 boxOffset { get { return m_BoxOffset; } set { m_BoxOffset = value; } }
public bool boxInfiniteProjection { get { return m_BoxInfiniteProjection; } }
/// <summary>The radius of the proxy if it as a shape Sphere</summary>
public Vector3 sphereOffset { get { return m_SphereOffset; } set { m_SphereOffset = value; } }
public bool sphereInfiniteProjection { get { return m_SphereInfiniteProjection; } }
public Vector3 extents
internal Vector3 extents
switch (shapeType)
switch (shape)
case Shape.Box: return m_BoxSize * 0.5f;
case Shape.Sphere: return Vector3.one * m_SphereRadius;
case ProxyShape.Box: return m_BoxSize * 0.5f;
case ProxyShape.Sphere: return Vector3.one * m_SphereRadius;
public bool infiniteProjection
internal void MigrateInfiniteProhjectionInShape()
get
#pragma warning disable CS0618 // Type or member is obsolete
if (shape == ProxyShape.Sphere && m_SphereInfiniteProjection
|| shape == ProxyShape.Box && m_BoxInfiniteProjection)
#pragma warning restore CS0618 // Type or member is obsolete
return shapeType == Shape.Box && boxInfiniteProjection
|| shapeType == Shape.Sphere && sphereInfiniteProjection;
shape = ProxyShape.Infinite;
}
}
}

32
com.unity.render-pipelines.high-definition/HDRP/Lighting/Reflection/Volumes/ReflectionProxyVolumeComponent.cs


namespace UnityEngine.Experimental.Rendering.HDPipeline
{
public class ReflectionProxyVolumeComponent : MonoBehaviour
public class ReflectionProxyVolumeComponent : MonoBehaviour, ISerializationCallbackReceiver
enum Version
{
First,
IncludeInfiniteInShape,
// Add new version here and they will automatically be the Current one
Max,
Current = Max - 1
}
[SerializeField]
int m_Version;
/// <summary>Access to proxy volume parameters</summary>
void ISerializationCallbackReceiver.OnBeforeSerialize()
{
}
void ISerializationCallbackReceiver.OnAfterDeserialize()
{
if (m_Version != (int)Version.Current)
{
// Add here data migration code
if (m_Version < (int)Version.IncludeInfiniteInShape)
{
proxyVolume.MigrateInfiniteProhjectionInShape();
}
m_Version = (int)Version.Current;
}
}
}
}

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


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

1001
com.unity.render-pipelines.high-definition/HDRP/Lighting/LightLoop/LightLoop.cs.orig
文件差异内容过多而无法显示
查看文件

75
com.unity.render-pipelines.high-definition/HDRP/Lighting/Reflection/HDProbe.cs.orig


using UnityEngine.Rendering;
using UnityEngine.Serialization;
namespace UnityEngine.Experimental.Rendering.HDPipeline
{
[ExecuteInEditMode]
public abstract class HDProbe : MonoBehaviour, ISerializationCallbackReceiver
{
[SerializeField, FormerlySerializedAs("proxyVolumeComponent"), FormerlySerializedAs("m_ProxyVolumeReference")]
ReflectionProxyVolumeComponent m_ProxyVolume = null;
[SerializeField]
InfluenceVolume m_InfluenceVolume;
[SerializeField, FormerlySerializedAsAttribute("dimmer"), FormerlySerializedAsAttribute("m_Dimmer"), FormerlySerializedAsAttribute("multiplier")]
float m_Multiplier = 1.0f;
[SerializeField, FormerlySerializedAsAttribute("weight")]
[Range(0.0f, 1.0f)]
float m_Weight = 1.0f;
[SerializeField]
ReflectionProbeMode m_Mode = ReflectionProbeMode.Baked;
[SerializeField]
ReflectionProbeRefreshMode m_RefreshMode = ReflectionProbeRefreshMode.OnAwake;
/// <summary>ProxyVolume currently used by this probe.</summary>
public ReflectionProxyVolumeComponent proxyVolume { get { return m_ProxyVolume; } }
/// <summary>InfluenceVolume of the probe.</summary>
public InfluenceVolume influenceVolume { get { return m_InfluenceVolume; } private set { m_InfluenceVolume = value; } }
/// <summary>Multiplier factor of reflection (non PBR parameter).</summary>
public float multiplier { get { return m_Multiplier; } }
/// <summary>Weight for blending amongst probes (non PBR parameter).</summary>
public float weight { get { return m_Weight; } }
/// <summary>The capture mode.</summary>
public virtual ReflectionProbeMode mode
{
get { return m_Mode; }
set { m_Mode = value; }
}
/// <summary>Refreshing rate of the capture for Realtime capture mode.</summary>
public virtual ReflectionProbeRefreshMode refreshMode
{
get { return m_RefreshMode; }
set { m_RefreshMode = value; }
}
<<<<<<< HEAD
void Awake()
=======
internal void Awake()
>>>>>>> HDRP/staging
{
if (influenceVolume == null)
influenceVolume = new InfluenceVolume();
influenceVolume.Init(this);
}
void ISerializationCallbackReceiver.OnBeforeSerialize()
{
}
void ISerializationCallbackReceiver.OnAfterDeserialize()
{
influenceVolume.Init(this);
}
internal virtual void UpdatedInfluenceVolumeShape(Vector3 size, Vector3 offset) { }
}
}
正在加载...
取消
保存