From: vortex Date: Sat, 23 Apr 2011 00:40:44 +0000 (+0000) Subject: R_LightPoint: fix glitch. Add checking for worldmodel->lit to R_LightPoint and R_Comp... X-Git-Tag: xonotic-v0.6.0~163^2~471 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=5329f72efb4a855e1d3caac8434e816fe8d3da5e;p=xonotic%2Fdarkplaces.git R_LightPoint: fix glitch. Add checking for worldmodel->lit to R_LightPoint and R_CompleteLightPoint. git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11075 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/gl_rmain.c b/gl_rmain.c index bd81b6ef..07228b6e 100644 --- a/gl_rmain.c +++ b/gl_rmain.c @@ -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)) { diff --git a/r_shadow.c b/r_shadow.c index 004b0c40..5b2a8190 100644 --- a/r_shadow.c +++ b/r_shadow.c @@ -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);