Added FOV and mouse sensitivity settings

This commit is contained in:
MihailRis
2023-12-05 14:47:46 +03:00
parent af2786164a
commit 1d73c0bd9f
10 changed files with 66 additions and 10 deletions
+10 -2
View File
@@ -7,7 +7,7 @@ using glm::vec3;
using glm::vec4;
using glm::mat4;
Camera::Camera(vec3 position, float fov) : position(position), fov(fov), zoom(1.0f), rotation(1.0f) {
Camera::Camera(vec3 position, float fov) : fov(fov), position(position), zoom(1.0f), rotation(1.0f) {
updateVectors();
}
@@ -60,4 +60,12 @@ mat4 Camera::getView(bool pos){
mat4 Camera::getProjView(){
return getProjection()*getView();
}
}
void Camera::setFov(float fov) {
this->fov = fov;
}
float Camera::getFov() const {
return fov;
}
+5 -1
View File
@@ -5,6 +5,7 @@
class Camera {
void updateVectors();
float fov;
public:
glm::vec3 front;
glm::vec3 up;
@@ -12,7 +13,7 @@ public:
glm::vec3 dir;
glm::vec3 position;
float fov;
float zoom;
glm::mat4 rotation;
bool perspective = true;
@@ -25,6 +26,9 @@ public:
glm::mat4 getProjection();
glm::mat4 getView(bool position=true);
glm::mat4 getProjView();
void setFov(float fov);
float getFov() const;
};
#endif /* WINDOW_CAMERA_H_ */