浏览代码

[ReflectionProbeEditor] Rebake realtime probe when moving a probe

/feature-ReflectionProbeFit
Frédéric Vauchelles 7 年前
当前提交
55be62a4
共有 3 个文件被更改,包括 36 次插入1 次删除
  1. 3
      ScriptableRenderPipeline/HDRenderPipeline/Editor/Lighting/HDCubemapInspector.cs
  2. 32
      ScriptableRenderPipeline/HDRenderPipeline/Editor/Lighting/HDReflectionProbeEditor.Handles.cs
  3. 2
      ScriptableRenderPipeline/HDRenderPipeline/Editor/Lighting/HDReflectionProbeEditor.cs

3
ScriptableRenderPipeline/HDRenderPipeline/Editor/Lighting/HDCubemapInspector.cs


{
hideFlags = HideFlags.HideAndDontSave
};
InitIcons();
}
void OnEnable()

if (s_MipMapLow == null)
InitIcons();
m_ReflectiveMaterial.SetTexture("_Cubemap", target as Texture);
}

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


using UnityEditorInternal;
using UnityEngine;
using UnityEngine.Experimental.Rendering;
using UnityEngine.Rendering;
namespace UnityEditor.Experimental.Rendering
{

var s = m_UIState;
var p = m_SerializedReflectionProbe;
var o = this;
BakeRealtimeProbeIfPositionChanged(s, p, o);
if (!s.sceneViewEditing)
return;

if (EditorGUI.EndChangeCheck())
Repaint();
}
void BakeRealtimeProbeIfPositionChanged(UIState s, SerializedReflectionProbe sp, Editor o)
{
if (Application.isPlaying
|| ((ReflectionProbeMode)sp.mode.intValue) != ReflectionProbeMode.Realtime)
{
m_PositionHash = 0;
return;
}
var hash = 0;
for (var i = 0; i < sp.so.targetObjects.Length; i++)
{
var p = (ReflectionProbe)sp.so.targetObjects[i];
var tr = p.GetComponent<Transform>();
hash ^= tr.position.GetHashCode();
}
if (hash != m_PositionHash)
{
m_PositionHash = hash;
for (var i = 0; i < sp.so.targetObjects.Length; i++)
{
var p = (ReflectionProbe)sp.so.targetObjects[i];
p.RenderProbe();
}
}
}
static void Handle_InfluenceBoxEditing(UIState s, SerializedReflectionProbe sp, Editor o)

2
ScriptableRenderPipeline/HDRenderPipeline/Editor/Lighting/HDReflectionProbeEditor.cs


SerializedObject m_AdditionalDataSerializedObject;
UIState m_UIState = new UIState();
int m_PositionHash = 0;
public bool sceneViewEditing
{
get { return IsReflectionProbeEditMode(EditMode.editMode) && EditMode.IsOwner(this); }

正在加载...
取消
保存