- if (lighthalf)
- {
- if (light)
- {
- for (;s;s = s->texturechain)
- {
- for (p=s->polys ; p ; p=p->next)
- {
- // FIXME: could be a transparent water texture
- transpolybegin(s->texinfo->texture->gl_texturenum, s->texinfo->texture->gl_glowtexturenum, 0, TPOLYTYPE_ALPHA);
- for (i = 0,v = p->verts[0];i < p->numverts;i++, v += VERTEXSIZE)
- {
- nv[0] = v[0];
- nv[1] = v[1];
- nv[2] = v[2] + r_waterripple.value * turbsin[(int)((v[3]*0.125f+realtime) * TURBSCALE) & 255] * turbsin[(int)((v[4]*0.125f+realtime) * TURBSCALE) & 255] * (1.0f / 64.0f);
- shadecolor[0] = shadecolor[1] = shadecolor[2] = 128 + (int) (r_ambient.value * 2.0f);
- R_DynamicLightPoint(shadecolor, nv, s->dlightbits);
- transpolyvert(nv[0], nv[1], nv[2], (v[3] + os) * (1.0f/64.0f), (v[4] + ot) * (1.0f/64.0f), (int) shadecolor[0] >> 1,(int) shadecolor[1] >> 1,(int) shadecolor[2] >> 1,alpha);
- }
- transpolyend();
- }
- }
- }
- else
- {
- for (;s;s = s->texturechain)
- {
- for (p=s->polys ; p ; p=p->next)
- {
- // FIXME: could be a transparent water texture
- transpolybegin(s->texinfo->texture->gl_texturenum, s->texinfo->texture->gl_glowtexturenum, 0, TPOLYTYPE_ALPHA);
- for (i = 0,v = p->verts[0];i < p->numverts;i++, v += VERTEXSIZE)
- {
- nv[0] = v[0];
- nv[1] = v[1];
- nv[2] = v[2] + r_waterripple.value * turbsin[(int)((v[3]*0.125f+realtime) * TURBSCALE) & 255] * turbsin[(int)((v[4]*0.125f+realtime) * TURBSCALE) & 255] * (1.0f / 64.0f);
- transpolyvert(nv[0], nv[1], nv[2], (v[3] + os) * (1.0f/64.0f), (v[4] + ot) * (1.0f/64.0f), r,g,b,alpha);
- }
- transpolyend();
- }
- }
- }
- }
- else
- {
- if (light)
- {
- for (;s;s = s->texturechain)
- {
- for (p=s->polys ; p ; p=p->next)
- {
- // FIXME: could be a transparent water texture
- transpolybegin(s->texinfo->texture->gl_texturenum, s->texinfo->texture->gl_glowtexturenum, 0, TPOLYTYPE_ALPHA);
- for (i = 0,v = p->verts[0];i < p->numverts;i++, v += VERTEXSIZE)
- {
- nv[0] = v[0];
- nv[1] = v[1];
- nv[2] = v[2] + r_waterripple.value * turbsin[(int)((v[3]*0.125f+realtime) * TURBSCALE) & 255] * turbsin[(int)((v[4]*0.125f+realtime) * TURBSCALE) & 255] * (1.0f / 64.0f);
- shadecolor[0] = shadecolor[1] = shadecolor[2] = 128 + (int) (r_ambient.value * 2.0f);
- R_DynamicLightPoint(shadecolor, nv, s->dlightbits);
- transpolyvert(nv[0], nv[1], nv[2], (v[3] + os) * (1.0f/64.0f), (v[4] + ot) * (1.0f/64.0f), shadecolor[0],shadecolor[1],shadecolor[2],alpha);
- }
- transpolyend();
- }
- }
- }
- else
- {
- for (;s;s = s->texturechain)
- {
- for (p=s->polys ; p ; p=p->next)
- {
- // FIXME: could be a transparent water texture
- transpolybegin(s->texinfo->texture->gl_texturenum, s->texinfo->texture->gl_glowtexturenum, 0, TPOLYTYPE_ALPHA);
- for (i = 0,v = p->verts[0];i < p->numverts;i++, v += VERTEXSIZE)
- {
- nv[0] = v[0];
- nv[1] = v[1];
- nv[2] = v[2] + r_waterripple.value * turbsin[(int)((v[3]*0.125f+realtime) * TURBSCALE) & 255] * turbsin[(int)((v[4]*0.125f+realtime) * TURBSCALE) & 255] * (1.0f / 64.0f);
- transpolyvert(nv[0], nv[1], nv[2], (v[3] + os) * (1.0f/64.0f), (v[4] + ot) * (1.0f/64.0f), r,g,b,alpha);
- }
- transpolyend();
- }
- }
- }
- }
- }
- else
- {
- if (lighthalf)
- {
- if (light)
- {
- for (;s;s = s->texturechain)
- {
- for (p=s->polys ; p ; p=p->next)
- {
- // FIXME: could be a transparent water texture
- transpolybegin(s->texinfo->texture->gl_texturenum, s->texinfo->texture->gl_glowtexturenum, 0, TPOLYTYPE_ALPHA);
- for (i = 0,v = p->verts[0];i < p->numverts;i++, v += VERTEXSIZE)
- {
- shadecolor[0] = shadecolor[1] = shadecolor[2] = 128 + (int) (r_ambient.value * 2.0f);
- R_DynamicLightPoint(shadecolor, v, s->dlightbits);
- transpolyvert(v[0], v[1], v[2], (v[3] + os) * (1.0f/64.0f), (v[4] + ot) * (1.0f/64.0f), (int) shadecolor[0] >> 1,(int) shadecolor[1] >> 1,(int) shadecolor[2] >> 1,alpha);
- }
- transpolyend();
- }
- }
- }
- else
- {
- for (;s;s = s->texturechain)
- {
- for (p=s->polys ; p ; p=p->next)
- {
- // FIXME: could be a transparent water texture
- transpolybegin(s->texinfo->texture->gl_texturenum, s->texinfo->texture->gl_glowtexturenum, 0, TPOLYTYPE_ALPHA);
- for (i = 0,v = p->verts[0];i < p->numverts;i++, v += VERTEXSIZE)
- {
- transpolyvert(v[0], v[1], v[2], (v[3] + os) * (1.0f/64.0f), (v[4] + ot) * (1.0f/64.0f), r,g,b,alpha);
- }
- transpolyend();
- }
- }
- }
- }
- else
- {
- if (light)
- {
- for (;s;s = s->texturechain)
- {
- for (p=s->polys ; p ; p=p->next)
- {
- // FIXME: could be a transparent water texture
- transpolybegin(s->texinfo->texture->gl_texturenum, s->texinfo->texture->gl_glowtexturenum, 0, TPOLYTYPE_ALPHA);
- for (i = 0,v = p->verts[0];i < p->numverts;i++, v += VERTEXSIZE)
- {
- shadecolor[0] = shadecolor[1] = shadecolor[2] = 128 + (int) (r_ambient.value * 2.0f);
- R_DynamicLightPoint(shadecolor, v, s->dlightbits);
- transpolyvert(v[0], v[1], v[2], (v[3] + os) * (1.0f/64.0f), (v[4] + ot) * (1.0f/64.0f), shadecolor[0],shadecolor[1],shadecolor[2],alpha);
- }
- transpolyend();
- }
- }
- }
- else
- {
- for (;s;s = s->texturechain)
- {
- for (p=s->polys ; p ; p=p->next)
- {
- // FIXME: could be a transparent water texture
- transpolybegin(s->texinfo->texture->gl_texturenum, s->texinfo->texture->gl_glowtexturenum, 0, TPOLYTYPE_ALPHA);
- for (i = 0,v = p->verts[0];i < p->numverts;i++, v += VERTEXSIZE)
- {
- transpolyvert(v[0], v[1], v[2], (v[3] + os) * (1.0f/64.0f), (v[4] + ot) * (1.0f/64.0f), r,g,b,alpha);
- }
- transpolyend();
- }
- }
- }
- }