Exemplo n.º 1
0
        public static void display(GameWorld.World world, Player player, Character doNotDisplay)
        {
            DisplayParameters displayParameters = new DisplayParameters();

            if (player.wantsStockpilesDisplayed())
            {
                displayParameters.addParameter(DisplayParameter.drawStockpiles);
            }
            RasterizerState rs = new RasterizerState();

            rs.CullMode            = CullMode.None;
            device.RasterizerState = rs;
            device.BlendState      = BlendState.Opaque;

            setStatesForMainDraw(player);

            world.runPreDrawCalculations();


            RasterizerState rasterizerState = new RasterizerState();

            rasterizerState.FillMode = FillMode.Solid;
            rasterizerState.CullMode = CullMode.None;
            device.RasterizerState   = rasterizerState;

            device.Clear(ClearOptions.Target | ClearOptions.DepthBuffer, Color.DarkSlateBlue, 1.0f, 0);
            device.SetRenderTarget(renderTarget);


            device.BlendState        = BlendState.NonPremultiplied;
            device.DepthStencilState = new DepthStencilState()
            {
                DepthBufferEnable = true
            };

            display3DObjects(world, player, doNotDisplay, effect, displayParameters);



            effect.Parameters["xWorld"].SetValue(Matrix.Identity);



            mainRenderImage = (Texture2D)renderTarget;

            device.SetRenderTarget(null);


            device.Clear(ClearOptions.Target | ClearOptions.DepthBuffer, Color.DarkSlateBlue, 1.0f, 0);

            spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Opaque,
                              SamplerState.PointClamp, DepthStencilState.Default,
                              RasterizerState.CullNone);
            spriteBatch.Draw(mainRenderImage, new Vector2(0, 0), Color.White);

            spriteBatch.End();

            WorldMarkupHandler.resetWorldMarkup();
        }