diff --git a/libs/video/renderer/Makefile.am b/libs/video/renderer/Makefile.am index c6d522d8b..fc0ec0b4f 100644 --- a/libs/video/renderer/Makefile.am +++ b/libs/video/renderer/Makefile.am @@ -10,8 +10,8 @@ EXTRA_LTLIBRARIES= libQFrenderer_sw.la libQFrenderer_sw32.la \ libQFrenderer_gl.la libQFrenderer_glsl.la common_sources= \ - crosshair.c r_alias.c r_cvar.c r_efrag.c r_ent.c r_graph.c r_light.c \ - r_main.c r_part.c r_progs.c r_screen.c + crosshair.c r_alias.c r_bsp.c r_cvar.c r_efrag.c r_ent.c r_graph.c \ + r_light.c r_main.c r_part.c r_progs.c r_screen.c libQFrenderer_gl_la_LDFLAGS= -version-info $(QUAKE_LIBRARY_VERSION_INFO) -rpath $(libdir) libQFrenderer_gl_la_LIBADD= gl/libgl.la diff --git a/libs/video/renderer/gl/gl_rmain.c b/libs/video/renderer/gl/gl_rmain.c index 0aee1d291..4917c6289 100644 --- a/libs/video/renderer/gl/gl_rmain.c +++ b/libs/video/renderer/gl/gl_rmain.c @@ -97,8 +97,6 @@ float r_base_world_matrix[16]; // screen size info VISIBLE refdef_t r_refdef; -mleaf_t *r_viewleaf, *r_oldviewleaf; - int d_lightstylevalue[256]; // 8.8 fraction of base light value vec3_t shadecolor; // Ender (Extend) Colormod diff --git a/libs/video/renderer/gl/gl_rsurf.c b/libs/video/renderer/gl/gl_rsurf.c index 103a97b76..b9b088e62 100644 --- a/libs/video/renderer/gl/gl_rsurf.c +++ b/libs/video/renderer/gl/gl_rsurf.c @@ -836,50 +836,6 @@ R_DrawWorld (void) clear_texture_chains (); } -void -R_MarkLeaves (void) -{ - byte solid[4096]; - byte *vis; - int c; - unsigned int i; - mleaf_t *leaf; - mnode_t *node; - msurface_t **mark; - - if (r_oldviewleaf == r_viewleaf && !r_novis->int_val) - return; - - r_visframecount++; - r_oldviewleaf = r_viewleaf; - - if (r_novis->int_val) { - vis = solid; - memset (solid, 0xff, (r_worldentity.model->numleafs + 7) >> 3); - } else - vis = Mod_LeafPVS (r_viewleaf, r_worldentity.model); - - for (i = 0; (int) i < r_worldentity.model->numleafs; i++) { - if (vis[i >> 3] & (1 << (i & 7))) { - leaf = &r_worldentity.model->leafs[i + 1]; - if ((c = leaf->nummarksurfaces)) { - mark = leaf->firstmarksurface; - do { - (*mark)->visframe = r_visframecount; - mark++; - } while (--c); - } - node = (mnode_t *) leaf; - do { - if (node->visframe == r_visframecount) - break; - node->visframe = r_visframecount; - node = node->parent; - } while (node); - } - } -} - int nColinElim; model_t *currentmodel; mvertex_t *r_pcurrentvertbase; diff --git a/libs/video/renderer/r_bsp.c b/libs/video/renderer/r_bsp.c new file mode 100644 index 000000000..d335faeae --- /dev/null +++ b/libs/video/renderer/r_bsp.c @@ -0,0 +1,90 @@ +/* + r_bsp.c + + Common bsp rendering. + + Copyright (C) 1996-1997 Id Software, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + + See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to: + + Free Software Foundation, Inc. + 59 Temple Place - Suite 330 + Boston, MA 02111-1307, USA + +*/ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +static __attribute__ ((used)) const char rcsid[] = "$Id$"; + +#ifdef HAVE_STRING_H +# include "string.h" +#endif +#ifdef HAVE_STRINGS_H +# include "strings.h" +#endif + +#include "QF/cvar.h" + +#include "r_cvar.h" +#include "r_local.h" +#include "r_shared.h" + +mleaf_t *r_viewleaf, *r_oldviewleaf; + +void +R_MarkLeaves (void) +{ + byte solid[8192]; + byte *vis; + int c; + unsigned int i; + mleaf_t *leaf; + mnode_t *node; + msurface_t **mark; + + if (r_oldviewleaf == r_viewleaf && !r_novis->int_val) + return; + + r_visframecount++; + r_oldviewleaf = r_viewleaf; + + if (r_novis->int_val) { + vis = solid; + memset (solid, 0xff, (r_worldentity.model->numleafs + 7) >> 3); + } else + vis = Mod_LeafPVS (r_viewleaf, r_worldentity.model); + + for (i = 0; (int) i < r_worldentity.model->numleafs; i++) { + if (vis[i >> 3] & (1 << (i & 7))) { + leaf = &r_worldentity.model->leafs[i + 1]; + if ((c = leaf->nummarksurfaces)) { + mark = leaf->firstmarksurface; + do { + (*mark)->visframe = r_visframecount; + mark++; + } while (--c); + } + node = (mnode_t *) leaf; + do { + if (node->visframe == r_visframecount) + break; + node->visframe = r_visframecount; + node = node->parent; + } while (node); + } + } +} diff --git a/libs/video/renderer/sw/sw_rmain.c b/libs/video/renderer/sw/sw_rmain.c index aa4919c10..6f09f72ab 100644 --- a/libs/video/renderer/sw/sw_rmain.c +++ b/libs/video/renderer/sw/sw_rmain.c @@ -133,8 +133,6 @@ int reinit_surfcache = 1; // if 1, surface cache is currently empty // and must be reinitialized for current // cache size -mleaf_t *r_viewleaf, *r_oldviewleaf; - float r_aliastransition, r_resfudge; int d_lightstylevalue[256]; // 8.8 fraction of base light value @@ -367,47 +365,6 @@ R_ViewChanged (float aspect) D_ViewChanged (); } -void -R_MarkLeaves (void) -{ - byte *vis; - mnode_t *node; - mleaf_t *leaf; - msurface_t **mark; - int c; - int i; - - if (r_oldviewleaf == r_viewleaf) - return; - - r_visframecount++; - r_oldviewleaf = r_viewleaf; - - vis = Mod_LeafPVS (r_viewleaf, r_worldentity.model); - - for (i = 0; i < r_worldentity.model->numleafs; i++) { - if (vis[i >> 3] & (1 << (i & 7))) { - leaf = &r_worldentity.model->leafs[i + 1]; - mark = leaf->firstmarksurface; - c = leaf->nummarksurfaces; - if (c) { - do { - (*mark)->visframe = r_visframecount; - mark++; - } while (--c); - } - - node = (mnode_t *) leaf; - do { - if (node->visframe == r_visframecount) - break; - node->visframe = r_visframecount; - node = node->parent; - } while (node); - } - } -} - static void R_DrawEntitiesOnList (void) { diff --git a/libs/video/renderer/sw32/sw32_rmain.c b/libs/video/renderer/sw32/sw32_rmain.c index 1b5450172..4625f7681 100644 --- a/libs/video/renderer/sw32/sw32_rmain.c +++ b/libs/video/renderer/sw32/sw32_rmain.c @@ -127,8 +127,6 @@ int reinit_surfcache = 1; // if 1, surface cache is currently empty // and must be reinitialized for current // cache size -mleaf_t *r_viewleaf, *r_oldviewleaf; - float r_aliastransition, r_resfudge; int d_lightstylevalue[256]; // 8.8 fraction of base light value @@ -387,47 +385,6 @@ R_ViewChanged (float aspect) D_ViewChanged (); } -void -R_MarkLeaves (void) -{ - byte *vis; - mnode_t *node; - mleaf_t *leaf; - msurface_t **mark; - int c; - int i; - - if (r_oldviewleaf == r_viewleaf) - return; - - r_visframecount++; - r_oldviewleaf = r_viewleaf; - - vis = Mod_LeafPVS (r_viewleaf, r_worldentity.model); - - for (i = 0; i < r_worldentity.model->numleafs; i++) { - if (vis[i >> 3] & (1 << (i & 7))) { - leaf = &r_worldentity.model->leafs[i + 1]; - mark = leaf->firstmarksurface; - c = leaf->nummarksurfaces; - if (c) { - do { - (*mark)->visframe = r_visframecount; - mark++; - } while (--c); - } - - node = (mnode_t *) leaf; - do { - if (node->visframe == r_visframecount) - break; - node->visframe = r_visframecount; - node = node->parent; - } while (node); - } - } -} - static void R_DrawEntitiesOnList (void) {