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()
{
}
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();
glDisable(GL_ALPHA_TEST);
}
-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++)
{