浏览代码

[ReflectionProbeEditor] Use handle with fixed blend distance

/feature-ReflectionProbeFit
Frédéric Vauchelles 7 年前
当前提交
58a48687
共有 1 个文件被更改,包括 13 次插入5 次删除
  1. 18
      ScriptableRenderPipeline/HDRenderPipeline/Editor/Lighting/HDReflectionProbeEditor.Handles.cs

18
ScriptableRenderPipeline/HDRenderPipeline/Editor/Lighting/HDReflectionProbeEditor.Handles.cs


EditorGUI.BeginChangeCheck();
s.boxInfluenceBoundsHandle.DrawHandle();
var influenceChanged = EditorGUI.EndChangeCheck();
EditorGUI.BeginChangeCheck();
if (EditorGUI.EndChangeCheck())
if (influenceChanged || EditorGUI.EndChangeCheck())
{
Undo.RecordObject(p, "Modified Reflection Probe AABB");
var center = s.boxInfluenceBoundsHandle.center;

var blendDistance = ((influenceSize.x - blendSize.x) * 0.5f + (influenceSize.y - blendSize.y) * 0.5f + (influenceSize.z - blendSize.z) * 0.5f) / 3;
var blendDistance = influenceChanged
? p.blendDistance
: ((influenceSize.x - blendSize.x) * 0.5f + (influenceSize.y - blendSize.y) * 0.5f + (influenceSize.z - blendSize.z) * 0.5f) / 3;
p.center = center;
p.size = influenceSize;
p.blendDistance = Mathf.Max(blendDistance, 0);

EditorGUI.BeginChangeCheck();
s.influenceSphereHandle.DrawHandle();
var influenceChanged = EditorGUI.EndChangeCheck();
EditorGUI.BeginChangeCheck();
if (EditorGUI.EndChangeCheck())
if (influenceChanged || EditorGUI.EndChangeCheck())
var influenceRadius = Mathf.Max(s.influenceSphereHandle.radius, s.sphereBlendHandle.radius);
var blendRadius = Mathf.Min(s.influenceSphereHandle.radius, s.sphereBlendHandle.radius);
var influenceRadius =s.influenceSphereHandle.radius;
var blendRadius = influenceChanged
? influenceRadius - p.blendDistance * 2
: s.sphereBlendHandle.radius;
var radius = Vector3.one * influenceRadius;

正在加载...
取消
保存