diff options
author | Graham Linden graham@lindenlab.com <Graham Linden graham@lindenlab.com> | 2018-03-09 21:40:46 +0000 |
---|---|---|
committer | Graham Linden graham@lindenlab.com <Graham Linden graham@lindenlab.com> | 2018-03-09 21:40:46 +0000 |
commit | b6b23926340d8a2ac142b02923f04624b7c6b08e (patch) | |
tree | 211401687ba748beb05ed7323b41e47e80287549 /indra/newview/app_settings/shaders/class1/environment | |
parent | b2d8d63890e3ba0a5fe303f8e2de7358e4f9fc23 (diff) |
De-duplicate water fog code and modify programs to include the shared object as necessary.
Diffstat (limited to 'indra/newview/app_settings/shaders/class1/environment')
-rw-r--r-- | indra/newview/app_settings/shaders/class1/environment/waterFogF.glsl | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/indra/newview/app_settings/shaders/class1/environment/waterFogF.glsl b/indra/newview/app_settings/shaders/class1/environment/waterFogF.glsl index 4bdfce9260..a7c28a1ac3 100644 --- a/indra/newview/app_settings/shaders/class1/environment/waterFogF.glsl +++ b/indra/newview/app_settings/shaders/class1/environment/waterFogF.glsl @@ -33,10 +33,10 @@ uniform float waterFogKS; vec3 getPositionEye(); -vec4 applyWaterFog(vec4 color) +vec4 applyWaterFogView(vec3 pos, vec4 color) { + vec3 view = normalize(pos); //normalize view vector - vec3 view = normalize(getPositionEye()); float es = -(dot(view, waterPlane.xyz)); //find intersection point with water plane and eye vector @@ -47,7 +47,7 @@ vec4 applyWaterFog(vec4 color) vec3 int_v = waterPlane.w > 0.0 ? view * waterPlane.w/es : vec3(0.0, 0.0, 0.0); //get object depth - float depth = length(getPositionEye() - int_v); + float depth = length(pos - int_v); //get "thickness" of water float l = max(depth, 0.1); @@ -72,3 +72,9 @@ vec4 applyWaterFog(vec4 color) return color; } +vec4 applyWaterFog(vec4 color) +{ + //normalize view vector + return applyWaterFogView(getPositionEye(), color); +} + |