Example #1
0
        protected override void Initialize()
        {
            camera = new Camera(this, sCamPos, sCamTar, sCamUp);
            Components.Add(camera);

            models = new Models(this);
            Components.Add(models);

            base.Initialize();
        }
Example #2
0
        public void Draw(Camera camera)
        {
            Matrix[] transforms = new Matrix[model.Bones.Count];
            model.CopyAbsoluteBoneTransformsTo(transforms);

            foreach (ModelMesh mesh in model.Meshes)
            {
                foreach (BasicEffect be in mesh.Effects)
                {
                    be.EnableDefaultLighting();
                    be.Projection = camera.projection;
                    be.View = camera.view;
                    be.World = GetWorld() * transforms[mesh.ParentBone.Index] * gameWorldRotation;
                }

                mesh.Draw();
            }
        }