浏览代码

Add code to prevent nested camera rendering.

/main
Felipe Lira 7 年前
当前提交
506d7954
共有 1 个文件被更改,包括 17 次插入4 次删除
  1. 21
      ScriptableRenderPipeline/LightweightPipeline/LWRP/LightweightPipeline.cs

21
ScriptableRenderPipeline/LightweightPipeline/LWRP/LightweightPipeline.cs


CullResults m_CullResults;
List<int> m_LocalLightIndices = new List<int>();
bool m_IsCameraRendering;
public LightweightPipeline(LightweightPipelineAsset asset)
{
pipelineAsset = asset;

QualitySettings.antiAliasing = pipelineAsset.MsaaSampleCount;
Shader.globalRenderPipeline = "LightweightPipeline";
m_IsCameraRendering = false;
}
public override void Dispose()

public override void Render(ScriptableRenderContext context, Camera[] cameras)
{
if (m_IsCameraRendering)
{
Debug.LogWarning("Nested camera rendering is forbidden. If you are calling camera.Render inside OnWillRenderObject callback, use BeginCameraRender callback instead.");
return;
}
base.Render(context, cameras);
BeginFrameRendering(cameras);

// Sort cameras array by camera depth
Array.Sort(cameras, m_CameraComparer);
BeginCameraRendering(camera);
m_IsCameraRendering = true;
BeginCameraRendering(camera);
ScriptableCullingParameters cullingParameters;
if (!CullResults.GetCullingParameters(camera, cameraData.isStereoEnabled, out cullingParameters))
continue;

m_Renderer.Setup(ref context, ref m_CullResults, ref renderingData);
m_Renderer.Execute(ref context, ref m_CullResults, ref renderingData);
context.Submit();
m_IsCameraRendering = false;
}
void InitializeCameraData(Camera camera, out CameraData cameraData)

正在加载...
取消
保存