23 const float kThirdPersonCameraDist = 7.0f;
26 const float kThirdPersonFollowCameraDist = 2.0f;
29 const float kTopDownCameraDist = 5.0f;
32 const float kZoomSpeed = 10.0f;
35 const float kMoveSpeed = 10.0f;
38 const float kRotationSpeed = 2.0f;
41 const float kCamViewMinDist = .1f;
42 const float kCamViewMaxDist = 100.f;
47 const float kHighFov = 65.0f;
48 const float kLowFov = 65.0f;
54 cam_cur_target_rot_(1,0,0,0),
55 start_touch_dist_(0.0
f),
65 float y0,
float x1,
float y1) {
93 if (touch_count == 2) {
96 float abs_x = x0 - x1;
97 float abs_y = y0 - y1;
108 float abs_x = x0 - x1;
109 float abs_y = y0 - y1;
119 kCamViewMinDist, kCamViewMaxDist);
127 glm::vec2 touch_center_position((x0+x1)/2.0
f, (y0+y1)/2.0
f);
152 normalized_x = normalized_x - 0.5f;
153 normalized_y = 0.5f - normalized_y;
157 glm::vec3(normalized_x * screen_width, normalized_y * screen_height,
180 switch (camera_index) {
void SetCameraType(CameraType camera_index)
GLM_FUNC_DECL vecType< T, P > sqrt(vecType< T, P > const &x)
highp_quat quat
Quaternion of default single-precision floating-point numbers.
Transform * cam_parent_transform_
Segment GetSegmentFromTouch(float normalized_x, float normalized_y, float touch_range)
GLM_FUNC_DECL genType normalize(genType const &x)
void SetFieldOfView(const float fov)
void SetOrthoMode(bool enabled)
glm::vec3 ApplyTransform(const glm::mat4 &mat, const glm::vec3 &vec)
float Clamp(float value, float min, float max)
glm::quat cam_cur_target_rot_
glm::vec2 cam_start_angle_
void StartCameraToCurrentTransform()
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)
GLM_FUNC_DECL genType tan(genType const &angle)
void SetAnchorPosition(const glm::vec3 &pos, const glm::quat &rotation)
void SetOrthoCropFactor(float value)
glm::vec2 touch0_start_position_
void SetOrthoScale(float scale)