Changeset 348 for experimental/distortionNG
- Timestamp:
- Apr 21, 2012, 11:44:46 AM (13 years ago)
- Location:
- experimental/distortionNG
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
experimental/distortionNG/DistortionManipulator.cpp
r347 r348 27 27 DistortionManipulator::DistortionManipulator() 28 28 { 29 activeSetupMode = DISABLED; 30 activeDistortionMode = MESH; 31 activeManualSetupMode = DISTORTION; 32 activeVisualizationMode = NONE; 29 33 } 30 34 … … 44 48 } 45 49 46 bool DistortionManipulator::handle(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa, osg::Object* , osg::NodeVisitor* nv)50 bool DistortionManipulator::handle(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa, osg::Object* obj, osg::NodeVisitor* nv) 47 51 { 48 52 osgViewer::View* viewer = dynamic_cast<osgViewer::View*>(&aa); … … 54 58 switch(ea.getEventType()) 55 59 { 56 case(osgGA::GUIEventAdapter::MOVE): 60 case(osgGA::GUIEventAdapter::MOVE): break; 57 61 case(osgGA::GUIEventAdapter::DRAG): 58 62 { … … 61 65 } 62 66 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; 64 75 case(osgGA::GUIEventAdapter::KEYDOWN): 65 76 { … … 76 87 if (ea.getKey()==osgGA::GUIEventAdapter::KEY_KP_Left) // KP 4: Toggles Setup Mode between DISABLED, MANUAL & DELEGATED. 77 88 { 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; 79 97 return(true); 80 98 } 81 99 if (ea.getKey()==osgGA::GUIEventAdapter::KEY_KP_Begin) // KP 5: MANUAL Mode: Toggle between blending & distortion setup. 82 100 { 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; 84 104 return(true); 85 105 } 86 106 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 107 { 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; 89 110 return(true); 90 111 } 91 112 if (ea.getKey()==osgGA::GUIEventAdapter::KEY_KP_Home) // KP 7: Show distortion mesh / intensity map / none. 92 113 { 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; 94 121 return(true); 95 122 } 96 123 if (ea.getKey()==osgGA::GUIEventAdapter::KEY_KP_Up) // KP 8: Save distortion set via plugin 97 124 { 98 osg::notify(osg::ALWAYS)<<"KEY_KP_8 "<<std::endl;125 osg::notify(osg::ALWAYS)<<"KEY_KP_8 : todo: Save DistortionContainer"<<std::endl; 99 126 return(true); 100 127 } … … 103 130 return false; // Event ignored 104 131 } 105 case(osgGA::GUIEventAdapter::KEYUP): 132 case(osgGA::GUIEventAdapter::KEYUP): break; 106 133 case(osgGA::GUIEventAdapter::FRAME): 107 134 { -
experimental/distortionNG/DistortionManipulator.h
r347 r348 28 28 { 29 29 public: 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 30 50 DistortionManipulator(); 31 51 virtual ~DistortionManipulator(); … … 37 57 void resetIntensityMap(); 38 58 void resetDistortion(); 59 60 SetupMode activeSetupMode; 61 DistortionMode activeDistortionMode; 62 ManualSetupMode activeManualSetupMode; 63 VisualizationMode activeVisualizationMode; 39 64 }; 40 65 -
experimental/distortionNG/main.cpp
r347 r348 165 165 * distortionManipulator abgeleitet von osgGA::GUIEventHandler 166 166 * 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 169 168 * - Key to Save distortion Container - via plugin 170 * 171 * 169 * [done] - Key to toggle MANUAL mode between blending und distortion setup 170 * [done] - Key to toggle distortion setup: 172 171 * 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) 173 172 * MANUAL distortion/blending modification via mouse Selection and drag'n'drop 174 173 * DELEGATED distortion/blending modification by calling a foreign class or calling a subclassed function 175 * 174 * [done] - Key to control if mouse drags affects mesh coordinates or rttScene texture coordinates. Default: Mesh coordinates. 176 175 * - Key to reset Distortion. 177 176 * - Key to reset Blending.
Note: See TracChangeset
for help on using the changeset viewer.