Open Inventor Release 2024.1.3
 
Loading...
Searching...
No Matches
SoControllerButtonEvent.h
1/*=======================================================================
2 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), ***
3 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. ***
4 *** ***
5 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS ***
6 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR ***
7 *** WRITTEN AUTHORIZATION OF FEI S.A.S. ***
8 *** ***
9 *** RESTRICTED RIGHTS LEGEND ***
10 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS ***
11 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN ***
12 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT ***
13 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN ***
14 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. ***
15 *** ***
16 *** COPYRIGHT (C) 1996-2014 BY FEI S.A.S, ***
17 *** BORDEAUX, FRANCE ***
18 *** ALL RIGHTS RESERVED ***
19**=======================================================================*/
20/*=======================================================================
21** Author : Modified (MMM yyyy)
22**=======================================================================*/
23
24#ifndef _SO_CONTROLLER_BUTTON_EVENT_
25#define _SO_CONTROLLER_BUTTON_EVENT_
26
27#include <Inventor/events/SoButtonEvent.h>
28#include <Inventor/events/SbTrackerInfo.h>
29
30// some convenience macros for determining if an event matches
31
32#define SO_CONTROLLER_PRESS_EVENT(EVENT,BUTTON) \
33 (SoControllerButtonEvent::isButtonPressEvent(EVENT,SoControllerButtonEvent::BUTTON))
34
35#define SO_CONTROLLER_RELEASE_EVENT(EVENT,BUTTON) \
36 (SoControllerButtonEvent::isButtonReleaseEvent(EVENT,SoControllerButtonEvent::BUTTON))
37
38
83
84 SO_EVENT_HEADER();
85
86 public:
87
89 enum Button {
90 ANY = 0,
102 BUTTON3 = 3
103 };
104
109#ifndef HIDDEN_FROM_DOC
110 virtual ~SoControllerButtonEvent();
111#endif // HIDDEN_FROM_DOC
112
121
125 void setPosition3(const SbVec3f &p)
126 { m_trackerInfo.setPosition3( p ); }
127
131 const SbVec3f & getPosition3() const
132 { return m_trackerInfo.getPosition3(); }
133
138 void setOrientation( float x, float y, float z)
139 { m_trackerInfo.setOrientation( x, y, z ); }
140
144 void setOrientation( SbRotation orientation )
145 { m_trackerInfo.setOrientation( orientation ); }
146
150 void setOrientation(const SbVec3f &axis, float angle)
151 { m_trackerInfo.setOrientation( axis, angle ); }
152
158 { return m_trackerInfo.getOrientation(); }
159
163 const SbLine getRay() const
164 { return m_trackerInfo.getRay(); }
165
166
167 // Imports declaration from SoEvent.
169
176 virtual const SbTrackerInfo *getTrackerInfo() const
177 { return &m_trackerInfo; }
178
182 virtual const SbTrackerInfo & trackerInfo() const
183 { return m_trackerInfo; }
184
190 const SoEvent *e,
192
198 const SoEvent *e,
200
201 private:
202 static void initClass();
203 static void exitClass();
204
205 private:
206 Button button; // which button
207 SbTrackerInfo m_trackerInfo;
208
209};
210
211#endif /* _SO_CONTROLLER_BUTTON_EVENT_ */
212
213
Directed line in 3D.
Definition SbLine.h:57
Class for representing a rotation.
Definition SbRotation.h:126
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Class for repres...
void setOrientation(float q0, float q1, float q2, float q3)
Set orientation value from 4 floats defining the rotation quaternion.
const SbVec3f & getPosition3() const
Get position of tracker in world coordinates.
void setPosition3(const SbVec3f &p)
Set position of tracker in world coordinates.
const SbLine getRay() const
Convenience function to get ray for picking/intersecting.
const SbRotation & getOrientation() const
Get orientation of tracker as a standard Open Inventor rotation (quaternion).
3D vector class.
Definition SbVec.h:932
Base class for all button events.
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Controller butto...
void setButton(SoControllerButtonEvent::Button b)
Set which button generated the event.
void setOrientation(float x, float y, float z)
Set orientation value of associated tracker from Euler angles in radians (using the trackd convention...
static SbBool isButtonPressEvent(const SoEvent *e, SoControllerButtonEvent::Button whichButton)
Convenience function to see if an SoEvent is a press of the passed mouse button.
const SbVec3f & getPosition3() const
Get position of associated tracker in world coordinates.
virtual const SbTrackerInfo & trackerInfo() const
Get the SbTrackerInfo object.
virtual const SbTrackerInfo * getTrackerInfo() const
Returns the SbTrackerInfo object.
@ BUTTON1
Controller button 1.
@ BUTTON2
Controller button 2.
void setOrientation(const SbVec3f &axis, float angle)
Set orientation value of associated tracker from axis and angle in radians.
static SbBool isButtonReleaseEvent(const SoEvent *e, SoControllerButtonEvent::Button whichButton)
Convenience function to see if an SoEvent is a release of the passed mouse button.
void setPosition3(const SbVec3f &p)
Set position of associated tracker in world coordinates.
SoControllerButtonEvent()
Constructor.
const SbLine getRay() const
Get a ray for picking/intersecting.
const SbRotation & getOrientation() const
Get orientation of associated tracker as a standard Open Inventor rotation (quaternion).
SoControllerButtonEvent::Button getButton() const
Get which button generated the event.
void setOrientation(SbRotation orientation)
Set orientation value of associated tracker from an SbRotation.
Base class for all events.
Definition SoEvent.h:116
virtual const SbTrackerInfo * getTrackerInfo() const
Gets whether an event object has associated tracker information.
Definition SoEvent.h:255
int SbBool
Boolean type.
Definition SbBase.h:87