source: experimental/distortionNG/DistortionManipulator.h @ 380

Last change on this file since 380 was 380, checked in by Torben Dannhauer, 12 years ago
File size: 3.3 KB
RevLine 
[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>
[353]23#include <osg/Referenced>
24#include <osg/Switch>
25#include <osg/Geometry>
26#include <osgUtil/IntersectionVisitor>
27#include <osgUtil/LineSegmentIntersector>
[356]28#include <osgText/Text>
[353]29
[371]30#include "DistortionSetupStrategy.h"
[349]31#include "DistortionSet.h"
[346]32
[380]33class extViewer;
[346]34
35namespace osgViewer {
36
[353]37
[346]38class DistortionManipulator : public osgGA::GUIEventHandler
39{
40public:
[348]41        enum SetupMode {
42                DISABLED,
43                MANUAL,
44                DELEGATED
45        };
46        enum DistortionMode {
47                MESH,
48                TEXCOORDINATES
49        };
50        enum ManualSetupMode {
51                DISTORTION,
52                BLENDING
53        };
54        enum VisualizationMode {
55                DISTORTION_MESH,
56                INTENSITY_MAP,
57                NONE
58        };
59
60
[380]61        DistortionManipulator(extViewer* viewer, DistortionSet* ds);
[346]62        virtual ~DistortionManipulator();
63
64        virtual void getUsage(osg::ApplicationUsage& usage) const;
65    virtual bool handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter& aa, osg::Object*, osg::NodeVisitor* nv);
[347]66
[349]67        void setDistortionSet(DistortionSet* ds) {_distortionSet = ds;}
68
[372]69        void setDistortionSetupStrategy(DistortionSetupStrategy* strategy)      {_delegatedDistortionSetupStrategy = strategy;}
[353]70
[347]71private:
72        void resetIntensityMap();
73        void resetDistortion();
[349]74        void showDistortionMesh(bool show);
75        void showIntensityMap(bool show);
[348]76
[353]77        void computeSelectedVertex( osgUtil::LineSegmentIntersector::Intersection& result );
78        void createVertexHighlighter();
[356]79        void createHUD();
80        void updateHUD();
[353]81
[348]82        SetupMode activeSetupMode;
83        DistortionMode activeDistortionMode;
84        ManualSetupMode activeManualSetupMode;
85        VisualizationMode activeVisualizationMode;
[349]86
87        osg::ref_ptr<DistortionSet> _distortionSet;
[371]88        osg::ref_ptr<DistortionSetupStrategy> _delegatedDistortionSetupStrategy;
[353]89
90        osg::ref_ptr<osg::Geometry> _highlighter;
91    osg::observer_ptr<osg::Camera> _camera;
[380]92         osg::observer_ptr<extViewer> _viewer;
[353]93        osg::Geometry* _distortionMesh;
94        const osg::Vec4 _highlightColor;
[370]95       
96        //LF Screen Resolution
97        unsigned int _screenPixWidth, _screenPixHeight;
98       
[356]99
100        // HUD
101        osg::ref_ptr<osgText::Text> hudSetupMode;
102        osg::ref_ptr<osgText::Text> hudDistortionMode;
103        osg::ref_ptr<osgText::Text> hudManualSetupMode;
104        osg::ref_ptr<osgText::Text> hudVisualizationMode;
[346]105};
106
107
108}
109
110#endif /* OSGGA_DISTORTION_MANIPULATOR */
Note: See TracBrowser for help on using the repository browser.