FineKernelToolKit 4.2.13
読み取り中…
検索中…
一致する文字列を見つけられません
Shape.h
[詳解]
1#if !defined(__FK_SHAPE_BASE_HEADER__)
2#define __FK_SHAPE_BASE_HEADER__
3
4#include <FK/Base.h>
5#include <FK/Palette.h>
6#include <FK/Attribute.h>
7#include <FK/Vector.h>
8#include <FK/OpenGL.hh>
9#include <map>
10#include <functional>
11
12namespace FK {
13
14#if !defined(FK_DOXYGEN_USER_PROCESS)
15 using shapeAttrI = std::tuple<int, int, std::vector<int> *>;
16 using shapeAttrF = std::tuple<int, int, std::vector<float> *>;
17
18 using shapeMapI = std::map<std::string, shapeAttrI>;
19 using shapeMapF = std::map<std::string, shapeAttrF>;
20#endif
21
23 enum class fk_RealShapeType {
24 IFS,
25 SOLID,
26 TEXTURE,
27 POINT,
28 LINE,
29 CURVE,
30 SURFACE,
31 LIGHT,
32 GRAPH,
33 OTHER
34 };
35
37
44 class fk_Shape: public fk_Attribute {
45
46#if !defined(FK_DOXYGEN_USER_PROCESS)
47 class Member {
48 public:
49 GLuint pointVAO, lineVAO, faceVAO;
50
51 shapeMapI attrMapI;
52 shapeMapF attrMapF;
53
54 bool vboInitFlg;
55
56 std::map<std::string, bool> attrModify;
57
58 std::map<std::string, std::unique_ptr<std::vector<int>>> intSelf;
59 std::map<std::string, std::unique_ptr<std::vector<float>>> floatSelf;
60
61 Member(void);
62 };
63#endif
64
65 public:
66
67#if !defined(FK_DOXYGEN_USER_PROCESS)
68 static constexpr int ALIVE = 1;
69 static constexpr int DEAD = 0;
70#endif
74 virtual ~fk_Shape();
75
77
84
86
120 void setShaderAttribute(std::string name, int dim,
121 std::vector<int> *array, bool self = false);
122
124
158 void setShaderAttribute(std::string name, int dim,
159 std::vector<float> *array, bool self = false);
160
162
187 void setShaderAttribute(std::string name, int dim, std::vector<fk_Vector> *array);
188
190
214 void setShaderAttribute(std::string name, int dim, std::vector<fk_TexCoord> *array);
215
217
242 void setShaderAttribute(std::string name, int dim, std::vector<fk_HVector> *array);
243
245
260 void modifyAttribute(std::string name);
261
262#if !defined(FK_OLD_NONSUPPORT) && !defined(FK_DOXYGEN_USER_PROCESS)
263 // 廃止関数群
264 fk_Palette * getPaletteData(void);
265 void clearMaterial(void);
266 void setObjMaterialID(int ID);
267 void pushPalette(fk_Material &mat);
268 void setPalette(fk_Material &mat, int ID);
269 int getObjMaterialID(void);
270 int getPaletteSize(void);
271 fk_Material * getMaterial(int id);
272 std::vector<fk_Material> * getMaterialVector(void);
273 void setMaterialMode(fk_MaterialMode mode);
274 fk_MaterialMode getMaterialMode(void);
275#endif
276
277#if !defined(FK_DOXYGEN_USER_PROCESS)
278 // 非公開関数群
279 void FinishSetVBO(void);
280 virtual void ForceUpdateAttr(void);
281 std::function<void(void)> FlushAttr;
282
283 void SetPaletteData(fk_Palette *pal);
284 void setPaletteData(fk_Palette *pal);
285
286 void SetPointVAO(GLuint);
287 void SetLineVAO(GLuint);
288 void SetFaceVAO(GLuint);
289 GLuint GetPointVAO(void);
290 GLuint GetLineVAO(void);
291 GLuint GetFaceVAO(void);
292
293 void DefineVBO(void);
294 void BindShaderBuffer(std::map<std::string, int> *);
295
296 static GLuint GenBuffer(void);
297 static void DeleteBuffer(GLuint);
298
299 // シェーダー変数名: 頂点座標
300 static const std::string vertexName;
301 static const std::string normalName;
302
303 // シェーダー変数名: 頂点モデル色
304 static const std::string pointModelColorName;
305 static const std::string pointElementColorName;
306 static const std::string pointElementAliveName;
307
308 static const std::string lineModelColorName;
309 static const std::string lineElementColorName;
310 static const std::string lineElementAliveName;
311
312 static const std::string curveModelColorName;
313
314 // シェーダー変数名: テクスチャ座標
315 static const std::string texCoordName;
316
317 // シェーダー変数名: 曲線曲面
318 static const std::string ctrlPosName;
319 static const std::string degreeName;
320 static const std::string geomDivName;
321#endif
322
323 private:
324 std::unique_ptr<Member> _m;
325
326 void DeleteMapI(std::string);
327 void DeleteMapF(std::string);
328
329 protected:
330#if !defined(FK_DOXYGEN_USER_PROCESS)
331 fk_RealShapeType realType;
332#endif
333 };
334}
335
336#endif // !__FK_SHAPE_BASE_HEADER__
337
338/****************************************************************************
339 *
340 * Copyright (c) 1999-2024, Fine Kernel Project, All rights reserved.
341 *
342 * Redistribution and use in source and binary forms,
343 * with or without modification, are permitted provided that the
344 * following conditions are met:
345 *
346 * - Redistributions of source code must retain the above
347 * copyright notice, this list of conditions and the
348 * following disclaimer.
349 *
350 * - Redistributions in binary form must reproduce the above
351 * copyright notice, this list of conditions and the
352 * following disclaimer in the documentation and/or
353 * other materials provided with the distribution.
354 *
355 * - Neither the name of the copyright holders nor the names
356 * of its contributors may be used to endorse or promote
357 * products derived from this software without specific
358 * prior written permission.
359 *
360 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
361 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
362 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
363 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
364 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
365 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
366 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
367 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
368 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
369 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
370 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
371 * POSSIBILITY OF SUCH DAMAGE.
372 *
373 ****************************************************************************/
374/****************************************************************************
375 *
376 * Copyright (c) 1999-2024, Fine Kernel Project, All rights reserved.
377 *
378 * 本ソフトウェアおよびソースコードのライセンスは、基本的に
379 * 「修正 BSD ライセンス」に従います。以下にその詳細を記します。
380 *
381 * ソースコード形式かバイナリ形式か、変更するかしないかを問わず、
382 * 以下の条件を満たす場合に限り、再頒布および使用が許可されます。
383 *
384 * - ソースコードを再頒布する場合、上記の著作権表示、本条件一覧、
385 * および下記免責条項を含めること。
386 *
387 * - バイナリ形式で再頒布する場合、頒布物に付属のドキュメント等の
388 * 資料に、上記の著作権表示、本条件一覧、および下記免責条項を
389 * 含めること。
390 *
391 * - 書面による特別の許可なしに、本ソフトウェアから派生した製品の
392 * 宣伝または販売促進に、本ソフトウェアの著作権者の名前または
393 * コントリビューターの名前を使用してはならない。
394 *
395 * 本ソフトウェアは、著作権者およびコントリビューターによって「現
396 * 状のまま」提供されており、明示黙示を問わず、商業的な使用可能性、
397 * および特定の目的に対する適合性に関す暗黙の保証も含め、またそれ
398 * に限定されない、いかなる保証もないものとします。著作権者もコン
399 * トリビューターも、事由のいかんを問わず、損害発生の原因いかんを
400 * 問わず、かつ責任の根拠が契約であるか厳格責任であるか(過失その
401 * 他の)不法行為であるかを問わず、仮にそのような損害が発生する可
402 * 能性を知らされていたとしても、本ソフトウェアの使用によって発生
403 * した(代替品または代用サービスの調達、使用の喪失、データの喪失、
404 * 利益の喪失、業務の中断も含め、またそれに限定されない)直接損害、
405 * 間接損害、偶発的な損害、特別損害、懲罰的損害、または結果損害に
406 * ついて、一切責任を負わないものとします。
407 *
408 ****************************************************************************/
形状や位相要素の属性を付与、取得するクラス
Definition Attribute.h:17
マテリアル(質感)を管理するクラス
Definition Material.h:40
マテリアルパレットを管理するクラス
Definition Palette.h:27
形状用基底クラス
Definition Shape.h:44
void setShaderAttribute(std::string name, int dim, std::vector< fk_HVector > *array)
シェーダー内 attribute 変数設定関数5
void modifyAttribute(std::string name)
attribute 変数更新関数
void setShaderAttribute(std::string name, int dim, std::vector< fk_Vector > *array)
シェーダー内 attribute 変数設定関数3
fk_RealShapeType getRealShapeType(void)
形状データ構造取得関数
void setShaderAttribute(std::string name, int dim, std::vector< float > *array, bool self=false)
シェーダー内 attribute 変数設定関数2
void setShaderAttribute(std::string name, int dim, std::vector< fk_TexCoord > *array)
シェーダー内 attribute 変数設定関数4
void setShaderAttribute(std::string name, int dim, std::vector< int > *array, bool self=false)
シェーダー内 attribute 変数設定関数1
virtual ~fk_Shape()
デストラクタ
fk_Shape(fk_Type=fk_Type::SHAPE)
コンストラクタ
Fine Kernel Toolkit 名前空間
Definition Angle.h:6
fk_RealShapeType
形状データの具体的なデータ構造を表す列挙型
Definition Shape.h:23
@ IFS
fk_IndexFaceSet ベース
fk_Type
オブジェクトインスタンスのタイプを表す列挙型
Definition Base.h:43
@ CURVE
fk_Curve 型
@ LINE
fk_Line 型
@ SURFACE
fk_Surface 型
@ TEXTURE
fk_Texture 型
@ POINT
fk_Point 型
@ SOLID
fk_Solid 型
@ GRAPH
fk_Graph 型
@ SHAPE
fk_Shape 型
@ LIGHT
fk_Light 型
fk_MaterialMode
マテリアルモード型
Definition Palette.h:11