|
发表于 2013-6-3 08:39:51
|
显示全部楼层
- if (_autoRotateMode==ROTATE_TO_SCREEN)
- {
- osg::Vec3d translation;
- osg::Quat rotation;
- osg::Vec3d scale;
- osg::Quat so;
- cs->getModelViewMatrix()->decompose( translation, rotation, scale, so );
- setRotation(rotation.inverse());
- }
- else if (_autoRotateMode==ROTATE_TO_CAMERA)
- {
- osg::Vec3d PosToEye = _position - eyePoint;
- osg::Matrix lookto = osg::Matrix::lookAt(
- osg::Vec3d(0,0,0), PosToEye, localUp);
- Quat q;
- q.set(osg::Matrix::inverse(lookto));
- setRotation(q);
- }
复制代码 自己看 |
|