//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
-// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
/*****************************************************************
*
* WARNING - Curt has some ideas about AI traffic so anything in here
-* may get rewritten or scrapped. Contact Curt curt@flightgear.org
+* may get rewritten or scrapped. Contact Curt http://www.flightgear.org/~curt
* before spending any time or effort on this code!!!
*
******************************************************************/
#include <Main/globals.hxx>
#include <Scenery/scenery.hxx>
-//#include <simgear/constants.h>
+#include <simgear/constants.h>
#include <simgear/math/point3d.hxx>
#include <simgear/math/sg_geodesy.hxx>
#include <simgear/misc/sg_path.hxx>
#include "AIEntity.hxx"
+FGAIEntity::FGAIEntity() {
+}
+
FGAIEntity::~FGAIEntity() {
+ //cout << "FGAIEntity dtor called..." << endl;
+ //cout << "Removing model from scene graph..." << endl;
+ globals->get_scenery()->get_scene_graph()->removeChild(_aip.getSceneGraph());
+
+ //cout << "Done!" << endl;
+}
+
+void FGAIEntity::SetModel(osg::Node* model) {
+ _model = model;
+ _aip.init(_model.get());
+ _aip.setVisible(false);
+ globals->get_scenery()->get_scene_graph()->addChild(_aip.getSceneGraph());
+
}
void FGAIEntity::Update(double dt) {
}
+const string &FGAIEntity::GetCallsign() {
+ static string s = "";
+ return(s);
+}
+
void FGAIEntity::RegisterTransmission(int code) {
}
// Run the internal calculations
//void FGAIEntity::Update() {
void FGAIEntity::Transform() {
- aip.setPosition(pos.lon(), pos.lat(), pos.elev() * SG_METER_TO_FEET);
- aip.setOrientation(roll, pitch, hdg);
- aip.update( globals->get_scenery()->get_center() );
+ _aip.setPosition(_pos.lon(), _pos.lat(), _pos.elev() * SG_METER_TO_FEET);
+ _aip.setOrientation(_roll, _pitch, _hdg);
+ _aip.update();
}