removed the duplicated water code since I removed the water warp. We can

do a better effect later.
This commit is contained in:
Joseph Carter 2000-06-15 08:56:49 +00:00
parent c6d9fea93c
commit 1161fee40b

View file

@ -336,9 +336,6 @@ extern int solidskytexture;
extern int alphaskytexture; extern int alphaskytexture;
extern float speedscale; // for top sky and bottom sky extern float speedscale; // for top sky and bottom sky
void DrawGLWaterPoly (glpoly_t *p);
void DrawGLWaterPolyLightmap (glpoly_t *p);
lpMTexFUNC qglMTexCoord2f = NULL; lpMTexFUNC qglMTexCoord2f = NULL;
lpSelTexFUNC qglSelectTexture = NULL; lpSelTexFUNC qglSelectTexture = NULL;
@ -378,14 +375,13 @@ void R_DrawSequentialPoly (msurface_t *s)
float *v; float *v;
int i; int i;
texture_t *t; texture_t *t;
vec3_t nv;
glRect_t *theRect; glRect_t *theRect;
// //
// normal lightmaped poly // normal lightmaped poly
// //
if (! (s->flags & (SURF_DRAWSKY|SURF_DRAWTURB|SURF_UNDERWATER) ) ) if (! (s->flags & (SURF_DRAWSKY|SURF_DRAWTURB/*|SURF_UNDERWATER*/) ) )
{ {
R_RenderDynamicLightmaps (s); R_RenderDynamicLightmaps (s);
if (gl_mtexable) if (gl_mtexable)
@ -457,139 +453,12 @@ void R_DrawSequentialPoly (msurface_t *s)
if (s->flags & SURF_DRAWTURB) if (s->flags & SURF_DRAWTURB)
{ {
GL_DisableMultitexture();
glBindTexture (GL_TEXTURE_2D, s->texinfo->texture->gl_texturenum);
EmitWaterPolys (s); EmitWaterPolys (s);
return; return;
} }
//
// subdivided sky warp
//
if (s->flags & SURF_DRAWSKY)
{
// GL_DisableMultitexture();
// glBindTexture (GL_TEXTURE_2D, solidskytexture);
// speedscale = realtime*8;
// speedscale -= (int)speedscale & ~127;
// EmitSkyPolys (s);
// glBindTexture (GL_TEXTURE_2D, alphaskytexture);
// speedscale = realtime*16;
// speedscale -= (int)speedscale & ~127;
// EmitSkyPolys (s);
return;
}
//
// underwater warped with lightmap
//
R_RenderDynamicLightmaps (s);
if (gl_mtexable)
{
p = s->polys;
t = R_TextureAnimation (s->texinfo->texture);
GL_SelectTexture(0);
glBindTexture (GL_TEXTURE_2D, t->gl_texturenum);
GL_EnableMultitexture();
glBindTexture (GL_TEXTURE_2D, lightmap_textures + s->lightmaptexturenum);
i = s->lightmaptexturenum;
if (lightmap_modified[i])
{
lightmap_modified[i] = false;
theRect = &lightmap_rectchange[i];
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, theRect->t,
BLOCK_WIDTH, theRect->h, gl_lightmap_format, GL_UNSIGNED_BYTE,
lightmaps+(i* BLOCK_HEIGHT + theRect->t) *BLOCK_WIDTH*lightmap_bytes);
theRect->l = BLOCK_WIDTH;
theRect->t = BLOCK_HEIGHT;
theRect->h = 0;
theRect->w = 0;
}
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glBegin (GL_TRIANGLE_FAN);
v = p->verts[0];
for (i=0 ; i<p->numverts ; i++, v+= VERTEXSIZE)
{
qglMTexCoord2f (gl_mtex_enum + 0, v[3], v[4]);
qglMTexCoord2f (gl_mtex_enum + 1, v[5], v[6]);
nv[0] = v[0] + 8*sin(v[1]*0.05+realtime)*sin(v[2]*0.05+realtime);
nv[1] = v[1] + 8*sin(v[0]*0.05+realtime)*sin(v[2]*0.05+realtime);
nv[2] = v[2];
glVertex3fv (nv);
}
glEnd ();
} else {
p = s->polys;
t = R_TextureAnimation (s->texinfo->texture);
glBindTexture (GL_TEXTURE_2D, t->gl_texturenum);
DrawGLWaterPoly (p);
glBindTexture (GL_TEXTURE_2D, lightmap_textures + s->lightmaptexturenum);
DrawGLWaterPolyLightmap (p);
}
} }
/*
================
DrawGLWaterPoly
Warp the vertex coordinates
================
*/
void DrawGLWaterPoly (glpoly_t *p)
{
int i;
float *v;
vec3_t nv;
GL_DisableMultitexture();
glBegin (GL_TRIANGLE_FAN);
v = p->verts[0];
for (i=0 ; i<p->numverts ; i++, v+= VERTEXSIZE)
{
glTexCoord2f (v[3], v[4]);
nv[0] = v[0] + 8*sin(v[1]*0.05+realtime)*sin(v[2]*0.05+realtime);
nv[1] = v[1] + 8*sin(v[0]*0.05+realtime)*sin(v[2]*0.05+realtime);
nv[2] = v[2];
glVertex3fv (nv);
}
glEnd ();
}
void DrawGLWaterPolyLightmap (glpoly_t *p)
{
int i;
float *v;
vec3_t nv;
GL_DisableMultitexture();
glBegin (GL_TRIANGLE_FAN);
v = p->verts[0];
for (i=0 ; i<p->numverts ; i++, v+= VERTEXSIZE)
{
glTexCoord2f (v[5], v[6]);
nv[0] = v[0] + 8*sin(v[1]*0.05+realtime)*sin(v[2]*0.05+realtime);
nv[1] = v[1] + 8*sin(v[0]*0.05+realtime)*sin(v[2]*0.05+realtime);
nv[2] = v[2];
glVertex3fv (nv);
}
glEnd ();
}
/* /*
================ ================
DrawGLPoly DrawGLPoly
@ -604,7 +473,7 @@ void DrawGLPoly (glpoly_t *p)
v = p->verts[0]; v = p->verts[0];
for (i=0 ; i<p->numverts ; i++, v+= VERTEXSIZE) for (i=0 ; i<p->numverts ; i++, v+= VERTEXSIZE)
{ {
glTexCoord2f (v[3], v[4]); glTexCoord2fv (&v[3]);
glVertex3fv (v); glVertex3fv (v);
} }
glEnd (); glEnd ();
@ -660,23 +529,14 @@ void R_BlendLightmaps (void)
} }
for ( ; p ; p=p->chain) for ( ; p ; p=p->chain)
{ {
// if (p->flags & SURF_UNDERWATER) glBegin (GL_POLYGON);
// DrawGLWaterPolyLightmap (p); v = p->verts[0];
if (((r_viewleaf->contents==CONTENTS_EMPTY && (p->flags & SURF_UNDERWATER)) || for (j=0 ; j<p->numverts ; j++, v+= VERTEXSIZE)
(r_viewleaf->contents!=CONTENTS_EMPTY && !(p->flags & SURF_UNDERWATER)))
&& !(p->flags & SURF_DONTWARP))
DrawGLWaterPolyLightmap (p);
else
{ {
glBegin (GL_POLYGON); glTexCoord2fv (&v[5]);
v = p->verts[0]; glVertex3fv (v);
for (j=0 ; j<p->numverts ; j++, v+= VERTEXSIZE)
{
glTexCoord2f (v[5], v[6]);
glVertex3fv (v);
}
glEnd ();
} }
glEnd ();
} }
} }
@ -716,12 +576,7 @@ void R_RenderBrushPoly (msurface_t *fa)
return; return;
} }
if (((r_viewleaf->contents==CONTENTS_EMPTY && (fa->flags & SURF_UNDERWATER)) || DrawGLPoly (fa->polys);
(r_viewleaf->contents!=CONTENTS_EMPTY && !(fa->flags & SURF_UNDERWATER)))
&& !(fa->flags & SURF_DONTWARP))
DrawGLWaterPoly (fa->polys);
else
DrawGLPoly (fa->polys);
// add the poly to the proper lightmap chain // add the poly to the proper lightmap chain
@ -919,7 +774,6 @@ void DrawTextureChains (void)
if (skychain) if (skychain)
{ {
// R_DrawSkyChain(skychain);
skychain = NULL; skychain = NULL;
} }