YASim: add initalizer to Model.hpp, cleanup constructor.
This commit is contained in:
parent
f9334d8c39
commit
b4743b3830
2 changed files with 16 additions and 34 deletions
|
@ -50,28 +50,13 @@ void printState(State* s)
|
||||||
|
|
||||||
Model::Model()
|
Model::Model()
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
for(i=0; i<3; i++) _wind[i] = 0;
|
|
||||||
|
|
||||||
_integrator.setBody(&_body);
|
_integrator.setBody(&_body);
|
||||||
_integrator.setEnvironment(this);
|
_integrator.setEnvironment(this);
|
||||||
|
|
||||||
// Default value of 30 Hz
|
// Default value of 30 Hz
|
||||||
_integrator.setInterval(1.0f/30.0f);
|
_integrator.setInterval(1.0f/30.0f);
|
||||||
|
|
||||||
_agl = 0;
|
|
||||||
_crashed = false;
|
|
||||||
_turb = 0;
|
|
||||||
_ground_cb = new Ground();
|
_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);
|
_modelN = fgGetNode("/fdm/yasim/forces", true);
|
||||||
_fAeroXN = _modelN->getNode("f-x-drag", true);
|
_fAeroXN = _modelN->getNode("f-x-drag", true);
|
||||||
_fAeroYN = _modelN->getNode("f-y-side", true);
|
_fAeroYN = _modelN->getNode("f-y-side", true);
|
||||||
|
@ -98,8 +83,7 @@ void Model::getThrust(float* out) const
|
||||||
{
|
{
|
||||||
float tmp[3];
|
float tmp[3];
|
||||||
out[0] = out[1] = out[2] = 0;
|
out[0] = out[1] = out[2] = 0;
|
||||||
int i;
|
for(int i=0; i<_thrusters.size(); i++) {
|
||||||
for(i=0; i<_thrusters.size(); i++) {
|
|
||||||
Thruster* t = (Thruster*)_thrusters.get(i);
|
Thruster* t = (Thruster*)_thrusters.get(i);
|
||||||
t->getThrust(tmp);
|
t->getThrust(tmp);
|
||||||
Math::add3(tmp, out, out);
|
Math::add3(tmp, out, out);
|
||||||
|
@ -153,8 +137,6 @@ void Model::initIteration()
|
||||||
Hitch* h = (Hitch*)_hitches.get(i);
|
Hitch* h = (Hitch*)_hitches.get(i);
|
||||||
h->integrate(_integrator.getInterval());
|
h->integrate(_integrator.getInterval());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// This function initializes some variables for the rotor calculation
|
// This function initializes some variables for the rotor calculation
|
||||||
|
|
|
@ -87,33 +87,33 @@ private:
|
||||||
Integrator _integrator;
|
Integrator _integrator;
|
||||||
RigidBody _body;
|
RigidBody _body;
|
||||||
|
|
||||||
Turbulence* _turb;
|
Turbulence* _turb {nullptr};
|
||||||
|
|
||||||
Vector _thrusters;
|
Vector _thrusters;
|
||||||
Vector _surfaces;
|
Vector _surfaces;
|
||||||
Rotorgear _rotorgear;
|
Rotorgear _rotorgear;
|
||||||
Vector _gears;
|
Vector _gears;
|
||||||
Hook* _hook;
|
Hook* _hook {nullptr};
|
||||||
Launchbar* _launchbar;
|
Launchbar* _launchbar {nullptr};
|
||||||
Vector _hitches;
|
Vector _hitches;
|
||||||
|
|
||||||
float _wingSpan;
|
float _wingSpan {0};
|
||||||
float _groundEffect;
|
float _groundEffect {0};
|
||||||
float _geRefPoint[3];
|
float _geRefPoint[3] {0,0,0};
|
||||||
|
|
||||||
Ground* _ground_cb;
|
Ground* _ground_cb;
|
||||||
double _global_ground[4];
|
double _global_ground[4] {0,0,1, -1e5};
|
||||||
Atmosphere _atmo;
|
Atmosphere _atmo;
|
||||||
float _wind[3];
|
float _wind[3] {0,0,0};
|
||||||
|
|
||||||
|
|
||||||
// Accumulators for the total internal gyro and engine torque
|
// Accumulators for the total internal gyro and engine torque
|
||||||
float _gyro[3];
|
float _gyro[3] {0,0,0};
|
||||||
float _torque[3];
|
float _torque[3] {0,0,0};
|
||||||
|
|
||||||
State* _s;
|
State* _s;
|
||||||
bool _crashed;
|
bool _crashed {false};
|
||||||
float _agl;
|
float _agl {0};
|
||||||
SGPropertyNode_ptr _modelN;
|
SGPropertyNode_ptr _modelN;
|
||||||
SGPropertyNode_ptr _fAeroXN;
|
SGPropertyNode_ptr _fAeroXN;
|
||||||
SGPropertyNode_ptr _fAeroYN;
|
SGPropertyNode_ptr _fAeroYN;
|
||||||
|
|
Loading…
Reference in a new issue