Fixing waterPlane not being rendered last, leading to incorrect alpha.

This commit is contained in:
Fabian Klemp 2015-03-09 14:59:22 +01:00
parent 67c1c812a5
commit c2d669e5b3

View File

@ -19,8 +19,8 @@ Level::~Level() {
} }
for(unsigned int i = 0; i<objects.size(); i++) { for(unsigned int i = 0; i<objects.size(); i++) {
delete(objects.at(i)); delete(objects.at(i));
delete(waterPlane);
} }
delete(waterPlane);
} }
void Level::load() { void Level::load() {
@ -60,12 +60,14 @@ void Level::render(ACGL::OpenGL::SharedShaderProgram shader, bool lightingPass,
for(unsigned int i = 0; i<objects.size(); i++) { for(unsigned int i = 0; i<objects.size(); i++) {
if (lightingPass) { if (lightingPass) {
objects.at(i)->render(shader, lightingPass, true, viewProjectionMatrix, shadowVPs); objects.at(i)->render(shader, lightingPass, true, viewProjectionMatrix, shadowVPs);
waterPlane->render(shader, lightingPass, true, viewProjectionMatrix, shadowVPs);
} }
else { else {
objects.at(i)->render(shader, lightingPass, false, viewProjectionMatrix, shadowVPs); objects.at(i)->render(shader, lightingPass, false, viewProjectionMatrix, shadowVPs);
} }
} }
if (lightingPass) {
waterPlane->render(shader, lightingPass, true, viewProjectionMatrix, shadowVPs);
}
} }
void Level::update(float runTimeSinceLastUpdate, float runTime, glm::vec2 mouseDelta, bool wPressed, bool aPressed, bool sPressed, bool dPressed,bool kPressed, bool lPressed) { void Level::update(float runTimeSinceLastUpdate, float runTime, glm::vec2 mouseDelta, bool wPressed, bool aPressed, bool sPressed, bool dPressed,bool kPressed, bool lPressed) {