From ea8e7b60485dcad37a9c4c1e51b96b8f4c1aceea Mon Sep 17 00:00:00 2001 From: Faerbit Date: Tue, 2 Jun 2015 17:36:55 +0200 Subject: [PATCH] Fixing the rendering of the shadows. Closes #10. --- game/graphics.cc | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/game/graphics.cc b/game/graphics.cc index 09f11a2..96cdef4 100644 --- a/game/graphics.cc +++ b/game/graphics.cc @@ -680,32 +680,32 @@ void Graphics::updateLights() { } // Build light position array - glm::vec3 lightSources[closestLights->size()]; - for(unsigned int i = 0; isize(); i++) { - lightSources[i] = closestLights->at(i)->getPosition(); + glm::vec3 lightSources[shadowRenderQueue.size()]; + for(unsigned int i = 0; igetPosition(); } glUniform3fv(lightingShader->getUniformLocation("lightSources"), sizeof(lightSources), (GLfloat*) lightSources); // Build light colour array - glm::vec3 lightColours[closestLights->size()]; - for(unsigned int i = 0; isize(); i++) { - lightColours[i] = closestLights->at(i)->getColour(); + glm::vec3 lightColours[shadowRenderQueue.size()]; + for(unsigned int i = 0; igetColour(); } glUniform3fv(lightingShader->getUniformLocation("lightColors"), sizeof(lightColours), (GLfloat*) lightColours); // Build light attenuation array - float lightIntensities[closestLights->size()]; - for(unsigned int i = 0; isize(); i++) { - lightIntensities[i] = closestLights->at(i)->getIntensity(); + float lightIntensities[shadowRenderQueue.size()]; + for(unsigned int i = 0; igetIntensity(); } glUniform1fv(lightingShader->getUniformLocation("lightIntensities"), sizeof(lightIntensities), (GLfloat*) lightIntensities); - bool isFlame[closestLights->size()]; + bool isFlame[shadowRenderQueue.size()]; closestFlames = std::vector(); - for (unsigned int i = 0; isize(); i++) { - if (closestLights->at(i)->isFlame()) { - closestFlames.push_back(closestLights->at(i)->getFlame()); + for(unsigned int i = 0; iisFlame()) { + closestFlames.push_back(shadowRenderQueue.at(i).light->getFlame()); isFlame[i] = true; } else {