mirror of
https://github.com/nzp-team/fteqw.git
synced 2024-11-23 20:32:43 +00:00
33a540806e
Added $reflection texture map for (water) shaders. Just renders the screen to an fbo before rendering the surface. hub/savegame fixes. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4034 fc73d0e0-1445-4013-8a0c-d673dee63da5
31 lines
806 B
GLSL
31 lines
806 B
GLSL
//pretty much a regular sky shader
|
|
//though in reality we should render a sun circle in the middle.
|
|
//still, its kinda cool to have scrolling clouds masking out parts of the sun.
|
|
|
|
#ifdef VERTEX_SHADER
|
|
varying vec3 pos;
|
|
void main ()
|
|
{
|
|
pos = v_position.xyz;
|
|
gl_Position = ftetransform();
|
|
}
|
|
#endif
|
|
#ifdef FRAGMENT_SHADER
|
|
uniform float e_time;
|
|
uniform vec3 e_eyepos;
|
|
varying vec3 pos;
|
|
uniform sampler2D s_t0;
|
|
uniform sampler2D s_t1;
|
|
void main ()
|
|
{
|
|
vec2 tccoord;
|
|
vec3 dir = pos - e_eyepos;
|
|
dir.z *= 3.0;
|
|
dir.xy /= 0.5*length(dir);
|
|
tccoord = (dir.xy + e_time*0.03125);
|
|
vec3 solid = vec3(texture2D(s_t0, tccoord));
|
|
tccoord = (dir.xy + e_time*0.0625);
|
|
vec4 clouds = texture2D(s_t1, tccoord);
|
|
gl_FragColor.rgb = (solid.rgb*(1.0-clouds.a)) + (clouds.a*clouds.rgb);
|
|
}
|
|
#endif
|