app
android
jni
tango-gl
include
tango-gl
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
{
29
kFirstPerson
= 0,
30
kThirdPersonFollow
= 1,
31
kTopDown
= 2,
32
kTopOrtho
= 3,
33
kThirdPerson
= 4
34
};
35
36
enum
TouchEvent
{
37
kTouch0Down
= 0,
38
kTouch0Up
= 1,
39
kTouchMove
= 2,
40
kTouch1Down
= 5,
41
kTouch1Up
= 6,
42
kTouchNone
= -1
43
};
44
45
GestureCamera
();
46
~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
68
CameraType
GetCameraType
()
const
{
return
camera_type_
; }
69
float
getFOV
()
const
{
return
field_of_view_
*
RADIAN_2_DEGREE
;}
70
71
private
:
72
void
StartCameraToCurrentTransform
();
73
74
// Render camera's parent transformation.
75
Transform
*
cam_parent_transform_
;
76
77
CameraType
camera_type_
;
78
79
glm::vec2
cam_start_angle_
;
80
glm::vec2
cam_cur_angle_
;
81
glm::quat
cam_cur_target_rot_
;
82
83
float
cam_start_dist_
;
84
float
cam_start_fov_
;
85
float
cam_cur_dist_
;
86
glm::vec3
anchor_offset_
;
87
88
float
start_touch_dist_
;
89
float
cur_touch_dist_
;
90
91
glm::vec2
touch0_start_position_
;
92
};
93
}
// namespace tango_gl
94
#endif // TANGO_GL_GESTURE_CAMERA_H_
tango_gl::GestureCamera::getFOV
float getFOV() const
Definition:
gesture_camera.h:69
tango_gl::GestureCamera::kTopOrtho
@ kTopOrtho
Definition:
gesture_camera.h:32
tango_gl::GestureCamera::kTouchMove
@ kTouchMove
Definition:
gesture_camera.h:39
tango_gl::GestureCamera::SetCameraType
void SetCameraType(CameraType camera_index)
Definition:
gesture_camera.cpp:180
tango_gl::GestureCamera::kThirdPerson
@ kThirdPerson
Definition:
gesture_camera.h:33
tango_gl::GestureCamera::kFirstPerson
@ kFirstPerson
Definition:
gesture_camera.h:29
tango_gl::GestureCamera::start_touch_dist_
float start_touch_dist_
Definition:
gesture_camera.h:88
util.h
tango_gl::GestureCamera::cam_cur_target_rot_
glm::quat cam_cur_target_rot_
Definition:
gesture_camera.h:81
tango_gl::GestureCamera::GetCameraType
CameraType GetCameraType() const
Definition:
gesture_camera.h:68
tango_gl::GestureCamera::GetSegmentFromTouch
Segment GetSegmentFromTouch(float normalized_x, float normalized_y, float touch_range)
Definition:
gesture_camera.cpp:146
glm::detail::tquat
Definition:
fwd.hpp:41
tango_gl::GestureCamera
Definition:
gesture_camera.h:26
glm::detail::tvec3
Definition:
type_mat.hpp:37
tango_gl::GestureCamera::CameraType
CameraType
Definition:
gesture_camera.h:28
tango_gl::Camera::field_of_view_
float field_of_view_
Definition:
camera.h:59
tango_gl::GestureCamera::kThirdPersonFollow
@ kThirdPersonFollow
Definition:
gesture_camera.h:30
tango_gl::Segment
Definition:
segment.h:23
tango_gl::GestureCamera::cam_cur_dist_
float cam_cur_dist_
Definition:
gesture_camera.h:85
tango_gl::GestureCamera::cam_start_dist_
float cam_start_dist_
Definition:
gesture_camera.h:83
tango_gl::GestureCamera::cam_cur_angle_
glm::vec2 cam_cur_angle_
Definition:
gesture_camera.h:80
RADIAN_2_DEGREE
#define RADIAN_2_DEGREE
Definition:
tango-gl/include/tango-gl/util.h:69
tango_gl::GestureCamera::GestureCamera
GestureCamera()
Definition:
gesture_camera.cpp:55
tango_gl::GestureCamera::TouchEvent
TouchEvent
Definition:
gesture_camera.h:36
tango_gl::Transform
Definition:
transform.h:24
tango_gl::GestureCamera::cam_start_fov_
float cam_start_fov_
Definition:
gesture_camera.h:84
tango_gl::GestureCamera::GetAnchorOffset
const glm::vec3 & GetAnchorOffset() const
Definition:
gesture_camera.h:60
tango_gl::GestureCamera::cam_start_angle_
glm::vec2 cam_start_angle_
Definition:
gesture_camera.h:79
tango_gl::GestureCamera::camera_type_
CameraType camera_type_
Definition:
gesture_camera.h:77
tango_gl::Camera
Definition:
camera.h:23
tango_gl::GestureCamera::kTopDown
@ kTopDown
Definition:
gesture_camera.h:31
tango_gl::GestureCamera::touch0_start_position_
glm::vec2 touch0_start_position_
Definition:
gesture_camera.h:91
camera.h
tango_gl::GestureCamera::kTouch1Down
@ kTouch1Down
Definition:
gesture_camera.h:40
tango_gl::GestureCamera::StartCameraToCurrentTransform
void StartCameraToCurrentTransform()
Definition:
gesture_camera.cpp:244
tango_gl::GestureCamera::SetAnchorOffset
void SetAnchorOffset(const glm::vec3 &pos)
Definition:
gesture_camera.h:59
glm::rotation
GLM_FUNC_DECL detail::tquat< T, P > rotation(detail::tvec3< T, P > const &orig, detail::tvec3< T, P > const &dest)
tango_gl::GestureCamera::kTouch0Down
@ kTouch0Down
Definition:
gesture_camera.h:37
tango_gl::GestureCamera::anchor_offset_
glm::vec3 anchor_offset_
Definition:
gesture_camera.h:86
tango_gl::GestureCamera::cur_touch_dist_
float cur_touch_dist_
Definition:
gesture_camera.h:89
tango_gl::GestureCamera::kTouch0Up
@ kTouch0Up
Definition:
gesture_camera.h:38
transform.h
tango_gl::GestureCamera::kTouchNone
@ kTouchNone
Definition:
gesture_camera.h:42
tango_gl::GestureCamera::SetAnchorPosition
void SetAnchorPosition(const glm::vec3 &pos, const glm::quat &rotation)
Definition:
gesture_camera.cpp:165
tango_gl
Definition:
axis.cpp:20
tango_gl::GestureCamera::SetCameraDistance
void SetCameraDistance(float cameraDistance)
Definition:
gesture_camera.h:62
pos
tango_gl::GestureCamera::GetCameraDistance
float GetCameraDistance() const
Definition:
gesture_camera.h:63
segment.h
glm::detail::tvec2
Definition:
type_mat.hpp:36
tango_gl::GestureCamera::~GestureCamera
~GestureCamera()
Definition:
gesture_camera.cpp:64
tango_gl::GestureCamera::kTouch1Up
@ kTouch1Up
Definition:
gesture_camera.h:41
tango_gl::GestureCamera::cam_parent_transform_
Transform * cam_parent_transform_
Definition:
gesture_camera.h:75
tango_gl::GestureCamera::OnTouchEvent
void OnTouchEvent(int touch_count, TouchEvent event, float x0, float y0, float x1, float y1)
Definition:
gesture_camera.cpp:66
rtabmap
Author(s): Mathieu Labbe
autogenerated on Thu Jul 25 2024 02:50:10