move shaders into .glsl files and add #include feature

This commit is contained in:
2019-02-21 19:26:40 +01:00
parent 16eb9de358
commit eaab9c79e5
47 changed files with 1124 additions and 777 deletions

View File

@@ -0,0 +1,29 @@
[[vertex]]
#define PI 3.1415926535897932384626433832795
#define TWO_PI 6.283185307179586476925286766559
uniform mat4 mvp;
in vec4 pos;
in vec2 uvs;
out vec2 uv;
void main()
{
uv = (vec2(1.0) - uvs + vec2(0.25,0.0)) * vec2(TWO_PI, PI);
gl_Position = mvp * vec4(pos.xyz, 1.0);
}
[[fragment]]
uniform samplerCube tex;
in highp vec2 uv;
out mediump vec4 frag;
void main()
{
highp float anglex = uv.x;
highp float angley = uv.y;
highp float sx = sin(anglex);
highp float cx = cos(anglex);
highp vec3 dir = vec3(0.0, 0.0, 0.0);
dir.x = sin(angley) * cx;
dir.y = cos(angley);
dir.z = sin(angley) * sx;
frag = texture(tex, dir);
}