FineKernelToolKit  2.9.0
 全て クラス ネームスペース ファイル 関数 変数 型定義 列挙型 列挙型の値 フレンド マクロ定義 ページ
Particle.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_PARTICLE_HEADER__
73 #define __FK_PARTICLE_HEADER__
74 
75 #include <FK/Base.h>
76 #include <FK/Vector.h>
77 #include <FK/Material.h>
78 #include <FK/Attribute.h>
79 
80 class fk_Point;
81 class fk_IDAdmin;
82 class fk_Shape;
83 
85 
124 class fk_Particle: public fk_BaseObject, public fk_Attribute {
125 
126  private:
127  int id; // 頂点 ID
128  fk_Point *base; // 全体位相
129  unsigned int count; // 年齢
130  fk_Vector velocity; // 速度
131  fk_Vector accel; // 加速度
132 
133  public:
134 #ifndef FK_DOXYGEN_USER_PROCESS
135 
136  fk_Particle(fk_Point *, int);
137  virtual ~fk_Particle();
138 
139 #endif
140 
142 
145  void init(void);
146 
148 
153  int getID(void) const;
154 
156 
163  unsigned int getCount(void) const;
164 
166 
171  fk_Vector getPosition(void) const;
172 
174 
179  void setPosition(const fk_Vector &pos);
180 
182 
189  void setPosition(double x, double y, double z);
190 
192 
197  fk_Vector getVelocity(void) const;
198 
200 
205  void setVelocity(const fk_Vector &vel);
206 
208 
215  void setVelocity(double x, double y, double z);
216 
218 
223  fk_Vector getAccel(void) const;
224 
226 
231  void setAccel(const fk_Vector &acc);
232 
234 
241  void setAccel(double x, double y, double z);
242 
244 
251  int getColorID(void) const;
252 
254 
261  void setColorID(int ID);
262 
264 
270  bool getDrawMode(void) const;
271 
273 
279  void setDrawMode(bool mode);
280 
282 
290  void handle(void);
291 };
292 
294 
316 
317  private:
318  std::vector<fk_Particle *> pSet;
319  fk_IDAdmin *pAdmin;
320  fk_Point *point;
321  unsigned int count;
322  bool allMode, indivMode;
323  unsigned int maxNum;
324 
325  protected:
327 
336  fk_Particle * newParticle(void);
337 
339 
350  fk_Particle * newParticle(const fk_Vector &pos);
351 
353 
366  fk_Particle * newParticle(double x, double y, double z);
367 
369 
378  bool removeParticle(fk_Particle *p);
379 
381 
390  bool removeParticle(int ID);
391 
393 
400  unsigned int getCount(void) const;
401 
403 
410  fk_Particle * getParticle(int ID) const;
411 
413 
443 
445 
450  unsigned int getParticleNum(void) const;
451 
453 
460  void setMaxSize(unsigned int max);
461 
463 
470  unsigned int getMaxSize(void) const;
471 
473 
485  void setColorPalette(int ID, const fk_Color &col);
486 
488 
503  void setColorPalette(int ID, float R, float G, float B);
504 
506 
521  void setColorPalette(int ID, double R, double G, double B);
522 
524 
533  virtual void genMethod(fk_Particle *p);
534 
536 
543  virtual void allMethod(void);
544 
546 
556  virtual void indivMethod(fk_Particle *p);
557 
559 
567  void setAllMode(bool mode);
568 
570 
577  bool getAllMode(void) const;
578 
580 
588  void setIndivMode(bool mode);
589 
591 
598  bool getIndivMode(void) const;
599 
600  public:
602 
607  fk_ParticleSet(unsigned int max = 0);
608 
610  virtual ~fk_ParticleSet();
611 
613 
619  void handle(void);
620 
622 
634  fk_Shape * getShape(void) const;
635 };
636 
637 #endif // !__FK_PARTICLE_HEADER__
void handle(void)
年齢更新関数
void setAccel(const fk_Vector &acc)
加速度ベクトル設定関数1
void setVelocity(const fk_Vector &vel)
速度ベクトル設定関数1
bool removeParticle(fk_Particle *p)
パーティクル削除関数1
void init(void)
初期化関数
virtual ~fk_ParticleSet()
デストラクタ
3次元ベクトルを管理するクラス
Definition: Vector.h:110
unsigned int getCount(void) const
年齢参照関数
int getID(void) const
ID参照関数
fk_Vector getVelocity(void) const
速度ベクトル参照設定
virtual void genMethod(fk_Particle *p)
個別初期化用仮想関数
形状用基底クラス
Definition: Shape.h:86
RGB色を管理するクラス
Definition: Material.h:92
fk_Shape * getShape(void) const
モデル設定用関数
点群を生成、管理するクラス
Definition: Point.h:101
fk_Particle * newParticle(void)
パーティクル生成関数1
bool getDrawMode(void) const
描画有無効参照関数
形状や位相要素の属性を付与、取得するクラス
Definition: Attribute.h:87
void setAllMode(bool mode)
全体動作モード設定関数
void setColorID(int ID)
色 ID 設定関数
fk_Vector getAccel(void) const
加速度ベクトル参照設定
bool getIndivMode(void) const
個別動作モード参照関数
unsigned int getCount(void) const
年齢参照関数
unsigned int getParticleNum(void) const
パーティクル個数参照関数
void setPosition(const fk_Vector &pos)
位置ベクトル設定関数1
void setMaxSize(unsigned int max)
パーティクル最大個数設定関数
FK の各クラスの基盤となる基本クラス
Definition: Base.h:212
int getColorID(void) const
色 ID 参照関数
void setDrawMode(bool mode)
描画有無効設定関数
パーティクル単体を制御するクラス
Definition: Particle.h:124
virtual void allMethod(void)
全体動作用仮想関数
virtual void indivMethod(fk_Particle *p)
個別動作用仮想関数
void handle(void)
実行関数
パーティクル集合を制御するクラス
Definition: Particle.h:315
unsigned int getMaxSize(void) const
パーティクル最大個数参照関数
fk_Particle * getNextParticle(fk_Particle *p) const
パーティクルインスタンス順次取得取得
bool getAllMode(void) const
全体動作モード参照関数
fk_Vector getPosition(void) const
位置ベクトル参照設定
void setColorPalette(int ID, const fk_Color &col)
カラーパレット設定1
fk_Particle * getParticle(int ID) const
パーティクルインスタンス参照関数
void setIndivMode(bool mode)
個別動作モード設定関数
fk_ParticleSet(unsigned int max=0)
コンストラクタ