From: Anders Gidenstam Date: Sun, 20 May 2012 19:49:08 +0000 (+0200) Subject: Clement de l'Hamaide: Add support for pitch and roll for OBJECT_SHARED and OBJECT_STA... X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=ffb67f4014f16f33e7cea6b150e1da004558fad5;p=simgear.git 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. --- 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);