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

Tomaž Vajngerl tomaz.vajngerl at collabora.com
Fri Nov 13 10:17:25 PST 2015


 slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx |   84 ++++------
 1 file changed, 41 insertions(+), 43 deletions(-)

New commits:
commit 6f6056d9cf388f9a5a2b340e4091810910f2eb26
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.com>
Date:   Fri Nov 13 19:16:03 2015 +0100

    slideshow: improve rotation timing in glitter transition
    
    Change-Id: I8b0475a6dcde53202a489b9d3265add9fe068cbc

diff --git a/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx b/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx
index 2f75890..f696ecb 100644
--- a/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx
+++ b/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx
@@ -1866,7 +1866,8 @@ std::shared_ptr<OGLTransitionImpl> makeRipple()
 
 std::shared_ptr<OGLTransitionImpl> makeGlitter()
 {
-    const int NX = 30, NY = 30;
+    const int NX = 80;
+    const int NY = NX * 4 / 3;
 
     Primitives_t aLeavingSlide;
     Primitives_t aEnteringSlide;
@@ -1875,37 +1876,42 @@ std::shared_ptr<OGLTransitionImpl> makeGlitter()
     {
         for (int x = 0; x < NX+2; x+=2)
         {
-            Primitive Slide;
+            Primitive aHexagon;
 
             if (y % 4 == 0)
             {
-                Slide.pushTriangle(vec(x-1, y-1, NX, NY), vec(x,   y-2, NX, NY), vec(x, y+0.5, NX, NY));
-                Slide.pushTriangle(vec(x,   y-2, NX, NY), vec(x+1, y-1, NX, NY), vec(x, y+0.5, NX, NY));
-                Slide.pushTriangle(vec(x+1, y-1, NX, NY), vec(x+1, y,   NX, NY), vec(x, y+0.5, NX, NY));
-                Slide.pushTriangle(vec(x+1, y,   NX, NY), vec(x,   y+1, NX, NY), vec(x, y+0.5, NX, NY));
-                Slide.pushTriangle(vec(x,   y+1, NX, NY), vec(x-1, y,   NX, NY), vec(x, y+0.5, NX, NY));
-                Slide.pushTriangle(vec(x-1, y,   NX, NY), vec(x-1, y-1, NX, NY), vec(x, y+0.5, NX, NY));
+                aHexagon.pushTriangle(vec(x-1, y-1, NX, NY), vec(x,   y-2, NX, NY), vec(x, y+0.5, NX, NY));
+                aHexagon.pushTriangle(vec(x,   y-2, NX, NY), vec(x+1, y-1, NX, NY), vec(x, y+0.5, NX, NY));
+                aHexagon.pushTriangle(vec(x+1, y-1, NX, NY), vec(x+1, y,   NX, NY), vec(x, y+0.5, NX, NY));
+                aHexagon.pushTriangle(vec(x+1, y,   NX, NY), vec(x,   y+1, NX, NY), vec(x, y+0.5, NX, NY));
+                aHexagon.pushTriangle(vec(x,   y+1, NX, NY), vec(x-1, y,   NX, NY), vec(x, y+0.5, NX, NY));
+                aHexagon.pushTriangle(vec(x-1, y,   NX, NY), vec(x-1, y-1, NX, NY), vec(x, y+0.5, NX, NY));
             }
             else
             {
-                Slide.pushTriangle(vec(x-2, y-1, NX, NY), vec(x-1, y-2, NX, NY), vec(x, y+0.5, NX, NY));
-                Slide.pushTriangle(vec(x-1, y-2, NX, NY), vec(x,   y-1, NX, NY), vec(x, y+0.5, NX, NY));
-                Slide.pushTriangle(vec(x,   y-1, NX, NY), vec(x,   y,   NX, NY), vec(x, y+0.5, NX, NY));
-                Slide.pushTriangle(vec(x,   y,   NX, NY), vec(x-1, y+1, NX, NY), vec(x, y+0.5, NX, NY));
-                Slide.pushTriangle(vec(x-1, y+1, NX, NY), vec(x-2, y,   NX, NY), vec(x, y+0.5, NX, NY));
-                Slide.pushTriangle(vec(x-2, y,   NX, NY), vec(x-2, y-1, NX, NY), vec(x, y+0.5, NX, NY));
+                aHexagon.pushTriangle(vec(x-2, y-1, NX, NY), vec(x-1, y-2, NX, NY), vec(x, y+0.5, NX, NY));
+                aHexagon.pushTriangle(vec(x-1, y-2, NX, NY), vec(x,   y-1, NX, NY), vec(x, y+0.5, NX, NY));
+                aHexagon.pushTriangle(vec(x,   y-1, NX, NY), vec(x,   y,   NX, NY), vec(x, y+0.5, NX, NY));
+                aHexagon.pushTriangle(vec(x,   y,   NX, NY), vec(x-1, y+1, NX, NY), vec(x, y+0.5, NX, NY));
+                aHexagon.pushTriangle(vec(x-1, y+1, NX, NY), vec(x-2, y,   NX, NY), vec(x, y+0.5, NX, NY));
+                aHexagon.pushTriangle(vec(x-2, y,   NX, NY), vec(x-2, y-1, NX, NY), vec(x, y+0.5, NX, NY));
             }
 
-            glm::vec3 center = Slide.getVertices()[2];
+            glm::vec3 aCenter = aHexagon.getVertices()[2];
 
-            float random = comphelper::rng::uniform_real_distribution(-0.2, std::nextafter(0.2, DBL_MAX));
+            float fRandom = comphelper::rng::uniform_real_distribution(-0.25, std::nextafter(0.2, DBL_MAX));
 
-            Slide.Operations.push_back(makeSRotate(glm::vec3(0, 1, 0), center, 180 , true, fdiv(x, NX) + random , 1.0));
+            double fDelta = 0.6 + fRandom;
+            double fHorizontal = fdiv(x, NX + 2) * fDelta;
 
-            aLeavingSlide.push_back (Slide);
+            double fStart = fHorizontal;
+            double fEnd   = fHorizontal + (1.0 - fDelta);
 
-            Slide.Operations.push_back(makeSRotate(glm::vec3(0, 1, 0), center, 180 , false, fdiv(x, NX) + random, 1.0));
-            aEnteringSlide.push_back (Slide);
+            aHexagon.Operations.push_back(makeSRotate(glm::vec3(0, 1, 0), aCenter, 180 , true, fStart, fEnd));
+            aLeavingSlide.push_back(aHexagon);
+
+            aHexagon.Operations.push_back(makeSRotate(glm::vec3(0, 1, 0), aCenter, 180 , false, fStart, fEnd));
+            aEnteringSlide.push_back(aHexagon);
         }
     }
 
commit 7dec6e6eed9838337beb7d0d7b7e5edf6ff5a04a
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.com>
Date:   Fri Nov 13 18:05:01 2015 +0100

    slideshow: simplify NByMTileFlip transition
    
    Change-Id: I0ec07eb25d538d82d740a33f05b0a4f002adf36a

diff --git a/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx b/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx
index 3b3d581..2f75890 100644
--- a/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx
+++ b/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx
@@ -384,8 +384,7 @@ makeSimpleTransition(
 {
     return std::make_shared<SimpleTransition>(
             TransitionScene(rLeavingSlidePrimitives, rEnteringSlidePrimitives, rOverallOperations, rSceneObjects),
-            rSettings)
-        ;
+            rSettings);
 }
 
 std::shared_ptr<OGLTransitionImpl>
@@ -852,35 +851,28 @@ glm::vec2 vec(float x, float y, float nx, float ny)
 
 std::shared_ptr<OGLTransitionImpl> makeNByMTileFlip( sal_uInt16 n, sal_uInt16 m )
 {
-    double invN(1.0/static_cast<double>(n));
-    double invM(1.0/static_cast<double>(m));
-    double iDn = 0.0;
-    double iPDn = invN;
     Primitives_t aLeavingSlide;
     Primitives_t aEnteringSlide;
-    for(unsigned int i(0); i < n; ++i)
+
+    for (int x = 0; x < n; x++)
     {
-        double jDm = 0.0;
-        double jPDm = invM;
-        for(unsigned int j(0); j < m; ++j)
+        for (int y = 0; y < n; y++)
         {
-            Primitive Tile;
+            Primitive aTile;
+            glm::vec2 x11 = vec(x,   y,   n, m);
+            glm::vec2 x12 = vec(x,   y+1, n, m);
+            glm::vec2 x21 = vec(x+1, y,   n, m);
+            glm::vec2 x22 = vec(x+1, y+1, n, m);
 
-            Tile.pushTriangle(glm::vec2( iPDn , jDm ) , glm::vec2( iDn , jDm ) , glm::vec2( iDn , jPDm ));
+            aTile.pushTriangle(x21, x11, x12);
+            aTile.pushTriangle(x22, x21, x12);
 
-            Tile.pushTriangle(glm::vec2( iPDn , jPDm ) , glm::vec2( iPDn , jDm ) , glm::vec2( iDn , jPDm ));//bottom left corner of tile
+            aTile.Operations.push_back(makeSRotate( glm::vec3(0 , 1, 0), (aTile.getVertices()[1] + aTile.getVertices()[3]) / 2.0f, 180 , true, x11.x * x11.y / 2.0f , ((x22.x * x22.y) + 1.0f) / 2.0f));
+            aLeavingSlide.push_back(aTile);
 
-            Tile.Operations.push_back( makeSRotate( glm::vec3( 1 , 1 , 0 ) , ( Tile.getVertices()[1] + Tile.getVertices()[3] )/2.0f , 180 , true, iDn*jDm/2.0 , ((iPDn*jPDm)+1.0)/2.0 ) );
-            aLeavingSlide.push_back(Tile);
-            Tile.Operations.push_back( makeSRotate( glm::vec3( 1 , 1 , 0 ) , ( Tile.getVertices()[1] + Tile.getVertices()[3] )/2.0f , -180, false, iDn*jDm/2.0 , ((iPDn*jPDm)+1.0)/2.0 ) );
-
-            aEnteringSlide.push_back(Tile);
-
-            jDm += invM;
-            jPDm += invM;
+            aTile.Operations.push_back(makeSRotate( glm::vec3(0 , 1, 0), (aTile.getVertices()[1] + aTile.getVertices()[3]) / 2.0f, -180, false, x11.x * x11.y / 2.0f , ((x22.x * x22.y) + 1.0f) / 2.0f));
+            aEnteringSlide.push_back(aTile);
         }
-        iDn += invN;
-        iPDn += invN;
     }
 
     return makeSimpleTransition(aLeavingSlide, aEnteringSlide);


More information about the Libreoffice-commits mailing list