浏览代码

Merge pull request #1404 from Unity-Technologies/fix-camera-nested-code

Fix LWRP camera nested code
/main
GitHub 7 年前
当前提交
fdc0cd77
共有 1 个文件被更改,包括 26 次插入14 次删除
  1. 40
      com.unity.render-pipelines.lightweight/LWRP/LightweightPipeline.cs

40
com.unity.render-pipelines.lightweight/LWRP/LightweightPipeline.cs


CommandBuffer cmd = CommandBufferPool.Get(renderCameraTag);
using (new ProfilingSample(cmd, renderCameraTag))
{
m_IsCameraRendering = true;
CameraData cameraData;
InitializeCameraData(camera, out cameraData);
SetupPerCameraShaderConstants(cameraData);

context.ExecuteCommandBuffer(cmd);
cmd.Clear();
try
{
m_IsCameraRendering = true;
// Emit scene view UI
if (cameraData.isSceneViewCamera)
ScriptableRenderContext.EmitWorldGeometryForSceneView(camera);
// Emit scene view UI
if (cameraData.isSceneViewCamera)
ScriptableRenderContext.EmitWorldGeometryForSceneView(camera);
CullResults.Cull(ref cullingParameters, context, ref m_CullResults);
List<VisibleLight> visibleLights = m_CullResults.visibleLights;
CullResults.Cull(ref cullingParameters, context, ref m_CullResults);
List<VisibleLight> visibleLights = m_CullResults.visibleLights;
RenderingData renderingData;
InitializeRenderingData(ref cameraData, visibleLights, m_Renderer.maxSupportedLocalLightsPerPass, m_Renderer.maxSupportedVertexLights, out renderingData);
m_Renderer.Setup(ref context, ref m_CullResults, ref renderingData);
m_Renderer.Execute(ref context, ref m_CullResults, ref renderingData);
m_IsCameraRendering = false;
RenderingData renderingData;
InitializeRenderingData(ref cameraData, visibleLights,
m_Renderer.maxSupportedLocalLightsPerPass, m_Renderer.maxSupportedVertexLights,
out renderingData);
m_Renderer.Setup(ref context, ref m_CullResults, ref renderingData);
m_Renderer.Execute(ref context, ref m_CullResults, ref renderingData);
}
catch (Exception)
{
CommandBufferPool.Release(cmd);
throw;
}
finally
{
m_IsCameraRendering = false;
}
}
context.ExecuteCommandBuffer(cmd);
CommandBufferPool.Release(cmd);

{
for (int i = 0; i < visibleLights.Count; ++i)
{
bool castShadows = visibleLights[i].light.shadows != LightShadows.None;
Light light = visibleLights[i].light;
bool castShadows = light != null && light.shadows != LightShadows.None;
if (visibleLights[i].lightType == LightType.Directional)
{
hasDirectionalShadowCastingLight |= castShadows;

正在加载...
取消
保存