diff --git a/gfx/drivers/gl_shaders/pipeline_snowflake.glsl.frag.h b/gfx/drivers/gl_shaders/pipeline_snowflake.glsl.frag.h new file mode 100644 index 00000000000..f2bd97f6dfe --- /dev/null +++ b/gfx/drivers/gl_shaders/pipeline_snowflake.glsl.frag.h @@ -0,0 +1,65 @@ +/* credits to: TheTimJames + https://www.shadertoy.com/view/Md2GRw +*/ + +#include "shaders_common.h" + +static const char* stock_fragment_xmb_snowflake = GLSL( + uniform float time; + uniform float atime; + uniform vec2 OutputSize; + vec2 uv; + + float rand(vec2 co) + { + return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453); + } + + float snow(vec3 pos, vec2 uv, float o) + { + vec2 d = (pos.xy - uv); + float a = atan(d.y,d.x)+sin(atime*1.+o)*10.; + + float dist = d.x*d.x + d.y*d.y; + + if(dist < pos.z/400.){ + float col = 0.0; + if(sin(a*8.) < 0.0){col=1.0;} + if(distprg[VIDEO_SHADER_MENU_5].id, &glsl->uniforms[VIDEO_SHADER_MENU_5]); + +#if defined(HAVE_OPENGLES) + shader_prog_info.vertex = stock_vertex_xmb_snow_modern; +#else + shader_prog_info.vertex = glsl_core ? stock_vertex_xmb_snow_modern : stock_vertex_xmb_snow_legacy; +#endif + shader_prog_info.fragment = stock_fragment_xmb_snowflake; + + gl_glsl_compile_program( + glsl, + VIDEO_SHADER_MENU_6, + &glsl->prg[VIDEO_SHADER_MENU_6], + &shader_prog_info); + gl_glsl_find_uniforms(glsl, 0, glsl->prg[VIDEO_SHADER_MENU_6].id, + &glsl->uniforms[VIDEO_SHADER_MENU_6]); #endif gl_glsl_reset_attrib(glsl); diff --git a/gfx/video_driver.h b/gfx/video_driver.h index 0267c11e6d4..6836ede8176 100644 --- a/gfx/video_driver.h +++ b/gfx/video_driver.h @@ -56,6 +56,7 @@ #define VIDEO_SHADER_MENU_3 (GFX_MAX_SHADERS - 4) #define VIDEO_SHADER_MENU_4 (GFX_MAX_SHADERS - 5) #define VIDEO_SHADER_MENU_5 (GFX_MAX_SHADERS - 6) +#define VIDEO_SHADER_MENU_6 (GFX_MAX_SHADERS - 7) #endif diff --git a/intl/msg_hash_us.h b/intl/msg_hash_us.h index 5fb03ee34b6..25a36dda4fe 100644 --- a/intl/msg_hash_us.h +++ b/intl/msg_hash_us.h @@ -2542,6 +2542,8 @@ MSG_HASH( ) MSG_HASH(MENU_ENUM_LABEL_VALUE_SHADER_PIPELINE_BOKEH, "Bokeh") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SHADER_PIPELINE_SNOWFLAKE, + "Snowflake") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_REFRESH_ROOMS, "Refresh Room List") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_ROOM_NICKNAME, diff --git a/menu/cbs/menu_cbs_get_value.c b/menu/cbs/menu_cbs_get_value.c index 7c42baa3465..5b98e955549 100644 --- a/menu/cbs/menu_cbs_get_value.c +++ b/menu/cbs/menu_cbs_get_value.c @@ -246,6 +246,10 @@ static void menu_action_setting_disp_set_label_pipeline( strlcpy(s, msg_hash_to_str( MENU_ENUM_LABEL_VALUE_SHADER_PIPELINE_BOKEH), len); + case XMB_SHADER_PIPELINE_SNOWFLAKE: + strlcpy(s, + msg_hash_to_str( + MENU_ENUM_LABEL_VALUE_SHADER_PIPELINE_SNOWFLAKE), len); break; } diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index 0392da6f34f..0185ec76ee5 100755 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -2759,6 +2759,9 @@ static void xmb_draw_bg( case XMB_SHADER_PIPELINE_BOKEH: draw.pipeline.id = VIDEO_SHADER_MENU_5; break; + case XMB_SHADER_PIPELINE_SNOWFLAKE: + draw.pipeline.id = VIDEO_SHADER_MENU_6; + break; default: break; } diff --git a/menu/drivers_display/menu_display_gl.c b/menu/drivers_display/menu_display_gl.c index 65cf5221156..d1d57b70753 100644 --- a/menu/drivers_display/menu_display_gl.c +++ b/menu/drivers_display/menu_display_gl.c @@ -185,6 +185,7 @@ static void menu_display_gl_draw_pipeline(void *data) case VIDEO_SHADER_MENU_3: case VIDEO_SHADER_MENU_4: case VIDEO_SHADER_MENU_5: + case VIDEO_SHADER_MENU_6: shader_info.data = NULL; shader_info.idx = draw->pipeline.id; shader_info.set_active = true; @@ -215,6 +216,7 @@ static void menu_display_gl_draw_pipeline(void *data) case VIDEO_SHADER_MENU_3: case VIDEO_SHADER_MENU_4: case VIDEO_SHADER_MENU_5: + case VIDEO_SHADER_MENU_6: #ifndef HAVE_PSGL uniform_param.type = UNIFORM_2F; uniform_param.lookup.ident = "OutputSize"; diff --git a/menu/menu_driver.h b/menu/menu_driver.h index d660ccbb4be..f2d3db313f5 100644 --- a/menu/menu_driver.h +++ b/menu/menu_driver.h @@ -260,6 +260,7 @@ enum xmb_shader_pipeline XMB_SHADER_PIPELINE_SIMPLE_SNOW, XMB_SHADER_PIPELINE_SNOW, XMB_SHADER_PIPELINE_BOKEH, + XMB_SHADER_PIPELINE_SNOWFLAKE, XMB_SHADER_PIPELINE_LAST }; diff --git a/msg_hash.h b/msg_hash.h index fdd00470e1c..f9e92af1d3a 100644 --- a/msg_hash.h +++ b/msg_hash.h @@ -447,6 +447,7 @@ enum msg_hash_enums MENU_LABEL(SHADER_PIPELINE_SIMPLE_SNOW), MENU_LABEL(SHADER_PIPELINE_SNOW), MENU_LABEL(SHADER_PIPELINE_BOKEH), + MENU_LABEL(SHADER_PIPELINE_SNOWFLAKE), MENU_LABEL(MATERIALUI_MENU_HEADER_OPACITY), MENU_LABEL(MATERIALUI_MENU_FOOTER_OPACITY),