• R/O
  • SSH
  • HTTPS

mmdx: Commit


Commit MetaInfo

Revision855 (tree)
Zeit2011-06-13 00:41:51
Autorwilfrem

Log Message

とりあえず、ダンスが踊れるところまで

Ändern Zusammenfassung

Diff

--- branches/XNA4/MikuMikuDanceXNA/Model/MMDXBoxModelPart.cs (revision 854)
+++ branches/XNA4/MikuMikuDanceXNA/Model/MMDXBoxModelPart.cs (revision 855)
@@ -102,7 +102,7 @@
102102 VertexBuffer mainVertexBuffer;
103103 VertexBuffer externaiVertexBuffer;
104104
105- VertexBufferBinding[] bindings = new VertexBufferBinding[2];
105+ VertexBufferBinding[] bindings = new VertexBufferBinding[3];
106106 /// <summary>
107107 /// コンストラクタ
108108 /// </summary>
@@ -159,6 +159,8 @@
159159 GraphicsDevice graphics = Effect.GraphicsDevice;
160160 //レンダーステートセットアップ
161161 SetUpRenderState(mode, graphics);
162+ //スキニング行列を書き込んだ頂点をセット
163+ bindings[2] = new VertexBufferBinding(model.SkinVertBuffer, model.BufferOffset);
162164 //バッファセット
163165 graphics.Indices = indexBuffer;
164166 graphics.SetVertexBuffers(bindings);
@@ -184,7 +186,7 @@
184186 VertexBuffer mainVertexBuffer;
185187 VertexBuffer externaiVertexBuffer;
186188
187- VertexBufferBinding[] bindings = new VertexBufferBinding[2];
189+ VertexBufferBinding[] bindings = new VertexBufferBinding[3];
188190 /// <summary>
189191 /// コンストラクタ
190192 /// </summary>
@@ -241,6 +243,8 @@
241243 GraphicsDevice graphics = Effect.GraphicsDevice;
242244 //レンダーステートセットアップ
243245 SetUpRenderState(mode, graphics);
246+ //スキニング行列を書き込んだ頂点をセット
247+ bindings[2] = new VertexBufferBinding(model.SkinVertBuffer, model.BufferOffset);
244248 //バッファセット
245249 graphics.Indices = indexBuffer;
246250 graphics.SetVertexBuffers(bindings);
@@ -266,7 +270,7 @@
266270 VertexBuffer mainVertexBuffer;
267271 VertexBuffer externaiVertexBuffer;
268272
269- VertexBufferBinding[] bindings = new VertexBufferBinding[2];
273+ VertexBufferBinding[] bindings = new VertexBufferBinding[3];
270274 /// <summary>
271275 /// コンストラクタ
272276 /// </summary>
@@ -324,6 +328,8 @@
324328 GraphicsDevice graphics = Effect.GraphicsDevice;
325329 //レンダーステートセットアップ
326330 SetUpRenderState(mode, graphics);
331+ //スキニング行列を書き込んだ頂点をセット
332+ bindings[2] = new VertexBufferBinding(model.SkinVertBuffer, model.BufferOffset);
327333 //バッファセット
328334 graphics.Indices = indexBuffer;
329335 graphics.SetVertexBuffers(bindings);
--- branches/XNA4/MikuMikuDanceCore/Model/Physics/PhysicsManager.cs (revision 854)
+++ branches/XNA4/MikuMikuDanceCore/Model/Physics/PhysicsManager.cs (revision 855)
@@ -205,32 +205,36 @@
205205 }
206206 else
207207 {
208- if (bSetup)
208+ if (MMDCore.Instance.UsePhysics)
209209 {
210- //ボディを有効化し、グループとマスクを適応
211- for (int i = 0; i < Rigids.Count; ++i)
212- MMDCore.Instance.Physics.addRigidBody(Rigids[i],groups[i],masks[i]);
213- foreach (var joint in Joints)
214- MMDCore.Instance.Physics.addConstraint(joint);
215- bSetup = false;
216- }
217- for (int i = 0; i < motionState.Count; i++)
218- {
219- if (nReset>0)
220- Rigids[i].activate(true);
221- motionState[i].Flush(nReset>0);
222- if (nReset>0)
210+ if (bSetup)
223211 {
224- btTransform temp;
225- motionState[i].getWorldTransform(out temp);
226- Rigids[i].WorldTransform = temp;
227- Rigids[i].LinearVelocity = btVector3.Zero;
228- Rigids[i].AngularVelocity = btVector3.Zero;
212+ //ボディを有効化し、グループとマスクを適応
213+ for (int i = 0; i < Rigids.Count; ++i)
214+ MMDCore.Instance.Physics.addRigidBody(Rigids[i], groups[i], masks[i]);
215+ foreach (var joint in Joints)
216+ MMDCore.Instance.Physics.addConstraint(joint);
217+ bSetup = false;
229218 }
219+ for (int i = 0; i < motionState.Count; i++)
220+ {
221+ if (nReset > 0)
222+ Rigids[i].activate(true);
223+ motionState[i].Flush(nReset > 0);
224+ if (nReset > 0)
225+ {
226+ btTransform temp;
227+ motionState[i].getWorldTransform(out temp);
228+ Rigids[i].WorldTransform = temp;
229+ Rigids[i].LinearVelocity = btVector3.Zero;
230+ Rigids[i].AngularVelocity = btVector3.Zero;
231+ }
232+ }
233+ if (nReset > 0)
234+ --nReset;
230235 }
231236 }
232- if (nReset > 0)
233- --nReset;
237+
234238 }
235239 /// <summary>
236240 /// 剛体位置のリセット
--- branches/XNA4/MikuMikuDanceCore/Motion/AnimationPlayer.cs (revision 854)
+++ branches/XNA4/MikuMikuDanceCore/Motion/AnimationPlayer.cs (revision 855)
@@ -141,7 +141,7 @@
141141 //ボーンマネージャへの書き戻し
142142 foreach (var pose in Poses)
143143 {
144- if (!boneManager[pose.Key].IsPhysics)
144+ if (!boneManager[pose.Key].IsPhysics || !MMDCore.Instance.UsePhysics)
145145 boneManager[pose.Key].LocalTransform = pose.Value;
146146 }
147147 foreach (var face in Faces)
--- branches/XNA4/MikuMikuDanceCore/MMDCore.cs (revision 854)
+++ branches/XNA4/MikuMikuDanceCore/MMDCore.cs (revision 855)
@@ -133,7 +133,7 @@
133133 Physics = new DiscreteDynamicsWorld(dispatcher, pairCache, solver, config);
134134 Physics.Gravity = new btVector3(0, -9.81f * 5.0f, 0);
135135 #if !XBOX
136- UsePhysics = true;
136+ UsePhysics = false;
137137 #else
138138 UsePhysics = false;//XBoxのパフォーマンス問題(物理はやっぱり重たいので入れないほうが早い)
139139 #endif
Show on old repository browser