2001-12-01 06:22:24 +00:00
|
|
|
#include "Math.hpp"
|
|
|
|
#include "Thruster.hpp"
|
|
|
|
namespace yasim {
|
|
|
|
|
|
|
|
Thruster::Thruster()
|
|
|
|
{
|
|
|
|
_dir[0] = 1; _dir[1] = 0; _dir[2] = 0;
|
2001-12-07 20:00:59 +00:00
|
|
|
int i;
|
|
|
|
for(i=0; i<3; i++) _pos[i] = _wind[i] = 0;
|
2001-12-01 06:22:24 +00:00
|
|
|
_throttle = 0;
|
|
|
|
_mixture = 0;
|
2002-02-20 04:27:22 +00:00
|
|
|
_starter = false;
|
2001-12-07 20:00:59 +00:00
|
|
|
_pressure = _temp = _rho = 0;
|
2001-12-01 06:22:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Thruster::~Thruster()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void Thruster::getPosition(float* out)
|
|
|
|
{
|
2001-12-07 20:00:59 +00:00
|
|
|
int i;
|
|
|
|
for(i=0; i<3; i++) out[i] = _pos[i];
|
2001-12-01 06:22:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Thruster::setPosition(float* pos)
|
|
|
|
{
|
2001-12-07 20:00:59 +00:00
|
|
|
int i;
|
|
|
|
for(i=0; i<3; i++) _pos[i] = pos[i];
|
2001-12-01 06:22:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Thruster::getDirection(float* out)
|
|
|
|
{
|
2001-12-07 20:00:59 +00:00
|
|
|
int i;
|
|
|
|
for(i=0; i<3; i++) out[i] = _dir[i];
|
2001-12-01 06:22:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Thruster::setDirection(float* dir)
|
|
|
|
{
|
|
|
|
Math::unit3(dir, _dir);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Thruster::setThrottle(float throttle)
|
|
|
|
{
|
2008-12-04 18:47:49 +00:00
|
|
|
_throttle = Math::clamp(throttle, -1, 1);
|
2001-12-01 06:22:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Thruster::setMixture(float mixture)
|
|
|
|
{
|
2001-12-06 18:13:24 +00:00
|
|
|
_mixture = Math::clamp(mixture, 0, 1);
|
2001-12-01 06:22:24 +00:00
|
|
|
}
|
|
|
|
|
2004-07-20 22:17:58 +00:00
|
|
|
|
2002-02-20 04:27:22 +00:00
|
|
|
void Thruster::setStarter(bool starter)
|
|
|
|
{
|
|
|
|
_starter = starter;
|
|
|
|
}
|
|
|
|
|
2001-12-01 06:22:24 +00:00
|
|
|
void Thruster::setWind(float* wind)
|
|
|
|
{
|
2001-12-07 20:00:59 +00:00
|
|
|
int i;
|
|
|
|
for(i=0; i<3; i++) _wind[i] = wind[i];
|
2001-12-01 06:22:24 +00:00
|
|
|
}
|
|
|
|
|
2002-06-10 08:47:29 +00:00
|
|
|
void Thruster::setAir(float pressure, float temp, float density)
|
2001-12-01 06:22:24 +00:00
|
|
|
{
|
2001-12-07 20:00:59 +00:00
|
|
|
_pressure = pressure;
|
|
|
|
_temp = temp;
|
2002-06-10 08:47:29 +00:00
|
|
|
_rho = density;
|
2001-12-01 06:22:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}; // namespace yasim
|