]> git.mxchange.org Git - simgear.git/commitdiff
Clement de l'Hamaide: Add support for pitch and roll for OBJECT_SHARED and OBJECT_STA...
authorAnders Gidenstam <anders@gidenstam.org>
Sun, 20 May 2012 19:49:08 +0000 (21:49 +0200)
committerAnders Gidenstam <anders@gidenstam.org>
Sun, 20 May 2012 20:21:38 +0000 (22:21 +0200)
Pitch and roll behave the same as pitch-deg and roll-deg offsets in
model XML files.

simgear/scene/tgdb/ReaderWriterSTG.cxx

index 21a47ba677a3746bd50bef01e34a7c4977b704d8..9e317a5ed8e522a4a51856c5d0c8446744994599 100644 (file)
@@ -281,7 +281,22 @@ ReaderWriterSTG::readStgFile(const std::string& absoluteFileName,
                 matrix = makeZUpFrame(SGGeod::fromDegM(lon, lat, elev));
                 matrix.preMultRotate(osg::Quat(SGMiscd::deg2rad(hdg),
                                                osg::Vec3(0, 0, 1)));
-                
+
+                while ( (in.peek() != '\n') && (in.peek() != '\r') &&
+                        (in.peek() != '-')  && isspace(in.peek()) ) {
+                   in.get();
+                }
+
+                if (isdigit(in.peek()) || (in.peek() == '-')){
+                    double pitch(0.0), roll(0.0);
+                    in >> pitch >> roll;
+
+                    matrix.preMultRotate(osg::Quat(SGMiscd::deg2rad(pitch),
+                                                   osg::Vec3(0, 1, 0)));
+                    matrix.preMultRotate(osg::Quat(SGMiscd::deg2rad(roll),
+                                                   osg::Vec3(1, 0, 0)));
+                }
+
                 osg::MatrixTransform* matrixTransform;
                 matrixTransform = new osg::MatrixTransform(matrix);
                 matrixTransform->setDataVariance(osg::Object::STATIC);