From: havoc Date: Tue, 4 Apr 2006 13:49:12 +0000 (+0000) Subject: don't render skymasking polygons when noclipping X-Git-Tag: xonotic-v0.1.0preview~4108 X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fdarkplaces.git;a=commitdiff_plain;h=97c801886c678d9442a1e02dead8f977de974551 don't render skymasking polygons when noclipping git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@6248 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/gl_rmain.c b/gl_rmain.c index d5c180ee..c9f1f0aa 100644 --- a/gl_rmain.c +++ b/gl_rmain.c @@ -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)); diff --git a/gl_rsurf.c b/gl_rsurf.c index 912b48f1..fd810717 100644 --- a/gl_rsurf.c +++ b/gl_rsurf.c @@ -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 diff --git a/render.h b/render.h index 52d3afb7..9fc52ba1 100644 --- 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];