Removed time offset from bx. Let app #dealwithit.

This commit is contained in:
bkaradzic 2013-04-25 23:30:56 -07:00
parent 047eca5829
commit 52079f1d49
2 changed files with 6 additions and 2 deletions

View file

@ -232,6 +232,8 @@ int _main_(int /*_argc*/, char** /*_argv*/)
bgfx::ProgramHandle raymarching = loadProgram("vs_raymarching", "fs_raymarching");
int64_t timeOffset = bx::getHPCounter();
while (!processEvents(width, height, debug, reset) )
{
// Set view 0 default viewport.
@ -274,7 +276,7 @@ int _main_(int /*_argc*/, char** /*_argv*/)
// Set view and projection matrix for view 0.
bgfx::setViewTransform(1, NULL, ortho);
float time = (float)(bx::getHPCounter()/double(bx::getHPFrequency() ) );
float time = (float)( (bx::getHPCounter()-timeOffset)/double(bx::getHPFrequency() ) );
float vp[16];
mtxMul(vp, view, proj);

View file

@ -331,6 +331,8 @@ int _main_(int /*_argc*/, char** /*_argv*/)
Mesh mesh;
mesh.load("meshes/bunny.bin");
int64_t timeOffset = bx::getHPCounter();
while (!processEvents(width, height, debug, reset) )
{
// Set view 0 default viewport.
@ -346,7 +348,7 @@ int _main_(int /*_argc*/, char** /*_argv*/)
last = now;
const double freq = double(bx::getHPFrequency() );
const double toMs = 1000.0/freq;
float time = (float)(bx::getHPCounter()/double(bx::getHPFrequency() ) );
float time = (float)( (bx::getHPCounter()-timeOffset)/double(bx::getHPFrequency() ) );
bgfx::setUniform(u_time, &time);
// Use debug font to print information about this example.