summaryrefslogtreecommitdiff
path: root/slideshow
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.com>2015-11-18 18:01:31 +0100
committerTomaž Vajngerl <tomaz.vajngerl@collabora.com>2015-11-18 18:28:04 +0100
commit9f8392846bcf9fa5209834a0f79bd31aa06567a6 (patch)
tree3bedc059d1c6c9df051e78b768d113216828c9a0 /slideshow
parent57924b617e4b1b0428cf9b07204b3d5160aa7ea4 (diff)
slideshow: improve "honeycomb" transition
Change-Id: I8687127cd9ccf6a6ddd87d934f7462a69a047053
Diffstat (limited to 'slideshow')
-rw-r--r--slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx107
1 files changed, 60 insertions, 47 deletions
diff --git a/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx b/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx
index 72427ab35ad0..e9c92148b62c 100644
--- a/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx
+++ b/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx
@@ -1864,6 +1864,28 @@ std::shared_ptr<OGLTransitionImpl> makeRipple()
return makeRippleTransition(aLeavingSlide, aEnteringSlide, aSettings);
}
+void createHexagon(Primitive& aHexagon, const int x, const int y, const int NX, const int NY)
+{
+ if (y % 4 == 0)
+ {
+ 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
+ {
+ 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));
+ }
+}
+
std::shared_ptr<OGLTransitionImpl> makeGlitter()
{
const int NX = 80;
@@ -1877,25 +1899,7 @@ std::shared_ptr<OGLTransitionImpl> makeGlitter()
for (int x = 0; x < NX+2; x+=2)
{
Primitive aHexagon;
-
- if (y % 4 == 0)
- {
- 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
- {
- 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));
- }
+ createHexagon(aHexagon, x, y, NX, NY);
glm::vec3 aCenter = aHexagon.getVertices()[2];
@@ -1920,59 +1924,68 @@ std::shared_ptr<OGLTransitionImpl> makeGlitter()
std::shared_ptr<OGLTransitionImpl> makeHoneycomb()
{
- TransitionSettings aSettings;
-
- const int NX = 15;
- const int NY = NX * 4 / 3;
+ const int NX = 21;
+ const int NY = 21;
Primitives_t aLeavingSlide;
Primitives_t aEnteringSlide;
+ float fRandom = 0.0f;
+
+ int centerX = NX / 2;
+ int centerY = NY / 2;
+
for (int y = 0; y < NY+2; y+=2)
{
for (int x = 0; x < NX+2; x+=2)
{
Primitive aHexagon;
+ createHexagon(aHexagon, x, y, NX, NY);
- if (y % 4 == 0)
+ fRandom = comphelper::rng::uniform_real_distribution(0.2, std::nextafter(0.7, DBL_MAX));
+
+ aHexagon.Operations.push_back(makeSRotate(glm::vec3(0, 0, 1), glm::vec3(0, 0, 0), 0 , false, -1, 0.1));
+ aHexagon.Operations.push_back(makeSRotate(glm::vec3(0, 0, 1), glm::vec3(0, 0, 0), 90 , true, 0.2, 1.0));
+ if (x <= 0 || y <= 0 || x >= NX || y >= NY)
+ {
+ aHexagon.Operations.push_back(makeSTranslate(glm::vec3 (0, 0, 100), false, 0.1, 1.0));
+ }
+ else if ((centerX - 1 <= x && x <= centerX + 1 && centerY - 1 <= y && y <= centerY + 1 ))
{
- 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));
+ aHexagon.Operations.push_back(makeSTranslate(glm::vec3 (0, 0, 7), true, 0.0, 1.0));
+ aHexagon.Operations.push_back(makeSTranslate(glm::vec3 (0, 0, 100), false, 0.1, 1.0));
}
else
{
- 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));
+ aHexagon.Operations.push_back(makeSTranslate(glm::vec3 (0, 0, 7), true, 0.0, 1.0));
+ aHexagon.Operations.push_back(makeSTranslate(glm::vec3 (0, 0, 100), false, fRandom, 1.0));
}
- float fRandom = comphelper::rng::uniform_real_distribution(0.0, std::nextafter(1.0, DBL_MAX));
-
- aHexagon.Operations.push_back(makeSRotate(glm::vec3(0, 0, 1), glm::vec3(0, 0, 0), 90 , true, 0.0, 1.0));
- aHexagon.Operations.push_back(makeSTranslate(glm::vec3 (0, 0, 7), true, 0.0, fRandom));
- aHexagon.Operations.push_back(makeSTranslate(glm::vec3 (0, 0, 100), false, fRandom, 1.0));
-
aLeavingSlide.push_back(aHexagon);
aHexagon.Operations.clear();
+
aHexagon.Operations.push_back(makeSRotate(glm::vec3(0, 0, 1), glm::vec3(0, 0, 0), -90 , false, -1, 0.0));
- aHexagon.Operations.push_back(makeSRotate(glm::vec3(0, 0, 1), glm::vec3(0, 0, 0), 90 , true, 0.0, 1.0));
- aHexagon.Operations.push_back(makeSTranslate(glm::vec3(-100, 0, 0),false, -1, 0));
- aHexagon.Operations.push_back(makeSTranslate(glm::vec3(100, 0, -7),false, 0.0, 1));
- aHexagon.Operations.push_back(makeSTranslate(glm::vec3 (0, 0, 7), true, 0.0, 1));
+ aHexagon.Operations.push_back(makeSRotate(glm::vec3(0, 0, 1), glm::vec3(0, 0, 0), 90 , true, 0.0, 0.8));
+ aHexagon.Operations.push_back(makeSTranslate(glm::vec3(-100, 0, -20), false, -1, 0));
+
+ if (x <= 0 || y <= 0 || x >= NX || y >= NY)
+ {
+ fRandom = comphelper::rng::uniform_real_distribution(0.85, std::nextafter(0.95, DBL_MAX));
+ aHexagon.Operations.push_back(makeSTranslate(glm::vec3(100, 0, 0), false, fRandom, 0.95));
+ }
+ else
+ {
+ fRandom = comphelper::rng::uniform_real_distribution(0.3, std::nextafter(0.8, DBL_MAX));
+ aHexagon.Operations.push_back(makeSTranslate(glm::vec3(100, 0, 0), false, fRandom, 0.9));
+ }
+ aHexagon.Operations.push_back(makeSTranslate(glm::vec3 (0, 0, 20), true, 0.1, 1.0));
aEnteringSlide.push_back(aHexagon);
}
}
- return makeSimpleTransition(aLeavingSlide, aEnteringSlide, aSettings);
+ return makeSimpleTransition(aLeavingSlide, aEnteringSlide);
}
std::shared_ptr<OGLTransitionImpl> makeNewsflash()