mirror of
https://github.com/libretro/RetroArch
synced 2025-03-20 10:20:51 +00:00
Split up vertex/fragment shader conditionals for XMB ribbon
This commit is contained in:
parent
3e40b77108
commit
3dfd8a0584
@ -1,11 +1,6 @@
|
||||
static const char *stock_vertex_xmb =
|
||||
"#if __VERSION__ >= 130\n"
|
||||
"#define COMPAT_VARYING out\n"
|
||||
"#define COMPAT_ATTRIBUTE in\n"
|
||||
"#else\n"
|
||||
static const char *stock_vertex_xmb_legacy =
|
||||
"#define COMPAT_VARYING varying\n"
|
||||
"#define COMPAT_ATTRIBUTE attribute\n"
|
||||
"#endif\n"
|
||||
"COMPAT_ATTRIBUTE vec3 VertexCoord;\n"
|
||||
"uniform float time;\n"
|
||||
"COMPAT_VARYING vec3 fragVertexEc;\n"
|
@ -1,11 +1,6 @@
|
||||
static const char *stock_vertex_xmb_simple =
|
||||
"#if __VERSION__ >= 130\n"
|
||||
"#define COMPAT_VARYING out\n"
|
||||
"#define COMPAT_ATTRIBUTE in\n"
|
||||
"#else\n"
|
||||
static const char *stock_vertex_xmb_simple_legacy =
|
||||
"#define COMPAT_VARYING varying\n"
|
||||
"#define COMPAT_ATTRIBUTE attribute\n"
|
||||
"#endif\n"
|
||||
"COMPAT_ATTRIBUTE vec3 VertexCoord;\n"
|
||||
"uniform float time;\n"
|
||||
"float iqhash( float n )\n"
|
@ -0,0 +1,45 @@
|
||||
static const char *stock_vertex_xmb_modern =
|
||||
"#define COMPAT_VARYING out\n"
|
||||
"#define COMPAT_ATTRIBUTE in\n"
|
||||
"COMPAT_ATTRIBUTE vec3 VertexCoord;\n"
|
||||
"uniform float time;\n"
|
||||
"COMPAT_VARYING vec3 fragVertexEc;\n"
|
||||
"float iqhash( float n )\n"
|
||||
"{\n"
|
||||
" return fract(sin(n)*43758.5453);\n"
|
||||
"}\n"
|
||||
"float noise( vec3 x )\n"
|
||||
"{\n"
|
||||
" vec3 p = floor(x);\n"
|
||||
" vec3 f = fract(x);\n"
|
||||
" f = f*f*(3.0-2.0*f);\n"
|
||||
" float n = p.x + p.y*57.0 + 113.0*p.z;\n"
|
||||
" return mix(mix(mix( iqhash(n+0.0 ), iqhash(n+1.0 ),f.x),\n"
|
||||
" mix( iqhash(n+57.0 ), iqhash(n+58.0 ),f.x),f.y),\n"
|
||||
" mix(mix( iqhash(n+113.0), iqhash(n+114.0),f.x),\n"
|
||||
" mix( iqhash(n+170.0), iqhash(n+171.0),f.x),f.y),f.z);\n"
|
||||
"}\n"
|
||||
"float xmb_noise2( vec3 x )\n"
|
||||
"{\n"
|
||||
" return cos((x.z*1.0)*2.0);"
|
||||
"}\n"
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
" vec3 v = vec3(VertexCoord.x, 0.0, VertexCoord.y);\n"
|
||||
" vec3 v2 = v;\n"
|
||||
" vec3 v3 = v;\n"
|
||||
|
||||
" v.y = xmb_noise2(v2)/6.0;\n"
|
||||
|
||||
" v3.x = v3.x + time/5.0;\n"
|
||||
" v3.x = v3.x / 2.0;\n"
|
||||
|
||||
" v3.z = v3.z + time/10.0;\n"
|
||||
" v3.y = v3.y + time/100.0;\n"
|
||||
|
||||
" v.z = v.z + noise(v3*7.0)/15.0;\n"
|
||||
" v.y = v.y + noise(v3*7.0)/15.0 + cos(v.x*2.0-time/5.0)/5.0 - 0.3;\n"
|
||||
|
||||
" gl_Position = vec4(v, 1.0);\n"
|
||||
" fragVertexEc = gl_Position.xyz;\n"
|
||||
"}\n";
|
@ -0,0 +1,29 @@
|
||||
static const char *stock_vertex_xmb_simple_modern =
|
||||
"#define COMPAT_VARYING out\n"
|
||||
"#define COMPAT_ATTRIBUTE in\n"
|
||||
"COMPAT_ATTRIBUTE vec3 VertexCoord;\n"
|
||||
"uniform float time;\n"
|
||||
"float iqhash( float n )\n"
|
||||
"{\n"
|
||||
" return fract(sin(n)*43758.5453);\n"
|
||||
"}\n"
|
||||
"float noise( vec3 x )\n"
|
||||
"{\n"
|
||||
" vec3 p = floor(x);\n"
|
||||
" vec3 f = fract(x);\n"
|
||||
" f = f*f*(3.0-2.0*f);\n"
|
||||
" float n = p.x + p.y*57.0 + 113.0*p.z;\n"
|
||||
" return mix(mix(mix( iqhash(n+0.0 ), iqhash(n+1.0 ),f.x),\n"
|
||||
" mix( iqhash(n+57.0 ), iqhash(n+58.0 ),f.x),f.y),\n"
|
||||
" mix(mix( iqhash(n+113.0), iqhash(n+114.0),f.x),\n"
|
||||
" mix( iqhash(n+170.0), iqhash(n+171.0),f.x),f.y),f.z);\n"
|
||||
"}\n"
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
" vec3 v = vec3(VertexCoord.x, 0.0, VertexCoord.y);\n"
|
||||
" vec3 v2 = v;\n"
|
||||
" v2.x = v2.x + time/2.0;\n"
|
||||
" v2.z = v.z * 3.0;\n"
|
||||
" v.y = -cos((v.x+v.z/3.0+time)*2.0)/10.0 - noise(v2.xyz)/4.0;\n"
|
||||
" gl_Position = vec4(v, 1.0);\n"
|
||||
"}\n";
|
@ -124,10 +124,12 @@ static const char *glsl_prefixes[] = {
|
||||
#include "../drivers/gl_shaders/core_alpha_blend.glsl.vert.h"
|
||||
#include "../drivers/gl_shaders/core_alpha_blend.glsl.frag.h"
|
||||
|
||||
#include "../drivers/gl_shaders/pipeline_xmb_ribbon_simple.glsl.vert.h"
|
||||
#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/pipeline_xmb_ribbon_simple.glsl.frag.h"
|
||||
#if !defined(HAVE_OPENGLES2)
|
||||
#include "../drivers/gl_shaders/pipeline_xmb_ribbon.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"
|
||||
#endif
|
||||
|
||||
@ -900,10 +902,10 @@ static void *gl_glsl_init(void *data, const char *path)
|
||||
}
|
||||
|
||||
#if defined(HAVE_OPENGLES2)
|
||||
shader_prog_info.vertex = stock_vertex_xmb_simple;
|
||||
shader_prog_info.vertex = stock_vertex_xmb_simple_legacy;
|
||||
shader_prog_info.fragment = stock_fragment_xmb_simple;
|
||||
#else
|
||||
shader_prog_info.vertex = stock_vertex_xmb;
|
||||
shader_prog_info.vertex = glsl_core ? stock_vertex_xmb_modern : stock_vertex_xmb_legacy;
|
||||
shader_prog_info.fragment = stock_fragment_xmb;
|
||||
#endif
|
||||
shader_prog_info.is_file = false;
|
||||
@ -916,7 +918,7 @@ static void *gl_glsl_init(void *data, const char *path)
|
||||
gl_glsl_find_uniforms(glsl, 0, glsl->prg[VIDEO_SHADER_MENU].id,
|
||||
&glsl->uniforms[VIDEO_SHADER_MENU]);
|
||||
|
||||
shader_prog_info.vertex = stock_vertex_xmb_simple;
|
||||
shader_prog_info.vertex = glsl_core ? stock_vertex_xmb_simple_modern : stock_vertex_xmb_simple_legacy;
|
||||
shader_prog_info.fragment = stock_fragment_xmb_simple;
|
||||
|
||||
gl_glsl_compile_program(
|
||||
|
Loading…
x
Reference in New Issue
Block a user