OSDN Git Service

2ae50480ea816cd5a1fae6989dbfbf52720828ac
[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     public static final ParseStage BONE_LIST = new ParseStage();
22
23     /** IKリスト抽出ループ。 */
24     public static final ParseStage IK_LIST = new ParseStage();
25
26     /** IKチェーンリスト抽出ループ。 */
27     public static final ParseStage IKCHAIN_LIST = new ParseStage();
28
29     /** ボーングループ名抽出ループ。 */
30     public static final ParseStage BONEGROUP_LIST = new ParseStage();
31
32     /** ボーングループ内訳抽出ループ。 */
33     public static final 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     public abstract 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     public abstract 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     public abstract 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     public abstract void pmdIKInfo(
105             int boneId, int targetId,
106             int depth, float weight)
107             throws MmdFormatException;
108
109     /**
110      * IKチェイン要素の通知を受け取る。
111      *
112      * <p>{@link #IK_LIST}ループの下位{@link #IKCHAIN_LIST}ループの構成要素。
113      *
114      * @param childId IK影響下ボーンID
115      * @throws MmdFormatException
116      *     不正フォーマットによるパース処理の中断をパーサに指示
117      */
118     public abstract void pmdIKChainInfo(int childId)
119             throws MmdFormatException;
120
121     /**
122      * ボーングループ名定義の通知を受け取る。
123      *
124      * <p>{@link #BONEGROUP_LIST}ループの構成要素。
125      *
126      * @param groupName ボーングループ名。末尾のLF(0x0a)は削除される。
127      * @throws MmdFormatException
128      *     不正フォーマットによるパース処理の中断をパーサに指示
129      */
130     public abstract void pmdBoneGroupInfo(String groupName)
131             throws MmdFormatException;
132
133     /**
134      * ボーングループ内訳の通知を受け取る。
135      *
136      * <p>{@link #GROUPEDBONE_LIST}ループの構成要素。
137      *
138      * @param boneId グループに所属するボーンのID
139      * @param groupId ボーンが所属するボーングループIDに1を足した数
140      * @throws MmdFormatException
141      *     不正フォーマットによるパース処理の中断をパーサに指示
142      */
143     public abstract void pmdGroupedBoneInfo(int boneId, int groupId)
144             throws MmdFormatException;
145
146 }