+ if (depthonly)
+ {
+ if ((rsurface_texture->currentmaterialflags & (MATERIALFLAG_NODEPTHTEST | MATERIALFLAG_BLENDED | MATERIALFLAG_ALPHATEST)))
+ return;
+ if (rsurface_mode != RSURFMODE_MULTIPASS)
+ rsurface_mode = RSURFMODE_MULTIPASS;
+ if (r_depthfirst.integer == 3)
+ {
+ int i = (int)(texturesurfacelist[0] - rsurface_model->data_surfaces);
+ GL_Color(((i >> 6) & 7) / 7.0f, ((i >> 3) & 7) / 7.0f, (i & 7) / 7.0f,1);
+ }
+ else
+ {
+ GL_ColorMask(0,0,0,0);
+ GL_Color(1,1,1,1);
+ }
+ GL_DepthRange(0, (rsurface_texture->currentmaterialflags & MATERIALFLAG_SHORTDEPTHRANGE) ? 0.0625 : 1);
+ GL_CullFace((rsurface_texture->currentmaterialflags & MATERIALFLAG_NOCULLFACE) ? GL_NONE : GL_FRONT); // quake is backwards, this culls back faces
+ GL_DepthTest(true);
+ GL_BlendFunc(GL_ONE, GL_ZERO);
+ GL_DepthMask(true);
+ GL_AlphaTest(false);
+ R_Mesh_ColorPointer(NULL, 0, 0);
+ R_Mesh_ResetTextureState();
+ RSurf_PrepareVerticesForBatch(false, false, texturenumsurfaces, texturesurfacelist);
+ RSurf_DrawBatch_Simple(texturenumsurfaces, texturesurfacelist);
+ GL_ColorMask(r_view.colormask[0], r_view.colormask[1], r_view.colormask[2], 1);
+ r_refdef.stats.entities_surfaces += texturenumsurfaces;
+ }
+ else if (r_depthfirst.integer == 3)
+ return;
+ else if (r_showsurfaces.integer)
+ {
+ if (rsurface_mode != RSURFMODE_MULTIPASS)
+ rsurface_mode = RSURFMODE_MULTIPASS;
+ GL_DepthRange(0, (rsurface_texture->currentmaterialflags & MATERIALFLAG_SHORTDEPTHRANGE) ? 0.0625 : 1);
+ GL_DepthTest(true);
+ GL_CullFace((rsurface_texture->currentmaterialflags & MATERIALFLAG_NOCULLFACE) ? GL_NONE : GL_FRONT); // quake is backwards, this culls back faces
+ GL_BlendFunc(GL_ONE, GL_ZERO);
+ GL_DepthMask(writedepth);
+ GL_Color(1,1,1,1);
+ GL_AlphaTest(false);
+ R_Mesh_ColorPointer(NULL, 0, 0);
+ R_Mesh_ResetTextureState();
+ RSurf_PrepareVerticesForBatch(false, false, texturenumsurfaces, texturesurfacelist);