浏览代码

fix offset application of reflection probe when rotating the transform

/main
RSlysz 6 年前
当前提交
121b22df
共有 2 个文件被更改,包括 11 次插入7 次删除
  1. 11
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/SerializedHDReflectionProbe.cs
  2. 7
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/Volume/InfluenceVolumeUI.Drawers.cs

11
com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/SerializedHDReflectionProbe.cs


SerializedProperty legacyBlendDistance;
SerializedProperty legacySize;
//SerializedProperty legacyOffset;
SerializedProperty legacyOffset;
SerializedProperty legacyMode;
internal new HDAdditionalReflectionData target { get { return serializedObject.targetObject as HDAdditionalReflectionData; } }

renderDynamicObjects = legacyProbe.FindProperty("m_RenderDynamicObjects");
timeSlicingMode = legacyProbe.FindProperty("m_TimeSlicingMode");
legacySize = legacyProbe.FindProperty("m_BoxSize");
//legacyOffset = legacyProbe.FindProperty("m_BoxOffset");
legacyOffset = legacyProbe.FindProperty("m_BoxOffset");
resolution = legacyProbe.FindProperty("m_Resolution");
shadowDistance = legacyProbe.FindProperty("m_ShadowDistance");
cullingMask = legacyProbe.FindProperty("m_CullingMask");

{
serializedLegacyObject.Update();
base.Update();
//check if the transform have been rotated
if (legacyOffset.vector3Value != ((Component)serializedLegacyObject.targetObject).transform.rotation * influenceVolume.offset.vector3Value)
{
//call the offset setter as it will update legacy reflection probe
((HDAdditionalReflectionData)serializedObject.targetObject).influenceVolume.offset = influenceVolume.offset.vector3Value;
}
// Set the legacy blend distance to 0 so the legacy culling system use the probe extent
legacyBlendDistance.floatValue = 0;

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


static void Drawer_Offset(InfluenceVolumeUI s, SerializedInfluenceVolume d, Editor o)
{
HDProbeEditor editor = (HDProbeEditor)o;
InfluenceVolume influenceVolume = editor.GetTarget(editor.target).influenceVolume;
HDProbeEditor editor = (HDProbeEditor)o;
InfluenceVolume influenceVolume = editor.GetTarget(editor.target).influenceVolume;
d.Apply();
HDProbeUI.Drawer_ToolBarButton(HDProbeUI.ToolBar.CapturePosition, o, GUILayout.Width(28f), GUILayout.MinHeight(22f));
EditorGUILayout.EndHorizontal();
}
正在加载...
取消
保存