00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00027
00029 #ifndef __DHDHAPTICSDEVICE_H__
00030 #define __DHDHAPTICSDEVICE_H__
00031
00032 #include "H3DThreadedHapticsDevice.h"
00033 #include "MFString.h"
00034
00035 #ifdef HAVE_DHDAPI
00036 #include <dhdc.h>
00037
00038 #ifdef _MSC_VER
00039 #pragma comment( lib, "dhdms.lib" )
00040 #endif
00041
00042 #endif
00043
00044 namespace H3D {
00045
00054 class H3DAPI_API DHDHapticsDevice: public H3DThreadedHapticsDevice {
00055 public:
00056
00058 DHDHapticsDevice(
00059 Inst< ThreadSafeSField< SFVec3f > > _devicePosition = 0,
00060 Inst< ThreadSafeSField< SFRotation > > _deviceOrientation = 0,
00061 Inst< TrackerPosition > _trackerPosition = 0,
00062 Inst< TrackerOrientation > _trackerOrientation = 0,
00063 Inst< PosCalibration > _positionCalibration = 0,
00064 Inst< OrnCalibration > _orientationCalibration = 0,
00065 Inst< SFVec3f > _proxyPosition = 0,
00066 Inst< WeightedProxy > _weightedProxyPosition = 0,
00067 Inst< SFFloat > _proxyWeighting = 0,
00068 Inst< ThreadSafeSField< SFBool > > _main_button = 0,
00069 Inst< ThreadSafeSField< SFVec3f > > _force = 0,
00070 Inst< ThreadSafeSField< SFVec3f > > _torque = 0,
00071 Inst< SFInt32 > _inputDOF = 0,
00072 Inst< SFInt32 > _outputDOF = 0,
00073 Inst< SFInt32 > _hapticsRate = 0,
00074 Inst< SFNode > _stylus = 0,
00075 Inst< SFBool > _initialized = 0
00076 );
00077
00079 virtual ~DHDHapticsDevice() {
00080 disableDevice();
00081 if( thread ) {
00082 delete thread;
00083 thread = NULL;
00084 }
00085 }
00086
00089 virtual void initDevice();
00090
00094 virtual void disableDevice();
00095
00097 static H3DNodeDatabase database;
00098
00099 protected:
00102 virtual Vec3f getPosition();
00103
00106 virtual Vec3f getVelocity();
00107
00110 virtual Rotation getOrientation();
00111
00114 virtual bool getButtonStatus();
00115
00118 virtual void sendForce( const Vec3f &f );
00119
00122 virtual void sendTorque( const Vec3f &f );
00123
00124
00125 int device_id;
00126 };
00127 }
00128
00129 #endif