vkQuake2 doxygen  1.0 dev
gl_rsurf.c File Reference
#include <assert.h>
#include "gl_local.h"
#include <ctype.h>

Go to the source code of this file.

Classes

struct  gllightmapstate_t
 

Macros

#define DYNAMIC_LIGHT_WIDTH   128
 
#define DYNAMIC_LIGHT_HEIGHT   128
 
#define LIGHTMAP_BYTES   4
 
#define BLOCK_WIDTH   128
 
#define BLOCK_HEIGHT   128
 
#define MAX_LIGHTMAPS   128
 
#define GL_LIGHTMAP_FORMAT   GL_RGBA
 

Functions

static void LM_InitBlock (void)
 
static void LM_UploadBlock (qboolean dynamic)
 
static qboolean LM_AllocBlock (int w, int h, int *x, int *y)
 
void R_SetCacheState (msurface_t *surf)
 
void R_BuildLightMap (msurface_t *surf, byte *dest, int stride)
 
image_tR_TextureAnimation (mtexinfo_t *tex)
 
void DrawGLPoly (glpoly_t *p)
 
void DrawGLFlowingPoly (msurface_t *fa)
 
void R_DrawTriangleOutlines (void)
 
void DrawGLPolyChain (glpoly_t *p, float soffset, float toffset)
 
void R_BlendLightmaps (void)
 
void R_RenderBrushPoly (msurface_t *fa)
 
void R_DrawAlphaSurfaces (void)
 
void DrawTextureChains (void)
 
static void GL_RenderLightmappedPoly (msurface_t *surf)
 
void R_DrawInlineBModel (void)
 
void R_DrawBrushModel (entity_t *e)
 
void R_RecursiveWorldNode (mnode_t *node)
 
void R_DrawWorld (void)
 
void R_MarkLeaves (void)
 
void GL_BuildPolygonFromSurface (msurface_t *fa)
 
void GL_CreateSurfaceLightmap (msurface_t *surf)
 
void GL_BeginBuildingLightmaps (model_t *m)
 
void GL_EndBuildingLightmaps (void)
 

Variables

static vec3_t modelorg
 
msurface_tr_alpha_surfaces
 
int c_visible_lightmaps
 
int c_visible_textures
 
static gllightmapstate_t gl_lms
 

Macro Definition Documentation

◆ BLOCK_HEIGHT

#define BLOCK_HEIGHT   128

Definition at line 36 of file gl_rsurf.c.

◆ BLOCK_WIDTH

#define BLOCK_WIDTH   128

Definition at line 35 of file gl_rsurf.c.

◆ DYNAMIC_LIGHT_HEIGHT

#define DYNAMIC_LIGHT_HEIGHT   128

Definition at line 31 of file gl_rsurf.c.

◆ DYNAMIC_LIGHT_WIDTH

#define DYNAMIC_LIGHT_WIDTH   128

Definition at line 30 of file gl_rsurf.c.

◆ GL_LIGHTMAP_FORMAT

#define GL_LIGHTMAP_FORMAT   GL_RGBA

Definition at line 43 of file gl_rsurf.c.

◆ LIGHTMAP_BYTES

#define LIGHTMAP_BYTES   4

Definition at line 33 of file gl_rsurf.c.

◆ MAX_LIGHTMAPS

#define MAX_LIGHTMAPS   128

Definition at line 38 of file gl_rsurf.c.

Function Documentation

◆ DrawGLFlowingPoly()

void DrawGLFlowingPoly ( msurface_t fa)

Definition at line 203 of file gl_rsurf.c.

204 {
205  int i;
206  float *v;
207  glpoly_t *p;
208  float scroll;
209 
210  p = fa->polys;
211 
212  scroll = -64 * ( (r_newrefdef.time / 40.0) - (int)(r_newrefdef.time / 40.0) );
213  if(scroll == 0.0)
214  scroll = -64.0;
215 
216  qglBegin (GL_POLYGON);
217  v = p->verts[0];
218  for (i=0 ; i<p->numverts ; i++, v+= VERTEXSIZE)
219  {
220  qglTexCoord2f ((v[3] + scroll), v[4]);
221  qglVertex3fv (v);
222  }
223  qglEnd ();
224 }

Referenced by R_DrawAlphaSurfaces(), and R_RenderBrushPoly().

◆ DrawGLPoly()

void DrawGLPoly ( glpoly_t p)

Definition at line 181 of file gl_rsurf.c.

182 {
183  int i;
184  float *v;
185 
186  qglBegin (GL_POLYGON);
187  v = p->verts[0];
188  for (i=0 ; i<p->numverts ; i++, v+= VERTEXSIZE)
189  {
190  qglTexCoord2f (v[3], v[4]);
191  qglVertex3fv (v);
192  }
193  qglEnd ();
194 }

Referenced by R_DrawAlphaSurfaces(), and R_RenderBrushPoly().

◆ DrawGLPolyChain()

void DrawGLPolyChain ( glpoly_t p,
float  soffset,
float  toffset 
)

Definition at line 272 of file gl_rsurf.c.

273 {
274  if ( soffset == 0 && toffset == 0 )
275  {
276  for ( ; p != 0; p = p->chain )
277  {
278  float *v;
279  int j;
280 
281  qglBegin (GL_POLYGON);
282  v = p->verts[0];
283  for (j=0 ; j<p->numverts ; j++, v+= VERTEXSIZE)
284  {
285  qglTexCoord2f (v[5], v[6] );
286  qglVertex3fv (v);
287  }
288  qglEnd ();
289  }
290  }
291  else
292  {
293  for ( ; p != 0; p = p->chain )
294  {
295  float *v;
296  int j;
297 
298  qglBegin (GL_POLYGON);
299  v = p->verts[0];
300  for (j=0 ; j<p->numverts ; j++, v+= VERTEXSIZE)
301  {
302  qglTexCoord2f (v[5] - soffset, v[6] - toffset );
303  qglVertex3fv (v);
304  }
305  qglEnd ();
306  }
307  }
308 }

Referenced by R_BlendLightmaps().

◆ DrawTextureChains()

void DrawTextureChains ( void  )

Definition at line 635 of file gl_rsurf.c.

636 {
637  int i;
638  msurface_t *s;
639  image_t *image;
640 
641  c_visible_textures = 0;
642 
643 // GL_TexEnv( GL_REPLACE );
644 
645  if ( !qglSelectTextureSGIS && !qglActiveTextureARB )
646  {
647  for ( i = 0, image=gltextures ; i<numgltextures ; i++,image++)
648  {
649  if (!image->registration_sequence)
650  continue;
651  s = image->texturechain;
652  if (!s)
653  continue;
655 
656  for ( ; s ; s=s->texturechain)
658 
659  image->texturechain = NULL;
660  }
661  }
662  else
663  {
664  for ( i = 0, image=gltextures ; i<numgltextures ; i++,image++)
665  {
666  if (!image->registration_sequence)
667  continue;
668  if (!image->texturechain)
669  continue;
671 
672  for ( s = image->texturechain; s ; s=s->texturechain)
673  {
674  if ( !( s->flags & SURF_DRAWTURB ) )
676  }
677  }
678 
679  GL_EnableMultitexture( false );
680  for ( i = 0, image=gltextures ; i<numgltextures ; i++,image++)
681  {
682  if (!image->registration_sequence)
683  continue;
684  s = image->texturechain;
685  if (!s)
686  continue;
687 
688  for ( ; s ; s=s->texturechain)
689  {
690  if ( s->flags & SURF_DRAWTURB )
692  }
693 
694  image->texturechain = NULL;
695  }
696 // GL_EnableMultitexture( true );
697  }
698 
699  GL_TexEnv( GL_REPLACE );
700 }

Referenced by R_DrawWorld().

◆ GL_BeginBuildingLightmaps()

void GL_BeginBuildingLightmaps ( model_t m)

Definition at line 1565 of file gl_rsurf.c.

1566 {
1567  static lightstyle_t lightstyles[MAX_LIGHTSTYLES];
1568  int i;
1569  unsigned dummy[128*128];
1570 
1571  memset( gl_lms.allocated, 0, sizeof(gl_lms.allocated) );
1572 
1573  r_framecount = 1; // no dlightcache
1574 
1575  GL_EnableMultitexture( true );
1577 
1578  /*
1579  ** setup the base lightstyles so the lightmaps won't have to be regenerated
1580  ** the first time they're seen
1581  */
1582  for (i=0 ; i<MAX_LIGHTSTYLES ; i++)
1583  {
1584  lightstyles[i].rgb[0] = 1;
1585  lightstyles[i].rgb[1] = 1;
1586  lightstyles[i].rgb[2] = 1;
1587  lightstyles[i].white = 3;
1588  }
1589  r_newrefdef.lightstyles = lightstyles;
1590 
1592  {
1594 // gl_state.lightmap_textures = gl_state.texture_extension_number;
1595 // gl_state.texture_extension_number = gl_state.lightmap_textures + MAX_LIGHTMAPS;
1596  }
1597 
1599 
1600  /*
1601  ** if mono lightmaps are enabled and we want to use alpha
1602  ** blending (a,1-a) then we're likely running on a 3DLabs
1603  ** Permedia2. In a perfect world we'd use a GL_ALPHA lightmap
1604  ** in order to conserve space and maximize bandwidth, however
1605  ** this isn't a perfect world.
1606  **
1607  ** So we have to use alpha lightmaps, but stored in GL_RGBA format,
1608  ** which means we only get 1/16th the color resolution we should when
1609  ** using alpha lightmaps. If we find another board that supports
1610  ** only alpha lightmaps but that can at least support the GL_ALPHA
1611  ** format then we should change this code to use real alpha maps.
1612  */
1613  if ( toupper( gl_monolightmap->string[0] ) == 'A' )
1614  {
1616  }
1617  /*
1618  ** try to do hacked colored lighting with a blended texture
1619  */
1620  else if ( toupper( gl_monolightmap->string[0] ) == 'C' )
1621  {
1623  }
1624  else if ( toupper( gl_monolightmap->string[0] ) == 'I' )
1625  {
1626  gl_lms.internal_format = GL_INTENSITY8;
1627  }
1628  else if ( toupper( gl_monolightmap->string[0] ) == 'L' )
1629  {
1630  gl_lms.internal_format = GL_LUMINANCE8;
1631  }
1632  else
1633  {
1635  }
1636 
1637  /*
1638  ** initialize the dynamic lightmap texture
1639  */
1641  qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
1642  qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
1643  qglTexImage2D( GL_TEXTURE_2D,
1644  0,
1647  0,
1649  GL_UNSIGNED_BYTE,
1650  dummy );
1651 }

Referenced by Mod_LoadFaces().

◆ GL_BuildPolygonFromSurface()

void GL_BuildPolygonFromSurface ( msurface_t fa)

Definition at line 1450 of file gl_rsurf.c.

1451 {
1452  int i, lindex, lnumverts;
1453  medge_t *pedges, *r_pedge;
1454  int vertpage;
1455  float *vec;
1456  float s, t;
1457  glpoly_t *poly;
1458  vec3_t total;
1459 
1460 // reconstruct the polygon
1461  pedges = currentmodel->edges;
1462  lnumverts = fa->numedges;
1463  vertpage = 0;
1464 
1465  VectorClear (total);
1466  //
1467  // draw texture
1468  //
1469  poly = Hunk_Alloc (sizeof(glpoly_t) + (lnumverts-4) * VERTEXSIZE*sizeof(float));
1470  poly->next = fa->polys;
1471  poly->flags = fa->flags;
1472  fa->polys = poly;
1473  poly->numverts = lnumverts;
1474 
1475  for (i=0 ; i<lnumverts ; i++)
1476  {
1477  lindex = currentmodel->surfedges[fa->firstedge + i];
1478 
1479  if (lindex > 0)
1480  {
1481  r_pedge = &pedges[lindex];
1482  vec = currentmodel->vertexes[r_pedge->v[0]].position;
1483  }
1484  else
1485  {
1486  r_pedge = &pedges[-lindex];
1487  vec = currentmodel->vertexes[r_pedge->v[1]].position;
1488  }
1489  s = DotProduct (vec, fa->texinfo->vecs[0]) + fa->texinfo->vecs[0][3];
1490  s /= fa->texinfo->image->width;
1491 
1492  t = DotProduct (vec, fa->texinfo->vecs[1]) + fa->texinfo->vecs[1][3];
1493  t /= fa->texinfo->image->height;
1494 
1495  VectorAdd (total, vec, total);
1496  VectorCopy (vec, poly->verts[i]);
1497  poly->verts[i][3] = s;
1498  poly->verts[i][4] = t;
1499 
1500  //
1501  // lightmap texture coordinates
1502  //
1503  s = DotProduct (vec, fa->texinfo->vecs[0]) + fa->texinfo->vecs[0][3];
1504  s -= fa->texturemins[0];
1505  s += fa->light_s*16;
1506  s += 8;
1507  s /= BLOCK_WIDTH*16; //fa->texinfo->texture->width;
1508 
1509  t = DotProduct (vec, fa->texinfo->vecs[1]) + fa->texinfo->vecs[1][3];
1510  t -= fa->texturemins[1];
1511  t += fa->light_t*16;
1512  t += 8;
1513  t /= BLOCK_HEIGHT*16; //fa->texinfo->texture->height;
1514 
1515  poly->verts[i][5] = s;
1516  poly->verts[i][6] = t;
1517  }
1518 
1519  poly->numverts = lnumverts;
1520 
1521 }

Referenced by Mod_LoadFaces().

◆ GL_CreateSurfaceLightmap()

void GL_CreateSurfaceLightmap ( msurface_t surf)

Definition at line 1528 of file gl_rsurf.c.

1529 {
1530  int smax, tmax;
1531  byte *base;
1532 
1533  if (surf->flags & (SURF_DRAWSKY|SURF_DRAWTURB))
1534  return;
1535 
1536  smax = (surf->extents[0]>>4)+1;
1537  tmax = (surf->extents[1]>>4)+1;
1538 
1539  if ( !LM_AllocBlock( smax, tmax, &surf->light_s, &surf->light_t ) )
1540  {
1541  LM_UploadBlock( false );
1542  LM_InitBlock();
1543  if ( !LM_AllocBlock( smax, tmax, &surf->light_s, &surf->light_t ) )
1544  {
1545  ri.Sys_Error( ERR_FATAL, "Consecutive calls to LM_AllocBlock(%d,%d) failed\n", smax, tmax );
1546  }
1547  }
1548 
1550 
1551  base = gl_lms.lightmap_buffer;
1552  base += (surf->light_t * BLOCK_WIDTH + surf->light_s) * LIGHTMAP_BYTES;
1553 
1554  R_SetCacheState( surf );
1556 }

Referenced by Mod_LoadFaces().

◆ GL_EndBuildingLightmaps()

void GL_EndBuildingLightmaps ( void  )

Definition at line 1658 of file gl_rsurf.c.

1659 {
1660  LM_UploadBlock( false );
1661  GL_EnableMultitexture( false );
1662 }

Referenced by Mod_LoadFaces().

◆ GL_RenderLightmappedPoly()

static void GL_RenderLightmappedPoly ( msurface_t surf)
static

Definition at line 703 of file gl_rsurf.c.

704 {
705  int i, nv = surf->polys->numverts;
706  int map;
707  float *v;
708  image_t *image = R_TextureAnimation( surf->texinfo );
709  qboolean is_dynamic = false;
710  unsigned lmtex = surf->lightmaptexturenum;
711  glpoly_t *p;
712 
713  for ( map = 0; map < MAXLIGHTMAPS && surf->styles[map] != 255; map++ )
714  {
715  if ( r_newrefdef.lightstyles[surf->styles[map]].white != surf->cached_light[map] )
716  goto dynamic;
717  }
718 
719  // dynamic this frame or dynamic previously
720  if ( ( surf->dlightframe == r_framecount ) )
721  {
722 dynamic:
723  if ( gl_dynamic->value )
724  {
726  {
727  is_dynamic = true;
728  }
729  }
730  }
731 
732  if ( is_dynamic )
733  {
734  unsigned temp[128*128];
735  int smax, tmax;
736 
737  if ( ( surf->styles[map] >= 32 || surf->styles[map] == 0 ) && ( surf->dlightframe != r_framecount ) )
738  {
739  smax = (surf->extents[0]>>4)+1;
740  tmax = (surf->extents[1]>>4)+1;
741 
742  R_BuildLightMap( surf, (void *)temp, smax*4 );
743  R_SetCacheState( surf );
744 
746 
747  lmtex = surf->lightmaptexturenum;
748 
749  qglTexSubImage2D( GL_TEXTURE_2D, 0,
750  surf->light_s, surf->light_t,
751  smax, tmax,
753  GL_UNSIGNED_BYTE, temp );
754 
755  }
756  else
757  {
758  smax = (surf->extents[0]>>4)+1;
759  tmax = (surf->extents[1]>>4)+1;
760 
761  R_BuildLightMap( surf, (void *)temp, smax*4 );
762 
764 
765  lmtex = 0;
766 
767  qglTexSubImage2D( GL_TEXTURE_2D, 0,
768  surf->light_s, surf->light_t,
769  smax, tmax,
771  GL_UNSIGNED_BYTE, temp );
772 
773  }
774 
775  c_brush_polys++;
776 
777  GL_MBind( gl_texture0, image->texnum );
779 
780 //==========
781 //PGM
782  if (surf->texinfo->flags & SURF_FLOWING)
783  {
784  float scroll;
785 
786  scroll = -64 * ( (r_newrefdef.time / 40.0) - (int)(r_newrefdef.time / 40.0) );
787  if(scroll == 0.0)
788  scroll = -64.0;
789 
790  for ( p = surf->polys; p; p = p->chain )
791  {
792  v = p->verts[0];
793  qglBegin (GL_POLYGON);
794  for (i=0 ; i< nv; i++, v+= VERTEXSIZE)
795  {
796  qglMTexCoord2fSGIS( gl_texture0, (v[3]+scroll), v[4]);
797  qglMTexCoord2fSGIS( gl_texture1, v[5], v[6]);
798  qglVertex3fv (v);
799  }
800  qglEnd ();
801  }
802  }
803  else
804  {
805  for ( p = surf->polys; p; p = p->chain )
806  {
807  v = p->verts[0];
808  qglBegin (GL_POLYGON);
809  for (i=0 ; i< nv; i++, v+= VERTEXSIZE)
810  {
811  qglMTexCoord2fSGIS( gl_texture0, v[3], v[4]);
812  qglMTexCoord2fSGIS( gl_texture1, v[5], v[6]);
813  qglVertex3fv (v);
814  }
815  qglEnd ();
816  }
817  }
818 //PGM
819 //==========
820  }
821  else
822  {
823  c_brush_polys++;
824 
825  GL_MBind( gl_texture0, image->texnum );
827 
828 //==========
829 //PGM
830  if (surf->texinfo->flags & SURF_FLOWING)
831  {
832  float scroll;
833 
834  scroll = -64 * ( (r_newrefdef.time / 40.0) - (int)(r_newrefdef.time / 40.0) );
835  if(scroll == 0.0)
836  scroll = -64.0;
837 
838  for ( p = surf->polys; p; p = p->chain )
839  {
840  v = p->verts[0];
841  qglBegin (GL_POLYGON);
842  for (i=0 ; i< nv; i++, v+= VERTEXSIZE)
843  {
844  qglMTexCoord2fSGIS( gl_texture0, (v[3]+scroll), v[4]);
845  qglMTexCoord2fSGIS( gl_texture1, v[5], v[6]);
846  qglVertex3fv (v);
847  }
848  qglEnd ();
849  }
850  }
851  else
852  {
853 //PGM
854 //==========
855  for ( p = surf->polys; p; p = p->chain )
856  {
857  v = p->verts[0];
858  qglBegin (GL_POLYGON);
859  for (i=0 ; i< nv; i++, v+= VERTEXSIZE)
860  {
861  qglMTexCoord2fSGIS( gl_texture0, v[3], v[4]);
862  qglMTexCoord2fSGIS( gl_texture1, v[5], v[6]);
863  qglVertex3fv (v);
864  }
865  qglEnd ();
866  }
867 //==========
868 //PGM
869  }
870 //PGM
871 //==========
872  }
873 }

Referenced by R_DrawInlineBModel(), and R_RecursiveWorldNode().

◆ LM_AllocBlock()

static qboolean LM_AllocBlock ( int  w,
int  h,
int x,
int y 
)
static

Definition at line 1411 of file gl_rsurf.c.

1412 {
1413  int i, j;
1414  int best, best2;
1415 
1416  best = BLOCK_HEIGHT;
1417 
1418  for (i=0 ; i<BLOCK_WIDTH-w ; i++)
1419  {
1420  best2 = 0;
1421 
1422  for (j=0 ; j<w ; j++)
1423  {
1424  if (gl_lms.allocated[i+j] >= best)
1425  break;
1426  if (gl_lms.allocated[i+j] > best2)
1427  best2 = gl_lms.allocated[i+j];
1428  }
1429  if (j == w)
1430  { // this is a valid spot
1431  *x = i;
1432  *y = best = best2;
1433  }
1434  }
1435 
1436  if (best + h > BLOCK_HEIGHT)
1437  return false;
1438 
1439  for (i=0 ; i<w ; i++)
1440  gl_lms.allocated[*x + i] = best + h;
1441 
1442  return true;
1443 }

Referenced by GL_CreateSurfaceLightmap(), and R_BlendLightmaps().

◆ LM_InitBlock()

static void LM_InitBlock ( void  )
static

Definition at line 1354 of file gl_rsurf.c.

1355 {
1356  memset( gl_lms.allocated, 0, sizeof( gl_lms.allocated ) );
1357 }

Referenced by GL_CreateSurfaceLightmap(), and R_BlendLightmaps().

◆ LM_UploadBlock()

static void LM_UploadBlock ( qboolean  dynamic)
static

Definition at line 1359 of file gl_rsurf.c.

1360 {
1361  int texture;
1362  int height = 0;
1363 
1364  if ( dynamic )
1365  {
1366  texture = 0;
1367  }
1368  else
1369  {
1371  }
1372 
1374  qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
1375  qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
1376 
1377  if ( dynamic )
1378  {
1379  int i;
1380 
1381  for ( i = 0; i < BLOCK_WIDTH; i++ )
1382  {
1383  if ( gl_lms.allocated[i] > height )
1384  height = gl_lms.allocated[i];
1385  }
1386 
1387  qglTexSubImage2D( GL_TEXTURE_2D,
1388  0,
1389  0, 0,
1392  GL_UNSIGNED_BYTE,
1394  }
1395  else
1396  {
1397  qglTexImage2D( GL_TEXTURE_2D,
1398  0,
1401  0,
1403  GL_UNSIGNED_BYTE,
1406  ri.Sys_Error( ERR_DROP, "LM_UploadBlock() - MAX_LIGHTMAPS exceeded\n" );
1407  }
1408 }

Referenced by GL_CreateSurfaceLightmap(), GL_EndBuildingLightmaps(), and R_BlendLightmaps().

◆ R_BlendLightmaps()

void R_BlendLightmaps ( void  )

Definition at line 316 of file gl_rsurf.c.

317 {
318  int i;
319  msurface_t *surf, *newdrawsurf = 0;
320 
321  // don't bother if we're set to fullbright
322  if (r_fullbright->value)
323  return;
324  if (!r_worldmodel->lightdata)
325  return;
326 
327  // don't bother writing Z
328  qglDepthMask( 0 );
329 
330  /*
331  ** set the appropriate blending mode unless we're only looking at the
332  ** lightmaps.
333  */
334  if (!gl_lightmap->value)
335  {
336  qglEnable (GL_BLEND);
337 
338  if ( gl_saturatelighting->value )
339  {
340  qglBlendFunc( GL_ONE, GL_ONE );
341  }
342  else
343  {
344  if ( gl_monolightmap->string[0] != '0' )
345  {
346  switch ( toupper( gl_monolightmap->string[0] ) )
347  {
348  case 'I':
349  qglBlendFunc (GL_ZERO, GL_SRC_COLOR );
350  break;
351  case 'L':
352  qglBlendFunc (GL_ZERO, GL_SRC_COLOR );
353  break;
354  case 'A':
355  default:
356  qglBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
357  break;
358  }
359  }
360  else
361  {
362  qglBlendFunc (GL_ZERO, GL_SRC_COLOR );
363  }
364  }
365  }
366 
367  if ( currentmodel == r_worldmodel )
369 
370  /*
371  ** render static lightmaps first
372  */
373  for ( i = 1; i < MAX_LIGHTMAPS; i++ )
374  {
375  if ( gl_lms.lightmap_surfaces[i] )
376  {
377  if (currentmodel == r_worldmodel)
380 
381  for ( surf = gl_lms.lightmap_surfaces[i]; surf != 0; surf = surf->lightmapchain )
382  {
383  if ( surf->polys )
384  DrawGLPolyChain( surf->polys, 0, 0 );
385  }
386  }
387  }
388 
389  /*
390  ** render dynamic lightmaps
391  */
392  if ( gl_dynamic->value )
393  {
394  LM_InitBlock();
395 
397 
398  if (currentmodel == r_worldmodel)
400 
401  newdrawsurf = gl_lms.lightmap_surfaces[0];
402 
403  for ( surf = gl_lms.lightmap_surfaces[0]; surf != 0; surf = surf->lightmapchain )
404  {
405  int smax, tmax;
406  byte *base;
407 
408  smax = (surf->extents[0]>>4)+1;
409  tmax = (surf->extents[1]>>4)+1;
410 
411  if ( LM_AllocBlock( smax, tmax, &surf->dlight_s, &surf->dlight_t ) )
412  {
413  base = gl_lms.lightmap_buffer;
414  base += ( surf->dlight_t * BLOCK_WIDTH + surf->dlight_s ) * LIGHTMAP_BYTES;
415 
417  }
418  else
419  {
420  msurface_t *drawsurf;
421 
422  // upload what we have so far
423  LM_UploadBlock( true );
424 
425  // draw all surfaces that use this lightmap
426  for ( drawsurf = newdrawsurf; drawsurf != surf; drawsurf = drawsurf->lightmapchain )
427  {
428  if ( drawsurf->polys )
429  DrawGLPolyChain( drawsurf->polys,
430  ( drawsurf->light_s - drawsurf->dlight_s ) * ( 1.0 / 128.0 ),
431  ( drawsurf->light_t - drawsurf->dlight_t ) * ( 1.0 / 128.0 ) );
432  }
433 
434  newdrawsurf = drawsurf;
435 
436  // clear the block
437  LM_InitBlock();
438 
439  // try uploading the block now
440  if ( !LM_AllocBlock( smax, tmax, &surf->dlight_s, &surf->dlight_t ) )
441  {
442  ri.Sys_Error( ERR_FATAL, "Consecutive calls to LM_AllocBlock(%d,%d) failed (dynamic)\n", smax, tmax );
443  }
444 
445  base = gl_lms.lightmap_buffer;
446  base += ( surf->dlight_t * BLOCK_WIDTH + surf->dlight_s ) * LIGHTMAP_BYTES;
447 
449  }
450  }
451 
452  /*
453  ** draw remainder of dynamic lightmaps that haven't been uploaded yet
454  */
455  if ( newdrawsurf )
456  LM_UploadBlock( true );
457 
458  for ( surf = newdrawsurf; surf != 0; surf = surf->lightmapchain )
459  {
460  if ( surf->polys )
461  DrawGLPolyChain( surf->polys, ( surf->light_s - surf->dlight_s ) * ( 1.0 / 128.0 ), ( surf->light_t - surf->dlight_t ) * ( 1.0 / 128.0 ) );
462  }
463  }
464 
465  /*
466  ** restore state
467  */
468  qglDisable (GL_BLEND);
469  qglBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
470  qglDepthMask( 1 );
471 }

Referenced by R_DrawInlineBModel(), and R_DrawWorld().

◆ R_BuildLightMap()

void R_BuildLightMap ( msurface_t surf,
byte dest,
int  stride 
)

Definition at line 455 of file gl_light.c.

456 {
457  int smax, tmax;
458  int r, g, b, a, max;
459  int i, j, size;
460  byte *lightmap;
461  float scale[4];
462  int nummaps;
463  float *bl;
464  lightstyle_t *style;
465  int monolightmap;
466 
468  ri.Sys_Error (ERR_DROP, "R_BuildLightMap called for non-lit surface");
469 
470  smax = (surf->extents[0]>>4)+1;
471  tmax = (surf->extents[1]>>4)+1;
472  size = smax*tmax;
473  if (size > (sizeof(s_blocklights)>>4) )
474  ri.Sys_Error (ERR_DROP, "Bad s_blocklights size");
475 
476 // set to full bright if no light data
477  if (!surf->samples)
478  {
479  int maps;
480 
481  for (i=0 ; i<size*3 ; i++)
482  s_blocklights[i] = 255;
483  for (maps = 0 ; maps < MAXLIGHTMAPS && surf->styles[maps] != 255 ;
484  maps++)
485  {
486  style = &r_newrefdef.lightstyles[surf->styles[maps]];
487  }
488  goto store;
489  }
490 
491  // count the # of maps
492  for ( nummaps = 0 ; nummaps < MAXLIGHTMAPS && surf->styles[nummaps] != 255 ;
493  nummaps++)
494  ;
495 
496  lightmap = surf->samples;
497 
498  // add all the lightmaps
499  if ( nummaps == 1 )
500  {
501  int maps;
502 
503  for (maps = 0 ; maps < MAXLIGHTMAPS && surf->styles[maps] != 255 ;
504  maps++)
505  {
506  bl = s_blocklights;
507 
508  for (i=0 ; i<3 ; i++)
509  scale[i] = gl_modulate->value*r_newrefdef.lightstyles[surf->styles[maps]].rgb[i];
510 
511  if ( scale[0] == 1.0F &&
512  scale[1] == 1.0F &&
513  scale[2] == 1.0F )
514  {
515  for (i=0 ; i<size ; i++, bl+=3)
516  {
517  bl[0] = lightmap[i*3+0];
518  bl[1] = lightmap[i*3+1];
519  bl[2] = lightmap[i*3+2];
520  }
521  }
522  else
523  {
524  for (i=0 ; i<size ; i++, bl+=3)
525  {
526  bl[0] = lightmap[i*3+0] * scale[0];
527  bl[1] = lightmap[i*3+1] * scale[1];
528  bl[2] = lightmap[i*3+2] * scale[2];
529  }
530  }
531  lightmap += size*3; // skip to next lightmap
532  }
533  }
534  else
535  {
536  int maps;
537 
538  memset( s_blocklights, 0, sizeof( s_blocklights[0] ) * size * 3 );
539 
540  for (maps = 0 ; maps < MAXLIGHTMAPS && surf->styles[maps] != 255 ;
541  maps++)
542  {
543  bl = s_blocklights;
544 
545  for (i=0 ; i<3 ; i++)
546  scale[i] = gl_modulate->value*r_newrefdef.lightstyles[surf->styles[maps]].rgb[i];
547 
548  if ( scale[0] == 1.0F &&
549  scale[1] == 1.0F &&
550  scale[2] == 1.0F )
551  {
552  for (i=0 ; i<size ; i++, bl+=3 )
553  {
554  bl[0] += lightmap[i*3+0];
555  bl[1] += lightmap[i*3+1];
556  bl[2] += lightmap[i*3+2];
557  }
558  }
559  else
560  {
561  for (i=0 ; i<size ; i++, bl+=3)
562  {
563  bl[0] += lightmap[i*3+0] * scale[0];
564  bl[1] += lightmap[i*3+1] * scale[1];
565  bl[2] += lightmap[i*3+2] * scale[2];
566  }
567  }
568  lightmap += size*3; // skip to next lightmap
569  }
570  }
571 
572 // add all the dynamic lights
573  if (surf->dlightframe == r_framecount)
574  R_AddDynamicLights (surf);
575 
576 // put into texture format
577 store:
578  stride -= (smax<<2);
579  bl = s_blocklights;
580 
581  monolightmap = gl_monolightmap->string[0];
582 
583  if ( monolightmap == '0' )
584  {
585  for (i=0 ; i<tmax ; i++, dest += stride)
586  {
587  for (j=0 ; j<smax ; j++)
588  {
589 
590  r = Q_ftol( bl[0] );
591  g = Q_ftol( bl[1] );
592  b = Q_ftol( bl[2] );
593 
594  // catch negative lights
595  if (r < 0)
596  r = 0;
597  if (g < 0)
598  g = 0;
599  if (b < 0)
600  b = 0;
601 
602  /*
603  ** determine the brightest of the three color components
604  */
605  if (r > g)
606  max = r;
607  else
608  max = g;
609  if (b > max)
610  max = b;
611 
612  /*
613  ** alpha is ONLY used for the mono lightmap case. For this reason
614  ** we set it to the brightest of the color components so that
615  ** things don't get too dim.
616  */
617  a = max;
618 
619  /*
620  ** rescale all the color components if the intensity of the greatest
621  ** channel exceeds 1.0
622  */
623  if (max > 255)
624  {
625  float t = 255.0F / max;
626 
627  r = r*t;
628  g = g*t;
629  b = b*t;
630  a = a*t;
631  }
632 
633  dest[0] = r;
634  dest[1] = g;
635  dest[2] = b;
636  dest[3] = a;
637 
638  bl += 3;
639  dest += 4;
640  }
641  }
642  }
643  else
644  {
645  for (i=0 ; i<tmax ; i++, dest += stride)
646  {
647  for (j=0 ; j<smax ; j++)
648  {
649 
650  r = Q_ftol( bl[0] );
651  g = Q_ftol( bl[1] );
652  b = Q_ftol( bl[2] );
653 
654  // catch negative lights
655  if (r < 0)
656  r = 0;
657  if (g < 0)
658  g = 0;
659  if (b < 0)
660  b = 0;
661 
662  /*
663  ** determine the brightest of the three color components
664  */
665  if (r > g)
666  max = r;
667  else
668  max = g;
669  if (b > max)
670  max = b;
671 
672  /*
673  ** alpha is ONLY used for the mono lightmap case. For this reason
674  ** we set it to the brightest of the color components so that
675  ** things don't get too dim.
676  */
677  a = max;
678 
679  /*
680  ** rescale all the color components if the intensity of the greatest
681  ** channel exceeds 1.0
682  */
683  if (max > 255)
684  {
685  float t = 255.0F / max;
686 
687  r = r*t;
688  g = g*t;
689  b = b*t;
690  a = a*t;
691  }
692 
693  /*
694  ** So if we are doing alpha lightmaps we need to set the R, G, and B
695  ** components to 0 and we need to set alpha to 1-alpha.
696  */
697  switch ( monolightmap )
698  {
699  case 'L':
700  case 'I':
701  r = a;
702  g = b = 0;
703  break;
704  case 'C':
705  // try faking colored lighting
706  a = 255 - ((r+g+b)/3);
707  r *= a/255.0;
708  g *= a/255.0;
709  b *= a/255.0;
710  break;
711  case 'A':
712  default:
713  r = g = b = 0;
714  a = 255 - a;
715  break;
716  }
717 
718  dest[0] = r;
719  dest[1] = g;
720  dest[2] = b;
721  dest[3] = a;
722 
723  bl += 3;
724  dest += 4;
725  }
726  }
727  }
728 }

Referenced by GL_CreateSurfaceLightmap(), GL_RenderLightmappedPoly(), R_BlendLightmaps(), and R_RenderBrushPoly().

◆ R_DrawAlphaSurfaces()

void R_DrawAlphaSurfaces ( void  )

Definition at line 588 of file gl_rsurf.c.

589 {
590  msurface_t *s;
591  float intens;
592 
593  //
594  // go back to the world matrix
595  //
596  qglLoadMatrixf (r_world_matrix);
597 
598  qglEnable (GL_BLEND);
599  GL_TexEnv( GL_MODULATE );
600 
601  // the textures are prescaled up for a better lighting range,
602  // so scale it back down
603  intens = gl_state.inverse_intensity;
604 
605  for (s=r_alpha_surfaces ; s ; s=s->texturechain)
606  {
607  GL_Bind(s->texinfo->image->texnum);
608  c_brush_polys++;
609  if (s->texinfo->flags & SURF_TRANS33)
610  qglColor4f (intens,intens,intens,0.33);
611  else if (s->texinfo->flags & SURF_TRANS66)
612  qglColor4f (intens,intens,intens,0.66);
613  else
614  qglColor4f (intens,intens,intens,1);
615  if (s->flags & SURF_DRAWTURB)
616  EmitWaterPolys (s);
617  else if(s->texinfo->flags & SURF_FLOWING) // PGM 9/16/98
618  DrawGLFlowingPoly (s); // PGM
619  else
620  DrawGLPoly (s->polys);
621  }
622 
623  GL_TexEnv( GL_REPLACE );
624  qglColor4f (1,1,1,1);
625  qglDisable (GL_BLEND);
626 
628 }

◆ R_DrawBrushModel()

void R_DrawBrushModel ( entity_t e)

Definition at line 957 of file gl_rsurf.c.

958 {
959  vec3_t mins, maxs;
960  int i;
961  qboolean rotated;
962 
963  if (currentmodel->nummodelsurfaces == 0)
964  return;
965 
966  currententity = e;
968 
969  if (e->angles[0] || e->angles[1] || e->angles[2])
970  {
971  rotated = true;
972  for (i=0 ; i<3 ; i++)
973  {
974  mins[i] = e->origin[i] - currentmodel->radius;
975  maxs[i] = e->origin[i] + currentmodel->radius;
976  }
977  }
978  else
979  {
980  rotated = false;
981  VectorAdd (e->origin, currentmodel->mins, mins);
982  VectorAdd (e->origin, currentmodel->maxs, maxs);
983  }
984 
985  if (R_CullBox (mins, maxs))
986  return;
987 
988  qglColor3f (1,1,1);
989  memset (gl_lms.lightmap_surfaces, 0, sizeof(gl_lms.lightmap_surfaces));
990 
992  if (rotated)
993  {
994  vec3_t temp;
996 
997  VectorCopy (modelorg, temp);
999  modelorg[0] = DotProduct (temp, forward);
1000  modelorg[1] = -DotProduct (temp, right);
1001  modelorg[2] = DotProduct (temp, up);
1002  }
1003 
1004  qglPushMatrix ();
1005 e->angles[0] = -e->angles[0]; // stupid quake bug
1006 e->angles[2] = -e->angles[2]; // stupid quake bug
1007  R_RotateForEntity (e);
1008 e->angles[0] = -e->angles[0]; // stupid quake bug
1009 e->angles[2] = -e->angles[2]; // stupid quake bug
1010 
1011  GL_EnableMultitexture( true );
1013  GL_TexEnv( GL_REPLACE );
1015  GL_TexEnv( GL_MODULATE );
1016 
1017  R_DrawInlineBModel ();
1018  GL_EnableMultitexture( false );
1019 
1020  qglPopMatrix ();
1021 }

◆ R_DrawInlineBModel()

void R_DrawInlineBModel ( void  )

Definition at line 880 of file gl_rsurf.c.

881 {
882  int i, k;
883  cplane_t *pplane;
884  float dot;
885  msurface_t *psurf;
886  dlight_t *lt;
887 
888  // calculate dynamic lighting for bmodel
889  if ( !gl_flashblend->value )
890  {
891  lt = r_newrefdef.dlights;
892  for (k=0 ; k<r_newrefdef.num_dlights ; k++, lt++)
893  {
895  }
896  }
897 
899 
901  {
902  qglEnable (GL_BLEND);
903  qglColor4f (1,1,1,0.25);
904  GL_TexEnv( GL_MODULATE );
905  }
906 
907  //
908  // draw texture
909  //
910  for (i=0 ; i<currentmodel->nummodelsurfaces ; i++, psurf++)
911  {
912  // find which side of the node we are on
913  pplane = psurf->plane;
914 
915  dot = DotProduct (modelorg, pplane->normal) - pplane->dist;
916 
917  // draw the polygon
918  if (((psurf->flags & SURF_PLANEBACK) && (dot < -BACKFACE_EPSILON)) ||
919  (!(psurf->flags & SURF_PLANEBACK) && (dot > BACKFACE_EPSILON)))
920  {
921  if (psurf->texinfo->flags & (SURF_TRANS33|SURF_TRANS66) )
922  { // add to the translucent chain
924  r_alpha_surfaces = psurf;
925  }
926  else if ( qglMTexCoord2fSGIS && !( psurf->flags & SURF_DRAWTURB ) )
927  {
928  GL_RenderLightmappedPoly( psurf );
929  }
930  else
931  {
932  GL_EnableMultitexture( false );
933  R_RenderBrushPoly( psurf );
934  GL_EnableMultitexture( true );
935  }
936  }
937  }
938 
939  if ( !(currententity->flags & RF_TRANSLUCENT) )
940  {
941  if ( !qglMTexCoord2fSGIS )
942  R_BlendLightmaps ();
943  }
944  else
945  {
946  qglDisable (GL_BLEND);
947  qglColor4f (1,1,1,1);
948  GL_TexEnv( GL_REPLACE );
949  }
950 }

Referenced by R_DrawBrushModel().

◆ R_DrawTriangleOutlines()

void R_DrawTriangleOutlines ( void  )

Definition at line 231 of file gl_rsurf.c.

232 {
233  int i, j;
234  glpoly_t *p;
235 
236  if (!gl_showtris->value)
237  return;
238 
239  qglDisable (GL_TEXTURE_2D);
240  qglDisable (GL_DEPTH_TEST);
241  qglColor4f (1,1,1,1);
242 
243  for (i=0 ; i<MAX_LIGHTMAPS ; i++)
244  {
245  msurface_t *surf;
246 
247  for ( surf = gl_lms.lightmap_surfaces[i]; surf != 0; surf = surf->lightmapchain )
248  {
249  p = surf->polys;
250  for ( ; p ; p=p->chain)
251  {
252  for (j=2 ; j<p->numverts ; j++ )
253  {
254  qglBegin (GL_LINE_STRIP);
255  qglVertex3fv (p->verts[0]);
256  qglVertex3fv (p->verts[j-1]);
257  qglVertex3fv (p->verts[j]);
258  qglVertex3fv (p->verts[0]);
259  qglEnd ();
260  }
261  }
262  }
263  }
264 
265  qglEnable (GL_DEPTH_TEST);
266  qglEnable (GL_TEXTURE_2D);
267 }

Referenced by R_DrawWorld().

◆ R_DrawWorld()

void R_DrawWorld ( void  )

Definition at line 1197 of file gl_rsurf.c.

1198 {
1199  entity_t ent;
1200 
1201  if (!r_drawworld->value)
1202  return;
1203 
1205  return;
1206 
1208 
1210 
1211  // auto cycle the world frame for texture animation
1212  memset (&ent, 0, sizeof(ent));
1213  ent.frame = (int)(r_newrefdef.time*2);
1214  currententity = &ent;
1215 
1217 
1218  qglColor3f (1,1,1);
1219  memset (gl_lms.lightmap_surfaces, 0, sizeof(gl_lms.lightmap_surfaces));
1220  R_ClearSkyBox ();
1221 
1222  if ( qglMTexCoord2fSGIS )
1223  {
1224  GL_EnableMultitexture( true );
1225 
1227  GL_TexEnv( GL_REPLACE );
1229 
1230  if ( gl_lightmap->value )
1231  GL_TexEnv( GL_REPLACE );
1232  else
1233  GL_TexEnv( GL_MODULATE );
1234 
1236 
1237  GL_EnableMultitexture( false );
1238  }
1239  else
1240  {
1242  }
1243 
1244  /*
1245  ** theoretically nothing should happen in the next two functions
1246  ** if multitexture is enabled
1247  */
1248  DrawTextureChains ();
1249  R_BlendLightmaps ();
1250 
1251  R_DrawSkyBox ();
1252 
1254 }

◆ R_MarkLeaves()

void R_MarkLeaves ( void  )

Definition at line 1265 of file gl_rsurf.c.

1266 {
1267  byte *vis;
1268  byte fatvis[MAX_MAP_LEAFS/8];
1269  mnode_t *node;
1270  int i, c;
1271  mleaf_t *leaf;
1272  int cluster;
1273 
1275  return;
1276 
1277  // development aid to let you run around and see exactly where
1278  // the pvs ends
1279  if (gl_lockpvs->value)
1280  return;
1281 
1282  r_visframecount++;
1285 
1286  if (r_novis->value || r_viewcluster == -1 || !r_worldmodel->vis)
1287  {
1288  // mark everything
1289  for (i=0 ; i<r_worldmodel->numleafs ; i++)
1291  for (i=0 ; i<r_worldmodel->numnodes ; i++)
1293  return;
1294  }
1295 
1297  // may have to combine two clusters because of solid water boundaries
1299  {
1300  memcpy (fatvis, vis, (r_worldmodel->numleafs+7)/8);
1302  c = (r_worldmodel->numleafs+31)/32;
1303  for (i=0 ; i<c ; i++)
1304  ((int *)fatvis)[i] |= ((int *)vis)[i];
1305  vis = fatvis;
1306  }
1307 
1308  for (i=0,leaf=r_worldmodel->leafs ; i<r_worldmodel->numleafs ; i++, leaf++)
1309  {
1310  cluster = leaf->cluster;
1311  if (cluster == -1)
1312  continue;
1313  if (vis[cluster>>3] & (1<<(cluster&7)))
1314  {
1315  node = (mnode_t *)leaf;
1316  do
1317  {
1318  if (node->visframe == r_visframecount)
1319  break;
1320  node->visframe = r_visframecount;
1321  node = node->parent;
1322  } while (node);
1323  }
1324  }
1325 
1326 #if 0
1327  for (i=0 ; i<r_worldmodel->vis->numclusters ; i++)
1328  {
1329  if (vis[i>>3] & (1<<(i&7)))
1330  {
1331  node = (mnode_t *)&r_worldmodel->leafs[i]; // FIXME: cluster
1332  do
1333  {
1334  if (node->visframe == r_visframecount)
1335  break;
1336  node->visframe = r_visframecount;
1337  node = node->parent;
1338  } while (node);
1339  }
1340  }
1341 #endif
1342 }

◆ R_RecursiveWorldNode()

void R_RecursiveWorldNode ( mnode_t node)

Definition at line 1036 of file gl_rsurf.c.

1037 {
1038  int c, side, sidebit;
1039  cplane_t *plane;
1040  msurface_t *surf, **mark;
1041  mleaf_t *pleaf;
1042  float dot;
1043  image_t *image;
1044 
1045  if (node->contents == CONTENTS_SOLID)
1046  return; // solid
1047 
1048  if (node->visframe != r_visframecount)
1049  return;
1050  if (R_CullBox (node->minmaxs, node->minmaxs+3))
1051  return;
1052 
1053 // if a leaf node, draw stuff
1054  if (node->contents != -1)
1055  {
1056  pleaf = (mleaf_t *)node;
1057 
1058  // check for door connected areas
1059  if (r_newrefdef.areabits)
1060  {
1061  if (! (r_newrefdef.areabits[pleaf->area>>3] & (1<<(pleaf->area&7)) ) )
1062  return; // not visible
1063  }
1064 
1065  mark = pleaf->firstmarksurface;
1066  c = pleaf->nummarksurfaces;
1067 
1068  if (c)
1069  {
1070  do
1071  {
1072  (*mark)->visframe = r_framecount;
1073  mark++;
1074  } while (--c);
1075  }
1076 
1077  return;
1078  }
1079 
1080 // node is just a decision point, so go down the apropriate sides
1081 
1082 // find which side of the node we are on
1083  plane = node->plane;
1084 
1085  switch (plane->type)
1086  {
1087  case PLANE_X:
1088  dot = modelorg[0] - plane->dist;
1089  break;
1090  case PLANE_Y:
1091  dot = modelorg[1] - plane->dist;
1092  break;
1093  case PLANE_Z:
1094  dot = modelorg[2] - plane->dist;
1095  break;
1096  default:
1097  dot = DotProduct (modelorg, plane->normal) - plane->dist;
1098  break;
1099  }
1100 
1101  if (dot >= 0)
1102  {
1103  side = 0;
1104  sidebit = 0;
1105  }
1106  else
1107  {
1108  side = 1;
1109  sidebit = SURF_PLANEBACK;
1110  }
1111 
1112 // recurse down the children, front side first
1113  R_RecursiveWorldNode (node->children[side]);
1114 
1115  // draw stuff
1116  for ( c = node->numsurfaces, surf = r_worldmodel->surfaces + node->firstsurface; c ; c--, surf++)
1117  {
1118  if (surf->visframe != r_framecount)
1119  continue;
1120 
1121  if ( (surf->flags & SURF_PLANEBACK) != sidebit )
1122  continue; // wrong side
1123 
1124  if (surf->texinfo->flags & SURF_SKY)
1125  { // just adds to visible sky bounds
1126  R_AddSkySurface (surf);
1127  }
1128  else if (surf->texinfo->flags & (SURF_TRANS33|SURF_TRANS66))
1129  { // add to the translucent chain
1131  r_alpha_surfaces = surf;
1132  }
1133  else
1134  {
1135  if ( qglMTexCoord2fSGIS && !( surf->flags & SURF_DRAWTURB ) )
1136  {
1137  GL_RenderLightmappedPoly( surf );
1138  }
1139  else
1140  {
1141  // the polygon is visible, so add it to the texture
1142  // sorted chain
1143  // FIXME: this is a hack for animation
1144  image = R_TextureAnimation (surf->texinfo);
1145  surf->texturechain = image->texturechain;
1146  image->texturechain = surf;
1147  }
1148  }
1149  }
1150 
1151  // recurse down the back side
1152  R_RecursiveWorldNode (node->children[!side]);
1153 /*
1154  for ( ; c ; c--, surf++)
1155  {
1156  if (surf->visframe != r_framecount)
1157  continue;
1158 
1159  if ( (surf->flags & SURF_PLANEBACK) != sidebit )
1160  continue; // wrong side
1161 
1162  if (surf->texinfo->flags & SURF_SKY)
1163  { // just adds to visible sky bounds
1164  R_AddSkySurface (surf);
1165  }
1166  else if (surf->texinfo->flags & (SURF_TRANS33|SURF_TRANS66))
1167  { // add to the translucent chain
1168 // surf->texturechain = alpha_surfaces;
1169 // alpha_surfaces = surf;
1170  }
1171  else
1172  {
1173  if ( qglMTexCoord2fSGIS && !( surf->flags & SURF_DRAWTURB ) )
1174  {
1175  GL_RenderLightmappedPoly( surf );
1176  }
1177  else
1178  {
1179  // the polygon is visible, so add it to the texture
1180  // sorted chain
1181  // FIXME: this is a hack for animation
1182  image = R_TextureAnimation (surf->texinfo);
1183  surf->texturechain = image->texturechain;
1184  image->texturechain = surf;
1185  }
1186  }
1187  }
1188 */
1189 }

Referenced by R_DrawWorld().

◆ R_RenderBrushPoly()

void R_RenderBrushPoly ( msurface_t fa)

Definition at line 478 of file gl_rsurf.c.

479 {
480  int maps;
481  image_t *image;
482  qboolean is_dynamic = false;
483 
484  c_brush_polys++;
485 
486  image = R_TextureAnimation (fa->texinfo);
487 
488  if (fa->flags & SURF_DRAWTURB)
489  {
490  GL_Bind( image->texnum );
491 
492  // warp texture, no lightmaps
493  GL_TexEnv( GL_MODULATE );
494  qglColor4f( gl_state.inverse_intensity,
497  1.0F );
498  EmitWaterPolys (fa);
499  GL_TexEnv( GL_REPLACE );
500 
501  return;
502  }
503  else
504  {
505  GL_Bind( image->texnum );
506 
507  GL_TexEnv( GL_REPLACE );
508  }
509 
510 //======
511 //PGM
512  if(fa->texinfo->flags & SURF_FLOWING)
513  DrawGLFlowingPoly (fa);
514  else
515  DrawGLPoly (fa->polys);
516 //PGM
517 //======
518 
519  /*
520  ** check for lightmap modification
521  */
522  for ( maps = 0; maps < MAXLIGHTMAPS && fa->styles[maps] != 255; maps++ )
523  {
524  if ( r_newrefdef.lightstyles[fa->styles[maps]].white != fa->cached_light[maps] )
525  goto dynamic;
526  }
527 
528  // dynamic this frame or dynamic previously
529  if ( ( fa->dlightframe == r_framecount ) )
530  {
531 dynamic:
532  if ( gl_dynamic->value )
533  {
535  {
536  is_dynamic = true;
537  }
538  }
539  }
540 
541  if ( is_dynamic )
542  {
543  if ( ( fa->styles[maps] >= 32 || fa->styles[maps] == 0 ) && ( fa->dlightframe != r_framecount ) )
544  {
545  unsigned temp[34*34];
546  int smax, tmax;
547 
548  smax = (fa->extents[0]>>4)+1;
549  tmax = (fa->extents[1]>>4)+1;
550 
551  R_BuildLightMap( fa, (void *)temp, smax*4 );
552  R_SetCacheState( fa );
553 
555 
556  qglTexSubImage2D( GL_TEXTURE_2D, 0,
557  fa->light_s, fa->light_t,
558  smax, tmax,
560  GL_UNSIGNED_BYTE, temp );
561 
564  }
565  else
566  {
568  gl_lms.lightmap_surfaces[0] = fa;
569  }
570  }
571  else
572  {
575  }
576 }

Referenced by DrawTextureChains(), and R_DrawInlineBModel().

◆ R_SetCacheState()

void R_SetCacheState ( msurface_t surf)

Definition at line 437 of file gl_light.c.

438 {
439  int maps;
440 
441  for (maps = 0 ; maps < MAXLIGHTMAPS && surf->styles[maps] != 255 ;
442  maps++)
443  {
444  surf->cached_light[maps] = r_newrefdef.lightstyles[surf->styles[maps]].white;
445  }
446 }

Referenced by GL_CreateSurfaceLightmap(), GL_RenderLightmappedPoly(), and R_RenderBrushPoly().

◆ R_TextureAnimation()

image_t* R_TextureAnimation ( mtexinfo_t tex)

Definition at line 84 of file gl_rsurf.c.

85 {
86  int c;
87 
88  if (!tex->next)
89  return tex->image;
90 
91  c = currententity->frame % tex->numframes;
92  while (c)
93  {
94  tex = tex->next;
95  c--;
96  }
97 
98  return tex->image;
99 }

Referenced by GL_RenderLightmappedPoly(), R_RecursiveWorldNode(), and R_RenderBrushPoly().

Variable Documentation

◆ c_visible_lightmaps

int c_visible_lightmaps

Definition at line 40 of file gl_rsurf.c.

Referenced by R_BlendLightmaps().

◆ c_visible_textures

int c_visible_textures

Definition at line 41 of file gl_rsurf.c.

Referenced by DrawTextureChains().

◆ gl_lms

◆ modelorg

vec3_t modelorg
static

Definition at line 26 of file gl_rsurf.c.

Referenced by R_DrawBrushModel(), R_DrawInlineBModel(), R_DrawWorld(), and R_RecursiveWorldNode().

◆ r_alpha_surfaces

msurface_t* r_alpha_surfaces

Definition at line 28 of file gl_rsurf.c.

Referenced by R_DrawAlphaSurfaces(), R_DrawInlineBModel(), and R_RecursiveWorldNode().

RF_TRANSLUCENT
#define RF_TRANSLUCENT
Definition: q_shared.h:604
MAX_MAP_LEAFS
#define MAX_MAP_LEAFS
Definition: qfiles.h:239
nummaps
static int nummaps
Definition: menu.c:2393
cplane_s::normal
vec3_t normal
Definition: q_shared.h:415
msurface_s::dlight_s
int dlight_s
Definition: gl_model.h:109
refdef_t::vieworg
float vieworg[3]
Definition: ref.h:106
numgltextures
int numgltextures
Definition: gl_image.c:25
cplane_s::type
byte type
Definition: q_shared.h:417
height
GLsizei height
Definition: qgl_win.c:69
currentmodel
model_t * currentmodel
Definition: r_main.c:39
r_framecount
int r_framecount
Definition: r_main.c:97
msurface_s::plane
mplane_t * plane
Definition: r_model.h:100
msurface_s::styles
byte styles[MAXLIGHTMAPS]
Definition: r_model.h:115
mtexinfo_s::numframes
int numframes
Definition: r_model.h:89
entity_s::origin
float origin[3]
Definition: ref.h:57
mleaf_s::area
int area
Definition: r_model.h:155
BACKFACE_EPSILON
#define BACKFACE_EPSILON
Definition: r_local.h:228
lightstyle_t::rgb
float rgb[3]
Definition: ref.h:98
r_novis
cvar_t * r_novis
Definition: r_main.c:139
model_s::vis
dvis_t * vis
Definition: r_model.h:229
int
CONST PIXELFORMATDESCRIPTOR int
Definition: qgl_win.c:35
VectorSubtract
#define VectorSubtract(a, b, c)
Definition: q_shared.h:163
gl_modulate
cvar_t * gl_modulate
Definition: gl_rmain.c:118
model_s::nummodelsurfaces
int nummodelsurfaces
Definition: r_model.h:196
gl_state
glstate_t gl_state
Definition: gl_rmain.c:42
msurface_s::light_t
int light_t
Definition: gl_model.h:108
ri
refimport_t ri
Definition: r_main.c:25
BLOCK_HEIGHT
#define BLOCK_HEIGHT
Definition: gl_rsurf.c:36
glstate_t::currenttextures
int currenttextures[2]
Definition: gl_local.h:418
GL_MBind
void GL_MBind(GLenum target, int texnum)
Definition: gl_image.c:149
refdef_t::areabits
byte * areabits
Definition: ref.h:112
v
GLdouble v
Definition: qgl_win.c:143
gl_texture1
int gl_texture1
Definition: gl_rmain.c:35
gl_dynamic
cvar_t * gl_dynamic
Definition: gl_rmain.c:116
glpoly_s::verts
float verts[4][VERTEXSIZE]
Definition: gl_model.h:92
modelorg
static vec3_t modelorg
Definition: gl_rsurf.c:26
model_s::edges
medge_t * edges
Definition: r_model.h:211
msurface_s::dlight_t
int dlight_t
Definition: gl_model.h:109
mnode_s::visframe
int visframe
Definition: r_model.h:127
VERTEXSIZE
#define VERTEXSIZE
Definition: gl_model.h:84
cvar_s::string
char * string
Definition: q_shared.h:327
qboolean
qboolean
Definition: q_shared.h:63
x
GLint GLenum GLint x
Definition: qgl_win.c:116
VectorClear
#define VectorClear(a)
Definition: q_shared.h:166
i
int i
Definition: q_shared.c:305
msurface_s::numedges
int numedges
Definition: r_model.h:104
msurface_s::visframe
int visframe
Definition: r_model.h:95
gl_saturatelighting
cvar_t * gl_saturatelighting
Definition: gl_rmain.c:131
msurface_s::dlightframe
int dlightframe
Definition: r_model.h:97
model_s::firstnode
int firstnode
Definition: r_model.h:214
mleaf_s::visframe
int visframe
Definition: r_model.h:147
mnode_s::parent
struct mnode_s * parent
Definition: r_model.h:131
mnode_s
Definition: r_model.h:123
r_drawworld
cvar_t * r_drawworld
Definition: r_main.c:134
glpoly_s::next
struct glpoly_s * next
Definition: gl_model.h:88
mleaf_s::firstmarksurface
msurface_t ** firstmarksurface
Definition: r_model.h:157
r_oldviewcluster
int r_oldviewcluster
Definition: r_local.h:791
refdef_t::rdflags
int rdflags
Definition: ref.h:110
gl_texture0
int gl_texture0
Definition: gl_rmain.c:35
msurface_s::samples
byte * samples
Definition: r_model.h:116
R_TextureAnimation
image_t * R_TextureAnimation(mtexinfo_t *tex)
Definition: gl_rsurf.c:84
r_visframecount
int r_visframecount
Definition: r_main.c:98
mnode_s::children
struct mnode_s * children[2]
Definition: r_model.h:135
CONTENTS_SOLID
#define CONTENTS_SOLID
Definition: qfiles.h:333
entity_s::flags
int flags
Definition: ref.h:76
r_alpha_surfaces
msurface_t * r_alpha_surfaces
Definition: gl_rsurf.c:28
image_s::registration_sequence
int registration_sequence
Definition: r_local.h:77
currententity
entity_t * currententity
Definition: r_bsp.c:28
SURF_WARP
#define SURF_WARP
Definition: qfiles.h:372
msurface_s::extents
short extents[2]
Definition: r_model.h:110
R_MarkLights
void R_MarkLights(dlight_t *light, int bit, mnode_t *node)
Definition: r_light.c:40
msurface_s::cached_light
float cached_light[MAXLIGHTMAPS]
Definition: gl_model.h:123
mleaf_s
Definition: r_model.h:143
SURF_TRANS66
#define SURF_TRANS66
Definition: qfiles.h:374
r_viewcluster
int r_viewcluster
Definition: r_main.c:108
j
GLint j
Definition: qgl_win.c:150
mvertex_t::position
vec3_t position
Definition: r_model.h:47
gl_tex_alpha_format
int gl_tex_alpha_format
Definition: gl_image.c:43
AngleVectors
void AngleVectors(vec3_t angles, vec3_t forward, vec3_t right, vec3_t up)
Definition: q_shared.c:93
glpoly_s::numverts
int numverts
Definition: gl_model.h:90
SURF_PLANEBACK
#define SURF_PLANEBACK
Definition: r_model.h:68
gltextures
image_t gltextures[MAX_GLTEXTURES]
Definition: gl_image.c:24
mtexinfo_s::image
image_t * image
Definition: r_model.h:87
R_DrawInlineBModel
void R_DrawInlineBModel(void)
Definition: gl_rsurf.c:880
GL_EnableMultitexture
void GL_EnableMultitexture(qboolean enable)
Definition: gl_image.c:71
RDF_NOWORLDMODEL
#define RDF_NOWORLDMODEL
Definition: q_shared.h:622
LM_InitBlock
static void LM_InitBlock(void)
Definition: gl_rsurf.c:1354
numleafs
int numleafs
Definition: cmodel.c:77
R_BlendLightmaps
void R_BlendLightmaps(void)
Definition: gl_rsurf.c:316
r
GLdouble GLdouble r
Definition: qgl_win.c:336
dvis_t::numclusters
int numclusters
Definition: qfiles.h:465
medge_t
Definition: r_model.h:77
image_s::height
int height
Definition: r_local.h:75
R_DrawTriangleOutlines
void R_DrawTriangleOutlines(void)
Definition: gl_rsurf.c:231
mnode_s::minmaxs
short minmaxs[6]
Definition: r_model.h:129
refdef_t::num_dlights
int num_dlights
Definition: ref.h:119
R_ClearSkyBox
void R_ClearSkyBox(void)
Definition: gl_warp.c:508
R_AddSkySurface
void R_AddSkySurface(msurface_t *fa)
Definition: gl_warp.c:485
forward
static vec3_t forward
Definition: p_view.c:29
LIGHTMAP_BYTES
#define LIGHTMAP_BYTES
Definition: gl_rsurf.c:33
msurface_s::texinfo
mtexinfo_t * texinfo
Definition: r_model.h:112
model_s::leafs
mleaf_t * leafs
Definition: r_model.h:205
t
GLdouble t
Definition: qgl_win.c:328
model_s::nodes
mnode_t * nodes
Definition: r_model.h:215
Q_ftol
long Q_ftol(float f)
model_s::mins
vec3_t mins
Definition: r_model.h:185
mleaf_s::cluster
int cluster
Definition: r_model.h:154
image_s::texnum
int texnum
Definition: gl_local.h:95
LM_AllocBlock
static qboolean LM_AllocBlock(int w, int h, int *x, int *y)
Definition: gl_rsurf.c:1411
PLANE_Y
#define PLANE_Y
Definition: qfiles.h:308
refimport_t::Sys_Error
void(* Sys_Error)(int err_level, char *str,...)
Definition: ref.h:194
SURF_DRAWSKY
#define SURF_DRAWSKY
Definition: r_model.h:69
GL_Bind
void GL_Bind(int texnum)
Definition: gl_image.c:137
msurface_s::texturechain
struct msurface_s * texturechain
Definition: gl_model.h:112
SURF_FLOWING
#define SURF_FLOWING
Definition: qfiles.h:375
r_newrefdef
refdef_t r_newrefdef
Definition: r_main.c:38
DotProduct
#define DotProduct(x, y)
Definition: q_shared.h:162
SURF_TRANS33
#define SURF_TRANS33
Definition: qfiles.h:373
msurface_s::lightmapchain
struct msurface_s * lightmapchain
Definition: gl_model.h:113
r_worldmodel
model_t * r_worldmodel
Definition: r_main.c:41
cvar_s::value
float value
Definition: q_shared.h:331
cplane_s::dist
float dist
Definition: q_shared.h:416
BLOCK_WIDTH
#define BLOCK_WIDTH
Definition: gl_rsurf.c:35
model_s::lightdata
byte * lightdata
Definition: r_model.h:231
gl_lightmap
cvar_t * gl_lightmap
Definition: gl_rmain.c:113
c_visible_textures
int c_visible_textures
Definition: gl_rsurf.c:41
TEXNUM_LIGHTMAPS
#define TEXNUM_LIGHTMAPS
Definition: gl_local.h:103
SURF_DRAWTURB
#define SURF_DRAWTURB
Definition: r_model.h:70
DrawGLFlowingPoly
void DrawGLFlowingPoly(msurface_t *fa)
Definition: gl_rsurf.c:203
r_viewcluster2
int r_viewcluster2
Definition: gl_local.h:174
glpoly_s::chain
struct glpoly_s * chain
Definition: gl_model.h:89
F
#define F(X, Y, Z)
Definition: md4.c:13
DrawGLPolyChain
void DrawGLPolyChain(glpoly_t *p, float soffset, float toffset)
Definition: gl_rsurf.c:272
NULL
#define NULL
Definition: q_shared.h:67
refdef_t::time
float time
Definition: ref.h:109
gllightmapstate_t::lightmap_buffer
byte lightmap_buffer[4 *BLOCK_WIDTH *BLOCK_HEIGHT]
Definition: gl_rsurf.c:56
glstate_t::inverse_intensity
float inverse_intensity
Definition: gl_local.h:409
model_s::surfedges
int * surfedges
Definition: r_model.h:224
gl_flashblend
cvar_t * gl_flashblend
Definition: gl_rmain.c:129
mleaf_s::nummarksurfaces
int nummarksurfaces
Definition: r_model.h:158
image_s::width
int width
Definition: r_local.h:75
gllightmapstate_t::current_lightmap_texture
int current_lightmap_texture
Definition: gl_rsurf.c:48
ERR_DROP
#define ERR_DROP
Definition: qcommon.h:744
GL_RenderLightmappedPoly
static void GL_RenderLightmappedPoly(msurface_t *surf)
Definition: gl_rsurf.c:703
MAXLIGHTMAPS
#define MAXLIGHTMAPS
Definition: qfiles.h:409
R_DrawSkyBox
void R_DrawSkyBox(void)
Definition: gl_warp.c:562
ERR_FATAL
#define ERR_FATAL
Definition: qcommon.h:743
msurface_s::flags
int flags
Definition: r_model.h:101
lightstyle_t
Definition: ref.h:96
VectorAdd
#define VectorAdd(a, b, c)
Definition: q_shared.h:164
model_s::maxs
vec3_t maxs
Definition: r_model.h:185
s
static fixed16_t s
Definition: r_scan.c:30
model_s::radius
float radius
Definition: gl_model.h:189
y
GLint y
Definition: qgl_win.c:115
mtexinfo_s::next
struct mtexinfo_s * next
Definition: r_model.h:90
r_pedge
medge_t * r_pedge
Definition: r_rast.c:41
R_RenderBrushPoly
void R_RenderBrushPoly(msurface_t *fa)
Definition: gl_rsurf.c:478
msurface_s::polys
glpoly_t * polys
Definition: gl_model.h:111
gl_lms
static gllightmapstate_t gl_lms
Definition: gl_rsurf.c:59
entity_s::frame
int frame
Definition: ref.h:58
gllightmapstate_t::lightmap_surfaces
msurface_t * lightmap_surfaces[MAX_LIGHTMAPS]
Definition: gl_rsurf.c:50
R_RecursiveWorldNode
void R_RecursiveWorldNode(mnode_t *node)
Definition: gl_rsurf.c:1036
VectorCopy
#define VectorCopy(a, b)
Definition: q_shared.h:165
MAX_LIGHTMAPS
#define MAX_LIGHTMAPS
Definition: gl_rsurf.c:38
gl_tex_solid_format
int gl_tex_solid_format
Definition: gl_image.c:42
refdef_t::lightstyles
lightstyle_t * lightstyles
Definition: ref.h:114
PLANE_X
#define PLANE_X
Definition: qfiles.h:307
mtexinfo_s::vecs
float vecs[2][4]
Definition: r_model.h:85
r_oldviewcluster2
int r_oldviewcluster2
Definition: gl_local.h:174
R_CullBox
qboolean R_CullBox(vec3_t mins, vec3_t maxs)
Definition: gl_rmain.c:151
msurface_s::light_s
int light_s
Definition: gl_model.h:108
mnode_s::contents
int contents
Definition: r_model.h:126
mnode_s::firstsurface
unsigned short firstsurface
Definition: r_model.h:137
PLANE_Z
#define PLANE_Z
Definition: qfiles.h:309
up
static vec3_t up
Definition: p_view.c:29
EmitWaterPolys
void EmitWaterPolys(msurface_t *fa)
Definition: gl_warp.c:211
dlight_t
Definition: ref.h:82
entity_s
Definition: ref.h:49
GL_TexEnv
void GL_TexEnv(GLenum mode)
Definition: gl_image.c:126
model_s::firstmodelsurface
int firstmodelsurface
Definition: r_model.h:196
model_s::surfaces
msurface_t * surfaces
Definition: r_model.h:221
medge_t::v
unsigned short v[2]
Definition: r_model.h:79
mnode_s::plane
mplane_t * plane
Definition: r_model.h:134
DrawTextureChains
void DrawTextureChains(void)
Definition: gl_rsurf.c:635
stride
GLenum GLsizei stride
Definition: qgl_win.c:114
model_s::numleafs
int numleafs
Definition: r_model.h:204
msurface_s::lightmaptexturenum
int lightmaptexturenum
Definition: gl_model.h:121
msurface_s
Definition: r_model.h:93
DrawGLPoly
void DrawGLPoly(glpoly_t *p)
Definition: gl_rsurf.c:181
R_AddDynamicLights
void R_AddDynamicLights(msurface_t *surf)
Definition: gl_light.c:359
mtexinfo_s::flags
int flags
Definition: r_model.h:88
model_s::numnodes
int numnodes
Definition: r_model.h:213
gl_showtris
cvar_t * gl_showtris
Definition: gl_rmain.c:123
refdef_t::dlights
dlight_t * dlights
Definition: ref.h:120
glstate_t::lightmap_textures
int lightmap_textures
Definition: gl_local.h:416
R_RotateForEntity
void R_RotateForEntity(entity_t *e)
Definition: gl_rmain.c:165
msurface_s::texturemins
short texturemins[2]
Definition: r_model.h:109
texture
GLuint texture
Definition: qgl_win.c:68
lightstyle_t::white
float white
Definition: ref.h:99
w
GLdouble GLdouble GLdouble w
Definition: qgl_win.c:291
right
GLdouble right
Definition: qgl_win.c:159
image_s
Definition: r_local.h:71
r_world_matrix
float r_world_matrix[16]
Definition: gl_rmain.c:69
GL_LIGHTMAP_FORMAT
#define GL_LIGHTMAP_FORMAT
Definition: gl_rsurf.c:43
glpoly_s::flags
int flags
Definition: gl_model.h:91
cplane_s
Definition: q_shared.h:413
R_BuildLightMap
void R_BuildLightMap(msurface_t *surf, byte *dest, int stride)
Definition: gl_light.c:455
R_SetCacheState
void R_SetCacheState(msurface_t *surf)
Definition: gl_light.c:437
mnode_s::numsurfaces
unsigned short numsurfaces
Definition: r_model.h:138
r_fullbright
cvar_t * r_fullbright
Definition: r_main.c:137
model_s::vertexes
mvertex_t * vertexes
Definition: r_model.h:208
c_brush_polys
int c_brush_polys
Definition: gl_rmain.c:55
gl_lockpvs
cvar_t * gl_lockpvs
Definition: gl_rmain.c:136
GL_SelectTexture
void GL_SelectTexture(GLenum texture)
Definition: gl_image.c:92
gllightmapstate_t::internal_format
int internal_format
Definition: gl_rsurf.c:47
MAX_LIGHTSTYLES
#define MAX_LIGHTSTYLES
Definition: q_shared.h:88
c_visible_lightmaps
int c_visible_lightmaps
Definition: gl_rsurf.c:40
Mod_ClusterPVS
byte * Mod_ClusterPVS(int cluster, model_t *model)
Definition: r_model.c:268
max
#define max(a, b)
Definition: vk_local.h:75
gl_monolightmap
cvar_t * gl_monolightmap
Definition: gl_rmain.c:117
vec3_t
vec_t vec3_t[3]
Definition: q_shared.h:134
Hunk_Alloc
void * Hunk_Alloc(int size)
Definition: q_shwin.c:57
s_blocklights
static float s_blocklights[34 *34 *3]
Definition: gl_light.c:353
LM_UploadBlock
static void LM_UploadBlock(qboolean dynamic)
Definition: gl_rsurf.c:1359
entity_s::angles
float angles[3]
Definition: ref.h:52
msurface_s::firstedge
int firstedge
Definition: r_model.h:103
SURF_SKY
#define SURF_SKY
Definition: qfiles.h:371
gllightmapstate_t::allocated
int allocated[BLOCK_WIDTH]
Definition: gl_rsurf.c:52
glpoly_s
Definition: gl_model.h:86
image_s::texturechain
struct msurface_s * texturechain
Definition: gl_local.h:94