Added new Matrixf and Matrixd implementations.
Made Matrix be a typedef to either Matrixf or Matrixd. Defaults to Matrixf. Converted the osgGA::MatrixManipulators and osgProducer::Viewer/OsgCameraGroup across to using exclusively Matrixd for internal computations and passing betwen Manipulators, Producer and SceneView. Note, SceneView still uses Matrix internally so will depend on what is set as the default in include/osg/Matrix. Added the ability to osgProducer::setDone/getDone(), kept done() as the method that the viewer main loop uses for detecting the exit condition.
This commit is contained in:
@@ -180,21 +180,21 @@ void FlightManipulator::addMouseEvent(const GUIEventAdapter& ea)
|
||||
}
|
||||
|
||||
|
||||
void FlightManipulator::setByMatrix(const osg::Matrix& matrix)
|
||||
void FlightManipulator::setByMatrix(const osg::Matrixd& matrix)
|
||||
{
|
||||
_eye = matrix.getTrans();
|
||||
matrix.get(_rotation);
|
||||
_distance = 1.0f;
|
||||
}
|
||||
|
||||
osg::Matrix FlightManipulator::getMatrix() const
|
||||
osg::Matrixd FlightManipulator::getMatrix() const
|
||||
{
|
||||
return osg::Matrix::rotate(_rotation)*osg::Matrix::translate(_eye);
|
||||
return osg::Matrixd::rotate(_rotation)*osg::Matrixd::translate(_eye);
|
||||
}
|
||||
|
||||
osg::Matrix FlightManipulator::getInverseMatrix() const
|
||||
osg::Matrixd FlightManipulator::getInverseMatrix() const
|
||||
{
|
||||
return osg::Matrix::translate(-_eye)*osg::Matrix::rotate(_rotation.inverse());
|
||||
return osg::Matrixd::translate(-_eye)*osg::Matrixd::rotate(_rotation.inverse());
|
||||
}
|
||||
|
||||
void FlightManipulator::computePosition(const osg::Vec3& eye,const osg::Vec3& lv,const osg::Vec3& up)
|
||||
@@ -206,7 +206,7 @@ void FlightManipulator::computePosition(const osg::Vec3& eye,const osg::Vec3& lv
|
||||
osg::Vec3 u(s^f);
|
||||
u.normalize();
|
||||
|
||||
osg::Matrix rotation_matrix(s[0], u[0], -f[0], 0.0f,
|
||||
osg::Matrixd rotation_matrix(s[0], u[0], -f[0], 0.0f,
|
||||
s[1], u[1], -f[1], 0.0f,
|
||||
s[2], u[2], -f[2], 0.0f,
|
||||
0.0f, 0.0f, 0.0f, 1.0f);
|
||||
@@ -258,7 +258,7 @@ bool FlightManipulator::calcMovement()
|
||||
float dy = _ga_t0->getYnormalized();
|
||||
|
||||
|
||||
osg::Matrix rotation_matrix;
|
||||
osg::Matrixd rotation_matrix;
|
||||
rotation_matrix.makeRotate(_rotation);
|
||||
|
||||
osg::Vec3 up = osg::Vec3(0.0f,1.0f,0.0) * rotation_matrix;
|
||||
|
||||
Reference in New Issue
Block a user