+ R_ShadowVolumeLighting(true);
+ R_TimeReport("shadowvolume");
+ }
+ R_Mesh_Finish();
+ R_TimeReport("meshfinish");
+}
+
+/*
+void R_DrawBBoxMesh(vec3_t mins, vec3_t maxs, float cr, float cg, float cb, float ca)
+{
+ int i;
+ float *v, *c, f1, f2, diff[3];
+ rmeshstate_t m;
+ m.blendfunc1 = GL_SRC_ALPHA;
+ m.blendfunc2 = GL_ONE_MINUS_SRC_ALPHA;
+ R_Mesh_Matrix(&r_identitymatrix);
+ R_Mesh_State(&m);
+
+ varray_vertex[ 0] = mins[0];varray_vertex[ 1] = mins[1];varray_vertex[ 2] = mins[2];
+ varray_vertex[ 4] = maxs[0];varray_vertex[ 5] = mins[1];varray_vertex[ 6] = mins[2];
+ varray_vertex[ 8] = mins[0];varray_vertex[ 9] = maxs[1];varray_vertex[10] = mins[2];
+ varray_vertex[12] = maxs[0];varray_vertex[13] = maxs[1];varray_vertex[14] = mins[2];
+ varray_vertex[16] = mins[0];varray_vertex[17] = mins[1];varray_vertex[18] = maxs[2];
+ varray_vertex[20] = maxs[0];varray_vertex[21] = mins[1];varray_vertex[22] = maxs[2];
+ varray_vertex[24] = mins[0];varray_vertex[25] = maxs[1];varray_vertex[26] = maxs[2];
+ varray_vertex[28] = maxs[0];varray_vertex[29] = maxs[1];varray_vertex[30] = maxs[2];
+ R_FillColors(varray_color, 8, cr * r_colorscale, cg * r_colorscale, cb * r_colorscale, ca);
+ if (fogenabled)
+ {
+ for (i = 0, v = varray_vertex, c = varray_color;i < 8;i++, v += 4, c += 4)
+ {
+ VectorSubtract(v, r_origin, diff);
+ f2 = exp(fogdensity/DotProduct(diff, diff));
+ f1 = 1 - f2;
+ f2 *= r_colorscale;
+ c[0] = c[0] * f1 + fogcolor[0] * f2;
+ c[1] = c[1] * f1 + fogcolor[1] * f2;
+ c[2] = c[2] * f1 + fogcolor[2] * f2;
+ }
+ }
+ GL_UseColorArray();
+ R_Mesh_Draw(8, 12);
+}
+*/
+
+void R_DrawNoModelCallback(const void *calldata1, int calldata2)
+{
+ const entity_render_t *ent = calldata1;
+ int i, element[24];
+ float f1, f2, *c, diff[3];
+ rmeshstate_t m;
+ memset(&m, 0, sizeof(m));
+ if (ent->flags & EF_ADDITIVE)
+ {
+ m.blendfunc1 = GL_SRC_ALPHA;
+ m.blendfunc2 = GL_ONE;
+ }
+ else if (ent->alpha < 1)
+ {
+ m.blendfunc1 = GL_SRC_ALPHA;
+ m.blendfunc2 = GL_ONE_MINUS_SRC_ALPHA;
+ }
+ else
+ {
+ m.blendfunc1 = GL_ONE;
+ m.blendfunc2 = GL_ZERO;
+ }
+ R_Mesh_Matrix(&ent->matrix);
+ R_Mesh_State(&m);
+
+ element[ 0] = 5;element[ 1] = 2;element[ 2] = 0;
+ element[ 3] = 5;element[ 4] = 1;element[ 5] = 2;
+ element[ 6] = 5;element[ 7] = 0;element[ 8] = 3;
+ element[ 9] = 5;element[10] = 3;element[11] = 1;
+ element[12] = 0;element[13] = 2;element[14] = 4;
+ element[15] = 2;element[16] = 1;element[17] = 4;
+ element[18] = 3;element[19] = 0;element[20] = 4;
+ element[21] = 1;element[22] = 3;element[23] = 4;
+ varray_vertex[ 0] = -16;varray_vertex[ 1] = 0;varray_vertex[ 2] = 0;
+ varray_vertex[ 4] = 16;varray_vertex[ 5] = 0;varray_vertex[ 6] = 0;
+ varray_vertex[ 8] = 0;varray_vertex[ 9] = -16;varray_vertex[10] = 0;
+ varray_vertex[12] = 0;varray_vertex[13] = 16;varray_vertex[14] = 0;
+ varray_vertex[16] = 0;varray_vertex[17] = 0;varray_vertex[18] = -16;
+ varray_vertex[20] = 0;varray_vertex[21] = 0;varray_vertex[22] = 16;
+ varray_color[ 0] = 0.00f * r_colorscale;varray_color[ 1] = 0.00f * r_colorscale;varray_color[ 2] = 0.50f * r_colorscale;varray_color[ 3] = ent->alpha;
+ varray_color[ 4] = 0.00f * r_colorscale;varray_color[ 5] = 0.00f * r_colorscale;varray_color[ 6] = 0.50f * r_colorscale;varray_color[ 7] = ent->alpha;
+ varray_color[ 8] = 0.00f * r_colorscale;varray_color[ 9] = 0.50f * r_colorscale;varray_color[10] = 0.00f * r_colorscale;varray_color[11] = ent->alpha;
+ varray_color[12] = 0.00f * r_colorscale;varray_color[13] = 0.50f * r_colorscale;varray_color[14] = 0.00f * r_colorscale;varray_color[15] = ent->alpha;
+ varray_color[16] = 0.50f * r_colorscale;varray_color[17] = 0.00f * r_colorscale;varray_color[18] = 0.00f * r_colorscale;varray_color[19] = ent->alpha;
+ varray_color[20] = 0.50f * r_colorscale;varray_color[21] = 0.00f * r_colorscale;varray_color[22] = 0.00f * r_colorscale;varray_color[23] = ent->alpha;
+ if (fogenabled)
+ {
+ VectorSubtract(ent->origin, r_origin, diff);
+ f2 = exp(fogdensity/DotProduct(diff, diff));
+ f1 = 1 - f2;
+ for (i = 0, c = varray_color;i < 6;i++, c += 4)
+ {
+ c[0] = (c[0] * f1 + fogcolor[0] * f2) * r_colorscale;
+ c[1] = (c[1] * f1 + fogcolor[1] * f2) * r_colorscale;
+ c[2] = (c[2] * f1 + fogcolor[2] * f2) * r_colorscale;
+ }