[gl] extracted some common GPU rendering code

This commit is contained in:
Edu García
2024-05-08 18:03:44 +01:00
parent f1941de990
commit 558b9bb120
2 changed files with 33 additions and 32 deletions

View File

@@ -2482,38 +2482,6 @@ ddgr_color rend_GetPixel(int x, int y) {
return color[0];
}
void rend_FillCircle(ddgr_color col, int x, int y, int rad) {}
void rend_DrawCircle(int x, int y, int rad) {}
// Sets up a font character to draw. We draw our fonts as pieces of textures
void rend_DrawFontCharacter(int bm_handle, int x1, int y1, int x2, int y2, float u, float v, float w, float h) {
g3Point *ptr_pnts[4];
g3Point pnts[4];
for (int i = 0; i < 4; i++) {
pnts[i].p3_z = 1; // Make REALLY close!
pnts[i].p3_flags = PF_PROJECTED;
ptr_pnts[i] = &pnts[i];
}
pnts[0].p3_sx = x1;
pnts[0].p3_sy = y1;
pnts[0].p3_u = u;
pnts[0].p3_v = v;
pnts[1].p3_sx = x2;
pnts[1].p3_sy = y1;
pnts[1].p3_u = u + w;
pnts[1].p3_v = v;
pnts[2].p3_sx = x2;
pnts[2].p3_sy = y2;
pnts[2].p3_u = u + w;
pnts[2].p3_v = v + h;
pnts[3].p3_sx = x1;
pnts[3].p3_sy = y2;
pnts[3].p3_u = u;
pnts[3].p3_v = v + h;
rend_DrawPolygon2D(bm_handle, ptr_pnts, 4);
}
// Draws a line
void rend_DrawLine(int x1, int y1, int x2, int y2) {
sbyte atype;
@@ -2535,6 +2503,7 @@ void rend_DrawLine(int x1, int y1, int x2, int y2) {
rend_SetLighting(LS_NONE);
rend_SetTextureType(TT_FLAT);
// TODO: Generalize
dglBegin(GL_LINES);
dglColor4ub(r, g, b, 255);
dglVertex2i(x1 + gpu_state.clip_x1, y1 + gpu_state.clip_y1);