icculus quake2 doxygen  1.0 dev
gl_rsurf.c File Reference
#include <assert.h>
#include "gl_local.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 35 of file gl_rsurf.c.

◆ BLOCK_WIDTH

#define BLOCK_WIDTH   128

Definition at line 34 of file gl_rsurf.c.

◆ DYNAMIC_LIGHT_HEIGHT

#define DYNAMIC_LIGHT_HEIGHT   128

Definition at line 30 of file gl_rsurf.c.

◆ DYNAMIC_LIGHT_WIDTH

#define DYNAMIC_LIGHT_WIDTH   128

Definition at line 29 of file gl_rsurf.c.

◆ GL_LIGHTMAP_FORMAT

#define GL_LIGHTMAP_FORMAT   GL_RGBA

Definition at line 42 of file gl_rsurf.c.

◆ LIGHTMAP_BYTES

#define LIGHTMAP_BYTES   4

Definition at line 32 of file gl_rsurf.c.

◆ MAX_LIGHTMAPS

#define MAX_LIGHTMAPS   128

Definition at line 37 of file gl_rsurf.c.

Function Documentation

◆ DrawGLFlowingPoly()

void DrawGLFlowingPoly ( msurface_t fa)

Definition at line 202 of file gl_rsurf.c.

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

Referenced by R_DrawAlphaSurfaces(), and R_RenderBrushPoly().

◆ DrawGLPoly()

void DrawGLPoly ( glpoly_t p)

Definition at line 180 of file gl_rsurf.c.

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

Referenced by R_DrawAlphaSurfaces(), and R_RenderBrushPoly().

◆ DrawGLPolyChain()

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

Definition at line 271 of file gl_rsurf.c.

272 {
273  if ( soffset == 0 && toffset == 0 )
274  {
275  for ( ; p != 0; p = p->chain )
276  {
277  float *v;
278  int j;
279 
280  /* There is a crash somewheres around old line 282.
281  * I am trying to find a workaround.
282  * -- Phil Brown
283  */
284  v = p->verts[0];
285  if(v==NULL){
286  fprintf(stderr,"BUGFIX: DrawGLPolyChain: v==NULL\n");
287  return;
288  }
289  qglBegin (GL_POLYGON);
290  for (j=0 ; j<p->numverts ; j++, v+= VERTEXSIZE)
291  {
292  qglTexCoord2f (v[5], v[6] );
293  qglVertex3fv (v);
294  }
295  qglEnd ();
296  }
297  }
298  else
299  {
300  for ( ; p != 0; p = p->chain )
301  {
302  float *v;
303  int j;
304 
305  qglBegin (GL_POLYGON);
306  v = p->verts[0];
307  for (j=0 ; j<p->numverts ; j++, v+= VERTEXSIZE)
308  {
309  qglTexCoord2f (v[5] - soffset, v[6] - toffset );
310  qglVertex3fv (v);
311  }
312  qglEnd ();
313  }
314  }
315 }

Referenced by R_BlendLightmaps().

◆ DrawTextureChains()

void DrawTextureChains ( void  )

Definition at line 642 of file gl_rsurf.c.

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

Referenced by R_DrawWorld().

◆ GL_BeginBuildingLightmaps()

void GL_BeginBuildingLightmaps ( model_t m)

Definition at line 1572 of file gl_rsurf.c.

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

Referenced by Mod_LoadFaces().

◆ GL_BuildPolygonFromSurface()

void GL_BuildPolygonFromSurface ( msurface_t fa)

Definition at line 1457 of file gl_rsurf.c.

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

Referenced by Mod_LoadFaces().

◆ GL_CreateSurfaceLightmap()

void GL_CreateSurfaceLightmap ( msurface_t surf)

Definition at line 1535 of file gl_rsurf.c.

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

Referenced by Mod_LoadFaces().

◆ GL_EndBuildingLightmaps()

void GL_EndBuildingLightmaps ( void  )

Definition at line 1665 of file gl_rsurf.c.

1666 {
1667  LM_UploadBlock( false );
1668  GL_EnableMultitexture( false );
1669 }

Referenced by Mod_LoadFaces().

◆ GL_RenderLightmappedPoly()

static void GL_RenderLightmappedPoly ( msurface_t surf)
static

Definition at line 710 of file gl_rsurf.c.

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

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 1418 of file gl_rsurf.c.

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

Referenced by GL_CreateSurfaceLightmap(), and R_BlendLightmaps().

◆ LM_InitBlock()

static void LM_InitBlock ( void  )
static

Definition at line 1361 of file gl_rsurf.c.

1362 {
1363  memset( gl_lms.allocated, 0, sizeof( gl_lms.allocated ) );
1364 }

Referenced by GL_CreateSurfaceLightmap(), and R_BlendLightmaps().

◆ LM_UploadBlock()

static void LM_UploadBlock ( qboolean  dynamic)
static

Definition at line 1366 of file gl_rsurf.c.

1367 {
1368  int texture;
1369  int height = 0;
1370 
1371  if ( dynamic )
1372  {
1373  texture = 0;
1374  }
1375  else
1376  {
1378  }
1379 
1381  qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
1382  qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
1383 
1384  if ( dynamic )
1385  {
1386  int i;
1387 
1388  for ( i = 0; i < BLOCK_WIDTH; i++ )
1389  {
1390  if ( gl_lms.allocated[i] > height )
1391  height = gl_lms.allocated[i];
1392  }
1393 
1394  qglTexSubImage2D( GL_TEXTURE_2D,
1395  0,
1396  0, 0,
1399  GL_UNSIGNED_BYTE,
1401  }
1402  else
1403  {
1404  qglTexImage2D( GL_TEXTURE_2D,
1405  0,
1408  0,
1410  GL_UNSIGNED_BYTE,
1413  ri.Sys_Error( ERR_DROP, "LM_UploadBlock() - MAX_LIGHTMAPS exceeded\n" );
1414  }
1415 }

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

◆ R_BlendLightmaps()

void R_BlendLightmaps ( void  )

Definition at line 323 of file gl_rsurf.c.

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

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 595 of file gl_rsurf.c.

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

Referenced by R_RenderFrame(), and R_RenderView().

◆ R_DrawBrushModel()

void R_DrawBrushModel ( entity_t e)

Definition at line 964 of file gl_rsurf.c.

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

Referenced by R_DrawEntitiesOnList().

◆ R_DrawInlineBModel()

void R_DrawInlineBModel ( void  )

Definition at line 887 of file gl_rsurf.c.

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

Referenced by R_DrawBrushModel().

◆ R_DrawTriangleOutlines()

void R_DrawTriangleOutlines ( void  )

Definition at line 230 of file gl_rsurf.c.

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

Referenced by R_DrawWorld().

◆ R_DrawWorld()

void R_DrawWorld ( void  )

Definition at line 1204 of file gl_rsurf.c.

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

Referenced by R_RenderView().

◆ R_MarkLeaves()

void R_MarkLeaves ( void  )

Definition at line 1272 of file gl_rsurf.c.

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

◆ R_RecursiveWorldNode()

void R_RecursiveWorldNode ( mnode_t node)

Definition at line 1043 of file gl_rsurf.c.

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

Referenced by R_DrawWorld().

◆ R_RenderBrushPoly()

void R_RenderBrushPoly ( msurface_t fa)

Definition at line 485 of file gl_rsurf.c.

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

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 83 of file gl_rsurf.c.

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

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

Variable Documentation

◆ c_visible_lightmaps

int c_visible_lightmaps

Definition at line 39 of file gl_rsurf.c.

Referenced by R_BlendLightmaps(), and R_RenderView().

◆ c_visible_textures

int c_visible_textures

Definition at line 40 of file gl_rsurf.c.

Referenced by DrawTextureChains(), and R_RenderView().

◆ gl_lms

◆ modelorg

vec3_t modelorg
static

Definition at line 25 of file gl_rsurf.c.

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

◆ r_alpha_surfaces

RF_TRANSLUCENT
#define RF_TRANSLUCENT
Definition: q_shared.h:618
MAX_MAP_LEAFS
#define MAX_MAP_LEAFS
Definition: qfiles.h:239
nummaps
static int nummaps
Definition: menu.c:2439
cplane_s::normal
vec3_t normal
Definition: q_shared.h:411
msurface_s::dlight_s
int dlight_s
Definition: gl_model.h:109
refdef_t::vieworg
float vieworg[3]
Definition: ref.h:124
numgltextures
int numgltextures
Definition: gl_image.c:24
cplane_s::type
byte type
Definition: q_shared.h:413
height
GLsizei height
Definition: qgl_win.c:69
currentmodel
model_t * currentmodel
Definition: r_main.c:37
r_framecount
int r_framecount
Definition: r_main.c:91
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:220
lightstyle_t::rgb
float rgb[3]
Definition: ref.h:116
r_novis
cvar_t * r_novis
Definition: r_main.c:131
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:156
gl_modulate
cvar_t * gl_modulate
Definition: gl_rmain.c:113
model_s::nummodelsurfaces
int nummodelsurfaces
Definition: r_model.h:196
gl_state
glstate_t gl_state
Definition: gl_rmain.c:36
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:35
glstate_t::currenttextures
int currenttextures[2]
Definition: gl_local.h:426
GL_MBind
void GL_MBind(GLenum target, int texnum)
Definition: gl_image.c:148
refdef_t::areabits
byte * areabits
Definition: ref.h:130
v
GLdouble v
Definition: qgl_win.c:143
gl_dynamic
cvar_t * gl_dynamic
Definition: gl_rmain.c:111
glpoly_s::verts
float verts[4][VERTEXSIZE]
Definition: gl_model.h:92
modelorg
static vec3_t modelorg
Definition: gl_rsurf.c:25
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:320
qboolean
qboolean
Definition: q_shared.h:56
x
GLint GLenum GLint x
Definition: qgl_win.c:116
VectorClear
#define VectorClear(a)
Definition: q_shared.h:159
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:126
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:126
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:731
refdef_t::rdflags
int rdflags
Definition: ref.h:128
msurface_s::samples
byte * samples
Definition: r_model.h:116
R_TextureAnimation
image_t * R_TextureAnimation(mtexinfo_t *tex)
Definition: gl_rsurf.c:83
r_visframecount
int r_visframecount
Definition: r_main.c:92
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:27
image_s::registration_sequence
int registration_sequence
Definition: r_local.h:71
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
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:102
j
GLint j
Definition: qgl_win.c:150
msurface_s::plane
mplane_t * plane
Definition: r_model.h:100
mvertex_t::position
vec3_t position
Definition: r_model.h:47
gl_tex_alpha_format
int gl_tex_alpha_format
Definition: gl_image.c:42
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:23
mtexinfo_s::image
image_t * image
Definition: r_model.h:87
R_DrawInlineBModel
void R_DrawInlineBModel(void)
Definition: gl_rsurf.c:887
GL_EnableMultitexture
void GL_EnableMultitexture(qboolean enable)
Definition: gl_image.c:70
RDF_NOWORLDMODEL
#define RDF_NOWORLDMODEL
Definition: q_shared.h:646
mnode_s::plane
mplane_t * plane
Definition: r_model.h:134
LM_InitBlock
static void LM_InitBlock(void)
Definition: gl_rsurf.c:1361
numleafs
int numleafs
Definition: cmodel.c:77
R_BlendLightmaps
void R_BlendLightmaps(void)
Definition: gl_rsurf.c:323
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:69
R_DrawTriangleOutlines
void R_DrawTriangleOutlines(void)
Definition: gl_rsurf.c:230
refdef_t::num_dlights
int num_dlights
Definition: ref.h:137
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:32
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:102
LM_AllocBlock
static qboolean LM_AllocBlock(int w, int h, int *x, int *y)
Definition: gl_rsurf.c:1418
PLANE_Y
#define PLANE_Y
Definition: qfiles.h:308
refimport_t::Sys_Error
void(* Sys_Error)(int err_level, char *str,...)
Definition: ref.h:220
SURF_DRAWSKY
#define SURF_DRAWSKY
Definition: r_model.h:69
GL_Bind
void GL_Bind(int texnum)
Definition: gl_image.c:136
SURF_FLOWING
#define SURF_FLOWING
Definition: qfiles.h:375
msurface_s::texturechain
struct msurface_s * texturechain
Definition: gl_model.h:112
r_newrefdef
refdef_t r_newrefdef
Definition: r_main.c:36
DotProduct
#define DotProduct(x, y)
Definition: q_shared.h:155
SURF_TRANS33
#define SURF_TRANS33
Definition: qfiles.h:373
r_worldmodel
model_t * r_worldmodel
Definition: r_main.c:39
cvar_s::value
float value
Definition: q_shared.h:324
cplane_s::dist
float dist
Definition: q_shared.h:412
BLOCK_WIDTH
#define BLOCK_WIDTH
Definition: gl_rsurf.c:34
model_s::lightdata
byte * lightdata
Definition: r_model.h:231
gl_lightmap
cvar_t * gl_lightmap
Definition: gl_rmain.c:107
c_visible_textures
int c_visible_textures
Definition: gl_rsurf.c:40
TEXNUM_LIGHTMAPS
#define TEXNUM_LIGHTMAPS
Definition: gl_local.h:110
SURF_DRAWTURB
#define SURF_DRAWTURB
Definition: r_model.h:70
DrawGLFlowingPoly
void DrawGLFlowingPoly(msurface_t *fa)
Definition: gl_rsurf.c:202
r_viewcluster2
int r_viewcluster2
Definition: gl_local.h:181
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:271
NULL
#define NULL
Definition: q_shared.h:60
refdef_t::time
float time
Definition: ref.h:127
gllightmapstate_t::lightmap_buffer
byte lightmap_buffer[4 *BLOCK_WIDTH *BLOCK_HEIGHT]
Definition: gl_rsurf.c:55
glstate_t::inverse_intensity
float inverse_intensity
Definition: gl_local.h:417
model_s::surfedges
int * surfedges
Definition: r_model.h:224
gl_flashblend
cvar_t * gl_flashblend
Definition: gl_rmain.c:124
mleaf_s::nummarksurfaces
int nummarksurfaces
Definition: r_model.h:158
image_s::width
int width
Definition: r_local.h:69
gllightmapstate_t::current_lightmap_texture
int current_lightmap_texture
Definition: gl_rsurf.c:47
QGL_TEXTURE0
int QGL_TEXTURE0
Definition: gl_rmain.c:29
ERR_DROP
#define ERR_DROP
Definition: qcommon.h:736
GL_RenderLightmappedPoly
static void GL_RenderLightmappedPoly(msurface_t *surf)
Definition: gl_rsurf.c:710
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:735
QGL_TEXTURE1
int QGL_TEXTURE1
Definition: gl_rmain.c:29
msurface_s::flags
int flags
Definition: r_model.h:101
lightstyle_t
Definition: ref.h:114
VectorAdd
#define VectorAdd(a, b, c)
Definition: q_shared.h:157
model_s::maxs
vec3_t maxs
Definition: r_model.h:185
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:485
msurface_s::polys
glpoly_t * polys
Definition: gl_model.h:111
gl_lms
static gllightmapstate_t gl_lms
Definition: gl_rsurf.c:58
image_s::texturechain
struct msurface_s * texturechain
Definition: gl_local.h:101
entity_s::frame
int frame
Definition: ref.h:58
gllightmapstate_t::lightmap_surfaces
msurface_t * lightmap_surfaces[MAX_LIGHTMAPS]
Definition: gl_rsurf.c:49
R_RecursiveWorldNode
void R_RecursiveWorldNode(mnode_t *node)
Definition: gl_rsurf.c:1043
VectorCopy
#define VectorCopy(a, b)
Definition: q_shared.h:158
MAX_LIGHTMAPS
#define MAX_LIGHTMAPS
Definition: gl_rsurf.c:37
gl_tex_solid_format
int gl_tex_solid_format
Definition: gl_image.c:41
refdef_t::lightstyles
lightstyle_t * lightstyles
Definition: ref.h:132
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:181
R_CullBox
qboolean R_CullBox(vec3_t mins, vec3_t maxs)
Definition: gl_rmain.c:146
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:84
entity_s
Definition: ref.h:49
GL_TexEnv
void GL_TexEnv(GLenum mode)
Definition: gl_image.c:125
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
DrawTextureChains
void DrawTextureChains(void)
Definition: gl_rsurf.c:642
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:180
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:118
refdef_t::dlights
dlight_t * dlights
Definition: ref.h:138
glstate_t::lightmap_textures
int lightmap_textures
Definition: gl_local.h:424
R_RotateForEntity
void R_RotateForEntity(entity_t *e)
Definition: gl_rmain.c:160
msurface_s::cached_light
float cached_light[MAXLIGHTMAPS]
Definition: gl_model.h:123
mnode_s::minmaxs
short minmaxs[6]
Definition: r_model.h:129
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:117
w
GLdouble GLdouble GLdouble w
Definition: qgl_win.c:291
right
GLdouble right
Definition: qgl_win.c:159
image_s
Definition: r_local.h:65
r_world_matrix
float r_world_matrix[16]
Definition: gl_rmain.c:63
GL_LIGHTMAP_FORMAT
#define GL_LIGHTMAP_FORMAT
Definition: gl_rsurf.c:42
glpoly_s::flags
int flags
Definition: gl_model.h:91
cplane_s
Definition: q_shared.h:409
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:129
model_s::vertexes
mvertex_t * vertexes
Definition: r_model.h:208
c_brush_polys
int c_brush_polys
Definition: gl_rmain.c:49
gl_lockpvs
cvar_t * gl_lockpvs
Definition: gl_rmain.c:131
GL_SelectTexture
void GL_SelectTexture(GLenum texture)
Definition: gl_image.c:91
gllightmapstate_t::internal_format
int internal_format
Definition: gl_rsurf.c:46
MAX_LIGHTSTYLES
#define MAX_LIGHTSTYLES
Definition: q_shared.h:81
c_visible_lightmaps
int c_visible_lightmaps
Definition: gl_rsurf.c:39
msurface_s::lightmapchain
struct msurface_s * lightmapchain
Definition: gl_model.h:113
Mod_ClusterPVS
byte * Mod_ClusterPVS(int cluster, model_t *model)
Definition: r_model.c:268
gl_monolightmap
cvar_t * gl_monolightmap
Definition: gl_rmain.c:112
vec3_t
vec_t vec3_t[3]
Definition: q_shared.h:127
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:1366
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:51
glpoly_s
Definition: gl_model.h:86