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 | #include "DistortionManipulator.h" |
---|
20 | |
---|
21 | using namespace osg; |
---|
22 | using namespace osgViewer; |
---|
23 | |
---|
24 | |
---|
25 | DistortionManipulator::DistortionManipulator() |
---|
26 | { |
---|
27 | } |
---|
28 | |
---|
29 | DistortionManipulator::~DistortionManipulator() |
---|
30 | { |
---|
31 | } |
---|
32 | |
---|
33 | void DistortionManipulator::getUsage(osg::ApplicationUsage& usage) const |
---|
34 | { |
---|
35 | usage.addKeyboardMouseBinding("Keypad 7","Show distortion mesh / intensity map / none."); |
---|
36 | usage.addKeyboardMouseBinding("Keypad 8","Save distortion set."); // via plugin |
---|
37 | usage.addKeyboardMouseBinding("Keypad 4","Toggles Setup Mode between DISABLED, MANUAL & DELEGATED."); |
---|
38 | usage.addKeyboardMouseBinding("Keypad 5","MANUAL Mode: Toggle between blending & distortion setup."); |
---|
39 | usage.addKeyboardMouseBinding("Keypad 6","MANUAL Mode: Toggle if distortion drags affect mesh or rtt texture coordinates."); // Defaults to Mesh |
---|
40 | usage.addKeyboardMouseBinding("Keypad 1","Reset distortion."); |
---|
41 | usage.addKeyboardMouseBinding("Keypad 2","Reset intensity blending."); |
---|
42 | } |
---|
43 | |
---|
44 | bool DistortionManipulator::handle(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa, osg::Object*, osg::NodeVisitor* nv) |
---|
45 | { |
---|
46 | switch(ea.getEventType()) |
---|
47 | { |
---|
48 | case(osgGA::GUIEventAdapter::MOVE): |
---|
49 | case(osgGA::GUIEventAdapter::DRAG): |
---|
50 | { |
---|
51 | osg::notify(osg::ALWAYS)<<"DRAG!"<<std::endl; |
---|
52 | break; |
---|
53 | } |
---|
54 | case(osgGA::GUIEventAdapter::PUSH): |
---|
55 | case(osgGA::GUIEventAdapter::RELEASE): |
---|
56 | case(osgGA::GUIEventAdapter::KEYDOWN): |
---|
57 | case(osgGA::GUIEventAdapter::KEYUP): |
---|
58 | case(osgGA::GUIEventAdapter::FRAME): |
---|
59 | { |
---|
60 | osg::notify(osg::ALWAYS)<<"FRAME!"<<std::endl; |
---|
61 | break; |
---|
62 | } |
---|
63 | case (osgGA::GUIEventAdapter::RESIZE): // todo: adapt distortion mesh to new screen size |
---|
64 | { |
---|
65 | osg::notify(osg::ALWAYS)<<"RESIZE!"<<std::endl; |
---|
66 | break; |
---|
67 | } |
---|
68 | |
---|
69 | default: |
---|
70 | return false; |
---|
71 | } |
---|
72 | return false; |
---|
73 | } |
---|