Ignore:
Timestamp:
Apr 20, 2012, 10:51:36 PM (12 years ago)
Author:
Torben Dannhauer
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • experimental/distortionNG/DistortionManipulator.cpp

    r346 r347  
    1818
    1919#include "DistortionManipulator.h"
     20
     21#include<osgViewer/Viewer>
    2022
    2123using namespace osg;
     
    4446bool DistortionManipulator::handle(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa, osg::Object*, osg::NodeVisitor* nv)
    4547{
    46 switch(ea.getEventType())
     48        osgViewer::View* viewer = dynamic_cast<osgViewer::View*>(&aa);
     49                if ( viewer )
     50                {
     51                        //osg::notify(osg::ALWAYS)<<"viewer!"<<std::endl;
     52                }
     53
     54        switch(ea.getEventType())
    4755    {
    4856        case(osgGA::GUIEventAdapter::MOVE):
     
    5563        case(osgGA::GUIEventAdapter::RELEASE):
    5664        case(osgGA::GUIEventAdapter::KEYDOWN):
     65                {
     66                        if (ea.getKey()==osgGA::GUIEventAdapter::KEY_KP_End)    // KP 1: reset distortion
     67                        {
     68                                resetDistortion();
     69                                return(true);
     70                        }
     71                        if (ea.getKey()==osgGA::GUIEventAdapter::KEY_KP_Down)   // KP 2: reset intensity map
     72                        {
     73                                resetIntensityMap();
     74                                return(true);
     75                        }
     76                        if (ea.getKey()==osgGA::GUIEventAdapter::KEY_KP_Left)   // KP 4: Toggles Setup Mode between DISABLED, MANUAL & DELEGATED.
     77                        {
     78                                osg::notify(osg::ALWAYS)<<"KEY_KP_4"<<std::endl;
     79                                return(true);
     80                        }
     81                        if (ea.getKey()==osgGA::GUIEventAdapter::KEY_KP_Begin)  // KP 5: MANUAL Mode: Toggle between blending & distortion setup.
     82                        {
     83                                osg::notify(osg::ALWAYS)<<"KEY_KP_5"<<std::endl;
     84                                return(true);
     85                        }
     86                        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
     87                        {
     88                                osg::notify(osg::ALWAYS)<<"KEY_KP_6"<<std::endl;
     89                                return(true);
     90                        }
     91                        if (ea.getKey()==osgGA::GUIEventAdapter::KEY_KP_Home)   // KP 7: Show distortion mesh / intensity map / none.
     92                        {
     93                                osg::notify(osg::ALWAYS)<<"KEY_KP_7"<<std::endl;
     94                                return(true);
     95                        }
     96                        if (ea.getKey()==osgGA::GUIEventAdapter::KEY_KP_Up)     // KP 8: Save distortion set     via plugin
     97                        {
     98                                osg::notify(osg::ALWAYS)<<"KEY_KP_8"<<std::endl;
     99                                return(true);
     100                        }
     101                       
     102
     103                        return false;   // Event ignored
     104                }
    57105        case(osgGA::GUIEventAdapter::KEYUP):
    58106                case(osgGA::GUIEventAdapter::FRAME):
    59107                {
    60                         osg::notify(osg::ALWAYS)<<"FRAME!"<<std::endl;
     108                        //osg::notify(osg::ALWAYS)<<"FRAME!"<<std::endl;
    61109                        break;
    62110                }
     
    72120    return false;
    73121}
     122
     123void DistortionManipulator::resetIntensityMap()
     124{
     125        osg::notify(osg::ALWAYS)<<"ToDo: resetIntensityMap()"<<std::endl;
     126}
     127
     128void DistortionManipulator::resetDistortion()
     129{
     130        osg::notify(osg::ALWAYS)<<"ToDo: resetDistortion()"<<std::endl;
     131}
Note: See TracChangeset for help on using the changeset viewer.