OSDN Git Service

65fcf8a582c2ea24a50f8602c703a4274e75739e
[mikutoga/TogaGem.git] / src / main / java / jp / sfjp / mikutoga / pmd / parser / PmdRigidHandler.java
1 /*
2  * PMD rigid 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  * <p>MMDでの剛体力学では「Bullet Physics Library」が用いられる。
17  * @see <a href="http://www.bulletphysics.org/">Bullet Physics Library</a>
18  */
19 public interface PmdRigidHandler extends LoopHandler {
20
21     /** 剛体情報抽出ループ。 */
22     ParseStage RIGID_LIST = new ParseStage();
23
24     /**
25      * 剛体名の通知を受け取る。
26      * <p>{@link #RIGID_LIST}ループの構成要素。
27      * @param rigidName 剛体名
28      * @throws MmdFormatException 不正フォーマットによる
29      * パース処理の中断をパーサに指示
30      */
31     void pmdRigidName(String rigidName)
32         throws MmdFormatException;
33
34     /**
35      * 剛体基本情報の通知を受け取る。
36      * <p>{@link #RIGID_LIST}ループの構成要素。
37      * @param rigidGroupId 剛体グループ番号から1引いた数。(0-15)
38      * @param linkedBoneId 接続先ボーンID。
39      * [ 0x0000 - 0xfffe ] に収まらない場合は接続先ボーン無し。
40      * @throws MmdFormatException 不正フォーマットによる
41      * パース処理の中断をパーサに指示
42      */
43     void pmdRigidInfo(int rigidGroupId,
44                         int linkedBoneId)
45         throws MmdFormatException;
46
47     /**
48      * 剛体形状の通知を受け取る。
49      * <p>{@link #RIGID_LIST}ループの構成要素。
50      * @param shapeType 形状種別。
51      * <ul>
52      * <li>0x00:球
53      * <li>0x01:箱
54      * <li>0x02:カプセル
55      * </ul>
56      * @param width 球orカプセル半径。箱の幅。
57      * @param height 箱orカプセルの高さ
58      * @param depth 箱の奥行き
59      * @throws MmdFormatException 不正フォーマットによる
60      * パース処理の中断をパーサに指示
61      */
62     void pmdRigidShape(byte shapeType,
63                          float width, float height, float depth)
64         throws MmdFormatException;
65
66     /**
67      * 剛体位置の通知を受け取る。
68      * <p>{@link #RIGID_LIST}ループの構成要素。
69      * @param posX X座標
70      * @param posY Y座標
71      * @param posZ Z座標
72      * @throws MmdFormatException 不正フォーマットによる
73      * パース処理の中断をパーサに指示
74      */
75     void pmdRigidPosition(float posX, float posY, float posZ)
76         throws MmdFormatException;
77
78     /**
79      * 剛体姿勢の通知を受け取る。
80      * <p>{@link #RIGID_LIST}ループの構成要素。
81      * @param radX X軸回転量(radian)
82      * @param radY Y軸回転量(radian)
83      * @param radZ Z軸回転量(radian)
84      * @throws MmdFormatException 不正フォーマットによる
85      * パース処理の中断をパーサに指示
86      */
87     void pmdRigidRotation(float radX, float radY, float radZ)
88         throws MmdFormatException;
89
90     /**
91      * 剛体物理系数の通知を受け取る。
92      * <p>{@link #RIGID_LIST}ループの構成要素。
93      * @param mass 質量
94      * @param dampingPos 移動減衰率
95      * @param dampingRot 回転減衰率
96      * @param restitution 反発力
97      * @param friction 摩擦力
98      * @throws MmdFormatException 不正フォーマットによる
99      * パース処理の中断をパーサに指示
100      */
101     void pmdRigidPhysics(float mass,
102                            float dampingPos, float dampingRot,
103                            float restitution, float friction )
104         throws MmdFormatException;
105
106     /**
107      * 剛体の振る舞い情報の通知を受け取る。
108      * <p>{@link #RIGID_LIST}ループの構成要素。
109      * @param behaveType 剛体タイプ。
110      * <ul>
111      * <li>0:ボーン追従
112      * <li>1:物理演算
113      * <li>2:物理演算+ボーン位置合わせ
114      * </ul>
115      * @param collisionMap 非衝突剛体グループビットマップ。
116      * <p>
117      * (衝突グループ番号-1)位置のビット位置は1に、
118      * (非衝突グループ番号-1)位置のビット位置は0になる。
119      * 例)グループ1と8のみが非衝突指定の場合、0xff7eになる。
120      * @throws MmdFormatException 不正フォーマットによる
121      * パース処理の中断をパーサに指示
122      */
123     void pmdRigidBehavior(byte behaveType, short collisionMap)
124         throws MmdFormatException;
125
126 }