source: experimental/distortionNG/DistortionManipulator.h @ 430

Last change on this file since 430 was 381, checked in by Torben Dannhauer, 12 years ago
File size: 3.4 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
[381]82        void updateDistortionSetup();
83        void updateDistortionViewProjectionMatrix();
84        void updateDistortionMesh();
85
86
[348]87        SetupMode activeSetupMode;
88        DistortionMode activeDistortionMode;
89        ManualSetupMode activeManualSetupMode;
90        VisualizationMode activeVisualizationMode;
[349]91
92        osg::ref_ptr<DistortionSet> _distortionSet;
[371]93        osg::ref_ptr<DistortionSetupStrategy> _delegatedDistortionSetupStrategy;
[353]94
95        osg::ref_ptr<osg::Geometry> _highlighter;
96    osg::observer_ptr<osg::Camera> _camera;
[381]97        osg::observer_ptr<extViewer> _viewer;
[353]98        osg::Geometry* _distortionMesh;
99        const osg::Vec4 _highlightColor;
[370]100       
101        //LF Screen Resolution
102        unsigned int _screenPixWidth, _screenPixHeight;
103       
[356]104
105        // HUD
106        osg::ref_ptr<osgText::Text> hudSetupMode;
107        osg::ref_ptr<osgText::Text> hudDistortionMode;
108        osg::ref_ptr<osgText::Text> hudManualSetupMode;
109        osg::ref_ptr<osgText::Text> hudVisualizationMode;
[346]110};
111
112
113}
114
115#endif /* OSGGA_DISTORTION_MANIPULATOR */
Note: See TracBrowser for help on using the repository browser.