icculus quake2 doxygen
1.0 dev
|
|
Go to the documentation of this file.
29 #define DYNAMIC_LIGHT_WIDTH 128
30 #define DYNAMIC_LIGHT_HEIGHT 128
32 #define LIGHTMAP_BYTES 4
34 #define BLOCK_WIDTH 128
35 #define BLOCK_HEIGHT 128
37 #define MAX_LIGHTMAPS 128
42 #define GL_LIGHTMAP_FORMAT GL_RGBA
149 qglBegin (GL_TRIANGLE_FAN);
153 qglTexCoord2f (
v[3],
v[4]);
158 void DrawGLWaterPolyLightmap (
glpoly_t *p)
164 qglBegin (GL_TRIANGLE_FAN);
168 qglTexCoord2f (
v[5],
v[6]);
185 qglBegin (GL_POLYGON);
189 qglTexCoord2f (
v[3],
v[4]);
215 qglBegin (GL_POLYGON);
219 qglTexCoord2f ((
v[3] + scroll),
v[4]);
238 qglDisable (GL_TEXTURE_2D);
239 qglDisable (GL_DEPTH_TEST);
240 qglColor4f (1,1,1,1);
249 for ( ; p ; p=p->
chain)
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]);
264 qglEnable (GL_DEPTH_TEST);
265 qglEnable (GL_TEXTURE_2D);
273 if ( soffset == 0 && toffset == 0 )
275 for ( ; p != 0; p = p->
chain )
286 fprintf(stderr,
"BUGFIX: DrawGLPolyChain: v==NULL\n");
289 qglBegin (GL_POLYGON);
292 qglTexCoord2f (
v[5],
v[6] );
300 for ( ; p != 0; p = p->
chain )
305 qglBegin (GL_POLYGON);
309 qglTexCoord2f (
v[5] - soffset,
v[6] - toffset );
343 qglEnable (GL_BLEND);
347 qglBlendFunc( GL_ONE, GL_ONE );
356 qglBlendFunc (GL_ZERO, GL_SRC_COLOR );
359 qglBlendFunc (GL_ZERO, GL_SRC_COLOR );
363 qglBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
369 qglBlendFunc (GL_ZERO, GL_SRC_COLOR );
415 smax = (surf->
extents[0]>>4)+1;
416 tmax = (surf->
extents[1]>>4)+1;
433 for ( drawsurf = newdrawsurf; drawsurf != surf; drawsurf = drawsurf->
lightmapchain )
435 if ( drawsurf->
polys )
441 newdrawsurf = drawsurf;
449 ri.
Sys_Error(
ERR_FATAL,
"Consecutive calls to LM_AllocBlock(%d,%d) failed (dynamic)\n", smax, tmax );
465 for ( surf = newdrawsurf; surf != 0; surf = surf->
lightmapchain )
475 qglDisable (GL_BLEND);
476 qglBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
552 unsigned temp[34*34];
563 qglTexSubImage2D( GL_TEXTURE_2D, 0,
567 GL_UNSIGNED_BYTE, temp );
605 qglEnable (GL_BLEND);
617 qglColor4f (intens,intens,intens,0.33);
619 qglColor4f (intens,intens,intens,0.66);
621 qglColor4f (intens,intens,intens,1);
631 qglColor4f (1,1,1,1);
632 qglDisable (GL_BLEND);
652 if ( !qglSelectTextureSGIS && !qglActiveTextureARB )
741 unsigned temp[128*128];
746 smax = (surf->
extents[0]>>4)+1;
747 tmax = (surf->
extents[1]>>4)+1;
756 qglTexSubImage2D( GL_TEXTURE_2D, 0,
760 GL_UNSIGNED_BYTE, temp );
765 smax = (surf->
extents[0]>>4)+1;
766 tmax = (surf->
extents[1]>>4)+1;
774 qglTexSubImage2D( GL_TEXTURE_2D, 0,
778 GL_UNSIGNED_BYTE, temp );
800 qglBegin (GL_POLYGON);
815 qglBegin (GL_POLYGON);
848 qglBegin (GL_POLYGON);
865 qglBegin (GL_POLYGON);
909 qglEnable (GL_BLEND);
910 qglColor4f (1,1,1,0.25);
920 pplane = psurf->
plane;
948 if ( !qglMTexCoord2fSGIS )
953 qglDisable (GL_BLEND);
954 qglColor4f (1,1,1,1);
979 for (
i=0 ;
i<3 ;
i++)
1045 int c, side, sidebit;
1090 plane = node->
plane;
1092 switch (plane->
type)
1219 memset (&ent, 0,
sizeof(ent));
1229 if ( qglMTexCoord2fSGIS )
1310 for (
i=0 ;
i<c ;
i++)
1311 ((
int *)fatvis)[
i] |= ((
int *)vis)[
i];
1320 if (vis[cluster>>3] & (1<<(cluster&7)))
1336 if (vis[
i>>3] & (1<<(
i&7)))
1381 qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
1382 qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
1394 qglTexSubImage2D( GL_TEXTURE_2D,
1404 qglTexImage2D( GL_TEXTURE_2D,
1429 for (
j=0 ;
j<
w ;
j++)
1446 for (
i=0 ;
i<
w ;
i++)
1459 int i, lindex, lnumverts;
1482 for (
i=0 ;
i<lnumverts ;
i++)
1543 smax = (surf->
extents[0]>>4)+1;
1544 tmax = (surf->
extents[1]>>4)+1;
1576 unsigned dummy[128*128];
1591 lightstyles[
i].
rgb[0] = 1;
1592 lightstyles[
i].
rgb[1] = 1;
1593 lightstyles[
i].
rgb[2] = 1;
1594 lightstyles[
i].
white = 3;
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,
byte styles[MAXLIGHTMAPS]
CONST PIXELFORMATDESCRIPTOR int
#define VectorSubtract(a, b, c)
void R_DrawAlphaSurfaces(void)
void GL_MBind(GLenum target, int texnum)
float verts[4][VERTEXSIZE]
cvar_t * gl_saturatelighting
msurface_t ** firstmarksurface
image_t * R_TextureAnimation(mtexinfo_t *tex)
struct mnode_s * children[2]
msurface_t * r_alpha_surfaces
int registration_sequence
void R_MarkLights(dlight_t *light, int bit, mnode_t *node)
void AngleVectors(vec3_t angles, vec3_t forward, vec3_t right, vec3_t up)
image_t gltextures[MAX_GLTEXTURES]
void R_DrawInlineBModel(void)
void GL_EnableMultitexture(qboolean enable)
static void LM_InitBlock(void)
void R_BlendLightmaps(void)
void R_DrawTriangleOutlines(void)
void R_AddSkySurface(msurface_t *fa)
static qboolean LM_AllocBlock(int w, int h, int *x, int *y)
void(* Sys_Error)(int err_level, char *str,...)
struct msurface_s * texturechain
void DrawGLFlowingPoly(msurface_t *fa)
void DrawGLPolyChain(glpoly_t *p, float soffset, float toffset)
byte lightmap_buffer[4 *BLOCK_WIDTH *BLOCK_HEIGHT]
int current_lightmap_texture
static void GL_RenderLightmappedPoly(msurface_t *surf)
#define VectorAdd(a, b, c)
void R_RenderBrushPoly(msurface_t *fa)
static gllightmapstate_t gl_lms
struct msurface_s * texturechain
msurface_t * lightmap_surfaces[MAX_LIGHTMAPS]
void R_RecursiveWorldNode(mnode_t *node)
lightstyle_t * lightstyles
glpoly_t * WaterWarpPolyVerts(glpoly_t *p)
qboolean R_CullBox(vec3_t mins, vec3_t maxs)
unsigned short firstsurface
void EmitWaterPolys(msurface_t *fa)
void GL_TexEnv(GLenum mode)
void DrawTextureChains(void)
void GL_BuildPolygonFromSurface(msurface_t *fa)
void DrawGLPoly(glpoly_t *p)
void GL_CreateSurfaceLightmap(msurface_t *surf)
void R_RotateForEntity(entity_t *e)
float cached_light[MAXLIGHTMAPS]
GLdouble GLdouble GLdouble w
#define GL_LIGHTMAP_FORMAT
void R_BuildLightMap(msurface_t *surf, byte *dest, int stride)
void R_SetCacheState(msurface_t *surf)
unsigned short numsurfaces
void GL_SelectTexture(GLenum texture)
void R_DrawBrushModel(entity_t *e)
struct msurface_s * lightmapchain
byte * Mod_ClusterPVS(int cluster, model_t *model)
void * Hunk_Alloc(int size)
static void LM_UploadBlock(qboolean dynamic)
void GL_BeginBuildingLightmaps(model_t *m)
int allocated[BLOCK_WIDTH]
void GL_EndBuildingLightmaps(void)