From 40cfa92aa71ae6d61f72960e6fa4129242a5646c Mon Sep 17 00:00:00 2001 From: Jeff Teunissen Date: Tue, 9 Jan 2001 00:45:54 +0000 Subject: [PATCH] The gl_texsort cvar is gone. It did not do anything but disable multitexture, so I replaced it with a gl_multitexture cvar. It defaults off. Set gl_multitexture nonzero to enable it, but be warned that multitexturing and sorted textures are currently incompatible; this means that if you enable texturing, your textures will not be sorted and you may or may not get better performance. Made the following Cvars archived in GL: r_shadows, gl_affinemodels, gl_cull, gl_flashblend, gl_keeptjunctions, gl_multitexture, gl_particles, gl_sky_clip, gl_skymultipass, gl_smoothdlights. --- source/gl_rmain.c | 8 ++-- source/gl_rmisc.c | 99 ++++++++++++++--------------------------------- source/gl_rsurf.c | 47 ++++++++-------------- 3 files changed, 51 insertions(+), 103 deletions(-) diff --git a/source/gl_rmain.c b/source/gl_rmain.c index d7776fe..dd65e44 100644 --- a/source/gl_rmain.c +++ b/source/gl_rmain.c @@ -113,7 +113,6 @@ cvar_t *r_netgraph; cvar_t *gl_clear; cvar_t *gl_cull; -cvar_t *gl_texsort; cvar_t *gl_smooth; cvar_t *gl_smoothdlights; cvar_t *gl_affinemodels; @@ -123,15 +122,16 @@ cvar_t *gl_nocolors; cvar_t *gl_keeptjunctions; cvar_t *gl_particles; cvar_t *gl_lerp_anim; +cvar_t *gl_fb_models; +cvar_t *gl_fb_bmodels; +cvar_t *gl_texsort; +cvar_t *gl_multitexture; cvar_t *r_skyname; cvar_t *gl_skymultipass; cvar_t *gl_sky_clip; cvar_t *gl_sky_divide; -cvar_t *gl_fb_models; -cvar_t *gl_fb_bmodels; - cvar_t *brighten; extern cvar_t *scr_fov; diff --git a/source/gl_rmisc.c b/source/gl_rmisc.c index ceadd02..310991a 100644 --- a/source/gl_rmisc.c +++ b/source/gl_rmisc.c @@ -208,57 +208,40 @@ void R_Init_Cvars (void) { r_norefresh = Cvar_Get ("r_norefresh", "0", CVAR_NONE, "Set to 1 to disable display refresh"); - r_drawentities = Cvar_Get ("r_drawentities", "1", CVAR_NONE, "Set to 0 to disable drawing entities"); - r_drawviewmodel = Cvar_Get ("r_drawviewmodel", "1", CVAR_ARCHIVE, "Set to 0 to disable drawing your weapon"); - r_shadows = Cvar_Get ("r_shadows", "0", CVAR_NONE, "Set to 1 to enable shadows for entities"); - r_wateralpha = Cvar_Get ("r_wateralpha", "1", CVAR_NONE, "Determine opacity of liquids. 1 is solid," - ".75, .50, and .25 are partially transparent, and 0 is transparent."); + r_drawentities = Cvar_Get ("r_drawentities", "1", CVAR_NONE, "Toggles drawing of entities (almost everything but the world)"); + r_drawviewmodel = Cvar_Get ("r_drawviewmodel", "1", CVAR_ARCHIVE, "Toggles drawing of view models (your weapons)"); + r_shadows = Cvar_Get ("r_shadows", "0", CVAR_ARCHIVE, "Set to 1 to enable shadows for entities"); + r_wateralpha = Cvar_Get ("r_wateralpha", "1", CVAR_NONE, "Determine opacity of liquids. 1 = solid, 0 = transparent, otherwise translucent."); /* FIXME what does r_waterripple use for units? */ r_waterripple = Cvar_Get ("r_waterripple", "0", CVAR_NONE, "Set to make liquids ripple, a good setting is 5"); - r_dynamic = Cvar_Get ("r_dynamic", "1", CVAR_NONE, "Set to 0 to disable all dynamic lighting - unless gl_flashblend is set to 1"); - r_novis = Cvar_Get ("r_novis", "0", CVAR_NONE, "Set to 1 to enable transparency of liquids on unvised maps"); + r_dynamic = Cvar_Get ("r_dynamic", "1", CVAR_NONE, "Set to 0 to disable lightmap changes"); + r_novis = Cvar_Get ("r_novis", "0", CVAR_NONE, "Set to 1 to enable runtime visibility checking (SLOW)"); r_speeds = Cvar_Get ("r_speeds", "0", CVAR_NONE, "Display drawing time and statistics of what is being viewed"); r_netgraph = Cvar_Get ("r_netgraph", "0", CVAR_ARCHIVE, "Graph network stats"); r_netgraph_alpha = Cvar_Get ("r_netgraph_alpha", "0.5", CVAR_ARCHIVE, "Net graph translucency"); - r_netgraph_box = Cvar_Get ("r_netgraph_box", "1", CVAR_ARCHIVE, "Draw box around net graph?"); + r_netgraph_box = Cvar_Get ("r_netgraph_box", "1", CVAR_ARCHIVE, "Draw box around net graph"); + r_skyname = Cvar_Get ("r_skyname", "none", CVAR_NONE, "name of the current skybox"); + + gl_affinemodels = Cvar_Get ("gl_affinemodels", "0", CVAR_ARCHIVE, "Makes texture rendering quality better if set to 1"); gl_clear = Cvar_Get ("gl_clear", "0", CVAR_NONE, "Set to 1 to make background black. Useful for removing HOM effect"); - gl_texsort = Cvar_Get ("gl_texsort", "1", CVAR_NONE, "Set to 0 to enable multitexture"); - - gl_cull = Cvar_Get ("gl_cull", "1", CVAR_NONE, "If set to 1, does not render things that do not need to be"); - gl_smooth = Cvar_Get ("gl_smooth", "1", CVAR_NONE, "Set to 0 to NOT smooth lighted models"); - gl_smoothdlights = Cvar_Get ("gl_smoothdlights", "1", CVAR_NONE, "Set to 0 to NOT smooth lights"); - gl_affinemodels = Cvar_Get ("gl_affinemodels", "0", CVAR_NONE, "Makes texture rendering quality better if set to 1"); - gl_flashblend = Cvar_Get ("gl_flashblend", "0", CVAR_NONE, "Set to 1 to use a type of lighting faster on GL"); - gl_playermip = Cvar_Get ("gl_playermip", "0", CVAR_NONE, "Detail of player skins. 0 best, 2 worst."); + gl_cull = Cvar_Get ("gl_cull", "1", CVAR_ARCHIVE, "If set to 1, does not render things that do not need to be"); + gl_fb_bmodels = Cvar_Get ("gl_fb_bmodels", "1", CVAR_ARCHIVE, "Toggles fullbright color support for bmodels"); + gl_fb_models = Cvar_Get ("gl_fb_models", "1", CVAR_ARCHIVE, "Toggles fullbright color support for models"); + gl_fires = Cvar_Get ("gl_fires", "0", CVAR_ARCHIVE, "Toggles lavaball and rocket fireballs"); + gl_flashblend = Cvar_Get ("gl_flashblend", "0", CVAR_ARCHIVE, "Set to 1 to use a type of lighting faster on GL"); + gl_keeptjunctions = Cvar_Get ("gl_keeptjunctions", "1", CVAR_ARCHIVE, "Set to 1 to turn off colinear vertexes upon level load"); + gl_lerp_anim = Cvar_Get ("gl_lerp_anim", "1", CVAR_ARCHIVE, "Toggles model animation interpolation"); + gl_multitexture = Cvar_Get ("gl_multitexture", "0", CVAR_ARCHIVE, "Use multitexture when available"); gl_nocolors = Cvar_Get ("gl_nocolors", "0", CVAR_NONE, "Set to 1, turns off all player skins"); - - gl_fires = Cvar_Get ("gl_fires", "0", CVAR_ARCHIVE, - "Toggles lavaball and rocket fireballs"); - - gl_particles = Cvar_Get ("gl_particles", "1", CVAR_ARCHIVE, - "whether or not to draw particles"); - - gl_fb_models = Cvar_Get ("gl_fb_models", "1", CVAR_ARCHIVE, - "Toggles fullbright color support for models.. " - "This is very handy, but costs me 2 FPS.. (=:]"); - gl_fb_bmodels = Cvar_Get ("gl_fb_bmodels", "1", CVAR_ARCHIVE, - "Toggles fullbright color support for bmodels"); - - gl_keeptjunctions = Cvar_Get ("gl_keeptjunctions", "1", CVAR_NONE, "Set to 1 to turn off colinear vertexes upon level load"); - - gl_lerp_anim = Cvar_Get ("gl_lerp_anim", "1", CVAR_ARCHIVE, - "Toggles model animation interpolation"); - - r_skyname = Cvar_Get ("r_skyname", "none", CVAR_NONE, - "name of the current skybox"); - gl_skymultipass = Cvar_Get ("gl_skymultipass", "1", CVAR_NONE, - "controls whether the skydome is single or double pass"); - gl_sky_clip = Cvar_Get ("gl_sky_clip", "0", CVAR_NONE, - "controls whether sky is drawn first (0) or later (1)"); - gl_sky_divide = Cvar_Get ("gl_sky_divide", "1", CVAR_ARCHIVE, - "subdivide sky polys"); + gl_particles = Cvar_Get ("gl_particles", "1", CVAR_ARCHIVE, "whether or not to draw particles"); + gl_playermip = Cvar_Get ("gl_playermip", "0", CVAR_NONE, "Detail of player skins. 0 best, 2 worst."); + gl_sky_clip = Cvar_Get ("gl_sky_clip", "0", CVAR_ARCHIVE, "controls whether sky is drawn first (0) or later (1)"); + gl_sky_divide = Cvar_Get ("gl_sky_divide", "1", CVAR_ARCHIVE, "subdivide sky polys"); + gl_skymultipass = Cvar_Get ("gl_skymultipass", "1", CVAR_ARCHIVE, "controls whether the skydome is single or double pass"); + gl_smooth = Cvar_Get ("gl_smooth", "1", CVAR_ARCHIVE, "Smooth lighting on models"); + gl_smoothdlights = Cvar_Get ("gl_smoothdlights", "1", CVAR_ARCHIVE, "Smooth dynamic lights"); } /* @@ -311,8 +294,7 @@ R_TranslatePlayerSkin (int playernum) translate[i] = i; for (i = 0; i < 16; i++) { - if (top < 128) // the artists made some backwards - // ranges. sigh. + if (top < 128) // the artists made some backwards ranges. sigh. translate[TOP_RANGE + i] = top + i; else translate[TOP_RANGE + i] = top + 15 - i; @@ -323,12 +305,9 @@ R_TranslatePlayerSkin (int playernum) translate[BOTTOM_RANGE + i] = bottom + 15 - i; } - // // locate the original skin pixels - // - // real model width - tinwidth = 296; - tinheight = 194; + tinwidth = 296; // real model width + tinheight = 194; // real model height if (!player->skin) Skin_Find (player); @@ -342,28 +321,10 @@ R_TranslatePlayerSkin (int playernum) inheight = 194; } - // because this happens during gameplay, do it fast - // instead of sending it through gl_upload 8 + // instead of sending it through GL_Upload8() glBindTexture (GL_TEXTURE_2D, playertextures + playernum); -#if 0 - s = 320 * 200; - byte translated[320 * 200]; - - for (i = 0; i < s; i += 4) { - translated[i] = translate[original[i]]; - translated[i + 1] = translate[original[i + 1]]; - translated[i + 2] = translate[original[i + 2]]; - translated[i + 3] = translate[original[i + 3]]; - } - - - // don't mipmap these, because it takes too long - GL_Upload8 (translated, paliashdr->skinwidth, paliashdr->skinheight, - false, false, true); -#endif - // FIXME deek: This 512x256 limit sucks! scaled_width = min (gl_max_size->int_val, 512); scaled_height = min (gl_max_size->int_val, 256); @@ -373,7 +334,7 @@ R_TranslatePlayerSkin (int playernum) scaled_height >>= gl_playermip->int_val; if (VID_Is8bit ()) { // 8bit texture upload - byte *out2; + byte *out2; out2 = (byte *) pixels; memset (pixels, 0, sizeof (pixels)); diff --git a/source/gl_rsurf.c b/source/gl_rsurf.c index 3085712..b7a8f43 100644 --- a/source/gl_rsurf.c +++ b/source/gl_rsurf.c @@ -764,8 +764,7 @@ R_DrawBrushModel (entity_t *e) psurf = &clmodel->surfaces[clmodel->firstmodelsurface]; - // calculate dynamic lighting for bmodel if it's not an - // instanced model + // calculate dynamic lighting for bmodel if it's not an instanced model if (clmodel->firstmodelsurface != 0 && !gl_flashblend->int_val) { vec3_t lightorigin; @@ -784,13 +783,7 @@ R_DrawBrushModel (entity_t *e) R_RotateForEntity (e); e->angles[0] = -e->angles[0]; // stupid quake bug - // LordHavoc: anyone without multitexture won't want texsort 0 anyway... - if (!gl_mtex_capable) - Cvar_SetValue (gl_texsort, 1); - - // // draw texture - // for (i = 0; i < clmodel->nummodelsurfaces; i++, psurf++) { // find which side of the node we are on pplane = psurf->plane; @@ -807,15 +800,15 @@ R_DrawBrushModel (entity_t *e) psurf->texturechain = sky_chain; sky_chain = psurf; return; - } else if (gl_texsort->int_val) { - R_RenderBrushPoly (psurf); - } else { + } else if (gl_mtex_active) { R_DrawMultitexturePoly (psurf); + } else { + R_RenderBrushPoly (psurf); } } } - if (gl_texsort->int_val) + if (!gl_mtex_active) R_BlendLightmaps (); if (gl_fb_bmodels->int_val) @@ -857,7 +850,7 @@ R_RecursiveWorldNode (mnode_t *node) if (R_CullBox (node->minmaxs, node->minmaxs + 3)) return; -// if a leaf node, draw stuff + // if a leaf node, draw stuff if (node->contents < 0) { pleaf = (mleaf_t *) node; @@ -874,9 +867,9 @@ R_RecursiveWorldNode (mnode_t *node) return; } -// node is just a decision point, so go down the apropriate sides + // node is just a decision point, so go down the apropriate sides -// find which side of the node we are on + // find which side of the node we are on plane = node->plane; switch (plane->type) { @@ -896,7 +889,7 @@ R_RecursiveWorldNode (mnode_t *node) side = dot < 0; -// recurse down the children, front side first + // recurse down the children, front side first // LordHavoc: save a stack frame by avoiding a call if (node->children[side]->contents != CONTENTS_SOLID && node->children[side]->visframe == r_visframecount @@ -904,7 +897,7 @@ R_RecursiveWorldNode (mnode_t *node) node->children[side]->minmaxs + 3)) R_RecursiveWorldNode (node->children[side]); -// draw stuff + // draw stuff if ((c = node->numsurfaces)) { surf = cl.worldmodel->surfaces + node->firstsurface; @@ -928,15 +921,15 @@ R_RecursiveWorldNode (mnode_t *node) surf->texturechain = sky_chain; sky_chain = surf; continue; - } else if (gl_texsort->int_val) { + } else if (gl_mtex_active) { + R_DrawMultitexturePoly (surf); + } else { surf->texturechain = surf->texinfo->texture->texturechain; surf->texinfo->texture->texturechain = surf; - } else { - R_DrawMultitexturePoly (surf); } } } -// recurse down the back side + // recurse down the back side // LordHavoc: save a stack frame by avoiding a call side = !side; if (node->children[side]->contents != CONTENTS_SOLID @@ -965,10 +958,6 @@ R_DrawWorld (void) currententity = &ent; - // LordHavoc: anyone without multitexture won't want texsort 0 anyway... - if (!gl_mtex_capable) - Cvar_SetValue (gl_texsort, 1); - memset (lightmap_polys, 0, sizeof (lightmap_polys)); memset (fullbright_polys, 0, sizeof (fullbright_polys)); if (gl_sky_clip->int_val) { @@ -982,7 +971,7 @@ R_DrawWorld (void) DrawTextureChains (); - if (gl_texsort->int_val) + if (!gl_mtex_active) R_BlendLightmaps (); if (gl_fb_bmodels->int_val) @@ -1266,12 +1255,10 @@ GL_BuildLightmaps (void) } } - if (gl_mtex_capable && !gl_texsort->int_val) + if (gl_mtex_active) qglActiveTexture (gl_mtex_enum + 1); - // // upload all lightmaps that were filled - // for (i = 0; i < MAX_LIGHTMAPS; i++) { if (!allocated[i][0]) break; // no more used @@ -1288,6 +1275,6 @@ GL_BuildLightmaps (void) GL_UNSIGNED_BYTE, lightmaps[i]); } - if (gl_mtex_capable && !gl_texsort->int_val) + if (gl_mtex_active) qglActiveTexture (gl_mtex_enum + 0); }