diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.com> | 2015-11-13 19:16:03 +0100 |
---|---|---|
committer | Tomaž Vajngerl <tomaz.vajngerl@collabora.com> | 2015-11-13 19:17:01 +0100 |
commit | 6f6056d9cf388f9a5a2b340e4091810910f2eb26 (patch) | |
tree | 04de2f404f4ea46a5b989d90c01533fb2e3f9bb9 /slideshow/source/engine | |
parent | 7dec6e6eed9838337beb7d0d7b7e5edf6ff5a04a (diff) |
slideshow: improve rotation timing in glitter transition
Change-Id: I8b0475a6dcde53202a489b9d3265add9fe068cbc
Diffstat (limited to 'slideshow/source/engine')
-rw-r--r-- | slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx | 46 |
1 files changed, 26 insertions, 20 deletions
diff --git a/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx b/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx index 2f75890a46be..f696ecb2cf4c 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); } } |