renamed gl_stencil to vid.stencil
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 7 Dec 2009 16:00:13 +0000 (16:00 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 7 Dec 2009 16:00:13 +0000 (16:00 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@9553 d7cf8633-e32d-0410-b094-e92efae38249

cl_screen.c
gl_rmain.c
menu.c
r_shadow.c
vid.h
vid_shared.c

index 5824882..50ff644 100644 (file)
@@ -1492,7 +1492,7 @@ void R_ClearScreen(qboolean fogcolor)
                qglClearColor(0,0,0,0);CHECKGLERROR
        }
        qglClearDepth(1);CHECKGLERROR
-       if (gl_stencil)
+       if (vid.stencil)
        {
                // LordHavoc: we use a stencil centered around 128 instead of 0,
                // to avoid clamping interfering with strange shadow volume
@@ -1500,7 +1500,7 @@ void R_ClearScreen(qboolean fogcolor)
                qglClearStencil(128);CHECKGLERROR
        }
        // clear the screen
-       GL_Clear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | (gl_stencil ? GL_STENCIL_BUFFER_BIT : 0));
+       GL_Clear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | (vid.stencil ? GL_STENCIL_BUFFER_BIT : 0));
        // set dithering mode
        if (gl_dither.integer)
        {
index aab246b..e507002 100644 (file)
@@ -3944,7 +3944,7 @@ void R_SetupView(qboolean allowwaterclippingplane)
 
        if (!r_refdef.view.useperspective)
                R_Viewport_InitOrtho(&r_refdef.view.viewport, &r_refdef.view.matrix, r_refdef.view.x, vid.height - r_refdef.view.height - r_refdef.view.y, r_refdef.view.width, r_refdef.view.height, -r_refdef.view.ortho_x, -r_refdef.view.ortho_y, r_refdef.view.ortho_x, r_refdef.view.ortho_y, -r_refdef.farclip, r_refdef.farclip, customclipplane);
-       else if (gl_stencil && r_useinfinitefarclip.integer)
+       else if (vid.stencil && r_useinfinitefarclip.integer)
                R_Viewport_InitPerspectiveInfinite(&r_refdef.view.viewport, &r_refdef.view.matrix, r_refdef.view.x, vid.height - r_refdef.view.height - r_refdef.view.y, r_refdef.view.width, r_refdef.view.height, r_refdef.view.frustum_x, r_refdef.view.frustum_y, r_refdef.nearclip, customclipplane);
        else
                R_Viewport_InitPerspective(&r_refdef.view.viewport, &r_refdef.view.matrix, r_refdef.view.x, vid.height - r_refdef.view.height - r_refdef.view.y, r_refdef.view.width, r_refdef.view.height, r_refdef.view.frustum_x, r_refdef.view.frustum_y, r_refdef.nearclip, r_refdef.farclip, customclipplane);
@@ -4792,9 +4792,9 @@ void R_UpdateVariables(void)
        r_refdef.shadowpolygonoffset = r_refdef.polygonoffset + r_shadow_polygonoffset.value * (r_shadow_frontsidecasting.integer ? 1 : -1);
 
        r_refdef.scene.rtworld = r_shadow_realtime_world.integer != 0;
-       r_refdef.scene.rtworldshadows = r_shadow_realtime_world_shadows.integer && gl_stencil;
+       r_refdef.scene.rtworldshadows = r_shadow_realtime_world_shadows.integer && vid.stencil;
        r_refdef.scene.rtdlight = (r_shadow_realtime_world.integer || r_shadow_realtime_dlight.integer) && !gl_flashblend.integer && r_dynamic.integer;
-       r_refdef.scene.rtdlightshadows = r_refdef.scene.rtdlight && r_shadow_realtime_dlight_shadows.integer && gl_stencil;
+       r_refdef.scene.rtdlightshadows = r_refdef.scene.rtdlight && r_shadow_realtime_dlight_shadows.integer && vid.stencil;
        r_refdef.lightmapintensity = r_refdef.scene.rtworld ? r_shadow_realtime_world_lightmaps.value : 1;
        if (r_showsurfaces.integer)
        {
diff --git a/menu.c b/menu.c
index 7dd5ddc..9b17c58 100644 (file)
--- a/menu.c
+++ b/menu.c
@@ -2884,7 +2884,7 @@ static void M_Video_Draw (void)
        // Current and Proposed Resolution
        M_Print(16, video_cursor_table[t] - 12, "    Current Resolution");
        if (vid_supportrefreshrate && vid.userefreshrate && vid.fullscreen)
-               M_Print(220, video_cursor_table[t] - 12, va("%dx%d %dhz", vid.width, vid.height, vid.refreshrate));
+               M_Print(220, video_cursor_table[t] - 12, va("%dx%d %.2fhz", vid.width, vid.height, vid.refreshrate));
        else
                M_Print(220, video_cursor_table[t] - 12, va("%dx%d", vid.width, vid.height));
        M_Print(16, video_cursor_table[t], "        New Resolution");
@@ -2909,7 +2909,7 @@ static void M_Video_Draw (void)
 
        // Refresh Rate
        M_ItemPrint(16, video_cursor_table[t], "          Refresh Rate", vid_supportrefreshrate && vid_userefreshrate.integer);
-       M_DrawSlider(220, video_cursor_table[t], vid_refreshrate.integer, 60, 150);
+       M_DrawSlider(220, video_cursor_table[t], vid_refreshrate.value, 50, 150);
        t++;
 
        // Fullscreen
@@ -2972,7 +2972,7 @@ static void M_Menu_Video_AdjustSliders (int dir)
        else if (video_cursor == t++)
                Cvar_SetValueQuick (&vid_userefreshrate, !vid_userefreshrate.integer);
        else if (video_cursor == t++)
-               Cvar_SetValueQuick (&vid_refreshrate, bound(60, vid_refreshrate.integer + dir, 150));
+               Cvar_SetValueQuick (&vid_refreshrate, bound(50, vid_refreshrate.value + dir, 150));
        else if (video_cursor == t++)
                Cvar_SetValueQuick (&vid_fullscreen, !vid_fullscreen.integer);
        else if (video_cursor == t++)
index 4413c06..bb86919 100644 (file)
@@ -1902,7 +1902,7 @@ void R_Shadow_RenderMode_Begin(void)
 
        if (r_glsl.integer && gl_support_fragment_shader)
                r_shadow_lightingrendermode = R_SHADOW_RENDERMODE_LIGHT_GLSL;
-       else if (gl_dot3arb && gl_texturecubemap && r_shadow_dot3.integer && gl_stencil)
+       else if (gl_dot3arb && gl_texturecubemap && r_shadow_dot3.integer && vid.stencil)
                r_shadow_lightingrendermode = R_SHADOW_RENDERMODE_LIGHT_DOT3;
        else
                r_shadow_lightingrendermode = R_SHADOW_RENDERMODE_LIGHT_VERTEX;
@@ -4391,7 +4391,7 @@ void R_DrawRTLight(rtlight_t *rtlight, qboolean visible)
                for (i = 0;i < numlightentities;i++)
                        R_Shadow_DrawEntityLight(lightentities[i]);
        }
-       else if (castshadows && gl_stencil)
+       else if (castshadows && vid.stencil)
        {
                // draw stencil shadow volumes to mask off pixels that are in shadow
                // so that they won't receive lighting
@@ -4526,7 +4526,7 @@ void R_DrawModelShadows(void)
        vec3_t relativeshadowmins, relativeshadowmaxs;
        vec3_t tmp, shadowdir;
 
-       if (!r_drawentities.integer || !gl_stencil)
+       if (!r_drawentities.integer || !vid.stencil)
                return;
 
        CHECKGLERROR
diff --git a/vid.h b/vid.h
index 1b99140..af70fa5 100644 (file)
--- a/vid.h
+++ b/vid.h
@@ -43,14 +43,16 @@ typedef struct viddef_s
 {
        // these are set by VID_Mode
        viddef_mode_t mode;
+       // used in many locations in the renderer
        int width;
        int height;
        int bitsperpixel;
        qboolean fullscreen;
-       int refreshrate;
+       float refreshrate;
        qboolean userefreshrate;
        qboolean stereobuffer;
        int samples;
+       qboolean stencil;
 } viddef_t;
 
 // global video state
@@ -97,8 +99,6 @@ extern cvar_t v_color_white_g;
 extern cvar_t v_color_white_b;
 extern cvar_t v_hwgamma;
 
-extern int gl_stencil;
-
 // brand of graphics chip
 extern const char *gl_vendor;
 // graphics chip model and other information
index c5af66c..dcaf8a8 100644 (file)
@@ -29,8 +29,6 @@ int gl_combine_extension = false;
 int gl_supportslockarrays = false;
 // GLX_SGI_swap_control or WGL_EXT_swap_control
 int gl_videosyncavailable = false;
-// stencil available
-int gl_stencil = false;
 // 3D textures available
 int gl_texture3d = false;
 // GL_ARB_texture_cubemap
@@ -1265,7 +1263,7 @@ int VID_Mode(int fullscreen, int width, int height, int bpp, float refreshrate,
                vid.userefreshrate = vid.mode.userefreshrate;
                vid.stereobuffer   = vid.mode.stereobuffer;
                vid.samples        = vid.mode.samples;
-               gl_stencil         = vid.mode.bitsperpixel > 16;
+               vid.stencil        = vid.mode.bitsperpixel > 16;
                Con_Printf("Video Mode: %s %dx%dx%dx%.2fhz%s%s\n", mode.fullscreen ? "fullscreen" : "window", mode.width, mode.height, mode.bitsperpixel, mode.refreshrate, mode.stereobuffer ? " stereo" : "", mode.samples > 1 ? va(" (%ix AA)", mode.samples) : "");
 
                Cvar_SetValueQuick(&vid_fullscreen, vid.mode.fullscreen);