+#if 0
+ int i, size3;
+ surfvertex_t *v;
+ float *outv, *outc, *outst, *outuv, cl, ca, diff[3];
+ float base[3], scale, f;
+ qbyte *lm;
+ surfmesh_t *mesh;
+ rmeshbufferinfo_t m;
+ memset(&m, 0, sizeof(m));
+ if (currentrenderentity->effects & EF_ADDITIVE)
+ {
+ m.transparent = true;
+ m.blendfunc1 = GL_SRC_ALPHA;
+ m.blendfunc2 = GL_ONE;
+ }
+ else if (surf->currenttexture->fogtexture != NULL || currentrenderentity->alpha != 1)
+ {
+ m.transparent = true;
+ m.blendfunc1 = GL_SRC_ALPHA;
+ m.blendfunc2 = GL_ONE_MINUS_SRC_ALPHA;
+ }
+ else
+ {
+ m.transparent = false;
+ m.blendfunc1 = GL_ONE;
+ m.blendfunc2 = GL_ZERO;
+ }
+ m.depthwrite = false;
+ m.depthdisable = false;
+ m.tex[0] = R_GetTexture(surf->currenttexture->texture);
+
+ size3 = ((surf->extents[0]>>4)+1)*((surf->extents[1]>>4)+1)*3;
+
+ base[0] = base[1] = base[2] = currentrenderentity->effects & EF_FULLBRIGHT ? 2.0f : r_ambient.value * (1.0f / 64.0f) + surf->flags & SURF_LIGHTMAP ? 0 : ;
+
+ ca = currentrenderentity->alpha;
+ for (mesh = surf->mesh;mesh;mesh = mesh->chain)
+ {
+ m.numtriangles = mesh->numtriangles;
+ m.numverts = mesh->numverts;
+
+ if (R_Mesh_Draw_GetBuffer(&m))
+ {
+ cl = m.colorscale;
+ memcpy(m.index, mesh->index, m.numtriangles * sizeof(int[3]));
+
+ for (i = 0, v = mesh->vertex, outv = m.vertex, outc = m.color, outst = m.texcoords[0], outuv = m.texcoords[1];i < m.numverts;i++, v++, outv += 4, outc += 4, outst += 2, outuv += 2)
+ {
+ softwaretransform(v->v, outv);
+ outv[3] = 1;
+ VectorCopy(base, outc);
+ outc[3] = ca;
+ outst[0] = v->st[0];
+ outst[1] = v->st[1];
+ }
+
+ if (surf->dlightframe == r_framecount)
+ RSurf_LightSeparate(surf->dlightbits, m.numverts, m.vertex, m.color);
+
+ for (i = 0, v = mesh->vertex, outv = m.vertex, outc = m.color;i < m.numverts;i++, v++, outv += 4, outc += 4)
+ {
+ if (surf->flags & SURF_LIGHTMAP)
+ if (surf->styles[0] != 255)
+ {
+ lm = surf->samples + v->lightmapoffset;
+ scale = d_lightstylevalue[surf->styles[0]] * (1.0f / 32768.0f);
+ VectorMA(outc, scale, lm, outc);
+ if (surf->styles[1] != 255)
+ {
+ lm += size3;
+ scale = d_lightstylevalue[surf->styles[1]] * (1.0f / 32768.0f);
+ VectorMA(outc, scale, lm, outc);
+ if (surf->styles[2] != 255)
+ {
+ lm += size3;
+ scale = d_lightstylevalue[surf->styles[2]] * (1.0f / 32768.0f);
+ VectorMA(outc, scale, lm, outc);
+ if (surf->styles[3] != 255)
+ {
+ lm += size3;
+ scale = d_lightstylevalue[surf->styles[3]] * (1.0f / 32768.0f);
+ VectorMA(outc, scale, lm, outc);
+ }
+ }
+ }
+ }
+ if (fogenabled)
+ {
+ VectorSubtract(outv, r_origin, diff);
+ f = cl * (1 - exp(fogdensity/DotProduct(diff, diff)));
+ VectorScale(outc, f, outc);
+ }
+ else
+ VectorScale(outc, cl, outc);
+ }
+ }
+ }
+ int i;
+ surfvertex_t *v;
+ float *outv, *outc, *outst, *outuv, cl, ca, diff[3];
+ surfmesh_t *mesh;
+ rmeshbufferinfo_t m;
+ memset(&m, 0, sizeof(m));
+ if (currentrenderentity->effects & EF_ADDITIVE)
+ {
+ m.transparent = true;
+ m.blendfunc1 = GL_SRC_ALPHA;
+ m.blendfunc2 = GL_ONE;
+ }
+ else if (surf->currenttexture->fogtexture != NULL || currentrenderentity->alpha != 1)
+ {
+ m.transparent = true;
+ m.blendfunc1 = GL_SRC_ALPHA;
+ m.blendfunc2 = GL_ONE_MINUS_SRC_ALPHA;
+ }
+ else
+ {
+ m.transparent = false;
+ m.blendfunc1 = GL_ONE;
+ m.blendfunc2 = GL_ZERO;
+ }
+ m.depthwrite = false;
+ m.depthdisable = false;
+ m.tex[0] = R_GetTexture(surf->currenttexture->texture);
+ m.tex[1] = R_GetTexture(surf->lightmaptexture);
+ ca = currentrenderentity->alpha;
+ for (mesh = surf->mesh;mesh;mesh = mesh->chain)
+ {
+ m.numtriangles = mesh->numtriangles;
+ m.numverts = mesh->numverts;
+
+ if (R_Mesh_Draw_GetBuffer(&m))
+ {
+ cl = (float) (1 << lightscalebit) * m.colorscale;
+ memcpy(m.index, mesh->index, m.numtriangles * sizeof(int[3]));
+ for (i = 0, v = mesh->vertex, outv = m.vertex, outc = m.color, outst = m.texcoords[0], outuv = m.texcoords[1];i < m.numverts;i++, v++, outv += 4, outc += 4, outst += 2, outuv += 2)
+ {
+ softwaretransform(v->v, outv);
+ if (r_waterripple.value)
+ outv[2] += r_waterripple.value * (1.0f / 64.0f) * turbsin[(int)((v->v[0]*(1.0f/32.0f)+cl.time) * TURBSCALE) & 255] * turbsin[(int)((v->v[1]*(1.0f/32.0f)+cl.time) * TURBSCALE) & 255];
+ outv[3] = 1;
+ if (fogenabled)
+ {
+ VectorSubtract(outv, r_origin, diff);
+ outc[0] = outc[1] = outc[2] = cl * (1 - exp(fogdensity/DotProduct(diff, diff)));
+ }
+ else
+ outc[0] = outc[1] = outc[2] = cl;
+ outc[3] = ca;
+ outst[0] = v->st[0];
+ outst[1] = v->st[1];
+ outuv[0] = v->uv[0];
+ outuv[1] = v->uv[1];
+ }
+ }
+ }
+#else