- }
- else if (r_textureunits.integer >= 4)
- {
- // 4/2 2D combine path
- m.tex[0] = R_GetTexture(bumptexture);
- m.texcubemap[1] = R_GetTexture(r_shadow_normalscubetexture);
- m.texcombinergb[0] = GL_REPLACE;
- m.texcombinergb[1] = GL_DOT3_RGBA_ARB;
- m.tex[2] = R_GetTexture(r_shadow_attenuation2dtexture);
- m.tex[3] = R_GetTexture(r_shadow_attenuation2dtexture);
- R_Mesh_TextureState(&m);
- qglColorMask(0,0,0,1);
- qglDisable(GL_BLEND);
- GL_Color(1,1,1,1);
- memcpy(varray_texcoord[0], texcoords, numverts * sizeof(float[4]));
- R_Shadow_GenTexCoords_Diffuse_NormalCubeMap(varray_texcoord[1], numverts, varray_vertex, svectors, tvectors, normals, relativelightorigin);
- R_Shadow_TransformVertices(varray_texcoord[2], numverts, varray_vertex, matrix_worldtoattenuationxyz);
- R_Shadow_TransformVertices(varray_texcoord[3], numverts, varray_vertex, matrix_worldtoattenuationz);
- R_Mesh_Draw(numverts, numtriangles, elements);
- c_rt_lightmeshes++;
- c_rt_lighttris += numtriangles;
-
- m.tex[0] = R_GetTexture(basetexture);
- m.texcubemap[1] = R_GetTexture(lightcubemap);
- m.texcombinergb[0] = GL_MODULATE;
- m.texcombinergb[1] = GL_MODULATE;
- m.tex[2] = 0;
- m.tex[3] = 0;
- R_Mesh_TextureState(&m);
- qglColorMask(1,1,1,0);
- qglBlendFunc(GL_DST_ALPHA, GL_ONE);
- qglEnable(GL_BLEND);
- if (lightcubemap)
- R_Shadow_TransformVertices(varray_texcoord[1], numverts, varray_vertex, matrix_worldtofilter);
-
- VectorScale(lightcolor, r_colorscale * r_shadow_lightintensityscale.value, color);
- for (renders = 0;renders < 64 && (color[0] > 0 || color[1] > 0 || color[2] > 0);renders++, color[0] = max(0, color[0] - 1.0f), color[1] = max(0, color[1] - 1.0f), color[2] = max(0, color[2] - 1.0f))
+ else if (r_textureunits.integer >= 4)
+ {
+ // 4/2 2D combine path
+ m.tex[0] = R_GetTexture(bumptexture);
+ m.texcubemap[1] = R_GetTexture(r_shadow_normalscubetexture);
+ m.texcombinergb[0] = GL_REPLACE;
+ m.texcombinergb[1] = GL_DOT3_RGBA_ARB;
+ m.tex[2] = R_GetTexture(r_shadow_attenuation2dtexture);
+ m.tex[3] = R_GetTexture(r_shadow_attenuation2dtexture);
+ R_Mesh_TextureState(&m);
+ qglColorMask(0,0,0,1);
+ qglDisable(GL_BLEND);
+ GL_Color(1,1,1,1);
+ R_Mesh_GetSpace(numverts);
+ memcpy(varray_vertex, vertices, numverts * sizeof(float[4]));
+ memcpy(varray_texcoord[0], texcoords, numverts * sizeof(float[4]));
+ R_Shadow_GenTexCoords_Diffuse_NormalCubeMap(varray_texcoord[1], numverts, vertices, svectors, tvectors, normals, relativelightorigin);
+ R_Shadow_TransformVertices(varray_texcoord[2], numverts, vertices, matrix_modeltoattenuationxyz);
+ R_Shadow_TransformVertices(varray_texcoord[3], numverts, vertices, matrix_modeltoattenuationz);
+ R_Mesh_Draw(numverts, numtriangles, elements);
+ c_rt_lightmeshes++;
+ c_rt_lighttris += numtriangles;
+
+ m.tex[0] = R_GetTexture(basetexture);
+ m.texcubemap[1] = R_GetTexture(lightcubemap);
+ m.texcombinergb[0] = GL_MODULATE;
+ m.texcombinergb[1] = GL_MODULATE;
+ m.tex[2] = 0;
+ m.tex[3] = 0;
+ R_Mesh_TextureState(&m);
+ qglColorMask(1,1,1,0);
+ qglBlendFunc(GL_DST_ALPHA, GL_ONE);
+ qglEnable(GL_BLEND);
+
+ VectorScale(lightcolor, r_colorscale * r_shadow_lightintensityscale.value, color);
+ for (renders = 0;renders < 64 && (color[0] > 0 || color[1] > 0 || color[2] > 0);renders++, color[0] = max(0, color[0] - 1.0f), color[1] = max(0, color[1] - 1.0f), color[2] = max(0, color[2] - 1.0f))
+ {
+ GL_Color(color[0], color[1], color[2], 1);
+ R_Mesh_GetSpace(numverts);
+ memcpy(varray_vertex, vertices, numverts * sizeof(float[4]));
+ memcpy(varray_texcoord[0], texcoords, numverts * sizeof(float[4]));
+ if (lightcubemap)
+ R_Shadow_TransformVertices(varray_texcoord[1], numverts, vertices, matrix_modeltofilter);
+ R_Mesh_Draw(numverts, numtriangles, elements);
+ c_rt_lightmeshes++;
+ c_rt_lighttris += numtriangles;
+ }
+ }
+ else