]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
fixed recently introduced bug that made lightmapintensity affect dlights
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 27 May 2007 05:57:48 +0000 (05:57 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 27 May 2007 05:57:48 +0000 (05:57 +0000)
and rtlights

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@7373 d7cf8633-e32d-0410-b094-e92efae38249

gl_rmain.c
model_shared.h
r_shadow.c

index 3c23d277e6e24f7d98e02ff796c7c74a7ddfce3a..2d989ca1be8c8d782cf886483d187bc1a02f60c6 100644 (file)
@@ -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
index 0773c3d1de431bac76d08a35d467781291c7da0b..1ce9f2e525140a076711b381653e3b97a64f83ed 100644 (file)
@@ -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];
index b04f3575b9053e00dac280a42486087cbcfbcb3a..377acc5d581e24e21de4d532c8ed8654778f0cd7 100644 (file)
@@ -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;