- new switch for unit_particle _systems called static-particle-count
- Bugfix for "wild particles". ( the splash particle systems never died before! ) - Better german language file ( cpu player have english words again, words like ultra are common enough in germany )
This commit is contained in:
parent
9d8bb49a1b
commit
3b1ef055b1
|
@ -133,6 +133,15 @@ void UnitParticleSystemType::load(const XmlNode *particleSystemNode, const strin
|
||||||
relativeDirection=true;
|
relativeDirection=true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(particleSystemNode->hasChild("static-particle-count")){
|
||||||
|
//staticParticleCount
|
||||||
|
const XmlNode *staticParticleCountNode= particleSystemNode->getChild("static-particle-count");
|
||||||
|
staticParticleCount= staticParticleCountNode->getAttribute("value")->getIntValue();
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
staticParticleCount=0;
|
||||||
|
}
|
||||||
|
|
||||||
//fixed
|
//fixed
|
||||||
const XmlNode *fixedNode= particleSystemNode->getChild("fixed");
|
const XmlNode *fixedNode= particleSystemNode->getChild("fixed");
|
||||||
fixed= fixedNode->getAttribute("value")->getBoolValue();
|
fixed= fixedNode->getAttribute("value")->getBoolValue();
|
||||||
|
@ -186,8 +195,19 @@ void UnitParticleSystemType::setValues(UnitParticleSystem *ups){
|
||||||
ups->setRelativeDirection(relativeDirection);
|
ups->setRelativeDirection(relativeDirection);
|
||||||
ups->setTeamcolorNoEnergy(teamcolorNoEnergy);
|
ups->setTeamcolorNoEnergy(teamcolorNoEnergy);
|
||||||
ups->setTeamcolorEnergy(teamcolorEnergy);
|
ups->setTeamcolorEnergy(teamcolorEnergy);
|
||||||
|
ups->setStaticParticleCount(staticParticleCount);
|
||||||
ups->setRadius(radius);
|
ups->setRadius(radius);
|
||||||
ups->setBlendMode(ParticleSystem::strToBlendMode(mode));
|
ups->setBlendMode(ParticleSystem::strToBlendMode(mode));
|
||||||
|
//prepare system for given staticParticleCount
|
||||||
|
if(staticParticleCount>0)
|
||||||
|
{
|
||||||
|
ups->setEmissionRate(0.0f);
|
||||||
|
ups->setSpeed(0);
|
||||||
|
direction.x= 0.0f;
|
||||||
|
direction.y= 0.0f;
|
||||||
|
direction.z= 0.0f;
|
||||||
|
ups->setDirection(direction);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UnitParticleSystemType::load(const string &dir, const string &path, RendererInterface *renderer){
|
void UnitParticleSystemType::load(const string &dir, const string &path, RendererInterface *renderer){
|
||||||
|
|
|
@ -63,6 +63,7 @@ protected:
|
||||||
bool fixed;
|
bool fixed;
|
||||||
bool teamcolorNoEnergy;
|
bool teamcolorNoEnergy;
|
||||||
bool teamcolorEnergy;
|
bool teamcolorEnergy;
|
||||||
|
int staticParticleCount;
|
||||||
string mode;
|
string mode;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -211,6 +211,7 @@ private:
|
||||||
Vec3f cRotation;
|
Vec3f cRotation;
|
||||||
Vec3f fixedAddition;
|
Vec3f fixedAddition;
|
||||||
Vec3f oldPosition;
|
Vec3f oldPosition;
|
||||||
|
bool energyUp;
|
||||||
public:
|
public:
|
||||||
enum Primitive{
|
enum Primitive{
|
||||||
pQuad,
|
pQuad,
|
||||||
|
@ -227,6 +228,7 @@ public:
|
||||||
float sizeNoEnergy;
|
float sizeNoEnergy;
|
||||||
float gravity;
|
float gravity;
|
||||||
float rotation;
|
float rotation;
|
||||||
|
int staticParticleCount;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
UnitParticleSystem(int particleCount= 2000);
|
UnitParticleSystem(int particleCount= 2000);
|
||||||
|
@ -250,6 +252,7 @@ public:
|
||||||
void setRelativeDirection(bool relativeDirection) {this->relativeDirection= relativeDirection;}
|
void setRelativeDirection(bool relativeDirection) {this->relativeDirection= relativeDirection;}
|
||||||
void setFixed(bool fixed) {this->fixed= fixed;}
|
void setFixed(bool fixed) {this->fixed= fixed;}
|
||||||
void setPrimitive(Primitive primitive) {this->primitive= primitive;}
|
void setPrimitive(Primitive primitive) {this->primitive= primitive;}
|
||||||
|
void setStaticParticleCount(int staticParticleCount){this->staticParticleCount= staticParticleCount;}
|
||||||
|
|
||||||
static Primitive strToPrimitive(const string &str);
|
static Primitive strToPrimitive(const string &str);
|
||||||
|
|
||||||
|
|
|
@ -58,7 +58,7 @@ ParticleSystem::ParticleSystem(int particleCount) {
|
||||||
color= Vec4f(1.0f);
|
color= Vec4f(1.0f);
|
||||||
colorNoEnergy= Vec4f(0.0f);
|
colorNoEnergy= Vec4f(0.0f);
|
||||||
emissionRate= 15.0f;
|
emissionRate= 15.0f;
|
||||||
emissionState= 1.0f;
|
emissionState= 1.0f; // initialized with 1 because we must have at least one particle in the beginning!
|
||||||
speed= 1.0f;
|
speed= 1.0f;
|
||||||
teamcolorNoEnergy=false;
|
teamcolorNoEnergy=false;
|
||||||
teamcolorEnergy=false;
|
teamcolorEnergy=false;
|
||||||
|
@ -102,11 +102,11 @@ void ParticleSystem::update() {
|
||||||
initParticle(p, i);
|
initParticle(p, i);
|
||||||
}
|
}
|
||||||
emissionState=emissionState-(float)emissionIntValue;
|
emissionState=emissionState-(float)emissionIntValue;
|
||||||
if(aliveParticleCount==0){
|
// if(aliveParticleCount==0){
|
||||||
Particle *p = createParticle();
|
// Particle *p = createParticle();
|
||||||
initParticle(p, 0);
|
// initParticle(p, 0);
|
||||||
emissionState=0;
|
// emissionState=0;
|
||||||
}
|
// }
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -380,10 +380,16 @@ UnitParticleSystem::UnitParticleSystem(int particleCount): ParticleSystem(partic
|
||||||
rotation=0.0f;
|
rotation=0.0f;
|
||||||
relativeDirection=true;
|
relativeDirection=true;
|
||||||
relative=false;
|
relative=false;
|
||||||
|
staticParticleCount=0;
|
||||||
|
|
||||||
cRotation= Vec3f(1.0f,1.0f,1.0f);
|
cRotation= Vec3f(1.0f,1.0f,1.0f);
|
||||||
fixedAddition = Vec3f(0.0f,0.0f,0.0f);
|
fixedAddition = Vec3f(0.0f,0.0f,0.0f);
|
||||||
|
//prepare system for given staticParticleCount
|
||||||
|
if(staticParticleCount>0)
|
||||||
|
{
|
||||||
|
emissionState= (float)staticParticleCount;
|
||||||
|
}
|
||||||
|
energyUp=false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UnitParticleSystem::render(ParticleRenderer *pr,ModelRenderer *mr){
|
void UnitParticleSystem::render(ParticleRenderer *pr,ModelRenderer *mr){
|
||||||
|
@ -492,7 +498,29 @@ void UnitParticleSystem::updateParticle(Particle *p){
|
||||||
p->speed+= p->accel;
|
p->speed+= p->accel;
|
||||||
p->color = color * energyRatio + colorNoEnergy * (1.0f-energyRatio);
|
p->color = color * energyRatio + colorNoEnergy * (1.0f-energyRatio);
|
||||||
p->size = particleSize * energyRatio + sizeNoEnergy * (1.0f-energyRatio);
|
p->size = particleSize * energyRatio + sizeNoEnergy * (1.0f-energyRatio);
|
||||||
p->energy--;
|
if(state == ParticleSystem::sFade || staticParticleCount<1)
|
||||||
|
{
|
||||||
|
p->energy--;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(maxParticleEnergy>0)
|
||||||
|
{
|
||||||
|
if(energyUp){
|
||||||
|
p->energy++;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
p->energy--;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(p->energy==1){
|
||||||
|
energyUp=true;
|
||||||
|
}
|
||||||
|
if(p->energy==maxParticleEnergy){
|
||||||
|
energyUp=false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
p->lastPos= p->pos;
|
p->lastPos= p->pos;
|
||||||
|
@ -876,6 +904,10 @@ 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!
|
||||||
|
fade();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user