2 PrtView plugin for GtkRadiant
3 Copyright (C) 2001 Geoffrey Dewan, Loki software and qeradiant.com
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
31 CPortalsRender render;
33 int compare( const void *arg1, const void *arg2 )
36 if(portals.portal[*((int *)arg1)].dist > portals.portal[*((int *)arg2)].dist)
38 else if(portals.portal[*((int *)arg1)].dist < portals.portal[*((int *)arg2)].dist)
45 CBspPortal::CBspPortal()
47 memset(this, 0, sizeof(CBspPortal));
50 CBspPortal::~CBspPortal()
56 bool CBspPortal::Build(char *def)
63 if(portals.hint_flags)
65 res_cnt = sscanf(def, "%u %d %d %d", &point_count, &dummy1, &dummy2, (int *)&hint);
69 sscanf(def, "%u", &point_count);
73 if(point_count < 3 || (portals.hint_flags && res_cnt < 4))
76 point = new CBspPoint[point_count];
77 inner_point = new CBspPoint[point_count];
79 for(n = 0; n < point_count; n++)
81 for(; *c != 0 && *c != '('; c++);
88 sscanf(c, "%f %f %f", point[n].p, point[n].p+1, point[n].p+2);
90 center.p[0] += point[n].p[0];
91 center.p[1] += point[n].p[1];
92 center.p[2] += point[n].p[2];
96 for(i = 0; i < 3; i++)
98 min[i] = point[n].p[i];
99 max[i] = point[n].p[i];
104 for(i = 0; i < 3; i++)
106 if(min[i] > point[n].p[i])
107 min[i] = point[n].p[i];
108 if(max[i] < point[n].p[i])
109 max[i] = point[n].p[i];
114 center.p[0] /= (float)point_count;
115 center.p[1] /= (float)point_count;
116 center.p[2] /= (float)point_count;
118 for(n = 0; n < point_count; n++)
120 inner_point[n].p[0] = (0.01f * center.p[0]) + (0.99f * point[n].p[0]);
121 inner_point[n].p[1] = (0.01f * center.p[1]) + (0.99f * point[n].p[1]);
122 inner_point[n].p[2] = (0.01f * center.p[2]) + (0.99f * point[n].p[2]);
125 fp_color_random[0] = (float)(rand() & 0xff) / 255.0f;
126 fp_color_random[1] = (float)(rand() & 0xff) / 255.0f;
127 fp_color_random[2] = (float)(rand() & 0xff) / 255.0f;
128 fp_color_random[3] = 1.0f;
135 memset(this, 0, sizeof(CPortals));
138 CPortals::~CPortals()
143 void CPortals::Purge()
146 delete[] portal_sort;
158 void CPortals::Load()
160 char buf[LINE_BUF+1];
162 memset(buf, 0, LINE_BUF + 1);
166 Sys_Printf(MSG_PREFIX "Loading portal file %s.\n", fn);
170 in = fopen(fn, "rt");
174 Sys_Printf(" ERROR - could not open file.\n");
179 if(!fgets(buf, LINE_BUF, in))
183 Sys_Printf(" ERROR - File ended prematurely.\n");
188 if(strncmp("PRT1", buf, 4) != 0)
192 Sys_Printf(" ERROR - File header indicates wrong file type (should be \"PRT1\").\n");
197 if(!fgets(buf, LINE_BUF, in))
201 Sys_Printf(" ERROR - File ended prematurely.\n");
206 sscanf(buf, "%u", &node_count);
208 if(node_count > 0xFFFF)
214 Sys_Printf(" ERROR - Extreme number of nodes, aborting.\n");
220 if(!fgets(buf, LINE_BUF, in))
226 Sys_Printf(" ERROR - File ended prematurely.\n");
231 sscanf(buf, "%u", &portal_count);
233 if(portal_count > 0xFFFF)
240 Sys_Printf(" ERROR - Extreme number of portals, aborting.\n");
252 Sys_Printf(" ERROR - number of portals equals 0, aborting.\n");
257 // node = new CBspNode[node_count];
258 portal = new CBspPortal[portal_count];
259 portal_sort = new int[portal_count];
263 unsigned test_vals_1, test_vals_2;
267 for(n = 0; n < portal_count; )
269 if(!fgets(buf, LINE_BUF, in))
275 Sys_Printf(" ERROR - Could not find information for portal number %d of %d.\n", n + 1, portal_count);
280 if(!portal[n].Build(buf))
282 if(first && sscanf(buf, "%d %d", &test_vals_1, &test_vals_2) == 1) // skip additional counts of later data, not needed
284 // We can count on hint flags being in the file
295 Sys_Printf(" ERROR - Information for portal number %d of %d is not formatted correctly.\n", n + 1, portal_count);
305 Sys_Printf(" %u portals read in.\n", node_count, portal_count);
308 void CPortals::FixColors()
310 fp_color_2d[0] = (float)GetRValue(color_2d) / 255.0f;
311 fp_color_2d[1] = (float)GetGValue(color_2d) / 255.0f;
312 fp_color_2d[2] = (float)GetBValue(color_2d) / 255.0f;
313 fp_color_2d[3] = 1.0f;
315 fp_color_3d[0] = (float)GetRValue(color_3d) / 255.0f;
316 fp_color_3d[1] = (float)GetGValue(color_3d) / 255.0f;
317 fp_color_3d[2] = (float)GetBValue(color_3d) / 255.0f;
318 fp_color_3d[3] = 1.0f;
320 fp_color_fog[0] = 0.0f;//(float)GetRValue(color_fog) / 255.0f;
321 fp_color_fog[1] = 0.0f;//(float)GetGValue(color_fog) / 255.0f;
322 fp_color_fog[2] = 0.0f;//(float)GetBValue(color_fog) / 255.0f;
323 fp_color_fog[3] = 1.0f;
326 CPortalsRender::CPortalsRender()
331 CPortalsRender::~CPortalsRender()
335 void CPortalsRender::Register()
337 g_QglTable.m_pfnHookGL2DWindow( this );
338 g_QglTable.m_pfnHookGL3DWindow( this );
341 void CPortalsRender::Draw2D( VIEWTYPE vt )
343 if(!portals.show_2d || portals.portal_count < 1)
346 g_QglTable.m_pfn_qglPushAttrib(GL_ALL_ATTRIB_BITS);
350 g_QglTable.m_pfn_qglEnable(GL_BLEND);
351 g_QglTable.m_pfn_qglEnable(GL_LINE_SMOOTH);
355 g_QglTable.m_pfn_qglDisable(GL_BLEND);
356 g_QglTable.m_pfn_qglEnable(GL_LINE_SMOOTH);
364 g_QglTable.m_pfn_qglRotatef(270.0f, 1.0f, 0.0f, 0.0f);
367 g_QglTable.m_pfn_qglRotatef(270.0f, 1.0f, 0.0f, 0.0f);
368 g_QglTable.m_pfn_qglRotatef(270.0f, 0.0f, 0.0f, 1.0f);
372 g_QglTable.m_pfn_qglLineWidth(portals.width_2d * 0.5f);
374 g_QglTable.m_pfn_qglColor4fv(portals.fp_color_2d);
378 for(n = 0; n < portals.portal_count; n++)
380 g_QglTable.m_pfn_qglBegin(GL_LINE_LOOP);
382 for(p = 0; p < portals.portal[n].point_count; p++)
383 g_QglTable.m_pfn_qglVertex3fv(portals.portal[n].point[p].p);
385 g_QglTable.m_pfn_qglEnd();
388 g_QglTable.m_pfn_qglPopAttrib();
392 * Transform a point (column vector) by a 4x4 matrix. I.e. out = m * in
393 * Input: m - the 4x4 matrix
394 * in - the 4x1 vector
395 * Output: out - the resulting 4x1 vector.
397 static void transform_point( GLdouble out[4], const GLdouble m[16],
398 const GLdouble in[4] )
400 #define M(row,col) m[col*4+row]
401 out[0] = M(0,0) * in[0] + M(0,1) * in[1] + M(0,2) * in[2] + M(0,3) * in[3];
402 out[1] = M(1,0) * in[0] + M(1,1) * in[1] + M(1,2) * in[2] + M(1,3) * in[3];
403 out[2] = M(2,0) * in[0] + M(2,1) * in[1] + M(2,2) * in[2] + M(2,3) * in[3];
404 out[3] = M(3,0) * in[0] + M(3,1) * in[1] + M(3,2) * in[2] + M(3,3) * in[3];
412 * Perform a 4x4 matrix multiplication (product = a x b).
413 * Input: a, b - matrices to multiply
414 * Output: product - product of a and b
416 static void matmul( GLdouble *product, const GLdouble *a, const GLdouble *b )
418 /* This matmul was contributed by Thomas Malik */
422 #define A(row,col) a[(col<<2)+row]
423 #define B(row,col) b[(col<<2)+row]
424 #define T(row,col) temp[(col<<2)+row]
427 for (i = 0; i < 4; i++)
429 T(i, 0) = A(i, 0) * B(0, 0) + A(i, 1) * B(1, 0) + A(i, 2) * B(2, 0) + A(i, 3) * B(3, 0);
430 T(i, 1) = A(i, 0) * B(0, 1) + A(i, 1) * B(1, 1) + A(i, 2) * B(2, 1) + A(i, 3) * B(3, 1);
431 T(i, 2) = A(i, 0) * B(0, 2) + A(i, 1) * B(1, 2) + A(i, 2) * B(2, 2) + A(i, 3) * B(3, 2);
432 T(i, 3) = A(i, 0) * B(0, 3) + A(i, 1) * B(1, 3) + A(i, 2) * B(2, 3) + A(i, 3) * B(3, 3);
438 memcpy ( product, temp, 16*sizeof(GLdouble) );
444 * Compute inverse of 4x4 transformation matrix.
445 * Code contributed by Jacques Leroy jle@star.be
446 * Return GL_TRUE for success, GL_FALSE for failure (singular matrix)
448 static GLboolean invert_matrix( const GLdouble *m, GLdouble *out )
450 /* NB. OpenGL Matrices are COLUMN major. */
451 #define SWAP_ROWS(a, b) { GLdouble *_tmp = a; (a)=(b); (b)=_tmp; }
452 #define MAT(m,r,c) (m)[(c)*4+(r)]
455 GLdouble m0, m1, m2, m3, s;
456 GLdouble *r0, *r1, *r2, *r3;
458 r0 = wtmp[0], r1 = wtmp[1], r2 = wtmp[2], r3 = wtmp[3];
460 r0[0] = MAT(m,0,0), r0[1] = MAT(m,0,1),
461 r0[2] = MAT(m,0,2), r0[3] = MAT(m,0,3),
462 r0[4] = 1.0, r0[5] = r0[6] = r0[7] = 0.0,
464 r1[0] = MAT(m,1,0), r1[1] = MAT(m,1,1),
465 r1[2] = MAT(m,1,2), r1[3] = MAT(m,1,3),
466 r1[5] = 1.0, r1[4] = r1[6] = r1[7] = 0.0,
468 r2[0] = MAT(m,2,0), r2[1] = MAT(m,2,1),
469 r2[2] = MAT(m,2,2), r2[3] = MAT(m,2,3),
470 r2[6] = 1.0, r2[4] = r2[5] = r2[7] = 0.0,
472 r3[0] = MAT(m,3,0), r3[1] = MAT(m,3,1),
473 r3[2] = MAT(m,3,2), r3[3] = MAT(m,3,3),
474 r3[7] = 1.0, r3[4] = r3[5] = r3[6] = 0.0;
476 /* choose pivot - or die */
477 if (fabs(r3[0])>fabs(r2[0])) SWAP_ROWS(r3, r2);
478 if (fabs(r2[0])>fabs(r1[0])) SWAP_ROWS(r2, r1);
479 if (fabs(r1[0])>fabs(r0[0])) SWAP_ROWS(r1, r0);
480 if (0.0 == r0[0]) return GL_FALSE;
482 /* eliminate first variable */
483 m1 = r1[0]/r0[0]; m2 = r2[0]/r0[0]; m3 = r3[0]/r0[0];
484 s = r0[1]; r1[1] -= m1 * s; r2[1] -= m2 * s; r3[1] -= m3 * s;
485 s = r0[2]; r1[2] -= m1 * s; r2[2] -= m2 * s; r3[2] -= m3 * s;
486 s = r0[3]; r1[3] -= m1 * s; r2[3] -= m2 * s; r3[3] -= m3 * s;
488 if (s != 0.0) { r1[4] -= m1 * s; r2[4] -= m2 * s; r3[4] -= m3 * s; }
490 if (s != 0.0) { r1[5] -= m1 * s; r2[5] -= m2 * s; r3[5] -= m3 * s; }
492 if (s != 0.0) { r1[6] -= m1 * s; r2[6] -= m2 * s; r3[6] -= m3 * s; }
494 if (s != 0.0) { r1[7] -= m1 * s; r2[7] -= m2 * s; r3[7] -= m3 * s; }
496 /* choose pivot - or die */
497 if (fabs(r3[1])>fabs(r2[1])) SWAP_ROWS(r3, r2);
498 if (fabs(r2[1])>fabs(r1[1])) SWAP_ROWS(r2, r1);
499 if (0.0 == r1[1]) return GL_FALSE;
501 /* eliminate second variable */
502 m2 = r2[1]/r1[1]; m3 = r3[1]/r1[1];
503 r2[2] -= m2 * r1[2]; r3[2] -= m3 * r1[2];
504 r2[3] -= m2 * r1[3]; r3[3] -= m3 * r1[3];
505 s = r1[4]; if (0.0 != s) { r2[4] -= m2 * s; r3[4] -= m3 * s; }
506 s = r1[5]; if (0.0 != s) { r2[5] -= m2 * s; r3[5] -= m3 * s; }
507 s = r1[6]; if (0.0 != s) { r2[6] -= m2 * s; r3[6] -= m3 * s; }
508 s = r1[7]; if (0.0 != s) { r2[7] -= m2 * s; r3[7] -= m3 * s; }
510 /* choose pivot - or die */
511 if (fabs(r3[2])>fabs(r2[2])) SWAP_ROWS(r3, r2);
512 if (0.0 == r2[2]) return GL_FALSE;
514 /* eliminate third variable */
516 r3[3] -= m3 * r2[3], r3[4] -= m3 * r2[4],
517 r3[5] -= m3 * r2[5], r3[6] -= m3 * r2[6],
521 if (0.0 == r3[3]) return GL_FALSE;
523 s = 1.0/r3[3]; /* now back substitute row 3 */
524 r3[4] *= s; r3[5] *= s; r3[6] *= s; r3[7] *= s;
526 m2 = r2[3]; /* now back substitute row 2 */
528 r2[4] = s * (r2[4] - r3[4] * m2), r2[5] = s * (r2[5] - r3[5] * m2),
529 r2[6] = s * (r2[6] - r3[6] * m2), r2[7] = s * (r2[7] - r3[7] * m2);
531 r1[4] -= r3[4] * m1, r1[5] -= r3[5] * m1,
532 r1[6] -= r3[6] * m1, r1[7] -= r3[7] * m1;
534 r0[4] -= r3[4] * m0, r0[5] -= r3[5] * m0,
535 r0[6] -= r3[6] * m0, r0[7] -= r3[7] * m0;
537 m1 = r1[2]; /* now back substitute row 1 */
539 r1[4] = s * (r1[4] - r2[4] * m1), r1[5] = s * (r1[5] - r2[5] * m1),
540 r1[6] = s * (r1[6] - r2[6] * m1), r1[7] = s * (r1[7] - r2[7] * m1);
542 r0[4] -= r2[4] * m0, r0[5] -= r2[5] * m0,
543 r0[6] -= r2[6] * m0, r0[7] -= r2[7] * m0;
545 m0 = r0[1]; /* now back substitute row 0 */
547 r0[4] = s * (r0[4] - r1[4] * m0), r0[5] = s * (r0[5] - r1[5] * m0),
548 r0[6] = s * (r0[6] - r1[6] * m0), r0[7] = s * (r0[7] - r1[7] * m0);
550 MAT(out,0,0) = r0[4]; MAT(out,0,1) = r0[5],
551 MAT(out,0,2) = r0[6]; MAT(out,0,3) = r0[7],
552 MAT(out,1,0) = r1[4]; MAT(out,1,1) = r1[5],
553 MAT(out,1,2) = r1[6]; MAT(out,1,3) = r1[7],
554 MAT(out,2,0) = r2[4]; MAT(out,2,1) = r2[5],
555 MAT(out,2,2) = r2[6]; MAT(out,2,3) = r2[7],
556 MAT(out,3,0) = r3[4]; MAT(out,3,1) = r3[5],
557 MAT(out,3,2) = r3[6]; MAT(out,3,3) = r3[7];
565 GLint UnProject(GLdouble winx,GLdouble winy,GLdouble winz,
566 const GLdouble model[16],const GLdouble proj[16],
567 const GLint viewport[4],
568 GLdouble *objx,GLdouble *objy,GLdouble *objz)
570 /* matrice de transformation */
571 GLdouble m[16], A[16];
572 GLdouble in[4],out[4];
574 /* transformation coordonnees normalisees entre -1 et 1 */
575 in[0]=(winx-viewport[0])*2/viewport[2] - 1.0;
576 in[1]=(winy-viewport[1])*2/viewport[3] - 1.0;
580 /* calcul transformation inverse */
581 matmul(A,proj,model);
584 /* d'ou les coordonnees objets */
585 transform_point(out,m,in);
594 void CPortalsRender::Draw3D()
596 if(!portals.show_3d || portals.portal_count < 1)
599 g_QglTable.m_pfn_qglPushAttrib(GL_ALL_ATTRIB_BITS);
606 float trans = (100.0f - portals.trans_3d) / 100.0f;
609 g_QglTable.m_pfn_qglGetDoublev(GL_PROJECTION_MATRIX, proj_m);
610 g_QglTable.m_pfn_qglGetDoublev(GL_MODELVIEW_MATRIX, model_m);
611 g_QglTable.m_pfn_qglGetIntegerv(GL_VIEWPORT, view);
613 UnProject(0.5 * (double)view[2], 0.5 * (double)view[3], 0.0, model_m, proj_m, view, cam, cam+1, cam+2);
615 min_check[0] = (float)cam[0] + (portals.clip_range * 64.0f);
616 min_check[1] = (float)cam[1] + (portals.clip_range * 64.0f);
617 min_check[2] = (float)cam[2] + (portals.clip_range * 64.0f);
618 max_check[0] = (float)cam[0] - (portals.clip_range * 64.0f);
619 max_check[1] = (float)cam[1] - (portals.clip_range * 64.0f);
620 max_check[2] = (float)cam[2] - (portals.clip_range * 64.0f);
622 g_QglTable.m_pfn_qglHint(GL_FOG_HINT, GL_NICEST);
624 g_QglTable.m_pfn_qglDisable(GL_CULL_FACE);
626 g_QglTable.m_pfn_qglDisable(GL_LINE_SMOOTH);
627 g_QglTable.m_pfn_qglDisable(GL_POLYGON_SMOOTH);
629 g_QglTable.m_pfn_qglPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
631 g_QglTable.m_pfn_qglShadeModel(GL_SMOOTH);
633 g_QglTable.m_pfn_qglEnable(GL_BLEND);
634 g_QglTable.m_pfn_qglBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
635 g_QglTable.m_pfn_qglEnable(GL_POLYGON_SMOOTH);
638 g_QglTable.m_pfn_qglEnable(GL_LINE_SMOOTH);
640 g_QglTable.m_pfn_qglDisable(GL_LINE_SMOOTH);
644 g_QglTable.m_pfn_qglEnable(GL_FOG);
646 g_QglTable.m_pfn_qglFogi(GL_FOG_MODE, GL_EXP);
647 g_QglTable.m_pfn_qglFogf(GL_FOG_DENSITY, 0.001f);
648 g_QglTable.m_pfn_qglFogf(GL_FOG_START, 10.0f);
649 g_QglTable.m_pfn_qglFogf(GL_FOG_END, 10000.0f);
650 g_QglTable.m_pfn_qglFogi(GL_FOG_INDEX, 0);
651 g_QglTable.m_pfn_qglFogfv(GL_FOG_COLOR, portals.fp_color_fog);
655 g_QglTable.m_pfn_qglDisable(GL_FOG);
658 switch(portals.zbuffer)
661 g_QglTable.m_pfn_qglEnable(GL_DEPTH_TEST);
662 g_QglTable.m_pfn_qglDepthMask(GL_FALSE);
665 g_QglTable.m_pfn_qglDisable(GL_DEPTH_TEST);
668 g_QglTable.m_pfn_qglEnable(GL_DEPTH_TEST);
669 g_QglTable.m_pfn_qglDepthMask(GL_TRUE);
672 g_QglTable.m_pfn_qglLineWidth(portals.width_3d * 0.5f);
678 if(portals.zbuffer != 0)
682 for(n = 0; n < portals.portal_count; n++)
684 d = (float)cam[0] - portals.portal[n].center.p[0];
685 portals.portal[n].dist = d * d;
687 d = (float)cam[1] - portals.portal[n].center.p[1];
688 portals.portal[n].dist += d * d;
690 d = (float)cam[2] - portals.portal[n].center.p[2];
691 portals.portal[n].dist += d * d;
693 portals.portal_sort[n] = n;
696 qsort(portals.portal_sort, portals.portal_count, 4, compare);
698 for(n = 0; n < portals.portal_count; n++)
700 if(portals.polygons == 2 && !portals.portal[portals.portal_sort[n]].hint)
705 if(min_check[0] < portals.portal[portals.portal_sort[n]].min[0])
707 else if(min_check[1] < portals.portal[portals.portal_sort[n]].min[1])
709 else if(min_check[2] < portals.portal[portals.portal_sort[n]].min[2])
711 else if(max_check[0] > portals.portal[portals.portal_sort[n]].max[0])
713 else if(max_check[1] > portals.portal[portals.portal_sort[n]].max[1])
715 else if(max_check[2] > portals.portal[portals.portal_sort[n]].max[2])
719 g_QglTable.m_pfn_qglColor4f(portals.portal[portals.portal_sort[n]].fp_color_random[0], portals.portal[portals.portal_sort[n]].fp_color_random[1],
720 portals.portal[portals.portal_sort[n]].fp_color_random[2], trans);
722 g_QglTable.m_pfn_qglBegin(GL_POLYGON);
724 for(p = 0; p < portals.portal[portals.portal_sort[n]].point_count; p++)
725 g_QglTable.m_pfn_qglVertex3fv(portals.portal[portals.portal_sort[n]].point[p].p);
727 g_QglTable.m_pfn_qglEnd();
732 for(n = 0; n < portals.portal_count; n++)
734 if(portals.polygons == 2 && !portals.portal[n].hint)
739 if(min_check[0] < portals.portal[n].min[0])
741 else if(min_check[1] < portals.portal[n].min[1])
743 else if(min_check[2] < portals.portal[n].min[2])
745 else if(max_check[0] > portals.portal[n].max[0])
747 else if(max_check[1] > portals.portal[n].max[1])
749 else if(max_check[2] > portals.portal[n].max[2])
753 g_QglTable.m_pfn_qglColor4f(portals.portal[n].fp_color_random[0], portals.portal[n].fp_color_random[1],
754 portals.portal[n].fp_color_random[2], trans);
756 g_QglTable.m_pfn_qglBegin(GL_POLYGON);
758 for(p = 0; p < portals.portal[n].point_count; p++)
759 g_QglTable.m_pfn_qglVertex3fv(portals.portal[n].point[p].p);
761 g_QglTable.m_pfn_qglEnd();
768 g_QglTable.m_pfn_qglColor4fv(portals.fp_color_3d);
770 for(n = 0; n < portals.portal_count; n++)
772 if(portals.lines == 2 && !portals.portal[n].hint)
777 if(min_check[0] < portals.portal[n].min[0])
779 else if(min_check[1] < portals.portal[n].min[1])
781 else if(min_check[2] < portals.portal[n].min[2])
783 else if(max_check[0] > portals.portal[n].max[0])
785 else if(max_check[1] > portals.portal[n].max[1])
787 else if(max_check[2] > portals.portal[n].max[2])
791 g_QglTable.m_pfn_qglBegin(GL_LINE_LOOP);
793 for(p = 0; p < portals.portal[n].point_count; p++)
794 g_QglTable.m_pfn_qglVertex3fv(portals.portal[n].inner_point[p].p);
796 g_QglTable.m_pfn_qglEnd();
800 g_QglTable.m_pfn_qglPopAttrib();