• R/O
  • SSH
  • HTTPS

mmdx: Commit


Commit MetaInfo

Revision851 (tree)
Zeit2011-06-12 18:58:21
Autorwilfrem

Log Message

ヒープバグの排除。次はボーンの接続

Ändern Zusammenfassung

Diff

--- branches/XNA4/MikuMikuDanceXNADemo1/MikuMikuDanceXNADemo1/Game1.cs (revision 850)
+++ branches/XNA4/MikuMikuDanceXNADemo1/MikuMikuDanceXNADemo1/Game1.cs (revision 851)
@@ -32,6 +32,7 @@
3232 MMDMotion motion;
3333 //前回のキーボードの入力を保持
3434 KeyboardState beforeState;
35+ GamePadButtons beforeButtons;
3536 /// <summary>
3637 /// コンストラクタ
3738 /// </summary>
@@ -85,7 +86,8 @@
8586 (!beforeState.IsKeyDown(Keys.Escape) && Keyboard.GetState().IsKeyDown(Keys.Escape)))
8687 this.Exit();//ゲーム終了
8788 //エンターを入力すると
88- if (!beforeState.IsKeyDown(Keys.Enter) && Keyboard.GetState().IsKeyDown(Keys.Enter))
89+ if ((!beforeState.IsKeyDown(Keys.Enter) && Keyboard.GetState().IsKeyDown(Keys.Enter)) ||
90+ (GamePad.GetState(PlayerIndex.One).Buttons.A== ButtonState.Pressed))
8991 {
9092 //再生した後ならリセットをかける
9193 if (model.AnimationPlayer["TrueMyHeart"].NowFrame > 0)
@@ -106,6 +108,7 @@
106108 base.Update(gameTime);
107109 //キーボードの状態を記録
108110 beforeState = Keyboard.GetState();
111+ beforeButtons = GamePad.GetState(PlayerIndex.One).Buttons;
109112
110113 }
111114
--- branches/XNA4/MikuMikuDanceCore/Model/MMDBoneManager.cs (revision 850)
+++ branches/XNA4/MikuMikuDanceCore/Model/MMDBoneManager.cs (revision 851)
@@ -26,8 +26,11 @@
2626 /// </summary>
2727 public ReadOnlyCollection<MMDIK> IKs { get; private set; }
2828 Dictionary<string, int> boneDic;
29- internal Matrix[] SkinTransforms { get; private set; }
3029 /// <summary>
30+ /// スキニング行列
31+ /// </summary>
32+ public Matrix[] SkinTransforms { get; private set; }
33+ /// <summary>
3134 /// コンストラクタ
3235 /// </summary>
3336 /// <param name="bones">ボーン一覧</param>
@@ -74,8 +77,10 @@
7477 public int Count { get { return bones.Count; } }
7578
7679
77-
78- internal void CalcGlobalTransform()
80+ /// <summary>
81+ /// グローバルトランスフォームの更新
82+ /// </summary>
83+ public void CalcGlobalTransform()
7984 {
8085 MMDXProfiler.BeginMark("BoneManager.CalcGlobalTransform", MMDXMath.CreateColor(40, 255, 0));
8186 bones[0].LocalTransform.CreateMatrix(out bones[0].GlobalTransform);
@@ -89,13 +94,17 @@
8994 bones[i].GlobalTransform = local;
9095 }
9196 else
97+ {
9298 Matrix.Multiply(ref local, ref bones[parentBone].GlobalTransform, out bones[i].GlobalTransform);
99+ }
93100 }
94101 MMDXProfiler.EndMark("BoneManager.CalcGlobalTransform");
95102 }
96103
97-
98- internal void CalcSkinTransform()
104+ /// <summary>
105+ /// スキニング行列の計算
106+ /// </summary>
107+ public void CalcSkinTransform()
99108 {
100109 MMDXProfiler.BeginMark("BoneManager.CalcSkinTransform", MMDXMath.CreateColor(40, 255, 0));
101110 for (int i = 0; i < bones.Count; ++i)
@@ -102,7 +111,10 @@
102111 Matrix.Multiply(ref bones[i].InverseBindPose, ref bones[i].GlobalTransform, out SkinTransforms[i]);
103112 MMDXProfiler.EndMark("BoneManager.CalcSkinTransform");
104113 }
105- internal void CalcIK()
114+ /// <summary>
115+ /// IK計算
116+ /// </summary>
117+ public void CalcIK()
106118 {
107119 bool UpdateFlag = false;
108120 for (int i = 0; i < IKs.Count; ++i)
--- branches/XNA4/MikuMikuDanceCore/Motion/AnimationPlayer.cs (revision 850)
+++ branches/XNA4/MikuMikuDanceCore/Motion/AnimationPlayer.cs (revision 851)
@@ -47,10 +47,14 @@
4747 {
4848 get
4949 {
50+#if !XBOX
5051 IMMDMotionTrack result = null;
5152 if (!motionTracks.TryGetValue(motionKey, out result))
5253 throw new KeyNotFoundException("モーション名 \"" + motionKey.ToString() + "\" は見つかりません");
5354 return result;
55+#else
56+ return motionTracks[motionKey];
57+#endif
5458 }
5559 }
5660
--- branches/XNA4/MikuMikuDanceCore/MultiThreads/PhysicsThreadManager.cs (revision 850)
+++ branches/XNA4/MikuMikuDanceCore/MultiThreads/PhysicsThreadManager.cs (revision 851)
@@ -87,7 +87,8 @@
8787 {
8888 if (timeStep > 0.0f)
8989 {
90- MMDCore.Instance.Physics.stepSimulation(timeStep);
90+ if (MMDCore.Instance.UsePhysics)
91+ MMDCore.Instance.Physics.stepSimulation(timeStep);
9192 }
9293 }
9394 }
@@ -120,8 +121,8 @@
120121 {
121122 if (m_timeStep > 0.0f)
122123 {
123- //System.Diagnostics.Debug.WriteLine(m_timeStep);
124- MMDCore.Instance.Physics.stepSimulation(m_timeStep);
124+ if (MMDCore.Instance.UsePhysics)
125+ MMDCore.Instance.Physics.stepSimulation(m_timeStep);
125126 }
126127 }
127128 CalcFinished.Set();
--- branches/XNA4/MikuMikuDanceCore/MMDCore.cs (revision 850)
+++ branches/XNA4/MikuMikuDanceCore/MMDCore.cs (revision 851)
@@ -81,6 +81,10 @@
8181 /// <remarks>差し替える場合は他の処理の前に差し替えること。
8282 /// また、これの処理はマルチスレッドで行われるため、同期処理はUpdate関数を使用すること</remarks>
8383 public DiscreteDynamicsWorld Physics { get; set; }
84+ /// <summary>
85+ /// 物理演算を使用するかどうか。
86+ /// </summary>
87+ public bool UsePhysics { get; set; }
8488 #if !XBOX
8589 /// <summary>
8690 /// ファイルからモデルを読むファクトリー
@@ -128,6 +132,12 @@
128132 solver = new SequentialImpulseConstraintSolver();
129133 Physics = new DiscreteDynamicsWorld(dispatcher, pairCache, solver, config);
130134 Physics.Gravity = new btVector3(0, -9.81f * 5.0f, 0);
135+#if !XBOX
136+ UsePhysics = true;
137+#else
138+ UsePhysics = false;//XBoxのパフォーマンス問題(物理はやっぱり重たいので入れないほうが早い)
139+#endif
140+
131141 }
132142
133143
Show on old repository browser