Ejemplo n.º 1
0
        public TextureUtil(CustomRenderPipelineAsset asset)
        {
            m_Asset = asset;

            m_CopyTextureSupport       = SystemInfo.copyTextureSupport;
            m_BlitQuad                 = LightweightUtils.CreateQuadMesh(false);
            m_BlitMaterial             = CoreUtils.CreateEngineMaterial(asset.BlitShader);
            m_CopyDepthMaterial        = CoreUtils.CreateEngineMaterial(asset.CopyDepthShader);
            m_PostProcessRenderContext = new PostProcessRenderContext();
        }
Ejemplo n.º 2
0
        void Blit(CommandBuffer cmd, FrameRenderingConfiguration renderingConfig, RenderTargetIdentifier sourceRT, RenderTargetIdentifier destRT, Camera camera, Material material = null)
        {
            cmd.SetGlobalTexture(m_BlitTexID, sourceRT);
            if (LightweightUtils.HasFlag(renderingConfig, FrameRenderingConfiguration.DefaultViewport))
            {
                cmd.Blit(sourceRT, destRT, material);
            }
            else
            {
                if (m_BlitQuad == null)
                {
                    m_BlitQuad = LightweightUtils.CreateQuadMesh(false);
                }

                SetRenderTarget(cmd, destRT, camera.backgroundColor);
                cmd.SetViewProjectionMatrices(Matrix4x4.identity, Matrix4x4.identity);
                cmd.SetViewport(camera.pixelRect);
                cmd.DrawMesh(m_BlitQuad, Matrix4x4.identity, material);
            }
        }