|
|
@ -12,17 +12,22 @@ uniform sampler2D m_water_dudvmap; |
|
|
|
uniform sampler2D m_water_depthmap; |
|
|
|
uniform sampler2D m_water_depthmap; |
|
|
|
uniform vec4 m_waterColor; |
|
|
|
uniform vec4 m_waterColor; |
|
|
|
uniform float m_waterDepth; |
|
|
|
uniform float m_waterDepth; |
|
|
|
uniform vec4 m_distortionScale; |
|
|
|
uniform float m_distortionScale; |
|
|
|
uniform vec4 m_distortionMix; |
|
|
|
uniform float m_distortionMix; |
|
|
|
uniform vec4 m_texScale; |
|
|
|
uniform float m_texScale; |
|
|
|
|
|
|
|
/*uniform float m_distortionScale; |
|
|
|
|
|
|
|
uniform float m_distortionMix; |
|
|
|
|
|
|
|
uniform float m_texScale; |
|
|
|
|
|
|
|
*/ |
|
|
|
uniform vec2 m_FrustumNearFar; |
|
|
|
uniform vec2 m_FrustumNearFar; |
|
|
|
uniform float m_waterTransparency; |
|
|
|
uniform float m_waterTransparency; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
varying vec4 lightDir; //lightpos |
|
|
|
varying vec4 lightDir; //lightpos |
|
|
|
varying vec4 waterTex1; //moving texcoords |
|
|
|
varying vec2 waterTex1; //moving texcoords |
|
|
|
varying vec4 waterTex2; //moving texcoords |
|
|
|
varying vec2 waterTex2; //moving texcoords |
|
|
|
|
|
|
|
|
|
|
|
varying vec4 position; //for projection |
|
|
|
varying vec4 position; //for projection |
|
|
|
varying vec4 viewDir; //viewts |
|
|
|
varying vec4 viewDir; //viewts |
|
|
|
varying vec4 viewLightDir; |
|
|
|
varying vec4 viewLightDir; |
|
|
@ -62,13 +67,12 @@ void main(void) |
|
|
|
|
|
|
|
|
|
|
|
vec4 lightTS = normalize(lightDir); |
|
|
|
vec4 lightTS = normalize(lightDir); |
|
|
|
vec4 viewt = normalize(viewDir); |
|
|
|
vec4 viewt = normalize(viewDir); |
|
|
|
vec4 disdis = texture2D(m_water_dudvmap, vec2(waterTex2 * m_texScale)); |
|
|
|
vec4 disdis = texture2D(m_water_dudvmap, waterTex2 * vec2(m_texScale)); |
|
|
|
vec4 fdist = texture2D(m_water_dudvmap, vec2(waterTex1 + disdis*m_distortionMix)); |
|
|
|
vec4 fdist = texture2D(m_water_dudvmap, waterTex1 + vec2(disdis) * vec2(m_distortionMix)); |
|
|
|
fdist =normalize( fdist * 2.0 - 1.0)* m_distortionScale; |
|
|
|
fdist =normalize( fdist * 2.0 - 1.0)* vec4(m_distortionScale); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//load normalmap |
|
|
|
//load normalmap |
|
|
|
vec4 nmap = texture2D(m_water_normalmap, vec2(waterTex1 + disdis*m_distortionMix)); |
|
|
|
vec4 nmap = texture2D(m_water_normalmap, waterTex1 + vec2(disdis) * vec2(m_distortionMix)); |
|
|
|
nmap = (nmap-ofive) * two; |
|
|
|
nmap = (nmap-ofive) * two; |
|
|
|
// nmap = nmap*2.0-1.0; |
|
|
|
// nmap = nmap*2.0-1.0; |
|
|
|
vec4 vNorm = normalize(nmap); |
|
|
|
vec4 vNorm = normalize(nmap); |
|
|
|