/* osgVisual test. distortionNG, experimental. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #ifndef OSGGA_DISTORTION_MANIPULATOR #define OSGGA_DISTORTION_MANIPULATOR 1 #include #include #include #include #include #include #include #include "DistortionSetupStrategy.h" #include "DistortionSet.h" class extViewer; namespace osgViewer { class DistortionManipulator : public osgGA::GUIEventHandler { public: enum SetupMode { DISABLED, MANUAL, DELEGATED }; enum DistortionMode { MESH, TEXCOORDINATES }; enum ManualSetupMode { DISTORTION, BLENDING }; enum VisualizationMode { DISTORTION_MESH, INTENSITY_MAP, NONE }; DistortionManipulator(extViewer* viewer, DistortionSet* ds); virtual ~DistortionManipulator(); virtual void getUsage(osg::ApplicationUsage& usage) const; virtual bool handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter& aa, osg::Object*, osg::NodeVisitor* nv); void setDistortionSet(DistortionSet* ds) {_distortionSet = ds;} void setDistortionSetupStrategy(DistortionSetupStrategy* strategy) {_delegatedDistortionSetupStrategy = strategy;} private: void resetIntensityMap(); void resetDistortion(); void showDistortionMesh(bool show); void showIntensityMap(bool show); void computeSelectedVertex( osgUtil::LineSegmentIntersector::Intersection& result ); void createVertexHighlighter(); void createHUD(); void updateHUD(); SetupMode activeSetupMode; DistortionMode activeDistortionMode; ManualSetupMode activeManualSetupMode; VisualizationMode activeVisualizationMode; osg::ref_ptr _distortionSet; osg::ref_ptr _delegatedDistortionSetupStrategy; osg::ref_ptr _highlighter; osg::observer_ptr _camera; osg::observer_ptr _viewer; osg::Geometry* _distortionMesh; const osg::Vec4 _highlightColor; //LF Screen Resolution unsigned int _screenPixWidth, _screenPixHeight; // HUD osg::ref_ptr hudSetupMode; osg::ref_ptr hudDistortionMode; osg::ref_ptr hudManualSetupMode; osg::ref_ptr hudVisualizationMode; }; } #endif /* OSGGA_DISTORTION_MANIPULATOR */