00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072 #ifndef __FK_PARTICLE_HEADER__
00073 #define __FK_PARTICLE_HEADER__
00074
00075 #include <FK/Base.h>
00076 #include <FK/Vector.h>
00077 #include <FK/Material.h>
00078 #include <FK/Attribute.h>
00079
00080 class fk_Point;
00081 class fk_IDAdmin;
00082 class fk_Shape;
00083
00085
00124 class fk_Particle: public fk_BaseObject, public fk_Attribute {
00125
00126 private:
00127 int id;
00128 fk_Point *base;
00129 unsigned int count;
00130 fk_Vector velocity;
00131 fk_Vector accel;
00132
00133 public:
00134 #ifndef FK_DOXYGEN_USER_PROCESS
00135
00136 fk_Particle(fk_Point *, int);
00137 ~fk_Particle();
00138
00139 #endif
00140
00142
00145 void init(void);
00146
00148
00153 int getID(void) const;
00154
00156
00163 unsigned int getCount(void) const;
00164
00166
00171 fk_Vector getPosition(void) const;
00172
00174
00179 void setPosition(const fk_Vector &pos);
00180
00182
00189 void setPosition(double x, double y, double z);
00190
00192
00197 fk_Vector getVelocity(void) const;
00198
00200
00205 void setVelocity(const fk_Vector &vel);
00206
00208
00215 void setVelocity(double x, double y, double z);
00216
00218
00223 fk_Vector getAccel(void) const;
00224
00226
00231 void setAccel(const fk_Vector &acc);
00232
00234
00241 void setAccel(double x, double y, double z);
00242
00244
00251 int getColorID(void) const;
00252
00254
00261 void setColorID(int ID);
00262
00264
00270 bool getDrawMode(void) const;
00271
00273
00279 void setDrawMode(bool mode);
00280
00282
00290 void handle(void);
00291 };
00292
00294
00315 class fk_ParticleSet: public fk_BaseObject {
00316
00317 private:
00318 std::vector<fk_Particle *> pSet;
00319 fk_IDAdmin *pAdmin;
00320 fk_Point *point;
00321 unsigned int count;
00322 bool allMode, indivMode;
00323 unsigned int maxNum;
00324
00325 protected:
00327
00336 fk_Particle * newParticle(void);
00337
00339
00350 fk_Particle * newParticle(const fk_Vector &pos);
00351
00353
00366 fk_Particle * newParticle(double x, double y, double z);
00367
00369
00378 bool removeParticle(fk_Particle *p);
00379
00381
00390 bool removeParticle(int ID);
00391
00393
00400 unsigned int getCount(void) const;
00401
00403
00410 fk_Particle * getParticle(int ID) const;
00411
00413
00443 fk_Particle * getNextParticle(fk_Particle *p) const;
00444
00446
00451 unsigned int getParticleNum(void) const;
00452
00454
00461 void setMaxSize(unsigned int max);
00462
00464
00471 unsigned int getMaxSize(void) const;
00472
00474
00486 void setColorPalette(int ID, const fk_Color &col);
00487
00489
00504 void setColorPalette(int ID, float R, float G, float B);
00505
00507
00522 void setColorPalette(int ID, double R, double G, double B);
00523
00525
00534 virtual void genMethod(fk_Particle *p);
00535
00537
00544 virtual void allMethod(void);
00545
00547
00557 virtual void indivMethod(fk_Particle *p);
00558
00560
00568 void setAllMode(bool mode);
00569
00571
00578 bool getAllMode(void) const;
00579
00581
00589 void setIndivMode(bool mode);
00590
00592
00599 bool getIndivMode(void) const;
00600
00601 public:
00603
00608 fk_ParticleSet(unsigned int max = 0);
00609
00611 virtual ~fk_ParticleSet();
00612
00614
00620 void handle(void);
00621
00623
00635 fk_Shape * getShape(void) const;
00636 };
00637
00638 #endif // !__FK_PARTICLE_HEADER__