00001 #ifndef PARTICLASYSTEM_H
00002 #define PARTICLASYSTEM_H
00003
00004 #include "Renderable.h"
00005 #include "CGLA\Vec3f.h"
00006 class Material;
00007
00008
00009 using namespace CGLA;
00010
00011 class ParticleSystem:public Renderable{
00012 public:
00013 ParticleSystem();
00014 ~ParticleSystem();
00015
00016 void simulate();
00017 void render() const;
00018 void emitParticles(bool oneshot = true);
00019
00020 void setPosition(const Vec3f& pos){
00021 position = pos;
00022 }
00023
00024 Vec3f getPosition()const{
00025 return position;
00026 }
00027 Vec3f getWorldPosition()const{
00028 return position;
00029 }
00030
00031 static const RTTI TYPE;
00032 virtual const RTTI& getType() const{ return TYPE; }
00033
00034 protected:
00035 bool oneShot;
00036 bool emitting;
00037 Vec3f* positions;
00038 Vec3f* velocities;
00039 float* lifeTimes;
00040 float lifeTime;
00041 Material* material;
00042 int nbOfParts;
00043 Vec3f position;
00044
00045 private:
00046
00047 friend class boost::serialization::access;
00048 template<class Archive>
00049 void serialize(Archive& ar, const unsigned int version){
00050
00051 ar & boost::serialization::base_object<Renderable>(*this);
00052 }
00053 };
00054
00055 #endif