source: experimental/distortionNG/PlaceboManipulator.h @ 403

Last change on this file since 403 was 403, checked in by Torben Dannhauer, 12 years ago

placebo Manipulator added to allow to use manipulators together with directly set Viewer matrix

File size: 3.2 KB
Line 
1#pragma once
2/* -*-c++-*- osgVisual - Copyright (C) 2009-2011 Torben Dannhauer
3 *
4 * This library is based on OpenSceneGraph, open source and may be redistributed and/or modified under
5 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
6 * (at your option) any later version.  The full license is in LICENSE file
7 * included with this distribution, and on the openscenegraph.org website.
8 *
9 * osgVisual requires for some proprietary modules a license from the correspondig manufacturer.
10 * You have to aquire licenses for all used proprietary modules.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 * OpenSceneGraph Public License for more details.
16*/
17
18#include <osgGA/CameraManipulator>
19#include <osg/Referenced>
20#include <osgViewer/Viewer>
21
22
23namespace osgGA
24{ 
25
26/**
27 * \brief This class is a placebo manipulator, which doexs nothing.
28 Its purpose is to allow the mixed setup of manipulators together with plain setting of cameras view and projection matrix.
29 *
30 * @author Torben Dannhauer
31 * @date  Jul 2012
32 */ 
33class PlaceboManipulator : public CameraManipulator
34{
35    public:
36                /**
37                 * \brief Constructor
38                 *
39                 */ 
40        PlaceboManipulator();
41
42                /**
43                 * \brief This function returns the classname.
44                 *
45                 * @return Classname of this manipulator.
46                 */ 
47        virtual const char* className() const { return "PlaceboManipulator"; }
48
49                /**
50                 * \brief Set the position of the matrix manipulator using a 4x4 Matrix.
51                 *
52                 * @param matrix : Matrix to set.
53                 */ 
54        virtual void setByMatrix(const osg::Matrixd& matrix);
55
56                /**
57                 * \brief Set the position of the matrix manipulator using a 4x4 Matrix.
58                 *
59                 * @param matrix : Inverse Matrix to set.
60                 */ 
61        virtual void setByInverseMatrix(const osg::Matrixd& matrix) { setByMatrix(osg::Matrixd::inverse(matrix)); }
62
63        /** get the position of the manipulator as 4x4 Matrix.*/
64        virtual osg::Matrixd getMatrix() const;
65
66        /** get the position of the manipulator as a inverse matrix of the manipulator, typically used as a model view matrix.*/
67        virtual osg::Matrixd getInverseMatrix() const;
68
69                /**
70                 * \brief Start/restart the manipulator.
71                 *
72                 * No further implementation
73                 *
74                 * @param ea : GUI eventadapter to use for initialization.
75                 * @param us : GUI actionadapter to use for initialization.
76                 */ 
77        virtual void init(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& us);
78
79        /** handle events, return true if handled, false otherwise.*/
80                virtual bool handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter& aa, osg::Object*, osg::NodeVisitor* nv);
81
82        /** Get the keyboard and mouse usage of this manipulator.*/
83        virtual void getUsage(osg::ApplicationUsage& usage) const;
84
85
86
87    protected:
88                /**
89                 * \brief Destructor. Because it is protected, no explicit delete myPointer by external caller is possible.
90                 * This forces the class to be used with osg::ref pointers.
91                 */ 
92        virtual ~PlaceboManipulator();
93
94                osg::Matrixd  modelViewMatrix;
95
96};
97
98}       // END NAMESPACE
Note: See TracBrowser for help on using the repository browser.