2#include "glm/gtc/matrix_transform.hpp"
11 : pos_(glm::vec3(0.0f)),
12 target_(glm::vec3(0.0f)),
14 right_(glm::vec3(0.0f)),
29 pos_ = glm::vec3(0.0f, 0.0f, 0.0f);
30 target_ = glm::vec3(0.0f, 0.0f, 0.0f);
31 up_ = glm::vec3(0.0f, 0.0f, 1.0f);
46 target_.z = (zMin + zMax) / 2.0f;
47 setRadius((zMin + zMax) / 2.0f * 1.3f / sinf(glm::radians(fovDegrees / 2.0f)));
constexpr float CAMERA_MAX_RADIUS
constexpr float CAMERA_DEFAULT_PITCH
constexpr float CAMERA_DEFAULT_RADIUS
constexpr float CAMERA_MIN_RADIUS
constexpr float CAMERA_DEFAULT_YAW
void reset()
Reset all parameters to defaults.
float radius() const
Current orbit radius (distance to target).
glm::vec3 position() const
Current camera world position.
void setLookAt(const glm::vec3 &target)
Set the point the camera orbits around.
float yaw() const
Current yaw angle in radians.
void setPitch(float pitch)
Set the pitch angle (vertical elevation).
void setRadius(float radius)
Set the distance from the camera to the target.
void resetFromBounds(float zMin, float zMax, float fovDegrees)
Reset the camera to frame a model whose bounding box spans [zMin, zMax].
void setPosition(const glm::vec3 &position)
Set the camera world position directly.
float pitch() const
Current pitch angle in radians.
glm::mat4 getViewMatrix() const
Compute the current view matrix from yaw, pitch, and radius.
void setYaw(float yaw)
Set the yaw angle (horizontal rotation around the target).
void setYawAndPitch(float yaw, float pitch)
Set both yaw and pitch simultaneously.