group2 0.1.0
CSE 125 Group 2
Loading...
Searching...
No Matches
Camera.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <glm/glm.hpp>
4
6{
7public:
8 NewCamera();
9
10 // Camera perspective properties (modifies projection matrix)
11 void setAspect(float width, float height);
12 void setFov(float fovyDegrees);
13 void setZNear(float zNear);
14 void setZFar(float zFar);
15
16 // Sets the position of the camera in the world (modifies view matrix)
17 void setEye(glm::vec3 eye);
18 // Sets the view direction from the eye based on the pitch, yaw, and roll
19 // (all in radians). Roll rotates the up vector around the forward axis,
20 // used for camera tilt during wallruns.
21 void setTarget(float pitch, float yaw, float roll);
22 // Sets the up direction of the camera explicitly (overrides whatever
23 // setTarget produced). Useful if you ever need a non-gravity-aligned up.
24 void setUp(glm::vec3 up);
25
26 // Matrix computation, always run after using any of the set methods above.
28
30 [[nodiscard]] glm::mat4 getViewProjectionMatrix() const { return view_projection_; }
31
32private:
33 glm::vec3 eye_{0.0f, 0.0f, 3.0f};
34 glm::vec3 target_{0.0f, 0.0f, 0.0f};
35 glm::vec3 up_{0.0f, 1.0f, 0.0f};
36
37 // Near/far are sized for Quake units.
38 float fovy_ = glm::radians(60.0f);
39 float aspect_ = 1.0f;
40 float zNear_ = 5.0f;
41 float zFar_ = 15000.0f;
42
43 glm::mat4 view_projection_{1.0f};
44};
Definition Camera.hpp:6
void setEye(glm::vec3 eye)
Definition Camera.cpp:32
void setZFar(float zFar)
Definition Camera.cpp:27
void setUp(glm::vec3 up)
Definition Camera.cpp:48
void computeViewProjectionMatrix()
Definition Camera.cpp:53
glm::mat4 getViewProjectionMatrix() const
Return the combined view-projection matrix.
Definition Camera.hpp:30
NewCamera()
Definition Camera.cpp:7
void setAspect(float width, float height)
Definition Camera.cpp:12
void setFov(float fovyDegrees)
Definition Camera.cpp:17
void setZNear(float zNear)
Definition Camera.cpp:22
void setTarget(float pitch, float yaw, float roll)
Definition Camera.cpp:37