[glsl] Implement line graph drawing

Finally :/
This commit is contained in:
Bill Currie 2022-12-02 10:51:41 +09:00
parent baed4bb160
commit 958b6ff1d8
5 changed files with 16 additions and 7 deletions

View file

@ -46,6 +46,7 @@ void glsl_Draw_CrosshairAt (int ch, int x, int y);
void glsl_Draw_TileClear (int x, int y, int w, int h); void glsl_Draw_TileClear (int x, int y, int w, int h);
void glsl_Draw_Fill (int x, int y, int w, int h, int c); void glsl_Draw_Fill (int x, int y, int w, int h, int c);
void glsl_Draw_Line (int x0, int y0, int x1, int y1, int c); void glsl_Draw_Line (int x0, int y0, int x1, int y1, int c);
void glsl_LineGraph (int x, int y, int *h_vals, int count, int height);
void glsl_Draw_TextBox (int x, int y, int width, int lines, byte alpha); void glsl_Draw_TextBox (int x, int y, int width, int lines, byte alpha);
void glsl_Draw_FadeScreen (void); void glsl_Draw_FadeScreen (void);
void glsl_Draw_BlendScreen (quat_t color); void glsl_Draw_BlendScreen (quat_t color);

View file

@ -36,6 +36,5 @@ void glsl_R_RenderEntities (struct entqueue_s *queue);
void glsl_R_RenderView (void); void glsl_R_RenderView (void);
void glsl_R_ClearState (void); void glsl_R_ClearState (void);
void glsl_R_ViewChanged (void); void glsl_R_ViewChanged (void);
void glsl_R_LineGraph (int x, int y, int *h_vals, int count, int height);
#endif//__QF_GLSL_qf_main_h #endif//__QF_GLSL_qf_main_h

View file

@ -737,6 +737,20 @@ glsl_Draw_Line (int x0, int y0, int x1, int y1, int c)
memcpy (v, verts, size); memcpy (v, verts, size);
} }
void
glsl_LineGraph (int x, int y, int *h_vals, int count, int height)
{
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);
glsl_Draw_Line (x, y, x, y - h, c);
x++;
}
}
static inline void static inline void
draw_blendscreen (quat_t color) draw_blendscreen (quat_t color)
{ {

View file

@ -210,11 +210,6 @@ glsl_R_NewScene (scene_t *scene)
glsl_R_BuildDisplayLists (scene->models, scene->num_models); glsl_R_BuildDisplayLists (scene->models, scene->num_models);
} }
void
glsl_R_LineGraph (int x, int y, int *h_vals, int count, int height)
{
}
void void
glsl_R_ClearState (void) glsl_R_ClearState (void)
{ {

View file

@ -476,7 +476,7 @@ vid_render_funcs_t glsl_vid_render_funcs = {
.R_ClearState = glsl_R_ClearState, .R_ClearState = glsl_R_ClearState,
.R_LoadSkys = glsl_R_LoadSkys, .R_LoadSkys = glsl_R_LoadSkys,
.R_NewScene = glsl_R_NewScene, .R_NewScene = glsl_R_NewScene,
.R_LineGraph = glsl_R_LineGraph, .R_LineGraph = glsl_LineGraph,
.begin_frame = glsl_begin_frame, .begin_frame = glsl_begin_frame,
.render_view = glsl_render_view, .render_view = glsl_render_view,
.draw_particles = glsl_R_DrawParticles, .draw_particles = glsl_R_DrawParticles,