Go to the source code of this file.
|
|
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 }
|
|
||||||||||||
Here is the call graph for this function:

|
|
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().
|
Here is the call graph for this function:

|
||||||||||||||||||||
Here is the call graph for this function:

|
||||||||||||
|
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:

|
Here is the call graph for this function:

|
||||||||||||||||
|
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:

|
|
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:

|
||||||||||||
|
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:

|
||||||||||||||||
|
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:

|
||||||||||||
Here is the call graph for this function:

|