• R/O
  • SSH
  • HTTPS

mmdx: Commit


Commit MetaInfo

Revision562 (tree)
Zeit2010-07-27 09:51:35
Autorwilfrem

Log Message

QuatTransformの関数追加、各種修正等

Ändern Zusammenfassung

Diff

--- trunk/MikuMikuDanceXNA/Model/MMDBoneManager.cs (revision 561)
+++ trunk/MikuMikuDanceXNA/Model/MMDBoneManager.cs (revision 562)
@@ -54,6 +54,7 @@
5454 string Name = i.Name;
5555 bone.BoneData = i;
5656 m_Bones[boneindex] = bone;
57+ m_Bones[boneindex].BoneTransform.Rotation = Quaternion.Identity;
5758 BoneDic.Add(Name, boneindex);
5859 boneindex++;
5960 }
--- trunk/MikuMikuDanceXNA/Model/ModelData/QuatTransform.cs (revision 561)
+++ trunk/MikuMikuDanceXNA/Model/ModelData/QuatTransform.cs (revision 562)
@@ -125,13 +125,82 @@
125125 /// <summary>
126126 /// 移動QuatTransformを返します
127127 /// </summary>
128- /// <param name="x"></param>
129- /// <param name="y"></param>
130- /// <param name="z"></param>
131- /// <returns></returns>
132- public static QuatTransform CreateTranslation(int x, int y, int z)
128+ /// <param name="x">X移動</param>
129+ /// <param name="y">Y移動</param>
130+ /// <param name="z">Z移動</param>
131+ /// <returns>移動QuatTransform</returns>
132+ public static QuatTransform CreateTranslation(float x, float y, float z)
133133 {
134134 return new QuatTransform(Quaternion.Identity, new Vector3(x, y, z));
135135 }
136+ /// <summary>
137+ /// 移動QuatTransformを返します
138+ /// </summary>
139+ /// <param name="x">X移動</param>
140+ /// <param name="y">Y移動</param>
141+ /// <param name="z">Z移動</param>
142+ /// <param name="result">移動QuatTransform</param>
143+ public static void CreateTranslation(float x, float y, float z, out QuatTransform result)
144+ {
145+ result = new QuatTransform(Quaternion.Identity, new Vector3(x, y, z));
146+ }
147+
148+ /// <summary>
149+ /// X軸回転QuatTransformを返します
150+ /// </summary>
151+ /// <param name="rot">X回転</param>
152+ /// <returns>X軸回転QuatTransform</returns>
153+ public static QuatTransform CreateRotationX(float rot)
154+ {
155+ return new QuatTransform(Quaternion.CreateFromYawPitchRoll(0, rot, 0), Vector3.Zero);
156+ }
157+ /// <summary>
158+ /// X軸回転QuatTransformを返します
159+ /// </summary>
160+ /// <param name="rot">X回転</param>
161+ /// <param name="result">X軸回転QuatTransform</param>
162+ public static void CreateRotationX(float rot, out QuatTransform result)
163+ {
164+ result = new QuatTransform();
165+ Quaternion.CreateFromYawPitchRoll(0, rot, 0, out result.Rotation);
166+ }
167+ /// <summary>
168+ /// Y軸回転QuatTransformを返します
169+ /// </summary>
170+ /// <param name="rot">Y回転</param>
171+ /// <returns>Y軸回転QuatTransform</returns>
172+ public static QuatTransform CreateRotationY(float rot)
173+ {
174+ return new QuatTransform(Quaternion.CreateFromYawPitchRoll(rot, 0, 0), Vector3.Zero);
175+ }
176+ /// <summary>
177+ /// Y軸回転QuatTransformを返します
178+ /// </summary>
179+ /// <param name="rot">Y回転</param>
180+ /// <param name="result">Y軸回転QuatTransform</param>
181+ public static void CreateRotationY(float rot, out QuatTransform result)
182+ {
183+ result = new QuatTransform();
184+ Quaternion.CreateFromYawPitchRoll(rot, 0, 0, out result.Rotation);
185+ }
186+ /// <summary>
187+ /// Z軸回転QuatTransformを返します
188+ /// </summary>
189+ /// <param name="rot">Z回転</param>
190+ /// <returns>Z軸回転QuatTransform</returns>
191+ public static QuatTransform CreateRotationZ(float rot)
192+ {
193+ return new QuatTransform(Quaternion.CreateFromYawPitchRoll(0, 0, rot), Vector3.Zero);
194+ }
195+ /// <summary>
196+ /// Z軸回転QuatTransformを返します
197+ /// </summary>
198+ /// <param name="rot">Z回転</param>
199+ /// <param name="result">Z軸回転QuatTransform</param>
200+ public static void CreateRotationZ(float rot, out QuatTransform result)
201+ {
202+ result = new QuatTransform();
203+ Quaternion.CreateFromYawPitchRoll(0, 0, rot, out result.Rotation);
204+ }
136205 }
137206 }
--- trunk/MikuMikuDanceXNA/Motion/AnimationBaker.cs (revision 561)
+++ trunk/MikuMikuDanceXNA/Motion/AnimationBaker.cs (revision 562)
@@ -127,8 +127,11 @@
127127 tasks[thread]._normal = normal;
128128 tasks[thread]._BoneManager = BoneManager;
129129 tasks[thread].thread = new Thread(new ThreadStart(tasks[thread].Work));
130+ }
131+ Thread.MemoryBarrier();
132+ for (int thread = 0; thread < tasks.Length; thread++)
130133 tasks[thread].thread.Start();//処理が重いのでワーカースレッドに投げる
131- }
134+
132135 //表情用の処理
133136 /*BakeFaceTaskManager ftask = new BakeFaceTaskManager();
134137 ftask.BoneUpdated = new bool[BoneManager.Count];
@@ -203,10 +206,16 @@
203206 {
204207 result.Poses[Frame * result.NumBone + it.Value].BoneIndex = it.Key;
205208 result.Poses[Frame * result.NumBone + it.Value].Poses = BoneManager.Bones[it.Key].BoneTransform;
209+#if DEBUG && WINDOWS
210+ if (!MMDMath.IsValid(ref result.Poses[Frame * result.NumBone + it.Value].Poses.Rotation))
211+ throw new ApplicationException("ベイクループ内で無効なrotationを発見");
212+#endif
206213 }
207214 //表情の抽出
208215 Array.Copy(FaceManager.FaceRates, 0, result.Faces, Frame * FaceManager.FaceRates.Length, FaceManager.FaceRates.Length);
209216
217+ //Threadを休ませる
218+ Thread.Sleep(0);
210219 //for (int i = 0; i < FaceList.Count; i++)
211220 //{
212221 // result.Faces[Frame * result.NumFace + i].Rate = normal.Motion.GetFaceRate(FaceList[i], Frame);
@@ -213,6 +222,7 @@
213222 // result.Faces[Frame * result.NumFace + i].FaceName = FaceList[i];
214223 //}
215224 }
225+ Thread.MemoryBarrier();
216226 }
217227 }
218228 /*class BakeFaceTaskManager
--- trunk/MMDImporter/Model/MeshConverter.cs (revision 561)
+++ trunk/MMDImporter/Model/MeshConverter.cs (revision 562)
@@ -26,7 +26,7 @@
2626 if (model.ToonExpantion)
2727 {
2828 result.ToonTextures = new string[10];
29- Array.Copy(model.ToonFileNames, result.ToonTextures, model.ToonFileNames.Length);
29+ Array.Copy(model.ToonFileNames, result.ToonTextures, result.ToonTextures.Length);
3030 }
3131 //ボーンの参照をコピー
3232 result.Bones = model.Bones;
--- trunk/MMDImporter/Motion/MMDBakedMotionProcessor.cs (revision 561)
+++ trunk/MMDImporter/Motion/MMDBakedMotionProcessor.cs (revision 562)
@@ -79,7 +79,7 @@
7979 if (MMDMath.IsNaN(ref result.Poses[i].Poses))
8080 throw new InvalidContentException("BakeMotionのチェック中にNaNを発見-Pose");
8181 if (!MMDMath.IsValid(ref result.Poses[i].Poses.Rotation))
82- throw new InvalidContentException("BakeMotionのチェック中に無効なrotationを発見-Pose");
82+ throw new InvalidContentException("BakeMotionのチェック中に無効なrotationを発見-Pose" + i.ToString());
8383
8484 }
8585 #endif
Show on old repository browser