From de21da742d1f300d08681b08fe816ebc064b0526 Mon Sep 17 00:00:00 2001 From: havoc Date: Sun, 27 May 2007 05:57:48 +0000 Subject: [PATCH] fixed recently introduced bug that made lightmapintensity affect dlights and rtlights git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@7373 d7cf8633-e32d-0410-b094-e92efae38249 --- gl_rmain.c | 3 +++ model_shared.h | 2 ++ r_shadow.c | 6 +++--- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/gl_rmain.c b/gl_rmain.c index 3c23d277..2d989ca1 100644 --- a/gl_rmain.c +++ b/gl_rmain.c @@ -3320,6 +3320,7 @@ void R_UpdateTextureInfo(const entity_render_t *ent, texture_t *t) t->specularscale = r_shadow_gloss2intensity.value; } + VectorClear(t->dlightcolor); t->currentnumlayers = 0; if (!(t->currentmaterialflags & MATERIALFLAG_NODRAW)) { @@ -3366,6 +3367,8 @@ void R_UpdateTextureInfo(const entity_render_t *ent, texture_t *t) else { float colorscale; + // set the color tint used for lights affecting this surface + VectorSet(t->dlightcolor, ent->colormod[0] * t->currentalpha, ent->colormod[1] * t->currentalpha, ent->colormod[2] * t->currentalpha); colorscale = 2; // q3bsp has no lightmap updates, so the lightstylevalue that // would normally be baked into the lightmap must be diff --git a/model_shared.h b/model_shared.h index 0773c3d1..1ce9f2e5 100644 --- a/model_shared.h +++ b/model_shared.h @@ -452,6 +452,8 @@ typedef struct texture_s rtexture_t *backgroundglosstexture; float specularscale; float specularpower; + // color tint (colormod * currentalpha) used for rtlighting this material + float dlightcolor[3]; // from q3 shaders int customblendfunc[2]; diff --git a/r_shadow.c b/r_shadow.c index b04f3575..377acc5d 100644 --- a/r_shadow.c +++ b/r_shadow.c @@ -2224,9 +2224,9 @@ void R_Shadow_RenderLighting(int firstvertex, int numvertices, int numtriangles, float ambientscale, diffusescale, specularscale; vec3_t lightcolorbase, lightcolorpants, lightcolorshirt; // calculate colors to render this texture with - lightcolorbase[0] = rsurface.rtlight->currentcolor[0] * rsurface.texture->currentlayers[0].color[0] * rsurface.texture->currentlayers[0].color[3]; - lightcolorbase[1] = rsurface.rtlight->currentcolor[1] * rsurface.texture->currentlayers[0].color[1] * rsurface.texture->currentlayers[0].color[3]; - lightcolorbase[2] = rsurface.rtlight->currentcolor[2] * rsurface.texture->currentlayers[0].color[2] * rsurface.texture->currentlayers[0].color[3]; + lightcolorbase[0] = rsurface.rtlight->currentcolor[0] * rsurface.texture->dlightcolor[0]; + lightcolorbase[1] = rsurface.rtlight->currentcolor[1] * rsurface.texture->dlightcolor[1]; + lightcolorbase[2] = rsurface.rtlight->currentcolor[2] * rsurface.texture->dlightcolor[2]; ambientscale = rsurface.rtlight->ambientscale; diffusescale = rsurface.rtlight->diffusescale; specularscale = rsurface.rtlight->specularscale * rsurface.texture->specularscale; -- 2.39.2