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