From c04c6c000df81d80f8d762ed0c4acb2cdc38cf4d Mon Sep 17 00:00:00 2001 From: havoc Date: Fri, 16 Oct 2009 18:31:38 +0000 Subject: [PATCH] added r_shadow_dot3 cvar to control whether GL1.3 hardware uses dot3 bumpmapping or not, since on older hardware it can be quite demanding it defaults off changed default of gl_combine back to 1 now that the only expensive feature (dot3 bumpmapping) is on a separate cvar git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@9342 d7cf8633-e32d-0410-b094-e92efae38249 --- r_shadow.c | 13 +++++++++++-- vid_shared.c | 2 +- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/r_shadow.c b/r_shadow.c index 7d4abfda..ea6d596f 100644 --- a/r_shadow.c +++ b/r_shadow.c @@ -260,6 +260,7 @@ rtexturepool_t *r_shadow_filters_texturepool; cvar_t r_shadow_bumpscale_basetexture = {0, "r_shadow_bumpscale_basetexture", "0", "generate fake bumpmaps from diffuse textures at this bumpyness, try 4 to match tenebrae, higher values increase depth, requires r_restart to take effect"}; cvar_t r_shadow_bumpscale_bumpmap = {0, "r_shadow_bumpscale_bumpmap", "4", "what magnitude to interpret _bump.tga textures as, higher values increase depth, requires r_restart to take effect"}; cvar_t r_shadow_debuglight = {0, "r_shadow_debuglight", "-1", "renders only one light, for level design purposes or debugging"}; +cvar_t r_shadow_dot3 = {CVAR_SAVE, "r_shadow_dot3", "0", "enables use of (slow) per pixel lighting on GL1.3 hardware"}; cvar_t r_shadow_usenormalmap = {CVAR_SAVE, "r_shadow_usenormalmap", "1", "enables use of directional shading on lights"}; cvar_t r_shadow_gloss = {CVAR_SAVE, "r_shadow_gloss", "1", "0 disables gloss (specularity) rendering, 1 uses gloss if textures are found, 2 forces a flat metallic specular effect on everything without textures (similar to tenebrae)"}; cvar_t r_shadow_gloss2intensity = {0, "r_shadow_gloss2intensity", "0.125", "how bright the forced flat gloss should look if r_shadow_gloss is 2"}; @@ -660,6 +661,7 @@ void R_Shadow_Init(void) { Cvar_RegisterVariable(&r_shadow_bumpscale_basetexture); Cvar_RegisterVariable(&r_shadow_bumpscale_bumpmap); + Cvar_RegisterVariable(&r_shadow_dot3); Cvar_RegisterVariable(&r_shadow_usenormalmap); Cvar_RegisterVariable(&r_shadow_debuglight); Cvar_RegisterVariable(&r_shadow_gloss); @@ -1791,7 +1793,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_textureunits.integer >= 2 && gl_combine.integer && gl_stencil) + else if (gl_dot3arb && gl_texturecubemap && r_shadow_dot3.integer && gl_stencil) r_shadow_lightingrendermode = R_SHADOW_RENDERMODE_LIGHT_DOT3; else r_shadow_lightingrendermode = R_SHADOW_RENDERMODE_LIGHT_VERTEX; @@ -2087,6 +2089,13 @@ init_done: void R_Shadow_RenderMode_Lighting(qboolean stenciltest, qboolean transparent, qboolean shadowmapping) { + if (transparent) + { + r_shadow_lightscissor[0] = r_refdef.view.viewport.x; + r_shadow_lightscissor[1] = r_refdef.view.viewport.y; + r_shadow_lightscissor[2] = r_refdef.view.viewport.width; + r_shadow_lightscissor[3] = r_refdef.view.viewport.height; + } CHECKGLERROR R_Shadow_RenderMode_Reset(); GL_BlendFunc(GL_SRC_ALPHA, GL_ONE); @@ -3291,7 +3300,7 @@ static void R_Shadow_RenderLighting_Light_Vertex(int firstvertex, int numvertice m.pointer_texcoord_bufferoffset[1] = rsurface.vertex3f_bufferoffset; if (r_textureunits.integer >= 3) { - // Voodoo4 or Kyro (or Geforce3/Radeon with gl_combine off) + // Voodoo4 or Kyro (or Geforce3/Radeon with r_shadow_dot3 off) m.tex[2] = R_GetTexture(r_shadow_attenuation2dtexture); m.texmatrix[2] = rsurface.entitytoattenuationz; m.pointer_texcoord3f[2] = rsurface.vertex3f; diff --git a/vid_shared.c b/vid_shared.c index a53a4da9..2af26943 100644 --- a/vid_shared.c +++ b/vid_shared.c @@ -108,7 +108,7 @@ cvar_t vid_mouse = {CVAR_SAVE, "vid_mouse", "1", "whether to use the mouse in wi cvar_t vid_grabkeyboard = {CVAR_SAVE, "vid_grabkeyboard", "0", "whether to grab the keyboard when mouse is active (prevents use of volume control keys, music player keys, etc on some keyboards)"}; cvar_t vid_minwidth = {0, "vid_minwidth", "0", "minimum vid_width that is acceptable (to be set in default.cfg in mods)"}; cvar_t vid_minheight = {0, "vid_minheight", "0", "minimum vid_height that is acceptable (to be set in default.cfg in mods)"}; -cvar_t gl_combine = {0, "gl_combine", "0", "enables slow but advanced rendering techniques using GL_ARB_texture_env_combine extension (part of OpenGL 1.3 and above)"}; +cvar_t gl_combine = {0, "gl_combine", "1", "enables faster rendering using GL_ARB_texture_env_combine extension (part of OpenGL 1.3 and above)"}; cvar_t gl_finish = {0, "gl_finish", "0", "make the cpu wait for the graphics processor at the end of each rendered frame (can help with strange input or video lag problems on some machines)"}; cvar_t vid_stick_mouse = {CVAR_SAVE, "vid_stick_mouse", "0", "have the mouse stuck in the center of the screen" }; -- 2.39.2