move shaders into .glsl files and add #include feature
This commit is contained in:
27
data/shaders/bake-uv.glsl
Normal file
27
data/shaders/bake-uv.glsl
Normal 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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user