From Marcin Prus, "some time ago there was an optimization fix including change in DirectionalSector::computeMatrix().

Rotation matrices were replaced with quaternions but incorrect contructor was used. There was a call to Quat(angle, xAxis, yAxis, zAxis ) but there is no such constructor in Quat class to create quaternion for rotation. As a result we got this values being written into quaternion directly.

I've replaced Quat contructor calls with the ones creating rotation quaternions Quat( angle, Vec3( axis ) )."
This commit is contained in:
Robert Osfield
2008-12-10 10:10:45 +00:00
parent 3297702173
commit 33782a5177

View File

@@ -234,9 +234,9 @@ void DirectionalSector::computeMatrix()
double pitch = atan2(_direction[2], sqrt(_direction[0]*_direction[0] + _direction[1]*_direction[1]));
double roll = _rollAngle;
_local_to_LP.setRotate(osg::Quat(heading, 0.0, 0.0, -1.0));
_local_to_LP.preMultRotate(osg::Quat(pitch, 1.0, 0.0, 0.0));
_local_to_LP.preMultRotate(osg::Quat(roll, 0.0, 1.0, 0.0));
_local_to_LP.setRotate(osg::Quat(heading,osg::Vec3d(0.0, 0.0, -1.0)));
_local_to_LP.preMultRotate(osg::Quat(pitch, osg::Vec3d(1.0, 0.0, 0.0)));
_local_to_LP.preMultRotate(osg::Quat(roll, osg::Vec3d(0.0, 1.0, 0.0)));
}
void DirectionalSector::setDirection(const osg::Vec3& direction)