From 6dc659a4e2c195ca16dc0724bcae60125783f0ab Mon Sep 17 00:00:00 2001 From: Looki2000 Date: Mon, 10 Apr 2023 12:45:57 +0200 Subject: [PATCH] changed window size to bigger and 16:9, changed "zoom" to "fov", changed default fov to 90 --- src/game/core.hpp | 4 ++-- src/game/engine/chunk.cpp | 2 +- src/game/engine/engine.cpp | 2 +- src/game/engine/player_camera.cpp | 14 +++++++------- src/game/engine/player_camera.hpp | 4 ++-- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/game/core.hpp b/src/game/core.hpp index 8734deb..6b73b2c 100644 --- a/src/game/core.hpp +++ b/src/game/core.hpp @@ -1,8 +1,8 @@ #ifndef POLYGUN_CORE_HPP #define POLYGUN_CORE_HPP -#define SCR_HEIGHT 600 -#define SCR_WIDTH 800 +#define SCR_WIDTH 1280 +#define SCR_HEIGHT 720 /* C++ Libraries */ #include diff --git a/src/game/engine/chunk.cpp b/src/game/engine/chunk.cpp index 67dde1d..4ff374e 100644 --- a/src/game/engine/chunk.cpp +++ b/src/game/engine/chunk.cpp @@ -5,7 +5,7 @@ namespace polygun::engine { for (int x = 0; x < CHUNK_SIZE; x++) { for (int y = 0; y < CHUNK_SIZE; y++) { for (int z = 0; z < CHUNK_SIZE; z++) { - chunk_data[x][y][z] = 0 ; + chunk_data[x][y][z] = 1 ; } } } diff --git a/src/game/engine/engine.cpp b/src/game/engine/engine.cpp index 540f9b7..1b22f86 100644 --- a/src/game/engine/engine.cpp +++ b/src/game/engine/engine.cpp @@ -209,7 +209,7 @@ namespace polygun::engine { // activate shader chunk_shader.bind(); - glm::mat4 projection = glm::perspective(glm::radians(m_camera.m_zoom), (float)sizex / (float)sizey, 0.1f, 100.0f); + glm::mat4 projection = glm::perspective(glm::radians(m_camera.m_fov), (float)sizex / (float)sizey, 0.1f, 100.0f); chunk_shader.set_uniform("projection", projection); glm::mat4 view = m_camera.get_view_matrix(); diff --git a/src/game/engine/player_camera.cpp b/src/game/engine/player_camera.cpp index 54ab218..70ffd9e 100644 --- a/src/game/engine/player_camera.cpp +++ b/src/game/engine/player_camera.cpp @@ -14,7 +14,7 @@ Camera::Camera(glm::vec3 position, glm::vec3 up, float yaw, float pitch) : m_pitch(pitch), m_movement_speed(SPEED), m_mouse_sensitivity(SENSITIVITY), - m_zoom(ZOOM), + m_fov(FOV), m_last_x(SCR_WIDTH / 2.0f), m_last_y(SCR_HEIGHT / 2.0f), m_first_mouse(true) @@ -32,7 +32,7 @@ Camera::Camera(float pos_x, float pos_y, float pos_z, float up_x, float up_y, fl m_pitch(pitch), m_movement_speed(SPEED), m_mouse_sensitivity(SENSITIVITY), - m_zoom(ZOOM), + m_fov(FOV), m_last_x(SCR_WIDTH / 2.0f), m_last_y(SCR_HEIGHT / 2.0f), m_first_mouse(true) @@ -90,11 +90,11 @@ void Camera::process_mouse_movement(float x_offset, float y_offset, GLboolean co } void Camera::process_mouse_scroll(float y_offset) { - m_zoom -= y_offset; - if (m_zoom < 1.0f) - m_zoom = 1.0f; - if (m_zoom > 45.0f) - m_zoom = 45.0f; + m_fov -= y_offset; + if (m_fov < 1.0f) + m_fov = 1.0f; + if (m_fov > 45.0f) + m_fov = 45.0f; } void Camera::mouse_callback(GLFWwindow* window, double x_pos_in, double y_pos_in) { diff --git a/src/game/engine/player_camera.hpp b/src/game/engine/player_camera.hpp index 944e9d3..e2fbccc 100644 --- a/src/game/engine/player_camera.hpp +++ b/src/game/engine/player_camera.hpp @@ -17,7 +17,7 @@ namespace polygun::engine { const float PITCH = 0.0f; const float SPEED = 2.5f; const float SENSITIVITY = 0.1f; - const float ZOOM = 45.0f; + const float FOV = 90.0f; class Camera { public: @@ -30,7 +30,7 @@ namespace polygun::engine { float m_pitch; float m_movement_speed; float m_mouse_sensitivity; - float m_zoom; + float m_fov; Camera(glm::vec3 position = glm::vec3(-0.5f, 0.25f, -0.5f), glm::vec3 up = glm::vec3(0.0f, 1.0f, 0.0f), float yaw = YAW, float pitch = PITCH); Camera(float pos_x, float pos_y, float pos_z, float up_x, float up_y, float up_z, float yaw, float pitch);