Main Page | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

BRUSH.H File Reference

Go to the source code of this file.

Functions

int AddPlanept (float *f)
void Brush_AddToList (brush_t *b, brush_t *list)
brush_tBrush_Alloc ()
void Brush_Build (brush_t *b, bool bSnap=true, bool bMarkMap=true, bool bConvert=false)
void Brush_BuildWindings (brush_t *b, bool bSnap=true)
brush_tBrush_Clone (brush_t *b)
brush_tBrush_Create (vec3_t mins, vec3_t maxs, texdef_t *texdef)
void Brush_Draw (brush_t *b)
void Brush_DrawXY (brush_t *b, int nViewType)
void Brush_FitTexture (brush_t *b, int nHeight, int nWidth)
void Brush_Free (brush_t *b, bool bRemoveNode=true)
brush_tBrush_FullClone (brush_t *b)
const char * Brush_GetKeyValue (brush_t *b, const char *pKey)
winding_tBrush_MakeFaceWinding (brush_t *b, face_t *face)
void Brush_MakeSided (int sides)
void Brush_MakeSidedCone (int sides)
void Brush_MakeSidedSphere (int sides)
int Brush_MemorySize (brush_t *b)
void Brush_Move (brush_t *b, const vec3_t move, bool bSnap=true)
int Brush_MoveVertex (brush_t *b, vec3_t vertex, vec3_t delta, vec3_t end, bool bSnap=true)
const char * Brush_Name (brush_t *b)
brush_tBrush_Parse (void)
face_tBrush_Ray (vec3_t origin, vec3_t dir, brush_t *b, float *dist)
void Brush_RemoveEmptyFaces (brush_t *b)
void Brush_RemoveFromList (brush_t *b)
void Brush_ResetFaceOriginals (brush_t *b)
void Brush_Rotate (brush_t *b, vec3_t vAngle, vec3_t vOrigin, bool bBuild=true)
void Brush_SelectFaceForDragging (brush_t *b, face_t *f, qboolean shear)
void Brush_SetEpair (brush_t *b, const char *pKey, const char *pValue)
void Brush_SetTexture (brush_t *b, texdef_t *texdef, brushprimit_texdef_t *brushprimit_texdef, bool bFitScale=false, IPluginTexdef *pPlugTexdef=NULL)
void Brush_SideSelect (brush_t *b, vec3_t origin, vec3_t dir, qboolean shear)
void Brush_SnapToGrid (brush_t *pb)
void Brush_SplitBrushByFace (brush_t *in, face_t *f, brush_t **front, brush_t **back)
void Brush_Write (brush_t *b, CMemFile *pMemFile)
void Brush_Write (brush_t *b, FILE *f)
face_tFace_Alloc (void)
face_tFace_Clone (face_t *f)
void Face_Draw (face_t *face)
void Face_FitTexture (face_t *face, int nHeight, int nWidth)
void Face_Free (face_t *f)
void Face_MakePlane (face_t *f)
void Face_TextureVectors (face_t *f, float STfromXYZ[2][4])
void SetFaceTexdef (brush_t *b, face_t *f, texdef_t *texdef, brushprimit_texdef_t *brushprimit_texdef, bool bFitScale=false, IPluginTexdef *pPlugTexdef=NULL)
float SetShadeForPlane (plane_t *p)


Function Documentation

int AddPlanept float *  f  ) 
 

Definition at line 2987 of file Brush.cpp.

References QEGlobals_t::d_move_points, QEGlobals_t::d_num_move_points, g_qeglobals, and i.

Referenced by Brush_SelectFaceForDragging(), SelectFaceEdge(), and SelectVertex().

02988 {
02989     int     i;
02990 
02991     for (i=0 ; i<g_qeglobals.d_num_move_points ; i++)
02992         if (g_qeglobals.d_move_points[i] == f)
02993             return 0;
02994     g_qeglobals.d_move_points[g_qeglobals.d_num_move_points++] = f;
02995     return 1;
02996 }

void Brush_AddToList brush_t b,
brush_t list
 

Definition at line 2807 of file Brush.cpp.

References b, brush_t, DispatchRadiantMsg(), Error(), brush_s::next, Patch_Select(), brush_s::patchBrush, brush_s::pPatch, brush_s::prev, brush_s::pTerrain, RADIANT_SELECTION, selected_brushes, Terrain_Select(), and brush_s::terrainBrush.

Referenced by AddBrushForPatch(), AddBrushForTerrain(), AddProp(), AddRegionBrushes(), Brush_CopyList(), Brush_MakeSided(), Brush_MakeSidedCone(), Brush_MakeSidedSphere(), CPlugInManager::CommitBrushHandleToMap(), CXYWnd::Copy(), CopyAndSelect(), CopyToMap(), CreateEntityBrush(), CreateEntityFromName(), CreateSmartBrush(), CSG_MakeHollow(), CSG_Merge(), CSG_Subtract(), Map_ApplyRegion(), Map_RegionOff(), CXYWnd::NewBrushDrag(), CMainFrame::OnCreate(), CXYWnd::Paste(), CXYWnd::ProduceSplitLists(), QERApp_CreateBrush(), Select_AllOfType(), Select_Brush(), Select_Clone(), Select_CompleteTall(), Select_Inside(), Select_PartialTall(), Select_Ray(), Select_Touching(), SelectBrush(), Undo_AddBrush(), Undo_AddBrushList(), Undo_Redo(), and Undo_Undo().

02808 {
02809     if (b->next || b->prev)
02810         Error ("Brush_AddToList: allready linked");
02811     
02812     if (list == &selected_brushes || list == &active_brushes)
02813     {
02814         if (b->patchBrush && list == &selected_brushes)
02815         {
02816             Patch_Select(b->pPatch);
02817         }
02818         if (b->terrainBrush && list == &selected_brushes) {
02819             Terrain_Select(b->pTerrain);
02820         }
02821     }
02822     b->next = list->next;
02823     list->next->prev = b;
02824     list->next = b;
02825     b->prev = list;
02826     
02827     // TTimo messaging
02828     DispatchRadiantMsg( RADIANT_SELECTION );    
02829 }

Here is the call graph for this function:

brush_t* Brush_Alloc  ) 
 

Definition at line 46 of file Brush.cpp.

References b, brush_t, and qmalloc().

Referenced by Brush_Clone(), Brush_Create(), Brush_CreatePyramid(), Brush_FullClone(), Brush_MakeSided(), Brush_MakeSidedCone(), Brush_MakeSidedSphere(), Brush_Merge(), Brush_MergeList(), Brush_Parse(), and CPlugInManager::CreateBrushHandle().

00047 {
00048   brush_t *b = (brush_t*)qmalloc(sizeof(brush_t));
00049   return b;
00050 }

Here is the call graph for this function:

void Brush_Build brush_t b,
bool  bSnap = true,
bool  bMarkMap = true,
bool  bConvert = false
 

Definition at line 643 of file Brush.cpp.

References b, QEGlobals_t::bNeedConvert, Brush_BuildWindings(), brush_t, QEGlobals_t::d_select_mode, g_qeglobals, Group_AddToProperGroup(), QEGlobals_t::m_bBrushPrimitMode, Patch_BuildPoints(), sel_vertex, SetupVertexSelection(), Sys_MarkMapModified(), and Sys_Printf().

Referenced by AddBrushForPatch(), AddBrushForTerrain(), AddProp(), AddRegionBrushes(), Brush_FullClone(), Brush_MakeSided(), Brush_MakeSidedCone(), Brush_MakeSidedSphere(), Brush_Move(), Brush_RebuildBrush(), Brush_Resize(), Brush_Rotate(), Brush_SetTexture(), Brush_SnapToGrid(), Brush_SplitBrushByFace(), CPlugInManager::CommitBrushHandleToMap(), CPlugInManager::CommitEntityHandleToMap(), CXYWnd::Copy(), CopyAndSelect(), CopyBrush(), CopyToMap(), CreateEntityBrush(), CreateEntityFromName(), CreateSmartBrush(), Drag_Begin(), Entity_Create(), Entity_Parse(), FindReplaceTextures(), Map_BuildBrushData(), Map_ImportBuffer(), MoveSelection(), CXYWnd::NewBrushDrag(), CMainFrame::OnBrushFlipx(), CMainFrame::OnBrushFlipy(), CMainFrame::OnCreate(), CXYWnd::Paste(), QERApp_BuildBrush(), QERApp_BuildBrush2(), QERApp_CreateBrush(), QERApp_SetFaceInfo(), RotateTextures(), Select_ApplyMatrix(), Select_Clone(), Select_FitTexture(), Select_RotateTexture(), Select_Scale(), Select_ScaleTexture(), Select_SetTexture(), Select_ShiftTexture(), and Select_Ungroup().

00644 {
00645     bool        bLocalConvert;
00646 
00647 #ifdef _DEBUG
00648     if (!g_qeglobals.m_bBrushPrimitMode && bConvert)
00649         Sys_Printf("Warning : conversion from brush primitive to old brush format not implemented\n");
00650 #endif
00651 
00652     // if bConvert is set and g_qeglobals.bNeedConvert is not, that just means we need convert for this brush only
00653     if (bConvert && !g_qeglobals.bNeedConvert)
00654     {
00655         bLocalConvert = true;
00656         g_qeglobals.bNeedConvert = true;
00657     }
00658 
00659     /*
00660     ** build the windings and generate the bounding box
00661     */
00662     Brush_BuildWindings(b, bSnap);
00663 
00664     Patch_BuildPoints (b);
00665 
00666     /*
00667     ** move the points and edges if in select mode
00668     */
00669     if (g_qeglobals.d_select_mode == sel_vertex || g_qeglobals.d_select_mode == sel_edge)
00670         SetupVertexSelection ();
00671 
00672     if (b->itemOwner == NULL)
00673       Group_AddToProperGroup(b);
00674 
00675     if (bMarkMap)
00676     {
00677         Sys_MarkMapModified();
00678     }
00679 
00680     if (bLocalConvert)
00681         g_qeglobals.bNeedConvert = false;
00682 }

Here is the call graph for this function:

void Brush_BuildWindings brush_t b,
bool  bSnap = true
 

Definition at line 3150 of file Brush.cpp.

References b, QEGlobals_t::bNeedConvert, brush_s::brush_faces, Brush_MakeFacePlanes(), Brush_MakeFaceWinding(), Brush_SnapPlanepts(), brush_t, face_s::d_texture, EmitBrushPrimitTextureCoordinates(), EmitTextureCoordinates(), Face_SetColor(), face_t, face_s::face_winding, FaceToBrushPrimitFace(), free(), g_qeglobals, i, j, QEGlobals_t::m_bBrushPrimitMode, brush_s::maxs, brush_s::mins, texdef_t::name, face_s::next, winding_t::numpoints, winding_t::points, face_s::texdef, Texture_ForName(), v, vec_t, and w.

Referenced by Brush_Build(), Brush_Merge(), and Brush_MergeList().

03151 {
03152     winding_t *w;
03153     face_t    *face;
03154     vec_t      v;
03155 
03156     if (bSnap)
03157         Brush_SnapPlanepts( b );
03158 
03159     // clear the mins/maxs bounds
03160     b->mins[0] = b->mins[1] = b->mins[2] = 99999;
03161     b->maxs[0] = b->maxs[1] = b->maxs[2] = -99999;
03162 
03163     Brush_MakeFacePlanes (b);
03164 
03165     face = b->brush_faces;
03166 
03167     float fCurveColor = 1.0;
03168 
03169     for ( ; face ; face=face->next)
03170     {
03171         int i, j;
03172         free(face->face_winding);
03173         w = face->face_winding = Brush_MakeFaceWinding (b, face);
03174         face->d_texture = Texture_ForName( face->texdef.name );
03175 
03176         if (!w)
03177             continue;
03178     
03179         for (i=0 ; i<w->numpoints ; i++)
03180         {
03181             // add to bounding box
03182             for (j=0 ; j<3 ; j++)
03183             {
03184                 v = w->points[i][j];
03185                 if (v > b->maxs[j])
03186                     b->maxs[j] = v;
03187                 if (v < b->mins[j])
03188                     b->mins[j] = v;
03189             }
03190         }
03191         // setup s and t vectors, and set color
03192         //if (!g_PrefsDlg.m_bGLLighting)
03193     //{
03194           Face_SetColor (b, face, fCurveColor);
03195     //}
03196 
03197         fCurveColor -= .10;
03198         if (fCurveColor <= 0)
03199             fCurveColor = 1.0;
03200 
03201         // computing ST coordinates for the windings
03202         if (g_qeglobals.m_bBrushPrimitMode)
03203         {
03204             if (g_qeglobals.bNeedConvert)
03205             {
03206                 // we have parsed old brushes format and need conversion
03207                 // convert old brush texture representation to new format
03208                 FaceToBrushPrimitFace(face);
03209 #ifdef _DEBUG
03210                 // use old texture coordinates code to check against
03211                 for (i=0 ; i<w->numpoints ; i++)
03212                     EmitTextureCoordinates( w->points[i], face->d_texture, face);
03213 #endif
03214             }
03215             // use new texture representation to compute texture coordinates
03216             // in debug mode we will check against old code and warn if there are differences
03217             EmitBrushPrimitTextureCoordinates(face,w);
03218         }
03219         else
03220         {
03221             for (i=0 ; i<w->numpoints ; i++)
03222                 EmitTextureCoordinates( w->points[i], face->d_texture, face);
03223         }
03224     }
03225 }

Here is the call graph for this function:

brush_t* Brush_Clone brush_t b  ) 
 

Definition at line 2619 of file Brush.cpp.

References b, Brush_Alloc(), brush_s::brush_faces, Brush_RemoveFromList(), brush_t, Entity_UnlinkBrush(), f, Face_Clone(), face_t, g_nBrushId, n, face_s::next, brush_s::numberId, brush_s::owner, p, Patch_Duplicate(), brush_s::patchBrush, brush_s::pPatch, terrainMesh_t::pSymbiot, patchMesh_t::pSymbiot, brush_s::pTerrain, Terrain_Duplicate(), and brush_s::terrainBrush.

Referenced by Brush_SplitBrushByFace(), CXYWnd::Copy(), CopyBrush(), CXYWnd::Paste(), and Select_Clone().

02620 {
02621     brush_t *n = NULL;
02622     face_t  *f, *nf;
02623 
02624     if (b->patchBrush)
02625     {
02626         patchMesh_t *p = Patch_Duplicate(b->pPatch);
02627         Brush_RemoveFromList(p->pSymbiot);
02628         Entity_UnlinkBrush(p->pSymbiot);
02629         n = p->pSymbiot;
02630     }
02631     else if (b->terrainBrush)
02632     {
02633         terrainMesh_t *p = Terrain_Duplicate(b->pTerrain);
02634         Brush_RemoveFromList(p->pSymbiot);
02635         Entity_UnlinkBrush(p->pSymbiot);
02636         n = p->pSymbiot;
02637     }
02638     else
02639     {
02640     n = Brush_Alloc();
02641       n->numberId = g_nBrushId++;
02642         n->owner = b->owner;
02643         for (f=b->brush_faces ; f ; f=f->next)
02644         {
02645             nf = Face_Clone( f );
02646             nf->next = n->brush_faces;
02647             n->brush_faces = nf;
02648         }
02649     }
02650 
02651     return n;
02652 }

Here is the call graph for this function:

brush_t* Brush_Create vec3_t  mins,
vec3_t  maxs,
texdef_t texdef
 

Definition at line 2210 of file Brush.cpp.

References b, Brush_Alloc(), brush_s::brush_faces, brush_t, texdef_t::contents, Error(), f, Face_Alloc(), face_t, texdef_t::flags, g_qeglobals, i, j, QEGlobals_t::m_bBrushPrimitMode, face_s::next, face_s::planepts, texdef_t::rotate, texdef_t::scale, texdef_t::shift, Sys_Printf(), face_s::texdef, vec3_t, and VectorCopy.

Referenced by AddBrushForPatch(), AddBrushForTerrain(), AddProp(), AddRegionBrushes(), Brush_CreatePyramid(), Brush_Resize(), CPlugInManager::CommitEntityHandleToMap(), CreateEntityBrush(), CreateEntityFromName(), CreateSmartBrush(), Entity_Create(), Entity_Parse(), CXYWnd::NewBrushDrag(), CMainFrame::OnCreate(), and QERApp_CreateBrush().

02211 {
02212     int     i, j;
02213     vec3_t  pts[4][2];
02214     face_t  *f;
02215     brush_t *b;
02216 
02217     // brush primitive mode : convert texdef to brushprimit_texdef ?
02218     // most of the time texdef is empty
02219     if (g_qeglobals.m_bBrushPrimitMode)
02220     {
02221         // check texdef is empty .. if there are cases it's not we need to write some conversion code
02222         if (texdef->shift[0]!=0 || texdef->shift[1]!=0 || texdef->scale[0]!=0 || texdef->scale[1]!=0 || texdef->rotate!=0)
02223             Sys_Printf("Warning : non-zero texdef detected in Brush_Create .. need brush primitive conversion\n");
02224     }
02225 
02226     for (i=0 ; i<3 ; i++)
02227     {
02228         if (maxs[i] < mins[i])
02229             Error ("Brush_InitSolid: backwards");
02230     }
02231 
02232     b = Brush_Alloc();
02233     
02234     pts[0][0][0] = mins[0];
02235     pts[0][0][1] = mins[1];
02236     
02237     pts[1][0][0] = mins[0];
02238     pts[1][0][1] = maxs[1];
02239     
02240     pts[2][0][0] = maxs[0];
02241     pts[2][0][1] = maxs[1];
02242     
02243     pts[3][0][0] = maxs[0];
02244     pts[3][0][1] = mins[1];
02245     
02246     for (i=0 ; i<4 ; i++)
02247     {
02248         pts[i][0][2] = mins[2];
02249         pts[i][1][0] = pts[i][0][0];
02250         pts[i][1][1] = pts[i][0][1];
02251         pts[i][1][2] = maxs[2];
02252     }
02253 
02254     for (i=0 ; i<4 ; i++)
02255     {
02256         f = Face_Alloc();
02257         f->texdef = *texdef;
02258         f->texdef.flags &= ~SURF_KEEP;
02259         f->texdef.contents &= ~CONTENTS_KEEP;
02260         f->next = b->brush_faces;
02261         b->brush_faces = f;
02262         j = (i+1)%4;
02263 
02264         VectorCopy (pts[j][1], f->planepts[0]);
02265         VectorCopy (pts[i][1], f->planepts[1]);
02266         VectorCopy (pts[i][0], f->planepts[2]);
02267     }
02268     
02269     f = Face_Alloc();
02270     f->texdef = *texdef;
02271     f->texdef.flags &= ~SURF_KEEP;
02272     f->texdef.contents &= ~CONTENTS_KEEP;
02273     f->next = b->brush_faces;
02274     b->brush_faces = f;
02275 
02276     VectorCopy (pts[0][1], f->planepts[0]);
02277     VectorCopy (pts[1][1], f->planepts[1]);
02278     VectorCopy (pts[2][1], f->planepts[2]);
02279 
02280     f = Face_Alloc();
02281     f->texdef = *texdef;
02282     f->texdef.flags &= ~SURF_KEEP;
02283     f->texdef.contents &= ~CONTENTS_KEEP;
02284     f->next = b->brush_faces;
02285     b->brush_faces = f;
02286 
02287     VectorCopy (pts[2][0], f->planepts[0]);
02288     VectorCopy (pts[1][0], f->planepts[1]);
02289     VectorCopy (pts[0][0], f->planepts[2]);
02290 
02291     return b;
02292 }

Here is the call graph for this function:

void Brush_Draw brush_t b  ) 
 

Definition at line 3920 of file Brush.cpp.

References b, qtexture_s::bFromShader, brush_s::bModelFailed, Brush_DrawFacingAngle(), brush_s::brush_faces, brush_t, CCamWnd::Camera(), IPluginEntity::CamRender(), cd_texture, face_s::d_color, QEGlobals_t::d_savedinfo, face_s::d_texture, camera_t::draw_mode, DrawLight(), entity_s::eclass, SavedInfo_t::exclude, face_t, face_s::face_winding, eclass_s::fixedsize, texdef_t::flags, qtexture_s::fTrans, g_pParentWnd, g_PrefsDlg, g_qeglobals, CMainFrame::GetCamera(), brush_s::hiddenBrush, i, CPrefsDlg::m_bGLLighting, CPrefsDlg::m_bNewLightDraw, texdef_t::name, face_s::next, plane_t::normal, eclass_s::nShowFlags, winding_t::numpoints, order, brush_s::owner, PaintedModel(), Patch_DrawCam(), brush_s::patchBrush, face_s::plane, winding_t::points, brush_s::pPatch, entity_s::pPlugEnt, brush_s::pTerrain, qglBegin, qglBindTexture, qglColor3fv, qglColor4f, qglDisable, qglEnable, qglEnd, qglNormal3fv, qglTexCoord2fv, qglVertex3fv, qtexture_t, strstr(), Terrain_DrawCam(), brush_s::terrainBrush, face_s::texdef, qtexture_s::texture_number, and w.

Referenced by CCamWnd::Cam_Draw().

03921 {
03922     face_t          *face;
03923     int             i, order;
03924     qtexture_t      *prev = 0;
03925     winding_t *w;
03926 
03927     if ( b->owner && ( b->owner->eclass->nShowFlags & ECLASS_PLUGINENTITY ) )
03928     {
03929         b->owner->pPlugEnt->CamRender();
03930         return;
03931     }
03932     
03933     // (TTimo) NOTE: added by build 173, I check after pPlugEnt so it doesn't interfere ?
03934     if (b->hiddenBrush)
03935     {
03936         return;
03937     }
03938 
03939     if (b->patchBrush)
03940     {
03941         //Patch_DrawCam(b->nPatchID);
03942         Patch_DrawCam(b->pPatch);
03943         //if (!g_bPatchShowBounds)
03944         return;
03945     }
03946     
03947     if (b->terrainBrush)
03948     {
03949         Terrain_DrawCam(b->pTerrain);
03950         return;
03951     }
03952 
03953     int nDrawMode = g_pParentWnd->GetCamera()->Camera().draw_mode;
03954     
03955     if (b->owner->eclass->fixedsize)
03956     {
03957         
03958         if (!(g_qeglobals.d_savedinfo.exclude & EXCLUDE_ANGLES) && (b->owner->eclass->nShowFlags & ECLASS_ANGLE))
03959         {
03960             Brush_DrawFacingAngle(b, b->owner);
03961         }
03962         
03963         if (g_PrefsDlg.m_bNewLightDraw && (b->owner->eclass->nShowFlags & ECLASS_LIGHT))
03964         {
03965             DrawLight(b);
03966             return;
03967         }
03968         if (nDrawMode == cd_texture || nDrawMode == cd_light)
03969             qglDisable (GL_TEXTURE_2D);
03970         
03971         // if we are wireframing models
03972         bool bp = (b->bModelFailed) ? false : PaintedModel(b, true);
03973         
03974         if (nDrawMode == cd_texture || nDrawMode == cd_light)
03975             qglEnable (GL_TEXTURE_2D);
03976         
03977         if (bp)
03978             return;
03979     }
03980     
03981     // guarantee the texture will be set first
03982     prev = NULL;
03983     for (face = b->brush_faces,order = 0 ; face ; face=face->next, order++)
03984     {
03985         w = face->face_winding;
03986         if (!w)
03987         {
03988             continue;       // freed face
03989         }
03990         
03991         if (g_qeglobals.d_savedinfo.exclude & EXCLUDE_CAULK)
03992         {
03993             if (strstr(face->texdef.name, "caulk"))
03994             {
03995                 continue;
03996             }
03997         }
03998         
03999 #if 0
04000         if (b->alphaBrush)
04001         {
04002             if (!(face->texdef.flags & SURF_ALPHA))
04003                 continue;
04004             //--qglPushAttrib(GL_ALL_ATTRIB_BITS);
04005             qglDisable(GL_CULL_FACE);
04006             //--qglTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
04007             //--qglBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
04008             //--qglDisable(GL_DEPTH_TEST);
04009             //--qglBlendFunc (GL_SRC_ALPHA, GL_DST_ALPHA);
04010             //--qglEnable (GL_BLEND);
04011         }
04012 #endif
04013         
04014         if ((nDrawMode == cd_texture || nDrawMode == cd_light) && face->d_texture != prev)
04015         {
04016             // set the texture for this face
04017             prev = face->d_texture;
04018             qglBindTexture( GL_TEXTURE_2D, face->d_texture->texture_number );
04019         }
04020         
04021         
04022         
04023         if (!b->patchBrush)
04024         {
04025             if (face->texdef.flags & SURF_TRANS33) 
04026                 qglColor4f ( face->d_color[0], face->d_color[1], face->d_color[2], 0.33 );
04027             else if ( face->texdef.flags & SURF_TRANS66) 
04028                 qglColor4f ( face->d_color[0], face->d_color[1], face->d_color[2], 0.66 );
04029             else
04030                 qglColor3fv( face->d_color );
04031         }
04032         else
04033         {
04034             qglColor4f ( face->d_color[0], face->d_color[1], face->d_color[2], 0.13 );
04035         }
04036         
04037         // shader drawing stuff
04038         if (face->d_texture->bFromShader)
04039         {
04040             // setup shader drawing
04041             qglColor4f ( face->d_color[0], face->d_color[1], face->d_color[2], face->d_texture->fTrans );
04042             
04043         }
04044         
04045         // draw the polygon
04046         
04047         //if (nDrawMode == cd_light)
04048         //{
04049         if (g_PrefsDlg.m_bGLLighting)
04050         {
04051             qglNormal3fv(face->plane.normal);
04052         }
04053         //}
04054         
04055         qglBegin(GL_POLYGON);
04056         //if (nDrawMode == cd_light)
04057         
04058         for (i=0 ; i<w->numpoints ; i++)
04059         {
04060             if (nDrawMode == cd_texture || nDrawMode == cd_light)
04061                 qglTexCoord2fv( &w->points[i][3] );
04062             qglVertex3fv(w->points[i]);
04063         }
04064         qglEnd();
04065     }
04066     
04067 #if 0
04068     if (b->alphaBrush)
04069     {
04070         //--qglPopAttrib();
04071         qglEnable(GL_CULL_FACE);
04072         //--qglDisable (GL_BLEND);
04073         //--qglTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
04074     }
04075 #endif
04076     
04077     if (b->owner->eclass->fixedsize && (nDrawMode == cd_texture || nDrawMode == cd_light))
04078         qglEnable (GL_TEXTURE_2D);
04079     
04080     qglBindTexture( GL_TEXTURE_2D, 0 );
04081 }

Here is the call graph for this function:

void Brush_DrawXY brush_t b,
int  nViewType
 

Definition at line 4097 of file Brush.cpp.

References b, brush_s::brush_faces, brush_t, DrawBrushEntityName(), entity_s::eclass, face_t, face_s::face_winding, eclass_s::fixedsize, g_PrefsDlg, brush_s::hiddenBrush, i, CPrefsDlg::m_bNewLightDraw, brush_s::maxs, brush_s::mins, face_s::next, plane_t::normal, eclass_s::nShowFlags, winding_t::numpoints, order, brush_s::owner, PaintedModel(), Patch_DrawXY(), brush_s::patchBrush, face_s::plane, winding_t::points, brush_s::pPatch, brush_s::pTerrain, qglBegin, qglEnd, qglPolygonMode, qglVertex3fv, Terrain_DrawXY(), brush_s::terrainBrush, vec3_t, VectorCopy, and w.

Referenced by CXYWnd::XY_Draw().

04098 {
04099     face_t *face;
04100     int     order;
04101     winding_t *w;
04102     int        i;
04103 
04104     if (b->hiddenBrush)
04105     {
04106         return;
04107     }
04108 
04109     if (b->patchBrush)
04110     {
04111         //Patch_DrawXY(b->nPatchID);
04112         Patch_DrawXY(b->pPatch);
04113         if (!g_bPatchShowBounds)
04114             return;
04115     }
04116 
04117     if (b->terrainBrush)
04118     {
04119         Terrain_DrawXY(b->pTerrain, b->owner);
04120     }
04121                      
04122 
04123     if (b->owner->eclass->fixedsize)
04124     {
04125         if (g_PrefsDlg.m_bNewLightDraw && (b->owner->eclass->nShowFlags & ECLASS_LIGHT))
04126         {
04127             vec3_t vCorners[4];
04128             float fMid = b->mins[2] + (b->maxs[2] - b->mins[2]) / 2;
04129 
04130             vCorners[0][0] = b->mins[0];
04131             vCorners[0][1] = b->mins[1];
04132             vCorners[0][2] = fMid;
04133 
04134             vCorners[1][0] = b->mins[0];
04135             vCorners[1][1] = b->maxs[1];
04136             vCorners[1][2] = fMid;
04137 
04138             vCorners[2][0] = b->maxs[0];
04139             vCorners[2][1] = b->maxs[1];
04140             vCorners[2][2] = fMid;
04141 
04142             vCorners[3][0] = b->maxs[0];
04143             vCorners[3][1] = b->mins[1];
04144             vCorners[3][2] = fMid;
04145 
04146             vec3_t vTop, vBottom;
04147 
04148             vTop[0] = b->mins[0] + ((b->maxs[0] - b->mins[0]) / 2);
04149             vTop[1] = b->mins[1] + ((b->maxs[1] - b->mins[1]) / 2);
04150             vTop[2] = b->maxs[2];
04151 
04152             VectorCopy(vTop, vBottom);
04153             vBottom[2] = b->mins[2];
04154 
04155             qglPolygonMode (GL_FRONT_AND_BACK, GL_LINE);
04156             qglBegin(GL_TRIANGLE_FAN);
04157             qglVertex3fv(vTop);
04158             qglVertex3fv(vCorners[0]);
04159             qglVertex3fv(vCorners[1]);
04160             qglVertex3fv(vCorners[2]);
04161             qglVertex3fv(vCorners[3]);
04162             qglVertex3fv(vCorners[0]);
04163             qglEnd();
04164             qglBegin(GL_TRIANGLE_FAN);
04165             qglVertex3fv(vBottom);
04166             qglVertex3fv(vCorners[0]);
04167             qglVertex3fv(vCorners[3]);
04168             qglVertex3fv(vCorners[2]);
04169             qglVertex3fv(vCorners[1]);
04170             qglVertex3fv(vCorners[0]);
04171             qglEnd();
04172             DrawBrushEntityName (b);
04173             return;
04174         }
04175         else if (b->owner->eclass->nShowFlags & ECLASS_MISCMODEL)
04176         {
04177             if (PaintedModel(b, false))
04178             return;
04179         }
04180     }
04181 
04182     for (face = b->brush_faces,order = 0 ; face ; face=face->next, order++)
04183     {
04184         // only draw polygons facing in a direction we care about
04185     if (nViewType == XY)
04186     {
04187           if (face->plane.normal[2] <= 0)
04188               continue;
04189     }
04190     else
04191     {
04192       if (nViewType == XZ)
04193       {
04194         if (face->plane.normal[1] <= 0)
04195           continue;
04196       }
04197       else 
04198       {
04199         if (face->plane.normal[0] <= 0)
04200           continue;
04201       }
04202     }
04203 
04204         w = face->face_winding;
04205         if (!w)
04206             continue;
04207 
04208     //if (b->alphaBrush && !(face->texdef.flags & SURF_ALPHA))
04209     //  continue;
04210 
04211         // draw the polygon
04212         qglBegin(GL_LINE_LOOP);
04213     for (i=0 ; i<w->numpoints ; i++)
04214           qglVertex3fv(w->points[i]);
04215         qglEnd();
04216     }
04217 
04218     DrawBrushEntityName (b);
04219 
04220 }

Here is the call graph for this function:

void Brush_FitTexture brush_t b,
int  nHeight,
int  nWidth
 

Definition at line 4585 of file Brush.cpp.

References b, brush_s::brush_faces, brush_t, Face_FitTexture(), face_t, and face_s::next.

Referenced by Select_FitTexture().

04586 {
04587     face_t *face;
04588 
04589     for (face = b->brush_faces ; face ; face=face->next)
04590   {
04591     Face_FitTexture( face, nHeight, nWidth );
04592   }
04593 }

Here is the call graph for this function:

void Brush_Free brush_t b,
bool  bRemoveNode = true
 

Definition at line 2510 of file Brush.cpp.

References b, brush_s::brush_faces, Brush_RemoveFromList(), brush_t, Entity_UnlinkBrush(), epair_t, brush_s::epairs, f, Face_Free(), face_t, free(), Group_RemoveBrush(), epair_s::key, brush_s::next, epair_s::next, face_s::next, next, brush_s::onext, Patch_Delete(), brush_s::patchBrush, brush_s::pPatch, brush_s::pTerrain, Terrain_Delete(), brush_s::terrainBrush, and epair_s::value.

Referenced by AddProp(), Brush_MakeConvexBrushes(), Brush_MakeSided(), Brush_MakeSidedCone(), Brush_MakeSidedSphere(), Brush_MergeListPairs(), Brush_SplitBrushByFace(), Brush_Subtract(), CleanList(), CPlugInManager::Cleanup(), CreateEntityFromName(), CSG_MakeHollow(), CSG_Merge(), CSG_Subtract(), Entity_Free(), Entity_Parse(), Map_BuildBrushData(), Map_Free(), CXYWnd::NewBrushDrag(), CMainFrame::OnDestroy(), QERApp_DeletePatch(), RemoveRegionBrushes(), Select_Delete(), Undo_Clear(), Undo_ClearRedo(), and Undo_FreeFirstUndo().

02511 {
02512     face_t  *f, *next;
02513     epair_t *ep, *enext;
02514 
02515     // remove from group
02516     if (bRemoveNode)
02517         Group_RemoveBrush(b);
02518 
02519     // free the patch if it's there
02520     if (b->patchBrush)
02521     {
02522         Patch_Delete(b->pPatch);
02523     }
02524 
02525     if( b->terrainBrush )
02526     {
02527         Terrain_Delete( b->pTerrain );
02528     }
02529 
02530     // free faces
02531     for (f=b->brush_faces ; f ; f=next)
02532     {
02533         next = f->next;
02534         Face_Free( f );
02535     }
02536 
02537     //Timo : free brush epairs
02538     for (ep = b->epairs ; ep ; ep=enext )
02539     {
02540         enext = ep->next;
02541         free (ep->key);
02542         free (ep->value);
02543         free (ep);
02544     }
02545 
02546     // unlink from active/selected list
02547     if (b->next)
02548         Brush_RemoveFromList (b);
02549 
02550     // unlink from entity list
02551     if (b->onext)
02552         Entity_UnlinkBrush (b);
02553 
02554     free (b);
02555 }

Here is the call graph for this function:

brush_t* Brush_FullClone brush_t b