Stefan Dösinger : wined3d: Fix the spot light falloff == 0.0 case.

Alexandre Julliard julliard at wine.codeweavers.com
Tue Aug 28 07:50:09 CDT 2007


Module: wine
Branch: master
Commit: a8d4779f7f0c74573efef72434fd5e831d85b049
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=a8d4779f7f0c74573efef72434fd5e831d85b049

Author: Stefan Dösinger <stefan at codeweavers.com>
Date:   Mon Aug 20 22:10:36 2007 +0200

wined3d: Fix the spot light falloff == 0.0 case.

---

 dlls/wined3d/device.c |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index d14ad30..4544bf8 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -2557,12 +2557,17 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetLight(IWineD3DDevice *iface, DWORD I
          * furthermore if still used, probably nobody pays attention to such details.
          */
         if (pLight->Falloff == 0) {
-            rho = 6.28f;
+            /* Falloff = 0 is easy, because d3d's and opengl's spot light equations have the
+             * falloff resp. exponent parameter as an exponent, so the spot light lighting
+             * will always be 1.0 for both of them, and we don't have to care for the
+             * rest of the rather complex calculation
+             */
+            object->exponent = 0;
         } else {
             rho = pLight->Theta + (pLight->Phi - pLight->Theta)/(2*pLight->Falloff);
+            if (rho < 0.0001) rho = 0.0001f;
+            object->exponent = -0.3/log(cos(rho/2));
         }
-        if (rho < 0.0001) rho = 0.0001f;
-        object->exponent = -0.3/log(cos(rho/2));
 	if (object->exponent > 128.0) {
 		object->exponent = 128.0;
 	}




More information about the wine-cvs mailing list