浏览代码

merge InfluenceVolume usage into HDProbe

/main
RSlysz 6 年前
当前提交
165edab6
共有 8 个文件被更改,包括 167 次插入150 次删除
  1. 11
      com.unity.render-pipelines.high-definition/HDRP/Lighting/LightLoop/LightLoop.cs
  2. 76
      com.unity.render-pipelines.high-definition/HDRP/Lighting/Reflection/HDAdditionalReflectionData.cs
  3. 6
      com.unity.render-pipelines.high-definition/HDRP/Lighting/Reflection/HDProbe.cs
  4. 22
      com.unity.render-pipelines.high-definition/HDRP/Lighting/Reflection/PlanarReflectionProbe.cs
  5. 59
      com.unity.render-pipelines.high-definition/HDRP/Lighting/Reflection/ProbeWrapper.cs
  6. 127
      com.unity.render-pipelines.high-definition/HDRP/Lighting/Reflection/Volumes/InfluenceVolume.cs
  7. 12
      com.unity.render-pipelines.high-definition/HDRP/Lighting/Reflection/Volumes/ProxyVolume.cs
  8. 4
      com.unity.render-pipelines.high-definition/HDRP/Lighting/Reflection/Volumes/ShapeType.cs

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


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

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

if (add == null)
{
add = HDUtils.s_DefaultHDAdditionalReflectionData;
add.blendDistancePositive = Vector3.one * probe.blendDistance;
add.blendDistanceNegative = add.blendDistancePositive;
add.influenceShape = ShapeType.Box;
Vector3 distance = Vector3.one * probe.blendDistance;
add.influenceVolume.boxBlendDistancePositive = distance;
add.influenceVolume.boxBlendDistanceNegative = distance;
add.influenceVolume.shape = Shape.Box;
}
return add;
}

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


[RequireComponent(typeof(ReflectionProbe))]
public class HDAdditionalReflectionData : HDProbe, ISerializationCallbackReceiver
{
[HideInInspector]
const int currentVersion = 2;
const int currentVersion = 3;
[SerializeField, FormerlySerializedAs("version")]
int m_Version;

public ShapeType influenceShape;
public float influenceSphereRadius = 3.0f;
public float sphereReprojectionVolumeRadius = 1.0f;
public bool useSeparateProjectionVolume = false;
public Vector3 boxReprojectionVolumeSize = Vector3.one;
public Vector3 boxReprojectionVolumeCenter = Vector3.zero;
public float maxSearchDistance = 8.0f;
public Texture previewCubemap;
public Vector3 blendDistancePositive = Vector3.zero;
public Vector3 blendDistanceNegative = Vector3.zero;
public Vector3 blendNormalDistancePositive = Vector3.zero;
public Vector3 blendNormalDistanceNegative = Vector3.zero;
public Vector3 boxSideFadePositive = Vector3.one;
public Vector3 boxSideFadeNegative = Vector3.one;
//editor value that need to be saved for easy passing from simplified to advanced and vice et versa
// /!\ must not be used outside editor code
[SerializeField] private Vector3 editorAdvancedModeBlendDistancePositive;
[SerializeField] private Vector3 editorAdvancedModeBlendDistanceNegative;
[SerializeField] private float editorSimplifiedModeBlendDistance;
[SerializeField] private Vector3 editorAdvancedModeBlendNormalDistancePositive;
[SerializeField] private Vector3 editorAdvancedModeBlendNormalDistanceNegative;
[SerializeField] private float editorSimplifiedModeBlendNormalDistance;
[SerializeField] private bool editorAdvancedModeEnabled;
//data only kept for migration, to be removed in future version
[SerializeField, System.Obsolete("influenceShape is deprecated, use influenceVolume parameters instead")]
Shape 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")]
Vector3 blendDistancePositive = Vector3.zero;
[SerializeField, System.Obsolete("blendDistanceNegative is deprecated, use influenceVolume parameters instead")]
Vector3 blendDistanceNegative = Vector3.zero;
[SerializeField, System.Obsolete("blendNormalDistancePositive is deprecated, use influenceVolume parameters instead")]
Vector3 blendNormalDistancePositive = Vector3.zero;
[SerializeField, System.Obsolete("blendNormalDistanceNegative is deprecated, use influenceVolume parameters instead")]
Vector3 blendNormalDistanceNegative = Vector3.zero;
[SerializeField, System.Obsolete("boxSideFadePositive is deprecated, use influenceVolume parameters instead")]
Vector3 boxSideFadePositive = Vector3.one;
[SerializeField, System.Obsolete("boxSideFadeNegative is deprecated, use influenceVolume parameters instead")]
Vector3 boxSideFadeNegative = Vector3.one;
public Vector3 boxBlendCenterOffset { get { return (blendDistanceNegative - blendDistancePositive) * 0.5f; } }
public Vector3 boxBlendSizeOffset { get { return -(blendDistancePositive + blendDistanceNegative); } }
public Vector3 boxBlendNormalCenterOffset { get { return (blendNormalDistanceNegative - blendNormalDistancePositive) * 0.5f; } }
public Vector3 boxBlendNormalSizeOffset { get { return -(blendNormalDistancePositive + blendNormalDistanceNegative); } }
public float sphereBlendRadiusOffset { get { return -blendDistancePositive.x; } }
public float sphereBlendNormalRadiusOffset { get { return -blendNormalDistancePositive.x; } }
public void OnBeforeSerialize()
{

}
else
{
if (m_Version < 3)
{
MigrateToUseInfluanceVolume();
}
m_Version = currentVersion;
}
}

{
if (needMigrateToHDProbeChild)
MigrateToHDProbeChild();
MigrateToUseInfluanceVolume();
}
void MigrateToHDProbeChild()

m_Version = 2;
OnAfterDeserialize(); //continue migrating if needed
}
void MigrateToUseInfluanceVolume()
{
#pragma warning disable CS0618 // Type or member is obsolete
influenceVolume.shape = influenceShape;
influenceVolume.sphereRadius = influenceSphereRadius;
influenceVolume.boxBlendDistancePositive = blendDistancePositive;
influenceVolume.boxBlendDistanceNegative = blendDistanceNegative;
influenceVolume.boxBlendNormalDistancePositive = blendNormalDistancePositive;
influenceVolume.boxBlendNormalDistanceNegative = blendNormalDistanceNegative;
influenceVolume.boxSideFadePositive = boxSideFadePositive;
influenceVolume.boxSideFadeNegative = boxSideFadeNegative;
#pragma warning restore CS0618 // Type or member is obsolete
//Note: former editor parameters will be recreated as if non existent.
//User will lose parameters corresponding to non used mode between simplified and advanced
}
public override ReflectionProbeMode mode

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


[SerializeField, FormerlySerializedAs("proxyVolumeComponent"), FormerlySerializedAs("m_ProxyVolumeReference")]
ReflectionProxyVolumeComponent m_ProxyVolume = null;
[SerializeField]
InfluenceVolume m_InfluenceVolume = new InfluenceVolume();
[SerializeField, FormerlySerializedAsAttribute("dimmer"), FormerlySerializedAsAttribute("m_Dimmer"), FormerlySerializedAsAttribute("multiplier")]
float m_Multiplier = 1.0f;
[SerializeField, FormerlySerializedAsAttribute("weight")]

/// <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; } }
/// <summary>Multiplier factor of reflection (non PBR parameter).</summary>
public float multiplier { get { return m_Multiplier; } }

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


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

[HideInInspector]
const int currentVersion = 1;
const int currentVersion = 2;
[SerializeField, FormerlySerializedAs("version")]
int m_Version;

Static,
MirrorCamera
MirrorCamera,
InfluenceVolume m_InfluenceVolume = new InfluenceVolume();
[SerializeField]
Vector3 m_CaptureLocalPosition;
[SerializeField]
Texture m_CustomTexture;

public bool overrideFieldOfView { get { return m_OverrideFieldOfView; } }
public float fieldOfViewOverride { get { return m_FieldOfViewOverride; } }
public InfluenceVolume influenceVolume { get { return m_InfluenceVolume; } }
public BoundingSphere boundingSphere { get { return m_InfluenceVolume.GetBoundingSphereAt(transform); } }
public BoundingSphere boundingSphere { get { return influenceVolume.GetBoundingSphereAt(transform); } }
public Texture texture
{

}
}
}
public Bounds bounds { get { return m_InfluenceVolume.GetBoundsAt(transform); } }
public Bounds bounds { get { return influenceVolume.GetBoundsAt(transform); } }
public Vector3 captureLocalPosition { get { return m_CaptureLocalPosition; } set { m_CaptureLocalPosition = value; } }
public Matrix4x4 influenceToWorld
{

: influenceToWorld;
}
}
public ShapeType proxyShape
public Shape proxyShape
: influenceVolume.shapeType;
: influenceVolume.shape;
}
}
public Vector3 proxyExtents

return proxyVolume != null
? proxyVolume.proxyVolume.extents
: influenceVolume.boxBaseSize;
: influenceVolume.boxSize;
}
}
public bool infiniteProjection { get { return proxyVolume != null && proxyVolume.proxyVolume.infiniteProjection; } }

if (m_Version != currentVersion)
{
// Add here data migration code
if(m_Version < 2)
{
influenceVolume.MigrateOffsetSphere();
}
m_Version = currentVersion;
}
}

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


throw new ArgumentException();
}
protected static EnvShapeType ConvertShape(ShapeType shape)
protected static EnvShapeType ConvertShape(Shape shape)
case ShapeType.Box:
case Shape.Box:
case ShapeType.Sphere:
case Shape.Sphere:
return EnvShapeType.Sphere;
}
}

if (add == null)
{
add = HDUtils.s_DefaultHDAdditionalReflectionData;
add.blendDistancePositive = Vector3.one * probe.blendDistance;
add.blendDistanceNegative = add.blendDistancePositive;
add.influenceShape = ShapeType.Box;
Vector3 distance = Vector3.one * probe.blendDistance;
add.influenceVolume.boxBlendDistancePositive = distance;
add.influenceVolume.boxBlendDistanceNegative = distance;
add.influenceVolume.shape= Shape.Box;
}
return add;
}

public override Texture texture { get { return probe.texture; } }
public override ReflectionProbeMode mode { get { return probe.probe.mode; } }
public override EnvShapeType influenceShapeType { get { return ConvertShape(additional.influenceShape); } }
public override EnvShapeType influenceShapeType { get { return ConvertShape(additional.influenceVolume.shape); } }
public override float weight { get { return additional.weight; } }
public override float multiplier { get { return additional.multiplier; } }
public override Vector3 influenceExtents

switch (additional.influenceShape)
switch (additional.influenceVolume.shape)
case ShapeType.Box:
case Shape.Box:
case ShapeType.Sphere:
return Vector3.one * additional.influenceSphereRadius;
case Shape.Sphere:
return Vector3.one * additional.influenceVolume.sphereRadius;
public override Vector3 blendNormalDistancePositive { get { return additional.blendNormalDistancePositive; } }
public override Vector3 blendNormalDistanceNegative { get { return additional.blendNormalDistanceNegative; } }
public override Vector3 blendDistancePositive { get { return additional.blendDistancePositive; } }
public override Vector3 blendDistanceNegative { get { return additional.blendDistanceNegative; } }
public override Vector3 boxSideFadePositive { get { return additional.boxSideFadePositive; } }
public override Vector3 boxSideFadeNegative { get { return additional.boxSideFadeNegative; } }
public override Vector3 blendNormalDistancePositive { get { return additional.influenceVolume.boxBlendNormalDistancePositive; } }
public override Vector3 blendNormalDistanceNegative { get { return additional.influenceVolume.boxBlendNormalDistanceNegative; } }
public override Vector3 blendDistancePositive { get { return additional.influenceVolume.boxBlendDistancePositive; } }
public override Vector3 blendDistanceNegative { get { return additional.influenceVolume.boxBlendDistanceNegative; } }
public override Vector3 boxSideFadePositive { get { return additional.influenceVolume.boxSideFadePositive; } }
public override Vector3 boxSideFadeNegative { get { return additional.influenceVolume.boxSideFadeNegative; } }
public override EnvShapeType proxyShapeType
{

public override Matrix4x4 influenceToWorld { get { return planarReflectionProbe.influenceToWorld; } }
public override Texture texture { get { return planarReflectionProbe.texture; } }
public override EnvShapeType influenceShapeType { get { return ConvertShape(planarReflectionProbe.influenceVolume.shapeType); } }
public override EnvShapeType influenceShapeType { get { return ConvertShape(planarReflectionProbe.influenceVolume.shape); } }
public override float weight { get { return planarReflectionProbe.weight; } }
public override float multiplier { get { return planarReflectionProbe.multiplier; } }
public override Vector3 influenceExtents

switch (planarReflectionProbe.influenceVolume.shapeType)
switch (planarReflectionProbe.influenceVolume.shape)
case ShapeType.Box:
return planarReflectionProbe.influenceVolume.boxBaseSize * 0.5f;
case ShapeType.Sphere:
return planarReflectionProbe.influenceVolume.sphereBaseRadius * Vector3.one;
case Shape.Box:
return planarReflectionProbe.influenceVolume.boxSize * 0.5f;
case Shape.Sphere:
return planarReflectionProbe.influenceVolume.sphereRadius * Vector3.one;
public override Vector3 blendNormalDistancePositive { get { return planarReflectionProbe.influenceVolume.boxInfluenceNormalPositiveFade; } }
public override Vector3 blendNormalDistanceNegative { get { return planarReflectionProbe.influenceVolume.boxInfluenceNormalNegativeFade; } }
public override Vector3 blendDistancePositive { get { return planarReflectionProbe.influenceVolume.boxInfluencePositiveFade; } }
public override Vector3 blendDistanceNegative { get { return planarReflectionProbe.influenceVolume.boxInfluenceNegativeFade; } }
public override Vector3 boxSideFadePositive { get { return planarReflectionProbe.influenceVolume.boxPositiveFaceFade; } }
public override Vector3 boxSideFadeNegative { get { return planarReflectionProbe.influenceVolume.boxNegativeFaceFade; } }
public override Vector3 blendNormalDistancePositive { get { return planarReflectionProbe.influenceVolume.boxBlendNormalDistancePositive; } }
public override Vector3 blendNormalDistanceNegative { get { return planarReflectionProbe.influenceVolume.boxBlendNormalDistanceNegative; } }
public override Vector3 blendDistancePositive { get { return planarReflectionProbe.influenceVolume.boxBlendDistancePositive; } }
public override Vector3 blendDistanceNegative { get { return planarReflectionProbe.influenceVolume.boxBlendDistanceNegative; } }
public override Vector3 boxSideFadePositive { get { return planarReflectionProbe.influenceVolume.boxSideFadePositive; } }
public override Vector3 boxSideFadeNegative { get { return planarReflectionProbe.influenceVolume.boxSideFadeNegative; } }
public override EnvShapeType proxyShapeType { get { return ConvertShape(planarReflectionProbe.proxyShape); } }
public override Vector3 proxyExtents { get { return planarReflectionProbe.proxyExtents; } }
public override bool infiniteProjection { get { return planarReflectionProbe.infiniteProjection; } }

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


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

[SerializeField]
ShapeType m_ShapeType = ShapeType.Box;
[SerializeField, FormerlySerializedAs("m_ShapeType")]
Shape m_Shape = Shape.Box;
[SerializeField, FormerlySerializedAs("m_BoxBaseOffset")]
Vector3 m_Offset;
[SerializeField, Obsolete("Kept only for compatibility. Use m_Offset instead")]
Vector3 m_SphereBaseOffset;
[SerializeField]
Vector3 m_BoxBaseOffset;
[SerializeField]
Vector3 m_BoxInfluencePositiveFade;
[SerializeField]
Vector3 m_BoxInfluenceNegativeFade;
[SerializeField]
Vector3 m_BoxInfluenceNormalPositiveFade;
[SerializeField]
Vector3 m_BoxInfluenceNormalNegativeFade;
[SerializeField]
Vector3 m_BoxPositiveFaceFade = Vector3.one;
[SerializeField]
Vector3 m_BoxNegativeFaceFade = Vector3.one;
[SerializeField, FormerlySerializedAs("m_BoxInfluencePositiveFade")]
Vector3 m_BoxPositiveFade;
[SerializeField, FormerlySerializedAs("m_BoxInfluenceNegativeFade")]
Vector3 m_BoxNegativeFade;
[SerializeField, FormerlySerializedAs("m_BoxInfluenceNormalPositiveFade")]
Vector3 m_BoxNormalPositiveFade;
[SerializeField, FormerlySerializedAs("m_BoxInfluenceNormalNegativeFade")]
Vector3 m_BoxNormalNegativeFade;
[SerializeField, FormerlySerializedAs("m_BoxPositiveFaceFade")]
Vector3 m_BoxFacePositiveFade = Vector3.one;
[SerializeField, FormerlySerializedAs("m_BoxNegativeFaceFade")]
Vector3 m_BoxFaceNegativeFade = Vector3.one;
//editor value that need to be saved for easy passing from simplified to advanced and vice et versa
// /!\ must not be used outside editor code

[SerializeField] private bool editorAdvancedModeEnabled;
// Sphere
[SerializeField]
float m_SphereBaseRadius = 1;
[SerializeField]
Vector3 m_SphereBaseOffset;
[SerializeField]
float m_SphereInfluenceFade;
[SerializeField]
float m_SphereInfluenceNormalFade;
[SerializeField, FormerlySerializedAs("m_SphereBaseRadius")]
float m_SphereRadius = 1;
[SerializeField, FormerlySerializedAs("m_SphereInfluenceFade")]
float m_SphereBlendDistance;
[SerializeField, FormerlySerializedAs("m_SphereInfluenceNormalFade")]
float m_SphereBlendNormalDistance;
public ShapeType shapeType { get { return m_ShapeType; } }
/// <summary>Shape of this InfluenceVolume.</summary>
public Shape shape { get { return m_Shape; } set { m_Shape = value; } }
public Vector3 boxBaseSize { get { return m_BoxBaseSize; } set { m_BoxBaseSize = value; } }
public Vector3 boxBaseOffset { get { return m_BoxBaseOffset; } set { m_BoxBaseOffset = value; } }
public Vector3 boxInfluencePositiveFade { get { return m_BoxInfluencePositiveFade; } set { m_BoxInfluencePositiveFade = value; } }
public Vector3 boxInfluenceNegativeFade { get { return m_BoxInfluenceNegativeFade; } set { m_BoxInfluenceNegativeFade = value; } }
public Vector3 boxInfluenceNormalPositiveFade { get { return m_BoxInfluenceNormalPositiveFade; } set { m_BoxInfluenceNormalPositiveFade = value; } }
public Vector3 boxInfluenceNormalNegativeFade { get { return m_BoxInfluenceNormalNegativeFade; } set { m_BoxInfluenceNormalNegativeFade = value; } }
public Vector3 boxPositiveFaceFade { get { return m_BoxPositiveFaceFade; } set { m_BoxPositiveFaceFade = value; } }
public Vector3 boxNegativeFaceFade { get { return m_BoxNegativeFaceFade; } set { m_BoxNegativeFaceFade = value; } }
/// <summary>Offset of this influence volume to the component handling him.</summary>
public Vector3 offset { get { return m_Offset; } set { m_Offset = value; } }
public Vector3 boxSize { get { return m_BoxBaseSize; } set { m_BoxBaseSize = value; } }
public Vector3 boxBlendOffset { get { return (boxBlendDistanceNegative - boxBlendDistancePositive) * 0.5f; } }
public Vector3 boxBlendSize { get { return -(boxBlendDistancePositive + boxBlendDistanceNegative); } }
public Vector3 boxBlendDistancePositive { get { return m_BoxPositiveFade; } set { m_BoxPositiveFade = value; } }
public Vector3 boxBlendDistanceNegative { get { return m_BoxNegativeFade; } set { m_BoxNegativeFade = value; } }
public Vector3 boxInfluenceOffset { get { return (boxInfluenceNegativeFade - boxInfluencePositiveFade) * 0.5f; } }
public Vector3 boxInfluenceSizeOffset { get { return -(boxInfluencePositiveFade + boxInfluenceNegativeFade); } }
public Vector3 boxInfluenceNormalOffset { get { return (boxInfluenceNormalNegativeFade - boxInfluenceNormalPositiveFade) * 0.5f; } }
public Vector3 boxInfluenceNormalSizeOffset { get { return -(boxInfluenceNormalPositiveFade + boxInfluenceNormalNegativeFade); } }
public Vector3 boxBlendNormalOffset { get { return (boxBlendNormalDistanceNegative - boxBlendNormalDistancePositive) * 0.5f; } }
public Vector3 boxBlendNormalSize { get { return -(boxBlendNormalDistancePositive + boxBlendNormalDistanceNegative); } }
public Vector3 boxBlendNormalDistancePositive { get { return m_BoxNormalPositiveFade; } set { m_BoxNormalPositiveFade = value; } }
public Vector3 boxBlendNormalDistanceNegative { get { return m_BoxNormalNegativeFade; } set { m_BoxNormalNegativeFade = value; } }
public Vector3 boxSideFadePositive { get { return m_BoxFacePositiveFade; } set { m_BoxFacePositiveFade = value; } }
public Vector3 boxSideFadeNegative { get { return m_BoxFaceNegativeFade; } set { m_BoxFaceNegativeFade = value; } }
public float sphereBaseRadius { get { return m_SphereBaseRadius; } set { m_SphereBaseRadius = value; } }
public Vector3 sphereBaseOffset { get { return m_SphereBaseOffset; } set { m_SphereBaseOffset = value; } }
public float sphereInfluenceFade { get { return m_SphereInfluenceFade; } set { m_SphereInfluenceFade = value; } }
public float sphereInfluenceNormalFade { get { return m_SphereInfluenceNormalFade; } set { m_SphereInfluenceNormalFade = value; } }
public float sphereInfluenceRadiusOffset { get { return -sphereInfluenceFade; } }
public float sphereInfluenceNormalRadiusOffset { get { return -sphereInfluenceNormalFade; } }
public float sphereRadius { get { return m_SphereRadius; } set { m_SphereRadius = value; } }
public float sphereBlendDistance { get { return m_SphereBlendDistance; } set { m_SphereBlendDistance = value; } }
public float sphereBlendNormalDistance { get { return m_SphereBlendNormalDistance; } set { m_SphereBlendNormalDistance = value; } }
switch (shapeType)
switch (shape)
case ShapeType.Sphere:
return new BoundingSphere(transform.TransformPoint(sphereBaseOffset), sphereBaseRadius);
case ShapeType.Box:
case Shape.Sphere:
return new BoundingSphere(transform.TransformPoint(offset), sphereRadius);
case Shape.Box:
var position = transform.TransformPoint(boxBaseOffset);
var radius = Mathf.Max(boxBaseSize.x, Mathf.Max(boxBaseSize.y, boxBaseSize.z));
var position = transform.TransformPoint(offset);
var radius = Mathf.Max(boxSize.x, Mathf.Max(boxSize.y, boxSize.z));
return new BoundingSphere(position, radius);
}
}

{
switch (shapeType)
switch (shape)
case ShapeType.Sphere:
return new Bounds(transform.position, Vector3.one * sphereBaseRadius);
case ShapeType.Box:
case Shape.Sphere:
return new Bounds(transform.position, Vector3.one * sphereRadius);
case Shape.Box:
var position = transform.TransformPoint(boxBaseOffset);
var position = transform.TransformPoint(offset);
return new Bounds(position, boxBaseSize);
return new Bounds(position, boxSize);
}
}
}

switch (shapeType)
return transform.TransformPoint(offset);
}
internal void MigrateOffsetSphere()
{
if (shape == Shape.Sphere)
default:
case ShapeType.Sphere:
return transform.TransformPoint(sphereBaseOffset);
case ShapeType.Box:
return transform.TransformPoint(boxBaseOffset);
#pragma warning disable CS0618 // Type or member is obsolete
m_Offset = m_SphereBaseOffset;
#pragma warning restore CS0618 // Type or member is obsolete
}
}
}

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


public class ProxyVolume
{
[SerializeField]
ShapeType m_ShapeType = ShapeType.Box;
Shape m_ShapeType = Shape.Box;
// Box
[SerializeField]

bool m_SphereInfiniteProjection = false;
public ShapeType shapeType { get { return m_ShapeType; } }
public Shape shapeType { get { return m_ShapeType; } }
public Vector3 boxSize { get { return m_BoxSize; } set { m_BoxSize = value; } }
public Vector3 boxOffset { get { return m_BoxOffset; } set { m_BoxOffset = value; } }

{
switch (shapeType)
{
case ShapeType.Box: return m_BoxSize * 0.5f;
case ShapeType.Sphere: return Vector3.one * m_SphereRadius;
case Shape.Box: return m_BoxSize * 0.5f;
case Shape.Sphere: return Vector3.one * m_SphereRadius;
default: return Vector3.one;
}
}

{
get
{
return shapeType == ShapeType.Box && boxInfiniteProjection
|| shapeType == ShapeType.Sphere && sphereInfiniteProjection;
return shapeType == Shape.Box && boxInfiniteProjection
|| shapeType == Shape.Sphere && sphereInfiniteProjection;
}
}
}

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


namespace UnityEngine.Experimental.Rendering.HDPipeline
{
public enum ShapeType
public enum Shape
Sphere
Sphere,
}
}
正在加载...
取消
保存