mirror of
https://github.com/glest/glest-source.git
synced 2025-02-24 19:52:25 +01:00
black particles
This commit is contained in:
parent
f80359fdca
commit
15783511fd
@ -22,7 +22,7 @@ using namespace Shared::Util;
|
|||||||
namespace Glest{ namespace Game{
|
namespace Glest{ namespace Game{
|
||||||
|
|
||||||
const string mailString= "contact_game@glest.org";
|
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(){
|
string getCrashDumpFileName(){
|
||||||
return "glest"+glestVersionString+".dmp";
|
return "glest"+glestVersionString+".dmp";
|
||||||
|
@ -117,6 +117,17 @@ void ParticleSystemType::load(const XmlNode *particleSystemNode, const string &d
|
|||||||
//speed
|
//speed
|
||||||
const XmlNode *energyVarNode= particleSystemNode->getChild("energy-var");
|
const XmlNode *energyVarNode= particleSystemNode->getChild("energy-var");
|
||||||
energyVar= energyVarNode->getAttribute("value")->getIntValue();
|
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){
|
void ParticleSystemType::setValues(AttackParticleSystem *ats){
|
||||||
@ -133,6 +144,7 @@ void ParticleSystemType::setValues(AttackParticleSystem *ats){
|
|||||||
ats->setMaxParticleEnergy(energyMax);
|
ats->setMaxParticleEnergy(energyMax);
|
||||||
ats->setVarParticleEnergy(energyVar);
|
ats->setVarParticleEnergy(energyVar);
|
||||||
ats->setModel(model);
|
ats->setModel(model);
|
||||||
|
ats->setBlendMode(ParticleSystem::strToBlendMode(mode));
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================
|
// ===========================================================
|
||||||
|
@ -57,6 +57,7 @@ protected:
|
|||||||
int emissionRate;
|
int emissionRate;
|
||||||
int energyMax;
|
int energyMax;
|
||||||
int energyVar;
|
int energyVar;
|
||||||
|
string mode;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ParticleSystemType();
|
ParticleSystemType();
|
||||||
|
@ -131,6 +131,16 @@ void UnitParticleSystemType::load(const XmlNode *particleSystemNode, const strin
|
|||||||
//teamcolorEnergy
|
//teamcolorEnergy
|
||||||
const XmlNode *teamcolorEnergyNode= particleSystemNode->getChild("teamcolorEnergy");
|
const XmlNode *teamcolorEnergyNode= particleSystemNode->getChild("teamcolorEnergy");
|
||||||
teamcolorEnergy= teamcolorEnergyNode->getAttribute("value")->getBoolValue();
|
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){
|
void UnitParticleSystemType::setValues(UnitParticleSystem *ups){
|
||||||
@ -152,6 +162,7 @@ void UnitParticleSystemType::setValues(UnitParticleSystem *ups){
|
|||||||
ups->setTeamcolorNoEnergy(teamcolorNoEnergy);
|
ups->setTeamcolorNoEnergy(teamcolorNoEnergy);
|
||||||
ups->setTeamcolorEnergy(teamcolorEnergy);
|
ups->setTeamcolorEnergy(teamcolorEnergy);
|
||||||
ups->setRadius(radius);
|
ups->setRadius(radius);
|
||||||
|
ups->setBlendMode(ParticleSystem::strToBlendMode(mode));
|
||||||
}
|
}
|
||||||
|
|
||||||
void UnitParticleSystemType::load(const string &dir, const string &path){
|
void UnitParticleSystemType::load(const string &dir, const string &path){
|
||||||
|
@ -59,6 +59,7 @@ protected:
|
|||||||
bool fixed;
|
bool fixed;
|
||||||
bool teamcolorNoEnergy;
|
bool teamcolorNoEnergy;
|
||||||
bool teamcolorEnergy;
|
bool teamcolorEnergy;
|
||||||
|
string mode;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
UnitParticleSystemType();
|
UnitParticleSystemType();
|
||||||
|
@ -151,7 +151,9 @@ public:
|
|||||||
void setActive(bool active);
|
void setActive(bool active);
|
||||||
void setObserver(ParticleObserver *particleObserver);
|
void setObserver(ParticleObserver *particleObserver);
|
||||||
void setVisible(bool visible);
|
void setVisible(bool visible);
|
||||||
|
void setBlendMode(BlendMode blendMode) {this->blendMode= blendMode;}
|
||||||
|
|
||||||
|
static BlendMode strToBlendMode(const string &str);
|
||||||
//misc
|
//misc
|
||||||
void fade();
|
void fade();
|
||||||
int isEmpty() const;
|
int isEmpty() const;
|
||||||
|
@ -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 ==========================
|
// =============== SET ==========================
|
||||||
|
|
||||||
@ -365,13 +377,9 @@ void UnitParticleSystem::initParticle(Particle *p, int particleIndex){
|
|||||||
else
|
else
|
||||||
{// rotate it according to rotation
|
{// rotate it according to rotation
|
||||||
float rad=degToRad(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->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->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(){
|
void UnitParticleSystem::update(){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user