From 52079f1d49478102f7bcce94c50902b5519c8d22 Mon Sep 17 00:00:00 2001 From: bkaradzic Date: Thu, 25 Apr 2013 23:30:56 -0700 Subject: [PATCH] Removed time offset from bx. Let app #dealwithit. --- examples/03-raymarch/raymarch.cpp | 4 +++- examples/04-mesh/mesh.cpp | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/examples/03-raymarch/raymarch.cpp b/examples/03-raymarch/raymarch.cpp index e1b1c842..927c4e44 100644 --- a/examples/03-raymarch/raymarch.cpp +++ b/examples/03-raymarch/raymarch.cpp @@ -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); diff --git a/examples/04-mesh/mesh.cpp b/examples/04-mesh/mesh.cpp index 37b77bd9..e4b4aa5c 100644 --- a/examples/04-mesh/mesh.cpp +++ b/examples/04-mesh/mesh.cpp @@ -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.