gesture_camera.h
Go to the documentation of this file.
1 /*
2  * Copyright 2014 Google Inc. All Rights Reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef TANGO_GL_GESTURE_CAMERA_H_
18 #define TANGO_GL_GESTURE_CAMERA_H_
19 
20 #include "tango-gl/camera.h"
21 #include "tango-gl/segment.h"
22 #include "tango-gl/transform.h"
23 #include "tango-gl/util.h"
24 
25 namespace tango_gl {
26 class GestureCamera : public Camera {
27  public:
28  enum CameraType {
31  kTopDown = 2,
32  kTopOrtho = 3,
34  };
35 
36  enum TouchEvent {
38  kTouch0Up = 1,
41  kTouch1Up = 6,
43  };
44 
45  GestureCamera();
47 
48  void OnTouchEvent(int touch_count, TouchEvent event, float x0, float y0,
49  float x1, float y1);
50 
51  // Get the ray in opengl world frame given the 2d touch position on screen,
52  // normalized touch_x and normalized touch_y should be the same value get from
53  // OnTouchEvent, x0 and y0, touch_range is the depth of the touch in
54  // camera frame.
55  Segment GetSegmentFromTouch(float normalized_x, float normalized_y,
56  float touch_range);
57 
58  void SetAnchorPosition(const glm::vec3& pos, const glm::quat & rotation);
59  void SetAnchorOffset(const glm::vec3& pos) {anchor_offset_ = pos;}
60  const glm::vec3& GetAnchorOffset() const {return anchor_offset_;}
61 
62  void SetCameraDistance(float cameraDistance) {cam_cur_dist_ = cameraDistance;}
63  float GetCameraDistance() const {return cam_cur_dist_;}
64 
65  // Set camera type, set render camera's parent position and rotation.
66  void SetCameraType(CameraType camera_index);
67 
69  float getFOV() const {return field_of_view_ * RADIAN_2_DEGREE;}
70 
71  private:
73 
74  // Render camera's parent transformation.
76 
78 
82 
87 
90 
92 };
93 } // namespace tango_gl
94 #endif // TANGO_GL_GESTURE_CAMERA_H_
void SetCameraType(CameraType camera_index)
float field_of_view_
Definition: camera.h:59
Transform * cam_parent_transform_
Segment GetSegmentFromTouch(float normalized_x, float normalized_y, float touch_range)
float GetCameraDistance() const
#define RADIAN_2_DEGREE
const glm::vec3 & GetAnchorOffset() const
void OnTouchEvent(int touch_count, TouchEvent event, float x0, float y0, float x1, float y1)
GLM_FUNC_DECL detail::tquat< T, P > rotation(detail::tvec3< T, P > const &orig, detail::tvec3< T, P > const &dest)
void SetAnchorPosition(const glm::vec3 &pos, const glm::quat &rotation)
glm::vec2 touch0_start_position_
void SetCameraDistance(float cameraDistance)
void SetAnchorOffset(const glm::vec3 &pos)
CameraType GetCameraType() const


rtabmap
Author(s): Mathieu Labbe
autogenerated on Wed Jun 5 2019 22:41:31