mirror of
https://github.com/glest/glest-source.git
synced 2025-08-15 12:54:01 +02:00
- added will's patch for splash particle animation support
This commit is contained in:
@@ -350,7 +350,6 @@ protected:
|
|||||||
Vec3f offset;
|
Vec3f offset;
|
||||||
float sizeNoEnergy;
|
float sizeNoEnergy;
|
||||||
float gravity;
|
float gravity;
|
||||||
|
|
||||||
float tween;
|
float tween;
|
||||||
Vec3f direction;
|
Vec3f direction;
|
||||||
|
|
||||||
@@ -371,6 +370,7 @@ public:
|
|||||||
void setPrimitive(Primitive primitive) {this->primitive= primitive;}
|
void setPrimitive(Primitive primitive) {this->primitive= primitive;}
|
||||||
|
|
||||||
float getTween() { return tween; } // 0.0 -> 1.0 for animation of model
|
float getTween() { return tween; } // 0.0 -> 1.0 for animation of model
|
||||||
|
virtual void initParticleSystem() {} // opportunity to do any initialisation when the system has been created and all settings set
|
||||||
|
|
||||||
static Primitive strToPrimitive(const string &str);
|
static Primitive strToPrimitive(const string &str);
|
||||||
};
|
};
|
||||||
@@ -446,6 +446,8 @@ private:
|
|||||||
float horizontalSpreadA;
|
float horizontalSpreadA;
|
||||||
float horizontalSpreadB;
|
float horizontalSpreadB;
|
||||||
|
|
||||||
|
float startEmissionRate;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SplashParticleSystem(int particleCount= 1000);
|
SplashParticleSystem(int particleCount= 1000);
|
||||||
virtual ~SplashParticleSystem();
|
virtual ~SplashParticleSystem();
|
||||||
@@ -454,6 +456,8 @@ public:
|
|||||||
virtual void initParticle(Particle *p, int particleIndex);
|
virtual void initParticle(Particle *p, int particleIndex);
|
||||||
virtual void updateParticle(Particle *p);
|
virtual void updateParticle(Particle *p);
|
||||||
|
|
||||||
|
virtual void initParticleSystem();
|
||||||
|
|
||||||
void setEmissionRateFade(float emissionRateFade) {this->emissionRateFade= emissionRateFade;}
|
void setEmissionRateFade(float emissionRateFade) {this->emissionRateFade= emissionRateFade;}
|
||||||
void setVerticalSpreadA(float verticalSpreadA) {this->verticalSpreadA= verticalSpreadA;}
|
void setVerticalSpreadA(float verticalSpreadA) {this->verticalSpreadA= verticalSpreadA;}
|
||||||
void setVerticalSpreadB(float verticalSpreadB) {this->verticalSpreadB= verticalSpreadB;}
|
void setVerticalSpreadB(float verticalSpreadB) {this->verticalSpreadB= verticalSpreadB;}
|
||||||
|
@@ -913,11 +913,19 @@ SplashParticleSystem::~SplashParticleSystem(){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SplashParticleSystem::initParticleSystem() {
|
||||||
|
startEmissionRate = emissionRate;
|
||||||
|
}
|
||||||
|
|
||||||
void SplashParticleSystem::update(){
|
void SplashParticleSystem::update(){
|
||||||
ParticleSystem::update();
|
ParticleSystem::update();
|
||||||
if(state != sPause){
|
if(state != sPause) {
|
||||||
emissionRate-= emissionRateFade;
|
emissionRate-= emissionRateFade;
|
||||||
if(emissionRate < 0.0f){//otherwise this system lives forever!
|
|
||||||
|
tween= 1.0f - ((emissionRate + startEmissionRate) / (startEmissionRate * 2.0f));
|
||||||
|
tween= clamp(tween, 0.0f, 1.0f);
|
||||||
|
|
||||||
|
if(emissionRate < 0.0f) {//otherwise this system lives forever!
|
||||||
fade();
|
fade();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user