File: effect-distort-f.sdr

package info (click to toggle)
freespace2 24.0.2%2Brepack-1
  • links: PTS, VCS
  • area: non-free
  • in suites: trixie
  • size: 43,188 kB
  • sloc: cpp: 583,107; ansic: 21,729; python: 1,174; sh: 464; makefile: 248; xml: 181
file content (27 lines) | stat: -rw-r--r-- 761 bytes parent folder | download | duplicates (2)
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
in vec4 fragTexCoord;
in vec4 fragColor;
in float fragOffset;

out vec4 fragOut0;

uniform sampler2DArray baseMap;
uniform sampler2D depthMap;
uniform sampler2D distMap;
uniform sampler2D frameBuffer;

layout (std140) uniform genericData {
	float window_width;
	float window_height;
	float use_offset;
};

void main()
{
	vec2 depthCoord = vec2(gl_FragCoord.x / window_width, gl_FragCoord.y / window_height);
	vec4 fragmentColor = texture(baseMap, fragTexCoord.xyz) * fragColor.a;
	vec2 distortion = texture(distMap, fragTexCoord.xy+vec2(0.0, fragOffset)).rg;
	float alpha = clamp(dot(fragmentColor.rgb,vec3(0.3333))*10.0,0.0,1.0);
	distortion = ((distortion - 0.5) * 0.01) * alpha;
	fragOut0 = texture(frameBuffer,depthCoord+distortion);
	fragOut0.a = alpha;
}