1
0
Fork 0
forked from fte/fteqw
fteqw/engine/shaders/vulkan/underwaterwarp.glsl
Spoike 27a59a0cbc LOTS OF CHANGES. was hoping to get revision 5000 perfect, but really that's never going to happen. this has gone on for too long now.
vulkan, wasapi, quake injector features added.
irc, avplug, cef plugins/drivers reworked/updated/added
openal reverb, doppler effects added.
'dir' console command now attempts to view clicked files.
lots of warning fixes, should now only be deprecation warnings for most targets (depending on compiler version anyway...).
SendEntity finally reworked to use flags properly.
effectinfo improved, other smc-targetted fixes.
mapcluster stuff now has support for linux.
.basebone+.baseframe now exist in ssqc.
qcc: -Fqccx supports qccx syntax, including qccx hacks. don't expect these to work in fteqw nor dp though.
qcc: rewrote function call handling to use refs rather than defs. this makes struct passing more efficient and makes the __out keyword usable with fields etc.
qccgui: can cope a little better with non-unicode files. can now represent most quake chars.
qcc: suppressed warnings from *extensions.qc

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5000 fc73d0e0-1445-4013-8a0c-d673dee63da5
2016-07-12 00:40:13 +00:00

37 lines
1 KiB
GLSL

!!cvarf r_waterwarp
!!samps 3
#include "sys/defs.h"
//this is a post processing shader that is drawn fullscreen whenever the view is underwater.
//its generally expected to warp the view a little.
varying vec2 v_stc;
varying vec2 v_warp;
varying vec2 v_edge;
#ifdef VERTEX_SHADER
void main ()
{
gl_Position = ftetransform();
v_stc = vec2(v_texcoord.x, 1.0-v_texcoord.y);
v_warp.s = e_time * 0.25 + v_texcoord.s;
v_warp.t = e_time * 0.25 + v_texcoord.t;
v_edge = v_texcoord.xy;
}
#endif
#ifdef FRAGMENT_SHADER
//uniform sampler2D s_t0;/*$currentrender*/
//uniform sampler2D s_t1;/*warp image*/
//uniform sampler2D s_t2;/*edge image*/
//uniform vec4 e_rendertexturescale;
//uniform float cvar_r_waterwarp;
#define e_rendertexturescale vec4(1.0,1.0,0.0,0.0)
void main ()
{
vec2 amp = (0.010 / 0.625) * cvar_r_waterwarp * texture2D(s_t2, v_edge).rg;
vec3 offset = (texture2D(s_t1, v_warp).rgb - 0.5) * 2.0;
vec2 temp = v_stc + offset.xy * amp;
gl_FragColor = texture2D(s_t0, temp*e_rendertexturescale.st);
}
#endif