vg_tex2d tex_monofur = { .path = "textures/ascii.qoi", .flags = VG_TEXTURE_NO_MIP };
vg_tex2d tex_unkown = { .path = "textures/unkown.qoi" };
vg_tex2d tex_buttons = { .path = "textures/buttons.qoi" };
+vg_tex2d tex_sprites = { .path = "textures/autocombine.qoi" };
-vg_tex2d *texture_list[] = { &tex_tile_detail, &tex_tile_data, &tex_wood, &tex_ball_noise, &tex_monofur, &tex_unkown, &tex_buttons, &tex_ubuntu };
+vg_tex2d *texture_list[] = { &tex_tile_detail, &tex_tile_data, &tex_wood, &tex_ball_noise, &tex_monofur, &tex_unkown, &tex_buttons, &tex_ubuntu, &tex_sprites };
+
+#include "sprites_autocombine.h"
// AUDIO
// ===========================================================================================================
"out vec4 FragColor;"
""
"in vec2 aTexCoords;"
- "in vec4 aColour;"
""
"void main()"
"{"
UNIFORMS({ "uPv", "uTexGlyphs", "uColour" })
)
+SHADER_DEFINE( shader_sprite,
+
+ // VERTEX
+ "layout (location=0) in vec2 a_co;" // quad mesh
+ "layout (location=1) in vec4 ins_uv;" // instanced data (uv)
+ "layout (location=2) in vec3 ins_pos;" // position + scale
+ ""
+ "uniform mat3 uPv;"
+ ""
+ "out vec2 aTexCoords;"
+ ""
+ "void main()"
+ "{"
+ "vec2 vertex_world = ins_uv.zw * a_co * ins_pos.z + ins_pos.xy;"
+ "gl_Position = vec4( uPv * vec3( vertex_world, 1.0 ), 1.0 );"
+ "aTexCoords = ins_uv.xy + (a_co+0.5)*ins_uv.zw;"
+ "}",
+
+ // FRAGMENT
+ "uniform sampler2D uTexMain;"
+ "uniform vec4 uColour;"
+ "out vec4 FragColor;"
+ ""
+ "in vec2 aTexCoords;"
+ ""
+ "void main()"
+ "{"
+ "vec4 glyph = texture( uTexGlyphs, aTexCoords );"
+ "FragColor = glyph;"
+ "}"
+ ,
+ UNIFORMS({ "uPv", "uTexMain", "uColour" })
+)
+
void vg_register(void)
{
SHADER_INIT( shader_tile_colour );