Exemplo n.º 1
0
void MakeTnode (int nodenum)
{
	tnode_t			*t;
	dplane_t		*plane;
	int				i;
	dnode_t 		*node;
	
	t = tnode_p++;

	node = dnodes + nodenum;
	plane = dplanes + node->planenum;

	t->type = plane->type;
	VectorCopy (plane->normal, t->normal);
	t->dist = plane->dist;
	
	
	for (i=0 ; i<2 ; i++)
	{
		if (node->children[i] < 0)
		{
            t->children[i] = (dleafs[-node->children[i] - 1].contents & tnode_mask) | (1<<31);
        	t->children_leaf[i] = -node->children[i] - 1;
		}
		else
		{
			t->children[i] = tnode_p - tnodes;
			MakeTnode (node->children[i]);
		}
	}
}
Exemplo n.º 2
0
/*
==============
MakeTnode

Converts the disk node structure into the efficient tracing structure
==============
*/
void MakeTnode (int nodenum)
{
	tnode_t			*t;
	dplane_t		*plane;
	int				i;
	dnode_t 		*node;
	int				leafNum;

	t = tnode_p++;

	node = dnodes + nodenum;
	plane = dplanes + node->planeNum;

	t->planeNum = node->planeNum;
	t->type = PlaneTypeForNormal( plane->normal );
	VectorCopy (plane->normal, t->normal);
	t->dist = plane->dist;
	
	for (i=0 ; i<2 ; i++)
	{
		if (node->children[i] < 0) {
			leafNum = -node->children[i] - 1;
			if ( dleafs[leafNum].cluster == -1  ) {
				// solid
				t->children[i] = leafNum | ( 1 << 31 ) | ( 1 << 30 );
			} else {
				t->children[i] = leafNum | ( 1 << 31 );
			}
		} else {
			t->children[i] = tnode_p - tnodes;
			MakeTnode (node->children[i]);
		}
	}
			
}
Exemplo n.º 3
0
/*
=============
MakeTnodes

Loads the node structure out of a .bsp file to be used for light occlusion
=============
*/
void MakeTnodes (dmodel_t *bm)
{
    if (!numnodes)
        Error ("Map has no nodes\n");
    tnode_p = tnodes = malloc(numnodes * sizeof(tnode_t));

    MakeTnode (0);
}
Exemplo n.º 4
0
/*
   =============
   MakeTnodes

   Loads the node structure out of a .bsp file to be used for light occlusion
   =============
 */
void MakeTnodes( dmodel_t *bm ){
	// 32 byte align the structs
	tnodes = malloc( ( numnodes + 1 ) * sizeof( tnode_t ) );
	tnodes = (tnode_t *)( ( (int)tnodes + 31 ) & ~31 );
	tnode_p = tnodes;

	MakeTnode( 0 );
}
Exemplo n.º 5
0
/*
=============
InitTrace

Loads the node structure out of a .bsp file to be used for light occlusion
=============
*/
void InitTrace( void ) {
	// 32 byte align the structs
	tnodes = malloc( (MAX_TNODES+1) * sizeof(tnode_t));
	tnodes = (tnode_t *)(((int)tnodes + 31)&~31);
	tnode_p = tnodes;

	MakeTnode (0);

	InitSurfacesForTesting();
}
Exemplo n.º 6
0
/*
=============
MakeTnodes

Loads the node structure out of a .bsp file to be used for light occlusion
=============
*/
void MakeTnodes (dmodel_t *bm)
{
	// 32 byte align the structs
	tnodes = malloc( (numnodes+1) * sizeof(tnode_t));
	tnodes = (tnode_t *)(((int)tnodes + 31)&~31);
	tnode_p = tnodes;
	tnode_mask = CONTENTS_SOLID|CONTENTS_WINDOW;
	//TODO: or-in CONTENTS_WINDOW in response to a command-line argument

	MakeTnode (0);
}
Exemplo n.º 7
0
/*
 * =============
 * MakeTnodes
 * Loads the node structure out of a .bsp file to be used for light occlusion
 * =============
 */
void
MakeTnodes(void)
{
    tnode_p = tnodes = malloc(numnodes * sizeof(tnode_t));
    MakeTnode(0);
}