r_refdef.drawqueuesize += dq->size;
}
+void DrawQ_Lines (drawqueuemesh_t *mesh, int flags)
+{
+ int size;
+ void *p;
+ drawqueue_t *dq;
+ drawqueuemesh_t *m;
+ size = sizeof(*dq);
+ size += sizeof(drawqueuemesh_t);
+ size += sizeof(int[3]) * mesh->num_triangles;
+ size += sizeof(float[3]) * mesh->num_vertices;
+ size += sizeof(float[2]) * mesh->num_vertices;
+ size += sizeof(float[4]) * mesh->num_vertices;
+ if (r_refdef.drawqueuesize + size > r_refdef.maxdrawqueuesize)
+ return;
+ dq = (void *)(r_refdef.drawqueue + r_refdef.drawqueuesize);
+ dq->size = size;
+ dq->command = DRAWQUEUE_LINES;
+ dq->flags = flags;
+ dq->color = 0;
+ dq->x = 0;
+ dq->y = 0;
+ dq->scalex = 0;
+ dq->scaley = 0;
+ p = (void *)(dq + 1);
+ m = p;p = (unsigned char*)p + sizeof(drawqueuemesh_t);
+ m->num_triangles = mesh->num_triangles;
+ m->num_vertices = mesh->num_vertices;
+ m->texture = mesh->texture;
+ m->data_element3i = p;memcpy(m->data_element3i , mesh->data_element3i , m->num_triangles * sizeof(int[3]));p = (unsigned char*)p + m->num_triangles * sizeof(int[3]);
+ m->data_vertex3f = p;memcpy(m->data_vertex3f , mesh->data_vertex3f , m->num_vertices * sizeof(float[3]));p = (unsigned char*)p + m->num_vertices * sizeof(float[3]);
+ m->data_texcoord2f = p;memcpy(m->data_texcoord2f, mesh->data_texcoord2f, m->num_vertices * sizeof(float[2]));p = (unsigned char*)p + m->num_vertices * sizeof(float[2]);
+ m->data_color4f = p;memcpy(m->data_color4f , mesh->data_color4f , m->num_vertices * sizeof(float[4]));p = (unsigned char*)p + m->num_vertices * sizeof(float[4]);
+ r_refdef.drawqueuesize += dq->size;
+}
+
+//LordHavoc: FIXME: this is nasty!
+void DrawQ_LineWidth (float width)
+{
+ drawqueue_t *dq;
+ static int linewidth = 1;
+ if(width == linewidth)
+ return;
+ linewidth = width;
+ if(r_refdef.drawqueuesize + (int)sizeof(*dq) > r_refdef.maxdrawqueuesize)
+ {
+ Con_DPrint("DrawQueue full !\n");
+ return;
+ }
+ dq = (void*) (r_refdef.drawqueue + r_refdef.drawqueuesize);
+ dq->size = sizeof(*dq);
+ dq->command = DRAWQUEUE_LINEWIDTH;
+ dq->x = width;
+
+ r_refdef.drawqueuesize += dq->size;
+}
+
+//[515]: this is old, delete
+void DrawQ_Line (float width, float x1, float y1, float x2, float y2, float r, float g, float b, float alpha, int flags)
+{
+ drawqueue_t *dq;
+ if(width > 0)
+ DrawQ_LineWidth(width);
+ if(r_refdef.drawqueuesize + (int)sizeof(*dq) > r_refdef.maxdrawqueuesize)
+ {
+ Con_DPrint("DrawQueue full !\n");
+ return;
+ }
+ dq = (void*) (r_refdef.drawqueue + r_refdef.drawqueuesize);
+ dq->size = sizeof(*dq);
+ dq->command = DRAWQUEUE_LINES;
+ dq->x = x1;
+ dq->y = y1;
+ dq->scalex = x2;
+ dq->scaley = y2;
+ dq->flags = flags;
+ dq->color = ((unsigned int) (r * 255.0f) << 24) | ((unsigned int) (g * 255.0f) << 16) | ((unsigned int) (b * 255.0f) << 8) | ((unsigned int) (alpha * 255.0f));
+
+ r_refdef.drawqueuesize += dq->size;
+}
+
void DrawQ_SetClipArea(float x, float y, float width, float height)
{
drawqueue_t * dq;
#define DRAWQUEUE_MESH 1
#define DRAWQUEUE_SETCLIP 2
#define DRAWQUEUE_RESETCLIP 3
+#define DRAWQUEUE_LINEWIDTH 4
+#define DRAWQUEUE_LINES 5
typedef struct drawqueue_s
{
void DrawQ_SetClipArea(float x, float y, float width, float height);
// reset the clipping area
void DrawQ_ResetClipArea(void);
+// draw a line
+void DrawQ_Line(float width, float x1, float y1, float x2, float y2, float r, float g, float b, float alpha, int flags);
void SHOWLMP_decodehide(void);
void SHOWLMP_decodeshow(void);
case DRAWQUEUE_RESETCLIP:
GL_ScissorTest(false);
break;
+ case DRAWQUEUE_LINEWIDTH:
+ qglLineWidth(x);
+ break;
+ case DRAWQUEUE_LINES:
+ mesh = (drawqueuemesh_t *)(dq + 1);
+ GL_Color(c[0], c[1], c[2], c[3]);
+ qglBegin(GL_LINE_LOOP);
+ for (num = 0;num < mesh->num_vertices;num++)
+ qglVertex2f(mesh->data_vertex3f[num*3+0], mesh->data_vertex3f[num*3+1]);
+ qglEnd();
+ break;
}
}
extern void (GLAPIENTRY *qglPolygonOffset)(GLfloat factor, GLfloat units);
+//[515]: added on 29.07.2005
+extern void (GLAPIENTRY *qglLineWidth)(GLfloat width);
+extern void (GLAPIENTRY *qglPointSize)(GLfloat size);
+
// GL_ARB_shader_objects
extern int gl_support_shader_objects;
#ifndef GL_PROGRAM_OBJECT_ARB
void (GLAPIENTRY *qglPolygonOffset)(GLfloat factor, GLfloat units);
+//[515]: added on 29.07.2005
+void (GLAPIENTRY *qglLineWidth)(GLfloat width);
+void (GLAPIENTRY *qglPointSize)(GLfloat size);
+
void (GLAPIENTRY *qglActiveStencilFaceEXT)(GLenum);
void (GLAPIENTRY *qglDeleteObjectARB)(GLhandleARB obj);
{"glVertex3f", (void **) &qglVertex3f},
{"glBegin", (void **) &qglBegin},
{"glEnd", (void **) &qglEnd},
+//[515]: added on 29.07.2005
+ {"glLineWidth", (void**) &qglLineWidth},
+ {"glPointSize", (void**) &qglPointSize},
+//
{"glMatrixMode", (void **) &qglMatrixMode},
{"glOrtho", (void **) &qglOrtho},
{"glFrustum", (void **) &qglFrustum},