1
0
Fork 0

YASim: add initalizer to Model.hpp, cleanup constructor.

This commit is contained in:
Henning Stahlke 2017-04-29 12:31:09 +02:00
parent f9334d8c39
commit b4743b3830
2 changed files with 16 additions and 34 deletions

View file

@ -50,28 +50,13 @@ void printState(State* s)
Model::Model()
{
int i;
for(i=0; i<3; i++) _wind[i] = 0;
_integrator.setBody(&_body);
_integrator.setEnvironment(this);
// Default value of 30 Hz
_integrator.setInterval(1.0f/30.0f);
_agl = 0;
_crashed = false;
_turb = 0;
_ground_cb = new Ground();
_hook = 0;
_launchbar = 0;
_wingSpan = 0;
_groundEffect = 0;
for(i=0; i<3; i++) _geRefPoint[i] = 0;
_global_ground[0] = 0; _global_ground[1] = 0; _global_ground[2] = 1;
_global_ground[3] = -100000;
_modelN = fgGetNode("/fdm/yasim/forces", true);
_fAeroXN = _modelN->getNode("f-x-drag", true);
_fAeroYN = _modelN->getNode("f-y-side", true);
@ -98,8 +83,7 @@ void Model::getThrust(float* out) const
{
float tmp[3];
out[0] = out[1] = out[2] = 0;
int i;
for(i=0; i<_thrusters.size(); i++) {
for(int i=0; i<_thrusters.size(); i++) {
Thruster* t = (Thruster*)_thrusters.get(i);
t->getThrust(tmp);
Math::add3(tmp, out, out);
@ -153,8 +137,6 @@ void Model::initIteration()
Hitch* h = (Hitch*)_hitches.get(i);
h->integrate(_integrator.getInterval());
}
}
// This function initializes some variables for the rotor calculation

View file

@ -87,33 +87,33 @@ private:
Integrator _integrator;
RigidBody _body;
Turbulence* _turb;
Turbulence* _turb {nullptr};
Vector _thrusters;
Vector _surfaces;
Rotorgear _rotorgear;
Vector _gears;
Hook* _hook;
Launchbar* _launchbar;
Hook* _hook {nullptr};
Launchbar* _launchbar {nullptr};
Vector _hitches;
float _wingSpan;
float _groundEffect;
float _geRefPoint[3];
float _wingSpan {0};
float _groundEffect {0};
float _geRefPoint[3] {0,0,0};
Ground* _ground_cb;
double _global_ground[4];
double _global_ground[4] {0,0,1, -1e5};
Atmosphere _atmo;
float _wind[3];
float _wind[3] {0,0,0};
// Accumulators for the total internal gyro and engine torque
float _gyro[3];
float _torque[3];
float _gyro[3] {0,0,0};
float _torque[3] {0,0,0};
State* _s;
bool _crashed;
float _agl;
bool _crashed {false};
float _agl {0};
SGPropertyNode_ptr _modelN;
SGPropertyNode_ptr _fAeroXN;
SGPropertyNode_ptr _fAeroYN;