mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-18 02:31:31 +00:00
93 lines
2.1 KiB
C
93 lines
2.1 KiB
C
/*
|
|
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;
|
|
static mleaf_t *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) {
|
|
r_oldviewleaf = 0; // so vis will be recalcualted when novis gets
|
|
// turned off
|
|
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);
|
|
}
|
|
}
|
|
}
|