H3D API  2.4.1
SpaceballSensor.h
Go to the documentation of this file.
1 // Copyright 2004-2019, SenseGraphics AB
3 //
4 // This file is part of H3D API.
5 //
6 // H3D API is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 2 of the License, or
9 // (at your option) any later version.
10 //
11 // H3D API is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License
17 // along with H3D API; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 //
20 // A commercial license is also available. Please contact us at
21 // www.sensegraphics.com for more information.
22 //
23 //
27 //
29 #ifndef __SPACEBALLSENSOR_H__
30 #define __SPACEBALLSENSOR_H__
31 
32 
33 #include <H3D/X3DSensorNode.h>
34 #include <list>
35 
36 #include <H3D/SFVec3f.h>
37 #include <H3D/MFBool.h>
38 
39 
40 
41 namespace H3D {
42 
53  class H3DAPI_API SpaceballSensor : public X3DSensorNode {
54  public:
55 
57  SpaceballSensor( Inst< SFBool > _enabled = 0,
58  Inst< SFNode > _metadata = 0,
59  Inst< SFBool > _isActive = 0,
60  Inst< SFVec3f > _motion = 0,
61  Inst< SFVec3f > _rotation = 0,
62  Inst< MFBool > _buttons = 0 );
63 
65  virtual ~SpaceballSensor();
66 
67  void addGLUTMotionAction( int x, int y, int z );
68 
69  void addGLUTRotateAction( int x, int y, int z );
70 
71  void addGLUTButtonAction( int button, int state );
72 
73 
76  static void glutMotionCallback( int x, int y, int z );
77 
80  static void glutRotateCallback( int x, int y, int z );
81 
84  static void glutButtonCallback( int button, int state );
85 
89  H3DUniquePtr< SFVec3f> motion;
90 
94  H3DUniquePtr< SFVec3f> rotation;
95 
99  H3DUniquePtr< MFBool > buttons;
100 
101 
104 
105  private:
106  static list< SpaceballSensor * > instances;
107  };
108 }
109 
110 #endif
Contains the MFBool field class.
Contains the SFVec3f field class.
Header file for X3DSensorNode, X3D scene-graph node.
A sensor node for reading GLUT Spaceball values.
Definition: SpaceballSensor.h:53
H3DUniquePtr< SFVec3f > rotation
The rotation component of the Spaceball.
Definition: SpaceballSensor.h:94
static H3DNodeDatabase database
The H3DNodeDatabase for this node.
Definition: SpaceballSensor.h:103
H3DUniquePtr< MFBool > buttons
The status of the middle button.
Definition: SpaceballSensor.h:99
H3DUniquePtr< SFVec3f > motion
The translation component of the Spaceball.
Definition: SpaceballSensor.h:89
This abstract node type is the base type for all sensors.
Definition: X3DSensorNode.h:40
H3DDouble x
H3D API namespace.
Definition: Anchor.h:38
The H3DNodeDatabase contains a mapping between a name of a Node and the constructor for the Node with...
Definition: H3DNodeDatabase.h:194