Hi all.
My application needs a method to turn the view on the model horizontally and
vertically .
This is implemented by scroll wheels at the bottom and to the right of the
view.
I tried to make this working by calling the following methods:
osg::Matrixd trackballMatrix;
/** ##################################
* Starting to scroll the wheel by the cursor
*/
void Cl_3Dview_osg::startMoveEvent() {
// TODO: Throws disablen. Not possible by default
view->requestContinuousUpdate(false);
trackballMatrix = view->getCameraManipulator()->getMatrix();
}
/** ##################################
* Scrollin the wheel by the cursor
*/
void Cl_3Dview_osg::valueChangedEvent(Qt::Orientation orientation, int
newValue) {
osg::Vec3 achse;
if (orientation == Qt::Horizontal) {
achse = osg::Vec3(0.0, 0.0, 1.0);
} else {
achse = osg::Vec3(1.0, 0.0, 0.0);
}
osg::Matrixd myRotationMatrix;
myRotationMatrix.makeRotate(osg::DegreesToRadians((float)newValue),
achse);
view->getCameraManipulator()->setByMatrix(trackballMatrix *
myRotationMatrix);
}
Unfortunately this turns my scene around (0.0, 0.0, 0.0).
I'm really not familiar with such kind of stuff so I would appreciate any
help.
Many thanks in advance!
- Werner -
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org