From e099c231c70d83253a27db027c69601fa7abbe42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Steffen=20F=C3=BCndgens?= Date: Mon, 15 Dec 2014 16:48:42 +0100 Subject: [PATCH] Not using pointlight shadows. --- Shader/phong.fsh | 4 ++-- graphics.cc | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Shader/phong.fsh b/Shader/phong.fsh index bd723e3..8685039 100644 --- a/Shader/phong.fsh +++ b/Shader/phong.fsh @@ -13,7 +13,7 @@ uniform sampler2D uTexture; uniform sampler2DShadow shadowMap_near; uniform sampler2DShadow shadowMap_middle; uniform sampler2DShadow shadowMap_far; -uniform samplerCubeShadow shadowMap_cube; +//uniform samplerCubeShadow shadowMap_cube; uniform vec3 ambientColor; uniform float ambientFactor; uniform float diffuseFactor; @@ -111,7 +111,7 @@ void main() vec3 cameraVector = normalize(camera - vec3(fragPosition)); specularColor += clamp(pow((dot((cameraVector+lightVector),normalize(vNormal))/(length(cameraVector+lightVector)*length(normalize(vNormal)))),shininess), 0.0, 1.0) *specularFactor*intensity*lightColors[i]; - visibility = samplePointShadow(shadowMap_cube, lightDirection); + //visibility = samplePointShadow(shadowMap_cube, lightDirection); } } diff --git a/graphics.cc b/graphics.cc index 834f97a..c9ee3df 100644 --- a/graphics.cc +++ b/graphics.cc @@ -72,7 +72,7 @@ void Graphics::init(Level* level) { /*depth_cubeMaps = std::vector(level->getLights()->size()); for (unsigned int i = 0; i(1); + /*depth_cubeMaps = std::vector(1); for (unsigned int i = 0; i<1; i++) { depth_cubeMaps.at(i) = SharedTextureCubeMap(new TextureCubeMap(glm::vec2(cube_size, cube_size), GL_DEPTH_COMPONENT16)); depth_cubeMaps.at(i)->setMinFilter(GL_NEAREST); @@ -80,7 +80,7 @@ void Graphics::init(Level* level) { depth_cubeMaps.at(i)->setWrapS(GL_CLAMP_TO_EDGE); depth_cubeMaps.at(i)->setWrapT(GL_CLAMP_TO_EDGE); depth_cubeMaps.at(i)->setCompareMode(GL_COMPARE_REF_TO_TEXTURE); - } + }*/ framebuffer_cube = SharedFrameBufferObject(new FrameBufferObject()); } @@ -98,12 +98,12 @@ void Graphics::render() // At first render shadows depthShader->use(); // render depth textures for point lights - glViewport(0, 0, cube_size, cube_size); + /*glViewport(0, 0, cube_size, cube_size); glm::mat4 depthProjectionMatrix_pointlights = glm::perspective(1.571f, (float)cube_size/(float)cube_size, 0.1f, farPlane); glm::vec3 looking_directions[6] = {glm::vec3(1.0f, 0.0f, 0.0f), glm::vec3(-1.0f, 0.0f, 0.0f), glm::vec3(0.0f, 1.0f, 0.0f), - glm::vec3(0.0f, -1.0f, 0.0f), glm::vec3(0.0f, 0.0f, 1.0f), glm::vec3(0.0f, 0.0f, -1.0f)}; + glm::vec3(0.0f, -1.0f, 0.0f), glm::vec3(0.0f, 0.0f, 1.0f), glm::vec3(0.0f, 0.0f, -1.0f)};*/ - framebuffer_cube->bind(); + /*framebuffer_cube->bind(); //for (unsigned int i_pointlight = 0; i_pointlightgetLights()->size(); i_pointlight++) { for (unsigned int i_pointlight = 0; i_pointlight<1; i_pointlight++) { // render each side of the cube @@ -112,12 +112,12 @@ void Graphics::render() glClear(GL_DEPTH_BUFFER_BIT); 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->render(depthShader, false, &depthViewProjectionMatrix_face); + //level->render(depthShader, false, &depthViewProjectionMatrix_face); if (!framebuffer_cube->isFrameBufferObjectComplete()) { printf("Framebuffer incomplete, unknown error occured during shadow generation!\n"); } } - } + }*/ // render depth texture for sun glViewport(0, 0, windowSize.x, windowSize.y); // near pass @@ -185,7 +185,7 @@ void Graphics::render() glUniform1fv(lightingShader->getUniformLocation("lightIntensities"), sizeof(lightIntensities), (GLfloat*) lightIntensities); - lightingShader->setTexture("shadowMap_cube", depth_cubeMaps.at(0), 4); + //lightingShader->setTexture("shadowMap_cube", depth_cubeMaps.at(0), 4); } // set directional Light if(level->getDirectionalLight()) {