public DoomSRPPipeline(DoomSRPAsset asset) { Shader.globalRenderPipeline = "DoomSRP"; renderer = new ScriptableRenderer(asset); lightLoop.Initilize(settings); doomSRPPipeline = this; }
public static void RenderSingleCamera(DoomSRPPipeline pipelineInstance, ScriptableRenderContext context, Camera camera, ref CullResults cullResults, IRendererSetup setup = null) { if (pipelineInstance == null) { Debug.LogError("Trying to render a camera with an invalid render pipeline instance."); return; } ScriptableCullingParameters cullingParameters; if (!CullResults.GetCullingParameters(camera, out cullingParameters)) { return; } CommandBuffer cmd = CommandBufferPool.Get(k_RenderCameraTag); using (new ProfilingSample(cmd, k_RenderCameraTag)) { CameraData cameraData; PipelineSettings settings = pipelineInstance.settings; ScriptableRenderer renderer = pipelineInstance.renderer; LightLoop lightloop = pipelineInstance.GetLightLoop(); InitializeCameraData(pipelineInstance.settings, camera, out cameraData); SetupPerCameraShaderConstants(cameraData); cullingParameters.shadowDistance = Mathf.Min(cameraData.maxShadowDistance, camera.farClipPlane); context.ExecuteCommandBuffer(cmd); cmd.Clear(); #if UNITY_EDITOR // Emit scene view UI if (cameraData.isSceneViewCamera) { ScriptableRenderContext.EmitWorldGeometryForSceneView(camera); } #endif CullResults.Cull(ref cullingParameters, context, ref cullResults); RenderingData renderingData; InitializeRenderingData(settings, ref cameraData, ref cullResults, ref lightloop, out renderingData); var setupToUse = setup; if (setupToUse == null) { setupToUse = defaultRendererSetup; } renderer.Clear(); setupToUse.Setup(renderer, ref renderingData); renderer.Execute(context, ref renderingData); } context.ExecuteCommandBuffer(cmd); CommandBufferPool.Release(cmd); context.Submit(); #if UNITY_EDITOR Handles.DrawGizmos(camera); #endif }