]> git.mxchange.org Git - flightgear.git/blob - src/ATCDCL/AIEntity.cxx
Port over remaining Point3D usage to the more type and unit safe SG* classes.
[flightgear.git] / src / ATCDCL / AIEntity.cxx
1 // FGAIEntity - abstract base class an artificial intelligence entity
2 //
3 // Written by David Luff, started March 2002.
4 //
5 // Copyright (C) 2002  David C. Luff - david.luff@nottingham.ac.uk
6 //
7 // This program is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU General Public License as
9 // published by the Free Software Foundation; either version 2 of the
10 // License, or (at your option) any later version.
11 //
12 // This program is distributed in the hope that it will be useful, but
13 // WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15 // General Public License for more details.
16 //
17 // You should have received a copy of the GNU General Public License
18 // along with this program; if not, write to the Free Software
19 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
20
21 /*****************************************************************
22 *
23 * WARNING - Curt has some ideas about AI traffic so anything in here
24 * may get rewritten or scrapped.  Contact Curt http://www.flightgear.org/~curt 
25 * before spending any time or effort on this code!!!
26 *
27 ******************************************************************/
28
29 #ifdef HAVE_CONFIG_H
30 #  include <config.h>
31 #endif
32
33 #include <Main/globals.hxx>
34 #include <Scenery/scenery.hxx>
35 #include <simgear/constants.h>
36 #include <simgear/math/sg_geodesy.hxx>
37 #include <simgear/misc/sg_path.hxx>
38 #include <string>
39
40 #include "AIEntity.hxx"
41
42 FGAIEntity::FGAIEntity() :
43     _ground_elevation_m(0)
44 {
45 }
46
47 FGAIEntity::~FGAIEntity() {
48     globals->get_scenery()->get_scene_graph()->removeChild(_aip.getSceneGraph());
49 }
50
51 void FGAIEntity::SetModel(osg::Node* model) {
52     _aip.init(model);
53     _aip.setVisible(false);
54     globals->get_scenery()->get_scene_graph()->addChild(_aip.getSceneGraph());
55 }
56
57 void FGAIEntity::Update(double dt) {
58 }
59
60 const string &FGAIEntity::GetCallsign() {
61     static string s = "";
62     return(s);
63 }
64
65 void FGAIEntity::RegisterTransmission(int code) {
66 }
67
68 // Run the internal calculations
69 //void FGAIEntity::Update() {
70 void FGAIEntity::Transform() {
71     _aip.setPosition(_pos);
72     _aip.setOrientation(_roll, _pitch, _hdg);
73     _aip.update();    
74 }