]> git.localhorst.tv Git - blank.git/blobdiff - src/camera.cpp
minor optimizations in chunk
[blank.git] / src / camera.cpp
index 8f618672f5a4b17266ab64388a1fc3d3a1524b0e..f4e3171b01fb2697062cbb1bea6180f00a9ec109 100644 (file)
@@ -1,52 +1,54 @@
 #include "camera.hpp"
 
+#include "geometry.hpp"
+
 #include <GL/glew.h>
 #include <glm/gtc/matrix_transform.hpp>
 
 
 namespace blank {
 
-Camera::Camera()
-: fov(45.0f)
+Camera::Camera() noexcept
+: fov(PI_0p25)
 , aspect(1.0f)
 , near_clip(0.1f)
-, far_clip(100.0f)
+, far_clip(256.0f)
 , projection(glm::perspective(fov, aspect, near_clip, far_clip)) {
 
 }
 
 
-void Camera::Viewport(int width, int height) {
+void Camera::Viewport(int width, int height) noexcept {
        Viewport(0, 0, width, height);
 }
 
-void Camera::Viewport(int x, int y, int width, int height) {
+void Camera::Viewport(int x, int y, int width, int height) noexcept {
        glViewport(x, y, width, height);
        Aspect(width, height);
 }
 
-void Camera::FOV(float f) {
+void Camera::FOV(float f) noexcept {
        fov = f;
        UpdateProjection();
 }
 
-void Camera::Aspect(float r) {
+void Camera::Aspect(float r) noexcept {
        aspect = r;
        UpdateProjection();
 }
 
-void Camera::Aspect(float w, float h) {
+void Camera::Aspect(float w, float h) noexcept {
        Aspect(w / h);
 }
 
-void Camera::Clip(float near, float far) {
+void Camera::Clip(float near, float far) noexcept {
        near_clip = near;
        far_clip = far;
        UpdateProjection();
 }
 
 
-void Camera::UpdateProjection() {
+void Camera::UpdateProjection() noexcept {
        projection = glm::perspective(fov, aspect, near_clip, far_clip);
 }