2015-09-10 21:41:15 +00:00
|
|
|
uniform vec4 waterMaterialColor;
|
|
|
|
uniform float waterMaterialReflection;
|
|
|
|
uniform float waterMaterialShininess;
|
|
|
|
uniform float waterMaterialHardness;
|
2014-01-05 21:20:15 +00:00
|
|
|
uniform float waterReflection;
|
2013-12-24 10:48:06 +00:00
|
|
|
|
2013-12-21 23:41:19 +00:00
|
|
|
void main(void)
|
|
|
|
{
|
2014-01-21 20:41:15 +00:00
|
|
|
vec3 normal = noiseNormal2d(unprojected.xz, 0.001);
|
2014-01-05 20:52:09 +00:00
|
|
|
|
2015-09-10 21:41:15 +00:00
|
|
|
gl_FragColor = applyLighting(unprojected, normal, waterMaterialColor, waterMaterialReflection, waterMaterialShininess, waterMaterialHardness);
|
2014-01-05 21:20:15 +00:00
|
|
|
|
2014-01-21 21:31:17 +00:00
|
|
|
vec3 reflected = reflect(unprojected - cameraLocation, normal);
|
|
|
|
reflected.y = max(reflected.y, 0.0);
|
|
|
|
gl_FragColor += getSkyColor(unprojected, reflected) * waterReflection;
|
2013-12-22 00:17:57 +00:00
|
|
|
|
2013-12-24 14:00:32 +00:00
|
|
|
gl_FragColor = applyAerialPerspective(gl_FragColor);
|
2013-12-22 00:17:57 +00:00
|
|
|
|
2013-12-24 14:00:32 +00:00
|
|
|
gl_FragColor = applyToneMapping(gl_FragColor);
|
2013-12-22 00:17:57 +00:00
|
|
|
|
2015-09-06 23:15:59 +00:00
|
|
|
gl_FragColor = applyMouseTracking(unprojected, gl_FragColor);
|
|
|
|
|
2013-12-24 14:00:32 +00:00
|
|
|
gl_FragColor.a = distanceFadeout();
|
2013-12-21 23:41:19 +00:00
|
|
|
}
|