protected override void Draw(GameTime gameTime)
        {
            device.Clear(ClearOptions.Target | ClearOptions.DepthBuffer, Color.CornflowerBlue, 1, 0);

            //draw model
            Matrix worldMatrix = Matrix.CreateScale(0.003f) * Matrix.CreateTranslation(0, 0, 0);

            myModel.CopyAbsoluteBoneTransformsTo(modelTransforms);
            foreach (ModelMesh mesh in myModel.Meshes)
            {
                foreach (BasicEffect effect in mesh.Effects)
                {
                    effect.EnableDefaultLighting();
                    effect.World      = modelTransforms[mesh.ParentBone.Index] * worldMatrix;
                    effect.View       = fpsCam.ViewMatrix;
                    effect.Projection = fpsCam.ProjectionMatrix;
                }
                mesh.Draw();
            }

            //draw coordcross
            cCross.Draw(fpsCam.ViewMatrix, fpsCam.ProjectionMatrix);

            base.Draw(gameTime);

            List <string> ppEffectsList = new List <string>();

            ppEffectsList.Add("HorBlur");
            ppEffectsList.Add("VerBlurAndGlow");

            postProcessor.Parameters["xBlurSize"].SetValue(0.5f);
            postProcessor.PostProcess(ppEffectsList);
        }
Esempio n. 2
0
        protected override void Draw(GameTime gameTime)
        {
            device.Clear(ClearOptions.Target | ClearOptions.DepthBuffer, Color.Black, 1, 0);

            if (menusRunning)
            {
                spriteBatch.Begin(SpriteBlendMode.AlphaBlend, SpriteSortMode.BackToFront, SaveStateMode.None);
                foreach (MenuWindow currentMenu in menuList)
                {
                    currentMenu.Draw(spriteBatch);
                }
                spriteBatch.End();
                Window.Title = "Menu running ...";
            }
            else
            {
                device.Clear(ClearOptions.Target | ClearOptions.DepthBuffer, Color.Red, 1, 0);
                Window.Title = "Game running ...";
            }

            List <string> ppEffectsList = new List <string>();

            ppEffectsList.Add("HorBlur");
            ppEffectsList.Add("VerBlur");
            float blurRadius = (float)Math.Cos(gameTime.TotalGameTime.TotalMilliseconds / 1000.0f);

            if (blurRadius < 0)
            {
                blurRadius = 0;
            }
            postProcessor.Parameters["xBlurSize"].SetValue(blurRadius / 5.0f);
            postProcessor.PostProcess(ppEffectsList);

            base.Draw(gameTime);
        }