mirror of
https://github.com/glest/glest-source.git
synced 2025-08-28 10:19:55 +02:00
- daylight effects for unit particles ( best use with mode "black" )
- meadow has good looking mist in night now - startdelay for particles
This commit is contained in:
@@ -132,6 +132,7 @@ protected:
|
||||
bool teamcolorNoEnergy;
|
||||
bool teamcolorEnergy;
|
||||
int alternations;
|
||||
int particleSystemStartDelay;
|
||||
ParticleObserver *particleObserver;
|
||||
|
||||
public:
|
||||
@@ -173,6 +174,7 @@ public:
|
||||
void setTeamcolorNoEnergy(bool teamcolorNoEnergy) {this->teamcolorNoEnergy= teamcolorNoEnergy;}
|
||||
void setTeamcolorEnergy(bool teamcolorEnergy) {this->teamcolorEnergy= teamcolorEnergy;}
|
||||
void setAlternations(int alternations) {this->alternations= alternations;}
|
||||
void setParticleSystemStartDelay(int delay) {this->particleSystemStartDelay= delay;}
|
||||
virtual void setFactionColor(Vec3f factionColor);
|
||||
|
||||
static BlendMode strToBlendMode(const string &str);
|
||||
@@ -269,6 +271,7 @@ protected:
|
||||
class UnitParticleSystem: public GameParticleSystem{
|
||||
public:
|
||||
static bool isNight;
|
||||
static Vec3f lightColor;
|
||||
private:
|
||||
float radius;
|
||||
float minRadius;
|
||||
@@ -296,6 +299,7 @@ public:
|
||||
float rotation;
|
||||
bool isVisibleAtNight;
|
||||
bool isVisibleAtDay;
|
||||
bool isDaylightAffected;
|
||||
bool radiusBasedStartenergy;
|
||||
int staticParticleCount;
|
||||
int delay;
|
||||
@@ -339,6 +343,7 @@ public:
|
||||
void setPrimitive(Primitive primitive) {this->primitive= primitive;}
|
||||
void setStaticParticleCount(int staticParticleCount){this->staticParticleCount= staticParticleCount;}
|
||||
void setIsVisibleAtNight(bool value) {this->isVisibleAtNight= value;}
|
||||
void setIsDaylightAffected(bool value) {this->isDaylightAffected= value;}
|
||||
void setIsVisibleAtDay(bool value) {this->isVisibleAtDay= value;}
|
||||
void setRadiusBasedStartenergy(bool value) {this->radiusBasedStartenergy= value;}
|
||||
void setShape(Shape shape) {this->shape= shape;}
|
||||
|
@@ -74,6 +74,7 @@ ParticleSystem::ParticleSystem(int particleCount) {
|
||||
teamcolorNoEnergy= false;
|
||||
teamcolorEnergy= false;
|
||||
alternations= 0;
|
||||
particleSystemStartDelay= 0;
|
||||
}
|
||||
|
||||
ParticleSystem::~ParticleSystem(){
|
||||
@@ -97,8 +98,10 @@ void ParticleSystem::update(){
|
||||
if(aliveParticleCount > (int) particles.size()){
|
||||
throw runtime_error("aliveParticleCount >= particles.size()");
|
||||
}
|
||||
|
||||
if(state != sPause){
|
||||
if(particleSystemStartDelay>0){
|
||||
particleSystemStartDelay--;
|
||||
}
|
||||
else if(state != sPause){
|
||||
for(int i= 0; i < aliveParticleCount; ++i){
|
||||
updateParticle(&particles[i]);
|
||||
|
||||
@@ -527,6 +530,7 @@ void GameParticleSystem::setTween(float relative,float absolute) {
|
||||
// UnitParticleSystem
|
||||
// ===========================================================================
|
||||
bool UnitParticleSystem::isNight= false;
|
||||
Vec3f UnitParticleSystem::lightColor=Vec3f(1.0f,1.0f,1.0f);
|
||||
|
||||
UnitParticleSystem::UnitParticleSystem(int particleCount):
|
||||
GameParticleSystem(particleCount),
|
||||
@@ -549,6 +553,7 @@ UnitParticleSystem::UnitParticleSystem(int particleCount):
|
||||
|
||||
isVisibleAtNight= true;
|
||||
isVisibleAtDay= true;
|
||||
isDaylightAffected= false;
|
||||
|
||||
cRotation= Vec3f(1.0f, 1.0f, 1.0f);
|
||||
fixedAddition= Vec3f(0.0f, 0.0f, 0.0f);
|
||||
@@ -736,6 +741,12 @@ void UnitParticleSystem::updateParticle(Particle *p){
|
||||
}
|
||||
p->speed+= p->accel;
|
||||
p->color= color * energyRatio + colorNoEnergy * (1.0f - energyRatio);
|
||||
if(isDaylightAffected)
|
||||
{
|
||||
p->color.x=p->color.x*lightColor.x;
|
||||
p->color.y=p->color.y*lightColor.y;
|
||||
p->color.z=p->color.z*lightColor.z;
|
||||
}
|
||||
p->size= particleSize * energyRatio + sizeNoEnergy * (1.0f - energyRatio);
|
||||
if(state == ParticleSystem::sFade || staticParticleCount < 1){
|
||||
p->energy--;
|
||||
|
Reference in New Issue
Block a user