source: osgVisual/include/manip_ObjectMounted/manip_objectMounted.h @ 72

Last change on this file since 72 was 55, checked in by Torben Dannhauer, 15 years ago

Updated to new osg version with new manipulator schema.
Updated integration of 3dx SpaceNavigator? to allow disabling without compile errors.

File size: 3.5 KB
RevLine 
[32]1#pragma once
2/* -*-c++-*- osgVisual - Copyright (C) 2009-2010 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
[55]18#include <osgGA/CameraManipulator>
[32]19
20#include <osg/Quat>
21#include <osg/observer_ptr>
22
23#include <visual_object.h>
24
25
26namespace osgVisual
27{ 
28
29/**
30 * \brief This class is a free spacemouse manipulator. It uses the 3DConnexion SpaceNavigator, which interface is implemented in manip_spaceMouse.h
31 *
32 * @author Torben Dannhauer
33 * @date  Aug 2009
34 */ 
[55]35class objectMountedManipulator : public osgGA::CameraManipulator
[32]36{
37    public:
38                /**
39                 * \brief Constructor
40                 *
41                 */ 
42        objectMountedManipulator();
43
44                /**
45                 * \brief This function returns the classname.
46                 *
47                 * @return Classname of this manipulator.
48                 */ 
49        virtual const char* className() const { return "objectMountedManipulator"; }
50
51                /**
52                 * \brief Set the position of the matrix manipulator using a 4x4 Matrix.
53                 *
54                 * @param matrix : Matrix to set.
55                 */ 
56        virtual void setByMatrix(const osg::Matrixd& matrix);
57
58                /**
59                 * \brief Set the position of the matrix manipulator using a 4x4 Matrix.
60                 *
61                 * @param matrix : Inverse Matrix to set.
62                 */ 
63        virtual void setByInverseMatrix(const osg::Matrixd& matrix) { setByMatrix(osg::Matrixd::inverse(matrix)); }
64
65        /** get the position of the manipulator as 4x4 Matrix.*/
66        virtual osg::Matrixd getMatrix() const;
67
68        /** get the position of the manipulator as a inverse matrix of the manipulator, typically used as a model view matrix.*/
69        virtual osg::Matrixd getInverseMatrix() const;
70
71                /**
72                 * \brief Start/restart the manipulator.
73                 *
74                 * No further implementation
75                 *
76                 * @param ea : GUI eventadapter to use for initialization.
77                 * @param us : GUI actionadapter to use for initialization.
78                 */ 
79        virtual void init(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& us);
80
81        /** handle events, return true if handled, false otherwise.*/
82        virtual bool handle(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& us);
83
84        /** Get the keyboard and mouse usage of this manipulator.*/
85        virtual void getUsage(osg::ApplicationUsage& usage) const;
86
87                virtual void setAttachedObject( 
88                        osgVisual::visual_object* object_ ) {attachedObject = object_;};
89
90                virtual osgVisual::visual_object* getAttachedObject() {return attachedObject.get();};
91
92
93    protected:
94                /**
95                 * \brief Destructor. Because it is protected, no explicit delete myPointer by external caller is possible.
96                 * This forces the class to be used with osg::ref pointers.
97                 */ 
98        virtual ~objectMountedManipulator();
99
100                osg::Matrixd manipMatrix;
101       
102
103                osg::ref_ptr<osgVisual::visual_object> attachedObject;
104};
105
106}       // END NAMESPACE
Note: See TracBrowser for help on using the repository browser.