]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - r_light.c
moved the GL_CloseLibrary call a bit
[xonotic/darkplaces.git] / r_light.c
index a55de97171c3c217e715f2c3d2d4c7928a87a05b..fd18b086f2d48425f3ac35d32cbf13ebffd55d7e 100644 (file)
--- a/r_light.c
+++ b/r_light.c
@@ -125,7 +125,7 @@ void R_BuildLightList(void)
                        rd->cullradius = 2048.0f;
                rd->cullradius2 = rd->cullradius * rd->cullradius;
                rd->lightsubtract = 1.0f / rd->cullradius2;
-               rd->ent = cd->ent;
+               //rd->ent = cd->ent;
                r_numdlights++;
                c_dlights++; // count every dlight in use
        }
@@ -740,7 +740,7 @@ void R_ModelLightPoint (vec3_t color, vec3_t p, int *dlightbits)
 void R_LightModel(int numverts, float colorr, float colorg, float colorb, int worldcoords)
 {
        int i, j, nearlights = 0;
-       float color[3], basecolor[3], v[3], t, *av, *avn, *avc, a, number, f, dist2, mscale;
+       float color[3], basecolor[3], v[3], t, *av, *avn, *avc, a, f, dist2, mscale, dot;
        struct
        {
                vec3_t origin;
@@ -830,6 +830,7 @@ void R_LightModel(int numverts, float colorr, float colorg, float colorb, int wo
                        {
                                if (!(modeldlightbits[i >> 5] & (1 << (i & 31))))
                                        continue;
+                               /*
                                if (currentrenderentity == r_dlight[i].ent)
                                {
                                        f = (1.0f / LIGHTOFFSET) - nl->lightsubtract;
@@ -838,6 +839,7 @@ void R_LightModel(int numverts, float colorr, float colorg, float colorb, int wo
                                }
                                else
                                {
+                               */
                                        // transform the light into the model's coordinate system
                                        if (worldcoords)
                                                VectorCopy(r_dlight[i].origin, nl->origin);
@@ -854,7 +856,7 @@ void R_LightModel(int numverts, float colorr, float colorg, float colorb, int wo
                                        nl->offset = LIGHTOFFSET;
                                        nl++;
                                        nearlights++;
-                               }
+                               //}
                        }
                }
                else
@@ -875,8 +877,8 @@ void R_LightModel(int numverts, float colorr, float colorg, float colorb, int wo
                        {
                                VectorSubtract(nl->origin, av, v);
                                // directional shading
-                               a = DotProduct(avn,v);
-                               if (a > 0)
+                               dot = DotProduct(avn,v);
+                               if (dot > 0)
                                {
                                        // the vertex normal faces the light
 
@@ -888,18 +890,18 @@ void R_LightModel(int numverts, float colorr, float colorg, float colorb, int wo
                                                #if SLOWMATH
                                                t = 1.0f / sqrt(dist2);
                                                #else
-                                               number = DotProduct(v, v);
-                                               *((int *)&t) = 0x5f3759df - ((* (int *) &number) >> 1);
-                                               t = t * (1.5f - (number * 0.5f * t * t));
+                                               *((int *)&t) = 0x5f3759df - ((* (int *) &dist2) >> 1);
+                                               t = t * (1.5f - (dist2 * 0.5f * t * t));
                                                #endif
-                                               // a * t is dotproduct with a normalized v.
+
+                                               // dot * t is dotproduct with a normalized v.
                                                // (the result would be -1 to +1, but we already
                                                // eliminated the <= 0 case, so it is 0 to 1)
 
                                                // the hardness variables are for backlighting/shinyness
                                                // these have been hardwired at * 0.5 + 0.5 to match
                                                // the quake map lighting utility's equations
-                                               f *= a * t * 0.5f + 0.5f;// * hardness + hardnessoffset;
+                                               f *= dot * t * 0.5f + 0.5f;// * hardness + hardnessoffset;
                                                VectorMA(color, f, nl->light, color);
                                        }
                                }