NVidia Gameworks
  • Main Page
  • Classes
  • Files
  • File List
  • File Members

NvInputTransformer.h

Go to the documentation of this file.
00001 // TAGRELEASE: PUBLIC
00002 
00003 #ifndef NV_INPUT_TRANSFORMER_H
00004 #define NV_INPUT_TRANSFORMER_H
00005 
00006 #include <NvFoundation.h>
00007 #include "NvPlatformContext.h"
00008 #include "NvGamepad/NvGamepad.h"
00009 #include "NV/NvMath.h"
00010 
00013 
00015 struct NvCameraMotionType {
00016     enum Enum {
00017         ORBITAL = 0, 
00018         FIRST_PERSON = 1, 
00019         PAN_ZOOM = 2 
00020     };
00021 };
00022 
00027 class NvInputTransformer
00028 {
00029 public:
00030     NvInputTransformer();
00031     ~NvInputTransformer();
00032 
00039     void setScreenSize(int32_t width, int32_t height) { m_width = width; m_height = height; }
00040 
00044     void setMotionMode(NvCameraMotionType::Enum mode) { m_motionMode = mode; }
00045 
00049     NvCameraMotionType::Enum getMotionMode() { return m_motionMode; }
00050 
00055     nv::matrix4f getModelViewMat();
00056 
00061     const nv::matrix4f& getRotationMat() { return m_rotateMat; }
00062     const nv::matrix4f& getTranslationMat() { return m_translateMat; }
00063     const nv::matrix4f& getScaleMat() { return m_scaleMat; }
00065 
00068     const nv::vec3f& getRotationVec() { return m_rotate; }
00069 
00073     void setRotationVec(const nv::vec3f& vec) { m_rotate = vec; }
00074 
00077     const nv::vec3f& getTranslationVec() { return m_translate; }
00078 
00082     void setTranslationVec(const nv::vec3f& vec) { m_translate = vec; }
00083 
00086     const float getScale() { return m_scale*m_dscale; }
00087 
00091     void setScale(const float scale) { m_scale = scale; }
00092 
00095     const nv::vec3f& getRotationVel() { return m_rotateVel; }
00096 
00102     void setRotationVel(const nv::vec3f& vec) { m_rotateVel = vec; }
00103 
00106     const nv::vec3f& getTranslationVel() { return m_translateVel; }
00107 
00113     void setTranslationVel(const nv::vec3f& vec) { m_translateVel = vec; }
00114 
00118     float getMaxRotationVel() { return m_maxRotationVel; }
00119 
00123     void setMaxRotationVel(float maxVel) { m_maxRotationVel = maxVel; }
00124 
00128     float getMaxTranslationVel() { return m_maxTranslationVel; }
00129 
00133     void setMaxTranslationVel(float maxVel) { m_maxTranslationVel = maxVel; }
00134 
00138     void update(float deltaTime);
00139 
00151     bool processPointer(NvInputDeviceType::Enum device, NvPointerActionType::Enum action, 
00152         uint32_t modifiers, int32_t count, NvPointerEvent* points);
00153 
00162     bool processGamepad(uint32_t changedPadFlags, NvGamepad& pad);
00163 
00172     bool processKey(uint32_t code, NvKeyActionType::Enum action);
00173 
00174 private:
00176     void updateMats();
00177 
00178     NvCameraMotionType::Enum m_motionMode;
00179     bool m_touchDown;
00180     uint8_t m_maxPointsCount;
00181     enum ControlMode { TRANSLATE=0, ROTATE, ZOOM } m_mode;
00182     nv::vec2f m_firstInput;
00183     nv::vec2f m_lastInput;
00184     
00185     nv::vec3f m_translateVel;
00186     nv::vec3f m_rotateVel;
00187     float m_maxRotationVel;
00188     float m_maxTranslationVel;
00189 
00190     int8_t m_xVel_kb;
00191     int8_t m_zVel_kb;
00192     int8_t m_zVel_mouse;
00193     float m_xVel_gp;
00194     float m_zVel_gp;
00195 
00196     nv::vec3f m_translate;
00197     nv::vec3f m_rotate;
00198     float m_scale, m_dscale;
00199 
00200     nv::matrix4f m_translateMat;
00201     nv::matrix4f m_rotateMat;
00202     nv::matrix4f m_scaleMat;
00203 
00204     int32_t m_width;
00205     int32_t m_height;
00206 };
00207 
00208 #endif
Generated on Sat Mar 8 14:58:35 2014 for NVIDIA GameWorks OpenGL App Framework and Libraries by Doxygen
©2014 NVIDIA Corporation.