[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - slideshow/opengl slideshow/source

2016-03-15 Thread Emmanuel Gil Peyrot
 slideshow/opengl/honeycombFragmentShader.glsl|   30 
+-
 slideshow/opengl/honeycombGeometryShader.glsl|   15 +--
 slideshow/opengl/vortexFragmentShader.glsl   |   46 
--
 slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx |   12 +-
 4 files changed, 80 insertions(+), 23 deletions(-)

New commits:
commit 7a3fb01f7ee00443eea719ce0c0a2c89e432c842
Author: Emmanuel Gil Peyrot <emmanuel.pey...@collabora.com>
Date:   Wed Feb 24 20:21:13 2016 +

slideshow: Blur the shadows the further they are from the object

Reviewed-on: https://gerrit.libreoffice.org/22678
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Tomaž Vajngerl <qui...@gmail.com>

Conflicts:
slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx

(cherry-picked from the commit 3ed1e68a79e8dcc623eb9165577e0571cebf4709)

Change-Id: I63f4fda670b86db2ee1ea66d8755d71697fac0c7
Reviewed-on: https://gerrit.libreoffice.org/22812
Tested-by: Jenkins <c...@libreoffice.org>
Tested-by: jan iversen <j...@documentfoundation.org>
Reviewed-by: jan iversen <j...@documentfoundation.org>

diff --git a/slideshow/opengl/honeycombFragmentShader.glsl 
b/slideshow/opengl/honeycombFragmentShader.glsl
index c207203..e4ce8e3 100644
--- a/slideshow/opengl/honeycombFragmentShader.glsl
+++ b/slideshow/opengl/honeycombFragmentShader.glsl
@@ -29,6 +29,18 @@ bool isBorder(vec2 point)
 
 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);
@@ -73,13 +85,23 @@ void main()
 fragment.rgb *= actualTime;
 }
 }
+
+// Compute the shadow.
 float visibility = 1.0;
 const float epsilon = 0.0001;
-if (texture(depthShadowTexture, shadowCoordinate.xy).r < 
shadowCoordinate.z - epsilon)
-visibility *= 0.7 + 0.3 * (1.0 - texture(colorShadowTexture, 
shadowCoordinate.xy).a);
+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);
-if (fragment.a < 0.001)
-discard;
 gl_FragColor = mix(black, fragment, visibility * light);
 }
 
diff --git a/slideshow/opengl/honeycombGeometryShader.glsl 
b/slideshow/opengl/honeycombGeometryShader.glsl
index 5afaa7b..dedc0df 100644
--- a/slideshow/opengl/honeycombGeometryShader.glsl
+++ b/slideshow/opengl/honeycombGeometryShader.glsl
@@ -67,13 +67,14 @@ void emitHexagonVertex(vec3 center, vec2 translation)
 
 void main()
 {
-vec2 translateVectors[6];
-translateVectors[0] = vec2(-3, -2);
-translateVectors[1] = vec2(0, -4);
-translateVectors[2] = vec2(3, -2);
-translateVectors[3] = vec2(3, 2);
-translateVectors[4] = vec2(0, 4);
-translateVectors[5] = vec2(-3, 2);
+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;
 
diff --git a/slideshow/opengl/vortexFragmentShader.glsl 
b/slideshow/opengl/vortexFragmentShader.glsl
index a3f8191..6bcdfc5 100644
--- a/slideshow/opengl/vortexFragmentShader.glsl
+++ b/slideshow/opengl/vortexFragmentShader.glsl
@@ -18,15 +18,49 @@ 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 < shadowC

[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - slideshow/opengl

2016-03-15 Thread Emmanuel Gil Peyrot
 slideshow/opengl/honeycombFragmentShader.glsl |6 +++---
 slideshow/opengl/honeycombGeometryShader.glsl |2 +-
 slideshow/opengl/vortexFragmentShader.glsl|6 +++---
 slideshow/opengl/vortexVertexShader.glsl  |2 +-
 4 files changed, 8 insertions(+), 8 deletions(-)

New commits:
commit bd683e08cd614afdf3be1a8272200e39a38d9d0b
Author: Emmanuel Gil Peyrot <emmanuel.pey...@collabora.com>
Date:   Wed Feb 24 20:21:10 2016 +

slideshow: Only use texture() in GLSL 1.50, fixes Intel on Windows

texture2D() is still available, but not in the geometry stage, so
better be consistent everywhere.

(cherry-picked from the commit 1a9b62dc661a26c02db34ab5075b4e209a70b196)

Change-Id: I86bf1921713bcbf32946190525401bfcc633a69f
Reviewed-on: https://gerrit.libreoffice.org/22777
Reviewed-by: jan iversen <j...@documentfoundation.org>
Tested-by: jan iversen <j...@documentfoundation.org>

diff --git a/slideshow/opengl/honeycombFragmentShader.glsl 
b/slideshow/opengl/honeycombFragmentShader.glsl
index 41b6738..c207203 100644
--- a/slideshow/opengl/honeycombFragmentShader.glsl
+++ b/slideshow/opengl/honeycombFragmentShader.glsl
@@ -29,7 +29,7 @@ bool isBorder(vec2 point)
 
 void main()
 {
-vec4 fragment = vec4(texture2D(slideTexture, texturePosition).rgb, 1.0);
+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) {
@@ -75,8 +75,8 @@ void main()
 }
 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);
+if (texture(depthShadowTexture, shadowCoordinate.xy).r < 
shadowCoordinate.z - epsilon)
+visibility *= 0.7 + 0.3 * (1.0 - texture(colorShadowTexture, 
shadowCoordinate.xy).a);
 vec4 black = vec4(0.0, 0.0, 0.0, fragment.a);
 if (fragment.a < 0.001)
 discard;
diff --git a/slideshow/opengl/honeycombGeometryShader.glsl 
b/slideshow/opengl/honeycombGeometryShader.glsl
index 5269fad..5afaa7b 100644
--- a/slideshow/opengl/honeycombGeometryShader.glsl
+++ b/slideshow/opengl/honeycombGeometryShader.glsl
@@ -29,7 +29,7 @@ const float expandFactor = 0.0318;
 
 float snoise(vec2 p)
 {
-return texture2D(permTexture, p).r;
+return texture(permTexture, p).r;
 }
 
 mat4 identityMatrix(void)
diff --git a/slideshow/opengl/vortexFragmentShader.glsl 
b/slideshow/opengl/vortexFragmentShader.glsl
index 3212ebe..a3f8191 100644
--- a/slideshow/opengl/vortexFragmentShader.glsl
+++ b/slideshow/opengl/vortexFragmentShader.glsl
@@ -20,12 +20,12 @@ in vec4 shadowCoordinate;
 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 fragment = texture(slideTexture, v_texturePosition);
 float visibility = 1.0;
 const float epsilon = 0.0001;
-if (texture2D(leavingShadowTexture, shadowCoordinate.xy).r < 
shadowCoordinate.z - epsilon)
+if (texture(leavingShadowTexture, shadowCoordinate.xy).r < 
shadowCoordinate.z - epsilon)
 visibility *= 0.7;
-if (texture2D(enteringShadowTexture, shadowCoordinate.xy).r < 
shadowCoordinate.z - epsilon)
+if (texture(enteringShadowTexture, shadowCoordinate.xy).r < 
shadowCoordinate.z - epsilon)
 visibility *= 0.7;
 vec4 black = vec4(0.0, 0.0, 0.0, fragment.a);
 gl_FragColor = mix(black, fragment, visibility * light);
diff --git a/slideshow/opengl/vortexVertexShader.glsl 
b/slideshow/opengl/vortexVertexShader.glsl
index 5c6fe23..8d1a67d 100755
--- a/slideshow/opengl/vortexVertexShader.glsl
+++ b/slideshow/opengl/vortexVertexShader.glsl
@@ -39,7 +39,7 @@ out float endTime;
 
 float snoise(vec2 p)
 {
-return texture2D(permTexture, p).r;
+return texture(permTexture, p).r;
 }
 
 mat4 identityMatrix(void)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - slideshow/opengl

2016-03-15 Thread Emmanuel Gil Peyrot
 slideshow/opengl/honeycombVertexShader.glsl |   41 +---
 slideshow/opengl/vortexVertexShader.glsl|   15 +++---
 2 files changed, 42 insertions(+), 14 deletions(-)

New commits:
commit 750fcdef6551f069badb802649a665e147e69083
Author: Emmanuel Gil Peyrot <emmanuel.pey...@collabora.com>
Date:   Wed Feb 24 20:21:12 2016 +

slideshow: Add an ugly workaround for Intel’s matrix multiplication

When more than three multiplications are chained, Intel’s Windows
driver returns a mat4 containing only zeroes, likely due to a
misbehaving optimisation.  This patch prevents it from doing any
optimisation by doing each multiplication in its own uniform block.

(cherry-picked from the commit db9fe1ea4a1e0e33dece63652c2b076fb323ec63)

Change-Id: I0b435d3a5444afd47f78c379f0d2e442d2c2cfc0
Reviewed-on: https://gerrit.libreoffice.org/22776
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: jan iversen <j...@documentfoundation.org>

diff --git a/slideshow/opengl/honeycombVertexShader.glsl 
b/slideshow/opengl/honeycombVertexShader.glsl
index 32fdece..c3484d3 100644
--- a/slideshow/opengl/honeycombVertexShader.glsl
+++ b/slideshow/opengl/honeycombVertexShader.glsl
@@ -25,10 +25,21 @@ 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,
@@ -61,25 +72,35 @@ mat4 rotationMatrix(vec3 axis, float angle)
 void main( void )
 {
 mat4 nmodelViewMatrix = u_modelViewMatrix * u_operationsTransformMatrix * 
u_sceneTransformMatrix * u_primitiveTransformMatrix;
-mat4 transformMatrix;
+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
-transformMatrix = translationMatrix(vec3(0, 0, 6 * time))
-* scaleMatrix(vec3(1 + pow(2 * time, 2.1), 1 + pow(2 * time, 2.1), 
0))
-* slideScaleMatrix
-* rotationMatrix(vec3(0.0, 0.0, 1.0), -pow(time, 3) * M_PI)
-* invertSlideScaleMatrix;
+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
-transformMatrix = translationMatrix(vec3(0, 0, 28 * (sqrt(time) - 1)))
-* slideScaleMatrix
-* rotationMatrix(vec3(0.0, 0.0, 1.0), pow(0.8 * (time - 1.0), 2.0) 
* M_PI)
-* invertSlideScaleMatrix;
+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) {
diff --git a/slideshow/opengl/vortexVertexShader.glsl 
b/slideshow/opengl/vortexVertexShader.glsl
index 3d5838e..5c6fe23 100755
--- a/slideshow/opengl/vortexVertexShader.glsl
+++ b/slideshow/opengl/vortexVertexShader.glsl
@@ -26,6 +26,9 @@ 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;
@@ -130,10 +133,14 @@ void main( void )
 vec3 translationVector = vec3(rotationFuzz, 0.0, 0.0);
 
 // Compute the actual rotation matrix.
-transform = translationMatrix(translationVector)
-  * rotationMatrix(vec3(0.0, 1.0, 0.0), clamp(rotation, -1.0, 
1.0) * M_PI)
- 

[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - slideshow/opengl

2016-03-15 Thread Emmanuel Gil Peyrot
 slideshow/opengl/vortexGeometryShader.glsl |   22 ++
 slideshow/opengl/vortexVertexShader.glsl   |   14 --
 2 files changed, 18 insertions(+), 18 deletions(-)

New commits:
commit 5a7160e21fe17c2697c2b9d71c9e1f4bf65c9352
Author: Emmanuel Gil Peyrot <emmanuel.pey...@collabora.com>
Date:   Wed Feb 24 20:21:11 2016 +

slideshow: Move Vortex calculations to the geometry stage, fixes Intel

Their Windows driver was failing due to too many varyings being used
between the vertex and the geometry stages.

(cherry-picked from the commit 06404309026b8e5aeb4c47ea68aea7ef21c6654e)

Change-Id: Iec69a2ef29e6ed4ba5ce6e46c7a5eb7db5098d1b
Reviewed-on: https://gerrit.libreoffice.org/22775
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: jan iversen <j...@documentfoundation.org>

diff --git a/slideshow/opengl/vortexGeometryShader.glsl 
b/slideshow/opengl/vortexGeometryShader.glsl
index 312baba..5d64a12 100644
--- a/slideshow/opengl/vortexGeometryShader.glsl
+++ b/slideshow/opengl/vortexGeometryShader.glsl
@@ -12,11 +12,14 @@
 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 projectionMatrix[];
 in mat4 modelViewMatrix[];
-in mat4 shadowMatrix[];
 in mat4 transform[];
 in float nTime[];
 in float startTime[];
@@ -52,6 +55,17 @@ mat4 translationMatrix(vec3 axis)
 
 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);
@@ -62,8 +76,8 @@ void emitHexagonVertex(int index, vec3 translation, float 
fdsq)
 v_normal = normalize(vec3(normalMatrix * transform[index] * 
vec4(g_normal[index], 0.0)));
 v_normal.z *= fdsq;
 
-gl_Position = projectionMatrix[index] * modelViewMatrix[index] * pos;
-shadowCoordinate = translationMatrix(vec3(0.5, 0.5, 0.5)) * 
scaleMatrix(vec3(0.5, 0.5, 0.5)) * shadowMatrix[index] * modelViewMatrix[index] 
* pos;
+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();
 }
diff --git a/slideshow/opengl/vortexVertexShader.glsl 
b/slideshow/opengl/vortexVertexShader.glsl
index 9bab2d9..3d5838e 100755
--- a/slideshow/opengl/vortexVertexShader.glsl
+++ b/slideshow/opengl/vortexVertexShader.glsl
@@ -16,7 +16,6 @@ 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;
@@ -26,15 +25,10 @@ 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;
@@ -142,14 +136,6 @@ void main( void )
   * 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;
 gl_Position = vec4(a_position, 1.0);
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - slideshow/source

2016-03-15 Thread Emmanuel Gil Peyrot
 slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx |   18 
++
 1 file changed, 4 insertions(+), 14 deletions(-)

New commits:
commit 04d1ff651baac7ce0f851786064736ab7141b6f9
Author: Emmanuel Gil Peyrot <emmanuel.pey...@collabora.com>
Date:   Wed Feb 24 20:21:09 2016 +

slideshow: Move Vortex’ tileInfo attribute upload to the first frame

(cherry-picked from the commit 9adeebadd5d1728e9abaec67aa4dd8a0c300c98f)

Change-Id: Ifbc154755d43a085b78740a5a3c97ed2cbe9a905
Reviewed-on: https://gerrit.libreoffice.org/22774
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: jan iversen <j...@documentfoundation.org>

diff --git 
a/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx 
b/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx
index 39a68bc..a70c6c5 100644
--- a/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx
+++ b/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx
@@ -1557,7 +1557,6 @@ public:
 }
 
 private:
-virtual void prepare( double nTime, double SlideWidth, double SlideHeight, 
double DispWidth, double DispHeight ) override;
 virtual void finishTransition() override;
 virtual GLuint makeShader() const override;
 virtual void prepareTransition( sal_Int32 glLeavingSlideTex, sal_Int32 
glEnteringSlideTex ) override;
@@ -1575,19 +1574,6 @@ private:
 std::vector mvTileInfo;
 };
 
-void VortexTransition::prepare( double, double, double, double, double )
-{
-glBindBuffer(GL_ARRAY_BUFFER, mnTileInfoBuffer);
-CHECK_GL_ERROR();
-glEnableVertexAttribArray(mnTileInfoLocation);
-CHECK_GL_ERROR();
-glVertexAttribPointer(mnTileInfoLocation, 1, GL_FLOAT, GL_FALSE, 0, 
nullptr);
-CHECK_GL_ERROR();
-
-glBindBuffer(GL_ARRAY_BUFFER, 0);
-CHECK_GL_ERROR();
-}
-
 void VortexTransition::finishTransition()
 {
 PermTextureTransition::finishTransition();
@@ -1669,6 +1655,10 @@ void VortexTransition::prepareTransition( sal_Int32 
glLeavingSlideTex, sal_Int32
 
 glBindBuffer(GL_ARRAY_BUFFER, mnTileInfoBuffer);
 CHECK_GL_ERROR();
+glEnableVertexAttribArray(mnTileInfoLocation);
+CHECK_GL_ERROR();
+glVertexAttribPointer(mnTileInfoLocation, 1, GL_FLOAT, GL_FALSE, 0, 
nullptr);
+CHECK_GL_ERROR();
 glBufferData(GL_ARRAY_BUFFER, mvTileInfo.size()*sizeof(GLfloat), 
mvTileInfo.data(), GL_STATIC_DRAW);
 CHECK_GL_ERROR();
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'feature/fixes17' - slideshow/opengl slideshow/source

2016-03-01 Thread Emmanuel Gil Peyrot
 slideshow/opengl/honeycombFragmentShader.glsl|   30 
+-
 slideshow/opengl/honeycombGeometryShader.glsl|   15 +--
 slideshow/opengl/vortexFragmentShader.glsl   |   46 
--
 slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx |   12 +-
 4 files changed, 80 insertions(+), 23 deletions(-)

New commits:
commit 8a0701c14a19201b0ed90842f5716613e1bb3808
Author: Emmanuel Gil Peyrot <emmanuel.pey...@collabora.com>
Date:   Wed Feb 24 20:21:13 2016 +

slideshow: Blur the shadows the further they are from the object

Reviewed-on: https://gerrit.libreoffice.org/22678
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Tomaž Vajngerl <qui...@gmail.com>

Conflicts:
slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx

Change-Id: I63f4fda670b86db2ee1ea66d8755d71697fac0c7

diff --git a/slideshow/opengl/honeycombFragmentShader.glsl 
b/slideshow/opengl/honeycombFragmentShader.glsl
index c207203..e4ce8e3 100644
--- a/slideshow/opengl/honeycombFragmentShader.glsl
+++ b/slideshow/opengl/honeycombFragmentShader.glsl
@@ -29,6 +29,18 @@ bool isBorder(vec2 point)
 
 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);
@@ -73,13 +85,23 @@ void main()
 fragment.rgb *= actualTime;
 }
 }
+
+// Compute the shadow.
 float visibility = 1.0;
 const float epsilon = 0.0001;
-if (texture(depthShadowTexture, shadowCoordinate.xy).r < 
shadowCoordinate.z - epsilon)
-visibility *= 0.7 + 0.3 * (1.0 - texture(colorShadowTexture, 
shadowCoordinate.xy).a);
+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);
-if (fragment.a < 0.001)
-discard;
 gl_FragColor = mix(black, fragment, visibility * light);
 }
 
diff --git a/slideshow/opengl/honeycombGeometryShader.glsl 
b/slideshow/opengl/honeycombGeometryShader.glsl
index 5afaa7b..dedc0df 100644
--- a/slideshow/opengl/honeycombGeometryShader.glsl
+++ b/slideshow/opengl/honeycombGeometryShader.glsl
@@ -67,13 +67,14 @@ void emitHexagonVertex(vec3 center, vec2 translation)
 
 void main()
 {
-vec2 translateVectors[6];
-translateVectors[0] = vec2(-3, -2);
-translateVectors[1] = vec2(0, -4);
-translateVectors[2] = vec2(3, -2);
-translateVectors[3] = vec2(3, 2);
-translateVectors[4] = vec2(0, 4);
-translateVectors[5] = vec2(-3, 2);
+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;
 
diff --git a/slideshow/opengl/vortexFragmentShader.glsl 
b/slideshow/opengl/vortexFragmentShader.glsl
index a3f8191..6bcdfc5 100644
--- a/slideshow/opengl/vortexFragmentShader.glsl
+++ b/slideshow/opengl/vortexFragmentShader.glsl
@@ -18,15 +18,49 @@ 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) {
+   

[Libreoffice-commits] core.git: Branch 'feature/fixes17' - 2 commits - slideshow/opengl

2016-02-25 Thread Emmanuel Gil Peyrot
 slideshow/opengl/honeycombFragmentShader.glsl |6 +--
 slideshow/opengl/honeycombGeometryShader.glsl |2 -
 slideshow/opengl/honeycombVertexShader.glsl   |   41 +++---
 slideshow/opengl/vortexFragmentShader.glsl|6 +--
 slideshow/opengl/vortexVertexShader.glsl  |   17 +++---
 5 files changed, 50 insertions(+), 22 deletions(-)

New commits:
commit bbf28c9bc0c335646f610bf535fba5c125dcd65f
Author: Emmanuel Gil Peyrot <emmanuel.pey...@collabora.com>
Date:   Wed Feb 24 20:21:10 2016 +

slideshow: Only use texture() in GLSL 1.50, fixes Intel on Windows

texture2D() is still available, but not in the geometry stage, so
better be consistent everywhere.

Change-Id: I86bf1921713bcbf32946190525401bfcc633a69f

diff --git a/slideshow/opengl/honeycombFragmentShader.glsl 
b/slideshow/opengl/honeycombFragmentShader.glsl
index 41b6738..c207203 100644
--- a/slideshow/opengl/honeycombFragmentShader.glsl
+++ b/slideshow/opengl/honeycombFragmentShader.glsl
@@ -29,7 +29,7 @@ bool isBorder(vec2 point)
 
 void main()
 {
-vec4 fragment = vec4(texture2D(slideTexture, texturePosition).rgb, 1.0);
+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) {
@@ -75,8 +75,8 @@ void main()
 }
 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);
+if (texture(depthShadowTexture, shadowCoordinate.xy).r < 
shadowCoordinate.z - epsilon)
+visibility *= 0.7 + 0.3 * (1.0 - texture(colorShadowTexture, 
shadowCoordinate.xy).a);
 vec4 black = vec4(0.0, 0.0, 0.0, fragment.a);
 if (fragment.a < 0.001)
 discard;
diff --git a/slideshow/opengl/honeycombGeometryShader.glsl 
b/slideshow/opengl/honeycombGeometryShader.glsl
index 5269fad..5afaa7b 100644
--- a/slideshow/opengl/honeycombGeometryShader.glsl
+++ b/slideshow/opengl/honeycombGeometryShader.glsl
@@ -29,7 +29,7 @@ const float expandFactor = 0.0318;
 
 float snoise(vec2 p)
 {
-return texture2D(permTexture, p).r;
+return texture(permTexture, p).r;
 }
 
 mat4 identityMatrix(void)
diff --git a/slideshow/opengl/vortexFragmentShader.glsl 
b/slideshow/opengl/vortexFragmentShader.glsl
index 3212ebe..a3f8191 100644
--- a/slideshow/opengl/vortexFragmentShader.glsl
+++ b/slideshow/opengl/vortexFragmentShader.glsl
@@ -20,12 +20,12 @@ in vec4 shadowCoordinate;
 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 fragment = texture(slideTexture, v_texturePosition);
 float visibility = 1.0;
 const float epsilon = 0.0001;
-if (texture2D(leavingShadowTexture, shadowCoordinate.xy).r < 
shadowCoordinate.z - epsilon)
+if (texture(leavingShadowTexture, shadowCoordinate.xy).r < 
shadowCoordinate.z - epsilon)
 visibility *= 0.7;
-if (texture2D(enteringShadowTexture, shadowCoordinate.xy).r < 
shadowCoordinate.z - epsilon)
+if (texture(enteringShadowTexture, shadowCoordinate.xy).r < 
shadowCoordinate.z - epsilon)
 visibility *= 0.7;
 vec4 black = vec4(0.0, 0.0, 0.0, fragment.a);
 gl_FragColor = mix(black, fragment, visibility * light);
diff --git a/slideshow/opengl/vortexVertexShader.glsl 
b/slideshow/opengl/vortexVertexShader.glsl
index 5c6fe23..8d1a67d 100755
--- a/slideshow/opengl/vortexVertexShader.glsl
+++ b/slideshow/opengl/vortexVertexShader.glsl
@@ -39,7 +39,7 @@ out float endTime;
 
 float snoise(vec2 p)
 {
-return texture2D(permTexture, p).r;
+return texture(permTexture, p).r;
 }
 
 mat4 identityMatrix(void)
commit 92958290631112e65fb1dade7d4c7c91cc8ece17
Author: Emmanuel Gil Peyrot <emmanuel.pey...@collabora.com>
Date:   Wed Feb 24 20:21:12 2016 +

slideshow: Add an ugly workaround for Intel’s matrix multiplication

When more than three multiplications are chained, Intel’s Windows
driver returns a mat4 containing only zeroes, likely due to a
misbehaving optimisation.  This patch prevents it from doing any
optimisation by doing each multiplication in its own uniform block.

Change-Id: I0b435d3a5444afd47f78c379f0d2e442d2c2cfc0

diff --git a/slideshow/opengl/honeycombVertexShader.glsl 
b/slideshow/opengl/honeycombVertexShader.glsl
index 32fdece..c3484d3 100644
--- a/slideshow/opengl/honeycombVertexShader.glsl
+++ b/slideshow/opengl/honeycombVertexShader.glsl
@@ -25,10 +25,21 @@ 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;

[Libreoffice-commits] core.git: Branch 'feature/fixes17' - slideshow/opengl

2016-02-25 Thread Emmanuel Gil Peyrot
 slideshow/opengl/vortexGeometryShader.glsl |   22 ++
 slideshow/opengl/vortexVertexShader.glsl   |   14 --
 2 files changed, 18 insertions(+), 18 deletions(-)

New commits:
commit bb14be25bdb139410cdbe5627de08d1625b8e6fa
Author: Emmanuel Gil Peyrot <emmanuel.pey...@collabora.com>
Date:   Wed Feb 24 20:21:11 2016 +

slideshow: Move Vortex calculations to the geometry stage, fixes Intel

Their Windows driver was failing due to too many varyings being used
between the vertex and the geometry stages.

Change-Id: Iec69a2ef29e6ed4ba5ce6e46c7a5eb7db5098d1b

diff --git a/slideshow/opengl/vortexGeometryShader.glsl 
b/slideshow/opengl/vortexGeometryShader.glsl
index 312baba..5d64a12 100644
--- a/slideshow/opengl/vortexGeometryShader.glsl
+++ b/slideshow/opengl/vortexGeometryShader.glsl
@@ -12,11 +12,14 @@
 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 projectionMatrix[];
 in mat4 modelViewMatrix[];
-in mat4 shadowMatrix[];
 in mat4 transform[];
 in float nTime[];
 in float startTime[];
@@ -52,6 +55,17 @@ mat4 translationMatrix(vec3 axis)
 
 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);
@@ -62,8 +76,8 @@ void emitHexagonVertex(int index, vec3 translation, float 
fdsq)
 v_normal = normalize(vec3(normalMatrix * transform[index] * 
vec4(g_normal[index], 0.0)));
 v_normal.z *= fdsq;
 
-gl_Position = projectionMatrix[index] * modelViewMatrix[index] * pos;
-shadowCoordinate = translationMatrix(vec3(0.5, 0.5, 0.5)) * 
scaleMatrix(vec3(0.5, 0.5, 0.5)) * shadowMatrix[index] * modelViewMatrix[index] 
* pos;
+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();
 }
diff --git a/slideshow/opengl/vortexVertexShader.glsl 
b/slideshow/opengl/vortexVertexShader.glsl
index 9bab2d9..3d5838e 100755
--- a/slideshow/opengl/vortexVertexShader.glsl
+++ b/slideshow/opengl/vortexVertexShader.glsl
@@ -16,7 +16,6 @@ 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;
@@ -26,15 +25,10 @@ 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;
@@ -142,14 +136,6 @@ void main( void )
   * 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;
 gl_Position = vec4(a_position, 1.0);
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'feature/fixes17' - slideshow/source

2016-02-25 Thread Emmanuel Gil Peyrot
 slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx |   18 
++
 1 file changed, 4 insertions(+), 14 deletions(-)

New commits:
commit b947e40acf6432174f7d207e23832b8020c1af7e
Author: Emmanuel Gil Peyrot <emmanuel.pey...@collabora.com>
Date:   Wed Feb 24 20:21:09 2016 +

slideshow: Move Vortex’ tileInfo attribute upload to the first frame

Change-Id: Ifbc154755d43a085b78740a5a3c97ed2cbe9a905

diff --git 
a/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx 
b/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx
index fc66cb6..43dfc46 100644
--- a/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx
+++ b/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx
@@ -1557,7 +1557,6 @@ public:
 }
 
 private:
-virtual void prepare( double nTime, double SlideWidth, double SlideHeight, 
double DispWidth, double DispHeight ) override;
 virtual void finishTransition() override;
 virtual GLuint makeShader() const override;
 virtual void prepareTransition( sal_Int32 glLeavingSlideTex, sal_Int32 
glEnteringSlideTex ) override;
@@ -1575,19 +1574,6 @@ private:
 std::vector mvTileInfo;
 };
 
-void VortexTransition::prepare( double, double, double, double, double )
-{
-glBindBuffer(GL_ARRAY_BUFFER, mnTileInfoBuffer);
-CHECK_GL_ERROR();
-glEnableVertexAttribArray(mnTileInfoLocation);
-CHECK_GL_ERROR();
-glVertexAttribPointer(mnTileInfoLocation, 1, GL_FLOAT, GL_FALSE, 0, 
nullptr);
-CHECK_GL_ERROR();
-
-glBindBuffer(GL_ARRAY_BUFFER, 0);
-CHECK_GL_ERROR();
-}
-
 void VortexTransition::finishTransition()
 {
 PermTextureTransition::finishTransition();
@@ -1669,6 +1655,10 @@ void VortexTransition::prepareTransition( sal_Int32 
glLeavingSlideTex, sal_Int32
 
 glBindBuffer(GL_ARRAY_BUFFER, mnTileInfoBuffer);
 CHECK_GL_ERROR();
+glEnableVertexAttribArray(mnTileInfoLocation);
+CHECK_GL_ERROR();
+glVertexAttribPointer(mnTileInfoLocation, 1, GL_FLOAT, GL_FALSE, 0, 
nullptr);
+CHECK_GL_ERROR();
 glBufferData(GL_ARRAY_BUFFER, mvTileInfo.size()*sizeof(GLfloat), 
mvTileInfo.data(), GL_STATIC_DRAW);
 CHECK_GL_ERROR();
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: slideshow/opengl slideshow/source

2016-02-25 Thread Emmanuel Gil Peyrot
 slideshow/opengl/honeycombFragmentShader.glsl|   30 
+-
 slideshow/opengl/honeycombGeometryShader.glsl|   15 +--
 slideshow/opengl/vortexFragmentShader.glsl   |   46 
--
 slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx |   12 +-
 4 files changed, 80 insertions(+), 23 deletions(-)

New commits:
commit 3ed1e68a79e8dcc623eb9165577e0571cebf4709
Author: Emmanuel Gil Peyrot <emmanuel.pey...@collabora.com>
Date:   Wed Feb 24 20:21:13 2016 +

slideshow: Blur the shadows the further they are from the object

Change-Id: I63f4fda670b86db2ee1ea66d8755d71697fac0c7
Reviewed-on: https://gerrit.libreoffice.org/22678
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Tomaž Vajngerl <qui...@gmail.com>

diff --git a/slideshow/opengl/honeycombFragmentShader.glsl 
b/slideshow/opengl/honeycombFragmentShader.glsl
index c207203..e4ce8e3 100644
--- a/slideshow/opengl/honeycombFragmentShader.glsl
+++ b/slideshow/opengl/honeycombFragmentShader.glsl
@@ -29,6 +29,18 @@ bool isBorder(vec2 point)
 
 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);
@@ -73,13 +85,23 @@ void main()
 fragment.rgb *= actualTime;
 }
 }
+
+// Compute the shadow.
 float visibility = 1.0;
 const float epsilon = 0.0001;
-if (texture(depthShadowTexture, shadowCoordinate.xy).r < 
shadowCoordinate.z - epsilon)
-visibility *= 0.7 + 0.3 * (1.0 - texture(colorShadowTexture, 
shadowCoordinate.xy).a);
+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);
-if (fragment.a < 0.001)
-discard;
 gl_FragColor = mix(black, fragment, visibility * light);
 }
 
diff --git a/slideshow/opengl/honeycombGeometryShader.glsl 
b/slideshow/opengl/honeycombGeometryShader.glsl
index 5afaa7b..dedc0df 100644
--- a/slideshow/opengl/honeycombGeometryShader.glsl
+++ b/slideshow/opengl/honeycombGeometryShader.glsl
@@ -67,13 +67,14 @@ void emitHexagonVertex(vec3 center, vec2 translation)
 
 void main()
 {
-vec2 translateVectors[6];
-translateVectors[0] = vec2(-3, -2);
-translateVectors[1] = vec2(0, -4);
-translateVectors[2] = vec2(3, -2);
-translateVectors[3] = vec2(3, 2);
-translateVectors[4] = vec2(0, 4);
-translateVectors[5] = vec2(-3, 2);
+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;
 
diff --git a/slideshow/opengl/vortexFragmentShader.glsl 
b/slideshow/opengl/vortexFragmentShader.glsl
index a3f8191..6bcdfc5 100644
--- a/slideshow/opengl/vortexFragmentShader.glsl
+++ b/slideshow/opengl/vortexFragmentShader.glsl
@@ -18,15 +18,49 @@ 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(enteringShadowT

[Libreoffice-commits] core.git: slideshow/opengl

2016-02-25 Thread Emmanuel Gil Peyrot
 slideshow/opengl/honeycombFragmentShader.glsl |6 +++---
 slideshow/opengl/honeycombGeometryShader.glsl |2 +-
 slideshow/opengl/vortexFragmentShader.glsl|6 +++---
 slideshow/opengl/vortexVertexShader.glsl  |2 +-
 4 files changed, 8 insertions(+), 8 deletions(-)

New commits:
commit 1a9b62dc661a26c02db34ab5075b4e209a70b196
Author: Emmanuel Gil Peyrot <emmanuel.pey...@collabora.com>
Date:   Wed Feb 24 20:21:10 2016 +

slideshow: Only use texture() in GLSL 1.50, fixes Intel on Windows

texture2D() is still available, but not in the geometry stage, so
better be consistent everywhere.

Change-Id: I86bf1921713bcbf32946190525401bfcc633a69f
Reviewed-on: https://gerrit.libreoffice.org/22468
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Tomaž Vajngerl <qui...@gmail.com>

diff --git a/slideshow/opengl/honeycombFragmentShader.glsl 
b/slideshow/opengl/honeycombFragmentShader.glsl
index 41b6738..c207203 100644
--- a/slideshow/opengl/honeycombFragmentShader.glsl
+++ b/slideshow/opengl/honeycombFragmentShader.glsl
@@ -29,7 +29,7 @@ bool isBorder(vec2 point)
 
 void main()
 {
-vec4 fragment = vec4(texture2D(slideTexture, texturePosition).rgb, 1.0);
+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) {
@@ -75,8 +75,8 @@ void main()
 }
 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);
+if (texture(depthShadowTexture, shadowCoordinate.xy).r < 
shadowCoordinate.z - epsilon)
+visibility *= 0.7 + 0.3 * (1.0 - texture(colorShadowTexture, 
shadowCoordinate.xy).a);
 vec4 black = vec4(0.0, 0.0, 0.0, fragment.a);
 if (fragment.a < 0.001)
 discard;
diff --git a/slideshow/opengl/honeycombGeometryShader.glsl 
b/slideshow/opengl/honeycombGeometryShader.glsl
index 5269fad..5afaa7b 100644
--- a/slideshow/opengl/honeycombGeometryShader.glsl
+++ b/slideshow/opengl/honeycombGeometryShader.glsl
@@ -29,7 +29,7 @@ const float expandFactor = 0.0318;
 
 float snoise(vec2 p)
 {
-return texture2D(permTexture, p).r;
+return texture(permTexture, p).r;
 }
 
 mat4 identityMatrix(void)
diff --git a/slideshow/opengl/vortexFragmentShader.glsl 
b/slideshow/opengl/vortexFragmentShader.glsl
index 3212ebe..a3f8191 100644
--- a/slideshow/opengl/vortexFragmentShader.glsl
+++ b/slideshow/opengl/vortexFragmentShader.glsl
@@ -20,12 +20,12 @@ in vec4 shadowCoordinate;
 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 fragment = texture(slideTexture, v_texturePosition);
 float visibility = 1.0;
 const float epsilon = 0.0001;
-if (texture2D(leavingShadowTexture, shadowCoordinate.xy).r < 
shadowCoordinate.z - epsilon)
+if (texture(leavingShadowTexture, shadowCoordinate.xy).r < 
shadowCoordinate.z - epsilon)
 visibility *= 0.7;
-if (texture2D(enteringShadowTexture, shadowCoordinate.xy).r < 
shadowCoordinate.z - epsilon)
+if (texture(enteringShadowTexture, shadowCoordinate.xy).r < 
shadowCoordinate.z - epsilon)
 visibility *= 0.7;
 vec4 black = vec4(0.0, 0.0, 0.0, fragment.a);
 gl_FragColor = mix(black, fragment, visibility * light);
diff --git a/slideshow/opengl/vortexVertexShader.glsl 
b/slideshow/opengl/vortexVertexShader.glsl
index 5c6fe23..8d1a67d 100644
--- a/slideshow/opengl/vortexVertexShader.glsl
+++ b/slideshow/opengl/vortexVertexShader.glsl
@@ -39,7 +39,7 @@ out float endTime;
 
 float snoise(vec2 p)
 {
-return texture2D(permTexture, p).r;
+return texture(permTexture, p).r;
 }
 
 mat4 identityMatrix(void)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: slideshow/opengl

2016-02-25 Thread Emmanuel Gil Peyrot
 slideshow/opengl/honeycombVertexShader.glsl |   41 +---
 slideshow/opengl/vortexVertexShader.glsl|   15 +++---
 2 files changed, 42 insertions(+), 14 deletions(-)

New commits:
commit db9fe1ea4a1e0e33dece63652c2b076fb323ec63
Author: Emmanuel Gil Peyrot <emmanuel.pey...@collabora.com>
Date:   Wed Feb 24 20:21:12 2016 +

slideshow: Add an ugly workaround for Intel’s matrix multiplication

When more than three multiplications are chained, Intel’s Windows
driver returns a mat4 containing only zeroes, likely due to a
misbehaving optimisation.  This patch prevents it from doing any
optimisation by doing each multiplication in its own uniform block.

Change-Id: I0b435d3a5444afd47f78c379f0d2e442d2c2cfc0
Reviewed-on: https://gerrit.libreoffice.org/22470
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Tomaž Vajngerl <qui...@gmail.com>

diff --git a/slideshow/opengl/honeycombVertexShader.glsl 
b/slideshow/opengl/honeycombVertexShader.glsl
index 32fdece..c3484d3 100644
--- a/slideshow/opengl/honeycombVertexShader.glsl
+++ b/slideshow/opengl/honeycombVertexShader.glsl
@@ -25,10 +25,21 @@ 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,
@@ -61,25 +72,35 @@ mat4 rotationMatrix(vec3 axis, float angle)
 void main( void )
 {
 mat4 nmodelViewMatrix = u_modelViewMatrix * u_operationsTransformMatrix * 
u_sceneTransformMatrix * u_primitiveTransformMatrix;
-mat4 transformMatrix;
+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
-transformMatrix = translationMatrix(vec3(0, 0, 6 * time))
-* scaleMatrix(vec3(1 + pow(2 * time, 2.1), 1 + pow(2 * time, 2.1), 
0))
-* slideScaleMatrix
-* rotationMatrix(vec3(0.0, 0.0, 1.0), -pow(time, 3) * M_PI)
-* invertSlideScaleMatrix;
+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
-transformMatrix = translationMatrix(vec3(0, 0, 28 * (sqrt(time) - 1)))
-* slideScaleMatrix
-* rotationMatrix(vec3(0.0, 0.0, 1.0), pow(0.8 * (time - 1.0), 2.0) 
* M_PI)
-* invertSlideScaleMatrix;
+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) {
diff --git a/slideshow/opengl/vortexVertexShader.glsl 
b/slideshow/opengl/vortexVertexShader.glsl
index 3d5838e..5c6fe23 100644
--- a/slideshow/opengl/vortexVertexShader.glsl
+++ b/slideshow/opengl/vortexVertexShader.glsl
@@ -26,6 +26,9 @@ 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;
@@ -130,10 +133,14 @@ void main( void )
 vec3 translationVector = vec3(rotationFuzz, 0.0, 0.0);
 
 // Compute the actual rotation matrix.
-transform = translationMatrix(translationVector)
-  * rotationMatrix(vec3(0.0, 1.0, 0.0), clamp(rotation, -1.0, 
1.0) * M_PI)
-  * translationMatrix(-translationVector)
-  * transform;
+
+// I

[Libreoffice-commits] core.git: slideshow/opengl

2016-02-25 Thread Emmanuel Gil Peyrot
 slideshow/opengl/vortexGeometryShader.glsl |   22 ++
 slideshow/opengl/vortexVertexShader.glsl   |   14 --
 2 files changed, 18 insertions(+), 18 deletions(-)

New commits:
commit 06404309026b8e5aeb4c47ea68aea7ef21c6654e
Author: Emmanuel Gil Peyrot <emmanuel.pey...@collabora.com>
Date:   Wed Feb 24 20:21:11 2016 +

slideshow: Move Vortex calculations to the geometry stage, fixes Intel

Their Windows driver was failing due to too many varyings being used
between the vertex and the geometry stages.

Change-Id: Iec69a2ef29e6ed4ba5ce6e46c7a5eb7db5098d1b
Reviewed-on: https://gerrit.libreoffice.org/22469
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Tomaž Vajngerl <qui...@gmail.com>

diff --git a/slideshow/opengl/vortexGeometryShader.glsl 
b/slideshow/opengl/vortexGeometryShader.glsl
index 312baba..5d64a12 100644
--- a/slideshow/opengl/vortexGeometryShader.glsl
+++ b/slideshow/opengl/vortexGeometryShader.glsl
@@ -12,11 +12,14 @@
 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 projectionMatrix[];
 in mat4 modelViewMatrix[];
-in mat4 shadowMatrix[];
 in mat4 transform[];
 in float nTime[];
 in float startTime[];
@@ -52,6 +55,17 @@ mat4 translationMatrix(vec3 axis)
 
 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);
@@ -62,8 +76,8 @@ void emitHexagonVertex(int index, vec3 translation, float 
fdsq)
 v_normal = normalize(vec3(normalMatrix * transform[index] * 
vec4(g_normal[index], 0.0)));
 v_normal.z *= fdsq;
 
-gl_Position = projectionMatrix[index] * modelViewMatrix[index] * pos;
-shadowCoordinate = translationMatrix(vec3(0.5, 0.5, 0.5)) * 
scaleMatrix(vec3(0.5, 0.5, 0.5)) * shadowMatrix[index] * modelViewMatrix[index] 
* pos;
+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();
 }
diff --git a/slideshow/opengl/vortexVertexShader.glsl 
b/slideshow/opengl/vortexVertexShader.glsl
index 9bab2d9..3d5838e 100644
--- a/slideshow/opengl/vortexVertexShader.glsl
+++ b/slideshow/opengl/vortexVertexShader.glsl
@@ -16,7 +16,6 @@ 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;
@@ -26,15 +25,10 @@ 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;
@@ -142,14 +136,6 @@ void main( void )
   * 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;
 gl_Position = vec4(a_position, 1.0);
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: slideshow/source

2016-02-25 Thread Emmanuel Gil Peyrot
 slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx |   18 
++
 1 file changed, 4 insertions(+), 14 deletions(-)

New commits:
commit 9adeebadd5d1728e9abaec67aa4dd8a0c300c98f
Author: Emmanuel Gil Peyrot <emmanuel.pey...@collabora.com>
Date:   Wed Feb 24 20:21:09 2016 +

slideshow: Move Vortex’ tileInfo attribute upload to the first frame

Change-Id: Ifbc154755d43a085b78740a5a3c97ed2cbe9a905
Reviewed-on: https://gerrit.libreoffice.org/22467
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Tomaž Vajngerl <qui...@gmail.com>

diff --git 
a/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx 
b/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx
index 86e1131..672903b 100644
--- a/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx
+++ b/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx
@@ -1557,7 +1557,6 @@ public:
 }
 
 private:
-virtual void prepare( double nTime, double SlideWidth, double SlideHeight, 
double DispWidth, double DispHeight ) override;
 virtual void finishTransition() override;
 virtual GLuint makeShader() const override;
 virtual void prepareTransition( sal_Int32 glLeavingSlideTex, sal_Int32 
glEnteringSlideTex ) override;
@@ -1575,19 +1574,6 @@ private:
 std::vector mvTileInfo;
 };
 
-void VortexTransition::prepare( double, double, double, double, double )
-{
-glBindBuffer(GL_ARRAY_BUFFER, mnTileInfoBuffer);
-CHECK_GL_ERROR();
-glEnableVertexAttribArray(mnTileInfoLocation);
-CHECK_GL_ERROR();
-glVertexAttribPointer(mnTileInfoLocation, 1, GL_FLOAT, GL_FALSE, 0, 
nullptr);
-CHECK_GL_ERROR();
-
-glBindBuffer(GL_ARRAY_BUFFER, 0);
-CHECK_GL_ERROR();
-}
-
 void VortexTransition::finishTransition()
 {
 PermTextureTransition::finishTransition();
@@ -1669,6 +1655,10 @@ void VortexTransition::prepareTransition( sal_Int32 
glLeavingSlideTex, sal_Int32
 
 glBindBuffer(GL_ARRAY_BUFFER, mnTileInfoBuffer);
 CHECK_GL_ERROR();
+glEnableVertexAttribArray(mnTileInfoLocation);
+CHECK_GL_ERROR();
+glVertexAttribPointer(mnTileInfoLocation, 1, GL_FLOAT, GL_FALSE, 0, 
nullptr);
+CHECK_GL_ERROR();
 glBufferData(GL_ARRAY_BUFFER, mvTileInfo.size()*sizeof(GLfloat), 
mvTileInfo.data(), GL_STATIC_DRAW);
 CHECK_GL_ERROR();
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - slideshow/opengl slideshow/Package_opengl.mk slideshow/source

2016-02-09 Thread Emmanuel Gil Peyrot
 slideshow/Package_opengl.mk  |1 
 slideshow/opengl/vortexFragmentShader.glsl   |   34 ++
 slideshow/opengl/vortexGeometryShader.glsl   |   32 +-
 slideshow/opengl/vortexVertexShader.glsl |   19 -
 slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx |  160 
--
 slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.hxx |4 
 6 files changed, 214 insertions(+), 36 deletions(-)

New commits:
commit 49f55eabda703e9b651f3ca549193b89c2a5b0fd
Author: Emmanuel Gil Peyrot <emmanuel.pey...@collabora.com>
Date:   Tue Feb 9 09:27:46 2016 +

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.

also:

slideshow: Only retrieve each uniform location once

Change-Id: I8aaa1428c4481661283bf69b5e56aa4d95fb80dd
Reviewed-on: https://gerrit.libreoffice.org/22232
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Michael Meeks <michael.me...@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/22245
Reviewed-by: Tomaž Vajngerl <qui...@gmail.com>

diff --git a/slideshow/Package_opengl.mk b/slideshow/Package_opengl.mk
index 2781cd7..eef06e9 100644
--- a/slideshow/Package_opengl.mk
+++ b/slideshow/Package_opengl.mk
@@ -25,6 +25,7 @@ $(eval $(call 
gb_Package_add_files,slideshow_opengl_shader,$(LIBO_ETC_FOLDER)/op
staticFragmentShader.glsl \
vortexVertexShader.glsl \
vortexGeometryShader.glsl \
+   vortexFragmentShader.glsl \
rippleFragmentShader.glsl \
 ))
 
diff --git a/slideshow/opengl/vortexFragmentShader.glsl 
b/slideshow/opengl/vortexFragmentShader.glsl
new file mode 100644
index 000..3212ebe
--- /dev/null
+++ b/slideshow/opengl/vortexFragmentShader.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 150
+
+uniform sampler2D slideTexture;
+uniform sampler2D leavingShadowTexture;
+uniform sampler2D enteringShadowTexture;
+
+in vec2 v_texturePosition;
+in vec3 v_normal;
+in vec4 shadowCoordinate;
+
+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);
+float visibility = 1.0;
+const float epsilon = 0.0001;
+if (texture2D(leavingShadowTexture, shadowCoordinate.xy).r < 
shadowCoordinate.z - epsilon)
+visibility *= 0.7;
+if (texture2D(enteringShadowTexture, shadowCoordinate.xy).r < 
shadowCoordinate.z - epsilon)
+visibility *= 0.7;
+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
index 46999ef..312baba 100644
--- a/slideshow/opengl/vortexGeometryShader.glsl
+++ b/slideshow/opengl/vortexGeometryShader.glsl
@@ -14,16 +14,41 @@ layout(triangle_strip, max_vertices=11) out;
 
 in vec2 g_texturePosition[];
 in vec3 g_normal[];
+in mat4 projectionMatrix[];
 in mat4 modelViewMatrix[];
+in mat4 shadowMatrix[];
 in mat4 transform[];
 in float nTime[];
 in float startTime[];
 in float endTime[];
 
-uniform mat4 u_projectionMatrix;
-
 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)
 {
@@ -37,7 +62,8 @@ void emitHexagonVertex(int index, vec3 translation, float 
fdsq)
 v_normal = normalize(vec3(normalMatrix * transform[index] * 
vec4(g_normal[index], 0.0)));
 v_normal.z *= fdsq;
 
-gl_Position = u_projectionMatrix * modelViewMatrix[index] * pos;
+gl_Position = projectionMatrix[index] * modelViewMatrix[index] * pos;
+shadowCoordinate = translationMatrix(vec3(0.5, 0.5, 0.5)) * 
scaleMatrix(vec3(0.5, 0

[Libreoffice-commits] core.git: slideshow/source

2016-02-09 Thread Emmanuel Gil Peyrot
 slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx |   36 
+++---
 slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.hxx |4 +
 2 files changed, 18 insertions(+), 22 deletions(-)

New commits:
commit 0163501d57725b01037248922949029077b37530
Author: Emmanuel Gil Peyrot <emmanuel.pey...@collabora.com>
Date:   Tue Feb 9 09:27:46 2016 +

slideshow: Only retrieve each uniform location once

Change-Id: I882b1cd55062f1e41f901bf77383f7f4bf9ec097

diff --git 
a/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx 
b/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx
index 7816ca9..d5a5674 100644
--- a/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx
+++ b/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx
@@ -169,6 +169,7 @@ bool OGLTransitionImpl::prepare( sal_Int32 
glLeavingSlideTex, sal_Int32 glEnteri
 m_nPrimitiveTransformLocation = glGetUniformLocation( m_nProgramObject, 
"u_primitiveTransformMatrix" );
 m_nSceneTransformLocation = glGetUniformLocation( m_nProgramObject, 
"u_sceneTransformMatrix" );
 m_nOperationsTransformLocation = glGetUniformLocation( m_nProgramObject, 
"u_operationsTransformMatrix" );
+m_nTimeLocation = glGetUniformLocation( m_nProgramObject, "time" );
 
 glGenVertexArrays(1, _nVertexArrayObject);
 glBindVertexArray(m_nVertexArrayObject);
@@ -250,9 +251,7 @@ void OGLTransitionImpl::displaySlides_( double nTime, 
sal_Int32 glLeavingSlideTe
 CHECK_GL_ERROR();
 applyOverallOperations( nTime, SlideWidthScale, SlideHeightScale );
 
-GLint location = glGetUniformLocation( m_nProgramObject, "time" );
-if( location != -1 )
-glUniform1f( location, nTime );
+glUniform1f( m_nTimeLocation, nTime );
 
 glActiveTexture( GL_TEXTURE2 );
 glBindTexture( GL_TEXTURE_2D, glEnteringSlideTex );
@@ -1547,8 +1546,6 @@ class VortexTransition : public PermTextureTransition
 public:
 VortexTransition(const TransitionScene& rScene, const TransitionSettings& 
rSettings, int nNX, int nNY)
 : PermTextureTransition(rScene, rSettings)
-, mnTileInfoLocation(0)
-, mnTileInfoBuffer(0)
 , maNumTiles(nNX,nNY)
 {
 mvTileInfo.resize(6*maNumTiles.x*maNumTiles.y);
@@ -1563,8 +1560,9 @@ private:
 
 virtual void displaySlides_( double nTime, sal_Int32 glLeavingSlideTex, 
sal_Int32 glEnteringSlideTex, double SlideWidthScale, double SlideHeightScale ) 
override;
 
-GLint mnTileInfoLocation;
-GLuint mnTileInfoBuffer;
+GLint mnSlideLocation = -1;
+GLint mnTileInfoLocation = -1;
+GLuint mnTileInfoBuffer = 0u;
 
 glm::ivec2 maNumTiles;
 
@@ -1595,6 +1593,9 @@ void VortexTransition::prepareTransition( sal_Int32 
glLeavingSlideTex, sal_Int32
 PermTextureTransition::prepareTransition( glLeavingSlideTex, 
glEnteringSlideTex );
 CHECK_GL_ERROR();
 
+mnSlideLocation = glGetUniformLocation(m_nProgramObject, "slide");
+CHECK_GL_ERROR();
+
 mnTileInfoLocation = glGetAttribLocation(m_nProgramObject, "tileInfo");
 CHECK_GL_ERROR();
 
@@ -1640,18 +1641,11 @@ void VortexTransition::displaySlides_( double nTime, 
sal_Int32 glLeavingSlideTex
 {
 CHECK_GL_ERROR();
 applyOverallOperations( nTime, SlideWidthScale, SlideHeightScale );
+glUniform1f( m_nTimeLocation, nTime );
 
-GLint location = glGetUniformLocation( m_nProgramObject, "time" );
-if( location != -1 )
-glUniform1f( location, nTime );
-
-location = glGetUniformLocation( m_nProgramObject, "slide" );
-
-if( location != -1 )
-glUniform1f( location, 0.0 );
+glUniform1f( mnSlideLocation, 0.0 );
 displaySlide( nTime, glLeavingSlideTex, getScene().getLeavingSlide(), 
SlideWidthScale, SlideHeightScale );
-if( location != -1 )
-glUniform1f( location, 1.0 );
+glUniform1f( mnSlideLocation, 1.0 );
 displaySlide( nTime, glEnteringSlideTex, getScene().getEnteringSlide(), 
SlideWidthScale, SlideHeightScale );
 CHECK_GL_ERROR();
 }
@@ -1910,9 +1904,8 @@ private:
 virtual void prepareTransition( sal_Int32 glLeavingSlideTex, sal_Int32 
glEnteringSlideTex ) override;
 virtual void displaySlides_( double nTime, sal_Int32 glLeavingSlideTex, 
sal_Int32 glEnteringSlideTex, double SlideWidthScale, double SlideHeightScale ) 
override;
 
-GLint maHexagonSizeLocation = 0;
-GLint maTimeLocation = 0;
-GLint maSelectedTextureLocation = 0;
+GLint maHexagonSizeLocation = -1;
+GLint maSelectedTextureLocation = -1;
 };
 
 GLuint HoneycombTransition::makeShader() const
@@ -1927,7 +1920,6 @@ void HoneycombTransition::prepareTransition( sal_Int32 
glLeavingSlideTex, sal_In
 
 CHECK_GL_ERROR();
 maHexagonSizeLocation = glGetUniformLocation(m_nProgramObject, 
"hexagonSize");
-maTimeLocation = glGetUniformLocation( m_nP

[Libreoffice-commits] core.git: slideshow/opengl slideshow/Package_opengl.mk slideshow/source

2016-02-09 Thread Emmanuel Gil Peyrot
 slideshow/Package_opengl.mk  |1 
 slideshow/opengl/vortexFragmentShader.glsl   |   34 ++
 slideshow/opengl/vortexGeometryShader.glsl   |   32 ++
 slideshow/opengl/vortexVertexShader.glsl |   19 -
 slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx |  132 
+-
 5 files changed, 200 insertions(+), 18 deletions(-)

New commits:
commit 0c14c7babb71588fd93c1adccf4a99bf1b65dbd3
Author: Emmanuel Gil Peyrot <emmanuel.pey...@collabora.com>
Date:   Tue Feb 9 09:27:47 2016 +

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 <c...@libreoffice.org>
Reviewed-by: Michael Meeks <michael.me...@collabora.com>

diff --git a/slideshow/Package_opengl.mk b/slideshow/Package_opengl.mk
index 2781cd7..eef06e9 100644
--- a/slideshow/Package_opengl.mk
+++ b/slideshow/Package_opengl.mk
@@ -25,6 +25,7 @@ $(eval $(call 
gb_Package_add_files,slideshow_opengl_shader,$(LIBO_ETC_FOLDER)/op
staticFragmentShader.glsl \
vortexVertexShader.glsl \
vortexGeometryShader.glsl \
+   vortexFragmentShader.glsl \
rippleFragmentShader.glsl \
 ))
 
diff --git a/slideshow/opengl/vortexFragmentShader.glsl 
b/slideshow/opengl/vortexFragmentShader.glsl
new file mode 100644
index 000..3212ebe
--- /dev/null
+++ b/slideshow/opengl/vortexFragmentShader.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 150
+
+uniform sampler2D slideTexture;
+uniform sampler2D leavingShadowTexture;
+uniform sampler2D enteringShadowTexture;
+
+in vec2 v_texturePosition;
+in vec3 v_normal;
+in vec4 shadowCoordinate;
+
+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);
+float visibility = 1.0;
+const float epsilon = 0.0001;
+if (texture2D(leavingShadowTexture, shadowCoordinate.xy).r < 
shadowCoordinate.z - epsilon)
+visibility *= 0.7;
+if (texture2D(enteringShadowTexture, shadowCoordinate.xy).r < 
shadowCoordinate.z - epsilon)
+visibility *= 0.7;
+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
index 46999ef..312baba 100644
--- a/slideshow/opengl/vortexGeometryShader.glsl
+++ b/slideshow/opengl/vortexGeometryShader.glsl
@@ -14,16 +14,41 @@ layout(triangle_strip, max_vertices=11) out;
 
 in vec2 g_texturePosition[];
 in vec3 g_normal[];
+in mat4 projectionMatrix[];
 in mat4 modelViewMatrix[];
+in mat4 shadowMatrix[];
 in mat4 transform[];
 in float nTime[];
 in float startTime[];
 in float endTime[];
 
-uniform mat4 u_projectionMatrix;
-
 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)
 {
@@ -37,7 +62,8 @@ void emitHexagonVertex(int index, vec3 translation, float 
fdsq)
 v_normal = normalize(vec3(normalMatrix * transform[index] * 
vec4(g_normal[index], 0.0)));
 v_normal.z *= fdsq;
 
-gl_Position = u_projectionMatrix * modelViewMatrix[index] * pos;
+gl_Position = projectionMatrix[index] * modelViewMatrix[index] * pos;
+shadowCoordinate = translationMatrix(vec3(0.5, 0.5, 0.5)) * 
scaleMatrix(vec3(0.5, 0.5, 0.5)) * shadowMatrix[index] * modelViewMatrix[index] 
* pos;
 v_texturePosition = g_texturePosition[index];
 EmitVertex();
 }
diff --git a/slideshow/opengl/vortexVertexShader.glsl 
b/slideshow/opengl/vortexVertexShader.glsl
index 603c629..9bab2d9 10064

[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - slideshow/opengl slideshow/source

2016-02-09 Thread Emmanuel Gil Peyrot
 slideshow/opengl/honeycombFragmentShader.glsl|   11 
 slideshow/opengl/honeycombGeometryShader.glsl|   32 ++
 slideshow/opengl/honeycombVertexShader.glsl  |   20 +
 slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx |  125 
+-
 4 files changed, 171 insertions(+), 17 deletions(-)

New commits:
commit 48395acdae355a4c272cdbaf54131b3bcc96d63d
Author: Emmanuel Gil Peyrot <emmanuel.pey...@collabora.com>
Date:   Tue Feb 9 23:59:16 2016 +

slideshow: Add shadows to Honeycomb, using the same way as Vortex

Change-Id: I1f8f11f900f281792b417c1efead272fe3e8432e
Reviewed-on: https://gerrit.libreoffice.org/22255
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Tomaž Vajngerl <qui...@gmail.com>

diff --git a/slideshow/opengl/honeycombFragmentShader.glsl 
b/slideshow/opengl/honeycombFragmentShader.glsl
index 7e52951..41b6738 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: */
diff --git a/slideshow/opengl/honeycombGeometryShader.glsl 
b/slideshow/opengl/honeycombGeometryShader.glsl
index f1c0c70..5269fad 100644
--- a/slideshow/opengl/honeycombGeometryShader.glsl
+++ b/slideshow/opengl/honeycombGeometryShader.glsl
@@ -12,7 +12,9 @@
 layout(triangles) in;
 layout(triangle_strip, max_vertices=27) out;
 
-in mat4 modelViewProjectionMatrix[];
+in mat4 projectionMatrix[];
+in mat4 modelViewMatrix[];
+in mat4 shadowMatrix[];
 
 uniform float hexagonSize;
 uniform sampler2D permTexture;
@@ -21,6 +23,7 @@ out vec2 texturePosition;
 out float fuzz;
 out vec2 v_center;
 out vec3 normal;
+out vec4 shadowCoordinate;
 
 const float expandFactor = 0.0318;
 
@@ -29,10 +32,35 @@ float snoise(vec2 p)
 return texture2D(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 = modelViewProjectionMatrix[0] * pos;
+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();
 }
diff --git a/slideshow/opengl/honeycombVertexShader.glsl 
b/slideshow/opengl/honeycombVertexShader.glsl
index d54783b..32fdece 100644
--- a/slideshow/opengl/honeycombVertexShader.glsl
+++ b/slideshow/opengl/honeycombVertexShader.glsl
@@ -21,8 +21,13 @@ uniform mat4 u_operationsTransformMatrix;
 
 uniform float time;
 uniform float selectedTexture;
+uniform float shadow;
+uniform mat4 orthoProjectionMatrix;
+uniform mat4 orthoViewMatrix;
 
-out mat4 modelViewProjectionMatrix;
+out mat4 projectionMatrix;
+out mat4 modelViewMatrix;
+out mat4 shadowMatrix;
 
 mat4 translationMatrix(vec3 axis)
 {
@@ -55,7 +60,7 @@ mat4 rotationMatrix(vec3 axis, float angle)
 
 void main( void )
 {
-mat4 modelViewMatrix = u_modelViewMatrix * u_operationsTransformMatrix * 
u_sceneTransformMatrix * u_primitiveTransformMatrix;
+mat4 nmodelViewMatrix = u_modelViewMatrix * u_operationsTransformMatrix * 
u_sceneTransformMatrix * u_primitiveTransformMatrix;
 mat4 transformMatrix;
 
 // TODO: use the aspect ratio of the slide instead.
@@ -76,7 +81,16 @@ void main( void )
 * rotationMatrix(vec3(0.0, 0.0, 1.0), pow(0.8 * (time - 1.0), 2.0) 
* M_PI)
 * invertSlideScaleMatrix;
 }
-m

[Libreoffice-commits] core.git: slideshow/opengl

2016-02-02 Thread Emmanuel Gil Peyrot
 slideshow/opengl/honeycombFragmentShader.glsl |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 8b65dec8e0fdfc8564597e90aff91b971e23f7ce
Author: Emmanuel Gil Peyrot <emmanuel.pey...@collabora.com>
Date:   Wed Jan 27 20:21:21 2016 +

slideshow: Make sure the slide is fully opaque in Honeycomb

On Windows, the text is rendered with 0 of alpha, which is an issue in
this transition as it enables GL_BLEND.

Change-Id: I45fe32ccf77854e758eddc33f300791d4cdd6904

diff --git a/slideshow/opengl/honeycombFragmentShader.glsl 
b/slideshow/opengl/honeycombFragmentShader.glsl
index 325e393..7e52951 100644
--- a/slideshow/opengl/honeycombFragmentShader.glsl
+++ b/slideshow/opengl/honeycombFragmentShader.glsl
@@ -26,7 +26,7 @@ bool isBorder(vec2 point)
 
 void main()
 {
-vec4 fragment = texture2D(slideTexture, texturePosition);
+vec4 fragment = vec4(texture2D(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) {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - slideshow/opengl

2016-02-02 Thread Emmanuel Gil Peyrot
 slideshow/opengl/honeycombFragmentShader.glsl |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 59be03a2f0692c424299c8b2b3acdf1682bb1c1f
Author: Emmanuel Gil Peyrot <emmanuel.pey...@collabora.com>
Date:   Wed Jan 27 20:21:21 2016 +

slideshow: Make sure the slide is fully opaque in Honeycomb

On Windows, the text is rendered with 0 of alpha, which is an issue in
this transition as it enables GL_BLEND.

Change-Id: I45fe32ccf77854e758eddc33f300791d4cdd6904
(cherry picked from commit 8b65dec8e0fdfc8564597e90aff91b971e23f7ce)
Reviewed-on: https://gerrit.libreoffice.org/22021
Reviewed-by: Tomaž Vajngerl <qui...@gmail.com>
Tested-by: Tomaž Vajngerl <qui...@gmail.com>

diff --git a/slideshow/opengl/honeycombFragmentShader.glsl 
b/slideshow/opengl/honeycombFragmentShader.glsl
index 325e393..7e52951 100644
--- a/slideshow/opengl/honeycombFragmentShader.glsl
+++ b/slideshow/opengl/honeycombFragmentShader.glsl
@@ -26,7 +26,7 @@ bool isBorder(vec2 point)
 
 void main()
 {
-vec4 fragment = texture2D(slideTexture, texturePosition);
+vec4 fragment = vec4(texture2D(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) {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - slideshow/opengl slideshow/Package_opengl.mk slideshow/source

2016-01-28 Thread Emmanuel Gil Peyrot
 slideshow/Package_opengl.mk  |1 
 slideshow/opengl/vortexGeometryShader.glsl   |   76 
+++
 slideshow/opengl/vortexVertexShader.glsl |  102 
++
 slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx |3 
 4 files changed, 108 insertions(+), 74 deletions(-)

New commits:
commit 390b5922e0ae0f1c583cc528c872621924093ed4
Author: Emmanuel Gil Peyrot <emmanuel.pey...@collabora.com>
Date:   Wed Jan 20 21:04:37 2016 +

slideshow: Change quads into cubes in the Vortex transition

This makes Vortex require OpenGL 3.2 instead of 2.1.

(cherry picked from commit 29bd6961a23dd44bcf315cacac1189282d87fc9f)

Change-Id: I9438a37c2cf75e58eafc807ad1abaa22acb231b1
Reviewed-on: https://gerrit.libreoffice.org/21647
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Tomaž Vajngerl <qui...@gmail.com>

diff --git a/slideshow/Package_opengl.mk b/slideshow/Package_opengl.mk
index 6b01831..2781cd7 100644
--- a/slideshow/Package_opengl.mk
+++ b/slideshow/Package_opengl.mk
@@ -24,6 +24,7 @@ $(eval $(call 
gb_Package_add_files,slideshow_opengl_shader,$(LIBO_ETC_FOLDER)/op
reflectionFragmentShader.glsl \
staticFragmentShader.glsl \
vortexVertexShader.glsl \
+   vortexGeometryShader.glsl \
rippleFragmentShader.glsl \
 ))
 
diff --git a/slideshow/opengl/vortexGeometryShader.glsl 
b/slideshow/opengl/vortexGeometryShader.glsl
new file mode 100644
index 000..46999ef
--- /dev/null
+++ b/slideshow/opengl/vortexGeometryShader.glsl
@@ -0,0 +1,76 @@
+/* -*- 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;
+
+in vec2 g_texturePosition[];
+in vec3 g_normal[];
+in mat4 modelViewMatrix[];
+in mat4 transform[];
+in float nTime[];
+in float startTime[];
+in float endTime[];
+
+uniform mat4 u_projectionMatrix;
+
+out vec2 v_texturePosition;
+out vec3 v_normal;
+
+void emitHexagonVertex(int index, vec3 translation, float fdsq)
+{
+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 = u_projectionMatrix * 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
index e01b331..603c629 100755
--- a/slideshow/opengl/vortexVertexShader.glsl
+++ b/slideshow/opengl/vortexVertexShader.glsl
@@ -7,73 +7,32 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
-#version 120
+#version 150
 
 #define M_PI 3.1415926535897932384626433832795
 
-attribute vec3 a_position;
-attribute vec3 a_normal;
-attribute vec2 a_texCoord;
+in vec3 a_position;
+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;
 uniform mat4 u_operationsTransformMatrix;
 
-varying vec2 v_texturePosition;
-varying vec3 v_normal;
-
 uniform float time;
 uniform ivec2 numTiles;
 uniform sampler2D permTexture;
-attribute float tileInfo;
 uniform float slide;
 
-varying vec4 debug;
-
-#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

[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - slideshow/opengl

2016-01-21 Thread Emmanuel Gil Peyrot
 slideshow/opengl/glitterVertexShader.glsl |4 ++--
 slideshow/opengl/honeycombFragmentShader.glsl |6 --
 slideshow/opengl/honeycombVertexShader.glsl   |2 +-
 3 files changed, 7 insertions(+), 5 deletions(-)

New commits:
commit 76f7533d1bfd49179774a4a0948061b2b2c7939e
Author: Emmanuel Gil Peyrot <emmanuel.pey...@collabora.com>
Date:   Wed Jan 13 23:18:32 2016 +

slideshow: Tweak a few constants to make Glitter and Honeycomb look nicer

Change-Id: I5dd15f3d483caaedbf58a7ad12bf24798694524f
(cherry picked from commit 0fe5a3069b83d6a5e83c6c4df5d874c8802b7f52)
Reviewed-on: https://gerrit.libreoffice.org/21644
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: David Tardon <dtar...@redhat.com>

diff --git a/slideshow/opengl/glitterVertexShader.glsl 
b/slideshow/opengl/glitterVertexShader.glsl
index 3704efd..00ae568 100644
--- a/slideshow/opengl/glitterVertexShader.glsl
+++ b/slideshow/opengl/glitterVertexShader.glsl
@@ -111,9 +111,9 @@ void main( void )
 // 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 * 0.3 / 0.5;
+transitionTime = transitionTime / 2.0;
 else
-transitionTime = (transitionTime * 0.3 / 0.5) + 0.4;
+transitionTime = (transitionTime / 2.0) + 0.5;
 angle = transitionTime * M_PI * 2.0;
 
 mat4 modelViewMatrix = u_modelViewMatrix * u_operationsTransformMatrix * 
u_sceneTransformMatrix * u_primitiveTransformMatrix;
diff --git a/slideshow/opengl/honeycombFragmentShader.glsl 
b/slideshow/opengl/honeycombFragmentShader.glsl
index 607e83d..25b3e2d 100644
--- a/slideshow/opengl/honeycombFragmentShader.glsl
+++ b/slideshow/opengl/honeycombFragmentShader.glsl
@@ -43,7 +43,7 @@ void main()
 // If the center is “outside” of the canvas, clear it 
first.
 startTime = 0.15;
 else
-startTime = 0.15 + fuzz * 0.3;
+startTime = 0.15 + fuzz * 0.4;
 float endTime = startTime + 0.05;
 actualTime = 1.0 - clamp((time - startTime) / (endTime - 
startTime), 0, 1);
 } else {
@@ -52,9 +52,11 @@ void main()
 // If the center is “outside” of the canvas, clear it 
first.
 startTime = 0.85;
 else
-startTime = 0.5 + fuzz * 0.3;
+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;
 }
 gl_FragColor.a = actualTime;
 }
diff --git a/slideshow/opengl/honeycombVertexShader.glsl 
b/slideshow/opengl/honeycombVertexShader.glsl
index b54efbd..d54783b 100644
--- a/slideshow/opengl/honeycombVertexShader.glsl
+++ b/slideshow/opengl/honeycombVertexShader.glsl
@@ -73,7 +73,7 @@ void main( void )
 // Entering texture
 transformMatrix = translationMatrix(vec3(0, 0, 28 * (sqrt(time) - 1)))
 * slideScaleMatrix
-* rotationMatrix(vec3(0.0, 0.0, 1.0), pow(time - 1, 2) * M_PI)
+* rotationMatrix(vec3(0.0, 0.0, 1.0), pow(0.8 * (time - 1.0), 2.0) 
* M_PI)
 * invertSlideScaleMatrix;
 }
 modelViewProjectionMatrix = u_projectionMatrix * modelViewMatrix * 
transformMatrix;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - slideshow/opengl

2016-01-21 Thread Emmanuel Gil Peyrot
 slideshow/opengl/basicFragmentShader.glsl  |   35 +
 slideshow/opengl/fadeBlackFragmentShader.glsl  |   35 +
 slideshow/opengl/fadeFragmentShader.glsl   |   35 +
 slideshow/opengl/reflectionFragmentShader.glsl |   35 +
 slideshow/opengl/reflectionVertexShader.glsl   |   33 +--
 5 files changed, 39 insertions(+), 134 deletions(-)

New commits:
commit d0bb14ca73d53f2ecb110b6256c5c7f180f3a8f3
Author: Emmanuel Gil Peyrot <emmanuel.pey...@collabora.com>
Date:   Wed Jan 20 18:50:08 2016 +

slideshow: Relicense every shader of which I am the sole author to MPL

Change-Id: I921e52d8347f3b37030818711f979517eab690a8
(cherry picked from commit 3b6f877370191795fc8422772ccb544a1ee07456)
Reviewed-on: https://gerrit.libreoffice.org/21646
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: David Tardon <dtar...@redhat.com>

diff --git a/slideshow/opengl/basicFragmentShader.glsl 
b/slideshow/opengl/basicFragmentShader.glsl
index 01d72a2..fe27071 100644
--- a/slideshow/opengl/basicFragmentShader.glsl
+++ b/slideshow/opengl/basicFragmentShader.glsl
@@ -1,30 +1,11 @@
-/* -*- 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 2015 by Collabora, Ltd.
- *
- * 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.
- *
- /
+/* -*- 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
 
diff --git a/slideshow/opengl/fadeBlackFragmentShader.glsl 
b/slideshow/opengl/fadeBlackFragmentShader.glsl
index 7f80cc5..d45a736 100644
--- a/slideshow/opengl/fadeBlackFragmentShader.glsl
+++ b/slideshow/opengl/fadeBlackFragmentShader.glsl
@@ -1,30 +1,11 @@
-/* -*- 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 2015 by Collabora, Ltd.
- *
- * 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.
- *
- /
+/* -*- 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
 
diff --git a/slideshow/opengl/fadeFragmentShader.glsl 
b/slideshow/opengl/fadeFragmentShader.glsl
index aab848e..0751b6e 100644
--- a/slideshow/opengl/fadeFragmentShader.glsl
+++ b/slideshow/opengl/fadeFragmentShader.glsl
@@ -1,30 +1,11 @@
-/* -*- Mode: C++; tab-width: 4; indent-tab

[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - slideshow/opengl

2016-01-21 Thread Emmanuel Gil Peyrot
 slideshow/opengl/honeycombFragmentShader.glsl |   20 
 slideshow/opengl/honeycombGeometryShader.glsl |   22 --
 2 files changed, 36 insertions(+), 6 deletions(-)

New commits:
commit f28347ca6018b8163acf3f358a28f47eecf30641
Author: Emmanuel Gil Peyrot <emmanuel.pey...@collabora.com>
Date:   Fri Jan 15 21:07:56 2016 +

slideshow: Add some volume to the Honeycomb hexagons, making them look 
better

Change-Id: Ic0f62f36faccb65ab4fbc7bb5553d096a2658f96
(cherry picked from commit 7cca8d3b3f5a9eda0060342fd2576d08a874b1c3)
Reviewed-on: https://gerrit.libreoffice.org/21645
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: David Tardon <dtar...@redhat.com>

diff --git a/slideshow/opengl/honeycombFragmentShader.glsl 
b/slideshow/opengl/honeycombFragmentShader.glsl
index 25b3e2d..325e393 100644
--- a/slideshow/opengl/honeycombFragmentShader.glsl
+++ b/slideshow/opengl/honeycombFragmentShader.glsl
@@ -12,6 +12,7 @@
 in vec2 texturePosition;
 in float fuzz;
 in vec2 v_center;
+in vec3 normal;
 
 uniform sampler2D slideTexture;
 uniform float selectedTexture;
@@ -25,13 +26,15 @@ bool isBorder(vec2 point)
 
 void main()
 {
-gl_FragColor = texture2D(slideTexture, texturePosition);
+vec4 fragment = texture2D(slideTexture, texturePosition);
+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)
-gl_FragColor.a = 1.0 - time * 8 + gl_FragCoord.x / 1024.;
+fragment.a = 1.0 - time * 8 + gl_FragCoord.x / 1024.;
 else
-gl_FragColor.a = time * 8 - 7.7 + gl_FragCoord.x / 1024.;
+fragment.a = time * 8 - 7.3 + gl_FragCoord.x / 1024.;
 } else {
 // The hexagons themselves.
 
@@ -58,8 +61,17 @@ void main()
 if (time < 0.8)
 actualTime *= time / 0.8;
 }
-gl_FragColor.a = actualTime;
+
+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;
+}
 }
+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/honeycombGeometryShader.glsl 
b/slideshow/opengl/honeycombGeometryShader.glsl
index bb2b1f3..f1c0c70 100644
--- a/slideshow/opengl/honeycombGeometryShader.glsl
+++ b/slideshow/opengl/honeycombGeometryShader.glsl
@@ -10,7 +10,7 @@
 #version 150
 
 layout(triangles) in;
-layout(triangle_strip, max_vertices=13) out;
+layout(triangle_strip, max_vertices=27) out;
 
 in mat4 modelViewProjectionMatrix[];
 
@@ -20,6 +20,7 @@ uniform sampler2D permTexture;
 out vec2 texturePosition;
 out float fuzz;
 out vec2 v_center;
+out vec3 normal;
 
 const float expandFactor = 0.0318;
 
@@ -51,11 +52,28 @@ void main()
 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));
+emitHexagonVertex(center, vec2(0.0, 0.0));
 }
 
 EndPrimitive();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: slideshow/opengl

2016-01-20 Thread Emmanuel Gil Peyrot
 slideshow/opengl/basicFragmentShader.glsl  |   35 +
 slideshow/opengl/fadeBlackFragmentShader.glsl  |   35 +
 slideshow/opengl/fadeFragmentShader.glsl   |   35 +
 slideshow/opengl/reflectionFragmentShader.glsl |   35 +
 slideshow/opengl/reflectionVertexShader.glsl   |   33 +--
 5 files changed, 39 insertions(+), 134 deletions(-)

New commits:
commit 3b6f877370191795fc8422772ccb544a1ee07456
Author: Emmanuel Gil Peyrot <emmanuel.pey...@collabora.com>
Date:   Wed Jan 20 18:50:08 2016 +

slideshow: Relicense every shader of which I am the sole author to MPL

Change-Id: I921e52d8347f3b37030818711f979517eab690a8

diff --git a/slideshow/opengl/basicFragmentShader.glsl 
b/slideshow/opengl/basicFragmentShader.glsl
index 01d72a2..fe27071 100644
--- a/slideshow/opengl/basicFragmentShader.glsl
+++ b/slideshow/opengl/basicFragmentShader.glsl
@@ -1,30 +1,11 @@
-/* -*- 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 2015 by Collabora, Ltd.
- *
- * 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.
- *
- /
+/* -*- 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
 
diff --git a/slideshow/opengl/fadeBlackFragmentShader.glsl 
b/slideshow/opengl/fadeBlackFragmentShader.glsl
index 7f80cc5..d45a736 100644
--- a/slideshow/opengl/fadeBlackFragmentShader.glsl
+++ b/slideshow/opengl/fadeBlackFragmentShader.glsl
@@ -1,30 +1,11 @@
-/* -*- 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 2015 by Collabora, Ltd.
- *
- * 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.
- *
- /
+/* -*- 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
 
diff --git a/slideshow/opengl/fadeFragmentShader.glsl 
b/slideshow/opengl/fadeFragmentShader.glsl
index aab848e..0751b6e 100644
--- a/slideshow/opengl/fadeFragmentShader.glsl
+++ b/slideshow/opengl/fadeFragmentShader.glsl
@@ -1,30 +1,11 @@
-/* -*- 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 2015 by Collabora, Ltd.
- *

[Libreoffice-commits] core.git: slideshow/opengl slideshow/Package_opengl.mk slideshow/source

2016-01-20 Thread Emmanuel Gil Peyrot
 slideshow/Package_opengl.mk  |1 
 slideshow/opengl/vortexGeometryShader.glsl   |   76 
+++
 slideshow/opengl/vortexVertexShader.glsl |  100 
++
 slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx |3 
 4 files changed, 107 insertions(+), 73 deletions(-)

New commits:
commit 29bd6961a23dd44bcf315cacac1189282d87fc9f
Author: Emmanuel Gil Peyrot <emmanuel.pey...@collabora.com>
Date:   Wed Jan 20 21:04:37 2016 +

slideshow: Change quads into cubes in the Vortex transition

This makes Vortex require OpenGL 3.2 instead of 2.1.

Change-Id: I9438a37c2cf75e58eafc807ad1abaa22acb231b1

diff --git a/slideshow/Package_opengl.mk b/slideshow/Package_opengl.mk
index 6b01831..2781cd7 100644
--- a/slideshow/Package_opengl.mk
+++ b/slideshow/Package_opengl.mk
@@ -24,6 +24,7 @@ $(eval $(call 
gb_Package_add_files,slideshow_opengl_shader,$(LIBO_ETC_FOLDER)/op
reflectionFragmentShader.glsl \
staticFragmentShader.glsl \
vortexVertexShader.glsl \
+   vortexGeometryShader.glsl \
rippleFragmentShader.glsl \
 ))
 
diff --git a/slideshow/opengl/vortexGeometryShader.glsl 
b/slideshow/opengl/vortexGeometryShader.glsl
new file mode 100644
index 000..46999ef
--- /dev/null
+++ b/slideshow/opengl/vortexGeometryShader.glsl
@@ -0,0 +1,76 @@
+/* -*- 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;
+
+in vec2 g_texturePosition[];
+in vec3 g_normal[];
+in mat4 modelViewMatrix[];
+in mat4 transform[];
+in float nTime[];
+in float startTime[];
+in float endTime[];
+
+uniform mat4 u_projectionMatrix;
+
+out vec2 v_texturePosition;
+out vec3 v_normal;
+
+void emitHexagonVertex(int index, vec3 translation, float fdsq)
+{
+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 = u_projectionMatrix * 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
index 33fdc93..603c629 100644
--- a/slideshow/opengl/vortexVertexShader.glsl
+++ b/slideshow/opengl/vortexVertexShader.glsl
@@ -7,73 +7,32 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
-#version 120
+#version 150
 
 #define M_PI 3.1415926535897932384626433832795
 
-attribute vec3 a_position;
-attribute vec3 a_normal;
-attribute vec2 a_texCoord;
+in vec3 a_position;
+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;
 uniform mat4 u_operationsTransformMatrix;
 
-varying vec2 v_texturePosition;
-varying vec3 v_normal;
-
 uniform float time;
 uniform ivec2 numTiles;
 uniform sampler2D permTexture;
-attribute float tileInfo;
 uniform float slide;
 
-varying vec4 debug;
-
-#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;
-floa

[Libreoffice-commits] core.git: 2 commits - slideshow/opengl

2016-01-16 Thread Emmanuel Gil Peyrot
 slideshow/opengl/glitterVertexShader.glsl |4 ++--
 slideshow/opengl/honeycombFragmentShader.glsl |   26 --
 slideshow/opengl/honeycombGeometryShader.glsl |   22 --
 slideshow/opengl/honeycombVertexShader.glsl   |2 +-
 4 files changed, 43 insertions(+), 11 deletions(-)

New commits:
commit 7cca8d3b3f5a9eda0060342fd2576d08a874b1c3
Author: Emmanuel Gil Peyrot <emmanuel.pey...@collabora.com>
Date:   Fri Jan 15 21:07:56 2016 +

slideshow: Add some volume to the Honeycomb hexagons, making them look 
better

Change-Id: Ic0f62f36faccb65ab4fbc7bb5553d096a2658f96

diff --git a/slideshow/opengl/honeycombFragmentShader.glsl 
b/slideshow/opengl/honeycombFragmentShader.glsl
index 25b3e2d..325e393 100644
--- a/slideshow/opengl/honeycombFragmentShader.glsl
+++ b/slideshow/opengl/honeycombFragmentShader.glsl
@@ -12,6 +12,7 @@
 in vec2 texturePosition;
 in float fuzz;
 in vec2 v_center;
+in vec3 normal;
 
 uniform sampler2D slideTexture;
 uniform float selectedTexture;
@@ -25,13 +26,15 @@ bool isBorder(vec2 point)
 
 void main()
 {
-gl_FragColor = texture2D(slideTexture, texturePosition);
+vec4 fragment = texture2D(slideTexture, texturePosition);
+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)
-gl_FragColor.a = 1.0 - time * 8 + gl_FragCoord.x / 1024.;
+fragment.a = 1.0 - time * 8 + gl_FragCoord.x / 1024.;
 else
-gl_FragColor.a = time * 8 - 7.7 + gl_FragCoord.x / 1024.;
+fragment.a = time * 8 - 7.3 + gl_FragCoord.x / 1024.;
 } else {
 // The hexagons themselves.
 
@@ -58,8 +61,17 @@ void main()
 if (time < 0.8)
 actualTime *= time / 0.8;
 }
-gl_FragColor.a = actualTime;
+
+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;
+}
 }
+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/honeycombGeometryShader.glsl 
b/slideshow/opengl/honeycombGeometryShader.glsl
index bb2b1f3..f1c0c70 100644
--- a/slideshow/opengl/honeycombGeometryShader.glsl
+++ b/slideshow/opengl/honeycombGeometryShader.glsl
@@ -10,7 +10,7 @@
 #version 150
 
 layout(triangles) in;
-layout(triangle_strip, max_vertices=13) out;
+layout(triangle_strip, max_vertices=27) out;
 
 in mat4 modelViewProjectionMatrix[];
 
@@ -20,6 +20,7 @@ uniform sampler2D permTexture;
 out vec2 texturePosition;
 out float fuzz;
 out vec2 v_center;
+out vec3 normal;
 
 const float expandFactor = 0.0318;
 
@@ -51,11 +52,28 @@ void main()
 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));
+emitHexagonVertex(center, vec2(0.0, 0.0));
 }
 
 EndPrimitive();
commit 0fe5a3069b83d6a5e83c6c4df5d874c8802b7f52
Author: Emmanuel Gil Peyrot <emmanuel.pey...@collabora.com>
Date:   Wed Jan 13 23:18:32 2016 +

slideshow: Tweak a few constants to make Glitter and Honeycomb look nicer

Change-Id: I5dd15f3d483caaedbf58a7ad12bf24798694524f

diff --git a/slideshow/opengl/glitterVertexShader.glsl 
b/slideshow/opengl/glitterVertexShader.glsl
index 3704efd..00ae568 100644
--- a/slideshow/opengl/glitterVertexShader.glsl
+++ b/slideshow/opengl/glitterVertexShader.glsl
@@ -111,9 +111,9 @@ void main( void )
 // 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 * 0.3 / 0.5;
+transitionTime = transitionTime / 2.0;
 else
-transitionTime = (transitionTime * 0.3 / 0.5) + 0.4;
+transitionTime = (transitionTime / 2.0) + 0.5;
 angle = transitionTime * M_P

[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - slideshow/opengl slideshow/Package_opengl.mk slideshow/source vcl/source

2016-01-07 Thread Emmanuel Gil Peyrot
 slideshow/Package_opengl.mk  |1 
 slideshow/opengl/basicVertexShader.glsl  |   43 ++
 slideshow/opengl/glitterFragmentShader.glsl  |2 
 slideshow/opengl/glitterVertexShader.glsl|   65 
+++-
 slideshow/opengl/reflectionVertexShader.glsl |   43 ++
 slideshow/opengl/rippleFragmentShader.glsl   |   44 ++
 slideshow/opengl/vortexFragmentShader.glsl   |   40 --
 slideshow/opengl/vortexVertexShader.glsl |  151 
+++---
 slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx |   46 ++-
 vcl/source/opengl/OpenGLContext.cxx  |6 
 10 files changed, 330 insertions(+), 111 deletions(-)

New commits:
commit 97e2cc532644a1a7cbbae049f37bc3ac098e94ac
Author: Emmanuel Gil Peyrot <emmanuel.pey...@collabora.com>
Date:   Tue Jan 5 15:19:11 2016 +0100

OpenGL transitions: squashed 5 commits into this one

vcl: Ignore i965’s shader compiler debug

(cherry picked from commit 928fe134ff6ea85f732b36a1ab11336f1d829531)

slideshow: Fix a few issues in the Glitter transition

Remove an unused variable, add comments, reduce the time a tile stays
black, and don’t rely on implicit casts of integers into floats.

(cherry picked from commit 22480b20130d10f4691cdf0a658040be7f36e47b)

slideshow: Improve the Ripple transition to match PowerPoint better

(cherry picked from commit 1d411cad5a7d78ead8cffb5da522f1e0fba31187)

slideshow: Improve the Vortex transition to match PowerPoint better

(cherry picked from commit d886fef25c5978dd4b07fa0e3ce2402874a6c29a)

slideshow: Define inverse() to bring back the GLSL version to 1.20

(cherry picked from commit a301da7cb6c562cd21983d9b3b34dc01235a82a5)

Change-Id: Ifd33ae982b762af3ea8d88b2b2de259aabeebc9a
Reviewed-on: https://gerrit.libreoffice.org/21116
Reviewed-by: Tor Lillqvist <t...@collabora.com>
Tested-by: Tor Lillqvist <t...@collabora.com>

diff --git a/slideshow/Package_opengl.mk b/slideshow/Package_opengl.mk
index bed17d9..6b01831 100644
--- a/slideshow/Package_opengl.mk
+++ b/slideshow/Package_opengl.mk
@@ -23,7 +23,6 @@ $(eval $(call 
gb_Package_add_files,slideshow_opengl_shader,$(LIBO_ETC_FOLDER)/op
reflectionVertexShader.glsl \
reflectionFragmentShader.glsl \
staticFragmentShader.glsl \
-   vortexFragmentShader.glsl \
vortexVertexShader.glsl \
rippleFragmentShader.glsl \
 ))
diff --git a/slideshow/opengl/basicVertexShader.glsl 
b/slideshow/opengl/basicVertexShader.glsl
index cd68b16..730da36 100644
--- a/slideshow/opengl/basicVertexShader.glsl
+++ b/slideshow/opengl/basicVertexShader.glsl
@@ -41,6 +41,49 @@ 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;
diff --git a/slideshow/opengl/glitterFragmentShader.glsl 
b/slideshow/opengl/glitterFragmentShader.glsl
i

[Libreoffice-commits] core.git: 5 commits - slideshow/opengl slideshow/Package_opengl.mk slideshow/source vcl/source

2016-01-05 Thread Emmanuel Gil Peyrot
 slideshow/Package_opengl.mk  |1 
 slideshow/opengl/basicVertexShader.glsl  |   45 ++
 slideshow/opengl/glitterFragmentShader.glsl  |2 
 slideshow/opengl/glitterVertexShader.glsl|   65 
+++-
 slideshow/opengl/reflectionVertexShader.glsl |   45 ++
 slideshow/opengl/rippleFragmentShader.glsl   |   44 ++
 slideshow/opengl/vortexFragmentShader.glsl   |   40 --
 slideshow/opengl/vortexVertexShader.glsl |  153 
+++---
 slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx |   46 ++-
 vcl/source/opengl/OpenGLContext.cxx  |6 
 10 files changed, 333 insertions(+), 114 deletions(-)

New commits:
commit a301da7cb6c562cd21983d9b3b34dc01235a82a5
Author: Emmanuel Gil Peyrot <emmanuel.pey...@collabora.com>
Date:   Mon Dec 21 21:25:35 2015 +

slideshow: Define inverse() to bring back the GLSL version to 1.20

Change-Id: Ib0372d6a98734724d99b979f2d01abc1ee317847

diff --git a/slideshow/opengl/basicVertexShader.glsl 
b/slideshow/opengl/basicVertexShader.glsl
index e9febff..730da36 100644
--- a/slideshow/opengl/basicVertexShader.glsl
+++ b/slideshow/opengl/basicVertexShader.glsl
@@ -26,7 +26,7 @@
  *
  /
 
-#version 140
+#version 120
 
 attribute vec3 a_position;
 attribute vec3 a_normal;
@@ -41,6 +41,49 @@ 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;
diff --git a/slideshow/opengl/glitterFragmentShader.glsl 
b/slideshow/opengl/glitterFragmentShader.glsl
index 1bec201..7188174 100644
--- a/slideshow/opengl/glitterFragmentShader.glsl
+++ b/slideshow/opengl/glitterFragmentShader.glsl
@@ -7,7 +7,7 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
-#version 130
+#version 120
 
 #define M_PI 3.1415926535897932384626433832795
 
diff --git a/slideshow/opengl/glitterVertexShader.glsl 
b/slideshow/opengl/glitterVertexShader.glsl
index 64bb6de..3704efd 100644
--- a/slideshow/opengl/glitterVertexShader.glsl
+++ b/slideshow/opengl/glitterVertexShader.glsl
@@ -7,7 +7,7 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
-#version 140
+#version 120
 
 #define M_PI 3.1415926535897932384626433832795
 
@@ -29,6 +29,49 @@ 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;
+ 

[Libreoffice-commits] core.git: 6 commits - slideshow/Library_OGLTrans.mk slideshow/opengl slideshow/source

2015-11-23 Thread Emmanuel Gil Peyrot
 slideshow/Library_OGLTrans.mk|3 
 slideshow/opengl/basicFragmentShader.glsl|8 
 slideshow/opengl/basicVertexShader.glsl  |2 
 slideshow/opengl/reflectionFragmentShader.glsl   |6 
 slideshow/opengl/reflectionVertexShader.glsl |4 
 slideshow/source/engine/OGLTrans/generic/OGLTrans_Operation.cxx  |  221 
+
 slideshow/source/engine/OGLTrans/generic/OGLTrans_Operation.hxx  |  272 
++
 slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx |  420 
++
 slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.hxx |  261 
--
 9 files changed, 625 insertions(+), 572 deletions(-)

New commits:
commit 68ab250d73cc981fe3760f4e8671d3df3971ca05
Author: Emmanuel Gil Peyrot <emmanuel.pey...@collabora.com>
Date:   Mon Nov 23 21:53:23 2015 +

slideshow: Fix rotations when the slide and the screen have a different 
ratio

Change-Id: Ia6dcc352531a6bf067f3e87086cb275b00f81c97

diff --git a/slideshow/source/engine/OGLTrans/generic/OGLTrans_Operation.cxx 
b/slideshow/source/engine/OGLTrans/generic/OGLTrans_Operation.cxx
index 7199a7e..3709f3a 100644
--- a/slideshow/source/engine/OGLTrans/generic/OGLTrans_Operation.cxx
+++ b/slideshow/source/engine/OGLTrans/generic/OGLTrans_Operation.cxx
@@ -49,20 +49,22 @@ SScale::SScale(const glm::vec3& Scale, const glm::vec3& 
Origin,
 }
 
 RotateAndScaleDepthByWidth::RotateAndScaleDepthByWidth(const glm::vec3& Axis,
-const glm::vec3& Origin, double Angle, bool bInter, double T0, double 
T1):
+const glm::vec3& Origin, double Angle, bool bScale, bool bInter, 
double T0, double T1):
 Operation(bInter, T0, T1),
 axis(Axis),
 origin(Origin),
-angle(Angle)
+angle(Angle),
+scale(bScale)
 {
 }
 
 RotateAndScaleDepthByHeight::RotateAndScaleDepthByHeight(const glm::vec3& Axis,
-const glm::vec3& Origin, double Angle, bool bInter, double T0, double 
T1):
+const glm::vec3& Origin, double Angle, bool bScale, bool bInter, 
double T0, double T1):
 Operation(bInter, T0, T1),
 axis(Axis),
 origin(Origin),
-angle(Angle)
+angle(Angle),
+scale(bScale)
 {
 }
 
@@ -98,15 +100,15 @@ makeSEllipseTranslate(double dWidth, double dHeight, 
double dStartPosition, doub
 }
 
 std::shared_ptr
-makeRotateAndScaleDepthByWidth(const glm::vec3& Axis,const glm::vec3& 
Origin,double Angle,bool bInter, double T0, double T1)
+makeRotateAndScaleDepthByWidth(const glm::vec3& Axis,const glm::vec3& 
Origin,double Angle, bool bScale, bool bInter, double T0, double T1)
 {
-return std::make_shared(Axis, Origin, Angle, 
bInter, T0, T1);
+return std::make_shared(Axis, Origin, Angle, 
bScale, bInter, T0, T1);
 }
 
 std::shared_ptr
-makeRotateAndScaleDepthByHeight(const glm::vec3& Axis,const glm::vec3& 
Origin,double Angle,bool bInter, double T0, double T1)
+makeRotateAndScaleDepthByHeight(const glm::vec3& Axis,const glm::vec3& 
Origin,double Angle,bool bScale, bool bInter, double T0, double T1)
 {
-return std::make_shared(Axis, Origin, Angle, 
bInter, T0, T1);
+return std::make_shared(Axis, Origin, Angle, 
bScale, bInter, T0, T1);
 }
 
 inline double intervalInter(double t, double T0, double T1)
@@ -132,7 +134,7 @@ void SRotate::interpolate(glm::mat4& matrix, double t, 
double SlideWidthScale, d
 t = mnT1;
 t = intervalInter(t,mnT0,mnT1);
 glm::vec3 translation_vector(SlideWidthScale*origin.x, 
SlideHeightScale*origin.y, origin.z);
-glm::vec3 scale_vector(SlideWidthScale, SlideHeightScale, 1);
+glm::vec3 scale_vector(SlideWidthScale * SlideWidthScale, SlideHeightScale 
* SlideHeightScale, 1);
 matrix = glm::translate(matrix, translation_vector);
 matrix = glm::scale(matrix, scale_vector);
 matrix = glm::rotate(matrix, static_cast(t*angle), axis);
@@ -161,8 +163,13 @@ void RotateAndScaleDepthByWidth::interpolate(glm::mat4& 
matrix, double t, double
 t = mnT1;
 t = intervalInter(t,mnT0,mnT1);
 glm::vec3 translation_vector(SlideWidthScale*origin.x, 
SlideHeightScale*origin.y, SlideWidthScale*origin.z);
+glm::vec3 scale_vector(SlideWidthScale * SlideWidthScale, SlideHeightScale 
* SlideHeightScale, 1);
 matrix = glm::translate(matrix, translation_vector);
+if (scale)
+matrix = glm::scale(matrix, scale_vector);
 matrix = glm::rotate(matrix, static_cast(t*angle), axis);
+if (scale)
+matrix = glm::scale(matrix, 1.f / scale_vector);
 matrix = glm::translate(matrix, -translation_vector);
 }
 
@@ -174,8 +181,13 @@ void RotateAndScaleDepthByHeight::interpolate(glm::mat4& 
matrix, double t, doubl
 t = mnT1;
 t = intervalInter(t,mnT0,mnT1);
 glm::vec3 translation_vector(SlideWidthScale*origin.x, 
SlideHeightScale*origin.y, SlideHeightScale*origin.z

[Libreoffice-commits] core.git: 3 commits - slideshow/opengl slideshow/Package_opengl.mk slideshow/source

2015-11-20 Thread Emmanuel Gil Peyrot
 slideshow/Package_opengl.mk  |5 
 slideshow/opengl/basicFragmentShader.glsl|   39 
 slideshow/opengl/fadeBlackFragmentShader.glsl|   50 
 slideshow/opengl/fadeFragmentShader.glsl |   42 
 slideshow/opengl/reflectionFragmentShader.glsl   |   47 
 slideshow/opengl/reflectionVertexShader.glsl |   41 
 slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx |  514 
+-
 slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.hxx |   10 
 8 files changed, 489 insertions(+), 259 deletions(-)

New commits:
commit b3ce63e5a5899088def6458ae80a354c926f9891
Author: Emmanuel Gil Peyrot <emmanuel.pey...@collabora.com>
Date:   Fri Nov 20 20:13:05 2015 +

slideshow: Reimplement reflections in shaders, and port Rochade and 
TurnAround

This removes the hack reflections were previously, where a black quad
was drawn on top of a mirror version of the first primitive only.

Change-Id: I8c0863ab30e85d0130a8d7e838f3514e9be93788

diff --git a/slideshow/Package_opengl.mk b/slideshow/Package_opengl.mk
index 82fb3b9..1293c05 100644
--- a/slideshow/Package_opengl.mk
+++ b/slideshow/Package_opengl.mk
@@ -15,6 +15,8 @@ $(eval $(call 
gb_Package_add_files,slideshow_opengl_shader,$(LIBO_ETC_FOLDER)/op
dissolveFragmentShader.glsl \
fadeBlackFragmentShader.glsl \
fadeFragmentShader.glsl \
+   reflectionVertexShader.glsl \
+   reflectionFragmentShader.glsl \
staticFragmentShader.glsl \
vortexFragmentShader.glsl \
vortexVertexShader.glsl \
diff --git a/slideshow/opengl/reflectionFragmentShader.glsl 
b/slideshow/opengl/reflectionFragmentShader.glsl
new file mode 100644
index 000..9bf8ecb
--- /dev/null
+++ b/slideshow/opengl/reflectionFragmentShader.glsl
@@ -0,0 +1,47 @@
+/* -*- 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 2015 by Collabora, Ltd.
+ *
+ * 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 130
+
+uniform sampler2D slideTexture;
+varying float v_isShadow;
+varying vec2 v_texturePosition;
+
+void main() {
+vec4 fragment = texture2D(slideTexture, v_texturePosition);
+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 000..b08d0cc
--- /dev/null
+++ b/slideshow/opengl/reflectionVertexShader.glsl
@@ -0,0 +1,41 @@
+/* -*- 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

[Libreoffice-commits] core.git: 6 commits - slideshow/opengl slideshow/source

2015-11-19 Thread Emmanuel Gil Peyrot
 slideshow/opengl/basicVertexShader.glsl|2 
 slideshow/opengl/vortexVertexShader.glsl   |2 
 slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx   |  234 
+-
 slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.hxx   |   53 
+-
 slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionerImpl.cxx |   26 -
 5 files changed, 184 insertions(+), 133 deletions(-)

New commits:
commit cda5c7ab237fa839aa931556ec66ac37e6f6a955
Author: Emmanuel Gil Peyrot <emmanuel.pey...@collabora.com>
Date:   Thu Nov 19 17:18:56 2015 +

slideshow: Port all matrix operations from GL to glm

We are still using glPushMatrix/glMultMatrix/glPopMatrix until
everything is moved to shaders, at which point we will upload it with
glUniformMatrix instead.

Change-Id: I1684700eb9ed5867c5a2ae2b4e8cf2f1805f4d70

diff --git 
a/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx 
b/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx
index a7fa892..2a13ca1 100644
--- a/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx
+++ b/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx
@@ -27,6 +27,7 @@
  /
 
 #include 
+#include 
 #include 
 #include 
 
@@ -188,8 +189,12 @@ void OGLTransitionImpl::display( double nTime, sal_Int32 
glLeavingSlideTex, sal_
 void OGLTransitionImpl::applyOverallOperations( double nTime, double 
SlideWidthScale, double SlideHeightScale )
 {
 const Operations_t& rOverallOperations(maScene.getOperations());
+glm::mat4 matrix;
 for(size_t i(0); i != rOverallOperations.size(); ++i)
-
rOverallOperations[i]->interpolate(nTime,SlideWidthScale,SlideHeightScale);
+rOverallOperations[i]->interpolate(matrix, nTime, SlideWidthScale, 
SlideHeightScale);
+CHECK_GL_ERROR();
+glMultMatrixf(glm::value_ptr(matrix));
+CHECK_GL_ERROR();
 }
 
 static void display_primitives(const Primitives_t& primitives, double nTime, 
double WidthScale, double HeightScale)
@@ -264,8 +269,10 @@ OGLTransitionImpl::displaySlide(
 /* reflected slides */
 glPushMatrix();
 
-glScaled( 1, -1, 1 );
-glTranslated( 0, 2 - surfaceLevel, 0 );
+glm::mat4 matrix;
+matrix = glm::scale(matrix, glm::vec3(1, -1, 1));
+matrix = glm::translate(matrix, glm::vec3(0, 2 - surfaceLevel, 0));
+glMultMatrixf(glm::value_ptr(matrix));
 
 glCullFace(GL_FRONT);
 display_primitives(primitives, nTime, SlideWidthScale, 
SlideHeightScale);
@@ -308,10 +315,13 @@ void Primitive::display(double nTime, double WidthScale, 
double HeightScale, int
 
 void Primitive::applyOperations(double nTime, double WidthScale, double 
HeightScale) const
 {
-CHECK_GL_ERROR();
+glm::mat4 matrix;
 for(size_t i(0); i < Operations.size(); ++i)
-Operations[i]->interpolate( nTime ,WidthScale,HeightScale);
-glScaled(WidthScale,HeightScale,1);
+Operations[i]->interpolate(matrix, nTime, WidthScale, HeightScale);
+matrix = glm::scale(matrix, glm::vec3(WidthScale, HeightScale, 1));
+CHECK_GL_ERROR();
+// TODO: replace that with an uniform upload instead.
+glMultMatrixf(glm::value_ptr(matrix));
 CHECK_GL_ERROR();
 }
 
@@ -322,10 +332,12 @@ void SceneObject::display(double nTime, double /* 
SlideWidth */, double /* Slide
 CHECK_GL_ERROR();
 glPushMatrix();
 CHECK_GL_ERROR();
+glm::mat4 matrix;
 if (DispHeight > DispWidth)
-glScaled(DispHeight/DispWidth, 1, 1);
+matrix = glm::scale(matrix, glm::vec3(DispHeight/DispWidth, 1, 1));
 else
-glScaled(1, DispWidth/DispHeight, 1);
+matrix = glm::scale(matrix, glm::vec3(1, DispWidth/DispHeight, 1));
+glMultMatrixf(glm::value_ptr(matrix));
 CHECK_GL_ERROR();
 display_primitives(maPrimitives, nTime, 1, 1);
 CHECK_GL_ERROR();
@@ -992,74 +1004,69 @@ inline double intervalInter(double t, double T0, double 
T1)
 return ( t - T0 ) / ( T1 - T0 );
 }
 
-void STranslate::interpolate(double t,double SlideWidthScale,double 
SlideHeightScale) const
+void STranslate::interpolate(glm::mat4& matrix, double t, double 
SlideWidthScale, double SlideHeightScale) const
 {
-CHECK_GL_ERROR();
 if(t <= mnT0)
 return;
 if(!mbInterpolate || t > mnT1)
 t = mnT1;
 t = intervalInter(t,mnT0,mnT1);
-
glTranslated(SlideWidthScale*t*vector.x,SlideHeightScale*t*vector.y,t*vector.z);
-CHECK_GL_ERROR();
+matrix = glm::translate(matrix, glm::vec3(SlideWidthScale*t*vector.x, 
SlideHeightScale*t*vector.y, t*vector.z));
 }
 
-void SRotate::interpolate(double t,double SlideWidthScale,double 
SlideHeightScale) const
+void SRotate::interpolate(glm::mat4& matrix, double t, double SlideWidthScale, 
double SlideHeightSc