float transreciptable[256];
-void glpoly_init()
+void gl_poly_start()
{
int i;
- Cvar_RegisterVariable (&gl_multitexture);
- Cvar_RegisterVariable (&gl_vertexarrays);
- transvert = malloc(MAX_TRANSVERTS * sizeof(transvert_t));
- transpoly = malloc(MAX_TRANSPOLYS * sizeof(transpoly_t));
- transpolyindex = malloc(MAX_TRANSPOLYS * sizeof(unsigned short));
- wallvert = malloc(MAX_WALLVERTS * sizeof(wallvert_t));
- wallpoly = malloc(MAX_WALLPOLYS * sizeof(wallpoly_t));
- skyvert = malloc(MAX_SKYVERTS * sizeof(skyvert_t));
- skypoly = malloc(MAX_SKYPOLYS * sizeof(skypoly_t));
+ transvert = qmalloc(MAX_TRANSVERTS * sizeof(transvert_t));
+ transpoly = qmalloc(MAX_TRANSPOLYS * sizeof(transpoly_t));
+ transpolyindex = qmalloc(MAX_TRANSPOLYS * sizeof(unsigned short));
+ wallvert = qmalloc(MAX_WALLVERTS * sizeof(wallvert_t));
+ wallpoly = qmalloc(MAX_WALLPOLYS * sizeof(wallpoly_t));
+ skyvert = qmalloc(MAX_SKYVERTS * sizeof(skyvert_t));
+ skypoly = qmalloc(MAX_SKYPOLYS * sizeof(skypoly_t));
transreciptable[0] = 0.0f;
for (i = 1;i < 256;i++)
transreciptable[i] = 1.0f / i;
}
+void gl_poly_shutdown()
+{
+ qfree(transvert);
+ qfree(transpoly);
+ qfree(transpolyindex);
+ qfree(wallvert);
+ qfree(wallpoly);
+ qfree(skyvert);
+ qfree(skypoly);
+}
+
+void GL_Poly_Init()
+{
+ Cvar_RegisterVariable (&gl_multitexture);
+ Cvar_RegisterVariable (&gl_vertexarrays);
+ R_RegisterModule("GL_Poly", gl_poly_start, gl_poly_shutdown);
+}
void transpolyclear()
{
transviewdist = DotProduct(r_refdef.vieworg, vpn);
}
+// turned into a #define
+/*
void transpolybegin(int texnum, int glowtexnum, int fogtexnum, int transpolytype)
{
if (currenttranspoly >= MAX_TRANSPOLYS || currenttransvert >= MAX_TRANSVERTS)
transpoly[currenttranspoly].verts = 0;
// transpoly[currenttranspoly].ndist = 0; // clear the normal
}
+*/
// turned into a #define
/*
}
int transpolyindices;
-extern qboolean isG200;
/*
void transpolyrenderminmax()
{
int i, j, tpolytype, texnum;
transpoly_t *p;
+ if (!r_render.value)
+ return;
if (currenttranspoly < 1)
return;
// transpolyrenderminmax();
glEnable(GL_ALPHA_TEST);
else
glDisable(GL_ALPHA_TEST);
- // later note: wasn't working on my TNT drivers... strangely... used a cheaper hack in transpolyvert
- //// offset by 16 depth units so decal sprites appear infront of walls
- //glPolygonOffset(1, -16);
- //glEnable(GL_POLYGON_OFFSET_FILL);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
tpolytype = TPOLYTYPE_ALPHA;
texnum = -1;
glEnd();
}
- //glDisable(GL_POLYGON_OFFSET_FILL);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glDepthMask(1); // enable zbuffer updates
glDisable(GL_ALPHA_TEST);
}
-/*
-void lightpolybegin(int texnum)
-{
- if (currentlightpoly >= MAX_LIGHTPOLYS || currentlightvert >= MAX_LIGHTVERTS)
- return;
- lightpoly[currentlightpoly].texnum = (unsigned short) texnum;
- lightpoly[currentlightpoly].firstvert = currentlightvert;
- lightpoly[currentlightpoly].verts = 0;
-}
-
-// lightpolyvert is a #define
-
-void lightpolyend()
-{
- if (currentlightpoly >= MAX_LIGHTPOLYS)
- return;
- if (lightpoly[currentlightpoly].verts < 3) // skip invalid polygons
- {
- currentlightvert = lightpoly[currentlightpoly].firstvert; // reset vert pointer
- return;
- }
- if (currentlightvert >= MAX_LIGHTVERTS)
- return;
- currentlightpoly++;
-}
-*/
-
-extern qboolean isG200;
-
void wallpolyclear()
{
currentwallpoly = currentwallvert = 0;
}
-extern qboolean lighthalf;
void wallpolyrender()
{
int i, j, texnum, lighttexnum;
wallpoly_t *p;
wallvert_t *vert;
+ if (!r_render.value)
+ return;
if (currentwallpoly < 1)
return;
c_brush_polys += currentwallpoly;
currentskypoly = currentskyvert = 0;
}
-extern qboolean isATI;
-
extern char skyname[];
extern int solidskytexture, alphaskytexture;
void skypolyrender()
skyvert_t *vert;
float length, speedscale;
vec3_t dir;
+ if (!r_render.value)
+ return;
if (currentskypoly < 1)
return;
// testing
glDepthMask(1);
if (!fogenabled && !skyname[0]) // normal quake sky
{
- glColor3f(0.5f, 0.5f, 0.5f);
+ if(lighthalf)
+ glColor3f(0.5f, 0.5f, 0.5f);
+ else
+ glColor3f(1.0f,1.0f,1.0f);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glEnable(GL_TEXTURE_2D);
glDisable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glBindTexture(GL_TEXTURE_2D, solidskytexture); // upper clouds
- speedscale = realtime*8;
+ speedscale = cl.time*8;
speedscale -= (int)speedscale & ~127 ;
for (i = 0,p = &skypoly[0];i < currentskypoly;i++, p++)
{
glEnable(GL_BLEND);
glDepthMask(0);
glBindTexture(GL_TEXTURE_2D, alphaskytexture); // lower clouds
- speedscale = realtime*16;
+ speedscale = cl.time*16;
speedscale -= (int)speedscale & ~127 ;
for (i = 0,p = &skypoly[0];i < currentskypoly;i++, p++)
{