Files
panopainter/data/shaders/bake-uv.glsl
2019-02-21 21:51:55 +01:00

34 lines
404 B
GLSL

[[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;
}
}