source: trunk/tools/neercs/video/mirror.lolfx @ 1986

Last change on this file since 1986 was 1986, checked in by rez, 8 years ago

neercs - adding mirror sides (left ok, right no yet)

File size: 711 bytes
Line 
1[vert.glsl]
2
3#version 120
4
5void main()
6{
7    gl_Position = gl_Vertex;
8    gl_TexCoord[0] = gl_MultiTexCoord0;
9}
10
11[frag.glsl]
12
13#version 120
14
15uniform sampler2D texture;
16uniform vec2 screen_size;
17uniform vec4 mirror;
18
19void main(void)
20{
21    vec2 p = gl_TexCoord[0].xy;
22    vec3 source = texture2D(texture, p).xyz;
23
24    vec3 color = vec3(0.0);
25    if(p.x < mirror.x) color = (texture2D(texture, vec2(mirror.x - (1.0 - mirror.x * mirror.w + p.x * mirror.w), p.y)).xyz) * (mirror.z / mirror.x * p.x);
26    if(p.x > 1.0 - mirror.x) color = (texture2D(texture, vec2(mirror.x - (1.0 - mirror.x * mirror.w + p.x * mirror.w), p.y)).xyz) * (mirror.z / mirror.x * (1.0 - p.x));
27
28    gl_FragColor = vec4(source + color, 1.0);
29}
Note: See TracBrowser for help on using the repository browser.