void FGAIEntity::Transform() {
aip.setPosition(pos.lon(), pos.lat(), pos.elev() * SG_METER_TO_FEET);
aip.setOrientation(roll, pitch, hdg);
- aip.update();
+ aip.update( globals->get_scenery()->get_center() );
}
# include <config.h>
#endif
+#include <simgear/scene/model/location.hxx>
+
#include <Airports/runways.hxx>
#include <Main/globals.hxx>
-#include <Main/location.hxx>
#include <Scenery/scenery.hxx>
#include <Scenery/tilemgr.hxx>
#include <simgear/math/point3d.hxx>
string planepath = "Aircraft/c172/Models/c172-dpm.ac";
SGPath path = globals->get_fg_root();
path.append(planepath);
- aip.init(planepath.c_str());
+ aip.init( path.str(), planepath.c_str(), globals->get_props(),
+ globals->get_sim_time_sec() );
aip.setVisible(false); // This will be set to true once a valid ground elevation has been determined
globals->get_scenery()->get_scene_graph()->addKid(aip.getSceneGraph());
double visibility_meters = fgGetDouble("/environment/visibility-m");
//globals->get_tile_mgr()->prep_ssg_nodes( acmodel_location,
globals->get_tile_mgr()->prep_ssg_nodes( aip.getFGLocation(), visibility_meters );
- globals->get_tile_mgr()->update( aip.getFGLocation(), visibility_meters, (aip.getFGLocation())->get_absolute_view_pos() );
+ 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 ) );
// save results of update in FGLocation for fdm...
//if ( globals->get_scenery()->get_cur_elev() > -9990 ) {
# include <config.h>
#endif
-#include <simgear/misc/props.hxx>
+#include <simgear/props/props.hxx>
#include <Include/general.hxx>
#include <Main/fg_props.hxx>
// Show available aircraft types
void fgReadAircraft(void) {
- SGPropertyNode *aircraft_types = fgGetNode("/sim/aircraft-types", true);
+ // SGPropertyNode *aircraft_types = fgGetNode("/sim/aircraft-types", true);
SGPath path( globals->get_fg_root() );
path.append("Aircraft");
SGPropertyNode *desc = node->getNode("description");
if (desc) {
-#endif
- SGPropertyNode *aircraft =
+ SGPropertyNode *aircraft =
aircraft_types->getChild(dire->d_name, 0, true);
-#if 0
aircraft->setStringValue(strdup(desc->getStringValue()));
}
#define _NEWAUTO_HXX
-#include <simgear/misc/props.hxx>
+#include <simgear/props/props.hxx>
#include <simgear/route/waypoint.hxx>
#include <Main/fgfs.hxx>
#include <simgear/constants.h>
#include <simgear/debug/logstream.hxx>
#include <simgear/math/polar3d.hxx>
-#include <simgear/misc/props.hxx>
+#include <simgear/props/props.hxx>
#include <simgear/timing/sg_time.hxx>
#include <Aircraft/aircraft.hxx>
#include <simgear/constants.h>
#include <simgear/debug/logstream.hxx>
-#include <simgear/misc/props.hxx>
+#include <simgear/props/props.hxx>
#include <simgear/misc/sg_path.hxx>
-//#include <simgear/math/fg_random.h>
-//#include <simgear/math/polar3d.hxx>
#include <Aircraft/aircraft.hxx>
#include <Autopilot/newauto.hxx>
#include <NetworkOLK/network.h>
#endif
#include <Scenery/scenery.hxx>
-//#include <Time/fg_timer.hxx>
#if defined ( __sun__ ) || defined ( __sgi )
extern "C" {
#include <plib/ssg.h>
#include <simgear/math/interpolater.hxx>
-#include <simgear/misc/props.hxx>
+#include <simgear/props/props.hxx>
#include <simgear/timing/timestamp.hxx>
#include <cmath>
#include <simgear/compiler.h>
#include <simgear/misc/exception.hxx>
-#include <simgear/misc/sg_path.hxx>
#include <simgear/debug/logstream.hxx>
-#include <simgear/misc/props.hxx>
+#include <simgear/misc/sg_path.hxx>
+#include <simgear/props/props.hxx>
#include STL_IOSTREAM
#include STL_FSTREAM
const SGPropertyNode * conditionNode = node->getChild("condition");
if (conditionNode != 0)
// The top level is implicitly AND
- component->setCondition(fgReadCondition(conditionNode));
+ component->setCondition(fgReadCondition(globals->get_props(),
+ conditionNode) );
}
#ifndef _CONTROLS_HXX
#define _CONTROLS_HXX
-#include <simgear/misc/props.hxx>
+#include <simgear/props/props.hxx>
#include <Main/fgfs.hxx>
#include <Main/globals.hxx>
INCLUDES
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
-#include <simgear/misc/props.hxx>
+#include <simgear/props/props.hxx>
#include "FGPropertyManager.h"
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#include <string>
-#include <simgear/misc/props.hxx>
+#include <simgear/props/props.hxx>
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DEFINITIONS
FORWARD DECLARATIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
-#include <simgear/misc/props.hxx>
+#include <simgear/props/props.hxx>
#include <FDM/JSBSim/FGFDMExec.h>
#include <simgear/constants.h>
#include <simgear/debug/logstream.hxx>
+#include <simgear/scene/model/location.hxx>
-
-#include <Main/fg_props.hxx>
#include <Aircraft/aircraft.hxx>
#include <Controls/controls.hxx>
#include <Model/model.hxx>
-#include <Main/location.hxx>
#include <FDM/flight.hxx>
#include <FDM/LaRCsim/ls_cockpit.h>
#include <FDM/LaRCsim/ls_generic.h>
#include <FDM/LaRCsim/ls_interface.h>
#include <FDM/LaRCsimIC.hxx>
#include <FDM/UIUCModel/uiuc_aircraft.h>
+#include <Main/fg_props.hxx>
#include <Model/acmodel.hxx>
#include "IO360.hxx"
#define _FGFDM_HPP
#include <simgear/xml/easyxml.hxx>
-#include <simgear/misc/props.hxx>
+#include <simgear/props/props.hxx>
#include "Airplane.hpp"
#include "Vector.hpp"
Vector.hpp \
Wing.cpp Wing.hpp
-yasim_LDADD = -lsgxml -lsgmisc -lsgdebug
+yasim_LDADD = -lsgxml -lsgprops -lsgmisc -lsgdebug
INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/src
-#include <simgear/misc/sg_path.hxx>
#include <simgear/debug/logstream.hxx>
+#include <simgear/misc/sg_path.hxx>
+#include <simgear/scene/model/location.hxx>
#include <simgear/xml/easyxml.hxx>
+
#include <Main/globals.hxx>
#include <Main/fg_props.hxx>
#include <Model/acmodel.hxx>
#include <Model/model.hxx>
-#include <Main/location.hxx>
#include "FGFDM.hpp"
#include "Atmosphere.hpp"
#include <stdio.h>
+#include <simgear/props/props.hxx>
#include <simgear/xml/easyxml.hxx>
-#include <simgear/misc/props.hxx>
#include "FGFDM.hpp"
#include "Airplane.hpp"
#include <simgear/constants.h>
#include <simgear/debug/logstream.hxx>
#include <simgear/math/sg_geodesy.hxx>
+#include <simgear/scene/model/location.hxx>
#include <simgear/timing/timestamp.hxx>
#include <Scenery/scenery.hxx>
#include <FDM/LaRCsim/ls_interface.h>
#include <Main/globals.hxx>
#include <Main/fg_props.hxx>
-#include <Main/location.hxx>
#include <Model/model.hxx>
#include <Model/acmodel.hxx>
#include <plib/pu.h>
#include <simgear/compiler.h> // for SG_USING_STD
-#include <simgear/misc/props.hxx>
+#include <simgear/props/props.hxx>
#include <vector>
SG_USING_STD(vector);
# include <windows.h>
#endif
-#include <simgear/misc/props.hxx>
-#include <simgear/misc/props_io.hxx>
#include <simgear/misc/exception.hxx>
#include <simgear/misc/sg_path.hxx>
+#include <simgear/props/props.hxx>
+#include <simgear/props/props_io.hxx>
#include <plib/pu.h>
#include <plib/pu.h>
#include <simgear/compiler.h> // for SG_USING_STD
-#include <simgear/misc/props.hxx>
+#include <simgear/props/props.hxx>
#include <vector>
SG_USING_STD(vector);
# include <config.h>
#endif
-#include "prop_picker.hxx"
-#include <Main/globals.hxx>
-
#include <simgear/compiler.h>
-#include <simgear/misc/props.hxx>
+#include <simgear/props/props.hxx>
#include STL_STRING
+
+#include <Main/globals.hxx>
+
+#include "prop_picker.hxx"
+
SG_USING_STD(string);
// A local alternative name, for use when a variable called "string" is in scope - e.g. in classes derived from puInput.
#include <stdio.h>
#include "gui.h"
-#include <simgear/misc/props.hxx>
+#include <simgear/props/props.hxx>
void prop_pickerInit();
void prop_pickerView( puObject * );
#include <simgear/constants.h>
#include <simgear/debug/logstream.hxx>
-#include <simgear/misc/props.hxx>
+#include <simgear/props/props.hxx>
#include <Aircraft/aircraft.hxx>
#include <Autopilot/auto_gui.hxx>
{
const SGPropertyNode * conditionNode = node->getChild("condition");
if (conditionNode != 0)
- setCondition(fgReadCondition(conditionNode));
+ setCondition(fgReadCondition(globals->get_props(), conditionNode));
_command_name = node->getStringValue("command", "");
if (_command_name.empty()) {
#include <simgear/compiler.h>
#include <simgear/misc/commands.hxx>
-#include <simgear/misc/props.hxx>
+#include <simgear/props/condition.hxx>
+#include <simgear/props/props.hxx>
#include <Main/fgfs.hxx>
#include <Main/fg_props.hxx>
# error This library requires C++
#endif
-#include <simgear/misc/props.hxx>
+#include <simgear/props/props.hxx>
+
#include <Main/fgfs.hxx>
# error This library requires C++
#endif
-#include <simgear/misc/props.hxx>
+#include <simgear/props/props.hxx>
#include <Main/fgfs.hxx>
# error This library requires C++
#endif
-#include <simgear/misc/props.hxx>
+#include <simgear/props/props.hxx>
+
#include <Main/fgfs.hxx>
#include "gyro.hxx"
#endif
#include <simgear/math/point3d.hxx>
-#include <simgear/misc/props.hxx>
+#include <simgear/props/props.hxx>
+
#include <Main/fgfs.hxx>
# error This library requires C++
#endif
-#include <simgear/misc/props.hxx>
+#include <simgear/props/props.hxx>
+
#include <Main/fgfs.hxx>
# error This library requires C++
#endif
-#include <simgear/misc/props.hxx>
+#include <simgear/props/props.hxx>
+
#include <Main/fgfs.hxx>
#include "gyro.hxx"
# error This library requires C++
#endif
-#include <simgear/misc/props.hxx>
+#include <simgear/props/props.hxx>
+
#include <Main/fgfs.hxx>
# error This library requires C++
#endif
-#include <simgear/misc/props.hxx>
+#include <simgear/props/props.hxx>
+
#include <Main/fgfs.hxx>
#include "gyro.hxx"
# error This library requires C++
#endif
-#include <simgear/misc/props.hxx>
+#include <simgear/props/props.hxx>
+
#include <Main/fgfs.hxx>
#include "gyro.hxx"
# error This library requires C++
#endif
-#include <simgear/misc/props.hxx>
+#include <simgear/props/props.hxx>
+
#include <Main/fgfs.hxx>
splash.cxx splash.hxx \
util.cxx util.hxx \
viewer.cxx viewer.hxx \
- viewmgr.cxx viewmgr.hxx \
- location.cxx location.hxx
+ viewmgr.cxx viewmgr.hxx
fgfs_LDADD = \
$(top_builddir)/src/Aircraft/libAircraft.a \
$(top_builddir)/src/Systems/libSystems.a \
$(top_builddir)/src/Time/libTime.a \
$(WEATHER_LIBS) \
- -lsgroute -lsgsky -lsgephem -lsgtiming -lsgio -lsgscreen \
- -lsgmath -lsgbucket -lsgdebug -lsgmagvar -lsgmisc -lsgxml \
+ -lsgroute -lsgsky -lsgephem -lsgmodel -lsgtiming -lsgio -lsgscreen \
+ -lsgmath -lsgbucket -lsgprops -lsgdebug -lsgmagvar -lsgmisc -lsgxml \
-lsgserial \
$(THREAD_LIBS) \
-lplibpu -lplibfnt -lplibjs -lplibnet -lplibssg -lplibsg -lplibul \
#include STL_STRING
#include STL_FSTREAM
+#include <simgear/sg_inlines.h>
#include <simgear/debug/logstream.hxx>
#include <simgear/math/sg_random.h>
#include <simgear/misc/commands.hxx>
-#include <simgear/misc/props.hxx>
-#include <simgear/sg_inlines.h>
+#include <simgear/props/props.hxx>
#include <Cockpit/panel.hxx>
#include <Cockpit/panel_io.hxx>
#include <GUI/dialog.hxx>
#include <Scenery/tilemgr.hxx>
#if defined(HAVE_PLIB_PSL)
-#include <Scripting/scriptmgr.hxx>
+# include <Scripting/scriptmgr.hxx>
#endif
#include <Time/tmp.hxx>
vector<SGPropertyNode_ptr> subsystems = arg->getChildren("subsystem");
if (subsystems.size() == 0)
globals->get_subsystem_mgr()->reinit();
- else for (int i = 0; i < subsystems.size(); i++) {
+ else for ( unsigned int i = 0; i < subsystems.size(); i++ ) {
const char * name = subsystems[i]->getStringValue();
FGSubsystem * subsystem = globals->get_subsystem(name);
if (subsystem == 0) {
bool result = true;
vector<SGPropertyNode_ptr> subsystems = arg->getChildren("subsystem");
- for (int i = 0; i < subsystems.size(); i++) {
+ for ( unsigned int i = 0; i < subsystems.size(); i++ ) {
const char * name = subsystems[i]->getStringValue();
FGSubsystem * subsystem = globals->get_subsystem(name);
if (subsystem == 0) {
bool result = true;
vector<SGPropertyNode_ptr> subsystems = arg->getChildren("subsystem");
- for (int i = 0; i < subsystems.size(); i++) {
+ for ( unsigned int i = 0; i < subsystems.size(); i++ ) {
const char * name = subsystems[i]->getStringValue();
FGSubsystem * subsystem = globals->get_subsystem(name);
if (subsystem == 0) {
#endif
#include <simgear/misc/commands.hxx>
-#include <simgear/misc/props.hxx>
+#include <simgear/props/props.hxx>
/**
* Initialize the built-in commands.
// gear, its initialization call should located in this routine.
// Returns non-zero if a problem encountered.
bool fgInitSubsystems() {
- static const SGPropertyNode *longitude
- = fgGetNode("/sim/presets/longitude-deg");
- static const SGPropertyNode *latitude
- = fgGetNode("/sim/presets/latitude-deg");
- static const SGPropertyNode *altitude
- = fgGetNode("/sim/presets/altitude-ft");
+ // static const SGPropertyNode *longitude
+ // = fgGetNode("/sim/presets/longitude-deg");
+ // static const SGPropertyNode *latitude
+ // = fgGetNode("/sim/presets/latitude-deg");
+ // static const SGPropertyNode *altitude
+ // = fgGetNode("/sim/presets/altitude-ft");
fgLIGHT *l = &cur_light_params;
void fgReInitSubsystems()
{
- static const SGPropertyNode *longitude
- = fgGetNode("/sim/presets/longitude-deg");
- static const SGPropertyNode *latitude
- = fgGetNode("/sim/presets/latitude-deg");
+ // static const SGPropertyNode *longitude
+ // = fgGetNode("/sim/presets/longitude-deg");
+ // static const SGPropertyNode *latitude
+ // = fgGetNode("/sim/presets/latitude-deg");
static const SGPropertyNode *altitude
= fgGetNode("/sim/presets/altitude-ft");
static const SGPropertyNode *master_freeze
}
-
-\f
-////////////////////////////////////////////////////////////////////////
-// Implementation of FGCondition.
-////////////////////////////////////////////////////////////////////////
-
-FGCondition::FGCondition ()
-{
-}
-
-FGCondition::~FGCondition ()
-{
-}
-
-
-\f
-////////////////////////////////////////////////////////////////////////
-// Implementation of FGPropertyCondition.
-////////////////////////////////////////////////////////////////////////
-
-FGPropertyCondition::FGPropertyCondition (const char * propname)
- : _node(fgGetNode(propname, true))
-{
-}
-
-FGPropertyCondition::~FGPropertyCondition ()
-{
-}
-
-
-\f
-////////////////////////////////////////////////////////////////////////
-// Implementation of FGNotCondition.
-////////////////////////////////////////////////////////////////////////
-
-FGNotCondition::FGNotCondition (FGCondition * condition)
- : _condition(condition)
-{
-}
-
-FGNotCondition::~FGNotCondition ()
-{
- delete _condition;
-}
-
-bool
-FGNotCondition::test () const
-{
- return !(_condition->test());
-}
-
-
-\f
-////////////////////////////////////////////////////////////////////////
-// Implementation of FGAndCondition.
-////////////////////////////////////////////////////////////////////////
-
-FGAndCondition::FGAndCondition ()
-{
-}
-
-FGAndCondition::~FGAndCondition ()
-{
- for (unsigned int i = 0; i < _conditions.size(); i++)
- delete _conditions[i];
-}
-
-bool
-FGAndCondition::test () const
-{
- int nConditions = _conditions.size();
- for (int i = 0; i < nConditions; i++) {
- if (!_conditions[i]->test())
- return false;
- }
- return true;
-}
-
-void
-FGAndCondition::addCondition (FGCondition * condition)
-{
- _conditions.push_back(condition);
-}
-
-
-\f
-////////////////////////////////////////////////////////////////////////
-// Implementation of FGOrCondition.
-////////////////////////////////////////////////////////////////////////
-
-FGOrCondition::FGOrCondition ()
-{
-}
-
-FGOrCondition::~FGOrCondition ()
-{
- for (unsigned int i = 0; i < _conditions.size(); i++)
- delete _conditions[i];
-}
-
-bool
-FGOrCondition::test () const
-{
- int nConditions = _conditions.size();
- for (int i = 0; i < nConditions; i++) {
- if (_conditions[i]->test())
- return true;
- }
- return false;
-}
-
-void
-FGOrCondition::addCondition (FGCondition * condition)
-{
- _conditions.push_back(condition);
-}
-
-
-\f
-////////////////////////////////////////////////////////////////////////
-// Implementation of FGComparisonCondition.
-////////////////////////////////////////////////////////////////////////
-
-static int
-doComparison (const SGPropertyNode * left, const SGPropertyNode *right)
-{
- switch (left->getType()) {
- case SGPropertyNode::BOOL: {
- bool v1 = left->getBoolValue();
- bool v2 = right->getBoolValue();
- if (v1 < v2)
- return FGComparisonCondition::LESS_THAN;
- else if (v1 > v2)
- return FGComparisonCondition::GREATER_THAN;
- else
- return FGComparisonCondition::EQUALS;
- break;
- }
- case SGPropertyNode::INT: {
- int v1 = left->getIntValue();
- int v2 = right->getIntValue();
- if (v1 < v2)
- return FGComparisonCondition::LESS_THAN;
- else if (v1 > v2)
- return FGComparisonCondition::GREATER_THAN;
- else
- return FGComparisonCondition::EQUALS;
- break;
- }
- case SGPropertyNode::LONG: {
- long v1 = left->getLongValue();
- long v2 = right->getLongValue();
- if (v1 < v2)
- return FGComparisonCondition::LESS_THAN;
- else if (v1 > v2)
- return FGComparisonCondition::GREATER_THAN;
- else
- return FGComparisonCondition::EQUALS;
- break;
- }
- case SGPropertyNode::FLOAT: {
- float v1 = left->getFloatValue();
- float v2 = right->getFloatValue();
- if (v1 < v2)
- return FGComparisonCondition::LESS_THAN;
- else if (v1 > v2)
- return FGComparisonCondition::GREATER_THAN;
- else
- return FGComparisonCondition::EQUALS;
- break;
- }
- case SGPropertyNode::DOUBLE: {
- double v1 = left->getDoubleValue();
- double v2 = right->getDoubleValue();
- if (v1 < v2)
- return FGComparisonCondition::LESS_THAN;
- else if (v1 > v2)
- return FGComparisonCondition::GREATER_THAN;
- else
- return FGComparisonCondition::EQUALS;
- break;
- }
- case SGPropertyNode::STRING:
- case SGPropertyNode::NONE:
- case SGPropertyNode::UNSPECIFIED: {
- string v1 = left->getStringValue();
- string v2 = right->getStringValue();
- if (v1 < v2)
- return FGComparisonCondition::LESS_THAN;
- else if (v1 > v2)
- return FGComparisonCondition::GREATER_THAN;
- else
- return FGComparisonCondition::EQUALS;
- break;
- }
- }
- throw sg_exception("Unrecognized node type");
- return 0;
-}
-
-
-FGComparisonCondition::FGComparisonCondition (Type type, bool reverse)
- : _type(type),
- _reverse(reverse),
- _left_property(0),
- _right_property(0),
- _right_value(0)
-{
-}
-
-FGComparisonCondition::~FGComparisonCondition ()
-{
- delete _right_value;
-}
-
-bool
-FGComparisonCondition::test () const
-{
- // Always fail if incompletely specified
- if (_left_property == 0 ||
- (_right_property == 0 && _right_value == 0))
- return false;
-
- // Get LESS_THAN, EQUALS, or GREATER_THAN
- int cmp =
- doComparison(_left_property,
- (_right_property != 0 ? _right_property : _right_value));
- if (!_reverse)
- return (cmp == _type);
- else
- return (cmp != _type);
-}
-
-void
-FGComparisonCondition::setLeftProperty (const char * propname)
-{
- _left_property = fgGetNode(propname, true);
-}
-
-void
-FGComparisonCondition::setRightProperty (const char * propname)
-{
- delete _right_value;
- _right_value = 0;
- _right_property = fgGetNode(propname, true);
-}
-
-void
-FGComparisonCondition::setRightValue (const SGPropertyNode *node)
-{
- _right_property = 0;
- delete _right_value;
- _right_value = new SGPropertyNode(*node);
-}
-
-
-\f
-////////////////////////////////////////////////////////////////////////
-// Read a condition and use it if necessary.
-////////////////////////////////////////////////////////////////////////
-
- // Forward declaration
-static FGCondition * readCondition (const SGPropertyNode * node);
-
-static FGCondition *
-readPropertyCondition (const SGPropertyNode * node)
-{
- return new FGPropertyCondition(node->getStringValue());
-}
-
-static FGCondition *
-readNotCondition (const SGPropertyNode * node)
-{
- int nChildren = node->nChildren();
- for (int i = 0; i < nChildren; i++) {
- const SGPropertyNode * child = node->getChild(i);
- FGCondition * condition = readCondition(child);
- if (condition != 0)
- return new FGNotCondition(condition);
- }
- SG_LOG(SG_COCKPIT, SG_ALERT, "Panel: empty 'not' condition");
- return 0;
-}
-
-static FGCondition *
-readAndConditions (const SGPropertyNode * node)
-{
- FGAndCondition * andCondition = new FGAndCondition;
- int nChildren = node->nChildren();
- for (int i = 0; i < nChildren; i++) {
- const SGPropertyNode * child = node->getChild(i);
- FGCondition * condition = readCondition(child);
- if (condition != 0)
- andCondition->addCondition(condition);
- }
- return andCondition;
-}
-
-static FGCondition *
-readOrConditions (const SGPropertyNode * node)
-{
- FGOrCondition * orCondition = new FGOrCondition;
- int nChildren = node->nChildren();
- for (int i = 0; i < nChildren; i++) {
- const SGPropertyNode * child = node->getChild(i);
- FGCondition * condition = readCondition(child);
- if (condition != 0)
- orCondition->addCondition(condition);
- }
- return orCondition;
-}
-
-static FGCondition *
-readComparison (const SGPropertyNode * node,
- FGComparisonCondition::Type type,
- bool reverse)
-{
- FGComparisonCondition * condition = new FGComparisonCondition(type, reverse);
- condition->setLeftProperty(node->getStringValue("property[0]"));
- if (node->hasValue("property[1]"))
- condition->setRightProperty(node->getStringValue("property[1]"));
- else
- condition->setRightValue(node->getChild("value", 0));
-
- return condition;
-}
-
-static FGCondition *
-readCondition (const SGPropertyNode * node)
-{
- const string &name = node->getName();
- if (name == "property")
- return readPropertyCondition(node);
- else if (name == "not")
- return readNotCondition(node);
- else if (name == "and")
- return readAndConditions(node);
- else if (name == "or")
- return readOrConditions(node);
- else if (name == "less-than")
- return readComparison(node, FGComparisonCondition::LESS_THAN, false);
- else if (name == "less-than-equals")
- return readComparison(node, FGComparisonCondition::GREATER_THAN, true);
- else if (name == "greater-than")
- return readComparison(node, FGComparisonCondition::GREATER_THAN, false);
- else if (name == "greater-than-equals")
- return readComparison(node, FGComparisonCondition::LESS_THAN, true);
- else if (name == "equals")
- return readComparison(node, FGComparisonCondition::EQUALS, false);
- else if (name == "not-equals")
- return readComparison(node, FGComparisonCondition::EQUALS, true);
- else
- return 0;
-}
-
-
-\f
-////////////////////////////////////////////////////////////////////////
-// Implementation of FGConditional.
-////////////////////////////////////////////////////////////////////////
-
-FGConditional::FGConditional ()
- : _condition (0)
-{
-}
-
-FGConditional::~FGConditional ()
-{
- delete _condition;
-}
-
-void
-FGConditional::setCondition (FGCondition * condition)
-{
- delete _condition;
- _condition = condition;
-}
-
-bool
-FGConditional::test () const
-{
- return ((_condition == 0) || _condition->test());
-}
-
-
-\f
-// The top-level is always an implicit 'and' group
-FGCondition *
-fgReadCondition (const SGPropertyNode * node)
-{
- return readAndConditions(node);
-}
-
-
// end of fg_props.cxx
#define __FG_PROPS_HXX 1
#include <simgear/debug/logstream.hxx>
-#include <simgear/misc/props.hxx>
-#include <simgear/misc/props_io.hxx>
+#include <simgear/props/props.hxx>
+#include <simgear/props/props_io.hxx>
#include "globals.hxx"
}
-\f
-////////////////////////////////////////////////////////////////////////
-// Conditions.
-////////////////////////////////////////////////////////////////////////
-
-
-/**
- * An encoded condition.
- *
- * This class encodes a single condition of some sort, possibly
- * connected with properties.
- *
- * This class should migrate to somewhere more general.
- */
-class FGCondition
-{
-public:
- FGCondition ();
- virtual ~FGCondition ();
- virtual bool test () const = 0;
-};
-
-
-/**
- * Condition for a single property.
- *
- * This condition is true only if the property returns a boolean
- * true value.
- */
-class FGPropertyCondition : public FGCondition
-{
-public:
- FGPropertyCondition (const char * propname);
- virtual ~FGPropertyCondition ();
- virtual bool test () const { return _node->getBoolValue(); }
-private:
- const SGPropertyNode * _node;
-};
-
-
-/**
- * Condition for a 'not' operator.
- *
- * This condition is true only if the child condition is false.
- */
-class FGNotCondition : public FGCondition
-{
-public:
- // transfer pointer ownership
- FGNotCondition (FGCondition * condition);
- virtual ~FGNotCondition ();
- virtual bool test () const;
-private:
- FGCondition * _condition;
-};
-
-
-/**
- * Condition for an 'and' group.
- *
- * This condition is true only if all of the conditions
- * in the group are true.
- */
-class FGAndCondition : public FGCondition
-{
-public:
- FGAndCondition ();
- virtual ~FGAndCondition ();
- virtual bool test () const;
- // transfer pointer ownership
- virtual void addCondition (FGCondition * condition);
-private:
- vector<FGCondition *> _conditions;
-};
-
-
-/**
- * Condition for an 'or' group.
- *
- * This condition is true if at least one of the conditions in the
- * group is true.
- */
-class FGOrCondition : public FGCondition
-{
-public:
- FGOrCondition ();
- virtual ~FGOrCondition ();
- virtual bool test () const;
- // transfer pointer ownership
- virtual void addCondition (FGCondition * condition);
-private:
- vector<FGCondition *> _conditions;
-};
-
-
-/**
- * Abstract base class for property comparison conditions.
- */
-class FGComparisonCondition : public FGCondition
-{
-public:
- enum Type {
- LESS_THAN,
- GREATER_THAN,
- EQUALS
- };
- FGComparisonCondition (Type type, bool reverse = false);
- virtual ~FGComparisonCondition ();
- virtual bool test () const;
- virtual void setLeftProperty (const char * propname);
- virtual void setRightProperty (const char * propname);
- // will make a local copy
- virtual void setRightValue (const SGPropertyNode * value);
-private:
- Type _type;
- bool _reverse;
- const SGPropertyNode * _left_property;
- const SGPropertyNode * _right_property;
- const SGPropertyNode * _right_value;
-};
-
-
-/**
- * Base class for a conditional components.
- *
- * This class manages the conditions and tests; the component should
- * invoke the test() method whenever it needs to decide whether to
- * active itself, draw itself, and so on.
- */
-class FGConditional
-{
-public:
- FGConditional ();
- virtual ~FGConditional ();
- // transfer pointer ownership
- virtual void setCondition (FGCondition * condition);
- virtual const FGCondition * getCondition () const { return _condition; }
- virtual bool test () const;
-private:
- FGCondition * _condition;
-};
-
-
-/**
- * Global function to make a condition out of properties.
- *
- * The top-level is always an implicit 'and' group, whatever the
- * node's name (it should usually be "condition").
- *
- * @param node The top-level condition node (usually named "condition").
- * @return A pointer to a newly-allocated condition; it is the
- * responsibility of the caller to delete the condition when
- * it is no longer needed.
- */
-FGCondition * fgReadCondition (const SGPropertyNode * node);
-
-
#endif // __FG_PROPS_HXX
#include <map>
SG_USING_STD(map);
-#include <simgear/misc/props.hxx>
+#include <simgear/props/props.hxx>
\f
#include <simgear/compiler.h>
#include <simgear/debug/logstream.hxx>
#include <simgear/misc/exception.hxx>
-#include <simgear/misc/props.hxx>
+#include <simgear/props/props.hxx>
SG_USING_STD(ostream);
SG_USING_STD(vector);
#include <simgear/math/polar3d.hxx>
#include <simgear/math/sg_random.h>
#include <simgear/misc/sg_path.hxx>
+#include <simgear/scene/model/location.hxx>
#ifdef FG_USE_CLOUDS_3D
# include <simgear/sky/clouds3d/SkySceneLoader.hpp>
# include <simgear/sky/clouds3d/SkyUtil.hpp>
#include <Model/loader.hxx>
#include <Model/model.hxx>
#include <Model/modelmgr.hxx>
-#include <Main/location.hxx>
#include <Model/panelnode.hxx>
#ifdef FG_NETWORK_OLK
#include <NetworkOLK/network.h>
// Process/manage pending events
global_events.update( delta_time_sec );
- static const SGPropertyNode *longitude
- = fgGetNode("/position/longitude-deg");
- static const SGPropertyNode *latitude
- = fgGetNode("/position/latitude-deg");
- static const SGPropertyNode *altitude
- = fgGetNode("/position/altitude-ft");
+ // static const SGPropertyNode *longitude
+ // = fgGetNode("/position/longitude-deg");
+ // static const SGPropertyNode *latitude
+ // = fgGetNode("/position/latitude-deg");
+ // static const SGPropertyNode *altitude
+ // = fgGetNode("/position/altitude-ft");
static const SGPropertyNode *groundlevel_nearplane
= fgGetNode("/sim/current-view/ground-level-nearplane-m");
visibility_meters );
globals->get_tile_mgr()->
update( acmodel_location, visibility_meters,
- acmodel_location->get_absolute_view_pos() );
+ acmodel_location->get_absolute_view_pos(globals->get_scenery()->get_center()) );
// save results of update in FGLocation for fdm...
if ( globals->get_scenery()->get_cur_elev() > -9990 ) {
acmodel_location->
if ( strcmp(obj_filename,"repeat") != 0) {
ship_obj =
- globals->get_model_loader()->load_model( obj_filename );
+ globals->get_model_loader()->load_model( globals->get_fg_root(), obj_filename, globals->get_props(), globals->get_sim_time_sec() );
}
if ( ship_obj != NULL ) {
// temporary hack for deck lights - ultimately should move to PLib (when??)
//const char *extn = file_extension ( obj_filename ) ;
if ( objc == 1 ){
- ssgVertexArray *lights = new ssgVertexArray( 100 );
+ // ssgVertexArray *lights = new ssgVertexArray( 100 );
ssgVertexArray *lightpoints = new ssgVertexArray( 100 );
ssgVertexArray *lightnormals = new ssgVertexArray( 100 );
ssgVertexArray *lightdir = new ssgVertexArray( 100 );
- int ltype[500], light_type;
+ int ltype[500], light_type = 0;
static int ltcount = 0;
string token;
sgVec3 rway_dir,rway_normal,lightpt;
void
FGViewer::updateAtModelLocation (FGLocation * location)
{
- sgCopyMat4(ATLOCAL, location->getCachedTransformMatrix());
+ sgCopyMat4(ATLOCAL,
+ location->getCachedTransformMatrix());
}
void
// update from our own data...
location->setPosition( lon_deg, lat_deg, alt_ft );
location->setOrientation( roll_deg, pitch_deg, heading_deg );
- sgCopyMat4(LOCAL, location->getTransformMatrix());
+ sgCopyMat4(LOCAL,
+ location->getTransformMatrix(globals->get_scenery()->get_center()));
}
// recalc() is done every time one of the setters is called (making the
{
sgVec3 right, forward;
- sgVec3 eye_pos;
+ // sgVec3 eye_pos;
sgVec3 position_offset; // eye position offsets (xyz)
// LOOKFROM mode...
// calculate the "at" target object positon relative to eye or view's tile center...
sgdVec3 dVec3;
sgdSetVec3(dVec3, _location->get_tile_center()[0], _location->get_tile_center()[1], _location->get_tile_center()[2]);
- sgdSubVec3(dVec3, _target_location->get_absolute_view_pos(), dVec3 );
+ sgdSubVec3(dVec3,
+ _target_location->get_absolute_view_pos(globals->get_scenery()->get_center()),
+ dVec3 );
sgSetVec3(at_pos, dVec3[0], dVec3[1], dVec3[2]);
// Update location data for eye...
// Get our friendly vectors from the eye location...
sgCopyVec3(_zero_elev_view_pos, _location->get_zero_elev());
sgCopyVec3(_relative_view_pos, _location->get_view_pos());
- sgdCopyVec3(_absolute_view_pos, _location->get_absolute_view_pos());
+ sgdCopyVec3(_absolute_view_pos,
+ _location->get_absolute_view_pos(globals->get_scenery()->get_center()));
sgCopyMat4(UP, _location->getCachedUpMatrix());
sgCopyVec3(_world_up, _location->get_world_up());
// these are the vectors that the sun and moon code like to get...
#include <simgear/compiler.h>
#include <simgear/constants.h>
+#include <simgear/scene/model/location.hxx>
#include <plib/sg.h> // plib include
#include "fgfs.hxx"
-#include <Main/location.hxx>
-
#define FG_FOV_MIN 0.1
#define FG_FOV_MAX 179.9
_aircraft = new FGModelPlacement;
string path = fgGetString("/sim/model/path", "Models/Geometry/glider.ac");
try {
- _aircraft->init(path);
+ _aircraft->init( globals->get_fg_root(),
+ path,
+ globals->get_props(),
+ globals->get_sim_time_sec() );
} catch (const sg_exception &ex) {
SG_LOG(SG_GENERAL, SG_ALERT, "Failed to load aircraft from " << path);
SG_LOG(SG_GENERAL, SG_ALERT, "(Falling back to glider.ac.)");
- _aircraft->init("Models/Geometry/glider.ac");
+ _aircraft->init( globals->get_fg_root(),
+ "Models/Geometry/glider.ac",
+ globals->get_props(),
+ globals->get_sim_time_sec() );
}
_scene->addKid(_aircraft->getSceneGraph());
_selector->addKid(_aircraft->getSceneGraph());
_aircraft->setOrientation(fgGetDouble("/orientation/roll-deg"),
fgGetDouble("/orientation/pitch-deg"),
fgGetDouble("/orientation/heading-deg"));
- _aircraft->update();
+ _aircraft->update( globals->get_scenery()->get_center() );
}
#endif
#include <simgear/compiler.h>
-#include <simgear/misc/props.hxx>
+#include <simgear/props/props.hxx>
#include "loader.hxx"
#include "model.hxx"
}
ssgEntity *
-FGModelLoader::load_model (const string &path)
+FGModelLoader::load_model( const string &fg_root,
+ const string &path,
+ SGPropertyNode *prop_root,
+ double sim_time_sec )
{
// FIXME: normalize path to
// avoid duplicates.
std::map<string, ssgBase *>::iterator it = _table.find(path);
if (it == _table.end()) {
- _table[path] = fgLoad3DModel((char *)path.c_str());
+ _table[path] = fgLoad3DModel( fg_root, path, prop_root, sim_time_sec );
it = _table.find(path);
it->second->ref(); // add one reference to keep it around
}
}
ssgTexture *
-FGTextureLoader::load_texture (const string &path)
+FGTextureLoader::load_texture( const string &fg_root, const string &path )
{
std::map<string, ssgBase *>::iterator it = _table.find(path);
if (it == _table.end()) {
FGModelLoader ();
virtual ~FGModelLoader ();
- virtual ssgEntity * load_model (const string &path);
+ virtual ssgEntity * load_model( const string &fg_root,
+ const string &path,
+ SGPropertyNode *prop_root,
+ double sim_time_sec );
};
FGTextureLoader ();
virtual ~FGTextureLoader ();
- virtual ssgTexture * load_texture (const string &path);
+ virtual ssgTexture * load_texture( const string &fg_root,
+ const string &path );
};
#endif
#include <simgear/math/sg_geodesy.hxx>
#include <simgear/misc/exception.hxx>
#include <simgear/misc/sg_path.hxx>
+#include <simgear/props/condition.hxx>
+#include <simgear/props/props_io.hxx>
+#include <simgear/scene/model/location.hxx>
-#include <Main/fg_props.hxx>
-#include <Main/globals.hxx>
-#include <Main/location.hxx>
-#include <Scenery/scenery.hxx>
+// #include <Main/fg_props.hxx>
+// #include <Main/globals.hxx>
+// #include <Scenery/scenery.hxx>
#include "model.hxx"
#include "panelnode.hxx"
make_animation (ssgBranch * model,
const char * name,
vector<SGPropertyNode_ptr> &name_nodes,
- SGPropertyNode_ptr node)
+ SGPropertyNode *prop_root,
+ SGPropertyNode_ptr node,
+ double sim_time_sec )
{
Animation * animation = 0;
const char * type = node->getStringValue("type", "none");
} else if (!strcmp("billboard", type)) {
animation = new BillboardAnimation(node);
} else if (!strcmp("select", type)) {
- animation = new SelectAnimation(node);
+ animation = new SelectAnimation(prop_root, node);
} else if (!strcmp("spin", type)) {
- animation = new SpinAnimation(node);
+ animation = new SpinAnimation(prop_root, node, sim_time_sec );
} else if (!strcmp("timed", type)) {
animation = new TimedAnimation(node);
} else if (!strcmp("rotate", type)) {
- animation = new RotateAnimation(node);
+ animation = new RotateAnimation(prop_root, node);
} else if (!strcmp("translate", type)) {
- animation = new TranslateAnimation(node);
+ animation = new TranslateAnimation(prop_root, node);
} else {
animation = new NullAnimation(node);
SG_LOG(SG_INPUT, SG_WARN, "Unknown animation type " << type);
ssgBranch * branch = animation->getBranch();
splice_branch(branch, object);
- for (int i = 1; i < name_nodes.size(); i++) {
+ for (unsigned int i = 1; i < name_nodes.size(); i++) {
const char * name = name_nodes[i]->getStringValue();
object = find_named_node(model, name);
if (object == 0) {
////////////////////////////////////////////////////////////////////////
ssgBranch *
-fgLoad3DModel (const string &path)
+fgLoad3DModel( const string &fg_root, const string &path,
+ SGPropertyNode *prop_root,
+ double sim_time_sec )
{
ssgBranch * model = 0;
SGPropertyNode props;
xmlpath = modelpath;
}
else {
- xmlpath = globals->get_fg_root();
+ xmlpath = fg_root;
xmlpath.append(modelpath.str());
}
const char * name = animation_nodes[i]->getStringValue("name", 0);
vector<SGPropertyNode_ptr> name_nodes =
animation_nodes[i]->getChildren("object-name");
- make_animation(model, name, name_nodes, animation_nodes[i]);
+ make_animation( model, name, name_nodes, prop_root, animation_nodes[i],
+ sim_time_sec);
}
// Load sub-models
node->getFloatValue("offsets/z-m", 0.0));
align->setTransform(res_matrix);
- ssgBranch * kid = fgLoad3DModel(node->getStringValue("path"));
+ ssgBranch * kid = fgLoad3DModel( fg_root, node->getStringValue("path"),
+ prop_root, sim_time_sec );
align->addKid(kid);
model->addKid(align);
}
// Implementation of SelectAnimation
////////////////////////////////////////////////////////////////////////
-SelectAnimation::SelectAnimation (SGPropertyNode_ptr props)
+SelectAnimation::SelectAnimation( SGPropertyNode *prop_root,
+ SGPropertyNode_ptr props )
: Animation(props, new ssgSelector),
_condition(0)
{
SGPropertyNode_ptr node = props->getChild("condition");
if (node != 0)
- _condition = fgReadCondition(node);
+ _condition = fgReadCondition(prop_root, node);
}
SelectAnimation::~SelectAnimation ()
// Implementation of SpinAnimation
////////////////////////////////////////////////////////////////////////
-SpinAnimation::SpinAnimation (SGPropertyNode_ptr props)
+SpinAnimation::SpinAnimation( SGPropertyNode *prop_root,
+ SGPropertyNode_ptr props,
+ double sim_time_sec )
: Animation(props, new ssgTransform),
- _prop(fgGetNode(props->getStringValue("property", "/null"), true)),
+ _prop((SGPropertyNode *)prop_root->getNode(props->getStringValue("property", "/null"), true)),
_factor(props->getDoubleValue("factor", 1.0)),
_position_deg(props->getDoubleValue("starting-position-deg", 0)),
- _last_time_sec(globals->get_sim_time_sec())
+ _last_time_sec( sim_time_sec /* globals->get_sim_time_sec() */ )
{
_center[0] = props->getFloatValue("center/x-m", 0);
_center[1] = props->getFloatValue("center/y-m", 0);
}
void
-SpinAnimation::update ()
+SpinAnimation::update( double sim_time_sec )
{
- double sim_time = globals->get_sim_time_sec();
- double dt = sim_time - _last_time_sec;
- _last_time_sec = sim_time;
+ double dt = sim_time_sec - _last_time_sec;
+ _last_time_sec = sim_time_sec;
float velocity_rpms = (_prop->getDoubleValue() * _factor / 60.0);
_position_deg += (dt * velocity_rpms * 360);
}
void
-TimedAnimation::update ()
+TimedAnimation::update( double sim_time_sec )
{
- float sim_time_sec = globals->get_sim_time_sec();
if ((sim_time_sec - _last_time_sec) >= _duration_sec) {
_last_time_sec = sim_time_sec;
_step++;
// Implementation of RotateAnimation
////////////////////////////////////////////////////////////////////////
-RotateAnimation::RotateAnimation (SGPropertyNode_ptr props)
+RotateAnimation::RotateAnimation( SGPropertyNode *prop_root,
+ SGPropertyNode_ptr props )
: Animation(props, new ssgTransform),
- _prop(fgGetNode(props->getStringValue("property", "/null"), true)),
+ _prop((SGPropertyNode *)prop_root->getNode(props->getStringValue("property", "/null"), true)),
_offset_deg(props->getDoubleValue("offset-deg", 0.0)),
_factor(props->getDoubleValue("factor", 1.0)),
_table(read_interpolation_table(props)),
}
void
-RotateAnimation::update ()
+RotateAnimation::update()
{
if (_table == 0) {
_position_deg = _prop->getDoubleValue() * _factor + _offset_deg;
// Implementation of TranslateAnimation
////////////////////////////////////////////////////////////////////////
-TranslateAnimation::TranslateAnimation (SGPropertyNode_ptr props)
+TranslateAnimation::TranslateAnimation( SGPropertyNode *prop_root,
+ SGPropertyNode_ptr props )
: Animation(props, new ssgTransform),
- _prop(fgGetNode(props->getStringValue("property", "/null"), true)),
+ _prop((SGPropertyNode *)prop_root->getNode(props->getStringValue("property", "/null"), true)),
_offset_m(props->getDoubleValue("offset-m", 0.0)),
_factor(props->getDoubleValue("factor", 1.0)),
_table(read_interpolation_table(props)),
}
void
-FGModelPlacement::init (const string &path)
+FGModelPlacement::init( const string &fg_root,
+ const string &path,
+ SGPropertyNode *prop_root,
+ double sim_time_sec )
{
- ssgBranch * model = fgLoad3DModel(path);
+ ssgBranch * model = fgLoad3DModel( fg_root, path, prop_root, sim_time_sec );
if (model != 0)
_position->addKid(model);
_selector->addKid(_position);
}
void
-FGModelPlacement::update ()
+FGModelPlacement::update( const Point3D scenery_center )
{
_location->setPosition( _lon_deg, _lat_deg, _elev_ft );
_location->setOrientation( _roll_deg, _pitch_deg, _heading_deg );
- sgCopyMat4(POS, _location->getTransformMatrix());
+ sgCopyMat4( POS, _location->getTransformMatrix(scenery_center) );
sgVec3 trans;
sgCopyVec3(trans, _location->get_view_pos());
#include <plib/sg.h>
#include <plib/ssg.h>
-#include <simgear/misc/props.hxx>
+#include <simgear/math/point3d.hxx>
+#include <simgear/props/props.hxx>
// Don't pull in the headers, since we don't need them here.
* Subsystems should not normally invoke this function directly;
* instead, they should use the FGModelLoader declared in loader.hxx.
*/
-ssgBranch * fgLoad3DModel (const string &path);
+ssgBranch * fgLoad3DModel( const string& fg_root, const string &path,
+ SGPropertyNode *prop_root,
+ double sim_time_sec );
\f
class SelectAnimation : public Animation
{
public:
- SelectAnimation (SGPropertyNode_ptr props);
+ SelectAnimation( SGPropertyNode *prop_root,
+ SGPropertyNode_ptr props );
virtual ~SelectAnimation ();
virtual void update ();
private:
class SpinAnimation : public Animation
{
public:
- SpinAnimation (SGPropertyNode_ptr props);
+ SpinAnimation( SGPropertyNode *prop_root,
+ SGPropertyNode_ptr props,
+ double sim_time_sec );
virtual ~SpinAnimation ();
- virtual void update ();
+ virtual void update( double sim_time_sec );
private:
SGPropertyNode_ptr _prop;
double _factor;
public:
TimedAnimation (SGPropertyNode_ptr props);
virtual ~TimedAnimation ();
- virtual void update ();
+ virtual void update( double sim_time_sec );
private:
double _duration_sec;
double _last_time_sec;
class RotateAnimation : public Animation
{
public:
- RotateAnimation (SGPropertyNode_ptr props);
+ RotateAnimation( SGPropertyNode *prop_root, SGPropertyNode_ptr props );
virtual ~RotateAnimation ();
- virtual void update ();
+ virtual void update();
private:
SGPropertyNode_ptr _prop;
double _offset_deg;
class TranslateAnimation : public Animation
{
public:
- TranslateAnimation (SGPropertyNode_ptr props);
+ TranslateAnimation( SGPropertyNode *prop_root,
+ SGPropertyNode_ptr props );
virtual ~TranslateAnimation ();
virtual void update ();
private:
FGModelPlacement ();
virtual ~FGModelPlacement ();
- virtual void init (const string &path);
- virtual void update ();
+ virtual void init( const string &fg_root,
+ const string &path,
+ SGPropertyNode *prop_root,
+ double sim_time_sec );
+ virtual void update( const Point3D scenery_center );
virtual ssgEntity * getSceneGraph () { return (ssgEntity *)_selector; }
Instance * instance = new Instance;
FGModelPlacement * model = new FGModelPlacement;
instance->model = model;
- model->init(node->getStringValue("path", "Models/Geometry/glider.ac"));
+ model->init( globals->get_fg_root(),
+ node->getStringValue("path", "Models/Geometry/glider.ac"),
+ globals->get_props(),
+ globals->get_sim_time_sec() );
// Set position and orientation either
// indirectly through property refs
if (instance->heading_deg_node != 0)
model->setHeadingDeg(instance->heading_deg_node->getDoubleValue());
- instance->model->update();
+ instance->model->update( globals->get_scenery()->get_center() );
}
}
// Static (!) handling for all 3D panels in the program. Very
// clumsy. Replace with per-aircraft handling.
vector<FGPanelNode*> all_3d_panels;
-bool fgHandle3DPanelMouseEvent(int button, int updown, int x, int y)
+bool fgHandle3DPanelMouseEvent( int button, int updown, int x, int y )
{
- for(int i=0; i<all_3d_panels.size(); i++)
- if(all_3d_panels[i]->doMouseAction(button, updown, x, y))
+ for ( unsigned int i = 0; i < all_3d_panels.size(); i++ ) {
+ if ( all_3d_panels[i]->doMouseAction(button, updown, x, y) ) {
return true;
+ }
+ }
return false;
}
void fgUpdate3DPanels()
{
- for(int i=0; i<all_3d_panels.size(); i++)
+ for ( unsigned int i = 0; i < all_3d_panels.size(); i++ ) {
all_3d_panels[i]->getPanel()->updateMouseDelay();
+ }
}
FGPanelNode::FGPanelNode(SGPropertyNode* props)