mirror of
https://github.com/libretro/RetroArch
synced 2025-02-03 08:54:13 +00:00
Convert other shaders
This commit is contained in:
parent
653359911a
commit
3d5cc14030
@ -1,43 +1,50 @@
|
|||||||
static const char *stock_vertex_xmb_modern =
|
#include "shaders_common.h"
|
||||||
"in vec3 VertexCoord;\n"
|
|
||||||
"uniform float time;\n"
|
|
||||||
"out 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"
|
static const char *stock_vertex_xmb_modern = GLSL(
|
||||||
|
in vec3 VertexCoord;
|
||||||
|
uniform float time;
|
||||||
|
out vec3 fragVertexEc;
|
||||||
|
|
||||||
" v3.x = v3.x + time/5.0;\n"
|
float iqhash( float n )
|
||||||
" v3.x = v3.x / 2.0;\n"
|
{
|
||||||
|
return fract(sin(n)*43758.5453);
|
||||||
|
}
|
||||||
|
|
||||||
" v3.z = v3.z + time/10.0;\n"
|
float noise( vec3 x )
|
||||||
" v3.y = v3.y + time/100.0;\n"
|
{
|
||||||
|
vec3 p = floor(x);
|
||||||
|
vec3 f = fract(x);
|
||||||
|
f = f*f*(3.0-2.0*f);
|
||||||
|
float n = p.x + p.y*57.0 + 113.0*p.z;
|
||||||
|
return mix(mix(mix( iqhash(n+0.0 ), iqhash(n+1.0 ),f.x),
|
||||||
|
mix( iqhash(n+57.0 ), iqhash(n+58.0 ),f.x),f.y),
|
||||||
|
mix(mix( iqhash(n+113.0), iqhash(n+114.0),f.x),
|
||||||
|
mix( iqhash(n+170.0), iqhash(n+171.0),f.x),f.y),f.z);
|
||||||
|
}
|
||||||
|
|
||||||
" v.z = v.z + noise(v3*7.0)/15.0;\n"
|
float xmb_noise2( vec3 x )
|
||||||
" v.y = v.y + noise(v3*7.0)/15.0 + cos(v.x*2.0-time/5.0)/5.0 - 0.3;\n"
|
{
|
||||||
|
return cos((x.z*1.0)*2.0);
|
||||||
|
}
|
||||||
|
|
||||||
" gl_Position = vec4(v, 1.0);\n"
|
void main()
|
||||||
" fragVertexEc = gl_Position.xyz;\n"
|
{
|
||||||
"}\n";
|
vec3 v = vec3(VertexCoord.x, 0.0, VertexCoord.y);
|
||||||
|
vec3 v2 = v;
|
||||||
|
vec3 v3 = v;
|
||||||
|
|
||||||
|
v.y = xmb_noise2(v2)/6.0;
|
||||||
|
|
||||||
|
v3.x = v3.x + time/5.0;
|
||||||
|
v3.x = v3.x / 2.0;
|
||||||
|
|
||||||
|
v3.z = v3.z + time/10.0;
|
||||||
|
v3.y = v3.y + time/100.0;
|
||||||
|
|
||||||
|
v.z = v.z + noise(v3*7.0)/15.0;
|
||||||
|
v.y = v.y + noise(v3*7.0)/15.0 + cos(v.x*2.0-time/5.0)/5.0 - 0.3;
|
||||||
|
|
||||||
|
gl_Position = vec4(v, 1.0);
|
||||||
|
fragVertexEc = gl_Position.xyz;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
@ -1,37 +1,38 @@
|
|||||||
static const char *nuklear_shader =
|
#include "shaders_common.h"
|
||||||
"struct input\n"
|
|
||||||
"{\n"
|
|
||||||
" float time;\n"
|
|
||||||
"};\n"
|
|
||||||
|
|
||||||
"void main_vertex\n"
|
static const char *nuklear_shader = GLSL(
|
||||||
"(\n"
|
struct input
|
||||||
" float4 position : POSITION,\n"
|
{
|
||||||
" float4 color : COLOR,\n"
|
float time;
|
||||||
" float2 texCoord : TEXCOORD0,\n"
|
};
|
||||||
|
|
||||||
" uniform float4x4 modelViewProj,\n"
|
void main_vertex
|
||||||
|
(
|
||||||
|
float4 position : POSITION,
|
||||||
|
float4 color : COLOR,
|
||||||
|
float2 texCoord : TEXCOORD0,
|
||||||
|
|
||||||
" out float4 oPosition : POSITION,\n"
|
uniform float4x4 modelViewProj,
|
||||||
" out float4 oColor : COLOR,\n"
|
|
||||||
" out float2 otexCoord : TEXCOORD\n"
|
|
||||||
")\n"
|
|
||||||
"{\n"
|
|
||||||
" oPosition = mul(modelViewProj, position);\n"
|
|
||||||
" oColor = color;\n"
|
|
||||||
" otexCoord = texCoord;\n"
|
|
||||||
"}\n"
|
|
||||||
|
|
||||||
"struct output \n"
|
out float4 oPosition : POSITION,
|
||||||
"{\n"
|
out float4 oColor : COLOR,
|
||||||
" float4 color : COLOR;\n"
|
out float2 otexCoord : TEXCOORD
|
||||||
"};\n"
|
)
|
||||||
|
{
|
||||||
|
oPosition = mul(modelViewProj, position);
|
||||||
|
oColor = color;
|
||||||
|
otexCoord = texCoord;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct output
|
||||||
|
{
|
||||||
|
float4 color : COLOR;
|
||||||
|
};
|
||||||
|
|
||||||
"output main_fragment(float2 texCoord : TEXCOORD0, uniform sampler2D Texture : TEXUNIT0, uniform input IN)\n"
|
output main_fragment(float2 texCoord : TEXCOORD0, uniform sampler2D Texture : TEXUNIT0, uniform input IN)\
|
||||||
"{\n"
|
{
|
||||||
" output OUT;\n"
|
output OUT;
|
||||||
" OUT.color = tex2D(Texture, texCoord);\n"
|
OUT.color = tex2D(Texture, texCoord);
|
||||||
" return OUT;\n"
|
return OUT;
|
||||||
"}\n"
|
}
|
||||||
;
|
);
|
||||||
|
@ -1,10 +1,13 @@
|
|||||||
static const char *nuklear_fragment_shader =
|
#include "shaders_common.h"
|
||||||
"#version 300 es\n"
|
|
||||||
"precision mediump float;\n"
|
static const char *nuklear_fragment_shader = GLSL_330_ES(
|
||||||
"uniform sampler2D Texture;\n"
|
precision mediump float;
|
||||||
"in vec2 Frag_UV;\n"
|
uniform sampler2D Texture;
|
||||||
"in vec4 Frag_Color;\n"
|
in vec2 Frag_UV;
|
||||||
"out vec4 Out_Color;\n"
|
in vec4 Frag_Color;
|
||||||
"void main(){\n"
|
out vec4 Out_Color;
|
||||||
" Out_Color = Frag_Color * texture(Texture, Frag_UV.st);\n"
|
|
||||||
"}\n";
|
void main(){
|
||||||
|
Out_Color = Frag_Color * texture(Texture, Frag_UV.st);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
@ -1,13 +1,17 @@
|
|||||||
static const char *nuklear_vertex_shader =
|
#include "shaders_common.h"
|
||||||
"#version 300 es\n"
|
|
||||||
"uniform mat4 ProjMtx;\n"
|
static const char *nuklear_vertex_shader = GLSL_330_ES(
|
||||||
"in vec2 Position;\n"
|
uniform mat4 ProjMtx;
|
||||||
"in vec2 TexCoord;\n"
|
in vec2 Position;
|
||||||
"in vec4 Color;\n"
|
in vec2 TexCoord;
|
||||||
"out vec2 Frag_UV;\n"
|
in vec4 Color;
|
||||||
"out vec4 Frag_Color;\n"
|
out vec2 Frag_UV;
|
||||||
"void main() {\n"
|
out vec4 Frag_Color;
|
||||||
" Frag_UV = TexCoord;\n"
|
|
||||||
" Frag_Color = Color;\n"
|
void main()
|
||||||
" gl_Position = ProjMtx * vec4(Position.xy, 0, 1);\n"
|
{
|
||||||
"}\n";
|
Frag_UV = TexCoord;
|
||||||
|
Frag_Color = Color;
|
||||||
|
gl_Position = ProjMtx * vec4(Position.xy, 0, 1);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
@ -1,58 +1,60 @@
|
|||||||
static const char *stock_xmb_simple =
|
#include "shaders_common.h"
|
||||||
"struct input\n"
|
|
||||||
"{\n"
|
|
||||||
" float time;\n"
|
|
||||||
"};\n"
|
|
||||||
|
|
||||||
"float iqhash(float n)\n"
|
static const char *stock_xmb_simple = GLSL(
|
||||||
"{\n"
|
struct input
|
||||||
"return frac(sin(n)*43758.5453);\n"
|
{
|
||||||
"}\n"
|
float time;
|
||||||
|
};
|
||||||
|
|
||||||
"float noise(float3 x)\n"
|
float iqhash(float n)
|
||||||
"{\n"
|
{
|
||||||
"float3 p = floor(x);\n"
|
return frac(sin(n)*43758.5453);
|
||||||
"float3 f = frac(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 lerp(lerp(lerp(iqhash(n+0.0), iqhash(n+1.0), f.x),\n"
|
|
||||||
"lerp(iqhash(n+57.0), iqhash(n+58.0), f.x), f.y),\n"
|
|
||||||
"lerp(lerp(iqhash(n+113.0), iqhash(n+114.0), f.x),\n"
|
|
||||||
"lerp(iqhash(n+170.0), iqhash(n+171.0), f.x), f.y), f.z);\n"
|
|
||||||
"}\n"
|
|
||||||
|
|
||||||
"void main_vertex\n"
|
float noise(float3 x)
|
||||||
"(\n"
|
{
|
||||||
" float2 position : POSITION,\n"
|
float3 p = floor(x);
|
||||||
" float4 color : COLOR,\n"
|
float3 f = frac(x);
|
||||||
" float2 texCoord : TEXCOORD0,\n"
|
f = f * f * (3.0 - 2.0 * f);
|
||||||
|
float n = p.x + p.y * 57.0 + 113.0 * p.z;
|
||||||
|
return lerp(lerp(lerp(iqhash(n+0.0), iqhash(n+1.0), f.x),
|
||||||
|
lerp(iqhash(n+57.0), iqhash(n+58.0), f.x), f.y),
|
||||||
|
lerp(lerp(iqhash(n+113.0), iqhash(n+114.0), f.x),
|
||||||
|
lerp(iqhash(n+170.0), iqhash(n+171.0), f.x), f.y), f.z);
|
||||||
|
}
|
||||||
|
|
||||||
" uniform input IN,\n"
|
void main_vertex
|
||||||
|
(
|
||||||
|
float2 position : POSITION,
|
||||||
|
float4 color : COLOR,
|
||||||
|
float2 texCoord : TEXCOORD0,
|
||||||
|
|
||||||
" out float4 oPosition : POSITION,\n"
|
uniform input IN,
|
||||||
" out float4 oColor : COLOR,\n"
|
|
||||||
" out float2 otexCoord : TEXCOORD\n"
|
|
||||||
")\n"
|
|
||||||
"{\n"
|
|
||||||
"float3 v = float3(position.x, 0.0, position.y);\n"
|
|
||||||
"float3 v2 = v;\n"
|
|
||||||
"v2.x = v2.x + IN.time / 2.0;\n"
|
|
||||||
"v2.z = v.z * 3.0;\n"
|
|
||||||
"v.y = -cos((v.x + v.z / 3.0 + IN.time) * 2.0) / 10.0 - noise(v2.xyz) / 3.0;\n"
|
|
||||||
" oPosition = float4(v, 1.0);\n"
|
|
||||||
" oColor = color;\n"
|
|
||||||
" otexCoord = texCoord;\n"
|
|
||||||
"}\n"
|
|
||||||
|
|
||||||
"struct output\n"
|
out float4 oPosition : POSITION,
|
||||||
"{\n"
|
out float4 oColor : COLOR,
|
||||||
" float4 color : COLOR;\n"
|
out float2 otexCoord : TEXCOORD
|
||||||
"};\n"
|
)
|
||||||
|
{
|
||||||
|
float3 v = float3(position.x, 0.0, position.y);
|
||||||
|
float3 v2 = v;
|
||||||
|
v2.x = v2.x + IN.time / 2.0;
|
||||||
|
v2.z = v.z * 3.0;
|
||||||
|
v.y = -cos((v.x + v.z / 3.0 + IN.time) * 2.0) / 10.0 - noise(v2.xyz) / 3.0;
|
||||||
|
oPosition = float4(v, 1.0);
|
||||||
|
oColor = color;
|
||||||
|
otexCoord = texCoord;
|
||||||
|
}
|
||||||
|
|
||||||
"output main_fragment(uniform input IN) \n"
|
struct output
|
||||||
"{\n"
|
{
|
||||||
" output OUT;\n"
|
float4 color : COLOR;
|
||||||
" OUT.color = float4(1.0, 1.0, 1.0, 0.05);\n"
|
};
|
||||||
" return OUT;\n"
|
|
||||||
"}\n"
|
output main_fragment(uniform input IN)
|
||||||
;
|
{
|
||||||
|
output OUT;
|
||||||
|
OUT.color = float4(1.0, 1.0, 1.0, 0.05);
|
||||||
|
return OUT;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#define GLSL(src) "" #src
|
#define GLSL(src) "" #src
|
||||||
|
|
||||||
|
#define GLSL_330_ES(src) "#version 330 es\n" #src
|
||||||
#define GLSL_330_CORE(src) "#version 330 core\n" #src
|
#define GLSL_330_CORE(src) "#version 330 core\n" #src
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user