29 #include "../../../idlib/precompiled.h"
40 #define PLANESIDE_EPSILON 0.001
56 for ( ; brushes ; brushes = brushes->
next)
99 for ( i = 0 ; i < brushes->
numsides ; i++ ) {
121 for ( ; brushes ; brushes = next)
123 next = brushes->
next;
145 memcpy (newbrush, brush, size);
168 for ( ; brush ; brush=brush->
next)
192 for ( i=0;i<brush->
numsides ; i++ ) {
211 for ( i = 0; i < brush->
numsides; i++ ) {
219 for ( i = 0; i < 3; i++ ) {
243 for ( i = 0; i < brush->
numsides; i++ ) {
247 for ( j = 0; j < brush->
numsides &&
w; j++ ) {
255 w = w->
Clip( *plane, 0 );
280 for (i=0 ; i<3 ; i++) {
281 plane[0] = plane[1] = plane[2] = 0;
283 plane[3] = -bounds[1][
i];
287 plane[3] = bounds[0][
i];
306 float d, area, volume;
315 for ( i = 0; i < brush->
numsides; i++ ) {
364 f->
Printf(
"{\n\"classname\" \"worldspawn\"\n" );
366 for ( ; list ; list=list->
next )
369 for (i=0,s=list->
sides ; i<list->numsides ; i++,s++)
373 f->
Printf (
"( %i %i %i ) ", (
int)(*w)[0][0], (
int)(*w)[0][1], (
int)(*w)[0][2]);
374 f->
Printf (
"( %i %i %i ) ", (
int)(*w)[1][0], (
int)(*w)[1][1], (
int)(*w)[1][2]);
375 f->
Printf (
"( %i %i %i ) ", (
int)(*w)[2][0], (
int)(*w)[2][1], (
int)(*w)[2][2]);
377 f->
Printf (
"notexture 0 0 0 1 1\n" );
443 int c_unique, c_clusters;
461 common->
Printf(
"%5i cluster references\n", c_clusters );
476 memset (tree, 0,
sizeof(*tree));
492 memset (node, 0,
sizeof(*node));
513 for ( i = 0; i < brush->
numsides; i++ ) {
519 d = plane.
Distance( (*w)[j].ToVec3() );
548 float d, d_front, d_back;
550 *front = *back =
NULL;
554 d_front = d_back = 0;
555 for ( i = 0; i < brush->
numsides; i++ )
562 d = plane.
Distance( (*w)[j].ToVec3() );
563 if (d > 0 && d > d_front)
565 if (d < 0 && d < d_back)
583 for ( i = 0; i < brush->
numsides &&
w; i++ ) {
585 w = w->
Clip( plane2, 0 );
588 if ( !w || w->
IsTiny() ) {
608 for ( i = 0; i < 2; i++ ) {
610 memcpy( b[i], brush,
sizeof(
uBrush_t ) -
sizeof( brush->
sides ) );
618 for ( i = 0; i < brush->
numsides; i++ ) {
623 w->
Split( plane, 0 , &cw[0], &cw[1] );
624 for ( j = 0; j < 2; j++ ) {
645 for (i=0 ; i<2 ; i++)
651 if ( b[i]->numsides < 3 )
658 if ( !(b[0] && b[1]) )
678 for (i=0 ; i<2 ; i++)
695 for (i=0 ; i<2 ; i++)
int BrushSizeForSides(int numsides)
float GetArea(void) const
float Distance(const idVec3 &v) const
void FreeBrushList(uBrush_t *brushes)
int BrushMostlyOnSide(uBrush_t *brush, idPlane &plane)
idFileSystem * fileSystem
int FindFloatPlane(const idPlane &plane, bool *fixedDegeneracies=NULL)
int CountBrushList(uBrush_t *brushes)
void SplitBrush(uBrush_t *brush, int planenum, uBrush_t **front, uBrush_t **back)
idWinding * Clip(const idPlane &plane, const float epsilon=ON_EPSILON, const bool keepOn=false)
float BrushVolume(uBrush_t *brush)
void FilterBrushesIntoTree(uEntity_t *e)
void GLS_BeginScene(void)
const idMaterial * material
int FilterBrushIntoTree_r(uBrush_t *b, node_t *node)
bool AddPoint(const idVec3 &v)
struct bspbrush_s uBrush_t
void WriteBspBrushMap(const char *name, uBrush_t *list)
uBrush_t * CopyBrush(uBrush_t *brush)
int GetNumPoints(void) const
struct node_s * children[2]
GLubyte GLubyte GLubyte GLubyte w
uBrush_t * BrushFromBounds(const idBounds &bounds)
void GLS_Winding(const idWinding *w, int code)
virtual idFile * OpenFileWrite(const char *relativePath, const char *basePath="fs_savepath")=0
virtual void Printf(const char *fmt,...) id_attribute((format(printf
void FreeBrush(uBrush_t *brushes)
int Split(const idPlane &plane, const float epsilon, idWinding **front, idWinding **back) const
GLdouble GLdouble GLdouble r
struct primitive_s * next
struct bspbrush_s * original
bool BoundBrush(uBrush_t *brush)
void DrawBrushList(uBrush_t *brush)
void PrintBrush(uBrush_t *brush)
idWinding * Copy(void) const
bool CreateBrushWindings(uBrush_t *brush)
void * Mem_Alloc(const int size)
struct bspbrush_s * brush
dmapGlobals_t dmapGlobals
virtual void CloseFile(idFile *f)=0
virtual void Error(const char *fmt,...) id_attribute((format(printf
uBrush_t * AllocBrush(int numsides)
virtual int Printf(const char *fmt,...) id_attribute((format(printf