Hi all,
I know a lot of people who are interested by the interpretation of pitch and
roll in STG files.
Currently pitch and roll doesn't exist in STG file. A good proverb say "do it
yourself", thus I implemented the pitch and roll interpretation in STG files.
The git diff is :
diff --git a/simgear/scene/tgdb/ReaderWriterSTG.cxx
b/simgear/scene/tgdb/ReaderWriterSTG.cxx
index 21a47ba..5b8945a 100644
--- a/simgear/scene/tgdb/ReaderWriterSTG.cxx
+++ b/simgear/scene/tgdb/ReaderWriterSTG.cxx
@@ -281,6 +281,18 @@ 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)));
+
+
+ if ( (in.peek() != '\n') ){
+ double pitch(0.0), roll(0.0);
+ in >> pitch >> roll;
+
+ matrix.preMultRotate(osg::Quat(SGMiscd::deg2rad(pitch),
+ osg::Vec3(1, 0, 0)));
+ matrix.preMultRotate(osg::Quat(SGMiscd::deg2rad(roll),
+ osg::Vec3(0, 1, 0)));
+ }
+
osg::MatrixTransform* matrixTransform;
matrixTransform = new osg::MatrixTransform(matrix);
As you can see, it's only 6 lines added. This code works for "old" and "new"
STG files.
Example of old STG files :
OBJECT_SHARED Models/Communications/radio-medium.xml -121.8425 37.111111 964.15
180
Example of new STG files :
OBJECT_SHARED Models/Communications/radio-medium.xml -121.8425 37.111111 964.15
180 45.0 25.0
Where pitch = 45.0 degrees and roll = 25 degree
Someone can add it in Simgear please ?
Cheers,
Clément
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel