浏览代码

[PlanarReflection] Fixed culling

/main
Frédéric Vauchelles 7 年前
当前提交
4a5cb1e8
共有 4 个文件被更改,包括 37 次插入11 次删除
  1. 6
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/HDRenderPipeline.cs
  2. 26
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/ReflectionProbeCullResults.cs
  3. 10
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/ReflectionSystem.cs
  4. 6
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/ReflectionSystemInternal.cs

6
ScriptableRenderPipeline/HDRenderPipeline/HDRP/HDRenderPipeline.cs


if (m_FrameSettings.enableDBuffer)
DecalSystem.instance.BeginCull(camera);
ReflectionSystem.PrepareCull(camera, m_ReflectionProbeCullResults);
m_ReflectionProbeCullResults.Cull();
m_DbufferManager.vsibleDecalCount = 0;
if (m_FrameSettings.enableDBuffer)
{

ReflectionSystem.Cull(camera, m_ReflectionProbeCullResults);
var postProcessLayer = camera.GetComponent<PostProcessLayer>();
var hdCamera = HDCamera.Get(camera, postProcessLayer, m_FrameSettings);

26
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/ReflectionProbeCullResults.cs


int[] m_PlanarReflectionProbeIndices;
PlanarReflectionProbe[] m_VisiblePlanarReflectionProbes;
CullingGroup m_CullingGroup;
PlanarReflectionProbe[] m_Probes;
public int visiblePlanarReflectionProbeCount { get; private set; }
public PlanarReflectionProbe[] visiblePlanarReflectionProbes { get { return m_VisiblePlanarReflectionProbes; } }

visiblePlanarReflectionProbeCount = cullingGroup.QueryIndices(true, m_PlanarReflectionProbeIndices, 0);
for (var i = 0; i < visiblePlanarReflectionProbeCount; ++i)
m_VisiblePlanarReflectionProbes[i] = planarReflectionProbes[m_PlanarReflectionProbeIndices[i]];
}
public void PrepareCull(CullingGroup cullingGroup, PlanarReflectionProbe[] planarReflectionProbesArray)
{
Assert.IsNull(m_CullingGroup, "Culling was prepared but not used nor disposed");
Assert.IsNull(m_Probes, "Culling was prepared but not used nor disposed");
m_CullingGroup = cullingGroup;
m_Probes = planarReflectionProbesArray;
}
public void Cull()
{
Assert.IsNotNull(m_CullingGroup, "Culling was not prepared, please prepare cull before performing it.");
Assert.IsNotNull(m_Probes, "Culling was not prepared, please prepare cull before performing it.");
visiblePlanarReflectionProbeCount = m_CullingGroup.QueryIndices(true, m_PlanarReflectionProbeIndices, 0);
for (var i = 0; i < visiblePlanarReflectionProbeCount; ++i)
m_VisiblePlanarReflectionProbes[i] = m_Probes[m_PlanarReflectionProbeIndices[i]];
m_CullingGroup.Dispose();
m_CullingGroup = null;
m_Probes = null;
}
}
}

10
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/ReflectionSystem.cs


s_Instance.UnregisterProbe(planarProbe);
}
public static void Cull(Camera camera, ReflectionProbeCullResults results)
{
s_Instance.Cull(camera, results);
}
public static void RequestRealtimeRender(PlanarReflectionProbe probe)
{
s_Instance.RequestRealtimeRender(probe);

public static float GetCaptureCameraFOVFor(PlanarReflectionProbe probe)
{
return s_Instance.GetCaptureCameraFOVFor(probe);
}
public static void PrepareCull(Camera camera, ReflectionProbeCullResults results)
{
s_Instance.PrepareCull(camera, results);
}
}
}

6
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/ReflectionSystemInternal.cs


m_PlanarReflectionProbe_RealtimeUpdate.Remove(planarProbe);
}
public void Cull(Camera camera, ReflectionProbeCullResults results)
public void PrepareCull(Camera camera, ReflectionProbeCullResults results)
{
UpdateAllPlanarReflectionProbeBounds();

cullingGroup.SetBoundingSphereCount(m_PlanarReflectionProbeBounds.Count);
results.CullPlanarReflectionProbes(cullingGroup, m_PlanarReflectionProbesArray);
cullingGroup.Dispose();
results.PrepareCull(cullingGroup, m_PlanarReflectionProbesArray);
}
public void RenderAllRealtimeProbes()

正在加载...
取消
保存