29 #include "../../idlib/precompiled.h"
35 #include "../../renderer/tr_local.h"
36 #include "../../renderer/model_local.h"
70 for (
int k = 0; k < 3; k++ ) {
90 v.
x = floor(v.
x / g_qeglobals.d_gridsize + 0.5f) * g_qeglobals.d_gridsize;
91 v.
y = floor(v.
y / g_qeglobals.d_gridsize + 0.5f) * g_qeglobals.d_gridsize;
92 v.
z = floor(v.
z / g_qeglobals.d_gridsize + 0.5f) * g_qeglobals.d_gridsize;
101 static char cBuff[1024];
104 if (g_qeglobals.m_bBrushPrimitMode) {
105 sprintf(cBuff,
"Brush %i", b->numberId);
118 brush_t *
b =
new brush_t;
119 b->prev = b->next =
NULL;
120 b->oprev = b->onext =
NULL;
125 b->lightCenter.Zero();
126 b->lightRight.Zero();
127 b->lightTarget.Zero();
129 b->lightRadius.Zero();
130 b->lightOffset.Zero();
131 b->lightColor.Zero();
132 b->lightStart.Zero();
134 b->pointLight =
false;
137 b->trackLightOrigin =
false;
139 b->entityModel =
false;
140 b->brush_faces =
NULL;
141 b->hiddenBrush =
false;
143 b->pUndoOwner =
NULL;
149 b->bModelFailed =
false;
150 b->modelHandle =
NULL;
151 b->forceVisibile =
false;
152 b->forceWireFrame =
false;
200 for (i = 0; i < 6; i++) {
226 for (i = 0; i < 3; i++) {
234 for (i = 0; i < 3; i++) {
252 brushprimit_texdef_t bp;
256 bp.coords[0][0] = 0.0f;
257 bp.coords[1][1] = 0.0f;
258 f->brushprimit_texdef = bp;
271 if (f->face_winding) {
272 delete f->face_winding;
275 f->texdef.~texdef_t();
289 n->texdef = f->texdef;
290 n->brushprimit_texdef = f->brushprimit_texdef;
292 memcpy(n->planepts, f->planepts,
sizeof(n->planepts));
294 n->originalPlane = f->originalPlane;
313 n->texdef = f->texdef;
314 n->brushprimit_texdef = f->brushprimit_texdef;
315 memcpy(n->planepts, f->planepts,
sizeof(n->planepts));
317 n->originalPlane = f->originalPlane;
319 if (f->face_winding) {
320 n->face_winding = f->face_winding->Copy();
323 n->face_winding =
NULL;
336 float fFrac = f -
static_cast<int>(
f);
337 f =
static_cast<int>(
f) % nClamp;
353 if (g_qeglobals.m_bBrushPrimitMode) {
363 double fAngle =
DEG2RAD( f->texdef.rotate );
364 double c = cos(fAngle);
365 double s = sin(fAngle);
367 vShift[0] = vDP[0] * c - vDP[1] *
s;
368 vShift[1] = vDP[0] * s + vDP[1] *
c;
370 if (!f->texdef.scale[0]) {
371 f->texdef.scale[0] = 1;
374 if (!f->texdef.scale[1]) {
375 f->texdef.scale[1] = 1;
378 f->texdef.shift[0] -= vShift[0] / f->texdef.scale[0];
379 f->texdef.shift[1] -= vShift[1] / f->texdef.scale[1];
382 Clamp(f->texdef.shift[0], f->d_texture->GetEditorImage()->uploadWidth);
383 Clamp(f->texdef.shift[1], f->d_texture->GetEditorImage()->uploadHeight);
402 f->d_color[0] = f->d_color[1] = f->d_color[2] = shade;
404 else if ( f && b && b->owner ) {
405 f->d_color[0] = shade * b->owner->eclass->color.x;
406 f->d_color[1] = shade * b->owner->eclass->color.y;
407 f->d_color[2] = shade * b->owner->eclass->color.z;
421 float ang, sinv, cosv;
433 if (g_qeglobals.m_bBrushPrimitMode && !g_qeglobals.bNeedConvert) {
434 common->
Printf(
"Warning : illegal call of Face_TextureVectors in brush primitive mode\n");
440 memset(STfromXYZ, 0, 8 *
sizeof (
float));
454 if (td->rotate == 0) {
458 else if (td->rotate == 90) {
462 else if (td->rotate == 180) {
466 else if (td->rotate == 270) {
479 else if (pvecs[0][1]) {
489 else if (pvecs[1][1]) {
496 for (i = 0; i < 2; i++) {
497 ns = cosv * pvecs[
i][sv] - sinv * pvecs[
i][tv];
498 nt = sinv * pvecs[
i][sv] + cosv * pvecs[
i][tv];
499 STfromXYZ[
i][sv] = ns;
500 STfromXYZ[
i][tv] = nt;
504 for (i = 0; i < 2; i++) {
505 for (j = 0; j < 3; j++) {
506 STfromXYZ[
i][
j] = STfromXYZ[
i][
j] / td->scale[
i];
511 STfromXYZ[0][3] = td->shift[0];
512 STfromXYZ[1][3] = td->shift[1];
514 for (j = 0; j < 4; j++) {
532 for (j = 0; j < 3; j++) {
533 t1[
j] = f->planepts[0][
j] - f->planepts[1][
j];
534 t2[
j] = f->planepts[2][
j] - f->planepts[1][
j];
535 t3[
j] = f->planepts[1][
j];
538 f->plane = t1.
Cross( t2 );
544 f->plane[3] = - (t3 * f->plane.Normal());
546 if ( !f->dirty && !f->plane.Compare( oldPlane, 0.01f ) ) {
557 float STfromXYZ[2][4];
559 if (g_qeglobals.m_bBrushPrimitMode && !force) {
564 xyzst[3] =
DotProduct(xyzst, STfromXYZ[0]) + STfromXYZ[0][3];
565 xyzst[4] =
DotProduct(xyzst, STfromXYZ[1]) + STfromXYZ[1][3];
577 for (f = b->brush_faces; f; f = f->next) {
599 if (b != b->owner->brushes.onext) {
603 if (!(g_qeglobals.d_savedinfo.exclude & EXCLUDE_ANGLES)) {
610 idVec3 mid = (b->mins + b->maxs) / 2.0
f;
646 if (g_qeglobals.d_savedinfo.show_names && scale >= 1.0f) {
648 int nameLen = strlen(name);
649 if ( nameLen == 0 ) {
651 nameLen = strlen(name);
654 idVec3 origin = b->owner->origin;
656 float halfWidth = ( (nameLen / 2) * (7.0
f / scale) );
657 float halfHeight = 4.0f /
scale;
661 origin.
x -= halfWidth;
662 origin.
y += halfHeight;
665 origin.
x -= halfWidth;
666 origin.
z += halfHeight;
669 origin.
y -= halfWidth;
670 origin.
z += halfHeight;
697 for (clip = b->brush_faces; clip && w; clip = clip->next) {
703 if (
DotProduct(face->plane, clip->plane) > 0.999f &&
704 idMath::Fabs(face->plane[3] - clip->plane[3]) < 0.01f ) {
707 common->
Printf(
"Unable to create face winding on brush\n");
715 plane[3] = -clip->plane[3];
729 Sys_Status(
"Unable to create face winding on brush\n");
743 void Brush_Build(brush_t *
b,
bool bSnap,
bool bMarkMap,
bool bConvert,
bool updateLights) {
744 bool bLocalConvert =
false;
747 if (!g_qeglobals.m_bBrushPrimitMode && bConvert) {
748 common->
Printf(
"Warning : conversion from brush primitive to old brush format not implemented\n");
755 if (bConvert && !g_qeglobals.bNeedConvert) {
756 bLocalConvert =
true;
757 g_qeglobals.bNeedConvert =
true;
764 if (g_qeglobals.d_select_mode == sel_vertex || g_qeglobals.d_select_mode == sel_edge) {
765 SetupVertexSelection();
769 Sys_MarkMapModified();
774 g_qeglobals.bNeedConvert =
false;
793 nf->texdef = b->brush_faces->texdef;
794 nf->brushprimit_texdef = b->brush_faces->brushprimit_texdef;
795 nf->next = b->brush_faces;
800 if (!b->brush_faces) {
817 nf->texdef = b->brush_faces->texdef;
818 nf->brushprimit_texdef = b->brush_faces->brushprimit_texdef;
819 nf->next = b->brush_faces;
824 if (!b->brush_faces) {
842 face_t *face, *
f, *bestface;
844 int splits, tinywindings,
value, bestvalue;
848 for ( face = b->brush_faces; face; face = face->next ) {
851 for ( f = b->brush_faces; f; f = f->next ) {
856 f->face_winding->Split( face->plane, 0.1f, &front, &back );
879 value = splits + 50 * tinywindings;
880 if ( value < bestvalue ) {
902 brush_t *front, *back, *
end;
914 if (!front && !back) {
925 for (end = b; end->next; end = end->next);
940 face_t *face1, *face2;
942 for (face1 = b->brush_faces; face1; face1 = face1->next) {
943 if (!face1->face_winding) {
947 for (face2 = b->brush_faces; face2; face2 = face2->next) {
948 if (face1 == face2) {
952 if (!face2->face_winding) {
956 if ( face1->face_winding->PlanesConcave( *face2->face_winding,
957 face1->plane.Normal(), face2->plane.Normal(), -face1->plane[3], -face2->plane[3] ) ) {
976 #define MAX_MOVE_FACES 64
977 #define TINY_EPSILON 0.0325f
980 face_t *
f, *face, *newface, *lastface, *nextface;
986 int i,
j, k, nummovefaces,
result, done;
987 float dot, front, back, frac, smallestfrac;
997 for (i = 0; i < 3; i++) {
998 end[
i] = floor( end[i] / 0.125f + 0.5f ) * 0.125f;
1010 for ( face = b->brush_faces; face; face = face->next ) {
1011 w = face->face_winding;
1031 for (face = b->brush_faces; face; face = face->next) {
1032 w = face->face_winding;
1039 if (face->face_winding->GetNumPoints() <= 3) {
1040 movefacepoints[nummovefaces] =
i;
1041 movefaces[nummovefaces++] = face;
1045 dot =
DotProduct(end, face->plane) + face->plane[3];
1058 for (f = face; f->original; f = f->original) {};
1060 newface->original =
f;
1063 if (newface->face_winding) {
1064 delete newface->face_winding;
1067 newface->face_winding = tmpw.
Copy();
1073 newface->next = b->brush_faces;
1074 b->brush_faces = newface;
1077 movefacepoints[nummovefaces] = 0;
1078 movefaces[nummovefaces++] = newface;
1085 delete face->face_winding;
1086 face->face_winding = tmpw.Copy();
1089 movefacepoints[nummovefaces] = 2;
1090 movefaces[nummovefaces++] = face;
1111 for (f = face; f->original; f = f->original) {};
1113 newface->original =
f;
1116 if (newface->face_winding) {
1117 delete newface->face_winding;
1120 newface->face_winding = tmpw.Copy();
1126 newface->next = b->brush_faces;
1127 b->brush_faces = newface;
1128 movefacepoints[nummovefaces] = 1;
1129 movefaces[nummovefaces++] = newface;
1143 for (face = b->brush_faces; face; face = face->next) {
1145 for (i = 0; i < nummovefaces; i++) {
1146 if (movefaces[i]->original == face) {
1151 if (i >= nummovefaces) {
1156 for (j = 0; j < nummovefaces; j++) {
1157 if (face == movefaces[j]) {
1163 if (j >= nummovefaces) {
1164 memcpy(&plane, &movefaces[i]->original->plane,
sizeof(plane));
1167 k = movefacepoints[
j];
1168 w = movefaces[
j]->face_winding;
1172 k = movefacepoints[
i];
1173 w = movefaces[
i]->face_winding;
1176 if ( !plane.
FromPoints( tmpw[0].ToVec3(), tmpw[1].ToVec3(), tmpw[2].ToVec3(), false ) ) {
1178 if ( !plane.
FromPoints( tmpw[0].ToVec3(), tmpw[1].ToVec3(), tmpw[2].ToVec3() ),
false ) {
1184 plane[0] = -plane[0];
1185 plane[1] = -plane[1];
1186 plane[2] = -plane[2];
1187 plane[3] = -plane[3];
1209 frac = front / (front - back);
1210 if (frac < smallestfrac) {
1211 mid[0] = start[0] + (end[0] - start[0]) * frac;
1212 mid[1] = start[1] + (end[1] - start[1]) * frac;
1213 mid[2] = start[2] + (end[2] - start[2]) * frac;
1214 smallestfrac = frac;
1221 for (i = 0; i < nummovefaces; i++) {
1223 VectorCopy( mid, (*movefaces[i]->face_winding)[movefacepoints[i]] );
1226 for (j = 0; j < 3; j++) {
1227 VectorCopy( (*movefaces[i]->face_winding)[j], movefaces[i]->planepts[j] );
1238 for (i = 0; i < nummovefaces; i++) {
1240 VectorCopy( start, (*movefaces[i]->face_winding)[movefacepoints[i]] );
1243 for (j = 0; j < 3; j++) {
1244 VectorCopy( (*movefaces[i]->face_winding)[j], movefaces[i]->planepts[j] );
1259 for (i = 0; i < nummovefaces; i++) {
1261 for (j = 0; j < movefaces[
i]->face_winding->GetNumPoints(); j++) {
1268 for (face = b->brush_faces; face; face = nextface) {
1269 nextface = face->next;
1270 if (!face->original) {
1275 if ( !face->plane.Compare( face->original->plane, 0.0001f ) ) {
1280 w = face->face_winding->
TryMerge( *face->original->face_winding, face->plane.Normal(), true );
1286 delete face->original->face_winding;
1287 face->original->face_winding =
w;
1291 for (j = 0; j < face->original->face_winding->GetNumPoints(); j++) {
1297 lastface->next = face->next;
1300 b->brush_faces = face->next;
1332 for (face = b->brush_faces; face; face = face->next) {
1333 w = face->face_winding;
1357 delete face->face_winding;
1358 face->face_winding = neww;
1376 for (face = b->brush_faces; face; face = face->next) {
1377 face->original =
NULL;
1394 idVec3 useOrigin = origin;
1396 g_qeglobals.d_parsed_brushes++;
1399 if (!GetToken(
true)) {
1403 if (!
strcmp(token,
"}")) {
1410 g_qeglobals.bPrimitBrushes =
true;
1413 if (g_qeglobals.m_bBrushPrimitMode) {
1414 if (g_qeglobals.bOldBrushes) {
1415 common->
Printf(
"Warning : old brushes and brush primitive in the same file are not allowed ( Brush_Parse )\n");
1420 common->
Printf(
"Warning : conversion code from brush primitive not done ( Brush_Parse )\n");
1423 bool newFormat =
false;
1429 else if (
idStr::Icmp(token,
"brushDef3") == 0 ) {
1441 Warning(
"parsing brush primitive");
1453 b = Patch_Parse(
idStr::Icmp(token,
"patchDef2") == 0 );
1455 Warning(
"parsing patch/brush");
1466 g_qeglobals.bOldBrushes =
true;
1467 if (g_qeglobals.m_bBrushPrimitMode) {
1469 if (g_qeglobals.bPrimitBrushes) {
1470 common->
Printf(
"Warning : old brushes and brush primitive in the same file are not allowed ( Brush_Parse )\n");
1474 g_qeglobals.bNeedConvert =
true;
1484 if (!b->brush_faces) {
1489 for (scan = b->brush_faces; scan->next; scan = scan->next)
1495 for (i = 0; i < 3; i++) {
1500 if (
strcmp(token,
"(")) {
1501 Warning(
"parsing brush");
1505 for (j = 0; j < 3; j++) {
1507 f->planepts[
i][
j] = atof(token);
1511 if (
strcmp(token,
")")) {
1512 Warning(
"parsing brush");
1520 f->texdef.SetName(token);
1521 if (token[0] ==
'(') {
1526 f->texdef.shift[0] = atoi(token);
1528 f->texdef.shift[1] = atoi(token);
1530 f->texdef.rotate = atoi(token);
1532 f->texdef.scale[0] = atof(token);
1534 f->texdef.scale[1] = atof(token);
1543 if (TokenAvailable()) {
1547 f->texdef.value = atoi(token);
1568 va_start(argptr, text);
1583 if (g_qeglobals.m_bBrushPrimitMode) {
1585 Patch_SetEpair(b->pPatch, pKey, pValue);
1588 b->epairs.Set(pKey, pValue);
1592 Sys_Status(
"Can only set key/values in Brush primitive mode\n");
1602 if (g_qeglobals.m_bBrushPrimitMode) {
1604 return Patch_GetKeyValue(b->pPatch, pKey);
1607 return b->epairs.GetString(pKey);
1611 Sys_Status(
"Can only set brush/patch key/values in Brush primitive mode\n");
1630 Patch_Write(b->pPatch, f);
1634 if (g_qeglobals.m_bBrushPrimitMode) {
1644 int count = b->epairs.GetNumKeyVals();
1646 WriteFileString(f,
"\"%s\" \"%s\"\n", b->epairs.GetKeyVal(
j)->GetKey().c_str(), b->epairs.GetKeyVal(
j)->GetValue().c_str());
1649 for (fa = b->brush_faces; fa; fa = fa->next) {
1655 fa->planepts[0] -= origin;
1656 fa->planepts[1] -= origin;
1657 fa->planepts[2] -= origin;
1658 plane.
FromPoints( fa->planepts[0], fa->planepts[1], fa->planepts[2],
false );
1659 fa->planepts[0] += origin;
1660 fa->planepts[1] += origin;
1661 fa->planepts[2] += origin;
1663 plane = fa->originalPlane;
1667 for (i = 0; i < 4; i++) {
1668 if (plane[i] == (
int)plane[i]) {
1679 for (i = 0; i < 3; i++) {
1681 for (
int j = 0;
j < 3;
j++) {
1682 if (fa->planepts[i][
j] == static_cast<int>(fa->planepts[i][
j])) {
1696 for (i = 0; i < 3; i++) {
1697 if (fa->brushprimit_texdef.coords[0][i] == static_cast<int>(fa->brushprimit_texdef.coords[0][i])) {
1698 WriteFileString(f,
"%i ", static_cast<int>(fa->brushprimit_texdef.coords[0][i]));
1706 for (i = 0; i < 3; i++) {
1707 if (fa->brushprimit_texdef.coords[1][i] == static_cast<int>(fa->brushprimit_texdef.coords[1][i])) {
1708 WriteFileString(f,
"%i ", static_cast<int>(fa->brushprimit_texdef.coords[1][i]));
1717 char *pName = strlen(fa->texdef.name) > 0 ? fa->texdef.name :
"notexture";
1726 for (fa = b->brush_faces; fa; fa = fa->next) {
1727 for (i = 0; i < 3; i++) {
1729 for (
int j = 0;
j < 3;
j++) {
1730 if (fa->planepts[i][
j] == static_cast<int>(fa->planepts[i][
j])) {
1741 pname = fa->texdef.name;
1742 if (pname[0] == 0) {
1751 (
int)fa->texdef.shift[0],
1752 (
int)fa->texdef.shift[1],
1753 (
int)fa->texdef.rotate
1756 if (fa->texdef.scale[0] == (
int)fa->texdef.scale[0]) {
1763 if (fa->texdef.scale[1] == (
int)fa->texdef.scale[1]) {
1793 va_start(argptr, text);
1813 Patch_Write(b->pPatch, pMemFile);
1817 if (g_qeglobals.m_bBrushPrimitMode) {
1828 int count = b->epairs.GetNumKeyVals();
1830 MemFile_fprintf(pMemFile,
"\"%s\" \"%s\"\n", b->epairs.GetKeyVal(
j)->GetKey().c_str(), b->epairs.GetKeyVal(
j)->GetValue().c_str());
1833 for (fa = b->brush_faces; fa; fa = fa->next) {
1839 fa->planepts[0] -= origin;
1840 fa->planepts[1] -= origin;
1841 fa->planepts[2] -= origin;
1842 plane.
FromPoints( fa->planepts[0], fa->planepts[1], fa->planepts[2],
false );
1843 fa->planepts[0] += origin;
1844 fa->planepts[1] += origin;
1845 fa->planepts[2] += origin;
1847 plane = fa->originalPlane;
1851 for (i = 0; i < 4; i++) {
1852 if (plane[i] == (
int)plane[i]) {
1863 for (i = 0; i < 3; i++) {
1865 for (
int j = 0;
j < 3;
j++) {
1866 if (fa->planepts[i][
j] == static_cast<int>(fa->planepts[i][
j])) {
1867 MemFile_fprintf(pMemFile,
"%i ", static_cast<int>(fa->planepts[i][j]));
1880 for (i = 0; i < 3; i++) {
1881 if (fa->brushprimit_texdef.coords[0][i] == static_cast<int>(fa->brushprimit_texdef.coords[0][i])) {
1882 MemFile_fprintf(pMemFile,
"%i ", static_cast<int>(fa->brushprimit_texdef.coords[0][i]));
1885 MemFile_fprintf(pMemFile,
"%f ", fa->brushprimit_texdef.coords[0][i]);
1890 for (i = 0; i < 3; i++) {
1891 if (fa->brushprimit_texdef.coords[1][i] == static_cast<int>(fa->brushprimit_texdef.coords[1][i])) {
1892 MemFile_fprintf(pMemFile,
"%i ", static_cast<int>(fa->brushprimit_texdef.coords[1][i]));
1895 MemFile_fprintf(pMemFile,
"%f ", fa->brushprimit_texdef.coords[1][i]);
1902 char *pName = strlen(fa->texdef.name) > 0 ? fa->texdef.name :
"unnamed";
1912 for (fa = b->brush_faces; fa; fa = fa->next) {
1913 for (i = 0; i < 3; i++) {
1915 for (
int j = 0;
j < 3;
j++) {
1916 if (fa->planepts[i][
j] == static_cast<int>(fa->planepts[i][
j])) {
1917 MemFile_fprintf(pMemFile,
"%i ", static_cast<int>(fa->planepts[i][j]));
1927 pname = fa->texdef.name;
1928 if (pname[0] == 0) {
1937 (
int)fa->texdef.shift[0],
1938 (
int)fa->texdef.shift[1],
1939 (
int)fa->texdef.rotate
1942 if (fa->texdef.scale[0] == (
int)fa->texdef.scale[0]) {
1949 if (fa->texdef.scale[1] == (
int)fa->texdef.scale[1]) {
1982 for (i = 0; i < 3; i++) {
1983 if (maxs[i] < mins[i]) {
1984 Error(
"Brush_InitSolid: backwards");
1990 pts[0][0][0] = mins[0];
1991 pts[0][0][1] = mins[1];
1993 pts[1][0][0] = mins[0];
1994 pts[1][0][1] = maxs[1];
1996 pts[2][0][0] = maxs[0];
1997 pts[2][0][1] = maxs[1];
1999 pts[3][0][0] = maxs[0];
2000 pts[3][0][1] = mins[1];
2002 for (i = 0; i < 4; i++) {
2003 pts[
i][0][2] = mins[2];
2004 pts[
i][1][0] = pts[
i][0][0];
2005 pts[
i][1][1] = pts[
i][0][1];
2006 pts[
i][1][2] = maxs[2];
2009 for (i = 0; i < 4; i++) {
2011 f->texdef = *texdef;
2012 f->next = b->brush_faces;
2022 f->texdef = *texdef;
2023 f->next = b->brush_faces;
2031 f->texdef = *texdef;
2032 f->next = b->brush_faces;
2048 for ( face_t *
f = b->brush_faces;
f;
f =
f->next ) {
2049 for (
int i = 0;
i < 3;
i++ ) {
2050 VectorScale(
f->planepts[
i], g_qeglobals.d_gridsize,
f->planepts[
i] );
2067 for (i = 0; i < 3; i++) {
2068 if (maxs[i] < mins[i]) {
2069 Error(
"Brush_InitSolid: backwards");
2079 corners[0][0] = mins[0];
2080 corners[0][1] = mins[1];
2081 corners[0][2] = fMid;
2083 corners[1][0] = mins[0];
2084 corners[1][1] = maxs[1];
2085 corners[1][2] = fMid;
2087 corners[2][0] = maxs[0];
2088 corners[2][1] = maxs[1];
2089 corners[2][2] = fMid;
2091 corners[3][0] = maxs[0];
2092 corners[3][1] = mins[1];
2093 corners[3][2] = fMid;
2097 top[0] =
idMath::Rint(mins[0] + ((maxs[0] - mins[0]) / 2));
2098 top[1] =
idMath::Rint(mins[1] + ((maxs[1] - mins[1]) / 2));
2102 bottom[2] = mins[2];
2105 for (i = 0; i < 4; i++) {
2107 f->texdef = *texdef;
2108 f->next = b->brush_faces;
2111 int j = (i + 1) % 4;
2118 f->texdef = *texdef;
2119 f->next = b->brush_faces;
2157 if (!QE_SingleBrush()) {
2158 Sys_Status(
"Must have a single brush selected", 0);
2165 texdef = &g_qeglobals.d_texturewin.texdef;
2189 for (i = 0; i < 3; i++) {
2190 mid[
i] = (maxs[
i] + mins[
i]) * 0.5f;
2195 if ((maxs[i] - mins[i]) * 0.5f >
width) {
2196 width = (maxs[
i] - mins[
i]) * 0.5f;
2204 f->texdef = *texdef;
2205 f->next = b->brush_faces;
2208 f->planepts[2][(axis + 1) % 3] = mins[(axis + 1) % 3];
2209 f->planepts[2][(axis + 2) % 3] = mins[(axis + 2) % 3];
2210 f->planepts[2][axis] = maxs[axis];
2211 f->planepts[1][(axis + 1) % 3] = maxs[(axis + 1) % 3];
2212 f->planepts[1][(axis + 2) % 3] = mins[(axis + 2) % 3];
2213 f->planepts[1][axis] = maxs[axis];
2214 f->planepts[0][(axis + 1) % 3] = maxs[(axis + 1) % 3];
2215 f->planepts[0][(axis + 2) % 3] = maxs[(axis + 2) % 3];
2216 f->planepts[0][axis] = maxs[axis];
2220 f->texdef = *texdef;
2221 f->next = b->brush_faces;
2224 f->planepts[0][(axis + 1) % 3] = mins[(axis + 1) % 3];
2225 f->planepts[0][(axis + 2) % 3] = mins[(axis + 2) % 3];
2226 f->planepts[0][axis] = mins[axis];
2227 f->planepts[1][(axis + 1) % 3] = maxs[(axis + 1) % 3];
2228 f->planepts[1][(axis + 2) % 3] = mins[(axis + 2) % 3];
2229 f->planepts[1][axis] = mins[axis];
2230 f->planepts[2][(axis + 1) % 3] = maxs[(axis + 1) % 3];
2231 f->planepts[2][(axis + 2) % 3] = maxs[(axis + 2) % 3];
2232 f->planepts[2][axis] = mins[axis];
2234 for (i = 0; i < sides; i++) {
2236 f->texdef = *texdef;
2237 f->next = b->brush_faces;
2240 sv = sin(i * 3.14159265 * 2 / sides);
2241 cv = cos(i * 3.14159265 * 2 / sides);
2243 f->planepts[0][(axis + 1) % 3] = floor(mid[(axis + 1) % 3] + width * cv + 0.5f);
2244 f->planepts[0][(axis + 2) % 3] = floor(mid[(axis + 2) % 3] + width * sv + 0.5f);
2245 f->planepts[0][axis] = mins[axis];
2247 f->planepts[1][(axis + 1) % 3] = f->planepts[0][(axis + 1) % 3];
2248 f->planepts[1][(axis + 2) % 3] = f->planepts[0][(axis + 2) % 3];
2249 f->planepts[1][axis] = maxs[axis];
2251 f->planepts[2][(axis + 1) % 3] = floor(f->planepts[0][(axis + 1) % 3] - width * sv + 0.5f);
2252 f->planepts[2][(axis + 2) % 3] = floor(f->planepts[0][(axis + 2) % 3] + width * cv + 0.5f);
2253 f->planepts[2][axis] = maxs[axis];
2283 Patch_Delete(b->pPatch);
2287 for ( f = b->brush_faces; f; f = next ) {
2317 if ( f->face_winding ) {
2318 size +=
sizeof(
idWinding ) + f->face_winding->GetNumPoints() *
sizeof( (f->face_winding)[0] );
2320 size +=
sizeof( face_t );
2335 size += Patch_MemorySize( b->pPatch );
2338 for ( f = b->brush_faces; f; f = f->next ) {
2342 size +=
sizeof( brush_t ) + b->epairs.Size();
2358 patchMesh_t *
p = Patch_Duplicate(b->pPatch);
2366 n->owner = b->owner;
2367 n->lightColor = b->lightColor;
2368 n->lightEnd = b->lightEnd;
2369 n->lightOffset = b->lightOffset;
2370 n->lightRadius = b->lightRadius;
2371 n->lightRight = b->lightRight;
2372 n->lightStart = b->lightStart;
2373 n->lightTarget = b->lightTarget;
2374 n->lightCenter = b->lightCenter;
2375 n->lightTexture = b->lightTexture;
2376 n->lightUp = b->lightUp;
2377 n->modelHandle = b->modelHandle;
2378 n->pointLight = b->pointLight;
2379 for (f = b->brush_faces; f; f = f->next) {
2381 nf->next = n->brush_faces;
2382 n->brush_faces = nf;
2400 face_t *
f, *nf, *f2, *nf2;
2404 patchMesh_t *
p = Patch_Duplicate(b->pPatch);
2408 n->owner = b->owner;
2414 n->owner = b->owner;
2415 n->lightColor = b->lightColor;
2416 n->lightEnd = b->lightEnd;
2417 n->lightOffset = b->lightOffset;
2418 n->lightRadius = b->lightRadius;
2419 n->lightRight = b->lightRight;
2420 n->lightStart = b->lightStart;
2421 n->lightTarget = b->lightTarget;
2422 n->lightCenter = b->lightCenter;
2423 n->lightTexture = b->lightTexture;
2424 n->lightUp = b->lightUp;
2425 n->modelHandle = b->modelHandle;
2426 n->pointLight = b->pointLight;
2429 for (f = b->brush_faces; f; f = f->next) {
2435 nf->next = n->brush_faces;
2436 n->brush_faces = nf;
2439 for (f2 = b->brush_faces; f2; f2 = f2->next) {
2440 if (f2->original == f) {
2442 nf2->next = n->brush_faces;
2443 n->brush_faces = nf2;
2451 for (nf = n->brush_faces; nf; nf = nf->next) {
2453 if (nf->face_winding) {
2454 if (g_qeglobals.m_bBrushPrimitMode) {
2458 for (j = 0; j < nf->face_winding->GetNumPoints(); j++) {
2491 float x2 = (((x - origin[0]) * c) - ((y - origin[1]) * s)) + origin[0];
2492 float y2 = (((x - origin[0]) * s) + ((y - origin[1]) * c)) + origin[1];
2510 model = b->owner->eclass->entityModel;
2515 if ( dynamic_cast<idRenderModelMD5 *>( model ) ) {
2517 md5 = b->owner->eclass->entityModel;
2519 const char *classname =
ValueForKey( b->owner,
"classname" );
2520 if (
stricmp(classname,
"func_static") == 0) {
2523 const char *anim =
ValueForKey( b->owner,
"anim" );
2524 int frame =
IntForKey( b->owner,
"frame" ) + 1;
2528 if ( !anim || !anim[ 0 ] ) {
2564 v1 *= b->owner->rotation;
2565 v1 += b->owner->origin;
2566 v2 *= b->owner->rotation;
2567 v2 += b->owner->origin;
2568 v3 *= b->owner->rotation;
2569 v3 += b->owner->origin;
2571 v1 += b->owner->origin;
2572 v2 += b->owner->origin;
2573 v3 += b->owner->origin;
2590 face_t *
f, *firstface =
NULL;
2594 float scale = HUGE_DISTANCE * 2;
2596 for (i = 0; i < 3; i++) {
2597 p2[
i] = p1[
i] + dir[
i] * HUGE_DISTANCE * 2;
2600 for (f = b->brush_faces; f; f = f->next) {
2603 if (d1 >= 0 && d2 >= 0) {
2608 if (d1 <= 0 && d2 <= 0) {
2613 frac = d1 / (d1 - d2);
2616 for (i = 0; i < 3; i++) {
2617 p1[
i] = p1[
i] + frac * (p2[
i] - p1[
i]);
2621 for (i = 0; i < 3; i++) {
2622 p2[
i] = p1[
i] + frac * (p2[
i] - p1[
i]);
2638 else if ( b->modelHandle !=
NULL && dynamic_cast<idRenderModelPrt*>( b->modelHandle ) ==
NULL && dynamic_cast< idRenderModelLiquid*> ( b->modelHandle ) ==
NULL ) {
2659 for (f = b->brush_faces; f; f = f->next) {
2660 d1 =
DotProduct(origin, f->plane) + f->plane[3];
2666 return b->brush_faces;
2675 if (b->next || b->prev) {
2676 Error(
"Brush_AddToList: allready linked");
2681 Patch_Select(b->pPatch);
2686 b->next = list->next;
2687 list->next->prev =
b;
2699 if (!b->next || !b->prev) {
2700 Error(
"Brush_RemoveFromList: not linked");
2704 Patch_Deselect(b->pPatch);
2710 b->next->prev = b->prev;
2711 b->prev->next = b->next;
2712 b->next = b->prev =
NULL;
2727 void SetFaceTexdef( brush_t *
b, face_t *
f, texdef_t *texdef, brushprimit_texdef_t *brushprimit_texdef,
bool bFitScale ) {
2729 if (g_qeglobals.m_bBrushPrimitMode) {
2730 f->texdef = *texdef;
2733 else if (bFitScale) {
2734 f->texdef = *texdef;
2740 ComputeAbsolute(f, p1, p2, p3);
2756 AbsoluteToLocal(f->plane, f, p1, p2, p3);
2759 f->texdef = *texdef;
2769 void Brush_SetTexture(brush_t *
b, texdef_t *texdef, brushprimit_texdef_t *brushprimit_texdef,
bool bFitScale) {
2771 Patch_SetTexture(b->pPatch, texdef);
2774 for (face_t *
f = b->brush_faces;
f;
f =
f->next) {
2789 Patch_SetTextureName(b->pPatch, name);
2792 for (face_t *
f = b->brush_faces;
f;
f =
f->next) {
2793 f->texdef.SetName(name);
2812 if (d1 >= 0 && d2 >= 0) {
2816 if (d1 <= 0 && d2 <= 0) {
2820 fr = d1 / (d1 - d2);
2829 for (i = 0; i < 3; i++) {
2830 v[
i] = p1[
i] + fr * (p2[
i] - p1[
i]);
2844 for (i = 0; i < g_qeglobals.d_num_move_points; i++) {
2845 if (g_qeglobals.d_move_points[i] == f) {
2850 if (g_qeglobals.d_num_move_points < MAX_MOVE_POINTS) {
2851 g_qeglobals.d_move_points[g_qeglobals.d_num_move_points++] =
f;
2853 Sys_Status(
"Trying to move too many points\n");
2867 for (
int i = 0;
i < g_qeglobals.d_num_move_planes;
i++) {
2868 if (g_qeglobals.d_move_planes[
i] == p) {
2873 if (g_qeglobals.d_num_move_planes < MAX_MOVE_PLANES) {
2874 g_qeglobals.d_move_planes[g_qeglobals.d_num_move_planes++] =
p;
2876 Sys_Status(
"Trying to move too many planes\n");
2901 for (i = 0; i < 3; i++) {
2917 for (f2 = b2->brush_faces; f2; f2 = f2->next) {
2918 for (i = 0; i < 3; i++) {
2939 for (f2 = b->brush_faces; f2; f2 = f2->next) {
2951 d =
DotProduct( (*w)[i], f->plane ) + f->plane[3];
2977 d =
DotProduct( (*w)[i], f->plane ) + f->plane[3];
3011 for (f = b->brush_faces; f; f = f->next) {
3015 for (f2 = b->brush_faces; f2; f2 = f2->next) {
3061 out -= b->owner->origin;
3063 out += b->owner->origin;
3073 if (!(b->owner->eclass->nShowFlags & ECLASS_LIGHT)) {
3074 if (b->modelHandle) {
3082 if (b->entityModel) {
3087 idVec3 *origin = (b->trackLightOrigin) ? &b->owner->lightOrigin : &b->owner->origin;
3090 b->lightColor[0] = b->lightColor[1] = b->lightColor[2] = 1;
3093 const char *str =
ValueForKey(b->owner,
"texture");
3094 b->lightTexture = -1;
3095 if (str && strlen(str) > 0) {
3104 idVec3 vRight, vUp, vTarget, vTemp;
3113 VectorAdd(b->lightEnd, *origin, b->lightEnd);
3114 VectorAdd(b->lightStart, *origin, b->lightStart);
3115 VectorAdd(b->lightStart, offset, b->lightStart);
3118 b->startEnd =
false;
3124 if (offset.
x || offset.
y || offset.
z) {
3127 SetKeyVec3(b->owner,
"light_target", vTarget);
3130 VectorAdd(vTarget, *origin, b->lightTarget);
3131 VectorAdd(b->lightTarget, vRight, b->lightRight);
3132 VectorAdd(b->lightTarget, vUp, b->lightUp);
3139 b->pointLight =
false;
3142 b->pointLight =
true;
3146 if (offset.
x || offset.
y || offset.
z) {
3149 SetKeyVec3(b->owner,
"light_center", vCenter);
3152 VectorAdd(vCenter, *origin, b->lightCenter);
3162 b->lightRadius[0] = b->lightRadius[1] = b->lightRadius[2] =
f;
3179 void Brush_BuildWindings(brush_t *
b,
bool bSnap,
bool keepOnPlaneWinding,
bool updateLights,
bool makeFacePlanes) {
3185 b->mins[0] = b->mins[1] = b->mins[2] = 999999;
3186 b->maxs[0] = b->maxs[1] = b->maxs[2] = -999999;
3188 if (makeFacePlanes) {
3192 face = b->brush_faces;
3194 float fCurveColor = 1.0f;
3196 for (; face; face = face->next) {
3198 delete face->face_winding;
3208 for (j = 0; j < 3; j++) {
3210 if (v > b->maxs[j]) {
3221 if (makeFacePlanes) {
3225 fCurveColor -= 0.1f;
3226 if ( fCurveColor <= 0.0
f ) {
3231 if (g_qeglobals.m_bBrushPrimitMode) {
3232 if (g_qeglobals.bNeedConvert) {
3279 b->brush_faces =
NULL;
3281 for (;
f; f = next) {
3283 if (!f->face_winding) {
3287 f->next = b->brush_faces;
3300 for (face_t *
f = pb->brush_faces;
f;
f =
f->next) {
3311 for (i = 0; i < 3; i++) {
3312 f->planepts[
i].x = (*w)[
i].x;
3313 f->planepts[
i].y = (*w)[
i].y;
3314 f->planepts[
i].z = (*w)[
i].z;
3321 sprintf(str,
"%i %i %i", (
int)pb->owner->origin.x, (
int)pb->owner->origin.y, (
int)pb->owner->origin.z);
3325 if (pb->owner->eclass->nShowFlags & ECLASS_LIGHT) {
3337 pb->lightTarget =
v;
3357 if ( pb->owner->curve ) {
3358 int c = pb->owner->curve->GetNumValues();
3359 for ( i = 0; i <
c; i++ ) {
3360 v = pb->owner->curve->GetValue( i );
3362 pb->owner->curve->SetValue( i, v );
3375 for (face_t *
f = b->brush_faces;
f;
f =
f->next) {
3376 for (
int i = 0;
i < 3;
i++) {
3377 f->planepts[
i] -= origin;
3379 f->planepts[
i] += origin;
3396 for (face_t *
f = b->brush_faces;
f;
f =
f->next) {
3397 for (
int i = 0;
i < 3;
i++) {
3416 for (
int j = 0;
j < 3;
j++) {
3417 vMid[
j] = b->mins[
j] + abs((b->maxs[
j] - b->mins[
j]) * 0.5f);
3436 assert( vMin[0] < vMax[0] && vMin[1] < vMax[1] && vMin[2] < vMax[2] );
3440 for( f = b->brush_faces; f; f = f->next ) {
3441 for ( i = 0; i < 3; i++ ) {
3442 if ( f->plane.Normal()[
i] >= 0.999f ) {
3443 for ( j = 0; j < 3; j++ ) {
3444 f->planepts[
j][
i] = vMax[
i];
3448 if ( f->plane.Normal()[
i] <= -0.999f ) {
3449 for ( j = 0; j < 3; j++ ) {
3450 f->planepts[
j][
i] = vMin[
i];
3468 vMin[0] = vMin[1] = vMin[2] = 999999;
3469 vMax[0] = vMax[1] = vMax[2] = -999999;
3471 if (b->owner->md3Class !=
NULL) {
3472 return b->owner->md3Class;
3475 if (b->owner->eclass->modelHandle > 0) {
3476 return b->owner->eclass;
3482 if (b->owner->eclass->nShowFlags & ECLASS_MISCMODEL) {
3483 const char *pModel =
ValueForKey(b->owner,
"model");
3484 if (pModel !=
NULL && strlen(pModel) > 0) {
3491 VectorAdd(vMin, b->owner->origin, vMin);
3492 VectorAdd(vMax, b->owner->origin, vMax);
3494 b->bModelFailed =
false;
3497 b->bModelFailed =
true;
3519 if ( angle == -1 ) {
3520 angles.
Set( 270, 0, 0 );
3522 else if ( angle == -2 ) {
3523 angles.
Set( 90, 0, 0 );
3526 angles.
Set( 0, angle, 0 );
3548 angles.
ToVectors( &forward, &right, &up);
3558 idVec3 endpoint, tip1, tip2;
3564 dist = (b->maxs[0] - start[0]) * 2.5
f;
3566 FacingVectors(e, forward, right, up);
3567 VectorMA(start, dist, ( particle ) ? up : forward, endpoint);
3569 dist = (b->maxs[0] - start[0]) * 0.5
f;
3570 VectorMA(endpoint, -dist, ( particle ) ? up : forward, tip1);
3571 VectorMA(tip1, -dist, ( particle ) ? forward : up, tip1);
3572 VectorMA(tip1, 2 * dist, ( particle ) ? forward : up, tip2);
3641 idVec3 *origin = (b->trackLightOrigin) ? &b->owner->lightOrigin : &b->owner->origin;
3642 if (b->pointLight) {
3643 if ( b->lightCenter[0] || b->lightCenter[1] || b->lightCenter[2] ) {
3647 tv = b->lightCenter;
3671 tv = b->lightTarget;
3707 float ig = 3 - 2 *
r;
3709 float idgd = 4 * r - 10;
3742 if (!(g_qeglobals.d_savedinfo.showSoundAlways || (g_qeglobals.d_savedinfo.showSoundWhenSelected && bSelected))) {
3750 const char *
s = b->owner->epairs.GetString(
"s_shader");
3763 if (min == 0 && max == 0) {
3774 qglColor4f(g_qeglobals.d_savedinfo.colors[COLOR_SELBRUSHES].x, g_qeglobals.d_savedinfo.colors[COLOR_SELBRUSHES].y, g_qeglobals.d_savedinfo.colors[COLOR_SELBRUSHES].z, .5);
3776 qglColor4f(b->owner->eclass->color.x, b->owner->eclass->color.y, b->owner->eclass->color.z, .5);
3779 GLCircle(b->owner->origin.x, b->owner->origin.y, b->owner->origin.z, min);
3781 qglColor4f(g_qeglobals.d_savedinfo.colors[COLOR_SELBRUSHES].x, g_qeglobals.d_savedinfo.colors[COLOR_SELBRUSHES].y, g_qeglobals.d_savedinfo.colors[COLOR_SELBRUSHES].z, 1);
3783 qglColor4f(b->owner->eclass->color.x, b->owner->eclass->color.y, b->owner->eclass->color.z, 1);
3785 GLCircle(b->owner->origin.x, b->owner->origin.y, b->owner->origin.z, max);
3788 qglTranslatef(b->owner->origin.x, b->owner->origin.y, b->owner->origin.z );
3791 GLUquadricObj* qobj = gluNewQuadric();
3792 gluSphere(qobj, min, 8, 8);
3794 gluSphere(qobj, max, 8, 8);
3800 qglColor4f( g_qeglobals.d_savedinfo.colors[COLOR_SELBRUSHES].x, g_qeglobals.d_savedinfo.colors[COLOR_SELBRUSHES].y, g_qeglobals.d_savedinfo.colors[COLOR_SELBRUSHES].z, 0.35f );
3802 qglColor4f( b->owner->eclass->color.x, b->owner->eclass->color.y, b->owner->eclass->color.z, 0.35f );
3804 gluSphere(qobj, min, 8, 8);
3806 qglColor4f( g_qeglobals.d_savedinfo.colors[COLOR_SELBRUSHES].x, g_qeglobals.d_savedinfo.colors[COLOR_SELBRUSHES].y, g_qeglobals.d_savedinfo.colors[COLOR_SELBRUSHES].z, 0.1f );
3808 qglColor4f( b->owner->eclass->color.x, b->owner->eclass->color.y, b->owner->eclass->color.z, 0.1f );
3810 gluSphere(qobj, max, 8, 8);
3811 gluDeleteQuadric(qobj);
3825 bool bTriPaint =
false;
3827 vTriColor[0] = vTriColor[2] = 1.0f;
3828 vTriColor[1] = 1.0f;
3831 CString strColor =
ValueForKey(b->owner,
"_color");
3832 if (strColor.GetLength() > 0) {
3834 int n = sscanf(strColor,
"%f %f %f", &fR, &fG, &fB);
3842 qglColor3f(vTriColor[0], vTriColor[1], vTriColor[2]);
3845 float fMid = b->mins[2] + (b->maxs[2] - b->mins[2]) / 2;
3847 vCorners[0][0] = b->mins[0];
3848 vCorners[0][1] = b->mins[1];
3849 vCorners[0][2] = fMid;
3851 vCorners[1][0] = b->mins[0];
3852 vCorners[1][1] = b->maxs[1];
3853 vCorners[1][2] = fMid;
3855 vCorners[2][0] = b->maxs[0];
3856 vCorners[2][1] = b->maxs[1];
3857 vCorners[2][2] = fMid;
3859 vCorners[3][0] = b->maxs[0];
3860 vCorners[3][1] = b->mins[1];
3861 vCorners[3][2] = fMid;
3865 vTop[0] = b->mins[0] + ((b->maxs[0] - b->mins[0]) / 2);
3866 vTop[1] = b->mins[1] + ((b->maxs[1] - b->mins[1]) / 2);
3867 vTop[2] = b->maxs[2];
3870 vBottom[2] = b->mins[2];
3879 for (i = 0; i <= 3; i++) {
3880 vTriColor[0] *= 0.95f;
3881 vTriColor[1] *= 0.95f;
3882 vTriColor[2] *= 0.95f;
3883 qglColor3f(vTriColor[0], vTriColor[1], vTriColor[2]);
3891 vTriColor[0] *= 0.95f;
3892 vTriColor[1] *= 0.95f;
3893 vTriColor[2] *= 0.95f;
3898 for (i = 3; i >= 0; i--) {
3899 vTriColor[0] *= 0.95f;
3900 vTriColor[1] *= 0.95f;
3901 vTriColor[2] *= 0.95f;
3902 qglColor3f(vTriColor[0], vTriColor[1], vTriColor[2]);
3919 qtexture_t *prev = 0;
3924 for ( face = b->brush_faces, order = 0; face; face = face->next, order++ ) {
3925 w = face->face_winding;
3958 if ( model ==
NULL ) {
3959 model = b->owner->eclass->entityModel;
3965 bool fixedBounds =
false;
3968 if ( dynamic_cast<idRenderModelMD5 *>( model ) ) {
3969 const char *classname =
ValueForKey( b->owner,
"classname" );
3970 if (
stricmp(classname,
"func_static") == 0) {
3973 const char *anim =
ValueForKey( b->owner,
"anim" );
3974 int frame =
IntForKey( b->owner,
"frame" ) + 1;
3978 if ( !anim || !anim[ 0 ] ) {
3982 }
else if ( dynamic_cast<idRenderModelPrt*>( model ) || dynamic_cast<idRenderModelLiquid*>( model ) ) {
3997 color.
x = g_qeglobals.d_savedinfo.colors[COLOR_SELBRUSHES].x;
3998 color.
y = g_qeglobals.d_savedinfo.colors[COLOR_SELBRUSHES].y;
3999 color.
z = g_qeglobals.d_savedinfo.colors[COLOR_SELBRUSHES].z;
4001 color.
x = b->owner->eclass->color.x;
4002 color.
y = b->owner->eclass->color.y;
4003 color.
z = b->owner->eclass->color.z;
4006 glBox(color, b->owner->origin + center, bounds.
GetRadius( center ) );
4019 qglColor3fv( g_qeglobals.d_savedinfo.colors[COLOR_SELBRUSHES].ToFloatPtr() );
4026 if ( bSelected && camera )
4057 if ( bSelected && camera ) {
4060 else if ( camera ) {
4064 if ( g_bPatchShowBounds ) {
4065 for ( face_t *face = b->brush_faces; face; face = face->next ) {
4100 }
else if (color.
y) {
4118 for (
int i = 0;
i < 360;
i++) {
4119 float cx = origin.
x;
4120 float cy = origin.
y;
4121 float cz = origin.
z;
4124 cx += r * cos((
float)
i);
4125 cy += r * sin((
float)i);
4128 cx += r * cos((
float)i);
4129 cz += r * sin((
float)i);
4132 cy += r * sin((
float)i);
4133 cz += r * cos((
float)i);
4176 xr = (b->modelHandle->Bounds()[1].x > b->modelHandle->Bounds()[0].x) ? b->modelHandle->Bounds()[1].x - b->modelHandle->Bounds()[0].x : b->modelHandle->Bounds()[0].x - b->modelHandle->Bounds()[1].x;
4177 yr = (b->modelHandle->Bounds()[1].y > b->modelHandle->Bounds()[0].y) ? b->modelHandle->Bounds()[1].y - b->modelHandle->Bounds()[0].y : b->modelHandle->Bounds()[0].y - b->modelHandle->Bounds()[1].y;
4178 zr = (b->modelHandle->Bounds()[1].z > b->modelHandle->Bounds()[0].z) ? b->modelHandle->Bounds()[1].z - b->modelHandle->Bounds()[0].z : b->modelHandle->Bounds()[0].z - b->modelHandle->Bounds()[1].z;
4188 idVec3 org = b->owner->origin;
4189 if (g_qeglobals.rotateAxis == 0) {
4192 }
else if (g_qeglobals.rotateAxis == 1) {
4197 if (g_qeglobals.flatRotation) {
4205 vec[g_qeglobals.rotateAxis] = 1.0f;
4206 if (g_qeglobals.flatRotation == 1) {
4228 if (b->modelHandle > 0) {
4232 qglColor3fv(g_qeglobals.d_savedinfo.colors[COLOR_SELBRUSHES].ToFloatPtr());
4235 qglColor3fv(b->owner->eclass->color.ToFloatPtr());
4254 if ( !( b->owner->eclass->nShowFlags & ECLASS_PARTICLE ) ) {
4259 qglColor4f(g_qeglobals.d_savedinfo.colors[COLOR_SELBRUSHES].x, g_qeglobals.d_savedinfo.colors[COLOR_SELBRUSHES].y, g_qeglobals.d_savedinfo.colors[COLOR_SELBRUSHES].z, .5);
4261 qglColor4f(b->owner->eclass->color.x, b->owner->eclass->color.y, b->owner->eclass->color.z, .5);
4275 idVec3 origin, newOrigin;
4286 if ( b->owner->epairs.GetVector(
"origin",
"0 0 0", newOrigin ) ) {
4303 qglColor3fv( g_qeglobals.d_savedinfo.colors[COLOR_SELBRUSHES].ToFloatPtr() );
4322 float min_dist = b->owner->epairs.GetFloat(
"min" );
4323 float max_dist = b->owner->epairs.GetFloat(
"max" );
4324 float fov = b->owner->epairs.GetFloat(
"fov",
"60" );
4325 float yaw = b->owner->epairs.GetFloat(
"angle");
4328 idAngles leftang( 0.0
f, yaw + fov * 0.5
f - 90.0
f, 0.0
f );
4330 idAngles rightang( 0.0
f, yaw - fov * 0.5
f + 90.0
f, 0.0
f );
4332 bool disabled = b->owner->epairs.GetBool(
"start_off" );
4341 idVec3 leftDir( -cone_left.
y, cone_left.
x, 0.0f );
4342 idVec3 rightDir( cone_right.
y, -cone_right.
x, 0.0f );
4348 idVec3 entorg = b->owner->origin;
4349 float cone_dot = cone_right * axis[ 1 ];
4351 idVec3 pt, pt1, pt2, pt3, pt4;
4352 float cone_dist = max_dist / cone_dot;
4353 pt1 = org + leftDir * min_dist;
4354 pt2 = org + leftDir * cone_dist;
4355 pt3 = org + rightDir * cone_dist;
4356 pt4 = org + rightDir * min_dist;
4369 pt = (pt1 + pt4) * 0.5
f;
4371 pt = (pt2 + pt3) * 0.5
f;
4374 idVec3 dir = ((pt1 + pt2) * 0.5
f) - tip;
4376 pt = tip + dir * 15.0f;
4379 dir = ((pt4 + pt3) * 0.5
f) - tip;
4381 pt = tip + dir * 15.0f;
4404 if ( b->hiddenBrush ) {
4411 Patch_DrawCam(b->pPatch, bSelected);
4417 if (!(g_qeglobals.d_savedinfo.exclude & EXCLUDE_ANGLES) && (b->owner->eclass->nShowFlags & ECLASS_ANGLE)) {
4421 if ( b->owner->eclass->fixedsize ) {
4425 if (
g_PrefsDlg.
m_bNewLightDraw && (b->owner->eclass->nShowFlags & ECLASS_LIGHT) && !(b->modelHandle || b->entityModel) ) {
4430 if ( b->owner->eclass->nShowFlags & ECLASS_ENV ) {
4434 if ( b->owner->eclass->nShowFlags & ECLASS_COMBATNODE ) {
4441 if (!(b->owner && (b->owner->eclass->nShowFlags & ECLASS_WORLDSPAWN))) {
4449 if ( b->owner->eclass->entityModel ) {
4450 qglColor3fv( b->owner->eclass->color.ToFloatPtr() );
4457 if ( b->modelHandle > 0 && !model ) {
4464 for (face = b->brush_faces, order = 0; face; face = face->next, order++) {
4465 w = face->face_winding;
4470 if (g_qeglobals.d_savedinfo.exclude & EXCLUDE_CAULK) {
4471 if (strstr(face->texdef.name,
"caulk")) {
4476 if (g_qeglobals.d_savedinfo.exclude & EXCLUDE_VISPORTALS) {
4477 if (strstr(face->texdef.name,
"visportal")) {
4482 if (g_qeglobals.d_savedinfo.exclude & EXCLUDE_NODRAW) {
4483 if (strstr(face->texdef.name,
"nodraw")) {
4488 if ( (nDrawMode ==
cd_texture || nDrawMode ==
cd_light) && face->d_texture != prev && !b->forceWireFrame ) {
4490 prev = face->d_texture;
4497 qglColor4f( face->d_color.x, face->d_color.y, face->d_color.z, 0.1f );
4499 qglColor4f( face->d_color.x, face->d_color.y, face->d_color.z, face->d_texture->GetEditorAlpha() );
4530 if (f->face_winding ==
NULL) {
4535 for (i = 0; i < f->face_winding->GetNumPoints(); i++) {
4553 if ( curve ==
NULL || newCurve ==
NULL ) {
4559 for (
int i = 0;
i <
c;
i++ ) {
4581 if ( b ==
NULL || b->owner->curve ==
NULL ) {
4585 int maxage = b->owner->curve->GetNumValues();
4588 for ( i = 0; i < maxage; i++) {
4590 if ( bSelected && g_qeglobals.d_select_mode == sel_editpoint ) {
4591 idVec3 v = b->owner->curve->GetValue( i );
4594 if ( PointInMoveList( b->owner->curve->GetValueAddress( i ) ) >= 0 ) {
4603 if ( PointInMoveList( b->owner->curve->GetValueAddress( i ) ) >= 0 ) {
4646 if ( i + 1 < maxage ) {
4647 int start = b->owner->curve->GetTime( i );
4648 int end = b->owner->curve->GetTime( i + 1 );
4651 idVec3 v = b->owner->curve->GetCurrentValue( start );
4670 void Brush_DrawXY(brush_t *
b,
int nViewType,
bool bSelected,
bool ignoreViewType) {
4676 if ( b->hiddenBrush ) {
4683 if (!(b->owner && (b->owner->eclass->nShowFlags & ECLASS_WORLDSPAWN))) {
4697 Patch_DrawXY(b->pPatch);
4698 if (!g_bPatchShowBounds) {
4703 if (b->owner->eclass->fixedsize) {
4706 if (
g_PrefsDlg.
m_bNewLightDraw && (b->owner->eclass->nShowFlags & ECLASS_LIGHT) && !(b->modelHandle || b->entityModel)) {
4708 float fMid = b->mins[2] + (b->maxs[2] - b->mins[2]) / 2;
4710 vCorners[0][0] = b->mins[0];
4711 vCorners[0][1] = b->mins[1];
4712 vCorners[0][2] = fMid;
4714 vCorners[1][0] = b->mins[0];
4715 vCorners[1][1] = b->maxs[1];
4716 vCorners[1][2] = fMid;
4718 vCorners[2][0] = b->maxs[0];
4719 vCorners[2][1] = b->maxs[1];
4720 vCorners[2][2] = fMid;
4722 vCorners[3][0] = b->maxs[0];
4723 vCorners[3][1] = b->mins[1];
4724 vCorners[3][2] = fMid;
4728 vTop[0] = b->mins[0] + ((b->maxs[0] - b->mins[0]) / 2);
4729 vTop[1] = b->mins[1] + ((b->maxs[1] - b->mins[1]) / 2);
4730 vTop[2] = b->maxs[2];
4733 vBottom[2] = b->mins[2];
4755 }
else if (b->owner->eclass->nShowFlags & ECLASS_MISCMODEL) {
4757 }
else if (b->owner->eclass->nShowFlags & ECLASS_ENV) {
4759 }
else if (b->owner->eclass->nShowFlags & ECLASS_COMBATNODE) {
4763 if (b->owner->eclass->entityModel) {
4774 if (b->modelHandle > 0) {
4781 for (face = b->brush_faces, order = 0; face; face = face->next, order++) {
4783 if (!ignoreViewType) {
4784 if (nViewType == XY) {
4785 if (face->plane[2] <= 0) {
4789 if (nViewType == XZ) {
4790 if (face->plane[1] <= 0) {
4794 if (face->plane[0] <= 0) {
4801 w = face->face_winding;
4830 static int PointValueInPointList(
idVec3 v ) {
4831 for (
int i = 0;
i < g_qeglobals.d_numpoints;
i++ ) {
4832 if ( v == g_qeglobals.d_points[
i] ) {
4851 for (f = b->brush_faces; f; f = f->next) {
4859 for (i = 0; i < 3; i++) {
4860 VectorAdd(f->planepts[i], move, f->planepts[i]);
4868 Patch_Move(b->pPatch, move);
4871 if ( b->owner->curve ) {
4872 b->owner->curve->Translate( move );
4881 bool adjustOrigin =
true;
4882 if(b->trackLightOrigin) {
4883 b->owner->lightOrigin += move;
4884 sprintf(text,
"%i %i %i", (
int)b->owner->lightOrigin[0], (
int)b->owner->lightOrigin[1], (
int)b->owner->lightOrigin[2]);
4886 if (QE_SingleBrush(
true,
true)) {
4887 adjustOrigin =
false;
4891 if (adjustOrigin && updateOrigin) {
4892 b->owner->origin += move;
4894 sprintf(text,
"%g %g %g", b->owner->origin[0], b->owner->origin[1], b->owner->origin[2]);
4896 sprintf(text,
"%i %i %i", (
int)b->owner->origin[0], (
int)b->owner->origin[1], (
int)b->owner->origin[2]);
4915 if (b->owner->eclass->nShowFlags & ECLASS_ENV) {
4916 const idKeyValue *arg = b->owner->epairs.MatchPrefix(
"body ",
NULL );
4923 val = org.ToString(8);
4926 b->owner->epairs.Set(arg->
GetKey(), val);
4927 arg = b->owner->epairs.MatchPrefix(
"body ", arg );
4945 if (b->owner->eclass->nShowFlags & ECLASS_LIGHT) {
4946 vTemp[0] = vTemp[1] = 0;
4948 str.Format(
"%f %f %f", vTemp[0], vTemp[1], vTemp[2]);
4953 str.Format(
"%f %f %f", vTemp[0], vTemp[1], vTemp[2]);
4958 str.Format(
"%f %f %f", vTemp[0], vTemp[1], vTemp[2]);
4971 for (face_t *
f = b->brush_faces;
f;
f =
f->next) {
4973 common->
Printf(
"%f %f %f\n",
f->planepts[0][0],
f->planepts[0][1],
f->planepts[0][2]);
4974 common->
Printf(
"%f %f %f\n",
f->planepts[1][0],
f->planepts[1][1],
f->planepts[1][2]);
4975 common->
Printf(
"%f %f %f\n",
f->planepts[2][0],
f->planepts[2][1],
f->planepts[2][2]);
5001 if (!QE_SingleBrush()) {
5002 Sys_Status(
"Must have a single brush selected", 0);
5009 texdef = &g_qeglobals.d_texturewin.texdef;
5015 for (i = 0; i < 2; i++) {
5016 mid[
i] = (maxs[
i] + mins[
i]) * 0.5f;
5017 if (maxs[i] - mins[i] > width) {
5018 width = maxs[
i] - mins[
i];
5028 f->texdef = *texdef;
5029 f->next = b->brush_faces;
5032 f->planepts[0][0] = mins[0];
5033 f->planepts[0][1] = mins[1];
5034 f->planepts[0][2] = mins[2];
5035 f->planepts[1][0] = maxs[0];
5036 f->planepts[1][1] = mins[1];
5037 f->planepts[1][2] = mins[2];
5038 f->planepts[2][0] = maxs[0];
5039 f->planepts[2][1] = maxs[1];
5040 f->planepts[2][2] = mins[2];
5042 for (i = 0; i < sides; i++) {
5044 f->texdef = *texdef;
5045 f->next = b->brush_faces;
5051 f->planepts[0][0] = floor( mid[0] + width * cv + 0.5f );
5052 f->planepts[0][1] = floor( mid[1] + width * sv + 0.5f );
5053 f->planepts[0][2] = mins[2];
5055 f->planepts[1][0] = mid[0];
5056 f->planepts[1][1] = mid[1];
5057 f->planepts[1][2] = maxs[2];
5059 f->planepts[2][0] = floor( f->planepts[0][0] - width * sv + 0.5f );
5060 f->planepts[2][1] = floor( f->planepts[0][1] + width * cv + 0.5f );
5061 f->planepts[2][2] = maxs[2];
5094 if (!QE_SingleBrush()) {
5095 Sys_Status(
"Must have a single brush selected", 0);
5102 texdef = &g_qeglobals.d_texturewin.texdef;
5108 for ( i = 0; i < 3; i++ ) {
5109 mid[
i] = (maxs[
i] + mins[
i]) * 0.5f;
5110 if (maxs[i] - mins[i] > radius) {
5111 radius = maxs[
i] - mins[
i];
5119 for (i = 0; i < sides; i++) {
5120 for (j = 0; j < sides - 1; j++) {
5122 f->texdef = *texdef;
5123 f->next = b->brush_faces;
5149 if (g_qeglobals.m_bBrushPrimitMode) {
5151 mins[0] = maxs[0] = 0;
5199 for (face = b->brush_faces; face; face = face->next) {
5213 if ( b->owner->curve ) {
5214 int c = b->owner->curve->GetNumValues();
5215 for (
int i = 0;
i <
c;
i++ ) {
5216 bo.
AddPoint ( b->owner->curve->GetValue(
i ) );
CMainFrame * g_pParentWnd
GLdouble GLdouble GLdouble GLdouble q
brush_t * Brush_FullClone(brush_t *b)
void VectorSnapGrid(idVec3 &v)
void Brush_Print(brush_t *b)
void Face_FitTexture(face_t *face, float nHeight, float nWidth)
idImage * GetEditorImage(void) const
virtual idRenderModel * DefaultModel()=0
void AddSelectablePoint(brush_t *b, idVec3 v, int type, bool priority)
void WINAPI Sys_UpdateWindows(int nBits)
GLsizei const GLfloat * value
bool Compare(const idVec3 &a) const
type GetValue(const int index) const
int GetInt(const char *key, const char *defaultString="0") const
void DrawLight(brush_t *b, bool bSelected)
face_t * Face_Alloc(void)
void GLTransformedVertex(float x, float y, float z, idMat3 mat, idVec3 origin, idVec3 color, float maxDist)
void cross(float a[], float b[], float c[])
void Brush_Center(brush_t *b, idVec3 vNewCenter)
assert(prefInfo.fullscreenBtn)
virtual const idSoundShader * FindSound(const char *name, bool makeDefault=true)=0
bool FromPoints(const idVec3 &p1, const idVec3 &p2, const idVec3 &p3, bool fixDegenerate=true)
brush_t * Brush_Alloc(void)
const idVec3 & Normal(void) const
void Brush_DrawCombatNode(brush_t *b, bool cameraView, bool bSelected)
idVec3 GetCenter(void) const
void Brush_SetTextureName(brush_t *b, const char *name)
const float METERS_TO_DOOM
int Brush_Convex(brush_t *b)
void Brush_MakeSided(int sides)
void Face_TextureVectors(face_t *f, float STfromXYZ[2][4])
virtual idRenderModel * ANIM_CreateMeshForAnim(idRenderModel *model, const char *classname, const char *animname, int frame, bool remove_origin_offset)
void DrawBrushEntityName(brush_t *b)
virtual float GetMaxDistance() const
void ClearSelectablePoints(brush_t *b)
bool WriteFileString(FILE *fp, char *string,...)
int AddPlanept(idVec3 *f)
const idStr & GetKey(void) const
face_t * Brush_Point(idVec3 origin, brush_t *b)
const char * ToString(int precision=2) const
void Entity_UnlinkBrush(brush_t *b)
const float * ToFloatPtr(void) const
#define VectorSubtract(a, b, c)
srfTriangles_t * R_PolytopeSurface(int numPlanes, const idPlane *planes, idWinding **windings)
GLenum GLenum GLenum GLenum GLenum scale
face_t * Face_Clone(face_t *f)
idWinding * TryMerge(const idWinding &w, const idVec3 &normal, int keep=false) const
void SetFaceTexdef(brush_t *b, face_t *f, texdef_t *texdef, brushprimit_texdef_t *brushprimit_texdef, bool bFitScale)
eclass_t * HasModel(brush_t *b)
void Brush_DrawCurve(brush_t *b, bool bSelected, bool cam)
void Clamp(float &f, int nClamp)
void BuildEntityRenderState(entity_t *ent, bool update)
void Brush_DrawModel(brush_t *b, bool camera, bool bSelected)
brush_t * Brush_Parse(idVec3 origin)
const idMaterial * shader
void Brush_SideSelect(brush_t *b, idVec3 origin, idVec3 dir, bool shear)
void Brush_RemoveEmptyFaces(brush_t *b)
void Brush_Resize(brush_t *b, idVec3 vMin, idVec3 vMax)
void Sys_Status(const char *psz, int part)
const char * Brush_GetKeyValue(brush_t *b, const char *pKey)
const char * ValueForKey(entity_t *ent, const char *key)
void glBox(idVec4 &color, idVec3 &point, float size)
bool Entity_GetRotationMatrixAngles(entity_t *e, idMat3 &mat, idAngles &angles)
bool GetMatrixForKey(entity_t *ent, const char *key, idMat3 &mat)
void Face_MoveTexture(face_t *f, idVec3 delta)
bool Brush_ModelIntersect(brush_t *b, idVec3 origin, idVec3 dir, float &scale)
void Brush_Free(brush_t *b, bool bRemoveNode)
#define VectorAdd(a, b, c)
virtual float GetMinDistance() const
GLuint GLuint GLsizei GLenum type
void Brush_Move(brush_t *b, const idVec3 move, bool bSnap, bool updateOrigin)
bool Patch_Intersect(patchMesh_t *pm, idVec3 origin, idVec3 direction, float &scale)
void Brush_GetBounds(brush_t *b, idBounds &bo)
void MemFile_fprintf(CMemFile *pMemFile, const char *string,...)
brush_t * Brush_Clone(brush_t *b)
float GetRadius(void) const
idWinding * Clip(const idPlane &plane, const float epsilon=ON_EPSILON, const bool keepOn=false)
idVec3 Cross(const idVec3 &a) const
idMat3 Brush_RotationMatrix(brush_t *b)
static float Rint(float f)
void DrawSpeaker(brush_t *b, bool bSelected, bool twoD)
void Brush_DrawModelInfo(brush_t *b, bool selected)
void Face_FitTexture_BrushPrimit(face_t *f, idVec3 mins, idVec3 maxs, float nHeight, float nWidth)
void Brush_DrawAxis(brush_t *b)
void Brush_SetTexture(brush_t *b, texdef_t *texdef, brushprimit_texdef_t *brushprimit_texdef, bool bFitScale)
bool g_bShowLightTextures
void Brush_Build(brush_t *b, bool bSnap, bool bMarkMap, bool bConvert, bool updateLights)
void EmitTextureCoordinates(idVec5 &xyzst, const idMaterial *q, face_t *f, bool force)
int Icmp(const char *text) const
void Brush_DrawEnv(brush_t *b, bool cameraView, bool bSelected)
camera_draw_mode draw_mode
void Face_Free(face_t *f)
virtual dynamicModel_t IsDynamicModel() const =0
void Select_AddProjectedLight()
void SetKeyValue(entity_t *ent, const char *key, const char *value, bool trackAngles)
void InsertPoint(const idVec3 &point, int spot)
void Brush_SnapToGrid(brush_t *pb)
void Brush_MakeSidedCone(int sides)
bool AddPoint(const idVec3 &v)
void Error(const char *pFormat,...)
GLfloat GLfloat GLfloat v2
void Brush_BuildWindings(brush_t *b, bool bSnap, bool keepOnPlaneWinding, bool updateLights, bool makeFacePlanes)
int Face_MemorySize(face_t *f)
GLuint GLuint GLsizei count
void Brush_FitTexture(brush_t *b, float nHeight, float nWidth)
void Set(float pitch, float yaw, float roll)
void WINAPI QERApp_MapPrintf_MEMFILE(char *text,...)
void Entity_UpdateCurveData(entity_t *ent)
GLdouble GLdouble GLint GLint order
void GLTransformedCircle(int type, idVec3 origin, float r, idMat3 mat, float pointSize, idVec3 color, float maxDist)
int GetNumPoints(void) const
#define MAX_POINTS_ON_WINDING
GLubyte GLubyte GLubyte GLubyte w
bool EntityHasModel(entity_t *ent)
idVec3 ToForward(void) const
void Control_Draw(brush_t *b)
const idMaterial * Texture_ForName(const char *name)
void Brush_SplitBrushByFace(brush_t *in, face_t *f, brush_t **front, brush_t **back)
void Brush_AddToList(brush_t *b, brush_t *list)
idVec3 vec3_origin(0.0f, 0.0f, 0.0f)
brush_t * Brush_MakeConvexBrushes(brush_t *b)
void SetSweptCircle(const float radius)
static float Fabs(float f)
void Face_MakePlane(face_t *f)
srfTriangles_t * geometry
void SnapVectorToGrid(idVec3 &v)
void RotateVector(idVec3 &v, idVec3 origin, float a, float c, float s)
idVec3 Brush_TransformedPoint(brush_t *b, const idVec3 &in)
idVec3 ToVec3(void) const
virtual const modelSurface_t * Surface(int surfaceNum) const =0
idImageManager * globalImages
bool RayIntersectsTri(const idVec3 &origin, const idVec3 &direction, const idVec3 &vert0, const idVec3 &vert1, const idVec3 &vert2, float &scale)
brush_t * Brush_CreatePyramid(idVec3 mins, idVec3 maxs, texdef_t *texdef)
void Brush_SetEpair(brush_t *b, const char *pKey, const char *pValue)
void R_FreeStaticTriSurf(srfTriangles_t *tri)
void WINAPI QERApp_MapPrintf_FILE(char *text,...)
void Face_MoveTexture_BrushPrimit(face_t *f, idVec3 delta)
void Brush_ResetFaceOriginals(brush_t *b)
void BrushPrimit_Parse(brush_t *b, bool newFormat, const idVec3 origin)
virtual idRenderModel * AF_CreateMesh(const idDict &args, idVec3 &meshOrigin, idMat3 &meshAxis, bool &poseIsSet)
const idStr & GetValue(void) const
const idMaterial * Texture_LoadLight(const char *name)
float NormalizeFast(void)
void VectorRotate3Origin(const idVec3 &vIn, const idVec3 &vRotation, const idVec3 &vOrigin, idVec3 &out)
face_t * Face_FullClone(face_t *f)
void Brush_RemoveFromList(brush_t *b)
void FromTransformedBounds(const idBounds &bounds, const idVec3 &origin, const idMat3 &axis)
void DrawProjectedLight(brush_t *b, bool bSelected, bool texture)
const char * Brush_Name(brush_t *b)
int Brush_InsertVertexBetween(brush_t *b, idVec3 p1, idVec3 p2)
GLubyte GLubyte GLubyte a
virtual void Printf(const char *fmt,...) id_attribute((format(printf
int Brush_MemorySize(brush_t *b)
virtual idBounds Bounds(const struct renderEntity_s *ent=NULL) const =0
void Brush_Scale(brush_t *b)
GLdouble GLdouble GLdouble y2
const float * ToFloatPtr(void) const
GLdouble GLdouble GLdouble top
float GetTime(const int index) const
void TextureAxisFromPlane(const idPlane &pln, idVec3 &xv, idVec3 &yv)
idDeclManager * declManager
void Brush_Write(brush_t *b, FILE *f, const idVec3 &origin, bool newFormat)
static const float TWO_PI
void Tessellate(const int splineSubdivisions, const int sweptSplineSubdivisions)
GLfloat GLfloat GLfloat GLfloat v3
GLdouble GLdouble GLdouble r
bool GetVectorForKey(entity_t *ent, const char *key, idVec3 &vec)
void Entity_LinkBrush(entity_t *e, brush_t *b)
idRenderModelManager * renderModelManager
void R_RenderLightFrustum(const struct renderLight_s &renderLight, idPlane lightFrustum[6])
void AddMovePlane(idPlane *p)
bool Sys_KeyDown(int key)
void ConvertTexMatWithQTexture(float texMat1[2][3], const idMaterial *qtex1, float texMat2[2][3], const idMaterial *qtex2, float sScale=1.0, float tScale=1.0)
int Brush_MoveVertex(brush_t *b, const idVec3 &vertex, const idVec3 &delta, idVec3 &end, bool bSnap)
const int POINTS_PER_KNOT
const idMat3 & ToMat3(void) const
void Brush_Rotate(brush_t *b, idMat3 matrix, idVec3 origin, bool bBuild)
idMat3 ToMat3(void) const
void GLCircle(float x, float y, float z, float r)
bool ClipLineToFace(idVec3 &p1, idVec3 &p2, face_t *f)
void Face_SetColor(brush_t *b, face_t *f, float fCurveColor)
void DrawRenderModel(idRenderModel *model, idVec3 &origin, idMat3 &axis, bool cameraView)
idWinding * Copy(void) const
float ShadeForNormal(idVec3 normal)
void glVertex3fv(const GLfloat *v)
void Brush_DrawEmitter(brush_t *b, bool bSelected, bool cam)
virtual int AddValue(const float time, const type &value)
int IntForKey(entity_t *ent, const char *key)
brush_t * Brush_Create(idVec3 mins, idVec3 maxs, texdef_t *texdef)
void Brush_Draw(brush_t *b, bool bSelected)
int vsprintf(idStr &string, const char *fmt, va_list argptr)
void * Mem_ClearedAlloc(const int size)
virtual void ParseSpawnArgsToRenderLight(const idDict *args, renderLight_t *renderLight)
idAngles ToAngles(void) const
void Brush_MakeSidedSphere(int sides)
idWinding * Brush_MakeFaceWinding(brush_t *b, face_t *face, bool keepOnPlaneWinding)
void Brush_DrawXY(brush_t *b, int nViewType, bool bSelected, bool ignoreViewType)
void Brush_UpdateLightPoints(brush_t *b, const idVec3 &offset)
void RemovePoint(int point)
#define VectorScale(v, s, o)
void Face_Draw(face_t *f)
idBounds & ExpandSelf(const float d)
float dot(float a[], float b[])
GLuint GLenum GLenum transform
#define VectorMA(v, s, b, o)
float GetLengthBetweenKnots(const int i0, const int i1) const
BOOL m_selectByBoundingBrush
if(!ValidDisplayID(prefInfo.prefDisplayID)) prefInfo.prefDisplayID
int GetNumValues(void) const
void UpdateSelectablePoint(brush_t *b, idVec3 v, int type)
face_t * Brush_Ray(idVec3 origin, idVec3 dir, brush_t *b, float *dist, bool testPrimitive)
void SetKeyVec3(entity_t *ent, const char *key, idVec3 v)
void SetSpline(idCurve_Spline< idVec4 > *spline)
void ToVectors(idVec3 *forward, idVec3 *right=NULL, idVec3 *up=NULL) const
float FloatForKey(entity_t *ent, const char *key)
eclass_t * GetCachedModel(entity_t *pEntity, const char *pName, idVec3 &vMin, idVec3 &vMax)
void Brush_MakeFacePlanes(brush_t *b)
void Brush_SelectFaceForDragging(brush_t *b, face_t *f, bool shear)
void Brush_DrawFacingAngle(brush_t *b, entity_t *e, bool particle)
int sprintf(idStr &string, const char *fmt,...)
face_t * Brush_BestSplitFace(brush_t *b)
void EmitBrushPrimitTextureCoordinates(face_t *f, idWinding *w, patchMesh_t *patch)
void FaceToBrushPrimitFace(face_t *f)
idSurface_SweptSpline * SplineToSweptSpline(idCurve< idVec3 > *curve)
virtual int NumSurfaces() const =0