mirror of
https://github.com/glest/glest-source.git
synced 2025-09-27 07:59:00 +02:00
Added more debugging and option to disable new streflop usage.
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
// License, or (at your option) any later version
|
||||
// ==============================================================
|
||||
|
||||
#include "streflop_cond.h"
|
||||
#include "math_wrapper.h"
|
||||
#include "particle.h"
|
||||
|
||||
#include <cassert>
|
||||
@@ -263,12 +263,21 @@ void FireParticleSystem::initParticle(Particle *p, int particleIndex){
|
||||
ParticleSystem::initParticle(p, particleIndex);
|
||||
|
||||
float ang= random.randRange(-2.0f*pi, 2.0f*pi);
|
||||
#ifdef USE_STREFLOP
|
||||
float mod= streflop::fabsf(random.randRange(-radius, radius));
|
||||
|
||||
float x= streflop::sinf(ang)*mod;
|
||||
float y= streflop::cosf(ang)*mod;
|
||||
|
||||
float radRatio= streflop::sqrtf(streflop::sqrtf(mod/radius));
|
||||
#else
|
||||
float mod= fabsf(random.randRange(-radius, radius));
|
||||
|
||||
float x= sinf(ang)*mod;
|
||||
float y= cosf(ang)*mod;
|
||||
|
||||
float radRatio= sqrtf(sqrtf(mod/radius));
|
||||
#endif
|
||||
|
||||
p->color= colorNoEnergy*0.5f + colorNoEnergy*0.5f*radRatio;
|
||||
p->energy= static_cast<int>(maxParticleEnergy*radRatio) + random.randRange(-varParticleEnergy, varParticleEnergy);
|
||||
@@ -301,9 +310,15 @@ void FireParticleSystem::setRadius(float radius){
|
||||
}
|
||||
|
||||
void FireParticleSystem::setWind(float windAngle, float windSpeed){
|
||||
#ifdef USE_STREFLOP
|
||||
this->windSpeed.x= streflop::sinf(degToRad(windAngle))*windSpeed;
|
||||
this->windSpeed.y= 0.0f;
|
||||
this->windSpeed.z= streflop::cosf(degToRad(windAngle))*windSpeed;
|
||||
#else
|
||||
this->windSpeed.x= sinf(degToRad(windAngle))*windSpeed;
|
||||
this->windSpeed.y= 0.0f;
|
||||
this->windSpeed.z= cosf(degToRad(windAngle))*windSpeed;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -366,12 +381,21 @@ void UnitParticleSystem::initParticle(Particle *p, int particleIndex){
|
||||
ParticleSystem::initParticle(p, particleIndex);
|
||||
|
||||
float ang= random.randRange(-2.0f*pi, 2.0f*pi);
|
||||
#ifdef USE_STREFLOP
|
||||
float mod= streflop::fabsf(random.randRange(-radius, radius));
|
||||
|
||||
float x= streflop::sinf(ang)*mod;
|
||||
float y= streflop::cosf(ang)*mod;
|
||||
|
||||
float radRatio= streflop::sqrtf(streflop::sqrtf(mod/radius));
|
||||
#else
|
||||
float mod= fabsf(random.randRange(-radius, radius));
|
||||
|
||||
float x= sinf(ang)*mod;
|
||||
float y= cosf(ang)*mod;
|
||||
|
||||
float radRatio= sqrtf(sqrtf(mod/radius));
|
||||
#endif
|
||||
|
||||
//p->color= color*0.5f + color*0.5f*radRatio;
|
||||
p->color=color;
|
||||
@@ -393,10 +417,18 @@ void UnitParticleSystem::initParticle(Particle *p, int particleIndex){
|
||||
else
|
||||
{// rotate it according to rotation
|
||||
float rad=degToRad(rotation);
|
||||
#ifdef USE_STREFLOP
|
||||
p->pos= Vec3f(pos.x+x+offset.z*streflop::sinf(rad)+offset.x*streflop::cosf(rad), pos.y+random.randRange(-radius/2, radius/2)+offset.y, pos.z+y+(offset.z*streflop::cosf(rad)-offset.x*streflop::sinf(rad)));
|
||||
if(relativeDirection){
|
||||
p->speed=Vec3f(p->speed.z*streflop::sinf(rad)+p->speed.x*streflop::cosf(rad),p->speed.y,(p->speed.z*streflop::cosf(rad)-p->speed.x*streflop::sinf(rad)));
|
||||
}
|
||||
#else
|
||||
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)));
|
||||
if(relativeDirection){
|
||||
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)));
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -449,9 +481,15 @@ void UnitParticleSystem::setRadius(float radius){
|
||||
}
|
||||
|
||||
void UnitParticleSystem::setWind(float windAngle, float windSpeed){
|
||||
#ifdef USE_STREFLOP
|
||||
this->windSpeed.x= streflop::sinf(degToRad(windAngle))*windSpeed;
|
||||
this->windSpeed.y= 0.0f;
|
||||
this->windSpeed.z= streflop::cosf(degToRad(windAngle))*windSpeed;
|
||||
#else
|
||||
this->windSpeed.x= sinf(degToRad(windAngle))*windSpeed;
|
||||
this->windSpeed.y= 0.0f;
|
||||
this->windSpeed.z= cosf(degToRad(windAngle))*windSpeed;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -499,9 +537,15 @@ void RainParticleSystem::setRadius(float radius){
|
||||
}
|
||||
|
||||
void RainParticleSystem::setWind(float windAngle, float windSpeed){
|
||||
#ifdef USE_STREFLOP
|
||||
this->windSpeed.x= streflop::sinf(degToRad(windAngle))*windSpeed;
|
||||
this->windSpeed.y= 0.0f;
|
||||
this->windSpeed.z= streflop::cosf(degToRad(windAngle))*windSpeed;
|
||||
#else
|
||||
this->windSpeed.x= sinf(degToRad(windAngle))*windSpeed;
|
||||
this->windSpeed.y= 0.0f;
|
||||
this->windSpeed.z= cosf(degToRad(windAngle))*windSpeed;
|
||||
#endif
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -543,9 +587,15 @@ void SnowParticleSystem::setRadius(float radius){
|
||||
}
|
||||
|
||||
void SnowParticleSystem::setWind(float windAngle, float windSpeed){
|
||||
#ifdef USE_STREFLOP
|
||||
this->windSpeed.x= streflop::sinf(degToRad(windAngle))*windSpeed;
|
||||
this->windSpeed.y= 0.0f;
|
||||
this->windSpeed.z= streflop::cosf(degToRad(windAngle))*windSpeed;
|
||||
#else
|
||||
this->windSpeed.x= sinf(degToRad(windAngle))*windSpeed;
|
||||
this->windSpeed.y= 0.0f;
|
||||
this->windSpeed.z= cosf(degToRad(windAngle))*windSpeed;
|
||||
#endif
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -655,8 +705,13 @@ void ProjectileParticleSystem::update(){
|
||||
case tSpiral:
|
||||
{
|
||||
pos= flatPos;
|
||||
#ifdef USE_STREFLOP
|
||||
pos+= xVector * streflop::cos(t*trajectoryFrequency*targetVector.length())*trajectoryScale;
|
||||
pos+= yVector * streflop::sin(t*trajectoryFrequency*targetVector.length())*trajectoryScale;
|
||||
#else
|
||||
pos+= xVector * cos(t*trajectoryFrequency*targetVector.length())*trajectoryScale;
|
||||
pos+= yVector * sin(t*trajectoryFrequency*targetVector.length())*trajectoryScale;
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
|
||||
|
Reference in New Issue
Block a user