RSurfShader_Water_Pass_Base(s);
return false;
case 1:
- if (s->currenttexture->glowtexture)
- RSurfShader_Water_Pass_Glow(s);
+ if (fogenabled)
+ {
+ if (currentrenderentity->alpha * (s->flags & SURF_DRAWNOALPHA ? 1 : r_wateralpha.value) >= 1.0f)
+ RSurfShader_Water_Pass_Fog(s);
+ return false;
+ }
+ else
+ return true;
+ default:
+ return true;
+ }
+}
+
+static int RSurfShader_Water_Glow(int stage, msurface_t *s)
+{
+ switch(stage)
+ {
+ case 0:
+ RSurfShader_Water_Pass_Base(s);
+ return false;
+ case 1:
+ RSurfShader_Water_Pass_Glow(s);
return false;
case 2:
if (fogenabled)
static int RSurfShader_Wall_Fullbright(int stage, msurface_t *s)
{
if (stage == 0)
+ {
c_brush_polys++;
+ RSurfShader_Wall_Pass_BaseFullbright(s);
+ return false;
+ }
+ return true;
+}
+
+static int RSurfShader_Wall_Fullbright_Glow(int stage, msurface_t *s)
+{
switch(stage)
{
case 0:
+ c_brush_polys++;
RSurfShader_Wall_Pass_BaseFullbright(s);
return false;
case 1:
- if (s->currenttexture->glowtexture)
- RSurfShader_Wall_Pass_Glow(s);
+ RSurfShader_Wall_Pass_Glow(s);
return false;
default:
return true;
static int RSurfShader_Wall_Vertex(int stage, msurface_t *s)
{
if (stage == 0)
+ {
c_brush_polys++;
+ RSurfShader_Wall_Pass_BaseVertex(s);
+ return false;
+ }
+ return true;
+}
+
+static int RSurfShader_Wall_Vertex_Glow(int stage, msurface_t *s)
+{
switch(stage)
{
case 0:
+ c_brush_polys++;
RSurfShader_Wall_Pass_BaseVertex(s);
return false;
case 1:
- if (s->currenttexture->glowtexture)
- RSurfShader_Wall_Pass_Glow(s);
+ RSurfShader_Wall_Pass_Glow(s);
return false;
default:
return true;
}
static int RSurfShader_Wall_Lightmap(int stage, msurface_t *s)
+{
+ if (r_vertexsurfaces.integer)
+ {
+ if (stage == 0)
+ {
+ c_brush_polys++;
+ RSurfShader_Wall_Pass_BaseVertex(s);
+ return false;
+ }
+ return true;
+ }
+ else if (r_multitexture.integer)
+ {
+ if (r_dlightmap.integer)
+ {
+ if (stage == 0)
+ {
+ c_brush_polys++;
+ RSurfShader_Wall_Pass_BaseMTex(s);
+ return false;
+ }
+ return true;
+ }
+ else
+ {
+ switch(stage)
+ {
+ case 0:
+ c_brush_polys++;
+ RSurfShader_Wall_Pass_BaseMTex(s);
+ return false;
+ case 1:
+ if (s->dlightframe == r_framecount)
+ RSurfShader_Wall_Pass_Light(s);
+ return false;
+ default:
+ return true;
+ }
+ }
+ }
+ else if (s->currenttexture->fogtexture != NULL || currentrenderentity->alpha != 1 || currentrenderentity->effects & EF_ADDITIVE)
+ {
+ if (stage == 0)
+ {
+ c_brush_polys++;
+ RSurfShader_Wall_Pass_BaseVertex(s);
+ return false;
+ }
+ return true;
+ }
+ else
+ {
+ if (r_dlightmap.integer)
+ {
+ switch(stage)
+ {
+ case 0:
+ c_brush_polys++;
+ RSurfShader_Wall_Pass_BaseTexture(s);
+ return false;
+ case 1:
+ RSurfShader_Wall_Pass_BaseLightmap(s);
+ return false;
+ default:
+ return true;
+ }
+ }
+ else
+ {
+ switch(stage)
+ {
+ case 0:
+ c_brush_polys++;
+ RSurfShader_Wall_Pass_BaseTexture(s);
+ return false;
+ case 1:
+ RSurfShader_Wall_Pass_BaseLightmap(s);
+ return false;
+ case 2:
+ if (s->dlightframe == r_framecount)
+ RSurfShader_Wall_Pass_Light(s);
+ return false;
+ default:
+ return true;
+ }
+ }
+ }
+}
+
+static int RSurfShader_Wall_Lightmap_Glow(int stage, msurface_t *s)
{
if (stage == 0)
c_brush_polys++;
RSurfShader_Wall_Pass_BaseVertex(s);
return false;
case 1:
- if (s->currenttexture->glowtexture)
- RSurfShader_Wall_Pass_Glow(s);
+ RSurfShader_Wall_Pass_Glow(s);
return false;
default:
return true;
RSurfShader_Wall_Pass_BaseMTex(s);
return false;
case 1:
- if (s->currenttexture->glowtexture)
- RSurfShader_Wall_Pass_Glow(s);
+ RSurfShader_Wall_Pass_Glow(s);
return false;
default:
return true;
RSurfShader_Wall_Pass_Light(s);
return false;
case 2:
- if (s->currenttexture->glowtexture)
- RSurfShader_Wall_Pass_Glow(s);
+ RSurfShader_Wall_Pass_Glow(s);
return false;
default:
return true;
RSurfShader_Wall_Pass_BaseVertex(s);
return false;
case 1:
- if (s->currenttexture->glowtexture)
- RSurfShader_Wall_Pass_Glow(s);
+ RSurfShader_Wall_Pass_Glow(s);
return false;
default:
return true;
RSurfShader_Wall_Pass_BaseLightmap(s);
return false;
case 2:
- if (s->currenttexture->glowtexture)
- RSurfShader_Wall_Pass_Glow(s);
+ RSurfShader_Wall_Pass_Glow(s);
return false;
default:
return true;
RSurfShader_Wall_Pass_Light(s);
return false;
case 3:
- if (s->currenttexture->glowtexture)
- RSurfShader_Wall_Pass_Glow(s);
+ RSurfShader_Wall_Pass_Glow(s);
return false;
default:
return true;
}
Cshader_t Cshader_wall_vertex = {{NULL, RSurfShader_Wall_Vertex, RSurfShader_Wall_Fog}, NULL};
+Cshader_t Cshader_wall_vertex_glow = {{NULL, RSurfShader_Wall_Vertex_Glow, RSurfShader_Wall_Fog}, NULL};
Cshader_t Cshader_wall_lightmap = {{NULL, RSurfShader_Wall_Lightmap, RSurfShader_Wall_Fog}, NULL};
+Cshader_t Cshader_wall_lightmap_glow = {{NULL, RSurfShader_Wall_Lightmap_Glow, RSurfShader_Wall_Fog}, NULL};
Cshader_t Cshader_wall_fullbright = {{NULL, RSurfShader_Wall_Fullbright, RSurfShader_Wall_Fog}, NULL};
+Cshader_t Cshader_wall_fullbright_glow = {{NULL, RSurfShader_Wall_Fullbright_Glow, RSurfShader_Wall_Fog}, NULL};
Cshader_t Cshader_water = {{NULL, RSurfShader_Water, NULL}, NULL};
+Cshader_t Cshader_water_glow = {{NULL, RSurfShader_Water_Glow, NULL}, NULL};
Cshader_t Cshader_sky = {{RSurfShader_Sky, NULL, NULL}, NULL};
int Cshader_count = 5;
{
shader = Cshaders[i];
if (shader->chain && shader->shaderfunc[type])
+ // shader->shaderfunc[type](shader->chain);
for (stage = 0;stage < 1000;stage++)
for (surf = shader->chain;surf;surf = surf->chain)
if (shader->shaderfunc[type](stage, surf))
if (out->texinfo->texture->flags & SURF_DRAWTURB)
{
- out->shader = &Cshader_water;
+ if (out->texinfo->texture->glowtexture)
+ out->shader = &Cshader_water_glow;
+ else
+ out->shader = &Cshader_water;
/*
for (i=0 ; i<2 ; i++)
{
if (out->texinfo->flags & TEX_SPECIAL)
{
// qbsp couldn't find the texture for this surface, but it was either turb or sky... assume turb
+ if (out->texinfo->texture->glowtexture)
+ out->shader = &Cshader_water_glow;
+ else
+ out->shader = &Cshader_water;
out->shader = &Cshader_water;
out->samples = NULL;
Mod_GenerateWarpMesh (out);
else if ((out->extents[0]+1) > (256*16) || (out->extents[1]+1) > (256*16))
{
Con_Printf ("Bad surface extents, converting to fullbright polygon");
- out->shader = &Cshader_wall_fullbright;
+ if (out->texinfo->texture->glowtexture)
+ out->shader = &Cshader_wall_fullbright_glow;
+ else
+ out->shader = &Cshader_wall_fullbright;
out->samples = NULL;
Mod_GenerateVertexMesh(out);
}
memset(out->stainsamples, 255, ssize * tsize * 3);
if (out->extents[0] < r_vertexsurfacesthreshold.integer && out->extents[1] < r_vertexsurfacesthreshold.integer)
{
- out->shader = &Cshader_wall_vertex;
+ if (out->texinfo->texture->glowtexture)
+ out->shader = &Cshader_wall_vertex_glow;
+ else
+ out->shader = &Cshader_wall_vertex;
Mod_GenerateVertexLitMesh(out);
}
else
{
- out->shader = &Cshader_wall_lightmap;
+ if (out->texinfo->texture->glowtexture)
+ out->shader = &Cshader_wall_lightmap_glow;
+ else
+ out->shader = &Cshader_wall_lightmap;
Mod_GenerateLightmappedMesh(out);
}
}