FineKernelToolKit  2.9.0
 全て クラス ネームスペース ファイル 関数 変数 型定義 列挙型 列挙型の値 フレンド マクロ定義 ページ
IndexFace.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_INDEXFACE_HEADER__
73 #define __FK_INDEXFACE_HEADER__
74 
75 #include <FK/ParserBase.H>
76 #include <FK/ParserData.h>
77 #include <list>
78 
79 class fk_D3DXAnimation;
80 class fk_BVHMotion;
81 class fk_Solid;
82 
84 enum fk_IFType {
89 };
90 
91 
93 
146 
147  friend class fk_PointDraw;
148  friend class fk_LineDraw;
149  friend class fk_FaceDraw;
150  friend class fk_TextureDraw;
151 
152  private:
153 
154  fk_Palette localPalette;
155  std::vector<fk_FVector> pos;
156  std::vector<fk_FVector> timeOrgPos;
157  std::vector<fk_FVector> vNorm;
158  std::vector<fk_FVector> pNorm;
159  std::vector<int> ifs;
160  std::vector<int> edgeSet;
161  std::vector< std::vector<int> > loopStack;
162  bool modifyFlg;
163  std::vector<char> vNormFlg;
164  std::vector<char> pNormFlg;
165  std::vector<int> modifyList;
166  std::vector<int> colorID;
167  bool colorFlg;
168  fk_D3DXAnimation *anim;
169 
170  int posSize;
171  int faceSize;
172  fk_IFType type;
173 
174  bool cloneFlg;
175  std::list<fk_IndexFaceSet *> cloneList;
176  fk_IndexFaceSet *orgIFS;
177 
178  void InitPNorm(void);
179  void InitVNorm(void);
180  void ModifyPNorm(void);
181  void ModifyVNorm(void);
182  void MakePNorm(int);
183 
184  void ClearPFlg(void);
185  void ClearVFlg(void);
186 
187  fk_Vector CalcTriNorm(int *);
188  fk_Vector CalcPolyNorm(int, int *);
189  void MakeLoopTable(void);
190  void MakeEdgeSet(void);
191 
192  bool Init(int, int, int);
193  void Init(void);
194 
195  void DeleteCloneLink(fk_IndexFaceSet *);
196 
197  public:
198 
200  fk_IndexFaceSet(void);
201 
203  virtual ~fk_IndexFaceSet();
204 
205 
207 
213  void cloneShape(fk_IndexFaceSet *ifs);
214 
216 
217 
225  bool readSMFFile(std::string fileName);
226 
228 
260  bool readVRMLFile(std::string fileName,
261  bool materialFlg = true,
262  bool solidFlg = true);
263 
265 
288  bool readSTLFile(std::string fileName,
289  bool solidFlg = true,
290  double tolerance = 1.0e-08);
291 
293 
300  bool readHRCFile(std::string fileName);
301 
303 
316  bool readRDSFile(std::string fileName,
317  bool solidFlg = true);
318 
320 
332  bool readDXFFile(std::string fileName,
333  bool solidFlg = true);
334 
336 
371  bool readMQOFile(std::string fileName,
372  std::string objName,
373  bool solidFlg = true,
374  bool contFlg = true,
375  bool materialFlg = false);
376 
378 
423  bool readMQOFile(std::string fileName,
424  std::string objName,
425  int materialID,
426  bool solidFlg = true,
427  bool contFlg = true,
428  bool materialFlg = false);
429 
431 
473  bool readMQOData(unsigned char *buffer,
474  std::string objName,
475  bool solidFlg = true,
476  bool contFlg = true,
477  bool materialFlg = false);
478 
480 
528  bool readMQOData(unsigned char *buffer,
529  std::string objName,
530  int materialID,
531  bool solidFlg = true,
532  bool contFlg = true,
533  bool materialFlg = false);
534 
536 
564  bool readD3DXFile(std::string fileName,
565  std::string objName,
566  bool solidFlg = true);
567 
569 
603  bool readD3DXFile(std::string fileName,
604  std::string objName,
605  int materialID,
606  bool solidFlg = true);
607 
609 
611 
612 
625  bool writeVRMLFile(std::string fileName,
626  fk_Material *material = NULL,
627  bool triFlg = false);
628 
630 
649  bool writeVRMLFile(std::string fileName,
650  std::vector<double> *time,
651  std::vector<fk_Vector> *pos,
652  fk_Material *material = NULL,
653  bool triFlg = false);
654 
656 
663  bool writeSTLFile(std::string fileName);
664 
666 
676  bool writeDXFFile(std::string fileName,
677  bool triFlg = false);
678 
680 
687  bool writeMQOFile(std::string fileName);
689 
691 
692 
694 
699  int getPosSize(void);
700 
702 
707  int getFaceSize(void);
708 
710 
721  fk_Vector getPosVec(int vertexID);
722 
724 
733  std::vector<int> getFaceData(int faceID);
734 
736 
750  int getFaceData(int faceID, int vertexNum);
751 
753 
757  fk_IFType getFaceType(void);
758 
760 
771  fk_Vector getPNorm(int faceID, int order = 0);
772 
774 
785  fk_Vector getVNorm(int vertexID, int order = 0);
786 
788 
800  int getElemMaterialID(int faceID);
802 
804 
805 
807 
822  bool moveVPosition(int vertexID,
823  const fk_Vector &pos,
824  int order = 0);
825 
827 
844  bool moveVPosition(int vertexID,
845  double x, double y, double z,
846  int order = 0);
847 
849 
865  bool moveVPosition(int vertexID,
866  double *array,
867  int order = 0);
868 
870 
892  void makeIFSet(int faceNum,
893  int polyNum,
894  int *IFSet,
895  int vertexNum,
896  fk_Vector *posArray,
897  int order = 0);
898 
900 
923  bool setPNorm(int faceID,
924  const fk_Vector &norm,
925  int order = 0);
926 
928 
951  bool setVNorm(int vertexID,
952  const fk_Vector &norm,
953  int order = 0);
954 
956 
969  bool setElemMaterialID(int faceID,
970  int materialID);
971 
973 
988  void flush(void);
989 
991 
993 
994 
1018  void makeBlock(double x, double y, double z);
1019 
1021 
1033  void setBlockSize(double x, double y, double z);
1034 
1036 
1050  void setBlockSize(double length, fk_Axis axis);
1051 
1053 
1063  void setBlockScale(double scale);
1064 
1066 
1080  void setBlockScale(double scale, fk_Axis axis);
1081 
1083 
1095  void setBlockScale(double x, double y, double z);
1097 
1099 
1100 
1120  void makeCircle(int div, double rad);
1121 
1123 
1133  void setCircleRadius(double rad);
1134 
1136 
1146  void setCircleDivide(int div);
1147 
1149 
1159  void setCircleScale(double scale);
1161 
1163 
1164 
1183  void makeSphere(int div, double rad);
1184 
1186 
1196  void setSphereRadius(double rad);
1197 
1199 
1209  void setSphereDivide(int div);
1210 
1212 
1222  void setSphereScale(double scale);
1224 
1226 
1227 
1248  void makePrism(int div, double top,
1249  double bottom, double height);
1250 
1252 
1262  void setPrismDivide(int div);
1263 
1265 
1275  void setPrismTopRadius(double top);
1276 
1278 
1288  void setPrismBottomRadius(double bottom);
1289 
1291 
1301  void setPrismHeight(double height);
1303 
1305 
1306 
1326  void makeCone(int div, double rad, double height);
1327 
1329 
1339  void setConeDivide(int div);
1340 
1342 
1352  void setConeRadius(double rad);
1353 
1355 
1365  void setConeHeight(double height);
1367 
1369 
1370 
1372 
1382  void putSolid(fk_Solid *solid);
1383 
1385 
1394  void setAnimationTime(double time);
1395 
1397 
1404  void setBVHMotion(fk_BVHMotion *bvh);
1406 
1407 #ifndef FK_DOXYGEN_USER_PROCESS
1408 
1409  bool MakeMesh(std::vector<fk_Vector> *,
1410  std::vector< std::vector<int> > *,
1411  std::vector<int> * = NULL,
1412  bool = true);
1413 
1414  fk_D3DXAnimation * GetAnimation(void);
1415 
1416  void PosPrint(std::string);
1417 
1418 #endif
1419 
1420 };
1421 
1422 #endif // !__FK_INDEXFACE_HEADER__
void makePrism(int div, double top, double bottom, double height)
正多角柱(円柱)形状生成関数
void setPrismDivide(int div)
正多角柱(円柱)角数設定関数
bool readMQOData(unsigned char *buffer, std::string objName, bool solidFlg=true, bool contFlg=true, bool materialFlg=false)
MQOデータ入力関数1.
bool readHRCFile(std::string fileName)
HRCファイル入力関数
bool writeSTLFile(std::string fileName)
STL ファイル出力関数
fk_IFType getFaceType(void)
面タイプ取得関数
マテリアルパレットを管理するクラス
Definition: Palette.h:95
int getElemMaterialID(int faceID)
マテリアルID取得関数
bool readRDSFile(std::string fileName, bool solidFlg=true)
RDSファイル入力関数
fk_Vector getPNorm(int faceID, int order=0)
面法線ベクトル取得関数
void makeBlock(double x, double y, double z)
直方体生成関数
std::vector< int > getFaceData(int faceID)
頂点 ID 配列参照関数
bool readMQOFile(std::string fileName, std::string objName, bool solidFlg=true, bool contFlg=true, bool materialFlg=false)
MQOファイル入力関数1.
fk_IFType
インデックスフェースセットの内部データタイプを表す列挙型
Definition: IndexFace.h:84
friend class fk_PointDraw
Definition: IndexFace.h:147
3次元ベクトルを管理するクラス
Definition: Vector.h:110
void setSphereRadius(double rad)
球形状半径設定関数
fk_Axis
座標軸を表す列挙型
Definition: Vector.h:82
void flush(void)
法線ベクトル強制計算関数
bool setVNorm(int vertexID, const fk_Vector &norm, int order=0)
頂点法線ベクトル設定関数
bool writeVRMLFile(std::string fileName, fk_Material *material=NULL, bool triFlg=false)
VRML ファイル出力関数1.
未定義
Definition: IndexFace.h:85
virtual ~fk_IndexFaceSet()
デストラクタ
void makeIFSet(int faceNum, int polyNum, int *IFSet, int vertexNum, fk_Vector *posArray, int order=0)
任意形状生成関数
bool readD3DXFile(std::string fileName, std::string objName, bool solidFlg=true)
DirectX (D3DX) ファイル入力関数1.
friend class fk_FaceDraw
Definition: IndexFace.h:149
インデックスフェースセットによる任意形状を生成、管理するクラス
Definition: IndexFace.h:145
bool readDXFFile(std::string fileName, bool solidFlg=true)
DXFファイル入力関数
ファイル入出力機能用抽象クラス
Definition: ParserData.h:84
bool setElemMaterialID(int faceID, int materialID)
マテリアルID設定関数
bool moveVPosition(int vertexID, const fk_Vector &pos, int order=0)
頂点移動関数1
void setCircleScale(double scale)
円形状拡大縮小関数
bool readSTLFile(std::string fileName, bool solidFlg=true, double tolerance=1.0e-08)
STL ファイル入力関数
void cloneShape(fk_IndexFaceSet *ifs)
形状コピー関数
fk_IndexFaceSet(void)
コンストラクタ
void setConeRadius(double rad)
正多角錐(円錐)底面半径設定関数
friend class fk_LineDraw
Definition: IndexFace.h:148
void setPrismHeight(double height)
正多角柱(円柱)高さ設定関数
void setBlockScale(double scale)
直方体全体拡大縮小関数
3角形集合
Definition: IndexFace.h:86
fk_Vector getPosVec(int vertexID)
頂点位置ベクトル参照関数
bool readSMFFile(std::string fileName)
SMFファイル入力関数
bool writeMQOFile(std::string fileName)
MQO ファイル出力関数
bool setPNorm(int faceID, const fk_Vector &norm, int order=0)
面法線ベクトル設定関数
4角形集合
Definition: IndexFace.h:87
半稜線構造 (Half-Edge Structure) による任意形状を生成、管理するクラス
Definition: Solid.h:137
マテリアル(質感)を管理するクラス
Definition: Material.h:311
void setSphereDivide(int div)
球形状分割数設定関数
void setCircleRadius(double rad)
円形状半径設定関数
friend class fk_TextureDraw
Definition: IndexFace.h:150
void setPrismTopRadius(double top)
正多角柱(円柱)上面半径設定関数
void makeCircle(int div, double rad)
円形状生成関数
任意多角形集合
Definition: IndexFace.h:88
void setCircleDivide(int div)
円形状分割数設定関数
fk_Vector getVNorm(int vertexID, int order=0)
頂点法線ベクトル取得関数
void setBlockSize(double x, double y, double z)
直方体辺長変更関数
bool readVRMLFile(std::string fileName, bool materialFlg=true, bool solidFlg=true)
VRML ファイル入力関数
void setSphereScale(double scale)
球形状拡大縮小関数
void setBVHMotion(fk_BVHMotion *bvh)
BVHデータ設定関数
bool writeDXFFile(std::string fileName, bool triFlg=false)
DXF ファイル出力関数
void setPrismBottomRadius(double bottom)
正多角柱(円柱)角数設定関数
int getPosSize(void)
頂点数参照関数
void setAnimationTime(double time)
アニメーション時間設定関数
BVH 形式のモーションデータを読み込み、保持するクラス
Definition: BVHMotion.h:92
void putSolid(fk_Solid *solid)
fk_Solid 出力関数
void setConeDivide(int div)
正多角錐(円錐)角数設定関数
int getFaceSize(void)
面数参照関数
void makeSphere(int div, double rad)
球形状生成関数
void setConeHeight(double height)
正多角錐(円錐)高さ設定関数
void makeCone(int div, double rad, double height)
正多角錐(円錐)形状生成関数