From ffb67f4014f16f33e7cea6b150e1da004558fad5 Mon Sep 17 00:00:00 2001 From: Anders Gidenstam Date: Sun, 20 May 2012 21:49:08 +0200 Subject: [PATCH] Clement de l'Hamaide: Add support for pitch and roll for OBJECT_SHARED and OBJECT_STATIC in .stg files. Pitch and roll behave the same as pitch-deg and roll-deg offsets in model XML files. --- simgear/scene/tgdb/ReaderWriterSTG.cxx | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/simgear/scene/tgdb/ReaderWriterSTG.cxx b/simgear/scene/tgdb/ReaderWriterSTG.cxx index 21a47ba6..9e317a5e 100644 --- a/simgear/scene/tgdb/ReaderWriterSTG.cxx +++ b/simgear/scene/tgdb/ReaderWriterSTG.cxx @@ -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); -- 2.39.5