本文整理汇总了C++中FreeBrush函数的典型用法代码示例。如果您正苦于以下问题:C++ FreeBrush函数的具体用法?C++ FreeBrush怎么用?C++ FreeBrush使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了FreeBrush函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SplitBrush
//===========================================================================
// Returns a single brush made up by the intersection of the
// two provided brushes, or NULL if they are disjoint.
//
// The originals are undisturbed.
//
// Parameter: -
// Returns: -
// Changes Globals: -
//===========================================================================
bspbrush_t *IntersectBrush( bspbrush_t *a, bspbrush_t *b ) {
int i;
bspbrush_t *front, *back;
bspbrush_t *in;
in = a;
for ( i = 0 ; i < b->numsides && in ; i++ )
{
SplitBrush( in, b->sides[i].planenum, &front, &back );
// SplitBrush2(in, b->sides[i].planenum, &front, &back);
if ( in != a ) {
FreeBrush( in );
}
if ( front ) {
FreeBrush( front );
}
in = back;
} //end for
if ( in == a ) {
return NULL;
}
in->next = NULL;
return in;
} //end of the function IntersectBrush
示例2: out
//===========================================================================
// Returns a list of brushes that remain after B is subtracted from A.
// May by empty if A is contained inside B.
// The originals are undisturbed.
//
// Parameter: -
// Returns: -
// Changes Globals: -
//===========================================================================
bspbrush_t *SubtractBrush (bspbrush_t *a, bspbrush_t *b)
{ // a - b = out (list)
int i;
bspbrush_t *front, *back;
bspbrush_t *out, *in;
in = a;
out = NULL;
for (i = 0; i < b->numsides && in; i++)
{
SplitBrush2(in, b->sides[i].planenum, &front, &back);
if (in != a) FreeBrush(in);
if (front)
{ // add to list
front->next = out;
out = front;
} //end if
in = back;
} //end for
if (in)
{
FreeBrush (in);
} //end if
else
{ // didn't really intersect
FreeBrushList (out);
return a;
} //end else
return out;
} //end of the function SubtractBrush
示例3: FreeDMapFile
/*
================
FreeDMapFile
================
*/
void FreeDMapFile( void )
{
int i, j;
FreeBrush( buildBrush );
buildBrush = NULL;
// free the entities and brushes
for( i = 0; i < dmapGlobals.num_entities; i++ )
{
uEntity_t *ent;
primitive_t *prim, *nextPrim;
ent = &dmapGlobals.uEntities[i];
FreeTree( ent->tree );
// free primitives
for( prim = ent->primitives; prim; prim = nextPrim )
{
nextPrim = prim->next;
if( prim->brush )
{
FreeBrush( prim->brush );
}
if( prim->tris )
{
FreeTriList( prim->tris );
}
Mem_Free( prim );
}
// free area surfaces
if( ent->areas )
{
for( j = 0; j < ent->numAreas; j++ )
{
uArea_t *area;
area = &ent->areas[j];
FreeOptimizeGroupList( area->groups );
}
Mem_Free( ent->areas );
}
}
Mem_Free( dmapGlobals.uEntities );
dmapGlobals.num_entities = 0;
// free the map lights
for( i = 0; i < dmapGlobals.mapLights.Num(); i++ )
{
R_FreeLightDefDerivedData( &dmapGlobals.mapLights[i]->def );
}
dmapGlobals.mapLights.DeleteContents( true );
}
示例4: qprintf
//===========================================================================
//
// Parameter: -
// Returns: -
// Changes Globals: -
//===========================================================================
bspbrush_t *MergeBrushes(bspbrush_t *brushlist)
{
int nummerges, merged;
bspbrush_t *b1, *b2, *tail, *newbrush, *newbrushlist;
bspbrush_t *lastb2;
if (!brushlist) return NULL;
qprintf("%5d brushes merged", nummerges = 0);
do
{
for (tail = brushlist; tail; tail = tail->next)
{
if (!tail->next) break;
} //end for
merged = 0;
newbrushlist = NULL;
for (b1 = brushlist; b1; b1 = brushlist)
{
lastb2 = b1;
for (b2 = b1->next; b2; b2 = b2->next)
{
//if the brushes don't have the same contents
if (b1->original->contents != b2->original->contents ||
b1->original->expansionbbox != b2->original->expansionbbox) newbrush = NULL;
else newbrush = TryMergeBrushes(b1, b2);
if (newbrush)
{
tail->next = newbrush;
lastb2->next = b2->next;
brushlist = brushlist->next;
FreeBrush(b1);
FreeBrush(b2);
for (tail = brushlist; tail; tail = tail->next)
{
if (!tail->next) break;
} //end for
merged++;
qprintf("\r%5d", nummerges++);
break;
} //end if
lastb2 = b2;
} //end for
//if b1 can't be merged with any of the other brushes
if (!b2)
{
brushlist = brushlist->next;
//keep b1
b1->next = newbrushlist;
newbrushlist = b1;
} //end else
} //end for
brushlist = newbrushlist;
} while(merged);
qprintf("\n");
return newbrushlist;
} //end of the function MergeBrushes
示例5: PruneNodes_r
/*
============
PruneNodes_r
============
*/
void PruneNodes_r (node_t *node)
{
bspbrush_t *b, *next;
// portal_t *p, *nextp;
// int s;
if (node->planenum == PLANENUM_LEAF)
return;
PruneNodes_r (node->children[0]);
PruneNodes_r (node->children[1]);
if ( (node->children[0]->contents & CONTENTS_SOLID)
&& (node->children[1]->contents & CONTENTS_SOLID) )
{
if (node->faces)
Error ("node->faces seperating CONTENTS_SOLID");
if (node->children[0]->faces || node->children[1]->faces)
Error ("!node->faces with children");
// FIXME: free stuff
node->pruned = true;
node->planenum = PLANENUM_LEAF;
node->contents = CONTENTS_SOLID;
node->detail_seperator = false;
if (node->brushlist)
Error ("PruneNodes: node->brushlist");
// combine brush lists
node->brushlist = node->children[1]->brushlist;
for (b=node->children[0]->brushlist ; b ; b=next)
{
next = b->next;
b->next = node->brushlist;
node->brushlist = b;
}
node->children[0]->brushlist = NULL;
node->children[1]->brushlist = NULL;
if(node->children[0]->volume != NULL)
{
FreeBrush(node->children[0]->volume);
node->children[0]->volume = NULL;
}
if(node->children[1]->volume != NULL)
{
FreeBrush(node->children[1]->volume);
node->children[1]->volume = NULL;
}
c_pruned++;
}
}
示例6: Tree_Free_r
//===========================================================================
//
// Parameter: -
// Returns: -
// Changes Globals: -
//===========================================================================
void Tree_Free_r( node_t *node ) {
// face_t *f, *nextf;
bspbrush_t *brush, *nextbrush;
//free children
if ( node->planenum != PLANENUM_LEAF ) {
Tree_Free_r( node->children[0] );
Tree_Free_r( node->children[1] );
} //end if
//free bspbrushes
// FreeBrushList (node->brushlist);
for ( brush = node->brushlist; brush; brush = nextbrush )
{
nextbrush = brush->next;
#ifdef ME
freedtreemem += MemorySize( brush );
#endif //ME
FreeBrush( brush );
} //end for
node->brushlist = NULL;
/*
NOTE: only used when creating Q2 bsp
// free faces
for (f = node->faces; f; f = nextf)
{
nextf = f->next;
#ifdef ME
if (f->w) freedtreemem += MemorySize(f->w);
freedtreemem += sizeof(face_t);
#endif //ME
FreeFace(f);
} //end for
*/
// free the node
if ( node->volume ) {
#ifdef ME
freedtreemem += MemorySize( node->volume );
#endif //ME
FreeBrush( node->volume );
} //end if
if ( numthreads == 1 ) {
c_nodes--;
}
#ifdef ME
freedtreemem += MemorySize( node );
#endif //ME
FreeMemory( node );
} //end of the function Tree_Free_r
示例7: CheckPlaneAgainstVolume
//===========================================================================
//
// Parameter: -
// Returns: -
// Changes Globals: -
//===========================================================================
qboolean CheckPlaneAgainstVolume (int pnum, node_t *node)
{
bspbrush_t *front, *back;
qboolean good;
SplitBrush (node->volume, pnum, &front, &back);
good = (front && back);
if (front) FreeBrush (front);
if (back) FreeBrush (back);
return good;
} //end of the function CheckPlaneAgaintsVolume
示例8: FilterBrushIntoTree_r
/*
====================
FilterBrushIntoTree_r
====================
*/
int FilterBrushIntoTree_r( uBrush_t *b, node_t *node )
{
uBrush_t *front, *back;
int c;
if( !b )
{
return 0;
}
// add it to the leaf list
if( node->planenum == PLANENUM_LEAF )
{
b->next = node->brushlist;
node->brushlist = b;
// classify the leaf by the structural brush
if( b->opaque )
{
node->opaque = true;
}
return 1;
}
// split it by the node plane
SplitBrush( b, node->planenum, &front, &back );
FreeBrush( b );
c = 0;
c += FilterBrushIntoTree_r( front, node->children[0] );
c += FilterBrushIntoTree_r( back, node->children[1] );
return c;
}
示例9: CheckPlaneAgainstVolume
static bool CheckPlaneAgainstVolume (uint16_t pnum, const bspbrush_t* volume)
{
bspbrush_t* front, *back;
bool good;
SplitBrush(volume, pnum, &front, &back);
good = (front && back);
if (front)
FreeBrush(front);
if (back)
FreeBrush(back);
return good;
}
示例10: FreeTree_r
/*
=============
FreeTree_r
=============
*/
void FreeTree_r( node_t *node ){
face_t *f, *nextf;
// free children
if ( node->planenum != PLANENUM_LEAF ) {
FreeTree_r( node->children[0] );
FreeTree_r( node->children[1] );
}
// free bspbrushes
FreeBrushList( node->brushlist );
// free faces
for ( f = node->faces ; f ; f = nextf )
{
nextf = f->next;
FreeFace( f );
}
// free the node
if ( node->volume ) {
FreeBrush( node->volume );
}
if ( numthreads == 1 ) {
c_nodes--;
}
free( node );
}
示例11: Q1_CreateMapBrushes
//===========================================================================
//
// Parameter: -
// Returns: -
// Changes Globals: -
//===========================================================================
void Q1_CreateMapBrushes(entity_t *mapent, int modelnum)
{
bspbrush_t *brushlist, *brush, *nextbrush;
int i;
//create brushes from the model BSP tree
brushlist = Q1_CreateBrushesFromBSP(modelnum);
//texture the brushes and split them when necesary
brushlist = Q1_TextureBrushes(brushlist, modelnum);
//fix the contents textures of all brushes
Q1_FixContentsTextures(brushlist);
//
if (!nobrushmerge)
{
brushlist = Q1_MergeBrushes(brushlist, modelnum);
//brushlist = Q1_MergeBrushes(brushlist, modelnum);
} //end if
//
if (!modelnum) qprintf("converting brushes to map brushes\n");
if (!modelnum) qprintf("%5d brushes", i = 0);
for (brush = brushlist; brush; brush = nextbrush)
{
nextbrush = brush->next;
Q1_BSPBrushToMapBrush(brush, mapent);
brush->next = NULL;
FreeBrush(brush);
if (!modelnum) qprintf("\r%5d", ++i);
} //end for
if (!modelnum) qprintf("\n");
} //end of the function Q1_CreateMapBrushes
示例12: FreeTree_r
static void FreeTree_r (node_t *node)
{
face_t *f, *nextf;
/* free children */
if (node->planenum != PLANENUM_LEAF) {
FreeTree_r(node->children[0]);
FreeTree_r(node->children[1]);
}
/* free bspbrushes */
FreeBrushList(node->brushlist);
/* free faces */
for (f = node->faces; f; f = nextf) {
nextf = f->next;
FreeFace(f);
}
/* free the node */
if (node->volume)
FreeBrush(node->volume);
if (threadstate.numthreads == 1)
c_nodes--;
Mem_Free(node);
}
示例13: FreeBrushList
/**
* @sa AllocBrush
* @sa CountBrushList
*/
void FreeBrushList (bspbrush_t* brushes)
{
bspbrush_t* next;
for (; brushes; brushes = next) {
next = brushes->next;
FreeBrush(brushes);
}
}
示例14: FreeBrushList
/*
================
FreeBrushList
================
*/
void FreeBrushList( uBrush_t *brushes )
{
uBrush_t *next;
for( /**/; brushes; brushes = next )
{
next = brushes->next;
FreeBrush( brushes );
}
}
示例15: FreeBrushList
//===========================================================================
//
// Parameter: -
// Returns: -
// Changes Globals: -
//===========================================================================
void FreeBrushList( bspbrush_t *brushes ) {
bspbrush_t *next;
for ( ; brushes; brushes = next )
{
next = brushes->next;
FreeBrush( brushes );
} //end for
} //end of the function FreeBrushList