OSDN Git Service

f35256ec0e9c395f2ff603403a1fa23401554b52
[mikutoga/TogaGem.git] / src / main / java / jp / sfjp / 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.sfjp.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      *
38      * <p>{@link #BONE_LIST}ループの構成要素。
39      *
40      * @param boneName ボーン名
41      * @param boneKind ボーン種別。
42      * <ul>
43      * <li>0:回転
44      * <li>1:回転/移動
45      * <li>2:IK
46      * <li>3:不明
47      * <li>4:IK影響下(回転)
48      * <li>5:回転影響下
49      * <li>6:IK接続先
50      * <li>7:非表示
51      * <li>8:捩り
52      * <li>9:回転連動
53      * </ul>
54      * ※8,9はMMD4.0から?
55      * @throws MmdFormatException 不正フォーマットによる
56      * パース処理の中断をパーサに指示
57      */
58     void pmdBoneInfo(String boneName, byte boneKind)
59             throws MmdFormatException;
60
61     /**
62      * ボーン間接続情報の通知を受け取る。
63      *
64      * <p>{@link #BONE_LIST}ループの構成要素。
65      *
66      * @param parentId 親(前)ボーンID。無い場合は0xffff。
67      * @param tailId 子(次)ボーンID。末端の場合は0。
68      * 捩りボーンの場合は軸方向のボーンID、
69      * 回転連動ボーンの場合は影響元ボーンID
70      * @param ikId 影響IKボーンID。未指定の場合は0。
71      * ※回転連動では影響度(0-100)、負や100以上もOK!
72      * @throws MmdFormatException 不正フォーマットによる
73      * パース処理の中断をパーサに指示
74      */
75     void pmdBoneLink(int parentId, int tailId, int ikId)
76             throws MmdFormatException;
77
78     /**
79      * ボーン位置情報の通知を受け取る。
80      *
81      * <p>{@link #BONE_LIST}ループの構成要素。
82      *
83      * @param xPos X座標
84      * @param yPos Y座標
85      * @param zPos Z座標
86      * @throws MmdFormatException 不正フォーマットによる
87      * パース処理の中断をパーサに指示
88      */
89     void pmdBonePosition(float xPos, float yPos, float zPos)
90             throws MmdFormatException;
91
92     /**
93      * IKボーン情報の通知を受け取る。
94      *
95      * <p>{@link #IK_LIST}ループの構成要素。
96      *
97      * @param boneId IKボーンID
98      * @param targetId IKボーンが最初に接続するIK接続先ボーンID
99      * @param depth 再帰演算の深さ
100      * @param weight 制限角度強度
101      * @throws MmdFormatException 不正フォーマットによる
102      * パース処理の中断をパーサに指示
103      */
104     void pmdIKInfo(int boneId, int targetId, int depth, float weight)
105             throws MmdFormatException;
106
107     /**
108      * IKチェイン要素の通知を受け取る。
109      *
110      * <p>{@link #IK_LIST}ループの下位{@link #IKCHAIN_LIST}ループの構成要素。
111      *
112      * @param childId IK影響下ボーンID
113      * @throws MmdFormatException 不正フォーマットによる
114      * パース処理の中断をパーサに指示
115      */
116     void pmdIKChainInfo(int childId)
117             throws MmdFormatException;
118
119     /**
120      * ボーングループ名定義の通知を受け取る。
121      *
122      * <p>{@link #BONEGROUP_LIST}ループの構成要素。
123      *
124      * @param groupName ボーングループ名。末尾のLF(0x0a)は削除される。
125      * @throws MmdFormatException 不正フォーマットによる
126      * パース処理の中断をパーサに指示
127      */
128     void pmdBoneGroupInfo(String groupName) throws MmdFormatException;
129
130     /**
131      * ボーングループ内訳の通知を受け取る。
132      *
133      * <p>{@link #GROUPEDBONE_LIST}ループの構成要素。
134      *
135      * @param boneId グループに所属するボーンのID
136      * @param groupId ボーンが所属するボーングループIDに1を足した数
137      * @throws MmdFormatException 不正フォーマットによる
138      * パース処理の中断をパーサに指示
139      */
140     void pmdGroupedBoneInfo(int boneId, int groupId)
141             throws MmdFormatException;
142
143 }