Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef TANGO_GL_GESTURE_CAMERA_H_
00018 #define TANGO_GL_GESTURE_CAMERA_H_
00019
00020 #include "tango-gl/camera.h"
00021 #include "tango-gl/segment.h"
00022 #include "tango-gl/transform.h"
00023 #include "tango-gl/util.h"
00024
00025 namespace tango_gl {
00026 class GestureCamera : public Camera {
00027 public:
00028 enum CameraType {
00029 kFirstPerson = 0,
00030 kThirdPersonFollow = 1,
00031 kTopDown = 2,
00032 kThirdPerson = 3
00033 };
00034
00035 enum TouchEvent {
00036 kTouch0Down = 0,
00037 kTouch0Up = 1,
00038 kTouchMove = 2,
00039 kTouch1Down = 5,
00040 kTouch1Up = 6,
00041 kTouchNone = -1
00042 };
00043
00044 GestureCamera();
00045 ~GestureCamera();
00046
00047 void OnTouchEvent(int touch_count, TouchEvent event, float x0, float y0,
00048 float x1, float y1);
00049
00050
00051
00052
00053
00054 Segment GetSegmentFromTouch(float normalized_x, float normalized_y,
00055 float touch_range);
00056
00057 void SetAnchorPosition(const glm::vec3& pos, const glm::quat & rotation);
00058
00059
00060 void SetCameraType(CameraType camera_index);
00061
00062 CameraType GetCameraType() const { return camera_type_; }
00063 float getFOV() const {return field_of_view_ * RADIAN_2_DEGREE;}
00064
00065 private:
00066 void StartCameraToCurrentTransform();
00067
00068
00069 Transform* cam_parent_transform_;
00070
00071 CameraType camera_type_;
00072
00073 glm::vec2 cam_start_angle_;
00074 glm::vec2 cam_cur_angle_;
00075 glm::quat cam_cur_target_rot_;
00076
00077 float cam_start_dist_;
00078 float cam_cur_dist_;
00079
00080 float start_touch_dist_;
00081 float cur_touch_dist_;
00082
00083 glm::vec2 touch0_start_position_;
00084 };
00085 }
00086 #endif // TANGO_GL_GESTURE_CAMERA_H_