UFO: Alien Invasion
Loading...
Searching...
No Matches
trace.cpp
Go to the documentation of this file.
1
6
7/*
8Copyright (C) 1997-2001 Id Software, Inc.
9
10This program is free software; you can redistribute it and/or
11modify it under the terms of the GNU General Public License
12as published by the Free Software Foundation; either version 2
13of the License, or (at your option) any later version.
14
15This program is distributed in the hope that it will be useful,
16but WITHOUT ANY WARRANTY; without even the implied warranty of
17MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18
19See the GNU General Public License for more details.
20
21You should have received a copy of the GNU General Public License
22along with this program; if not, write to the Free Software
23Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24
25*/
26
27
28#include "shared.h"
29#include "../bsp.h"
30#include "bspfile.h"
31
38void MakeTracingNodes (int levels)
39{
40 /* Release any memory we have for existing tnodes, just in case. */
42
43 /* allocate memory for the tnodes structure */
44 tnode_t* tnode = curTile->tnodes = Mem_AllocTypeN(tnode_t, curTile->numnodes + 1);
45 curTile->numtheads = 0;
46
47 for (int i = 0; i < levels; i++) {
48 const dBspModel_t* model = &curTile->models[i];
49 if (!model->numfaces && i != LEVEL_LIGHTCLIP && i != LEVEL_ACTORCLIP)
50 continue;
51 if (model->headnode < 0) /* empty models have headnode -1 */
52 continue;
53 curTile->thead[curTile->numtheads] = tnode - curTile->tnodes;
54 curTile->theadlevel[curTile->numtheads] = i;
55 curTile->numtheads++;
56 assert(curTile->numtheads < LEVEL_MAX);
57 TR_BuildTracingNode_r(curTile, &tnode, model->headnode, i);
58 }
59}
60
66{
67 Mem_Free(curTile->tnodes);
68 curTile->tnodes = nullptr;
69}
#define LEVEL_MAX
Definition defines.h:353
#define LEVEL_LIGHTCLIP
Definition defines.h:349
#define LEVEL_ACTORCLIP
Definition defines.h:352
#define Mem_Free(ptr)
Definition mem.h:35
#define Mem_AllocTypeN(type, n)
Definition mem.h:38
QGL_EXTERN GLint i
Definition r_gl.h:113
int32_t headnode
Definition typedefs.h:357
Data for line tracing (?).
Definition typedefs.h:69
dMapTile_t * curTile
Definition bsp.cpp:32
void CloseTracingNodes(void)
Definition trace.cpp:65
void MakeTracingNodes(int levels)
Use the bsp node structure to reconstruct efficient tracing structures that are used for fast visibil...
Definition trace.cpp:38
void TR_BuildTracingNode_r(TR_TILE_TYPE *tile, tnode_t **tnode, int32_t nodenum, int level)
Definition tracing.cpp:122