diff options
author | Chris Xiong <chirs241097@gmail.com> | 2016-05-18 00:00:11 +0800 |
---|---|---|
committer | Chris Xiong <chirs241097@gmail.com> | 2016-05-18 00:00:11 +0800 |
commit | 473470054a4f67c67fb3f40a0438e87aff68703c (patch) | |
tree | f1e4644325cbb8eba4a1050ff5b69e31a0b6bb11 /visualization/extrasmeltutils.hpp | |
parent | 9b1dee8a2bed82df98d68001b9458f29a780c71e (diff) | |
download | QMidiPlayer-473470054a4f67c67fb3f40a0438e87aff68703c.tar.xz |
Fix bugs in the particle system.
Add particle look at option.
Diffstat (limited to 'visualization/extrasmeltutils.hpp')
-rw-r--r-- | visualization/extrasmeltutils.hpp | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/visualization/extrasmeltutils.hpp b/visualization/extrasmeltutils.hpp index bd103b0..08868a7 100644 --- a/visualization/extrasmeltutils.hpp +++ b/visualization/extrasmeltutils.hpp @@ -1,5 +1,6 @@ #ifndef EXTRASMELTUTILS_H #define EXTRASMELTUTILS_H +#include <ctime> #include <vector> #include <smelt.hpp> #include <smmath.hpp> @@ -33,7 +34,16 @@ class smEntity3DBuffer class smPSEmissionPositionGenerator { public: - virtual smvec3d genPos(); + virtual smvec3d genPos(){return smvec3d(0,0,0);} +}; +class smXLinePSGenerator:public smPSEmissionPositionGenerator +{ + private: + smRandomEngine re; + double var; + public: + smXLinePSGenerator(double _var){re.setSeed(time(NULL));var=_var;} + smvec3d genPos(){return smvec3d(re.nextDouble(-var,var),0,0);} }; class smParticleSystemInfo { @@ -54,13 +64,13 @@ class smParticle friend class smParticleSystem; private: static SMELT* sm; - smvec3d pos,rot; + smvec3d pos,rot,lookatpos; smvec3d vel,accel,rotv,rota; double lifespan,clifespan; double initsize,finalsize,size; DWORD color,initcolor,finalcolor; smQuad q; - bool dead; + bool dead,lookat; public: smParticle(); ~smParticle(); @@ -73,10 +83,10 @@ class smParticleSystem static SMELT* sm; std::vector<smParticle*> particles; smParticleSystemInfo psinfo; - smvec3d pos; + smvec3d pos,lookatpos; smRandomEngine re; smPSEmissionPositionGenerator* posGenerator; - bool active; + bool active,lookat; double cemdelay,nemdelay; public: smParticleSystem(); @@ -84,6 +94,8 @@ class smParticleSystem void setParticleSystemInfo(smParticleSystemInfo _psinfo); void setPos(smvec3d _pos); void setPSEmissionPosGen(smPSEmissionPositionGenerator* _gen); + void setPSLookAt(smvec3d at); + void unsetPSLookAt(); void startPS(); void stopPS(); void updatePS(); |