mirror of
https://github.com/glest/glest-source.git
synced 2025-08-30 03:09:49 +02:00
- added more options to g3d viewer commandline options
This commit is contained in:
@@ -84,17 +84,27 @@ class ParticleSystem {
|
||||
|
||||
public:
|
||||
|
||||
enum State{
|
||||
enum State {
|
||||
sPause, // No updates
|
||||
sPlay,
|
||||
sFade // No new particles
|
||||
};
|
||||
|
||||
enum BlendMode{
|
||||
enum BlendMode {
|
||||
bmOne,
|
||||
bmOneMinusAlpha
|
||||
};
|
||||
|
||||
enum ParticleSystemType {
|
||||
pst_All,
|
||||
pst_FireParticleSystem,
|
||||
pst_UnitParticleSystem,
|
||||
pst_RainParticleSystem,
|
||||
pst_SnowParticleSystem,
|
||||
pst_ProjectileParticleSystem,
|
||||
pst_SplashParticleSystem,
|
||||
};
|
||||
|
||||
protected:
|
||||
|
||||
std::vector<Particle> particles;
|
||||
@@ -129,6 +139,8 @@ public:
|
||||
ParticleSystem(int particleCount);
|
||||
virtual ~ParticleSystem();
|
||||
|
||||
virtual ParticleSystemType getParticleSystemType() const = 0;
|
||||
|
||||
//public
|
||||
virtual void update();
|
||||
virtual void render(ParticleRenderer *pr, ModelRenderer *mr);
|
||||
@@ -191,6 +203,8 @@ private:
|
||||
public:
|
||||
FireParticleSystem(int particleCount= 2000);
|
||||
|
||||
virtual ParticleSystemType getParticleSystemType() const { return pst_FireParticleSystem;}
|
||||
|
||||
//virtual
|
||||
virtual void initParticle(Particle *p, int particleIndex);
|
||||
virtual void updateParticle(Particle *p);
|
||||
@@ -233,6 +247,8 @@ public:
|
||||
public:
|
||||
UnitParticleSystem(int particleCount= 2000);
|
||||
|
||||
virtual ParticleSystemType getParticleSystemType() const { return pst_UnitParticleSystem;}
|
||||
|
||||
//virtual
|
||||
virtual void initParticle(Particle *p, int particleIndex);
|
||||
virtual void updateParticle(Particle *p);
|
||||
@@ -270,6 +286,8 @@ private:
|
||||
public:
|
||||
RainParticleSystem(int particleCount= 4000);
|
||||
|
||||
virtual ParticleSystemType getParticleSystemType() const { return pst_RainParticleSystem;}
|
||||
|
||||
virtual void render(ParticleRenderer *pr, ModelRenderer *mr);
|
||||
|
||||
virtual void initParticle(Particle *p, int particleIndex);
|
||||
@@ -291,6 +309,8 @@ private:
|
||||
public:
|
||||
SnowParticleSystem(int particleCount= 4000);
|
||||
|
||||
virtual ParticleSystemType getParticleSystemType() const { return pst_SnowParticleSystem;}
|
||||
|
||||
virtual void initParticle(Particle *p, int particleIndex);
|
||||
virtual bool deathTest(Particle *p);
|
||||
|
||||
@@ -324,6 +344,8 @@ protected:
|
||||
public:
|
||||
AttackParticleSystem(int particleCount);
|
||||
|
||||
virtual ParticleSystemType getParticleSystemType() const { return pst_ProjectileParticleSystem;}
|
||||
|
||||
virtual void render(ParticleRenderer *pr, ModelRenderer *mr);
|
||||
|
||||
Model *getModel() const {return model;}
|
||||
@@ -375,6 +397,8 @@ public:
|
||||
ProjectileParticleSystem(int particleCount= 1000);
|
||||
virtual ~ProjectileParticleSystem();
|
||||
|
||||
virtual ParticleSystemType getParticleSystemType() const { return pst_SplashParticleSystem;}
|
||||
|
||||
void link(SplashParticleSystem *particleSystem);
|
||||
|
||||
virtual void update();
|
||||
@@ -442,6 +466,7 @@ public:
|
||||
void cleanupUnitParticleSystems(vector<UnitParticleSystem *> &particleSystems);
|
||||
int findParticleSystems(ParticleSystem *psFind, const vector<ParticleSystem *> &particleSystems) const;
|
||||
bool validateParticleSystemStillExists(ParticleSystem * particleSystem) const;
|
||||
bool hasActiveParticleSystem(ParticleSystem::ParticleSystemType type) const;
|
||||
};
|
||||
|
||||
}}//end namespace
|
||||
|
@@ -941,6 +941,38 @@ void ParticleManager::render(ParticleRenderer *pr, ModelRenderer *mr) const{
|
||||
}
|
||||
}
|
||||
|
||||
bool ParticleManager::hasActiveParticleSystem(ParticleSystem::ParticleSystemType type) const {
|
||||
bool result = false;
|
||||
|
||||
size_t particleSystemCount = particleSystems.size();
|
||||
int currentParticleCount = 0;
|
||||
|
||||
vector<ParticleSystem *> cleanupParticleSystemsList;
|
||||
for (unsigned int i = 0; i < particleSystems.size(); i++) {
|
||||
ParticleSystem *ps = particleSystems[i];
|
||||
if(ps != NULL) {
|
||||
currentParticleCount += ps->getAliveParticleCount();
|
||||
|
||||
bool showParticle = true;
|
||||
if( dynamic_cast<UnitParticleSystem *>(ps) != NULL ||
|
||||
dynamic_cast<FireParticleSystem *>(ps) != NULL ) {
|
||||
showParticle = ps->getVisible() || (ps->getState() == ParticleSystem::sFade);
|
||||
}
|
||||
if(showParticle == true) {
|
||||
//printf("Looking for [%d] current id [%d] i = %d\n",type,ps->getParticleSystemType(),i);
|
||||
|
||||
if(type == ParticleSystem::pst_All || type == ps->getParticleSystemType()) {
|
||||
//printf("FOUND particle system type match for [%d] current id [%d] i = %d\n",type,ps->getParticleSystemType(),i);
|
||||
result = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void ParticleManager::update(int renderFps) {
|
||||
Chrono chrono;
|
||||
chrono.start();
|
||||
|
Reference in New Issue
Block a user