WoW Model Viewer
Your premiere tool for viewing, equipping and animating World of Warcraft models.
Loading...
Searching...
No Matches
OrbitCamera.h
Go to the documentation of this file.
1#pragma once
2
3#include "glm/glm.hpp"
4
10{
11public:
13
15 glm::mat4 getViewMatrix() const;
16
18 void reset();
19
24 void resetFromBounds(float zMin, float zMax, float fovDegrees);
25
27 void setPosition(const glm::vec3& position);
28
30 glm::vec3 position() const { return pos_; }
31
33 glm::vec3 right() const { return right_; }
34
36 void setYaw(float yaw);
37
39 void setPitch(float pitch);
40
42 void setYawAndPitch(float yaw, float pitch);
43
45 float yaw() const { return yaw_; }
46
48 float pitch() const { return pitch_; }
49
51 void setLookAt(const glm::vec3& target);
52
54 glm::vec3 lookAt() const { return target_; }
55
57 void setRadius(float radius);
58
60 float radius() const { return radius_; }
61
62private:
63 void updatePosition();
64
65 glm::vec3 pos_;
66 glm::vec3 target_;
67 glm::vec3 up_;
68 glm::vec3 right_;
69
70 float yaw_;
71 float pitch_;
72 float radius_;
73};
Orbit camera that revolves around a target point.
Definition OrbitCamera.h:10
void reset()
Reset all parameters to defaults.
float radius() const
Current orbit radius (distance to target).
Definition OrbitCamera.h:60
glm::vec3 position() const
Current camera world position.
Definition OrbitCamera.h:30
glm::vec3 right_
Definition OrbitCamera.h:68
void setLookAt(const glm::vec3 &target)
Set the point the camera orbits around.
float yaw() const
Current yaw angle in radians.
Definition OrbitCamera.h:45
glm::vec3 target_
Definition OrbitCamera.h:66
glm::vec3 pos_
Definition OrbitCamera.h:65
void setPitch(float pitch)
Set the pitch angle (vertical elevation).
void setRadius(float radius)
Set the distance from the camera to the target.
float radius_
Definition OrbitCamera.h:72
glm::vec3 up_
Definition OrbitCamera.h:67
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.
void updatePosition()
float pitch() const
Current pitch angle in radians.
Definition OrbitCamera.h:48
glm::vec3 lookAt() const
Current orbit target position.
Definition OrbitCamera.h:54
glm::vec3 right() const
Camera right vector (perpendicular to view direction and up).
Definition OrbitCamera.h:33
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.