]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
don't render skymasking polygons when noclipping
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 4 Apr 2006 13:49:12 +0000 (13:49 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 4 Apr 2006 13:49:12 +0000 (13:49 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@6248 d7cf8633-e32d-0410-b094-e92efae38249

gl_rmain.c
gl_rsurf.c
render.h

index d5c180eeebe9bc423b647d72b2037dd2f29884ba..c9f1f0aa75ee96fb3cf9dfbaaa1029191dbe1cc1 100644 (file)
@@ -87,6 +87,7 @@ cvar_t r_fullbright = {0, "r_fullbright","0", "make everything bright cheat (not
 cvar_t r_wateralpha = {CVAR_SAVE, "r_wateralpha","1", "opacity of water polygons"};
 cvar_t r_dynamic = {CVAR_SAVE, "r_dynamic","1", "enables dynamic lights (rocket glow and such)"};
 cvar_t r_fullbrights = {CVAR_SAVE, "r_fullbrights", "1", "enables glowing pixels in quake textures (changes need r_restart to take effect)"};
+cvar_t r_q1bsp_skymasking = {0, "r_qb1sp_skymasking", "1", "allows sky polygons in quake1 maps to obscure other geometry"};
 
 cvar_t gl_fogenable = {0, "gl_fogenable", "0", "nehahra fog enable (for Nehahra compatibility only)"};
 cvar_t gl_fogdensity = {0, "gl_fogdensity", "0.25", "nehahra fog density (recommend values below 0.1) (for Nehahra compatibility only)"};
@@ -1062,6 +1063,7 @@ void GL_Main_Init(void)
        Cvar_RegisterVariable(&r_wateralpha);
        Cvar_RegisterVariable(&r_dynamic);
        Cvar_RegisterVariable(&r_fullbright);
+       Cvar_RegisterVariable(&r_q1bsp_skymasking);
        Cvar_RegisterVariable(&r_textureunits);
        Cvar_RegisterVariable(&r_glsl);
        Cvar_RegisterVariable(&r_glsl_offsetmapping);
@@ -2762,11 +2764,13 @@ static void R_DrawTextureSurfaceList(const entity_render_t *ent, texture_t *text
                                R_Mesh_Matrix(&ent->matrix);
                        }
                        GL_DepthMask(true);
-                       // LordHavoc: HalfLife maps have freaky skypolys...
-                       // LordHavoc: Quake3 never did sky masking (unlike software Quake
-                       // and Quake2), so disable the sky masking in Quake3 maps as it
-                       // causes problems with q3map2 sky tricks
-                       if (!model->brush.ishlbsp && model->type != mod_brushq3)
+                       // LordHavoc: HalfLife maps have freaky skypolys so don't use
+                       // skymasking on them, and Quake3 never did sky masking (unlike
+                       // software Quake and software Quake2), so disable the sky masking
+                       // in Quake3 maps as it causes problems with q3map2 sky tricks,
+                       // and skymasking also looks very bad when noclipping outside the
+                       // level, so don't use it then either.
+                       if (model->type == mod_brushq1 && r_q1bsp_skymasking.integer && !r_worldnovis)
                        {
                                GL_Color(fogcolor[0], fogcolor[1], fogcolor[2], 1);
                                memset(&m, 0, sizeof(m));
index 912b48f17997a4d5f229efa5e590e7615194f1ca..fd8107175e101ff050d95dda3ff32849ddd4a089 100644 (file)
@@ -40,6 +40,8 @@ unsigned char r_pvsbits[(32768+7)>>3];
 unsigned char r_worldleafvisible[32768];
 // TODO: dynamic resize according to r_refdef.worldmodel->num_surfaces
 unsigned char r_worldsurfacevisible[262144];
+// if true, the view is currently in a leaf without pvs data
+qboolean r_worldnovis;
 
 /*
 ===============
@@ -418,6 +420,8 @@ void R_WorldVisibility(void)
                memset(r_worldsurfacevisible, 0, model->num_surfaces);
                memset(r_worldleafvisible, 0, model->brush.num_leafs);
 
+               r_worldnovis = false;
+
                // if floating around in the void (no pvs data available, and no
                // portals available), simply use all on-screen leafs.
                if (!viewleaf || viewleaf->clusterindex < 0)
@@ -425,6 +429,7 @@ void R_WorldVisibility(void)
                        // no visibility method: (used when floating around in the void)
                        // simply cull each leaf to the frustum (view pyramid)
                        // similar to quake's RecursiveWorldNode but without cache misses
+                       r_worldnovis = true;
                        for (j = 0, leaf = model->brush.data_leafs;j < model->brush.num_leafs;j++, leaf++)
                        {
                                // if leaf is in current pvs and on the screen, mark its surfaces
index 52d3afb7dbbdc45d9d3ae67b358de4e2e781fea4..9fc52ba1ed17986e1bcd92660337329469870167 100644 (file)
--- a/render.h
+++ b/render.h
@@ -29,6 +29,8 @@ extern unsigned char r_pvsbits[(32768+7)>>3];
 extern unsigned char r_worldleafvisible[32768];
 // TODO: dynamic resize according to r_refdef.worldmodel->num_surfaces
 extern unsigned char r_worldsurfacevisible[262144];
+// if true, the view is currently in a leaf without pvs data
+extern qboolean r_worldnovis;
 
 // 1.0f / N table
 extern float ixtable[4096];