浏览代码

Fix legacy box resizing

/main
RSlysz 6 年前
当前提交
826ccf9a
共有 2 个文件被更改,包括 40 次插入4 次删除
  1. 14
      com.unity.render-pipelines.high-definition/HDRP/Lighting/Reflection/HDAdditionalReflectionData.cs
  2. 30
      com.unity.render-pipelines.high-definition/HDRP/Lighting/Reflection/Volumes/InfluenceVolume.cs

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


namespace UnityEngine.Experimental.Rendering
{
[RequireComponent(typeof(ReflectionProbe))]
[ExecuteInEditMode]
public class HDAdditionalReflectionData : HDProbe, ISerializationCallbackReceiver
{
const int currentVersion = 3;

}
}
private void OnEnable()
void OnEnable()
influenceVolume.OnSizeChanged += UpdateLegacySize;
}
void OnDisable()
{
influenceVolume.OnSizeChanged -= UpdateLegacySize;
}
void UpdateLegacySize(Vector3 newSize, Vector3 newCenter)
{
legacyProbe.size = newSize;
legacyProbe.center = newCenter;
}
void MigrateToHDProbeChild()

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


[Serializable]
public class InfluenceVolume
{
internal event Action<Vector3, Vector3> OnSizeChanged;
[SerializeField, FormerlySerializedAs("m_ShapeType")]
Shape m_Shape = Shape.Box;
[SerializeField, FormerlySerializedAs("m_BoxBaseOffset")]

// Box
[SerializeField, FormerlySerializedAs("m_BoxBaseSize")]
Vector3 m_BoxSize = Vector3.one;
Vector3 m_BoxSize = Vector3.one * 10;
[SerializeField, FormerlySerializedAs("m_BoxInfluencePositiveFade")]
Vector3 m_BoxBlendDistancePositive;
[SerializeField, FormerlySerializedAs("m_BoxInfluenceNegativeFade")]

public Vector3 offset { get { return m_Offset; } set { m_Offset = value; } }
/// <summary>Size of the InfluenceVolume in Box Mode.</summary>
public Vector3 boxSize { get { return m_BoxSize; } set { m_BoxSize = value; } }
public Vector3 boxSize
{
get { return m_BoxSize; }
set
{
m_BoxSize = value;
if (OnSizeChanged != null)
{
OnSizeChanged.Invoke(m_BoxSize, offset);
}
}
}
/// <summary>Offset of sub volume defining fading.</summary>
public Vector3 boxBlendOffset { get { return (boxBlendDistanceNegative - boxBlendDistancePositive) * 0.5f; } }

/// <summary>Radius of the InfluenceVolume in Sphere Mode.</summary>
public float sphereRadius { get { return m_SphereRadius; } set { m_SphereRadius = value; } }
public float sphereRadius
{
get { return m_SphereRadius; }
set
{
m_SphereRadius = value;
if (OnSizeChanged != null)
{
OnSizeChanged.Invoke(Vector3.one * m_SphereRadius, offset);
}
}
}
/// <summary>
/// Offset of the fade sub volume from InfluenceVolume hull.
/// Value between 0 (on InfluenceVolume hull) and sphereRadius (fade sub volume reduced to a point).

正在加载...
取消
保存