diff options
Diffstat (limited to 'include/libsurvive/poser.h')
-rw-r--r-- | include/libsurvive/poser.h | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/include/libsurvive/poser.h b/include/libsurvive/poser.h new file mode 100644 index 0000000..98c926e --- /dev/null +++ b/include/libsurvive/poser.h @@ -0,0 +1,56 @@ +#ifndef _LSPOSER_H +#define _LSPOSER_H + +#include "survive_types.h" + +typedef enum PoserType_t +{ + POSERDATA_NONE = 0, + POSERDATA_IMU, + POSERDATA_LIGHT, //Single lighting event. + POSERDATA_FULL_SCENE, //Full, statified X, Y sweep data for both lighthouses. + POSERDATA_DISASSOCIATE, //If you get this, it doesn't contain data. It just tells you to please disassociate from the current SurviveObject and delete your poserdata. +} PoserType; + +typedef struct +{ + PoserType pt; + uint8_t data[0]; +} PoserData; + +typedef struct +{ + PoserType pt; + uint8_t datamask; //0 = accel present, 1 = gyro present, 2 = mag present. + FLT accel[3]; + FLT gyro[3]; + FLT mag[3]; + uint32_t timecode; //In object-local ticks. +} PoserDataIMU; + +typedef struct +{ + PoserType pt; + int sensor_id; + int acode; //OOTX Code associated with this sweep. base_station = acode >> 2; axis = acode & 1; + uint32_t timecode; //In object-local ticks. + FLT length; //In seconds + FLT angle; //In radians from center of lighthouse. +} PoserDataLight; + +typedef struct +{ + PoserType pt; + + //If "lengths[...]" < 0, means not a valid piece of sweep information. + FLT lengths[SENSORS_PER_OBJECT][NUM_LIGHTHOUSES][2]; + FLT angles [SENSORS_PER_OBJECT][NUM_LIGHTHOUSES][2]; //2 Axes (Angles in LH space) + + PoserDataIMU lastimu; +} PoserDataFullScene; + +//When you write your posers, use the following definition, and register with REGISTER_LINKTIME. +typedef int (*PoserCB)( SurviveObject * so, PoserData * pd ); + + +#endif |