R_Mesh_Matrix(&identitymatrix);
+ R_Mesh_VertexPointer(particle_vertex3f);
+ R_Mesh_ColorPointer(NULL);
memset(&m, 0, sizeof(m));
m.tex[0] = R_GetTexture(tex->texture);
m.pointer_texcoord[0] = particle_texcoord2f;
- m.pointer_vertex = particle_vertex3f;
- R_Mesh_State(&m);
+ R_Mesh_TextureState(&m);
GL_Color(cr, cg, cb, ca);
{
float x, y;
cachepic_t *pic;
- rmeshstate_t m;
float vertex3f[12];
float texcoord2f[8];
// don't do anything if not initialized yet
GL_Color(1,1,1,1);
GL_BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
GL_DepthTest(false);
- memset(&m, 0, sizeof(m));
- m.pointer_vertex = vertex3f;
- m.pointer_texcoord[0] = texcoord2f;
- m.tex[0] = R_GetTexture(pic->tex);
- R_Mesh_State(&m);
+ R_Mesh_VertexPointer(vertex3f);
+ R_Mesh_ColorPointer(NULL);
+ R_Mesh_ResetTextureState();
+ R_Mesh_TexBind(0, R_GetTexture(pic->tex));
+ R_Mesh_TexCoordPointer(0, 2, texcoord2f);
vertex3f[2] = vertex3f[5] = vertex3f[8] = vertex3f[11] = 0;
vertex3f[0] = vertex3f[9] = x;
vertex3f[1] = vertex3f[4] = y;
}
}
-void R_Mesh_State(const rmeshstate_t *m)
+void R_Mesh_TextureState(const rmeshstate_t *m)
{
unsigned int i;
BACKENDACTIVECHECK
- R_Mesh_VertexPointer(m->pointer_vertex);
- R_Mesh_ColorPointer(m->pointer_color);
-
if (gl_backend_rebindtextures)
{
gl_backend_rebindtextures = false;
}
}
+void R_Mesh_ResetTextureState(void)
+{
+ unsigned int unitnum;
+
+ BACKENDACTIVECHECK
+
+ if (gl_backend_rebindtextures)
+ {
+ gl_backend_rebindtextures = false;
+ GL_SetupTextureState();
+ }
+
+ for (unitnum = 0;unitnum < backendimageunits;unitnum++)
+ {
+ gltextureunit_t *unit = gl_state.units + unitnum;
+ // update 1d texture binding
+ if (unit->t1d)
+ {
+ GL_ActiveTexture(unitnum);
+ if (unitnum < backendunits)
+ qglDisable(GL_TEXTURE_1D);
+ unit->t1d = 0;
+ qglBindTexture(GL_TEXTURE_1D, unit->t1d);
+ CHECKGLERROR
+ }
+ // update 2d texture binding
+ if (unit->t2d)
+ {
+ GL_ActiveTexture(unitnum);
+ if (unitnum < backendunits)
+ qglDisable(GL_TEXTURE_2D);
+ unit->t2d = 0;
+ qglBindTexture(GL_TEXTURE_2D, unit->t2d);
+ CHECKGLERROR
+ }
+ // update 3d texture binding
+ if (unit->t3d)
+ {
+ GL_ActiveTexture(unitnum);
+ if (unitnum < backendunits)
+ qglDisable(GL_TEXTURE_3D);
+ unit->t3d = 0;
+ qglBindTexture(GL_TEXTURE_3D, unit->t3d);
+ CHECKGLERROR
+ }
+ // update cubemap texture binding
+ if (unit->tcubemap)
+ {
+ GL_ActiveTexture(unitnum);
+ if (unitnum < backendunits)
+ qglDisable(GL_TEXTURE_CUBE_MAP_ARB);
+ unit->tcubemap = 0;
+ qglBindTexture(GL_TEXTURE_CUBE_MAP_ARB, unit->tcubemap);
+ CHECKGLERROR
+ }
+ }
+ for (unitnum = 0;unitnum < backendarrayunits;unitnum++)
+ {
+ gltextureunit_t *unit = gl_state.units + unitnum;
+ // texture array unit is disabled, disable the array
+ if (unit->arrayenabled)
+ {
+ unit->arrayenabled = false;
+ GL_ClientActiveTexture(unitnum);
+ qglDisableClientState(GL_TEXTURE_COORD_ARRAY);CHECKGLERROR
+ }
+ }
+ for (unitnum = 0;unitnum < backendunits;unitnum++)
+ {
+ gltextureunit_t *unit = gl_state.units + unitnum;
+ // no texmatrix specified, revert to identity
+ if (unit->texmatrixenabled)
+ {
+ unit->texmatrixenabled = false;
+ qglMatrixMode(GL_TEXTURE);
+ GL_ActiveTexture(unitnum);
+ qglLoadIdentity();
+ qglMatrixMode(GL_MODELVIEW);
+ }
+ if (gl_combine.integer)
+ {
+ // GL_ARB_texture_env_combine
+ if (unit->combinergb != GL_MODULATE)
+ {
+ unit->combinergb = GL_MODULATE;
+ GL_ActiveTexture(unitnum);
+ qglTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, unit->combinergb);CHECKGLERROR
+ }
+ if (unit->combinealpha != GL_MODULATE)
+ {
+ unit->combinealpha = GL_MODULATE;
+ GL_ActiveTexture(unitnum);
+ qglTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA_ARB, unit->combinealpha);CHECKGLERROR
+ }
+ if (unit->rgbscale != 1)
+ {
+ GL_ActiveTexture(unitnum);
+ qglTexEnvi(GL_TEXTURE_ENV, GL_RGB_SCALE_ARB, (unit->rgbscale = 1));CHECKGLERROR
+ }
+ if (unit->alphascale != 1)
+ {
+ GL_ActiveTexture(unitnum);
+ qglTexEnvi(GL_TEXTURE_ENV, GL_ALPHA_SCALE, (unit->alphascale = 1));CHECKGLERROR
+ }
+ }
+ else
+ {
+ // normal GL texenv
+ if (unit->combinergb != GL_MODULATE)
+ {
+ unit->combinergb = GL_MODULATE;
+ GL_ActiveTexture(unitnum);
+ qglTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, unit->combinergb);CHECKGLERROR
+ }
+ }
+ }
+}
+
void R_Mesh_Draw_ShowTris(int firstvertex, int numvertices, int numtriangles, const int *elements)
{
qglBegin(GL_LINES);
extern cvar_t gl_paranoid;
extern cvar_t gl_printcheckerror;
-//input to R_Mesh_State
+//input to R_Mesh_TextureState
typedef struct rmeshstate_s
{
// textures
// pointers
const float *pointer_texcoord[MAX_TEXTUREUNITS]; // 2D
const float *pointer_texcoord3f[MAX_TEXTUREUNITS]; // 3D
-
- // other state set by this
- const float *pointer_vertex;
- const float *pointer_color;
}
rmeshstate_t;
void R_Mesh_TexMatrix(unsigned int unitnum, const matrix4x4_t *matrix);
// sets the combine state for a texenv unit
void R_Mesh_TexCombine(unsigned int unitnum, int combinergb, int combinealpha, int rgbscale, int alphascale);
-// set up the requested entire rendering state
-void R_Mesh_State(const rmeshstate_t *m);
+// set up the requested texture state
+void R_Mesh_TextureState(const rmeshstate_t *m);
+// set up a blank texture state (faster/easier specialized version of R_Mesh_TextureState)
+void R_Mesh_ResetTextureState(void);
// renders a mesh
void R_Mesh_Draw(int firstvertex, int numvertices, int numtriangles, const int *elements);
int i, num;
float *av, *at;
int batchcount;
- rmeshstate_t m;
float vertex3f[QUADELEMENTS_MAXQUADS*4*3];
float texcoord2f[QUADELEMENTS_MAXQUADS*4*2];
GL_Color(red, green, blue, alpha);
- memset(&m, 0, sizeof(m));
- m.pointer_vertex = vertex3f;
- m.pointer_color = NULL;
- m.pointer_texcoord[0] = texcoord2f;
- m.tex[0] = R_GetTexture(char_texture);
- R_Mesh_State(&m);
+ R_Mesh_VertexPointer(vertex3f);
+ R_Mesh_ColorPointer(NULL);
+ R_Mesh_ResetTextureState();
+ R_Mesh_TexBind(0, R_GetTexture(char_texture));
+ R_Mesh_TexCoordPointer(0, 2, texcoord2f);
at = texcoord2f;
av = vertex3f;
void DrawQ_SuperPic(float x, float y, cachepic_t *pic, float width, float height, float s1, float t1, float r1, float g1, float b1, float a1, float s2, float t2, float r2, float g2, float b2, float a2, float s3, float t3, float r3, float g3, float b3, float a3, float s4, float t4, float r4, float g4, float b4, float a4, int flags)
{
- rmeshstate_t m;
float floats[36];
if (!r_refdef.draw2dstage)
else
GL_BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- memset(&m, 0, sizeof(m));
- m.pointer_vertex = floats;
- m.pointer_color = floats + 20;
+ R_Mesh_VertexPointer(floats);
+ R_Mesh_ColorPointer(floats + 20);
+ R_Mesh_ResetTextureState();
if (pic)
{
if (width == 0)
width = pic->width;
if (height == 0)
height = pic->height;
- m.tex[0] = R_GetTexture(pic->tex);
- m.pointer_texcoord[0] = floats + 12;
+ R_Mesh_TexBind(0, R_GetTexture(pic->tex));
+ R_Mesh_TexCoordPointer(0, 2, floats + 12);
floats[12] = s1;floats[13] = t1;
floats[14] = s2;floats[15] = t2;
floats[16] = s4;floats[17] = t4;
floats[18] = s3;floats[19] = t3;
}
- R_Mesh_State(&m);
floats[2] = floats[5] = floats[8] = floats[11] = 0;
floats[0] = floats[9] = x;
void DrawQ_Mesh (drawqueuemesh_t *mesh, int flags)
{
- rmeshstate_t m;
-
if (!r_refdef.draw2dstage)
{
Con_Printf("DrawQ_Mesh: not in 2d rendering stage!\n");
else
GL_BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- memset(&m, 0, sizeof(m));
- m.pointer_vertex = mesh->data_vertex3f;
- m.pointer_color = mesh->data_color4f;
- m.tex[0] = R_GetTexture(mesh->texture);
- if (m.tex[0])
- m.pointer_texcoord[0] = mesh->data_texcoord2f;
- R_Mesh_State(&m);
+ R_Mesh_VertexPointer(mesh->data_vertex3f);
+ R_Mesh_ColorPointer(mesh->data_color4f);
+ R_Mesh_ResetTextureState();
+ R_Mesh_TexBind(0, R_GetTexture(mesh->texture));
+ R_Mesh_TexCoordPointer(0, 2, mesh->data_texcoord2f);
GL_LockArrays(0, mesh->num_vertices);
R_Mesh_Draw(0, mesh->num_vertices, mesh->num_triangles, mesh->data_element3i);
static float blendvertex3f[9] = {-5000, -5000, 10, 10000, -5000, 10, -5000, 10000, 10};
void R_DrawGamma(void)
{
- rmeshstate_t m;
float c[4];
if (!vid_usinghwgamma)
{
// all the blends ignore depth
- memset(&m, 0, sizeof(m));
- m.pointer_vertex = blendvertex3f;
- R_Mesh_State(&m);
+ R_Mesh_VertexPointer(blendvertex3f);
+ R_Mesh_ColorPointer(NULL);
+ R_Mesh_ResetTextureState();
GL_DepthMask(true);
GL_DepthTest(false);
if (v_color_enable.integer)
if (r_glsl_permutation->loc_Texture_Normal >= 0) R_Mesh_TexBind(0, R_GetTexture(texture->skin.nmap));
if (r_glsl_permutation->loc_Texture_Color >= 0) R_Mesh_TexBind(1, R_GetTexture(texture->basetexture));
if (r_glsl_permutation->loc_Texture_Gloss >= 0) R_Mesh_TexBind(2, R_GetTexture(texture->glosstexture));
- if (r_glsl_permutation->loc_Texture_FogMask >= 0) R_Mesh_TexBind(4, R_GetTexture(r_texture_fogattenuation));
+ //if (r_glsl_permutation->loc_Texture_Cube >= 0 && permutation & SHADERPERMUTATION_MODE_LIGHTSOURCE) R_Mesh_TexBindCubeMap(3, R_GetTexture(r_shadow_rtlight->currentcubemap));
+ //if (r_glsl_permutation->loc_Texture_FogMask >= 0) R_Mesh_TexBind(4, R_GetTexture(r_texture_fogattenuation));
if (r_glsl_permutation->loc_Texture_Pants >= 0) R_Mesh_TexBind(5, R_GetTexture(texture->skin.pants));
if (r_glsl_permutation->loc_Texture_Shirt >= 0) R_Mesh_TexBind(6, R_GetTexture(texture->skin.shirt));
+ //if (r_glsl_permutation->loc_Texture_Lightmap >= 0) R_Mesh_TexBind(7, R_GetTexture(r_texture_white));
+ //if (r_glsl_permutation->loc_Texture_Deluxemap >= 0) R_Mesh_TexBind(8, R_GetTexture(r_texture_blanknormalmap));
if (r_glsl_permutation->loc_Texture_Glow >= 0) R_Mesh_TexBind(9, R_GetTexture(texture->skin.glow));
if (r_glsl_permutation->loc_FogColor >= 0)
{
int screenwidth, screenheight;
qboolean dobloom;
qboolean doblend;
- rmeshstate_t m;
float vertex3f[12];
float texcoord2f[3][8];
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;
+ R_Mesh_VertexPointer(vertex3f);
+ R_Mesh_ColorPointer(NULL);
+ R_Mesh_ResetTextureState();
if (dobloom)
{
- int bloomwidth, bloomheight, x, dobloomblend, range;
+ int bloomwidth, bloomheight, x, range;
float xoffset, yoffset, r;
renderstats.bloom++;
// allocate textures as needed
texcoord2f[1][5] = 0;
texcoord2f[1][6] = 0;
texcoord2f[1][7] = 0;
- memset(&m, 0, sizeof(m));
- m.pointer_vertex = vertex3f;
- m.pointer_texcoord[0] = texcoord2f[0];
- m.tex[0] = R_GetTexture(r_bloom_texture_screen);
- R_Mesh_State(&m);
+ R_Mesh_TexCoordPointer(0, 2, texcoord2f[0]);
+ R_Mesh_TexBind(0, R_GetTexture(r_bloom_texture_screen));
// copy view into the full resolution screen image texture
GL_ActiveTexture(0);
qglCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, r_view_x, vid.height - (r_view_y + r_view_height), r_view_width, r_view_height);
}
// 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 = vertex3f;
- m.tex[0] = R_GetTexture(r_bloom_texture_bloom);
- m.pointer_texcoord[0] = texcoord2f[2];
- R_Mesh_State(&m);
+ R_Mesh_TexBind(0, R_GetTexture(r_bloom_texture_bloom));
+ R_Mesh_TexCoordPointer(0, 2, texcoord2f[2]);
GL_ActiveTexture(0);
qglCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, r_view_x, vid.height - (r_view_y + bloomheight), bloomwidth, bloomheight);
renderstats.bloom_copypixels += bloomwidth * bloomheight;
qglViewport(r_view_x, vid.height - (r_view_y + r_view_height), r_view_width, r_view_height);
// put the original screen image back in place and blend the bloom
// texture on it
- memset(&m, 0, sizeof(m));
- m.pointer_vertex = vertex3f;
- m.tex[0] = R_GetTexture(r_bloom_texture_screen);
- m.pointer_texcoord[0] = texcoord2f[0];
-#if 0
- dobloomblend = false;
-#else
+ GL_Color(1,1,1,1);
+ GL_BlendFunc(GL_ONE, GL_ZERO);
// do both in one pass if possible
+ R_Mesh_TexBind(0, R_GetTexture(r_bloom_texture_screen));
+ R_Mesh_TexCoordPointer(0, 2, texcoord2f[0]);
if (r_textureunits.integer >= 2 && gl_combine.integer)
{
- dobloomblend = false;
- m.texcombinergb[1] = GL_ADD;
- m.tex[1] = R_GetTexture(r_bloom_texture_bloom);
- m.pointer_texcoord[1] = texcoord2f[1];
+ R_Mesh_TexCombine(1, GL_ADD, GL_ADD, 1, 1);
+ R_Mesh_TexBind(1, R_GetTexture(r_bloom_texture_bloom));
+ R_Mesh_TexCoordPointer(1, 2, texcoord2f[1]);
}
else
- dobloomblend = true;
-#endif
- R_Mesh_State(&m);
- GL_BlendFunc(GL_ONE, GL_ZERO);
- GL_Color(1,1,1,1);
- R_Mesh_Draw(0, 4, 2, polygonelements);
- renderstats.bloom_drawpixels += r_view_width * r_view_height;
- // now blend on the bloom texture if multipass
- if (dobloomblend)
{
- memset(&m, 0, sizeof(m));
- m.pointer_vertex = vertex3f;
- m.tex[0] = R_GetTexture(r_bloom_texture_bloom);
- m.pointer_texcoord[0] = texcoord2f[1];
- R_Mesh_State(&m);
- GL_BlendFunc(GL_ONE, GL_ONE);
- GL_Color(1,1,1,1);
R_Mesh_Draw(0, 4, 2, polygonelements);
renderstats.bloom_drawpixels += r_view_width * r_view_height;
+ // now blend on the bloom texture
+ GL_BlendFunc(GL_ONE, GL_ONE);
+ R_Mesh_TexBind(0, R_GetTexture(r_bloom_texture_bloom));
+ R_Mesh_TexCoordPointer(0, 2, texcoord2f[1]);
}
+ R_Mesh_Draw(0, 4, 2, polygonelements);
+ renderstats.bloom_drawpixels += r_view_width * r_view_height;
}
if (doblend)
{
// apply a color tint to the whole view
- memset(&m, 0, sizeof(m));
- m.pointer_vertex = vertex3f;
- R_Mesh_State(&m);
+ R_Mesh_ResetTextureState();
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_Draw(0, 4, 2, polygonelements);
{
int i;
float *v, *c, f1, f2, diff[3], vertex3f[8*3], color4f[8*4];
- rmeshstate_t m;
GL_BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
GL_DepthMask(false);
GL_DepthTest(true);
c[2] = c[2] * f1 + fogcolor[2] * f2;
}
}
- memset(&m, 0, sizeof(m));
- m.pointer_vertex = vertex3f;
- m.pointer_color = color;
- R_Mesh_State(&m);
+ R_Mesh_VertexPointer(vertex3f);
+ R_Mesh_ColorPointer(color);
+ R_Mesh_ResetTextureState();
R_Mesh_Draw(8, 12);
}
*/
int i;
float f1, f2, *c;
float color4f[6*4];
- rmeshstate_t m;
R_Mesh_Matrix(&ent->matrix);
- memset(&m, 0, sizeof(m));
- m.pointer_vertex = nomodelvertex3f;
-
if (ent->flags & EF_ADDITIVE)
{
GL_BlendFunc(GL_SRC_ALPHA, GL_ONE);
GL_DepthMask(true);
}
GL_DepthTest(!(ent->effects & EF_NODEPTHTEST));
+ R_Mesh_VertexPointer(nomodelvertex3f);
if (fogenabled)
{
memcpy(color4f, nomodelcolor4f, sizeof(float[6*4]));
- m.pointer_color = color4f;
+ R_Mesh_ColorPointer(color4f);
f2 = VERTEXFOGTABLE(VectorDistance(ent->origin, r_vieworigin));
f1 = 1 - f2;
for (i = 0, c = color4f;i < 6;i++, c += 4)
else if (ent->alpha != 1)
{
memcpy(color4f, nomodelcolor4f, sizeof(float[6*4]));
- m.pointer_color = color4f;
+ R_Mesh_ColorPointer(color4f);
for (i = 0, c = color4f;i < 6;i++, c += 4)
c[3] *= ent->alpha;
}
else
- m.pointer_color = nomodelcolor4f;
- R_Mesh_State(&m);
+ R_Mesh_ColorPointer(nomodelcolor4f);
+ R_Mesh_ResetTextureState();
R_Mesh_Draw(0, 6, 8, nomodelelements);
}
void R_DrawSprite(int blendfunc1, int blendfunc2, rtexture_t *texture, rtexture_t *fogtexture, int depthdisable, const vec3_t origin, const vec3_t left, const vec3_t up, float scalex1, float scalex2, float scaley1, float scaley2, float cr, float cg, float cb, float ca)
{
float fog = 0.0f, ifog;
- rmeshstate_t m;
float vertex3f[12];
if (fogenabled)
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;
- m.pointer_vertex = vertex3f;
- R_Mesh_State(&m);
+ R_Mesh_VertexPointer(vertex3f);
+ R_Mesh_ColorPointer(NULL);
+ R_Mesh_ResetTextureState();
+ R_Mesh_TexBind(0, R_GetTexture(texture));
+ R_Mesh_TexCoordPointer(0, 2, spritetexcoord2f);
GL_Color(cr * ifog, cg * ifog, cb * ifog, ca);
R_Mesh_Draw(0, 4, 2, polygonelements);
static void R_DrawCollisionBrush(colbrushf_t *brush)
{
int i;
- rmeshstate_t m;
- memset(&m, 0, sizeof(m));
- m.pointer_vertex = brush->points->v;
- R_Mesh_State(&m);
+ R_Mesh_VertexPointer(brush->points->v);
i = (int)(((size_t)brush) / sizeof(colbrushf_t));
GL_Color((i & 31) * (1.0f / 32.0f), ((i >> 5) & 31) * (1.0f / 32.0f), ((i >> 10) & 31) * (1.0f / 32.0f), 0.2f);
GL_LockArrays(0, brush->numpoints);
static void R_DrawCollisionSurface(entity_render_t *ent, msurface_t *surface)
{
int i;
- rmeshstate_t m;
if (!surface->num_collisiontriangles)
return;
- memset(&m, 0, sizeof(m));
- m.pointer_vertex = surface->data_collisionvertex3f;
- R_Mesh_State(&m);
+ R_Mesh_VertexPointer(surface->data_collisionvertex3f);
i = (int)(((size_t)surface) / sizeof(msurface_t));
GL_Color((i & 31) * (1.0f / 32.0f), ((i >> 5) & 31) * (1.0f / 32.0f), ((i >> 10) & 31) * (1.0f / 32.0f), 0.2f);
GL_LockArrays(0, surface->num_collisionvertices);
{
GL_LockArrays(surface->num_firstvertex, surface->num_vertices);
R_Mesh_Draw(surface->num_firstvertex, surface->num_vertices, surface->num_triangles, (rsurface_model->surfmesh.data_element3i + 3 * surface->num_firsttriangle));
- GL_LockArrays(0, 0);
}
static void RSurf_DrawLightmap(const msurface_t *surface, float r, float g, float b, float a, int lightmode, qboolean applycolor, qboolean applyfog)
{
GL_DepthMask(true);
GL_BlendFunc(GL_ONE, GL_ZERO);
- memset(&m, 0, sizeof(m));
- R_Mesh_State(&m);
+ R_Mesh_ColorPointer(NULL);
+ R_Mesh_ResetTextureState();
RSurf_PrepareVerticesForBatch(ent, texture, modelorg, false, false, texturenumsurfaces, texturesurfacelist);
for (texturesurfaceindex = 0;texturesurfaceindex < texturenumsurfaces;texturesurfaceindex++)
{
if (model->type == mod_brushq1 && r_q1bsp_skymasking.integer && !r_worldnovis)
{
GL_Color(fogcolor[0], fogcolor[1], fogcolor[2], 1);
- memset(&m, 0, sizeof(m));
- R_Mesh_State(&m);
+ R_Mesh_ColorPointer(NULL);
+ R_Mesh_ResetTextureState();
if (skyrendermasked)
{
// depth-only (masking)
GL_DepthMask(true);
}
- memset(&m, 0, sizeof(m));
- R_Mesh_State(&m);
+ R_Mesh_ColorPointer(NULL);
+ R_Mesh_ResetTextureState();
GL_Color(ent->colormod[0], ent->colormod[1], ent->colormod[2], texture->currentalpha);
R_SetupSurfaceShader(ent, texture, modelorg, vec3_origin, lightmode == 2);
if (!r_glsl_permutation)
return;
RSurf_PrepareVerticesForBatch(ent, texture, modelorg, true, true, texturenumsurfaces, texturesurfacelist);
+ R_Mesh_TexCoordPointer(0, 2, model->surfmesh.data_texcoordtexture2f);
+ R_Mesh_TexCoordPointer(1, 3, rsurface_svector3f);
+ R_Mesh_TexCoordPointer(2, 3, rsurface_tvector3f);
+ R_Mesh_TexCoordPointer(3, 3, rsurface_normal3f);
if (lightmode == 2)
{
for (texturesurfaceindex = 0;texturesurfaceindex < texturenumsurfaces;texturesurfaceindex++)
{
surface = texturesurfacelist[texturesurfaceindex];
- R_Mesh_TexCoordPointer(0, 2, model->surfmesh.data_texcoordtexture2f);
- R_Mesh_TexCoordPointer(1, 3, rsurface_svector3f);
- R_Mesh_TexCoordPointer(2, 3, rsurface_tvector3f);
- R_Mesh_TexCoordPointer(3, 3, rsurface_normal3f);
RSurf_Draw(surface);
}
}
else
{
+ R_Mesh_TexCoordPointer(4, 2, model->surfmesh.data_texcoordlightmap2f);
for (texturesurfaceindex = 0;texturesurfaceindex < texturenumsurfaces;texturesurfaceindex++)
{
surface = texturesurfacelist[texturesurfaceindex];
- R_Mesh_TexCoordPointer(0, 2, model->surfmesh.data_texcoordtexture2f);
- R_Mesh_TexCoordPointer(1, 3, rsurface_svector3f);
- R_Mesh_TexCoordPointer(2, 3, rsurface_tvector3f);
- R_Mesh_TexCoordPointer(3, 3, rsurface_normal3f);
- R_Mesh_TexCoordPointer(4, 2, model->surfmesh.data_texcoordlightmap2f);
if (surface->lightmaptexture)
{
R_Mesh_TexBind(7, R_GetTexture(surface->lightmaptexture));
VectorScale(layer->color, 1.0f, layercolor);
}
layercolor[3] = layer->color[3];
+ R_Mesh_ColorPointer(NULL);
GL_Color(layercolor[0], layercolor[1], layercolor[2], layercolor[3]);
applycolor = layercolor[0] != 1 || layercolor[1] != 1 || layercolor[2] != 1 || layercolor[3] != 1;
applyfog = (layer->flags & TEXTURELAYERFLAG_FOGDARKEN) != 0;
{
case TEXTURELAYERTYPE_LITTEXTURE_COMBINE:
memset(&m, 0, sizeof(m));
+ m.pointer_texcoord[0] = model->surfmesh.data_texcoordlightmap2f;
m.tex[1] = R_GetTexture(layer->texture);
m.texmatrix[1] = layer->texmatrix;
m.texrgbscale[1] = layertexrgbscale;
- m.pointer_color = rsurface_array_color4f;
- m.pointer_vertex = rsurface_vertex3f;
- R_Mesh_State(&m);
+ m.pointer_texcoord[1] = model->surfmesh.data_texcoordtexture2f;
+ R_Mesh_TextureState(&m);
if (lightmode == 2)
{
for (texturesurfaceindex = 0;texturesurfaceindex < texturenumsurfaces;texturesurfaceindex++)
{
surface = texturesurfacelist[texturesurfaceindex];
- R_Mesh_TexCoordPointer(0, 2, model->surfmesh.data_texcoordlightmap2f);
- R_Mesh_TexCoordPointer(1, 2, model->surfmesh.data_texcoordtexture2f);
R_Mesh_TexBind(0, R_GetTexture(r_texture_white));
RSurf_DrawLightmap(surface, layercolor[0], layercolor[1], layercolor[2], layercolor[3], 2, applycolor, applyfog);
}
for (texturesurfaceindex = 0;texturesurfaceindex < texturenumsurfaces;texturesurfaceindex++)
{
surface = texturesurfacelist[texturesurfaceindex];
- R_Mesh_TexCoordPointer(0, 2, model->surfmesh.data_texcoordlightmap2f);
- R_Mesh_TexCoordPointer(1, 2, model->surfmesh.data_texcoordtexture2f);
if (surface->lightmaptexture)
{
R_Mesh_TexBind(0, R_GetTexture(surface->lightmaptexture));
memset(&m, 0, sizeof(m));
m.tex[0] = R_GetTexture(layer->texture);
m.texmatrix[0] = layer->texmatrix;
- m.pointer_color = rsurface_array_color4f;
m.texrgbscale[0] = layertexrgbscale;
- m.pointer_vertex = rsurface_vertex3f;
- R_Mesh_State(&m);
+ m.pointer_texcoord[0] = model->surfmesh.data_texcoordlightmap2f;
+ R_Mesh_TextureState(&m);
if (lightmode == 2)
{
for (texturesurfaceindex = 0;texturesurfaceindex < texturenumsurfaces;texturesurfaceindex++)
{
surface = texturesurfacelist[texturesurfaceindex];
- R_Mesh_TexCoordPointer(0, 2, model->surfmesh.data_texcoordlightmap2f);
R_Mesh_TexBind(0, R_GetTexture(r_texture_white));
RSurf_DrawLightmap(surface, 1, 1, 1, 1, 2, false, false);
}
for (texturesurfaceindex = 0;texturesurfaceindex < texturenumsurfaces;texturesurfaceindex++)
{
surface = texturesurfacelist[texturesurfaceindex];
- R_Mesh_TexCoordPointer(0, 2, model->surfmesh.data_texcoordlightmap2f);
if (surface->lightmaptexture)
{
R_Mesh_TexBind(0, R_GetTexture(surface->lightmaptexture));
}
}
}
+ GL_LockArrays(0, 0);
GL_BlendFunc(GL_DST_COLOR, GL_SRC_COLOR);
memset(&m, 0, sizeof(m));
m.tex[0] = R_GetTexture(layer->texture);
m.texmatrix[0] = layer->texmatrix;
- m.pointer_color = rsurface_array_color4f;
m.texrgbscale[0] = layertexrgbscale;
- m.pointer_vertex = rsurface_vertex3f;
- R_Mesh_State(&m);
+ m.pointer_texcoord[0] = model->surfmesh.data_texcoordtexture2f;
+ R_Mesh_TextureState(&m);
for (texturesurfaceindex = 0;texturesurfaceindex < texturenumsurfaces;texturesurfaceindex++)
{
surface = texturesurfacelist[texturesurfaceindex];
- R_Mesh_TexCoordPointer(0, 2, model->surfmesh.data_texcoordtexture2f);
RSurf_DrawLightmap(surface, layercolor[0], layercolor[1], layercolor[2], layercolor[3], 0, applycolor, false);
}
break;
m.tex[0] = R_GetTexture(layer->texture);
m.texmatrix[0] = layer->texmatrix;
m.texrgbscale[0] = layertexrgbscale;
- m.pointer_color = rsurface_array_color4f;
- m.pointer_vertex = rsurface_vertex3f;
- R_Mesh_State(&m);
+ m.pointer_texcoord[0] = model->surfmesh.data_texcoordtexture2f;
+ R_Mesh_TextureState(&m);
if (lightmode == 2)
{
for (texturesurfaceindex = 0;texturesurfaceindex < texturenumsurfaces;texturesurfaceindex++)
{
surface = texturesurfacelist[texturesurfaceindex];
- R_Mesh_TexCoordPointer(0, 2, model->surfmesh.data_texcoordtexture2f);
RSurf_DrawLightmap(surface, layercolor[0], layercolor[1], layercolor[2], layercolor[3], 2, applycolor, applyfog);
}
}
for (texturesurfaceindex = 0;texturesurfaceindex < texturenumsurfaces;texturesurfaceindex++)
{
surface = texturesurfacelist[texturesurfaceindex];
- R_Mesh_TexCoordPointer(0, 2, model->surfmesh.data_texcoordtexture2f);
RSurf_DrawLightmap(surface, layercolor[0], layercolor[1], layercolor[2], layercolor[3], 1, applycolor, applyfog);
}
}
memset(&m, 0, sizeof(m));
m.tex[0] = R_GetTexture(layer->texture);
m.texmatrix[0] = layer->texmatrix;
- m.pointer_color = rsurface_array_color4f;
m.texrgbscale[0] = layertexrgbscale;
- m.pointer_vertex = rsurface_vertex3f;
- R_Mesh_State(&m);
+ m.pointer_texcoord[0] = model->surfmesh.data_texcoordtexture2f;
+ R_Mesh_TextureState(&m);
for (texturesurfaceindex = 0;texturesurfaceindex < texturenumsurfaces;texturesurfaceindex++)
{
surface = texturesurfacelist[texturesurfaceindex];
- R_Mesh_TexCoordPointer(0, 2, model->surfmesh.data_texcoordtexture2f);
RSurf_DrawLightmap(surface, layercolor[0], layercolor[1], layercolor[2], layercolor[3], 0, applycolor, applyfog);
}
break;
case TEXTURELAYERTYPE_FOG:
- memset(&m, 0, sizeof(m));
+ R_Mesh_ColorPointer(rsurface_array_color4f);
if (layer->texture)
{
+ memset(&m, 0, sizeof(m));
m.tex[0] = R_GetTexture(layer->texture);
m.texmatrix[0] = layer->texmatrix;
+ m.pointer_texcoord[0] = model->surfmesh.data_texcoordtexture2f;
+ R_Mesh_TextureState(&m);
}
- m.pointer_vertex = rsurface_vertex3f;
- R_Mesh_State(&m);
+ else
+ R_Mesh_ResetTextureState();
for (texturesurfaceindex = 0;texturesurfaceindex < texturenumsurfaces;texturesurfaceindex++)
{
int i;
float f, *v, *c;
surface = texturesurfacelist[texturesurfaceindex];
- if (layer->texture)
- R_Mesh_TexCoordPointer(0, 2, model->surfmesh.data_texcoordtexture2f);
- R_Mesh_ColorPointer(rsurface_array_color4f);
for (i = 0, v = (rsurface_vertex3f + 3 * surface->num_firstvertex), c = (rsurface_array_color4f + 4 * surface->num_firstvertex);i < surface->num_vertices;i++, v += 3, c += 4)
{
f = VERTEXFOGTABLE(VectorDistance(v, modelorg));
default:
Con_Printf("R_DrawTextureSurfaceList: unknown layer type %i\n", layer->type);
}
+ GL_LockArrays(0, 0);
// if trying to do overbright on first pass of an opaque surface
// when combine is not supported, brighten as a post process
if (layertexrgbscale > 1 && !gl_combine.integer && layer->depthmask)
{
int scale;
GL_BlendFunc(GL_DST_COLOR, GL_SRC_COLOR);
+ R_Mesh_ColorPointer(NULL);
GL_Color(1, 1, 1, 1);
- memset(&m, 0, sizeof(m));
- m.pointer_vertex = rsurface_vertex3f;
- R_Mesh_State(&m);
+ R_Mesh_ResetTextureState();
for (texturesurfaceindex = 0;texturesurfaceindex < texturenumsurfaces;texturesurfaceindex++)
{
surface = texturesurfacelist[texturesurfaceindex];
for (scale = 1;scale < layertexrgbscale;scale <<= 1)
RSurf_Draw(surface);
}
+ GL_LockArrays(0, 0);
}
}
}
+ GL_LockArrays(0, 0);
if ((texture->textureflags & Q3TEXTUREFLAG_TWOSIDED) || (ent->flags & RENDER_NOCULLFACE))
qglEnable(GL_CULL_FACE);
}
msurface_t *surface;
q3mbrush_t *brush;
R_Mesh_Matrix(&ent->matrix);
+ R_Mesh_ColorPointer(NULL);
+ R_Mesh_ResetTextureState();
GL_BlendFunc(GL_SRC_ALPHA, GL_ONE);
GL_DepthMask(false);
GL_DepthTest(!r_showdisabledepthtest.integer);
{
int k, l;
const int *elements;
- rmeshstate_t m;
vec3_t v;
GL_DepthTest(true);
GL_DepthMask(true);
if (r_showdisabledepthtest.integer)
qglDepthFunc(GL_ALWAYS);
GL_BlendFunc(GL_ONE, GL_ZERO);
- memset(&m, 0, sizeof(m));
- R_Mesh_State(&m);
+ R_Mesh_ColorPointer(NULL);
+ R_Mesh_ResetTextureState();
for (i = 0, j = model->firstmodelsurface, surface = model->data_surfaces + j;i < model->nummodelsurfaces;i++, j++, surface++)
{
if (ent == r_refdef.worldentity && !r_worldsurfacevisible[j])
const mportal_t *portal = (mportal_t *)ent;
int i, numpoints;
float *v;
- rmeshstate_t m;
float vertex3f[POLYGONELEMENTS_MAXPOINTS*3];
GL_BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
GL_DepthMask(false);
numpoints = min(portal->numpoints, POLYGONELEMENTS_MAXPOINTS);
- memset(&m, 0, sizeof(m));
- m.pointer_vertex = vertex3f;
- R_Mesh_State(&m);
+ R_Mesh_VertexPointer(vertex3f);
+ R_Mesh_ColorPointer(NULL);
+ R_Mesh_ResetTextureState();
i = surfacenumber;
GL_Color(((i & 0x0007) >> 0) * (1.0f / 7.0f),
texture = t->currentframe;
f = (texture->currentmaterialflags & (MATERIALFLAG_NODRAW | MATERIALFLAG_TRANSPARENT | MATERIALFLAG_WALL)) == MATERIALFLAG_WALL;
}
- if (!f && surface->num_triangles)
+ if (f && surface->num_triangles)
surfacelist[numsurfacelist++] = surface;
}
if (numsurfacelist)
numverts = EXPLOSIONVERTS;
alpha = e->alpha;
+ R_Mesh_VertexPointer(e->vert[0]);
+ R_Mesh_ColorPointer(NULL);
memset(&m, 0, sizeof(m));
m.tex[0] = R_GetTexture(explosiontexture);
m.pointer_texcoord[0] = explosiontexcoord2f[0];
- m.pointer_vertex = e->vert[0];
- R_Mesh_State(&m);
+ R_Mesh_TextureState(&m);
GL_Color(alpha, alpha, alpha, 1);
// (and realize that the whole polygon assembly orients itself to face
// the viewer)
- memset(&m, 0, sizeof(m));
- if (r_lightningbeam_qmbtexture.integer)
- m.tex[0] = R_GetTexture(r_lightningbeamqmbtexture);
- else
- m.tex[0] = R_GetTexture(r_lightningbeamtexture);
- m.pointer_texcoord[0] = texcoord2f;
- m.pointer_vertex = vertex3f;
-
GL_BlendFunc(GL_SRC_ALPHA, GL_ONE);
GL_DepthMask(false);
GL_DepthTest(true);
R_CalcLightningBeamPolygonTexCoord2f(texcoord2f + 8, t1 + 0.33, t2 + 0.33);
R_CalcLightningBeamPolygonTexCoord2f(texcoord2f + 16, t1 + 0.66, t2 + 0.66);
+ R_Mesh_VertexPointer(vertex3f);
if (fogenabled)
{
// per vertex colors if fog is used
- m.pointer_color = color4f;
+ R_Mesh_ColorPointer(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
{
// solid color if fog is not used
+ R_Mesh_ColorPointer(NULL);
GL_Color(r_lightningbeam_color_red.value, r_lightningbeam_color_green.value, r_lightningbeam_color_blue.value, 1);
}
- R_Mesh_State(&m);
+ memset(&m, 0, sizeof(m));
+ if (r_lightningbeam_qmbtexture.integer)
+ m.tex[0] = R_GetTexture(r_lightningbeamqmbtexture);
+ else
+ m.tex[0] = R_GetTexture(r_lightningbeamtexture);
+ m.pointer_texcoord[0] = texcoord2f;
+ R_Mesh_TextureState(&m);
// draw the 3 polygons as one batch of 6 triangles using the 12 vertices
GL_LockArrays(0, 12);
void R_Shadow_RenderVolume(int numvertices, int numtriangles, const float *vertex3f, const int *element3i)
{
- rmeshstate_t m;
if (r_shadow_compilingrtlight)
{
// if we're compiling an rtlight, capture the mesh
return;
}
renderstats.lights_shadowtriangles += numtriangles;
- memset(&m, 0, sizeof(m));
- m.pointer_vertex = vertex3f;
- R_Mesh_State(&m);
+ R_Mesh_VertexPointer(vertex3f);
GL_LockArrays(0, numvertices);
if (r_shadow_rendermode == R_SHADOW_RENDERMODE_STENCIL)
{
void R_Shadow_RenderMode_Begin(void)
{
- rmeshstate_t m;
-
R_Shadow_ValidateCvars();
if (!r_shadow_attenuation2dtexture
|| r_shadow_lightattenuationscale.value != r_shadow_attenscale)
R_Shadow_MakeTextures();
- memset(&m, 0, sizeof(m));
- R_Mesh_State(&m);
+ R_Mesh_ColorPointer(NULL);
+ R_Mesh_ResetTextureState();
GL_BlendFunc(GL_ONE, GL_ZERO);
GL_DepthMask(false);
GL_DepthTest(true);
void R_Shadow_RenderMode_Reset(void)
{
- rmeshstate_t m;
if (r_shadow_rendermode == R_SHADOW_RENDERMODE_LIGHT_GLSL)
{
qglUseProgramObjectARB(0);
}
else if (r_shadow_rendermode == R_SHADOW_RENDERMODE_STENCILTWOSIDE)
qglDisable(GL_STENCIL_TEST_TWO_SIDE_EXT);
- memset(&m, 0, sizeof(m));
- R_Mesh_State(&m);
+ R_Mesh_ColorPointer(NULL);
+ R_Mesh_ResetTextureState();
}
void R_Shadow_RenderMode_StencilShadowVolumes(void)
R_Mesh_TexBind(4, R_GetTexture(r_texture_fogattenuation)); // fog
R_Mesh_TexBind(5, R_GetTexture(r_texture_white)); // pants
R_Mesh_TexBind(6, R_GetTexture(r_texture_white)); // shirt
+ R_Mesh_TexBind(7, R_GetTexture(r_texture_white)); // lightmap
+ R_Mesh_TexBind(8, R_GetTexture(r_texture_blanknormalmap)); // deluxemap
+ R_Mesh_TexBind(9, R_GetTexture(r_texture_black)); // glow
//R_Mesh_TexMatrix(3, r_shadow_entitytolight); // light filter matrix
GL_BlendFunc(GL_SRC_ALPHA, GL_ONE);
GL_ColorMask(r_refdef.colormask[0], r_refdef.colormask[1], r_refdef.colormask[2], 0);
// used to display how many times a surface is lit for level design purposes
int surfacelistindex;
model_t *model = ent->model;
- rmeshstate_t m;
GL_Color(0.1, 0.025, 0, 1);
- memset(&m, 0, sizeof(m));
- R_Mesh_State(&m);
+ R_Mesh_ColorPointer(NULL);
+ R_Mesh_ResetTextureState();
RSurf_PrepareVerticesForBatch(ent, texture, r_shadow_entityeyeorigin, false, false, numsurfaces, surfacelist);
for (surfacelistindex = 0;surfacelistindex < numsurfaces;surfacelistindex++)
{
model_t *model = ent->model;
RSurf_PrepareVerticesForBatch(ent, texture, r_shadow_entityeyeorigin, true, true, numsurfaces, surfacelist);
R_SetupSurfaceShader(ent, texture, r_shadow_entityeyeorigin, lightcolorbase, false);
+ R_Mesh_TexCoordPointer(0, 2, model->surfmesh.data_texcoordtexture2f);
+ R_Mesh_TexCoordPointer(1, 3, rsurface_svector3f);
+ R_Mesh_TexCoordPointer(2, 3, rsurface_tvector3f);
+ R_Mesh_TexCoordPointer(3, 3, rsurface_normal3f);
for (surfacelistindex = 0;surfacelistindex < numsurfaces;surfacelistindex++)
{
const msurface_t *surface = surfacelist[surfacelistindex];
- const int *elements = model->surfmesh.data_element3i + surface->num_firsttriangle * 3;
- R_Mesh_TexCoordPointer(0, 2, model->surfmesh.data_texcoordtexture2f);
- R_Mesh_TexCoordPointer(1, 3, rsurface_svector3f);
- R_Mesh_TexCoordPointer(2, 3, rsurface_tvector3f);
- R_Mesh_TexCoordPointer(3, 3, rsurface_normal3f);
GL_LockArrays(surface->num_firstvertex, surface->num_vertices);
- R_Mesh_Draw(surface->num_firstvertex, surface->num_vertices, surface->num_triangles, elements);
- GL_LockArrays(0, 0);
+ R_Mesh_Draw(surface->num_firstvertex, surface->num_vertices, surface->num_triangles, model->surfmesh.data_element3i + surface->num_firsttriangle * 3);
}
+ GL_LockArrays(0, 0);
}
static void R_Shadow_RenderSurfacesLighting_Light_Dot3_AmbientPass(const entity_render_t *ent, const texture_t *texture, const msurface_t *surface, const vec3_t lightcolorbase, rtexture_t *basetexture, float colorscale)
{
// 3 3D combine path (Geforce3, Radeon 8500)
memset(&m, 0, sizeof(m));
- m.pointer_vertex = rsurface_vertex3f;
m.tex3d[0] = R_GetTexture(r_shadow_attenuation3dtexture);
m.pointer_texcoord3f[0] = rsurface_vertex3f;
m.texmatrix[0] = r_shadow_entitytoattenuationxyz;
{
// 2 3D combine path (Geforce3, original Radeon)
memset(&m, 0, sizeof(m));
- m.pointer_vertex = rsurface_vertex3f;
m.tex3d[0] = R_GetTexture(r_shadow_attenuation3dtexture);
m.pointer_texcoord3f[0] = rsurface_vertex3f;
m.texmatrix[0] = r_shadow_entitytoattenuationxyz;
{
// 4 2D combine path (Geforce3, Radeon 8500)
memset(&m, 0, sizeof(m));
- m.pointer_vertex = rsurface_vertex3f;
m.tex[0] = R_GetTexture(r_shadow_attenuation2dtexture);
m.pointer_texcoord3f[0] = rsurface_vertex3f;
m.texmatrix[0] = r_shadow_entitytoattenuationxyz;
{
// 3 2D combine path (Geforce3, original Radeon)
memset(&m, 0, sizeof(m));
- m.pointer_vertex = rsurface_vertex3f;
m.tex[0] = R_GetTexture(r_shadow_attenuation2dtexture);
m.pointer_texcoord3f[0] = rsurface_vertex3f;
m.texmatrix[0] = r_shadow_entitytoattenuationxyz;
{
// 2/2/2 2D combine path (any dot3 card)
memset(&m, 0, sizeof(m));
- m.pointer_vertex = rsurface_vertex3f;
m.tex[0] = R_GetTexture(r_shadow_attenuation2dtexture);
m.pointer_texcoord3f[0] = rsurface_vertex3f;
m.texmatrix[0] = r_shadow_entitytoattenuationxyz;
m.tex[1] = R_GetTexture(r_shadow_attenuation2dtexture);
m.pointer_texcoord3f[1] = rsurface_vertex3f;
m.texmatrix[1] = r_shadow_entitytoattenuationz;
- R_Mesh_State(&m);
+ R_Mesh_TextureState(&m);
GL_ColorMask(0,0,0,1);
GL_BlendFunc(GL_ONE, GL_ZERO);
GL_LockArrays(surface->num_firstvertex, surface->num_vertices);
GL_LockArrays(0, 0);
memset(&m, 0, sizeof(m));
- m.pointer_vertex = rsurface_vertex3f;
m.tex[0] = R_GetTexture(basetexture);
m.pointer_texcoord[0] = model->surfmesh.data_texcoordtexture2f;
m.texmatrix[0] = texture->currenttexmatrix;
GL_BlendFunc(GL_DST_ALPHA, GL_ONE);
}
// this final code is shared
- R_Mesh_State(&m);
+ R_Mesh_TextureState(&m);
GL_ColorMask(r_refdef.colormask[0], r_refdef.colormask[1], r_refdef.colormask[2], 0);
VectorScale(lightcolorbase, colorscale, color2);
GL_LockArrays(surface->num_firstvertex, surface->num_vertices);
{
// 3/2 3D combine path (Geforce3, Radeon 8500)
memset(&m, 0, sizeof(m));
- m.pointer_vertex = rsurface_vertex3f;
m.tex[0] = R_GetTexture(normalmaptexture);
m.texcombinergb[0] = GL_REPLACE;
m.pointer_texcoord[0] = model->surfmesh.data_texcoordtexture2f;
m.tex3d[2] = R_GetTexture(r_shadow_attenuation3dtexture);
m.pointer_texcoord3f[2] = rsurface_vertex3f;
m.texmatrix[2] = r_shadow_entitytoattenuationxyz;
- R_Mesh_State(&m);
+ R_Mesh_TextureState(&m);
GL_ColorMask(0,0,0,1);
GL_BlendFunc(GL_ONE, GL_ZERO);
GL_LockArrays(surface->num_firstvertex, surface->num_vertices);
GL_LockArrays(0, 0);
memset(&m, 0, sizeof(m));
- m.pointer_vertex = rsurface_vertex3f;
m.tex[0] = R_GetTexture(basetexture);
m.pointer_texcoord[0] = model->surfmesh.data_texcoordtexture2f;
m.texmatrix[0] = texture->currenttexmatrix;
{
// 1/2/2 3D combine path (original Radeon)
memset(&m, 0, sizeof(m));
- m.pointer_vertex = rsurface_vertex3f;
m.tex3d[0] = R_GetTexture(r_shadow_attenuation3dtexture);
m.pointer_texcoord3f[0] = rsurface_vertex3f;
m.texmatrix[0] = r_shadow_entitytoattenuationxyz;
- R_Mesh_State(&m);
+ R_Mesh_TextureState(&m);
GL_ColorMask(0,0,0,1);
GL_BlendFunc(GL_ONE, GL_ZERO);
GL_LockArrays(surface->num_firstvertex, surface->num_vertices);
GL_LockArrays(0, 0);
memset(&m, 0, sizeof(m));
- m.pointer_vertex = rsurface_vertex3f;
m.tex[0] = R_GetTexture(normalmaptexture);
m.texcombinergb[0] = GL_REPLACE;
m.pointer_texcoord[0] = model->surfmesh.data_texcoordtexture2f;
m.texcombinergb[1] = GL_DOT3_RGBA_ARB;
m.pointer_texcoord3f[1] = rsurface_array_texcoord3f;
R_Shadow_GenTexCoords_Diffuse_NormalCubeMap(rsurface_array_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);
+ R_Mesh_TextureState(&m);
GL_BlendFunc(GL_DST_ALPHA, GL_ZERO);
GL_LockArrays(surface->num_firstvertex, surface->num_vertices);
R_Mesh_Draw(surface->num_firstvertex, surface->num_vertices, surface->num_triangles, elements);
GL_LockArrays(0, 0);
memset(&m, 0, sizeof(m));
- m.pointer_vertex = rsurface_vertex3f;
m.tex[0] = R_GetTexture(basetexture);
m.pointer_texcoord[0] = model->surfmesh.data_texcoordtexture2f;
m.texmatrix[0] = texture->currenttexmatrix;
{
// 2/2 3D combine path (original Radeon)
memset(&m, 0, sizeof(m));
- m.pointer_vertex = rsurface_vertex3f;
m.tex[0] = R_GetTexture(normalmaptexture);
m.texcombinergb[0] = GL_REPLACE;
m.pointer_texcoord[0] = model->surfmesh.data_texcoordtexture2f;
m.texcombinergb[1] = GL_DOT3_RGBA_ARB;
m.pointer_texcoord3f[1] = rsurface_array_texcoord3f;
R_Shadow_GenTexCoords_Diffuse_NormalCubeMap(rsurface_array_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);
+ R_Mesh_TextureState(&m);
GL_ColorMask(0,0,0,1);
GL_BlendFunc(GL_ONE, GL_ZERO);
GL_LockArrays(surface->num_firstvertex, surface->num_vertices);
GL_LockArrays(0, 0);
memset(&m, 0, sizeof(m));
- m.pointer_vertex = rsurface_vertex3f;
m.tex[0] = R_GetTexture(basetexture);
m.pointer_texcoord[0] = model->surfmesh.data_texcoordtexture2f;
m.texmatrix[0] = texture->currenttexmatrix;
{
// 4/2 2D combine path (Geforce3, Radeon 8500)
memset(&m, 0, sizeof(m));
- m.pointer_vertex = rsurface_vertex3f;
m.tex[0] = R_GetTexture(normalmaptexture);
m.texcombinergb[0] = GL_REPLACE;
m.pointer_texcoord[0] = model->surfmesh.data_texcoordtexture2f;
m.tex[3] = R_GetTexture(r_shadow_attenuation2dtexture);
m.pointer_texcoord3f[3] = rsurface_vertex3f;
m.texmatrix[3] = r_shadow_entitytoattenuationz;
- R_Mesh_State(&m);
+ R_Mesh_TextureState(&m);
GL_ColorMask(0,0,0,1);
GL_BlendFunc(GL_ONE, GL_ZERO);
GL_LockArrays(surface->num_firstvertex, surface->num_vertices);
GL_LockArrays(0, 0);
memset(&m, 0, sizeof(m));
- m.pointer_vertex = rsurface_vertex3f;
m.tex[0] = R_GetTexture(basetexture);
m.pointer_texcoord[0] = model->surfmesh.data_texcoordtexture2f;
m.texmatrix[0] = texture->currenttexmatrix;
{
// 2/2/2 2D combine path (any dot3 card)
memset(&m, 0, sizeof(m));
- m.pointer_vertex = rsurface_vertex3f;
m.tex[0] = R_GetTexture(r_shadow_attenuation2dtexture);
m.pointer_texcoord3f[0] = rsurface_vertex3f;
m.texmatrix[0] = r_shadow_entitytoattenuationxyz;
m.tex[1] = R_GetTexture(r_shadow_attenuation2dtexture);
m.pointer_texcoord3f[1] = rsurface_vertex3f;
m.texmatrix[1] = r_shadow_entitytoattenuationz;
- R_Mesh_State(&m);
+ R_Mesh_TextureState(&m);
GL_ColorMask(0,0,0,1);
GL_BlendFunc(GL_ONE, GL_ZERO);
GL_LockArrays(surface->num_firstvertex, surface->num_vertices);
GL_LockArrays(0, 0);
memset(&m, 0, sizeof(m));
- m.pointer_vertex = rsurface_vertex3f;
m.tex[0] = R_GetTexture(normalmaptexture);
m.texcombinergb[0] = GL_REPLACE;
m.pointer_texcoord[0] = model->surfmesh.data_texcoordtexture2f;
m.texcombinergb[1] = GL_DOT3_RGBA_ARB;
m.pointer_texcoord3f[1] = rsurface_array_texcoord3f;
R_Shadow_GenTexCoords_Diffuse_NormalCubeMap(rsurface_array_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);
+ R_Mesh_TextureState(&m);
GL_BlendFunc(GL_DST_ALPHA, GL_ZERO);
GL_LockArrays(surface->num_firstvertex, surface->num_vertices);
R_Mesh_Draw(surface->num_firstvertex, surface->num_vertices, surface->num_triangles, elements);
GL_LockArrays(0, 0);
memset(&m, 0, sizeof(m));
- m.pointer_vertex = rsurface_vertex3f;
m.tex[0] = R_GetTexture(basetexture);
m.pointer_texcoord[0] = model->surfmesh.data_texcoordtexture2f;
m.texmatrix[0] = texture->currenttexmatrix;
GL_BlendFunc(GL_DST_ALPHA, GL_ONE);
}
// this final code is shared
- R_Mesh_State(&m);
+ R_Mesh_TextureState(&m);
GL_ColorMask(r_refdef.colormask[0], r_refdef.colormask[1], r_refdef.colormask[2], 0);
VectorScale(lightcolorbase, colorscale, color2);
GL_LockArrays(surface->num_firstvertex, surface->num_vertices);
{
// 2/0/0/1/2 3D combine blendsquare path
memset(&m, 0, sizeof(m));
- m.pointer_vertex = rsurface_vertex3f;
m.tex[0] = R_GetTexture(normalmaptexture);
m.pointer_texcoord[0] = model->surfmesh.data_texcoordtexture2f;
m.texmatrix[0] = texture->currenttexmatrix;
m.texcombinergb[1] = GL_DOT3_RGBA_ARB;
m.pointer_texcoord3f[1] = rsurface_array_texcoord3f;
R_Shadow_GenTexCoords_Specular_NormalCubeMap(rsurface_array_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);
+ R_Mesh_TextureState(&m);
GL_ColorMask(0,0,0,1);
// this squares the result
GL_BlendFunc(GL_SRC_ALPHA, GL_ZERO);
R_Mesh_Draw(surface->num_firstvertex, surface->num_vertices, surface->num_triangles, elements);
GL_LockArrays(0, 0);
- memset(&m, 0, sizeof(m));
- m.pointer_vertex = rsurface_vertex3f;
- R_Mesh_State(&m);
+ R_Mesh_ResetTextureState();
GL_LockArrays(surface->num_firstvertex, surface->num_vertices);
// square alpha in framebuffer a few times to make it shiny
GL_BlendFunc(GL_ZERO, GL_DST_ALPHA);
GL_LockArrays(0, 0);
memset(&m, 0, sizeof(m));
- m.pointer_vertex = rsurface_vertex3f;
m.tex3d[0] = R_GetTexture(r_shadow_attenuation3dtexture);
m.pointer_texcoord3f[0] = rsurface_vertex3f;
m.texmatrix[0] = r_shadow_entitytoattenuationxyz;
- R_Mesh_State(&m);
+ R_Mesh_TextureState(&m);
GL_BlendFunc(GL_DST_ALPHA, GL_ZERO);
GL_LockArrays(surface->num_firstvertex, surface->num_vertices);
R_Mesh_Draw(surface->num_firstvertex, surface->num_vertices, surface->num_triangles, elements);
GL_LockArrays(0, 0);
memset(&m, 0, sizeof(m));
- m.pointer_vertex = rsurface_vertex3f;
m.tex[0] = R_GetTexture(glosstexture);
m.pointer_texcoord[0] = model->surfmesh.data_texcoordtexture2f;
m.texmatrix[0] = texture->currenttexmatrix;
{
// 2/0/0/2 3D combine blendsquare path
memset(&m, 0, sizeof(m));
- m.pointer_vertex = rsurface_vertex3f;
m.tex[0] = R_GetTexture(normalmaptexture);
m.pointer_texcoord[0] = model->surfmesh.data_texcoordtexture2f;
m.texmatrix[0] = texture->currenttexmatrix;
m.texcombinergb[1] = GL_DOT3_RGBA_ARB;
m.pointer_texcoord3f[1] = rsurface_array_texcoord3f;
R_Shadow_GenTexCoords_Specular_NormalCubeMap(rsurface_array_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);
+ R_Mesh_TextureState(&m);
GL_ColorMask(0,0,0,1);
// this squares the result
GL_BlendFunc(GL_SRC_ALPHA, GL_ZERO);
R_Mesh_Draw(surface->num_firstvertex, surface->num_vertices, surface->num_triangles, elements);
GL_LockArrays(0, 0);
- memset(&m, 0, sizeof(m));
- m.pointer_vertex = rsurface_vertex3f;
- R_Mesh_State(&m);
+ R_Mesh_ResetTextureState();
GL_LockArrays(surface->num_firstvertex, surface->num_vertices);
// square alpha in framebuffer a few times to make it shiny
GL_BlendFunc(GL_ZERO, GL_DST_ALPHA);
GL_LockArrays(0, 0);
memset(&m, 0, sizeof(m));
- m.pointer_vertex = rsurface_vertex3f;
m.tex[0] = R_GetTexture(glosstexture);
m.pointer_texcoord[0] = model->surfmesh.data_texcoordtexture2f;
m.texmatrix[0] = texture->currenttexmatrix;
{
// 2/0/0/2/2 2D combine blendsquare path
memset(&m, 0, sizeof(m));
- m.pointer_vertex = rsurface_vertex3f;
m.tex[0] = R_GetTexture(normalmaptexture);
m.pointer_texcoord[0] = model->surfmesh.data_texcoordtexture2f;
m.texmatrix[0] = texture->currenttexmatrix;
m.texcombinergb[1] = GL_DOT3_RGBA_ARB;
m.pointer_texcoord3f[1] = rsurface_array_texcoord3f;
R_Shadow_GenTexCoords_Specular_NormalCubeMap(rsurface_array_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);
+ R_Mesh_TextureState(&m);
GL_ColorMask(0,0,0,1);
// this squares the result
GL_BlendFunc(GL_SRC_ALPHA, GL_ZERO);
R_Mesh_Draw(surface->num_firstvertex, surface->num_vertices, surface->num_triangles, elements);
GL_LockArrays(0, 0);
- memset(&m, 0, sizeof(m));
- m.pointer_vertex = rsurface_vertex3f;
- R_Mesh_State(&m);
+ R_Mesh_ResetTextureState();
GL_LockArrays(surface->num_firstvertex, surface->num_vertices);
// square alpha in framebuffer a few times to make it shiny
GL_BlendFunc(GL_ZERO, GL_DST_ALPHA);
GL_LockArrays(0, 0);
memset(&m, 0, sizeof(m));
- m.pointer_vertex = rsurface_vertex3f;
m.tex[0] = R_GetTexture(r_shadow_attenuation2dtexture);
m.pointer_texcoord3f[0] = rsurface_vertex3f;
m.texmatrix[0] = r_shadow_entitytoattenuationxyz;
m.tex[1] = R_GetTexture(r_shadow_attenuation2dtexture);
m.pointer_texcoord3f[1] = rsurface_vertex3f;
m.texmatrix[1] = r_shadow_entitytoattenuationz;
- R_Mesh_State(&m);
+ R_Mesh_TextureState(&m);
GL_BlendFunc(GL_DST_ALPHA, GL_ZERO);
GL_LockArrays(surface->num_firstvertex, surface->num_vertices);
R_Mesh_Draw(surface->num_firstvertex, surface->num_vertices, surface->num_triangles, elements);
GL_LockArrays(0, 0);
memset(&m, 0, sizeof(m));
- m.pointer_vertex = rsurface_vertex3f;
m.tex[0] = R_GetTexture(glosstexture);
m.pointer_texcoord[0] = model->surfmesh.data_texcoordtexture2f;
m.texmatrix[0] = texture->currenttexmatrix;
}
GL_BlendFunc(GL_DST_ALPHA, GL_ONE);
}
- R_Mesh_State(&m);
+ R_Mesh_TextureState(&m);
GL_ColorMask(r_refdef.colormask[0], r_refdef.colormask[1], r_refdef.colormask[2], 0);
VectorScale(lightcolorbase, colorscale, color2);
GL_LockArrays(surface->num_firstvertex, surface->num_vertices);
if (!doambient && !dodiffuse && !dospecular)
return;
RSurf_PrepareVerticesForBatch(ent, texture, r_shadow_entityeyeorigin, true, true, numsurfaces, surfacelist);
+ R_Mesh_ColorPointer(NULL);
for (surfacelistindex = 0;surfacelistindex < numsurfaces;surfacelistindex++)
{
const msurface_t *surface = surfacelist[surfacelistindex];
VectorScale(lightcolorshirt, r_shadow_rtlight->ambientscale * 2, ambientcolorshirt);
VectorScale(lightcolorshirt, r_shadow_rtlight->diffusescale * 2, diffusecolorshirt);
GL_BlendFunc(GL_SRC_ALPHA, GL_ONE);
+ R_Mesh_ColorPointer(rsurface_array_color4f);
memset(&m, 0, sizeof(m));
m.tex[0] = R_GetTexture(basetexture);
+ m.texmatrix[0] = texture->currenttexmatrix;
+ m.pointer_texcoord[0] = model->surfmesh.data_texcoordtexture2f;
if (r_textureunits.integer >= 2)
{
- // voodoo2
+ // voodoo2 or TNT
m.tex[1] = R_GetTexture(r_shadow_attenuation2dtexture);
m.texmatrix[1] = r_shadow_entitytoattenuationxyz;
+ m.pointer_texcoord3f[1] = rsurface_vertex3f;
if (r_textureunits.integer >= 3)
{
- // Geforce3/Radeon class but not using dot3
+ // Voodoo4 or Kyro (or Geforce3/Radeon with gl_combine off)
m.tex[2] = R_GetTexture(r_shadow_attenuation2dtexture);
m.texmatrix[2] = r_shadow_entitytoattenuationz;
+ m.pointer_texcoord3f[2] = rsurface_vertex3f;
}
}
- m.pointer_color = rsurface_array_color4f;
- R_Mesh_State(&m);
+ R_Mesh_TextureState(&m);
RSurf_PrepareVerticesForBatch(ent, texture, r_shadow_entityeyeorigin, true, false, numsurfaces, surfacelist);
for (surfacelistindex = 0;surfacelistindex < numsurfaces;surfacelistindex++)
{
const msurface_t *surface = surfacelist[surfacelistindex];
// OpenGL 1.1 path (anything)
- R_Mesh_TexCoordPointer(0, 2, model->surfmesh.data_texcoordtexture2f);
- R_Mesh_TexMatrix(0, &texture->currenttexmatrix);
- if (r_textureunits.integer >= 2)
- {
- // voodoo2 or TNT
- R_Mesh_TexCoordPointer(1, 3, rsurface_vertex3f);
- if (r_textureunits.integer >= 3)
- {
- // Voodoo4 or Kyro (or Geforce3/Radeon with gl_combine off)
- R_Mesh_TexCoordPointer(2, 3, rsurface_vertex3f);
- }
- }
R_Mesh_TexBind(0, R_GetTexture(basetexture));
R_Shadow_RenderSurfacesLighting_Light_Vertex_Pass(model, surface, diffusecolorbase, ambientcolorbase);
if (dopants)
static void R_SkyBox(void)
{
int i;
- rmeshstate_t m;
GL_Color(1, 1, 1, 1);
- memset(&m, 0, sizeof(m));
GL_BlendFunc(GL_ONE, GL_ZERO);
GL_DepthMask(false);
GL_DepthTest(false); // don't modify or read zbuffer
- m.pointer_vertex = skyboxvertex3f;
- m.pointer_texcoord[0] = skyboxtexcoord2f;
+ R_Mesh_VertexPointer(skyboxvertex3f);
+ R_Mesh_ColorPointer(NULL);
+ R_Mesh_ResetTextureState();
+ R_Mesh_TexCoordPointer(0, 2, skyboxtexcoord2f);
GL_LockArrays(0, 6*4);
for (i = 0;i < 6;i++)
{
- m.tex[0] = R_GetTexture(skyboxside[i]);
- R_Mesh_State(&m);
+ R_Mesh_TexBind(0, R_GetTexture(skyboxside[i]));
R_Mesh_Draw(0, 6*4, 2, skyboxelements + i * 6);
}
GL_LockArrays(0, 0);
{
float speedscale;
static qboolean skysphereinitialized = false;
- rmeshstate_t m;
matrix4x4_t scroll1matrix, scroll2matrix;
if (!skysphereinitialized)
{
GL_BlendFunc(GL_ONE, GL_ZERO);
GL_DepthMask(true);
GL_DepthTest(false); // don't modify or read zbuffer
- memset(&m, 0, sizeof(m));
- m.pointer_vertex = skysphere_vertex3f;
- m.tex[0] = R_GetTexture(r_refdef.worldmodel->brush.solidskytexture);
- m.pointer_texcoord[0] = skysphere_texcoord2f;
- m.texmatrix[0] = scroll1matrix;
+ R_Mesh_VertexPointer(skysphere_vertex3f);
+ R_Mesh_ColorPointer(NULL);
+ R_Mesh_ResetTextureState();
+ R_Mesh_TexBind(0, R_GetTexture(r_refdef.worldmodel->brush.solidskytexture));
+ R_Mesh_TexCoordPointer(0, 2, skysphere_texcoord2f);
+ R_Mesh_TexMatrix(0, &scroll1matrix);
if (r_textureunits.integer >= 2)
{
// one pass using GL_DECAL or GL_INTERPOLATE_ARB for alpha layer
- m.tex[1] = R_GetTexture(r_refdef.worldmodel->brush.alphaskytexture);
- m.texcombinergb[1] = gl_combine.integer ? GL_INTERPOLATE_ARB : GL_DECAL;
- m.pointer_texcoord[1] = skysphere_texcoord2f;
- m.texmatrix[1] = scroll2matrix;
- R_Mesh_State(&m);
+ R_Mesh_TexBind(1, R_GetTexture(r_refdef.worldmodel->brush.alphaskytexture));
+ R_Mesh_TexCombine(1, gl_combine.integer ? GL_INTERPOLATE_ARB : GL_DECAL, GL_MODULATE, 1, 1);
+ R_Mesh_TexCoordPointer(1, 2, skysphere_texcoord2f);
+ R_Mesh_TexMatrix(1, &scroll2matrix);
GL_LockArrays(0, skysphere_numverts);
R_Mesh_Draw(0, skysphere_numverts, skysphere_numtriangles, skysphere_element3i);
GL_LockArrays(0, 0);
else
{
// two pass
- R_Mesh_State(&m);
GL_LockArrays(0, skysphere_numverts);
R_Mesh_Draw(0, skysphere_numverts, skysphere_numtriangles, skysphere_element3i);
- GL_LockArrays(0, 0);
GL_BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- m.tex[0] = R_GetTexture(r_refdef.worldmodel->brush.alphaskytexture);
- m.texmatrix[0] = scroll2matrix;
- R_Mesh_State(&m);
+ R_Mesh_TexBind(0, R_GetTexture(r_refdef.worldmodel->brush.alphaskytexture));
+ R_Mesh_TexMatrix(0, &scroll2matrix);
GL_LockArrays(0, skysphere_numverts);
R_Mesh_Draw(0, skysphere_numverts, skysphere_numtriangles, skysphere_element3i);
GL_LockArrays(0, 0);