Go to the documentation of this file.00001 #pragma once
00002
00003 #include "GGraphicsObject.h"
00004 #include "GMatrix16.h"
00005 #include "GVec4f.h"
00006 #include "types.h"
00007 #include "GParticle.h"
00008 #include "GTextureManager.h"
00009 #include "GShaderManager.h"
00010 #include "GSceneManager.h"
00011 #include <string>
00012 #include <algorithm>
00013
00014 class GParticleEmitter : public GGraphicsObject
00015 {
00016 protected:
00017
00018
00019
00020
00021 std::string name;
00022
00023 bool isEnabled;
00024 bool isRunning;
00025
00026 static const int maxParticles;
00027
00028 static const GVec4f gravity;
00029 bool applyGravity;
00030
00031 int useParticles;
00032 int activeParticles;
00033
00034 ParticleType type;
00035
00036 std::string texturefile;
00037 unsigned int texId;
00038
00039 bool isRandomDirection;
00040 GVec4f emittingDirection;
00041
00042 float emissiveVelocity;
00043
00044 float emitterActivation;
00045 float emitterDuration;
00046 float lastSpawnTime;
00047 float spawnTime;
00048 float minLifeTime;
00049 float maxLifeTime;
00050
00051 vector<GParticle *> particles;
00052 public:
00053 GParticleEmitter(std::string name, ParticleType t, std::string texture, GVec4f pos, bool isRandom, GVec4f dir, float v, float dur, float spawn, float mini, float max, int numParticles);
00054 GParticleEmitter(ParticleType t);
00055 ~GParticleEmitter(void);
00056
00057 bool IsEnabled();
00058 bool IsActive();
00059
00060 int Enable(float duration = 0);
00061 int Disable();
00062 int Update(double time, double dtime);
00063 virtual int Draw(double time, double dtime, GMatrix16 *viewmatrix, GMatrix16 *worldmatrix, int FLAGS);
00064 virtual int DrawSprites(double time, double dtime, GMatrix16 *viewmatrix, GMatrix16 *worldmatrix, int FLAGS);
00065
00066 std::string GetName();
00067 ParticleType GetType();
00068
00069 GVec4f *GetPosition();
00070 int SetPosition(GVec4f pos);
00071
00072 bool GetIsRandomDirection();
00073 int SetIsRandomDirection(bool isRandom);
00074 GVec4f *GetEmittingDirection();
00075 int SetEmittingDirection(const GVec4f &dir);
00076
00077 float GetEmissiveVelocity();
00078 int SetEmissiveVelocity(float v);
00079
00080 float GetEmitterDuration();
00081 int SetEmitterDuration(float dur);
00082
00083 float GetSpawnTime();
00084 int SetSpawnTime(float spawn);
00085
00086 float GetMinParticleLifetime();
00087 int SetMinParticleLifetime(float min);
00088
00089 float GetMaxParticleLifetime();
00090 int SetMaxParticleLifetime(float max);
00091 };