Ignore:
Timestamp:
Apr 21, 2012, 11:44:46 AM (12 years ago)
Author:
Torben Dannhauer
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • experimental/distortionNG/DistortionManipulator.cpp

    r347 r348  
    2727DistortionManipulator::DistortionManipulator()
    2828{
     29        activeSetupMode = DISABLED;
     30        activeDistortionMode = MESH;
     31        activeManualSetupMode = DISTORTION;
     32        activeVisualizationMode = NONE;
    2933}
    3034
     
    4448}
    4549
    46 bool DistortionManipulator::handle(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa, osg::Object*, osg::NodeVisitor* nv)
     50bool DistortionManipulator::handle(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa, osg::Object* obj, osg::NodeVisitor* nv)
    4751{
    4852        osgViewer::View* viewer = dynamic_cast<osgViewer::View*>(&aa);
     
    5458        switch(ea.getEventType())
    5559    {
    56         case(osgGA::GUIEventAdapter::MOVE):
     60        case(osgGA::GUIEventAdapter::MOVE): break;
    5761        case(osgGA::GUIEventAdapter::DRAG):
    5862                {
     
    6165                }
    6266        case(osgGA::GUIEventAdapter::PUSH):
    63         case(osgGA::GUIEventAdapter::RELEASE):
     67                {
     68                        if(ea.getButton() == osgGA::GUIEventAdapter::LEFT_MOUSE_BUTTON)
     69                        {
     70                                osg::notify(osg::ALWAYS)<<"mouse click left!"<<std::endl;
     71                        }
     72                        break;
     73                }
     74        case(osgGA::GUIEventAdapter::RELEASE): break;
    6475        case(osgGA::GUIEventAdapter::KEYDOWN):
    6576                {
     
    7687                        if (ea.getKey()==osgGA::GUIEventAdapter::KEY_KP_Left)   // KP 4: Toggles Setup Mode between DISABLED, MANUAL & DELEGATED.
    7788                        {
    78                                 osg::notify(osg::ALWAYS)<<"KEY_KP_4"<<std::endl;
     89                                switch(activeSetupMode)
     90                                {
     91                                        case DISABLED : activeSetupMode = MANUAL; break;
     92                                        case MANUAL : activeSetupMode = DELEGATED; break;
     93                                        case DELEGATED : activeSetupMode = DISABLED; break;
     94                                }
     95
     96                                osg::notify(osg::ALWAYS)<<"KEY_KP_4 : Setup Mode now "<<activeSetupMode<<std::endl;
    7997                                return(true);
    8098                        }
    8199                        if (ea.getKey()==osgGA::GUIEventAdapter::KEY_KP_Begin)  // KP 5: MANUAL Mode: Toggle between blending & distortion setup.
    82100                        {
    83                                 osg::notify(osg::ALWAYS)<<"KEY_KP_5"<<std::endl;
     101
     102                                activeManualSetupMode = (activeManualSetupMode==DISTORTION?BLENDING:DISTORTION);
     103                                osg::notify(osg::ALWAYS)<<"KEY_KP_5 : activeManualSetupMode is now "<<activeManualSetupMode<<std::endl;
    84104                                return(true);
    85105                        }
    86106                        if (ea.getKey()==osgGA::GUIEventAdapter::KEY_KP_Right)  // KP 6: MANUAL Mode: Toggle if distortion drags affect mesh or rtt texture coordinates -> defaults to Mesh
    87107                        {
    88                                 osg::notify(osg::ALWAYS)<<"KEY_KP_6"<<std::endl;
     108                                activeDistortionMode = (activeDistortionMode==MESH?TEXCOORDINATES:MESH);
     109                                osg::notify(osg::ALWAYS)<<"KEY_KP_6 : activeDistortionMode is now "<<activeDistortionMode<<std::endl;
    89110                                return(true);
    90111                        }
    91112                        if (ea.getKey()==osgGA::GUIEventAdapter::KEY_KP_Home)   // KP 7: Show distortion mesh / intensity map / none.
    92113                        {
    93                                 osg::notify(osg::ALWAYS)<<"KEY_KP_7"<<std::endl;
     114                                switch(activeVisualizationMode)
     115                                {       
     116                                        case DISTORTION_MESH : activeVisualizationMode = INTENSITY_MAP; break;
     117                                        case INTENSITY_MAP : activeVisualizationMode = NONE; break;
     118                                        case NONE : activeVisualizationMode = DISTORTION_MESH; break;
     119                                }
     120                                osg::notify(osg::ALWAYS)<<"KEY_KP_7 : activeVisualizationMode is now "<<activeVisualizationMode<<std::endl;
    94121                                return(true);
    95122                        }
    96123                        if (ea.getKey()==osgGA::GUIEventAdapter::KEY_KP_Up)     // KP 8: Save distortion set     via plugin
    97124                        {
    98                                 osg::notify(osg::ALWAYS)<<"KEY_KP_8"<<std::endl;
     125                                osg::notify(osg::ALWAYS)<<"KEY_KP_8 : todo: Save DistortionContainer"<<std::endl;
    99126                                return(true);
    100127                        }
     
    103130                        return false;   // Event ignored
    104131                }
    105         case(osgGA::GUIEventAdapter::KEYUP):
     132        case(osgGA::GUIEventAdapter::KEYUP): break;
    106133                case(osgGA::GUIEventAdapter::FRAME):
    107134                {
Note: See TracChangeset for help on using the changeset viewer.