浏览代码

[PlanarReflection] fixed mirrored position

/main
Frédéric Vauchelles 7 年前
当前提交
220a51cd
共有 7 个文件被更改,包括 77 次插入43 次删除
  1. 3
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/BaseUI.cs
  2. 7
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/Lighting/PlanarReflectionProbeEditor.cs
  3. 47
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/Lighting/PlanarReflectionProbeUI.Handles.cs
  4. 2
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/Lighting/PlanarReflectionProbeUI.cs
  5. 54
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/Lighting/Volume/InfluenceVolumeUI.Gizmos.cs
  6. 3
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/Lighting/Volume/InfluenceVolumeUI.cs
  7. 4
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/PlanarReflectionProbe.cs

3
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/BaseUI.cs


for (var i = 0; i < m_AnimBools.Length; ++i)
{
m_AnimBools[i].valueChanged.RemoveAllListeners();
m_AnimBools[i].valueChanged.AddListener(repaint);
if (repaint != null)
m_AnimBools[i].valueChanged.AddListener(repaint);
}
Update();

7
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/Lighting/PlanarReflectionProbeEditor.cs


{
m_TypedTargets[i] = (PlanarReflectionProbe)targets[i];
m_UIHandleState[i] = new PlanarReflectionProbeUI();
m_UIHandleState[i].Reset(m_SerializedAsset, Repaint);
m_UIHandleState[i].Reset(m_SerializedAsset, null);
s_StateMap[m_TypedTargets[i]] = m_UIHandleState[i];
}

void OnSceneGUI()
{
for (var i = 0; i < m_TypedTargets.Length; i++)
{
m_UIHandleState[i].Update();
m_UIHandleState[i].influenceVolume.showInfluenceHandles = m_UIState.influenceVolume.isSectionExpandedShape.target;
m_UIHandleState[i].showCaptureHandles = m_UIState.isSectionExpandedCaptureSettings.target;
}
SceneViewOverlay_Window(_.GetContent("Planar Probe"), OnOverlayGUI, -100, target);
}

47
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/Lighting/PlanarReflectionProbeUI.Handles.cs


switch (EditMode.editMode)
{
case EditBaseShape:
InfluenceVolumeUI.DrawGizmos_EditBase(s.influenceVolume, d.influenceVolume, mat);
InfluenceVolumeUI.DrawGizmos(
s.influenceVolume,
d.influenceVolume,
mat,
InfluenceVolumeUI.HandleType.Base,
InfluenceVolumeUI.HandleType.All);
InfluenceVolumeUI.DrawGizmos_EditInfluence(s.influenceVolume, d.influenceVolume, mat);
InfluenceVolumeUI.DrawGizmos(
s.influenceVolume,
d.influenceVolume,
mat,
InfluenceVolumeUI.HandleType.Influence,
InfluenceVolumeUI.HandleType.All);
InfluenceVolumeUI.DrawGizmos_EditInfluenceNormal(s.influenceVolume, d.influenceVolume, mat);
InfluenceVolumeUI.DrawGizmos(
s.influenceVolume,
d.influenceVolume,
mat,
InfluenceVolumeUI.HandleType.InfluenceNormal,
InfluenceVolumeUI.HandleType.All);
InfluenceVolumeUI.DrawGizmos_EditNone(s.influenceVolume, d.influenceVolume, mat);
break;
{
var showedHandles = s.influenceVolume.showInfluenceHandles
? InfluenceVolumeUI.HandleType.All
: InfluenceVolumeUI.HandleType.Base;
InfluenceVolumeUI.DrawGizmos(
s.influenceVolume,
d.influenceVolume,
mat,
InfluenceVolumeUI.HandleType.None,
showedHandles);
break;
}
DrawGizmos_CaptureFrustrum(s, d);
if (s.showCaptureHandles
|| EditMode.editMode == EditCenter)
{
DrawGizmos_CaptureFrustrum(s, d);
if (d.mode == ReflectionProbeMode.Realtime
&& d.refreshMode == ReflectionProbeRefreshMode.EveryFrame)
DrawGizmos_CaptureMirror(s, d);
if (d.mode == ReflectionProbeMode.Realtime
&& d.refreshMode == ReflectionProbeRefreshMode.EveryFrame)
DrawGizmos_CaptureMirror(s, d);
}
}
static void DrawGizmos_CaptureMirror(PlanarReflectionProbeUI s, PlanarReflectionProbe d)

2
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/Lighting/PlanarReflectionProbeUI.cs


public AnimBool isSectionExpandedCaptureMirrorSettings { get { return m_AnimBools[k_ReflectionProbeModeModeCount + 2]; } }
public bool showCaptureHandles { get; set; }
public PlanarReflectionProbeUI()
: base(k_AnimBoolTotal)
{

54
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/Lighting/Volume/InfluenceVolumeUI.Gizmos.cs


using System;
using UnityEngine;
using UnityEngine.Experimental.Rendering.HDPipeline;

{
public static void DrawGizmos_EditBase(InfluenceVolumeUI s, InfluenceVolume d, Matrix4x4 matrix)
[Flags]
public enum HandleType
DrawGizmos_Generic(s, d, matrix, 0);
}
None = 0,
Base = 1,
Influence = 1 << 1,
InfluenceNormal = 1 << 2,
public static void DrawGizmos_EditInfluence(InfluenceVolumeUI s, InfluenceVolume d, Matrix4x4 matrix)
{
DrawGizmos_Generic(s, d, matrix, 1);
All = ~0
public static void DrawGizmos_EditInfluenceNormal(InfluenceVolumeUI s, InfluenceVolume d, Matrix4x4 matrix)
public static void DrawGizmos(InfluenceVolumeUI s, InfluenceVolume d, Matrix4x4 matrix, HandleType editedHandle, HandleType showedHandle)
DrawGizmos_Generic(s, d, matrix, 2);
}
if ((showedHandle & HandleType.Base) != 0)
DrawGizmos_BaseHandle(s, d, matrix, (editedHandle & HandleType.Base) != 0, k_GizmoThemeColorBase);
public static void DrawGizmos_EditNone(InfluenceVolumeUI s, InfluenceVolume d, Matrix4x4 matrix)
{
DrawGizmos_Generic(s, d, matrix, -1);
}
if ((showedHandle & HandleType.Influence) != 0)
DrawGizmos_FadeHandle(
s, d, matrix,
d.boxInfluenceOffset, d.boxInfluenceSizeOffset,
d.sphereInfluenceRadiusOffset,
(editedHandle & HandleType.Influence) != 0,
k_GizmoThemeColorInfluence);
static void DrawGizmos_Generic(InfluenceVolumeUI s, InfluenceVolume d, Matrix4x4 matrix, int solidIndex)
{
DrawGizmos_BaseHandle(s, d, matrix, solidIndex == 0, k_GizmoThemeColorBase);
DrawGizmos_FadeHandle(
s, d, matrix,
d.boxInfluenceOffset, d.boxInfluenceSizeOffset,
d.sphereInfluenceRadiusOffset,
solidIndex == 1,
k_GizmoThemeColorInfluence);
DrawGizmos_FadeHandle(
s, d, matrix,
d.boxInfluenceNormalOffset, d.boxInfluenceNormalSizeOffset,
d.sphereInfluenceNormalRadiusOffset,
solidIndex == 2,
k_GizmoThemeColorInfluenceNormal);
if ((showedHandle & HandleType.InfluenceNormal) != 0)
DrawGizmos_FadeHandle(
s, d, matrix,
d.boxInfluenceNormalOffset, d.boxInfluenceNormalSizeOffset,
d.sphereInfluenceNormalRadiusOffset,
(editedHandle & HandleType.InfluenceNormal) != 0,
k_GizmoThemeColorInfluenceNormal);
}
static void DrawGizmos_BaseHandle(

3
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/Lighting/Volume/InfluenceVolumeUI.cs


using System;
using System;
using UnityEditor.AnimatedValues;
using UnityEditor.IMGUI.Controls;
using UnityEngine;

public SphereBoundsHandle sphereInfluenceNormalHandle = new SphereBoundsHandle();
public AnimBool isSectionExpandedShape { get { return m_AnimBools[k_ShapeCount]; } }
public bool showInfluenceHandles { get; set; }
public InfluenceVolumeUI()
: base(k_ShapeCount + 1)

4
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/PlanarReflectionProbe.cs


&& capturePositionMode == CapturePositionMode.MirrorCamera)
{
var planeCenter = influenceToWorld.MultiplyPoint(m_CaptureMirrorPlaneLocalPosition);
var planeNormal = influenceToWorld.MultiplyVector(m_CaptureMirrorPlaneLocalNormal).normalized;
var planeNormal = influenceToWorld.MultiplyVector(m_CaptureMirrorPlaneLocalNormal.normalized);
var capturePosition = r - 2 * Vector3.Dot(planeNormal, r) * planeNormal;
var capturePosition = r - 2 * Vector3.Dot(planeNormal, r) * planeNormal + planeCenter;
var tr = transform;
var influencePosition = influenceVolume.GetWorldPosition(tr);

正在加载...
取消
保存