- // LordHavoc: fast path version for no vertex lighting cases
- out = &wallvert[currentwallvert];
- for (p = s->polys;p;p = p->next)
- {
- if ((currentwallpoly >= MAX_WALLPOLYS) || (currentwallvert+p->numverts > MAX_WALLVERTS))
- return;
- wp = &wallpoly[currentwallpoly++];
- wp->texnum = (unsigned short) R_GetTexture(t->texture);
- wp->lighttexnum = (unsigned short) (lightmap_textures + s->lightmaptexturenum);
- wp->glowtexnum = (unsigned short) R_GetTexture(t->glowtexture);
- wp->firstvert = currentwallvert;
- wp->numverts = p->numverts;
- wp->lit = false;
- wp++;
- currentwallvert += p->numverts;
- v = p->verts[0];
- if (transform)
- {
- for (i = 0;i < p->numverts;i++, v += VERTEXSIZE, out++)
- {
- softwaretransform(v, out->vert);
- out->vert[3] = v[3];
- out->vert[4] = v[4];
- out->vert[5] = v[5];
- out->vert[6] = v[6];
- }
- }
- else
- {
- /*
- for (i = 0;i < p->numverts;i++, v += VERTEXSIZE, out++)
- {
- VectorCopy(v, out->vert);
- out->vert[3] = v[3];
- out->vert[4] = v[4];
- out->vert[5] = v[5];
- out->vert[6] = v[6];
- }
- */
- memcpy(out, v, sizeof(vec_t) * VERTEXSIZE * p->numverts);
- out += p->numverts;
- }
- }
- }
- else
- {
- float *wv;
- wv = wvert;
- for (p = s->polys;p;p = p->next)
- {
- for (i = 0, v = p->verts[0];i < p->numverts;i++, v += VERTEXSIZE)
- {
- if (transform)
- softwaretransform(v, wv);
- else
- VectorCopy(v, wv);
- wv[3] = wv[4] = wv[5] = 0.0f;
- wv += 6;
- }
- verts += p->numverts;
- polys++;
- }
- if ((currentwallpoly + polys > MAX_WALLPOLYS) || (currentwallvert+verts > MAX_WALLVERTS))
- return;
- if ((!r_dlightmap.value) && s->dlightframe == r_framecount)
- lit = RSurf_Light(s->dlightbits, s->polys);
- wv = wvert;
- wp = &wallpoly[currentwallpoly];
- out = &wallvert[currentwallvert];
- outcolor = &wallvertcolor[currentwallvert];
- currentwallpoly += polys;
- for (p = s->polys;p;p = p->next)
- {
- v = p->verts[0];
- wp->texnum = (unsigned short) R_GetTexture(t->texture);
- wp->lighttexnum = (unsigned short) (lightmap_textures + s->lightmaptexturenum);
- wp->glowtexnum = (unsigned short) R_GetTexture(t->glowtexture);
- wp->firstvert = currentwallvert;
- wp->numverts = p->numverts;
- wp->lit = lit;
- wp++;
- currentwallvert += p->numverts;
- for (i = 0;i < p->numverts;i++, v += VERTEXSIZE, wv += 6, out++, outcolor++)
- {
- if (lit)
- {
- if (lighthalf)
- {
- outcolor->r = (byte) (bound(0, (int) wv[3] >> 1, 255));
- outcolor->g = (byte) (bound(0, (int) wv[4] >> 1, 255));
- outcolor->b = (byte) (bound(0, (int) wv[5] >> 1, 255));
- outcolor->a = 255;
- }
- else
- {
- outcolor->r = (byte) (bound(0, (int) wv[3], 255));
- outcolor->g = (byte) (bound(0, (int) wv[4], 255));
- outcolor->b = (byte) (bound(0, (int) wv[5], 255));
- outcolor->a = 255;
- }
- }
- out->vert[0] = wv[0];
- out->vert[1] = wv[1];
- out->vert[2] = wv[2];
- out->vert[3] = v[3];
- out->vert[4] = v[4];
- out->vert[5] = v[5];
- out->vert[6] = v[6];
- }
- }