public void Draw(ArcBallCamera camera)
        {
            model.Root.Transform = Matrix.Identity *
                Matrix.CreateScale(0.005f) *
                Matrix.CreateRotationY(ShipRotation) *
                Matrix.CreateTranslation(Position);

               // model.Bones["turret_geo"].Transform =
               // Matrix.CreateRotationY(TurretRotation) * baseTurretTransform;

               // model.Bones["canon_geo"].Transform =
             //   Matrix.CreateRotationX(gunElevation) * baseGunTransform;

               // model.CopyAbsoluteBoneTransformsTo(boneTransforms);

            foreach (ModelMesh mesh in model.Meshes)
            {
                foreach (BasicEffect basicEffect in mesh.Effects)
                {
                   // basicEffect.World = boneTransforms[mesh.ParentBone.Index];
                    basicEffect.View = camera.View;
                    basicEffect.Projection = camera.Projection;

                    basicEffect.EnableDefaultLighting();
                }

                mesh.Draw();
            }
        }
        public void Draw(ArcBallCamera camera, BasicEffect effect)
        {
            effect.VertexColorEnabled = false;
            effect.TextureEnabled     = true;
            effect.Texture            = texture;
            effect.LightingEnabled    = false;

            Matrix center = Matrix.CreateTranslation(
                new Vector3(-0.5f, -0.5f, -0.5f));
            Matrix scale = Matrix.CreateScale(200f);

            Matrix translate = Matrix.CreateTranslation(camera.Position);

            Matrix rot = Matrix.CreateRotationY(rotation);

            effect.World      = center * rot * scale * translate;
            effect.View       = camera.View;
            effect.Projection = camera.WideProjection;

            foreach (EffectPass pass in effect.CurrentTechnique.Passes)
            {
                pass.Apply();
                device.SetVertexBuffer(cubeVertexBuffer);
                device.DrawPrimitives(
                    PrimitiveType.TriangleList,
                    0,
                    cubeVertexBuffer.VertexCount / 3);
            }
        }
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // TODO: Add your initialization logic here
// below camer looks at 64,16,64 point with elivation -30 degrees and rotation 0, min view 32 and max 192 starting at 128
            camera = new ArcBallCamera(
                new Vector3(64f, 16f, 64f),
                MathHelper.ToRadians(-30),
                0f,
                32f,
                192f,
                128f,
                GraphicsDevice.Viewport.AspectRatio,
                0.1f,
                512f);

            screenCenter.X = this.Window.ClientBounds.Width / 2;
            screenCenter.Y = this.Window.ClientBounds.Height / 2;

            this.IsMouseVisible = true;

            previousMouse = Mouse.GetState();
            Mouse.SetPosition(screenCenter.X, screenCenter.Y);

            base.Initialize();
        }
        public void Draw(ArcBallCamera camera, BasicEffect effect)
        {
            effect.VertexColorEnabled = false;
            effect.TextureEnabled = true;
            effect.Texture = texture;
            effect.LightingEnabled = false;

            Matrix center = Matrix.CreateTranslation(
                new Vector3(-0.5f, -0.5f, -0.5f));
            Matrix scale = Matrix.CreateScale(200f);

            Matrix translate = Matrix.CreateTranslation(camera.Position);

            Matrix rot = Matrix.CreateRotationY(rotation);

            effect.World = center * rot * scale * translate;
            effect.View = camera.View;
            effect.Projection = camera.WideProjection;

            foreach (EffectPass pass in effect.CurrentTechnique.Passes)
            {
                pass.Apply();
                device.SetVertexBuffer(cubeVertexBuffer);
                device.DrawPrimitives(
                    PrimitiveType.TriangleList,
                    0,
                    cubeVertexBuffer.VertexCount / 3);
            }
        }
        public void Draw(ArcBallCamera camera)
        {
            model.Root.Transform = Matrix.Identity *
                                   Matrix.CreateScale(0.005f) *
                                   Matrix.CreateRotationY(ShipRotation) *
                                   Matrix.CreateTranslation(Position);

            // model.Bones["turret_geo"].Transform =
            // Matrix.CreateRotationY(TurretRotation) * baseTurretTransform;

            // model.Bones["canon_geo"].Transform =
            //   Matrix.CreateRotationX(gunElevation) * baseGunTransform;

            // model.CopyAbsoluteBoneTransformsTo(boneTransforms);

            foreach (ModelMesh mesh in model.Meshes)
            {
                foreach (BasicEffect basicEffect in mesh.Effects)
                {
                    // basicEffect.World = boneTransforms[mesh.ParentBone.Index];
                    basicEffect.View       = camera.View;
                    basicEffect.Projection = camera.Projection;

                    basicEffect.EnableDefaultLighting();
                }

                mesh.Draw();
            }
        }
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // TODO: Add your initialization logic here
            // below camer looks at 64,16,64 point with elivation -30 degrees and rotation 0, min view 32 and max 192 starting at 128
            camera = new ArcBallCamera(
                new Vector3(64f, 16f, 64f),
                MathHelper.ToRadians(-30),
                0f,
                32f,
                192f,
                128f,
                GraphicsDevice.Viewport.AspectRatio,
                0.1f,
                512f);

            screenCenter.X = this.Window.ClientBounds.Width / 2;
            screenCenter.Y = this.Window.ClientBounds.Height / 2;

            this.IsMouseVisible = true;

            previousMouse = Mouse.GetState();
            Mouse.SetPosition(screenCenter.X, screenCenter.Y);

            base.Initialize();
        }