public override void Draw(GameTime time) { if (levelLoaded) { base.Draw(time); level.RenderLevel(scene.Camera.VEye, World, scene.Camera.MView, scene.Camera.MProjection, time, GraphicsDevice, renderSkybox); } }
/// <summary> /// This is called when the game should draw itself. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Draw(GameTime gameTime) { graphics.GraphicsDevice.SetRenderTarget(0, buffer); GraphicsDevice.Clear(Color.Black); // render the levels, entity and any first-person player-related elements (ie. crosshair, weapon, etc.) if (level != null) { level.RenderLevel(player.position, player.view, player.projection, gameTime, graphics.GraphicsDevice); entitySystem.draw(player.view, player.projection); player.draw(spriteBatch); } // disable the render target for post processing graphics.GraphicsDevice.SetRenderTarget(0, null); // blur game screen if menu is open if (menu.active) { blur.Begin(); spriteBatch.Begin(SpriteBlendMode.None, SpriteSortMode.Immediate, SaveStateMode.SaveState); foreach (EffectTechnique t in blur.Techniques) { foreach (EffectPass p in t.Passes) { p.Begin(); spriteBatch.Draw(buffer.GetTexture(), Vector2.Zero, Color.White); p.End(); } } spriteBatch.End(); blur.End(); } // otherwise apply other post-processing effects else { post.Begin(); spriteBatch.Begin(SpriteBlendMode.None, SpriteSortMode.Immediate, SaveStateMode.SaveState); foreach (EffectTechnique t in post.Techniques) { foreach (EffectPass p in t.Passes) { p.Begin(); spriteBatch.Draw(buffer.GetTexture(), Vector2.Zero, Color.White); p.End(); } } spriteBatch.End(); post.End(); } screenManager.draw(spriteBatch, graphics.GraphicsDevice); base.Draw(gameTime); }
public override void Draw() { Game1.Instance.GraphicsDevice.DepthStencilState = DepthStencilState.Default; Game1.Instance.GraphicsDevice.RasterizerState = RasterizerState.CullNone; level.RenderLevel(camera.Position, camera.View, camera.Projection, gameTime, Game1.Instance.GraphicsDevice); }