Fixed a drawing bug for the pointlight shadows.
This commit is contained in:
parent
e1654ded34
commit
e9390d860b
@ -93,8 +93,8 @@ void Graphics::render()
|
|||||||
for (unsigned int i_pointlight = 0; i_pointlight<1 && i_pointlight<level->getLights()->size(); i_pointlight++) {
|
for (unsigned int i_pointlight = 0; i_pointlight<1 && i_pointlight<level->getLights()->size(); i_pointlight++) {
|
||||||
// render each side of the cube
|
// render each side of the cube
|
||||||
for (int i_face = 0; i_face<6; i_face++) {
|
for (int i_face = 0; i_face<6; i_face++) {
|
||||||
glClear(GL_DEPTH_BUFFER_BIT);
|
|
||||||
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_CUBE_MAP_POSITIVE_X + i_face, depth_cubeMaps.at(i_pointlight)->getObjectName(), 0);
|
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_CUBE_MAP_POSITIVE_X + i_face, depth_cubeMaps.at(i_pointlight)->getObjectName(), 0);
|
||||||
|
glClear(GL_DEPTH_BUFFER_BIT);
|
||||||
glm::mat4 depthViewProjectionMatrix_face = depthProjectionMatrix_pointlights * glm::lookAt(level->getLights()->at(i_pointlight).getPosition(),
|
glm::mat4 depthViewProjectionMatrix_face = depthProjectionMatrix_pointlights * glm::lookAt(level->getLights()->at(i_pointlight).getPosition(),
|
||||||
level->getLights()->at(i_pointlight).getPosition() + looking_directions[i_face], glm::vec3(0.0f, 1.0f, 0.0f));
|
level->getLights()->at(i_pointlight).getPosition() + looking_directions[i_face], glm::vec3(0.0f, 1.0f, 0.0f));
|
||||||
level->render(depthShader, false, &depthViewProjectionMatrix_face);
|
level->render(depthShader, false, &depthViewProjectionMatrix_face);
|
||||||
|
Loading…
Reference in New Issue
Block a user