Go to the documentation of this file.
33 #define SUBDIVIDE_SIZE 64
41 mins[0] = mins[1] = mins[2] = 9999;
42 maxs[0] = maxs[1] = maxs[2] = -9999;
44 for (
i=0 ;
i<numverts ;
i++)
45 for (
j=0 ;
j<3 ;
j++,
v++)
60 vec3_t front[64], back[64];
67 float total_s, total_t;
76 m = (mins[
i] + maxs[
i]) * 0.5;
85 for (
j=0 ;
j<numverts ;
j++,
v+= 3)
95 for (
j=0 ;
j<numverts ;
j++,
v+= 3)
107 if (dist[
j] == 0 || dist[
j+1] == 0)
109 if ( (dist[
j] > 0) != (dist[
j+1] > 0) )
112 frac = dist[
j] / (dist[
j] - dist[
j+1]);
113 for (k=0 ; k<3 ; k++)
114 front[f][k] = back[b][k] =
v[k] + frac*(
v[3+k] -
v[k]);
133 for (
i=0 ;
i<numverts ;
i++, verts+= 3)
148 poly->
verts[0][3] = total_s/numverts;
149 poly->
verts[0][4] = total_t/numverts;
202 #define TURBSCALE (256.0 / (2 * M_PI))
228 qglBegin (GL_TRIANGLE_FAN);
249 qglTexCoord2f (
s,
t);
315 glBegin (GL_POLYGON);
316 for (
i=0 ;
i<nump ;
i++, vecs+=3)
326 for (
i=0, vp=vecs ;
i<nump ;
i++, vp+=3)
333 if (av[0] > av[1] && av[0] > av[2])
340 else if (av[1] > av[2] && av[1] > av[0])
356 for (
i=0 ;
i<nump ;
i++, vecs+=3)
367 s = -vecs[-
j -1] /
dv;
372 t = -vecs[-
j -1] /
dv;
387 #define ON_EPSILON 0.1 // point on plane side epsilon
388 #define MAX_CLIP_VERTS 64
409 front = back =
false;
411 for (
i=0,
v = vecs ;
i<nump ;
i++,
v+=3)
439 newc[0] = newc[1] = 0;
441 for (
i=0,
v = vecs ;
i<nump ;
i++,
v+=3)
464 d = dists[
i] / (dists[
i] - dists[
i+1]);
465 for (
j=0 ;
j<3 ;
j++)
467 e =
v[
j] + d*(
v[
j+3] -
v[
j]);
468 newv[0][newc[0]][
j] = e;
469 newv[1][newc[1]][
j] = e;
512 for (
i=0 ;
i<6 ;
i++)
529 for (
j=0 ;
j<3 ;
j++)
552 qglTexCoord2f (
s,
t);
567 qglEnable (GL_BLEND);
569 qglColor4f (1,1,1,0.5);
570 qglDisable (GL_DEPTH_TEST);
574 for (
i=0 ;
i<6 ;
i++)
586 for (
i=0 ;
i<6 ;
i++)
611 glDisable (GL_BLEND);
612 glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
613 glColor4f (1,1,1,0.5);
614 glEnable (GL_DEPTH_TEST);
625 char *
suf[6] = {
"rt",
"bk",
"lf",
"ft",
"up",
"dn"};
635 for (
i=0 ;
i<6 ;
i++)
CONST PIXELFORMATDESCRIPTOR int
#define VectorSubtract(a, b, c)
void MakeSkyVec(float s, float t, int axis)
void EmitWaterPolys(msurface_t *fa)
float verts[4][VERTEXSIZE]
void VectorScale(vec3_t in, vec_t scale, vec3_t out)
image_t * GL_FindImage(char *name, imagetype_t type)
void GL_SubdivideSurface(msurface_t *fa)
void(* Sys_Error)(int err_level, char *str,...)
void ClipSkyPolygon(int nump, vec3_t vecs, int stage)
#define VectorAdd(a, b, c)
void DrawSkyPolygon(int nump, vec3_t vecs)
void R_AddSkySurface(msurface_t *fa)
void GL_TexEnv(GLenum mode)
void SubdividePolygon(int numverts, float *verts)
void BoundPoly(int numverts, float *verts, vec3_t mins, vec3_t maxs)
void R_SetSky(char *name, float rotate, vec3_t axis)
void * Hunk_Alloc(int size)
void Com_sprintf(char *dest, int size, char *fmt,...)