Exemplo n.º 1
0
        /// <summary>
        ///     Se llama cada vez que hay que refrescar la pantalla.
        ///     Escribir aquí todo el código referido al renderizado.
        /// </summary>
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.SetRenderTarget(RenderTarget);
            GraphicsDevice.Clear(Color.CornflowerBlue);

            SphereModel.Draw(LavaSphereWorld, Camera.View, Camera.Projection, LavaTexture);
            SphereModel.Draw(WaterSphereWorld, Camera.View, Camera.Projection, WaterTexture);
            SphereModel.Draw(RockSphereWorld, Camera.View, Camera.Projection, RockTexture);
            FloorQuad.Draw(FloorWorld, Camera.View, Camera.Projection, FloorTexture);

            DrawRobot();

            if (LightingEnabled)
            {
                LightCube.Draw(Matrix.CreateTranslation(LightOnePosition), Camera.View, Camera.Projection, Color.Red);
                LightCube.Draw(Matrix.CreateTranslation(LightTwoPosition), Camera.View, Camera.Projection, Color.Blue);
            }

            GraphicsDevice.SetRenderTarget(null);
            GraphicsDevice.Clear(Color.Black);

            Effect.CurrentTechnique = Effect.Techniques["PostProcessing"];
            Effect.Parameters["ModelTexture"].SetValue(RenderTarget);
            FullScreenQuad.Draw(Effect);



            base.Draw(gameTime);
        }
Exemplo n.º 2
0
        /// <summary>
        ///     Libero los recursos que se cargaron en el juego.
        /// </summary>
        protected override void UnloadContent()
        {
            // Libero los recursos.
            Content.Unload();

            FloorQuad.Dispose();
            SphereModel.Dispose();
            FullScreenQuad.Dispose();

            if (LightingEnabled)
            {
                LightCube.Dispose();
            }
            base.UnloadContent();
        }