Torque3D Documentation / _generateds / razerHydraData.h

razerHydraData.h

Engine/source/platform/input/razerHydra/razerHydraData.h

More...

Classes:

Detailed Description

  1
  2//-----------------------------------------------------------------------------
  3// Copyright (c) 2012 GarageGames, LLC
  4//
  5// Permission is hereby granted, free of charge, to any person obtaining a copy
  6// of this software and associated documentation files (the "Software"), to
  7// deal in the Software without restriction, including without limitation the
  8// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  9// sell copies of the Software, and to permit persons to whom the Software is
 10// furnished to do so, subject to the following conditions:
 11//
 12// The above copyright notice and this permission notice shall be included in
 13// all copies or substantial portions of the Software.
 14//
 15// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 16// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 17// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 18// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 19// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 21// IN THE SOFTWARE.
 22//-----------------------------------------------------------------------------
 23
 24#ifndef _RAZERHYDRADATA_H_
 25#define _RAZERHYDRADATA_H_
 26
 27#include "console/consoleTypes.h"
 28#include "math/mMathFn.h"
 29#include "math/mMatrix.h"
 30#include "math/mQuat.h"
 31#include "sixense.h"
 32
 33struct RazerHyrdaControllerData
 34{
 35   enum DataDifferences {
 36      DIFF_NONE            = 0,
 37      DIFF_POSX            = (1<<0),
 38      DIFF_POSY            = (1<<1),
 39      DIFF_POSZ            = (1<<2),
 40      DIFF_ROT             = (1<<3),
 41      DIFF_ROTAXISX        = (1<<4),
 42      DIFF_ROTAXISY        = (1<<5),
 43      DIFF_AXISX           = (1<<6),
 44      DIFF_AXISY           = (1<<7),
 45      DIFF_TRIGGER         = (1<<8),
 46      DIFF_BUTTON1         = (1<<9),
 47      DIFF_BUTTON2         = (1<<10),
 48      DIFF_BUTTON3         = (1<<11),
 49      DIFF_BUTTON4         = (1<<12),
 50      DIFF_BUTTON_START    = (1<<13),
 51      DIFF_BUTTON_SHOULDER = (1<<14),
 52      DIFF_BUTTON_THUMB    = (1<<15),
 53
 54      DIFF_POS = (DIFF_POSX | DIFF_POSY | DIFF_POSZ),
 55      DIFF_AXIS = (DIFF_AXISX | DIFF_AXISY),
 56      DIFF_ROTAXIS = (DIFF_ROTAXISX | DIFF_ROTAXISY),
 57   };
 58
 59   enum MetaDataDifferences {
 60      METADIFF_NONE        = 0,
 61      METADIFF_DOCKED      = (1<<0),
 62   };
 63
 64   bool mDataSet;
 65
 66   // Position
 67   F32 mRawPos[3];
 68   S32 mPos[3];
 69   Point3F mPosPoint;
 70
 71   // Rotation
 72   MatrixF mRot;
 73   QuatF   mRotQuat;
 74
 75   // Controller rotation as axis x, y
 76   Point2F mRotAxis;
 77
 78   // Thumb stick x, y and trigger
 79   F32 mThumbStick[2];
 80   F32 mTrigger;
 81
 82   // Buttons
 83   bool mShoulder;
 84   bool mThumb;
 85   bool mStart;
 86   bool mButton1;
 87   bool mButton2;
 88   bool mButton3;
 89   bool mButton4;
 90
 91   // Other data
 92   bool mIsDocked;
 93
 94   // Sequence number from sixense
 95   U32 mSequenceNum;
 96
 97   RazerHyrdaControllerData();
 98
 99   /// Reset controller data
100   void reset();
101
102   /// Set position based on sixense controller data
103   void setData(const sixenseControllerData& data, const F32& maxAxisRadius);
104
105   /// Compare this data and given and return differences
106   U32 compare(RazerHyrdaControllerData* other);
107
108   /// Compare meta data between this and given and return differences
109   U32 compareMeta(RazerHyrdaControllerData* other);
110};
111
112#endif   // _RAZERHYDRADATA_H_
113