no longer checking texture_t->currentalpha < 1 in
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 14 Nov 2009 19:28:56 +0000 (19:28 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 14 Nov 2009 19:28:56 +0000 (19:28 +0000)
R_DecalSystem_SplatEntity because it is falsely (?) failing to apply
decals to player models in Nexuiz
added cl_decals_newsystem_intensitymultiplier cvar (default 2) to make
decals more visible

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

cl_particles.c
gl_rmain.c

index 70dc7cc..3cd1401 100644 (file)
@@ -215,6 +215,7 @@ cvar_t cl_decals_visculling = {CVAR_SAVE, "cl_decals_visculling", "1", "perform
 cvar_t cl_decals_time = {CVAR_SAVE, "cl_decals_time", "20", "how long before decals start to fade away"};
 cvar_t cl_decals_fadetime = {CVAR_SAVE, "cl_decals_fadetime", "1", "how long decals take to fade away"};
 cvar_t cl_decals_newsystem = {CVAR_SAVE, "cl_decals_newsystem", "0", "enables new advanced decal system"};
+cvar_t cl_decals_newsystem_intensitymultiplier = {CVAR_SAVE, "cl_decals_newsystem_intensitymultiplier", "2", "boosts intensity of decals (because the distance fade can make them hard to see otherwise)"};
 cvar_t cl_decals_models = {CVAR_SAVE, "cl_decals_models", "0", "enables decals on animated models (if newsystem is also 1)"};
 cvar_t cl_decals_bias = {CVAR_SAVE, "cl_decals_bias", "0.125", "distance to bias decals from surface to prevent depth fighting"};
 
@@ -498,6 +499,7 @@ void CL_Particles_Init (void)
        Cvar_RegisterVariable (&cl_decals_time);
        Cvar_RegisterVariable (&cl_decals_fadetime);
        Cvar_RegisterVariable (&cl_decals_newsystem);
+       Cvar_RegisterVariable (&cl_decals_newsystem_intensitymultiplier);
        Cvar_RegisterVariable (&cl_decals_models);
        Cvar_RegisterVariable (&cl_decals_bias);
 }
index cffd200..43bc388 100644 (file)
@@ -8324,6 +8324,7 @@ void R_DecalSystem_SpawnTriangle(decalsystem_t *decalsystem, const float *v0, co
 
 extern cvar_t cl_decals_bias;
 extern cvar_t cl_decals_models;
+extern cvar_t cl_decals_newsystem_intensitymultiplier;
 void R_DecalSystem_SplatEntity(entity_render_t *ent, const vec3_t worldorigin, const vec3_t worldnormal, float r, float g, float b, float a, float s1, float t1, float s2, float t2, float worldsize)
 {
        matrix4x4_t projection;
@@ -8451,8 +8452,6 @@ void R_DecalSystem_SplatEntity(entity_render_t *ent, const vec3_t worldorigin, c
                        continue;
                if (texture->surfaceflags & Q3SURFACEFLAG_NOMARKS)
                        continue;
-               if (texture->currentalpha < 1)
-                       continue;
                if (!dynamic && !BoxesOverlap(surface->mins, surface->maxs, localmins, localmaxs))
                        continue;
                numvertices = surface->num_vertices;
@@ -8506,8 +8505,8 @@ void R_DecalSystem_SplatEntity(entity_render_t *ent, const vec3_t worldorigin, c
                                tc[cornerindex][0] = (temp[1]+1.0f)*0.5f * (s2-s1) + s1;
                                tc[cornerindex][1] = (temp[2]+1.0f)*0.5f * (t2-t1) + t1;
                                // calculate distance fade from the projection origin
-                               f = a * (1.0f-fabs(temp[0]));
-                               f = max(0.0f, f);
+                               f = a * (1.0f-fabs(temp[0])) * cl_decals_newsystem_intensitymultiplier.value;
+                               f = bound(0.0f, f, 1.0f);
                                c[cornerindex][0] = r * f;
                                c[cornerindex][1] = g * f;
                                c[cornerindex][2] = b * f;
@@ -8515,7 +8514,7 @@ void R_DecalSystem_SplatEntity(entity_render_t *ent, const vec3_t worldorigin, c
                                //VectorMA(v[cornerindex], cl_decals_bias.value, localnormal, v[cornerindex]);
                        }
                        if (dynamic)
-                               R_DecalSystem_SpawnTriangle(decalsystem, v[0], v[1], v[2], tc[0], tc[1], tc[2], c[0], c[1], c[2], triangleindex);
+                               R_DecalSystem_SpawnTriangle(decalsystem, v[0], v[1], v[2], tc[0], tc[1], tc[2], c[0], c[1], c[2], triangleindex+surface->num_firsttriangle);
                        else
                                for (cornerindex = 0;cornerindex < numpoints-2;cornerindex++)
                                        R_DecalSystem_SpawnTriangle(decalsystem, v[0], v[cornerindex+1], v[cornerindex+2], tc[0], tc[cornerindex+1], tc[cornerindex+2], c[0], c[cornerindex+1], c[cornerindex+2], -1);