OSDN Git Service

76a3587946ab268d6a07e66a821227de6bdb768a
[mikutoga/TogaGem.git] / src / main / java / jp / sourceforge / mikutoga / pmd / parser / PmdBoneHandler.java
1 /*
2  * PMD bone information handler
3  *
4  * License : The MIT License
5  * Copyright(c) 2010 MikuToga Partners
6  */
7
8 package jp.sourceforge.mikutoga.pmd.parser;
9
10 import jp.sfjp.mikutoga.bin.parser.LoopHandler;
11 import jp.sfjp.mikutoga.bin.parser.MmdFormatException;
12 import jp.sfjp.mikutoga.bin.parser.ParseStage;
13
14 /**
15  * PMDモデルの各種ボーン情報の通知用ハンドラ。
16  * ボーン定義の出現順と、0から始まるボーンIDは対応する。
17  */
18 public interface PmdBoneHandler extends LoopHandler {
19
20     /** ボーン定義抽出ループ。 */
21     ParseStage BONE_LIST = new ParseStage();
22
23     /** IKリスト抽出ループ。 */
24     ParseStage IK_LIST = new ParseStage();
25
26     /** IKチェーンリスト抽出ループ。 */
27     ParseStage IKCHAIN_LIST = new ParseStage();
28
29     /** ボーングループ名抽出ループ。 */
30     ParseStage BONEGROUP_LIST = new ParseStage();
31
32     /** ボーングループ内訳抽出ループ。 */
33     ParseStage GROUPEDBONE_LIST = new ParseStage();
34
35     /**
36      * ボーン定義情報の通知を受け取る。
37      * {@link #BONE_LIST}ループの構成要素。
38      * @param boneName ボーン名
39      * @param boneKind ボーン種別。
40      * <ul>
41      * <li>0:回転
42      * <li>1:回転/移動
43      * <li>2:IK
44      * <li>3:不明
45      * <li>4:IK影響下(回転)
46      * <li>5:回転影響下
47      * <li>6:IK接続先
48      * <li>7:非表示
49      * <li>8:捩り
50      * <li>9:回転連動
51      * </ul>
52      * ※8,9はMMD4.0から?
53      * @throws MmdFormatException 不正フォーマットによる
54      * パース処理の中断をパーサに指示
55      */
56     void pmdBoneInfo(String boneName, byte boneKind)
57             throws MmdFormatException;
58
59     /**
60      * ボーン間接続情報の通知を受け取る。
61      * {@link #BONE_LIST}ループの構成要素。
62      * @param parentId 親(前)ボーンID。無い場合は0xffff。
63      * @param tailId 子(次)ボーンID。末端の場合は0。
64      * 捩りボーンの場合は軸方向のボーンID、
65      * 回転連動ボーンの場合は影響元ボーンID
66      * @param ikId 影響IKボーンID。未指定の場合は0。
67      * ※回転連動では影響度(0-100)、負や100以上もOK!
68      * @throws MmdFormatException 不正フォーマットによる
69      * パース処理の中断をパーサに指示
70      */
71     void pmdBoneLink(int parentId, int tailId, int ikId)
72             throws MmdFormatException;
73
74     /**
75      * ボーン位置情報の通知を受け取る。
76      * {@link #BONE_LIST}ループの構成要素。
77      * @param xPos X座標
78      * @param yPos Y座標
79      * @param zPos Z座標
80      * @throws MmdFormatException 不正フォーマットによる
81      * パース処理の中断をパーサに指示
82      */
83     void pmdBonePosition(float xPos, float yPos, float zPos)
84             throws MmdFormatException;
85
86     /**
87      * IKボーン情報の通知を受け取る。
88      * {@link #IK_LIST}ループの構成要素。
89      * @param boneId IKボーンID
90      * @param targetId IKボーンが最初に接続するIK接続先ボーンID
91      * @param depth 再帰演算の深さ
92      * @param weight 制限角度強度
93      * @throws MmdFormatException 不正フォーマットによる
94      * パース処理の中断をパーサに指示
95      */
96     void pmdIKInfo(int boneId, int targetId, int depth, float weight)
97             throws MmdFormatException;
98
99     /**
100      * IKチェイン要素の通知を受け取る。
101      * {@link #IK_LIST}ループの下位{@link #IKCHAIN_LIST}ループの構成要素。
102      * @param childId IK影響下ボーンID
103      * @throws MmdFormatException 不正フォーマットによる
104      * パース処理の中断をパーサに指示
105      */
106     void pmdIKChainInfo(int childId)
107             throws MmdFormatException;
108
109     /**
110      * ボーングループ名定義の通知を受け取る。
111      * {@link #BONEGROUP_LIST}ループの構成要素。
112      * @param groupName ボーングループ名。末尾のLF(0x0a)は削除される。
113      * @throws MmdFormatException 不正フォーマットによる
114      * パース処理の中断をパーサに指示
115      */
116     void pmdBoneGroupInfo(String groupName) throws MmdFormatException;
117
118     /**
119      * ボーングループ内訳の通知を受け取る。
120      * {@link #GROUPEDBONE_LIST}ループの構成要素。
121      * @param boneId グループに所属するボーンのID
122      * @param groupId ボーンが所属するボーングループIDに1を足した数
123      * @throws MmdFormatException 不正フォーマットによる
124      * パース処理の中断をパーサに指示
125      */
126     void pmdGroupedBoneInfo(int boneId, int groupId)
127             throws MmdFormatException;
128
129 }