1 /*---------------------------------------------------------------------------*\
5 * Copyright (C) 2000-2002 by the OpenSG Forum *
9 * contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de *
11 \*---------------------------------------------------------------------------*/
12 /*---------------------------------------------------------------------------*\
15 * This library is free software; you can redistribute it and/or modify it *
16 * under the terms of the GNU Library General Public License as published *
17 * by the Free Software Foundation, version 2. *
19 * This library is distributed in the hope that it will be useful, but *
20 * WITHOUT ANY WARRANTY; without even the implied warranty of *
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
22 * Library General Public License for more details. *
24 * You should have received a copy of the GNU Library General Public *
25 * License along with this library; if not, write to the Free Software *
26 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
28 \*---------------------------------------------------------------------------*/
29 /*---------------------------------------------------------------------------*\
37 \*---------------------------------------------------------------------------*/
39 #ifndef _OSG_NAVBALLENGINE_H_
40 #define _OSG_NAVBALLENGINE_H_
42 #include "OSGNavigatorEngine.h"
48 /*! \brief NavballEngine provides the trackball navigator functionality.
50 class OSG_UTIL_DLLMAPPING NavballEngine
: public NavigatorEngine
52 typedef NavigatorEngine Inherited
;
53 typedef NavballEngine Self
;
55 /*========================== PUBLIC =================================*/
59 /*---------------------------------------------------------------------*/
63 OSG_GEN_INTERNAL_MEMOBJPTR(NavballEngine
);
66 /*---------------------------------------------------------------------*/
67 /*! \name Construction */
70 static ObjTransitPtr
create(Real32 rSize
= 0.8f
);
73 /*---------------------------------------------------------------------*/
74 /*! \name Class Get */
77 const char *getClassname(void) { return "NavballEngine"; }
80 /*---------------------------------------------------------------------*/
84 virtual const Pnt3f
&getFrom (void);
85 virtual const Pnt3f
&getAt (void);
86 virtual const Vec3f
&getUp (void);
87 virtual const Matrix
&getMatrix (void);
88 virtual Real32
getDistance(void);
91 /*---------------------------------------------------------------------*/
95 virtual void setFrom ( Pnt3f new_from
);
96 virtual void setAt ( Pnt3f new_at
);
97 virtual void setUp ( Vec3f new_up
);
98 virtual void set ( Pnt3f new_from
,
101 virtual void set (const Matrix
&new_matrix
);
102 virtual void setDistance( Real32 new_distance
);
105 /*---------------------------------------------------------------------*/
106 /*! \name navigator engine callbacks */
109 virtual void buttonPress (Int16 button
,
113 virtual void buttonRelease(Int16 button
,
117 virtual void keyPress (Int16 key
,
121 virtual void moveTo (Int16 x
,
124 virtual void idle (Int16 buttons
,
130 /*---------------------------------------------------------------------*/
131 /*! \name Navball Transformations */
134 void rotate (Real32 fromX
,
138 void translateXY(Real32 distanceX
,
140 void translateZ (Real32 distance
);
144 /*========================== PROTECTED ==============================*/
148 /*---------------------------------------------------------------------*/
149 /*! \name Constructors/Destructor */
152 NavballEngine(Real32 rSize
= 0.8f
);
153 virtual ~NavballEngine(void );
156 /*---------------------------------------------------------------------*/
166 /* temporary values */
171 /*---------------------------------------------------------------------*/
173 void updateFinalMatrix (void );
174 void calcDeltas (Int16
,
181 void getIntersectionPoint(Int16 x
,
187 /* Not implemented */
188 NavballEngine(const NavballEngine
&other
);
189 NavballEngine
&operator =(const NavballEngine
&other
);
192 OSG_GEN_MEMOBJPTR(NavballEngine
);