Last change
on this file since 1456 was
1456,
checked in by sam, 11 years ago
|
neercs: import Rez's code in our framework. Not ready yet.
|
File size:
858 bytes
|
Line | |
---|
1 | -- GLSL.Vert -- |
---|
2 | |
---|
3 | #version 120 |
---|
4 | |
---|
5 | void main() |
---|
6 | { |
---|
7 | gl_Position=gl_Vertex; |
---|
8 | gl_TexCoord[0]=gl_MultiTexCoord0; |
---|
9 | } |
---|
10 | |
---|
11 | -- GLSL.Frag -- |
---|
12 | |
---|
13 | #version 120 |
---|
14 | |
---|
15 | uniform sampler2D texture; |
---|
16 | uniform int screen_w; |
---|
17 | uniform int screen_h; |
---|
18 | uniform float time; |
---|
19 | uniform float value1; |
---|
20 | uniform float value2; |
---|
21 | uniform float color; |
---|
22 | |
---|
23 | float PI=3.14159265358979323846; |
---|
24 | |
---|
25 | vec3 deform(in vec2 p) |
---|
26 | { |
---|
27 | vec2 uv; |
---|
28 | float zoom=0.5; |
---|
29 | uv.x=p.x*zoom-0.5; |
---|
30 | uv.y=p.y*zoom-0.5; |
---|
31 | return texture2D(texture,uv).xyz; |
---|
32 | } |
---|
33 | |
---|
34 | void main(void) |
---|
35 | { |
---|
36 | int n=32; |
---|
37 | |
---|
38 | vec2 p=-1.0+4.0*gl_TexCoord[0].xy; |
---|
39 | vec2 s=p; |
---|
40 | vec3 source=deform(s); |
---|
41 | |
---|
42 | vec3 total=vec3(0,1.0,1.0); |
---|
43 | |
---|
44 | vec2 d=-p/float(n*2); |
---|
45 | float w=value1; |
---|
46 | for(int i=0;i<n;i++) |
---|
47 | { |
---|
48 | vec3 c=deform(s); |
---|
49 | vec3 data=c+vec3(c.x*color-p.x*color,c.z*color+p.y*color,c.y*color+p.x*color); |
---|
50 | total+=data*w; |
---|
51 | w*=value2; |
---|
52 | s+=d; |
---|
53 | } |
---|
54 | gl_FragColor=vec4(source*0.625+total*0.025,1.0); |
---|
55 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.