}
}
+#define USETEXMATRIX 0 // broken
void R_Shadow_RenderLighting(int numverts, int numtriangles, const int *elements, const float *vertex3f, const float *svector3f, const float *tvector3f, const float *normal3f, const float *texcoord2f, const float *relativelightorigin, const float *relativeeyeorigin, const float *lightcolor, const matrix4x4_t *matrix_modeltolight, const matrix4x4_t *matrix_modeltoattenuationxyz, const matrix4x4_t *matrix_modeltoattenuationz, rtexture_t *basetexture, rtexture_t *bumptexture, rtexture_t *glosstexture, rtexture_t *lightcubemap, int lighting)
{
int renders;
memset(&m, 0, sizeof(m));
m.pointer_vertex = vertex3f;
m.tex[0] = R_GetTexture(bumptexture);
- m.pointer_texcoord[0] = texcoord2f;
m.texcombinergb[0] = GL_REPLACE;
+ m.pointer_texcoord[0] = texcoord2f;
m.texcubemap[1] = R_GetTexture(r_shadow_normalcubetexture);
m.texcombinergb[1] = GL_DOT3_RGBA_ARB;
- m.pointer_texcoord[1] = varray_texcoord3f[1];
+ m.pointer_texcoord3f[1] = varray_texcoord3f[1];
R_Shadow_GenTexCoords_Diffuse_NormalCubeMap(varray_texcoord3f[1], numverts, vertex3f, svector3f, tvector3f, normal3f, relativelightorigin);
m.tex3d[2] = R_GetTexture(r_shadow_attenuation3dtexture);
- m.pointer_texcoord[2] = varray_texcoord3f[2];
+#if USETEXMATRIX
+ m.pointer_texcoord3f[2] = vertex3f;
+ m.texmatrix[2] = *matrix_modeltoattenuationxyz;
+#else
+ m.pointer_texcoord3f[2] = varray_texcoord3f[2];
R_Shadow_Transform_Vertex3f_TexCoord3f(varray_texcoord3f[2], numverts, vertex3f, matrix_modeltoattenuationxyz);
+#endif
R_Mesh_State(&m);
GL_ColorMask(0,0,0,1);
GL_BlendFunc(GL_ONE, GL_ZERO);
GL_LockArrays(0, 0);
c_rt_lightmeshes++;
c_rt_lighttris += numtriangles;
-
+
memset(&m, 0, sizeof(m));
m.pointer_vertex = vertex3f;
m.tex[0] = R_GetTexture(basetexture);
if (lightcubemap)
{
m.texcubemap[1] = R_GetTexture(lightcubemap);
- m.pointer_texcoord[1] = varray_texcoord3f[1];
+#if USETEXMATRIX
+ m.pointer_texcoord3f[1] = vertex3f;
+ m.texmatrix[1] = *matrix_modeltolight;
+#else
+ m.pointer_texcoord3f[1] = varray_texcoord3f[1];
R_Shadow_Transform_Vertex3f_TexCoord3f(varray_texcoord3f[1], numverts, vertex3f, matrix_modeltolight);
+#endif
}
R_Mesh_State(&m);
GL_LockArrays(0, numverts);
memset(&m, 0, sizeof(m));
m.pointer_vertex = vertex3f;
m.tex3d[0] = R_GetTexture(r_shadow_attenuation3dtexture);
- m.pointer_texcoord[0] = varray_texcoord3f[0];
+#if USETEXMATRIX
+ m.pointer_texcoord3f[0] = vertex3f;
+ m.texmatrix[0] = *matrix_modeltoattenuationxyz;
+#else
+ m.pointer_texcoord3f[0] = varray_texcoord3f[0];
R_Shadow_Transform_Vertex3f_TexCoord3f(varray_texcoord3f[0], numverts, vertex3f, matrix_modeltoattenuationxyz);
+#endif
R_Mesh_State(&m);
GL_ColorMask(0,0,0,1);
GL_BlendFunc(GL_ONE, GL_ZERO);
GL_LockArrays(0, 0);
c_rt_lightmeshes++;
c_rt_lighttris += numtriangles;
-
+
memset(&m, 0, sizeof(m));
m.pointer_vertex = vertex3f;
m.tex[0] = R_GetTexture(bumptexture);
m.pointer_texcoord[0] = texcoord2f;
m.texcubemap[1] = R_GetTexture(r_shadow_normalcubetexture);
m.texcombinergb[1] = GL_DOT3_RGBA_ARB;
- m.pointer_texcoord[1] = varray_texcoord3f[1];
+ m.pointer_texcoord3f[1] = varray_texcoord3f[1];
R_Shadow_GenTexCoords_Diffuse_NormalCubeMap(varray_texcoord3f[1], numverts, vertex3f, svector3f, tvector3f, normal3f, relativelightorigin);
R_Mesh_State(&m);
GL_BlendFunc(GL_DST_ALPHA, GL_ZERO);
GL_LockArrays(0, 0);
c_rt_lightmeshes++;
c_rt_lighttris += numtriangles;
-
+
memset(&m, 0, sizeof(m));
m.pointer_vertex = vertex3f;
m.tex[0] = R_GetTexture(basetexture);
if (lightcubemap)
{
m.texcubemap[1] = R_GetTexture(lightcubemap);
- m.pointer_texcoord[1] = varray_texcoord3f[1];
+#if USETEXMATRIX
+ m.pointer_texcoord3f[1] = vertex3f;
+ m.texmatrix[1] = *matrix_modeltolight;
+#else
+ m.pointer_texcoord3f[1] = varray_texcoord3f[1];
R_Shadow_Transform_Vertex3f_TexCoord3f(varray_texcoord3f[1], numverts, vertex3f, matrix_modeltolight);
+#endif
}
R_Mesh_State(&m);
GL_LockArrays(0, numverts);
m.pointer_texcoord[0] = texcoord2f;
m.texcubemap[1] = R_GetTexture(r_shadow_normalcubetexture);
m.texcombinergb[1] = GL_DOT3_RGBA_ARB;
- m.pointer_texcoord[1] = varray_texcoord3f[1];
+ m.pointer_texcoord3f[1] = varray_texcoord3f[1];
R_Shadow_GenTexCoords_Diffuse_NormalCubeMap(varray_texcoord3f[1], numverts, vertex3f, svector3f, tvector3f, normal3f, relativelightorigin);
R_Mesh_State(&m);
GL_ColorMask(0,0,0,1);
GL_LockArrays(0, 0);
c_rt_lightmeshes++;
c_rt_lighttris += numtriangles;
-
+
memset(&m, 0, sizeof(m));
m.pointer_vertex = vertex3f;
m.tex[0] = R_GetTexture(basetexture);
m.pointer_texcoord[0] = texcoord2f;
m.tex3d[1] = R_GetTexture(r_shadow_attenuation3dtexture);
- m.pointer_texcoord[1] = varray_texcoord3f[1];
+#if USETEXMATRIX
+ m.pointer_texcoord3f[1] = vertex3f;
+ m.texmatrix[1] = *matrix_modeltoattenuationxyz;
+#else
+ m.pointer_texcoord3f[1] = varray_texcoord3f[1];
R_Shadow_Transform_Vertex3f_TexCoord3f(varray_texcoord3f[1], numverts, vertex3f, matrix_modeltoattenuationxyz);
+#endif
R_Mesh_State(&m);
GL_LockArrays(0, numverts);
GL_ColorMask(1,1,1,0);
m.pointer_texcoord[0] = texcoord2f;
m.texcubemap[1] = R_GetTexture(r_shadow_normalcubetexture);
m.texcombinergb[1] = GL_DOT3_RGBA_ARB;
- m.pointer_texcoord[1] = varray_texcoord3f[1];
+ m.pointer_texcoord3f[1] = varray_texcoord3f[1];
R_Shadow_GenTexCoords_Diffuse_NormalCubeMap(varray_texcoord3f[1], numverts, vertex3f, svector3f, tvector3f, normal3f, relativelightorigin);
m.tex[2] = R_GetTexture(r_shadow_attenuation2dtexture);
+#if USETEXMATRIX
+ m.pointer_texcoord3f[2] = vertex3f;
+ m.texmatrix[2] = *matrix_modeltoattenuationxyz;
+#else
m.pointer_texcoord[2] = varray_texcoord2f[2];
R_Shadow_Transform_Vertex3f_TexCoord2f(varray_texcoord2f[2], numverts, vertex3f, matrix_modeltoattenuationxyz);
+#endif
m.tex[3] = R_GetTexture(r_shadow_attenuation2dtexture);
+#if USETEXMATRIX
+ m.pointer_texcoord3f[3] = vertex3f;
+ m.texmatrix[3] = *matrix_modeltoattenuationz;
+#else
m.pointer_texcoord[3] = varray_texcoord2f[3];
R_Shadow_Transform_Vertex3f_TexCoord2f(varray_texcoord2f[3], numverts, vertex3f, matrix_modeltoattenuationz);
+#endif
R_Mesh_State(&m);
GL_ColorMask(0,0,0,1);
GL_BlendFunc(GL_ONE, GL_ZERO);
GL_LockArrays(0, 0);
c_rt_lightmeshes++;
c_rt_lighttris += numtriangles;
-
+
memset(&m, 0, sizeof(m));
m.pointer_vertex = vertex3f;
m.tex[0] = R_GetTexture(basetexture);
if (lightcubemap)
{
m.texcubemap[1] = R_GetTexture(lightcubemap);
- m.pointer_texcoord[1] = varray_texcoord3f[1];
+#if USETEXMATRIX
+ m.pointer_texcoord3f[1] = vertex3f;
+ m.texmatrix[1] = *matrix_modeltolight;
+#else
+ m.pointer_texcoord3f[1] = varray_texcoord3f[1];
R_Shadow_Transform_Vertex3f_TexCoord3f(varray_texcoord3f[1], numverts, vertex3f, matrix_modeltolight);
+#endif
}
R_Mesh_State(&m);
GL_LockArrays(0, numverts);
memset(&m, 0, sizeof(m));
m.pointer_vertex = vertex3f;
m.tex[0] = R_GetTexture(r_shadow_attenuation2dtexture);
+#if USETEXMATRIX
+ m.pointer_texcoord3f[0] = vertex3f;
+ m.texmatrix[0] = *matrix_modeltoattenuationxyz;
+#else
m.pointer_texcoord[0] = varray_texcoord2f[0];
R_Shadow_Transform_Vertex3f_TexCoord2f(varray_texcoord2f[0], numverts, vertex3f, matrix_modeltoattenuationxyz);
+#endif
m.tex[1] = R_GetTexture(r_shadow_attenuation2dtexture);
+#if USETEXMATRIX
+ m.pointer_texcoord3f[1] = vertex3f;
+ m.texmatrix[1] = *matrix_modeltoattenuationz;
+#else
m.pointer_texcoord[1] = varray_texcoord2f[1];
R_Shadow_Transform_Vertex3f_TexCoord2f(varray_texcoord2f[1], numverts, vertex3f, matrix_modeltoattenuationz);
+#endif
R_Mesh_State(&m);
GL_ColorMask(0,0,0,1);
GL_BlendFunc(GL_ONE, GL_ZERO);
GL_LockArrays(0, 0);
c_rt_lightmeshes++;
c_rt_lighttris += numtriangles;
-
+
memset(&m, 0, sizeof(m));
m.pointer_vertex = vertex3f;
m.tex[0] = R_GetTexture(bumptexture);
m.pointer_texcoord[0] = texcoord2f;
m.texcubemap[1] = R_GetTexture(r_shadow_normalcubetexture);
m.texcombinergb[1] = GL_DOT3_RGBA_ARB;
- m.pointer_texcoord[1] = varray_texcoord3f[1];
+ m.pointer_texcoord3f[1] = varray_texcoord3f[1];
R_Shadow_GenTexCoords_Diffuse_NormalCubeMap(varray_texcoord3f[1], numverts, vertex3f, svector3f, tvector3f, normal3f, relativelightorigin);
R_Mesh_State(&m);
GL_BlendFunc(GL_DST_ALPHA, GL_ZERO);
GL_LockArrays(0, 0);
c_rt_lightmeshes++;
c_rt_lighttris += numtriangles;
-
+
memset(&m, 0, sizeof(m));
m.pointer_vertex = vertex3f;
m.tex[0] = R_GetTexture(basetexture);
if (lightcubemap)
{
m.texcubemap[1] = R_GetTexture(lightcubemap);
- m.pointer_texcoord[1] = varray_texcoord3f[1];
+#if USETEXMATRIX
+ m.pointer_texcoord3f[1] = vertex3f;
+ m.texmatrix[1] = *matrix_modeltolight;
+#else
+ m.pointer_texcoord3f[1] = varray_texcoord3f[1];
R_Shadow_Transform_Vertex3f_TexCoord3f(varray_texcoord3f[1], numverts, vertex3f, matrix_modeltolight);
+#endif
}
R_Mesh_State(&m);
GL_LockArrays(0, numverts);
m.pointer_texcoord[0] = texcoord2f;
m.texcubemap[1] = R_GetTexture(r_shadow_normalcubetexture);
m.texcombinergb[1] = GL_DOT3_RGBA_ARB;
- m.pointer_texcoord[1] = varray_texcoord3f[1];
+ m.pointer_texcoord3f[1] = varray_texcoord3f[1];
R_Shadow_GenTexCoords_Specular_NormalCubeMap(varray_texcoord3f[1], numverts, vertex3f, svector3f, tvector3f, normal3f, relativelightorigin, relativeeyeorigin);
R_Mesh_State(&m);
GL_ColorMask(0,0,0,1);
GL_LockArrays(0, 0);
c_rt_lightmeshes++;
c_rt_lighttris += numtriangles;
-
+
memset(&m, 0, sizeof(m));
m.pointer_vertex = vertex3f;
R_Mesh_State(&m);
c_rt_lightmeshes++;
c_rt_lighttris += numtriangles;
GL_LockArrays(0, 0);
-
+
memset(&m, 0, sizeof(m));
m.pointer_vertex = vertex3f;
m.tex3d[0] = R_GetTexture(r_shadow_attenuation3dtexture);
- m.pointer_texcoord[0] = varray_texcoord3f[0];
+#if USETEXMATRIX
+ m.pointer_texcoord3f[0] = vertex3f;
+ m.texmatrix[0] = *matrix_modeltoattenuationxyz;
+#else
+ m.pointer_texcoord3f[0] = varray_texcoord3f[0];
R_Shadow_Transform_Vertex3f_TexCoord3f(varray_texcoord3f[0], numverts, vertex3f, matrix_modeltoattenuationxyz);
+#endif
R_Mesh_State(&m);
GL_BlendFunc(GL_DST_ALPHA, GL_ZERO);
GL_LockArrays(0, numverts);
GL_LockArrays(0, 0);
c_rt_lightmeshes++;
c_rt_lighttris += numtriangles;
-
+
memset(&m, 0, sizeof(m));
m.pointer_vertex = vertex3f;
m.tex[0] = R_GetTexture(glosstexture);
if (lightcubemap)
{
m.texcubemap[1] = R_GetTexture(lightcubemap);
- m.pointer_texcoord[1] = varray_texcoord3f[1];
+#if USETEXMATRIX
+ m.pointer_texcoord3f[1] = vertex3f;
+ m.texmatrix[1] = *matrix_modeltolight;
+#else
+ m.pointer_texcoord3f[1] = varray_texcoord3f[1];
R_Shadow_Transform_Vertex3f_TexCoord3f(varray_texcoord3f[1], numverts, vertex3f, matrix_modeltolight);
+#endif
}
R_Mesh_State(&m);
GL_LockArrays(0, numverts);
m.pointer_texcoord[0] = texcoord2f;
m.texcubemap[1] = R_GetTexture(r_shadow_normalcubetexture);
m.texcombinergb[1] = GL_DOT3_RGBA_ARB;
- m.pointer_texcoord[1] = varray_texcoord3f[1];
+ m.pointer_texcoord3f[1] = varray_texcoord3f[1];
R_Shadow_GenTexCoords_Specular_NormalCubeMap(varray_texcoord3f[1], numverts, vertex3f, svector3f, tvector3f, normal3f, relativelightorigin, relativeeyeorigin);
R_Mesh_State(&m);
GL_ColorMask(0,0,0,1);
GL_LockArrays(0, 0);
c_rt_lightmeshes++;
c_rt_lighttris += numtriangles;
-
+
memset(&m, 0, sizeof(m));
m.pointer_vertex = vertex3f;
R_Mesh_State(&m);
c_rt_lightmeshes++;
c_rt_lighttris += numtriangles;
GL_LockArrays(0, 0);
-
+
memset(&m, 0, sizeof(m));
m.pointer_vertex = vertex3f;
m.tex[0] = R_GetTexture(glosstexture);
m.pointer_texcoord[0] = texcoord2f;
m.tex3d[1] = R_GetTexture(r_shadow_attenuation3dtexture);
- m.pointer_texcoord[1] = varray_texcoord3f[1];
+#if USETEXMATRIX
+ m.pointer_texcoord3f[1] = vertex3f;
+ m.texmatrix[1] = *matrix_modeltoattenuationxyz;
+#else
+ m.pointer_texcoord3f[1] = varray_texcoord3f[1];
R_Shadow_Transform_Vertex3f_TexCoord3f(varray_texcoord3f[1], numverts, vertex3f, matrix_modeltoattenuationxyz);
+#endif
R_Mesh_State(&m);
GL_LockArrays(0, numverts);
GL_ColorMask(1,1,1,0);
m.pointer_texcoord[0] = texcoord2f;
m.texcubemap[1] = R_GetTexture(r_shadow_normalcubetexture);
m.texcombinergb[1] = GL_DOT3_RGBA_ARB;
- m.pointer_texcoord[1] = varray_texcoord3f[1];
+ m.pointer_texcoord3f[1] = varray_texcoord3f[1];
R_Shadow_GenTexCoords_Specular_NormalCubeMap(varray_texcoord3f[1], numverts, vertex3f, svector3f, tvector3f, normal3f, relativelightorigin, relativeeyeorigin);
R_Mesh_State(&m);
GL_ColorMask(0,0,0,1);
GL_LockArrays(0, 0);
c_rt_lightmeshes++;
c_rt_lighttris += numtriangles;
-
+
memset(&m, 0, sizeof(m));
m.pointer_vertex = vertex3f;
R_Mesh_State(&m);
c_rt_lightmeshes++;
c_rt_lighttris += numtriangles;
GL_LockArrays(0, 0);
-
+
memset(&m, 0, sizeof(m));
m.pointer_vertex = vertex3f;
m.tex[0] = R_GetTexture(r_shadow_attenuation2dtexture);
+#if USETEXMATRIX
+ m.pointer_texcoord3f[0] = vertex3f;
+ m.texmatrix[0] = *matrix_modeltoattenuationxyz;
+#else
m.pointer_texcoord[0] = varray_texcoord2f[0];
R_Shadow_Transform_Vertex3f_TexCoord2f(varray_texcoord2f[0], numverts, vertex3f, matrix_modeltoattenuationxyz);
+#endif
m.tex[1] = R_GetTexture(r_shadow_attenuation2dtexture);
+#if USETEXMATRIX
+ m.pointer_texcoord3f[1] = vertex3f;
+ m.texmatrix[1] = *matrix_modeltoattenuationz;
+#else
m.pointer_texcoord[1] = varray_texcoord2f[1];
R_Shadow_Transform_Vertex3f_TexCoord2f(varray_texcoord2f[1], numverts, vertex3f, matrix_modeltoattenuationz);
+#endif
R_Mesh_State(&m);
GL_BlendFunc(GL_DST_ALPHA, GL_ZERO);
GL_LockArrays(0, numverts);
GL_LockArrays(0, 0);
c_rt_lightmeshes++;
c_rt_lighttris += numtriangles;
-
+
memset(&m, 0, sizeof(m));
m.pointer_vertex = vertex3f;
m.tex[0] = R_GetTexture(glosstexture);
if (lightcubemap)
{
m.texcubemap[1] = R_GetTexture(lightcubemap);
- m.pointer_texcoord[1] = varray_texcoord3f[1];
+#if USETEXMATRIX
+ m.pointer_texcoord3f[1] = vertex3f;
+ m.texmatrix[1] = *matrix_modeltolight;
+#else
+ m.pointer_texcoord3f[1] = varray_texcoord3f[1];
R_Shadow_Transform_Vertex3f_TexCoord3f(varray_texcoord3f[1], numverts, vertex3f, matrix_modeltolight);
+#endif
}
R_Mesh_State(&m);
GL_LockArrays(0, numverts);
{
// voodoo2
m.tex[1] = R_GetTexture(r_shadow_attenuation2dtexture);
+#if USETEXMATRIX
+ m.pointer_texcoord3f[1] = vertex3f;
+ m.texmatrix[1] = *matrix_modeltoattenuationxyz;
+#else
m.pointer_texcoord[1] = varray_texcoord2f[1];
R_Shadow_Transform_Vertex3f_TexCoord2f(varray_texcoord2f[1], numverts, vertex3f, matrix_modeltoattenuationxyz);
+#endif
}
R_Mesh_State(&m);
for (renders = 0;renders < 64 && (color2[0] > 0 || color2[1] > 0 || color2[2] > 0);renders++, color2[0]--, color2[1]--, color2[2]--)