Want more features on Pastebin? Sign Up, it's FREE!
Guest

Add pitch and roll interpretation in STG

By: a guest on May 20th, 2012  |  syntax: None  |  size: 1.35 KB  |  views: 25  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. diff --git a/simgear/scene/tgdb/ReaderWriterSTG.cxx b/simgear/scene/tgdb/ReaderWriterSTG.cxx
  2. index 21a47ba..3d1ba29 100644
  3. --- a/simgear/scene/tgdb/ReaderWriterSTG.cxx
  4. +++ b/simgear/scene/tgdb/ReaderWriterSTG.cxx
  5. @@ -281,7 +281,22 @@ ReaderWriterSTG::readStgFile(const std::string& absoluteFileName,
  6.                  matrix = makeZUpFrame(SGGeod::fromDegM(lon, lat, elev));
  7.                  matrix.preMultRotate(osg::Quat(SGMiscd::deg2rad(hdg),
  8.                                                 osg::Vec3(0, 0, 1)));
  9. -                
  10. +
  11. +                while ( (in.peek() != '\n') && (in.peek() != '\r') &&
  12. +                        isspace(in.peek()) ) {
  13. +                   in.get();
  14. +                }
  15. +
  16. +                if (isdigit(in.peek())){
  17. +                    double pitch(0.0), roll(0.0);
  18. +                    in >> pitch >> roll;
  19. +
  20. +                    matrix.preMultRotate(osg::Quat(SGMiscd::deg2rad(pitch),
  21. +                                                   osg::Vec3(1, 0, 0)));
  22. +                    matrix.preMultRotate(osg::Quat(SGMiscd::deg2rad(roll),
  23. +                                                   osg::Vec3(0, 1, 0)));
  24. +                }
  25. +
  26.                  osg::MatrixTransform* matrixTransform;
  27.                  matrixTransform = new osg::MatrixTransform(matrix);
  28.                  matrixTransform->setDataVariance(osg::Object::STATIC);
clone this paste RAW Paste Data