OSDN Git Service

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