]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
removed old surface renderer
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 10 Sep 2005 11:33:11 +0000 (11:33 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 10 Sep 2005 11:33:11 +0000 (11:33 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@5710 d7cf8633-e32d-0410-b094-e92efae38249

gl_rmain.c

index ec27666473e46b340e91993ef3c470abdd3f4ac7..9fb8351bc77a14f08965715a13bf67b881817ff8 100644 (file)
@@ -1864,13 +1864,8 @@ void RSurf_SetColorPointer(const entity_render_t *ent, const msurface_t *surface
 
 static void R_DrawTextureSurfaceList(const entity_render_t *ent, texture_t *texture, int texturenumsurfaces, const msurface_t **texturesurfacelist, const vec3_t modelorg)
 {
-       int i;
        int texturesurfaceindex;
        int lightmode;
-       const float *v;
-       float *c;
-       float diff[3];
-       float f, r, g, b, a, colorscale;
        const msurface_t *surface;
        qboolean applycolor;
        rmeshstate_t m;
@@ -1906,8 +1901,6 @@ static void R_DrawTextureSurfaceList(const entity_render_t *ent, texture_t *text
        GL_DepthTest(!(texture->currentmaterialflags & MATERIALFLAG_NODEPTHTEST));
        if (texture->textureflags & Q3TEXTUREFLAG_TWOSIDED)
                qglDisable(GL_CULL_FACE);
-if (r_test.integer)
-{
        if (texture->currentnumlayers)
        {
                int layerindex;
@@ -2071,6 +2064,7 @@ if (r_test.integer)
                                for (texturesurfaceindex = 0;texturesurfaceindex < texturenumsurfaces;texturesurfaceindex++)
                                {
                                        int i;
+                                       float diff[3];
                                        float f, *v, *c;
                                        surface = texturesurfacelist[texturesurfaceindex];
                                        RSurf_SetVertexPointer(ent, texture, surface, modelorg);
@@ -2096,430 +2090,6 @@ if (r_test.integer)
                        }
                }
        }
-}
-else
-{
-       GL_DepthMask(!(texture->currentmaterialflags & MATERIALFLAG_TRANSPARENT));
-       if (texture->currentmaterialflags & MATERIALFLAG_ADD)
-               GL_BlendFunc(GL_SRC_ALPHA, GL_ONE);
-       else if (texture->currentmaterialflags & MATERIALFLAG_ALPHA)
-               GL_BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
-       else
-               GL_BlendFunc(GL_ONE, GL_ZERO);
-       if (texture->currentmaterialflags & MATERIALFLAG_SKY)
-       {
-               if (skyrendernow)
-               {
-                       skyrendernow = false;
-                       if (skyrendermasked)
-                               R_Sky();
-               }
-               // LordHavoc: HalfLife maps have freaky skypolys...
-               //if (!ent->model->brush.ishlbsp)
-               {
-                       R_Mesh_Matrix(&ent->matrix);
-                       GL_Color(fogcolor[0], fogcolor[1], fogcolor[2], 1);
-                       if (skyrendermasked)
-                       {
-                               // depth-only (masking)
-                               GL_ColorMask(0,0,0,0);
-                               // just to make sure that braindead drivers don't draw anything
-                               // despite that colormask...
-                               GL_BlendFunc(GL_ZERO, GL_ONE);
-                       }
-                       else
-                       {
-                               // fog sky
-                               GL_BlendFunc(GL_ONE, GL_ZERO);
-                       }
-                       GL_DepthMask(true);
-                       GL_DepthTest(true);
-                       memset(&m, 0, sizeof(m));
-                       R_Mesh_State(&m);
-                       for (texturesurfaceindex = 0;texturesurfaceindex < texturenumsurfaces;texturesurfaceindex++)
-                       {
-                               surface = texturesurfacelist[texturesurfaceindex];
-                               RSurf_SetVertexPointer(ent, texture, surface, modelorg);
-                               GL_LockArrays(surface->num_firstvertex, surface->num_vertices);
-                               R_Mesh_Draw(surface->num_firstvertex, surface->num_vertices, surface->num_triangles, (surface->groupmesh->data_element3i + 3 * surface->num_firsttriangle));
-                               GL_LockArrays(0, 0);
-                       }
-                       GL_ColorMask(r_refdef.colormask[0], r_refdef.colormask[1], r_refdef.colormask[2], 1);
-               }
-       }
-       else if (texture->currentmaterialflags & (MATERIALFLAG_WATER | MATERIALFLAG_WALL))
-       {
-               // normal surface (wall or water)
-               if (!(texture->currentmaterialflags & MATERIALFLAG_FULLBRIGHT) && r_textureunits.integer >= 2 && gl_combine.integer)
-               {
-                       // multitexture single pass
-                       memset(&m, 0, sizeof(m));
-                       m.tex[1] = R_GetTexture(texture->currentbasetexture);
-                       m.texmatrix[1] = texture->currenttexmatrix;
-                       m.texrgbscale[1] = 2;
-                       m.pointer_color = varray_color4f;
-                       R_Mesh_State(&m);
-                       // transparent is not affected by r_lightmapintensity
-                       if (!(texture->currentmaterialflags & MATERIALFLAG_TRANSPARENT))
-                               colorscale = r_lightmapintensity;
-                       else
-                               colorscale = 1;
-                       // q3bsp has no lightmap updates, so the lightstylevalue that
-                       // would normally be baked into the lightmaptexture must be
-                       // applied to the color
-                       if (ent->model->type == mod_brushq3)
-                               colorscale *= d_lightstylevalue[0] * (1.0f / 128.0f);
-                       r = texture->currentcolorbase[0] * colorscale;
-                       g = texture->currentcolorbase[1] * colorscale;
-                       b = texture->currentcolorbase[2] * colorscale;
-                       a = texture->currentcolorbase[3];
-                       applycolor = r != 1 || g != 1 || b != 1 || a != 1;
-                       for (texturesurfaceindex = 0;texturesurfaceindex < texturenumsurfaces;texturesurfaceindex++)
-                       {
-                               surface = texturesurfacelist[texturesurfaceindex];
-                               RSurf_SetVertexPointer(ent, texture, surface, modelorg);
-                               R_Mesh_TexCoordPointer(0, 2, surface->groupmesh->data_texcoordlightmap2f);
-                               R_Mesh_TexCoordPointer(1, 2, surface->groupmesh->data_texcoordtexture2f);
-                               if (surface->lightmaptexture)
-                                       R_Mesh_TexBind(0, R_GetTexture(surface->lightmaptexture));
-                               else
-                                       R_Mesh_TexBind(0, R_GetTexture(r_texture_white));
-                               RSurf_SetColorPointer(ent, surface, modelorg, r, g, b, a, lightmode ? lightmode : !surface->lightmaptexture, applycolor, texture->currentfogallpasses);
-                               GL_LockArrays(surface->num_firstvertex, surface->num_vertices);
-                               R_Mesh_Draw(surface->num_firstvertex, surface->num_vertices, surface->num_triangles, (surface->groupmesh->data_element3i + 3 * surface->num_firsttriangle));
-                               GL_LockArrays(0, 0);
-                       }
-               }
-               // FIXME: identify models using a better check than ent->model->brush.shadowmesh
-               else if (!(texture->currentmaterialflags & MATERIALFLAG_FULLBRIGHT) && !(texture->currentmaterialflags & MATERIALFLAG_TRANSPARENT) && ((ent->effects & EF_FULLBRIGHT) || ent->model->brush.shadowmesh))
-               {
-                       // single texture two pass
-                       GL_BlendFunc(GL_ONE, GL_ZERO);
-                       GL_DepthMask(true);
-                       GL_Color(1, 1, 1, 1);
-                       memset(&m, 0, sizeof(m));
-                       R_Mesh_State(&m);
-                       for (texturesurfaceindex = 0;texturesurfaceindex < texturenumsurfaces;texturesurfaceindex++)
-                       {
-                               surface = texturesurfacelist[texturesurfaceindex];
-                               RSurf_SetVertexPointer(ent, texture, surface, modelorg);
-                               R_Mesh_TexCoordPointer(0, 2, surface->groupmesh->data_texcoordlightmap2f);
-                               if (surface->lightmaptexture)
-                               {
-                                       R_Mesh_TexBind(0, R_GetTexture(surface->lightmaptexture));
-                                       R_Mesh_ColorPointer(NULL);
-                               }
-                               else
-                               {
-                                       R_Mesh_TexBind(0, R_GetTexture(r_texture_white));
-                                       R_Mesh_ColorPointer(surface->groupmesh->data_lightmapcolor4f);
-                               }
-                               GL_LockArrays(surface->num_firstvertex, surface->num_vertices);
-                               R_Mesh_Draw(surface->num_firstvertex, surface->num_vertices, surface->num_triangles, (surface->groupmesh->data_element3i + 3 * surface->num_firsttriangle));
-                               GL_LockArrays(0, 0);
-                       }
-                       GL_BlendFunc(GL_DST_COLOR, GL_SRC_COLOR);
-                       GL_DepthMask(false);
-                       GL_Color(r_lightmapintensity * texture->currentcolorbase[0], r_lightmapintensity * texture->currentcolorbase[1], r_lightmapintensity * texture->currentcolorbase[2], texture->currentcolorbase[3]);
-                       memset(&m, 0, sizeof(m));
-                       m.tex[0] = R_GetTexture(texture->currentbasetexture);
-                       m.texmatrix[0] = texture->currenttexmatrix;
-                       R_Mesh_State(&m);
-                       for (texturesurfaceindex = 0;texturesurfaceindex < texturenumsurfaces;texturesurfaceindex++)
-                       {
-                               surface = texturesurfacelist[texturesurfaceindex];
-                               RSurf_SetVertexPointer(ent, texture, surface, modelorg);
-                               R_Mesh_TexCoordPointer(0, 2, surface->groupmesh->data_texcoordtexture2f);
-                               GL_LockArrays(surface->num_firstvertex, surface->num_vertices);
-                               R_Mesh_Draw(surface->num_firstvertex, surface->num_vertices, surface->num_triangles, (surface->groupmesh->data_element3i + 3 * surface->num_firsttriangle));
-                               GL_LockArrays(0, 0);
-                       }
-               }
-               else
-               {
-                       // single texture single pass (vertex lit only)
-                       memset(&m, 0, sizeof(m));
-                       m.tex[0] = R_GetTexture(texture->currentbasetexture);
-                       m.texmatrix[0] = texture->currenttexmatrix;
-                       m.pointer_color = varray_color4f;
-                       colorscale = 2;
-                       if (gl_combine.integer)
-                       {
-                               m.texrgbscale[0] = 2;
-                               colorscale = 1;
-                       }
-                       // transparent is not affected by r_lightmapintensity
-                       if (!(texture->currentmaterialflags & MATERIALFLAG_TRANSPARENT))
-                               colorscale *= r_lightmapintensity;
-                       // q3bsp has no lightmap updates, so the lightstylevalue that
-                       // would normally be baked into the lightmaptexture must be
-                       // applied to the color
-                       if (!(texture->currentmaterialflags & MATERIALFLAG_FULLBRIGHT) && ent->model->type == mod_brushq3)
-                               colorscale *= d_lightstylevalue[0] * (1.0f / 128.0f);
-                       R_Mesh_State(&m);
-                       r = texture->currentcolorbase[0] * colorscale;
-                       g = texture->currentcolorbase[1] * colorscale;
-                       b = texture->currentcolorbase[2] * colorscale;
-                       a = texture->currentcolorbase[3];
-                       applycolor = r != 1 || g != 1 || b != 1 || a != 1;
-                       if (!(texture->currentmaterialflags & MATERIALFLAG_FULLBRIGHT))
-                       {
-                               for (texturesurfaceindex = 0;texturesurfaceindex < texturenumsurfaces;texturesurfaceindex++)
-                               {
-                                       surface = texturesurfacelist[texturesurfaceindex];
-                                       RSurf_SetVertexPointer(ent, texture, surface, modelorg);
-                                       R_Mesh_TexCoordPointer(0, 2, surface->groupmesh->data_texcoordtexture2f);
-                                       RSurf_SetColorPointer(ent, surface, modelorg, r, g, b, a, lightmode ? lightmode : 1, applycolor, texture->currentfogallpasses);
-                                       GL_LockArrays(surface->num_firstvertex, surface->num_vertices);
-                                       R_Mesh_Draw(surface->num_firstvertex, surface->num_vertices, surface->num_triangles, (surface->groupmesh->data_element3i + 3 * surface->num_firsttriangle));
-                                       GL_LockArrays(0, 0);
-                               }
-                       }
-                       else
-                       {
-                               for (texturesurfaceindex = 0;texturesurfaceindex < texturenumsurfaces;texturesurfaceindex++)
-                               {
-                                       surface = texturesurfacelist[texturesurfaceindex];
-                                       RSurf_SetVertexPointer(ent, texture, surface, modelorg);
-                                       R_Mesh_TexCoordPointer(0, 2, surface->groupmesh->data_texcoordtexture2f);
-                                       RSurf_SetColorPointer(ent, surface, modelorg, r, g, b, a, 0, applycolor, texture->currentfogallpasses);
-                                       GL_LockArrays(surface->num_firstvertex, surface->num_vertices);
-                                       R_Mesh_Draw(surface->num_firstvertex, surface->num_vertices, surface->num_triangles, (surface->groupmesh->data_element3i + 3 * surface->num_firsttriangle));
-                                       GL_LockArrays(0, 0);
-                               }
-                       }
-               }
-               if (texture->currentdopants)
-               {
-                       GL_BlendFunc(GL_SRC_ALPHA, GL_ONE);
-                       memset(&m, 0, sizeof(m));
-                       m.tex[0] = R_GetTexture(texture->skin.pants);
-                       m.texmatrix[0] = texture->currenttexmatrix;
-                       m.pointer_color = varray_color4f;
-                       colorscale = 2;
-                       if (gl_combine.integer)
-                       {
-                               m.texrgbscale[0] = 2;
-                               colorscale = 1;
-                       }
-                       // transparent is not affected by r_lightmapintensity
-                       if (!(texture->currentmaterialflags & MATERIALFLAG_TRANSPARENT))
-                               colorscale *= r_lightmapintensity;
-                       // q3bsp has no lightmap updates, so the lightstylevalue that
-                       // would normally be baked into the lightmaptexture must be
-                       // applied to the color
-                       if (!(texture->currentmaterialflags & MATERIALFLAG_FULLBRIGHT) && !texture->currentdofullbrightpants && ent->model->type == mod_brushq3)
-                               colorscale *= d_lightstylevalue[0] * (1.0f / 128.0f);
-                       R_Mesh_State(&m);
-                       r = texture->currentcolorpants[0] * colorscale;
-                       g = texture->currentcolorpants[1] * colorscale;
-                       b = texture->currentcolorpants[2] * colorscale;
-                       a = texture->currentcolorpants[3];
-                       applycolor = r != 1 || g != 1 || b != 1 || a != 1;
-                       if (!(texture->currentmaterialflags & MATERIALFLAG_FULLBRIGHT) && !texture->currentdofullbrightpants)
-                       {
-                               for (texturesurfaceindex = 0;texturesurfaceindex < texturenumsurfaces;texturesurfaceindex++)
-                               {
-                                       surface = texturesurfacelist[texturesurfaceindex];
-                                       RSurf_SetVertexPointer(ent, texture, surface, modelorg);
-                                       R_Mesh_TexCoordPointer(0, 2, surface->groupmesh->data_texcoordtexture2f);
-                                       RSurf_SetColorPointer(ent, surface, modelorg, r, g, b, a, lightmode, applycolor, texture->currentfogallpasses);
-                                       GL_LockArrays(surface->num_firstvertex, surface->num_vertices);
-                                       R_Mesh_Draw(surface->num_firstvertex, surface->num_vertices, surface->num_triangles, (surface->groupmesh->data_element3i + 3 * surface->num_firsttriangle));
-                                       GL_LockArrays(0, 0);
-                               }
-                       }
-                       else
-                       {
-                               for (texturesurfaceindex = 0;texturesurfaceindex < texturenumsurfaces;texturesurfaceindex++)
-                               {
-                                       surface = texturesurfacelist[texturesurfaceindex];
-                                       RSurf_SetVertexPointer(ent, texture, surface, modelorg);
-                                       R_Mesh_TexCoordPointer(0, 2, surface->groupmesh->data_texcoordtexture2f);
-                                       RSurf_SetColorPointer(ent, surface, modelorg, r, g, b, a, 0, applycolor, texture->currentfogallpasses);
-                                       GL_LockArrays(surface->num_firstvertex, surface->num_vertices);
-                                       R_Mesh_Draw(surface->num_firstvertex, surface->num_vertices, surface->num_triangles, (surface->groupmesh->data_element3i + 3 * surface->num_firsttriangle));
-                                       GL_LockArrays(0, 0);
-                               }
-                       }
-               }
-               if (texture->currentdoshirt)
-               {
-                       GL_BlendFunc(GL_SRC_ALPHA, GL_ONE);
-                       memset(&m, 0, sizeof(m));
-                       m.tex[0] = R_GetTexture(texture->skin.shirt);
-                       m.texmatrix[0] = texture->currenttexmatrix;
-                       m.pointer_color = varray_color4f;
-                       colorscale = 2;
-                       if (gl_combine.integer)
-                       {
-                               m.texrgbscale[0] = 2;
-                               colorscale = 1;
-                       }
-                       // transparent is not affected by r_lightmapintensity
-                       if (!(texture->currentmaterialflags & MATERIALFLAG_TRANSPARENT))
-                               colorscale *= r_lightmapintensity;
-                       // q3bsp has no lightmap updates, so the lightstylevalue that
-                       // would normally be baked into the lightmaptexture must be
-                       // applied to the color
-                       if (!(texture->currentmaterialflags & MATERIALFLAG_FULLBRIGHT) && !texture->currentdofullbrightshirt && ent->model->type == mod_brushq3)
-                               colorscale *= d_lightstylevalue[0] * (1.0f / 128.0f);
-                       R_Mesh_State(&m);
-                       r = texture->currentcolorshirt[0] * colorscale;
-                       g = texture->currentcolorshirt[1] * colorscale;
-                       b = texture->currentcolorshirt[2] * colorscale;
-                       a = texture->currentcolorshirt[3];
-                       applycolor = r != 1 || g != 1 || b != 1 || a != 1;
-                       if (!(texture->currentmaterialflags & MATERIALFLAG_FULLBRIGHT) && !texture->currentdofullbrightshirt)
-                       {
-                               for (texturesurfaceindex = 0;texturesurfaceindex < texturenumsurfaces;texturesurfaceindex++)
-                               {
-                                       surface = texturesurfacelist[texturesurfaceindex];
-                                       RSurf_SetVertexPointer(ent, texture, surface, modelorg);
-                                       R_Mesh_TexCoordPointer(0, 2, surface->groupmesh->data_texcoordtexture2f);
-                                       RSurf_SetColorPointer(ent, surface, modelorg, r, g, b, a, lightmode, applycolor, texture->currentfogallpasses);
-                                       GL_LockArrays(surface->num_firstvertex, surface->num_vertices);
-                                       R_Mesh_Draw(surface->num_firstvertex, surface->num_vertices, surface->num_triangles, (surface->groupmesh->data_element3i + 3 * surface->num_firsttriangle));
-                                       GL_LockArrays(0, 0);
-                               }
-                       }
-                       else
-                       {
-                               for (texturesurfaceindex = 0;texturesurfaceindex < texturenumsurfaces;texturesurfaceindex++)
-                               {
-                                       surface = texturesurfacelist[texturesurfaceindex];
-                                       RSurf_SetVertexPointer(ent, texture, surface, modelorg);
-                                       R_Mesh_TexCoordPointer(0, 2, surface->groupmesh->data_texcoordtexture2f);
-                                       RSurf_SetColorPointer(ent, surface, modelorg, r, g, b, a, 0, applycolor, texture->currentfogallpasses);
-                                       GL_LockArrays(surface->num_firstvertex, surface->num_vertices);
-                                       R_Mesh_Draw(surface->num_firstvertex, surface->num_vertices, surface->num_triangles, (surface->groupmesh->data_element3i + 3 * surface->num_firsttriangle));
-                                       GL_LockArrays(0, 0);
-                               }
-                       }
-               }
-               if (r_ambient.value >= (1/64.0f))
-               {
-                       GL_BlendFunc(GL_SRC_ALPHA, GL_ONE);
-                       GL_DepthMask(false);
-                       memset(&m, 0, sizeof(m));
-                       m.tex[0] = R_GetTexture(texture->skin.base);
-                       m.texmatrix[0] = texture->currenttexmatrix;
-                       m.pointer_color = varray_color4f;
-                       colorscale = 1;
-                       if (gl_combine.integer && (ent->colormod[0] > 1 || ent->colormod[1] > 1 || ent->colormod[2] > 1))
-                       {
-                               m.texrgbscale[0] = 4;
-                               colorscale = 0.25f;
-                       }
-                       R_Mesh_State(&m);
-                       colorscale *= r_ambient.value * (1.0f / 64.0f);
-                       r = texture->currentcolorbase[0] * colorscale;
-                       g = texture->currentcolorbase[1] * colorscale;
-                       b = texture->currentcolorbase[2] * colorscale;
-                       a = texture->currentcolorbase[3];
-                       applycolor = r != 1 || g != 1 || b != 1 || a != 1;
-                       for (texturesurfaceindex = 0;texturesurfaceindex < texturenumsurfaces;texturesurfaceindex++)
-                       {
-                               surface = texturesurfacelist[texturesurfaceindex];
-                               RSurf_SetVertexPointer(ent, texture, surface, modelorg);
-                               R_Mesh_TexCoordPointer(0, 2, surface->groupmesh->data_texcoordtexture2f);
-                               RSurf_SetColorPointer(ent, surface, modelorg, r, g, b, a, 0, applycolor, texture->currentfogallpasses);
-                               GL_LockArrays(surface->num_firstvertex, surface->num_vertices);
-                               R_Mesh_Draw(surface->num_firstvertex, surface->num_vertices, surface->num_triangles, (surface->groupmesh->data_element3i + 3 * surface->num_firsttriangle));
-                               GL_LockArrays(0, 0);
-                       }
-               }
-               if (texture->skin.glow != NULL)
-               {
-                       // if glow was not already done using multitexture, do it now.
-                       GL_BlendFunc(GL_SRC_ALPHA, GL_ONE);
-                       GL_DepthMask(false);
-                       memset(&m, 0, sizeof(m));
-                       m.tex[0] = R_GetTexture(texture->skin.glow);
-                       m.texmatrix[0] = texture->currenttexmatrix;
-                       m.pointer_color = varray_color4f;
-                       R_Mesh_State(&m);
-                       r = 1;
-                       g = 1;
-                       b = 1;
-                       a = texture->currentcolorbase[3];
-                       applycolor = r != 1 || g != 1 || b != 1 || a != 1;
-                       for (texturesurfaceindex = 0;texturesurfaceindex < texturenumsurfaces;texturesurfaceindex++)
-                       {
-                               surface = texturesurfacelist[texturesurfaceindex];
-                               RSurf_SetVertexPointer(ent, texture, surface, modelorg);
-                               R_Mesh_TexCoordPointer(0, 2, surface->groupmesh->data_texcoordtexture2f);
-                               RSurf_SetColorPointer(ent, surface, modelorg, r, g, b, a, 0, applycolor, texture->currentfogallpasses);
-                               GL_LockArrays(surface->num_firstvertex, surface->num_vertices);
-                               R_Mesh_Draw(surface->num_firstvertex, surface->num_vertices, surface->num_triangles, (surface->groupmesh->data_element3i + 3 * surface->num_firsttriangle));
-                               GL_LockArrays(0, 0);
-                       }
-               }
-               if (fogenabled && !(texture->currentmaterialflags & MATERIALFLAG_ADD))
-               {
-                       // if this is opaque use alpha blend which will darken the earlier
-                       // passes cheaply.
-                       //
-                       // if this is an alpha blended material, all the earlier passes
-                       // were darkened by fog already, so we only need to add the fog
-                       // color ontop through the fog mask texture
-                       //
-                       // if this is an additive blended material, all the earlier passes
-                       // were darkened by fog already, and we should not add fog color
-                       // (because the background was not darkened, there is no fog color
-                       // that was lost behind it).
-                       if (texture->currentfogallpasses)
-                               GL_BlendFunc(GL_SRC_ALPHA, GL_ONE);
-                       else
-                               GL_BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
-                       GL_DepthMask(false);
-                       memset(&m, 0, sizeof(m));
-                       m.tex[0] = R_GetTexture(texture->skin.fog);
-                       m.texmatrix[0] = texture->currenttexmatrix;
-                       R_Mesh_State(&m);
-                       r = fogcolor[0];
-                       g = fogcolor[1];
-                       b = fogcolor[2];
-                       a = texture->currentcolorbase[3];
-                       applycolor = r != 1 || g != 1 || b != 1 || a != 1;
-                       for (texturesurfaceindex = 0;texturesurfaceindex < texturenumsurfaces;texturesurfaceindex++)
-                       {
-                               surface = texturesurfacelist[texturesurfaceindex];
-                               RSurf_SetVertexPointer(ent, texture, surface, modelorg);
-                               R_Mesh_TexCoordPointer(0, 2, surface->groupmesh->data_texcoordtexture2f);
-                               R_Mesh_ColorPointer(varray_color4f);
-                               //RSurf_FogPassColors_Vertex3f_Color4f((surface->groupmesh->data_vertex3f + 3 * surface->num_firstvertex), varray_color4f, fogcolor[0], fogcolor[1], fogcolor[2], texture->currentcolorbase[3], 1, surface->num_vertices, modelorg);
-                               if (!surface->lightmaptexture && surface->groupmesh->data_lightmapcolor4f && (texture->currentmaterialflags & MATERIALFLAG_TRANSPARENT))
-                               {
-                                       for (i = 0, v = (rsurface_vertex3f + 3 * surface->num_firstvertex), c = (varray_color4f + 4 * surface->num_firstvertex);i < surface->num_vertices;i++, v += 3, c += 4)
-                                       {
-                                               VectorSubtract(v, modelorg, diff);
-                                               f = exp(fogdensity/DotProduct(diff, diff));
-                                               c[0] = r;
-                                               c[1] = g;
-                                               c[2] = b;
-                                               c[3] = (surface->groupmesh->data_lightmapcolor4f + 4 * surface->num_firstvertex)[i*4+3] * f * a;
-                                       }
-                               }
-                               else
-                               {
-                                       for (i = 0, v = (rsurface_vertex3f + 3 * surface->num_firstvertex), c = (varray_color4f + 4 * surface->num_firstvertex);i < surface->num_vertices;i++, v += 3, c += 4)
-                                       {
-                                               VectorSubtract(v, modelorg, diff);
-                                               f = exp(fogdensity/DotProduct(diff, diff));
-                                               c[0] = r;
-                                               c[1] = g;
-                                               c[2] = b;
-                                               c[3] = f * a;
-                                       }
-                               }
-                               GL_LockArrays(surface->num_firstvertex, surface->num_vertices);
-                               R_Mesh_Draw(surface->num_firstvertex, surface->num_vertices, surface->num_triangles, (surface->groupmesh->data_element3i + 3 * surface->num_firsttriangle));
-                               GL_LockArrays(0, 0);
-                       }
-               }
-       }
-}
        if (texture->textureflags & Q3TEXTUREFLAG_TWOSIDED)
                qglEnable(GL_CULL_FACE);
 }