3d texcoords now must use rmeshstate_t.pointer_texcoord3f instead of pointer_texcoord...
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 15 Mar 2004 07:00:14 +0000 (07:00 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 15 Mar 2004 07:00:14 +0000 (07:00 +0000)
implemented (broken and disabled) texture matrix optimizations in R_Shadow_RenderLighting, I'm still trying to figure out what is wrong

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@4021 d7cf8633-e32d-0410-b094-e92efae38249

gl_backend.c
gl_backend.h
r_shadow.c
todo

index 11b89b7..9c18e68 100644 (file)
@@ -1009,8 +1009,16 @@ void R_Mesh_State(const rmeshstate_t *m)
                        GL_ActiveTexture(i);
                        qglTexEnvi(GL_TEXTURE_ENV, GL_ALPHA_SCALE, (unit->alphascale = scale));CHECKGLERROR
                }
-               arrayis3d = unit->t3d || unit->tcubemap;
-               texcoords = m->pointer_texcoord[i];
+               if (m->pointer_texcoord3f[i])
+               {
+                       arrayis3d = true;
+                       texcoords = m->pointer_texcoord3f[i];
+               }
+               else
+               {
+                       arrayis3d = false;
+                       texcoords = m->pointer_texcoord[i];
+               }
                if (texcoords && !unit->t1d && !unit->t2d && !unit->t3d && !unit->tcubemap)
                        texcoords = NULL;
                if (unit->pointer_texcoord != texcoords || unit->arrayis3d != arrayis3d)
index c97fd14..343f66b 100644 (file)
@@ -49,7 +49,8 @@ typedef struct
        // matrices
        matrix4x4_t texmatrix[MAX_TEXTUREUNITS];
        // pointers
-       const float *pointer_texcoord[MAX_TEXTUREUNITS];
+       const float *pointer_texcoord[MAX_TEXTUREUNITS]; // 2D
+       const float *pointer_texcoord3f[MAX_TEXTUREUNITS]; // 3D
 
        // other state set by this
        const float *pointer_vertex;
index b2e4d97..adf1f09 100644 (file)
@@ -1214,6 +1214,7 @@ void R_Shadow_GenTexCoords_Specular_NormalCubeMap(float *out3f, int numverts, co
        }
 }
 
+#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;
@@ -1240,15 +1241,20 @@ void R_Shadow_RenderLighting(int numverts, int numtriangles, const int *elements
                                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);
@@ -1257,7 +1263,7 @@ void R_Shadow_RenderLighting(int numverts, int numtriangles, const int *elements
                                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);
@@ -1265,8 +1271,13 @@ void R_Shadow_RenderLighting(int numverts, int numtriangles, const int *elements
                                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);
@@ -1291,8 +1302,13 @@ void R_Shadow_RenderLighting(int numverts, int numtriangles, const int *elements
                                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);
@@ -1301,7 +1317,7 @@ void R_Shadow_RenderLighting(int numverts, int numtriangles, const int *elements
                                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);
@@ -1309,7 +1325,7 @@ void R_Shadow_RenderLighting(int numverts, int numtriangles, const int *elements
                                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);
@@ -1318,7 +1334,7 @@ void R_Shadow_RenderLighting(int numverts, int numtriangles, const int *elements
                                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);
@@ -1326,8 +1342,13 @@ void R_Shadow_RenderLighting(int numverts, int numtriangles, const int *elements
                                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);
@@ -1356,7 +1377,7 @@ void R_Shadow_RenderLighting(int numverts, int numtriangles, const int *elements
                                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);
@@ -1366,14 +1387,19 @@ void R_Shadow_RenderLighting(int numverts, int numtriangles, const int *elements
                                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);
@@ -1401,14 +1427,24 @@ void R_Shadow_RenderLighting(int numverts, int numtriangles, const int *elements
                                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);
@@ -1417,7 +1453,7 @@ void R_Shadow_RenderLighting(int numverts, int numtriangles, const int *elements
                                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);
@@ -1425,8 +1461,13 @@ void R_Shadow_RenderLighting(int numverts, int numtriangles, const int *elements
                                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);
@@ -1451,11 +1492,21 @@ void R_Shadow_RenderLighting(int numverts, int numtriangles, const int *elements
                                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);
@@ -1464,7 +1515,7 @@ void R_Shadow_RenderLighting(int numverts, int numtriangles, const int *elements
                                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);
@@ -1472,7 +1523,7 @@ void R_Shadow_RenderLighting(int numverts, int numtriangles, const int *elements
                                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);
@@ -1481,7 +1532,7 @@ void R_Shadow_RenderLighting(int numverts, int numtriangles, const int *elements
                                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);
@@ -1489,8 +1540,13 @@ void R_Shadow_RenderLighting(int numverts, int numtriangles, const int *elements
                                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);
@@ -1525,7 +1581,7 @@ void R_Shadow_RenderLighting(int numverts, int numtriangles, const int *elements
                                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);
@@ -1536,7 +1592,7 @@ void R_Shadow_RenderLighting(int numverts, int numtriangles, const int *elements
                                GL_LockArrays(0, 0);
                                c_rt_lightmeshes++;
                                c_rt_lighttris += numtriangles;
-
+       
                                memset(&m, 0, sizeof(m));
                                m.pointer_vertex = vertex3f;
                                R_Mesh_State(&m);
@@ -1554,12 +1610,17 @@ void R_Shadow_RenderLighting(int numverts, int numtriangles, const int *elements
                                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);
@@ -1567,7 +1628,7 @@ void R_Shadow_RenderLighting(int numverts, int numtriangles, const int *elements
                                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);
@@ -1575,8 +1636,13 @@ void R_Shadow_RenderLighting(int numverts, int numtriangles, const int *elements
                                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);
@@ -1604,7 +1670,7 @@ void R_Shadow_RenderLighting(int numverts, int numtriangles, const int *elements
                                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);
@@ -1615,7 +1681,7 @@ void R_Shadow_RenderLighting(int numverts, int numtriangles, const int *elements
                                GL_LockArrays(0, 0);
                                c_rt_lightmeshes++;
                                c_rt_lighttris += numtriangles;
-
+       
                                memset(&m, 0, sizeof(m));
                                m.pointer_vertex = vertex3f;
                                R_Mesh_State(&m);
@@ -1633,14 +1699,19 @@ void R_Shadow_RenderLighting(int numverts, int numtriangles, const int *elements
                                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);
@@ -1667,7 +1738,7 @@ void R_Shadow_RenderLighting(int numverts, int numtriangles, const int *elements
                                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);
@@ -1678,7 +1749,7 @@ void R_Shadow_RenderLighting(int numverts, int numtriangles, const int *elements
                                GL_LockArrays(0, 0);
                                c_rt_lightmeshes++;
                                c_rt_lighttris += numtriangles;
-
+       
                                memset(&m, 0, sizeof(m));
                                m.pointer_vertex = vertex3f;
                                R_Mesh_State(&m);
@@ -1696,15 +1767,25 @@ void R_Shadow_RenderLighting(int numverts, int numtriangles, const int *elements
                                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);
@@ -1712,7 +1793,7 @@ void R_Shadow_RenderLighting(int numverts, int numtriangles, const int *elements
                                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);
@@ -1720,8 +1801,13 @@ void R_Shadow_RenderLighting(int numverts, int numtriangles, const int *elements
                                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);
@@ -1757,8 +1843,13 @@ void R_Shadow_RenderLighting(int numverts, int numtriangles, const int *elements
                        {
                                // 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]--)
diff --git a/todo b/todo
index 97bc750..ec0b924 100644 (file)
--- a/todo
+++ b/todo
@@ -46,8 +46,9 @@ d darkplaces: typing ip in join game menu should show 'trying' and 'no response'
 -n dpmod: make grapple off-hand (joe hill)
 -n darkplaces: add DP_SV_ROTATINGBMODEL extension to explain that MOVETYPE_PUSH/SOLID_BSP support rotation in darkplaces and a demonstration of how to use it without qc modifications (Uffe, Supajoe)
 d darkplaces: fix 2D attenuation texturing which is all black
-0 darkplaces: allow typing characters > 128 to allow Latin1 fonts to be used properly (Urre)
-0 darkplaces: make sure the engine uses only the first 32 special chars, so the high set can be replaced (Urre)
+2 dpmod: write a readme for the menu progs code to get people started with it, and know what is and is not possible, what builtins do, etc (Urre)
+0 darkplaces: allow typing characters > 128 into console to allow Latin1 fonts to be used properly, already works in text messages (Urre)
+0 darkplaces: make sure the engine uses only the first 32 special chars, so the high set can be replaced, this means player messages should not be shifted up, and the 'shift down' printing in dedicated server consoles should be removed, etc (Urre)
 0 dpmod: make spawning use viewzoom to start zoomed out 2.0 and then zoom in to 1.0 (Urre)
 0 darkplaces: add DP_SENSITIVITYSCALE extension which scales sensitivity on client like viewzoom does, but without affecting fov, note if this is non-zero it overrides viewzoom sensitivity entirely, it does not scale it (Urre)
 0 darkplaces: bump protocol number again and expand viewzoom to two bytes (8bit.8bit fixedpoint instead of 0.8bit like it is now) (Urre)