]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - gl_rmain.c
experimental feature to load the alpha channel of foo.jpg from foo_alpha.jpg (JPEG...
[xonotic/darkplaces.git] / gl_rmain.c
index 48334387371277aaf8beda1da6d2e0d51d3c4248..43bc3880f12966fb186f1d3aee7208613859811a 100644 (file)
@@ -2872,6 +2872,7 @@ void R_Main_ResizeViewCache(void)
 {
        int numentities = r_refdef.scene.numentities;
        int numclusters = r_refdef.scene.worldmodel ? r_refdef.scene.worldmodel->brush.num_pvsclusters : 1;
+       int numclusterbytes = r_refdef.scene.worldmodel ? r_refdef.scene.worldmodel->brush.num_pvsclusterbytes : 1;
        int numleafs = r_refdef.scene.worldmodel ? r_refdef.scene.worldmodel->brush.num_leafs : 1;
        int numsurfaces = r_refdef.scene.worldmodel ? r_refdef.scene.worldmodel->num_surfaces : 1;
        if (r_refdef.viewcache.maxentities < numentities)
@@ -2884,9 +2885,10 @@ void R_Main_ResizeViewCache(void)
        if (r_refdef.viewcache.world_numclusters != numclusters)
        {
                r_refdef.viewcache.world_numclusters = numclusters;
+               r_refdef.viewcache.world_numclusterbytes = numclusterbytes;
                if (r_refdef.viewcache.world_pvsbits)
                        Mem_Free(r_refdef.viewcache.world_pvsbits);
-               r_refdef.viewcache.world_pvsbits = Mem_Alloc(r_main_mempool, (r_refdef.viewcache.world_numclusters+7)>>3);
+               r_refdef.viewcache.world_pvsbits = Mem_Alloc(r_main_mempool, r_refdef.viewcache.world_numclusterbytes);
        }
        if (r_refdef.viewcache.world_numleafs != numleafs)
        {
@@ -8322,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;
@@ -8449,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;
@@ -8504,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;
@@ -8513,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);