world-wide commit to ruin everything
This commit is contained in:
@@ -1,10 +1,3 @@
|
||||
/*
|
||||
* Camera.cpp
|
||||
*
|
||||
* Created on: Feb 11, 2020
|
||||
* Author: MihailRis
|
||||
*/
|
||||
|
||||
#include "Camera.h"
|
||||
#include "Window.h"
|
||||
|
||||
@@ -36,7 +29,10 @@ void Camera::rotate(float x, float y, float z){
|
||||
}
|
||||
|
||||
mat4 Camera::getProjection(){
|
||||
float aspect = (float)Window::width / (float)Window::height;
|
||||
float aspect = this->aspect;
|
||||
if (aspect == 0.0f){
|
||||
aspect = (float)Window::width / (float)Window::height;
|
||||
}
|
||||
if (perspective)
|
||||
return glm::perspective(fov*zoom, aspect, 0.05f, 1500.0f);
|
||||
else
|
||||
@@ -50,5 +46,5 @@ mat4 Camera::getView(){
|
||||
if (perspective)
|
||||
return glm::lookAt(position, position+front, up);
|
||||
else
|
||||
return glm::mat4(1.0f);
|
||||
return glm::translate(glm::mat4(1.0f), position);
|
||||
}
|
||||
|
||||
+1
-7
@@ -1,10 +1,3 @@
|
||||
/*
|
||||
* Camera.h
|
||||
*
|
||||
* Created on: Feb 11, 2020
|
||||
* Author: MihailRis
|
||||
*/
|
||||
|
||||
#ifndef WINDOW_CAMERA_H_
|
||||
#define WINDOW_CAMERA_H_
|
||||
|
||||
@@ -25,6 +18,7 @@ public:
|
||||
mat4 rotation;
|
||||
bool perspective = true;
|
||||
bool flipped = false;
|
||||
float aspect = 0.0f;
|
||||
Camera(vec3 position, float fov);
|
||||
|
||||
void rotate(float x, float y, float z);
|
||||
|
||||
@@ -41,6 +41,10 @@ int Window::initialize(int width, int height, const char* title){
|
||||
return 0;
|
||||
}
|
||||
|
||||
void Window::viewport(int x, int y, int width, int height){
|
||||
glViewport(x, y, width, height);
|
||||
}
|
||||
|
||||
void Window::setCursorMode(int mode){
|
||||
glfwSetInputMode(window, GLFW_CURSOR, mode);
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ public:
|
||||
static int initialize(int width, int height, const char* title);
|
||||
static void terminate();
|
||||
|
||||
static void viewport(int x, int y, int width, int height);
|
||||
static void setCursorMode(int mode);
|
||||
static bool isShouldClose();
|
||||
static void setShouldClose(bool flag);
|
||||
|
||||
Reference in New Issue
Block a user