]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - gl_rmain.c
(Round 4) Break up host_cmd.c
[xonotic/darkplaces.git] / gl_rmain.c
index b37bdcfdfd4feb2e28605383aac57cac0debd552..2bb72a67a0d4bfa985ca7ffd924ec2b3441fa302 100644 (file)
@@ -1914,7 +1914,7 @@ void R_SetupShader_Surface(const float rtlightambient[3], const float rtlightdif
        }
        if(!(blendfuncflags & BLENDFUNC_ALLOWS_ANYFOG))
                permutation &= ~(SHADERPERMUTATION_FOGHEIGHTTEXTURE | SHADERPERMUTATION_FOGOUTSIDE | SHADERPERMUTATION_FOGINSIDE);
-       if(blendfuncflags & BLENDFUNC_ALLOWS_FOG_HACKALPHA)
+       if(blendfuncflags & BLENDFUNC_ALLOWS_FOG_HACKALPHA && !notrippy)
                permutation |= SHADERPERMUTATION_FOGALPHAHACK;
        switch(vid.renderpath)
        {
@@ -1976,7 +1976,7 @@ void R_SetupShader_Surface(const float rtlightambient[3], const float rtlightdif
                                if (r_glsl_permutation->loc_DeferredMod_Specular >= 0) qglUniform3f(r_glsl_permutation->loc_DeferredMod_Specular, t->render_rtlight_specular[0], t->render_rtlight_specular[1], t->render_rtlight_specular[2]);
                        }
                        // additive passes are only darkened by fog, not tinted
-                       if (r_glsl_permutation->loc_FogColor >= 0)
+                       if (r_glsl_permutation->loc_FogColor >= 0 && !notrippy)
                        {
                                if(blendfuncflags & BLENDFUNC_ALLOWS_FOG_HACK0)
                                        qglUniform3f(r_glsl_permutation->loc_FogColor, 0, 0, 0);
@@ -2950,10 +2950,18 @@ static int componentorder[4] = {0, 1, 2, 3};
 
 static rtexture_t *R_LoadCubemap(const char *basename)
 {
-       int i, j, cubemapsize;
+       int i, j, cubemapsize, forcefilter;
        unsigned char *cubemappixels, *image_buffer;
        rtexture_t *cubemaptexture;
        char name[256];
+
+       // HACK: if the cubemap name starts with a !, the cubemap is nearest-filtered
+       forcefilter = TEXF_FORCELINEAR;
+       if (basename && basename[0] == '!')
+       {
+               basename++;
+               forcefilter = TEXF_FORCENEAREST;
+       }
        // must start 0 so the first loadimagepixels has no requested width/height
        cubemapsize = 0;
        cubemappixels = NULL;
@@ -2996,7 +3004,7 @@ static rtexture_t *R_LoadCubemap(const char *basename)
                if (developer_loading.integer)
                        Con_Printf("loading cubemap \"%s\"\n", basename);
 
-               cubemaptexture = R_LoadTextureCubeMap(r_main_texturepool, basename, cubemapsize, cubemappixels, vid.sRGB3D ? TEXTYPE_SRGB_BGRA : TEXTYPE_BGRA, (gl_texturecompression_lightcubemaps.integer && gl_texturecompression.integer ? TEXF_COMPRESS : 0) | TEXF_FORCELINEAR | TEXF_CLAMP, -1, NULL);
+               cubemaptexture = R_LoadTextureCubeMap(r_main_texturepool, basename, cubemapsize, cubemappixels, vid.sRGB3D ? TEXTYPE_SRGB_BGRA : TEXTYPE_BGRA, (gl_texturecompression_lightcubemaps.integer && gl_texturecompression.integer ? TEXF_COMPRESS : 0) | forcefilter | TEXF_CLAMP, -1, NULL);
                Mem_Free(cubemappixels);
        }
        else
@@ -4138,8 +4146,8 @@ static void R_View_UpdateEntityVisible (void)
                        {
                                samples = ent->last_trace_visibility == 0 ? r_cullentities_trace_tempentitysamples.integer : r_cullentities_trace_samples.integer;
                                if (R_CanSeeBox(samples, r_cullentities_trace_eyejitter.value, r_cullentities_trace_enlarge.value, r_cullentities_trace_expand.value, r_cullentities_trace_pad.value, r_refdef.view.origin, ent->mins, ent->maxs))
-                                       ent->last_trace_visibility = realtime;
-                               if (ent->last_trace_visibility < realtime - r_cullentities_trace_delay.value)
+                                       ent->last_trace_visibility = host.realtime;
+                               if (ent->last_trace_visibility < host.realtime - r_cullentities_trace_delay.value)
                                        r_refdef.viewcache.entityvisible[i] = 0;
                        }
                }
@@ -4631,7 +4639,7 @@ void R_RenderTarget_FreeUnused(qboolean force)
                // free resources for rendertargets that have not been used for a while
                // (note: this check is run after the frame render, so any targets used
                // this frame will not be affected even at low framerates)
-               if (r && (realtime - r->lastusetime > 0.2 || force))
+               if (r && (host.realtime - r->lastusetime > 0.2 || force))
                {
                        if (r->fbo)
                                R_Mesh_DestroyFramebufferObject(r->fbo);
@@ -4672,7 +4680,7 @@ r_rendertarget_t *R_RenderTarget_Get(int texturewidth, int textureheight, textyp
        for (i = 0; i < end; i++)
        {
                r = (r_rendertarget_t *)Mem_ExpandableArray_RecordAtIndex(&r_fb.rendertargets, i);
-               if (r && r->lastusetime != realtime && r->texturewidth == texturewidth && r->textureheight == textureheight && r->depthtextype == depthtextype && r->colortextype[0] == colortextype0 && r->colortextype[1] == colortextype1 && r->colortextype[2] == colortextype2 && r->colortextype[3] == colortextype3)
+               if (r && r->lastusetime != host.realtime && r->texturewidth == texturewidth && r->textureheight == textureheight && r->depthtextype == depthtextype && r->colortextype[0] == colortextype0 && r->colortextype[1] == colortextype1 && r->colortextype[2] == colortextype2 && r->colortextype[3] == colortextype3)
                        break;
        }
        if (i == end)
@@ -4701,7 +4709,7 @@ r_rendertarget_t *R_RenderTarget_Get(int texturewidth, int textureheight, textyp
        }
        r_refdef.stats[r_stat_rendertargets_used]++;
        r_refdef.stats[r_stat_rendertargets_pixels] += r->texturewidth * r->textureheight;
-       r->lastusetime = realtime;
+       r->lastusetime = host.realtime;
        R_CalcTexCoordsForView(0, 0, r->texturewidth, r->textureheight, r->texturewidth, r->textureheight, r->texcoord2f);
        return r;
 }