Reverting to old way when to sample the directional shadow, because of a bug introduced by this.

This commit is contained in:
Faerbit 2015-05-31 17:51:11 +02:00
parent 806182835f
commit 5dbf839f76
3 changed files with 3 additions and 17 deletions

View File

@ -51,7 +51,6 @@ uniform bool movingTexture;
uniform vec2 movement;
uniform vec2 movingTextureOffset;
uniform float time;
uniform bool sampleDirectionalShadowSwitch;
vec2 poissonDisk[16] = vec2[](
vec2( -0.94201624, -0.39906216 ),
@ -209,9 +208,9 @@ void main()
// direction lighting
float sunAngle = -1.0;
if(sampleDirectionalShadowSwitch) {
vec3 directionalVector = normalize(directionalLightVector);
sunAngle = dot(vec3(0.0, 1.0, 0.0), directionalVector);
if(sunAngle > 0.0) {
float directionalVisibility = 1.0f;
float directionalIntensity = sunIntensity(sunAngle);
if (distanceToBorder(shadowCoord3.xy) <= 0.5 && distanceToBorder(shadowCoord3.xy) > 0.2) {

View File

@ -30,7 +30,6 @@ Graphics::Graphics(glm::uvec2 windowSize, float nearPlane,
renderFlames = true;
renderWorld = true;
renderDebug = false;
directionalShadowSwitch = false;
}
Graphics::Graphics() {
@ -197,7 +196,6 @@ void Graphics::init(Level* level) {
lightingShader->setUniform("fogColorRise", level->getFogColourRise());
lightingShader->setUniform("fogColorNight", level->getFogColourNight());
lightingShader->setUniform("ambientColor", level->getAmbientLight());
lightingShader->setUniform("sampleDirectionalShadowSwitch", false);
if(level->getDirectionalLight()) {
lightingShader->setUniform("directionalLightVector",
level->getDirectionalLight()->getPosition());
@ -370,11 +368,6 @@ void Graphics::render(double time)
glm::vec3 sunVector = (level->getCameraCenter()->getPosition() + level->getDirectionalLight()->getPosition());
if (sunAngle > 0.0f) {
if (!directionalShadowSwitch) {
lightingShader->use();
lightingShader->setUniform("sampleDirectionalShadowSwitch", true);
directionalShadowSwitch = true;
}
depthShader->use();
for (unsigned int i = 0; i<framebuffer_directional.size(); i++) {
framebuffer_directional.at(i)->bind();
@ -405,11 +398,6 @@ void Graphics::render(double time)
}
}
}
else if (directionalShadowSwitch) {
lightingShader->use();
lightingShader->setUniform("sampleDirectionalShadowSwitch", false);
directionalShadowSwitch = false;
}
}
// lighting render pass

View File

@ -84,7 +84,6 @@ class Graphics {
bool renderFlames;
bool renderDebug;
bool renderWorld;
bool directionalShadowSwitch;
DebugDraw debugDrawer;
SharedArrayBuffer debug_ab;
SharedVertexArrayObject debug_vao;