Panda3D
|
00001 // Filename: vrpnTrackerDevice.h 00002 // Created by: drose (25Jan01) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 #ifndef VRPNTRACKERDEVICE_H 00016 #define VRPNTRACKERDEVICE_H 00017 00018 #include "pandabase.h" 00019 00020 #include "clientTrackerDevice.h" 00021 00022 class VrpnClient; 00023 class VrpnTracker; 00024 00025 //////////////////////////////////////////////////////////////////// 00026 // Class : VrpnTrackerDevice 00027 // Description : The Panda interface to a VRPN tracker. This object 00028 // will be returned by VrpnClient::make_device(), for 00029 // attaching to a TrackerNode. 00030 // 00031 // It represents the data from just one particular 00032 // sensor of a named VRPN tracker, and may reflect 00033 // either the sensor's position, its velocity, or its 00034 // acceleration. 00035 // 00036 // This class does not need to be exported from the DLL. 00037 //////////////////////////////////////////////////////////////////// 00038 class VrpnTrackerDevice : public ClientTrackerDevice { 00039 public: 00040 enum DataType { 00041 DT_position, 00042 DT_velocity, 00043 DT_acceleration 00044 }; 00045 00046 VrpnTrackerDevice(VrpnClient *client, const string &device_name, 00047 int sensor, DataType data_type, 00048 VrpnTracker *vrpn_tracker); 00049 virtual ~VrpnTrackerDevice(); 00050 00051 INLINE int get_sensor() const; 00052 INLINE DataType get_data_type() const; 00053 INLINE VrpnTracker *get_vrpn_tracker() const; 00054 00055 private: 00056 int _sensor; 00057 DataType _data_type; 00058 VrpnTracker *_vrpn_tracker; 00059 00060 public: 00061 static TypeHandle get_class_type() { 00062 return _type_handle; 00063 } 00064 static void init_type() { 00065 ClientTrackerDevice::init_type(); 00066 register_type(_type_handle, "VrpnTrackerDevice", 00067 ClientTrackerDevice::get_class_type()); 00068 } 00069 virtual TypeHandle get_type() const { 00070 return get_class_type(); 00071 } 00072 virtual TypeHandle force_init_type() {init_type(); return get_class_type();} 00073 00074 private: 00075 static TypeHandle _type_handle; 00076 00077 friend class VrpnTracker; 00078 }; 00079 00080 #include "vrpnTrackerDevice.I" 00081 00082 #endif