-
Notifications
You must be signed in to change notification settings - Fork 0
/
RetinotopyCallaway.frag.txt
51 lines (41 loc) · 1.15 KB
/
RetinotopyCallaway.frag.txt
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
41
42
43
44
45
46
47
48
49
50
51
/* RetinotopyCallaway.frag.txt */
const float twopi = 2.0*3.141592653589793;
/* Values passed from vertex shader: */
varying float Black;
varying float White;
varying vec4 Grey;
varying float Center;
varying float vertOhorz;
varying float Width;
varying float checkSize;
varying float checkPhase;
varying float screenDist;
varying float CenterX;
varying float CenterY;
void main()
{
/* Query current output texel position: */
vec2 pos = gl_TexCoord[0].xy;
float currentPos;
float color1;
/* Convert distance, apply shift offset: */
float x = pos[0]-CenterX;
float y = pos[1]-CenterY;
float theta = twopi/4-acos(y/sqrt(screenDist*screenDist+x*x+y*y));
float phi = atan(x/screenDist);
if (checkPhase == 0.0) {
color1 = White;
}
else {
color1 = Black;
}
if (vertOhorz < 1.5) {
currentPos = phi-Center;
}
else {
currentPos = theta-Center;
}
float kernel = exp(-(currentPos*currentPos)/(Width*Width/2.0));
float color = abs(color1-mod(floor(theta/checkSize)+floor(phi/checkSize),2.0));
gl_FragColor = vec4(color,color,color,kernel);
}