mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-26 06:10:56 +00:00
[vulkan] Implement line graph rendering
I should probably just use the line rendering for all renderers and pull the graph drawing out to the client code.
This commit is contained in:
parent
74e64d7228
commit
2fb5b67012
3 changed files with 19 additions and 0 deletions
|
@ -85,4 +85,7 @@ void Vulkan_End2D (struct vulkan_ctx_s *ctx);
|
|||
void Vulkan_DrawReset (struct vulkan_ctx_s *ctx);
|
||||
void Vulkan_FlushText (struct qfv_renderframe_s *rFrame);
|
||||
|
||||
void Vulkan_LineGraph (int x, int y, int *h_vals, int count, int height,
|
||||
struct vulkan_ctx_s *ctx);
|
||||
|
||||
#endif//__QF_Vulkan_qf_draw_h
|
||||
|
|
|
@ -136,6 +136,7 @@ vulkan_R_NewScene (scene_t *scene)
|
|||
static void
|
||||
vulkan_R_LineGraph (int x, int y, int *h_vals, int count, int height)
|
||||
{
|
||||
Vulkan_LineGraph (x, y, h_vals, count, height, vulkan_ctx);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -1330,3 +1330,18 @@ Vulkan_Draw_FontString (int x, int y, int fontid, const char *str,
|
|||
RText_RenderText (shaper, &text, x, y, vulkan_render_glyph, &rgctx);
|
||||
RText_DeleteShaper (shaper);
|
||||
}
|
||||
|
||||
void
|
||||
Vulkan_LineGraph (int x, int y, int *h_vals, int count, int height,
|
||||
vulkan_ctx_t *ctx)
|
||||
{
|
||||
static int colors[] = { 0xd0, 0x4f, 0x6f };
|
||||
|
||||
while (count-- > 0) {
|
||||
int h = *h_vals++;
|
||||
int c = h < 9998 || h > 10000 ? 0xfe : colors[h - 9998];
|
||||
h = min (h, height);
|
||||
Vulkan_Draw_Line (x, y, x, y - h, c, ctx);
|
||||
x++;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue