+
+ // add the vertices of the surfaces to a world bounding box so we can scissor the sky render later
+ if (r_sky_scissor.integer)
+ {
+ RSurf_PrepareVerticesForBatch(BATCHNEED_ARRAY_VERTEX | BATCHNEED_ALLOWMULTIDRAW, texturenumsurfaces, texturesurfacelist);
+ for (i = 0; i < texturenumsurfaces; i++)
+ {
+ const msurface_t *surf = texturesurfacelist[i];
+ const float *v;
+ float p[3];
+ for (j = 0, v = rsurface.batchvertex3f + 3 * surf->num_firstvertex; j < surf->num_vertices; j++, v += 3)
+ {
+ Matrix4x4_Transform(&rsurface.matrix, v, p);
+ if (skyscissor)
+ {
+ if (skyscissormins[0] > p[0]) skyscissormins[0] = p[0];
+ if (skyscissormins[1] > p[1]) skyscissormins[1] = p[1];
+ if (skyscissormins[2] > p[2]) skyscissormins[2] = p[2];
+ if (skyscissormaxs[0] < p[0]) skyscissormaxs[0] = p[0];
+ if (skyscissormaxs[1] < p[1]) skyscissormaxs[1] = p[1];
+ if (skyscissormaxs[2] < p[2]) skyscissormaxs[2] = p[2];
+ }
+ else
+ {
+ VectorCopy(p, skyscissormins);
+ VectorCopy(p, skyscissormaxs);
+ skyscissor = true;
+ }
+ }
+ }
+ }
+
+ // LadyHavoc: HalfLife maps have freaky skypolys so don't use