summaryrefslogtreecommitdiff
path: root/slideshow/opengl/vortexVertexShader.glsl
diff options
context:
space:
mode:
authorEmmanuel Gil Peyrot <emmanuel.peyrot@collabora.com>2016-02-09 09:27:47 +0000
committerMichael Meeks <michael.meeks@collabora.com>2016-02-09 17:02:46 +0000
commit0c14c7babb71588fd93c1adccf4a99bf1b65dbd3 (patch)
tree9b6dbc38f7df6f9afe361d9f3fa4dfe543b5d803 /slideshow/opengl/vortexVertexShader.glsl
parent882d27fce20ee0537f785a619be1dd065ea6bbca (diff)
slideshow: Add shadows to the Vortex transition
These are done using a shadow mapping technique, we render both slides from the point of view of the light, and then do a second pass in which we lower the light of the fragment if some other cube is above it. Change-Id: I8aaa1428c4481661283bf69b5e56aa4d95fb80dd Reviewed-on: https://gerrit.libreoffice.org/22232 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Diffstat (limited to 'slideshow/opengl/vortexVertexShader.glsl')
-rw-r--r--slideshow/opengl/vortexVertexShader.glsl19
1 files changed, 13 insertions, 6 deletions
diff --git a/slideshow/opengl/vortexVertexShader.glsl b/slideshow/opengl/vortexVertexShader.glsl
index 603c62960f2a..9bab2d9e0397 100644
--- a/slideshow/opengl/vortexVertexShader.glsl
+++ b/slideshow/opengl/vortexVertexShader.glsl
@@ -16,6 +16,7 @@ in vec3 a_normal;
in vec2 a_texCoord;
in float tileInfo;
+uniform mat4 u_projectionMatrix;
uniform mat4 u_modelViewMatrix;
uniform mat4 u_sceneTransformMatrix;
uniform mat4 u_primitiveTransformMatrix;
@@ -25,10 +26,15 @@ uniform float time;
uniform ivec2 numTiles;
uniform sampler2D permTexture;
uniform float slide;
+uniform float shadow;
+uniform mat4 orthoProjectionMatrix;
+uniform mat4 orthoViewMatrix;
out vec2 g_texturePosition;
out vec3 g_normal;
+out mat4 projectionMatrix;
out mat4 modelViewMatrix;
+out mat4 shadowMatrix;
out mat4 transform;
out float nTime;
out float startTime;
@@ -134,13 +140,14 @@ void main( void )
* rotationMatrix(vec3(0.0, 1.0, 0.0), clamp(rotation, -1.0, 1.0) * M_PI)
* translationMatrix(-translationVector)
* transform;
+ }
- // Add a translation movement to the leaving slide so it doesn’t exactly mirror the entering one.
- if (isLeavingSlide && nTime > 0.3)
- {
- float movement = smoothstep(0.0, 1.0, (nTime - 0.3) * 2.0);
- transform = translationMatrix(vec3(-movement, 0.0, -0.5 * movement)) * transform;
- }
+ if (shadow < 0.5) {
+ projectionMatrix = u_projectionMatrix;
+ shadowMatrix = orthoProjectionMatrix * orthoViewMatrix;
+ } else {
+ projectionMatrix = orthoProjectionMatrix * orthoViewMatrix;
+ shadowMatrix = mat4(0.0);
}
modelViewMatrix = u_modelViewMatrix * u_operationsTransformMatrix * u_sceneTransformMatrix * u_primitiveTransformMatrix;