diff --git a/data/shaders/alpha_mask.frag b/data/shaders/alpha_mask.frag deleted file mode 100644 index d8fc3a2..0000000 --- a/data/shaders/alpha_mask.frag +++ /dev/null @@ -1,22 +0,0 @@ - -in vec4 color; -in vec2 texCoord; -out vec4 fragColor; - -uniform sampler2D tex; -uniform sampler2D mask_tex; - -uniform float offset_x; -uniform float offset_y; -uniform float resolution_x; -uniform float resolution_y; -uniform float mask_resolution_x; -uniform float mask_resolution_y; - -void main(void) -{ - vec4 col = texture2D(tex, texCoord); - vec2 mask_coords = vec2((texCoord.x*resolution_x + offset_x)/mask_resolution_x, (texCoord.y*resolution_y + offset_y)/mask_resolution_y); - vec4 mask = texture2D(mask_tex, mask_coords); - fragColor = vec4(col.rgb, col.a*mask.a); -} \ No newline at end of file diff --git a/data/shaders/crt-simple.frag b/data/shaders/crt-simple.frag new file mode 100644 index 0000000..0aaca13 --- /dev/null +++ b/data/shaders/crt-simple.frag @@ -0,0 +1,23 @@ +varying vec4 color; +varying vec2 texCoord; + +uniform sampler2D tex; +uniform vec4 myColor; + +out vec4 fragColor; + +void main(void) +{ + vec4 c = myColor * color; + + vec4 rgba = texture2D(tex, texCoord); + vec4 intensity; + + if(fract(gl_FragCoord.y * (0.5 * 4.0 / 3.0)) > 0.5) { + intensity = vec4(0); + } else { + intensity = smoothstep(0.2, 0.8, rgba) + normalize(rgba); + } + + fragColor = intensity * -0.25 + rgba * 1.1; +} \ No newline at end of file diff --git a/data/shaders/marching_ants.frag b/data/shaders/marching_ants.frag deleted file mode 100644 index d36186c..0000000 --- a/data/shaders/marching_ants.frag +++ /dev/null @@ -1,51 +0,0 @@ - -in vec4 color; -in vec2 texCoord; -out vec4 fragColor; - -uniform sampler2D tex; - -uniform float resolution_x; -uniform float resolution_y; - -uniform float screen_w; -uniform float screen_h; - -uniform float time; -uniform float zoom; - -void main(void) -{ - float x_offset = 1.0/(screen_w*zoom) + 1.0/(resolution_x*zoom); - float y_offset = 1.0/(screen_h*zoom) + 1.0/(resolution_y*zoom); - - vec4 center = texture2D(tex, texCoord); - vec4 left = texture2D(tex, vec2(texCoord.s - x_offset, texCoord.t)); - vec4 right = texture2D(tex, vec2(texCoord.s + x_offset, texCoord.t)); - vec4 up = texture2D(tex, vec2(texCoord.s, texCoord.t - y_offset)); - vec4 down = texture2D(tex, vec2(texCoord.s, texCoord.t + y_offset)); - - bool is_image_edge = (texCoord.s - x_offset < 0 || texCoord.s + x_offset > 1 || texCoord.t - y_offset < 0 || texCoord.t + y_offset > 1); - - if(left.a != right.a || left.a != up.a || left.a != down.a || (center.a > 0.5 && is_image_edge)) - { - if(center.a > 0.5) - { - float speed = 0.6; - float ant_size = 10; - float black_to_white_ratio = 0.5; - float ant_position = (gl_FragCoord.x + gl_FragCoord.y); - float t = step(black_to_white_ratio, mod(time*speed + ant_position/ant_size, 1.0)); - - fragColor = vec4(t, t, t, 1); - } - else - fragColor = vec4(1, 1, 1, 1); - } - else if(center.a < 0.5) - { - fragColor = vec4(0, 0, 0, 0.1); - } - else - discard; -} \ No newline at end of file diff --git a/data/shaders/untextured.frag b/data/shaders/untextured.frag deleted file mode 100644 index 40ffe59..0000000 --- a/data/shaders/untextured.frag +++ /dev/null @@ -1,8 +0,0 @@ -#version 120 - -varying vec4 color; - -void main(void) -{ - gl_FragColor = color; -} \ No newline at end of file diff --git a/data/shaders/untextured.vert b/data/shaders/untextured.vert deleted file mode 100644 index 54aae53..0000000 --- a/data/shaders/untextured.vert +++ /dev/null @@ -1,13 +0,0 @@ -#version 120 - -attribute vec3 gpu_Vertex; -attribute vec4 gpu_Color; -uniform mat4 gpu_ModelViewProjectionMatrix; - -varying vec4 color; - -void main(void) -{ - color = gpu_Color; - gl_Position = gpu_ModelViewProjectionMatrix * vec4(gpu_Vertex, 1.0); -} \ No newline at end of file diff --git a/src/system.c b/src/system.c index 823ad5d..bfd8f68 100644 --- a/src/system.c +++ b/src/system.c @@ -13,7 +13,7 @@ #include #endif -#define STUDIO_UI_SCALE 3 +#define STUDIO_UI_SCALE 4 #define STUDIO_PIXEL_FORMAT SDL_PIXELFORMAT_ARGB8888 #define TEXTURE_SIZE (TIC80_FULLWIDTH) #define OFFSET_LEFT ((TIC80_FULLWIDTH-TIC80_WIDTH)/2) @@ -1120,7 +1120,7 @@ static s32 start(s32 argc, char **argv, const char* folder) GPU_Image* texture = GPU_CreateImage(TIC80_FULLWIDTH, TIC80_FULLHEIGHT, GPU_FORMAT_BGRA); s32 color_shader = 0; - GPU_ShaderBlock color_block = load_shader_program(&color_shader, "data/shaders/common.vert", "data/shaders/color.frag"); + GPU_ShaderBlock color_block = load_shader_program(&color_shader, "data/shaders/common.vert", "data/shaders/crt-simple.frag"); int color_loc = GPU_GetUniformLocation(color_shader, "myColor"); { @@ -1148,8 +1148,8 @@ static s32 start(s32 argc, char **argv, const char* folder) GPU_ActivateShaderProgram(color_shader, &color_block); update_color_shader((1+sin(t))/2, (1+sin(t+1))/2, (1+sin(t+2))/2, 1.0f, color_loc); - // GPU_BlitScale(texture, NULL, screen, TIC80_FULLWIDTH/2*STUDIO_UI_SCALE, TIC80_FULLHEIGHT/2*STUDIO_UI_SCALE, STUDIO_UI_SCALE, STUDIO_UI_SCALE); - GPU_Blit(texture, NULL, screen, TIC80_FULLWIDTH/2*STUDIO_UI_SCALE, TIC80_FULLHEIGHT/2*STUDIO_UI_SCALE); + GPU_BlitScale(texture, NULL, screen, TIC80_FULLWIDTH/2*STUDIO_UI_SCALE, TIC80_FULLHEIGHT/2*STUDIO_UI_SCALE, STUDIO_UI_SCALE, STUDIO_UI_SCALE); + // GPU_Blit(texture, NULL, screen, TIC80_FULLWIDTH/2*STUDIO_UI_SCALE, TIC80_FULLHEIGHT/2*STUDIO_UI_SCALE); GPU_Flip(screen);