]> git.mxchange.org Git - flightgear.git/blob - src/Model/model.cxx
3f1078cff0da8dd72d7bc533582bac359e3bd03c
[flightgear.git] / src / Model / model.cxx
1 // model.cxx - manage a 3D aircraft model.
2 // Written by David Megginson, started 2002.
3 //
4 // This file is in the Public Domain, and comes with no warranty.
5
6 #ifdef HAVE_CONFIG_H
7 #  include <config.h>
8 #endif
9
10 #include <string.h>             // for strcmp()
11
12 #include <plib/sg.h>
13 #include <plib/ssg.h>
14
15 #include <simgear/compiler.h>
16 #include <simgear/debug/logstream.hxx>
17 #include <simgear/math/interpolater.hxx>
18 #include <simgear/math/point3d.hxx>
19 #include <simgear/math/sg_geodesy.hxx>
20 #include <simgear/misc/exception.hxx>
21 #include <simgear/misc/sg_path.hxx>
22
23 #include <Main/fg_props.hxx>
24 #include <Main/globals.hxx>
25 #include <Main/location.hxx>
26 #include <Scenery/scenery.hxx>
27
28 #include "model.hxx"
29
30
31 \f
32 ////////////////////////////////////////////////////////////////////////
33 // Static utility functions.
34 ////////////////////////////////////////////////////////////////////////
35
36 /**
37  * Locate a named SSG node in a branch.
38  */
39 static ssgEntity *
40 find_named_node (ssgEntity * node, const char * name)
41 {
42   char * node_name = node->getName();
43   if (node_name != 0 && !strcmp(name, node_name))
44     return node;
45   else if (node->isAKindOf(ssgTypeBranch())) {
46     int nKids = node->getNumKids();
47     for (int i = 0; i < nKids; i++) {
48       ssgEntity * result =
49         find_named_node(((ssgBranch*)node)->getKid(i), name);
50       if (result != 0)
51         return result;
52     }
53   } 
54   return 0;
55 }
56
57 /**
58  * Splice a branch in between all child nodes and their parents.
59  */
60 static void
61 splice_branch (ssgBranch * branch, ssgEntity * child)
62 {
63   int nParents = child->getNumParents();
64   branch->addKid(child);
65   for (int i = 0; i < nParents; i++) {
66     ssgBranch * parent = child->getParent(i);
67     parent->replaceKid(child, branch);
68   }
69 }
70
71 /**
72  * Set up the transform matrix for a spin or rotation.
73  */
74 static void
75 set_rotation (sgMat4 &matrix, double position_deg,
76               sgVec3 &center, sgVec3 &axis)
77 {
78  float temp_angle = -position_deg * SG_DEGREES_TO_RADIANS ;
79  
80  float s = (float) sin ( temp_angle ) ;
81  float c = (float) cos ( temp_angle ) ;
82  float t = SG_ONE - c ;
83
84  // axis was normalized at load time 
85  // hint to the compiler to put these into FP registers
86  float x = axis[0];
87  float y = axis[1];
88  float z = axis[2];
89
90  matrix[0][0] = t * x * x + c ;
91  matrix[0][1] = t * y * x - s * z ;
92  matrix[0][2] = t * z * x + s * y ;
93  matrix[0][3] = SG_ZERO;
94  
95  matrix[1][0] = t * x * y + s * z ;
96  matrix[1][1] = t * y * y + c ;
97  matrix[1][2] = t * z * y - s * x ;
98  matrix[1][3] = SG_ZERO;
99  
100  matrix[2][0] = t * x * z - s * y ;
101  matrix[2][1] = t * y * z + s * x ;
102  matrix[2][2] = t * z * z + c ;
103  matrix[2][3] = SG_ZERO;
104
105   // hint to the compiler to put these into FP registers
106  x = center[0];
107  y = center[1];
108  z = center[2];
109  
110  matrix[3][0] = x - x*matrix[0][0] - y*matrix[1][0] - z*matrix[2][0];
111  matrix[3][1] = y - x*matrix[0][1] - y*matrix[1][1] - z*matrix[2][1];
112  matrix[3][2] = z - x*matrix[0][2] - y*matrix[1][2] - z*matrix[2][2];
113  matrix[3][3] = SG_ONE;
114 }
115
116 /**
117  * Set up the transform matrix for a translation.
118  */
119 static void
120 set_translation (sgMat4 &matrix, double position_m, sgVec3 &axis)
121 {
122   sgVec3 xyz;
123   sgScaleVec3(xyz, axis, position_m);
124   sgMakeTransMat4(matrix, xyz);
125 }
126
127
128 /**
129  * Make an offset matrix from rotations and position offset.
130  */
131 static void
132 make_offsets_matrix (sgMat4 * result, double h_rot, double p_rot, double r_rot,
133                      double x_off, double y_off, double z_off)
134 {
135   sgMat4 rot_matrix;
136   sgMat4 pos_matrix;
137   sgMakeRotMat4(rot_matrix, h_rot, p_rot, r_rot);
138   sgMakeTransMat4(pos_matrix, x_off, y_off, z_off);
139   sgMultMat4(*result, pos_matrix, rot_matrix);
140 }
141
142
143 /**
144  * Read an interpolation table from properties.
145  */
146 static SGInterpTable *
147 read_interpolation_table (const SGPropertyNode * props)
148 {
149   const SGPropertyNode * table_node = props->getNode("interpolation");
150   if (table_node != 0) {
151     SGInterpTable * table = new SGInterpTable();
152     vector<SGPropertyNode_ptr> entries = table_node->getChildren("entry");
153     for (int i = 0; i < entries.size(); i++)
154       table->addEntry(entries[i]->getDoubleValue("ind", 0.0),
155                       entries[i]->getDoubleValue("dep", 0.0));
156     return table;
157   } else {
158     return 0;
159   }
160 }
161
162
163 \f
164 ////////////////////////////////////////////////////////////////////////
165 // Implementation of FG3DModel
166 ////////////////////////////////////////////////////////////////////////
167
168 FG3DModel::FG3DModel ()
169   : _model(0)
170 {
171 }
172
173 FG3DModel::~FG3DModel ()
174 {
175   // since the nodes are attached to the scene graph, they'll be
176   // deleted automatically
177
178   int i;
179   for (i = 0; i < _animations.size(); i++)
180     delete _animations[i];
181 }
182
183 void 
184 FG3DModel::init (const string &path)
185 {
186   SGPropertyNode props;
187
188                                 // Load the 3D aircraft object itself
189   SGPath xmlpath = globals->get_fg_root();
190   SGPath modelpath = path;
191   xmlpath.append(modelpath.str());
192
193                                 // Check for an XML wrapper
194   if (xmlpath.str().substr(xmlpath.str().size() - 4, 4) == ".xml") {
195     readProperties(xmlpath.str(), &props);
196     if (props.hasValue("/path")) {
197       modelpath = modelpath.dir();
198       modelpath.append(props.getStringValue("/path"));
199     } else {
200       throw sg_exception("No path for model");
201     }
202   }
203
204                                 // Assume that textures are in
205                                 // the same location as the XML file.
206   ssgTexturePath((char *)xmlpath.dir().c_str());
207   _model = (ssgBranch *)ssgLoad((char *)modelpath.c_str());
208   if (_model == 0)
209     throw sg_exception("Failed to load 3D model");
210
211                                 // Set up the alignment node
212   ssgTransform * align = new ssgTransform;
213   align->addKid(_model);
214   sgMat4 res_matrix;
215   make_offsets_matrix(&res_matrix,
216                       props.getFloatValue("/offsets/heading-deg", 0.0),
217                       props.getFloatValue("/offsets/roll-deg", 0.0),
218                       props.getFloatValue("/offsets/pitch-deg", 0.0),
219                       props.getFloatValue("/offsets/x-m", 0.0),
220                       props.getFloatValue("/offsets/y-m", 0.0),
221                       props.getFloatValue("/offsets/z-m", 0.0));
222   align->setTransform(res_matrix);
223
224                                 // Load animations
225   vector<SGPropertyNode_ptr> animation_nodes = props.getChildren("animation");
226   unsigned int i;
227   for (i = 0; i < animation_nodes.size(); i++) {
228     vector<SGPropertyNode_ptr> name_nodes =
229       animation_nodes[i]->getChildren("object-name");
230     if (name_nodes.size() < 1) {
231       Animation * animation = make_animation(0, animation_nodes[i]);
232       if (animation != 0)
233         _animations.push_back(animation);
234     } else {
235       for (unsigned int j = 0; j < name_nodes.size(); j++) {
236         Animation * animation =
237           make_animation(name_nodes[j]->getStringValue(), animation_nodes[i]);
238         if (animation != 0)
239           _animations.push_back(animation);
240       }
241     }
242   }
243
244                                 // Load sub-models
245   vector<SGPropertyNode_ptr> model_nodes = props.getChildren("model");
246   for (i = 0; i < model_nodes.size(); i++) {
247     SGPropertyNode_ptr node = model_nodes[i];
248     ssgTransform * align = new ssgTransform;
249     sgMat4 res_matrix;
250     make_offsets_matrix(&res_matrix,
251                         node->getFloatValue("offsets/heading-deg", 0.0),
252                         node->getFloatValue("offsets/roll-deg", 0.0),
253                         node->getFloatValue("offsets/pitch-deg", 0.0),
254                         node->getFloatValue("offsets/x-m", 0.0),
255                         node->getFloatValue("offsets/y-m", 0.0),
256                         node->getFloatValue("offsets/z-m", 0.0));
257     align->setTransform(res_matrix);
258     FG3DModel * kid = new FG3DModel;
259     kid->init(node->getStringValue("path"));
260     align->addKid(kid->getSceneGraph());
261     _model->addKid(align);
262     _children.push_back(kid);
263   }
264 }
265
266 void
267 FG3DModel::update (double dt)
268 {
269   unsigned int i;
270
271   for (i = 0; i < _children.size(); i++)
272     _children[i]->update(dt);
273   for (i = 0; i < _animations.size(); i++)
274     _animations[i]->update(dt);
275 }
276
277 FG3DModel::Animation *
278 FG3DModel::make_animation (const char * object_name,
279                            SGPropertyNode * node)
280 {
281   Animation * animation = 0;
282   const char * type = node->getStringValue("type");
283   if (!strcmp("none", type)) {
284     animation = new NullAnimation();
285   } else if (!strcmp("range", type)) {
286     animation = new RangeAnimation();
287   } else if (!strcmp("billboard", type)) {
288     animation = new BillboardAnimation();
289   } else if (!strcmp("select", type)) {
290     animation = new SelectAnimation();
291   } else if (!strcmp("spin", type)) {
292     animation = new SpinAnimation();
293   } else if (!strcmp("rotate", type)) {
294     animation = new RotateAnimation();
295   } else if (!strcmp("translate", type)) {
296     animation = new TranslateAnimation();
297   } else {
298     animation = new NullAnimation();
299     SG_LOG(SG_INPUT, SG_WARN, "Unknown animation type " << type);
300   }
301
302   ssgEntity * object;
303   if (object_name != 0) {
304     object = find_named_node(_model, object_name);
305     if (object == 0) {
306       SG_LOG(SG_INPUT, SG_WARN, "Object " << object_name << " not found");
307       delete animation;
308       animation = 0;
309     }
310   } else {
311     object = _model;
312   }
313
314   if (animation != 0)
315     animation->init(object, node);
316   return animation;
317 }
318
319
320 \f
321 ////////////////////////////////////////////////////////////////////////
322 // Implementation of FG3DModel::Animation
323 ////////////////////////////////////////////////////////////////////////
324
325 FG3DModel::Animation::Animation ()
326 {
327 }
328
329 FG3DModel::Animation::~Animation ()
330 {
331 }
332
333
334 \f
335 ////////////////////////////////////////////////////////////////////////
336 // Implementation of FG3DModel::NullAnimation
337 ////////////////////////////////////////////////////////////////////////
338
339 FG3DModel::NullAnimation::NullAnimation ()
340   : _branch(new ssgBranch)
341 {
342 }
343
344 FG3DModel::NullAnimation::~NullAnimation ()
345 {
346   _branch = 0;
347 }
348
349 void
350 FG3DModel::NullAnimation::init (ssgEntity * object,
351                                       SGPropertyNode * props)
352 {
353   splice_branch(_branch, object);
354   _branch->setName(props->getStringValue("name", 0));
355 }
356
357 void
358 FG3DModel::NullAnimation::update (double dt)
359 {
360 }
361
362
363 \f
364 ////////////////////////////////////////////////////////////////////////
365 // Implementation of FG3DModel::RangeAnimation
366 ////////////////////////////////////////////////////////////////////////
367
368 FG3DModel::RangeAnimation::RangeAnimation ()
369   : _branch(new ssgRangeSelector)
370 {
371 }
372
373 FG3DModel::RangeAnimation::~RangeAnimation ()
374 {
375   _branch = 0;
376 }
377
378 void
379 FG3DModel::RangeAnimation::init (ssgEntity * object,
380                                       SGPropertyNode * props)
381 {
382   float ranges[2];
383   splice_branch(_branch, object);
384   _branch->setName(props->getStringValue("name", 0));
385   ranges[0] = props->getFloatValue("min-m", 0);
386   ranges[1] = props->getFloatValue("max-m", 5000);
387   _branch->setRanges(ranges, 2);
388 }
389
390 void
391 FG3DModel::RangeAnimation::update (double dt)
392 {
393 }
394
395
396 \f
397 ////////////////////////////////////////////////////////////////////////
398 // Implementation of FG3DModel::BillboardAnimation
399 ////////////////////////////////////////////////////////////////////////
400
401 FG3DModel::BillboardAnimation::BillboardAnimation ()
402   : _branch(0)
403 {
404   // Note: we cannot allocate the branch until we know whether
405   // it can rotate around the x axis as well as the z axis.
406 }
407
408 FG3DModel::BillboardAnimation::~BillboardAnimation ()
409 {
410   _branch = 0;
411 }
412
413 void
414 FG3DModel::BillboardAnimation::init (ssgEntity * object,
415                                      SGPropertyNode * props)
416 {
417   _branch = new ssgCutout(props->getBoolValue("spherical", true));
418   splice_branch(_branch, object);
419   _branch->setName(props->getStringValue("name", 0));
420 }
421
422 void
423 FG3DModel::BillboardAnimation::update (double dt)
424 {
425 }
426
427
428 \f
429 ////////////////////////////////////////////////////////////////////////
430 // Implementation of FG3DModel::SelectAnimation
431 ////////////////////////////////////////////////////////////////////////
432
433 FG3DModel::SelectAnimation::SelectAnimation ()
434   : _condition(0),
435     _selector(new ssgSelector)
436 {
437 }
438
439 FG3DModel::SelectAnimation::~SelectAnimation ()
440 {
441   delete _condition;
442   _selector = 0;
443 }
444
445 void
446 FG3DModel::SelectAnimation::init (ssgEntity * object,
447                                       SGPropertyNode * props)
448 {
449   splice_branch(_selector, object);
450   _selector->setName(props->getStringValue("name", 0));
451   SGPropertyNode * node = props->getChild("condition");
452   if (node != 0) {
453     _condition = fgReadCondition(node);
454   }
455 }
456
457 void
458 FG3DModel::SelectAnimation::update (double dt)
459 {
460   if (_condition != 0 && _condition->test()) 
461     _selector->select(0xffff);
462   else
463     _selector->select(0x0000);
464 }
465
466
467 \f
468 ////////////////////////////////////////////////////////////////////////
469 // Implementation of FG3DModel::SpinAnimation
470 ////////////////////////////////////////////////////////////////////////
471
472 FG3DModel::SpinAnimation::SpinAnimation ()
473   : _prop(0),
474     _factor(0),
475     _position_deg(0),
476     _transform(new ssgTransform)
477 {
478 }
479
480 FG3DModel::SpinAnimation::~SpinAnimation ()
481 {
482   _transform = 0;
483 }
484
485 void
486 FG3DModel::SpinAnimation::init (ssgEntity * object,
487                                       SGPropertyNode * props)
488 {
489                                 // Splice in the new transform node
490   splice_branch(_transform, object);
491   _transform->setName(props->getStringValue("name", 0));
492   _prop = fgGetNode(props->getStringValue("property", "/null"), true);
493   _factor = props->getDoubleValue("factor", 1.0);
494   _position_deg = props->getDoubleValue("starting-position-deg", 0);
495   _center[0] = props->getFloatValue("center/x-m", 0);
496   _center[1] = props->getFloatValue("center/y-m", 0);
497   _center[2] = props->getFloatValue("center/z-m", 0);
498   _axis[0] = props->getFloatValue("axis/x", 0);
499   _axis[1] = props->getFloatValue("axis/y", 0);
500   _axis[2] = props->getFloatValue("axis/z", 0);
501   sgNormalizeVec3(_axis);
502 }
503
504 void
505 FG3DModel::SpinAnimation::update (double dt)
506 {
507   float velocity_rpms = (_prop->getDoubleValue() * _factor / 60.0);
508   _position_deg += (dt * velocity_rpms * 360);
509   while (_position_deg < 0)
510     _position_deg += 360.0;
511   while (_position_deg >= 360.0)
512     _position_deg -= 360.0;
513   set_rotation(_matrix, _position_deg, _center, _axis);
514   _transform->setTransform(_matrix);
515 }
516
517
518 \f
519 ////////////////////////////////////////////////////////////////////////
520 // Implementation of FG3DModel::RotateAnimation
521 ////////////////////////////////////////////////////////////////////////
522
523 FG3DModel::RotateAnimation::RotateAnimation ()
524   : _prop(0),
525     _offset_deg(0.0),
526     _factor(1.0),
527     _table(0),
528     _has_min(false),
529     _min_deg(0.0),
530     _has_max(false),
531     _max_deg(1.0),
532     _position_deg(0.0),
533     _transform(new ssgTransform)
534 {
535 }
536
537 FG3DModel::RotateAnimation::~RotateAnimation ()
538 {
539   delete _table;
540   _transform = 0;
541 }
542
543 void
544 FG3DModel::RotateAnimation::init (ssgEntity * object,
545                                   SGPropertyNode * props)
546 {
547                                 // Splice in the new transform node
548   splice_branch(_transform, object);
549   _transform->setName(props->getStringValue("name", 0));
550   _prop = fgGetNode(props->getStringValue("property", "/null"), true);
551   _offset_deg = props->getDoubleValue("offset-deg", 0.0);
552   _factor = props->getDoubleValue("factor", 1.0);
553   _table = read_interpolation_table(props);
554   if (props->hasValue("min-deg")) {
555     _has_min = true;
556     _min_deg = props->getDoubleValue("min-deg");
557   }
558   if (props->hasValue("max-deg")) {
559     _has_max = true;
560     _max_deg = props->getDoubleValue("max-deg");
561   }
562   _position_deg = props->getDoubleValue("starting-position-deg", 0);
563   _center[0] = props->getFloatValue("center/x-m", 0);
564   _center[1] = props->getFloatValue("center/y-m", 0);
565   _center[2] = props->getFloatValue("center/z-m", 0);
566   _axis[0] = props->getFloatValue("axis/x", 0);
567   _axis[1] = props->getFloatValue("axis/y", 0);
568   _axis[2] = props->getFloatValue("axis/z", 0);
569   sgNormalizeVec3(_axis);
570 }
571
572 void
573 FG3DModel::RotateAnimation::update (double dt)
574 {
575   if (_table == 0) {
576     _position_deg = (_prop->getDoubleValue() + _offset_deg) * _factor;
577    if (_has_min && _position_deg < _min_deg)
578      _position_deg = _min_deg;
579    if (_has_max && _position_deg > _max_deg)
580      _position_deg = _max_deg;
581   } else {
582     _position_deg = _table->interpolate(_prop->getDoubleValue());
583   }
584   set_rotation(_matrix, _position_deg, _center, _axis);
585   _transform->setTransform(_matrix);
586 }
587
588
589 \f
590 ////////////////////////////////////////////////////////////////////////
591 // Implementation of FG3DModel::TranslateAnimation
592 ////////////////////////////////////////////////////////////////////////
593
594 FG3DModel::TranslateAnimation::TranslateAnimation ()
595   : _prop(0),
596     _offset_m(0.0),
597     _factor(1.0),
598     _table(0),
599     _has_min(false),
600     _min_m(0.0),
601     _has_max(false),
602     _max_m(1.0),
603     _position_m(0.0),
604     _transform(new ssgTransform)
605 {
606 }
607
608 FG3DModel::TranslateAnimation::~TranslateAnimation ()
609 {
610   delete _table;
611   _transform = 0;
612 }
613
614 void
615 FG3DModel::TranslateAnimation::init (ssgEntity * object,
616                                      SGPropertyNode * props)
617 {
618                                 // Splice in the new transform node
619   splice_branch(_transform, object);
620   _transform->setName(props->getStringValue("name", 0));
621   _prop = fgGetNode(props->getStringValue("property", "/null"), true);
622   _offset_m = props->getDoubleValue("offset-m", 0.0);
623   _factor = props->getDoubleValue("factor", 1.0);
624   _table = read_interpolation_table(props);
625   if (props->hasValue("min-m")) {
626     _has_min = true;
627     _min_m = props->getDoubleValue("min-m");
628   }
629   if (props->hasValue("max-m")) {
630     _has_max = true;
631     _max_m = props->getDoubleValue("max-m");
632   }
633   _position_m = props->getDoubleValue("starting-position-m", 0);
634   _axis[0] = props->getFloatValue("axis/x", 0);
635   _axis[1] = props->getFloatValue("axis/y", 0);
636   _axis[2] = props->getFloatValue("axis/z", 0);
637   sgNormalizeVec3(_axis);
638 }
639
640 void
641 FG3DModel::TranslateAnimation::update (double dt)
642 {
643   if (_table == 0) {
644     _position_m = (_prop->getDoubleValue() + _offset_m) * _factor;
645     if (_has_min && _position_m < _min_m)
646       _position_m = _min_m;
647     if (_has_max && _position_m > _max_m)
648       _position_m = _max_m;
649   } else {
650     _position_m = _table->interpolate(_prop->getDoubleValue());
651   }
652   set_translation(_matrix, _position_m, _axis);
653   _transform->setTransform(_matrix);
654 }
655
656
657 \f
658 ////////////////////////////////////////////////////////////////////////
659 // Implementation of FGModelPlacement.
660 ////////////////////////////////////////////////////////////////////////
661
662 FGModelPlacement::FGModelPlacement ()
663   : _model(new FG3DModel),
664     _lon_deg(0),
665     _lat_deg(0),
666     _elev_ft(0),
667     _roll_deg(0),
668     _pitch_deg(0),
669     _heading_deg(0),
670     _selector(new ssgSelector),
671     _position(new ssgTransform),
672     _location(new FGLocation)
673 {
674 }
675
676 FGModelPlacement::~FGModelPlacement ()
677 {
678   delete _model;
679   delete _selector;
680 }
681
682 void
683 FGModelPlacement::init (const string &path)
684 {
685   _model->init(path);
686   _position->addKid(_model->getSceneGraph());
687   _selector->addKid(_position);
688   _selector->clrTraversalMaskBits(SSGTRAV_HOT);
689 }
690
691 void
692 FGModelPlacement::update (double dt)
693 {
694   _model->update(dt);
695
696   _location->setPosition( _lon_deg, _lat_deg, _elev_ft );
697   _location->setOrientation( _roll_deg, _pitch_deg, _heading_deg );
698
699   sgMat4 POS;
700   sgCopyMat4(POS, _location->getTransformMatrix());
701   
702   sgVec3 trans;
703   sgCopyVec3(trans, _location->get_view_pos());
704
705   for(int i = 0; i < 4; i++) {
706     float tmp = POS[i][3];
707     for( int j=0; j<3; j++ ) {
708       POS[i][j] += (tmp * trans[j]);
709     }
710   }
711   _position->setTransform(POS);
712 }
713
714 bool
715 FGModelPlacement::getVisible () const
716 {
717   return (_selector->getSelect() != 0);
718 }
719
720 void
721 FGModelPlacement::setVisible (bool visible)
722 {
723   _selector->select(visible);
724 }
725
726 void
727 FGModelPlacement::setLongitudeDeg (double lon_deg)
728 {
729   _lon_deg = lon_deg;
730 }
731
732 void
733 FGModelPlacement::setLatitudeDeg (double lat_deg)
734 {
735   _lat_deg = lat_deg;
736 }
737
738 void
739 FGModelPlacement::setElevationFt (double elev_ft)
740 {
741   _elev_ft = elev_ft;
742 }
743
744 void
745 FGModelPlacement::setPosition (double lon_deg, double lat_deg, double elev_ft)
746 {
747   _lon_deg = lon_deg;
748   _lat_deg = lat_deg;
749   _elev_ft = elev_ft;
750 }
751
752 void
753 FGModelPlacement::setRollDeg (double roll_deg)
754 {
755   _roll_deg = roll_deg;
756 }
757
758 void
759 FGModelPlacement::setPitchDeg (double pitch_deg)
760 {
761   _pitch_deg = pitch_deg;
762 }
763
764 void
765 FGModelPlacement::setHeadingDeg (double heading_deg)
766 {
767   _heading_deg = heading_deg;
768 }
769
770 void
771 FGModelPlacement::setOrientation (double roll_deg, double pitch_deg,
772                                   double heading_deg)
773 {
774   _roll_deg = roll_deg;
775   _pitch_deg = pitch_deg;
776   _heading_deg = heading_deg;
777 }
778
779 // end of model.cxx