BoundingVolumeIsInView() public method

Checks if the bounding box is in the camera frustrum or not
public BoundingVolumeIsInView ( Microsoft.Xna.Framework.BoundingBox box ) : bool
box Microsoft.Xna.Framework.BoundingBox the Bounding box to check
return bool
Example #1
0
        // Called when the game should draw itself
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.Black);

            foreach (CModel model in models)
            {
                if (camera.BoundingVolumeIsInView(model.BoundingSphere))
                {
                    model.Draw(camera.View, camera.Projection, ((FreeCamera)camera).Position);
                }
            }

            base.Draw(gameTime);
        }
Example #2
0
        // Called when the game should draw itself
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.CornflowerBlue);

            foreach (CModel model in models)
            {
                if (camera.BoundingVolumeIsInView(model.BoundingSphere))
                {
                    model.Draw(camera.View, camera.Projection);
                }
            }

            base.Draw(gameTime);
        }
Example #3
0
        // Called when the game should draw itself
        protected override void Draw(GameTime gameTime)
        {
            water.PreDraw(camera, gameTime);

            GraphicsDevice.Clear(Color.CornflowerBlue);

            sky.Draw(camera.View, camera.Projection, ((FreeCamera)camera).Position);
            water.Draw(camera.View, camera.Projection, ((FreeCamera)camera).Position);

            foreach (CModel model in models)
                if (camera.BoundingVolumeIsInView(model.BoundingSphere))
                    model.Draw(camera.View, camera.Projection,
                        ((FreeCamera)camera).Position);

            base.Draw(gameTime);
        }
Example #4
0
        // Called when the game should draw itself
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.CornflowerBlue);

            foreach (CModel model in models)
            {
                if (camera.BoundingVolumeIsInView(model.BoundingSphere))
                {
                    model.Draw(camera.View, camera.Projection, ((FreeCamera)camera).Position);
                }
            }

            trees.Draw(camera.View, camera.Projection);
            clouds.Draw(camera.View, camera.Projection, ((FreeCamera)camera).Up, ((FreeCamera)camera).Right);

            base.Draw(gameTime);
        }
Example #5
0
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.Black);

            foreach (CModel model in models)
            {
                if (camera.BoundingVolumeIsInView(model.BoundingSphere))
                {
                    if (cameraChosen == 1)
                    {
                        model.Draw(camera.View, camera.Projection, ((ChaseCamera)camera).Position, BlinnModel);
                    }
                    else if (cameraChosen == 2 || cameraChosen == 3)
                    {
                        model.Draw(camera.View, camera.Projection, ((TargetCamera)camera).Position, BlinnModel);
                    }
                }
            }

            base.Draw(gameTime);
        }
Example #6
0
        // Called when the game should draw itself
        protected override void Draw(GameTime gameTime)
        {
            renderCapture.Begin();

            GraphicsDevice.Clear(Color.CornflowerBlue);

            foreach (CModel model in models)
            {
                if (camera.BoundingVolumeIsInView(model.BoundingSphere))
                {
                    model.Draw(camera.View, camera.Projection, ((FreeCamera)camera).Position);
                }
            }

            renderCapture.End();

            GraphicsDevice.Clear(Color.Black);

            postprocessor.Input = renderCapture.GetTexture();
            postprocessor.Draw();

            base.Draw(gameTime);
        }
Example #7
0
        // Called when the game should draw itself
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Microsoft.Xna.Framework.Color.Black);
            RasterizerState originalRasterizerState = graphics.GraphicsDevice.RasterizerState;
            RasterizerState rasterizerState         = new RasterizerState();

            rasterizerState.CullMode = CullMode.None;
            graphics.GraphicsDevice.RasterizerState = rasterizerState;

            skybox.Draw(camera.View, camera.Projection, ((TargetCamera)camera).Position);

            graphics.GraphicsDevice.RasterizerState = originalRasterizerState;

            rasterizerState          = new RasterizerState();
            rasterizerState.CullMode = CullMode.CullCounterClockwiseFace;
            //    rasterizerState.CullMode = CullMode.CullClockwiseFace;
            //    rasterizerState.CullMode = CullMode.None;
            graphics.GraphicsDevice.RasterizerState = rasterizerState;
            GraphicsDevice.Viewport         = leftViewport;
            ((TargetCamera)camera).Target   = new Microsoft.Xna.Framework.Vector3(tempbus_target_I.X, tempbus_target_I.Y, tempbus_target_I.Z);
            ((TargetCamera)camera).Position = new Microsoft.Xna.Framework.Vector3(tempbus_Position_I.X, tempbus_Position_I.Y, tempbus_Position_I.Z);
            camera.Update();
            skybox2.Draw(camera.Projection, ((TargetCamera)camera).Target, ((TargetCamera)camera).Position, -1.57f, graphics, GraphicsDevice);
            foreach (CModel model in models)
            {
                if (camera.BoundingVolumeIsInView(model.BoundingSphere))
                {
                    model.Draw(camera.View, camera.Projection, ((TargetCamera)camera).Position);
                }
            }



            foreach (BusModel model in Bus_models)
            {
                model.Draw(camera.View, camera.Projection, ((TargetCamera)camera).Position);
            }

            //render cenetr
            graphics.GraphicsDevice.RasterizerState = originalRasterizerState;
            GraphicsDevice.Viewport         = centerViewport;
            ((TargetCamera)camera).Target   = new Microsoft.Xna.Framework.Vector3(tempbus_target_C.X, tempbus_target_C.Y, tempbus_target_C.Z);
            ((TargetCamera)camera).Position = new Microsoft.Xna.Framework.Vector3(tempbus_Position_C.X, tempbus_Position_C.Y, tempbus_Position_C.Z);
            camera.Update();
            skybox2.Draw(camera.Projection, ((TargetCamera)camera).Target, ((TargetCamera)camera).Position, -0.0f, graphics, GraphicsDevice);
            foreach (CModel model in models)
            {
                if (camera.BoundingVolumeIsInView(model.BoundingSphere))
                {
                    model.Draw(camera.View, camera.Projection, ((TargetCamera)camera).Position);
                }
            }
            foreach (BusModel model in Bus_models)
            {
                model.Draw(camera.View, camera.Projection, ((TargetCamera)camera).Position);
            }



            //render Rigth
            graphics.GraphicsDevice.RasterizerState = originalRasterizerState;
            GraphicsDevice.Viewport         = rightViewport;
            ((TargetCamera)camera).Target   = new Microsoft.Xna.Framework.Vector3(tempbus_target_D.X, tempbus_target_D.Y, tempbus_target_D.Z);
            ((TargetCamera)camera).Position = new Microsoft.Xna.Framework.Vector3(tempbus_Position_D.X, tempbus_Position_D.Y, tempbus_Position_D.Z);
            camera.Update();
            skybox2.Draw(camera.Projection, ((TargetCamera)camera).Target, ((TargetCamera)camera).Position, +1.57f, graphics, GraphicsDevice);
            foreach (CModel model in models)
            {
                if (camera.BoundingVolumeIsInView(model.BoundingSphere))
                {
                    model.Draw(camera.View, camera.Projection, ((TargetCamera)camera).Position);
                }
            }
            foreach (BusModel model in Bus_models)
            {
                model.Draw(camera.View, camera.Projection, ((TargetCamera)camera).Position);
            }


            graphics.GraphicsDevice.RasterizerState = originalRasterizerState;

            base.Draw(gameTime);
        }