protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.CornflowerBlue);

            //debug.Draw(mainCamera);

            foreach (SimpleModel go in gameObjects)
            {
                if (FrustumContains(go))
                {
                    go.Draw(mainCamera);
                }
            }

            spriteBatch.Begin();
            spriteBatch.DrawString(sfont, "Objects Drawn: " + objectsDrawn, new Vector2(10, 10), Color.White);
            spriteBatch.DrawString(sfont, "Occulsion Time: " + totalTime, new Vector2(10, 25), Color.White);

            spriteBatch.End();

            objectsDrawn = 0;
            GameUtilities.SetGraphicsDeviceFor3D();

            base.Draw(gameTime);
        }
예제 #2
0
        public override void Draw(CameraComponent camera)
        {
            effect.World = Matrix.CreateConstrainedBillboard(
                Manager.Owner.Location,
                camera.Manager.Owner.Location,
                Vector3.Down,
                null, null);

            effect.View       = camera.View;
            effect.Projection = camera.Projection;

            sbatch.Begin(
                SpriteSortMode.Deferred,
                BlendState.AlphaBlend, null, null, null, effect);

            sbatch.Draw(
                texture,
                Vector2.Zero,
                null,
                Color.White,
                0,
                origin,
                0.01f,
                SpriteEffects.None,
                0);

            sbatch.End();
            GameUtilities.SetGraphicsDeviceFor3D();

            base.Draw(camera);
        }
예제 #3
0
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.PeachPuff);

            DrawDepthAndNormal(mainCamera);

            foreach (SimpleModel go in gameObjects)
            {
                if (FrustumContains(go))
                {
                    go.Draw(mainCamera);
                }
            }



            spriteBatch.Begin();

            spriteBatch.Draw(normalTarget, new Rectangle(10, 10, 400, 200), Color.White);
            spriteBatch.Draw(depthTarget, new Rectangle(435, 10, 400, 200), Color.White);

            spriteBatch.DrawString(sfont, "Objects Drawn:" + gameObjects.Count, new Vector2(10, 10), Color.White);
            spriteBatch.DrawString(sfont, "Occlusion Time Drawn:" + totalTime, new Vector2(10, 40), Color.White);
            spriteBatch.End();
            objectsDrawn = 0;
            timer.Reset();
            totalTime = 0;
            GameUtilities.SetGraphicsDeviceFor3D();
            base.Draw(gameTime);
        }
예제 #4
0
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.DarkGray);

            DrawGameObjects();

            GameUtilities.SetGraphicsDeviceFor3D();

            base.Draw(gameTime);
        }
예제 #5
0
        /// <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)
        {
            GraphicsDevice.Clear(Color.Black); //Using black to illustrate colors better

            if (!FourKToggle)
            {
                GraphicsDevice.SetRenderTarget(null);
            }
            else
            {
                GraphicsDevice.SetRenderTarget(FourK_RT);

                //Below lines needed to avoid backfaces being rendered in front of object during spritebatch draw
                GraphicsDevice.DepthStencilState = DepthStencilState.Default;
                GraphicsDevice.BlendState        = BlendState.Opaque;
            }


            //Model Rendering
            foreach (CustomEffectModel model in gameObjects)
            {
                if (mainCamera.Frustum.Contains(model.AABB) != ContainmentType.Disjoint)
                {
                    model.Draw(mainCamera);
                }
            }

            debug.Draw(mainCamera);


            GraphicsDevice.SetRenderTarget(null);

            //4K spritebatch
            if (FourKToggle)
            {
                spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Opaque);
                spriteBatch.Draw(FourK_RT, GraphicsDevice.Viewport.Bounds, Color.White);
                spriteBatch.DrawString(debugFont, "Drawing @ 4K", new Vector2(10, 10), Color.White);
                spriteBatch.End();
            }

            GameUtilities.SetGraphicsDeviceFor3D();

            base.Draw(gameTime);
        }
예제 #6
0
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.CornflowerBlue);

            foreach (var gameObject in gameObjects)
            {
                if (FrustumContains((gameObject as SimpleModel).AABB))
                {
                    gameObject.Draw(mainCamera);
                }
            }

            debug.Draw(mainCamera);

            spriteBatch.Begin();
            spriteBatch.End();

            GameUtilities.SetGraphicsDeviceFor3D();

            base.Draw(gameTime);
        }
예제 #7
0
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.HotPink);

            debug.Draw(mainCamera);

            time.Reset();

            foreach (SimpleModel item in gameObjects)
            {
                if (FrustumContains(item))
                {
                    if (!IsOccluded(item))
                    {
                        item.Draw(mainCamera);
                        objectsDrawn++;
                    }
                }
            }
            spriteBatch.Begin();

            spriteBatch.DrawString(
                sfont,
                "Objects Drawn: " + objectsDrawn + " Occlusion Time: " + totalTime,
                new Vector2(10, 10),
                Color.White);

            spriteBatch.End();

            objectsDrawn = 0;
            totalTime    = 0;

            GameUtilities.SetGraphicsDeviceFor3D();

            base.Draw(gameTime);
        }
예제 #8
0
 public virtual void DrawUI()
 {
     GameUtilities.SetGraphicsDeviceFor3D();
 }