• R/O
  • SSH
  • HTTPS

mmdx: Commit


Commit MetaInfo

Revision81 (tree)
Zeit2010-03-21 20:31:57
Autorwilfrem

Log Message

カメラモーション実装完了。ついでにMotionLibraryのカメラモーションの座標系変換ミス修正

Ändern Zusammenfassung

Diff

--- trunk/MikuMikuDanceXNA/MikuMikuDanceXNA.cs (revision 80)
+++ trunk/MikuMikuDanceXNA/MikuMikuDanceXNA.cs (revision 81)
@@ -70,6 +70,7 @@
7070 {
7171 Content = game.Content;
7272 Camera = new MMDCamera(game);
73+ game.Components.Add(Camera);
7374 LightManager = new MMDLightManager();
7475 #if WINDOWS
7576 //論理コア数を取得して、最適スレッド数を取得
@@ -90,6 +91,7 @@
9091 {
9192 Content = game.Content;
9293 Camera = new MMDCamera(game);
94+ game.Components.Add(Camera);
9395 LightManager = new MMDLightManager();
9496 #if WINDOWS
9597 //論理コア数を取得して、最適スレッド数を取得
@@ -116,10 +118,11 @@
116118 return result;
117119 }
118120 /// <summary>
119- /// モーションをアセットから読み込む
121+ /// モデルモーションをアセットから読み込む
120122 /// </summary>
121123 /// <param name="assetName">モーションのアセット名</param>
122- /// <returns>MikuMikuDance for XNAのモーション</returns>
124+ /// <returns>MikuMikuDance for XNAのモデルモーション</returns>
125+ /// <remarks>カメラ、ライトモーションはLoadStageMotionを使用</remarks>
123126 public MMDMotion LoadMotion(string assetName)
124127 {
125128 MMDMotion result = new MMDMotion();
@@ -147,8 +150,18 @@
147150 {
148151 return Content.Load<MMD_VAC>(assetName);
149152 }
150-
151153 /// <summary>
154+ /// カメラ、ライトモーション(ステージモーション)をアセットから読み込む
155+ /// </summary>
156+ /// <param name="assetName">モーションのアセット名</param>
157+ /// <returns>MikuMikuDance for XNAのステージモーション</returns>
158+ public MMDStageMotion LoadStageMotion(string assetName)
159+ {
160+ MMDStageMotion result = new MMDStageMotion();
161+ result.Initialize(Content.Load<MMDMotionData>(assetName), this);
162+ return result;
163+ }
164+ /// <summary>
152165 /// 登録済み物理エンジンのアップデート
153166 /// </summary>
154167 /// <param name="timeStep">GameTimeオブジェクト</param>
--- trunk/MikuMikuDanceXNA/Stages/CameraMotionTrack.cs (revision 80)
+++ trunk/MikuMikuDanceXNA/Stages/CameraMotionTrack.cs (revision 81)
@@ -34,7 +34,7 @@
3434
3535 public void Start()
3636 {
37- if (!timer.IsRunning)
37+ if (timer.IsRunning)
3838 return;
3939 timer.Start();
4040 beforeMS = (decimal)timer.Elapsed.TotalMilliseconds - LossTime;
@@ -72,7 +72,7 @@
7272 //モーションデータを計算
7373 motion.GetCameraData(NowFrame, out Length, out Locate, out Rotate, out ViewAngle);
7474 //カメラ位置を計算
75- Vector3 CameraPos = new Vector3(0, 0, 1) * Length;
75+ Vector3 CameraPos = new Vector3(0, 0, -1) * Length;
7676 CameraPos = Vector3.Transform(CameraPos, Rotate) + Locate;
7777 mmdCamera.CameraPos = CameraPos;
7878 //ターゲット位置を計算
--- trunk/MikuMikuDanceXNA/Stages/CameraAnimationPlayer.cs (revision 80)
+++ trunk/MikuMikuDanceXNA/Stages/CameraAnimationPlayer.cs (revision 81)
@@ -61,6 +61,7 @@
6161 {
6262 //オブジェクトプールのモーショントラックにデータをセット
6363 mmdMotion[index].Reset();
64+ motion.ToCameraUse = true;
6465 mmdMotion[index].motion = motion;
6566 mmdMotion[index].IsEmpty = false;
6667 mmdMotion[index] = mmdMotion[index];//オブジェクトプールから引っ張ってくる
--- trunk/MikuMikuDanceXNA/Stages/MMDStageMotion.cs (revision 80)
+++ trunk/MikuMikuDanceXNA/Stages/MMDStageMotion.cs (revision 81)
@@ -15,18 +15,14 @@
1515 //内部データ
1616 internal MMDMotionData MotionData { get; private set; }
1717 internal MikuMikuDanceXNA mmdXNA { get; private set; }
18+ internal bool ToCameraUse = true;
19+ internal long MaxFrame { get { return ToCameraUse ? MotionData.CameraMotions.Last().FrameNo : MotionData.LightMotions.Last().FrameNo; } }
1820
19- internal long MaxFrame { get; set; }
20-
2121 internal MMDStageMotion() { }//外から作らせない
22- internal void Initialize(MMDMotionData motionData, MikuMikuDanceXNA mmdxna, bool ToCameraUse)
22+ internal void Initialize(MMDMotionData motionData, MikuMikuDanceXNA mmdxna)
2323 {
2424 MotionData = motionData;
2525 mmdXNA = mmdxna;
26- if (ToCameraUse)
27- MaxFrame = motionData.CameraMotions.Last().FrameNo;
28- else
29- MaxFrame = motionData.LightMotions.Last().FrameNo;
3026 }
3127 internal void GetCameraData(decimal NowFrame, out float Length, out Vector3 Locate, out Quaternion Rotate, out float ViewAngle)
3228 {
Show on old repository browser