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

Brush.cpp File Reference

#include "stdafx.h"
#include <assert.h>
#include "qe3.h"
#include "winding.h"

Include dependency graph for Brush.cpp:

Include dependency graph

Go to the source code of this file.

Defines

#define INTERSECT_EPSILON   0.1
#define INTERSECT_EPSILON   0.1
#define MAX_MOVE_FACES   64
#define MAX_MOVE_FACES   64
#define MAX_MOVE_FACES   64
#define POINT_EPSILON   0.3
#define POINT_EPSILON   0.3

Functions

int AddPlanept (float *f)
void Brush_AddToList (brush_t *b, brush_t *list)
brush_tBrush_Alloc ()
face_tBrush_BestSplitFace (brush_t *b)
void Brush_Build (brush_t *b, bool bSnap, bool bMarkMap, bool bConvert)
void Brush_BuildWindings (brush_t *b, bool bSnap)
void Brush_Center (brush_t *b, vec3_t vNewCenter)
brush_tBrush_Clone (brush_t *b)
int Brush_Convex (brush_t *b)
brush_tBrush_Create (vec3_t mins, vec3_t maxs, texdef_t *texdef)
brush_tBrush_CreatePyramid (vec3_t mins, vec3_t maxs, texdef_t *texdef)
void Brush_Draw (brush_t *b)
void Brush_DrawFacingAngle (brush_t *b, entity_t *e)
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)
brush_tBrush_FullClone (brush_t *b)
const char * Brush_GetKeyValue (brush_t *b, const char *pKey)
int Brush_InsertVertexBetween (brush_t *b, vec3_t p1, vec3_t p2)
brush_tBrush_MakeConvexBrushes (brush_t *b)
void Brush_MakeFacePlanes (brush_t *b)
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)
int Brush_MoveVertex (brush_t *b, vec3_t vertex, vec3_t delta, vec3_t end, bool bSnap)
int Brush_MoveVertex_old1 (brush_t *b, vec3_t vertex, vec3_t delta, vec3_t end, bool bSnap)
int Brush_MoveVertex_old2 (brush_t *b, vec3_t vertex, vec3_t delta, vec3_t end, bool bSnap)
const char * Brush_Name (brush_t *b)
brush_tBrush_Parse (void)
face_tBrush_Point (vec3_t origin, brush_t *b)
void Brush_Print (brush_t *b)
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_Resize (brush_t *b, vec3_t vMin, vec3_t vMax)
void Brush_Rotate (brush_t *b, vec3_t vAngle, vec3_t vOrigin, bool bBuild)
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, IPluginTexdef *pTexdef)
void Brush_SideSelect (brush_t *b, vec3_t origin, vec3_t dir, qboolean shear)
void Brush_SnapPlanepts (brush_t *b)
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)
void Clamp (float &f, int nClamp)
qboolean ClipLineToFace (vec3_t p1, vec3_t p2, face_t *f)
void DrawBrushEntityName (brush_t *b)
void DrawLight (brush_t *b)
void EmitTextureCoordinates (float *xyzst, qtexture_t *q, face_t *f)
face_tFace_Alloc (void)
face_tFace_Clone (face_t *f)
void Face_Draw (face_t *f)
void Face_FitTexture (face_t *face, int nHeight, int nWidth)
void Face_Free (face_t *f)
face_tFace_FullClone (face_t *f)
void Face_MakePlane (face_t *f)
int Face_MemorySize (face_t *f)
void Face_MoveTexture (face_t *f, vec3_t delta)
void Face_SetColor (brush_t *b, face_t *f, float fCurveColor)
void Face_TextureVectors (face_t *f, float STfromXYZ[2][4])
void FacingVectors (entity_t *e, vec3_t forward, vec3_t right, vec3_t up)
eclass_tHasModel (brush_t *b)
bool PaintedModel (brush_t *b, bool bOkToTexture)
void PrintPlane (plane_t *p)
void PrintVector (vec3_t v)
void PrintWinding (winding_t *w)
void WINAPI QERApp_MapPrintf_FILE (char *text,...)
void WINAPI QERApp_MapPrintf_MEMFILE (char *text,...)
void SetFaceTexdef (brush_t *b, face_t *f, texdef_t *texdef, brushprimit_texdef_t *brushprimit_texdef, bool bFitScale, IPluginTexdef *pPlugTexdef)
float SetShadeForPlane (plane_t *p)
void TextureAxisFromPlane (plane_t *pln, vec3_t xv, vec3_t yv)

Variables

vec3_t baseaxis [18]
bool g_bDoIt = false
bool g_bInPaintedModel = false
FILEg_File
int g_nBrushId = 0
CMemFile * g_pMemFile
float lightaxis [3] = {0.6, 0.8, 1.0}
float shift [2]
vec3_t vecs [2]


Define Documentation

#define INTERSECT_EPSILON   0.1
 

Definition at line 1125 of file Brush.cpp.

#define INTERSECT_EPSILON   0.1
 

Definition at line 1125 of file Brush.cpp.

#define MAX_MOVE_FACES   64
 

Definition at line 1318 of file Brush.cpp.

#define MAX_MOVE_FACES   64
 

Definition at line 1318 of file Brush.cpp.

#define MAX_MOVE_FACES   64
 

Definition at line 1318 of file Brush.cpp.

#define POINT_EPSILON   0.3
 

Definition at line 1126 of file Brush.cpp.

#define POINT_EPSILON   0.3
 

Definition at line 1126 of file Brush.cpp.


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:

face_t* Brush_BestSplitFace brush_t b  ) 
 

Definition at line 751 of file Brush.cpp.

References b, brush_s::brush_faces, brush_t, plane_t::dist, f, face_t, face_s::face_winding, face_s::next, plane_t::normal, face_s::plane, value, Winding_Free(), Winding_IsTiny(), and Winding_SplitEpsilon().

Referenced by Brush_MakeConvexBrushes().

00752 {
00753     face_t *face, *f, *bestface;
00754     winding_t *front, *back;
00755     int splits, tinywindings, value, bestvalue;
00756 
00757     bestvalue = 999999;
00758     bestface = NULL;
00759     for (face = b->brush_faces; face; face = face->next)
00760     {
00761         splits = 0;
00762         tinywindings = 0;
00763         for (f = b->brush_faces; f; f = f->next)
00764         {
00765             if (f == face) continue;
00766             //
00767             Winding_SplitEpsilon(f->face_winding, face->plane.normal, face->plane.dist, 0.1, &front, &back);
00768 
00769             if (!front)
00770             {
00771                 Winding_Free(back);
00772             }
00773             else if (!back)
00774             {
00775                 Winding_Free(front);
00776             }
00777             else
00778             {
00779                 splits++;
00780                 if (Winding_IsTiny(front)) tinywindings++;
00781                 if (Winding_IsTiny(back)) tinywindings++;
00782             }
00783         }
00784         if (splits)
00785         {
00786             value = splits + 50 * tinywindings;
00787             if (value < bestvalue)
00788             {
00789                 bestvalue = value;
00790                 bestface = face;
00791             }
00792         }
00793     }
00794     return bestface;
00795 }

Here is the call graph for this function:

void Brush_Build brush_t b,
bool  bSnap,
bool  bMarkMap,
bool  bConvert
 

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
 

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:

void Brush_Center brush_t b,
vec3_t  vNewCenter
 

Definition at line 3285 of file Brush.cpp.

References abs(), b, Brush_Move(), brush_t, j, brush_s::maxs, brush_s::mins, vec3_t, and VectorSubtract.

03286 {
03287   vec3_t vMid;
03288   // get center of the brush
03289   for (int j = 0; j < 3; j++)
03290   {
03291     vMid[j] = b->mins[j] + abs((b->maxs[j] - b->mins[j]) * 0.5);
03292   }
03293   // calc distance between centers
03294   VectorSubtract(vNewCenter, vMid, vMid);
03295   Brush_Move(b, vMid, true);
03296 
03297 }

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, patchMesh_t::pSymbiot, terrainMesh_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:

int Brush_Convex brush_t b  ) 
 

Definition at line 837 of file Brush.cpp.

References b, brush_s::brush_faces, brush_t, plane_t::dist, face_t, face_s::face_winding, face_s::next, plane_t::normal, face_s::plane, and Winding_PlanesConcave().

00838 {
00839     face_t *face1, *face2;
00840 
00841     for (face1 = b->brush_faces; face1; face1 = face1->next)
00842     {
00843         if (!face1->face_winding) continue;
00844         for (face2 = b->brush_faces; face2; face2 = face2->next)
00845         {
00846             if (face1 == face2) continue;
00847             if (!face2->face_winding) continue;
00848             if (Winding_PlanesConcave(face1->face_winding, face2->face_winding,
00849                                         face1->plane.normal, face2->plane.normal,
00850                                         face1->plane.dist, face2->plane.dist))
00851             {
00852                 return false;
00853             }
00854         }
00855     }
00856     return true;
00857 }

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:

brush_t* Brush_CreatePyramid vec3_t  mins,
vec3_t  maxs,
texdef_t texdef
 

Definition at line 2302 of file Brush.cpp.

References b, bottom, Brush_Alloc(), Brush_Create(), brush_s::brush_faces, brush_t, texdef_t::contents, Error(), f, Face_Alloc(), face_t, texdef_t::flags, i, j, face_s::next, face_s::planepts, Q_rint(), face_s::texdef, top, vec3_t, and VectorCopy.

02303 {
02304     //++timo handle new brush primitive ? return here ??
02305     return Brush_Create(mins, maxs, texdef);
02306 
02307     for (int i=0 ; i<3 ; i++)
02308         if (maxs[i] < mins[i])
02309             Error ("Brush_InitSolid: backwards");
02310 
02311     brush_t* b = Brush_Alloc();
02312 
02313     vec3_t corners[4];
02314 
02315     float fMid = Q_rint(mins[2] + (Q_rint((maxs[2] - mins[2]) / 2)));
02316 
02317     corners[0][0] = mins[0];
02318     corners[0][1] = mins[1];
02319     corners[0][2] = fMid;
02320 
02321     corners[1][0] = mins[0];
02322     corners[1][1] = maxs[1];
02323     corners[1][2] = fMid;
02324 
02325     corners[2][0] = maxs[0];
02326     corners[2][1] = maxs[1];
02327     corners[2][2] = fMid;
02328 
02329     corners[3][0] = maxs[0];
02330     corners[3][1] = mins[1];
02331     corners[3][2] = fMid;
02332 
02333     vec3_t top, bottom;
02334 
02335     top[0] = Q_rint(mins[0] + ((maxs[0] - mins[0]) / 2));
02336     top[1] = Q_rint(mins[1] + ((maxs[1] - mins[1]) / 2));
02337     top[2] = Q_rint(maxs[2]);
02338 
02339     VectorCopy(top, bottom);
02340     bottom[2] = mins[2];
02341 
02342     // sides
02343     for (i = 0; i < 4; i++)
02344     {
02345         face_t* f = Face_Alloc();
02346         f->texdef = *texdef;
02347         f->texdef.flags &= ~SURF_KEEP;
02348         f->texdef.contents &= ~CONTENTS_KEEP;
02349         f->next = b->brush_faces;
02350         b->brush_faces = f;
02351         int j = (i+1)%4;
02352 
02353         VectorCopy (top, f->planepts[0]);
02354         VectorCopy (corners[i], f->planepts[1]);
02355         VectorCopy(corners[j], f->planepts[2]);
02356 
02357         f = Face_Alloc();
02358         f->texdef = *texdef;
02359         f->texdef.flags &= ~SURF_KEEP;
02360         f->texdef.contents &= ~CONTENTS_KEEP;
02361         f->next = b->brush_faces;
02362         b->brush_faces = f;
02363 
02364         VectorCopy (bottom, f->planepts[2]);
02365         VectorCopy (corners[i], f->planepts[1]);
02366         VectorCopy(corners[j], f->planepts[0]);
02367     }
02368 
02369     return b;
02370 }

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