Beispiel #1
0
        public static void SetPPXTarget(RenderTarget2D color, RenderTarget2D depth, bool clear, Color clearColor)
        {
            if (color == null && depth == null && Backbuffer != null)
            {
                color = Backbuffer;
            }
            ActiveColor = color;
            if (color == Backbuffer && depth == null && BackbufferDepth != null)
            {
                depth = BackbufferDepth;
            }
            ActiveDepth = depth;

            if (color != null && depth != null)
            {
                depth.InheritDepthStencil(color);
            }
            var gd = GD;

            gd.SetRenderTarget(color); //can be null
            if (clear)
            {
                StencilValue = 1;

                gd.Clear(clearColor);// FSO.Common.Rendering.Framework.GameScreen.ClearColor);
                if (depth != null)
                {
                    gd.SetRenderTarget(depth);
                    gd.Clear(Color.White);
                }
            }
            if (FSOEnvironment.UseMRT)
            {
                if (depth != null)
                {
                    gd.SetRenderTargets(color, depth);
                }
            }
        }