Kaydet (Commit) 9f839284 authored tarafından Tomaž Vajngerl's avatar Tomaž Vajngerl

slideshow: improve "honeycomb" transition

Change-Id: I8687127cd9ccf6a6ddd87d934f7462a69a047053
üst 57924b61
......@@ -1864,20 +1864,8 @@ std::shared_ptr<OGLTransitionImpl> makeRipple()
return makeRippleTransition(aLeavingSlide, aEnteringSlide, aSettings);
}
std::shared_ptr<OGLTransitionImpl> makeGlitter()
void createHexagon(Primitive& aHexagon, const int x, const int y, const int NX, const int NY)
{
const int NX = 80;
const int NY = NX * 4 / 3;
Primitives_t aLeavingSlide;
Primitives_t aEnteringSlide;
for (int y = 0; y < NY+2; y+=2)
{
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));
......@@ -1896,6 +1884,22 @@ std::shared_ptr<OGLTransitionImpl> makeGlitter()
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;
const int NY = NX * 4 / 3;
Primitives_t aLeavingSlide;
Primitives_t aEnteringSlide;
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);
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.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, 100), false, 0.1, 1.0));
}
else
else if ((centerX - 1 <= x && x <= centerX + 1 && centerY - 1 <= y && y <= centerY + 1 ))
{
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, 0.1, 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));
else
{
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));
}
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()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment