unsigned short *data_sortedelement3s;
qboolean begin_active;
+ int begin_draw2d;
rtexture_t *begin_texture;
int begin_drawflag;
int begin_vertices;
R_EntityMatrix(&identitymatrix);
GL_CullFace(GL_NONE);
GL_DepthTest(true); // polys in 3D space shall always have depth test
- R_Mesh_VertexPointer(polys->data_vertex3f, 0, 0);
- R_Mesh_ColorPointer(polys->data_color4f, 0, 0);
- R_Mesh_TexCoordPointer(0, 2, polys->data_texcoord2f, 0, 0);
+ GL_DepthRange(0, 1);
for (surfacelistindex = 0;surfacelistindex < numsurfaces;)
{
if(polys->begin_color[i][3] < 1)
hasalpha = true;
- if (r_refdef.draw2dstage)
+ if (polys->begin_draw2d)
{
// draw the polygon as 2D immediately
drawqueuemesh_t mesh;
int i;
if (polys->max_triangles < polys->num_triangles + polys->begin_vertices-2)
{
- polys->max_triangles *= 2;
+ while (polys->max_triangles < polys->num_triangles + polys->begin_vertices-2)
+ polys->max_triangles *= 2;
VM_ResizePolygons(polys);
}
if (polys->num_vertices + polys->begin_vertices <= polys->max_vertices)
polys->num_vertices = 0; // otherwise it's not rendered at all and prints an error message --blub */
}
-//void(string texturename, float flag) R_BeginPolygon
+//void(string texturename, float flag[, float is2d]) R_BeginPolygon
void VM_CL_R_PolygonBegin (void)
{
const char *picname;
// better management of flags, and is more suited for 3D rendering), what
// about supporting Q3 shaders?
- VM_SAFEPARMCOUNT(2, VM_CL_R_PolygonBegin);
+ VM_SAFEPARMCOUNTRANGE(2, 3, VM_CL_R_PolygonBegin);
if (!polys->initialized)
VM_InitPolygons(polys);
polys->begin_drawflag = (int)PRVM_G_FLOAT(OFS_PARM1) & DRAWFLAG_MASK;
polys->begin_vertices = 0;
polys->begin_active = true;
+ polys->begin_draw2d = (prog->argc >= 3 ? (int)PRVM_G_FLOAT(OFS_PARM2) : r_refdef.draw2dstage);
}
//void(vector org, vector texcoords, vector rgb, float alpha) R_PolygonVertex
VM_CL_R_SetView, // #303 float(float property, ...) setproperty (EXT_CSQC)
VM_CL_R_RenderScene, // #304 void() renderscene (EXT_CSQC)
VM_CL_R_AddDynamicLight, // #305 void(vector org, float radius, vector lightcolours) adddynamiclight (EXT_CSQC)
-VM_CL_R_PolygonBegin, // #306 void(string texturename, float flag[, float is2d, float lines]) R_BeginPolygon
+VM_CL_R_PolygonBegin, // #306 void(string texturename, float flag, float is2d[NYI: , float lines]) R_BeginPolygon
VM_CL_R_PolygonVertex, // #307 void(vector org, vector texcoords, vector rgb, float alpha) R_PolygonVertex
VM_CL_R_PolygonEnd, // #308 void() R_EndPolygon
NULL /* R_LoadWorldModel in menu VM, should stay unassigned in client*/, // #309