Cosmetic changes for new code moved into simgear to make the naming scheme
better follow simgear conventions.
This commit is contained in:
parent
65c3caa032
commit
3c7bdc31d9
26 changed files with 120 additions and 132 deletions
|
@ -58,7 +58,7 @@ protected:
|
||||||
double pitch; //degrees
|
double pitch; //degrees
|
||||||
|
|
||||||
char* model_path; //Path to the 3D model
|
char* model_path; //Path to the 3D model
|
||||||
FGModelPlacement aip;
|
SGModelPlacement aip;
|
||||||
|
|
||||||
void Transform();
|
void Transform();
|
||||||
};
|
};
|
||||||
|
|
|
@ -157,7 +157,7 @@ bool FGAILocalTraffic::Init(string ICAO, OperatingState initialState, PatternLeg
|
||||||
string planepath = "Aircraft/c172/Models/c172-dpm.ac";
|
string planepath = "Aircraft/c172/Models/c172-dpm.ac";
|
||||||
SGPath path = globals->get_fg_root();
|
SGPath path = globals->get_fg_root();
|
||||||
path.append(planepath);
|
path.append(planepath);
|
||||||
ssgBranch *model = fgLoad3DModel( path.str(),
|
ssgBranch *model = sgLoad3DModel( path.str(),
|
||||||
planepath.c_str(),
|
planepath.c_str(),
|
||||||
globals->get_props(),
|
globals->get_props(),
|
||||||
globals->get_sim_time_sec() );
|
globals->get_sim_time_sec() );
|
||||||
|
@ -404,8 +404,8 @@ void FGAILocalTraffic::Update(double dt) {
|
||||||
//cout << "In IN_PATTERN\n";
|
//cout << "In IN_PATTERN\n";
|
||||||
if(!inAir) DoGroundElev();
|
if(!inAir) DoGroundElev();
|
||||||
if(!elevInitGood) {
|
if(!elevInitGood) {
|
||||||
if(aip.getFGLocation()->get_cur_elev_m() > -9990.0) {
|
if(aip.getSGLocation()->get_cur_elev_m() > -9990.0) {
|
||||||
pos.setelev(aip.getFGLocation()->get_cur_elev_m() + wheelOffset);
|
pos.setelev(aip.getSGLocation()->get_cur_elev_m() + wheelOffset);
|
||||||
//cout << "TAKEOFF_ROLL, POS = " << pos.lon() << ", " << pos.lat() << ", " << pos.elev() << '\n';
|
//cout << "TAKEOFF_ROLL, POS = " << pos.lon() << ", " << pos.lat() << ", " << pos.elev() << '\n';
|
||||||
//Transform();
|
//Transform();
|
||||||
aip.setVisible(true);
|
aip.setVisible(true);
|
||||||
|
@ -421,8 +421,8 @@ void FGAILocalTraffic::Update(double dt) {
|
||||||
//cout << "*" << flush;
|
//cout << "*" << flush;
|
||||||
if(!elevInitGood) {
|
if(!elevInitGood) {
|
||||||
//DoGroundElev();
|
//DoGroundElev();
|
||||||
if(aip.getFGLocation()->get_cur_elev_m() > -9990.0) {
|
if(aip.getSGLocation()->get_cur_elev_m() > -9990.0) {
|
||||||
pos.setelev(aip.getFGLocation()->get_cur_elev_m() + wheelOffset);
|
pos.setelev(aip.getSGLocation()->get_cur_elev_m() + wheelOffset);
|
||||||
//Transform();
|
//Transform();
|
||||||
aip.setVisible(true);
|
aip.setVisible(true);
|
||||||
//Transform();
|
//Transform();
|
||||||
|
@ -469,8 +469,8 @@ void FGAILocalTraffic::Update(double dt) {
|
||||||
//cout << "In PARKED\n";
|
//cout << "In PARKED\n";
|
||||||
if(!elevInitGood) {
|
if(!elevInitGood) {
|
||||||
DoGroundElev();
|
DoGroundElev();
|
||||||
if(aip.getFGLocation()->get_cur_elev_m() > -9990.0) {
|
if(aip.getSGLocation()->get_cur_elev_m() > -9990.0) {
|
||||||
pos.setelev(aip.getFGLocation()->get_cur_elev_m() + wheelOffset);
|
pos.setelev(aip.getSGLocation()->get_cur_elev_m() + wheelOffset);
|
||||||
//Transform();
|
//Transform();
|
||||||
aip.setVisible(true);
|
aip.setVisible(true);
|
||||||
//Transform();
|
//Transform();
|
||||||
|
@ -613,8 +613,8 @@ void FGAILocalTraffic::FlyTrafficPattern(double dt) {
|
||||||
double dveldt = 5.0;
|
double dveldt = 5.0;
|
||||||
vel += dveldt * dt;
|
vel += dveldt * dt;
|
||||||
}
|
}
|
||||||
if(aip.getFGLocation()->get_cur_elev_m() > -9990.0) {
|
if(aip.getSGLocation()->get_cur_elev_m() > -9990.0) {
|
||||||
pos.setelev(aip.getFGLocation()->get_cur_elev_m() + wheelOffset);
|
pos.setelev(aip.getSGLocation()->get_cur_elev_m() + wheelOffset);
|
||||||
}
|
}
|
||||||
IAS = vel + (cos((hdg - wind_from) * DCL_DEGREES_TO_RADIANS) * wind_speed);
|
IAS = vel + (cos((hdg - wind_from) * DCL_DEGREES_TO_RADIANS) * wind_speed);
|
||||||
if(IAS >= 70) {
|
if(IAS >= 70) {
|
||||||
|
@ -743,8 +743,8 @@ void FGAILocalTraffic::FlyTrafficPattern(double dt) {
|
||||||
// for us in update(...) when the inAir flag is false.
|
// for us in update(...) when the inAir flag is false.
|
||||||
}
|
}
|
||||||
if(pos.elev() < (rwy.threshold_pos.elev()+10.0+wheelOffset)) {
|
if(pos.elev() < (rwy.threshold_pos.elev()+10.0+wheelOffset)) {
|
||||||
if(aip.getFGLocation()->get_cur_elev_m() > -9990.0) {
|
if(aip.getSGLocation()->get_cur_elev_m() > -9990.0) {
|
||||||
if((aip.getFGLocation()->get_cur_elev_m() + wheelOffset) > pos.elev()) {
|
if((aip.getSGLocation()->get_cur_elev_m() + wheelOffset) > pos.elev()) {
|
||||||
slope = 0.0;
|
slope = 0.0;
|
||||||
pitch = 0.0;
|
pitch = 0.0;
|
||||||
leg = LANDING_ROLL;
|
leg = LANDING_ROLL;
|
||||||
|
@ -755,8 +755,8 @@ void FGAILocalTraffic::FlyTrafficPattern(double dt) {
|
||||||
break;
|
break;
|
||||||
case LANDING_ROLL:
|
case LANDING_ROLL:
|
||||||
//inAir = false;
|
//inAir = false;
|
||||||
if(aip.getFGLocation()->get_cur_elev_m() > -9990.0) {
|
if(aip.getSGLocation()->get_cur_elev_m() > -9990.0) {
|
||||||
pos.setelev(aip.getFGLocation()->get_cur_elev_m() + wheelOffset);
|
pos.setelev(aip.getSGLocation()->get_cur_elev_m() + wheelOffset);
|
||||||
}
|
}
|
||||||
track = rwy.hdg;
|
track = rwy.hdg;
|
||||||
double dveldt = -5.0;
|
double dveldt = -5.0;
|
||||||
|
@ -1063,8 +1063,8 @@ void FGAILocalTraffic::Taxi(double dt) {
|
||||||
double slope = 0.0;
|
double slope = 0.0;
|
||||||
pos = dclUpdatePosition(pos, track, slope, dist);
|
pos = dclUpdatePosition(pos, track, slope, dist);
|
||||||
//cout << "Updated position...\n";
|
//cout << "Updated position...\n";
|
||||||
if(aip.getFGLocation()->get_cur_elev_m() > -9990) {
|
if(aip.getSGLocation()->get_cur_elev_m() > -9990) {
|
||||||
pos.setelev(aip.getFGLocation()->get_cur_elev_m() + wheelOffset);
|
pos.setelev(aip.getSGLocation()->get_cur_elev_m() + wheelOffset);
|
||||||
} // else don't change the elev until we get a valid ground elev again!
|
} // else don't change the elev until we get a valid ground elev again!
|
||||||
} else if(lastNode) {
|
} else if(lastNode) {
|
||||||
if(taxiState == TD_LINING_UP) {
|
if(taxiState == TD_LINING_UP) {
|
||||||
|
@ -1082,8 +1082,8 @@ void FGAILocalTraffic::Taxi(double dt) {
|
||||||
double slope = 0.0;
|
double slope = 0.0;
|
||||||
pos = dclUpdatePosition(pos, track, slope, dist);
|
pos = dclUpdatePosition(pos, track, slope, dist);
|
||||||
//cout << "Updated position...\n";
|
//cout << "Updated position...\n";
|
||||||
if(aip.getFGLocation()->get_cur_elev_m() > -9990) {
|
if(aip.getSGLocation()->get_cur_elev_m() > -9990) {
|
||||||
pos.setelev(aip.getFGLocation()->get_cur_elev_m() + wheelOffset);
|
pos.setelev(aip.getSGLocation()->get_cur_elev_m() + wheelOffset);
|
||||||
} // else don't change the elev until we get a valid ground elev again!
|
} // else don't change the elev until we get a valid ground elev again!
|
||||||
if(fabs(hdg - rwy.hdg) <= 1.0) {
|
if(fabs(hdg - rwy.hdg) <= 1.0) {
|
||||||
operatingState = IN_PATTERN;
|
operatingState = IN_PATTERN;
|
||||||
|
@ -1117,14 +1117,14 @@ void FGAILocalTraffic::DoGroundElev() {
|
||||||
// answer with one call to the function, but what I tried in the two commented-out lines
|
// answer with one call to the function, but what I tried in the two commented-out lines
|
||||||
// below only intermittently worked, and I haven't quite groked why yet.
|
// below only intermittently worked, and I haven't quite groked why yet.
|
||||||
//SGBucket buck(pos.lon(), pos.lat());
|
//SGBucket buck(pos.lon(), pos.lat());
|
||||||
//aip.getFGLocation()->set_tile_center(Point3D(buck.get_center_lon(), buck.get_center_lat(), 0.0));
|
//aip.getSGLocation()->set_tile_center(Point3D(buck.get_center_lon(), buck.get_center_lat(), 0.0));
|
||||||
|
|
||||||
double visibility_meters = fgGetDouble("/environment/visibility-m");
|
double visibility_meters = fgGetDouble("/environment/visibility-m");
|
||||||
//globals->get_tile_mgr()->prep_ssg_nodes( acmodel_location,
|
//globals->get_tile_mgr()->prep_ssg_nodes( acmodel_location,
|
||||||
globals->get_tile_mgr()->prep_ssg_nodes( aip.getFGLocation(), visibility_meters );
|
globals->get_tile_mgr()->prep_ssg_nodes( aip.getSGLocation(), visibility_meters );
|
||||||
Point3D scenery_center = globals->get_scenery()->get_center();
|
Point3D scenery_center = globals->get_scenery()->get_center();
|
||||||
globals->get_tile_mgr()->update( aip.getFGLocation(), visibility_meters, (aip.getFGLocation())->get_absolute_view_pos( scenery_center ) );
|
globals->get_tile_mgr()->update( aip.getSGLocation(), visibility_meters, (aip.getSGLocation())->get_absolute_view_pos( scenery_center ) );
|
||||||
// save results of update in FGLocation for fdm...
|
// save results of update in SGLocation for fdm...
|
||||||
|
|
||||||
//if ( globals->get_scenery()->get_cur_elev() > -9990 ) {
|
//if ( globals->get_scenery()->get_cur_elev() > -9990 ) {
|
||||||
// acmodel_location->
|
// acmodel_location->
|
||||||
|
@ -1132,10 +1132,10 @@ void FGAILocalTraffic::DoGroundElev() {
|
||||||
//}
|
//}
|
||||||
|
|
||||||
// The need for this here means that at least 2 consecutive passes are needed :-(
|
// The need for this here means that at least 2 consecutive passes are needed :-(
|
||||||
aip.getFGLocation()->set_tile_center( globals->get_scenery()->get_next_center() );
|
aip.getSGLocation()->set_tile_center( globals->get_scenery()->get_next_center() );
|
||||||
|
|
||||||
//cout << "Transform Elev is " << globals->get_scenery()->get_cur_elev() << '\n';
|
//cout << "Transform Elev is " << globals->get_scenery()->get_cur_elev() << '\n';
|
||||||
aip.getFGLocation()->set_cur_elev_m(globals->get_scenery()->get_cur_elev());
|
aip.getSGLocation()->set_cur_elev_m(globals->get_scenery()->get_cur_elev());
|
||||||
//return(globals->get_scenery()->get_cur_elev());
|
//return(globals->get_scenery()->get_cur_elev());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -228,7 +228,7 @@ private:
|
||||||
* or joystick, but they are tied to specific mouse actions in
|
* or joystick, but they are tied to specific mouse actions in
|
||||||
* rectangular areas of the panel.
|
* rectangular areas of the panel.
|
||||||
*/
|
*/
|
||||||
class FGPanelAction : public FGConditional
|
class FGPanelAction : public SGConditional
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
FGPanelAction ();
|
FGPanelAction ();
|
||||||
|
@ -288,7 +288,7 @@ private:
|
||||||
/**
|
/**
|
||||||
* A transformation for a layer.
|
* A transformation for a layer.
|
||||||
*/
|
*/
|
||||||
class FGPanelTransformation : public FGConditional
|
class FGPanelTransformation : public SGConditional
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -327,7 +327,7 @@ public:
|
||||||
* on current FGFS instrument readings: for example, a texture
|
* on current FGFS instrument readings: for example, a texture
|
||||||
* representing a needle can rotate to show the airspeed.
|
* representing a needle can rotate to show the airspeed.
|
||||||
*/
|
*/
|
||||||
class FGInstrumentLayer : public FGConditional
|
class FGInstrumentLayer : public SGConditional
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -369,7 +369,7 @@ protected:
|
||||||
* may show up in the future (some complex instruments could be
|
* may show up in the future (some complex instruments could be
|
||||||
* entirely hand-coded, for example).
|
* entirely hand-coded, for example).
|
||||||
*/
|
*/
|
||||||
class FGPanelInstrument : public FGConditional
|
class FGPanelInstrument : public SGConditional
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
FGPanelInstrument ();
|
FGPanelInstrument ();
|
||||||
|
@ -491,7 +491,7 @@ public:
|
||||||
DOUBLE_VALUE
|
DOUBLE_VALUE
|
||||||
};
|
};
|
||||||
|
|
||||||
class Chunk : public FGConditional
|
class Chunk : public SGConditional
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Chunk (const string &text, const string &fmt = "%s");
|
Chunk (const string &text, const string &fmt = "%s");
|
||||||
|
|
|
@ -132,12 +132,12 @@ readTexture (const SGPropertyNode * node)
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
static void
|
static void
|
||||||
readConditions (FGConditional * component, const SGPropertyNode * node)
|
readConditions (SGConditional *component, const SGPropertyNode *node)
|
||||||
{
|
{
|
||||||
const SGPropertyNode * conditionNode = node->getChild("condition");
|
const SGPropertyNode * conditionNode = node->getChild("condition");
|
||||||
if (conditionNode != 0)
|
if (conditionNode != 0)
|
||||||
// The top level is implicitly AND
|
// The top level is implicitly AND
|
||||||
component->setCondition(fgReadCondition(globals->get_props(),
|
component->setCondition(sgReadCondition(globals->get_props(),
|
||||||
conditionNode) );
|
conditionNode) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -190,7 +190,7 @@ void FGLaRCsim::update( double dt ) {
|
||||||
|
|
||||||
// Inform LaRCsim of the local terrain altitude
|
// Inform LaRCsim of the local terrain altitude
|
||||||
// Runway_altitude = get_Runway_altitude();
|
// Runway_altitude = get_Runway_altitude();
|
||||||
Runway_altitude = getACModel()->get3DModel()->getFGLocation()->get_cur_elev_m() * SG_METER_TO_FEET;
|
Runway_altitude = getACModel()->get3DModel()->getSGLocation()->get_cur_elev_m() * SG_METER_TO_FEET;
|
||||||
// Weather
|
// Weather
|
||||||
/* V_north_airmass = get_V_north_airmass();
|
/* V_north_airmass = get_V_north_airmass();
|
||||||
V_east_airmass = get_V_east_airmass();
|
V_east_airmass = get_V_east_airmass();
|
||||||
|
|
|
@ -253,7 +253,7 @@ void YASim::copyToYASim(bool copyState)
|
||||||
wind[2] = get_V_down_airmass() * FT2M * -1.0;
|
wind[2] = get_V_down_airmass() * FT2M * -1.0;
|
||||||
|
|
||||||
// Get ground elevation from the FGinterface's FGlocation data
|
// Get ground elevation from the FGinterface's FGlocation data
|
||||||
double ground = getACModel()->get3DModel()->getFGLocation()->get_cur_elev_m();
|
double ground = getACModel()->get3DModel()->getSGLocation()->get_cur_elev_m();
|
||||||
// cout << "YASIM: ground = " << ground << endl;
|
// cout << "YASIM: ground = " << ground << endl;
|
||||||
|
|
||||||
float pressure = fgGetFloat("/environment/pressure-inhg") * INHG2PA;
|
float pressure = fgGetFloat("/environment/pressure-inhg") * INHG2PA;
|
||||||
|
|
|
@ -201,7 +201,7 @@ FGInterface::common_init ()
|
||||||
* SGD_DEGREES_TO_RADIANS );
|
* SGD_DEGREES_TO_RADIANS );
|
||||||
double ground_elev_m = globals->get_scenery()->get_cur_elev();
|
double ground_elev_m = globals->get_scenery()->get_cur_elev();
|
||||||
double ground_elev_ft = ground_elev_m * SG_METER_TO_FEET;
|
double ground_elev_ft = ground_elev_m * SG_METER_TO_FEET;
|
||||||
_acmodel->get3DModel()->getFGLocation()->set_cur_elev_m( ground_elev_m );
|
_acmodel->get3DModel()->getSGLocation()->set_cur_elev_m( ground_elev_m );
|
||||||
_set_Runway_altitude ( ground_elev_ft );
|
_set_Runway_altitude ( ground_elev_ft );
|
||||||
if ( fgGetBool("/sim/presets/onground")
|
if ( fgGetBool("/sim/presets/onground")
|
||||||
|| fgGetDouble("/sim/presets/altitude-ft") < ground_elev_ft ) {
|
|| fgGetDouble("/sim/presets/altitude-ft") < ground_elev_ft ) {
|
||||||
|
@ -504,7 +504,7 @@ void FGInterface::_updateGeodeticPosition( double lat, double lon, double alt )
|
||||||
|
|
||||||
_set_Sea_level_radius( sl_radius * SG_METER_TO_FEET );
|
_set_Sea_level_radius( sl_radius * SG_METER_TO_FEET );
|
||||||
if ( getACModel() != NULL ) {
|
if ( getACModel() != NULL ) {
|
||||||
_set_Runway_altitude( getACModel()->get3DModel()->getFGLocation()->get_cur_elev_m() * SG_METER_TO_FEET );
|
_set_Runway_altitude( getACModel()->get3DModel()->getSGLocation()->get_cur_elev_m() * SG_METER_TO_FEET );
|
||||||
}
|
}
|
||||||
|
|
||||||
_set_sin_lat_geocentric( lat_geoc );
|
_set_sin_lat_geocentric( lat_geoc );
|
||||||
|
@ -561,7 +561,7 @@ void FGInterface::_updateGeocentricPosition( double lat_geoc, double lon,
|
||||||
_set_Geodetic_Position( lat_geod, lon, alt );
|
_set_Geodetic_Position( lat_geod, lon, alt );
|
||||||
|
|
||||||
_set_Sea_level_radius( sl_radius2 * SG_METER_TO_FEET );
|
_set_Sea_level_radius( sl_radius2 * SG_METER_TO_FEET );
|
||||||
_set_Runway_altitude( getACModel()->get3DModel()->getFGLocation()->get_cur_elev_m() * SG_METER_TO_FEET );
|
_set_Runway_altitude( getACModel()->get3DModel()->getSGLocation()->get_cur_elev_m() * SG_METER_TO_FEET );
|
||||||
|
|
||||||
_set_sin_lat_geocentric( lat_geoc );
|
_set_sin_lat_geocentric( lat_geoc );
|
||||||
_set_cos_lat_geocentric( lat_geoc );
|
_set_cos_lat_geocentric( lat_geoc );
|
||||||
|
|
|
@ -104,7 +104,7 @@ FGBinding::read (const SGPropertyNode * node)
|
||||||
{
|
{
|
||||||
const SGPropertyNode * conditionNode = node->getChild("condition");
|
const SGPropertyNode * conditionNode = node->getChild("condition");
|
||||||
if (conditionNode != 0)
|
if (conditionNode != 0)
|
||||||
setCondition(fgReadCondition(globals->get_props(), conditionNode));
|
setCondition(sgReadCondition(globals->get_props(), conditionNode));
|
||||||
|
|
||||||
_command_name = node->getStringValue("command", "");
|
_command_name = node->getStringValue("command", "");
|
||||||
if (_command_name.empty()) {
|
if (_command_name.empty()) {
|
||||||
|
|
|
@ -62,7 +62,7 @@ SG_USING_STD(vector);
|
||||||
* keyboard key, a joystick button or axis, or even a panel
|
* keyboard key, a joystick button or axis, or even a panel
|
||||||
* instrument.</p>
|
* instrument.</p>
|
||||||
*/
|
*/
|
||||||
class FGBinding : public FGConditional
|
class FGBinding : public SGConditional
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
|
@ -980,19 +980,22 @@ fgInitNav ()
|
||||||
bool fgInitPosition() {
|
bool fgInitPosition() {
|
||||||
bool set_pos = false;
|
bool set_pos = false;
|
||||||
|
|
||||||
// Do a first guess if we should be on the ground or in the air
|
// If glideslope is specified, then calculate offset-distance or
|
||||||
// (to be refined later based on other input.
|
// altitude relative to glide slope if either of those was not
|
||||||
|
// specified.
|
||||||
|
if ( fgGetDouble("/sim/presets/glideslope-deg") > 0.1 ) {
|
||||||
|
fgSetDistOrAltFromGlideSlope();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Select ground or air start depending on if an altitude is
|
||||||
|
// specified (this choice can be refined later based on other
|
||||||
|
// input.)
|
||||||
if ( fgGetDouble("/sim/presets/altitude-ft") > -9990.0 ) {
|
if ( fgGetDouble("/sim/presets/altitude-ft") > -9990.0 ) {
|
||||||
fgSetBool("/sim/presets/onground", false);
|
fgSetBool("/sim/presets/onground", false);
|
||||||
} else {
|
} else {
|
||||||
fgSetBool("/sim/presets/onground", true);
|
fgSetBool("/sim/presets/onground", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If glideslope is specified, then calculate offset-distance or
|
|
||||||
// altitude relative to glide slope if either of those was not
|
|
||||||
// specified.
|
|
||||||
fgSetDistOrAltFromGlideSlope();
|
|
||||||
|
|
||||||
// If we have an explicit, in-range lon/lat, don't change it, just use it.
|
// If we have an explicit, in-range lon/lat, don't change it, just use it.
|
||||||
// If not, check for an airport-id and use that.
|
// If not, check for an airport-id and use that.
|
||||||
// If not, default to the middle of the KSFO field.
|
// If not, default to the middle of the KSFO field.
|
||||||
|
@ -1045,33 +1048,18 @@ bool fgInitPosition() {
|
||||||
if ( !set_pos && !vor.empty() ) {
|
if ( !set_pos && !vor.empty() ) {
|
||||||
// a VOR is requested
|
// a VOR is requested
|
||||||
if ( fgSetPosFromNAV( vor, vor_freq ) ) {
|
if ( fgSetPosFromNAV( vor, vor_freq ) ) {
|
||||||
if ( fgGetDouble("/sim/presets/altitude-ft") > -9990.0 ) {
|
|
||||||
fgSetBool("/sim/presets/onground", false);
|
|
||||||
} else {
|
|
||||||
fgSetBool("/sim/presets/onground", true);
|
|
||||||
}
|
|
||||||
set_pos = true;
|
set_pos = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( !set_pos && !ndb.empty() ) {
|
if ( !set_pos && !ndb.empty() ) {
|
||||||
// an NDB is requested
|
// an NDB is requested
|
||||||
if ( fgSetPosFromNAV( ndb, ndb_freq ) ) {
|
if ( fgSetPosFromNAV( ndb, ndb_freq ) ) {
|
||||||
if ( fgGetDouble("/sim/presets/altitude-ft") > -9990.0 ) {
|
|
||||||
fgSetBool("/sim/presets/onground", false);
|
|
||||||
} else {
|
|
||||||
fgSetBool("/sim/presets/onground", true);
|
|
||||||
}
|
|
||||||
set_pos = true;
|
set_pos = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( !set_pos && !fix.empty() ) {
|
if ( !set_pos && !fix.empty() ) {
|
||||||
// a Fix is requested
|
// a Fix is requested
|
||||||
if ( fgSetPosFromFix( fix ) ) {
|
if ( fgSetPosFromFix( fix ) ) {
|
||||||
if ( fgGetDouble("/sim/presets/altitude-ft") > -9990.0 ) {
|
|
||||||
fgSetBool("/sim/presets/onground", false);
|
|
||||||
} else {
|
|
||||||
fgSetBool("/sim/presets/onground", true);
|
|
||||||
}
|
|
||||||
set_pos = true;
|
set_pos = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,6 +52,7 @@ class SGEphemeris;
|
||||||
|
|
||||||
class SGCommandMgr;
|
class SGCommandMgr;
|
||||||
class SGMagVar;
|
class SGMagVar;
|
||||||
|
class SGModelLoader;
|
||||||
class SGPropertyNode;
|
class SGPropertyNode;
|
||||||
class SGRoute;
|
class SGRoute;
|
||||||
class SGTime;
|
class SGTime;
|
||||||
|
@ -66,7 +67,6 @@ class FGControls;
|
||||||
class FGEnvironment;
|
class FGEnvironment;
|
||||||
class FGEnvironmentMgr;
|
class FGEnvironmentMgr;
|
||||||
class FGIO;
|
class FGIO;
|
||||||
class FGModelLoader;
|
|
||||||
class FGModelMgr;
|
class FGModelMgr;
|
||||||
class FGScenery;
|
class FGScenery;
|
||||||
#ifdef FG_MPLAYER_AS
|
#ifdef FG_MPLAYER_AS
|
||||||
|
@ -159,7 +159,7 @@ private:
|
||||||
|
|
||||||
SGCommandMgr *commands;
|
SGCommandMgr *commands;
|
||||||
|
|
||||||
FGModelLoader * model_loader;
|
SGModelLoader * model_loader;
|
||||||
|
|
||||||
FGAircraftModel *acmodel;
|
FGAircraftModel *acmodel;
|
||||||
|
|
||||||
|
@ -275,9 +275,9 @@ public:
|
||||||
|
|
||||||
inline SGCommandMgr *get_commands () { return commands; }
|
inline SGCommandMgr *get_commands () { return commands; }
|
||||||
|
|
||||||
inline FGModelLoader * get_model_loader () { return model_loader; }
|
inline SGModelLoader * get_model_loader () { return model_loader; }
|
||||||
|
|
||||||
inline void set_model_loader (FGModelLoader * loader) {
|
inline void set_model_loader (SGModelLoader * loader) {
|
||||||
model_loader = loader;
|
model_loader = loader;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -497,7 +497,7 @@ void fgRenderFrame() {
|
||||||
}
|
}
|
||||||
// Keep resetting sim time while the sim is initializing
|
// Keep resetting sim time while the sim is initializing
|
||||||
globals->set_sim_time_sec( 0.0 );
|
globals->set_sim_time_sec( 0.0 );
|
||||||
Animation::set_sim_time_sec( 0.0 );
|
SGAnimation::set_sim_time_sec( 0.0 );
|
||||||
} else {
|
} else {
|
||||||
// idle_state is now 1000 meaning we've finished all our
|
// idle_state is now 1000 meaning we've finished all our
|
||||||
// initializations and are running the main loop, so this will
|
// initializations and are running the main loop, so this will
|
||||||
|
@ -1025,7 +1025,7 @@ static void fgMainLoop( void ) {
|
||||||
delta_time_sec = 0;
|
delta_time_sec = 0;
|
||||||
last_time_stamp = current_time_stamp;
|
last_time_stamp = current_time_stamp;
|
||||||
globals->inc_sim_time_sec( delta_time_sec );
|
globals->inc_sim_time_sec( delta_time_sec );
|
||||||
Animation::set_sim_time_sec( globals->get_sim_time_sec() );
|
SGAnimation::set_sim_time_sec( globals->get_sim_time_sec() );
|
||||||
|
|
||||||
static long remainder = 0;
|
static long remainder = 0;
|
||||||
long elapsed;
|
long elapsed;
|
||||||
|
@ -1042,9 +1042,9 @@ static void fgMainLoop( void ) {
|
||||||
sglog().setLogLevels( SG_ALL, (sgDebugPriority)fgGetInt("/sim/log-level") );
|
sglog().setLogLevels( SG_ALL, (sgDebugPriority)fgGetInt("/sim/log-level") );
|
||||||
sglog().setLogLevels( SG_ALL, SG_INFO );
|
sglog().setLogLevels( SG_ALL, SG_INFO );
|
||||||
|
|
||||||
FGLocation * acmodel_location = 0;
|
SGLocation * acmodel_location = 0;
|
||||||
if(cur_fdm_state->getACModel() != 0) {
|
if(cur_fdm_state->getACModel() != 0) {
|
||||||
acmodel_location = (FGLocation *) cur_fdm_state->getACModel()->get3DModel()->getFGLocation();
|
acmodel_location = (SGLocation *) cur_fdm_state->getACModel()->get3DModel()->getSGLocation();
|
||||||
}
|
}
|
||||||
|
|
||||||
SG_LOG( SG_ALL, SG_DEBUG, "Running Main Loop");
|
SG_LOG( SG_ALL, SG_DEBUG, "Running Main Loop");
|
||||||
|
@ -1250,14 +1250,14 @@ static void fgMainLoop( void ) {
|
||||||
|
|
||||||
// update tile manager for FDM...
|
// update tile manager for FDM...
|
||||||
// ...only if location is different than the viewer (to avoid duplicating effort)
|
// ...only if location is different than the viewer (to avoid duplicating effort)
|
||||||
if( acmodel_location != current_view->getFGLocation() ) {
|
if( acmodel_location != current_view->getSGLocation() ) {
|
||||||
if( acmodel_location != 0 ) {
|
if( acmodel_location != 0 ) {
|
||||||
globals->get_tile_mgr()->prep_ssg_nodes( acmodel_location,
|
globals->get_tile_mgr()->prep_ssg_nodes( acmodel_location,
|
||||||
visibility_meters );
|
visibility_meters );
|
||||||
globals->get_tile_mgr()->
|
globals->get_tile_mgr()->
|
||||||
update( acmodel_location, visibility_meters,
|
update( acmodel_location, visibility_meters,
|
||||||
acmodel_location->get_absolute_view_pos(globals->get_scenery()->get_center()) );
|
acmodel_location->get_absolute_view_pos(globals->get_scenery()->get_center()) );
|
||||||
// save results of update in FGLocation for fdm...
|
// save results of update in SGLocation for fdm...
|
||||||
if ( globals->get_scenery()->get_cur_elev() > -9990 ) {
|
if ( globals->get_scenery()->get_cur_elev() > -9990 ) {
|
||||||
acmodel_location->
|
acmodel_location->
|
||||||
set_cur_elev_m( globals->get_scenery()->get_cur_elev() );
|
set_cur_elev_m( globals->get_scenery()->get_cur_elev() );
|
||||||
|
@ -1267,24 +1267,24 @@ static void fgMainLoop( void ) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
globals->get_tile_mgr()->prep_ssg_nodes( current_view->getFGLocation(),
|
globals->get_tile_mgr()->prep_ssg_nodes( current_view->getSGLocation(),
|
||||||
visibility_meters );
|
visibility_meters );
|
||||||
// update tile manager for view...
|
// update tile manager for view...
|
||||||
// IMPORTANT!!! the tilemgr update for view location _must_ be done last
|
// IMPORTANT!!! the tilemgr update for view location _must_ be done last
|
||||||
// after the FDM's until all of Flight Gear code references the viewer's location
|
// after the FDM's until all of Flight Gear code references the viewer's location
|
||||||
// for elevation instead of the "scenery's" current elevation.
|
// for elevation instead of the "scenery's" current elevation.
|
||||||
FGLocation *view_location = globals->get_current_view()->getFGLocation();
|
SGLocation *view_location = globals->get_current_view()->getSGLocation();
|
||||||
globals->get_tile_mgr()->update( view_location, visibility_meters,
|
globals->get_tile_mgr()->update( view_location, visibility_meters,
|
||||||
current_view->get_absolute_view_pos() );
|
current_view->get_absolute_view_pos() );
|
||||||
// save results of update in FGLocation for fdm...
|
// save results of update in SGLocation for fdm...
|
||||||
if ( globals->get_scenery()->get_cur_elev() > -9990 ) {
|
if ( globals->get_scenery()->get_cur_elev() > -9990 ) {
|
||||||
current_view->getFGLocation()->set_cur_elev_m( globals->get_scenery()->get_cur_elev() );
|
current_view->getSGLocation()->set_cur_elev_m( globals->get_scenery()->get_cur_elev() );
|
||||||
}
|
}
|
||||||
current_view->getFGLocation()->set_tile_center( globals->get_scenery()->get_next_center() );
|
current_view->getSGLocation()->set_tile_center( globals->get_scenery()->get_next_center() );
|
||||||
|
|
||||||
// If fdm location is same as viewer's then we didn't do the update for fdm location
|
// If fdm location is same as viewer's then we didn't do the update for fdm location
|
||||||
// above so we need to save the viewer results in the fdm FGLocation as well...
|
// above so we need to save the viewer results in the fdm SGLocation as well...
|
||||||
if( acmodel_location == current_view->getFGLocation() ) {
|
if( acmodel_location == current_view->getSGLocation() ) {
|
||||||
if( acmodel_location != 0 ) {
|
if( acmodel_location != 0 ) {
|
||||||
if ( globals->get_scenery()->get_cur_elev() > -9990 ) {
|
if ( globals->get_scenery()->get_cur_elev() > -9990 ) {
|
||||||
acmodel_location->set_cur_elev_m( globals->get_scenery()->get_cur_elev() );
|
acmodel_location->set_cur_elev_m( globals->get_scenery()->get_cur_elev() );
|
||||||
|
@ -1697,7 +1697,7 @@ static bool fgMainInit( int argc, char **argv ) {
|
||||||
// Initialize the general model subsystem.
|
// Initialize the general model subsystem.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
globals->set_model_loader(new FGModelLoader);
|
globals->set_model_loader(new SGModelLoader);
|
||||||
globals->set_model_mgr(new FGModelMgr);
|
globals->set_model_mgr(new FGModelMgr);
|
||||||
globals->get_model_mgr()->init();
|
globals->get_model_mgr()->init();
|
||||||
globals->get_model_mgr()->bind();
|
globals->get_model_mgr()->bind();
|
||||||
|
|
|
@ -186,15 +186,15 @@ void
|
||||||
FGViewer::init ()
|
FGViewer::init ()
|
||||||
{
|
{
|
||||||
if ( _from_model )
|
if ( _from_model )
|
||||||
_location = (FGLocation *) globals->get_aircraft_model()->get3DModel()->getFGLocation();
|
_location = (SGLocation *) globals->get_aircraft_model()->get3DModel()->getSGLocation();
|
||||||
else
|
else
|
||||||
_location = (FGLocation *) new FGLocation;
|
_location = (SGLocation *) new SGLocation;
|
||||||
|
|
||||||
if ( _type == FG_LOOKAT ) {
|
if ( _type == FG_LOOKAT ) {
|
||||||
if ( _at_model )
|
if ( _at_model )
|
||||||
_target_location = (FGLocation *) globals->get_aircraft_model()->get3DModel()->getFGLocation();
|
_target_location = (SGLocation *) globals->get_aircraft_model()->get3DModel()->getSGLocation();
|
||||||
else
|
else
|
||||||
_target_location = (FGLocation *) new FGLocation;
|
_target_location = (SGLocation *) new SGLocation;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -477,20 +477,20 @@ FGViewer::getZeroElevViewPos ()
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
FGViewer::updateFromModelLocation (FGLocation * location)
|
FGViewer::updateFromModelLocation (SGLocation * location)
|
||||||
{
|
{
|
||||||
sgCopyMat4(LOCAL, location->getCachedTransformMatrix());
|
sgCopyMat4(LOCAL, location->getCachedTransformMatrix());
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
FGViewer::updateAtModelLocation (FGLocation * location)
|
FGViewer::updateAtModelLocation (SGLocation * location)
|
||||||
{
|
{
|
||||||
sgCopyMat4(ATLOCAL,
|
sgCopyMat4(ATLOCAL,
|
||||||
location->getCachedTransformMatrix());
|
location->getCachedTransformMatrix());
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
FGViewer::recalcOurOwnLocation (FGLocation * location, double lon_deg, double lat_deg, double alt_ft,
|
FGViewer::recalcOurOwnLocation (SGLocation * location, double lon_deg, double lat_deg, double alt_ft,
|
||||||
double roll_deg, double pitch_deg, double heading_deg)
|
double roll_deg, double pitch_deg, double heading_deg)
|
||||||
{
|
{
|
||||||
// update from our own data...
|
// update from our own data...
|
||||||
|
@ -668,7 +668,7 @@ FGViewer::recalcLookAt ()
|
||||||
}
|
}
|
||||||
|
|
||||||
// copy results from location class to viewer...
|
// copy results from location class to viewer...
|
||||||
// FIXME: some of these should be changed to reference directly to FGLocation...
|
// FIXME: some of these should be changed to reference directly to SGLocation...
|
||||||
void
|
void
|
||||||
FGViewer::copyLocationData()
|
FGViewer::copyLocationData()
|
||||||
{
|
{
|
||||||
|
|
|
@ -255,7 +255,7 @@ public:
|
||||||
inline void set_clean() { _dirty = false; }
|
inline void set_clean() { _dirty = false; }
|
||||||
|
|
||||||
// return eye location...
|
// return eye location...
|
||||||
virtual FGLocation * getFGLocation () const { return _location; }
|
virtual SGLocation * getSGLocation () const { return _location; }
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -322,8 +322,8 @@ private:
|
||||||
bool _at_model;
|
bool _at_model;
|
||||||
int _at_model_index; // number of model (for multi model)
|
int _at_model_index; // number of model (for multi model)
|
||||||
|
|
||||||
FGLocation * _location;
|
SGLocation * _location;
|
||||||
FGLocation * _target_location;
|
SGLocation * _target_location;
|
||||||
|
|
||||||
// the nominal field of view (angle, in degrees)
|
// the nominal field of view (angle, in degrees)
|
||||||
double _fov_deg;
|
double _fov_deg;
|
||||||
|
@ -372,9 +372,9 @@ private:
|
||||||
void recalcLookFrom();
|
void recalcLookFrom();
|
||||||
void recalcLookAt();
|
void recalcLookAt();
|
||||||
void copyLocationData();
|
void copyLocationData();
|
||||||
void updateFromModelLocation (FGLocation * location);
|
void updateFromModelLocation (SGLocation * location);
|
||||||
void updateAtModelLocation (FGLocation * location);
|
void updateAtModelLocation (SGLocation * location);
|
||||||
void recalcOurOwnLocation (FGLocation * location, double lon_deg, double lat_deg, double alt_ft,
|
void recalcOurOwnLocation (SGLocation * location, double lon_deg, double lat_deg, double alt_ft,
|
||||||
double roll_deg, double pitch_deg, double heading_deg);
|
double roll_deg, double pitch_deg, double heading_deg);
|
||||||
|
|
||||||
// add to _heading_offset_deg
|
// add to _heading_offset_deg
|
||||||
|
|
|
@ -53,7 +53,7 @@ FGAircraftModel::~FGAircraftModel ()
|
||||||
void
|
void
|
||||||
FGAircraftModel::init ()
|
FGAircraftModel::init ()
|
||||||
{
|
{
|
||||||
_aircraft = new FGModelPlacement;
|
_aircraft = new SGModelPlacement;
|
||||||
string path = fgGetString("/sim/model/path", "Models/Geometry/glider.ac");
|
string path = fgGetString("/sim/model/path", "Models/Geometry/glider.ac");
|
||||||
try {
|
try {
|
||||||
ssgBranch *model = fgLoad3DModelPanel( globals->get_fg_root(),
|
ssgBranch *model = fgLoad3DModelPanel( globals->get_fg_root(),
|
||||||
|
|
|
@ -21,7 +21,7 @@ SG_USING_STD(vector);
|
||||||
// Don't pull in the headers, since we don't need them here.
|
// Don't pull in the headers, since we don't need them here.
|
||||||
class ssgRoot;
|
class ssgRoot;
|
||||||
class ssgSelector;
|
class ssgSelector;
|
||||||
class FGModelPlacement;
|
class SGModelPlacement;
|
||||||
|
|
||||||
|
|
||||||
class FGAircraftModel : public FGSubsystem
|
class FGAircraftModel : public FGSubsystem
|
||||||
|
@ -36,11 +36,11 @@ public:
|
||||||
virtual void unbind ();
|
virtual void unbind ();
|
||||||
virtual void update (double dt);
|
virtual void update (double dt);
|
||||||
virtual void draw ();
|
virtual void draw ();
|
||||||
virtual FGModelPlacement * get3DModel() { return _aircraft; }
|
virtual SGModelPlacement * get3DModel() { return _aircraft; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
FGModelPlacement * _aircraft;
|
SGModelPlacement * _aircraft;
|
||||||
ssgSelector * _selector;
|
ssgSelector * _selector;
|
||||||
ssgRoot * _scene;
|
ssgRoot * _scene;
|
||||||
float _nearplane;
|
float _nearplane;
|
||||||
|
|
|
@ -84,7 +84,7 @@ fgLoad3DModelPanel( const string &fg_root, const string &path,
|
||||||
ssgTransform * alignmainmodel = new ssgTransform;
|
ssgTransform * alignmainmodel = new ssgTransform;
|
||||||
alignmainmodel->addKid(model);
|
alignmainmodel->addKid(model);
|
||||||
sgMat4 res_matrix;
|
sgMat4 res_matrix;
|
||||||
fgMakeOffsetsMatrix(&res_matrix,
|
sgMakeOffsetsMatrix(&res_matrix,
|
||||||
props.getFloatValue("/offsets/heading-deg", 0.0),
|
props.getFloatValue("/offsets/heading-deg", 0.0),
|
||||||
props.getFloatValue("/offsets/roll-deg", 0.0),
|
props.getFloatValue("/offsets/roll-deg", 0.0),
|
||||||
props.getFloatValue("/offsets/pitch-deg", 0.0),
|
props.getFloatValue("/offsets/pitch-deg", 0.0),
|
||||||
|
@ -111,7 +111,7 @@ fgLoad3DModelPanel( const string &fg_root, const string &path,
|
||||||
const char * name = animation_nodes[i]->getStringValue("name", 0);
|
const char * name = animation_nodes[i]->getStringValue("name", 0);
|
||||||
vector<SGPropertyNode_ptr> name_nodes =
|
vector<SGPropertyNode_ptr> name_nodes =
|
||||||
animation_nodes[i]->getChildren("object-name");
|
animation_nodes[i]->getChildren("object-name");
|
||||||
fgMakeAnimation( model, name, name_nodes, prop_root, animation_nodes[i],
|
sgMakeAnimation( model, name, name_nodes, prop_root, animation_nodes[i],
|
||||||
sim_time_sec);
|
sim_time_sec);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -121,7 +121,7 @@ fgLoad3DModelPanel( const string &fg_root, const string &path,
|
||||||
SGPropertyNode_ptr node = model_nodes[i];
|
SGPropertyNode_ptr node = model_nodes[i];
|
||||||
ssgTransform * align = new ssgTransform;
|
ssgTransform * align = new ssgTransform;
|
||||||
sgMat4 res_matrix;
|
sgMat4 res_matrix;
|
||||||
fgMakeOffsetsMatrix(&res_matrix,
|
sgMakeOffsetsMatrix(&res_matrix,
|
||||||
node->getFloatValue("offsets/heading-deg", 0.0),
|
node->getFloatValue("offsets/heading-deg", 0.0),
|
||||||
node->getFloatValue("offsets/roll-deg", 0.0),
|
node->getFloatValue("offsets/roll-deg", 0.0),
|
||||||
node->getFloatValue("offsets/pitch-deg", 0.0),
|
node->getFloatValue("offsets/pitch-deg", 0.0),
|
||||||
|
@ -130,7 +130,7 @@ fgLoad3DModelPanel( const string &fg_root, const string &path,
|
||||||
node->getFloatValue("offsets/z-m", 0.0));
|
node->getFloatValue("offsets/z-m", 0.0));
|
||||||
align->setTransform(res_matrix);
|
align->setTransform(res_matrix);
|
||||||
|
|
||||||
ssgBranch * kid = fgLoad3DModel( fg_root, node->getStringValue("path"),
|
ssgBranch * kid = sgLoad3DModel( fg_root, node->getStringValue("path"),
|
||||||
prop_root, sim_time_sec );
|
prop_root, sim_time_sec );
|
||||||
align->addKid(kid);
|
align->addKid(kid);
|
||||||
model->addKid(align);
|
model->addKid(align);
|
||||||
|
|
|
@ -53,7 +53,7 @@ class FGLocation;
|
||||||
* list wrapper to add animations to the model.
|
* list wrapper to add animations to the model.
|
||||||
*
|
*
|
||||||
* Subsystems should not normally invoke this function directly;
|
* Subsystems should not normally invoke this function directly;
|
||||||
* instead, they should use the FGModelLoader declared in loader.hxx.
|
* instead, they should use the SGModelLoader declared in loader.hxx.
|
||||||
*/
|
*/
|
||||||
ssgBranch *fgLoad3DModelPanel( const string& fg_root, const string &path,
|
ssgBranch *fgLoad3DModelPanel( const string& fg_root, const string &path,
|
||||||
SGPropertyNode *prop_root,
|
SGPropertyNode *prop_root,
|
||||||
|
|
|
@ -45,10 +45,10 @@ FGModelMgr::init ()
|
||||||
SG_LOG(SG_GENERAL, SG_INFO,
|
SG_LOG(SG_GENERAL, SG_INFO,
|
||||||
"Adding model " << node->getStringValue("name", "[unnamed]"));
|
"Adding model " << node->getStringValue("name", "[unnamed]"));
|
||||||
Instance * instance = new Instance;
|
Instance * instance = new Instance;
|
||||||
FGModelPlacement *model = new FGModelPlacement;
|
SGModelPlacement *model = new SGModelPlacement;
|
||||||
instance->model = model;
|
instance->model = model;
|
||||||
ssgBranch *object
|
ssgBranch *object
|
||||||
= fgLoad3DModel( globals->get_fg_root(),
|
= sgLoad3DModel( globals->get_fg_root(),
|
||||||
node->getStringValue("path",
|
node->getStringValue("path",
|
||||||
"Models/Geometry/glider.ac"),
|
"Models/Geometry/glider.ac"),
|
||||||
globals->get_props(),
|
globals->get_props(),
|
||||||
|
@ -117,7 +117,7 @@ FGModelMgr::update (double dt)
|
||||||
{
|
{
|
||||||
for (unsigned int i = 0; i < _instances.size(); i++) {
|
for (unsigned int i = 0; i < _instances.size(); i++) {
|
||||||
Instance * instance = _instances[i];
|
Instance * instance = _instances[i];
|
||||||
FGModelPlacement * model = instance->model;
|
SGModelPlacement * model = instance->model;
|
||||||
|
|
||||||
// Optionally set position from properties
|
// Optionally set position from properties
|
||||||
if (instance->lon_deg_node != 0)
|
if (instance->lon_deg_node != 0)
|
||||||
|
|
|
@ -21,7 +21,7 @@ SG_USING_STD(vector);
|
||||||
// Don't pull in headers, since we don't need them here.
|
// Don't pull in headers, since we don't need them here.
|
||||||
class ssgSelector;
|
class ssgSelector;
|
||||||
class SGPropertyNode;
|
class SGPropertyNode;
|
||||||
class FGModelPlacement;
|
class SGModelPlacement;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -37,18 +37,18 @@ public:
|
||||||
* The model manager uses the property nodes to update the model's
|
* The model manager uses the property nodes to update the model's
|
||||||
* position and orientation; any of the property node pointers may
|
* position and orientation; any of the property node pointers may
|
||||||
* be set to zero to avoid update. Normally, a caller should
|
* be set to zero to avoid update. Normally, a caller should
|
||||||
* load the model by instantiating FGModelPlacement with the path
|
* load the model by instantiating SGModelPlacement with the path
|
||||||
* to the model or its XML wrapper, then assign any relevant
|
* to the model or its XML wrapper, then assign any relevant
|
||||||
* property node pointers.
|
* property node pointers.
|
||||||
*
|
*
|
||||||
* @see FGModelPlacement
|
* @see SGModelPlacement
|
||||||
* @see FGModelMgr#add_instance
|
* @see FGModelMgr#add_instance
|
||||||
*/
|
*/
|
||||||
struct Instance
|
struct Instance
|
||||||
{
|
{
|
||||||
Instance ();
|
Instance ();
|
||||||
virtual ~Instance ();
|
virtual ~Instance ();
|
||||||
FGModelPlacement * model;
|
SGModelPlacement * model;
|
||||||
SGPropertyNode * lon_deg_node;
|
SGPropertyNode * lon_deg_node;
|
||||||
SGPropertyNode * lat_deg_node;
|
SGPropertyNode * lat_deg_node;
|
||||||
SGPropertyNode * elev_ft_node;
|
SGPropertyNode * elev_ft_node;
|
||||||
|
|
|
@ -89,7 +89,7 @@ bool fgGenTile( const string& path, SGBucket b,
|
||||||
double *bounding_radius,
|
double *bounding_radius,
|
||||||
ssgBranch* geometry )
|
ssgBranch* geometry )
|
||||||
{
|
{
|
||||||
FGNewMat *newmat;
|
SGMaterial *newmat;
|
||||||
|
|
||||||
ssgSimpleState *state = NULL;
|
ssgSimpleState *state = NULL;
|
||||||
|
|
||||||
|
@ -283,7 +283,7 @@ class LeafUserData : public ssgBase
|
||||||
public:
|
public:
|
||||||
bool is_filled_in;
|
bool is_filled_in;
|
||||||
ssgLeaf * leaf;
|
ssgLeaf * leaf;
|
||||||
FGNewMat * mat;
|
SGMaterial * mat;
|
||||||
ssgBranch * branch;
|
ssgBranch * branch;
|
||||||
float sin_lat;
|
float sin_lat;
|
||||||
float cos_lat;
|
float cos_lat;
|
||||||
|
@ -306,13 +306,13 @@ public:
|
||||||
float * p3;
|
float * p3;
|
||||||
sgVec3 center;
|
sgVec3 center;
|
||||||
double area;
|
double area;
|
||||||
FGNewMat::ObjectGroup * object_group;
|
SGMaterial::ObjectGroup * object_group;
|
||||||
ssgBranch * branch;
|
ssgBranch * branch;
|
||||||
LeafUserData * leafData;
|
LeafUserData * leafData;
|
||||||
unsigned int seed;
|
unsigned int seed;
|
||||||
|
|
||||||
void fill_in_triangle();
|
void fill_in_triangle();
|
||||||
void add_object_to_triangle(FGNewMat::Object * object);
|
void add_object_to_triangle(SGMaterial::Object * object);
|
||||||
void makeWorldMatrix (sgMat4 ROT, double hdg_deg );
|
void makeWorldMatrix (sgMat4 ROT, double hdg_deg );
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -333,7 +333,7 @@ void TriUserData::fill_in_triangle ()
|
||||||
int nObjects = object_group->get_object_count();
|
int nObjects = object_group->get_object_count();
|
||||||
|
|
||||||
for (int i = 0; i < nObjects; i++) {
|
for (int i = 0; i < nObjects; i++) {
|
||||||
FGNewMat::Object * object = object_group->get_object(i);
|
SGMaterial::Object * object = object_group->get_object(i);
|
||||||
double num = area / object->get_coverage_m2();
|
double num = area / object->get_coverage_m2();
|
||||||
|
|
||||||
// place an object each unit of area
|
// place an object each unit of area
|
||||||
|
@ -353,11 +353,11 @@ void TriUserData::fill_in_triangle ()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TriUserData::add_object_to_triangle (FGNewMat::Object * object)
|
void TriUserData::add_object_to_triangle (SGMaterial::Object * object)
|
||||||
{
|
{
|
||||||
// Set up the random heading if required.
|
// Set up the random heading if required.
|
||||||
double hdg_deg = 0;
|
double hdg_deg = 0;
|
||||||
if (object->get_heading_type() == FGNewMat::Object::HEADING_RANDOM)
|
if (object->get_heading_type() == SGMaterial::Object::HEADING_RANDOM)
|
||||||
hdg_deg = sg_random() * 360;
|
hdg_deg = sg_random() * 360;
|
||||||
|
|
||||||
sgMat4 mat;
|
sgMat4 mat;
|
||||||
|
@ -539,7 +539,7 @@ void LeafUserData::setup_triangle (int i )
|
||||||
int num_groups = mat->get_object_group_count();
|
int num_groups = mat->get_object_group_count();
|
||||||
for (int j = 0; j < num_groups; j++) {
|
for (int j = 0; j < num_groups; j++) {
|
||||||
// Look up the random object.
|
// Look up the random object.
|
||||||
FGNewMat::ObjectGroup * group = mat->get_object_group(j);
|
SGMaterial::ObjectGroup * group = mat->get_object_group(j);
|
||||||
|
|
||||||
// Set up the range selector for the entire
|
// Set up the range selector for the entire
|
||||||
// triangle; note that we use the object
|
// triangle; note that we use the object
|
||||||
|
@ -670,7 +670,7 @@ gen_random_surface_objects (ssgLeaf *leaf,
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Get the material for this surface.
|
// Get the material for this surface.
|
||||||
FGNewMat * mat = material_lib.find(material_name);
|
SGMaterial * mat = material_lib.find(material_name);
|
||||||
if (mat == 0) {
|
if (mat == 0) {
|
||||||
SG_LOG(SG_INPUT, SG_ALERT, "Unknown material " << material_name);
|
SG_LOG(SG_INPUT, SG_ALERT, "Unknown material " << material_name);
|
||||||
return;
|
return;
|
||||||
|
@ -743,7 +743,7 @@ ssgLeaf *gen_leaf( const string& path,
|
||||||
ssgSimpleState *state = NULL;
|
ssgSimpleState *state = NULL;
|
||||||
float coverage = -1;
|
float coverage = -1;
|
||||||
|
|
||||||
FGNewMat *newmat = material_lib.find( material );
|
SGMaterial *newmat = material_lib.find( material );
|
||||||
if ( newmat == NULL ) {
|
if ( newmat == NULL ) {
|
||||||
// see if this is an on the fly texture
|
// see if this is an on the fly texture
|
||||||
string file = path;
|
string file = path;
|
||||||
|
|
|
@ -117,7 +117,7 @@ ssgLeaf *gen_directional_light( sgVec3 pt, sgVec3 dir, sgVec3 up,
|
||||||
ssgLeaf *leaf =
|
ssgLeaf *leaf =
|
||||||
new ssgVtxTable ( GL_TRIANGLES, vl, nl, NULL, cl );
|
new ssgVtxTable ( GL_TRIANGLES, vl, nl, NULL, cl );
|
||||||
|
|
||||||
FGNewMat *newmat = material_lib.find( material );
|
SGMaterial *newmat = material_lib.find( material );
|
||||||
|
|
||||||
if ( newmat != NULL ) {
|
if ( newmat != NULL ) {
|
||||||
leaf->setState( newmat->get_state() );
|
leaf->setState( newmat->get_state() );
|
||||||
|
@ -234,7 +234,7 @@ ssgTransform *gen_dir_light_group( const point_list &nodes,
|
||||||
ssgLeaf *leaf =
|
ssgLeaf *leaf =
|
||||||
new ssgVtxTable ( GL_TRIANGLES, vl, nl, NULL, cl );
|
new ssgVtxTable ( GL_TRIANGLES, vl, nl, NULL, cl );
|
||||||
|
|
||||||
FGNewMat *newmat = material_lib.find( material );
|
SGMaterial *newmat = material_lib.find( material );
|
||||||
|
|
||||||
if ( newmat != NULL ) {
|
if ( newmat != NULL ) {
|
||||||
leaf->setState( newmat->get_state() );
|
leaf->setState( newmat->get_state() );
|
||||||
|
@ -319,7 +319,7 @@ ssgTransform *gen_reil_lights( const point_list &nodes,
|
||||||
ssgLeaf *leaf =
|
ssgLeaf *leaf =
|
||||||
new ssgVtxTable ( GL_TRIANGLES, vl, nl, NULL, cl );
|
new ssgVtxTable ( GL_TRIANGLES, vl, nl, NULL, cl );
|
||||||
|
|
||||||
FGNewMat *newmat = material_lib.find( "RWY_WHITE_LIGHTS" );
|
SGMaterial *newmat = material_lib.find( "RWY_WHITE_LIGHTS" );
|
||||||
|
|
||||||
if ( newmat != NULL ) {
|
if ( newmat != NULL ) {
|
||||||
leaf->setState( newmat->get_state() );
|
leaf->setState( newmat->get_state() );
|
||||||
|
@ -393,7 +393,7 @@ ssgTransform *gen_odals_lights( const point_list &nodes,
|
||||||
new ssgVtxTable ( GL_POINTS, vl, NULL, NULL, cl );
|
new ssgVtxTable ( GL_POINTS, vl, NULL, NULL, cl );
|
||||||
|
|
||||||
// we don't want directional lights here
|
// we don't want directional lights here
|
||||||
FGNewMat *newmat = material_lib.find( "GROUND_LIGHTS" );
|
SGMaterial *newmat = material_lib.find( "GROUND_LIGHTS" );
|
||||||
|
|
||||||
if ( newmat != NULL ) {
|
if ( newmat != NULL ) {
|
||||||
leaf->setState( newmat->get_state() );
|
leaf->setState( newmat->get_state() );
|
||||||
|
@ -428,7 +428,7 @@ ssgTransform *gen_odals_lights( const point_list &nodes,
|
||||||
new ssgVtxTable ( GL_POINTS, vl, NULL, NULL, cl );
|
new ssgVtxTable ( GL_POINTS, vl, NULL, NULL, cl );
|
||||||
|
|
||||||
// we don't want directional lights here
|
// we don't want directional lights here
|
||||||
FGNewMat *newmat = material_lib.find( "GROUND_LIGHTS" );
|
SGMaterial *newmat = material_lib.find( "GROUND_LIGHTS" );
|
||||||
|
|
||||||
if ( newmat != NULL ) {
|
if ( newmat != NULL ) {
|
||||||
leaf->setState( newmat->get_state() );
|
leaf->setState( newmat->get_state() );
|
||||||
|
@ -527,7 +527,7 @@ ssgTransform *gen_rabbit_lights( const point_list &nodes,
|
||||||
ssgLeaf *leaf =
|
ssgLeaf *leaf =
|
||||||
new ssgVtxTable ( GL_TRIANGLES, vl, nl, NULL, cl );
|
new ssgVtxTable ( GL_TRIANGLES, vl, nl, NULL, cl );
|
||||||
|
|
||||||
FGNewMat *newmat = material_lib.find( "RWY_WHITE_LIGHTS" );
|
SGMaterial *newmat = material_lib.find( "RWY_WHITE_LIGHTS" );
|
||||||
|
|
||||||
if ( newmat != NULL ) {
|
if ( newmat != NULL ) {
|
||||||
leaf->setState( newmat->get_state() );
|
leaf->setState( newmat->get_state() );
|
||||||
|
@ -584,7 +584,7 @@ ssgLeaf *gen_normal_line( sgVec3 pt, sgVec3 dir, sgVec3 up ) {
|
||||||
ssgLeaf *leaf =
|
ssgLeaf *leaf =
|
||||||
new ssgVtxTable ( GL_LINES, vl, NULL, NULL, cl );
|
new ssgVtxTable ( GL_LINES, vl, NULL, NULL, cl );
|
||||||
|
|
||||||
FGNewMat *newmat = material_lib.find( "GROUND_LIGHTS" );
|
SGMaterial *newmat = material_lib.find( "GROUND_LIGHTS" );
|
||||||
leaf->setState( newmat->get_state() );
|
leaf->setState( newmat->get_state() );
|
||||||
|
|
||||||
return leaf;
|
return leaf;
|
||||||
|
|
|
@ -155,7 +155,7 @@ private:
|
||||||
* Lock and synchronize access to tile queue.
|
* Lock and synchronize access to tile queue.
|
||||||
*/
|
*/
|
||||||
SGMutex mutex;
|
SGMutex mutex;
|
||||||
SGCondition frame_cond;
|
SGPthreadCond frame_cond;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Thread cleanup handler.
|
* Thread cleanup handler.
|
||||||
|
|
|
@ -525,7 +525,7 @@ ssgLeaf* FGTileEntry::gen_lights( ssgVertexArray *lights, int inc, float bright
|
||||||
new ssgVtxTable ( GL_POINTS, vl, nl, tl, cl );
|
new ssgVtxTable ( GL_POINTS, vl, nl, tl, cl );
|
||||||
|
|
||||||
// assign state
|
// assign state
|
||||||
FGNewMat *newmat = material_lib.find( "GROUND_LIGHTS" );
|
SGMaterial *newmat = material_lib.find( "GROUND_LIGHTS" );
|
||||||
leaf->setState( newmat->get_state() );
|
leaf->setState( newmat->get_state() );
|
||||||
leaf->setCallback( SSG_CALLBACK_PREDRAW, fgLightsPredraw );
|
leaf->setCallback( SSG_CALLBACK_PREDRAW, fgLightsPredraw );
|
||||||
leaf->setCallback( SSG_CALLBACK_POSTDRAW, fgLightsPostdraw );
|
leaf->setCallback( SSG_CALLBACK_POSTDRAW, fgLightsPostdraw );
|
||||||
|
|
|
@ -354,7 +354,7 @@ void FGTileMgr::update_queues()
|
||||||
// disk.
|
// disk.
|
||||||
int FGTileMgr::update( double visibility_meters )
|
int FGTileMgr::update( double visibility_meters )
|
||||||
{
|
{
|
||||||
FGLocation *location = globals->get_current_view()->getFGLocation();
|
SGLocation *location = globals->get_current_view()->getSGLocation();
|
||||||
sgdVec3 abs_pos_vector;
|
sgdVec3 abs_pos_vector;
|
||||||
sgdCopyVec3( abs_pos_vector,
|
sgdCopyVec3( abs_pos_vector,
|
||||||
globals->get_current_view()->get_absolute_view_pos() );
|
globals->get_current_view()->get_absolute_view_pos() );
|
||||||
|
@ -362,7 +362,7 @@ int FGTileMgr::update( double visibility_meters )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int FGTileMgr::update( FGLocation *location, double visibility_meters,
|
int FGTileMgr::update( SGLocation *location, double visibility_meters,
|
||||||
sgdVec3 abs_pos_vector )
|
sgdVec3 abs_pos_vector )
|
||||||
{
|
{
|
||||||
longitude = location->getLongitude_deg();
|
longitude = location->getLongitude_deg();
|
||||||
|
@ -470,7 +470,7 @@ int FGTileMgr::updateCurrentElevAtPos(sgdVec3 abs_pos_vector, Point3D center) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void FGTileMgr::prep_ssg_nodes( FGLocation *location, float vis ) {
|
void FGTileMgr::prep_ssg_nodes( SGLocation *location, float vis ) {
|
||||||
|
|
||||||
// traverse the potentially viewable tile list and update range
|
// traverse the potentially viewable tile list and update range
|
||||||
// selector and transform
|
// selector and transform
|
||||||
|
|
|
@ -163,7 +163,7 @@ public:
|
||||||
// local chunks. If the chunk isn't already in the cache, then
|
// local chunks. If the chunk isn't already in the cache, then
|
||||||
// read it from disk.
|
// read it from disk.
|
||||||
int update( double visibility_meters );
|
int update( double visibility_meters );
|
||||||
int update( FGLocation *location, double visibility_meters,
|
int update( SGLocation *location, double visibility_meters,
|
||||||
sgdVec3 abs_pos_vector );
|
sgdVec3 abs_pos_vector );
|
||||||
|
|
||||||
int updateCurrentElevAtPos(sgdVec3 abs_pos_vector, Point3D center );
|
int updateCurrentElevAtPos(sgdVec3 abs_pos_vector, Point3D center );
|
||||||
|
@ -183,7 +183,7 @@ public:
|
||||||
// tile, set the ssg transform and update it's range selector
|
// tile, set the ssg transform and update it's range selector
|
||||||
// based on current visibilty void prep_ssg_nodes( float
|
// based on current visibilty void prep_ssg_nodes( float
|
||||||
// visibility_meters );
|
// visibility_meters );
|
||||||
void prep_ssg_nodes( FGLocation *location, float visibility_meters );
|
void prep_ssg_nodes( SGLocation *location, float visibility_meters );
|
||||||
|
|
||||||
// Set flag with event manager so that non-moving view refreshes
|
// Set flag with event manager so that non-moving view refreshes
|
||||||
// tiles...
|
// tiles...
|
||||||
|
|
Loading…
Add table
Reference in a new issue