-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathimage.fs
40 lines (26 loc) · 788 Bytes
/
image.fs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
precision highp float;
out vec4 fragColor;
void main( void )
{
ivec2 coord = ivec2(gl_FragCoord);
vec4 val = texelFetch(bufferA, coord, 0);
// if(!ISNONE(val.z))
// {
// fragColor = vec4(1, 0, 0, 1);
// return;
// }
if(ISNONE(val.x))//(MODE(val) == NONE)
{
fragColor = vec4(0.);//vec4(1, 0, 1, 1);
return;
}
mat3x3 surfJacob = transpose(surface(VAL2(VAL(val.x, 1, 0), VAL(val.y, 0, 1))));
vec3 surfVal = surfJacob[0]; // surface(val.xy);
// if(maxVal(abs(gl_FragCoord.xy - proj(surfVal))) > 1.)
// {
// fragColor = vec4(1, 1, 0, 1);
// return;
// }
vec3 normal = normalize(cross(surfJacob[1], surfJacob[2]));
fragColor = vec4(shading(normal, val.xy, surfVal), 1);
}