fixed: compile issue
[opensg.git] / Source / System / Window / Utilities / OSGNavballEngine.h
blob87d539dcb0449e6d6edd06edece222c000becc15
1 /*---------------------------------------------------------------------------*\
2 * OpenSG *
3 * *
4 * *
5 * Copyright (C) 2000-2002 by the OpenSG Forum *
6 * *
7 * www.opensg.org *
8 * *
9 * contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de *
10 * *
11 \*---------------------------------------------------------------------------*/
12 /*---------------------------------------------------------------------------*\
13 * License *
14 * *
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. *
18 * *
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. *
23 * *
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. *
27 * *
28 \*---------------------------------------------------------------------------*/
29 /*---------------------------------------------------------------------------*\
30 * Changes *
31 * *
32 * *
33 * *
34 * *
35 * *
36 * *
37 \*---------------------------------------------------------------------------*/
39 #ifndef _OSG_NAVBALLENGINE_H_
40 #define _OSG_NAVBALLENGINE_H_
42 #include "OSGNavigatorEngine.h"
44 OSG_BEGIN_NAMESPACE
46 class Navigator;
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 =================================*/
57 public:
59 /*---------------------------------------------------------------------*/
60 /*! \name Types */
61 /*! \{ */
63 OSG_GEN_INTERNAL_MEMOBJPTR(NavballEngine);
65 /*! \} */
66 /*---------------------------------------------------------------------*/
67 /*! \name Construction */
68 /*! \{ */
70 static ObjTransitPtr create(Real32 rSize = 0.8f);
72 /*! \} */
73 /*---------------------------------------------------------------------*/
74 /*! \name Class Get */
75 /*! \{ */
77 const char *getClassname(void) { return "NavballEngine"; }
79 /*! \} */
80 /*---------------------------------------------------------------------*/
81 /*! \name Get */
82 /*! \{ */
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);
90 /*! \} */
91 /*---------------------------------------------------------------------*/
92 /*! \name Set */
93 /*! \{ */
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,
99 Pnt3f new_at,
100 Vec3f new_up );
101 virtual void set (const Matrix &new_matrix );
102 virtual void setDistance( Real32 new_distance);
104 /*! \} */
105 /*---------------------------------------------------------------------*/
106 /*! \name navigator engine callbacks */
107 /*! \{ */
109 virtual void buttonPress (Int16 button,
110 Int16 x,
111 Int16 y,
112 Navigator *nav );
113 virtual void buttonRelease(Int16 button,
114 Int16 x,
115 Int16 y,
116 Navigator *nav );
117 virtual void keyPress (Int16 key,
118 Int16 x,
119 Int16 y,
120 Navigator *nav );
121 virtual void moveTo (Int16 x,
122 Int16 y,
123 Navigator *nav );
124 virtual void idle (Int16 buttons,
125 Int16 x,
126 Int16 y,
127 Navigator *nav );
129 /*! \} */
130 /*---------------------------------------------------------------------*/
131 /*! \name Navball Transformations */
132 /*! \{ */
134 void rotate (Real32 fromX,
135 Real32 fromY,
136 Real32 toX,
137 Real32 toY );
138 void translateXY(Real32 distanceX,
139 Real32 distanceY);
140 void translateZ (Real32 distance );
143 /*! \} */
144 /*========================== PROTECTED ==============================*/
146 protected:
148 /*---------------------------------------------------------------------*/
149 /*! \name Constructors/Destructor */
150 /*! \{ */
152 NavballEngine(Real32 rSize = 0.8f);
153 virtual ~NavballEngine(void );
155 /*! \} */
156 /*---------------------------------------------------------------------*/
157 /*! \name Members */
158 /*! \{ */
160 Real32 _rDistance;
161 Matrix _finalMatrix;
162 Pnt3f _pFrom;
163 Pnt3f _pAt;
164 Vec3f _vUp;
166 /* temporary values */
167 Pnt3f _ip;
168 Vec3f _dir;
170 /*! \} */
171 /*---------------------------------------------------------------------*/
173 void updateFinalMatrix (void );
174 void calcDeltas (Int16,
175 Int16,
176 Int16 toX,
177 Int16 toY,
178 Real32 &distanceX,
179 Real32 &distanceY,
180 Navigator *nav );
181 void getIntersectionPoint(Int16 x,
182 Int16 y,
183 Navigator *nav );
185 private:
187 /* Not implemented */
188 NavballEngine(const NavballEngine &other);
189 NavballEngine &operator =(const NavballEngine &other);
192 OSG_GEN_MEMOBJPTR(NavballEngine);
194 OSG_END_NAMESPACE
196 #endif