Exemplo n.º 1
0
    public void Setup(ScriptableRenderer renderer, ref RenderingData renderingData)
    {
        Init();

        Camera camera = renderingData.cameraData.camera;

        RenderTextureDescriptor baseDesc   = CoreUtils.CreateRenderTextureDescriptor(ref renderingData.cameraData);
        RenderTextureDescriptor shadowDesc = baseDesc;

        shadowDesc.dimension = TextureDimension.Tex2D;

        m_DirectionalShadowPass.Setup(DirectionalShadowmap, ref renderingData.shadowData);
        renderer.EnqueuePass(m_DirectionalShadowPass);

        if (renderingData.shadowData.supportSoftShadows)
        {
            if (renderingData.shadowData.shadowType == SoftShadowType.VSM)
            {
                m_BlurPass.Setup(DirectionalShadowmap, BluredDirectionalShadowmap);
                renderer.EnqueuePass(m_BlurPass);
            }
        }

        renderer.EnqueuePass(m_SetupForwardRenderingPass);

        m_DepthOnlyPass.Setup(baseDesc, DepthTexture, 1);
        renderer.EnqueuePass(m_DepthOnlyPass);

        m_ScreenSpaceShadowPass.Setup(baseDesc, ScreenSpaceShadowmap);
        renderer.EnqueuePass(m_ScreenSpaceShadowPass);

        //m_SetupLWDConstants.Setup();
        //renderer.EnqueuePass(m_SetupLWDConstants);

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

        RendererConfiguration rendererConfig = RendererConfiguration.None;

        m_RenderOpaqueForwardPass.Setup(baseDesc, colorHandle, depthHandle, ScriptableRenderer.GetClearFlag(camera), camera.backgroundColor, rendererConfig);
        renderer.EnqueuePass(m_RenderOpaqueForwardPass);

        //m_FinalBlitPass.Setup(baseDesc, colorHandle);
        //renderer.EnqueuePass(m_FinalBlitPass);
    }