Added snow shader hooks - doesn't work yet though - shader driver

system is very limited in terms of how we can set custom menu
shaders - will require a rethink
This commit is contained in:
twinaphex 2016-11-17 20:54:29 +01:00
parent 23aa03fcdd
commit a2c69ec254
11 changed files with 64 additions and 26 deletions

View File

@ -1,6 +1,6 @@
#include "shaders_common.h"
static const char *stock_vertex_xmb_simple_legacy = GLSL(
static const char *stock_vertex_xmb_snow_legacy = GLSL(
attribute vec3 VertexCoord;
uniform float time;
float iqhash( float n )

View File

@ -1,6 +1,6 @@
#include "shaders_common.h"
static const char *stock_vertex_xmb_simple_modern = GLSL(
static const char *stock_vertex_xmb_snow = GLSL(
in vec3 VertexCoord;
uniform float time;
@ -24,10 +24,6 @@ static const char *stock_vertex_xmb_simple_modern = GLSL(
void main()
{
vec3 v = vec3(VertexCoord.x, 0.0, VertexCoord.y);
//vec3 v2 = v;
//v2.x = v2.x + time/2.0;
//v2.z = v.z * 3.0;
//v.y = -cos((v.x+v.z/3.0+time)*2.0)/10.0 - noise(v2.xyz)/4.0;
gl_Position = vec4(v, 1.0);
}
);

View File

@ -1,6 +1,6 @@
#include "shaders_common.h"
static const char *stock_xmb_simple = CG(
static const char *stock_xmb_snow = CG(
struct input
{
float time;

View File

@ -1,6 +1,6 @@
#include "shaders_common.h"
static const char *stock_fragment_xmb_simple = GLSL(
static const char *stock_fragment_xmb_snow = GLSL(
uniform float time;
vec2 res = vec2(1920*3, 1080*3);

View File

@ -41,6 +41,7 @@
#ifdef HAVE_SHADERPIPELINE
#include "../drivers/gl_shaders/pipeline_xmb_ribbon_simple.cg.h"
#include "../drivers/gl_shaders/pipeline_snow.cg.h"
#endif
#include "../include/Cg/cg.h"

View File

@ -121,8 +121,11 @@ static const char *glsl_prefixes[] = {
#ifdef HAVE_SHADERPIPELINE
#include "../drivers/gl_shaders/legacy_pipeline_xmb_ribbon_simple.glsl.vert.h"
#include "../drivers/gl_shaders/modern_pipeline_xmb_ribbon_simple.glsl.vert.h"
#include "../drivers/gl_shaders/modern_pipeline_snow.glsl.vert.h"
#include "../drivers/gl_shaders/pipeline_xmb_ribbon_simple.glsl.frag.h"
#include "../drivers/gl_shaders/pipeline_snow.glsl.frag.h"
#if !defined(HAVE_OPENGLES)
#include "../drivers/gl_shaders/legacy_pipeline_snow.glsl.vert.h"
#include "../drivers/gl_shaders/legacy_pipeline_xmb_ribbon.glsl.vert.h"
#include "../drivers/gl_shaders/modern_pipeline_xmb_ribbon.glsl.vert.h"
#include "../drivers/gl_shaders/pipeline_xmb_ribbon.glsl.frag.h"

View File

@ -1190,6 +1190,8 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_SHADER_PIPELINE_RIBBON,
"Ribbon")
MSG_HASH(MENU_ENUM_LABEL_VALUE_SHADER_PIPELINE_RIBBON_SIMPLIFIED,
"Ribbon (simplified)")
MSG_HASH(MENU_ENUM_LABEL_VALUE_SHADER_PIPELINE_SNOW,
"Snow")
MSG_HASH(MENU_ENUM_LABEL_VALUE_SHOW_ADVANCED_SETTINGS,
"Show Advanced Settings")
MSG_HASH(MENU_ENUM_LABEL_VALUE_SHOW_HIDDEN_FILES,

View File

@ -225,6 +225,11 @@ static void menu_action_setting_disp_set_label_pipeline(
msg_hash_to_str(
MENU_ENUM_LABEL_VALUE_SHADER_PIPELINE_RIBBON), len);
break;
case XMB_SHADER_PIPELINE_SNOW:
strlcpy(s,
msg_hash_to_str(
MENU_ENUM_LABEL_VALUE_SHADER_PIPELINE_SNOW), len);
break;
}
strlcpy(s2, path, len2);

View File

@ -2278,7 +2278,8 @@ static void xmb_draw_bg(
menu_display_draw_gradient(&draw);
draw.pipeline.id = VIDEO_SHADER_MENU_SEC;
if (settings->menu.xmb.shader_pipeline == XMB_SHADER_PIPELINE_RIBBON)
if (settings->menu.xmb.shader_pipeline == XMB_SHADER_PIPELINE_RIBBON ||
settings->menu.xmb.shader_pipeline == XMB_SHADER_PIPELINE_SNOW)
draw.pipeline.id = VIDEO_SHADER_MENU;
menu_display_draw_pipeline(&draw);
@ -2798,36 +2799,63 @@ static void xmb_ribbon_set_vertex(float *ribbon_verts, unsigned idx, unsigned ro
static void xmb_init_ribbon(xmb_handle_t * xmb)
{
video_coords_t coords;
float ribbon_verts[2 * XMB_RIBBON_VERTICES];
float dummy[4 * XMB_RIBBON_VERTICES];
unsigned i, r, c, col;
video_coord_array_t *ca = NULL;
unsigned vertices_total;
unsigned r, c, col;
unsigned i = 0;
float *ribbon_verts = NULL;
float *dummy = NULL;
settings_t *settings = config_get_ptr();
video_coord_array_t *ca = menu_display_get_coords_array();
memset(&dummy[0], 0, 4 * XMB_RIBBON_VERTICES * sizeof(float));
ca = menu_display_get_coords_array();
/* Set up vertices */
i = 0;
for (r = 0; r < XMB_RIBBON_ROWS - 1; r++)
if (settings->menu.xmb.shader_pipeline == XMB_SHADER_PIPELINE_SNOW)
{
for (c = 0; c < XMB_RIBBON_COLS; c++)
vertices_total = 4;
ribbon_verts = (float*)calloc(2 * vertices_total, sizeof(float));
ribbon_verts[0] = -1.0f;
ribbon_verts[1] = -1.0f;
ribbon_verts[2] = 1.0f;
ribbon_verts[3] = -1.0f;
ribbon_verts[4] = -1.0f;
ribbon_verts[5] = 1.0f;
ribbon_verts[6] = 1.0f;
ribbon_verts[7] = 1.0f;
}
else
{
vertices_total = XMB_RIBBON_VERTICES;
ribbon_verts = (float*)calloc(2 * vertices_total, sizeof(float));
/* Set up vertices */
for (r = 0; r < XMB_RIBBON_ROWS - 1; r++)
{
col = r % 2 ? XMB_RIBBON_COLS - c - 1 : c;
xmb_ribbon_set_vertex(ribbon_verts, i, r, col);
xmb_ribbon_set_vertex(ribbon_verts, i + 2, r + 1, col);
i += 4;
for (c = 0; c < XMB_RIBBON_COLS; c++)
{
col = r % 2 ? XMB_RIBBON_COLS - c - 1 : c;
xmb_ribbon_set_vertex(ribbon_verts, i, r, col);
xmb_ribbon_set_vertex(ribbon_verts, i + 2, r + 1, col);
i += 4;
}
}
}
dummy = (float*)calloc(4 * vertices_total, sizeof(float));
coords.color = dummy;
coords.vertex = ribbon_verts;
coords.tex_coord = dummy;
coords.lut_tex_coord = dummy;
coords.vertices = XMB_RIBBON_VERTICES;
coords.vertices = vertices_total;
video_coord_array_append(ca, &coords, XMB_RIBBON_VERTICES);
free(dummy);
free(ribbon_verts);
video_coord_array_append(ca, &coords, coords.vertices);
}
static void *xmb_init(void **userdata)
{
unsigned width, height;
@ -2901,6 +2929,7 @@ static void *xmb_init(void **userdata)
menu_display_allocate_white_texture();
xmb_init_horizontal_list(xmb);
xmb_init_ribbon(xmb);
return menu;

View File

@ -74,6 +74,7 @@ enum xmb_shader_pipeline
XMB_SHADER_PIPELINE_WALLPAPER = 0,
XMB_SHADER_PIPELINE_SIMPLE_RIBBON,
XMB_SHADER_PIPELINE_RIBBON,
XMB_SHADER_PIPELINE_SNOW,
XMB_SHADER_PIPELINE_LAST
};

View File

@ -376,6 +376,7 @@ enum msg_hash_enums
MENU_ENUM_LABEL_VALUE_SHADER_PIPELINE_RIBBON_SIMPLIFIED,
MENU_ENUM_LABEL_VALUE_SHADER_PIPELINE_RIBBON,
MENU_ENUM_LABEL_VALUE_SHADER_PIPELINE_SNOW,
MENU_ENUM_LABEL_MATERIALUI_MENU_HEADER_OPACITY,
MENU_ENUM_LABEL_VALUE_MATERIALUI_MENU_HEADER_OPACITY,