R_Mesh_Matrix(&identitymatrix);
R_Mesh_ResetTextureState();
- R_Mesh_VertexPointer(particle_vertex3f);
- R_Mesh_TexCoordPointer(0, 2, particle_texcoord2f);
- R_Mesh_ColorPointer(particle_color4f);
+ R_Mesh_VertexPointer(particle_vertex3f, 0, 0);
+ R_Mesh_TexCoordPointer(0, 2, particle_texcoord2f, 0, 0);
+ R_Mesh_ColorPointer(particle_color4f, 0, 0);
GL_DepthMask(false);
GL_DepthTest(true);
GL_CullFace(GL_FRONT); // quake is backwards, this culls back faces
if (blendmode != p->type->blendmode)
{
if (batchcount > 0)
- R_Mesh_Draw(batchstart * 4, batchcount * 4, batchcount * 2, particle_element3i + batchstart * 6);
+ R_Mesh_Draw(batchstart * 4, batchcount * 4, batchcount * 2, particle_element3i + batchstart * 6, 0, 0);
batchcount = 0;
batchstart = surfacelistindex;
blendmode = p->type->blendmode;
if (texture != particletexture[p->texnum].texture)
{
if (batchcount > 0)
- R_Mesh_Draw(batchstart * 4, batchcount * 4, batchcount * 2, particle_element3i + batchstart * 6);
+ R_Mesh_Draw(batchstart * 4, batchcount * 4, batchcount * 2, particle_element3i + batchstart * 6, 0, 0);
batchcount = 0;
batchstart = surfacelistindex;
texture = particletexture[p->texnum].texture;
batchcount++;
}
if (batchcount > 0)
- R_Mesh_Draw(batchstart * 4, batchcount * 4, batchcount * 2, particle_element3i + batchstart * 6);
+ R_Mesh_Draw(batchstart * 4, batchcount * 4, batchcount * 2, particle_element3i + batchstart * 6, 0, 0);
GL_LockArrays(0, 0);
}
GL_Color(1,1,1,1);
GL_BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
GL_DepthTest(false);
- R_Mesh_VertexPointer(vertex3f);
- R_Mesh_ColorPointer(NULL);
+ R_Mesh_VertexPointer(vertex3f, 0, 0);
+ R_Mesh_ColorPointer(NULL, 0, 0);
R_Mesh_ResetTextureState();
R_Mesh_TexBind(0, R_GetTexture(pic->tex));
- R_Mesh_TexCoordPointer(0, 2, texcoord2f);
+ R_Mesh_TexCoordPointer(0, 2, texcoord2f, 0, 0);
vertex3f[2] = vertex3f[5] = vertex3f[8] = vertex3f[11] = 0;
vertex3f[0] = vertex3f[9] = x;
vertex3f[1] = vertex3f[4] = y;
if (vid.stereobuffer)
{
qglDrawBuffer(GL_FRONT_LEFT);
- R_Mesh_Draw(0, 4, 2, polygonelements);
+ R_Mesh_Draw(0, 4, 2, polygonelements, 0, 0);
qglDrawBuffer(GL_FRONT_RIGHT);
- R_Mesh_Draw(0, 4, 2, polygonelements);
+ R_Mesh_Draw(0, 4, 2, polygonelements, 0, 0);
}
else
{
qglDrawBuffer(GL_FRONT);
- R_Mesh_Draw(0, 4, 2, polygonelements);
+ R_Mesh_Draw(0, 4, 2, polygonelements, 0, 0);
}
R_Mesh_Finish();
// refresh
// renders triangles using vertices from the active arrays
int paranoidblah = 0;
-void R_Mesh_Draw(int firstvertex, int numvertices, int numtriangles, const int *elements)
+void R_Mesh_Draw(int firstvertex, int numvertices, int numtriangles, const int *elements, int bufferobject, size_t bufferoffset)
{
- int bufferobject = 0;
- size_t offset = 0;
unsigned int numelements = numtriangles * 3;
if (numvertices < 3 || numtriangles < 1)
{
else if (gl_mesh_drawrangeelements.integer && qglDrawRangeElements != NULL)
{
GL_BindEBO(bufferobject);
- qglDrawRangeElements(GL_TRIANGLES, firstvertex, firstvertex + numvertices, numelements, GL_UNSIGNED_INT, bufferobject ? (void *)offset : elements);
+ qglDrawRangeElements(GL_TRIANGLES, firstvertex, firstvertex + numvertices, numelements, GL_UNSIGNED_INT, bufferobject ? (void *)bufferoffset : elements);
CHECKGLERROR
}
else
{
GL_BindEBO(bufferobject);
- qglDrawElements(GL_TRIANGLES, numelements, GL_UNSIGNED_INT, bufferobject ? (void *)offset : elements);
+ qglDrawElements(GL_TRIANGLES, numelements, GL_UNSIGNED_INT, bufferobject ? (void *)bufferoffset : elements);
CHECKGLERROR
}
}
}
}
-void R_Mesh_VertexPointer(const float *vertex3f)
+void R_Mesh_VertexPointer(const float *vertex3f, int bufferobject, size_t bufferoffset)
{
- int bufferobject = 0;
- size_t offset = 0;
- if (gl_state.pointer_vertex != vertex3f || gl_state.pointer_vertex_buffer != bufferobject || gl_state.pointer_vertex_offset != offset)
+ if (gl_state.pointer_vertex != vertex3f || gl_state.pointer_vertex_buffer != bufferobject || gl_state.pointer_vertex_offset != bufferoffset)
{
gl_state.pointer_vertex = vertex3f;
gl_state.pointer_vertex_buffer = bufferobject;
- gl_state.pointer_vertex_offset = offset;
+ gl_state.pointer_vertex_offset = bufferoffset;
CHECKGLERROR
GL_BindVBO(bufferobject);
- qglVertexPointer(3, GL_FLOAT, sizeof(float[3]), bufferobject ? (void *)offset : vertex3f);CHECKGLERROR
+ qglVertexPointer(3, GL_FLOAT, sizeof(float[3]), bufferobject ? (void *)bufferoffset : vertex3f);CHECKGLERROR
}
}
-void R_Mesh_ColorPointer(const float *color4f)
+void R_Mesh_ColorPointer(const float *color4f, int bufferobject, size_t bufferoffset)
{
- int bufferobject = 0;
- size_t offset = 0;
if (color4f || bufferobject)
{
// caller wants color array enabled
CHECKGLERROR
qglEnableClientState(GL_COLOR_ARRAY);CHECKGLERROR
}
- if (gl_state.pointer_color != color4f || gl_state.pointer_color_buffer != bufferobject || gl_state.pointer_color_offset != offset)
+ if (gl_state.pointer_color != color4f || gl_state.pointer_color_buffer != bufferobject || gl_state.pointer_color_offset != bufferoffset)
{
gl_state.pointer_color = color4f;
gl_state.pointer_color_buffer = bufferobject;
- gl_state.pointer_color_offset = offset;
+ gl_state.pointer_color_offset = bufferoffset;
CHECKGLERROR
GL_BindVBO(bufferobject);
- qglColorPointer(4, GL_FLOAT, sizeof(float[4]), bufferobject ? (void *)offset : color4f);CHECKGLERROR
+ qglColorPointer(4, GL_FLOAT, sizeof(float[4]), bufferobject ? (void *)bufferoffset : color4f);CHECKGLERROR
}
}
else
}
}
-void R_Mesh_TexCoordPointer(unsigned int unitnum, unsigned int numcomponents, const float *texcoord)
+void R_Mesh_TexCoordPointer(unsigned int unitnum, unsigned int numcomponents, const float *texcoord, int bufferobject, size_t bufferoffset)
{
- int bufferobject = 0;
- size_t offset;
gltextureunit_t *unit = gl_state.units + unitnum;
// update array settings
CHECKGLERROR
qglEnableClientState(GL_TEXTURE_COORD_ARRAY);CHECKGLERROR
}
// texcoord array
- if (unit->pointer_texcoord != texcoord || unit->pointer_texcoord_buffer != bufferobject || unit->pointer_texcoord_offset != offset || unit->arraycomponents != numcomponents)
+ if (unit->pointer_texcoord != texcoord || unit->pointer_texcoord_buffer != bufferobject || unit->pointer_texcoord_offset != bufferoffset || unit->arraycomponents != numcomponents)
{
unit->pointer_texcoord = texcoord;
unit->pointer_texcoord_buffer = bufferobject;
- unit->pointer_texcoord_offset = offset;
+ unit->pointer_texcoord_offset = bufferoffset;
unit->arraycomponents = numcomponents;
GL_ClientActiveTexture(unitnum);
GL_BindVBO(bufferobject);
- qglTexCoordPointer(unit->arraycomponents, GL_FLOAT, sizeof(float) * unit->arraycomponents, bufferobject ? (void *)offset : texcoord);CHECKGLERROR
+ qglTexCoordPointer(unit->arraycomponents, GL_FLOAT, sizeof(float) * unit->arraycomponents, bufferobject ? (void *)bufferoffset : texcoord);CHECKGLERROR
}
}
else
for (i = 0;i < backendarrayunits;i++)
{
if (m->pointer_texcoord3f[i])
- R_Mesh_TexCoordPointer(i, 3, m->pointer_texcoord3f[i]);
+ R_Mesh_TexCoordPointer(i, 3, m->pointer_texcoord3f[i], 0, 0);
else
- R_Mesh_TexCoordPointer(i, 2, m->pointer_texcoord[i]);
+ R_Mesh_TexCoordPointer(i, 2, m->pointer_texcoord[i], 0, 0);
}
for (i = 0;i < backendunits;i++)
{
// sets up the requested vertex transform matrix
void R_Mesh_Matrix(const matrix4x4_t *matrix);
// sets the vertex array pointer
-void R_Mesh_VertexPointer(const float *vertex3f);
+void R_Mesh_VertexPointer(const float *vertex3f, int bufferobject, size_t bufferoffset);
// sets the color array pointer (GL_Color only works when this is NULL)
-void R_Mesh_ColorPointer(const float *color4f);
+void R_Mesh_ColorPointer(const float *color4f, int bufferobject, size_t bufferoffset);
// sets the texcoord array pointer for an array unit
-void R_Mesh_TexCoordPointer(unsigned int unitnum, unsigned int numcomponents, const float *texcoord);
+void R_Mesh_TexCoordPointer(unsigned int unitnum, unsigned int numcomponents, const float *texcoord, int bufferobject, size_t bufferoffset);
// sets all textures bound to an image unit (multiple can be non-zero at once, according to OpenGL rules the highest one overrides the others)
void R_Mesh_TexBindAll(unsigned int unitnum, int tex1d, int tex2d, int tex3d, int texcubemap);
// sets these are like TexBindAll with only one of the texture indices non-zero
void R_Mesh_ResetTextureState(void);
// renders a mesh
-void R_Mesh_Draw(int firstvertex, int numvertices, int numtriangles, const int *elements);
+void R_Mesh_Draw(int firstvertex, int numvertices, int numtriangles, const int *elements, int bufferobject, size_t bufferoffset);
// renders a mesh as lines
void R_Mesh_Draw_ShowTris(int firstvertex, int numvertices, int numtriangles, const int *elements);
GL_Color(red, green, blue, alpha);
- R_Mesh_VertexPointer(vertex3f);
- R_Mesh_ColorPointer(NULL);
+ R_Mesh_VertexPointer(vertex3f, 0, 0);
+ R_Mesh_ColorPointer(NULL, 0, 0);
R_Mesh_ResetTextureState();
R_Mesh_TexBind(0, R_GetTexture(char_texture));
- R_Mesh_TexCoordPointer(0, 2, texcoord2f);
+ R_Mesh_TexCoordPointer(0, 2, texcoord2f, 0, 0);
at = texcoord2f;
av = vertex3f;
if (batchcount >= QUADELEMENTS_MAXQUADS)
{
GL_LockArrays(0, batchcount * 4);
- R_Mesh_Draw(0, batchcount * 4, batchcount * 2, quadelements);
+ R_Mesh_Draw(0, batchcount * 4, batchcount * 2, quadelements, 0, 0);
GL_LockArrays(0, 0);
batchcount = 0;
at = texcoord2f;
if (batchcount > 0)
{
GL_LockArrays(0, batchcount * 4);
- R_Mesh_Draw(0, batchcount * 4, batchcount * 2, quadelements);
+ R_Mesh_Draw(0, batchcount * 4, batchcount * 2, quadelements, 0, 0);
GL_LockArrays(0, 0);
}
}
_DrawQ_ProcessDrawFlag(flags);
- R_Mesh_VertexPointer(floats);
- R_Mesh_ColorPointer(floats + 20);
+ R_Mesh_VertexPointer(floats, 0, 0);
+ R_Mesh_ColorPointer(floats + 20, 0, 0);
R_Mesh_ResetTextureState();
if (pic)
{
if (height == 0)
height = pic->height;
R_Mesh_TexBind(0, R_GetTexture(pic->tex));
- R_Mesh_TexCoordPointer(0, 2, floats + 12);
+ R_Mesh_TexCoordPointer(0, 2, floats + 12, 0, 0);
floats[12] = s1;floats[13] = t1;
floats[14] = s2;floats[15] = t2;
floats[16] = s4;floats[17] = t4;
floats[28] = r4;floats[29] = g4;floats[30] = b4;floats[31] = a4;
floats[32] = r3;floats[33] = g3;floats[34] = b3;floats[35] = a3;
- R_Mesh_Draw(0, 4, 2, polygonelements);
+ R_Mesh_Draw(0, 4, 2, polygonelements, 0, 0);
}
void DrawQ_Mesh (drawqueuemesh_t *mesh, int flags)
{
_DrawQ_ProcessDrawFlag(flags);
- R_Mesh_VertexPointer(mesh->data_vertex3f);
- R_Mesh_ColorPointer(mesh->data_color4f);
+ R_Mesh_VertexPointer(mesh->data_vertex3f, 0, 0);
+ R_Mesh_ColorPointer(mesh->data_color4f, 0, 0);
R_Mesh_ResetTextureState();
R_Mesh_TexBind(0, R_GetTexture(mesh->texture));
- R_Mesh_TexCoordPointer(0, 2, mesh->data_texcoord2f);
+ R_Mesh_TexCoordPointer(0, 2, mesh->data_texcoord2f, 0, 0);
GL_LockArrays(0, mesh->num_vertices);
- R_Mesh_Draw(0, mesh->num_vertices, mesh->num_triangles, mesh->data_element3i);
+ R_Mesh_Draw(0, mesh->num_vertices, mesh->num_triangles, mesh->data_element3i, 0, 0);
GL_LockArrays(0, 0);
}
if (!vid_usinghwgamma)
{
// all the blends ignore depth
- R_Mesh_VertexPointer(blendvertex3f);
- R_Mesh_ColorPointer(NULL);
+ R_Mesh_VertexPointer(blendvertex3f, 0, 0);
+ R_Mesh_ColorPointer(NULL, 0, 0);
R_Mesh_ResetTextureState();
GL_DepthMask(true);
GL_DepthTest(false);
while (c[0] >= 1.01f || c[1] >= 1.01f || c[2] >= 1.01f)
{
GL_Color(bound(0, c[0] - 1, 1), bound(0, c[1] - 1, 1), bound(0, c[2] - 1, 1), 1);
- R_Mesh_Draw(0, 3, 1, polygonelements);
+ R_Mesh_Draw(0, 3, 1, polygonelements, 0, 0);
VectorScale(c, 0.5, c);
}
}
{
GL_BlendFunc(GL_ONE, GL_ONE);
GL_Color(c[0], c[1], c[2], 1);
- R_Mesh_Draw(0, 3, 1, polygonelements);
+ R_Mesh_Draw(0, 3, 1, polygonelements, 0, 0);
}
}
}
r_refdef.stats.bloom++;
R_ResetViewRendering2D();
- R_Mesh_VertexPointer(r_screenvertex3f);
- R_Mesh_ColorPointer(NULL);
- R_Mesh_TexCoordPointer(0, 2, r_bloomstate.screentexcoord2f);
+ R_Mesh_VertexPointer(r_screenvertex3f, 0, 0);
+ R_Mesh_ColorPointer(NULL, 0, 0);
+ R_Mesh_TexCoordPointer(0, 2, r_bloomstate.screentexcoord2f, 0, 0);
R_Mesh_TexBind(0, R_GetTexture(r_bloomstate.texture_screen));
// copy view into the screen texture
GL_BlendFunc(GL_ONE, GL_ZERO);
GL_Color(colorscale, colorscale, colorscale, 1);
// TODO: optimize with multitexture or GLSL
- R_Mesh_Draw(0, 4, 2, polygonelements);
+ R_Mesh_Draw(0, 4, 2, polygonelements, 0, 0);
r_refdef.stats.bloom_drawpixels += r_bloomstate.bloomwidth * r_bloomstate.bloomheight;
// we now have a bloom image in the framebuffer
r_refdef.stats.bloom++;
R_ResetViewRendering2D();
- R_Mesh_VertexPointer(r_screenvertex3f);
- R_Mesh_ColorPointer(NULL);
+ R_Mesh_VertexPointer(r_screenvertex3f, 0, 0);
+ R_Mesh_ColorPointer(NULL, 0, 0);
// we have a bloom image in the framebuffer
CHECKGLERROR
GL_BlendFunc(GL_DST_COLOR, GL_SRC_COLOR);
GL_Color(r, r, r, 1);
R_Mesh_TexBind(0, R_GetTexture(r_bloomstate.texture_bloom));
- R_Mesh_TexCoordPointer(0, 2, r_bloomstate.bloomtexcoord2f);
- R_Mesh_Draw(0, 4, 2, polygonelements);
+ R_Mesh_TexCoordPointer(0, 2, r_bloomstate.bloomtexcoord2f, 0, 0);
+ R_Mesh_Draw(0, 4, 2, polygonelements, 0, 0);
r_refdef.stats.bloom_drawpixels += r_bloomstate.bloomwidth * r_bloomstate.bloomheight;
// copy the vertically blurred bloom view to a texture
if (r_hdr.integer)
brighten *= r_hdr_range.value;
R_Mesh_TexBind(0, R_GetTexture(r_bloomstate.texture_bloom));
- R_Mesh_TexCoordPointer(0, 2, r_bloomstate.offsettexcoord2f);
+ R_Mesh_TexCoordPointer(0, 2, r_bloomstate.offsettexcoord2f, 0, 0);
for (dir = 0;dir < 2;dir++)
{
//r = (dir ? 1.0f : brighten)/(range*2+1);
r = (dir ? 1.0f : brighten)/(range*2+1)*(1 - x*x/(float)(range*range));
GL_Color(r, r, r, 1);
- R_Mesh_Draw(0, 4, 2, polygonelements);
+ R_Mesh_Draw(0, 4, 2, polygonelements, 0, 0);
r_refdef.stats.bloom_drawpixels += r_bloomstate.bloomwidth * r_bloomstate.bloomheight;
GL_BlendFunc(GL_ONE, GL_ONE);
}
{
GL_BlendFunc(GL_ONE, GL_ZERO);
R_Mesh_TexBind(0, R_GetTexture(r_bloomstate.texture_bloom));
- R_Mesh_TexCoordPointer(0, 2, r_bloomstate.bloomtexcoord2f);
+ R_Mesh_TexCoordPointer(0, 2, r_bloomstate.bloomtexcoord2f, 0, 0);
GL_Color(1, 1, 1, 1);
- R_Mesh_Draw(0, 4, 2, polygonelements);
+ R_Mesh_Draw(0, 4, 2, polygonelements, 0, 0);
r_refdef.stats.bloom_drawpixels += r_bloomstate.bloomwidth * r_bloomstate.bloomheight;
GL_BlendFunc(GL_ONE, GL_ONE);
qglBlendEquationEXT(GL_FUNC_REVERSE_SUBTRACT_EXT);
R_Mesh_TexBind(0, R_GetTexture(r_texture_white));
- R_Mesh_TexCoordPointer(0, 2, r_bloomstate.bloomtexcoord2f);
+ R_Mesh_TexCoordPointer(0, 2, r_bloomstate.bloomtexcoord2f, 0, 0);
GL_Color(r_bloom_colorsubtract.value, r_bloom_colorsubtract.value, r_bloom_colorsubtract.value, 1);
- R_Mesh_Draw(0, 4, 2, polygonelements);
+ R_Mesh_Draw(0, 4, 2, polygonelements, 0, 0);
r_refdef.stats.bloom_drawpixels += r_bloomstate.bloomwidth * r_bloomstate.bloomheight;
qglBlendEquationEXT(GL_FUNC_ADD_EXT);
// the bloom texture was made earlier this render, so we just need to
// blend it onto the screen...
R_ResetViewRendering2D();
- R_Mesh_VertexPointer(r_screenvertex3f);
- R_Mesh_ColorPointer(NULL);
+ R_Mesh_VertexPointer(r_screenvertex3f, 0, 0);
+ R_Mesh_ColorPointer(NULL, 0, 0);
GL_Color(1, 1, 1, 1);
GL_BlendFunc(GL_ONE, GL_ONE);
R_Mesh_TexBind(0, R_GetTexture(r_bloomstate.texture_bloom));
- R_Mesh_TexCoordPointer(0, 2, r_bloomstate.bloomtexcoord2f);
- R_Mesh_Draw(0, 4, 2, polygonelements);
+ R_Mesh_TexCoordPointer(0, 2, r_bloomstate.bloomtexcoord2f, 0, 0);
+ R_Mesh_Draw(0, 4, 2, polygonelements, 0, 0);
r_refdef.stats.bloom_drawpixels += r_view.width * r_view.height;
}
else if (r_bloomstate.enabled)
// put the original screen image back in place and blend the bloom
// texture on it
R_ResetViewRendering2D();
- R_Mesh_VertexPointer(r_screenvertex3f);
- R_Mesh_ColorPointer(NULL);
+ R_Mesh_VertexPointer(r_screenvertex3f, 0, 0);
+ R_Mesh_ColorPointer(NULL, 0, 0);
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_bloomstate.texture_bloom));
- R_Mesh_TexCoordPointer(0, 2, r_bloomstate.bloomtexcoord2f);
+ R_Mesh_TexCoordPointer(0, 2, r_bloomstate.bloomtexcoord2f, 0, 0);
if (r_textureunits.integer >= 2 && gl_combine.integer)
{
R_Mesh_TexCombine(1, GL_ADD, GL_ADD, 1, 1);
R_Mesh_TexBind(1, R_GetTexture(r_bloomstate.texture_screen));
- R_Mesh_TexCoordPointer(1, 2, r_bloomstate.screentexcoord2f);
+ R_Mesh_TexCoordPointer(1, 2, r_bloomstate.screentexcoord2f, 0, 0);
}
else
{
- R_Mesh_Draw(0, 4, 2, polygonelements);
+ R_Mesh_Draw(0, 4, 2, polygonelements, 0, 0);
r_refdef.stats.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_bloomstate.texture_screen));
- R_Mesh_TexCoordPointer(0, 2, r_bloomstate.screentexcoord2f);
+ R_Mesh_TexCoordPointer(0, 2, r_bloomstate.screentexcoord2f, 0, 0);
}
- R_Mesh_Draw(0, 4, 2, polygonelements);
+ R_Mesh_Draw(0, 4, 2, polygonelements, 0, 0);
r_refdef.stats.bloom_drawpixels += r_view.width * r_view.height;
}
if (r_refdef.viewblend[3] >= (1.0f / 256.0f))
{
// apply a color tint to the whole view
R_ResetViewRendering2D();
- R_Mesh_VertexPointer(r_screenvertex3f);
- R_Mesh_ColorPointer(NULL);
+ R_Mesh_VertexPointer(r_screenvertex3f, 0, 0);
+ R_Mesh_ColorPointer(NULL, 0, 0);
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);
+ R_Mesh_Draw(0, 4, 2, polygonelements, 0, 0);
}
}
c[2] = c[2] * f1 + r_refdef.fogcolor[2] * f2;
}
}
- R_Mesh_VertexPointer(vertex3f);
- R_Mesh_ColorPointer(color);
+ R_Mesh_VertexPointer(vertex3f, 0, 0);
+ R_Mesh_ColorPointer(color, 0, 0);
R_Mesh_ResetTextureState();
- R_Mesh_Draw(8, 12);
+ R_Mesh_Draw(8, 12, 0, 0);
}
*/
}
GL_DepthTest(!(ent->effects & EF_NODEPTHTEST));
GL_CullFace((ent->effects & EF_DOUBLESIDED) ? GL_NONE : GL_FRONT); // quake is backwards, this culls back faces
- R_Mesh_VertexPointer(nomodelvertex3f);
+ R_Mesh_VertexPointer(nomodelvertex3f, 0, 0);
if (r_refdef.fogenabled)
{
vec3_t org;
memcpy(color4f, nomodelcolor4f, sizeof(float[6*4]));
- R_Mesh_ColorPointer(color4f);
+ R_Mesh_ColorPointer(color4f, 0, 0);
Matrix4x4_OriginFromMatrix(&ent->matrix, org);
f2 = VERTEXFOGTABLE(VectorDistance(org, r_view.origin));
f1 = 1 - f2;
else if (ent->alpha != 1)
{
memcpy(color4f, nomodelcolor4f, sizeof(float[6*4]));
- R_Mesh_ColorPointer(color4f);
+ R_Mesh_ColorPointer(color4f, 0, 0);
for (i = 0, c = color4f;i < 6;i++, c += 4)
c[3] *= ent->alpha;
}
else
- R_Mesh_ColorPointer(nomodelcolor4f);
+ R_Mesh_ColorPointer(nomodelcolor4f, 0, 0);
R_Mesh_ResetTextureState();
- R_Mesh_Draw(0, 6, 8, nomodelelements);
+ R_Mesh_Draw(0, 6, 8, nomodelelements, 0, 0);
}
void R_DrawNoModel(entity_render_t *ent)
vertex3f[10] = origin[1] + left[1] * scalex1 + up[1] * scaley1;
vertex3f[11] = origin[2] + left[2] * scalex1 + up[2] * scaley1;
- R_Mesh_VertexPointer(vertex3f);
- R_Mesh_ColorPointer(NULL);
+ R_Mesh_VertexPointer(vertex3f, 0, 0);
+ R_Mesh_ColorPointer(NULL, 0, 0);
R_Mesh_ResetTextureState();
R_Mesh_TexBind(0, R_GetTexture(texture));
- R_Mesh_TexCoordPointer(0, 2, spritetexcoord2f);
+ R_Mesh_TexCoordPointer(0, 2, spritetexcoord2f, 0, 0);
// FIXME: fixed function path can't properly handle r_view.colorscale > 1
GL_Color(cr * ifog * r_view.colorscale, cg * ifog * r_view.colorscale, cb * ifog * r_view.colorscale, ca);
- R_Mesh_Draw(0, 4, 2, polygonelements);
+ R_Mesh_Draw(0, 4, 2, polygonelements, 0, 0);
if (blendfunc2 == GL_ONE_MINUS_SRC_ALPHA)
{
R_Mesh_TexBind(0, R_GetTexture(fogtexture));
GL_BlendFunc(blendfunc1, GL_ONE);
GL_Color(r_refdef.fogcolor[0] * fog * r_view.colorscale, r_refdef.fogcolor[1] * fog * r_view.colorscale, r_refdef.fogcolor[2] * fog * r_view.colorscale, ca);
- R_Mesh_Draw(0, 4, 2, polygonelements);
+ R_Mesh_Draw(0, 4, 2, polygonelements, 0, 0);
}
}
static void R_DrawCollisionBrush(const colbrushf_t *brush)
{
int i;
- R_Mesh_VertexPointer(brush->points->v);
+ R_Mesh_VertexPointer(brush->points->v, 0, 0);
i = (int)(((size_t)brush) / sizeof(colbrushf_t));
GL_Color((i & 31) * (1.0f / 32.0f) * r_view.colorscale, ((i >> 5) & 31) * (1.0f / 32.0f) * r_view.colorscale, ((i >> 10) & 31) * (1.0f / 32.0f) * r_view.colorscale, 0.2f);
GL_LockArrays(0, brush->numpoints);
- R_Mesh_Draw(0, brush->numpoints, brush->numtriangles, brush->elements);
+ R_Mesh_Draw(0, brush->numpoints, brush->numtriangles, brush->elements, 0, 0);
GL_LockArrays(0, 0);
}
int i;
if (!surface->num_collisiontriangles)
return;
- R_Mesh_VertexPointer(surface->data_collisionvertex3f);
+ R_Mesh_VertexPointer(surface->data_collisionvertex3f, 0, 0);
i = (int)(((size_t)surface) / sizeof(msurface_t));
GL_Color((i & 31) * (1.0f / 32.0f) * r_view.colorscale, ((i >> 5) & 31) * (1.0f / 32.0f) * r_view.colorscale, ((i >> 10) & 31) * (1.0f / 32.0f) * r_view.colorscale, 0.2f);
GL_LockArrays(0, surface->num_collisionvertices);
- R_Mesh_Draw(0, surface->num_collisionvertices, surface->num_collisiontriangles, surface->data_collisionelement3i);
+ R_Mesh_Draw(0, surface->num_collisionvertices, surface->num_collisiontriangles, surface->data_collisionelement3i, 0, 0);
GL_LockArrays(0, 0);
}
rsurface_tvector3f = rsurface_modeltvector3f;
rsurface_normal3f = rsurface_modelnormal3f;
}
- R_Mesh_VertexPointer(rsurface_vertex3f);
+ R_Mesh_VertexPointer(rsurface_vertex3f, 0, 0);
}
void RSurf_DrawBatch_Simple(int texturenumsurfaces, msurface_t **texturesurfacelist)
if (texturenumsurfaces == 1)
{
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));
+ R_Mesh_Draw(surface->num_firstvertex, surface->num_vertices, surface->num_triangles, (rsurface_model->surfmesh.data_element3i + 3 * surface->num_firsttriangle), 0, 0);
}
else if (r_batchmode.integer == 2)
{
j = i + 1;
if (surface->num_triangles > MAXBATCHTRIANGLES)
{
- R_Mesh_Draw(surface->num_firstvertex, surface->num_vertices, surface->num_triangles, (rsurface_model->surfmesh.data_element3i + 3 * surface->num_firsttriangle));
+ R_Mesh_Draw(surface->num_firstvertex, surface->num_vertices, surface->num_triangles, (rsurface_model->surfmesh.data_element3i + 3 * surface->num_firsttriangle), 0, 0);
continue;
}
memcpy(batchelements, rsurface_model->surfmesh.data_element3i + 3 * surface->num_firsttriangle, surface->num_triangles * sizeof(int[3]));
}
surface2 = texturesurfacelist[j-1];
numvertices = endvertex - firstvertex;
- R_Mesh_Draw(firstvertex, numvertices, batchtriangles, batchelements);
+ R_Mesh_Draw(firstvertex, numvertices, batchtriangles, batchelements, 0, 0);
}
}
else if (r_batchmode.integer == 1)
numvertices = surface2->num_firstvertex + surface2->num_vertices - surface->num_firstvertex;
numtriangles = surface2->num_firsttriangle + surface2->num_triangles - surface->num_firsttriangle;
GL_LockArrays(surface->num_firstvertex, numvertices);
- R_Mesh_Draw(surface->num_firstvertex, numvertices, numtriangles, (rsurface_model->surfmesh.data_element3i + 3 * surface->num_firsttriangle));
+ R_Mesh_Draw(surface->num_firstvertex, numvertices, numtriangles, (rsurface_model->surfmesh.data_element3i + 3 * surface->num_firsttriangle), 0, 0);
}
}
else
{
surface = texturesurfacelist[i];
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));
+ R_Mesh_Draw(surface->num_firstvertex, surface->num_vertices, surface->num_triangles, (rsurface_model->surfmesh.data_element3i + 3 * surface->num_firsttriangle), 0, 0);
}
}
}
if (deluxemaptexunit >= 0)
R_Mesh_TexBind(deluxemaptexunit, R_GetTexture(surface->deluxemaptexture));
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));
+ R_Mesh_Draw(surface->num_firstvertex, surface->num_vertices, surface->num_triangles, (rsurface_model->surfmesh.data_element3i + 3 * surface->num_firsttriangle), 0, 0);
}
else if (r_batchmode.integer == 2)
{
j = i + 1;
if (surface->num_triangles > MAXBATCHTRIANGLES)
{
- R_Mesh_Draw(surface->num_firstvertex, surface->num_vertices, surface->num_triangles, (rsurface_model->surfmesh.data_element3i + 3 * surface->num_firsttriangle));
+ R_Mesh_Draw(surface->num_firstvertex, surface->num_vertices, surface->num_triangles, (rsurface_model->surfmesh.data_element3i + 3 * surface->num_firsttriangle), 0, 0);
continue;
}
memcpy(batchelements, rsurface_model->surfmesh.data_element3i + 3 * surface->num_firsttriangle, surface->num_triangles * sizeof(int[3]));
}
surface2 = texturesurfacelist[j-1];
numvertices = endvertex - firstvertex;
- R_Mesh_Draw(firstvertex, numvertices, batchtriangles, batchelements);
+ R_Mesh_Draw(firstvertex, numvertices, batchtriangles, batchelements, 0, 0);
}
}
else if (r_batchmode.integer == 1)
numvertices = surface2->num_firstvertex + surface2->num_vertices - surface->num_firstvertex;
numtriangles = surface2->num_firsttriangle + surface2->num_triangles - surface->num_firsttriangle;
GL_LockArrays(surface->num_firstvertex, numvertices);
- R_Mesh_Draw(surface->num_firstvertex, numvertices, numtriangles, (rsurface_model->surfmesh.data_element3i + 3 * surface->num_firsttriangle));
+ R_Mesh_Draw(surface->num_firstvertex, numvertices, numtriangles, (rsurface_model->surfmesh.data_element3i + 3 * surface->num_firsttriangle), 0, 0);
}
#if 0
Con_Printf("\n");
if (deluxemaptexunit >= 0)
R_Mesh_TexBind(deluxemaptexunit, R_GetTexture(surface->deluxemaptexture));
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));
+ R_Mesh_Draw(surface->num_firstvertex, surface->num_vertices, surface->num_triangles, (rsurface_model->surfmesh.data_element3i + 3 * surface->num_firsttriangle), 0, 0);
}
}
}
{
float f = ((j + surface->num_firsttriangle) & 31) * (1.0f / 31.0f) * r_view.colorscale;
GL_Color(f, f, f, 1);
- R_Mesh_Draw(surface->num_firstvertex, surface->num_vertices, 1, (rsurface_model->surfmesh.data_element3i + 3 * (j + surface->num_firsttriangle)));
+ R_Mesh_Draw(surface->num_firstvertex, surface->num_vertices, 1, (rsurface_model->surfmesh.data_element3i + 3 * (j + surface->num_firsttriangle)), 0, 0);
}
}
}
int k = (int)(((size_t)surface) / sizeof(msurface_t));
GL_Color((k & 15) * (1.0f / 16.0f) * r_view.colorscale, ((k >> 4) & 15) * (1.0f / 16.0f) * r_view.colorscale, ((k >> 8) & 15) * (1.0f / 16.0f) * r_view.colorscale, 1);
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));
+ R_Mesh_Draw(surface->num_firstvertex, surface->num_vertices, surface->num_triangles, (rsurface_model->surfmesh.data_element3i + 3 * surface->num_firsttriangle), 0, 0);
}
}
}
rsurface_lightmapcolor4f = NULL;
if (applyfog) RSurf_DrawBatch_GL11_ApplyFog(texturenumsurfaces, texturesurfacelist);
if (applycolor) RSurf_DrawBatch_GL11_ApplyColor(texturenumsurfaces, texturesurfacelist, r, g, b, a);
- R_Mesh_ColorPointer(rsurface_lightmapcolor4f);
+ R_Mesh_ColorPointer(rsurface_lightmapcolor4f, 0, 0);
GL_Color(r, g, b, a);
RSurf_DrawBatch_WithLightmapSwitching(texturenumsurfaces, texturesurfacelist, 0, -1);
}
rsurface_lightmapcolor4f = NULL;
if (applyfog) RSurf_DrawBatch_GL11_ApplyFog(texturenumsurfaces, texturesurfacelist);
if (applycolor) RSurf_DrawBatch_GL11_ApplyColor(texturenumsurfaces, texturesurfacelist, r, g, b, a);
- R_Mesh_ColorPointer(rsurface_lightmapcolor4f);
+ R_Mesh_ColorPointer(rsurface_lightmapcolor4f, 0, 0);
GL_Color(r, g, b, a);
RSurf_DrawBatch_Simple(texturenumsurfaces, texturesurfacelist);
}
rsurface_lightmapcolor4f = rsurface_model->surfmesh.data_lightmapcolor4f;
if (applyfog) RSurf_DrawBatch_GL11_ApplyFog(texturenumsurfaces, texturesurfacelist);
if (applycolor) RSurf_DrawBatch_GL11_ApplyColor(texturenumsurfaces, texturesurfacelist, r, g, b, a);
- R_Mesh_ColorPointer(rsurface_lightmapcolor4f);
+ R_Mesh_ColorPointer(rsurface_lightmapcolor4f, 0, 0);
GL_Color(r, g, b, a);
RSurf_DrawBatch_Simple(texturenumsurfaces, texturesurfacelist);
}
}
if (applyfog) RSurf_DrawBatch_GL11_ApplyFog(texturenumsurfaces, texturesurfacelist);
if (applycolor) RSurf_DrawBatch_GL11_ApplyColor(texturenumsurfaces, texturesurfacelist, r, g, b, a);
- R_Mesh_ColorPointer(rsurface_lightmapcolor4f);
+ R_Mesh_ColorPointer(rsurface_lightmapcolor4f, 0, 0);
GL_Color(r, g, b, a);
RSurf_DrawBatch_Simple(texturenumsurfaces, texturesurfacelist);
}
rsurface_mode = RSURFMODE_SHOWSURFACES;
GL_DepthMask(true);
GL_BlendFunc(GL_ONE, GL_ZERO);
- R_Mesh_ColorPointer(NULL);
+ R_Mesh_ColorPointer(NULL, 0, 0);
R_Mesh_ResetTextureState();
}
RSurf_PrepareVerticesForBatch(false, false, texturenumsurfaces, texturesurfacelist);
if (rsurface_model->type == mod_brushq1 && r_q1bsp_skymasking.integer && !r_viewcache.world_novis)
{
GL_Color(r_refdef.fogcolor[0] * r_view.colorscale, r_refdef.fogcolor[1] * r_view.colorscale, r_refdef.fogcolor[2] * r_view.colorscale, 1);
- R_Mesh_ColorPointer(NULL);
+ R_Mesh_ColorPointer(NULL, 0, 0);
R_Mesh_ResetTextureState();
if (skyrendermasked)
{
RSurf_PrepareVerticesForBatch(true, r_glsl_permutation->loc_Texture_Normal, texturenumsurfaces, texturesurfacelist);
else
RSurf_PrepareVerticesForBatch(r_glsl_permutation->loc_Texture_Normal, r_glsl_permutation->loc_Texture_Normal, texturenumsurfaces, texturesurfacelist);
- R_Mesh_TexCoordPointer(0, 2, rsurface_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, rsurface_model->surfmesh.data_texcoordlightmap2f);
+ R_Mesh_TexCoordPointer(0, 2, rsurface_model->surfmesh.data_texcoordtexture2f, 0, 0);
+ R_Mesh_TexCoordPointer(1, 3, rsurface_svector3f, 0, 0);
+ R_Mesh_TexCoordPointer(2, 3, rsurface_tvector3f, 0, 0);
+ R_Mesh_TexCoordPointer(3, 3, rsurface_normal3f, 0, 0);
+ R_Mesh_TexCoordPointer(4, 2, rsurface_model->surfmesh.data_texcoordlightmap2f, 0, 0);
if (rsurface_texture->currentmaterialflags & MATERIALFLAG_FULLBRIGHT)
{
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));
- R_Mesh_ColorPointer(NULL);
+ R_Mesh_ColorPointer(NULL, 0, 0);
}
else if (rsurface_uselightmaptexture)
{
R_Mesh_TexBind(7, R_GetTexture(texturesurfacelist[0]->lightmaptexture));
if (r_glsl_permutation->loc_Texture_Deluxemap >= 0)
R_Mesh_TexBind(8, R_GetTexture(texturesurfacelist[0]->deluxemaptexture));
- R_Mesh_ColorPointer(NULL);
+ R_Mesh_ColorPointer(NULL, 0, 0);
}
else
{
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));
- R_Mesh_ColorPointer(rsurface_model->surfmesh.data_lightmapcolor4f);
+ R_Mesh_ColorPointer(rsurface_model->surfmesh.data_lightmapcolor4f, 0, 0);
}
if (rsurface_uselightmaptexture && !(rsurface_texture->currentmaterialflags & MATERIALFLAG_FULLBRIGHT))
}
layercolor[3] = layer->color[3];
applycolor = layercolor[0] != 1 || layercolor[1] != 1 || layercolor[2] != 1 || layercolor[3] != 1;
- R_Mesh_ColorPointer(NULL);
+ R_Mesh_ColorPointer(NULL, 0, 0);
applyfog = (layer->flags & TEXTURELAYERFLAG_FOGDARKEN) != 0;
switch (layer->type)
{
}
R_Mesh_TextureState(&m);
// generate a color array for the fog pass
- R_Mesh_ColorPointer(rsurface_array_color4f);
+ R_Mesh_ColorPointer(rsurface_array_color4f, 0, 0);
for (texturesurfaceindex = 0;texturesurfaceindex < texturenumsurfaces;texturesurfaceindex++)
{
int i;
}
GL_DepthMask(layer->depthmask);
GL_BlendFunc(layer->blendfunc1, layer->blendfunc2);
- R_Mesh_ColorPointer(NULL);
+ R_Mesh_ColorPointer(NULL, 0, 0);
applyfog = (layer->flags & TEXTURELAYERFLAG_FOGDARKEN) != 0;
switch (layer->type)
{
break;
case TEXTURELAYERTYPE_FOG:
// singletexture fogging
- R_Mesh_ColorPointer(rsurface_array_color4f);
+ R_Mesh_ColorPointer(rsurface_array_color4f, 0, 0);
if (layer->texture)
{
memset(&m, 0, sizeof(m));
GL_CullFace(GL_NONE);
R_Mesh_Matrix(&identitymatrix);
- R_Mesh_VertexPointer(vertex3f);
- R_Mesh_ColorPointer(NULL);
+ R_Mesh_VertexPointer(vertex3f, 0, 0);
+ R_Mesh_ColorPointer(NULL, 0, 0);
R_Mesh_ResetTextureState();
i = surfacelist[0];
for (j = 0;j < 3;j++, i++)
vertex3f[i] = mins[j] + size[j] * locboxvertex3f[i];
- R_Mesh_Draw(0, 6*4, 6*2, locboxelement3i);
+ R_Mesh_Draw(0, 6*4, 6*2, locboxelement3i, 0, 0);
}
void R_DrawLocs(void)
if (!model->brush.num_brushes)
return;
CHECKGLERROR
- R_Mesh_ColorPointer(NULL);
+ R_Mesh_ColorPointer(NULL, 0, 0);
R_Mesh_ResetTextureState();
GL_BlendFunc(GL_SRC_ALPHA, GL_ONE);
GL_DepthMask(false);
GL_DepthTest(!r_showdisabledepthtest.integer);
GL_DepthMask(true);
GL_BlendFunc(GL_ONE, GL_ZERO);
- R_Mesh_ColorPointer(NULL);
+ R_Mesh_ColorPointer(NULL, 0, 0);
R_Mesh_ResetTextureState();
for (i = 0, j = model->firstmodelsurface, surface = model->data_surfaces + j;i < model->nummodelsurfaces;i++, j++, surface++)
{
numpoints = min(portal->numpoints, POLYGONELEMENTS_MAXPOINTS);
- R_Mesh_VertexPointer(vertex3f);
- R_Mesh_ColorPointer(NULL);
+ R_Mesh_VertexPointer(vertex3f, 0, 0);
+ R_Mesh_ColorPointer(NULL, 0, 0);
R_Mesh_ResetTextureState();
i = surfacelist[0];
0.125f);
for (i = 0, v = vertex3f;i < numpoints;i++, v += 3)
VectorCopy(portal->points[i].position, v);
- R_Mesh_Draw(0, numpoints, numpoints - 2, polygonelements);
+ R_Mesh_Draw(0, numpoints, numpoints - 2, polygonelements, 0, 0);
}
// LordHavoc: this is just a nice debugging tool, very slow
GL_CullFace(GL_FRONT); // quake is backwards, this culls back faces
R_Mesh_Matrix(&identitymatrix);
- R_Mesh_ColorPointer(NULL);
+ R_Mesh_ColorPointer(NULL, 0, 0);
memset(&m, 0, sizeof(m));
m.tex[0] = R_GetTexture(explosiontexture);
m.pointer_texcoord[0] = explosiontexcoord2f[0];
for (surfacelistindex = 0;surfacelistindex < numsurfaces;surfacelistindex++)
{
const explosion_t *e = explosion + surfacelist[surfacelistindex];
- R_Mesh_VertexPointer(e->vert[0]);
+ R_Mesh_VertexPointer(e->vert[0], 0, 0);
// FIXME: fixed function path can't properly handle r_view.colorscale > 1
GL_Color(e->alpha * r_view.colorscale, e->alpha * r_view.colorscale, e->alpha * r_view.colorscale, 1);
GL_LockArrays(0, numverts);
- R_Mesh_Draw(0, numverts, numtriangles, explosiontris[0]);
+ R_Mesh_Draw(0, numverts, numtriangles, explosiontris[0], 0, 0);
GL_LockArrays(0, 0);
}
}
if (!r_lightningbeam_qmbtexture.integer && r_lightningbeamtexture == NULL)
r_lightningbeams_setuptexture();
- R_Mesh_VertexPointer(vertex3f);
+ R_Mesh_VertexPointer(vertex3f, 0, 0);
// FIXME: fixed function path can't properly handle r_view.colorscale > 1
if (r_refdef.fogenabled)
{
// per vertex colors if fog is used
- R_Mesh_ColorPointer(color4f);
+ R_Mesh_ColorPointer(color4f, 0, 0);
R_FogLightningBeam_Vertex3f_Color4f(vertex3f, color4f, 12, r_lightningbeam_color_red.value * r_view.colorscale, r_lightningbeam_color_green.value * r_view.colorscale, r_lightningbeam_color_blue.value * r_view.colorscale, 1);
}
else
{
// solid color if fog is not used
- R_Mesh_ColorPointer(NULL);
+ R_Mesh_ColorPointer(NULL, 0, 0);
GL_Color(r_lightningbeam_color_red.value * r_view.colorscale, r_lightningbeam_color_green.value * r_view.colorscale, r_lightningbeam_color_blue.value * r_view.colorscale, 1);
}
memset(&m, 0, sizeof(m));
// draw the 3 polygons as one batch of 6 triangles using the 12 vertices
GL_LockArrays(0, 12);
- R_Mesh_Draw(0, 12, 6, r_lightningbeamelements);
+ R_Mesh_Draw(0, 12, 6, r_lightningbeamelements, 0, 0);
GL_LockArrays(0, 0);
}
}
}
r_refdef.stats.lights_shadowtriangles += numtriangles;
CHECKGLERROR
- R_Mesh_VertexPointer(vertex3f);
+ R_Mesh_VertexPointer(vertex3f, 0, 0);
GL_LockArrays(0, numvertices);
if (r_shadow_rendermode == R_SHADOW_RENDERMODE_STENCIL)
{
// decrement stencil if backface is behind depthbuffer
GL_CullFace(GL_BACK); // quake is backwards, this culls front faces
qglStencilOp(GL_KEEP, GL_DECR, GL_KEEP);CHECKGLERROR
- R_Mesh_Draw(0, numvertices, numtriangles, element3i);
+ R_Mesh_Draw(0, numvertices, numtriangles, element3i, 0, 0);
// increment stencil if frontface is behind depthbuffer
GL_CullFace(GL_FRONT); // quake is backwards, this culls back faces
qglStencilOp(GL_KEEP, GL_INCR, GL_KEEP);CHECKGLERROR
}
- R_Mesh_Draw(0, numvertices, numtriangles, element3i);
+ R_Mesh_Draw(0, numvertices, numtriangles, element3i, 0, 0);
GL_LockArrays(0, 0);
CHECKGLERROR
}
R_Shadow_MakeTextures();
CHECKGLERROR
- R_Mesh_ColorPointer(NULL);
+ R_Mesh_ColorPointer(NULL, 0, 0);
R_Mesh_ResetTextureState();
GL_BlendFunc(GL_ONE, GL_ZERO);
GL_DepthTest(true);
{
qglDisable(GL_STENCIL_TEST_TWO_SIDE_EXT);CHECKGLERROR
}
- R_Mesh_ColorPointer(NULL);
+ R_Mesh_ColorPointer(NULL, 0, 0);
R_Mesh_ResetTextureState();
GL_DepthTest(true);
GL_DepthMask(false);
{
// used to display how many times a surface is lit for level design purposes
GL_Color(0.1 * r_view.colorscale, 0.025 * r_view.colorscale, 0, 1);
- R_Mesh_ColorPointer(NULL);
+ R_Mesh_ColorPointer(NULL, 0, 0);
R_Mesh_ResetTextureState();
- R_Mesh_Draw(firstvertex, numvertices, numtriangles, element3i);
+ R_Mesh_Draw(firstvertex, numvertices, numtriangles, element3i, 0, 0);
}
static void R_Shadow_RenderLighting_Light_GLSL(int firstvertex, int numvertices, int numtriangles, const int *element3i, const vec3_t lightcolorbase, const vec3_t lightcolorpants, const vec3_t lightcolorshirt, rtexture_t *basetexture, rtexture_t *pantstexture, rtexture_t *shirttexture, rtexture_t *normalmaptexture, rtexture_t *glosstexture, float ambientscale, float diffusescale, float specularscale, qboolean dopants, qboolean doshirt)
{
// ARB2 GLSL shader path (GFFX5200, Radeon 9500)
R_SetupSurfaceShader(lightcolorbase, false, ambientscale, diffusescale, specularscale);
- R_Mesh_TexCoordPointer(0, 2, rsurface_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(0, 2, rsurface_model->surfmesh.data_texcoordtexture2f, 0, 0);
+ R_Mesh_TexCoordPointer(1, 3, rsurface_svector3f, 0, 0);
+ R_Mesh_TexCoordPointer(2, 3, rsurface_tvector3f, 0, 0);
+ R_Mesh_TexCoordPointer(3, 3, rsurface_normal3f, 0, 0);
if (rsurface_texture->currentmaterialflags & MATERIALFLAG_ALPHATEST)
{
qglDepthFunc(GL_EQUAL);CHECKGLERROR
}
- R_Mesh_Draw(firstvertex, numvertices, numtriangles, element3i);
+ R_Mesh_Draw(firstvertex, numvertices, numtriangles, element3i, 0, 0);
if (rsurface_texture->currentmaterialflags & MATERIALFLAG_ALPHATEST)
{
qglDepthFunc(GL_LEQUAL);CHECKGLERROR
for (renders = 0;renders < 64 && (r > 0 || g > 0 || b > 0);renders++, r--, g--, b--)
{
GL_Color(bound(0, r, 1), bound(0, g, 1), bound(0, b, 1), 1);
- R_Mesh_Draw(firstvertex, numvertices, numtriangles, element3i);
+ R_Mesh_Draw(firstvertex, numvertices, numtriangles, element3i, 0, 0);
}
}
R_Mesh_TextureState(&m);
GL_ColorMask(0,0,0,1);
GL_BlendFunc(GL_ONE, GL_ZERO);
- R_Mesh_Draw(firstvertex, numvertices, numtriangles, element3i);
+ R_Mesh_Draw(firstvertex, numvertices, numtriangles, element3i, 0, 0);
// second pass
memset(&m, 0, sizeof(m));
R_Mesh_TextureState(&m);
GL_ColorMask(0,0,0,1);
GL_BlendFunc(GL_ONE, GL_ZERO);
- R_Mesh_Draw(firstvertex, numvertices, numtriangles, element3i);
+ R_Mesh_Draw(firstvertex, numvertices, numtriangles, element3i, 0, 0);
// second pass
memset(&m, 0, sizeof(m));
R_Mesh_TextureState(&m);
GL_ColorMask(0,0,0,1);
GL_BlendFunc(GL_ONE, GL_ZERO);
- R_Mesh_Draw(firstvertex, numvertices, numtriangles, element3i);
+ R_Mesh_Draw(firstvertex, numvertices, numtriangles, element3i, 0, 0);
// second pass
memset(&m, 0, sizeof(m));
m.pointer_texcoord3f[1] = rsurface_array_texcoord3f;
R_Mesh_TextureState(&m);
GL_BlendFunc(GL_DST_ALPHA, GL_ZERO);
- R_Mesh_Draw(firstvertex, numvertices, numtriangles, element3i);
+ R_Mesh_Draw(firstvertex, numvertices, numtriangles, element3i, 0, 0);
// second pass
memset(&m, 0, sizeof(m));
R_Mesh_TextureState(&m);
GL_ColorMask(0,0,0,1);
GL_BlendFunc(GL_ONE, GL_ZERO);
- R_Mesh_Draw(firstvertex, numvertices, numtriangles, element3i);
+ R_Mesh_Draw(firstvertex, numvertices, numtriangles, element3i, 0, 0);
// second pass
memset(&m, 0, sizeof(m));
R_Mesh_TextureState(&m);
GL_ColorMask(0,0,0,1);
GL_BlendFunc(GL_ONE, GL_ZERO);
- R_Mesh_Draw(firstvertex, numvertices, numtriangles, element3i);
+ R_Mesh_Draw(firstvertex, numvertices, numtriangles, element3i, 0, 0);
// second pass
memset(&m, 0, sizeof(m));
R_Mesh_TextureState(&m);
GL_ColorMask(0,0,0,1);
GL_BlendFunc(GL_ONE, GL_ZERO);
- R_Mesh_Draw(firstvertex, numvertices, numtriangles, element3i);
+ R_Mesh_Draw(firstvertex, numvertices, numtriangles, element3i, 0, 0);
// second pass
memset(&m, 0, sizeof(m));
m.pointer_texcoord3f[1] = rsurface_array_texcoord3f;
R_Mesh_TextureState(&m);
GL_BlendFunc(GL_DST_ALPHA, GL_ZERO);
- R_Mesh_Draw(firstvertex, numvertices, numtriangles, element3i);
+ R_Mesh_Draw(firstvertex, numvertices, numtriangles, element3i, 0, 0);
// second pass
memset(&m, 0, sizeof(m));
GL_ColorMask(0,0,0,1);
// this squares the result
GL_BlendFunc(GL_SRC_ALPHA, GL_ZERO);
- R_Mesh_Draw(firstvertex, numvertices, numtriangles, element3i);
+ R_Mesh_Draw(firstvertex, numvertices, numtriangles, element3i, 0, 0);
// second and third pass
R_Mesh_ResetTextureState();
// square alpha in framebuffer a few times to make it shiny
GL_BlendFunc(GL_ZERO, GL_DST_ALPHA);
for (glossexponent = 2;glossexponent * 2 <= r_shadow_glossexponent.value;glossexponent *= 2)
- R_Mesh_Draw(firstvertex, numvertices, numtriangles, element3i);
+ R_Mesh_Draw(firstvertex, numvertices, numtriangles, element3i, 0, 0);
// fourth pass
memset(&m, 0, sizeof(m));
m.texmatrix[0] = r_shadow_entitytoattenuationxyz;
R_Mesh_TextureState(&m);
GL_BlendFunc(GL_DST_ALPHA, GL_ZERO);
- R_Mesh_Draw(firstvertex, numvertices, numtriangles, element3i);
+ R_Mesh_Draw(firstvertex, numvertices, numtriangles, element3i, 0, 0);
// fifth pass
memset(&m, 0, sizeof(m));
GL_ColorMask(0,0,0,1);
// this squares the result
GL_BlendFunc(GL_SRC_ALPHA, GL_ZERO);
- R_Mesh_Draw(firstvertex, numvertices, numtriangles, element3i);
+ R_Mesh_Draw(firstvertex, numvertices, numtriangles, element3i, 0, 0);
// second and third pass
R_Mesh_ResetTextureState();
// square alpha in framebuffer a few times to make it shiny
GL_BlendFunc(GL_ZERO, GL_DST_ALPHA);
for (glossexponent = 2;glossexponent * 2 <= r_shadow_glossexponent.value;glossexponent *= 2)
- R_Mesh_Draw(firstvertex, numvertices, numtriangles, element3i);
+ R_Mesh_Draw(firstvertex, numvertices, numtriangles, element3i, 0, 0);
// fourth pass
memset(&m, 0, sizeof(m));
GL_ColorMask(0,0,0,1);
// this squares the result
GL_BlendFunc(GL_SRC_ALPHA, GL_ZERO);
- R_Mesh_Draw(firstvertex, numvertices, numtriangles, element3i);
+ R_Mesh_Draw(firstvertex, numvertices, numtriangles, element3i, 0, 0);
// second and third pass
R_Mesh_ResetTextureState();
// square alpha in framebuffer a few times to make it shiny
GL_BlendFunc(GL_ZERO, GL_DST_ALPHA);
for (glossexponent = 2;glossexponent * 2 <= r_shadow_glossexponent.value;glossexponent *= 2)
- R_Mesh_Draw(firstvertex, numvertices, numtriangles, element3i);
+ R_Mesh_Draw(firstvertex, numvertices, numtriangles, element3i, 0, 0);
// fourth pass
memset(&m, 0, sizeof(m));
m.texmatrix[1] = r_shadow_entitytoattenuationz;
R_Mesh_TextureState(&m);
GL_BlendFunc(GL_DST_ALPHA, GL_ZERO);
- R_Mesh_Draw(firstvertex, numvertices, numtriangles, element3i);
+ R_Mesh_Draw(firstvertex, numvertices, numtriangles, element3i, 0, 0);
// fifth pass
memset(&m, 0, sizeof(m));
qboolean dospecular = specularscale > 0;
if (!doambient && !dodiffuse && !dospecular)
return;
- R_Mesh_ColorPointer(NULL);
+ R_Mesh_ColorPointer(NULL, 0, 0);
if (doambient)
R_Shadow_RenderLighting_Light_Dot3_AmbientPass(firstvertex, numvertices, numtriangles, element3i, lightcolorbase, basetexture, ambientscale * r_view.colorscale);
if (dodiffuse)
newe += 3;
if (newnumtriangles >= 1024)
{
- R_Mesh_Draw(newfirstvertex, newlastvertex - newfirstvertex + 1, newnumtriangles, newelements);
+ R_Mesh_Draw(newfirstvertex, newlastvertex - newfirstvertex + 1, newnumtriangles, newelements, 0, 0);
newnumtriangles = 0;
newe = newelements;
stop = false;
}
if (newnumtriangles >= 1)
{
- R_Mesh_Draw(newfirstvertex, newlastvertex - newfirstvertex + 1, newnumtriangles, newelements);
+ R_Mesh_Draw(newfirstvertex, newlastvertex - newfirstvertex + 1, newnumtriangles, newelements, 0, 0);
stop = false;
}
// if we couldn't find any lit triangles, exit early
VectorScale(lightcolorshirt, ambientscale * 2 * r_view.colorscale, ambientcolorshirt);
VectorScale(lightcolorshirt, diffusescale * 2 * r_view.colorscale, diffusecolorshirt);
GL_BlendFunc(GL_SRC_ALPHA, GL_ONE);
- R_Mesh_ColorPointer(rsurface_array_color4f);
+ R_Mesh_ColorPointer(rsurface_array_color4f, 0, 0);
memset(&m, 0, sizeof(m));
m.tex[0] = R_GetTexture(basetexture);
m.texmatrix[0] = rsurface_texture->currenttexmatrix;
for (mesh = r_shadow_rtlight->static_meshchain_shadow;mesh;mesh = mesh->next)
{
r_refdef.stats.lights_shadowtriangles += mesh->numtriangles;
- R_Mesh_VertexPointer(mesh->vertex3f);
+ R_Mesh_VertexPointer(mesh->vertex3f, 0, 0);
GL_LockArrays(0, mesh->numverts);
if (r_shadow_rendermode == R_SHADOW_RENDERMODE_STENCIL)
{
// decrement stencil if backface is behind depthbuffer
GL_CullFace(GL_BACK); // quake is backwards, this culls front faces
qglStencilOp(GL_KEEP, GL_DECR, GL_KEEP);CHECKGLERROR
- R_Mesh_Draw(0, mesh->numverts, mesh->numtriangles, mesh->element3i);
+ R_Mesh_Draw(0, mesh->numverts, mesh->numtriangles, mesh->element3i, 0, 0);
// increment stencil if frontface is behind depthbuffer
GL_CullFace(GL_FRONT); // quake is backwards, this culls back faces
qglStencilOp(GL_KEEP, GL_INCR, GL_KEEP);CHECKGLERROR
}
- R_Mesh_Draw(0, mesh->numverts, mesh->numtriangles, mesh->element3i);
+ R_Mesh_Draw(0, mesh->numverts, mesh->numtriangles, mesh->element3i, 0, 0);
GL_LockArrays(0, 0);
}
CHECKGLERROR
GL_ScissorTest(true);
R_Mesh_Matrix(&identitymatrix);
R_Mesh_ResetTextureState();
- R_Mesh_VertexPointer(vertex3f);
- R_Mesh_ColorPointer(NULL);
+ R_Mesh_VertexPointer(vertex3f, 0, 0);
+ R_Mesh_ColorPointer(NULL, 0, 0);
// set up a 50% darkening blend on shadowed areas
GL_BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
qglStencilFunc(GL_NOTEQUAL, 128, ~0);CHECKGLERROR
// apply the blend to the shadowed areas
- R_Mesh_Draw(0, 4, 2, polygonelements);
+ R_Mesh_Draw(0, 4, 2, polygonelements, 0, 0);
// restoring the perspective view is done by R_RenderScene
//R_SetupView(&r_view.matrix);
GL_BlendFunc(GL_ONE, GL_ZERO);
GL_DepthMask(false);
GL_DepthTest(false); // don't modify or read zbuffer
- R_Mesh_VertexPointer(skyboxvertex3f);
- R_Mesh_ColorPointer(NULL);
+ R_Mesh_VertexPointer(skyboxvertex3f, 0, 0);
+ R_Mesh_ColorPointer(NULL, 0, 0);
R_Mesh_ResetTextureState();
- R_Mesh_TexCoordPointer(0, 2, skyboxtexcoord2f);
+ R_Mesh_TexCoordPointer(0, 2, skyboxtexcoord2f, 0, 0);
GL_LockArrays(0, 6*4);
for (i = 0;i < 6;i++)
{
R_Mesh_TexBind(0, R_GetTexture(skyboxside[i]));
- R_Mesh_Draw(0, 6*4, 2, skyboxelements + i * 6);
+ R_Mesh_Draw(0, 6*4, 2, skyboxelements + i * 6, 0, 0);
}
GL_LockArrays(0, 0);
}
GL_BlendFunc(GL_ONE, GL_ZERO);
GL_DepthMask(true);
GL_DepthTest(false); // don't modify or read zbuffer
- R_Mesh_VertexPointer(skysphere_vertex3f);
- R_Mesh_ColorPointer(NULL);
+ R_Mesh_VertexPointer(skysphere_vertex3f, 0, 0);
+ R_Mesh_ColorPointer(NULL, 0, 0);
R_Mesh_ResetTextureState();
R_Mesh_TexBind(0, R_GetTexture(r_refdef.worldmodel->brush.solidskytexture));
- R_Mesh_TexCoordPointer(0, 2, skysphere_texcoord2f);
+ R_Mesh_TexCoordPointer(0, 2, skysphere_texcoord2f, 0, 0);
R_Mesh_TexMatrix(0, &scroll1matrix);
if (r_textureunits.integer >= 2 && r_view.colorscale == 1)
{
// one pass using GL_DECAL or GL_INTERPOLATE_ARB for alpha layer
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_TexCoordPointer(1, 2, skysphere_texcoord2f, 0, 0);
R_Mesh_TexMatrix(1, &scroll2matrix);
GL_LockArrays(0, skysphere_numverts);
- R_Mesh_Draw(0, skysphere_numverts, skysphere_numtriangles, skysphere_element3i);
+ R_Mesh_Draw(0, skysphere_numverts, skysphere_numtriangles, skysphere_element3i, 0, 0);
GL_LockArrays(0, 0);
}
else
{
// two pass
GL_LockArrays(0, skysphere_numverts);
- R_Mesh_Draw(0, skysphere_numverts, skysphere_numtriangles, skysphere_element3i);
+ R_Mesh_Draw(0, skysphere_numverts, skysphere_numtriangles, skysphere_element3i, 0, 0);
GL_BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
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);
+ R_Mesh_Draw(0, skysphere_numverts, skysphere_numtriangles, skysphere_element3i, 0, 0);
GL_LockArrays(0, 0);
}
}