]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
R_LightPoint: fix glitch. Add checking for worldmodel->lit to R_LightPoint and R_Comp...
authorvortex <vortex@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 23 Apr 2011 00:40:44 +0000 (00:40 +0000)
committerRudolf Polzer <divverent@alientrap.org>
Mon, 25 Apr 2011 19:30:20 +0000 (21:30 +0200)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11075 d7cf8633-e32d-0410-b094-e92efae38249
::stable-branch::merge=5329f72efb4a855e1d3caac8434e816fe8d3da5e

gl_rmain.c
r_shadow.c

index bd81b6ef564fe885751c7774234278321deb7e40..07228b6e863a9301b6a27425fe271ed21be73338 100644 (file)
@@ -4630,7 +4630,7 @@ static void R_View_UpdateEntityLighting (void)
                VectorClear(ent->modellight_ambient);
                VectorClear(ent->modellight_diffuse);
                VectorClear(tempdiffusenormal);
-               if ((ent->flags & RENDER_LIGHT) && r_refdef.scene.worldmodel && r_refdef.scene.worldmodel->brush.LightPoint)
+               if (ent->flags & RENDER_LIGHT)
                {
                        vec3_t org;
                        Matrix4x4_OriginFromMatrix(&ent->matrix, org);
@@ -7512,7 +7512,7 @@ texture_t *R_GetCurrentTexture(texture_t *t)
                t->currentmaterialflags |= MATERIALFLAG_FULLBRIGHT;
        else if (FAKELIGHT_ENABLED)
        {
-                       // no modellight if using fakelight for the map
+               // no modellight if using fakelight for the map
        }
        else if (rsurface.modeltexcoordlightmap2f == NULL && !(t->currentmaterialflags & MATERIALFLAG_FULLBRIGHT))
        {
index 004b0c4000afe5b43c60d5ec5978ca5ab35693ba..5b2a8190b38327019a438c751ec629f850caaca0 100644 (file)
@@ -6771,26 +6771,29 @@ void R_LightPoint(vec3_t color, const vec3_t p, const int flags)
        rtlight_t *light;
        dlight_t *dlight;
 
-       VectorClear(color);
-
        if (r_fullbright.integer)
        {
                VectorSet(color, 1, 1, 1);
                return;
        }
 
+       VectorClear(color);
+
        if (flags & LP_LIGHTMAP)
        {
-               if (!r_fullbright.integer && r_refdef.scene.worldmodel && r_refdef.scene.worldmodel->brush.LightPoint)
+               if (!r_fullbright.integer && r_refdef.scene.worldmodel && r_refdef.scene.worldmodel->lit && r_refdef.scene.worldmodel->brush.LightPoint)
                {
+                       VectorClear(diffuse);
                        r_refdef.scene.worldmodel->brush.LightPoint(r_refdef.scene.worldmodel, p, color, diffuse, n);
-                       color[0] += r_refdef.scene.ambient + diffuse[0];
-                       color[1] += r_refdef.scene.ambient + diffuse[1];
-                       color[2] += r_refdef.scene.ambient + diffuse[2];
+                       VectorAdd(color, diffuse, color);
                }
                else
                        VectorSet(color, 1, 1, 1);
+               color[0] += r_refdef.scene.ambient;
+               color[1] += r_refdef.scene.ambient;
+               color[2] += r_refdef.scene.ambient;
        }
+
        if (flags & LP_RTWORLD)
        {
                flag = r_refdef.scene.rtworld ? LIGHTFLAG_REALTIMEMODE : LIGHTFLAG_NORMALMODE;
@@ -6868,15 +6871,17 @@ void R_CompleteLightPoint(vec3_t ambient, vec3_t diffuse, vec3_t lightdir, const
                VectorSet(ambient, r_refdef.scene.ambient, r_refdef.scene.ambient, r_refdef.scene.ambient);
                VectorClear(diffuse);
                VectorClear(lightdir);
-               if (r_refdef.scene.worldmodel && r_refdef.scene.worldmodel->brush.LightPoint)
+               if (r_refdef.scene.worldmodel && r_refdef.scene.worldmodel->lit && r_refdef.scene.worldmodel->brush.LightPoint)
                        r_refdef.scene.worldmodel->brush.LightPoint(r_refdef.scene.worldmodel, p, ambient, diffuse, lightdir);
+               else
+                       VectorSet(ambient, 1, 1, 1);
                return;
        }
 
        memset(sample, 0, sizeof(sample));
        VectorSet(sample, r_refdef.scene.ambient, r_refdef.scene.ambient, r_refdef.scene.ambient);
 
-       if ((flags & LP_LIGHTMAP) && r_refdef.scene.worldmodel && r_refdef.scene.worldmodel->brush.LightPoint)
+       if ((flags & LP_LIGHTMAP) && r_refdef.scene.worldmodel && r_refdef.scene.worldmodel->lit && r_refdef.scene.worldmodel->brush.LightPoint)
        {
                vec3_t tempambient;
                VectorClear(tempambient);