Added FOV and mouse sensitivity settings
This commit is contained in:
+10
-2
@@ -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
@@ -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_ */
|
||||
|
||||
Reference in New Issue
Block a user