]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - r_light.c
fix a signed/unsigned comparison in PR_UglyValueString
[xonotic/darkplaces.git] / r_light.c
index bd1bf3a8e00841b28bd769a5846937432c345c53..c393f558e3a248c81e1a9a517853a912c14d8ab9 100644 (file)
--- a/r_light.c
+++ b/r_light.c
@@ -252,8 +252,7 @@ static void R_RecursiveMarkLights(entity_render_t *ent, vec3_t lightorigin, rdli
                        {
                                surf->dlightbits[0] = surf->dlightbits[1] = surf->dlightbits[2] = surf->dlightbits[3] = surf->dlightbits[4] = surf->dlightbits[5] = surf->dlightbits[6] = surf->dlightbits[7] = 0;
                                surf->dlightframe = r_framecount;
-                               if (r_dlightmap.integer)
-                                       surf->cached_dlight = true;
+                               surf->cached_dlight = true;
                        }
                        surf->dlightbits[bitindex] |= bit;
                }
@@ -540,7 +539,9 @@ void R_LightModel_CalcVertexColors(const float *ambientcolor4f, const float *dif
        float color[4], v[3], dot, dist2, f, dnormal[3];
        nearlight_t *nl;
        usediffuse = DotProduct(diffusecolor, diffusecolor) > 0;
-       VectorCopy(diffusenormal, dnormal);
+       // negate the diffuse normal to avoid the need to negate the
+       // dotproduct on each vertex
+       VectorNegate(diffusenormal, dnormal);
        if (usediffuse)
                VectorNormalize(dnormal);
        // directional shading code here
@@ -551,7 +552,7 @@ void R_LightModel_CalcVertexColors(const float *ambientcolor4f, const float *dif
                // silly directional diffuse shading
                if (usediffuse)
                {
-                       dot = -DotProduct(normal3f, dnormal);
+                       dot = DotProduct(normal3f, dnormal);
                        if (dot > 0)
                                VectorMA(color, dot, diffusecolor, color);
                }