From: <re...@us...> - 2008-07-24 16:11:57
|
Revision: 30522 http://crystal.svn.sourceforge.net/crystal/?rev=30522&view=rev Author: res2002 Date: 2008-07-24 16:11:51 +0000 (Thu, 24 Jul 2008) Log Message: ----------- Change light attenuation vector to contain the inverse radius for the linear attenuation in the last component (not the plain radius) Modified Paths: -------------- CS/trunk/data/shader/snippets/lighting/lightfuncs.cginc CS/trunk/data/shader-old/parallaxAtt/parallaxAtt.cgvp CS/trunk/plugins/engine/3d/light.cpp Modified: CS/trunk/data/shader/snippets/lighting/lightfuncs.cginc =================================================================== --- CS/trunk/data/shader/snippets/lighting/lightfuncs.cginc 2008-07-24 15:42:04 UTC (rev 30521) +++ CS/trunk/data/shader/snippets/lighting/lightfuncs.cginc 2008-07-24 16:11:51 UTC (rev 30522) @@ -264,9 +264,9 @@ float lightDist = lightSpace.GetLightDistance(); half attn; - float attnRadius = lightAttenuationVec.w; - if (attnRadius > 0) - attn = Attenuation_Linear (lightDist, 1 / attnRadius); + float invAttnRadius = lightAttenuationVec.w; + if (invAttnRadius > 0) + attn = Attenuation_Linear (lightDist, invAttnRadius); else attn = Attenuation_CLQ (lightDist, lightAttenuationVec.xyz); Modified: CS/trunk/data/shader-old/parallaxAtt/parallaxAtt.cgvp =================================================================== --- CS/trunk/data/shader-old/parallaxAtt/parallaxAtt.cgvp 2008-07-24 15:42:04 UTC (rev 30521) +++ CS/trunk/data/shader-old/parallaxAtt/parallaxAtt.cgvp 2008-07-24 16:11:51 UTC (rev 30522) @@ -59,7 +59,7 @@ OUT.oLightDir = normalize(tangLight.xyz); OUT.oEyeVec = normalize(tangEyeVec.xyz); if (Attenuation.w > 0) - Attenuation.xy = float2 (Attenuation.w, 1/Attenuation.w); + Attenuation.xy = float2 (1.0f/Attenuation.w, Attenuation.w); OUT.Attenuation = -objLight*Attenuation.y*0.4 + 0.5; OUT.Attenuation.w = 0.5; Modified: CS/trunk/plugins/engine/3d/light.cpp =================================================================== --- CS/trunk/plugins/engine/3d/light.cpp 2008-07-24 15:42:04 UTC (rev 30521) +++ CS/trunk/plugins/engine/3d/light.cpp 2008-07-24 16:11:51 UTC (rev 30522) @@ -245,7 +245,7 @@ break; case CS_ATTN_LINEAR: // @@@ FIXME: cutoff distance != radius, really - attenuationConstants.Set (0, 0, 0, cutoffDistance); + attenuationConstants.Set (0, 0, 0, 1.0f/cutoffDistance); break; case CS_ATTN_INVERSE: attenuationConstants.Set (0, 1, 0, 0); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |