/* ================ AllocBrush ================ */ uBrush_t *AllocBrush( int numsides ) { uBrush_t *bb; int c; c = BrushSizeForSides( numsides ); bb = static_cast<uBrush_t *>( Mem_Alloc( c ) ); memset( bb, 0, c ); c_active_brushes++; return bb; }
/* ================== CopyBrush Duplicates the brush, the sides, and the windings ================== */ uBrush_t *CopyBrush (uBrush_t *brush) { uBrush_t *newbrush; int size; int i; size = BrushSizeForSides( brush->numsides ); newbrush = AllocBrush (brush->numsides); memcpy (newbrush, brush, size); for (i=0 ; i<brush->numsides ; i++) { if (brush->sides[i].winding) newbrush->sides[i].winding = brush->sides[i].winding->Copy(); } return newbrush; }