particles for te skills
This commit is contained in:
parent
012644273e
commit
0550d06faf
|
@ -4,7 +4,7 @@
|
|||
#----------------------------------------------------------------------------
|
||||
AC_PREREQ([2.54])
|
||||
|
||||
AC_INIT([megaglest], [3.2.3], [matze@braunis.de])
|
||||
AC_INIT([megaglest], [3.2.4-1-beta2], [matze@braunis.de])
|
||||
AC_CONFIG_SRCDIR([mk/jam/build.jam])
|
||||
AC_CONFIG_AUX_DIR([mk/autoconf])
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ namespace Shared{ namespace G3dViewer{
|
|||
// class MainWindow
|
||||
// ===============================================
|
||||
|
||||
const string MainWindow::versionString= "v1.3.4";
|
||||
const string MainWindow::versionString= "v1.3.5-beta1";
|
||||
const string MainWindow::winHeader= "G3D viewer " + versionString + " - Built: " + __DATE__;
|
||||
|
||||
MainWindow::MainWindow(const string &modelPath):
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// ==============================================================
|
||||
// This file is part of Glest (www.glest.org)
|
||||
//
|
||||
// Copyright (C) 2001-2008 Martiño Figueroa
|
||||
// Copyright (C) 2001-2008 Marti<EFBFBD>o Figueroa
|
||||
//
|
||||
// You can redistribute this code and/or modify it under
|
||||
// the terms of the GNU General Public License as published
|
||||
|
@ -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-4-beta1";
|
||||
const string glestVersionString= "v3.2.4-1-beta2";
|
||||
|
||||
string getCrashDumpFileName(){
|
||||
return "glest"+glestVersionString+".dmp";
|
||||
|
@ -52,11 +52,11 @@ string getAboutString2(int i){
|
|||
|
||||
string getTeammateName(int i){
|
||||
switch(i){
|
||||
case 0: return "Martiño Figueroa";
|
||||
case 1: return "José Luis González";
|
||||
case 2: return "Tucho Fernández";
|
||||
case 3: return "José Zanni";
|
||||
case 4: return "Félix Menéndez";
|
||||
case 0: return "Marti<EFBFBD>o Figueroa";
|
||||
case 1: return "Jos<EFBFBD> Luis Gonz<6E>lez";
|
||||
case 2: return "Tucho Fern<EFBFBD>ndez";
|
||||
case 3: return "Jos<EFBFBD> Zanni";
|
||||
case 4: return "F<EFBFBD>lix Men<65>ndez";
|
||||
case 5: return "Marcos Caruncho";
|
||||
case 6: return "Matthias Braun";
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// ==============================================================
|
||||
// This file is part of Glest (www.glest.org)
|
||||
//
|
||||
// Copyright (C) 2001-2008 Martiño Figueroa
|
||||
// Copyright (C) 2010-2010 Titus Tscharntke
|
||||
//
|
||||
// You can redistribute this code and/or modify it under
|
||||
// the terms of the GNU General Public License as published
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// ==============================================================
|
||||
// This file is part of Glest (www.glest.org)
|
||||
//
|
||||
// Copyright (C) 2001-2008 Martiño Figueroa
|
||||
// Copyright (C) 2001-2008 Marti<EFBFBD>o Figueroa
|
||||
//
|
||||
// You can redistribute this code and/or modify it under
|
||||
// the terms of the GNU General Public License as published
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// ==============================================================
|
||||
// This file is part of Glest (www.glest.org)
|
||||
//
|
||||
// Copyright (C) 2001-2008 Martiño Figueroa
|
||||
// Copyright (C) 2001-2008 Marti<EFBFBD>o Figueroa
|
||||
//
|
||||
// You can redistribute this code and/or modify it under
|
||||
// the terms of the GNU General Public License as published
|
||||
|
@ -1351,11 +1351,19 @@ void Renderer::renderUnits(){
|
|||
const Model *model= unit->getCurrentModel();
|
||||
model->updateInterpolationData(unit->getAnimProgress(), unit->isAlive());
|
||||
modelRenderer->render(model);
|
||||
|
||||
triangleCount+= model->getTriangleCount();
|
||||
pointCount+= model->getVertexCount();
|
||||
|
||||
glPopMatrix();
|
||||
if(unit->skillParticleSystem!=NULL){
|
||||
unit->skillParticleSystem->setVisible(true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(unit->skillParticleSystem!=NULL){
|
||||
unit->skillParticleSystem->setVisible(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// ==============================================================
|
||||
// This file is part of Glest (www.glest.org)
|
||||
//
|
||||
// Copyright (C) 2001-2008 Martiño Figueroa
|
||||
// Copyright (C) 2001-2008 Marti<EFBFBD>o Figueroa
|
||||
//
|
||||
// You can redistribute this code and/or modify it under
|
||||
// the terms of the GNU General Public License as published
|
||||
|
@ -13,6 +13,7 @@
|
|||
#include <cassert>
|
||||
|
||||
#include "unit.h"
|
||||
#include "unit_particle_type.h"
|
||||
#include "world.h"
|
||||
#include "upgrade.h"
|
||||
#include "map.h"
|
||||
|
@ -139,11 +140,12 @@ Unit::Unit(int id, const Vec2i &pos, const UnitType *type, Faction *faction, Map
|
|||
if(getType()->getField(fLand)) currField=fLand;
|
||||
|
||||
fire= NULL;
|
||||
skillParticleSystem=NULL;
|
||||
|
||||
computeTotalUpgrade();
|
||||
|
||||
//starting skill
|
||||
currSkill= getType()->getFirstStOfClass(scStop);
|
||||
this->currSkill=getType()->getFirstStOfClass(scStop);
|
||||
}
|
||||
|
||||
Unit::~Unit(){
|
||||
|
@ -311,6 +313,22 @@ void Unit::setCurrSkill(const SkillType *currSkill){
|
|||
if(currSkill->getClass()!=this->currSkill->getClass()){
|
||||
animProgress= 0;
|
||||
lastAnimProgress= 0;
|
||||
|
||||
if(skillParticleSystem!=NULL){
|
||||
skillParticleSystem->fade();
|
||||
skillParticleSystem=NULL;
|
||||
}
|
||||
}
|
||||
if((currSkill->getParticleSystemType()!=NULL)
|
||||
&& (skillParticleSystem==NULL) ){
|
||||
UnitParticleSystemType *upst=currSkill->getParticleSystemType();
|
||||
UnitParticleSystem *ups;
|
||||
ups= new UnitParticleSystem(200);
|
||||
upst->setValues(ups);
|
||||
ups->setPos(getCurrVector());
|
||||
ups->setTeamNumber(getTeam());
|
||||
skillParticleSystem= ups;
|
||||
Renderer::getInstance().manageParticleSystem(ups, rsGame);
|
||||
}
|
||||
progress2= 0;
|
||||
this->currSkill= currSkill;
|
||||
|
@ -588,6 +606,7 @@ bool Unit::update(){
|
|||
float heightDiff= map->getCell(pos)->getHeight() - map->getCell(targetPos)->getHeight();
|
||||
heightFactor= clamp(1.f+heightDiff/5.f, 0.2f, 5.f);
|
||||
}
|
||||
|
||||
|
||||
//update progresses
|
||||
lastAnimProgress= animProgress;
|
||||
|
@ -612,6 +631,16 @@ bool Unit::update(){
|
|||
}
|
||||
}
|
||||
|
||||
if (fire!=NULL)
|
||||
{
|
||||
fire->setPos(getCurrVector());
|
||||
}
|
||||
if (skillParticleSystem!=NULL)
|
||||
{
|
||||
skillParticleSystem->setPos(getCurrVector());
|
||||
skillParticleSystem->setRotation(getRotation());
|
||||
}
|
||||
|
||||
//checks
|
||||
if(animProgress>1.f){
|
||||
animProgress= currSkill->getClass()==scDie? 1.f: 0.f;
|
||||
|
@ -645,7 +674,11 @@ void Unit::tick(){
|
|||
if(hp>type->getTotalMaxHp(&totalUpgrade)){
|
||||
hp= type->getTotalMaxHp(&totalUpgrade);
|
||||
}
|
||||
|
||||
//stop fire
|
||||
if(hp>type->getTotalMaxHp(&totalUpgrade)/2 && fire!=NULL){
|
||||
fire->fade();
|
||||
fire= NULL;
|
||||
}
|
||||
//regenerate ep
|
||||
ep+= type->getEpRegeneration();
|
||||
if(ep>type->getTotalMaxEp(&totalUpgrade)){
|
||||
|
@ -685,7 +718,7 @@ bool Unit::repair(){
|
|||
}
|
||||
|
||||
//stop fire
|
||||
if(hp>type->getMaxHp()/2 && fire!=NULL){
|
||||
if(hp>type->getTotalMaxHp(&totalUpgrade)/2 && fire!=NULL){
|
||||
fire->fade();
|
||||
fire= NULL;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// ==============================================================
|
||||
// This file is part of Glest (www.glest.org)
|
||||
//
|
||||
// Copyright (C) 2001-2008 Martiño Figueroa
|
||||
// Copyright (C) 2001-2008 Marti<EFBFBD>o Figueroa
|
||||
//
|
||||
// You can redistribute this code and/or modify it under
|
||||
// the terms of the GNU General Public License as published
|
||||
|
@ -20,6 +20,7 @@
|
|||
namespace Glest{ namespace Game{
|
||||
|
||||
using Shared::Graphics::ParticleSystem;
|
||||
using Shared::Graphics::UnitParticleSystem;
|
||||
using Shared::Graphics::Vec4f;
|
||||
using Shared::Graphics::Vec2f;
|
||||
using Shared::Graphics::Vec3f;
|
||||
|
@ -127,6 +128,7 @@ public:
|
|||
static const int maxDeadCount;
|
||||
static const float highlightTime;
|
||||
static const int invalidId;
|
||||
UnitParticleSystem *skillParticleSystem;
|
||||
|
||||
private:
|
||||
int id;
|
||||
|
@ -207,6 +209,7 @@ public:
|
|||
float getRotation() const {return rotation;}
|
||||
float getVerticalRotation() const;
|
||||
ParticleSystem *getFire() const {return fire;}
|
||||
UnitParticleSystem *getSkillParticleSystem() const {return skillParticleSystem;}
|
||||
int getKills() {return kills;}
|
||||
const Level *getLevel() const {return level;}
|
||||
const Level *getNextLevel() const;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// ==============================================================
|
||||
// This file is part of Glest (www.glest.org)
|
||||
//
|
||||
// Copyright (C) 2001-2008 Martiño Figueroa
|
||||
// Copyright (C) 2001-2008 Marti<EFBFBD>o Figueroa
|
||||
//
|
||||
// You can redistribute this code and/or modify it under
|
||||
// the terms of the GNU General Public License as published
|
||||
|
@ -18,6 +18,7 @@
|
|||
#include "lang.h"
|
||||
#include "renderer.h"
|
||||
#include "particle_type.h"
|
||||
#include "unit_particle_type.h"
|
||||
#include "tech_tree.h"
|
||||
#include "faction_type.h"
|
||||
#include "leak_dumper.h"
|
||||
|
@ -32,6 +33,8 @@ namespace Glest{ namespace Game{
|
|||
// =====================================================
|
||||
|
||||
SkillType::~SkillType(){
|
||||
delete particleSystemType;
|
||||
|
||||
deleteValues(sounds.getSounds().begin(), sounds.getSounds().end());
|
||||
}
|
||||
|
||||
|
@ -53,6 +56,22 @@ void SkillType::load(const XmlNode *sn, const string &dir, const TechTree *tt, c
|
|||
animation= Renderer::getInstance().newModel(rsGame);
|
||||
animation->load(dir + "/" + path);
|
||||
|
||||
//particles
|
||||
if(sn->hasChild("particle")){
|
||||
const XmlNode *particleNode= sn->getChild("particle");
|
||||
bool particleEnabled= particleNode->getAttribute("value")->getBoolValue();
|
||||
if(particleEnabled){
|
||||
string path= particleNode->getAttribute("path")->getRestrictedValue();
|
||||
particleSystemType= new UnitParticleSystemType();
|
||||
particleSystemType->load(dir, dir + "/" + path);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
particleSystemType=NULL;
|
||||
}
|
||||
|
||||
|
||||
//sound
|
||||
const XmlNode *soundNode= sn->getChild("sound");
|
||||
if(soundNode->getAttribute("enabled")->getBoolValue()){
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// ==============================================================
|
||||
// This file is part of Glest (www.glest.org)
|
||||
//
|
||||
// Copyright (C) 2001-2008 Martiño Figueroa
|
||||
// Copyright (C) 2001-2008 Marti<EFBFBD>o Figueroa
|
||||
//
|
||||
// You can redistribute this code and/or modify it under
|
||||
// the terms of the GNU General Public License as published
|
||||
|
@ -21,6 +21,7 @@
|
|||
#include "element_type.h"
|
||||
#include "factory.h"
|
||||
#include "sound_container.h"
|
||||
#include "particle.h"
|
||||
|
||||
using Shared::Sound::StaticSound;
|
||||
using Shared::Xml::XmlNode;
|
||||
|
@ -33,11 +34,13 @@ using Shared::Util::MultiFactory;
|
|||
|
||||
class ParticleSystemTypeProjectile;
|
||||
class ParticleSystemTypeSplash;
|
||||
class UnitParticleSystemType;
|
||||
class FactionType;
|
||||
class TechTree;
|
||||
class Lang;
|
||||
class TotalUpgrade;
|
||||
|
||||
|
||||
enum Field{
|
||||
fLand,
|
||||
fAir,
|
||||
|
@ -77,6 +80,7 @@ protected:
|
|||
Model *animation;
|
||||
SoundContainer sounds;
|
||||
float soundStartTime;
|
||||
UnitParticleSystemType *particleSystemType;
|
||||
|
||||
public:
|
||||
//varios
|
||||
|
@ -92,6 +96,7 @@ public:
|
|||
const Model *getAnimation() const {return animation;}
|
||||
StaticSound *getSound() const {return sounds.getRandSound();}
|
||||
float getSoundStartTime() const {return soundStartTime;}
|
||||
UnitParticleSystemType *getParticleSystemType() const {return particleSystemType;}
|
||||
|
||||
//other
|
||||
virtual string toString() const= 0;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// ==============================================================
|
||||
// This file is part of Glest Shared Library (www.glest.org)
|
||||
//
|
||||
// Copyright (C) 2001-2008 Martiño Figueroa
|
||||
// Copyright (C) 2001-2008 Marti<EFBFBD>o Figueroa
|
||||
//
|
||||
// You can redistribute this code and/or modify it under
|
||||
// the terms of the GNU General Public License as published
|
||||
|
@ -27,6 +27,7 @@ namespace Shared{ namespace Graphics{
|
|||
|
||||
class ParticleSystem;
|
||||
class FireParticleSystem;
|
||||
class UnitParticleSystem;
|
||||
class RainParticleSystem;
|
||||
class SnowParticleSystem;
|
||||
class ProjectileParticleSystem;
|
||||
|
@ -187,6 +188,65 @@ public:
|
|||
void setWind(float windAngle, float windSpeed);
|
||||
};
|
||||
|
||||
// =====================================================
|
||||
// class UnitParticleSystem
|
||||
// =====================================================
|
||||
|
||||
class UnitParticleSystem: public ParticleSystem{
|
||||
private:
|
||||
float radius;
|
||||
Vec3f windSpeed;
|
||||
Vec3f cRotation;
|
||||
Vec3f fixedAddition;
|
||||
Vec3f oldPosition;
|
||||
public:
|
||||
enum Primitive{
|
||||
pQuad,
|
||||
pLine,
|
||||
pLineAlpha
|
||||
};
|
||||
bool relative;
|
||||
bool fixed;
|
||||
int teamNumber;
|
||||
bool teamcolorNoEnergy;
|
||||
bool teamcolorEnergy;
|
||||
Model *model;
|
||||
Primitive primitive;
|
||||
Vec3f offset;
|
||||
Vec3f direction;
|
||||
float sizeNoEnergy;
|
||||
float gravity;
|
||||
float rotation;
|
||||
|
||||
public:
|
||||
UnitParticleSystem(int particleCount= 2000);
|
||||
|
||||
//virtual
|
||||
virtual void initParticle(Particle *p, int particleIndex);
|
||||
virtual void updateParticle(Particle *p);
|
||||
virtual void update();
|
||||
virtual void setTeamNumber(int teamNumber);
|
||||
//virtual void render(ParticleRenderer *pr, ModelRenderer *mr);
|
||||
|
||||
//set params
|
||||
void setRadius(float radius);
|
||||
void setWind(float windAngle, float windSpeed);
|
||||
|
||||
void setOffset(Vec3f offset) {this->offset= offset;}
|
||||
void setDirection(Vec3f direction) {this->direction= direction;}
|
||||
void setSizeNoEnergy(float sizeNoEnergy) {this->sizeNoEnergy= sizeNoEnergy;}
|
||||
void setGravity(float gravity) {this->gravity= gravity;}
|
||||
void setRotation(float rotation) {this->rotation= rotation;}
|
||||
void setRelative(bool relative) {this->relative= relative;}
|
||||
void setFixed(bool fixed) {this->fixed= fixed;}
|
||||
void setTeamcolorNoEnergy(bool teamcolorNoEnergy) {this->teamcolorNoEnergy= teamcolorNoEnergy;}
|
||||
void setTeamcolorEnergy(bool teamcolorEnergy) {this->teamcolorEnergy= teamcolorEnergy;}
|
||||
void setPrimitive(Primitive primitive) {this->primitive= primitive;}
|
||||
|
||||
static Primitive strToPrimitive(const string &str);
|
||||
|
||||
};
|
||||
|
||||
// =====================================================
|
||||
// class RainParticleSystem
|
||||
// =====================================================
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// ==============================================================
|
||||
// This file is part of Glest Shared Library (www.glest.org)
|
||||
//
|
||||
// Copyright (C) 2001-2008 Martiño Figueroa
|
||||
// Copyright (C) 2001-2008 Marti<EFBFBD>o Figueroa
|
||||
//
|
||||
// You can redistribute this code and/or modify it under
|
||||
// the terms of the GNU General Public License as published
|
||||
|
@ -276,6 +276,183 @@ void FireParticleSystem::setWind(float windAngle, float windSpeed){
|
|||
this->windSpeed.z= cosf(degToRad(windAngle))*windSpeed;
|
||||
}
|
||||
|
||||
|
||||
// ===========================================================================
|
||||
// UnitParticleSystem
|
||||
// ===========================================================================
|
||||
|
||||
UnitParticleSystem::UnitParticleSystem(int particleCount): ParticleSystem(particleCount){
|
||||
|
||||
radius= 0.5f;
|
||||
speed= 0.01f;
|
||||
windSpeed= Vec3f(0.0f);
|
||||
|
||||
setParticleSize(0.6f);
|
||||
setColorNoEnergy(Vec4f(1.0f, 0.5f, 0.0f, 1.0f));
|
||||
|
||||
primitive= pQuad;
|
||||
offset= Vec3f(0.0f);
|
||||
direction= Vec3f(0.0f,1.0f,0.0f);
|
||||
gravity= 0.0f;
|
||||
|
||||
fixed=false;
|
||||
teamcolorNoEnergy=false;
|
||||
teamcolorEnergy=false;
|
||||
rotation=0.0f;
|
||||
|
||||
cRotation= Vec3f(1.0f,1.0f,1.0f);
|
||||
fixedAddition = Vec3f(0.0f,0.0f,0.0f);
|
||||
|
||||
}
|
||||
|
||||
/*void UnitParticleSystem::render(ParticleRenderer *pr,ModelRenderer *mr){
|
||||
if(active){
|
||||
switch(primitive){
|
||||
case pQuad:
|
||||
pr->renderSystem(this);
|
||||
break;
|
||||
case pLine:
|
||||
pr->renderSystemLine(this);
|
||||
break;
|
||||
default:
|
||||
assert(false);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
UnitParticleSystem::Primitive UnitParticleSystem::strToPrimitive(const string &str){
|
||||
if(str=="quad"){
|
||||
return pQuad;
|
||||
}
|
||||
else if(str=="line"){
|
||||
return pLine;
|
||||
}
|
||||
else{
|
||||
throw "Unknown particle primitive: " + str;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void UnitParticleSystem::initParticle(Particle *p, int particleIndex){
|
||||
ParticleSystem::initParticle(p, particleIndex);
|
||||
|
||||
float ang= random.randRange(-2.0f*pi, 2.0f*pi);
|
||||
float mod= fabsf(random.randRange(-radius, radius));
|
||||
|
||||
float x= sinf(ang)*mod;
|
||||
float y= cosf(ang)*mod;
|
||||
|
||||
float radRatio= sqrtf(sqrtf(mod/radius));
|
||||
float rad=degToRad(rotation);
|
||||
|
||||
//p->color= color*0.5f + color*0.5f*radRatio;
|
||||
p->color=color;
|
||||
p->energy= static_cast<int>(maxParticleEnergy*radRatio) + random.randRange(-varParticleEnergy, varParticleEnergy);
|
||||
|
||||
p->lastPos= pos;
|
||||
oldPosition=pos;
|
||||
p->size= particleSize;
|
||||
p->speed= Vec3f(direction.x*speed+direction.x*speed*random.randRange(-0.5f, 0.5f),
|
||||
direction.y*speed+direction.y*speed*random.randRange(-0.5f, 0.5f),
|
||||
direction.z*speed+direction.z*speed*random.randRange(-0.5f, 0.5f));
|
||||
|
||||
if(relative){
|
||||
p->pos= Vec3f(pos.x+x+offset.x, pos.y+random.randRange(-radius/2, radius/2)+offset.y, pos.z+y+offset.z);
|
||||
}
|
||||
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(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(){
|
||||
if(fixed)
|
||||
{
|
||||
fixedAddition= Vec3f(pos.x-oldPosition.x,pos.y-oldPosition.y,pos.z-oldPosition.z);
|
||||
oldPosition=pos;
|
||||
}
|
||||
ParticleSystem::update();
|
||||
}
|
||||
|
||||
void UnitParticleSystem::updateParticle(Particle *p){
|
||||
|
||||
float energyRatio= clamp(static_cast<float>(p->energy)/maxParticleEnergy, 0.f, 1.f);
|
||||
|
||||
p->lastPos+= p->speed;
|
||||
p->pos+= p->speed;
|
||||
if(fixed)
|
||||
{
|
||||
p->lastPos+= fixedAddition;
|
||||
p->pos+= fixedAddition;
|
||||
}
|
||||
p->speed+= p->accel;
|
||||
p->color = color * energyRatio + colorNoEnergy * (1.0f-energyRatio);
|
||||
p->size = particleSize * energyRatio + sizeNoEnergy * (1.0f-energyRatio);
|
||||
p->energy--;
|
||||
|
||||
/*
|
||||
p->lastPos= p->pos;
|
||||
p->pos= p->pos+p->speed;
|
||||
p->energy--;
|
||||
|
||||
if(p->color.x>0.0f)
|
||||
p->color.x*= 0.98f;
|
||||
if(p->color.y>0.0f)
|
||||
p->color.y*= 0.98f;
|
||||
if(p->color.w>0.0f)
|
||||
p->color.w*= 0.98f;
|
||||
|
||||
p->speed.x*=1.001f;
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
// ================= SET PARAMS ====================
|
||||
|
||||
void UnitParticleSystem::setRadius(float radius){
|
||||
this->radius= radius;
|
||||
}
|
||||
|
||||
void UnitParticleSystem::setWind(float windAngle, float windSpeed){
|
||||
this->windSpeed.x= sinf(degToRad(windAngle))*windSpeed;
|
||||
this->windSpeed.y= 0.0f;
|
||||
this->windSpeed.z= cosf(degToRad(windAngle))*windSpeed;
|
||||
}
|
||||
|
||||
void UnitParticleSystem::setTeamNumber(int teamNumber){
|
||||
this->teamNumber=teamNumber;
|
||||
Vec3f tmpCol;
|
||||
|
||||
if(teamNumber==0)
|
||||
{
|
||||
tmpCol=Vec3f(1,0,0);
|
||||
}
|
||||
else if(teamNumber==1)
|
||||
{
|
||||
tmpCol=Vec3f(0,0,1);
|
||||
}
|
||||
else if(teamNumber==2)
|
||||
{
|
||||
tmpCol=Vec3f(0,1,0);
|
||||
}
|
||||
else if(teamNumber==3)
|
||||
{
|
||||
tmpCol=Vec3f(1,1,0);
|
||||
}
|
||||
|
||||
if(teamcolorNoEnergy)
|
||||
{
|
||||
this->color=Vec4f(tmpCol.x,tmpCol.y,tmpCol.z,this->color.w);
|
||||
}
|
||||
if(teamcolorEnergy)
|
||||
{
|
||||
this->colorNoEnergy=Vec4f(tmpCol.x,tmpCol.y,tmpCol.z,this->colorNoEnergy.w);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ===========================================================================
|
||||
// RainParticleSystem
|
||||
// ===========================================================================
|
||||
|
|
Loading…
Reference in New Issue