summaryrefslogtreecommitdiffstats
path: root/slideshow/opengl
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:06:44 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:06:44 +0000
commited5640d8b587fbcfed7dd7967f3de04b37a76f26 (patch)
tree7a5f7c6c9d02226d7471cb3cc8fbbf631b415303 /slideshow/opengl
parentInitial commit. (diff)
downloadlibreoffice-cb75148ebd0135178ff46f89a30139c44f8d2040.tar.xz
libreoffice-cb75148ebd0135178ff46f89a30139c44f8d2040.zip
Adding upstream version 4:7.4.7.upstream/4%7.4.7upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--slideshow/opengl/basicFragmentShader.glsl24
-rw-r--r--slideshow/opengl/basicVertexShader.glsl96
-rw-r--r--slideshow/opengl/dissolveFragmentShader.glsl50
-rw-r--r--slideshow/opengl/fadeBlackFragmentShader.glsl35
-rw-r--r--slideshow/opengl/fadeFragmentShader.glsl23
-rw-r--r--slideshow/opengl/glitterFragmentShader.glsl36
-rw-r--r--slideshow/opengl/glitterVertexShader.glsl128
-rw-r--r--slideshow/opengl/honeycombFragmentShader.glsl108
-rw-r--r--slideshow/opengl/honeycombGeometryShader.glsl111
-rw-r--r--slideshow/opengl/honeycombVertexShader.glsl118
-rw-r--r--slideshow/opengl/reflectionFragmentShader.glsl34
-rw-r--r--slideshow/opengl/reflectionVertexShader.glsl79
-rw-r--r--slideshow/opengl/rippleFragmentShader.glsl57
-rw-r--r--slideshow/opengl/staticFragmentShader.glsl64
-rw-r--r--slideshow/opengl/vortexFragmentShader.glsl68
-rw-r--r--slideshow/opengl/vortexGeometryShader.glsl116
-rw-r--r--slideshow/opengl/vortexVertexShader.glsl153
17 files changed, 1300 insertions, 0 deletions
diff --git a/slideshow/opengl/basicFragmentShader.glsl b/slideshow/opengl/basicFragmentShader.glsl
new file mode 100644
index 000000000..fe27071a9
--- /dev/null
+++ b/slideshow/opengl/basicFragmentShader.glsl
@@ -0,0 +1,24 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#version 120
+
+uniform sampler2D slideTexture;
+varying vec2 v_texturePosition;
+varying vec3 v_normal;
+
+void main() {
+ vec3 lightVector = vec3(0.0, 0.0, 1.0);
+ float light = max(dot(lightVector, v_normal), 0.0);
+ vec4 fragment = texture2D(slideTexture, v_texturePosition);
+ vec4 black = vec4(0.0, 0.0, 0.0, fragment.a);
+ gl_FragColor = mix(black, fragment, light);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/slideshow/opengl/basicVertexShader.glsl b/slideshow/opengl/basicVertexShader.glsl
new file mode 100644
index 000000000..730da36fd
--- /dev/null
+++ b/slideshow/opengl/basicVertexShader.glsl
@@ -0,0 +1,96 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#version 120
+
+attribute vec3 a_position;
+attribute vec3 a_normal;
+attribute vec2 a_texCoord;
+
+uniform mat4 u_projectionMatrix;
+uniform mat4 u_modelViewMatrix;
+uniform mat4 u_sceneTransformMatrix;
+uniform mat4 u_primitiveTransformMatrix;
+uniform mat4 u_operationsTransformMatrix;
+
+varying vec2 v_texturePosition;
+varying vec3 v_normal;
+
+#if __VERSION__ < 140
+mat4 inverse(mat4 m)
+{
+ float a00 = m[0][0], a01 = m[0][1], a02 = m[0][2], a03 = m[0][3];
+ float a10 = m[1][0], a11 = m[1][1], a12 = m[1][2], a13 = m[1][3];
+ float a20 = m[2][0], a21 = m[2][1], a22 = m[2][2], a23 = m[2][3];
+ float a30 = m[3][0], a31 = m[3][1], a32 = m[3][2], a33 = m[3][3];
+
+ float b00 = a00 * a11 - a01 * a10;
+ float b01 = a00 * a12 - a02 * a10;
+ float b02 = a00 * a13 - a03 * a10;
+ float b03 = a01 * a12 - a02 * a11;
+ float b04 = a01 * a13 - a03 * a11;
+ float b05 = a02 * a13 - a03 * a12;
+ float b06 = a20 * a31 - a21 * a30;
+ float b07 = a20 * a32 - a22 * a30;
+ float b08 = a20 * a33 - a23 * a30;
+ float b09 = a21 * a32 - a22 * a31;
+ float b10 = a21 * a33 - a23 * a31;
+ float b11 = a22 * a33 - a23 * a32;
+
+ float det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;
+
+ return mat4(
+ a11 * b11 - a12 * b10 + a13 * b09,
+ a02 * b10 - a01 * b11 - a03 * b09,
+ a31 * b05 - a32 * b04 + a33 * b03,
+ a22 * b04 - a21 * b05 - a23 * b03,
+ a12 * b08 - a10 * b11 - a13 * b07,
+ a00 * b11 - a02 * b08 + a03 * b07,
+ a32 * b02 - a30 * b05 - a33 * b01,
+ a20 * b05 - a22 * b02 + a23 * b01,
+ a10 * b10 - a11 * b08 + a13 * b06,
+ a01 * b08 - a00 * b10 - a03 * b06,
+ a30 * b04 - a31 * b02 + a33 * b00,
+ a21 * b02 - a20 * b04 - a23 * b00,
+ a11 * b07 - a10 * b09 - a12 * b06,
+ a00 * b09 - a01 * b07 + a02 * b06,
+ a31 * b01 - a30 * b03 - a32 * b00,
+ a20 * b03 - a21 * b01 + a22 * b00) / det;
+}
+#endif
+
+void main( void )
+{
+ mat4 modelViewMatrix = u_modelViewMatrix * u_operationsTransformMatrix * u_sceneTransformMatrix * u_primitiveTransformMatrix;
+ mat3 normalMatrix = mat3(transpose(inverse(modelViewMatrix)));
+ gl_Position = u_projectionMatrix * modelViewMatrix * vec4(a_position, 1.0);
+ v_texturePosition = a_texCoord;
+ v_normal = normalize(normalMatrix * a_normal);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/slideshow/opengl/dissolveFragmentShader.glsl b/slideshow/opengl/dissolveFragmentShader.glsl
new file mode 100644
index 000000000..c0fdbf441
--- /dev/null
+++ b/slideshow/opengl/dissolveFragmentShader.glsl
@@ -0,0 +1,50 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#version 120
+
+uniform sampler2D leavingSlideTexture;
+uniform sampler2D enteringSlideTexture;
+uniform sampler2D permTexture;
+uniform float time;
+varying vec2 v_texturePosition;
+
+float snoise(vec2 P) {
+
+ return texture2D(permTexture, P).r;
+}
+
+void main() {
+ float sn = snoise(10.0*v_texturePosition);
+ if( sn < time)
+ gl_FragColor = texture2D(enteringSlideTexture, v_texturePosition);
+ else
+ gl_FragColor = texture2D(leavingSlideTexture, v_texturePosition);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/slideshow/opengl/fadeBlackFragmentShader.glsl b/slideshow/opengl/fadeBlackFragmentShader.glsl
new file mode 100644
index 000000000..3d618a3b4
--- /dev/null
+++ b/slideshow/opengl/fadeBlackFragmentShader.glsl
@@ -0,0 +1,35 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#version 120
+
+uniform sampler2D leavingSlideTexture;
+uniform sampler2D enteringSlideTexture;
+uniform float time;
+varying vec2 v_texturePosition;
+
+void main() {
+#ifdef use_white
+ vec4 color = vec4(1.0, 1.0, 1.0, 1.0);
+#else
+ vec4 color = vec4(0.0, 0.0, 0.0, 1.0);
+#endif
+ vec4 texel;
+ float amount;
+ if (time < 0.5) {
+ texel = texture2D(leavingSlideTexture, v_texturePosition);
+ amount = time * 2;
+ } else {
+ texel = texture2D(enteringSlideTexture, v_texturePosition);
+ amount = (1.0 - time) * 2;
+ }
+ gl_FragColor = mix(texel, color, amount);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/slideshow/opengl/fadeFragmentShader.glsl b/slideshow/opengl/fadeFragmentShader.glsl
new file mode 100644
index 000000000..0751b6ecd
--- /dev/null
+++ b/slideshow/opengl/fadeFragmentShader.glsl
@@ -0,0 +1,23 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#version 120
+
+uniform sampler2D leavingSlideTexture;
+uniform sampler2D enteringSlideTexture;
+uniform float time;
+varying vec2 v_texturePosition;
+
+void main() {
+ vec4 leavingFragment = texture2D(leavingSlideTexture, v_texturePosition);
+ vec4 enteringFragment = texture2D(enteringSlideTexture, v_texturePosition);
+ gl_FragColor = mix(leavingFragment, enteringFragment, time);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/slideshow/opengl/glitterFragmentShader.glsl b/slideshow/opengl/glitterFragmentShader.glsl
new file mode 100644
index 000000000..71881742c
--- /dev/null
+++ b/slideshow/opengl/glitterFragmentShader.glsl
@@ -0,0 +1,36 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#version 120
+
+#define M_PI 3.1415926535897932384626433832795
+
+uniform sampler2D leavingSlideTexture;
+uniform sampler2D enteringSlideTexture;
+varying vec2 v_texturePosition;
+varying vec3 v_normal;
+
+uniform float time;
+varying float angle;
+
+void main() {
+ vec3 lightVector = vec3(0.0, 0.0, 1.0);
+ float light = dot(lightVector, v_normal);
+
+ vec4 fragment;
+ if (angle < M_PI)
+ fragment = texture2D(leavingSlideTexture, v_texturePosition);
+ else
+ fragment = texture2D(enteringSlideTexture, v_texturePosition);
+
+ vec4 black = vec4(0.0, 0.0, 0.0, fragment.a);
+ gl_FragColor = mix(black, fragment, max(light, 0.0));
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/slideshow/opengl/glitterVertexShader.glsl b/slideshow/opengl/glitterVertexShader.glsl
new file mode 100644
index 000000000..00ae568ac
--- /dev/null
+++ b/slideshow/opengl/glitterVertexShader.glsl
@@ -0,0 +1,128 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#version 120
+
+#define M_PI 3.1415926535897932384626433832795
+
+attribute vec3 a_position;
+attribute vec3 a_normal;
+
+uniform mat4 u_projectionMatrix;
+uniform mat4 u_modelViewMatrix;
+uniform mat4 u_sceneTransformMatrix;
+uniform mat4 u_primitiveTransformMatrix;
+uniform mat4 u_operationsTransformMatrix;
+
+varying vec2 v_texturePosition;
+varying vec3 v_normal;
+
+attribute vec3 center;
+uniform float time;
+uniform ivec2 numTiles;
+uniform sampler2D permTexture;
+varying float angle;
+
+#if __VERSION__ < 140
+mat4 inverse(mat4 m)
+{
+ float a00 = m[0][0], a01 = m[0][1], a02 = m[0][2], a03 = m[0][3];
+ float a10 = m[1][0], a11 = m[1][1], a12 = m[1][2], a13 = m[1][3];
+ float a20 = m[2][0], a21 = m[2][1], a22 = m[2][2], a23 = m[2][3];
+ float a30 = m[3][0], a31 = m[3][1], a32 = m[3][2], a33 = m[3][3];
+
+ float b00 = a00 * a11 - a01 * a10;
+ float b01 = a00 * a12 - a02 * a10;
+ float b02 = a00 * a13 - a03 * a10;
+ float b03 = a01 * a12 - a02 * a11;
+ float b04 = a01 * a13 - a03 * a11;
+ float b05 = a02 * a13 - a03 * a12;
+ float b06 = a20 * a31 - a21 * a30;
+ float b07 = a20 * a32 - a22 * a30;
+ float b08 = a20 * a33 - a23 * a30;
+ float b09 = a21 * a32 - a22 * a31;
+ float b10 = a21 * a33 - a23 * a31;
+ float b11 = a22 * a33 - a23 * a32;
+
+ float det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;
+
+ return mat4(
+ a11 * b11 - a12 * b10 + a13 * b09,
+ a02 * b10 - a01 * b11 - a03 * b09,
+ a31 * b05 - a32 * b04 + a33 * b03,
+ a22 * b04 - a21 * b05 - a23 * b03,
+ a12 * b08 - a10 * b11 - a13 * b07,
+ a00 * b11 - a02 * b08 + a03 * b07,
+ a32 * b02 - a30 * b05 - a33 * b01,
+ a20 * b05 - a22 * b02 + a23 * b01,
+ a10 * b10 - a11 * b08 + a13 * b06,
+ a01 * b08 - a00 * b10 - a03 * b06,
+ a30 * b04 - a31 * b02 + a33 * b00,
+ a21 * b02 - a20 * b04 - a23 * b00,
+ a11 * b07 - a10 * b09 - a12 * b06,
+ a00 * b09 - a01 * b07 + a02 * b06,
+ a31 * b01 - a30 * b03 - a32 * b00,
+ a20 * b03 - a21 * b01 + a22 * b00) / det;
+}
+#endif
+
+float snoise(vec2 p)
+{
+ return texture2D(permTexture, p).r;
+}
+
+mat4 translationMatrix(vec3 axis)
+{
+ return mat4(1.0, 0.0, 0.0, 0.0,
+ 0.0, 1.0, 0.0, 0.0,
+ 0.0, 0.0, 1.0, 0.0,
+ axis.x, axis.y, axis.z, 1.0);
+}
+
+mat4 rotationMatrix(vec3 axis, float angle)
+{
+ axis = normalize(axis);
+ float s = sin(angle);
+ float c = cos(angle);
+ float oc = 1.0 - c;
+
+ return mat4(oc * axis.x * axis.x + c, oc * axis.x * axis.y - axis.z * s, oc * axis.z * axis.x + axis.y * s, 0.0,
+ oc * axis.x * axis.y + axis.z * s, oc * axis.y * axis.y + c, oc * axis.y * axis.z - axis.x * s, 0.0,
+ oc * axis.z * axis.x - axis.y * s, oc * axis.y * axis.z + axis.x * s, oc * axis.z * axis.z + c, 0.0,
+ 0.0, 0.0, 0.0, 1.0);
+}
+
+void main( void )
+{
+ vec2 pos = (center.xy + 1.0) / 2.0;
+
+ // 0..1 pseudo-random value used to randomize the tile’s start time.
+ float fuzz = snoise(pos);
+
+ float startTime = pos.x * 0.5 + fuzz * 0.25;
+ float endTime = startTime + 0.25;
+
+ // Scale the transition time to minimize the time a tile will stay black.
+ float transitionTime = clamp((time - startTime) / (endTime - startTime), 0.0, 1.0);
+ if (transitionTime < 0.5)
+ transitionTime = transitionTime / 2.0;
+ else
+ transitionTime = (transitionTime / 2.0) + 0.5;
+ angle = transitionTime * M_PI * 2.0;
+
+ mat4 modelViewMatrix = u_modelViewMatrix * u_operationsTransformMatrix * u_sceneTransformMatrix * u_primitiveTransformMatrix;
+ mat4 transformMatrix = translationMatrix(center) * rotationMatrix(vec3(0.0, 1.0, 0.0), angle) * translationMatrix(-center);
+
+ mat3 normalMatrix = mat3(transpose(inverse(transformMatrix)));
+ gl_Position = u_projectionMatrix * modelViewMatrix * transformMatrix * vec4(a_position, 1.0);
+ v_texturePosition = vec2((a_position.x + 1.0) / 2.0, (1.0 - a_position.y) / 2.0);
+ v_normal = normalize(normalMatrix * a_normal);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/slideshow/opengl/honeycombFragmentShader.glsl b/slideshow/opengl/honeycombFragmentShader.glsl
new file mode 100644
index 000000000..e4ce8e31f
--- /dev/null
+++ b/slideshow/opengl/honeycombFragmentShader.glsl
@@ -0,0 +1,108 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#version 150
+
+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;
+
+bool isBorder(vec2 point)
+{
+ return point.x < 0.02 || point.x > 0.98 || point.y < 0.02 || point.y > 0.98;
+}
+
+void main()
+{
+ const vec2 samplingPoints[9] = vec2[](
+ vec2(0, 0),
+ vec2(-1, -1),
+ vec2(-1, 0),
+ vec2(-1, 1),
+ vec2(0, 1),
+ vec2(1, 1),
+ vec2(1, 0),
+ vec2(1, -1),
+ vec2(0, -1)
+ );
+
+ vec4 fragment = vec4(texture(slideTexture, texturePosition).rgb, 1.0);
+ vec3 lightVector = vec3(0.0, 0.0, 1.0);
+ float light = max(dot(lightVector, normal), 0.0);
+ if (hexagonSize > 1.0) {
+ // The space in-between hexagons.
+ if (selectedTexture > 0.5)
+ fragment.a = 1.0 - time * 8 + gl_FragCoord.x / 1024.;
+ else
+ fragment.a = time * 8 - 7.3 + gl_FragCoord.x / 1024.;
+ } else {
+ // The hexagons themselves.
+
+ float startTime;
+ float actualTime;
+ if (selectedTexture > 0.5) {
+ // Leaving slide.
+ if (isBorder(v_center))
+ // If the center is “outside” of the canvas, clear it first.
+ startTime = 0.15;
+ else
+ startTime = 0.15 + fuzz * 0.4;
+ float endTime = startTime + 0.05;
+ actualTime = 1.0 - clamp((time - startTime) / (endTime - startTime), 0, 1);
+ } else {
+ // Entering slide.
+ if (isBorder(v_center))
+ // If the center is “outside” of the canvas, clear it first.
+ startTime = 0.85;
+ else
+ startTime = 0.3 + fuzz * 0.4;
+ float endTime = startTime + 0.05;
+ actualTime = clamp((time - startTime) / (endTime - startTime), 0, 1);
+ if (time < 0.8)
+ actualTime *= time / 0.8;
+ }
+
+ if (selectedTexture > 0.5) {
+ // Leaving texture needs to be transparent to see-through.
+ fragment.a = actualTime;
+ } else {
+ // Entering one though, would look weird with transparency.
+ fragment.rgb *= actualTime;
+ }
+ }
+
+ // Compute the shadow.
+ float visibility = 1.0;
+ const float epsilon = 0.0001;
+ if (selectedTexture < 0.5) {
+ float depthShadow = texture(depthShadowTexture, shadowCoordinate.xy).z;
+ float shadowRadius = (1.0 / (shadowCoordinate.z - depthShadow)) * 1000.0;
+ // Only the entering slide.
+ for (int i = 0; i < 9; ++i) {
+ vec2 coordinate = shadowCoordinate.xy + samplingPoints[i] / shadowRadius;
+ if (depthShadow < shadowCoordinate.z - epsilon) {
+ visibility -= 0.05 * texture(colorShadowTexture, coordinate).a;
+ }
+ }
+ }
+
+ vec4 black = vec4(0.0, 0.0, 0.0, fragment.a);
+ gl_FragColor = mix(black, fragment, visibility * light);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/slideshow/opengl/honeycombGeometryShader.glsl b/slideshow/opengl/honeycombGeometryShader.glsl
new file mode 100644
index 000000000..dedc0df97
--- /dev/null
+++ b/slideshow/opengl/honeycombGeometryShader.glsl
@@ -0,0 +1,111 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#version 150
+
+layout(triangles) in;
+layout(triangle_strip, max_vertices=27) out;
+
+in mat4 projectionMatrix[];
+in mat4 modelViewMatrix[];
+in mat4 shadowMatrix[];
+
+uniform float hexagonSize;
+uniform sampler2D permTexture;
+
+out vec2 texturePosition;
+out float fuzz;
+out vec2 v_center;
+out vec3 normal;
+out vec4 shadowCoordinate;
+
+const float expandFactor = 0.0318;
+
+float snoise(vec2 p)
+{
+ return texture(permTexture, p).r;
+}
+
+mat4 identityMatrix(void)
+{
+ return mat4(1.0, 0.0, 0.0, 0.0,
+ 0.0, 1.0, 0.0, 0.0,
+ 0.0, 0.0, 1.0, 0.0,
+ 0.0, 0.0, 0.0, 1.0);
+}
+
+mat4 scaleMatrix(vec3 axis)
+{
+ mat4 matrix = identityMatrix();
+ matrix[0][0] = axis.x;
+ matrix[1][1] = axis.y;
+ matrix[2][2] = axis.z;
+ return matrix;
+}
+
+mat4 translationMatrix(vec3 axis)
+{
+ mat4 matrix = identityMatrix();
+ matrix[3] = vec4(axis, 1.0);
+ return matrix;
+}
+
+void emitHexagonVertex(vec3 center, vec2 translation)
+{
+ vec4 pos = vec4(center + hexagonSize * expandFactor * vec3(translation, 0.0), 1.0);
+ gl_Position = projectionMatrix[0] * modelViewMatrix[0] * pos;
+ shadowCoordinate = translationMatrix(vec3(0.5, 0.5, 0.5)) * scaleMatrix(vec3(0.5, 0.5, 0.5)) * shadowMatrix[0] * modelViewMatrix[0] * pos;
+ texturePosition = vec2((pos.x + 1), (1 - pos.y)) / 2;
+ EmitVertex();
+}
+
+void main()
+{
+ const vec2 translateVectors[6] = vec2[](
+ vec2(-3, -2),
+ vec2(0, -4),
+ vec2(3, -2),
+ vec2(3, 2),
+ vec2(0, 4),
+ vec2(-3, 2)
+ );
+
+ vec3 center = gl_in[0].gl_Position.xyz;
+
+ v_center = (1 + center.xy) / 2;
+ fuzz = snoise(center.xy);
+
+ // Draw “walls” to the hexagons.
+ if (hexagonSize < 1.0) {
+ vec3 rearCenter = vec3(center.xy, -0.3);
+ normal = vec3(0.0, 0.0, 0.3);
+ emitHexagonVertex(center, translateVectors[5]);
+ emitHexagonVertex(rearCenter, translateVectors[5]);
+
+ for (int i = 0; i < 6; ++i) {
+ emitHexagonVertex(center, translateVectors[i]);
+ emitHexagonVertex(rearCenter, translateVectors[i]);
+ }
+
+ EndPrimitive();
+ }
+
+ // Draw the main hexagon part.
+ normal = vec3(0.0, 0.0, 1.0);
+ emitHexagonVertex(center, translateVectors[5]);
+
+ for (int i = 0; i < 6; ++i) {
+ emitHexagonVertex(center, translateVectors[i]);
+ emitHexagonVertex(center, vec2(0.0, 0.0));
+ }
+
+ EndPrimitive();
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/slideshow/opengl/honeycombVertexShader.glsl b/slideshow/opengl/honeycombVertexShader.glsl
new file mode 100644
index 000000000..c3484d39a
--- /dev/null
+++ b/slideshow/opengl/honeycombVertexShader.glsl
@@ -0,0 +1,118 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#version 150
+
+#define M_PI 3.1415926535897932384626433832795
+
+in vec3 a_position;
+
+uniform mat4 u_projectionMatrix;
+uniform mat4 u_modelViewMatrix;
+uniform mat4 u_sceneTransformMatrix;
+uniform mat4 u_primitiveTransformMatrix;
+uniform mat4 u_operationsTransformMatrix;
+
+uniform float time;
+uniform float selectedTexture;
+uniform float shadow;
+uniform mat4 orthoProjectionMatrix;
+uniform mat4 orthoViewMatrix;
+
+// Workaround for Intel's Windows driver, to prevent optimisation breakage.
+uniform float zero;
+
+out mat4 projectionMatrix;
+out mat4 modelViewMatrix;
+out mat4 shadowMatrix;
+
+mat4 identityMatrix(void)
+{
+ return mat4(1.0, 0.0, 0.0, 0.0,
+ 0.0, 1.0, 0.0, 0.0,
+ 0.0, 0.0, 1.0, 0.0,
+ 0.0, 0.0, 0.0, 1.0);
+}
+
+mat4 translationMatrix(vec3 axis)
+{
+ return mat4(1.0, 0.0, 0.0, 0.0,
+ 0.0, 1.0, 0.0, 0.0,
+ 0.0, 0.0, 1.0, 0.0,
+ axis.x, axis.y, axis.z, 1.0);
+}
+
+mat4 scaleMatrix(vec3 axis)
+{
+ return mat4(axis.x, 0.0, 0.0, 0.0,
+ 0.0, axis.y, 0.0, 0.0,
+ 0.0, 0.0, axis.z, 0.0,
+ 0.0, 0.0, 0.0, 1.0);
+}
+
+mat4 rotationMatrix(vec3 axis, float angle)
+{
+ axis = normalize(axis);
+ float s = sin(angle);
+ float c = cos(angle);
+ float oc = 1.0 - c;
+
+ return mat4(oc * axis.x * axis.x + c, oc * axis.x * axis.y - axis.z * s, oc * axis.z * axis.x + axis.y * s, 0.0,
+ oc * axis.x * axis.y + axis.z * s, oc * axis.y * axis.y + c, oc * axis.y * axis.z - axis.x * s, 0.0,
+ oc * axis.z * axis.x - axis.y * s, oc * axis.y * axis.z + axis.x * s, oc * axis.z * axis.z + c, 0.0,
+ 0.0, 0.0, 0.0, 1.0);
+}
+
+void main( void )
+{
+ mat4 nmodelViewMatrix = u_modelViewMatrix * u_operationsTransformMatrix * u_sceneTransformMatrix * u_primitiveTransformMatrix;
+ mat4 transformMatrix = identityMatrix();
+
+ // TODO: use the aspect ratio of the slide instead.
+ mat4 slideScaleMatrix = scaleMatrix(vec3(0.75, 1, 1));
+ mat4 invertSlideScaleMatrix = scaleMatrix(1.0 / vec3(0.75, 1, 1));
+
+ // These ugly zero comparisons are a workaround for Intel's Windows driver optimisation bug.
+ if (selectedTexture > 0.5) {
+ // Leaving texture
+ if (zero < 1.0)
+ transformMatrix = invertSlideScaleMatrix * transformMatrix;
+ if (zero < 2.0)
+ transformMatrix = rotationMatrix(vec3(0.0, 0.0, 1.0), -pow(time, 3) * M_PI) * transformMatrix;
+ if (zero < 3.0)
+ transformMatrix = slideScaleMatrix * transformMatrix;
+ if (zero < 4.0)
+ transformMatrix = scaleMatrix(vec3(1 + pow(2 * time, 2.1), 1 + pow(2 * time, 2.1), 0)) * transformMatrix;
+ if (zero < 5.0)
+ transformMatrix = translationMatrix(vec3(0, 0, 6 * time)) * transformMatrix;
+ } else {
+ // Entering texture
+ if (zero < 1.0)
+ transformMatrix = invertSlideScaleMatrix * transformMatrix;
+ if (zero < 2.0)
+ transformMatrix = rotationMatrix(vec3(0.0, 0.0, 1.0), pow(0.8 * (time - 1.0), 2.0) * M_PI) * transformMatrix;
+ if (zero < 3.0)
+ transformMatrix = slideScaleMatrix * transformMatrix;
+ if (zero < 4.0)
+ transformMatrix = translationMatrix(vec3(0, 0, 28 * (sqrt(time) - 1))) * transformMatrix;
+ }
+
+ if (shadow < 0.5) {
+ projectionMatrix = u_projectionMatrix;
+ shadowMatrix = orthoProjectionMatrix * orthoViewMatrix;
+ } else {
+ projectionMatrix = orthoProjectionMatrix * orthoViewMatrix;
+ shadowMatrix = mat4(0.0);
+ }
+
+ modelViewMatrix = nmodelViewMatrix * transformMatrix;
+ gl_Position = vec4(a_position, 1.0);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/slideshow/opengl/reflectionFragmentShader.glsl b/slideshow/opengl/reflectionFragmentShader.glsl
new file mode 100644
index 000000000..c50b6a9d2
--- /dev/null
+++ b/slideshow/opengl/reflectionFragmentShader.glsl
@@ -0,0 +1,34 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#version 130
+
+uniform sampler2D slideTexture;
+varying float v_isShadow;
+varying vec2 v_texturePosition;
+varying vec3 v_normal;
+
+void main() {
+ vec3 lightVector = vec3(0.0, 0.0, 1.0);
+ float light = max(dot(lightVector, v_normal), 0.0);
+ vec4 fragment = texture2D(slideTexture, v_texturePosition);
+ vec4 black = vec4(0.0, 0.0, 0.0, fragment.a);
+ fragment = mix(black, fragment, light);
+
+ if (v_isShadow > 0.5) {
+ if (v_texturePosition.y > 1.0 - 0.3)
+ gl_FragColor = mix(fragment, vec4(0.0, 0.0, 0.0, 0.0), (1.0 - v_texturePosition.y) / 0.3);
+ else
+ discard;
+ } else {
+ gl_FragColor = fragment;
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/slideshow/opengl/reflectionVertexShader.glsl b/slideshow/opengl/reflectionVertexShader.glsl
new file mode 100644
index 000000000..6c0c41c75
--- /dev/null
+++ b/slideshow/opengl/reflectionVertexShader.glsl
@@ -0,0 +1,79 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#version 130
+
+attribute vec3 a_position;
+attribute vec3 a_normal;
+attribute vec2 a_texCoord;
+
+uniform mat4 u_projectionMatrix;
+uniform mat4 u_modelViewMatrix;
+uniform mat4 u_sceneTransformMatrix;
+uniform mat4 u_primitiveTransformMatrix;
+uniform mat4 u_operationsTransformMatrix;
+
+varying vec2 v_texturePosition;
+varying vec3 v_normal;
+varying float v_isShadow;
+
+#if __VERSION__ < 140
+mat4 inverse(mat4 m)
+{
+ float a00 = m[0][0], a01 = m[0][1], a02 = m[0][2], a03 = m[0][3];
+ float a10 = m[1][0], a11 = m[1][1], a12 = m[1][2], a13 = m[1][3];
+ float a20 = m[2][0], a21 = m[2][1], a22 = m[2][2], a23 = m[2][3];
+ float a30 = m[3][0], a31 = m[3][1], a32 = m[3][2], a33 = m[3][3];
+
+ float b00 = a00 * a11 - a01 * a10;
+ float b01 = a00 * a12 - a02 * a10;
+ float b02 = a00 * a13 - a03 * a10;
+ float b03 = a01 * a12 - a02 * a11;
+ float b04 = a01 * a13 - a03 * a11;
+ float b05 = a02 * a13 - a03 * a12;
+ float b06 = a20 * a31 - a21 * a30;
+ float b07 = a20 * a32 - a22 * a30;
+ float b08 = a20 * a33 - a23 * a30;
+ float b09 = a21 * a32 - a22 * a31;
+ float b10 = a21 * a33 - a23 * a31;
+ float b11 = a22 * a33 - a23 * a32;
+
+ float det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;
+
+ return mat4(
+ a11 * b11 - a12 * b10 + a13 * b09,
+ a02 * b10 - a01 * b11 - a03 * b09,
+ a31 * b05 - a32 * b04 + a33 * b03,
+ a22 * b04 - a21 * b05 - a23 * b03,
+ a12 * b08 - a10 * b11 - a13 * b07,
+ a00 * b11 - a02 * b08 + a03 * b07,
+ a32 * b02 - a30 * b05 - a33 * b01,
+ a20 * b05 - a22 * b02 + a23 * b01,
+ a10 * b10 - a11 * b08 + a13 * b06,
+ a01 * b08 - a00 * b10 - a03 * b06,
+ a30 * b04 - a31 * b02 + a33 * b00,
+ a21 * b02 - a20 * b04 - a23 * b00,
+ a11 * b07 - a10 * b09 - a12 * b06,
+ a00 * b09 - a01 * b07 + a02 * b06,
+ a31 * b01 - a30 * b03 - a32 * b00,
+ a20 * b03 - a21 * b01 + a22 * b00) / det;
+}
+#endif
+
+void main( void )
+{
+ mat4 modelViewMatrix = u_modelViewMatrix * u_operationsTransformMatrix * u_sceneTransformMatrix * u_primitiveTransformMatrix;
+ mat3 normalMatrix = mat3(transpose(inverse(modelViewMatrix)));
+ gl_Position = u_projectionMatrix * modelViewMatrix * vec4(a_position, 1.0);
+ v_texturePosition = a_texCoord;
+ v_normal = normalize(normalMatrix * a_normal);
+ v_isShadow = float(gl_VertexID >= 6);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/slideshow/opengl/rippleFragmentShader.glsl b/slideshow/opengl/rippleFragmentShader.glsl
new file mode 100644
index 000000000..df4bd5927
--- /dev/null
+++ b/slideshow/opengl/rippleFragmentShader.glsl
@@ -0,0 +1,57 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#version 120
+
+#define M_PI 3.1415926535897932384626433832795
+
+uniform sampler2D leavingSlideTexture;
+uniform sampler2D enteringSlideTexture;
+uniform float time;
+uniform vec2 center;
+uniform float slideRatio;
+
+varying vec2 v_texturePosition;
+
+// This function returns the distance between two points, taking into account the slide ratio.
+float betterDistance(vec2 p1, vec2 p2)
+{
+ p1.x *= slideRatio;
+ p2.x *= slideRatio;
+ return distance(p1, p2);
+}
+
+void main()
+{
+ const float w = 0.5;
+ const float v = 0.1;
+
+ // Distance from this fragment to the center, in slide coordinates.
+ float dist = betterDistance(center, v_texturePosition);
+
+ // We want the ripple to span all of the slide at the end of the transition.
+ float t = time * (sqrt(2.0) * (slideRatio < 1.0 ? 1.0 / slideRatio : slideRatio));
+
+ // Interpolate the distance to the center in function of the time.
+ float mixed = smoothstep(t*w-v, t*w+v, dist);
+
+ // Get the displacement offset from the current pixel, for fragments that have been touched by the ripple already.
+ vec2 offset = (v_texturePosition - center) * (sin(dist * 64.0 - time * 16.0) + 0.5) / 32.0;
+ vec2 wavyTexCoord = mix(v_texturePosition + offset, v_texturePosition, time);
+
+ // Get the final position we will sample from.
+ vec2 pos = mix(wavyTexCoord, v_texturePosition, mixed);
+
+ // Sample from the textures and mix that together.
+ vec4 leaving = texture2D(leavingSlideTexture, pos);
+ vec4 entering = texture2D(enteringSlideTexture, pos);
+ gl_FragColor = mix(entering, leaving, mixed);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/slideshow/opengl/staticFragmentShader.glsl b/slideshow/opengl/staticFragmentShader.glsl
new file mode 100644
index 000000000..ab4913de7
--- /dev/null
+++ b/slideshow/opengl/staticFragmentShader.glsl
@@ -0,0 +1,64 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#version 120
+
+uniform sampler2D leavingSlideTexture;
+uniform sampler2D enteringSlideTexture;
+uniform sampler2D permTexture;
+uniform float time;
+varying vec2 v_texturePosition;
+
+float snoise(vec2 P) {
+
+ return texture2D(permTexture, P).r;
+}
+
+
+#define PART 0.5
+#define START 0.4
+#define END 0.9
+
+void main() {
+ float sn = snoise(10.0*v_texturePosition+time*0.07);
+ if( time < PART ) {
+ float sn1 = snoise(vec2(time*15.0, 20.0*v_texturePosition.y));
+ float sn2 = snoise(v_texturePosition);
+ if (sn1 > 1.0 - time*time && sn2 < 2.0*time+0.1)
+ gl_FragColor = vec4(sn, sn, sn, 1.0);
+ else if (time > START )
+ gl_FragColor = ((time-START)/(PART - START))*vec4(sn, sn, sn, 1.0) + (1.0 - (time - START)/(PART - START))*texture2D(leavingSlideTexture, v_texturePosition);
+ else
+ gl_FragColor = texture2D(leavingSlideTexture, v_texturePosition);
+ } else if ( time > END ) {
+ gl_FragColor = ((1.0 - time)/(1.0 - END))*vec4(sn, sn, sn, 1.0) + ((time - END)/(1.0 - END))*texture2D(enteringSlideTexture, v_texturePosition);
+ } else
+ gl_FragColor = vec4(sn, sn, sn, 1.0);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/slideshow/opengl/vortexFragmentShader.glsl b/slideshow/opengl/vortexFragmentShader.glsl
new file mode 100644
index 000000000..6bcdfc5da
--- /dev/null
+++ b/slideshow/opengl/vortexFragmentShader.glsl
@@ -0,0 +1,68 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#version 150
+
+uniform sampler2D slideTexture;
+uniform sampler2D leavingShadowTexture;
+uniform sampler2D enteringShadowTexture;
+
+in vec2 v_texturePosition;
+in vec3 v_normal;
+in vec4 shadowCoordinate;
+
+void main() {
+ const vec2 samplingPoints[9] = vec2[](
+ vec2(0, 0),
+ vec2(-1, -1),
+ vec2(-1, 0),
+ vec2(-1, 1),
+ vec2(0, 1),
+ vec2(1, 1),
+ vec2(1, 0),
+ vec2(1, -1),
+ vec2(0, -1)
+ );
+
+ // Compute the shadow...
+ float visibility = 1.0;
+ const float epsilon = 0.0001;
+
+ // for the leaving slide,
+ {
+ float depthShadow = texture(leavingShadowTexture, shadowCoordinate.xy).r;
+ float shadowRadius = (1.0 / (shadowCoordinate.z - depthShadow)) * 1000.0;
+ for (int i = 0; i < 9; ++i) {
+ vec2 coordinate = shadowCoordinate.xy + samplingPoints[i] / shadowRadius;
+ if (texture(leavingShadowTexture, coordinate).r < shadowCoordinate.z - epsilon) {
+ visibility -= 0.05;
+ }
+ }
+ }
+
+ // and for entering slide.
+ {
+ float depthShadow = texture(enteringShadowTexture, shadowCoordinate.xy).r;
+ float shadowRadius = (1.0 / (shadowCoordinate.z - depthShadow)) * 1000.0;
+ for (int i = 0; i < 9; ++i) {
+ vec2 coordinate = shadowCoordinate.xy + samplingPoints[i] / shadowRadius;
+ if (texture(enteringShadowTexture, coordinate).r < shadowCoordinate.z - epsilon) {
+ visibility -= 0.05;
+ }
+ }
+ }
+
+ vec3 lightVector = vec3(0.0, 0.0, 1.0);
+ float light = max(dot(lightVector, v_normal), 0.0);
+ vec4 fragment = texture(slideTexture, v_texturePosition);
+ vec4 black = vec4(0.0, 0.0, 0.0, fragment.a);
+ gl_FragColor = mix(black, fragment, visibility * light);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/slideshow/opengl/vortexGeometryShader.glsl b/slideshow/opengl/vortexGeometryShader.glsl
new file mode 100644
index 000000000..5d64a1249
--- /dev/null
+++ b/slideshow/opengl/vortexGeometryShader.glsl
@@ -0,0 +1,116 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#version 150
+
+layout(triangles) in;
+layout(triangle_strip, max_vertices=11) out;
+
+uniform float shadow;
+uniform mat4 u_projectionMatrix;
+uniform mat4 orthoProjectionMatrix;
+uniform mat4 orthoViewMatrix;
+
+in vec2 g_texturePosition[];
+in vec3 g_normal[];
+in mat4 modelViewMatrix[];
+in mat4 transform[];
+in float nTime[];
+in float startTime[];
+in float endTime[];
+
+out vec2 v_texturePosition;
+out vec3 v_normal;
+out vec4 shadowCoordinate;
+
+mat4 identityMatrix(void)
+{
+ return mat4(1.0, 0.0, 0.0, 0.0,
+ 0.0, 1.0, 0.0, 0.0,
+ 0.0, 0.0, 1.0, 0.0,
+ 0.0, 0.0, 0.0, 1.0);
+}
+
+mat4 scaleMatrix(vec3 axis)
+{
+ mat4 matrix = identityMatrix();
+ matrix[0][0] = axis.x;
+ matrix[1][1] = axis.y;
+ matrix[2][2] = axis.z;
+ return matrix;
+}
+
+mat4 translationMatrix(vec3 axis)
+{
+ mat4 matrix = identityMatrix();
+ matrix[3] = vec4(axis, 1.0);
+ return matrix;
+}
+
+void emitHexagonVertex(int index, vec3 translation, float fdsq)
+{
+ mat4 projectionMatrix;
+ mat4 shadowMatrix;
+
+ if (shadow < 0.5) {
+ projectionMatrix = u_projectionMatrix;
+ shadowMatrix = orthoProjectionMatrix * orthoViewMatrix;
+ } else {
+ projectionMatrix = orthoProjectionMatrix * orthoViewMatrix;
+ shadowMatrix = mat4(0.0);
+ }
+
+ mat4 normalMatrix = transpose(inverse(modelViewMatrix[index]));
+
+ vec4 pos = gl_in[index].gl_Position + vec4(translation, 0.0);
+
+ // Apply our transform operations.
+ pos = transform[index] * pos;
+
+ v_normal = normalize(vec3(normalMatrix * transform[index] * vec4(g_normal[index], 0.0)));
+ v_normal.z *= fdsq;
+
+ gl_Position = projectionMatrix * modelViewMatrix[index] * pos;
+ shadowCoordinate = translationMatrix(vec3(0.5, 0.5, 0.5)) * scaleMatrix(vec3(0.5, 0.5, 0.5)) * shadowMatrix * modelViewMatrix[index] * pos;
+ v_texturePosition = g_texturePosition[index];
+ EmitVertex();
+}
+
+void main()
+{
+ const vec4 invalidPosition = vec4(-256.0, -256.0, -256.0, -256.0);
+ const vec3 noTranslation = vec3(0.0, 0.0, 0.0);
+
+ if (gl_in[0].gl_Position == invalidPosition)
+ return;
+
+ // Draw “walls” to the hexagons.
+ if (nTime[0] > startTime[0] && nTime[0] <= endTime[0]) {
+ const vec3 translation = vec3(0.0, 0.0, -0.02);
+
+ emitHexagonVertex(2, noTranslation, 0.3);
+ emitHexagonVertex(2, translation, 0.3);
+
+ for (int i = 0; i < 3; ++i) {
+ emitHexagonVertex(i, noTranslation, 0.3);
+ emitHexagonVertex(i, translation, 0.3);
+ }
+
+ EndPrimitive();
+ }
+
+ // Draw the main quad part.
+ for (int i = 0; i < 3; ++i) {
+ emitHexagonVertex(i, noTranslation, 1.0);
+ }
+
+ EndPrimitive();
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/slideshow/opengl/vortexVertexShader.glsl b/slideshow/opengl/vortexVertexShader.glsl
new file mode 100644
index 000000000..8d1a67d3d
--- /dev/null
+++ b/slideshow/opengl/vortexVertexShader.glsl
@@ -0,0 +1,153 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#version 150
+
+#define M_PI 3.1415926535897932384626433832795
+
+in vec3 a_position;
+in vec3 a_normal;
+in vec2 a_texCoord;
+in float tileInfo;
+
+uniform mat4 u_modelViewMatrix;
+uniform mat4 u_sceneTransformMatrix;
+uniform mat4 u_primitiveTransformMatrix;
+uniform mat4 u_operationsTransformMatrix;
+
+uniform float time;
+uniform ivec2 numTiles;
+uniform sampler2D permTexture;
+uniform float slide;
+
+// Workaround for Intel's Windows driver, to prevent optimisation breakage.
+uniform float zero;
+
+out vec2 g_texturePosition;
+out vec3 g_normal;
+out mat4 modelViewMatrix;
+out mat4 transform;
+out float nTime;
+out float startTime;
+out float endTime;
+
+float snoise(vec2 p)
+{
+ return texture(permTexture, p).r;
+}
+
+mat4 identityMatrix(void)
+{
+ return mat4(1.0, 0.0, 0.0, 0.0,
+ 0.0, 1.0, 0.0, 0.0,
+ 0.0, 0.0, 1.0, 0.0,
+ 0.0, 0.0, 0.0, 1.0);
+}
+
+mat4 translationMatrix(vec3 axis)
+{
+ mat4 matrix = identityMatrix();
+ matrix[3] = vec4(axis, 1.0);
+ return matrix;
+}
+
+mat4 rotationMatrix(vec3 axis, float angle)
+{
+ axis = normalize(axis);
+ float s = sin(angle);
+ float c = cos(angle);
+ float oc = 1.0 - c;
+
+ return mat4(oc * axis.x * axis.x + c, oc * axis.x * axis.y - axis.z * s, oc * axis.z * axis.x + axis.y * s, 0.0,
+ oc * axis.x * axis.y + axis.z * s, oc * axis.y * axis.y + c, oc * axis.y * axis.z - axis.x * s, 0.0,
+ oc * axis.z * axis.x - axis.y * s, oc * axis.y * axis.z + axis.x * s, oc * axis.z * axis.z + c, 0.0,
+ 0.0, 0.0, 0.0, 1.0);
+}
+
+void main( void )
+{
+ // Each tile moves during only half of the transition. The leftmost
+ // tiles start moving at the start and arrive at their end
+ // position around time=0.5, when the tiles there (the rightmost
+ // ones) start moving. (The exact time each tile is moving is
+ // fuzzed a bit to make a more random appearance.)
+
+ // In GLSL 1.20 we don't have any bitwise operators, sigh
+
+ int tileXIndex = int(mod(int(tileInfo), 256));
+ int tileYIndex = int(mod(int(tileInfo) / 256, 256));
+
+ // A semi-random number 0..1, different for neighbouring tiles, to know when they should start moving.
+ float startTimeFuzz = snoise(vec2(float(tileXIndex)/(numTiles.x-1), float(tileYIndex)/(numTiles.y-1)));
+
+ // A semi-random number -1.5..1.5, different for neighbouring tiles, to specify their rotation center.
+ // The additional 0.5 on each side is because we want some tiles to rotate outside.
+ float rotationFuzz = snoise(vec2(float(numTiles.x + tileXIndex)/(numTiles.x-1), float(tileYIndex)/(numTiles.y-1))) * 3.0 - 1.5;
+
+ startTime = float(tileXIndex)/(numTiles.x-1) * 0.2 + startTimeFuzz * 0.2;
+ endTime = min(startTime + 0.7, 1.0);
+
+ bool isLeavingSlide = (slide < 0.5);
+ const vec4 invalidPosition = vec4(-256.0, -256.0, -256.0, -256.0);
+
+ // Don’t display the tile before or after its rotation, depending on the slide.
+ if (!isLeavingSlide)
+ {
+ if (time < max(0.3, startTime))
+ {
+ gl_Position = invalidPosition;
+ return;
+ }
+ nTime = 1.0 - time;
+ }
+ else
+ {
+ if (time > endTime)
+ {
+ gl_Position = invalidPosition;
+ return;
+ }
+ nTime = time;
+ }
+
+ transform = identityMatrix();
+ if (nTime > startTime && nTime <= endTime)
+ {
+ // We are in the rotation part.
+ float rotation = (nTime - startTime) / (endTime - startTime);
+ if (isLeavingSlide)
+ rotation *= -1.0;
+
+ if (rotation < -0.5 || rotation > 0.5) {
+ gl_Position = invalidPosition;
+ return;
+ }
+
+ // Translation vector to set the origin of the rotation.
+ vec3 translationVector = vec3(rotationFuzz, 0.0, 0.0);
+
+ // Compute the actual rotation matrix.
+
+ // Intel's Windows driver gives a wrong matrix when all operations are done at once.
+ if (zero < 1.0)
+ transform = translationMatrix(translationVector) * transform;
+ if (zero < 2.0)
+ transform = rotationMatrix(vec3(0.0, 1.0, 0.0), clamp(rotation, -1.0, 1.0) * M_PI) * transform;
+ if (zero < 3.0)
+ transform = translationMatrix(-translationVector) * transform;
+ }
+
+ modelViewMatrix = u_modelViewMatrix * u_operationsTransformMatrix * u_sceneTransformMatrix * u_primitiveTransformMatrix;
+ gl_Position = vec4(a_position, 1.0);
+
+ g_texturePosition = a_texCoord;
+ g_normal = a_normal;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */