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 kHighestFov = 120.0f;
48 const float kHighFov = 85.0f;
49 const float kLowFov = 65.0f;
50 const float kLowestFov = 40.0f;
56 cam_cur_target_rot_(1,0,0,0),
57 start_touch_dist_(0.0
f),
67 float y0,
float x1,
float y1) {
95 if (touch_count == 2) {
98 float abs_x = x0 - x1;
99 float abs_y = y0 - y1;
110 float abs_x = x0 - x1;
111 float abs_y = y0 - y1;
121 kCamViewMinDist, kCamViewMaxDist);
129 glm::vec2 touch_center_position((x0+x1)/2.0
f, (y0+y1)/2.0
f);
154 normalized_x = normalized_x - 0.5f;
155 normalized_y = 0.5f - normalized_y;
159 glm::vec3(normalized_x * screen_width, normalized_y * screen_height,
182 switch (camera_index) {
void SetNearFarClipPlanes(const float near, const float far)
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)