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

27
data/shaders/bake-uv.glsl Normal file
View File

@@ -0,0 +1,27 @@
[[vertex]]
uniform mat4 mvp;
in vec4 pos;
in vec3 nor;
in vec2 uvs;
out vec3 n;
out vec3 p;
void main()
{
n = nor;
p = vec3(mvp * pos);
gl_Position = vec4(uvs * 2.0 - 1.0, 0.0, 1.0);
}
[[fragment]]
uniform int mode;
in highp vec3 n;
in highp vec3 p;
out highp vec3 frag;
void main()
{
switch(mode)
{
case 0: frag = normalize(n); break;
case 1: frag = p; break;
}
}