Advertisement
Guest User

Add pitch and roll interpretation in STG

a guest
May 20th, 2012
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.35 KB | None | 0 0
  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);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement