]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
fix some issues with r_hdr 1 (or r_hdr_scenebrightness) where
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 21 Dec 2009 14:01:32 +0000 (14:01 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 21 Dec 2009 14:01:32 +0000 (14:01 +0000)
r_refdef.view.colorscale was being misused

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

cl_particles.c
gl_rmain.c
r_lightning.c

index f607fab881c35f2c52ec2d63f56f73d8c0bbd0cb..5814ee236448c7a9fa20734e751f4633645e228c 100644 (file)
@@ -2209,7 +2209,7 @@ void R_DrawDecal_TransparentCallback(const entity_render_t *ent, const rtlight_t
        float *v3f, *t2f, *c4f;
        particletexture_t *tex;
        float right[3], up[3], size, ca;
-       float alphascale = (1.0f / 65536.0f) * cl_particles_alpha.value * r_refdef.view.colorscale;
+       float alphascale = (1.0f / 65536.0f) * cl_particles_alpha.value;
        float particle_vertex3f[BATCHSIZE*12], particle_texcoord2f[BATCHSIZE*8], particle_color4f[BATCHSIZE*16];
 
        RSurf_ActiveWorldEntity();
@@ -2392,15 +2392,28 @@ void R_DrawParticle_TransparentCallback(const entity_render_t *ent, const rtligh
 
                blendmode = p->blendmode;
 
-               c4f[0] = p->color[0] * colormultiplier[0];
-               c4f[1] = p->color[1] * colormultiplier[1];
-               c4f[2] = p->color[2] * colormultiplier[2];
-               c4f[3] = p->alpha * colormultiplier[3];
                switch (blendmode)
                {
                case PBLEND_INVALID:
                case PBLEND_INVMOD:
+                       c4f[0] = p->color[0] * (1.0f / 256.0f);
+                       c4f[1] = p->color[1] * (1.0f / 256.0f);
+                       c4f[2] = p->color[2] * (1.0f / 256.0f);
+                       c4f[3] = p->alpha * colormultiplier[3];
+                       // additive and modulate can just fade out in fog (this is correct)
+                       if (r_refdef.fogenabled)
+                               c4f[3] *= RSurf_FogVertex(p->org);
+                       // collapse alpha into color for these blends (so that the particlefont does not need alpha on most textures)
+                       c4f[0] *= c4f[3];
+                       c4f[1] *= c4f[3];
+                       c4f[2] *= c4f[3];
+                       c4f[3] = 1;
+                       break;
                case PBLEND_ADD:
+                       c4f[0] = p->color[0] * colormultiplier[0];
+                       c4f[1] = p->color[1] * colormultiplier[1];
+                       c4f[2] = p->color[2] * colormultiplier[2];
+                       c4f[3] = p->alpha * colormultiplier[3];
                        // additive and modulate can just fade out in fog (this is correct)
                        if (r_refdef.fogenabled)
                                c4f[3] *= RSurf_FogVertex(p->org);
@@ -2411,6 +2424,10 @@ void R_DrawParticle_TransparentCallback(const entity_render_t *ent, const rtligh
                        c4f[3] = 1;
                        break;
                case PBLEND_ALPHA:
+                       c4f[0] = p->color[0] * colormultiplier[0];
+                       c4f[1] = p->color[1] * colormultiplier[1];
+                       c4f[2] = p->color[2] * colormultiplier[2];
+                       c4f[3] = p->alpha * colormultiplier[3];
                        // note: lighting is not cheap!
                        if (particletype[p->typeindex].lighting)
                        {
index e5452b18d28f064a6fa4e19d709e963e3f9a1b09..5aa3ea88efe15f8d0180c7f0c439168f3239bccd 100644 (file)
@@ -6265,7 +6265,7 @@ texture_t *R_GetCurrentTexture(texture_t *t)
                        // were darkened by fog already, and we should not add fog color
                        // (because the background was not darkened, there is no fog color
                        // that was lost behind it).
-                       R_Texture_AddLayer(t, false, GL_SRC_ALPHA, (t->currentmaterialflags & MATERIALFLAG_BLENDED) ? GL_ONE : GL_ONE_MINUS_SRC_ALPHA, TEXTURELAYERTYPE_FOG, t->currentskinframe->fog, &t->currenttexmatrix, r_refdef.fogcolor[0] / r_refdef.view.colorscale, r_refdef.fogcolor[1] / r_refdef.view.colorscale, r_refdef.fogcolor[2] / r_refdef.view.colorscale, t->lightmapcolor[3]);
+                       R_Texture_AddLayer(t, false, GL_SRC_ALPHA, (t->currentmaterialflags & MATERIALFLAG_BLENDED) ? GL_ONE : GL_ONE_MINUS_SRC_ALPHA, TEXTURELAYERTYPE_FOG, t->currentskinframe->fog, &t->currenttexmatrix, r_refdef.fogcolor[0], r_refdef.fogcolor[1], r_refdef.fogcolor[2], t->lightmapcolor[3]);
                }
        }
 
index 212497a33e557a777dae149879c0a7af7b9cc85a..f4397149194bb30caa8803d9076e45d37c012fb0 100644 (file)
@@ -223,7 +223,7 @@ void R_DrawLightningBeam_TransparentCallback(const entity_render_t *ent, const r
        float vertex3f[12*3];
        float texcoord2f[12*2];
 
-       RSurf_ActiveCustomEntity(&identitymatrix, &identitymatrix, 0, 0, r_lightningbeam_color_red.value * r_refdef.view.colorscale, r_lightningbeam_color_green.value * r_refdef.view.colorscale, r_lightningbeam_color_blue.value * r_refdef.view.colorscale, 1, 12, vertex3f, texcoord2f, NULL, NULL, NULL, NULL, 6, r_lightningbeamelement3i, r_lightningbeamelement3s, false, false);
+       RSurf_ActiveCustomEntity(&identitymatrix, &identitymatrix, 0, 0, r_lightningbeam_color_red.value, r_lightningbeam_color_green.value, r_lightningbeam_color_blue.value, 1, 12, vertex3f, texcoord2f, NULL, NULL, NULL, NULL, 6, r_lightningbeamelement3i, r_lightningbeamelement3s, false, false);
 
        if (r_lightningbeam_qmbtexture.integer && r_lightningbeamqmbtexture == NULL)
                r_lightningbeams_setupqmbtexture();