Changeset 348 for experimental


Ignore:
Timestamp:
Apr 21, 2012, 11:44:46 AM (12 years ago)
Author:
Torben Dannhauer
Message:
 
Location:
experimental/distortionNG
Files:
3 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                {
  • experimental/distortionNG/DistortionManipulator.h

    r347 r348  
    2828{
    2929public:
     30        enum SetupMode {
     31                DISABLED,
     32                MANUAL,
     33                DELEGATED
     34        };
     35        enum DistortionMode {
     36                MESH,
     37                TEXCOORDINATES
     38        };
     39        enum ManualSetupMode {
     40                DISTORTION,
     41                BLENDING
     42        };
     43        enum VisualizationMode {
     44                DISTORTION_MESH,
     45                INTENSITY_MAP,
     46                NONE
     47        };
     48
     49
    3050        DistortionManipulator();
    3151        virtual ~DistortionManipulator();
     
    3757        void resetIntensityMap();
    3858        void resetDistortion();
     59
     60        SetupMode activeSetupMode;
     61        DistortionMode activeDistortionMode;
     62        ManualSetupMode activeManualSetupMode;
     63        VisualizationMode activeVisualizationMode;
    3964};
    4065
  • experimental/distortionNG/main.cpp

    r347 r348  
    165165 * distortionManipulator                                abgeleitet von osgGA::GUIEventHandler
    166166 *                                                                              Grundfunktionen:
    167  *                                                                              - Key to Show/Hide Distortion Mesh
    168  *                                                                              - Key to Show/Hide Intensity Map
     167 *                                                      [done]          - Key to Show Distortion Mesh / Intensity Map / none
    169168 *                                                                              - Key to Save distortion Container  - via plugin
    170  *                                                                              - Key to toggle MANUAL mode between blending und distortion setup
    171  *                                                                              - Key to toggle distortion setup:
     169 *                                                      [done]          - Key to toggle MANUAL mode between blending und distortion setup
     170 *                                                      [done]          - Key to toggle distortion setup:
    172171 *                                                                                              DISABLED distortion/blending modifications are forbidden (ggfs. beim Verlassen von DISABLED ggf. auf singleThreaded wechseln und beim aktivieren von DISABLED wieder auf das alte threadingmodel. Alternativ  die data variance des meshes/Blendmap beeinflussen)
    173172 *                                                                                              MANUAL distortion/blending modification via mouse Selection and drag'n'drop
    174173 *                                                                                              DELEGATED distortion/blending modification by calling a foreign class or calling a subclassed function
    175  *                                                                              - Key to control if mouse drags affects mesh coordinates or rttScene texture coordinates. Default: Mesh coordinates.
     174 *                                                      [done]          - Key to control if mouse drags affects mesh coordinates or rttScene texture coordinates. Default: Mesh coordinates.
    176175 *                                                                              - Key to reset Distortion.
    177176 *                                                                              - Key to reset Blending.
Note: See TracChangeset for help on using the changeset viewer.