コード例 #1
0
ファイル: Game1.cs プロジェクト: rushTENm/Chasing
        protected override void Initialize()
        {
            // TODO: Add your initialization logic here
            target = new CameraTarget(GraphicsDevice);

            livingRoom = new GameModel();

            // Create the chase camera
            camera = new ChaseCamera();

            // Perform an inital reset on the camera so that it starts at the resting
            // position. If we don't do this, the camera will start at the origin and
            // race across the world to get behind the chased object.
            // This is performed here because the aspect ratio is needed by Reset.
            UpdateCameraChaseTarget();
            camera.Reset();

            base.Initialize();
        }
コード例 #2
0
ファイル: GameModel.cs プロジェクト: rushTENm/Chasing
        public void DrawMeshes(ChaseCamera Camera)
        {
            Matrix[] boneTransforms = new Matrix[Model.Bones.Count];
            Model.CopyAbsoluteBoneTransformsTo(boneTransforms);

            foreach (ModelMesh mesh in Model.Meshes)
            {
                foreach (BasicEffect effect in mesh.Effects)
                {
                    effect.EnableDefaultLighting();
                    effect.PreferPerPixelLighting = true;

                    effect.World = boneTransforms[mesh.ParentBone.Index] * Matrix.CreateScale(Scale) * Matrix.CreateTranslation(Position);
                    effect.Projection = Camera.Projection;
                    effect.View = Camera.View;
                }
                mesh.Draw();
            }
        }
コード例 #3
0
ファイル: CameraTarget.cs プロジェクト: rushTENm/Chasing
        public void DrawMeshes(ChaseCamera camera)
        {
            Matrix[] transforms = new Matrix[Model.Bones.Count];
            Model.CopyAbsoluteBoneTransformsTo(transforms);

            foreach (ModelMesh mesh in Model.Meshes)
            {
                foreach (BasicEffect effect in mesh.Effects)
                {
                    effect.EnableDefaultLighting();
                    effect.PreferPerPixelLighting = true;
                    effect.World = transforms[mesh.ParentBone.Index] * Matrix.CreateScale(Scale) * world;

                    // Use the matrices provided by the chase camera
                    effect.View = camera.View;
                    effect.Projection = camera.Projection;
                }
                mesh.Draw();
            }
        }