This commit is contained in:
Branimir Karadžić 2018-04-23 16:23:38 -07:00
parent 1068eff004
commit 80d56ed37c
2 changed files with 54 additions and 22 deletions

View File

@ -244,22 +244,22 @@ public:
}
m_textureCube[0] = bgfx::createTextureCube(
textureside
, false
, 1
, bgfx::TextureFormat::BGRA8
, BGFX_TEXTURE_MIN_POINT|BGFX_TEXTURE_MAG_POINT|BGFX_TEXTURE_MIP_POINT
);
textureside
, false
, 1
, bgfx::TextureFormat::BGRA8
, BGFX_TEXTURE_MIN_POINT|BGFX_TEXTURE_MAG_POINT|BGFX_TEXTURE_MIP_POINT
);
if (m_blitSupported)
{
m_textureCube[1] = bgfx::createTextureCube(
textureside
, false
, 1
, bgfx::TextureFormat::BGRA8
, BGFX_TEXTURE_MIN_POINT|BGFX_TEXTURE_MAG_POINT|BGFX_TEXTURE_MIP_POINT|BGFX_TEXTURE_BLIT_DST
);
textureside
, false
, 1
, bgfx::TextureFormat::BGRA8
, BGFX_TEXTURE_MIN_POINT|BGFX_TEXTURE_MAG_POINT|BGFX_TEXTURE_MIP_POINT|BGFX_TEXTURE_BLIT_DST
);
}
if (m_computeSupported)
@ -274,13 +274,13 @@ public:
}
m_texture2d = bgfx::createTexture2D(
texture2dSize
, texture2dSize
, false
, 1
, bgfx::TextureFormat::BGRA8
, BGFX_TEXTURE_MIN_POINT|BGFX_TEXTURE_MAG_POINT|BGFX_TEXTURE_MIP_POINT
);
texture2dSize
, texture2dSize
, false
, 1
, bgfx::TextureFormat::BGRA8
, BGFX_TEXTURE_MIN_POINT|BGFX_TEXTURE_MAG_POINT|BGFX_TEXTURE_MIP_POINT
);
m_texture2dData = (uint8_t*)malloc(texture2dSize*texture2dSize*4);

View File

@ -977,8 +977,7 @@ struct InterpolatorT
float getValue()
{
if (duration > 0.0)
if (isActive() )
{
const double freq = double(bx::getHPFrequency() );
int64_t now = bx::getHPCounter();
@ -989,6 +988,15 @@ struct InterpolatorT
return to;
}
bool isActive() const
{
const double freq = double(bx::getHPFrequency() );
int64_t now = bx::getHPCounter();
float time = (float)(double(now - offset) / freq);
float lerp = bx::clamp(time, 0.0f, duration) / duration;
return lerp < 1.0f;
}
};
typedef InterpolatorT<bx::lerp, bx::easeInOutQuad> Interpolator;
@ -1266,6 +1274,23 @@ int _main_(int _argc, char** _argv)
InterpolatorAngle angx(0.0f);
InterpolatorAngle angy(0.0f);
auto anyActive = [&]() -> bool
{
return false
|| menuFade.isActive()
|| mip.isActive()
|| layer.isActive()
|| ev.isActive()
|| zoom.isActive()
|| scale.isActive()
|| posx.isActive()
|| posy.isActive()
|| angle.isActive()
|| angx.isActive()
|| angy.isActive()
;
};
const char* filePath = _argc < 2 ? "" : _argv[1];
std::string path = filePath;
@ -1461,7 +1486,7 @@ int _main_(int _argc, char** _argv)
mouseDelta = true;
}
int32_t zoomDelta = overArea ? 0.0f : mouseState.m_mz - mouseStatePrev.m_mz;
int32_t zoomDelta = overArea ? 0 : mouseState.m_mz - mouseStatePrev.m_mz;
if (zoomDelta != 0)
{
char exec[64];
@ -1999,6 +2024,13 @@ int _main_(int _argc, char** _argv)
}
bgfx::frame();
// Slow down when nothing is animating...
if (!dragging
&& !anyActive() )
{
bx::sleep(100);
}
}
}