+
+ m.tex[0] = R_GetTexture(basetexture);
+ m.texcubemap[1] = R_GetTexture(lightcubemap);
+ m.texcombinergb[0] = GL_MODULATE;
+ m.texcombinergb[1] = GL_MODULATE;
+ R_Mesh_TextureState(&m);
+ qglColorMask(1,1,1,0);
+ qglBlendFunc(GL_DST_ALPHA, GL_ONE);
+
+ VectorScale(lightcolor, r_colorscale * r_shadow_lightintensityscale.value, color2);
+ for (renders = 0;renders < 64 && (color2[0] > 0 || color2[1] > 0 || color2[2] > 0);renders++, color2[0]--, color2[1]--, color2[2]--)
+ {
+ color[0] = bound(0, color2[0], 1);
+ color[1] = bound(0, color2[1], 1);
+ color[2] = bound(0, color2[2], 1);
+ GL_Color(color[0], color[1], color[2], 1);
+ R_Mesh_GetSpace(numverts);
+ R_Mesh_CopyVertex3f(vertex3f, numverts);
+ R_Mesh_CopyTexCoord2f(0, texcoord2f, numverts);
+ if (lightcubemap)
+ R_Shadow_Transform_Vertex3f_TexCoord3f(varray_texcoord3f[1], numverts, vertex3f, matrix_modeltofilter);
+ R_Mesh_Draw(numverts, numtriangles, elements);
+ c_rt_lightmeshes++;
+ c_rt_lighttris += numtriangles;
+ }
+ }
+ }
+ else
+ {
+ if (r_textureunits.integer >= 2)
+ {
+ // voodoo2
+#if 1
+ m.tex[0] = R_GetTexture(basetexture);
+ m.tex[1] = R_GetTexture(r_shadow_attenuation2dtexture);
+ R_Mesh_TextureState(&m);
+ qglBlendFunc(GL_SRC_ALPHA, GL_ONE);
+ qglEnable(GL_BLEND);
+#else
+ m.tex[0] = R_GetTexture(basetexture);
+ m.tex[1] = R_GetTexture(r_shadow_attenuation2dtexture);
+ m.blendfunc1 = GL_SRC_ALPHA;
+ m.blendfunc2 = GL_ONE;
+ R_Mesh_State(&m);
+#endif
+ VectorScale(lightcolor, r_colorscale * r_shadow_lightintensityscale.value, color2);
+ for (renders = 0;renders < 64 && (color2[0] > 0 || color2[1] > 0 || color2[2] > 0);renders++, color2[0]--, color2[1]--, color2[2]--)
+ {
+ color[0] = bound(0, color2[0], 1);
+ color[1] = bound(0, color2[1], 1);
+ color[2] = bound(0, color2[2], 1);
+ GL_UseColorArray();
+ R_Mesh_GetSpace(numverts);
+ R_Mesh_CopyVertex3f(vertex3f, numverts);
+ R_Mesh_CopyTexCoord2f(0, texcoord2f, numverts);
+ R_Shadow_Transform_Vertex3f_TexCoord2f(varray_texcoord2f[1], numverts, vertex3f, matrix_modeltoattenuationxyz);
+ R_Shadow_VertexLightingWithXYAttenuationTexture(numverts, vertex3f, normal3f, color, matrix_modeltofilter);
+ R_Mesh_Draw(numverts, numtriangles, elements);
+ }
+ }
+ else
+ {
+ // voodoo1
+#if 1
+ m.tex[0] = R_GetTexture(basetexture);
+ R_Mesh_TextureState(&m);
+ qglBlendFunc(GL_SRC_ALPHA, GL_ONE);
+ qglEnable(GL_BLEND);
+#else
+ m.tex[0] = R_GetTexture(basetexture);
+ m.blendfunc1 = GL_SRC_ALPHA;
+ m.blendfunc2 = GL_ONE;
+ R_Mesh_State(&m);
+#endif
+ VectorScale(lightcolor, r_colorscale * r_shadow_lightintensityscale.value, color2);
+ for (renders = 0;renders < 64 && (color2[0] > 0 || color2[1] > 0 || color2[2] > 0);renders++, color2[0]--, color2[1]--, color2[2]--)
+ {
+ color[0] = bound(0, color2[0], 1);
+ color[1] = bound(0, color2[1], 1);
+ color[2] = bound(0, color2[2], 1);
+ GL_UseColorArray();
+ R_Mesh_GetSpace(numverts);
+ R_Mesh_CopyVertex3f(vertex3f, numverts);
+ R_Mesh_CopyTexCoord2f(0, texcoord2f, numverts);
+ R_Shadow_VertexLighting(numverts, vertex3f, normal3f, color, matrix_modeltofilter);
+ R_Mesh_Draw(numverts, numtriangles, elements);
+ }