FineKernelToolKit  2.9.0
 全て クラス ネームスペース ファイル 関数 変数 型定義 列挙型 列挙型の値 フレンド マクロ定義 ページ
MotionCharactor.h
説明を見る。
1 /****************************************************************************
2  *
3  * Copyright (c) 1999-2014, Fine Kernel Project, All rights reserved.
4  *
5  * Redistribution and use in source and binary forms,
6  * with or without modification, are permitted provided that the
7  * following conditions are met:
8  *
9  * - Redistributions of source code must retain the above
10  * copyright notice, this list of conditions and the
11  * following disclaimer.
12  *
13  * - Redistributions in binary form must reproduce the above
14  * copyright notice, this list of conditions and the
15  * following disclaimer in the documentation and/or
16  * other materials provided with the distribution.
17  *
18  * - Neither the name of the copyright holders nor the names
19  * of its contributors may be used to endorse or promote
20  * products derived from this software without specific
21  * prior written permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
26  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
27  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
28  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
29  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
30  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
32  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
33  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34  * POSSIBILITY OF SUCH DAMAGE.
35  *
36  ****************************************************************************/
37 /****************************************************************************
38  *
39  * Copyright (c) 1999-2014, Fine Kernel Project, All rights reserved.
40  *
41  * 本ソフトウェアおよびソースコードのライセンスは、基本的に
42  * 「修正 BSD ライセンス」に従います。以下にその詳細を記します。
43  *
44  * ソースコード形式かバイナリ形式か、変更するかしないかを問わず、
45  * 以下の条件を満たす場合に限り、再頒布および使用が許可されます。
46  *
47  * - ソースコードを再頒布する場合、上記の著作権表示、本条件一覧、
48  * および下記免責条項を含めること。
49  *
50  * - バイナリ形式で再頒布する場合、頒布物に付属のドキュメント等の
51  * 資料に、上記の著作権表示、本条件一覧、および下記免責条項を
52  * 含めること。
53  *
54  * - 書面による特別の許可なしに、本ソフトウェアから派生した製品の
55  * 宣伝または販売促進に、本ソフトウェアの著作権者の名前または
56  * コントリビューターの名前を使用してはならない。
57  *
58  * 本ソフトウェアは、著作権者およびコントリビューターによって「現
59  * 状のまま」提供されており、明示黙示を問わず、商業的な使用可能性、
60  * および特定の目的に対する適合性に関す暗黙の保証も含め、またそれ
61  * に限定されない、いかなる保証もないものとします。著作権者もコン
62  * トリビューターも、事由のいかんを問わず、損害発生の原因いかんを
63  * 問わず、かつ責任の根拠が契約であるか厳格責任であるか(過失その
64  * 他の)不法行為であるかを問わず、仮にそのような損害が発生する可
65  * 能性を知らされていたとしても、本ソフトウェアの使用によって発生
66  * した(代替品または代用サービスの調達、使用の喪失、データの喪失、
67  * 利益の喪失、業務の中断も含め、またそれに限定されない)直接損害、
68  * 間接損害、偶発的な損害、特別損害、懲罰的損害、または結果損害に
69  * ついて、一切責任を負わないものとします。
70  *
71  ****************************************************************************/
72 #ifndef __FK_MOTIONCHARACTOR_HEADER__
73 #define __FK_MOTIONCHARACTOR_HEADER__
74 
75 #include <FK/Shape.h>
76 #include <FK/IFSTexture.h>
77 #include <FK/Scene.h>
78 #include <FK/MotionData.H>
79 #include <map>
80 
82 
113 private:
114  std::vector<fk_Model *> jointModel;
115  std::vector<fk_Shape *> mesh;
116  std::vector<fk_Model *> objModel;
117 
118  std::vector<fk_Material> matPalette;
119  std::vector<int> matTable;
120  std::vector<fk_Image *> texImage;
121  std::vector<std::string> texName;
122  std::vector<int> texTable;
123 
124  std::string mqoName;
125  int objNum;
126  std::vector<std::string> objName;
127  std::map<int, int> parentTable;
128  bool parentConnect;
129 
130  std::vector<std::vector<fk_PerformerMotion> > keyFrameData;
131  std::vector<int> nowFrame, maxFrame;
132 
133  std::vector<bool> visibleInfo;
134  fk_DrawMode draw_mode;
135 
136  int prevPlayMotionID, loopCnt;
137 
138  fk_Model absParent;
139 
140  typedef std::map<int, int>::iterator parentIte;
141 
142  void init(void);
143  bool EnumObjectName(const std::string &);
144 
145  // オイラー角版
146  bool LoadMotionDataEuler(const std::string &);
147  // スケール対応版
148  bool LoadMotionDataEulerScale(const std::string &);
149 
150  static std::map<std::string, fk_Shape *> shapeCache;
151  static std::map<std::string, fk_Image *> imageCache;
152  static std::map<fk_BaseObject *, int> countCache;
153  static std::map<fk_BaseObject *, std::string> reverseCache;
154 
155 public:
157  fk_Performer(void);
159  ~fk_Performer(void);
160 
162 
170  bool cloneCharactor(fk_Performer *perf);
171 
173 
174 
176 
184  bool loadObjectData(const std::string &filename);
185 
187 
195  bool loadJointData(const std::string &filename);
196 
198 
209  bool loadMotionData(const std::string &filename);
210 
212 
214 
215 
217 
225  void entryScene(fk_Scene *scene);
226 
228 
236  void removeScene(fk_Scene *scene);
237 
239 
241 
242 
244 
249  int getObjectNum(void);
250 
252 
264  fk_Model * getBaseModel(void);
265 
267 
282  fk_Model * getObjectModel(int id);
283 
285 
302  fk_Model * getJointModel(int id);
303 
305 
307 
308 
310 
319  int getNowFrame(int id);
320 
322 
331  int getTotalFrame(int id);
332 
334 
345  bool playMotion(int id);
346 
348 
356  void stillMotion(int motionID, int frameID);
357 
359 
367  void setNowFrame(int motionID, int frameID);
368 
370 
378  bool isMotionFinished(int id);
379 
381 
387  int getLoopCount(void);
388 
390 
391 #ifndef FK_DOXYGEN_USER_PROCESS
392  void jointToPoser(void);
393  void setAsCamera(fk_Scene *);
394  void setDrawMode(bool);
395  void setMarkerShape(fk_Shape *);
396 #endif
397 };
398 
400 
401 #endif
bool loadMotionData(const std::string &filename)
FKM モーション読み込み関数
bool playMotion(int id)
モーション再生関数
int getTotalFrame(int id)
モーションのトータルフレーム数取得関数
FK Performer キャラクターランタイムクラス
Definition: MotionCharactor.h:112
bool cloneCharactor(fk_Performer *perf)
キャラクタークローン関数
fk_Performer(void)
コンストラクタ
モデルを生成、管理するクラス
Definition: Model.h:139
fk_Model * getBaseModel(void)
ベースモデル取得関数
bool loadJointData(const std::string &filename)
FKC ジョイント読み込み関数
void entryScene(fk_Scene *scene)
シーン登録関数
形状用基底クラス
Definition: Shape.h:86
シーンを制御するクラス
Definition: Scene.h:109
void setNowFrame(int motionID, int frameID)
姿勢制御無しフレーム頭出し関数
fk_Model * getObjectModel(int id)
オブジェクトモデル取得関数
fk_Model * getJointModel(int id)
ジョイントモデル取得関数
fk_Performer fkut_Performer
Definition: MotionCharactor.h:399
int getLoopCount(void)
モーションのループ回数取得関数
bool loadObjectData(const std::string &filename)
MQO オブジェクト読み込み関数
void stillMotion(int motionID, int frameID)
姿勢制御付きフレーム頭出し関数
int getObjectNum(void)
オブジェクト数取得関数
void removeScene(fk_Scene *scene)
シーン登録解除関数
unsigned int fk_DrawMode
Definition: Model.h:81
int getNowFrame(int id)
モーション再生位置取得関数
~fk_Performer(void)
デストラクタ
bool isMotionFinished(int id)
モーション再生終了状態取得関数