FineKernelToolKit  2.9.0
 全て クラス ネームスペース ファイル 関数 変数 型定義 列挙型 列挙型の値 フレンド マクロ定義 ページ
Model.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_MODEL_HEADER__
73 #define __FK_MODEL_HEADER__
74 
75 #include <FK/MatAdmin.h>
76 #include <FK/Palette.h>
77 #include <FK/Angle.h>
78 
79 class fk_Material;
80 class fk_Shape;
82 
83 typedef unsigned int fk_DrawMode;
84 
85 const fk_DrawMode FK_NONEMODE = 0x0000;
86 const fk_DrawMode FK_POINTMODE = 0x0001;
87 const fk_DrawMode FK_LINEMODE = 0x0002;
88 const fk_DrawMode FK_POLYMODE = 0x0004;
91 const fk_DrawMode FK_TEXTUREMODE = 0x0020;
92 
93 #ifndef FK_DOXYGEN_USER_PROCESS
94 
95 enum fk_BoundaryMode {
96  FK_SPHERE_B,
97  FK_BOX_B,
98  FK_CAPSULE_B
99 };
100 
101 #endif
102 
104 
139 class fk_Model : public fk_MatrixAdmin {
140 
141  private:
142  fk_Material *material;
143  fk_Color *pointColor;
144  fk_Color *lineColor;
145  fk_Shape *shape;
146  fk_Model *parent;
147  fk_TreeData *treeData;
148  bool materialFlag;
149  fk_DrawMode drawMode;
150  fk_MaterialMode materialMode;
151  double drawSize;
152  double drawWidth;
153  bool pickFlag;
154  bool smoothFlag;
155  bool reverseFlag;
156  bool treeFlag;
157  unsigned int _modelID;
158 
159  fk_BoundaryMode boundaryMode;
160 
161  fk_HVector snapPos;
162  fk_HVector snapInhPos;
163  fk_Angle snapAngle;
164  bool snapFlag;
165 
166  double sbRadius;
167 
168  void EntryTree(void);
169  void DeleteTree(void);
170  fk_TreeData * GetTreeData(fk_Model *);
171 
172  public:
173 
175 
181  fk_Model(fk_Shape *shape = (fk_Shape *)NULL);
182 
184  virtual ~fk_Model();
185 
186 
188 
195  unsigned int getID(void) const;
196 
198 
199 
201 
212  void setShape(fk_Shape *shape);
213 
215 
221  fk_Shape * getShape(void) const;
222 
224 
226 
227 
245  void setMaterial(const fk_Material &mat);
246 
248 
256  void setPointColor(fk_Color *col);
257 
259 
269  void setPointColor(float r, float g, float b);
270 
272 
280  void setLineColor(fk_Color *col);
281 
283 
293  void setLineColor(float r, float g, float b);
294 
296 
301  void deleteMaterial(void);
302 
304 
309  void deletePointColor(void);
310 
312 
317  void deleteLineColor(void);
319 
321 
322 
331  fk_Material * getMaterial(void);
332 
334 
343  fk_Material * getInhMaterial(void);
344 
346 
354  fk_Color * getPointColor(void);
355 
357 
366  fk_Color * getInhPointColor(void);
367 
369 
377  fk_Color * getLineColor(void);
378 
380 
389  fk_Color * getInhLineColor(void);
391 
393 
394 
396 
402  void setSize(const double size);
403 
405 
411  void setWidth(const double width);
412 
414 
419  double getSize(void) const;
420 
422 
427  double getWidth(void) const;
429 
431 
432 
434 
457  void setDrawMode(const fk_DrawMode mode);
458 
460 
467  fk_DrawMode getDrawMode(void) const;
468 
470 
496  void setMaterialMode(const fk_MaterialMode mode);
497 
499 
506  fk_MaterialMode getMaterialMode(void) const;
507 
509 
521  void setPickMode(const bool mode);
522 
524 
531  bool getPickMode(void) const;
532 
534 
543  void setSmoothMode(const bool mode);
544 
546 
553  bool getSmoothMode(void) const;
554 
556 
564  void setReverseDrawMode(const bool mode);
565 
567 
574  bool getReverseDrawMode(void) const;
576 
578 
579 
581 
594  fk_Matrix getInhMatrix(void) const;
595 
597 
611  fk_Matrix getInhInvMatrix(void) const;
612 
614 
629  fk_OrthoMatrix getInhBaseMatrix(void) const;
630 
632 
648 
650 
658  fk_Vector getInhPosition(void) const;
659 
661 
669  fk_Vector getInhVec(void) const;
670 
672 
680  fk_Vector getInhUpvec(void) const;
681 
682 #ifndef FK_DOXYGEN_USER_PROCESS
683  fk_Vector getInhUpVec(void) const;
684 #endif
685 
687 
696  fk_Angle getInhAngle(void) const;
698 
700 
701 
703 
721  bool setParent(fk_Model *model, bool setMode = false);
722 
724 
736  void deleteParent(bool setMode = false);
737 
739 
747  fk_Model * getParent(void) const;
748 
750 
768  bool entryChild(fk_Model *model, bool setMode = false);
769 
771 
788  bool deleteChild(fk_Model *model, bool setMode = false);
789 
791 
803  void deleteChildren(bool setMode = false);
804 
806 
834  fk_Model * foreachChild(fk_Model *model);
835 
837 
839 
840 
842 
848  void snapShot(void);
849 
851 
856  bool restore(void);
857 
859 
871  bool restore(double t);
872 
874 
876 
877 
879 
892  virtual void preShader(void) {};
893 
895 
908  virtual void postShader(void) {};
910 
911 #ifndef FK_DOXYGEN_USER_PROCESS
912 
913  void setBoundaryMode(fk_BoundaryMode);
914  fk_BoundaryMode getBoundaryMode(void);
915  void setSBRadius(double);
916  double getSBRadius(void);
917  bool isInterference(fk_Model *);
918  bool isCollision(fk_Model *);
919  double getCollisionTime(fk_Model *);
920 
921 
922  // rita_ext: カスタムテクスチャ描画用エントリポイント
923  virtual void connectShader(unsigned int) {};
924 
925  void TreePrint(void);
926 #endif
927 };
928 
929 #endif // !__FK_MODEL_HEADER__
fk_MaterialMode getMaterialMode(void) const
マテリアルモード参照関数
fk_Color * getPointColor(void)
頂点色参照関数
const fk_DrawMode FK_TEXTUREMODE
Definition: Model.h:91
一般4元正方行列を管理するクラス
Definition: Matrix.h:586
bool getSmoothMode(void) const
スムースモード参照関数
fk_Material * getMaterial(void)
マテリアル参照関数
void deleteMaterial(void)
基本マテリアル削除関数
void deleteLineColor(void)
稜線色削除関数
void setShape(fk_Shape *shape)
形状設定関数
virtual void postShader(void)
描画処理事後関数
Definition: Model.h:908
モデルを生成、管理するクラス
Definition: Model.h:139
オイラー角を表すクラス
Definition: Angle.h:90
fk_Matrix getInhMatrix(void) const
継承変換行列取得関数
3次元ベクトルを管理するクラス
Definition: Vector.h:110
void deleteChildren(bool setMode=false)
全子モデル解除関数
void deleteParent(bool setMode=false)
親モデル解除関数
fk_OrthoMatrix getInhInvBaseMatrix(void) const
継承移動・回転要素逆変換行列取得関数
void setMaterial(const fk_Material &mat)
マテリアル設定関数
bool entryChild(fk_Model *model, bool setMode=false)
子モデル設定関数
bool restore(void)
位置・姿勢復元関数
形状用基底クラス
Definition: Shape.h:86
unsigned int getID(void) const
ID参照関数
RGB色を管理するクラス
Definition: Material.h:92
virtual void preShader(void)
描画処理事前関数
Definition: Model.h:892
fk_Color * getInhPointColor(void)
継承頂点色参照関数
void setSize(const double size)
頂点描画サイズ設定関数
void setPointColor(fk_Color *col)
頂点色設定関数1
const fk_DrawMode FK_FRONTBACK_POLYMODE
Definition: Model.h:90
const fk_DrawMode FK_POINTMODE
Definition: Model.h:86
const fk_DrawMode FK_LINEMODE
Definition: Model.h:87
4次元ベクトルを管理するクラス
Definition: Vector.h:542
4元正方直交行列を管理するクラス
Definition: Matrix.h:114
fk_Color * getInhLineColor(void)
継承稜線色参照関数
const fk_DrawMode FK_POLYMODE
Definition: Model.h:88
bool getPickMode(void) const
ピックモード参照関数
void setWidth(const double width)
稜線描画幅設定関数
fk_Model * getParent(void) const
親モデル参照関数
const fk_DrawMode FK_BACK_POLYMODE
Definition: Model.h:89
fk_DrawMode getDrawMode(void) const
描画モード参照関数
fk_Shape * getShape(void) const
形状参照関数
fk_Model(fk_Shape *shape=(fk_Shape *) NULL)
コンストラクタ
void setLineColor(fk_Color *col)
稜線色設定関数1
void setSmoothMode(const bool mode)
スムースモード設定関数
木構造用ノードデータクラス
Definition: Tree.h:128
bool setParent(fk_Model *model, bool setMode=false)
親モデル設定関数
const fk_DrawMode FK_NONEMODE
Definition: Model.h:85
fk_Vector getInhUpvec(void) const
継承アップベクトル参照関数
マテリアル(質感)を管理するクラス
Definition: Material.h:311
void setReverseDrawMode(const bool mode)
描画順序制御関数
fk_OrthoMatrix getInhBaseMatrix(void) const
継承移動・回転要素変換行列取得関数
fk_Matrix getInhInvMatrix(void) const
継承逆変換行列取得関数
bool getReverseDrawMode(void) const
描画順序参照関数
double getSize(void) const
頂点描画サイズ参照関数
void snapShot(void)
位置・姿勢保存関数
fk_Material * getInhMaterial(void)
継承マテリアル参照関数
unsigned char fk_MaterialMode
マテリアルモード型
Definition: Palette.h:79
void setDrawMode(const fk_DrawMode mode)
描画モード設定関数
fk_Vector getInhVec(void) const
継承方向ベクトル参照関数
fk_Vector getInhPosition(void) const
継承位置ベクトル参照関数
void setPickMode(const bool mode)
ピックモード設定関数
void deletePointColor(void)
頂点色削除関数
fk_Model * foreachChild(fk_Model *model)
子モデル逐次参照関数
double getWidth(void) const
稜線描画幅設定関数
モデルの位置や姿勢を管理するクラス
Definition: MatAdmin.h:121
bool deleteChild(fk_Model *model, bool setMode=false)
子モデル解除関数
unsigned int fk_DrawMode
Definition: Model.h:81
void setMaterialMode(const fk_MaterialMode mode)
マテリアルモード設定関数
virtual ~fk_Model()
デストラクタ
fk_Color * getLineColor(void)
稜線色参照関数
fk_Angle getInhAngle(void) const
継承オイラー角参照関数