FineKernelToolKit 4.2.13
読み取り中…
検索中…
一致する文字列を見つけられません
IndexFace.h
[詳解]
1#if !defined(__FK_INDEXFACE_HEADER__)
2#define __FK_INDEXFACE_HEADER__
3
4#include <FK/FVecArray.h>
5#include <FK/ParserBase.hh>
6#include <FK/ParserData.h>
7#include <list>
8
9namespace FK {
10
11 class fk_D3DXAnimation;
12 class fk_BVHBase;
13 class fk_Solid;
14
16
69
70#if !defined(FK_DOXYGEN_USER_PROCESS)
71 class Member {
72 public:
73 fk_FVecArray vertexPosition;
74 fk_FVecArray timeOrgPosition;
75 fk_FVecArray vertexNormal;
76 fk_FVecArray faceNormal;
77 std::vector<GLuint> edgeIndex;
78 std::vector<GLuint> faceIndex;
79 std::vector< std::vector<int> > loopStack;
80 std::vector<int> modifyList;
81 std::shared_ptr<fk_D3DXAnimation> anim;
82
83 bool cloneFlg;
84 std::list<fk_IndexFaceSet *> cloneList;
85 fk_IndexFaceSet *orgIFS;
86
87 // 編集があった場合に true, ない場合 false
88 bool edgeIndexFlg, faceIndexFlg;
89 std::vector<char> faceNormFlg;
90 std::vector<char> vertexNormFlg;
91
92 GLuint edgeIBO, faceIBO;
93 bool smoothMode;
94
95 Member(void);
96 };
97#endif
98
99 public:
100
103
106
107
109
116
119
121
128 bool readSMFFile(std::string fileName);
129
131
164 bool readVRMLFile(std::string fileName, bool materialFlg = true, bool solidFlg = true);
165
167
190 bool readSTLFile(std::string fileName, bool solidFlg = true, double tolerance = 1.0e-08);
191
193
200 bool readHRCFile(std::string fileName);
201
203
216 bool readRDSFile(std::string fileName, bool solidFlg = true);
217
219
231 bool readDXFFile(std::string fileName, bool solidFlg = true);
232
234
269 bool readMQOFile(std::string fileName,
270 std::string objName,
271 bool solidFlg = true,
272 bool contFlg = true,
273 bool materialFlg = false);
274
276
321 bool readMQOFile(std::string fileName,
322 std::string objName,
323 int materialID,
324 bool solidFlg = true,
325 bool contFlg = true,
326 bool materialFlg = false);
327
329
371 bool readMQOData(unsigned char *buffer,
372 std::string objName,
373 bool solidFlg = true,
374 bool contFlg = true,
375 bool materialFlg = false);
376
378
426 bool readMQOData(unsigned char *buffer,
427 std::string objName,
428 int materialID,
429 bool solidFlg = true,
430 bool contFlg = true,
431 bool materialFlg = false);
432
434
462 bool readD3DXFile(std::string fileName,
463 std::string objName,
464 bool solidFlg = true);
465
467
501 bool readD3DXFile(std::string fileName,
502 std::string objName,
503 int materialID,
504 bool solidFlg = true);
505
507
510
512
526 bool writeVRMLFile(std::string fileName,
527 fk_Material *material = nullptr,
528 bool triFlg = false);
529
531
554 bool writeVRMLFile(std::string fileName,
555 std::vector<double> *time,
556 std::vector<fk_Vector> *pos,
557 fk_Material *material = nullptr,
558 bool triFlg = false);
559
561
568 bool writeSTLFile(std::string fileName);
569
571
582 bool writeDXFFile(std::string fileName, bool triFlg = false);
583
585
592 bool writeMQOFile(std::string fileName);
594
597
599
604 int getPosSize(void);
605
607
612 int getEdgeSize(void);
613
615
620 int getFaceSize(void);
621
623
634 fk_Vector getPosVec(int vertexID);
635
637
646 std::vector<int> getFaceData(int faceID);
647
649
664 int getFaceData(int faceID, int vertexNum);
665
666
668
680 fk_Vector getFaceNorm(int faceID, int order = 0);
681
683
695 fk_Vector getVertexNorm(int vertexID, int order = 0);
696
698
701
703
720 bool moveVPosition(int vertexID, const fk_Vector &pos, int order = 0);
721
723
741 bool moveVPosition(int vertexID, double x, double y, double z, int order = 0);
742
744
762 bool moveVPosition(int vertexID, double *array, int order = 0);
763
765
796 void makeIFSet(int faceNum,
797 int polyNum,
798 int *IFSet,
799 int vertexNum,
800 fk_Vector *posArray,
801 bool smoothMode = false,
802 int order = 0);
803
805
832 void makeIFSet(int faceNum,
833 int polyNum,
834 int *IFSet,
835 int vertexNum,
836 fk_Vector *posArray,
837 int order);
838
840
866 void makeIFSet(std::vector< std::vector<int> > *faceArray,
867 std::vector<fk_Vector> *posArray,
868 bool smoothMode = false,
869 int order = 0);
870
872
894 void makeIFSet(std::vector< std::vector<int> > *faceArray,
895 std::vector<fk_Vector> *posArray,
896 int order);
897
899
924 bool setFaceNorm(int faceID, const fk_Vector &norm, int order = 0);
925
927
952 bool setVertexNorm(int vertexID, const fk_Vector &norm, int order = 0);
953
955
970 void flush(void);
971
973
976
978
988 void makePolygon(std::vector<fk_Vector> *posArray);
989
991
1002 void makePolygon(int num, fk_Vector *posArray);
1004
1007
1009
1032 void makeBlock(double x, double y, double z);
1033
1035
1047 void setBlockSize(double x, double y, double z);
1048
1050
1064 void setBlockSize(double length, fk_Axis axis);
1065
1067
1077 void setBlockScale(double scale);
1078
1080
1094 void setBlockScale(double scale, fk_Axis axis);
1095
1097
1109 void setBlockScale(double x, double y, double z);
1111
1114
1116
1135 void makeCircle(int div, double rad);
1136
1138
1148 void setCircleRadius(double rad);
1149
1151
1161 void setCircleDivide(int div);
1162
1164
1174 void setCircleScale(double scale);
1176
1179
1181
1199 void makeSphere(int div, double rad);
1200
1202
1212 void setSphereRadius(double rad);
1213
1215
1225 void setSphereDivide(int div);
1226
1228
1238 void setSphereScale(double scale);
1240
1243
1245
1270 void makePrism(int div, double top,
1271 double bottom, double height, bool smoothMode = false);
1272
1274
1284 void setPrismDivide(int div);
1285
1287
1297 void setPrismTopRadius(double top);
1298
1300
1310 void setPrismBottomRadius(double bottom);
1311
1313
1323 void setPrismHeight(double height);
1325
1328
1330
1354 void makeCone(int div, double rad, double height, bool smoothMode = true);
1355
1357
1367 void setConeDivide(int div);
1368
1370
1380 void setConeRadius(double rad);
1381
1383
1393 void setConeHeight(double height);
1395
1398
1400
1417 void makeCapsule(int div, double len, double rad);
1418
1420
1431 void setCapsuleSize(double len, double rad);
1433
1436
1438
1448 void putSolid(fk_Solid *solid);
1449
1451
1460 void setAnimationTime(double time);
1461
1463
1470 void setBVHMotion(fk_BVHBase *bvh);
1472
1473#if !defined(FK_DOXYGEN_USER_PROCESS)
1474
1475 bool MakeMesh(std::vector<fk_Vector> *,
1476 std::vector< std::vector<int> > *, bool = true);
1477
1478
1479 fk_D3DXAnimation * GetAnimation(void);
1480
1481 void DataPrint(void);
1482
1483 void EdgeIBOSetup(void);
1484 void FaceIBOSetup(void);
1485
1486 int getElemMaterialID(int);
1487 bool setElemMaterialID(int, int);
1488 void ForceUpdateAttr(void);
1489
1490 fk_Vector getPNorm(int faceID, int order = 0);
1491 fk_Vector getVNorm(int vertexID, int order = 0);
1492 bool setPNorm(int faceID, const fk_Vector &norm, int order = 0);
1493 bool setVNorm(int vertexID, const fk_Vector &norm, int order = 0);
1494
1495 void updateAttr(void);
1496
1497 std::vector<float> * GetVertexP(void);
1498 std::vector<float> * GetNormP(void);
1499
1500#endif
1501
1502 private:
1503 std::unique_ptr<Member> _m;
1504
1505 void InitFaceNorm(void);
1506 void InitVertexNorm(void);
1507
1508 void ModifyFaceNorm(void);
1509 void ModifyVertexNorm(void);
1510
1511 void MakeFaceNorm(int);
1512
1513 void ResetFaceFlg(void);
1514
1515 fk_FVector CalcTriNorm(GLuint *);
1516 fk_FVector CalcPolyNorm(int, int *);
1517 void MakeLoopTable(void);
1518 void MakeEdgeSet(std::vector< std::vector<int> > *);
1519
1520 void Init(void);
1521
1522 void DeleteCloneLink(fk_IndexFaceSet *);
1523
1524 void MakeCapsuleVec(std::vector<fk_Vector> *, int, double, double);
1525 void MakeCapsuleIFSet(std::vector< std::vector<int> > *, int);
1526 };
1527}
1528
1529#endif // !__FK_INDEXFACE_HEADER__
1530
1531/****************************************************************************
1532 *
1533 * Copyright (c) 1999-2024, Fine Kernel Project, All rights reserved.
1534 *
1535 * Redistribution and use in source and binary forms,
1536 * with or without modification, are permitted provided that the
1537 * following conditions are met:
1538 *
1539 * - Redistributions of source code must retain the above
1540 * copyright notice, this list of conditions and the
1541 * following disclaimer.
1542 *
1543 * - Redistributions in binary form must reproduce the above
1544 * copyright notice, this list of conditions and the
1545 * following disclaimer in the documentation and/or
1546 * other materials provided with the distribution.
1547 *
1548 * - Neither the name of the copyright holders nor the names
1549 * of its contributors may be used to endorse or promote
1550 * products derived from this software without specific
1551 * prior written permission.
1552 *
1553 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1554 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1555 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
1556 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
1557 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
1558 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
1559 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
1560 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
1561 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
1562 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
1563 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
1564 * POSSIBILITY OF SUCH DAMAGE.
1565 *
1566 ****************************************************************************/
1567/****************************************************************************
1568 *
1569 * Copyright (c) 1999-2024, Fine Kernel Project, All rights reserved.
1570 *
1571 * 本ソフトウェアおよびソースコードのライセンスは、基本的に
1572 * 「修正 BSD ライセンス」に従います。以下にその詳細を記します。
1573 *
1574 * ソースコード形式かバイナリ形式か、変更するかしないかを問わず、
1575 * 以下の条件を満たす場合に限り、再頒布および使用が許可されます。
1576 *
1577 * - ソースコードを再頒布する場合、上記の著作権表示、本条件一覧、
1578 * および下記免責条項を含めること。
1579 *
1580 * - バイナリ形式で再頒布する場合、頒布物に付属のドキュメント等の
1581 * 資料に、上記の著作権表示、本条件一覧、および下記免責条項を
1582 * 含めること。
1583 *
1584 * - 書面による特別の許可なしに、本ソフトウェアから派生した製品の
1585 * 宣伝または販売促進に、本ソフトウェアの著作権者の名前または
1586 * コントリビューターの名前を使用してはならない。
1587 *
1588 * 本ソフトウェアは、著作権者およびコントリビューターによって「現
1589 * 状のまま」提供されており、明示黙示を問わず、商業的な使用可能性、
1590 * および特定の目的に対する適合性に関す暗黙の保証も含め、またそれ
1591 * に限定されない、いかなる保証もないものとします。著作権者もコン
1592 * トリビューターも、事由のいかんを問わず、損害発生の原因いかんを
1593 * 問わず、かつ責任の根拠が契約であるか厳格責任であるか(過失その
1594 * 他の)不法行為であるかを問わず、仮にそのような損害が発生する可
1595 * 能性を知らされていたとしても、本ソフトウェアの使用によって発生
1596 * した(代替品または代用サービスの調達、使用の喪失、データの喪失、
1597 * 利益の喪失、業務の中断も含め、またそれに限定されない)直接損害、
1598 * 間接損害、偶発的な損害、特別損害、懲罰的損害、または結果損害に
1599 * ついて、一切責任を負わないものとします。
1600 *
1601 ****************************************************************************/
シェーダー内 attribute 変数用ベクトル管理クラス
Definition FVecArray.h:31
単精度浮動小数点型3次元ベクトルを管理するクラス
Definition Vector.h:760
インデックスフェースセットによる任意形状を生成、管理するクラス
Definition IndexFace.h:68
void setCircleScale(double scale)
円形状拡大縮小関数
int getPosSize(void)
頂点数参照関数
bool readMQOFile(std::string fileName, std::string objName, int materialID, bool solidFlg=true, bool contFlg=true, bool materialFlg=false)
MQOファイル入力関数2
void setBVHMotion(fk_BVHBase *bvh)
BVHデータ設定関数
bool readMQOData(unsigned char *buffer, std::string objName, int materialID, bool solidFlg=true, bool contFlg=true, bool materialFlg=false)
MQOデータ入力関数2
void putSolid(fk_Solid *solid)
fk_Solid 出力関数
fk_Vector getPosVec(int vertexID)
頂点位置ベクトル参照関数
void makePolygon(std::vector< fk_Vector > *posArray)
多角形生成関数1
void setAnimationTime(double time)
アニメーション時間設定関数
void flush(void)
法線ベクトル強制計算関数
void cloneShape(fk_IndexFaceSet *ifs)
形状コピー関数
int getFaceSize(void)
面数参照関数
void setSphereDivide(int div)
球形状分割数設定関数
bool readD3DXFile(std::string fileName, std::string objName, bool solidFlg=true)
DirectX (D3DX) ファイル入力関数1
bool readMQOFile(std::string fileName, std::string objName, bool solidFlg=true, bool contFlg=true, bool materialFlg=false)
MQOファイル入力関数1
void setBlockScale(double scale, fk_Axis axis)
直方体軸方向拡大縮小関数
bool moveVPosition(int vertexID, const fk_Vector &pos, int order=0)
頂点移動関数1
bool readVRMLFile(std::string fileName, bool materialFlg=true, bool solidFlg=true)
VRML ファイル入力関数
bool setFaceNorm(int faceID, const fk_Vector &norm, int order=0)
面法線ベクトル設定関数
bool writeSTLFile(std::string fileName)
STL ファイル出力関数
void makeCapsule(int div, double len, double rad)
カプセル型形状生成関数
void setBlockSize(double x, double y, double z)
直方体辺長変更関数
bool readRDSFile(std::string fileName, bool solidFlg=true)
RDSファイル入力関数
void setConeRadius(double rad)
正多角錐(円錐)底面半径設定関数
bool writeVRMLFile(std::string fileName, fk_Material *material=nullptr, bool triFlg=false)
VRML ファイル出力関数1
virtual ~fk_IndexFaceSet()
デストラクタ
void makeCone(int div, double rad, double height, bool smoothMode=true)
正多角錐(円錐)形状生成関数
void setPrismTopRadius(double top)
正多角柱(円柱)上面半径設定関数
bool readDXFFile(std::string fileName, bool solidFlg=true)
DXFファイル入力関数
void setPrismBottomRadius(double bottom)
正多角柱(円柱)角数設定関数
int getEdgeSize(void)
稜線数参照関数
void setBlockSize(double length, fk_Axis axis)
直方体個別辺長設定関数
bool readMQOData(unsigned char *buffer, std::string objName, bool solidFlg=true, bool contFlg=true, bool materialFlg=false)
MQOデータ入力関数1
int getFaceData(int faceID, int vertexNum)
頂点 ID 参照関数
bool readHRCFile(std::string fileName)
HRCファイル入力関数
bool writeMQOFile(std::string fileName)
MQO ファイル出力関数
bool readSTLFile(std::string fileName, bool solidFlg=true, double tolerance=1.0e-08)
STL ファイル入力関数
bool writeVRMLFile(std::string fileName, std::vector< double > *time, std::vector< fk_Vector > *pos, fk_Material *material=nullptr, bool triFlg=false)
VRML ファイル出力関数2
void setCapsuleSize(double len, double rad)
カプセル型形状寸法設定関数
void setSphereScale(double scale)
球形状拡大縮小関数
void setPrismHeight(double height)
正多角柱(円柱)高さ設定関数
bool readD3DXFile(std::string fileName, std::string objName, int materialID, bool solidFlg=true)
DirectX (D3DX) ファイル入力関数2
bool writeDXFFile(std::string fileName, bool triFlg=false)
DXF ファイル出力関数
bool readSMFFile(std::string fileName)
SMFファイル入力関数
void makePrism(int div, double top, double bottom, double height, bool smoothMode=false)
正多角柱(円柱)形状生成関数
void makeCircle(int div, double rad)
円形状生成関数
fk_Vector getVertexNorm(int vertexID, int order=0)
頂点法線ベクトル取得関数
fk_IndexFaceSet(void)
コンストラクタ
void setBlockScale(double x, double y, double z)
直方体軸方向個別拡大縮小関数
std::vector< int > getFaceData(int faceID)
頂点 ID 配列参照関数
void makePolygon(int num, fk_Vector *posArray)
多角形生成関数2
void setBlockScale(double scale)
直方体全体拡大縮小関数
void makeIFSet(std::vector< std::vector< int > > *faceArray, std::vector< fk_Vector > *posArray, bool smoothMode=false, int order=0)
任意形状生成関数3
fk_Vector getFaceNorm(int faceID, int order=0)
面法線ベクトル取得関数
void makeIFSet(int faceNum, int polyNum, int *IFSet, int vertexNum, fk_Vector *posArray, bool smoothMode=false, int order=0)
任意形状生成関数1
bool moveVPosition(int vertexID, double x, double y, double z, int order=0)
頂点移動関数2
void setCircleDivide(int div)
円形状分割数設定関数
void setConeDivide(int div)
正多角錐(円錐)角数設定関数
void setPrismDivide(int div)
正多角柱(円柱)角数設定関数
void setConeHeight(double height)
正多角錐(円錐)高さ設定関数
bool moveVPosition(int vertexID, double *array, int order=0)
頂点移動関数3
void makeIFSet(std::vector< std::vector< int > > *faceArray, std::vector< fk_Vector > *posArray, int order)
任意形状生成関数4
void setCircleRadius(double rad)
円形状半径設定関数
void makeSphere(int div, double rad)
球形状生成関数
void setSphereRadius(double rad)
球形状半径設定関数
void makeIFSet(int faceNum, int polyNum, int *IFSet, int vertexNum, fk_Vector *posArray, int order)
任意形状生成関数2
void makeBlock(double x, double y, double z)
直方体生成関数
bool setVertexNorm(int vertexID, const fk_Vector &norm, int order=0)
頂点法線ベクトル設定関数
マテリアル(質感)を管理するクラス
Definition Material.h:40
ファイル入出力機能用抽象クラス
Definition ParserData.h:15
半稜線構造 (Half-Edge Structure) による任意形状を生成、管理するクラス
Definition Solid.h:66
3次元ベクトルを管理するクラス
Definition Vector.h:45
Fine Kernel Toolkit 名前空間
Definition Angle.h:6
fk_Axis
座標軸を表す列挙型
Definition Vector.h:16