示例#1
0
文件: Game.cs 项目: smalice/Cap3DDemo
        protected override void Initialize()
        {
            camera = new Camera(this, sCamPos, sCamTar, sCamUp);
            Components.Add(camera);

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

            base.Initialize();
        }
示例#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();
            }
        }