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.
This commit is contained in:
@@ -281,7 +281,22 @@ ReaderWriterSTG::readStgFile(const std::string& absoluteFileName,
|
|||||||
matrix = makeZUpFrame(SGGeod::fromDegM(lon, lat, elev));
|
matrix = makeZUpFrame(SGGeod::fromDegM(lon, lat, elev));
|
||||||
matrix.preMultRotate(osg::Quat(SGMiscd::deg2rad(hdg),
|
matrix.preMultRotate(osg::Quat(SGMiscd::deg2rad(hdg),
|
||||||
osg::Vec3(0, 0, 1)));
|
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;
|
osg::MatrixTransform* matrixTransform;
|
||||||
matrixTransform = new osg::MatrixTransform(matrix);
|
matrixTransform = new osg::MatrixTransform(matrix);
|
||||||
matrixTransform->setDataVariance(osg::Object::STATIC);
|
matrixTransform->setDataVariance(osg::Object::STATIC);
|
||||||
|
|||||||
Reference in New Issue
Block a user