Merge branch 'master' of github.com:Faerbit/swp

This commit is contained in:
Steffen Fündgens 2014-12-19 13:36:05 +01:00
commit f21b837b1c
2 changed files with 4 additions and 3 deletions

View File

@ -27,7 +27,7 @@ uniform float directionalIntensity;
uniform vec3 lightSources[32]; uniform vec3 lightSources[32];
uniform vec3 lightColors[32]; uniform vec3 lightColors[32];
uniform float lightIntensities[32]; uniform float lightIntensities[32];
uniform float fogEnd; uniform float farPlane;
uniform vec4 fogColor; uniform vec4 fogColor;
uniform vec3 cameraCenter; uniform vec3 cameraCenter;
@ -133,7 +133,7 @@ void main()
vec3 finalColor = specularColor + diffuseColor + ambientColor; vec3 finalColor = specularColor + diffuseColor + ambientColor;
float distanceCameraCenter = distance(cameraCenter, vec3(fragPosition)); float distanceCameraCenter = distance(cameraCenter, vec3(fragPosition));
float fogFactor = clamp((1.0 - (fogEnd-distanceCameraCenter)/30.0), 0.0, 1.0); float fogFactor = clamp((1.0 - ((farPlane - 35.0) -distanceCameraCenter)/30.0), 0.0, 1.0);
fogFactor *= clamp((1.0-((fragPosition.y-8.0)/30.0)), 0.0, 1.0); fogFactor *= clamp((1.0-((fragPosition.y-8.0)/30.0)), 0.0, 1.0);
vec4 texture = texture(uTexture, vTexCoord).rgba; vec4 texture = texture(uTexture, vTexCoord).rgba;

View File

@ -212,8 +212,9 @@ void Graphics::render()
lightingShader->setTexture("shadowMap_middle", depthTexture_middle, 2); lightingShader->setTexture("shadowMap_middle", depthTexture_middle, 2);
lightingShader->setTexture("shadowMap_far", depthTexture_far, 3); lightingShader->setTexture("shadowMap_far", depthTexture_far, 3);
lightingShader->setUniform("farPlane", farPlane);
// set fog Parameters // set fog Parameters
lightingShader->setUniform("fogEnd", (farPlane)-35.0f);
lightingShader->setUniform("fogColor", level->getFogColour()); lightingShader->setUniform("fogColor", level->getFogColour());
lightingShader->setUniform("cameraCenter", level->getCameraCenter()->getPosition()); lightingShader->setUniform("cameraCenter", level->getCameraCenter()->getPosition());