+ RSurf_FogColors(varray_vertex, varray_color, colorscale, mesh->numverts, modelorg);
+ R_Mesh_Draw(mesh->numverts, mesh->numtriangles, mesh->index);
+ }
+}
+
+static void RSurfShader_Wall_Pass_Glow(const entity_render_t *ent, const msurface_t *surf, const texture_t *texture, int rendertype, float currentalpha)
+{
+ const surfmesh_t *mesh;
+ rmeshstate_t m;
+ float modelorg[3];
+ Matrix4x4_Transform(&ent->inversematrix, r_origin, modelorg);
+ memset(&m, 0, sizeof(m));
+ m.blendfunc1 = GL_SRC_ALPHA;
+ m.blendfunc2 = GL_ONE;
+ m.tex[0] = R_GetTexture(texture->skin.glow);
+ R_Mesh_State(&m);
+ GL_UseColorArray();
+ for (mesh = surf->mesh;mesh;mesh = mesh->chain)
+ {
+ R_Mesh_ResizeCheck(mesh->numverts);
+ memcpy(varray_vertex, mesh->verts, mesh->numverts * sizeof(float[4]));
+ memcpy(varray_texcoord[0], mesh->str, mesh->numverts * sizeof(float[4]));
+ RSurf_FoggedColors(varray_vertex, varray_color, 1, 1, 1, currentalpha, r_colorscale, mesh->numverts, modelorg);
+ R_Mesh_Draw(mesh->numverts, mesh->numtriangles, mesh->index);
+ }
+}
+
+static void RSurfShader_Wall_Pass_Fog(const entity_render_t *ent, const msurface_t *surf, const texture_t *texture, int rendertype, float currentalpha)
+{
+ const surfmesh_t *mesh;
+ rmeshstate_t m;
+ float modelorg[3];
+ Matrix4x4_Transform(&ent->inversematrix, r_origin, modelorg);
+ memset(&m, 0, sizeof(m));
+ m.blendfunc1 = GL_SRC_ALPHA;
+ m.blendfunc2 = GL_ONE;
+ m.tex[0] = R_GetTexture(texture->skin.fog);
+ R_Mesh_State(&m);
+ GL_UseColorArray();
+ for (mesh = surf->mesh;mesh;mesh = mesh->chain)
+ {
+ R_Mesh_ResizeCheck(mesh->numverts);
+ memcpy(varray_vertex, mesh->verts, mesh->numverts * sizeof(float[4]));
+ if (m.tex[0])
+ memcpy(varray_texcoord[0], mesh->str, mesh->numverts * sizeof(float[4]));
+ RSurf_FogPassColors(varray_vertex, varray_color, fogcolor[0], fogcolor[1], fogcolor[2], currentalpha, r_colorscale, mesh->numverts, modelorg);
+ R_Mesh_Draw(mesh->numverts, mesh->numtriangles, mesh->index);
+ }
+}
+
+static void RSurfShader_OpaqueWall_Pass_BaseTripleTexCombine(const entity_render_t *ent, const texture_t *texture, msurface_t **surfchain)
+{
+ const msurface_t *surf;
+ const surfmesh_t *mesh;
+ rmeshstate_t m;
+ int lightmaptexturenum;
+ float cl;
+ memset(&m, 0, sizeof(m));
+ m.blendfunc1 = GL_ONE;
+ m.blendfunc2 = GL_ZERO;
+ m.tex[0] = R_GetTexture(texture->skin.base);
+ m.tex[1] = R_GetTexture((**surfchain).lightmaptexture);
+ m.tex[2] = R_GetTexture(texture->skin.detail);
+ m.texrgbscale[0] = 1;
+ m.texrgbscale[1] = 4;
+ m.texrgbscale[2] = 2;
+ R_Mesh_State(&m);
+ cl = (float) (1 << r_lightmapscalebit) * r_colorscale;
+ GL_Color(cl, cl, cl, 1);
+ while((surf = *surfchain++) != NULL)
+ {
+ if (surf->visframe == r_framecount)