浏览代码

Merge pull request #649 from Unity-Technologies/volume-improvements

Volume improvements
/asmdef
GitHub 7 年前
当前提交
07321d46
共有 3 个文件被更改,包括 38 次插入3 次删除
  1. 25
      ScriptableRenderPipeline/Core/Volume/Editor/VolumeEditor.cs
  2. 6
      ScriptableRenderPipeline/Core/Volume/VolumeManager.cs
  3. 10
      ScriptableRenderPipeline/Core/Volume/VolumeParameter.cs

25
ScriptableRenderPipeline/Core/Volume/Editor/VolumeEditor.cs


Undo.DestroyObjectImmediate(prevSettings);
}
void MoveComponent(int id, int offset)
{
// Move components
serializedObject.Update();
m_Components.MoveArrayElement(id, id + offset);
serializedObject.ApplyModifiedProperties();
// Move editors
var prev = m_Editors[id + offset];
m_Editors[id + offset] = m_Editors[id];
m_Editors[id] = prev;
}
if (id == 0)
menu.AddDisabledItem(CoreEditorUtils.GetContent("Move Up"));
else
menu.AddItem(CoreEditorUtils.GetContent("Move Up"), false, () => MoveComponent(id, -1));
if (id == m_Editors.Count - 1)
menu.AddDisabledItem(CoreEditorUtils.GetContent("Move Down"));
else
menu.AddItem(CoreEditorUtils.GetContent("Move Down"), false, () => MoveComponent(id, 1));
menu.AddSeparator(string.Empty);
menu.AddItem(CoreEditorUtils.GetContent("Reset"), false, () => ResetComponent(targetComponent.GetType(), id));
menu.AddItem(CoreEditorUtils.GetContent("Remove"), false, () => RemoveComponent(id));
menu.AddSeparator(string.Empty);

6
ScriptableRenderPipeline/Core/Volume/VolumeManager.cs


float blendDistSqr = volume.blendDistance * volume.blendDistance;
// Volume has no influence, ignore it
// Note: Volume doesn't do anything when `closestDistanceSqr = blendDistSqr` but
// we can't use a >= comparison as blendDistSqr could be set to 0 in which
// case volume would have total influence
// Note: Volume doesn't do anything when `closestDistanceSqr = blendDistSqr` but we
// can't use a >= comparison as blendDistSqr could be set to 0 in which case
// volume would have total influence
if (closestDistanceSqr > blendDistSqr)
continue;

10
ScriptableRenderPipeline/Core/Volume/VolumeParameter.cs


return string.Format("{0} ({1})", value, overrideState);
}
public static bool operator ==(VolumeParameter<T> lhs, T rhs)
{
return lhs.value.Equals(rhs);
}
public static bool operator !=(VolumeParameter<T> lhs, T rhs)
{
return !(lhs == rhs);
}
//
// Implicit conversion; assuming the following:
//

正在加载...
取消
保存