public void Update(MovingData movingNow, Size ClientSize) { World = Matrix.Identity; View = Matrix.Multiply( Matrix.Multiply( Matrix.RotationX(-movingNow.rotY / 100.0f), Matrix.RotationY(movingNow.rotX / 100.0f) ), Matrix.Multiply( Matrix.LookAtLH(ViewEye, ViewTarget, new Vector3(0, 1, 0)), Matrix.Translation(movingNow.posX / divXY, -movingNow.posY / divXY, movingNow.posZ * divZ) ) ); var newEye = Vector3.Transform( ViewEye, Matrix.Multiply( Matrix.Multiply( Matrix.RotationX(-movingNow.rotY / 100.0f), Matrix.RotationY(movingNow.rotX / 100.0f) ), Matrix.Translation(movingNow.posX / divXY, -movingNow.posY / divXY, movingNow.posZ * divZ) )); Projection = Matrix.PerspectiveFovLH( 30 * (float)Math.PI / 180, ClientSize.Width / ClientSize.Height, 0.1f, 1000 ); LightDir = new Vector4(0, 20, 0, 1); EyePosition = newEye; }
public DrawMmdModel(string Path) { mmdLoader = new MmdLoader(Path); vmdLoader = new VmdLoader(@"motion\kl.vmd"); flameCount = 0; movingNow = new MovingData(); camera = new Camera(); camera.ViewTarget = new Vector3(0, 10, 0); camera.ViewEye = new Vector3(0, 10, -45); motMng = new MotionManager(mmdLoader.Bone); boneMng = new BoneManager(mmdLoader.Bone); motMng.SetMotion(vmdLoader.Motion, true); motMng.Start(); }