Beispiel #1
0
    public void Setup(ScriptableRenderer renderer, ref ScriptableRenderContext context,
                      ref CullResults cullResults, ref RenderingData renderingData)
    {
        Init();

        renderer.Clear();

        renderer.SetupPerObjectLightIndices(ref cullResults, ref renderingData.lightData);
        RenderTextureDescriptor baseDescriptor   = ScriptableRenderer.CreateRTDesc(ref renderingData.cameraData);
        RenderTextureDescriptor shadowDescriptor = baseDescriptor;

        shadowDescriptor.dimension = TextureDimension.Tex2D;

        renderer.EnqueuePass(m_SetupForwardRenderingPass);

        RenderTargetHandle colorHandle = RenderTargetHandle.CameraTarget;
        RenderTargetHandle depthHandle = RenderTargetHandle.CameraTarget;

        var sampleCount = (SampleCount)renderingData.cameraData.msaaSamples;

        m_CreateLightweightRenderTexturesPass.Setup(baseDescriptor, colorHandle, depthHandle, sampleCount);
        renderer.EnqueuePass(m_CreateLightweightRenderTexturesPass);

        Camera camera          = renderingData.cameraData.camera;
        bool   dynamicBatching = renderingData.supportsDynamicBatching;
        RendererConfiguration rendererConfiguration = ScriptableRenderer.GetRendererConfiguration(renderingData.lightData.totalAdditionalLightsCount);

        m_SetupLightweightConstants.Setup(renderer.maxVisibleLocalLights, renderer.perObjectLightIndices);
        renderer.EnqueuePass(m_SetupLightweightConstants);

        m_RenderOpaqueForwardPass.Setup(baseDescriptor, colorHandle, depthHandle, ScriptableRenderer.GetCameraClearFlag(camera), camera.backgroundColor, rendererConfiguration, dynamicBatching);
        renderer.EnqueuePass(m_RenderOpaqueForwardPass);
    }
        public override void Execute(ScriptableRenderer renderer, ref ScriptableRenderContext context,
                                     ref CullResults cullResults,
                                     ref RenderingData renderingData)
        {
            RenderTextureDescriptor opaqueDesc = ScriptableRenderer.CreateRTDesc(ref renderingData.cameraData);

            var cmd = CommandBufferPool.Get("Capture Pass");

            cmd.GetTemporaryRT(m_Target.id, opaqueDesc);
            cmd.Blit(m_Source.Identifier(), m_Target.Identifier());
            context.ExecuteCommandBuffer(cmd);
            CommandBufferPool.Release(cmd);
        }