Exemple #1
0
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.DarkSlateGray);

            base.Draw(gameTime);

            // setup drawing context

            var animTime = (float)gameTime.TotalGameTime.TotalSeconds;

            var lookAt = new Vector3(0, 2, 0);
            var camPos = new Vector3((float)Math.Sin(animTime * 0.5f) * 2, 2, 12);
            var camera = Matrix.CreateWorld(camPos, lookAt - camPos, Vector3.UnitY);

            var ctx = new ModelDrawingContext(_Graphics.GraphicsDevice);

            ctx.SetCamera(camera);

            // draw all the instances.

            ctx.DrawSceneInstances
            (

                // environment lights and fog
                _LightsAndFog,

                // all model instances
                _Avocado, _HauntedHouse, _BrainStem, _CesiumMan1, _CesiumMan2, _CesiumMan3, _CesiumMan4, _Shark

            );
        }
Exemple #2
0
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.CornflowerBlue);

            var camPos = Vector3.Zero;

            var camX = Matrix.CreateWorld(Vector3.Zero, _ModelView1.WorldBounds.Center - camPos, Vector3.UnitY);

            var dc = new ModelDrawingContext(_Graphics.GraphicsDevice);

            dc.SetCamera(camX);

            dc.DrawModelInstance(_LightsAndFog, _ModelView1);

            base.Draw(gameTime);
        }
Exemple #3
0
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.CornflowerBlue);

            var camPos = Vector3.Zero;
            var mdlPos = new Vector3(0.5f, 0, 0);

            var camX = Matrix.CreateWorld(Vector3.Zero, mdlPos - camPos, Vector3.UnitY);
            var mdlX = Matrix.CreateRotationY(0.25f * (float)gameTime.TotalGameTime.TotalSeconds) * Matrix.CreateTranslation(mdlPos);

            var dc = new ModelDrawingContext(_Graphics.GraphicsDevice);

            dc.NearPlane = 0.1f; // we need to make near plane small because the object is very very close.
            dc.SetCamera(camX);
            dc.DrawMesh(_LightsAndFog, _MeshCollection[0], mdlX);

            base.Draw(gameTime);
        }