From 1cd0f35cb7d0edce1774961cb93144203a734f34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Branimir=20Karad=C5=BEi=C4=87?= Date: Sat, 4 Nov 2017 00:07:40 -0700 Subject: [PATCH] texturev: Added option to disable transition animation. --- tools/texturev/texturev.cpp | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/tools/texturev/texturev.cpp b/tools/texturev/texturev.cpp index ebed1664c..8e4922405 100644 --- a/tools/texturev/texturev.cpp +++ b/tools/texturev/texturev.cpp @@ -219,6 +219,7 @@ struct View , m_orientation(0.0f) , m_flipH(0.0f) , m_flipV(0.0f) + , m_transitionTime(1.0f) , m_filter(true) , m_fit(true) , m_alpha(false) @@ -494,6 +495,19 @@ struct View m_orientation = 0.0f; } } + else if (0 == bx::strCmp(_argv[1], "transition") ) + { + if (_argc >= 3) + { + float time; + bx::fromString(&time, _argv[3]); + m_transitionTime = bx::fclamp(time, 0.0f, 5.0f); + } + else + { + m_transitionTime = 1.0f; + } + } else if (0 == bx::strCmp(_argv[1], "filter") ) { if (_argc >= 3) @@ -691,6 +705,7 @@ struct View float m_orientation; float m_flipH; float m_flipV; + float m_transitionTime; bool m_filter; bool m_fit; bool m_alpha; @@ -1314,6 +1329,12 @@ int _main_(int _argc, char** _argv) cmdExec("view filter"); } + bool animate = 0.0f < view.m_transitionTime; + if (ImGui::MenuItem("Animate", NULL, &animate) ) + { + cmdExec("view transition %f", animate ? 1.0f : 0.0f); + } + if (ImGui::BeginMenu("Cubemap", view.m_textureInfo.cubeMap) ) { if (ImGui::MenuItem("Quad", NULL, Geometry::Quad == view.m_cubeMapGeo) ) @@ -1637,7 +1658,7 @@ int _main_(int _argc, char** _argv) time += (float)(frameTime*speed/freq); - float transitionTime = dragging ? 0.0f : 0.25f; + float transitionTime = dragging ? 0.0f : 0.25f*view.m_transitionTime; posx.set(view.m_posx, transitionTime); posy.set(view.m_posy, transitionTime); @@ -1710,12 +1731,12 @@ int _main_(int _argc, char** _argv) scale.set(bx::fmin(float(width) / result[0] , float(height) / result[1]) - , 0.1f + , 0.1f*view.m_transitionTime ); } else { - scale.set(1.0f, 0.1f); + scale.set(1.0f, 0.1f*view.m_transitionTime); } zoom.set(view.m_zoom, transitionTime);