int i;
cachepic_t *pic;
static double nextpurgetime;
- int purgeframe;
if (nextpurgetime > realtime)
return;
nextpurgetime = realtime + 0.05;
- purgeframe = draw_frame - 1;
for (i = 0, pic = cachepics;i < numcachepics;i++, pic++)
{
if (pic->autoload && pic->tex && pic->lastusedframe < draw_frame)
void DrawQ_Pic(float x, float y, cachepic_t *pic, float width, float height, float red, float green, float blue, float alpha, int flags)
{
- float floats[20];
+ float floats[36];
_DrawQ_ProcessDrawFlag(flags);
- GL_Color(red, green, blue, alpha);
- R_Mesh_VertexPointer(floats, 0, 0);
- R_Mesh_ColorPointer(NULL, 0, 0);
R_Mesh_ResetTextureState();
+ floats[12] = 0.0f;floats[13] = 0.0f;
+ floats[14] = 1.0f;floats[15] = 0.0f;
+ floats[16] = 1.0f;floats[17] = 1.0f;
+ floats[18] = 0.0f;floats[19] = 1.0f;
+ floats[20] = floats[24] = floats[28] = floats[32] = red;
+ floats[21] = floats[25] = floats[29] = floats[33] = green;
+ floats[22] = floats[26] = floats[30] = floats[34] = blue;
+ floats[23] = floats[27] = floats[31] = floats[35] = alpha;
if (pic)
{
if (width == 0)
if (height == 0)
height = pic->height;
R_SetupShader_Generic(Draw_GetPicTexture(pic), NULL, GL_MODULATE, 1);
- R_Mesh_TexCoordPointer(0, 2, floats + 12, 0, 0);
-
-#if 1
- floats[12] = 0.0f;floats[13] = 0.0f;
- floats[14] = 1.0f;floats[15] = 0.0f;
- floats[16] = 1.0f;floats[17] = 1.0f;
- floats[18] = 0.0f;floats[19] = 1.0f;
-#else
+
+#if 0
// AK07: lets be texel correct on the corners
{
float horz_offset = 0.5f / pic->width;
floats[3] = floats[6] = x + width;
floats[7] = floats[10] = y + height;
- R_Mesh_Draw(0, 4, 0, 2, polygonelement3i, polygonelement3s, 0, 0);
+ R_Mesh_PrepareVertices_Generic_Arrays(4, floats, floats + 20, floats + 12);
+ R_Mesh_Draw(0, 4, 0, 2, polygonelement3i, NULL, 0, polygonelement3s, NULL, 0);
}
void DrawQ_RotPic(float x, float y, cachepic_t *pic, float width, float height, float org_x, float org_y, float angle, float red, float green, float blue, float alpha, int flags)
{
- float floats[20];
+ float floats[36];
float af = DEG2RAD(-angle); // forward
float ar = DEG2RAD(-angle + 90); // right
float sinaf = sin(af);
float cosar = cos(ar);
_DrawQ_ProcessDrawFlag(flags);
- GL_Color(red, green, blue, alpha);
- R_Mesh_VertexPointer(floats, 0, 0);
- R_Mesh_ColorPointer(NULL, 0, 0);
R_Mesh_ResetTextureState();
if (pic)
{
if (height == 0)
height = pic->height;
R_SetupShader_Generic(Draw_GetPicTexture(pic), NULL, GL_MODULATE, 1);
- R_Mesh_TexCoordPointer(0, 2, floats + 12, 0, 0);
-
- floats[12] = 0.0f;floats[13] = 0.0f;
- floats[14] = 1.0f;floats[15] = 0.0f;
- floats[16] = 1.0f;floats[17] = 1.0f;
- floats[18] = 0.0f;floats[19] = 1.0f;
}
else
R_SetupShader_Generic(NULL, NULL, GL_MODULATE, 1);
floats[9] = x - cosaf*org_x + cosar*(height-org_y);
floats[10] = y - sinaf*org_x + sinar*(height-org_y);
- R_Mesh_Draw(0, 4, 0, 2, polygonelement3i, polygonelement3s, 0, 0);
+ floats[12] = 0.0f;floats[13] = 0.0f;
+ floats[14] = 1.0f;floats[15] = 0.0f;
+ floats[16] = 1.0f;floats[17] = 1.0f;
+ floats[18] = 0.0f;floats[19] = 1.0f;
+ floats[20] = floats[24] = floats[28] = floats[32] = red;
+ floats[21] = floats[25] = floats[29] = floats[33] = green;
+ floats[22] = floats[26] = floats[30] = floats[34] = blue;
+ floats[23] = floats[27] = floats[31] = floats[35] = alpha;
+
+ R_Mesh_PrepareVertices_Generic_Arrays(4, floats, floats + 20, floats + 12);
+ R_Mesh_Draw(0, 4, 0, 2, polygonelement3i, NULL, 0, polygonelement3s, NULL, 0);
}
void DrawQ_Fill(float x, float y, float width, float height, float red, float green, float blue, float alpha, int flags)
{
- float floats[12];
+ float floats[36];
_DrawQ_ProcessDrawFlag(flags);
- GL_Color(red, green, blue, alpha);
- R_Mesh_VertexPointer(floats, 0, 0);
- R_Mesh_ColorPointer(NULL, 0, 0);
R_Mesh_ResetTextureState();
R_SetupShader_Generic(NULL, NULL, GL_MODULATE, 1);
floats[1] = floats[4] = y;
floats[3] = floats[6] = x + width;
floats[7] = floats[10] = y + height;
-
- R_Mesh_Draw(0, 4, 0, 2, polygonelement3i, polygonelement3s, 0, 0);
+ floats[12] = 0.0f;floats[13] = 0.0f;
+ floats[14] = 1.0f;floats[15] = 0.0f;
+ floats[16] = 1.0f;floats[17] = 1.0f;
+ floats[18] = 0.0f;floats[19] = 1.0f;
+ floats[20] = floats[24] = floats[28] = floats[32] = red;
+ floats[21] = floats[25] = floats[29] = floats[33] = green;
+ floats[22] = floats[26] = floats[30] = floats[34] = blue;
+ floats[23] = floats[27] = floats[31] = floats[35] = alpha;
+
+ R_Mesh_PrepareVertices_Generic_Arrays(4, floats, floats + 20, floats + 12);
+ R_Mesh_Draw(0, 4, 0, 2, polygonelement3i, NULL, 0, polygonelement3s, NULL, 0);
}
/// color tag printing
size_t bytes_left;
ft2_font_map_t *fontmap = NULL;
ft2_font_map_t *map = NULL;
- ft2_font_map_t *prevmap = NULL;
+ //ft2_font_map_t *prevmap = NULL;
ft2_font_t *ft2 = fnt->ft2;
// float ftbase_x;
qboolean snap = true;
qboolean least_one = false;
- float dw, dh; // display w/h
+ float dw; // display w
+ //float dh; // display h
const float *width_of;
if (!h) h = w;
}
dw = w * sw;
- dh = h * sh;
+ //dh = h * sh;
if (*maxlen < 1)
*maxlen = 1<<30;
if (prevch && Font_GetKerningForMap(ft2, map_index, w, h, prevch, ch, &kx, NULL))
x += kx * dw;
x += map->glyphs[mapch].advance_x * dw;
- prevmap = map;
+ //prevmap = map;
prevch = ch;
}
}
Uchar prevch = 0; // used for kerning
int tempcolorindex;
int map_index = 0;
- ft2_font_map_t *prevmap = NULL; // the previous map
+ //ft2_font_map_t *prevmap = NULL; // the previous map
ft2_font_map_t *map = NULL; // the currently used map
ft2_font_map_t *fontmap = NULL; // the font map for the size
float ftbase_y;
_DrawQ_ProcessDrawFlag(flags);
- R_Mesh_ColorPointer(color4f, 0, 0);
R_Mesh_ResetTextureState();
if (!fontmap)
R_Mesh_TexBind(0, fnt->tex);
- R_Mesh_TexCoordPointer(0, 2, texcoord2f, 0, 0);
- R_Mesh_VertexPointer(vertex3f, 0, 0);
R_SetupShader_Generic(fnt->tex, NULL, GL_MODULATE, 1);
ac = color4f;
if (batchcount)
{
// switching from freetype to non-freetype rendering
- R_Mesh_Draw(0, batchcount * 4, 0, batchcount * 2, quadelement3i, quadelement3s, 0, 0);
+ R_Mesh_PrepareVertices_Generic_Arrays(batchcount * 4, vertex3f, color4f, texcoord2f);
+ R_Mesh_Draw(0, batchcount * 4, 0, batchcount * 2, quadelement3i, NULL, 0, quadelement3s, NULL, 0);
batchcount = 0;
ac = color4f;
at = texcoord2f;
batchcount++;
if (batchcount >= QUADELEMENTS_MAXQUADS)
{
- R_Mesh_Draw(0, batchcount * 4, 0, batchcount * 2, quadelement3i, quadelement3s, 0, 0);
+ R_Mesh_PrepareVertices_Generic_Arrays(batchcount * 4, vertex3f, color4f, texcoord2f);
+ R_Mesh_Draw(0, batchcount * 4, 0, batchcount * 2, quadelement3i, NULL, 0, quadelement3s, NULL, 0);
batchcount = 0;
ac = color4f;
at = texcoord2f;
if (batchcount)
{
// we need a different character map, render what we currently have:
- R_Mesh_Draw(0, batchcount * 4, 0, batchcount * 2, quadelement3i, quadelement3s, 0, 0);
+ R_Mesh_PrepareVertices_Generic_Arrays(batchcount * 4, vertex3f, color4f, texcoord2f);
+ R_Mesh_Draw(0, batchcount * 4, 0, batchcount * 2, quadelement3i, NULL, 0, quadelement3s, NULL, 0);
batchcount = 0;
ac = color4f;
at = texcoord2f;
batchcount++;
if (batchcount >= QUADELEMENTS_MAXQUADS)
{
- R_Mesh_Draw(0, batchcount * 4, 0, batchcount * 2, quadelement3i, quadelement3s, 0, 0);
+ R_Mesh_PrepareVertices_Generic_Arrays(batchcount * 4, vertex3f, color4f, texcoord2f);
+ R_Mesh_Draw(0, batchcount * 4, 0, batchcount * 2, quadelement3i, NULL, 0, quadelement3s, NULL, 0);
batchcount = 0;
ac = color4f;
at = texcoord2f;
av = vertex3f;
}
- prevmap = map;
+ //prevmap = map;
prevch = ch;
}
if (shadow)
}
}
if (batchcount > 0)
- R_Mesh_Draw(0, batchcount * 4, 0, batchcount * 2, quadelement3i, quadelement3s, 0, 0);
+ {
+ R_Mesh_PrepareVertices_Generic_Arrays(batchcount * 4, vertex3f, color4f, texcoord2f);
+ R_Mesh_Draw(0, batchcount * 4, 0, batchcount * 2, quadelement3i, NULL, 0, quadelement3s, NULL, 0);
+ }
if (outcolor)
*outcolor = colorindex;
_DrawQ_ProcessDrawFlag(flags);
- 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_SetupShader_Generic(Draw_GetPicTexture(pic), NULL, GL_MODULATE, 1);
- 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[18] = s3;floats[19] = t3;
}
else
R_SetupShader_Generic(NULL, NULL, GL_MODULATE, 1);
floats[1] = floats[4] = y;
floats[3] = floats[6] = x + width;
floats[7] = floats[10] = y + height;
+ floats[12] = s1;floats[13] = t1;
+ floats[14] = s2;floats[15] = t2;
+ floats[16] = s4;floats[17] = t4;
+ floats[18] = s3;floats[19] = t3;
floats[20] = r1;floats[21] = g1;floats[22] = b1;floats[23] = a1;
floats[24] = r2;floats[25] = g2;floats[26] = b2;floats[27] = a2;
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, 0, 2, polygonelement3i, polygonelement3s, 0, 0);
+ R_Mesh_PrepareVertices_Generic_Arrays(4, floats, floats + 20, floats + 12);
+ R_Mesh_Draw(0, 4, 0, 2, polygonelement3i, NULL, 0, polygonelement3s, NULL, 0);
}
void DrawQ_Mesh (drawqueuemesh_t *mesh, int flags)
{
_DrawQ_ProcessDrawFlag(flags);
- R_Mesh_VertexPointer(mesh->data_vertex3f, 0, 0);
- R_Mesh_ColorPointer(mesh->data_color4f, 0, 0);
R_Mesh_ResetTextureState();
- R_Mesh_TexCoordPointer(0, 2, mesh->data_texcoord2f, 0, 0);
R_SetupShader_Generic(mesh->texture, NULL, GL_MODULATE, 1);
- R_Mesh_Draw(0, mesh->num_vertices, 0, mesh->num_triangles, mesh->data_element3i, mesh->data_element3s, 0, 0);
+ R_Mesh_PrepareVertices_Generic_Arrays(mesh->num_vertices, mesh->data_vertex3f, mesh->data_color4f, mesh->data_texcoord2f);
+ R_Mesh_Draw(0, mesh->num_vertices, 0, mesh->num_triangles, mesh->data_element3i, NULL, 0, mesh->data_element3s, NULL, 0);
}
void DrawQ_LineLoop (drawqueuemesh_t *mesh, int flags)
break;
}
// all the blends ignore depth
- R_Mesh_VertexPointer(blendvertex3f, 0, 0);
- R_Mesh_ColorPointer(NULL, 0, 0);
R_Mesh_ResetTextureState();
R_SetupShader_Generic(NULL, NULL, GL_MODULATE, 1);
GL_DepthMask(true);
GL_BlendFunc(GL_DST_COLOR, GL_ONE);
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, 0, 1, polygonelement3i, polygonelement3s, 0, 0);
+ GL_Color(c[0] - 1, c[1] - 1, c[2] - 1, 1);
+ R_Mesh_PrepareVertices_Generic_Arrays(3, blendvertex3f, NULL, NULL);
+ R_Mesh_Draw(0, 3, 0, 1, polygonelement3i, NULL, 0, polygonelement3s, NULL, 0);
VectorScale(c, 0.5, c);
}
}
if (c[0] >= 0.01f || c[1] >= 0.01f || c[2] >= 0.01f)
{
GL_BlendFunc(GL_ONE, GL_ONE);
- GL_Color(c[0], c[1], c[2], 1);
- R_Mesh_Draw(0, 3, 0, 1, polygonelement3i, polygonelement3s, 0, 0);
+ GL_Color(c[0] - 1, c[1] - 1, c[2] - 1, 1);
+ R_Mesh_PrepareVertices_Generic_Arrays(3, blendvertex3f, NULL, NULL);
+ R_Mesh_Draw(0, 3, 0, 1, polygonelement3i, NULL, 0, polygonelement3s, NULL, 0);
}
}