• R/O
  • SSH
  • HTTPS

mmdx: Commit


Commit MetaInfo

Revision60 (tree)
Zeit2010-03-20 18:36:06
Autorwilfrem

Log Message

表情の頂点移動出力計算をDrawからUpdateに移動

Ändern Zusammenfassung

Diff

--- trunk/MikuMikuDanceXNA/Model/MMDModel.cs (revision 59)
+++ trunk/MikuMikuDanceXNA/Model/MMDModel.cs (revision 60)
@@ -177,6 +177,7 @@
177177 }
178178 #endif
179179 BoneManager.Update();
180+ FaceManager.Update();
180181 #if TRACE
181182 if (mmdXNA.TimeRular != null && UseTimeRular)
182183 mmdXNA.TimeRular.EndMark(1, "BoneManager");
@@ -246,14 +247,13 @@
246247 translationTexture.Flip();
247248 faceTexture.Flip();
248249
249- //TODO: GetSkinRotation、GetSkinTranslationがボトルネック。原因はO(200)程度の処理量……
250250 //スキンアニメーション用テクスチャ
251251 rotationTexture.Texture.SetData<Quaternion>(BoneManager.GetSkinRotation());
252252 translationTexture.Texture.SetData<Vector4>(BoneManager.GetSkinTranslation());
253253 //フェイステクスチャ
254+ //TODO: GetFaceTranslationがボトルネック。
254255 faceTexture.Texture.SetData<Vector4>(FaceManager.GetFaceTranslation());
255256
256-
257257 //ライティング設定の取得
258258 Vector3 LightVector, LightColor;
259259 mmdXNA.LightManager.GetParameters(out LightVector, out LightColor);
--- trunk/MikuMikuDanceXNA/Model/MMDFaceManager.cs (revision 59)
+++ trunk/MikuMikuDanceXNA/Model/MMDFaceManager.cs (revision 60)
@@ -1,5 +1,6 @@
11 using System.Collections.Generic;
22 using Microsoft.Xna.Framework;
3+using System;
34
45 namespace MikuMikuDance.XNA.Model
56 {
@@ -41,18 +42,9 @@
4142 public void ResetFace()
4243 {
4344 FaceRates.Clear();
44- ResetTranslations();
45+ Array.Clear(FaceTranslations, 0, FaceTranslations.Length);
4546 }
46- private void ResetTranslations()
47- {
48- for (int i = 0; i < FaceTranslations.Length; i++)
49- {
50- FaceTranslations[i].X = 0;
51- FaceTranslations[i].Y = 0;
52- FaceTranslations[i].Z = 0;
53- FaceTranslations[i].W = 0;
54- }
55- }
47+
5648 /// <summary>
5749 /// 表情のセット
5850 /// </summary>
@@ -69,23 +61,23 @@
6961 else
7062 FaceRates.Add(facename, rate);
7163 }
72-
73- internal Vector4[] GetFaceTranslation()
64+ internal void Update()
7465 {
75- ResetTranslations();//まずは表情をリセットしておく
66+ Array.Clear(FaceTranslations, 0, FaceTranslations.Length);
67+ //ResetTranslations();//まずは表情をリセットしておく
7668 //次に表情名に合わせて頂点とその移動量を合算する
7769 foreach (var face in FaceRates)
7870 {//各表情ごとに頂点移動量の合成処理
7971 if (!FaceDictionary.ContainsKey(face.Key))
8072 continue;//対象表情が無いのでパス
81- float temp;
82- if (face.Key == "あ")
83- temp=face.Value;
8473 foreach (var vert in model.ModelData.Skins[FaceDictionary[face.Key]].SkinVerts)
8574 {
8675 FaceTranslations[vert.VertIndex] += (new Vector4(vert.Pos[0], vert.Pos[1], vert.Pos[2], 0) * face.Value);
8776 }
8877 }
78+ }
79+ internal Vector4[] GetFaceTranslation()
80+ {
8981 return FaceTranslations;
9082 }
9183 }
Show on old repository browser