no message
This commit is contained in:
parent
800e6fdfb9
commit
e98573ac1c
|
@ -1,11 +0,0 @@
|
|||
varying vec4 color;
|
||||
varying vec2 texCoord;
|
||||
|
||||
uniform sampler2D tex;
|
||||
uniform vec4 myColor;
|
||||
|
||||
void main(void)
|
||||
{
|
||||
vec4 c = myColor * color;
|
||||
gl_FragColor = texture2D(tex, texCoord) * c;
|
||||
}
|
|
@ -1,23 +1,16 @@
|
|||
varying vec4 color;
|
||||
varying vec2 texCoord;
|
||||
in vec4 color;
|
||||
in vec2 texCoord;
|
||||
out vec4 fragColor;
|
||||
|
||||
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);
|
||||
}
|
||||
vec4 intensity = fract(gl_FragCoord.y * (0.5 * 4.0 / 3.0)) > 0.5
|
||||
? vec4(0)
|
||||
: smoothstep(0.2, 0.8, rgba) + normalize(rgba);
|
||||
|
||||
fragColor = intensity * -0.25 + rgba * 1.1;
|
||||
fragColor = intensity * -0.25 + rgba * 1.1;
|
||||
}
|
19
src/system.c
19
src/system.c
|
@ -1093,12 +1093,6 @@ void free_shader(Uint32 p)
|
|||
GPU_FreeShaderProgram(p);
|
||||
}
|
||||
|
||||
void update_color_shader(float r, float g, float b, float a, int color_loc)
|
||||
{
|
||||
float fcolor[4] = {r, g, b, a};
|
||||
GPU_SetUniformfv(color_loc, 4, 1, fcolor);
|
||||
}
|
||||
|
||||
#include <math.h>
|
||||
|
||||
static s32 start(s32 argc, char **argv, const char* folder)
|
||||
|
@ -1119,9 +1113,9 @@ static s32 start(s32 argc, char **argv, const char* folder)
|
|||
GPU_Target* screen = GPU_Init(TIC80_FULLWIDTH * STUDIO_UI_SCALE, TIC80_FULLHEIGHT * STUDIO_UI_SCALE, GPU_INIT_DISABLE_VSYNC);
|
||||
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/crt-simple.frag");
|
||||
int color_loc = GPU_GetUniformLocation(color_shader, "myColor");
|
||||
u32 crt_shader = 0;
|
||||
GPU_ShaderBlock crt_block = load_shader_program(&crt_shader, "data/shaders/common.vert", "data/shaders/crt-simple.frag");
|
||||
GPU_ActivateShaderProgram(crt_shader, &crt_block);
|
||||
|
||||
{
|
||||
u64 nextTick = SDL_GetPerformanceCounter();
|
||||
|
@ -1136,8 +1130,6 @@ static s32 start(s32 argc, char **argv, const char* folder)
|
|||
{
|
||||
pollEvent();
|
||||
|
||||
float t = SDL_GetTicks()/1000.0f;
|
||||
|
||||
GPU_Clear(screen);
|
||||
|
||||
{
|
||||
|
@ -1145,9 +1137,6 @@ static s32 start(s32 argc, char **argv, const char* folder)
|
|||
GPU_UpdateImageBytes(texture, NULL, (const u8*)tic->screen, TIC80_FULLWIDTH * sizeof(u32));
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
|
@ -1175,6 +1164,8 @@ static s32 start(s32 argc, char **argv, const char* folder)
|
|||
|
||||
SDL_CloseAudioDevice(platform.audio.device);
|
||||
|
||||
free_shader(crt_shader);
|
||||
|
||||
GPU_FreeImage(texture);
|
||||
|
||||
GPU_Quit();
|
||||
|
|
Loading…
Reference in New Issue