diff options
Diffstat (limited to 'intern/ghost/intern/GHOST_NDOFManager.h')
-rw-r--r-- | intern/ghost/intern/GHOST_NDOFManager.h | 95 |
1 files changed, 54 insertions, 41 deletions
diff --git a/intern/ghost/intern/GHOST_NDOFManager.h b/intern/ghost/intern/GHOST_NDOFManager.h index 7be129c327c..31b11a352db 100644 --- a/intern/ghost/intern/GHOST_NDOFManager.h +++ b/intern/ghost/intern/GHOST_NDOFManager.h @@ -28,7 +28,7 @@ typedef enum { NDOF_UnknownDevice, - // current devices + /* Current devices. */ NDOF_SpaceNavigator, NDOF_SpaceExplorer, NDOF_SpacePilotPro, @@ -37,51 +37,51 @@ typedef enum { NDOF_SpaceMouseProWireless, NDOF_SpaceMouseEnterprise, - // older devices + /* Older devices. */ NDOF_SpacePilot, NDOF_Spaceball5000, NDOF_SpaceTraveler } NDOF_DeviceT; -// NDOF device button event types +/* NDOF device button event types */ typedef enum { - // used internally, never sent + /* Used internally, never sent. */ NDOF_BUTTON_NONE, - // these two are available from any 3Dconnexion device + /* These two are available from any 3Dconnexion device. */ NDOF_BUTTON_MENU, NDOF_BUTTON_FIT, - // standard views + /* Standard views. */ NDOF_BUTTON_TOP, NDOF_BUTTON_BOTTOM, NDOF_BUTTON_LEFT, NDOF_BUTTON_RIGHT, NDOF_BUTTON_FRONT, NDOF_BUTTON_BACK, - // more views + /* More views. */ NDOF_BUTTON_ISO1, NDOF_BUTTON_ISO2, - // 90 degree rotations - // these don't all correspond to physical buttons + /* 90 degree rotations. + * These don't all correspond to physical buttons. */ NDOF_BUTTON_ROLL_CW, NDOF_BUTTON_ROLL_CCW, NDOF_BUTTON_SPIN_CW, NDOF_BUTTON_SPIN_CCW, NDOF_BUTTON_TILT_CW, NDOF_BUTTON_TILT_CCW, - // device control + /* Device control. */ NDOF_BUTTON_ROTATE, NDOF_BUTTON_PANZOOM, NDOF_BUTTON_DOMINANT, NDOF_BUTTON_PLUS, NDOF_BUTTON_MINUS, - // keyboard emulation + /* Keyboard emulation. */ NDOF_BUTTON_ESC, NDOF_BUTTON_ALT, NDOF_BUTTON_SHIFT, NDOF_BUTTON_CTRL, - // general-purpose buttons - // users can assign functions via keymap editor + /* General-purpose buttons. + * Users can assign functions via keymap editor. */ NDOF_BUTTON_1, NDOF_BUTTON_2, NDOF_BUTTON_3, @@ -92,11 +92,11 @@ typedef enum { NDOF_BUTTON_8, NDOF_BUTTON_9, NDOF_BUTTON_10, - // more general-purpose buttons + /* More general-purpose buttons. */ NDOF_BUTTON_A, NDOF_BUTTON_B, NDOF_BUTTON_C, - // the end + /* The end. */ NDOF_BUTTON_LAST } NDOF_ButtonT; @@ -107,40 +107,53 @@ class GHOST_NDOFManager { { } - // whether multi-axis functionality is available (via the OS or driver) - // does not imply that a device is plugged in or being used + /** + * Whether multi-axis functionality is available (via the OS or driver) + * does not imply that a device is plugged in or being used. + */ virtual bool available() = 0; - // each platform's device detection should call this - // use standard USB/HID identifiers + /** + * Each platform's device detection should call this + * use standard USB/HID identifiers. + */ bool setDevice(unsigned short vendor_id, unsigned short product_id); - // filter out small/accidental/uncalibrated motions by - // setting up a "dead zone" around home position - // set to 0 to disable - // 0.1 is a safe and reasonable value + /** + * Filter out small/accidental/un-calibrated motions by + * setting up a "dead zone" around home position + * set to 0 to disable + * 0.1 is a safe and reasonable value. + */ void setDeadZone(float); - // the latest raw axis data from the device - // NOTE: axis data should be in blender view coordinates - // +X is to the right - // +Y is up - // +Z is out of the screen - // for rotations, look from origin to each +axis - // rotations are + when CCW, - when CW - // each platform is responsible for getting axis data into this form - // these values should not be scaled (just shuffled or flipped) + /** + * The latest raw axis data from the device. + * + * \note axis data should be in blender view coordinates + * - +X is to the right. + * - +Y is up. + * - +Z is out of the screen. + * - for rotations, look from origin to each +axis. + * - rotations are + when CCW, - when CW. + * Each platform is responsible for getting axis data into this form + * these values should not be scaled (just shuffled or flipped). + */ void updateTranslation(const int t[3], uint64_t time); void updateRotation(const int r[3], uint64_t time); - // the latest raw button data from the device - // use HID button encoding (not NDOF_ButtonT) + /** + * The latest raw button data from the device + * use HID button encoding (not #NDOF_ButtonT). + */ void updateButton(int button_number, bool press, uint64_t time); void updateButtons(int button_bits, uint64_t time); - // NDOFButton events are sent immediately + /* #NDOFButton events are sent immediately */ - // processes and sends most recent raw data as an NDOFMotion event - // returns whether an event was sent + /** + * Processes and sends most recent raw data as an #NDOFMotion event + * returns whether an event was sent. + */ bool sendMotionEvent(); protected: @@ -157,12 +170,12 @@ class GHOST_NDOFManager { int m_translation[3]; int m_rotation[3]; - int m_buttons; // bit field + int m_buttons; /* Bit field. */ - uint64_t m_motionTime; // in milliseconds - uint64_t m_prevMotionTime; // time of most recent Motion event sent + uint64_t m_motionTime; /* In milliseconds. */ + uint64_t m_prevMotionTime; /* Time of most recent motion event sent. */ GHOST_TProgress m_motionState; bool m_motionEventPending; - float m_deadZone; // discard motion with each component < this + float m_deadZone; /* Discard motion with each component < this. */ }; |