00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef _BODIES_H__
00012 #define _BODIES_H__
00013
00014
00015 #include "../../core/src/module.h"
00016
00017
00019
00022 struct Finger
00023 {
00025
00028 float Position[3];
00030
00033 float Matrix[9];
00035
00038 float Length[3];
00040
00043 float Angle[2];
00045 float Radius;
00046 };
00047
00048
00050 class Body
00051 {
00052 public:
00054 enum BodyType
00055 {
00056 NRECG = 0,
00057 B3D = 1,
00058 B6D = 2,
00059 BGL = 3,
00060 B6DF2 = 4,
00061 B6DF = 5,
00062 B6DMT = 6
00063 };
00065
00071 Body(int id, float qu, BodyType type, float * shift = NULL, float * rotation = NULL);
00073 ~Body();
00075 void Identity();
00077 void SetShift(float * shift);
00079 void SetRotation(float * rotation);
00081 void SetMatrix(MATRIX & matr);
00083 int GetID();
00085 BodyType GetType();
00087
00090 vector3 GetShift();
00092
00095 MATRIX GetRotation();
00097 MATRIX Matrix();
00098
00100
00105 float GetQuality();
00107
00112 virtual int Button(int num);
00114 virtual int ButonsNumber();
00116 virtual int ControlsNuber();
00118
00121 virtual float Control(int num);
00123
00127 virtual int LeftHand();
00129
00132 virtual int FingersNum();
00134
00137 virtual Finger * GetFinger(int num);
00139 virtual int ButtonsMask32();
00141 void Scale(float num);
00142 protected:
00144 BodyType deviceType;
00146 int deviceID;
00148 float quality;
00150 MATRIX tMatrix;
00151 };
00153 class BodyGlove : public Body
00154 {
00155 protected:
00157 bool leftHand;
00159 int fingerCount;
00161 Finger * fingers;
00162 public:
00164
00171 BodyGlove(int id, float qu, int numFingers, bool leftHand = true, float * shift = NULL, float * rotation = NULL);
00173 ~BodyGlove();
00175
00179 void addFinger(int pos , Finger finger);
00181
00186 virtual int LeftHand();
00188 virtual int FingersNum();
00190
00194 virtual Finger * GetFinger(int num);
00195 };
00197 class ButtonDevice : public Body
00198 {
00199 protected:
00201 int buttons;
00203
00210 ButtonDevice(BodyType type, int id, float qu, int buttons, float * shift = NULL, float * rotation = NULL);
00211 public:
00213 ~ButtonDevice();
00215
00220 virtual int Button(int num);
00222 virtual int ButonsNumber();
00224 virtual int ButtonsMask32();
00225 };
00226
00227 class FlyStick1 : public ButtonDevice
00228 {
00229 public:
00231
00237 FlyStick1(int id, float qu, int buttons, float * shift = NULL, float * rotation = NULL);
00239 ~FlyStick1();
00240 };
00241 class Measurer : public ButtonDevice
00242 {
00243 public:
00245
00251 Measurer(int id, float qu, int buttons, float * shift = NULL, float * rotation = NULL);
00253 ~Measurer();
00254 };
00256 class FlyStick2 :public Body
00257 {
00258 protected:
00260 int buttonsCount;
00262 int controlCount;
00264 int * buttArray;
00266 float * ctrlArray;
00267 public:
00269
00276 FlyStick2(int id, float qu, int buttons, int controls, float * shift = NULL, float * rotation = NULL);
00278 ~FlyStick2();
00280
00285 void addButtons(int pos, int config);
00287
00290 void addControls(int pos, float value);
00292
00297 virtual int Button(int num);
00299 virtual int ButonsNumber();
00301 virtual int ButtonsMask32();
00302
00304 virtual int ControlsNuber();
00306
00309 virtual float Control(int num);
00310 };
00311 #endif