switched to command based rendering
[fishladder.git] / fishladder_resources.h
index ddc1f00926e05f19549a32aed40f8dd6c55dc413..7b12859d44f94bb993c23fab06b9dd5627826e4f 100644 (file)
@@ -124,8 +124,11 @@ vg_tex2d tex_ball_noise =  { .path = "textures/bnoise.qoi" };
 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
 // ===========================================================================================================
@@ -463,6 +466,7 @@ SHADER_DEFINE( shader_background,
                "vec4 data_this_tile = texture( uTexMain, aTexCoords );"
                
                "ao_accum -= data_this_tile.r;"
+               "ao_accum *= uVisibility;"
                
                "vec3 colour_main = mix( vec3( 0.369768, 0.3654, 0.42 ), vec3( 0.275, 0.388, 0.553 ), data_this_tile.g * uVisibility );"
                
@@ -599,7 +603,6 @@ SHADER_DEFINE( shader_sdf,
        "out vec4 FragColor;"
        ""
        "in vec2 aTexCoords;"
-       "in vec4 aColour;"
        ""
        "void main()"
        "{"
@@ -611,6 +614,40 @@ SHADER_DEFINE( shader_sdf,
        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 );
@@ -899,18 +936,47 @@ static struct cmp_level cmp_levels_grad[] =
                .map_name = "cmp_grad",
                .description = "",
 
-               ._linked = 22
+               ._linked = 22,
+               ._unlock = 23
        },
        // r2 GM
        {
                .serial_id = 22,
                .title = "SECRET CODE",
                .map_name = "cmp_secret",
+               .description = "",
+
+               ._unlock = 23
+       }
+};
+
+static struct cmp_level cmp_levels_computer[] = 
+{
+       {
+               .serial_id = 23,
+               .title = "3 BIT BINARY",
+               .map_name = "cmp_binary",
+               .description = "",
+               
+               ._unlock = 24
+       },
+       {
+               .serial_id = 24,
+               .title = "3 BIT ADDITION",
+               .map_name = "cmp_add3b",
+               .description = "",
+
+               ._unlock = 25
+       },
+       {
+               .serial_id = 25,
+               .title = "3x3 PLOT",
+               .map_name = "cmp_plot3x3",
                .description = ""
        }
 };
 
-#define NUM_CAMPAIGN_LEVELS (vg_list_size( cmp_levels_tutorials ) + vg_list_size( cmp_levels_basic ) + vg_list_size( cmp_levels_grad ))
+#define NUM_CAMPAIGN_LEVELS (vg_list_size( cmp_levels_tutorials ) + vg_list_size( cmp_levels_basic ) + vg_list_size( cmp_levels_grad ) + vg_list_size( cmp_levels_computer ) )
 
 static struct career_level_pack 
 {
@@ -935,14 +1001,21 @@ career_packs[] =
                .count = vg_list_size( cmp_levels_basic ),
                .primary_colour = { 0.304f, 0.245f, 0.553f },
                .origin = { -3, 0 },
-               .dims = { 3, 6 }
+               .dims = { 3, 5 }
        },
        {
                .pack = cmp_levels_grad,
                .count = vg_list_size( cmp_levels_grad ),
                .primary_colour = { 0.553f, 0.345f, 0.204f },
-               .origin = { -5, 7 },
+               .origin = { -5, 6 },
                .dims = { 4, 1 }
+       },
+       {
+               .pack = cmp_levels_computer,
+               .count = vg_list_size( cmp_levels_computer ),
+               .primary_colour = { 0.75f, 0.23f, 0.39f },
+               .origin = { -5, 8 },
+               .dims = { 5, 1 }
        }
 };