[346] | 1 | /* osgVisual test. distortionNG, experimental. |
---|
| 2 | * |
---|
| 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
---|
| 4 | * of this software and associated documentation files (the "Software"), to deal |
---|
| 5 | * in the Software without restriction, including without limitation the rights |
---|
| 6 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
---|
| 7 | * copies of the Software, and to permit persons to whom the Software is |
---|
| 8 | * furnished to do so, subject to the following conditions: |
---|
| 9 | * |
---|
| 10 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
---|
| 11 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
---|
| 12 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
---|
| 13 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
---|
| 14 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
---|
| 15 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
---|
| 16 | * THE SOFTWARE. |
---|
| 17 | */ |
---|
| 18 | |
---|
| 19 | #ifndef OSGGA_DISTORTION_MANIPULATOR |
---|
| 20 | #define OSGGA_DISTORTION_MANIPULATOR 1 |
---|
| 21 | |
---|
[349] | 22 | #include <osgGA/GUIEventHandler> |
---|
| 23 | #include<osg/Referenced> |
---|
| 24 | #include "DistortionSet.h" |
---|
[346] | 25 | |
---|
| 26 | |
---|
| 27 | namespace osgViewer { |
---|
| 28 | |
---|
| 29 | class DistortionManipulator : public osgGA::GUIEventHandler |
---|
| 30 | { |
---|
| 31 | public: |
---|
[348] | 32 | enum SetupMode { |
---|
| 33 | DISABLED, |
---|
| 34 | MANUAL, |
---|
| 35 | DELEGATED |
---|
| 36 | }; |
---|
| 37 | enum DistortionMode { |
---|
| 38 | MESH, |
---|
| 39 | TEXCOORDINATES |
---|
| 40 | }; |
---|
| 41 | enum ManualSetupMode { |
---|
| 42 | DISTORTION, |
---|
| 43 | BLENDING |
---|
| 44 | }; |
---|
| 45 | enum VisualizationMode { |
---|
| 46 | DISTORTION_MESH, |
---|
| 47 | INTENSITY_MAP, |
---|
| 48 | NONE |
---|
| 49 | }; |
---|
| 50 | |
---|
| 51 | |
---|
[346] | 52 | DistortionManipulator(); |
---|
| 53 | virtual ~DistortionManipulator(); |
---|
| 54 | |
---|
| 55 | virtual void getUsage(osg::ApplicationUsage& usage) const; |
---|
| 56 | virtual bool handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter& aa, osg::Object*, osg::NodeVisitor* nv); |
---|
[347] | 57 | |
---|
[349] | 58 | void setDistortionSet(DistortionSet* ds) {_distortionSet = ds;} |
---|
| 59 | |
---|
[347] | 60 | private: |
---|
| 61 | void resetIntensityMap(); |
---|
| 62 | void resetDistortion(); |
---|
[349] | 63 | void showDistortionMesh(bool show); |
---|
| 64 | void showIntensityMap(bool show); |
---|
[348] | 65 | |
---|
| 66 | SetupMode activeSetupMode; |
---|
| 67 | DistortionMode activeDistortionMode; |
---|
| 68 | ManualSetupMode activeManualSetupMode; |
---|
| 69 | VisualizationMode activeVisualizationMode; |
---|
[349] | 70 | |
---|
| 71 | osg::ref_ptr<DistortionSet> _distortionSet; |
---|
[346] | 72 | }; |
---|
| 73 | |
---|
| 74 | |
---|
| 75 | } |
---|
| 76 | |
---|
| 77 | #endif /* OSGGA_DISTORTION_MANIPULATOR */ |
---|