DXGL r181 - Code Review

Jump to navigation Jump to search
Repository:DXGL
Revision:r180‎ | r181 | r182 >
Date:18:46, 24 June 2012
Author:admin
Status:new
Tags:
Comment:
Add attenuation factors to point/spot lights
Modified paths:
  • /ddraw/shadergen.cpp (modified) (history)

Diff [purge]

Index: ddraw/shadergen.cpp
@@ -324,7 +324,8 @@
325325 vec3 H = normalize(L + vec3(0.0, 0.0, 1.0));\n\
326326 float NdotL = max(dot(N,L),0.0);\n\
327327 float NdotH = max(dot(N,H),0.0);\n\
328 -diffuse += light.diffuse*NdotL;\n\
 328+float attenuation = 1.0/(light.constant+(d*light.linear)+((d*d)*light.quad));\n\
 329+diffuse += light.diffuse*NdotL*attenuation;\n\
329330 ambient += light.ambient;\n\
330331 }\n";
331332