diff options
author | Emmanuel Gil Peyrot <emmanuel.peyrot@collabora.com> | 2016-02-09 23:59:16 +0000 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2016-02-09 23:59:52 +0000 |
commit | d323f2487d84fbd3909cd2166b98a2a875b71bf8 (patch) | |
tree | 6a76c24bfb28cc632d8261435263d7be8b2772ef /slideshow/opengl/honeycombFragmentShader.glsl | |
parent | 1f8ddf1b8ff4727473676de9c7fda24b49b9599d (diff) |
slideshow: Add shadows to Honeycomb, using the same way as Vortex
Change-Id: I1f8f11f900f281792b417c1efead272fe3e8432e
Diffstat (limited to 'slideshow/opengl/honeycombFragmentShader.glsl')
-rw-r--r-- | slideshow/opengl/honeycombFragmentShader.glsl | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/slideshow/opengl/honeycombFragmentShader.glsl b/slideshow/opengl/honeycombFragmentShader.glsl index 7e529517915f..41b6738a804f 100644 --- a/slideshow/opengl/honeycombFragmentShader.glsl +++ b/slideshow/opengl/honeycombFragmentShader.glsl @@ -13,8 +13,11 @@ in vec2 texturePosition; in float fuzz; in vec2 v_center; in vec3 normal; +in vec4 shadowCoordinate; uniform sampler2D slideTexture; +uniform sampler2D colorShadowTexture; +uniform sampler2D depthShadowTexture; uniform float selectedTexture; uniform float time; uniform float hexagonSize; @@ -70,8 +73,14 @@ void main() fragment.rgb *= actualTime; } } + float visibility = 1.0; + const float epsilon = 0.0001; + if (texture2D(depthShadowTexture, shadowCoordinate.xy).r < shadowCoordinate.z - epsilon) + visibility *= 0.7 + 0.3 * (1.0 - texture2D(colorShadowTexture, shadowCoordinate.xy).a); vec4 black = vec4(0.0, 0.0, 0.0, fragment.a); - gl_FragColor = mix(black, fragment, light); + if (fragment.a < 0.001) + discard; + gl_FragColor = mix(black, fragment, visibility * light); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |