From: hgn Date: Sun, 12 Nov 2023 20:53:57 +0000 (+0000) Subject: shape glyphs, ui drawcall colour X-Git-Url: https://harrygodden.com/git/?p=vg.git;a=commitdiff_plain;h=aa880cfc4ba86b43338c21df307b484a5ce230c9 shape glyphs, ui drawcall colour --- diff --git a/src/fonts/vg_font_thin.png b/src/fonts/vg_font_thin.png index f03727a..82d031a 100644 Binary files a/src/fonts/vg_font_thin.png and b/src/fonts/vg_font_thin.png differ diff --git a/src/fonts/vg_font_thin.xcf b/src/fonts/vg_font_thin.xcf index 9d991f0..80cf62f 100644 Binary files a/src/fonts/vg_font_thin.xcf and b/src/fonts/vg_font_thin.xcf differ diff --git a/vg_imgui.h b/vg_imgui.h index 0a83a53..53d8472 100644 --- a/vg_imgui.h +++ b/vg_imgui.h @@ -220,6 +220,8 @@ struct{ cursor; SDL_Cursor *cursor_map[ k_ui_cursor_max ]; + + v4f colour; } static vg_ui = { .scheme = { @@ -258,7 +260,8 @@ static vg_ui = { [ k_ui_purple + k_ui_brighter ] = UI_RGB( 0xd3869b ), [ k_ui_gray + k_ui_brighter ] = UI_RGB( 0xa89984 ), }, - .font = &vg_ui_font_small + .font = &vg_ui_font_small, + .colour = {1.0f,1.0f,1.0f,1.0f} }; static struct vg_shader _shader_ui = @@ -292,6 +295,7 @@ static struct vg_shader _shader_ui = .orig_file = NULL, .static_src = "uniform sampler2D uTexGlyphs;" + "uniform vec4 uColour;" "out vec4 FragColor;" "" "in vec2 aTexCoords;" @@ -309,7 +313,7 @@ static struct vg_shader _shader_ui = "diffuse.a = texture( uTexGlyphs, aTexCoords ).r;" "}" - "FragColor = diffuse;" + "FragColor = diffuse * uColour;" "}" } }; @@ -344,6 +348,7 @@ static struct vg_shader _shader_ui_image = { .orig_file = NULL, .static_src = "uniform sampler2D uTexImage;" + "uniform vec4 uColour;" "out vec4 FragColor;" "in vec2 aTexCoords;" @@ -353,7 +358,7 @@ static struct vg_shader _shader_ui_image = { "void main()" "{" "vec4 colour = texture( uTexImage, aTexCoords );" - "FragColor = colour;" + "FragColor = colour * uColour;" "}" } }; @@ -512,6 +517,8 @@ static void ui_flush( enum ui_shader shader ){ glUniformMatrix3fv( glGetUniformLocation( _shader_ui.id, "uPv" ), 1, GL_FALSE, (float *)view ); + glUniform4fv( glGetUniformLocation( _shader_ui.id, "uColour" ), 1, + vg_ui.colour ); glActiveTexture( GL_TEXTURE0 ); glBindTexture( GL_TEXTURE_2D, vg_ui.tex_glyphs ); @@ -522,6 +529,8 @@ static void ui_flush( enum ui_shader shader ){ glUniformMatrix3fv( glGetUniformLocation( _shader_ui_image.id, "uPv" ), 1, GL_FALSE, (float *)view ); glUniform1i( glGetUniformLocation(_shader_ui_image.id,"uTexImage"), 0 ); + glUniform4fv( glGetUniformLocation( _shader_ui_image.id, "uColour" ), 1, + vg_ui.colour ); } else vg_fatal_error( "Invalid UI shader (%d)\n", shader ); diff --git a/vg_pxfont_thin.h b/vg_pxfont_thin.h index 198c9cd..96a6bc1 100644 --- a/vg_pxfont_thin.h +++ b/vg_pxfont_thin.h @@ -1,4 +1,4 @@ -/* Font buffer generated from source file: 'vg/src/fonts/vg_font_thin.png' */ +/* Font buffer generated from source file: 'src/fonts/vg_font_thin.png' */ 0xc3002800,0x8000020,0x8100000,0,0,0,0,0, 0x81102800,0x1c000020,0x10080010,0x2,0x3c103c7c,0x407c387c,0x38380000,0, 0x102822,0x22202020,0x20040010,0x2,0x46304208,0x48404404,0x44440000,0x38, @@ -58,13 +58,13 @@ 0,0,0,0,0,0,0,0, 0,0x40700,0,0,0,0,0,0, 0xdc,0x87300,0,0,0,0,0,0, -0xe8000090,0x104500,0,0,0,0,0,0, -0xa80000dc,0x6c104800,0,0,0,0,0,0, -0xe8002284,0xaa104200,0,0,0,0,0,0, -0xae0042dc,0xaa0e4200,0,0,0,0,0,0, -0x429e00,0xaa007e00,0,0,0,0,0,0, -0xe0424070,0xee000000,0,0,0,0,0,0, -0x407e2040,0x82000000,0,0,0,0,0,0, +0xe8000090,0x1045fe,0x10380000,0,0,0,0,0, +0xa80000dc,0x6c1048fe,0x387c0000,0,0,0,0,0, +0xe8002284,0xaa1042fe,0x38fe0000,0,0,0,0,0, +0xae0042dc,0xaa0e42fe,0x7cfe0000,0,0,0,0,0, +0x429e00,0xaa007efe,0x7cfe0000,0,0,0,0,0, +0xe0424070,0xee0000fe,0xfe7c0000,0,0,0,0,0, +0x407e2040,0x820000fe,0xfe380000,0,0,0,0,0, 0x40000070,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, @@ -213,17 +213,17 @@ 0,0,0x8,0,0,0,0,0, 0,0,0x10,0x1e00000,0,0,0,0, 0,0,0x20,0x7c600000,0,0,0,0, -0,0,0x40,0x60a00000,0,0,0,0, -0,0,0x80,0x61200000,0,0,0,0, -0xc01b800,0,0x738080,0x62000000,0,0,0,0, -0x12021000,0,0x924080,0x60400000,0,0,0,0, -0x21021000,0x1040,0x924040,0x60400000,0,0,0,0, -0x40819024,0xe0002042,0x6692403c,0x60400000,0,0,0,0, -0x80400054,0x40004044,0x88924000,0x7fc00000,0,0,0,0, -0x8041a054,0x40008f86,0x48924000,0x7fc00000,0,0,0,0, -0xf3c22074,0x44044004,0x28f3c000,0,0,0,0,0, -0x12022053,0x44042002,0xc6804000,0,0,0,0,0, -0x12021800,0x7fc1000,0x804000,0,0,0,0,0, +0,0,0x40,0x60a0000c,0x3f00000,0,0,0, +0,0,0x80,0x612ffc1e,0x7f80000,0,0,0, +0xc01b800,0,0x738080,0x620ffc1e,0xffc0000,0,0,0, +0x12021000,0,0x924080,0x604ffc3f,0xffc0000,0,0,0, +0x21021000,0x1040,0x924040,0x604ffc3f,0xffc0000,0,0,0, +0x40819024,0xe0002042,0x6692403c,0x604ffc7f,0x8ffc0000,0,0,0, +0x80400054,0x40004044,0x88924000,0x7fcffc7f,0x8ffc0000,0,0,0, +0x8041a054,0x40008f86,0x48924000,0x7fcffc7f,0x8ffc0000,0,0,0, +0xf3c22074,0x44044004,0x28f3c000,0xffcff,0xcffc0000,0,0,0, +0x12022053,0x44042002,0xc6804000,0xffcff,0xc7f80000,0,0,0, +0x12021800,0x7fc1000,0x804000,0xffcff,0xc3f00000,0,0,0, 0x1e000000,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,