[osg-users] scene snapshot
Trajce Nikolov NICK
trajce.nikolov.nick at gmail.com
Wed Aug 30 04:06:00 PDT 2017
Hi Gianni, Robert,
yes, this will be like map view. I am familiar with the Camera interface
and the GL/GLU counterparts. The projection matrix should for sure be
ortho2D, just struggling with the view matrix how to set it up to have the
scene to fit exactly in ... thinking ...
Thanks for any hint
On Wed, Aug 30, 2017 at 11:57 AM, Gianni Ambrosio <g.ambrosio+osg at gmail.com>
wrote:
> Hi Nick,
> I'm not sure my scenario is like mine but hope this code snippet may help:
>
>
> Code:
>
> void setViewTowardsXMinus()
> {
> nodeTrackerManipulator->setTransformation(computeEye(osg::Vec3d(
> nodeTrackerManipulator->getDistance(), 0.0, 0.0)), osg::Vec3d(0.0, 0.0,
> 0.0), nodeTrackerManipulator->getHomeUpPosition());
> }
>
> void setViewTowardsXPlus()
> {
> nodeTrackerManipulator->setTransformation(computeEye(osg::Vec3d(-
> nodeTrackerManipulator->getDistance(), 0.0, 0.0)), osg::Vec3d(0.0, 0.0,
> 0.0), nodeTrackerManipulator->getHomeUpPosition());
> }
>
> void setViewTowardsYMinus()
> {
> nodeTrackerManipulator->setTransformation(computeEye(osg::Vec3d(0.0,
> nodeTrackerManipulator->getDistance(), 0.0)), osg::Vec3d(0.0, 0.0, 0.0),
> nodeTrackerManipulator->getHomeUpPosition());
> }
>
> void setViewTowardsYPlus()
> {
> nodeTrackerManipulator->setTransformation(computeEye(osg::Vec3d(0.0,
> -nodeTrackerManipulator->getDistance(), 0.0)), osg::Vec3d(0.0, 0.0, 0.0),
> nodeTrackerManipulator->getHomeUpPosition());
> }
>
> void setViewTowardsZMinus()
> {
> nodeTrackerManipulator->setTransformation(computeEye(osg::Vec3d(0.0,
> 0.0, nodeTrackerManipulator->getDistance())), osg::Vec3d(0.0, 0.0, 0.0),
> nodeTrackerManipulator->getHomeUpPosition());
> }
>
> void setViewTowardsZPlus()
> {
> nodeTrackerManipulator->setTransformation(computeEye(osg::Vec3(0.0f,
> 0.0f, -nodeTrackerManipulator->getDistance())), osg::Vec3d(0.0, 0.0,
> 0.0), nodeTrackerManipulator->getHomeUpPosition());
> }
>
> osg::Vec3d computeEye(const osg::Vec3d& iEye)
> {
> osg::Vec3d eye = iEye;
> ...
> double psi, theta, phi;
> graphicObject->getInitialRotation(psi, theta, phi);
> osg::Quat initAttitude = viosg::quatFromBody313(psi, theta, phi);
> eye = initAttitude * graphicObject->getTransformNode()->getAttitude()
> * eye;
> return eye;
> }
>
>
>
>
> Cheers,
> Gianni
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=71564#71564
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
--
trajce nikolov nick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20170830/6c5e2453/attachment.htm>
More information about the osg-users
mailing list