diff --git a/data/shaders/basic.frag b/data/shaders/basic.frag index 8b21987..e34a5ae 100644 --- a/data/shaders/basic.frag +++ b/data/shaders/basic.frag @@ -42,7 +42,7 @@ struct PointLight { vec3 diffuse; vec3 specular; }; -#define NUM_POINT_LIGHTS 16 +#define NUM_POINT_LIGHTS 1 uniform PointLight u_pointLight[NUM_POINT_LIGHTS]; /*struct SpotLight { diff --git a/src/JsonParser.cpp b/src/JsonParser.cpp index 24ef0be..8e42fe8 100644 --- a/src/JsonParser.cpp +++ b/src/JsonParser.cpp @@ -168,8 +168,7 @@ std::vector JsonParser::getLights(ShaderProgram* shaderProgram) // Pointlights const Json::Value pointLightsJson = root["pointLights"]; - - unsigned int index = 0; + int index = 0; for (; index < pointLightsJson.size(); index++) { PointLight *current_pointLight; diff --git a/src/Light.cpp b/src/Light.cpp index 885b6a5..b48cb76 100644 --- a/src/Light.cpp +++ b/src/Light.cpp @@ -75,7 +75,8 @@ void PointLight::update() std::string PointLight::getStructMemberName() { - std::string temp = "u_pointLight[" + std::to_string(id) + "]."; + // id - 1 because id 0 is always the DirectionalLight! + std::string temp = "u_pointLight[" + std::to_string(id - 1) + "]."; return temp; } diff --git a/src/Light.h b/src/Light.h index b0e1398..394c7b2 100644 --- a/src/Light.h +++ b/src/Light.h @@ -4,7 +4,7 @@ #include "ShaderProgram.h" -#define NUM_POINT_LIGHTS 4 +#define NUM_POINT_LIGHTS 1 class Light { diff --git a/src/Menu.cpp b/src/Menu.cpp index 0087631..6839755 100644 --- a/src/Menu.cpp +++ b/src/Menu.cpp @@ -2,7 +2,6 @@ #include "JsonParser.h" #include "eventActions.h" #include "helper.h" -#include Menu::Menu(Framebuffer *p_framebuffer, ShaderProgram *p_shaderProgram) : framebuffer(p_framebuffer), shaderProgram(p_shaderProgram) @@ -75,7 +74,7 @@ void Menu::writeWindowActions(bool *windowActionRegister) void Menu::onPlayPressed() { - std::cout << "Hello, from Widget play in Menu :)" << std::endl; + } void Menu::onExitPressed() diff --git a/src/Window.cpp b/src/Window.cpp index 2419470..45d7617 100644 --- a/src/Window.cpp +++ b/src/Window.cpp @@ -6,7 +6,6 @@ #include "defines.h" #include "helper.h" - Window::Window() { // Initialize GLFW