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

PMESH.CPP File Reference

#include "stdafx.h"
#include "qe3.h"
#include "DialogInfo.h"
#include "CapDialog.h"

Include dependency graph for PMESH.CPP:

Include dependency graph

Go to the source code of this file.

Defines

#define CBLOCK_SUBDIVISIONS   6

Enumerations

enum  {
  BEND_SELECT_ROTATION = 0, BEND_SELECT_ORIGIN, BEND_SELECT_EDGE, BEND_BENDIT,
  BEND_STATE_COUNT
}
enum  { INSERT_SELECT_EDGE = 0, INSERT_STATE_COUNT }

Functions

vec_t __VectorNormalize (vec3_t in, vec3_t out)
void _DecColor (float fColor[3])
void _SetColor (face_t *f, float fColor[3])
void _Write1DMatrix (CMemFile *f, int x, float *m)
void _Write1DMatrix (FILE *f, int x, float *m)
void _Write2DMatrix (CMemFile *f, int y, int x, float *m)
void _Write2DMatrix (FILE *f, int y, int x, float *m)
void _Write3DMatrix (CMemFile *f, int y, int x, int z, float *m)
void _Write3DMatrix (FILE *f, int y, int x, int z, float *m)
brush_tAddBrushForPatch (patchMesh_t *pm, bool bLinkToWorld)
void AddPatchMovePoint (vec3_t v, bool bMulti, bool bFull)
void AddPoint (patchMesh_t *p, vec3_t v, bool bWeldOrDrill=true)
bool WINAPI AnyPatchesSelected ()
void Brush_RebuildBrush (brush_t *b, vec3_t vMins, vec3_t vMaxs)
void BrushesForSection (float section[2][4][7])
brush_tCap (patchMesh_t *pParent, bool bByColumn, bool bFirst)
brush_tCapSpecial (patchMesh_t *pParent, int nType, bool bFirst)
bool ColumnSelected (patchMesh_t *p, int nCol)
void ConvexHullForSection (float section[2][4][7])
void DrawPatchMesh (patchMesh_t *pm, bool bPoints, bool bShade=false)
void DrawSinglePatch (float ctrl[3][3][5], bool bPoints)
void EmitTextureCoordinates (float *xyzst, qtexture_t *q, face_t *f)
face_tFace_Alloc (void)
void FillPatch (patchMesh_t *p, vec3_t v)
void GenerateEndCaps (brush_t *brushParent, bool bBevel, bool bEndcap, bool bInverted)
void InterpolateInteriorPoints (patchMesh_t *p)
patchMesh_tMakeNewPatch ()
void MemFile_fprintf (CMemFile *pMemFile, const char *pText,...)
face_tnextFace (patchMesh_t *p)
bool WINAPI OnlyPatchesSelected ()
void Parse1DMatrix (int x, float *p)
void Parse2DMatrix (int y, int x, float *p)
void Parse3DMatrix (int z, int y, int x, float *p)
void Patch_AddRow (patchMesh_t *p)
void Patch_AdjustColumns (patchMesh_t *p, int nCols)
void Patch_AdjustRows (patchMesh_t *p, int nRows)
void Patch_AdjustSelected (bool bInsert, bool bColumn, bool bFlag)
void Patch_AdjustSelectedRowCols (int nRows, int nCols)
void Patch_ApplyMatrix (patchMesh_t *p, const vec3_t vOrigin, const vec3_t vMatrix[3], bool bSnap)
void Patch_BendHandleENTER ()
void Patch_BendHandleESC ()
void Patch_BendHandleTAB ()
void Patch_BendToggle ()
void Patch_BrushToMesh (bool bCone, bool bBevel, bool bEndcap, bool bSquare, int nHeight)
void Patch_BuildPoints (brush_t *b)
void Patch_CalcBounds (patchMesh_t *p, vec3_t &vMin, vec3_t &vMax)
void Patch_CapCurrent (bool bInvertedBevel, bool bInvertedEndcap)
void Patch_CapTexture (patchMesh_t *p, bool bFaceCycle=false)
void Patch_Cleanup ()
void Patch_ClearOverlays ()
void Patch_Clone (patchMesh_t *p, brush_t *pNewOwner)
void Patch_Delete (patchMesh_t *p)
void Patch_Deselect (patchMesh_t *p)
void Patch_Deselect ()
void Patch_DisperseColumns ()
void Patch_DisperseRows ()
bool Patch_DragScale (patchMesh_t *p, vec3_t vAmt, vec3_t vMove)
void Patch_DrawCam (patchMesh_t *pm)
void Patch_DrawXY (patchMesh_t *pm)
patchMesh_tPatch_Duplicate (patchMesh_t *pFrom)
void Patch_EditPatch ()
void Patch_FindReplaceTexture (brush_t *pb, const char *pFind, const char *pReplace, bool bForce)
void Patch_FitTexturing ()
void Patch_Freeze ()
void Patch_FromTriangle (vec5_t vx, vec5_t vy, vec5_t vz)
brush_tPatch_GenericMesh (int nWidth, int nHeight, int nOrientation, bool bDeleteSource, bool bOverride)
face_tPatch_GetAxisFace (patchMesh_t *p)
const char * Patch_GetKeyValue (patchMesh_t *p, const char *pKey)
const char * Patch_GetTextureName ()
float Patch_Height (patchMesh_t *p)
float Patch_HeightDistanceTo (patchMesh_t *p, int j)
void Patch_InsDelESC ()
void Patch_InsDelHandleENTER ()
void Patch_InsDelHandleTAB ()
void Patch_InsDelToggle ()
void Patch_InsertColumn (patchMesh_t *p, bool bAdd)
void Patch_InsertRow (patchMesh_t *p, bool bAdd)
void Patch_InvertTexture (bool bY)
int Patch_MemorySize (patchMesh_t *p)
void Patch_MeshNormals (patchMesh_t *in)
void Patch_Move (patchMesh_t *pm, const vec3_t vMove, bool bRebuild)
void Patch_Naturalize (patchMesh_t *p)
void Patch_NaturalizeSelected (bool bCap, bool bCycleCap)
brush_tPatch_Parse (bool bOld)
void WINAPI Patch_Rebuild (patchMesh_t *p)
void Patch_RemoveColumn (patchMesh_t *p, bool bFirst)
void Patch_RemoveRow (patchMesh_t *p, bool bFirst)
void Patch_ReplaceQTexture (brush_t *pb, qtexture_t *pOld, qtexture_t *pNew)
void Patch_ResetTexturing (float fx, float fy)
void Patch_Restore (patchMesh_t *p)
void Patch_RotateTexture (patchMesh_t *p, float fAngle)
void Patch_Save (patchMesh_t *p)
void Patch_Scale (patchMesh_t *p, const vec3_t vOrigin, const vec3_t vAmt, bool bRebuild)
void Patch_ScaleTexture (patchMesh_t *p, float fx, float fy, bool bFixup)
void Patch_Select (patchMesh_t *p)
void Patch_SelectAreaPoints ()
void Patch_SelectBendAxis ()
void Patch_SelectBendNormal ()
void Patch_SetBendRotateOrigin (patchMesh_t *p)
void Patch_SetEpair (patchMesh_t *p, const char *pKey, const char *pValue)
void Patch_SetOverlays ()
void Patch_SetPointIntensities (int n)
void Patch_SetStyle (patchMesh_t *p, int nStyle)
void Patch_SetTexture (patchMesh_t *p, texdef_t *tex_def, IPluginTexdef *pPlugTexdef)
void Patch_SetTextureInfo (texdef_t *pt)
void Patch_SetType (patchMesh_t *p, int nType)
void Patch_SetView (int n)
void Patch_ShiftTexture (patchMesh_t *p, float fx, float fy)
void Patch_Thicken (int nAmount, bool bSeam)
void Patch_ToggleInverted ()
void Patch_Transpose ()
void Patch_UnFreeze (bool bAll)
void Patch_UpdateSelected (vec3_t vMove)
float Patch_Width (patchMesh_t *p)
float Patch_WidthDistanceTo (patchMesh_t *p, int j)
void Patch_Write (patchMesh_t *p, FILE *file)
void Patch_Write (patchMesh_t *p, CMemFile *file)
void patchInvert (patchMesh_t *p)
int PointInMoveList (float *pf)
int PointValueInMoveList (vec3_t v)
void RemovePointFromMoveList (vec3_t v)
void SampleSinglePatch (float ctrl[3][3][5], float u, float v, float out[5])
void Select_SnapToGrid ()
void SelectColumn (patchMesh_t *p, int nCol, bool bMulti)
void SelectRow (patchMesh_t *p, int nRow, bool bMulti)
patchMesh_tSinglePatchSelected ()
bool within (vec3_t vTest, vec3_t vTL, vec3_t vBR)

Variables

const float fDec = .05
const float fFullBright = 1.0
const float fLowerLimit = .50
bool g_bPatchAxisOnRow = true
bool g_bPatchBendMode = false
bool g_bPatchDrillDown = true
bool g_bPatchInsertMode = false
bool g_bPatchLowerEdge = true
bool g_bPatchShowBounds = true
bool g_bPatchWeld = true
bool g_bPatchWireFrame = false
bool g_bSameView = false
float * g_InversePoints [1024]
int g_nBendOriginIndex = 0
int g_nFaceCycle = 0
int g_nPatchAxisIndex = 0
int g_nPatchBendState = -1
int g_nPatchClickedView = -1
int g_nPatchInsertState = -1
const char * g_pBendStateMsg []
const char * g_pInsertStateMsg []
vec3_t g_vBendOrigin
int Index3By [][2]
int Index5By [][2]
int Interior3By [][2]
int Interior3ByCount = sizeof(Interior3By) / sizeof(int[2])
int Interior5By [][2]
int Interior5ByCount = sizeof(Interior5By) / sizeof(int[2])
int neighbors [8][2]
patchMesh_t patchSave


Define Documentation

#define CBLOCK_SUBDIVISIONS   6
 

Definition at line 40 of file PMESH.CPP.

Referenced by DrawSinglePatch().


Enumeration Type Documentation

anonymous enum
 

Enumeration values:
BEND_SELECT_ROTATION 
BEND_SELECT_ORIGIN 
BEND_SELECT_EDGE 
BEND_BENDIT 
BEND_STATE_COUNT 

Definition at line 89 of file PMESH.CPP.

00090 {
00091   BEND_SELECT_ROTATION = 0,
00092   BEND_SELECT_ORIGIN,
00093   BEND_SELECT_EDGE,
00094   BEND_BENDIT,
00095   BEND_STATE_COUNT
00096 };

anonymous enum
 

Enumeration values:
INSERT_SELECT_EDGE 
INSERT_STATE_COUNT 

Definition at line 108 of file PMESH.CPP.

00109 {
00110   INSERT_SELECT_EDGE = 0,
00111   INSERT_STATE_COUNT
00112 };


Function Documentation

vec_t __VectorNormalize vec3_t  in,
vec3_t  out
 

Definition at line 154 of file PMESH.CPP.

References in, length(), sqrt(), vec_t, and VectorClear.

Referenced by Patch_MeshNormals().

00155 {
00156     vec_t   length, ilength;
00157 
00158     length = sqrt (in[0]*in[0] + in[1]*in[1] + in[2]*in[2]);
00159     if (length == 0)
00160     {
00161         VectorClear (out);
00162         return 0;
00163     }
00164 
00165     ilength = 1.0/length;
00166     out[0] = in[0]*ilength;
00167     out[1] = in[1]*ilength;
00168     out[2] = in[2]*ilength;
00169 
00170     return length;
00171 }

Here is the call graph for this function:

void _DecColor float  fColor[3]  ) 
 

Definition at line 135 of file PMESH.CPP.

References i, and qglColor3fv.

00136 {
00137   return;
00138   fColor[0] -= fDec;
00139   fColor[1] -= fDec ;
00140   fColor[2] -= fDec;
00141   for (int i = 0; i < 3; i++)
00142   {
00143     if (fColor[i] <= fLowerLimit)
00144     {
00145       fColor[0] = fFullBright;
00146       fColor[1] = fFullBright;
00147       fColor[2] = fFullBright;
00148       break;
00149     }
00150   }
00151     qglColor3fv(fColor);
00152 }

void _SetColor face_t f,
float  fColor[3]
 

Definition at line 125 of file PMESH.CPP.

References face_s::d_color, f, face_t, and qglColor3fv.

00126 {
00127   return;
00128   fColor[0] = f->d_color[0];
00129   fColor[1] = f->d_color[1];
00130   fColor[2] = f->d_color[2];
00131   qglColor3fv(fColor);
00132 }

void _Write1DMatrix CMemFile *  f,
int  x,
float *  m
 

Definition at line 4497 of file PMESH.CPP.

References f, i, m, and MemFile_fprintf().

Referenced by _Write2DMatrix().

04497                                                    {
04498     int     i;
04499 
04500     MemFile_fprintf (f, "( ");
04501     for (i = 0 ; i < x ; i++) {
04502         if (m[i] == (int)m[i] ) {
04503             MemFile_fprintf (f, "%i ", (int)m[i]);
04504         } else {
04505             MemFile_fprintf (f, "%f ", m[i]);
04506         }
04507     }
04508     MemFile_fprintf (f, ")");
04509 }

Here is the call graph for this function:

void _Write1DMatrix FILE f,
int  x,
float *  m
 

Definition at line 4461 of file PMESH.CPP.

References f, fprintf(), i, and m.

04461                                                {
04462     int     i;
04463 
04464     fprintf (f, "( ");
04465     for (i = 0 ; i < x ; i++) {
04466         if (m[i] == (int)m[i] ) {
04467             fprintf (f, "%i ", (int)m[i]);
04468         } else {
04469             fprintf (f, "%f ", m[i]);
04470         }
04471     }
04472     fprintf (f, ")");
04473 }

Here is the call graph for this function:

void _Write2DMatrix CMemFile *  f,
int  y,
int  x,
float *  m
 

Definition at line 4511 of file PMESH.CPP.

References _Write1DMatrix(), f, i, m, MemFile_fprintf(), and x.

Referenced by _Write3DMatrix().

04511                                                           {
04512     int     i;
04513 
04514     MemFile_fprintf (f, "( ");
04515     for (i = 0 ; i < y ; i++) {
04516         _Write1DMatrix (f, x, m + i*x);
04517         MemFile_fprintf (f, " ");
04518     }
04519     MemFile_fprintf (f, ")\n");
04520 }

Here is the call graph for this function:

void _Write2DMatrix FILE f,
int  y,
int  x,
float *  m
 

Definition at line 4475 of file PMESH.CPP.

References _Write1DMatrix(), f, fprintf(), i, m, and x.

04475                                                       {
04476     int     i;
04477 
04478     fprintf (f, "( ");
04479     for (i = 0 ; i < y ; i++) {
04480         _Write1DMatrix (f, x, m + i*x);
04481         fprintf (f, " ");
04482     }
04483     fprintf (f, ")\n");
04484 }

Here is the call graph for this function:

void _Write3DMatrix CMemFile *  f,
int  y,
int  x,
int  z,
float *  m
 

Definition at line 4523 of file PMESH.CPP.

References _Write2DMatrix(), f, i, m, MAX_PATCH_HEIGHT, MemFile_fprintf(), x, and y.

Referenced by Patch_Write().

04523                                                                  {
04524     int     i;
04525 
04526     MemFile_fprintf (f, "(\n");
04527     for (i = 0 ; i < z ; i++) {
04528         _Write2DMatrix (f, y, x, m + i*(x*MAX_PATCH_HEIGHT) );
04529     }
04530     MemFile_fprintf (f, ")\n");
04531 }

Here is the call graph for this function:

void _Write3DMatrix FILE f,
int  y,
int  x,
int  z,
float *  m
 

Definition at line 4487 of file PMESH.CPP.

References _Write2DMatrix(), f, fprintf(), i, m, MAX_PATCH_HEIGHT, x, and y.

04487                                                              {
04488     int     i;
04489 
04490     fprintf (f, "(\n");
04491     for (i = 0 ; i < z ; i++) {
04492         _Write2DMatrix (f, y, x, m + i*(x*MAX_PATCH_HEIGHT) );
04493     }
04494     fprintf (f, ")\n");
04495 }

Here is the call graph for this function:

brush_t* AddBrushForPatch patchMesh_t pm,
bool  bLinkToWorld
 

Definition at line 542 of file PMESH.CPP.

References active_brushes, b, Brush_AddToList(), Brush_Build(), Brush_Create(), brush_s::brush_faces, brush_t, QEGlobals_t::d_texturewin, Entity_LinkBrush(), f, face_t, texdef_t::flags, g_qeglobals, j, face_s::next, Patch_CalcBounds(), pm, brush_s::pPatch, texturewin_t::texdef, face_s::texdef, vec3_t, and world_entity.

Referenced by CPlugInManager::CommitPatchHandleToMap(), Patch_BrushToMesh(), Patch_Duplicate(), Patch_FromTriangle(), Patch_GenericMesh(), and Patch_Parse().

00543 {
00544   // find the farthest points in x,y,z
00545   vec3_t vMin, vMax;
00546   Patch_CalcBounds(pm, vMin, vMax);
00547 
00548   for (int j = 0; j < 3; j++)
00549   {
00550     if (vMin[j] == vMax[j])
00551     {
00552       vMin[j] -= 4;
00553       vMax[j] += 4;
00554     }
00555   }
00556 
00557   brush_t *b = Brush_Create(vMin, vMax, &g_qeglobals.d_texturewin.texdef);
00558     face_t      *f;
00559     for (f=b->brush_faces ; f ; f=f->next) 
00560   {
00561         f->texdef.flags |= SURF_PATCH; 
00562     }
00563 
00564   // FIXME: this entire type of linkage needs to be fixed
00565   b->pPatch = pm;
00566   pm->pSymbiot = b;
00567   pm->bSelected = false;
00568   pm->bOverlay = false;
00569   pm->bDirty = true;
00570   pm->nListID = -1;
00571 
00572   if (bLinkToWorld)
00573   {
00574     Brush_AddToList (b, &active_brushes);
00575       Entity_LinkBrush (world_entity, b);
00576     Brush_Build(b);
00577   }
00578 
00579   return b;
00580 }

Here is the call graph for this function:

void AddPatchMovePoint vec3_t  v,
bool  bMulti,
bool  bFull
 

Definition at line 1963 of file PMESH.CPP.

References AddPoint(), brush_t, ColumnSelected(), patchMesh_t::ctrl, QEGlobals_t::d_num_move_points, g_bSameView, g_qeglobals, patchMesh_t::height, i, j, brush_s::next, p, brush_s::patchBrush, PointInMoveList(), brush_s::pPatch, RemovePointFromMoveList(), SelectColumn(), selected_brushes, SelectRow(), v, VectorCompare(), patchMesh_t::width, and drawVert_t::xyz.

Referenced by SelectCurvePointByRay().

01964 {
01965   if (!g_bSameView && !bMulti && !bFull)
01966   {
01967     g_bSameView = true;
01968     return;
01969   }
01970 
01971     for (brush_t *pb = selected_brushes.next ; pb != &selected_brushes ; pb = pb->next)
01972     {
01973     if (pb->patchBrush)
01974     {
01975         patchMesh_t* p = pb->pPatch;
01976         for ( int i = 0 ; i < p->width ; i++ ) 
01977       {
01978             for ( int j = 0 ; j < p->height ; j++ ) 
01979         {
01980           if (VectorCompare(v, p->ctrl[i][j].xyz))
01981           {
01982             if (PointInMoveList(p->ctrl[i][j].xyz) == -1)
01983             {
01984               if (bFull)        // if we want the full row/col this is on
01985               {
01986                 SelectColumn(p, i, bMulti);
01987               }
01988               else
01989               {
01990                 if (!bMulti)
01991                   g_qeglobals.d_num_move_points = 0;
01992                 AddPoint(p, p->ctrl[i][j].xyz);
01993                 //Sys_Printf("Selected col:row %d:%d\n", i, j);
01994               }
01995               //--if (!bMulti)
01996               return;
01997             }
01998             else
01999             {
02000               if (bFull)
02001               {
02002                 if (ColumnSelected(p, i))
02003                 {
02004                   SelectRow(p, j, bMulti);
02005                 }
02006                 else
02007                 {
02008                   SelectColumn(p, i, bMulti);
02009                 }
02010                 return;
02011               }
02012               if (g_bSameView)
02013               {
02014                 RemovePointFromMoveList(v);
02015                 return;
02016               }
02017             }
02018           }
02019             }
02020         }
02021     }
02022   }
02023 }

Here is the call graph for this function:

void AddPoint patchMesh_t p,
vec3_t  v,
bool  bWeldOrDrill = true
 

Definition at line 1834 of file PMESH.CPP.

References CMainFrame::ActiveXY(), patchMesh_t::ctrl, QEGlobals_t::d_move_points, QEGlobals_t::d_num_move_points, fabs(), g_bPatchDrillDown, g_bPatchWeld, g_nPatchClickedView, g_pParentWnd, g_qeglobals, CXYWnd::GetViewType(), patchMesh_t::height, i, j, k, l, n, p, p2, PointInMoveList(), v, VectorCompare(), patchMesh_t::width, and drawVert_t::xyz.

Referenced by AddPatchMovePoint(), SelectColumn(), and SelectRow().

01835 {
01836   int nDim1 = (g_pParentWnd->ActiveXY()->GetViewType() == YZ) ? 1 : 0;
01837   int nDim2 = (g_pParentWnd->ActiveXY()->GetViewType() == XY) ? 1 : 2;
01838   g_qeglobals.d_move_points[g_qeglobals.d_num_move_points++] = v;
01839   if ((g_bPatchWeld || g_bPatchDrillDown) && bWeldOrDrill)
01840   {
01841       for ( int i = 0 ; i < p->width ; i++ ) 
01842     {
01843           for ( int j = 0 ; j < p->height ; j++ ) 
01844       {
01845         if (g_bPatchWeld)
01846         {
01847           if ( VectorCompare(v, p->ctrl[i][j].xyz)
01848             && PointInMoveList(p->ctrl[i][j].xyz) == -1)
01849           {
01850             g_qeglobals.d_move_points[g_qeglobals.d_num_move_points++] = p->ctrl[i][j].xyz;
01851             continue;
01852           }
01853         }
01854         if (g_bPatchDrillDown && g_nPatchClickedView != W_CAMERA)
01855         {
01856           if ( (fabs(v[nDim1] - p->ctrl[i][j].xyz[nDim1]) <= EQUAL_EPSILON) 
01857              &&(fabs(v[nDim2] - p->ctrl[i][j].xyz[nDim2]) <= EQUAL_EPSILON)) 
01858           {
01859             if (PointInMoveList(p->ctrl[i][j].xyz) == -1)
01860             {
01861               g_qeglobals.d_move_points[g_qeglobals.d_num_move_points++] = p->ctrl[i][j].xyz;
01862               continue;
01863             }
01864           }
01865 #if 0
01866           int l = 0;
01867             for ( int k = 0; k < 2; k++ )
01868           {
01869                 if (fabs(v[k] - p->ctrl[i][j].xyz[k]) > EQUAL_EPSILON)
01870               continue;
01871              l++;
01872           }
01873           if (l >= 2 && PointInMoveList(p->ctrl[i][j].xyz) == -1)
01874           {
01875             g_qeglobals.d_move_points[g_qeglobals.d_num_move_points++] = p->ctrl[i][j].xyz;
01876             continue;
01877           }
01878 #endif
01879         }
01880       }
01881     }
01882   }
01883 #if 0
01884   if (g_qeglobals.d_num_move_points == 1)
01885   {
01886     // single point selected
01887     // FIXME: the two loops can probably be reduced to one
01888       for ( int i = 0 ; i < p->width ; i++ ) 
01889     {
01890           for ( int j = 0 ; j < p->height ; j++ ) 
01891       {
01892         int n = PointInMoveList(v);
01893         if (n >= 0)
01894         {
01895           if (((i & 0x01) && (j & 0x01)) == 0)
01896           {
01897             // put any sibling fixed points
01898             // into the inverse list
01899             int p1, p2, p3, p4;
01900             p1 = i + 2;
01901             p2 = i - 2;
01902             p3 = j + 2;
01903             p4 = j - 2;
01904             if (p1 < p->width)
01905             {
01906 
01907             }
01908             if (p2 >= 0)
01909             {
01910             }
01911             if (p3 < p->height)
01912             {
01913             }
01914             if (p4 >= 0)
01915             {
01916             }
01917           }
01918         }
01919       }
01920     }
01921   }
01922 #endif
01923 }

Here is the call graph for this function:

bool WINAPI AnyPatchesSelected  ) 
 

Definition at line 4068 of file PMESH.CPP.

References brush_t, g_ptrSelectedFaces, brush_s::next, brush_s::patchBrush, and selected_brushes.

Referenced by CMainFrame::OnSelectionDragvertecies(), and CXYWnd::ProduceSplitLists().

04069 {
04070   if (g_ptrSelectedFaces.GetSize() > 0  || selected_brushes.next == &selected_brushes)
04071     return false;
04072     for (brush_t *pb = selected_brushes.next ; pb != &selected_brushes ; pb = pb->next)
04073     {
04074     if (pb->patchBrush)
04075     {
04076       return true;
04077     }
04078   }
04079   return false;
04080 }

void Brush_RebuildBrush brush_t b,
vec3_t  vMins,
vec3_t  vMaxs
 

Definition at line 419 of file PMESH.CPP.

References b, Brush_Build(), brush_s::brush_faces, brush_t, texdef_t::contents, Error(), f, Face_Alloc(), Face_Free(), face_t, texdef_t::flags, i, j, next, face_s::next, brush_s::patchBrush, face_s::planepts, face_s::texdef, vec3_t, and VectorCopy.

Referenced by GenerateEndCaps(), Patch_AddRow(), Patch_AdjustSelected(), Patch_ApplyMatrix(), Patch_Rebuild(), Patch_Scale(), Patch_Thicken(), Patch_UpdateSelected(), Select_SnapToGrid(), Terrain_Scale(), and Terrain_UpdateSelected().

00420 {
00421   //
00422   // Total hack job 
00423   // Rebuilds a brush
00424     int     i, j;
00425     face_t  *f, *next;
00426     vec3_t  pts[4][2];
00427   texdef_t  texdef;
00428     // free faces
00429 
00430   for (j = 0; j < 3; j++)
00431   {
00432     if ((int)vMins[j] == (int)vMaxs[j])
00433     {
00434       vMins[j] -= 4;
00435       vMaxs[j] += 4;
00436     }
00437   }
00438 
00439   
00440   for (f=b->brush_faces ; f ; f=next)
00441     {
00442         next = f->next;
00443     if (f)
00444       texdef = f->texdef;
00445     Face_Free( f );
00446     }
00447 
00448   b->brush_faces = NULL;
00449 
00450   // left the last face so we can use its texdef
00451 
00452     for (i=0 ; i<3 ; i++)
00453         if (vMaxs[i] < vMins[i])
00454             Error ("Brush_RebuildBrush: backwards");
00455 
00456     pts[0][0][0] = vMins[0];
00457     pts[0][0][1] = vMins[1];
00458     
00459     pts[1][0][0] = vMins[0];
00460     pts[1][0][1] = vMaxs[1];
00461     
00462     pts[2][0][0] = vMaxs[0];
00463     pts[2][0][1] = vMaxs[1];
00464     
00465     pts[3][0][0] = vMaxs[0];
00466     pts[3][0][1] = vMins[1];
00467     
00468     for (i=0 ; i<4 ; i++)
00469     {
00470         pts[i][0][2] = vMins[2];
00471         pts[i][1][0] = pts[i][0][0];
00472         pts[i][1][1] = pts[i][0][1];
00473         pts[i][1][2] = vMaxs[2];
00474     }
00475 
00476     for (i=0 ; i<4 ; i++)
00477     {
00478         f = Face_Alloc();
00479         f->texdef = texdef;
00480         f->texdef.flags &= ~SURF_KEEP;
00481         f->texdef.contents &= ~CONTENTS_KEEP;
00482         if ( b->patchBrush )
00483         {
00484             f->texdef.flags |= SURF_PATCH; 
00485         }
00486         f->next = b->brush_faces;
00487         b->brush_faces = f;
00488         j = (i+1)%4;
00489 
00490         VectorCopy (pts[j][1], f->planepts[0]);
00491         VectorCopy (pts[i][1], f->planepts[1]);
00492         VectorCopy (pts[i][0], f->planepts[2]);
00493     }
00494     
00495     f = Face_Alloc();
00496     f->texdef = texdef;
00497     f->texdef.flags &= ~SURF_KEEP;
00498     f->texdef.contents &= ~CONTENTS_KEEP;
00499     if ( b->patchBrush )
00500     {
00501         f->texdef.flags |= SURF_PATCH; 
00502     }
00503     f->next = b->brush_faces;
00504     b->brush_faces = f;
00505 
00506     VectorCopy (pts[0][1], f->planepts[0]);
00507     VectorCopy (pts[1][1], f->planepts[1]);
00508     VectorCopy (pts[2][1], f->planepts[2]);
00509 
00510     f = Face_Alloc();
00511     f->texdef = texdef;
00512     f->texdef.flags &= ~SURF_KEEP;
00513     f->texdef.contents &= ~CONTENTS_KEEP;
00514     if ( b->patchBrush )
00515     {
00516         f->texdef.flags |= SURF_PATCH; 
00517     }
00518     f->next = b->brush_faces;
00519     b->brush_faces = f;
00520 
00521     VectorCopy (pts[2][0], f->planepts[0]);
00522     VectorCopy (pts[1][0], f->planepts[1]);
00523     VectorCopy (pts[0][0], f->planepts[2]);
00524 
00525   Brush_Build(b);
00526 }

Here is the call graph for this function:

void BrushesForSection float  section[2][4][7]  ) 
 

Definition at line 2652 of file PMESH.CPP.

02652                                                  {
02653 }

brush_t* Cap patchMesh_t pParent,
bool  bByColumn,
bool  bFirst
 

Definition at line 876 of file PMESH.CPP.

References abs(), b, brush_t, patchMesh_t::ctrl, f, FillPatch(), patchMesh_t::height, i, Index3By, Index5By, Interior3By, Interior3ByCount, Interior5By, j, memcpy(), p, Patch_CapTexture(), Patch_GenericMesh(), Patch_Rebuild(), brush_s::pPatch, patchMesh_t::pSymbiot, Sys_Printf(), patchMesh_t::type, vec3_t, VectorCopy, patchMesh_t::width, and drawVert_t::xyz.

Referenced by Patch_CapCurrent().

00877 {
00878   brush_t *b;
00879   patchMesh_t *p;
00880   vec3_t vMin, vMax;
00881   int i, j;
00882 
00883   bool bSmall = true;
00884   // make a generic patch
00885   if (pParent->width <= 9)
00886   {
00887     b =