fixed point lights range issue

This commit is contained in:
Anselme 2016-12-21 16:46:04 +01:00
parent 7cafed3e67
commit 24611e0e56

View File

@ -117,13 +117,14 @@ void main(void) {
float att = 1;
#ifdef POINT_LIGHT
vec3 dirLight = pointLight - fragPos.xyz;
vec4 pointShadowParam = vec4(inverseViewMatrix * dirLight, length(dirLight));
//vec4 pointShadowParam = vec4(inverseViewMatrix * dirLight, length(dirLight));
//att = texture(shadowMap, pointShadowParam);
//outColor = vec4(vec3(texture(shadowMap, vec4(inverseViewMatrix * dirLight, length(dirLight)/range))), 1);
//outColor = vec4(vec3(texture(shadowMap, vec3(inverseViewMatrix * dirLight)).r), 1);
//outColor = vec4(vec3(length(dirLight)/range), 1);
//return;
att = clamp(att, 0, 1);
float dist = length(dirLight);
att = clamp(1 - dist/range, 0, 1);
dirLight = normalize(dirLight);
#endif