diff --git a/commons/src/main/com/mbrlabs/mundus/commons/shaders/water.frag.glsl b/commons/src/main/com/mbrlabs/mundus/commons/shaders/water.frag.glsl index fd88c6488..ca3044a37 100644 --- a/commons/src/main/com/mbrlabs/mundus/commons/shaders/water.frag.glsl +++ b/commons/src/main/com/mbrlabs/mundus/commons/shaders/water.frag.glsl @@ -2,10 +2,10 @@ precision mediump float; #endif -in vec2 v_texCoord0; -in vec4 v_clipSpace; -in vec3 v_toCameraVector; -in vec3 v_fromLightVector; +varying vec2 v_texCoord0; +varying vec4 v_clipSpace; +varying vec3 v_toCameraVector; +varying vec3 v_fromLightVector; uniform vec3 u_color; uniform float u_alpha; @@ -29,9 +29,9 @@ void main() { vec2 reflectTexCoords = vec2(ndc.x, 1.0-ndc.y); // Dudv distortion - vec2 distortedTexCoords = texture(u_dudvTexture, vec2(v_texCoord0.x + u_moveFactor, v_texCoord0.y)).rg*0.1; + vec2 distortedTexCoords = texture2D(u_dudvTexture, vec2(v_texCoord0.x + u_moveFactor, v_texCoord0.y)).rg*0.1; distortedTexCoords = v_texCoord0 + vec2(distortedTexCoords.x, distortedTexCoords.y+u_moveFactor); - vec2 totalDistortion = (texture(u_dudvTexture, distortedTexCoords).rg * 2.0 - 1.0) * u_waveStrength * clamp(5/20.0,0.0,1.0); + vec2 totalDistortion = (texture2D(u_dudvTexture, distortedTexCoords).rg * 2.0 - 1.0) * u_waveStrength * clamp(5.0/20.0,0.0,1.0); float minTexCoord = 0.005; float maxTexCoord = 1.0 - minTexCoord; @@ -45,12 +45,12 @@ void main() { reflectTexCoords.y = clamp(reflectTexCoords.y, 0.001, 0.999); // Sample textures with distortion - vec4 reflectColor = texture(u_texture, reflectTexCoords); - vec4 refractColor = texture(u_refractionTexture, refractTexCoords); + vec4 reflectColor = texture2D(u_texture, reflectTexCoords); + vec4 refractColor = texture2D(u_refractionTexture, refractTexCoords); // Normal map - vec4 normalMapColor = texture(u_normalMapTexture, distortedTexCoords); - vec3 normal = vec3(normalMapColor.r * 2.0 - 1.0, normalMapColor.b * 3, normalMapColor.g * 2.0 - 1.0); + vec4 normalMapColor = texture2D(u_normalMapTexture, distortedTexCoords); + vec3 normal = vec3(normalMapColor.r * 2.0 - 1.0, normalMapColor.b * 3.0, normalMapColor.g * 2.0 - 1.0); normal = normalize(normal); // Fresnel Effect @@ -64,7 +64,7 @@ void main() { vec3 specularHighlights = u_lightColor * specular * reflectivity; vec4 color = mix(reflectColor, refractColor, refractiveFactor); - color = mix(color, COLOR_TURQUOISE, 0.2f) + vec4(specularHighlights, 0.0); + color = mix(color, COLOR_TURQUOISE, 0.2) + vec4(specularHighlights, 0.0); gl_FragColor = color; }