Changeset 230 for osgVisual


Ignore:
Timestamp:
Feb 13, 2011, 3:19:38 PM (13 years ago)
Author:
Torben Dannhauer
Message:

Clean up the spacemouse Node tracker a little bit.

Location:
osgVisual/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • osgVisual/trunk/bin/osgVisualConfig.xml

    r229 r230  
    7171        </geometry>
    7272      </model>
    73       <trackmodel id="1" updater_slot=""></trackmodel>
     73      <trackmodel id="2" updater_slot=""></trackmodel>
    7474    </models>
    7575    <datetime day="0" month="0" year="0" hour="12" minute="30"></datetime>
  • osgVisual/trunk/include/manip_Spacemouse/manip_nodeTrackerSpaceMouse.h

    r229 r230  
    200200        void addMouseEvent(const GUIEventAdapter& ea);
    201201
     202                /** Computes the world to local matrix */
     203                void computeNodeWorldToLocal(osg::Matrixd& worldToLocal) const;
     204
     205                /** Computes the local to world matrix */
     206        void computeNodeLocalToWorld(osg::Matrixd& localToWorld) const;
     207
    202208        void computeNodeCenterAndRotation(osg::Vec3d& center, osg::Quat& rotation) const;
    203209
  • osgVisual/trunk/src/manip_Spacemouse/manip_nodeTrackerSpaceMouse.cpp

    r229 r230  
    316316}
    317317
     318void NodeTrackerSpaceMouse::computeNodeWorldToLocal(osg::Matrixd& worldToLocal) const
     319{
     320    osg::NodePath nodePath;
     321    if (_trackNodePath.getNodePath(nodePath))
     322    {
     323        worldToLocal = osg::computeWorldToLocal(nodePath);
     324    }
     325}
     326
     327void NodeTrackerSpaceMouse::computeNodeLocalToWorld(osg::Matrixd& localToWorld) const
     328{
     329    osg::NodePath nodePath;
     330    if (_trackNodePath.getNodePath(nodePath))
     331    {
     332        localToWorld = osg::computeLocalToWorld(nodePath);
     333    }
     334
     335}
     336
    318337void NodeTrackerSpaceMouse::computeNodeCenterAndRotation(osg::Vec3d& nodeCenter, osg::Quat& nodeRotation) const
    319338{
     
    321340                return;
    322341
    323     osg::Matrixd localToWorld, worldToLocal;
     342    osg::Matrixd localToWorld;
     343        computeNodeLocalToWorld(localToWorld);
     344
    324345    osg::NodePath nodePath;
    325        
    326346        if (_trackNodePath.getNodePath(nodePath) && !nodePath.empty())
    327         {
    328                 worldToLocal = osg::computeWorldToLocal(nodePath);
    329                 localToWorld = osg::computeLocalToWorld(nodePath);
    330347        nodeCenter = osg::Vec3d(nodePath.back()->getBound().center())*localToWorld;
    331         }
    332348    else
    333349        nodeCenter = osg::Vec3d(0.0f,0.0f,0.0f)*localToWorld;
Note: See TracChangeset for help on using the changeset viewer.