00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00034
00035
00036
00038
00039 #ifndef _GADGET_GLOVE_PROXY_H_
00040 #define _GADGET_GLOVE_PROXY_H_
00041
00042 #include <gadget/gadgetConfig.h>
00043 #include <math.h>
00044
00045 #include <gadget/Type/Glove.h>
00046 #include <gadget/Type/Proxy.h>
00047
00048 namespace gadget
00049 {
00050
00055 class GADGET_CLASS_API GloveProxy : public TypedProxy<Glove>
00056 {
00057 public:
00062 GloveProxy()
00063 {
00064 mUnitNum = -1;
00065 mVisible = true;
00066 }
00067
00068 virtual ~GloveProxy()
00069 {}
00070
00071 gmtl::Vec3f getTipVector(GloveData::GloveComponent component)
00072 {
00073 if(isStupefied())
00074 return gmtl::Vec3f(0,0,0);
00075 else
00076 return mTypedDevice->getTipVector(component,mUnitNum);
00077 }
00078
00079 gmtl::Matrix44f getTipTransform( GloveData::GloveComponent component)
00080 {
00081 if(isStupefied())
00082 return gmtl::Matrix44f();
00083 else
00084 return mTypedDevice->getTipTransform(component,mUnitNum);
00085 }
00086
00087 gmtl::Matrix44f getJointTransform(GloveData::GloveComponent component,
00088 GloveData::GloveJoint joint)
00089 {
00090 if(isStupefied())
00091 return gmtl::Matrix44f();
00092 else
00093 return mTypedDevice->getJointTransform(component, joint, mUnitNum);
00094 }
00095
00096 GloveData getData()
00097 {
00098 if(isStupefied())
00099 return GloveData();
00100 else
00101 return mTypedDevice->getGloveData(mUnitNum);
00102 }
00103
00105 vpr::Interval getTimeStamp() const
00106 {
00107
00108
00109 return vpr::Interval();
00110 }
00111
00113 Glove* getGlovePtr()
00114 {
00115 if(isStupefied())
00116 return NULL;
00117 else
00118 return mTypedDevice;
00119 }
00120
00122 int getUnit()
00123 {
00124 return mUnitNum;
00125 }
00126
00127 bool isVisible()
00128 {
00129 return mVisible;
00130 }
00131
00132 static std::string getElementType();
00133
00134 bool config(jccl::ConfigElementPtr element);
00135
00136 virtual Input* getProxiedInputDevice()
00137 {
00138 if((NULL == mTypedDevice) || (isStupefied()))
00139 return NULL;
00140
00141 Input* ret_val = dynamic_cast<Input*>(mTypedDevice);
00142 vprASSERT((ret_val != NULL) && "Cross-cast in GloveProxy failed");
00143 return ret_val;
00144 }
00145
00146 private:
00148 bool mVisible;
00149
00151 int mUnitNum;
00152 };
00153
00154 }
00155
00156 #endif