コンテンツパイプライン時にベイク出来るようにするための作業(途中、クラスはある程度準備した)
@@ -5,6 +5,7 @@ | ||
5 | 5 | |
6 | 6 | namespace MikuMikuDance.XNA.Model |
7 | 7 | { |
8 | + | |
8 | 9 | /// <summary> |
9 | 10 | /// TypeWrite前のMMDModelクラス |
10 | 11 | /// </summary> |
@@ -0,0 +1,33 @@ | ||
1 | +using System; | |
2 | +using System.Collections.Generic; | |
3 | +using System.Linq; | |
4 | +using System.Text; | |
5 | +using System.Runtime.InteropServices; | |
6 | + | |
7 | +namespace MikuMikuDance.XNA | |
8 | +{ | |
9 | + /// <summary> | |
10 | + /// Win32API用のクラス。 | |
11 | + /// </summary> | |
12 | + internal static class Win32API | |
13 | + { | |
14 | + [DllImport("kernel32")] | |
15 | + internal static extern void GetSystemInfo(ref SYSTEM_INFO ptmpsi); | |
16 | + | |
17 | + [StructLayout(LayoutKind.Sequential)] | |
18 | + public struct SYSTEM_INFO | |
19 | + { | |
20 | + public uint dwOemId; | |
21 | + public uint dwPageSize; | |
22 | + public uint lpMinimumApplicationAddress; | |
23 | + public uint lpMaximumApplicationAddress; | |
24 | + public uint dwActiveProcessorMask; | |
25 | + public uint dwNumberOfProcessors; | |
26 | + public uint dwProcessorType; | |
27 | + public uint dwAllocationGranularity; | |
28 | + public uint dwProcessorLevel; | |
29 | + public uint dwProcessorRevision; | |
30 | + } | |
31 | + | |
32 | + } | |
33 | +} |
@@ -0,0 +1,21 @@ | ||
1 | +using Microsoft.Xna.Framework.Content.Pipeline; | |
2 | +using MikuMikuDance.Motion.Motion2; | |
3 | +using MikuMikuDance.XNA.Model; | |
4 | + | |
5 | +namespace MikuMikuDance.XNA.Motion | |
6 | +{ | |
7 | + /// <summary> | |
8 | + /// ベイクするモーションとモデルのセット | |
9 | + /// </summary> | |
10 | + public class BakeMotionSet | |
11 | + { | |
12 | + /// <summary> | |
13 | + /// モーション | |
14 | + /// </summary> | |
15 | + public ExternalReference<MMDMotion2> motion; | |
16 | + /// <summary> | |
17 | + /// 対象モデルファイル名 | |
18 | + /// </summary> | |
19 | + public ExternalReference<MMDModelIntermediate> model; | |
20 | + } | |
21 | +} |
@@ -0,0 +1,53 @@ | ||
1 | +using System; | |
2 | +using System.Collections.Generic; | |
3 | +using System.IO; | |
4 | +using System.Linq; | |
5 | +using Microsoft.Xna.Framework; | |
6 | +using Microsoft.Xna.Framework.Content.Pipeline; | |
7 | +using Microsoft.Xna.Framework.Content.Pipeline.Graphics; | |
8 | +using Microsoft.Xna.Framework.Content.Pipeline.Processors; | |
9 | +using Microsoft.Xna.Framework.Graphics; | |
10 | +using MikuMikuDance.Motion.Motion2; | |
11 | +using MikuMikuDance.XNA.Motion.MotionData; | |
12 | +using TInput = MikuMikuDance.XNA.Motion.BakeMotionSet; | |
13 | +using TOutput = MikuMikuDance.XNA.Motion.MotionData.MMDBakedMotionData; | |
14 | +using MikuMikuDance.Model; | |
15 | +using MikuMikuDance.XNA.Model; | |
16 | +using MikuMikuDance.XNA.Model.ModelData; | |
17 | + | |
18 | +namespace MikuMikuDance.XNA.Motion | |
19 | +{ | |
20 | + /// <summary> | |
21 | + /// ベイク済みモーション作成プロセッサ | |
22 | + /// </summary> | |
23 | + [ContentProcessor(DisplayName = "MikuMikuDanceモーションベイク : MikuMikuDance for XNA")] | |
24 | + public class MMDBakedMotionProcessor : ContentProcessor<TInput, TOutput> | |
25 | + { | |
26 | + /// <summary> | |
27 | + /// モーションのベイク処理 | |
28 | + /// </summary> | |
29 | + /// <param name="input">ベイクモーションセット</param> | |
30 | + /// <param name="context">ベイク済みモーション</param> | |
31 | + /// <returns></returns> | |
32 | + public override TOutput Process(TInput input, ContentProcessorContext context) | |
33 | + { | |
34 | + //モーションの変換 | |
35 | + string motionName = input.motion.Name; | |
36 | + string modelName = input.model.Name; | |
37 | + MMDMotion2 motion2 = context.BuildAndLoadAsset<MMDMotion2, MMDMotion2>(input.motion, null); | |
38 | + MMDModelIntermediate modelInter = context.BuildAndLoadAsset<MMDModelIntermediate, MMDModelIntermediate>(input.model, null); | |
39 | + MMDMotionProcessor motionProc = new MMDMotionProcessor(); | |
40 | + /*if(motion2.Motions==null) | |
41 | + throw new Exception(); | |
42 | + MMDMotionData motion = motionProc.Process(motion2, context);*/ | |
43 | + //MMDMotionData motion = context.Convert<MMDMotion2, MMDMotionData>(motion2, "MMDMotionProcessor"); | |
44 | + //MMDModelContext model = context.Convert<MMDModelIntermediate, MMDModelContext>(modelInter, "MMDModelProcessor"); | |
45 | + //ベイクルーチンでベイクする | |
46 | + | |
47 | + | |
48 | + //仮組み | |
49 | + TOutput result = new MMDBakedMotionData(); | |
50 | + return result; | |
51 | + } | |
52 | + } | |
53 | +} | |
\ No newline at end of file |