Fix some high severity bugs
This commit is contained in:
@@ -9,7 +9,7 @@ Size=894,195
|
|||||||
Collapsed=0
|
Collapsed=0
|
||||||
|
|
||||||
[Window][Debug Utils]
|
[Window][Debug Utils]
|
||||||
Pos=-18,7
|
Pos=18,8
|
||||||
Size=871,365
|
Size=791,379
|
||||||
Collapsed=0
|
Collapsed=0
|
||||||
|
|
||||||
|
|||||||
@@ -61,7 +61,6 @@ private:
|
|||||||
float speed = 2.0f;
|
float speed = 2.0f;
|
||||||
|
|
||||||
float fov;
|
float fov;
|
||||||
float exposure = 1.0f;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ void Controller::run()
|
|||||||
// This is the game loop
|
// This is the game loop
|
||||||
while (!glfwWindowShouldClose(gameWindow->getGLFWwindow())) {
|
while (!glfwWindowShouldClose(gameWindow->getGLFWwindow())) {
|
||||||
// --- Timing ---
|
// --- Timing ---
|
||||||
//limit_framerate();
|
limit_framerate();
|
||||||
|
|
||||||
// --- Update game ---
|
// --- Update game ---
|
||||||
|
|
||||||
|
|||||||
@@ -10,8 +10,8 @@ bool EventHandler::firstMouseInput = 1;
|
|||||||
float EventHandler::mouseSensitivity = 0.5f;
|
float EventHandler::mouseSensitivity = 0.5f;
|
||||||
|
|
||||||
|
|
||||||
EventHandler::EventHandler(GLFWwindow *window) :
|
EventHandler::EventHandler(GLFWwindow *p_window) :
|
||||||
window(window)
|
window(p_window)
|
||||||
{
|
{
|
||||||
glfwSetKeyCallback(window, key_callback);
|
glfwSetKeyCallback(window, key_callback);
|
||||||
glfwSetCursorPosCallback(window, mouse_callback);
|
glfwSetCursorPosCallback(window, mouse_callback);
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ Framebuffer::Framebuffer(uint32_t width, uint32_t height, ShaderProgram *shaderP
|
|||||||
{
|
{
|
||||||
glGenFramebuffers(1, &FBO);
|
glGenFramebuffers(1, &FBO);
|
||||||
|
|
||||||
generateTextutes(width, height);
|
generateTextures(width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
Framebuffer::~Framebuffer()
|
Framebuffer::~Framebuffer()
|
||||||
@@ -27,7 +27,7 @@ void Framebuffer::unbind()
|
|||||||
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Framebuffer::render(GLuint customTextureId)
|
void Framebuffer::render()
|
||||||
{
|
{
|
||||||
// Disable wireframe mode
|
// Disable wireframe mode
|
||||||
GLint wireframe;
|
GLint wireframe;
|
||||||
@@ -36,11 +36,8 @@ void Framebuffer::render(GLuint customTextureId)
|
|||||||
|
|
||||||
shaderProgram->bind();
|
shaderProgram->bind();
|
||||||
glActiveTexture(GL_TEXTURE0);
|
glActiveTexture(GL_TEXTURE0);
|
||||||
if(customTextureId) {
|
glBindTexture(GL_TEXTURE_2D, getTextureId());
|
||||||
glBindTexture(GL_TEXTURE_2D, customTextureId);
|
|
||||||
} else {
|
|
||||||
glBindTexture(GL_TEXTURE_2D, getTextureId());
|
|
||||||
}
|
|
||||||
GLint location = glGetUniformLocation(shaderProgram->getShaderProgramId(), "u_texture");
|
GLint location = glGetUniformLocation(shaderProgram->getShaderProgramId(), "u_texture");
|
||||||
glUniform1i(location, 0);
|
glUniform1i(location, 0);
|
||||||
|
|
||||||
@@ -60,10 +57,10 @@ void Framebuffer::changeDimensions(uint32_t width, uint32_t height)
|
|||||||
// Delete old textures
|
// Delete old textures
|
||||||
glDeleteTextures(2, textures);
|
glDeleteTextures(2, textures);
|
||||||
|
|
||||||
generateTextutes(width, height);
|
generateTextures(width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Framebuffer::generateTextutes(uint32_t width, uint32_t height)
|
void Framebuffer::generateTextures(uint32_t width, uint32_t height)
|
||||||
{
|
{
|
||||||
// Create new textures
|
// Create new textures
|
||||||
glGenTextures(2, textures);
|
glGenTextures(2, textures);
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ public:
|
|||||||
void bind();
|
void bind();
|
||||||
void unbind();
|
void unbind();
|
||||||
|
|
||||||
void render(GLuint customTextureId = 0);
|
void render();
|
||||||
|
|
||||||
void changeDimensions(uint32_t width, uint32_t height);
|
void changeDimensions(uint32_t width, uint32_t height);
|
||||||
|
|
||||||
@@ -24,7 +24,7 @@ public:
|
|||||||
void setExposureCorrection(bool exposureCorrection);
|
void setExposureCorrection(bool exposureCorrection);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void generateTextutes(uint32_t width, uint32_t height);
|
void generateTextures(uint32_t width, uint32_t height);
|
||||||
|
|
||||||
GLuint FBO;
|
GLuint FBO;
|
||||||
GLuint textures[2];
|
GLuint textures[2];
|
||||||
|
|||||||
@@ -9,6 +9,8 @@
|
|||||||
class Light
|
class Light
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
virtual ~Light() {}
|
||||||
|
|
||||||
virtual void update() = 0;
|
virtual void update() = 0;
|
||||||
|
|
||||||
void setActive(bool active)
|
void setActive(bool active)
|
||||||
@@ -38,7 +40,6 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
Light(ShaderProgram *shaderProgram) : shaderProgram(shaderProgram) {}
|
Light(ShaderProgram *shaderProgram) : shaderProgram(shaderProgram) {}
|
||||||
~Light() {}
|
|
||||||
|
|
||||||
ShaderProgram *shaderProgram;
|
ShaderProgram *shaderProgram;
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
#include "Widget.h"
|
#include "Widget.h"
|
||||||
#include "VertexArray.h"
|
#include "VertexArray.h"
|
||||||
|
|
||||||
Widget::Widget(Texture *texture, float x, float y, float w, float h) :
|
Widget::Widget(Texture *texture, float p_x, float p_y, float p_w, float p_h) :
|
||||||
x(x), y(y), w(w), h(h)
|
x(p_x), y(p_y), w(p_w), h(p_h)
|
||||||
{
|
{
|
||||||
widgetTextures.push_back(texture);
|
widgetTextures.push_back(texture);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user