black particles

This commit is contained in:
Titus Tscharntke 2010-02-22 22:51:46 +00:00
parent f80359fdca
commit 15783511fd
7 changed files with 41 additions and 6 deletions

View File

@ -22,7 +22,7 @@ using namespace Shared::Util;
namespace Glest{ namespace Game{
const string mailString= "contact_game@glest.org";
const string glestVersionString= "v3.2.4-1-beta3";
const string glestVersionString= "v3.2.4-2-beta3";
string getCrashDumpFileName(){
return "glest"+glestVersionString+".dmp";

View File

@ -117,6 +117,17 @@ void ParticleSystemType::load(const XmlNode *particleSystemNode, const string &d
//speed
const XmlNode *energyVarNode= particleSystemNode->getChild("energy-var");
energyVar= energyVarNode->getAttribute("value")->getIntValue();
//mode
if(particleSystemNode->hasChild("mode")){
const XmlNode *modeNode= particleSystemNode->getChild("mode");
mode= modeNode->getAttribute("value")->getRestrictedValue();
}
else
{
mode="normal";
}
}
void ParticleSystemType::setValues(AttackParticleSystem *ats){
@ -133,6 +144,7 @@ void ParticleSystemType::setValues(AttackParticleSystem *ats){
ats->setMaxParticleEnergy(energyMax);
ats->setVarParticleEnergy(energyVar);
ats->setModel(model);
ats->setBlendMode(ParticleSystem::strToBlendMode(mode));
}
// ===========================================================

View File

@ -57,6 +57,7 @@ protected:
int emissionRate;
int energyMax;
int energyVar;
string mode;
public:
ParticleSystemType();

View File

@ -131,6 +131,16 @@ void UnitParticleSystemType::load(const XmlNode *particleSystemNode, const strin
//teamcolorEnergy
const XmlNode *teamcolorEnergyNode= particleSystemNode->getChild("teamcolorEnergy");
teamcolorEnergy= teamcolorEnergyNode->getAttribute("value")->getBoolValue();
//mode
if(particleSystemNode->hasChild("mode")){
const XmlNode *modeNode= particleSystemNode->getChild("mode");
mode= modeNode->getAttribute("value")->getRestrictedValue();
}
else
{
mode="normal";
}
}
void UnitParticleSystemType::setValues(UnitParticleSystem *ups){
@ -152,6 +162,7 @@ void UnitParticleSystemType::setValues(UnitParticleSystem *ups){
ups->setTeamcolorNoEnergy(teamcolorNoEnergy);
ups->setTeamcolorEnergy(teamcolorEnergy);
ups->setRadius(radius);
ups->setBlendMode(ParticleSystem::strToBlendMode(mode));
}
void UnitParticleSystemType::load(const string &dir, const string &path){

View File

@ -59,6 +59,7 @@ protected:
bool fixed;
bool teamcolorNoEnergy;
bool teamcolorEnergy;
string mode;
public:
UnitParticleSystemType();

View File

@ -151,7 +151,9 @@ public:
void setActive(bool active);
void setObserver(ParticleObserver *particleObserver);
void setVisible(bool visible);
void setBlendMode(BlendMode blendMode) {this->blendMode= blendMode;}
static BlendMode strToBlendMode(const string &str);
//misc
void fade();
int isEmpty() const;

View File

@ -94,6 +94,18 @@ void ParticleSystem::render(ParticleRenderer *pr, ModelRenderer *mr){
}
}
ParticleSystem::BlendMode ParticleSystem::strToBlendMode(const string &str){
if(str=="normal"){
return bmOne;
}
else if(str=="black"){
return bmOneMinusAlpha;
}
else{
throw "Unknown particle mode: " + str;
}
}
// =============== SET ==========================
@ -365,13 +377,9 @@ void UnitParticleSystem::initParticle(Particle *p, int particleIndex){
else
{// rotate it according to rotation
float rad=degToRad(rotation);
// p->pos= Vec3f(pos.x+x+offset.x*cosf(rad)-offset.z*sinf(rad)*-1, pos.y+random.randRange(-radius/2, radius/2)+offset.y, pos.z+y+offset.z*cosf(rad)+offset.x*sinf(rad));
// p->speed=Vec3f(p->speed.x*cosf(rad)-p->speed.z*sinf(rad)*-1,p->speed.y,p->speed.z*cosf(rad)+p->speed.x*sinf(rad));
// p->pos= Vec3f(pos.x+x+(offset.x*cosf(rad)-offset.z*sinf(rad))*-1, pos.y+random.randRange(-radius/2, radius/2)+offset.y, pos.z+y+(offset.z*cosf(rad)+offset.x*sinf(rad)));
// p->speed=Vec3f((p->speed.x*cosf(rad)-p->speed.z*sinf(rad))*-1,p->speed.y,(p->speed.z*cosf(rad)+p->speed.x*sinf(rad)));
p->pos= Vec3f(pos.x+x+offset.z*sinf(rad)-offset.x*cosf(rad), pos.y+random.randRange(-radius/2, radius/2)+offset.y, pos.z+y+(offset.z*cosf(rad)+offset.x*sinf(rad)));
p->speed=Vec3f(p->speed.z*sinf(rad)-p->speed.x*cosf(rad),p->speed.y,(p->speed.z*cosf(rad)+p->speed.x*sinf(rad)));
}//p->pos=Vec3f(p->pos.x*cosf(rad)-p->pos.z*sinf(rad),p->pos.y,p->pos.z*cosf(rad)+p->pos.z*sinf(rad));
}
}
void UnitParticleSystem::update(){