changed window size to bigger and 16:9, changed "zoom" to "fov", changed default fov to 90
This commit is contained in:
parent
b1dc69ed28
commit
6dc659a4e2
@ -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 <set>
|
||||
|
@ -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 ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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();
|
||||
|
@ -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) {
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user