]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
removed the USETEXMATRIX define (now always on), reduced varray_texcoord3f to only...
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 21 Mar 2006 03:03:26 +0000 (03:03 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 21 Mar 2006 03:03:26 +0000 (03:03 +0000)
changed many simple uses of varray_* arrays to use stack arrays instead
this reduces memory usage by 1MB

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

cl_screen.c
gl_backend.c
gl_backend.h
gl_draw.c
gl_rmain.c
gl_rsurf.c
r_lightning.c
r_shadow.c

index d8f34cc215011eef5858a374aafc40aad852c592..dde64f3cfc4603d4140a4c0eed02b63e521f8dff 100644 (file)
@@ -1291,6 +1291,8 @@ void SCR_UpdateLoadingScreen (void)
        float x, y;
        cachepic_t *pic;
        rmeshstate_t m;
        float x, y;
        cachepic_t *pic;
        rmeshstate_t m;
+       float vertex3f[12];
+       float texcoord2f[8];
        // don't do anything if not initialized yet
        if (vid_hidden)
                return;
        // don't do anything if not initialized yet
        if (vid_hidden)
                return;
@@ -1317,18 +1319,19 @@ void SCR_UpdateLoadingScreen (void)
        GL_BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
        GL_DepthTest(false);
        memset(&m, 0, sizeof(m));
        GL_BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
        GL_DepthTest(false);
        memset(&m, 0, sizeof(m));
-       m.pointer_vertex = varray_vertex3f;
-       m.pointer_texcoord[0] = varray_texcoord2f[0];
+       m.pointer_vertex = vertex3f;
+       m.pointer_texcoord[0] = texcoord2f;
        m.tex[0] = R_GetTexture(pic->tex);
        R_Mesh_State(&m);
        m.tex[0] = R_GetTexture(pic->tex);
        R_Mesh_State(&m);
-       varray_vertex3f[0] = varray_vertex3f[9] = x;
-       varray_vertex3f[1] = varray_vertex3f[4] = y;
-       varray_vertex3f[3] = varray_vertex3f[6] = x + pic->width;
-       varray_vertex3f[7] = varray_vertex3f[10] = y + pic->height;
-       varray_texcoord2f[0][0] = 0;varray_texcoord2f[0][1] = 0;
-       varray_texcoord2f[0][2] = 1;varray_texcoord2f[0][3] = 0;
-       varray_texcoord2f[0][4] = 1;varray_texcoord2f[0][5] = 1;
-       varray_texcoord2f[0][6] = 0;varray_texcoord2f[0][7] = 1;
+       vertex3f[2] = vertex3f[5] = vertex3f[8] = vertex3f[11] = 0;
+       vertex3f[0] = vertex3f[9] = x;
+       vertex3f[1] = vertex3f[4] = y;
+       vertex3f[3] = vertex3f[6] = x + pic->width;
+       vertex3f[7] = vertex3f[10] = y + pic->height;
+       texcoord2f[0] = 0;texcoord2f[1] = 0;
+       texcoord2f[2] = 1;texcoord2f[3] = 0;
+       texcoord2f[4] = 1;texcoord2f[5] = 1;
+       texcoord2f[6] = 0;texcoord2f[7] = 1;
        R_Mesh_Draw(0, 4, 2, polygonelements);
        R_Mesh_Finish();
        // refresh
        R_Mesh_Draw(0, 4, 2, polygonelements);
        R_Mesh_Finish();
        // refresh
index 1e1ba225a9ea476092b401df8fdf712957568c7d..1d0418f41bdefc23d26cfc15f5ce877e7756ee44 100644 (file)
@@ -1650,7 +1650,5 @@ float varray_svector3f[65536*3];
 float varray_tvector3f[65536*3];
 float varray_normal3f[65536*3];
 float varray_color4f[65536*4];
 float varray_tvector3f[65536*3];
 float varray_normal3f[65536*3];
 float varray_color4f[65536*4];
-float varray_texcoord2f[4][65536*2];
-float varray_texcoord3f[4][65536*3];
-int earray_element3i[65536];
+float varray_texcoord3f[65536*3];
 float varray_vertex3f2[65536*3];
 float varray_vertex3f2[65536*3];
index 4adfec302e9b84ff392b1824d7a0bc93ce5945aa..dcb7ed972aa2d49209c4caf32a8c32af8014e9be 100644 (file)
@@ -113,9 +113,7 @@ extern float varray_svector3f[65536*3];
 extern float varray_tvector3f[65536*3];
 extern float varray_normal3f[65536*3];
 extern float varray_color4f[65536*4];
 extern float varray_tvector3f[65536*3];
 extern float varray_normal3f[65536*3];
 extern float varray_color4f[65536*4];
-extern float varray_texcoord2f[4][65536*2];
-extern float varray_texcoord3f[4][65536*3];
-extern int earray_element3i[65536];
+extern float varray_texcoord3f[65536*3];
 extern float varray_vertex3f2[65536*3];
 
 #endif
 extern float varray_vertex3f2[65536*3];
 
 #endif
index e0130f49d0d100ce88e56a923523e05819fac06d..50f472d4f099670117e3bade28c14eefbbd1961b 100644 (file)
--- a/gl_draw.c
+++ b/gl_draw.c
@@ -530,6 +530,8 @@ void DrawQ_String_Real(float x, float y, const char *string, int maxlen, float w
        float *av, *at;
        int batchcount;
        rmeshstate_t m;
        float *av, *at;
        int batchcount;
        rmeshstate_t m;
+       float vertex3f[QUADELEMENTS_MAXQUADS*4*3];
+       float texcoord2f[QUADELEMENTS_MAXQUADS*4*2];
 
        if (!r_refdef.draw2dstage)
        {
 
        if (!r_refdef.draw2dstage)
        {
@@ -555,14 +557,14 @@ void DrawQ_String_Real(float x, float y, const char *string, int maxlen, float w
        GL_Color(red, green, blue, alpha);
 
        memset(&m, 0, sizeof(m));
        GL_Color(red, green, blue, alpha);
 
        memset(&m, 0, sizeof(m));
-       m.pointer_vertex = varray_vertex3f;
+       m.pointer_vertex = vertex3f;
        m.pointer_color = NULL;
        m.pointer_color = NULL;
-       m.pointer_texcoord[0] = varray_texcoord2f[0];
+       m.pointer_texcoord[0] = texcoord2f;
        m.tex[0] = R_GetTexture(char_texture);
        R_Mesh_State(&m);
 
        m.tex[0] = R_GetTexture(char_texture);
        R_Mesh_State(&m);
 
-       at = varray_texcoord2f[0];
-       av = varray_vertex3f;
+       at = texcoord2f;
+       av = vertex3f;
        batchcount = 0;
 
        if (maxlen < 1)
        batchcount = 0;
 
        if (maxlen < 1)
@@ -593,8 +595,8 @@ void DrawQ_String_Real(float x, float y, const char *string, int maxlen, float w
                        R_Mesh_Draw(0, batchcount * 4, batchcount * 2, quadelements);
                        GL_LockArrays(0, 0);
                        batchcount = 0;
                        R_Mesh_Draw(0, batchcount * 4, batchcount * 2, quadelements);
                        GL_LockArrays(0, 0);
                        batchcount = 0;
-                       at = varray_texcoord2f[0];
-                       av = varray_vertex3f;
+                       at = texcoord2f;
+                       av = vertex3f;
                }
        }
        if (batchcount > 0)
                }
        }
        if (batchcount > 0)
index 87dd649120385f1a2f154c083c2cd85aa2aa0721..f79ac04335f2ee93489a830189c47f761370e58a 100644 (file)
@@ -1587,6 +1587,8 @@ static void R_BlendView(void)
        qboolean dobloom;
        qboolean doblend;
        rmeshstate_t m;
        qboolean dobloom;
        qboolean doblend;
        rmeshstate_t m;
+       float vertex3f[12];
+       float texcoord2f[3][8];
 
        // set the (poorly named) screenwidth and screenheight variables to
        // a power of 2 at least as large as the screen, these will define the
 
        // set the (poorly named) screenwidth and screenheight variables to
        // a power of 2 at least as large as the screen, these will define the
@@ -1605,10 +1607,10 @@ static void R_BlendView(void)
        GL_DepthTest(false);
        R_Mesh_Matrix(&identitymatrix);
        // vertex coordinates for a quad that covers the screen exactly
        GL_DepthTest(false);
        R_Mesh_Matrix(&identitymatrix);
        // vertex coordinates for a quad that covers the screen exactly
-       varray_vertex3f[0] = 0;varray_vertex3f[1] = 0;varray_vertex3f[2] = 0;
-       varray_vertex3f[3] = 1;varray_vertex3f[4] = 0;varray_vertex3f[5] = 0;
-       varray_vertex3f[6] = 1;varray_vertex3f[7] = 1;varray_vertex3f[8] = 0;
-       varray_vertex3f[9] = 0;varray_vertex3f[10] = 1;varray_vertex3f[11] = 0;
+       vertex3f[0] = 0;vertex3f[1] = 0;vertex3f[2] = 0;
+       vertex3f[3] = 1;vertex3f[4] = 0;vertex3f[5] = 0;
+       vertex3f[6] = 1;vertex3f[7] = 1;vertex3f[8] = 0;
+       vertex3f[9] = 0;vertex3f[10] = 1;vertex3f[11] = 0;
        if (dobloom)
        {
                int bloomwidth, bloomheight, x, dobloomblend, range;
        if (dobloom)
        {
                int bloomwidth, bloomheight, x, dobloomblend, range;
@@ -1625,27 +1627,27 @@ static void R_BlendView(void)
                bloomheight = min(r_view_height, bloomwidth * r_view_height / r_view_width);
                // set up a texcoord array for the full resolution screen image
                // (we have to keep this around to copy back during final render)
                bloomheight = min(r_view_height, bloomwidth * r_view_height / r_view_width);
                // set up a texcoord array for the full resolution screen image
                // (we have to keep this around to copy back during final render)
-               varray_texcoord2f[0][0] = 0;
-               varray_texcoord2f[0][1] = (float)r_view_height / (float)screenheight;
-               varray_texcoord2f[0][2] = (float)r_view_width / (float)screenwidth;
-               varray_texcoord2f[0][3] = (float)r_view_height / (float)screenheight;
-               varray_texcoord2f[0][4] = (float)r_view_width / (float)screenwidth;
-               varray_texcoord2f[0][5] = 0;
-               varray_texcoord2f[0][6] = 0;
-               varray_texcoord2f[0][7] = 0;
+               texcoord2f[0][0] = 0;
+               texcoord2f[0][1] = (float)r_view_height / (float)screenheight;
+               texcoord2f[0][2] = (float)r_view_width / (float)screenwidth;
+               texcoord2f[0][3] = (float)r_view_height / (float)screenheight;
+               texcoord2f[0][4] = (float)r_view_width / (float)screenwidth;
+               texcoord2f[0][5] = 0;
+               texcoord2f[0][6] = 0;
+               texcoord2f[0][7] = 0;
                // set up a texcoord array for the reduced resolution bloom image
                // (which will be additive blended over the screen image)
                // set up a texcoord array for the reduced resolution bloom image
                // (which will be additive blended over the screen image)
-               varray_texcoord2f[1][0] = 0;
-               varray_texcoord2f[1][1] = (float)bloomheight / (float)screenheight;
-               varray_texcoord2f[1][2] = (float)bloomwidth / (float)screenwidth;
-               varray_texcoord2f[1][3] = (float)bloomheight / (float)screenheight;
-               varray_texcoord2f[1][4] = (float)bloomwidth / (float)screenwidth;
-               varray_texcoord2f[1][5] = 0;
-               varray_texcoord2f[1][6] = 0;
-               varray_texcoord2f[1][7] = 0;
+               texcoord2f[1][0] = 0;
+               texcoord2f[1][1] = (float)bloomheight / (float)screenheight;
+               texcoord2f[1][2] = (float)bloomwidth / (float)screenwidth;
+               texcoord2f[1][3] = (float)bloomheight / (float)screenheight;
+               texcoord2f[1][4] = (float)bloomwidth / (float)screenwidth;
+               texcoord2f[1][5] = 0;
+               texcoord2f[1][6] = 0;
+               texcoord2f[1][7] = 0;
                memset(&m, 0, sizeof(m));
                memset(&m, 0, sizeof(m));
-               m.pointer_vertex = varray_vertex3f;
-               m.pointer_texcoord[0] = varray_texcoord2f[0];
+               m.pointer_vertex = vertex3f;
+               m.pointer_texcoord[0] = texcoord2f[0];
                m.tex[0] = R_GetTexture(r_bloom_texture_screen);
                R_Mesh_State(&m);
                // copy view into the full resolution screen image texture
                m.tex[0] = R_GetTexture(r_bloom_texture_screen);
                R_Mesh_State(&m);
                // copy view into the full resolution screen image texture
@@ -1671,9 +1673,9 @@ static void R_BlendView(void)
                // we now have a darkened bloom image in the framebuffer, copy it into
                // the bloom image texture for more processing
                memset(&m, 0, sizeof(m));
                // we now have a darkened bloom image in the framebuffer, copy it into
                // the bloom image texture for more processing
                memset(&m, 0, sizeof(m));
-               m.pointer_vertex = varray_vertex3f;
+               m.pointer_vertex = vertex3f;
                m.tex[0] = R_GetTexture(r_bloom_texture_bloom);
                m.tex[0] = R_GetTexture(r_bloom_texture_bloom);
-               m.pointer_texcoord[0] = varray_texcoord2f[2];
+               m.pointer_texcoord[0] = texcoord2f[2];
                R_Mesh_State(&m);
                GL_ActiveTexture(0);
                qglCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, r_view_x, vid.height - (r_view_y + bloomheight), bloomwidth, bloomheight);
                R_Mesh_State(&m);
                GL_ActiveTexture(0);
                qglCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, r_view_x, vid.height - (r_view_y + bloomheight), bloomwidth, bloomheight);
@@ -1687,14 +1689,14 @@ static void R_BlendView(void)
                        xoffset = 0 / (float)bloomwidth * (float)bloomwidth / (float)screenwidth;
                        yoffset = x / (float)bloomheight * (float)bloomheight / (float)screenheight;
                        // compute a texcoord array with the specified x and y offset
                        xoffset = 0 / (float)bloomwidth * (float)bloomwidth / (float)screenwidth;
                        yoffset = x / (float)bloomheight * (float)bloomheight / (float)screenheight;
                        // compute a texcoord array with the specified x and y offset
-                       varray_texcoord2f[2][0] = xoffset+0;
-                       varray_texcoord2f[2][1] = yoffset+(float)bloomheight / (float)screenheight;
-                       varray_texcoord2f[2][2] = xoffset+(float)bloomwidth / (float)screenwidth;
-                       varray_texcoord2f[2][3] = yoffset+(float)bloomheight / (float)screenheight;
-                       varray_texcoord2f[2][4] = xoffset+(float)bloomwidth / (float)screenwidth;
-                       varray_texcoord2f[2][5] = yoffset+0;
-                       varray_texcoord2f[2][6] = xoffset+0;
-                       varray_texcoord2f[2][7] = yoffset+0;
+                       texcoord2f[2][0] = xoffset+0;
+                       texcoord2f[2][1] = yoffset+(float)bloomheight / (float)screenheight;
+                       texcoord2f[2][2] = xoffset+(float)bloomwidth / (float)screenwidth;
+                       texcoord2f[2][3] = yoffset+(float)bloomheight / (float)screenheight;
+                       texcoord2f[2][4] = xoffset+(float)bloomwidth / (float)screenwidth;
+                       texcoord2f[2][5] = yoffset+0;
+                       texcoord2f[2][6] = xoffset+0;
+                       texcoord2f[2][7] = yoffset+0;
                        // this r value looks like a 'dot' particle, fading sharply to
                        // black at the edges
                        // (probably not realistic but looks good enough)
                        // this r value looks like a 'dot' particle, fading sharply to
                        // black at the edges
                        // (probably not realistic but looks good enough)
@@ -1720,14 +1722,14 @@ static void R_BlendView(void)
                        xoffset = x / (float)bloomwidth * (float)bloomwidth / (float)screenwidth;
                        yoffset = 0 / (float)bloomheight * (float)bloomheight / (float)screenheight;
                        // compute a texcoord array with the specified x and y offset
                        xoffset = x / (float)bloomwidth * (float)bloomwidth / (float)screenwidth;
                        yoffset = 0 / (float)bloomheight * (float)bloomheight / (float)screenheight;
                        // compute a texcoord array with the specified x and y offset
-                       varray_texcoord2f[2][0] = xoffset+0;
-                       varray_texcoord2f[2][1] = yoffset+(float)bloomheight / (float)screenheight;
-                       varray_texcoord2f[2][2] = xoffset+(float)bloomwidth / (float)screenwidth;
-                       varray_texcoord2f[2][3] = yoffset+(float)bloomheight / (float)screenheight;
-                       varray_texcoord2f[2][4] = xoffset+(float)bloomwidth / (float)screenwidth;
-                       varray_texcoord2f[2][5] = yoffset+0;
-                       varray_texcoord2f[2][6] = xoffset+0;
-                       varray_texcoord2f[2][7] = yoffset+0;
+                       texcoord2f[2][0] = xoffset+0;
+                       texcoord2f[2][1] = yoffset+(float)bloomheight / (float)screenheight;
+                       texcoord2f[2][2] = xoffset+(float)bloomwidth / (float)screenwidth;
+                       texcoord2f[2][3] = yoffset+(float)bloomheight / (float)screenheight;
+                       texcoord2f[2][4] = xoffset+(float)bloomwidth / (float)screenwidth;
+                       texcoord2f[2][5] = yoffset+0;
+                       texcoord2f[2][6] = xoffset+0;
+                       texcoord2f[2][7] = yoffset+0;
                        // this r value looks like a 'dot' particle, fading sharply to
                        // black at the edges
                        // (probably not realistic but looks good enough)
                        // this r value looks like a 'dot' particle, fading sharply to
                        // black at the edges
                        // (probably not realistic but looks good enough)
@@ -1748,9 +1750,9 @@ static void R_BlendView(void)
                // put the original screen image back in place and blend the bloom
                // texture on it
                memset(&m, 0, sizeof(m));
                // put the original screen image back in place and blend the bloom
                // texture on it
                memset(&m, 0, sizeof(m));
-               m.pointer_vertex = varray_vertex3f;
+               m.pointer_vertex = vertex3f;
                m.tex[0] = R_GetTexture(r_bloom_texture_screen);
                m.tex[0] = R_GetTexture(r_bloom_texture_screen);
-               m.pointer_texcoord[0] = varray_texcoord2f[0];
+               m.pointer_texcoord[0] = texcoord2f[0];
 #if 0
                dobloomblend = false;
 #else
 #if 0
                dobloomblend = false;
 #else
@@ -1760,7 +1762,7 @@ static void R_BlendView(void)
                        dobloomblend = false;
                        m.texcombinergb[1] = GL_ADD;
                        m.tex[1] = R_GetTexture(r_bloom_texture_bloom);
                        dobloomblend = false;
                        m.texcombinergb[1] = GL_ADD;
                        m.tex[1] = R_GetTexture(r_bloom_texture_bloom);
-                       m.pointer_texcoord[1] = varray_texcoord2f[1];
+                       m.pointer_texcoord[1] = texcoord2f[1];
                }
                else
                        dobloomblend = true;
                }
                else
                        dobloomblend = true;
@@ -1774,9 +1776,9 @@ static void R_BlendView(void)
                if (dobloomblend)
                {
                        memset(&m, 0, sizeof(m));
                if (dobloomblend)
                {
                        memset(&m, 0, sizeof(m));
-                       m.pointer_vertex = varray_vertex3f;
+                       m.pointer_vertex = vertex3f;
                        m.tex[0] = R_GetTexture(r_bloom_texture_bloom);
                        m.tex[0] = R_GetTexture(r_bloom_texture_bloom);
-                       m.pointer_texcoord[0] = varray_texcoord2f[1];
+                       m.pointer_texcoord[0] = texcoord2f[1];
                        R_Mesh_State(&m);
                        GL_BlendFunc(GL_ONE, GL_ONE);
                        GL_Color(1,1,1,1);
                        R_Mesh_State(&m);
                        GL_BlendFunc(GL_ONE, GL_ONE);
                        GL_Color(1,1,1,1);
@@ -1788,7 +1790,7 @@ static void R_BlendView(void)
        {
                // apply a color tint to the whole view
                memset(&m, 0, sizeof(m));
        {
                // apply a color tint to the whole view
                memset(&m, 0, sizeof(m));
-               m.pointer_vertex = varray_vertex3f;
+               m.pointer_vertex = vertex3f;
                R_Mesh_State(&m);
                GL_BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
                GL_Color(r_refdef.viewblend[0], r_refdef.viewblend[1], r_refdef.viewblend[2], r_refdef.viewblend[3]);
                R_Mesh_State(&m);
                GL_BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
                GL_Color(r_refdef.viewblend[0], r_refdef.viewblend[1], r_refdef.viewblend[2], r_refdef.viewblend[3]);
@@ -2244,6 +2246,7 @@ void R_DrawSprite(int blendfunc1, int blendfunc2, rtexture_t *texture, rtexture_
 {
        float fog = 0.0f, ifog;
        rmeshstate_t m;
 {
        float fog = 0.0f, ifog;
        rmeshstate_t m;
+       float vertex3f[12];
 
        if (fogenabled)
                fog = VERTEXFOGTABLE(VectorDistance(origin, r_vieworigin));
 
        if (fogenabled)
                fog = VERTEXFOGTABLE(VectorDistance(origin, r_vieworigin));
@@ -2254,23 +2257,23 @@ void R_DrawSprite(int blendfunc1, int blendfunc2, rtexture_t *texture, rtexture_
        GL_DepthMask(false);
        GL_DepthTest(!depthdisable);
 
        GL_DepthMask(false);
        GL_DepthTest(!depthdisable);
 
-       varray_vertex3f[ 0] = origin[0] + left[0] * scalex2 + up[0] * scaley1;
-       varray_vertex3f[ 1] = origin[1] + left[1] * scalex2 + up[1] * scaley1;
-       varray_vertex3f[ 2] = origin[2] + left[2] * scalex2 + up[2] * scaley1;
-       varray_vertex3f[ 3] = origin[0] + left[0] * scalex2 + up[0] * scaley2;
-       varray_vertex3f[ 4] = origin[1] + left[1] * scalex2 + up[1] * scaley2;
-       varray_vertex3f[ 5] = origin[2] + left[2] * scalex2 + up[2] * scaley2;
-       varray_vertex3f[ 6] = origin[0] + left[0] * scalex1 + up[0] * scaley2;
-       varray_vertex3f[ 7] = origin[1] + left[1] * scalex1 + up[1] * scaley2;
-       varray_vertex3f[ 8] = origin[2] + left[2] * scalex1 + up[2] * scaley2;
-       varray_vertex3f[ 9] = origin[0] + left[0] * scalex1 + up[0] * scaley1;
-       varray_vertex3f[10] = origin[1] + left[1] * scalex1 + up[1] * scaley1;
-       varray_vertex3f[11] = origin[2] + left[2] * scalex1 + up[2] * scaley1;
+       vertex3f[ 0] = origin[0] + left[0] * scalex2 + up[0] * scaley1;
+       vertex3f[ 1] = origin[1] + left[1] * scalex2 + up[1] * scaley1;
+       vertex3f[ 2] = origin[2] + left[2] * scalex2 + up[2] * scaley1;
+       vertex3f[ 3] = origin[0] + left[0] * scalex2 + up[0] * scaley2;
+       vertex3f[ 4] = origin[1] + left[1] * scalex2 + up[1] * scaley2;
+       vertex3f[ 5] = origin[2] + left[2] * scalex2 + up[2] * scaley2;
+       vertex3f[ 6] = origin[0] + left[0] * scalex1 + up[0] * scaley2;
+       vertex3f[ 7] = origin[1] + left[1] * scalex1 + up[1] * scaley2;
+       vertex3f[ 8] = origin[2] + left[2] * scalex1 + up[2] * scaley2;
+       vertex3f[ 9] = origin[0] + left[0] * scalex1 + up[0] * scaley1;
+       vertex3f[10] = origin[1] + left[1] * scalex1 + up[1] * scaley1;
+       vertex3f[11] = origin[2] + left[2] * scalex1 + up[2] * scaley1;
 
        memset(&m, 0, sizeof(m));
        m.tex[0] = R_GetTexture(texture);
        m.pointer_texcoord[0] = spritetexcoord2f;
 
        memset(&m, 0, sizeof(m));
        m.tex[0] = R_GetTexture(texture);
        m.pointer_texcoord[0] = spritetexcoord2f;
-       m.pointer_vertex = varray_vertex3f;
+       m.pointer_vertex = vertex3f;
        R_Mesh_State(&m);
        GL_Color(cr * ifog, cg * ifog, cb * ifog, ca);
        R_Mesh_Draw(0, 4, 2, polygonelements);
        R_Mesh_State(&m);
        GL_Color(cr * ifog, cg * ifog, cb * ifog, ca);
        R_Mesh_Draw(0, 4, 2, polygonelements);
index 6ba68f2ad33e419d6f40330a1c06cd5f0f4560be..b8e1c3c5cfbae404a29bd991c3117f4afd5b57d2 100644 (file)
@@ -301,6 +301,7 @@ static void R_DrawPortal_Callback(const entity_render_t *ent, int surfacenumber,
        GL_BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
        GL_DepthMask(false);
        GL_DepthTest(true);
        GL_BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
        GL_DepthMask(false);
        GL_DepthTest(true);
+       qglDisable(GL_CULL_FACE);
        R_Mesh_Matrix(&identitymatrix);
 
        memset(&m, 0, sizeof(m));
        R_Mesh_Matrix(&identitymatrix);
 
        memset(&m, 0, sizeof(m));
@@ -312,17 +313,12 @@ static void R_DrawPortal_Callback(const entity_render_t *ent, int surfacenumber,
                         ((i & 0x0038) >> 3) * (1.0f / 7.0f),
                         ((i & 0x01C0) >> 6) * (1.0f / 7.0f),
                         0.125f);
                         ((i & 0x0038) >> 3) * (1.0f / 7.0f),
                         ((i & 0x01C0) >> 6) * (1.0f / 7.0f),
                         0.125f);
-       if (PlaneDiff(r_vieworigin, (&portal->plane)) < 0)
-       {
-               for (i = portal->numpoints - 1, v = varray_vertex3f;i >= 0;i--, v += 3)
-                       VectorCopy(portal->points[i].position, v);
-       }
-       else
-               for (i = 0, v = varray_vertex3f;i < portal->numpoints;i++, v += 3)
-                       VectorCopy(portal->points[i].position, v);
+       for (i = 0, v = varray_vertex3f;i < portal->numpoints;i++, v += 3)
+               VectorCopy(portal->points[i].position, v);
        GL_LockArrays(0, portal->numpoints);
        R_Mesh_Draw(0, portal->numpoints, portal->numpoints - 2, polygonelements);
        GL_LockArrays(0, 0);
        GL_LockArrays(0, portal->numpoints);
        R_Mesh_Draw(0, portal->numpoints, portal->numpoints - 2, polygonelements);
        GL_LockArrays(0, 0);
+       qglEnable(GL_CULL_FACE);
 }
 
 // LordHavoc: this is just a nice debugging tool, very slow
 }
 
 // LordHavoc: this is just a nice debugging tool, very slow
index 54caa07c63f46557d04131ac3fac4358a1950d54..6b38c35b5bf1874b5c83a44c2f7cac23bdd9f9b4 100644 (file)
@@ -235,6 +235,9 @@ void R_DrawLightningBeam_TransparentCallback(const entity_render_t *ent, int sur
        rmeshstate_t m;
        vec3_t beamdir, right, up, offset;
        float length, t1, t2;
        rmeshstate_t m;
        vec3_t beamdir, right, up, offset;
        float length, t1, t2;
+       float vertex3f[12*3];
+       float texcoord2f[12*2];
+       float color4f[12*4];
 
        R_Mesh_Matrix(&identitymatrix);
 
 
        R_Mesh_Matrix(&identitymatrix);
 
@@ -282,8 +285,8 @@ void R_DrawLightningBeam_TransparentCallback(const entity_render_t *ent, int sur
                m.tex[0] = R_GetTexture(r_lightningbeamqmbtexture);
        else
                m.tex[0] = R_GetTexture(r_lightningbeamtexture);
                m.tex[0] = R_GetTexture(r_lightningbeamqmbtexture);
        else
                m.tex[0] = R_GetTexture(r_lightningbeamtexture);
-       m.pointer_texcoord[0] = varray_texcoord2f[0];
-       m.pointer_vertex = varray_vertex3f;
+       m.pointer_texcoord[0] = texcoord2f;
+       m.pointer_vertex = vertex3f;
 
        GL_BlendFunc(GL_SRC_ALPHA, GL_ONE);
        GL_DepthMask(false);
 
        GL_BlendFunc(GL_SRC_ALPHA, GL_ONE);
        GL_DepthMask(false);
@@ -295,24 +298,24 @@ void R_DrawLightningBeam_TransparentCallback(const entity_render_t *ent, int sur
 
        // polygon 1, verts 0-3
        VectorScale(right, r_lightningbeam_thickness.value, offset);
 
        // polygon 1, verts 0-3
        VectorScale(right, r_lightningbeam_thickness.value, offset);
-       R_CalcLightningBeamPolygonVertex3f(varray_vertex3f + 0, b->start, b->end, offset);
+       R_CalcLightningBeamPolygonVertex3f(vertex3f + 0, b->start, b->end, offset);
        // polygon 2, verts 4-7
        VectorAdd(right, up, offset);
        VectorScale(offset, r_lightningbeam_thickness.value * 0.70710681f, offset);
        // polygon 2, verts 4-7
        VectorAdd(right, up, offset);
        VectorScale(offset, r_lightningbeam_thickness.value * 0.70710681f, offset);
-       R_CalcLightningBeamPolygonVertex3f(varray_vertex3f + 12, b->start, b->end, offset);
+       R_CalcLightningBeamPolygonVertex3f(vertex3f + 12, b->start, b->end, offset);
        // polygon 3, verts 8-11
        VectorSubtract(right, up, offset);
        VectorScale(offset, r_lightningbeam_thickness.value * 0.70710681f, offset);
        // polygon 3, verts 8-11
        VectorSubtract(right, up, offset);
        VectorScale(offset, r_lightningbeam_thickness.value * 0.70710681f, offset);
-       R_CalcLightningBeamPolygonVertex3f(varray_vertex3f + 24, b->start, b->end, offset);
-       R_CalcLightningBeamPolygonTexCoord2f(varray_texcoord2f[0] + 0, t1, t2);
-       R_CalcLightningBeamPolygonTexCoord2f(varray_texcoord2f[0] + 8, t1 + 0.33, t2 + 0.33);
-       R_CalcLightningBeamPolygonTexCoord2f(varray_texcoord2f[0] + 16, t1 + 0.66, t2 + 0.66);
+       R_CalcLightningBeamPolygonVertex3f(vertex3f + 24, b->start, b->end, offset);
+       R_CalcLightningBeamPolygonTexCoord2f(texcoord2f + 0, t1, t2);
+       R_CalcLightningBeamPolygonTexCoord2f(texcoord2f + 8, t1 + 0.33, t2 + 0.33);
+       R_CalcLightningBeamPolygonTexCoord2f(texcoord2f + 16, t1 + 0.66, t2 + 0.66);
 
        if (fogenabled)
        {
                // per vertex colors if fog is used
 
        if (fogenabled)
        {
                // per vertex colors if fog is used
-               m.pointer_color = varray_color4f;
-               R_FogLightningBeam_Vertex3f_Color4f(varray_vertex3f, varray_color4f, 12, r_lightningbeam_color_red.value, r_lightningbeam_color_green.value, r_lightningbeam_color_blue.value, 1);
+               m.pointer_color = color4f;
+               R_FogLightningBeam_Vertex3f_Color4f(vertex3f, color4f, 12, r_lightningbeam_color_red.value, r_lightningbeam_color_green.value, r_lightningbeam_color_blue.value, 1);
        }
        else
        {
        }
        else
        {
index 199d0497e8b4e09a0d4e7ec9c94b58cc26e05765..2f24300b8a9aeac3866cde6cd93d52faba21d9ff 100644 (file)
@@ -928,8 +928,6 @@ void R_Shadow_RenderMode_Lighting(qboolean stenciltest, qboolean transparent)
        // do global setup needed for the chosen lighting mode
        if (r_shadow_rendermode == R_SHADOW_RENDERMODE_LIGHT_GLSL)
        {
        // do global setup needed for the chosen lighting mode
        if (r_shadow_rendermode == R_SHADOW_RENDERMODE_LIGHT_GLSL)
        {
-               R_Mesh_VertexPointer(varray_vertex3f);
-               R_Mesh_TexCoordPointer(0, 2, varray_texcoord2f[0]);
                R_Mesh_TexCoordPointer(1, 3, varray_svector3f);
                R_Mesh_TexCoordPointer(2, 3, varray_tvector3f);
                R_Mesh_TexCoordPointer(3, 3, varray_normal3f);
                R_Mesh_TexCoordPointer(1, 3, varray_svector3f);
                R_Mesh_TexCoordPointer(2, 3, varray_tvector3f);
                R_Mesh_TexCoordPointer(3, 3, varray_normal3f);
@@ -1208,36 +1206,6 @@ static void R_Shadow_RenderSurfacesLighting_Light_Vertex_Shading(const msurface_
 }
 
 // TODO: use glTexGen instead of feeding vertices to texcoordpointer?
 }
 
 // TODO: use glTexGen instead of feeding vertices to texcoordpointer?
-#define USETEXMATRIX
-
-#ifndef USETEXMATRIX
-// this should be done in a texture matrix or vertex program when possible, but here's code to do it manually
-// if hardware texcoord manipulation is not available (or not suitable, this would really benefit from 3DNow! or SSE
-static void R_Shadow_Transform_Vertex3f_TexCoord3f(float *tc3f, int numverts, const float *vertex3f, const matrix4x4_t *matrix)
-{
-       do
-       {
-               tc3f[0] = vertex3f[0] * matrix->m[0][0] + vertex3f[1] * matrix->m[0][1] + vertex3f[2] * matrix->m[0][2] + matrix->m[0][3];
-               tc3f[1] = vertex3f[0] * matrix->m[1][0] + vertex3f[1] * matrix->m[1][1] + vertex3f[2] * matrix->m[1][2] + matrix->m[1][3];
-               tc3f[2] = vertex3f[0] * matrix->m[2][0] + vertex3f[1] * matrix->m[2][1] + vertex3f[2] * matrix->m[2][2] + matrix->m[2][3];
-               vertex3f += 3;
-               tc3f += 3;
-       }
-       while (--numverts);
-}
-
-static void R_Shadow_Transform_Vertex3f_TexCoord2f(float *tc2f, int numverts, const float *vertex3f, const matrix4x4_t *matrix)
-{
-       do
-       {
-               tc2f[0] = vertex3f[0] * matrix->m[0][0] + vertex3f[1] * matrix->m[0][1] + vertex3f[2] * matrix->m[0][2] + matrix->m[0][3];
-               tc2f[1] = vertex3f[0] * matrix->m[1][0] + vertex3f[1] * matrix->m[1][1] + vertex3f[2] * matrix->m[1][2] + matrix->m[1][3];
-               vertex3f += 3;
-               tc2f += 2;
-       }
-       while (--numverts);
-}
-#endif
 
 static void R_Shadow_GenTexCoords_Diffuse_NormalCubeMap(float *out3f, int numverts, const float *vertex3f, const float *svector3f, const float *tvector3f, const float *normal3f, const vec3_t relativelightorigin)
 {
 
 static void R_Shadow_GenTexCoords_Diffuse_NormalCubeMap(float *out3f, int numverts, const float *vertex3f, const float *svector3f, const float *tvector3f, const float *normal3f, const vec3_t relativelightorigin)
 {
@@ -1329,24 +1297,14 @@ static void R_Shadow_RenderSurfacesLighting_Light_Dot3_AmbientPass(const entity_
                memset(&m, 0, sizeof(m));
                m.pointer_vertex = rsurface_vertex3f;
                m.tex3d[0] = R_GetTexture(r_shadow_attenuation3dtexture);
                memset(&m, 0, sizeof(m));
                m.pointer_vertex = rsurface_vertex3f;
                m.tex3d[0] = R_GetTexture(r_shadow_attenuation3dtexture);
-#ifdef USETEXMATRIX
                m.pointer_texcoord3f[0] = rsurface_vertex3f;
                m.texmatrix[0] = r_shadow_entitytoattenuationxyz;
                m.pointer_texcoord3f[0] = rsurface_vertex3f;
                m.texmatrix[0] = r_shadow_entitytoattenuationxyz;
-#else
-               m.pointer_texcoord3f[0] = varray_texcoord3f[0];
-               R_Shadow_Transform_Vertex3f_TexCoord3f(varray_texcoord3f[0] + 3 * surface->num_firstvertex, surface->num_vertices, rsurface_vertex3f + 3 * surface->num_firstvertex, &r_shadow_entitytoattenuationxyz);
-#endif
                m.tex[1] = R_GetTexture(basetexture);
                m.pointer_texcoord[1] = surface->groupmesh->data_texcoordtexture2f;
                m.texmatrix[1] = texture->currenttexmatrix;
                m.texcubemap[2] = R_GetTexture(r_shadow_rtlight->currentcubemap);
                m.tex[1] = R_GetTexture(basetexture);
                m.pointer_texcoord[1] = surface->groupmesh->data_texcoordtexture2f;
                m.texmatrix[1] = texture->currenttexmatrix;
                m.texcubemap[2] = R_GetTexture(r_shadow_rtlight->currentcubemap);
-#ifdef USETEXMATRIX
                m.pointer_texcoord3f[2] = rsurface_vertex3f;
                m.texmatrix[2] = r_shadow_entitytolight;
                m.pointer_texcoord3f[2] = rsurface_vertex3f;
                m.texmatrix[2] = r_shadow_entitytolight;
-#else
-               m.pointer_texcoord3f[2] = varray_texcoord3f[2];
-               R_Shadow_Transform_Vertex3f_TexCoord3f(varray_texcoord3f[2] + 3 * surface->num_firstvertex, surface->num_vertices, rsurface_vertex3f + 3 * surface->num_firstvertex, &r_shadow_entitytolight);
-#endif
                GL_BlendFunc(GL_ONE, GL_ONE);
        }
        else if (r_shadow_texture3d.integer && r_shadow_rtlight->currentcubemap == r_texture_whitecube && r_textureunits.integer >= 2)
                GL_BlendFunc(GL_ONE, GL_ONE);
        }
        else if (r_shadow_texture3d.integer && r_shadow_rtlight->currentcubemap == r_texture_whitecube && r_textureunits.integer >= 2)
@@ -1355,13 +1313,8 @@ static void R_Shadow_RenderSurfacesLighting_Light_Dot3_AmbientPass(const entity_
                memset(&m, 0, sizeof(m));
                m.pointer_vertex = rsurface_vertex3f;
                m.tex3d[0] = R_GetTexture(r_shadow_attenuation3dtexture);
                memset(&m, 0, sizeof(m));
                m.pointer_vertex = rsurface_vertex3f;
                m.tex3d[0] = R_GetTexture(r_shadow_attenuation3dtexture);
-#ifdef USETEXMATRIX
                m.pointer_texcoord3f[0] = rsurface_vertex3f;
                m.texmatrix[0] = r_shadow_entitytoattenuationxyz;
                m.pointer_texcoord3f[0] = rsurface_vertex3f;
                m.texmatrix[0] = r_shadow_entitytoattenuationxyz;
-#else
-               m.pointer_texcoord3f[0] = varray_texcoord3f[0];
-               R_Shadow_Transform_Vertex3f_TexCoord3f(varray_texcoord3f[0] + 3 * surface->num_firstvertex, surface->num_vertices, rsurface_vertex3f + 3 * surface->num_firstvertex, &r_shadow_entitytoattenuationxyz);
-#endif
                m.tex[1] = R_GetTexture(basetexture);
                m.pointer_texcoord[1] = surface->groupmesh->data_texcoordtexture2f;
                m.texmatrix[1] = texture->currenttexmatrix;
                m.tex[1] = R_GetTexture(basetexture);
                m.pointer_texcoord[1] = surface->groupmesh->data_texcoordtexture2f;
                m.texmatrix[1] = texture->currenttexmatrix;
@@ -1373,34 +1326,19 @@ static void R_Shadow_RenderSurfacesLighting_Light_Dot3_AmbientPass(const entity_
                memset(&m, 0, sizeof(m));
                m.pointer_vertex = rsurface_vertex3f;
                m.tex[0] = R_GetTexture(r_shadow_attenuation2dtexture);
                memset(&m, 0, sizeof(m));
                m.pointer_vertex = rsurface_vertex3f;
                m.tex[0] = R_GetTexture(r_shadow_attenuation2dtexture);
-#ifdef USETEXMATRIX
                m.pointer_texcoord3f[0] = rsurface_vertex3f;
                m.texmatrix[0] = r_shadow_entitytoattenuationxyz;
                m.pointer_texcoord3f[0] = rsurface_vertex3f;
                m.texmatrix[0] = r_shadow_entitytoattenuationxyz;
-#else
-               m.pointer_texcoord[0] = varray_texcoord2f[0];
-               R_Shadow_Transform_Vertex3f_Texcoord2f(varray_texcoord2f[0] + 3 * surface->num_firstvertex, surface->num_vertices, rsurface_vertex3f + 3 * surface->num_firstvertex, &r_shadow_entitytoattenuationxyz);
-#endif
                m.tex[1] = R_GetTexture(r_shadow_attenuation2dtexture);
                m.tex[1] = R_GetTexture(r_shadow_attenuation2dtexture);
-#ifdef USETEXMATRIX
                m.pointer_texcoord3f[1] = rsurface_vertex3f;
                m.texmatrix[1] = r_shadow_entitytoattenuationz;
                m.pointer_texcoord3f[1] = rsurface_vertex3f;
                m.texmatrix[1] = r_shadow_entitytoattenuationz;
-#else
-               m.pointer_texcoord[1] = varray_texcoord2f[1];
-               R_Shadow_Transform_Vertex3f_Texcoord2f(varray_texcoord2f[1] + 3 * surface->num_firstvertex, surface->num_vertices, rsurface_vertex3f + 3 * surface->num_firstvertex, &r_shadow_entitytoattenuationz);
-#endif
                m.tex[2] = R_GetTexture(basetexture);
                m.pointer_texcoord[2] = surface->groupmesh->data_texcoordtexture2f;
                m.texmatrix[2] = texture->currenttexmatrix;
                if (r_shadow_rtlight->currentcubemap != r_texture_whitecube)
                {
                        m.texcubemap[3] = R_GetTexture(r_shadow_rtlight->currentcubemap);
                m.tex[2] = R_GetTexture(basetexture);
                m.pointer_texcoord[2] = surface->groupmesh->data_texcoordtexture2f;
                m.texmatrix[2] = texture->currenttexmatrix;
                if (r_shadow_rtlight->currentcubemap != r_texture_whitecube)
                {
                        m.texcubemap[3] = R_GetTexture(r_shadow_rtlight->currentcubemap);
-#ifdef USETEXMATRIX
                        m.pointer_texcoord3f[3] = rsurface_vertex3f;
                        m.texmatrix[3] = r_shadow_entitytolight;
                        m.pointer_texcoord3f[3] = rsurface_vertex3f;
                        m.texmatrix[3] = r_shadow_entitytolight;
-#else
-                       m.pointer_texcoord3f[3] = varray_texcoord3f[3];
-                       R_Shadow_Transform_Vertex3f_TexCoord3f(varray_texcoord3f[3] + 3 * surface->num_firstvertex, surface->num_vertices, rsurface_vertex3f + 3 * surface->num_firstvertex, &r_shadow_entitytolight);
-#endif
                }
                GL_BlendFunc(GL_ONE, GL_ONE);
        }
                }
                GL_BlendFunc(GL_ONE, GL_ONE);
        }
@@ -1410,21 +1348,11 @@ static void R_Shadow_RenderSurfacesLighting_Light_Dot3_AmbientPass(const entity_
                memset(&m, 0, sizeof(m));
                m.pointer_vertex = rsurface_vertex3f;
                m.tex[0] = R_GetTexture(r_shadow_attenuation2dtexture);
                memset(&m, 0, sizeof(m));
                m.pointer_vertex = rsurface_vertex3f;
                m.tex[0] = R_GetTexture(r_shadow_attenuation2dtexture);
-#ifdef USETEXMATRIX
                m.pointer_texcoord3f[0] = rsurface_vertex3f;
                m.texmatrix[0] = r_shadow_entitytoattenuationxyz;
                m.pointer_texcoord3f[0] = rsurface_vertex3f;
                m.texmatrix[0] = r_shadow_entitytoattenuationxyz;
-#else
-               m.pointer_texcoord[0] = varray_texcoord2f[0];
-               R_Shadow_Transform_Vertex3f_Texcoord2f(varray_texcoord2f[0] + 3 * surface->num_firstvertex, surface->num_vertices, rsurface_vertex3f + 3 * surface->num_firstvertex, &r_shadow_entitytoattenuationxyz);
-#endif
                m.tex[1] = R_GetTexture(r_shadow_attenuation2dtexture);
                m.tex[1] = R_GetTexture(r_shadow_attenuation2dtexture);
-#ifdef USETEXMATRIX
                m.pointer_texcoord3f[1] = rsurface_vertex3f;
                m.texmatrix[1] = r_shadow_entitytoattenuationz;
                m.pointer_texcoord3f[1] = rsurface_vertex3f;
                m.texmatrix[1] = r_shadow_entitytoattenuationz;
-#else
-               m.pointer_texcoord[1] = varray_texcoord2f[1];
-               R_Shadow_Transform_Vertex3f_Texcoord2f(varray_texcoord2f[1] + 3 * surface->num_firstvertex, surface->num_vertices, rsurface_vertex3f + 3 * surface->num_firstvertex, &r_shadow_entitytoattenuationz);
-#endif
                m.tex[2] = R_GetTexture(basetexture);
                m.pointer_texcoord[2] = surface->groupmesh->data_texcoordtexture2f;
                m.texmatrix[2] = texture->currenttexmatrix;
                m.tex[2] = R_GetTexture(basetexture);
                m.pointer_texcoord[2] = surface->groupmesh->data_texcoordtexture2f;
                m.texmatrix[2] = texture->currenttexmatrix;
@@ -1436,21 +1364,11 @@ static void R_Shadow_RenderSurfacesLighting_Light_Dot3_AmbientPass(const entity_
                memset(&m, 0, sizeof(m));
                m.pointer_vertex = rsurface_vertex3f;
                m.tex[0] = R_GetTexture(r_shadow_attenuation2dtexture);
                memset(&m, 0, sizeof(m));
                m.pointer_vertex = rsurface_vertex3f;
                m.tex[0] = R_GetTexture(r_shadow_attenuation2dtexture);
-#ifdef USETEXMATRIX
                m.pointer_texcoord3f[0] = rsurface_vertex3f;
                m.texmatrix[0] = r_shadow_entitytoattenuationxyz;
                m.pointer_texcoord3f[0] = rsurface_vertex3f;
                m.texmatrix[0] = r_shadow_entitytoattenuationxyz;
-#else
-               m.pointer_texcoord[0] = varray_texcoord2f[0];
-               R_Shadow_Transform_Vertex3f_Texcoord2f(varray_texcoord2f[0] + 3 * surface->num_firstvertex, surface->num_vertices, rsurface_vertex3f + 3 * surface->num_firstvertex, &r_shadow_entitytoattenuationxyz);
-#endif
                m.tex[1] = R_GetTexture(r_shadow_attenuation2dtexture);
                m.tex[1] = R_GetTexture(r_shadow_attenuation2dtexture);
-#ifdef USETEXMATRIX
                m.pointer_texcoord3f[1] = rsurface_vertex3f;
                m.texmatrix[1] = r_shadow_entitytoattenuationz;
                m.pointer_texcoord3f[1] = rsurface_vertex3f;
                m.texmatrix[1] = r_shadow_entitytoattenuationz;
-#else
-               m.pointer_texcoord[1] = varray_texcoord2f[1];
-               R_Shadow_Transform_Vertex3f_Texcoord2f(varray_texcoord2f[1] + 3 * surface->num_firstvertex, surface->num_vertices, rsurface_vertex3f + 3 * surface->num_firstvertex, &r_shadow_entitytoattenuationz);
-#endif
                R_Mesh_State(&m);
                GL_ColorMask(0,0,0,1);
                GL_BlendFunc(GL_ONE, GL_ZERO);
                R_Mesh_State(&m);
                GL_ColorMask(0,0,0,1);
                GL_BlendFunc(GL_ONE, GL_ZERO);
@@ -1466,13 +1384,8 @@ static void R_Shadow_RenderSurfacesLighting_Light_Dot3_AmbientPass(const entity_
                if (r_shadow_rtlight->currentcubemap != r_texture_whitecube)
                {
                        m.texcubemap[1] = R_GetTexture(r_shadow_rtlight->currentcubemap);
                if (r_shadow_rtlight->currentcubemap != r_texture_whitecube)
                {
                        m.texcubemap[1] = R_GetTexture(r_shadow_rtlight->currentcubemap);
-#ifdef USETEXMATRIX
                        m.pointer_texcoord3f[1] = rsurface_vertex3f;
                        m.texmatrix[1] = r_shadow_entitytolight;
                        m.pointer_texcoord3f[1] = rsurface_vertex3f;
                        m.texmatrix[1] = r_shadow_entitytolight;
-#else
-                       m.pointer_texcoord3f[1] = varray_texcoord3f[1];
-                       R_Shadow_Transform_Vertex3f_TexCoord3f(varray_texcoord3f[1] + 3 * surface->num_firstvertex, surface->num_vertices, rsurface_vertex3f + 3 * surface->num_firstvertex, &r_shadow_entitytolight);
-#endif
                }
                GL_BlendFunc(GL_DST_ALPHA, GL_ONE);
        }
                }
                GL_BlendFunc(GL_DST_ALPHA, GL_ONE);
        }
@@ -1514,16 +1427,11 @@ static void R_Shadow_RenderSurfacesLighting_Light_Dot3_DiffusePass(const entity_
                m.texmatrix[0] = texture->currenttexmatrix;
                m.texcubemap[1] = R_GetTexture(r_texture_normalizationcube);
                m.texcombinergb[1] = GL_DOT3_RGBA_ARB;
                m.texmatrix[0] = texture->currenttexmatrix;
                m.texcubemap[1] = R_GetTexture(r_texture_normalizationcube);
                m.texcombinergb[1] = GL_DOT3_RGBA_ARB;
-               m.pointer_texcoord3f[1] = varray_texcoord3f[1];
-               R_Shadow_GenTexCoords_Diffuse_NormalCubeMap(varray_texcoord3f[1] + 3 * surface->num_firstvertex, surface->num_vertices, rsurface_vertex3f + 3 * surface->num_firstvertex, rsurface_svector3f + 3 * surface->num_firstvertex, rsurface_tvector3f + 3 * surface->num_firstvertex, rsurface_normal3f + 3 * surface->num_firstvertex, r_shadow_entitylightorigin);
+               m.pointer_texcoord3f[1] = varray_texcoord3f;
+               R_Shadow_GenTexCoords_Diffuse_NormalCubeMap(varray_texcoord3f + 3 * surface->num_firstvertex, surface->num_vertices, rsurface_vertex3f + 3 * surface->num_firstvertex, rsurface_svector3f + 3 * surface->num_firstvertex, rsurface_tvector3f + 3 * surface->num_firstvertex, rsurface_normal3f + 3 * surface->num_firstvertex, r_shadow_entitylightorigin);
                m.tex3d[2] = R_GetTexture(r_shadow_attenuation3dtexture);
                m.tex3d[2] = R_GetTexture(r_shadow_attenuation3dtexture);
-#ifdef USETEXMATRIX
                m.pointer_texcoord3f[2] = rsurface_vertex3f;
                m.texmatrix[2] = r_shadow_entitytoattenuationxyz;
                m.pointer_texcoord3f[2] = rsurface_vertex3f;
                m.texmatrix[2] = r_shadow_entitytoattenuationxyz;
-#else
-               m.pointer_texcoord3f[2] = varray_texcoord3f[2];
-               R_Shadow_Transform_Vertex3f_TexCoord3f(varray_texcoord3f[2] + 3 * surface->num_firstvertex, surface->num_vertices, rsurface_vertex3f + 3 * surface->num_firstvertex, &r_shadow_entitytoattenuationxyz);
-#endif
                R_Mesh_State(&m);
                GL_ColorMask(0,0,0,1);
                GL_BlendFunc(GL_ONE, GL_ZERO);
                R_Mesh_State(&m);
                GL_ColorMask(0,0,0,1);
                GL_BlendFunc(GL_ONE, GL_ZERO);
@@ -1539,13 +1447,8 @@ static void R_Shadow_RenderSurfacesLighting_Light_Dot3_DiffusePass(const entity_
                if (r_shadow_rtlight->currentcubemap != r_texture_whitecube)
                {
                        m.texcubemap[1] = R_GetTexture(r_shadow_rtlight->currentcubemap);
                if (r_shadow_rtlight->currentcubemap != r_texture_whitecube)
                {
                        m.texcubemap[1] = R_GetTexture(r_shadow_rtlight->currentcubemap);
-#ifdef USETEXMATRIX
                        m.pointer_texcoord3f[1] = rsurface_vertex3f;
                        m.texmatrix[1] = r_shadow_entitytolight;
                        m.pointer_texcoord3f[1] = rsurface_vertex3f;
                        m.texmatrix[1] = r_shadow_entitytolight;
-#else
-                       m.pointer_texcoord3f[1] = varray_texcoord3f[1];
-                       R_Shadow_Transform_Vertex3f_TexCoord3f(varray_texcoord3f[1] + 3 * surface->num_firstvertex, surface->num_vertices, rsurface_vertex3f + 3 * surface->num_firstvertex, &r_shadow_entitytolight);
-#endif
                }
                GL_BlendFunc(GL_DST_ALPHA, GL_ONE);
        }
                }
                GL_BlendFunc(GL_DST_ALPHA, GL_ONE);
        }
@@ -1555,13 +1458,8 @@ static void R_Shadow_RenderSurfacesLighting_Light_Dot3_DiffusePass(const entity_
                memset(&m, 0, sizeof(m));
                m.pointer_vertex = rsurface_vertex3f;
                m.tex3d[0] = R_GetTexture(r_shadow_attenuation3dtexture);
                memset(&m, 0, sizeof(m));
                m.pointer_vertex = rsurface_vertex3f;
                m.tex3d[0] = R_GetTexture(r_shadow_attenuation3dtexture);
-#ifdef USETEXMATRIX
                m.pointer_texcoord3f[0] = rsurface_vertex3f;
                m.texmatrix[0] = r_shadow_entitytoattenuationxyz;
                m.pointer_texcoord3f[0] = rsurface_vertex3f;
                m.texmatrix[0] = r_shadow_entitytoattenuationxyz;
-#else
-               m.pointer_texcoord3f[0] = varray_texcoord3f[0];
-               R_Shadow_Transform_Vertex3f_TexCoord3f(varray_texcoord3f[0] + 3 * surface->num_firstvertex, surface->num_vertices, rsurface_vertex3f + 3 * surface->num_firstvertex, &r_shadow_entitytoattenuationxyz);
-#endif
                R_Mesh_State(&m);
                GL_ColorMask(0,0,0,1);
                GL_BlendFunc(GL_ONE, GL_ZERO);
                R_Mesh_State(&m);
                GL_ColorMask(0,0,0,1);
                GL_BlendFunc(GL_ONE, GL_ZERO);
@@ -1577,8 +1475,8 @@ static void R_Shadow_RenderSurfacesLighting_Light_Dot3_DiffusePass(const entity_
                m.texmatrix[0] = texture->currenttexmatrix;
                m.texcubemap[1] = R_GetTexture(r_texture_normalizationcube);
                m.texcombinergb[1] = GL_DOT3_RGBA_ARB;
                m.texmatrix[0] = texture->currenttexmatrix;
                m.texcubemap[1] = R_GetTexture(r_texture_normalizationcube);
                m.texcombinergb[1] = GL_DOT3_RGBA_ARB;
-               m.pointer_texcoord3f[1] = varray_texcoord3f[1];
-               R_Shadow_GenTexCoords_Diffuse_NormalCubeMap(varray_texcoord3f[1] + 3 * surface->num_firstvertex, surface->num_vertices, rsurface_vertex3f + 3 * surface->num_firstvertex, rsurface_svector3f + 3 * surface->num_firstvertex, rsurface_tvector3f + 3 * surface->num_firstvertex, rsurface_normal3f + 3 * surface->num_firstvertex, r_shadow_entitylightorigin);
+               m.pointer_texcoord3f[1] = varray_texcoord3f;
+               R_Shadow_GenTexCoords_Diffuse_NormalCubeMap(varray_texcoord3f + 3 * surface->num_firstvertex, surface->num_vertices, rsurface_vertex3f + 3 * surface->num_firstvertex, rsurface_svector3f + 3 * surface->num_firstvertex, rsurface_tvector3f + 3 * surface->num_firstvertex, rsurface_normal3f + 3 * surface->num_firstvertex, r_shadow_entitylightorigin);
                R_Mesh_State(&m);
                GL_BlendFunc(GL_DST_ALPHA, GL_ZERO);
                GL_LockArrays(surface->num_firstvertex, surface->num_vertices);
                R_Mesh_State(&m);
                GL_BlendFunc(GL_DST_ALPHA, GL_ZERO);
                GL_LockArrays(surface->num_firstvertex, surface->num_vertices);
@@ -1593,13 +1491,8 @@ static void R_Shadow_RenderSurfacesLighting_Light_Dot3_DiffusePass(const entity_
                if (r_shadow_rtlight->currentcubemap != r_texture_whitecube)
                {
                        m.texcubemap[1] = R_GetTexture(r_shadow_rtlight->currentcubemap);
                if (r_shadow_rtlight->currentcubemap != r_texture_whitecube)
                {
                        m.texcubemap[1] = R_GetTexture(r_shadow_rtlight->currentcubemap);
-#ifdef USETEXMATRIX
                        m.pointer_texcoord3f[1] = rsurface_vertex3f;
                        m.texmatrix[1] = r_shadow_entitytolight;
                        m.pointer_texcoord3f[1] = rsurface_vertex3f;
                        m.texmatrix[1] = r_shadow_entitytolight;
-#else
-                       m.pointer_texcoord3f[1] = varray_texcoord3f[1];
-                       R_Shadow_Transform_Vertex3f_TexCoord3f(varray_texcoord3f[1] + 3 * surface->num_firstvertex, surface->num_vertices, rsurface_vertex3f + 3 * surface->num_firstvertex, &r_shadow_entitytolight);
-#endif
                }
                GL_BlendFunc(GL_DST_ALPHA, GL_ONE);
        }
                }
                GL_BlendFunc(GL_DST_ALPHA, GL_ONE);
        }
@@ -1614,8 +1507,8 @@ static void R_Shadow_RenderSurfacesLighting_Light_Dot3_DiffusePass(const entity_
                m.texmatrix[0] = texture->currenttexmatrix;
                m.texcubemap[1] = R_GetTexture(r_texture_normalizationcube);
                m.texcombinergb[1] = GL_DOT3_RGBA_ARB;
                m.texmatrix[0] = texture->currenttexmatrix;
                m.texcubemap[1] = R_GetTexture(r_texture_normalizationcube);
                m.texcombinergb[1] = GL_DOT3_RGBA_ARB;
-               m.pointer_texcoord3f[1] = varray_texcoord3f[1];
-               R_Shadow_GenTexCoords_Diffuse_NormalCubeMap(varray_texcoord3f[1] + 3 * surface->num_firstvertex, surface->num_vertices, rsurface_vertex3f + 3 * surface->num_firstvertex, rsurface_svector3f + 3 * surface->num_firstvertex, rsurface_tvector3f + 3 * surface->num_firstvertex, rsurface_normal3f + 3 * surface->num_firstvertex, r_shadow_entitylightorigin);
+               m.pointer_texcoord3f[1] = varray_texcoord3f;
+               R_Shadow_GenTexCoords_Diffuse_NormalCubeMap(varray_texcoord3f + 3 * surface->num_firstvertex, surface->num_vertices, rsurface_vertex3f + 3 * surface->num_firstvertex, rsurface_svector3f + 3 * surface->num_firstvertex, rsurface_tvector3f + 3 * surface->num_firstvertex, rsurface_normal3f + 3 * surface->num_firstvertex, r_shadow_entitylightorigin);
                R_Mesh_State(&m);
                GL_ColorMask(0,0,0,1);
                GL_BlendFunc(GL_ONE, GL_ZERO);
                R_Mesh_State(&m);
                GL_ColorMask(0,0,0,1);
                GL_BlendFunc(GL_ONE, GL_ZERO);
@@ -1629,13 +1522,8 @@ static void R_Shadow_RenderSurfacesLighting_Light_Dot3_DiffusePass(const entity_
                m.pointer_texcoord[0] = surface->groupmesh->data_texcoordtexture2f;
                m.texmatrix[0] = texture->currenttexmatrix;
                m.tex3d[1] = R_GetTexture(r_shadow_attenuation3dtexture);
                m.pointer_texcoord[0] = surface->groupmesh->data_texcoordtexture2f;
                m.texmatrix[0] = texture->currenttexmatrix;
                m.tex3d[1] = R_GetTexture(r_shadow_attenuation3dtexture);
-#ifdef USETEXMATRIX
                m.pointer_texcoord3f[1] = rsurface_vertex3f;
                m.texmatrix[1] = r_shadow_entitytoattenuationxyz;
                m.pointer_texcoord3f[1] = rsurface_vertex3f;
                m.texmatrix[1] = r_shadow_entitytoattenuationxyz;
-#else
-               m.pointer_texcoord3f[1] = varray_texcoord3f[1];
-               R_Shadow_Transform_Vertex3f_TexCoord3f(varray_texcoord3f[1] + 3 * surface->num_firstvertex, surface->num_vertices, rsurface_vertex3f + 3 * surface->num_firstvertex, &r_shadow_entitytoattenuationxyz);
-#endif
                GL_BlendFunc(GL_DST_ALPHA, GL_ONE);
        }
        else if (r_textureunits.integer >= 4)
                GL_BlendFunc(GL_DST_ALPHA, GL_ONE);
        }
        else if (r_textureunits.integer >= 4)
@@ -1649,24 +1537,14 @@ static void R_Shadow_RenderSurfacesLighting_Light_Dot3_DiffusePass(const entity_
                m.texmatrix[0] = texture->currenttexmatrix;
                m.texcubemap[1] = R_GetTexture(r_texture_normalizationcube);
                m.texcombinergb[1] = GL_DOT3_RGBA_ARB;
                m.texmatrix[0] = texture->currenttexmatrix;
                m.texcubemap[1] = R_GetTexture(r_texture_normalizationcube);
                m.texcombinergb[1] = GL_DOT3_RGBA_ARB;
-               m.pointer_texcoord3f[1] = varray_texcoord3f[1];
-               R_Shadow_GenTexCoords_Diffuse_NormalCubeMap(varray_texcoord3f[1] + 3 * surface->num_firstvertex, surface->num_vertices, rsurface_vertex3f + 3 * surface->num_firstvertex, rsurface_svector3f + 3 * surface->num_firstvertex, rsurface_tvector3f + 3 * surface->num_firstvertex, rsurface_normal3f + 3 * surface->num_firstvertex, r_shadow_entitylightorigin);
+               m.pointer_texcoord3f[1] = varray_texcoord3f;
+               R_Shadow_GenTexCoords_Diffuse_NormalCubeMap(varray_texcoord3f + 3 * surface->num_firstvertex, surface->num_vertices, rsurface_vertex3f + 3 * surface->num_firstvertex, rsurface_svector3f + 3 * surface->num_firstvertex, rsurface_tvector3f + 3 * surface->num_firstvertex, rsurface_normal3f + 3 * surface->num_firstvertex, r_shadow_entitylightorigin);
                m.tex[2] = R_GetTexture(r_shadow_attenuation2dtexture);
                m.tex[2] = R_GetTexture(r_shadow_attenuation2dtexture);
-#ifdef USETEXMATRIX
                m.pointer_texcoord3f[2] = rsurface_vertex3f;
                m.texmatrix[2] = r_shadow_entitytoattenuationxyz;
                m.pointer_texcoord3f[2] = rsurface_vertex3f;
                m.texmatrix[2] = r_shadow_entitytoattenuationxyz;
-#else
-               m.pointer_texcoord[2] = varray_texcoord2f[2];
-               R_Shadow_Transform_Vertex3f_Texcoord2f(varray_texcoord2f[2] + 3 * surface->num_firstvertex, surface->num_vertices, rsurface_vertex3f + 3 * surface->num_firstvertex, &r_shadow_entitytoattenuationxyz);
-#endif
                m.tex[3] = R_GetTexture(r_shadow_attenuation2dtexture);
                m.tex[3] = R_GetTexture(r_shadow_attenuation2dtexture);
-#ifdef USETEXMATRIX
                m.pointer_texcoord3f[3] = rsurface_vertex3f;
                m.texmatrix[3] = r_shadow_entitytoattenuationz;
                m.pointer_texcoord3f[3] = rsurface_vertex3f;
                m.texmatrix[3] = r_shadow_entitytoattenuationz;
-#else
-               m.pointer_texcoord[3] = varray_texcoord2f[3];
-               R_Shadow_Transform_Vertex3f_Texcoord2f(varray_texcoord2f[3] + 3 * surface->num_firstvertex, surface->num_vertices, rsurface_vertex3f + 3 * surface->num_firstvertex, &r_shadow_entitytoattenuationz);
-#endif
                R_Mesh_State(&m);
                GL_ColorMask(0,0,0,1);
                GL_BlendFunc(GL_ONE, GL_ZERO);
                R_Mesh_State(&m);
                GL_ColorMask(0,0,0,1);
                GL_BlendFunc(GL_ONE, GL_ZERO);
@@ -1682,13 +1560,8 @@ static void R_Shadow_RenderSurfacesLighting_Light_Dot3_DiffusePass(const entity_
                if (r_shadow_rtlight->currentcubemap != r_texture_whitecube)
                {
                        m.texcubemap[1] = R_GetTexture(r_shadow_rtlight->currentcubemap);
                if (r_shadow_rtlight->currentcubemap != r_texture_whitecube)
                {
                        m.texcubemap[1] = R_GetTexture(r_shadow_rtlight->currentcubemap);
-#ifdef USETEXMATRIX
                        m.pointer_texcoord3f[1] = rsurface_vertex3f;
                        m.texmatrix[1] = r_shadow_entitytolight;
                        m.pointer_texcoord3f[1] = rsurface_vertex3f;
                        m.texmatrix[1] = r_shadow_entitytolight;
-#else
-                       m.pointer_texcoord3f[1] = varray_texcoord3f[1];
-                       R_Shadow_Transform_Vertex3f_TexCoord3f(varray_texcoord3f[1] + 3 * surface->num_firstvertex, surface->num_vertices, rsurface_vertex3f + 3 * surface->num_firstvertex, &r_shadow_entitytolight);
-#endif
                }
                GL_BlendFunc(GL_DST_ALPHA, GL_ONE);
        }
                }
                GL_BlendFunc(GL_DST_ALPHA, GL_ONE);
        }
@@ -1698,21 +1571,11 @@ static void R_Shadow_RenderSurfacesLighting_Light_Dot3_DiffusePass(const entity_
                memset(&m, 0, sizeof(m));
                m.pointer_vertex = rsurface_vertex3f;
                m.tex[0] = R_GetTexture(r_shadow_attenuation2dtexture);
                memset(&m, 0, sizeof(m));
                m.pointer_vertex = rsurface_vertex3f;
                m.tex[0] = R_GetTexture(r_shadow_attenuation2dtexture);
-#ifdef USETEXMATRIX
                m.pointer_texcoord3f[0] = rsurface_vertex3f;
                m.texmatrix[0] = r_shadow_entitytoattenuationxyz;
                m.pointer_texcoord3f[0] = rsurface_vertex3f;
                m.texmatrix[0] = r_shadow_entitytoattenuationxyz;
-#else
-               m.pointer_texcoord[0] = varray_texcoord2f[0];
-               R_Shadow_Transform_Vertex3f_Texcoord2f(varray_texcoord2f[0] + 3 * surface->num_firstvertex, surface->num_vertices, rsurface_vertex3f + 3 * surface->num_firstvertex, &r_shadow_entitytoattenuationxyz);
-#endif
                m.tex[1] = R_GetTexture(r_shadow_attenuation2dtexture);
                m.tex[1] = R_GetTexture(r_shadow_attenuation2dtexture);
-#ifdef USETEXMATRIX
                m.pointer_texcoord3f[1] = rsurface_vertex3f;
                m.texmatrix[1] = r_shadow_entitytoattenuationz;
                m.pointer_texcoord3f[1] = rsurface_vertex3f;
                m.texmatrix[1] = r_shadow_entitytoattenuationz;
-#else
-               m.pointer_texcoord[1] = varray_texcoord2f[1];
-               R_Shadow_Transform_Vertex3f_Texcoord2f(varray_texcoord2f[1] + 3 * surface->num_firstvertex, surface->num_vertices, rsurface_vertex3f + 3 * surface->num_firstvertex, &r_shadow_entitytoattenuationz);
-#endif
                R_Mesh_State(&m);
                GL_ColorMask(0,0,0,1);
                GL_BlendFunc(GL_ONE, GL_ZERO);
                R_Mesh_State(&m);
                GL_ColorMask(0,0,0,1);
                GL_BlendFunc(GL_ONE, GL_ZERO);
@@ -1728,8 +1591,8 @@ static void R_Shadow_RenderSurfacesLighting_Light_Dot3_DiffusePass(const entity_
                m.texmatrix[0] = texture->currenttexmatrix;
                m.texcubemap[1] = R_GetTexture(r_texture_normalizationcube);
                m.texcombinergb[1] = GL_DOT3_RGBA_ARB;
                m.texmatrix[0] = texture->currenttexmatrix;
                m.texcubemap[1] = R_GetTexture(r_texture_normalizationcube);
                m.texcombinergb[1] = GL_DOT3_RGBA_ARB;
-               m.pointer_texcoord3f[1] = varray_texcoord3f[1];
-               R_Shadow_GenTexCoords_Diffuse_NormalCubeMap(varray_texcoord3f[1] + 3 * surface->num_firstvertex, surface->num_vertices, rsurface_vertex3f + 3 * surface->num_firstvertex, rsurface_svector3f + 3 * surface->num_firstvertex, rsurface_tvector3f + 3 * surface->num_firstvertex, rsurface_normal3f + 3 * surface->num_firstvertex, r_shadow_entitylightorigin);
+               m.pointer_texcoord3f[1] = varray_texcoord3f;
+               R_Shadow_GenTexCoords_Diffuse_NormalCubeMap(varray_texcoord3f + 3 * surface->num_firstvertex, surface->num_vertices, rsurface_vertex3f + 3 * surface->num_firstvertex, rsurface_svector3f + 3 * surface->num_firstvertex, rsurface_tvector3f + 3 * surface->num_firstvertex, rsurface_normal3f + 3 * surface->num_firstvertex, r_shadow_entitylightorigin);
                R_Mesh_State(&m);
                GL_BlendFunc(GL_DST_ALPHA, GL_ZERO);
                GL_LockArrays(surface->num_firstvertex, surface->num_vertices);
                R_Mesh_State(&m);
                GL_BlendFunc(GL_DST_ALPHA, GL_ZERO);
                GL_LockArrays(surface->num_firstvertex, surface->num_vertices);
@@ -1744,13 +1607,8 @@ static void R_Shadow_RenderSurfacesLighting_Light_Dot3_DiffusePass(const entity_
                if (r_shadow_rtlight->currentcubemap != r_texture_whitecube)
                {
                        m.texcubemap[1] = R_GetTexture(r_shadow_rtlight->currentcubemap);
                if (r_shadow_rtlight->currentcubemap != r_texture_whitecube)
                {
                        m.texcubemap[1] = R_GetTexture(r_shadow_rtlight->currentcubemap);
-#ifdef USETEXMATRIX
                        m.pointer_texcoord3f[1] = rsurface_vertex3f;
                        m.texmatrix[1] = r_shadow_entitytolight;
                        m.pointer_texcoord3f[1] = rsurface_vertex3f;
                        m.texmatrix[1] = r_shadow_entitytolight;
-#else
-                       m.pointer_texcoord3f[1] = varray_texcoord3f[1];
-                       R_Shadow_Transform_Vertex3f_TexCoord3f(varray_texcoord3f[1] + 3 * surface->num_firstvertex, surface->num_vertices, rsurface_vertex3f + 3 * surface->num_firstvertex, &r_shadow_entitytolight);
-#endif
                }
                GL_BlendFunc(GL_DST_ALPHA, GL_ONE);
        }
                }
                GL_BlendFunc(GL_DST_ALPHA, GL_ONE);
        }
@@ -1787,8 +1645,8 @@ static void R_Shadow_RenderSurfacesLighting_Light_Dot3_SpecularPass(const entity
                m.texmatrix[0] = texture->currenttexmatrix;
                m.texcubemap[1] = R_GetTexture(r_texture_normalizationcube);
                m.texcombinergb[1] = GL_DOT3_RGBA_ARB;
                m.texmatrix[0] = texture->currenttexmatrix;
                m.texcubemap[1] = R_GetTexture(r_texture_normalizationcube);
                m.texcombinergb[1] = GL_DOT3_RGBA_ARB;
-               m.pointer_texcoord3f[1] = varray_texcoord3f[1];
-               R_Shadow_GenTexCoords_Specular_NormalCubeMap(varray_texcoord3f[1] + 3 * surface->num_firstvertex, surface->num_vertices, rsurface_vertex3f + 3 * surface->num_firstvertex, rsurface_svector3f + 3 * surface->num_firstvertex, rsurface_tvector3f + 3 * surface->num_firstvertex, rsurface_normal3f + 3 * surface->num_firstvertex, r_shadow_entitylightorigin, r_shadow_entityeyeorigin);
+               m.pointer_texcoord3f[1] = varray_texcoord3f;
+               R_Shadow_GenTexCoords_Specular_NormalCubeMap(varray_texcoord3f + 3 * surface->num_firstvertex, surface->num_vertices, rsurface_vertex3f + 3 * surface->num_firstvertex, rsurface_svector3f + 3 * surface->num_firstvertex, rsurface_tvector3f + 3 * surface->num_firstvertex, rsurface_normal3f + 3 * surface->num_firstvertex, r_shadow_entitylightorigin, r_shadow_entityeyeorigin);
                R_Mesh_State(&m);
                GL_ColorMask(0,0,0,1);
                // this squares the result
                R_Mesh_State(&m);
                GL_ColorMask(0,0,0,1);
                // this squares the result
@@ -1814,13 +1672,8 @@ static void R_Shadow_RenderSurfacesLighting_Light_Dot3_SpecularPass(const entity
                memset(&m, 0, sizeof(m));
                m.pointer_vertex = rsurface_vertex3f;
                m.tex3d[0] = R_GetTexture(r_shadow_attenuation3dtexture);
                memset(&m, 0, sizeof(m));
                m.pointer_vertex = rsurface_vertex3f;
                m.tex3d[0] = R_GetTexture(r_shadow_attenuation3dtexture);
-#ifdef USETEXMATRIX
                m.pointer_texcoord3f[0] = rsurface_vertex3f;
                m.texmatrix[0] = r_shadow_entitytoattenuationxyz;
                m.pointer_texcoord3f[0] = rsurface_vertex3f;
                m.texmatrix[0] = r_shadow_entitytoattenuationxyz;
-#else
-               m.pointer_texcoord3f[0] = varray_texcoord3f[0];
-               R_Shadow_Transform_Vertex3f_TexCoord3f(varray_texcoord3f[0] + 3 * surface->num_firstvertex, surface->num_vertices, rsurface_vertex3f + 3 * surface->num_firstvertex, &r_shadow_entitytoattenuationxyz);
-#endif
                R_Mesh_State(&m);
                GL_BlendFunc(GL_DST_ALPHA, GL_ZERO);
                GL_LockArrays(surface->num_firstvertex, surface->num_vertices);
                R_Mesh_State(&m);
                GL_BlendFunc(GL_DST_ALPHA, GL_ZERO);
                GL_LockArrays(surface->num_firstvertex, surface->num_vertices);
@@ -1835,13 +1688,8 @@ static void R_Shadow_RenderSurfacesLighting_Light_Dot3_SpecularPass(const entity
                if (r_shadow_rtlight->currentcubemap != r_texture_whitecube)
                {
                        m.texcubemap[1] = R_GetTexture(r_shadow_rtlight->currentcubemap);
                if (r_shadow_rtlight->currentcubemap != r_texture_whitecube)
                {
                        m.texcubemap[1] = R_GetTexture(r_shadow_rtlight->currentcubemap);
-#ifdef USETEXMATRIX
                        m.pointer_texcoord3f[1] = rsurface_vertex3f;
                        m.texmatrix[1] = r_shadow_entitytolight;
                        m.pointer_texcoord3f[1] = rsurface_vertex3f;
                        m.texmatrix[1] = r_shadow_entitytolight;
-#else
-                       m.pointer_texcoord3f[1] = varray_texcoord3f[1];
-                       R_Shadow_Transform_Vertex3f_TexCoord3f(varray_texcoord3f[1] + 3 * surface->num_firstvertex, surface->num_vertices, rsurface_vertex3f + 3 * surface->num_firstvertex, &r_shadow_entitytolight);
-#endif
                }
                GL_BlendFunc(GL_DST_ALPHA, GL_ONE);
        }
                }
                GL_BlendFunc(GL_DST_ALPHA, GL_ONE);
        }
@@ -1855,8 +1703,8 @@ static void R_Shadow_RenderSurfacesLighting_Light_Dot3_SpecularPass(const entity
                m.texmatrix[0] = texture->currenttexmatrix;
                m.texcubemap[1] = R_GetTexture(r_texture_normalizationcube);
                m.texcombinergb[1] = GL_DOT3_RGBA_ARB;
                m.texmatrix[0] = texture->currenttexmatrix;
                m.texcubemap[1] = R_GetTexture(r_texture_normalizationcube);
                m.texcombinergb[1] = GL_DOT3_RGBA_ARB;
-               m.pointer_texcoord3f[1] = varray_texcoord3f[1];
-               R_Shadow_GenTexCoords_Specular_NormalCubeMap(varray_texcoord3f[1] + 3 * surface->num_firstvertex, surface->num_vertices, rsurface_vertex3f + 3 * surface->num_firstvertex, rsurface_svector3f + 3 * surface->num_firstvertex, rsurface_tvector3f + 3 * surface->num_firstvertex, rsurface_normal3f + 3 * surface->num_firstvertex, r_shadow_entitylightorigin, r_shadow_entityeyeorigin);
+               m.pointer_texcoord3f[1] = varray_texcoord3f;
+               R_Shadow_GenTexCoords_Specular_NormalCubeMap(varray_texcoord3f + 3 * surface->num_firstvertex, surface->num_vertices, rsurface_vertex3f + 3 * surface->num_firstvertex, rsurface_svector3f + 3 * surface->num_firstvertex, rsurface_tvector3f + 3 * surface->num_firstvertex, rsurface_normal3f + 3 * surface->num_firstvertex, r_shadow_entitylightorigin, r_shadow_entityeyeorigin);
                R_Mesh_State(&m);
                GL_ColorMask(0,0,0,1);
                // this squares the result
                R_Mesh_State(&m);
                GL_ColorMask(0,0,0,1);
                // this squares the result
@@ -1885,13 +1733,8 @@ static void R_Shadow_RenderSurfacesLighting_Light_Dot3_SpecularPass(const entity
                m.pointer_texcoord[0] = surface->groupmesh->data_texcoordtexture2f;
                m.texmatrix[0] = texture->currenttexmatrix;
                m.tex3d[1] = R_GetTexture(r_shadow_attenuation3dtexture);
                m.pointer_texcoord[0] = surface->groupmesh->data_texcoordtexture2f;
                m.texmatrix[0] = texture->currenttexmatrix;
                m.tex3d[1] = R_GetTexture(r_shadow_attenuation3dtexture);
-#ifdef USETEXMATRIX
                m.pointer_texcoord3f[1] = rsurface_vertex3f;
                m.texmatrix[1] = r_shadow_entitytoattenuationxyz;
                m.pointer_texcoord3f[1] = rsurface_vertex3f;
                m.texmatrix[1] = r_shadow_entitytoattenuationxyz;
-#else
-               m.pointer_texcoord3f[1] = varray_texcoord3f[1];
-               R_Shadow_Transform_Vertex3f_TexCoord3f(varray_texcoord3f[1] + 3 * surface->num_firstvertex, surface->num_vertices, rsurface_vertex3f + 3 * surface->num_firstvertex, &r_shadow_entitytoattenuationxyz);
-#endif
                GL_BlendFunc(GL_DST_ALPHA, GL_ONE);
        }
        else
                GL_BlendFunc(GL_DST_ALPHA, GL_ONE);
        }
        else
@@ -1904,8 +1747,8 @@ static void R_Shadow_RenderSurfacesLighting_Light_Dot3_SpecularPass(const entity
                m.texmatrix[0] = texture->currenttexmatrix;
                m.texcubemap[1] = R_GetTexture(r_texture_normalizationcube);
                m.texcombinergb[1] = GL_DOT3_RGBA_ARB;
                m.texmatrix[0] = texture->currenttexmatrix;
                m.texcubemap[1] = R_GetTexture(r_texture_normalizationcube);
                m.texcombinergb[1] = GL_DOT3_RGBA_ARB;
-               m.pointer_texcoord3f[1] = varray_texcoord3f[1];
-               R_Shadow_GenTexCoords_Specular_NormalCubeMap(varray_texcoord3f[1] + 3 * surface->num_firstvertex, surface->num_vertices, rsurface_vertex3f + 3 * surface->num_firstvertex, rsurface_svector3f + 3 * surface->num_firstvertex, rsurface_tvector3f + 3 * surface->num_firstvertex, rsurface_normal3f + 3 * surface->num_firstvertex, r_shadow_entitylightorigin, r_shadow_entityeyeorigin);
+               m.pointer_texcoord3f[1] = varray_texcoord3f;
+               R_Shadow_GenTexCoords_Specular_NormalCubeMap(varray_texcoord3f + 3 * surface->num_firstvertex, surface->num_vertices, rsurface_vertex3f + 3 * surface->num_firstvertex, rsurface_svector3f + 3 * surface->num_firstvertex, rsurface_tvector3f + 3 * surface->num_firstvertex, rsurface_normal3f + 3 * surface->num_firstvertex, r_shadow_entitylightorigin, r_shadow_entityeyeorigin);
                R_Mesh_State(&m);
                GL_ColorMask(0,0,0,1);
                // this squares the result
                R_Mesh_State(&m);
                GL_ColorMask(0,0,0,1);
                // this squares the result
@@ -1931,21 +1774,11 @@ static void R_Shadow_RenderSurfacesLighting_Light_Dot3_SpecularPass(const entity
                memset(&m, 0, sizeof(m));
                m.pointer_vertex = rsurface_vertex3f;
                m.tex[0] = R_GetTexture(r_shadow_attenuation2dtexture);
                memset(&m, 0, sizeof(m));
                m.pointer_vertex = rsurface_vertex3f;
                m.tex[0] = R_GetTexture(r_shadow_attenuation2dtexture);
-#ifdef USETEXMATRIX
                m.pointer_texcoord3f[0] = rsurface_vertex3f;
                m.texmatrix[0] = r_shadow_entitytoattenuationxyz;
                m.pointer_texcoord3f[0] = rsurface_vertex3f;
                m.texmatrix[0] = r_shadow_entitytoattenuationxyz;
-#else
-               m.pointer_texcoord[0] = varray_texcoord2f[0];
-               R_Shadow_Transform_Vertex3f_Texcoord2f(varray_texcoord2f[0] + 3 * surface->num_firstvertex, surface->num_vertices, rsurface_vertex3f + 3 * surface->num_firstvertex, &r_shadow_entitytoattenuationxyz);
-#endif
                m.tex[1] = R_GetTexture(r_shadow_attenuation2dtexture);
                m.tex[1] = R_GetTexture(r_shadow_attenuation2dtexture);
-#ifdef USETEXMATRIX
                m.pointer_texcoord3f[1] = rsurface_vertex3f;
                m.texmatrix[1] = r_shadow_entitytoattenuationz;
                m.pointer_texcoord3f[1] = rsurface_vertex3f;
                m.texmatrix[1] = r_shadow_entitytoattenuationz;
-#else
-               m.pointer_texcoord[1] = varray_texcoord2f[1];
-               R_Shadow_Transform_Vertex3f_Texcoord2f(varray_texcoord2f[1] + 3 * surface->num_firstvertex, surface->num_vertices, rsurface_vertex3f + 3 * surface->num_firstvertex, &r_shadow_entitytoattenuationz);
-#endif
                R_Mesh_State(&m);
                GL_BlendFunc(GL_DST_ALPHA, GL_ZERO);
                GL_LockArrays(surface->num_firstvertex, surface->num_vertices);
                R_Mesh_State(&m);
                GL_BlendFunc(GL_DST_ALPHA, GL_ZERO);
                GL_LockArrays(surface->num_firstvertex, surface->num_vertices);
@@ -1960,13 +1793,8 @@ static void R_Shadow_RenderSurfacesLighting_Light_Dot3_SpecularPass(const entity
                if (r_shadow_rtlight->currentcubemap != r_texture_whitecube)
                {
                        m.texcubemap[1] = R_GetTexture(r_shadow_rtlight->currentcubemap);
                if (r_shadow_rtlight->currentcubemap != r_texture_whitecube)
                {
                        m.texcubemap[1] = R_GetTexture(r_shadow_rtlight->currentcubemap);
-#ifdef USETEXMATRIX
                        m.pointer_texcoord3f[1] = rsurface_vertex3f;
                        m.texmatrix[1] = r_shadow_entitytolight;
                        m.pointer_texcoord3f[1] = rsurface_vertex3f;
                        m.texmatrix[1] = r_shadow_entitytolight;
-#else
-                       m.pointer_texcoord3f[1] = varray_texcoord3f[1];
-                       R_Shadow_Transform_Vertex3f_TexCoord3f(varray_texcoord3f[1] + 3 * surface->num_firstvertex, surface->num_vertices, rsurface_vertex3f + 3 * surface->num_firstvertex, &r_shadow_entitytolight);
-#endif
                }
                GL_BlendFunc(GL_DST_ALPHA, GL_ONE);
        }
                }
                GL_BlendFunc(GL_DST_ALPHA, GL_ONE);
        }
@@ -2108,22 +1936,12 @@ static void R_Shadow_RenderSurfacesLighting_Light_Vertex(const entity_render_t *
        {
                // voodoo2
                m.tex[1] = R_GetTexture(r_shadow_attenuation2dtexture);
        {
                // voodoo2
                m.tex[1] = R_GetTexture(r_shadow_attenuation2dtexture);
-#ifdef USETEXMATRIX
                m.texmatrix[1] = r_shadow_entitytoattenuationxyz;
                m.texmatrix[1] = r_shadow_entitytoattenuationxyz;
-#else
-               m.pointer_texcoord[1] = varray_texcoord2f[1];
-               R_Shadow_Transform_Vertex3f_Texcoord2f(varray_texcoord2f[1] + 3 * surface->num_firstvertex, surface->num_vertices, rsurface_vertex3f + 3 * surface->num_firstvertex, &r_shadow_entitytoattenuationxyz);
-#endif
                if (r_textureunits.integer >= 3)
                {
                        // Geforce3/Radeon class but not using dot3
                        m.tex[2] = R_GetTexture(r_shadow_attenuation2dtexture);
                if (r_textureunits.integer >= 3)
                {
                        // Geforce3/Radeon class but not using dot3
                        m.tex[2] = R_GetTexture(r_shadow_attenuation2dtexture);
-#ifdef USETEXMATRIX
                        m.texmatrix[2] = r_shadow_entitytoattenuationz;
                        m.texmatrix[2] = r_shadow_entitytoattenuationz;
-#else
-                       m.pointer_texcoord[2] = varray_texcoord2f[2];
-                       R_Shadow_Transform_Vertex3f_Texcoord2f(varray_texcoord2f[2] + 3 * surface->num_firstvertex, surface->num_vertices, rsurface_vertex3f + 3 * surface->num_firstvertex, &r_shadow_entitytoattenuationz);
-#endif
                }
        }
        m.pointer_color = varray_color4f;
                }
        }
        m.pointer_color = varray_color4f;
@@ -2138,19 +1956,11 @@ static void R_Shadow_RenderSurfacesLighting_Light_Vertex(const entity_render_t *
                if (r_textureunits.integer >= 2)
                {
                        // voodoo2 or TNT
                if (r_textureunits.integer >= 2)
                {
                        // voodoo2 or TNT
-#ifdef USETEXMATRIX
                        R_Mesh_TexCoordPointer(1, 3, rsurface_vertex3f);
                        R_Mesh_TexCoordPointer(1, 3, rsurface_vertex3f);
-#else
-                       R_Shadow_Transform_Vertex3f_Texcoord2f(varray_texcoord2f[1] + 3 * surface->num_firstvertex, surface->num_vertices, rsurface_vertex3f + 3 * surface->num_firstvertex, &r_shadow_entitytoattenuationxyz);
-#endif
                        if (r_textureunits.integer >= 3)
                        {
                                // Voodoo4 or Kyro (or Geforce3/Radeon with gl_combine off)
                        if (r_textureunits.integer >= 3)
                        {
                                // Voodoo4 or Kyro (or Geforce3/Radeon with gl_combine off)
-#ifdef USETEXMATRIX
                                R_Mesh_TexCoordPointer(2, 3, rsurface_vertex3f);
                                R_Mesh_TexCoordPointer(2, 3, rsurface_vertex3f);
-#else
-                               R_Shadow_Transform_Vertex3f_Texcoord2f(varray_texcoord2f[2] + 3 * surface->num_firstvertex, surface->num_vertices, rsurface_vertex3f + 3 * surface->num_firstvertex, &r_shadow_entitytoattenuationz);
-#endif
                        }
                }
                R_Mesh_TexBind(0, R_GetTexture(basetexture));
                        }
                }
                R_Mesh_TexBind(0, R_GetTexture(basetexture));