// ^^^^^^^^^^ blue component
// ^^^^^^ bottom row
// ^^^^^^^^^^^^ alpha is always on
- R_Mesh_Draw(0, 4, 0, 2, NULL, polygonelements, 0, 0);
+ R_Mesh_Draw(0, 4, 0, 2, polygonelement3i, polygonelement3s, 0, 0);
// make sure everything is cleared, including the progress indicator
if(loadingscreenheight < 8)
R_Mesh_ResetTextureState();
R_Mesh_TexBind(0, R_GetTexture(loadingscreentexture));
R_Mesh_TexCoordPointer(0, 2, loadingscreentexture_texcoord2f, 0, 0);
- R_Mesh_Draw(0, 4, 0, 2, NULL, polygonelements, 0, 0);
+ R_Mesh_Draw(0, 4, 0, 2, polygonelement3i, polygonelement3s, 0, 0);
}
R_Mesh_VertexPointer(loadingscreenpic_vertex3f, 0, 0);
R_Mesh_ResetTextureState();
R_Mesh_TexBind(0, R_GetTexture(loadingscreenpic->tex));
R_Mesh_TexCoordPointer(0, 2, loadingscreenpic_texcoord2f, 0, 0);
- R_Mesh_Draw(0, 4, 0, 2, NULL, polygonelements, 0, 0);
+ R_Mesh_Draw(0, 4, 0, 2, polygonelement3i, polygonelement3s, 0, 0);
SCR_DrawLoadingStack();
}
mesh.texture = polys->begin_texture;
mesh.num_vertices = polys->begin_vertices;
mesh.num_triangles = polys->begin_vertices-2;
- mesh.data_element3s = polygonelements;
+ mesh.data_element3i = polygonelement3i;
+ mesh.data_element3s = polygonelement3s;
mesh.data_vertex3f = polys->begin_vertex[0];
mesh.data_color4f = polys->begin_color[0];
mesh.data_texcoord2f = polys->begin_texcoord[0];
rtexture_t *texture;
int num_triangles;
int num_vertices;
+ int *data_element3i;
unsigned short *data_element3s;
float *data_vertex3f;
float *data_texcoord2f;
}
*/
-unsigned short polygonelements[(POLYGONELEMENTS_MAXPOINTS-2)*3];
-unsigned short quadelements[QUADELEMENTS_MAXQUADS*6];
+int polygonelement3i[(POLYGONELEMENTS_MAXPOINTS-2)*3];
+unsigned short polygonelement3s[(POLYGONELEMENTS_MAXPOINTS-2)*3];
+int quadelement3i[QUADELEMENTS_MAXQUADS*6];
+unsigned short quadelement3s[QUADELEMENTS_MAXQUADS*6];
void GL_Backend_AllocArrays(void)
{
for (i = 0;i < POLYGONELEMENTS_MAXPOINTS - 2;i++)
{
- polygonelements[i * 3 + 0] = 0;
- polygonelements[i * 3 + 1] = i + 1;
- polygonelements[i * 3 + 2] = i + 2;
+ polygonelement3s[i * 3 + 0] = 0;
+ polygonelement3s[i * 3 + 1] = i + 1;
+ polygonelement3s[i * 3 + 2] = i + 2;
}
// elements for rendering a series of quads as triangles
for (i = 0;i < QUADELEMENTS_MAXQUADS;i++)
{
- quadelements[i * 6 + 0] = i * 4;
- quadelements[i * 6 + 1] = i * 4 + 1;
- quadelements[i * 6 + 2] = i * 4 + 2;
- quadelements[i * 6 + 3] = i * 4;
- quadelements[i * 6 + 4] = i * 4 + 2;
- quadelements[i * 6 + 5] = i * 4 + 3;
+ quadelement3s[i * 6 + 0] = i * 4;
+ quadelement3s[i * 6 + 1] = i * 4 + 1;
+ quadelement3s[i * 6 + 2] = i * 4 + 2;
+ quadelement3s[i * 6 + 3] = i * 4;
+ quadelement3s[i * 6 + 4] = i * 4 + 2;
+ quadelement3s[i * 6 + 5] = i * 4 + 3;
}
+ for (i = 0;i < (POLYGONELEMENTS_MAXPOINTS - 2)*3;i++)
+ polygonelement3i[i] = polygonelement3s[i];
+ for (i = 0;i < QUADELEMENTS_MAXQUADS*3;i++)
+ quadelement3i[i] = quadelement3s[i];
+
Cvar_RegisterVariable(&r_render);
Cvar_RegisterVariable(&r_renderview);
Cvar_RegisterVariable(&r_waterwarp);
#define MAX_TEXTUREUNITS 64
#define POLYGONELEMENTS_MAXPOINTS 258
-extern unsigned short polygonelements[(POLYGONELEMENTS_MAXPOINTS-2)*3];
+extern int polygonelement3i[(POLYGONELEMENTS_MAXPOINTS-2)*3];
+extern unsigned short polygonelement3s[(POLYGONELEMENTS_MAXPOINTS-2)*3];
#define QUADELEMENTS_MAXQUADS 128
-extern unsigned short quadelements[QUADELEMENTS_MAXQUADS*6];
+extern int quadelement3i[QUADELEMENTS_MAXQUADS*6];
+extern unsigned short quadelement3s[QUADELEMENTS_MAXQUADS*6];
void R_Viewport_TransformToScreen(const r_viewport_t *v, const vec4_t in, vec4_t out);
void R_Viewport_InitOrtho(r_viewport_t *v, const matrix4x4_t *cameramatrix, int x, int y, int width, int height, double x1, double y1, double x2, double y2, double zNear, double zFar, const double *nearplane);
floats[3] = floats[6] = x + width;
floats[7] = floats[10] = y + height;
- R_Mesh_Draw(0, 4, 0, 2, NULL, polygonelements, 0, 0);
+ R_Mesh_Draw(0, 4, 0, 2, polygonelement3i, polygonelement3s, 0, 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)
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, NULL, polygonelements, 0, 0);
+ R_Mesh_Draw(0, 4, 0, 2, polygonelement3i, polygonelement3s, 0, 0);
}
void DrawQ_Fill(float x, float y, float width, float height, float red, float green, float blue, float alpha, int flags)
floats[3] = floats[6] = x + width;
floats[7] = floats[10] = y + height;
- R_Mesh_Draw(0, 4, 0, 2, NULL, polygonelements, 0, 0);
+ R_Mesh_Draw(0, 4, 0, 2, polygonelement3i, polygonelement3s, 0, 0);
}
/// color tag printing
if (batchcount >= QUADELEMENTS_MAXQUADS)
{
GL_LockArrays(0, batchcount * 4);
- R_Mesh_Draw(0, batchcount * 4, 0, batchcount * 2, NULL, quadelements, 0, 0);
+ R_Mesh_Draw(0, batchcount * 4, 0, batchcount * 2, quadelement3i, quadelement3s, 0, 0);
GL_LockArrays(0, 0);
batchcount = 0;
ac = color4f;
if (batchcount > 0)
{
GL_LockArrays(0, batchcount * 4);
- R_Mesh_Draw(0, batchcount * 4, 0, batchcount * 2, NULL, quadelements, 0, 0);
+ R_Mesh_Draw(0, batchcount * 4, 0, batchcount * 2, quadelement3i, quadelement3s, 0, 0);
GL_LockArrays(0, 0);
}
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, NULL, polygonelements, 0, 0);
+ R_Mesh_Draw(0, 4, 0, 2, polygonelement3i, polygonelement3s, 0, 0);
}
void DrawQ_Mesh (drawqueuemesh_t *mesh, int flags)
R_SetupGenericShader(mesh->texture != NULL);
GL_LockArrays(0, mesh->num_vertices);
- R_Mesh_Draw(0, mesh->num_vertices, 0, mesh->num_triangles, NULL, mesh->data_element3s, 0, 0);
+ R_Mesh_Draw(0, mesh->num_vertices, 0, mesh->num_triangles, mesh->data_element3i, mesh->data_element3s, 0, 0);
GL_LockArrays(0, 0);
}
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, NULL, polygonelements, 0, 0);
+ R_Mesh_Draw(0, 3, 0, 1, polygonelement3i, polygonelement3s, 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, 0, 1, NULL, polygonelements, 0, 0);
+ R_Mesh_Draw(0, 3, 0, 1, polygonelement3i, polygonelement3s, 0, 0);
}
}
}
R_SetupGenericShader(true);
R_Mesh_TexCoordPointer(0, 2, r_bloomstate.screentexcoord2f, 0, 0);
R_Mesh_TexBind(0, R_GetTexture(r_bloomstate.texture_screen));
- R_Mesh_Draw(0, 4, 0, 2, NULL, polygonelements, 0, 0);
+ R_Mesh_Draw(0, 4, 0, 2, polygonelement3i, polygonelement3s, 0, 0);
r_refdef.stats.bloom_drawpixels += r_bloomstate.bloomwidth * r_bloomstate.bloomheight;
// we now have a bloom image in the framebuffer
GL_Color(r, r, r, 1);
R_Mesh_TexBind(0, R_GetTexture(r_bloomstate.texture_bloom));
R_Mesh_TexCoordPointer(0, 2, r_bloomstate.bloomtexcoord2f, 0, 0);
- R_Mesh_Draw(0, 4, 0, 2, NULL, polygonelements, 0, 0);
+ R_Mesh_Draw(0, 4, 0, 2, polygonelement3i, polygonelement3s, 0, 0);
r_refdef.stats.bloom_drawpixels += r_bloomstate.bloomwidth * r_bloomstate.bloomheight;
// copy the vertically blurred bloom view to a texture
if(range >= 1)
r *= (1 - x*x/(float)(range*range));
GL_Color(r, r, r, 1);
- R_Mesh_Draw(0, 4, 0, 2, NULL, polygonelements, 0, 0);
+ R_Mesh_Draw(0, 4, 0, 2, polygonelement3i, polygonelement3s, 0, 0);
r_refdef.stats.bloom_drawpixels += r_bloomstate.bloomwidth * r_bloomstate.bloomheight;
GL_BlendFunc(GL_ONE, GL_ONE);
}
R_Mesh_TexBind(0, R_GetTexture(r_bloomstate.texture_bloom));
R_Mesh_TexCoordPointer(0, 2, r_bloomstate.bloomtexcoord2f, 0, 0);
GL_Color(1, 1, 1, 1);
- R_Mesh_Draw(0, 4, 0, 2, NULL, polygonelements, 0, 0);
+ R_Mesh_Draw(0, 4, 0, 2, polygonelement3i, polygonelement3s, 0, 0);
r_refdef.stats.bloom_drawpixels += r_bloomstate.bloomwidth * r_bloomstate.bloomheight;
GL_BlendFunc(GL_ONE, GL_ONE);
R_Mesh_TexBind(0, R_GetTexture(r_texture_white));
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, 0, 2, NULL, polygonelements, 0, 0);
+ R_Mesh_Draw(0, 4, 0, 2, polygonelement3i, polygonelement3s, 0, 0);
r_refdef.stats.bloom_drawpixels += r_bloomstate.bloomwidth * r_bloomstate.bloomheight;
qglBlendEquationEXT(GL_FUNC_ADD_EXT);
GL_Color(1, 1, 1, cl.motionbluralpha);
R_Mesh_TexBind(0, R_GetTexture(r_bloomstate.texture_screen));
R_Mesh_TexCoordPointer(0, 2, r_bloomstate.screentexcoord2f, 0, 0);
- R_Mesh_Draw(0, 4, 0, 2, NULL, polygonelements, 0, 0);
+ R_Mesh_Draw(0, 4, 0, 2, polygonelement3i, polygonelement3s, 0, 0);
r_refdef.stats.bloom_drawpixels += r_refdef.view.viewport.width * r_refdef.view.viewport.height;
}
}
}
if (r_glsl_permutation->loc_Saturation >= 0)
qglUniform1fARB(r_glsl_permutation->loc_Saturation, r_glsl_saturation.value);
- R_Mesh_Draw(0, 4, 0, 2, NULL, polygonelements, 0, 0);
+ R_Mesh_Draw(0, 4, 0, 2, polygonelement3i, polygonelement3s, 0, 0);
r_refdef.stats.bloom_drawpixels += r_refdef.view.viewport.width * r_refdef.view.viewport.height;
return;
}
GL_BlendFunc(GL_ONE, GL_ONE);
R_Mesh_TexBind(0, R_GetTexture(r_bloomstate.texture_bloom));
R_Mesh_TexCoordPointer(0, 2, r_bloomstate.bloomtexcoord2f, 0, 0);
- R_Mesh_Draw(0, 4, 0, 2, NULL, polygonelements, 0, 0);
+ R_Mesh_Draw(0, 4, 0, 2, polygonelement3i, polygonelement3s, 0, 0);
r_refdef.stats.bloom_drawpixels += r_refdef.view.viewport.width * r_refdef.view.viewport.height;
}
else if (r_bloomstate.texture_bloom)
else
{
R_SetupGenericShader(true);
- R_Mesh_Draw(0, 4, 0, 2, NULL, polygonelements, 0, 0);
+ R_Mesh_Draw(0, 4, 0, 2, polygonelement3i, polygonelement3s, 0, 0);
r_refdef.stats.bloom_drawpixels += r_refdef.view.viewport.width * r_refdef.view.viewport.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, 0, 0);
}
- R_Mesh_Draw(0, 4, 0, 2, NULL, polygonelements, 0, 0);
+ R_Mesh_Draw(0, 4, 0, 2, polygonelement3i, polygonelement3s, 0, 0);
r_refdef.stats.bloom_drawpixels += r_refdef.view.viewport.width * r_refdef.view.viewport.height;
}
if (r_refdef.viewblend[3] >= (1.0f / 256.0f))
R_SetupGenericShader(false);
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, 0, 2, NULL, polygonelements, 0, 0);
+ R_Mesh_Draw(0, 4, 0, 2, polygonelement3i, polygonelement3s, 0, 0);
}
}
prog = prog_save;
}
-unsigned short nomodelelements[24] =
+static const int nomodelelement3i[24] =
{
5, 2, 0,
5, 1, 2,
1, 3, 4
};
-float nomodelvertex3f[6*3] =
+static const unsigned short nomodelelement3s[24] =
+{
+ 5, 2, 0,
+ 5, 1, 2,
+ 5, 0, 3,
+ 5, 3, 1,
+ 0, 2, 4,
+ 2, 1, 4,
+ 3, 0, 4,
+ 1, 3, 4
+};
+
+static const float nomodelvertex3f[6*3] =
{
-16, 0, 0,
16, 0, 0,
0, 0, 16
};
-float nomodelcolor4f[6*4] =
+static const float nomodelcolor4f[6*4] =
{
0.0f, 0.0f, 0.5f, 1.0f,
0.0f, 0.0f, 0.5f, 1.0f,
else
R_Mesh_ColorPointer(nomodelcolor4f, 0, 0);
R_Mesh_ResetTextureState();
- R_Mesh_Draw(0, 6, 0, 8, NULL, nomodelelements, 0, 0);
+ R_Mesh_Draw(0, 6, 0, 8, nomodelelement3i, nomodelelement3s, 0, 0);
}
void R_DrawNoModel(entity_render_t *ent)
R_Mesh_TexCoordPointer(0, 2, spritetexcoord2f, 0, 0);
// FIXME: fixed function path can't properly handle r_refdef.view.colorscale > 1
GL_Color(cr * fog * r_refdef.view.colorscale, cg * fog * r_refdef.view.colorscale, cb * fog * r_refdef.view.colorscale, ca);
- R_Mesh_Draw(0, 4, 0, 2, NULL, polygonelements, 0, 0);
+ R_Mesh_Draw(0, 4, 0, 2, polygonelement3i, polygonelement3s, 0, 0);
if (blendfunc2 == GL_ONE_MINUS_SRC_ALPHA)
{
GL_BlendFunc(blendfunc1, GL_ONE);
fog = 1 - fog;
GL_Color(r_refdef.fogcolor[0] * fog, r_refdef.fogcolor[1] * fog, r_refdef.fogcolor[2] * fog, ca);
- R_Mesh_Draw(0, 4, 0, 2, NULL, polygonelements, 0, 0);
+ R_Mesh_Draw(0, 4, 0, 2, polygonelement3i, polygonelement3s, 0, 0);
}
}
isvis ? 0.125f : 0.03125f);
for (i = 0, v = vertex3f;i < numpoints;i++, v += 3)
VectorCopy(portal->points[i].position, v);
- R_Mesh_Draw(0, numpoints, 0, numpoints - 2, NULL, polygonelements, 0, 0);
+ R_Mesh_Draw(0, numpoints, 0, numpoints - 2, polygonelement3i, polygonelement3s, 0, 0);
}
// LordHavoc: this is just a nice debugging tool, very slow
qglStencilFunc(GL_NOTEQUAL, 128, ~0);CHECKGLERROR
// apply the blend to the shadowed areas
- R_Mesh_Draw(0, 4, 0, 2, NULL, polygonelements, 0, 0);
+ R_Mesh_Draw(0, 4, 0, 2, polygonelement3i, polygonelement3s, 0, 0);
// restore the viewport
R_SetViewport(&r_refdef.view.viewport);
0, 0
};
-static const unsigned short skyboxelements[6*2*3] =
+static const int skyboxelement3i[6*2*3] =
+{
+ // skyside[3]
+ 0, 1, 2,
+ 0, 2, 3,
+ // skyside[1]
+ 4, 5, 6,
+ 4, 6, 7,
+ // skyside[0]
+ 8, 9, 10,
+ 8, 10, 11,
+ // skyside[2]
+ 12, 13, 14,
+ 12, 14, 15,
+ // skyside[4]
+ 16, 17, 18,
+ 16, 18, 19,
+ // skyside[5]
+ 20, 21, 22,
+ 20, 22, 23
+};
+
+static const unsigned short skyboxelement3s[6*2*3] =
{
// skyside[3]
0, 1, 2,
for (i = 0;i < 6;i++)
{
R_Mesh_TexBind(0, R_GetTexture(skyboxside[i]));
- R_Mesh_Draw(0, 6*4, i*2, 2, NULL, skyboxelements, 0, 0);
+ R_Mesh_Draw(0, 6*4, i*2, 2, skyboxelement3i, skyboxelement3s, 0, 0);
}
if(r_refdef.fogenabled)
for (i = 0;i < 6;i++)
{
R_Mesh_TexBind(0, 0);
- R_Mesh_Draw(0, 6*4, i*2, 2, NULL, skyboxelements, 0, 0);
+ R_Mesh_Draw(0, 6*4, i*2, 2, skyboxelement3i, skyboxelement3s, 0, 0);
}
}
#define skysphere_numtriangles (skygridx * skygridy * 2)
static float skysphere_vertex3f[skysphere_numverts * 3];
static float skysphere_texcoord2f[skysphere_numverts * 2];
-static unsigned short skysphere_elements[skysphere_numtriangles * 3];
+static int skysphere_element3i[skysphere_numtriangles * 3];
+static unsigned short skysphere_element3s[skysphere_numtriangles * 3];
static void skyspherecalc(void)
{
*vertex3f++ = v[2];
}
}
- e = skysphere_elements;
+ e = skysphere_element3s;
for (j = 0;j < skygridy;j++)
{
for (i = 0;i < skygridx;i++)
*e++ = (j + 1) * skygridx1 + i;
}
}
+ for (i = 0;i < skysphere_numtriangles*3;i++)
+ skysphere_element3i[i] = skysphere_element3s[i];
}
static void R_SkySphere(void)
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, 0, skysphere_numtriangles, NULL, skysphere_elements, 0, 0);
+ R_Mesh_Draw(0, skysphere_numverts, 0, skysphere_numtriangles, skysphere_element3i, skysphere_element3s, 0, 0);
GL_LockArrays(0, 0);
R_Mesh_TexBind(1, 0);
}
// two pass
R_SetupGenericShader(true);
GL_LockArrays(0, skysphere_numverts);
- R_Mesh_Draw(0, skysphere_numverts, 0, skysphere_numtriangles, NULL, skysphere_elements, 0, 0);
+ R_Mesh_Draw(0, skysphere_numverts, 0, skysphere_numtriangles, skysphere_element3i, skysphere_element3s, 0, 0);
GL_BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
R_Mesh_TexBind(0, R_GetTexture(r_refdef.scene.worldmodel->brush.alphaskytexture));
R_Mesh_TexMatrix(0, &scroll2matrix);
GL_LockArrays(0, skysphere_numverts);
- R_Mesh_Draw(0, skysphere_numverts, 0, skysphere_numtriangles, NULL, skysphere_elements, 0, 0);
+ R_Mesh_Draw(0, skysphere_numverts, 0, skysphere_numtriangles, skysphere_element3i, skysphere_element3s, 0, 0);
GL_LockArrays(0, 0);
}
GL_BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
GL_Color(r_refdef.fogcolor[0], r_refdef.fogcolor[1], r_refdef.fogcolor[2], 1 - r_refdef.fogmasktable[FOGMASKTABLEWIDTH-1]);
GL_LockArrays(0, skysphere_numverts);
- R_Mesh_Draw(0, skysphere_numverts, 0, skysphere_numtriangles, NULL, skysphere_elements, 0, 0);
+ R_Mesh_Draw(0, skysphere_numverts, 0, skysphere_numtriangles, skysphere_element3i, skysphere_element3s, 0, 0);
GL_LockArrays(0, 0);
}
}