mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-25 00:58:30 -05:00
Fixing update time.
This commit is contained in:
parent
9780828b98
commit
3686725fef
3 changed files with 9 additions and 6 deletions
|
@ -572,6 +572,8 @@ int _main_(int /*_argc*/, char** /*_argv*/)
|
||||||
const uint32_t zpitch = DIMS*DIMS;
|
const uint32_t zpitch = DIMS*DIMS;
|
||||||
const float invdim = 1.0f/float(DIMS-1);
|
const float invdim = 1.0f/float(DIMS-1);
|
||||||
|
|
||||||
|
int64_t timeOffset = bx::getHPCounter();
|
||||||
|
|
||||||
while (!processEvents(width, height, debug, reset) )
|
while (!processEvents(width, height, debug, reset) )
|
||||||
{
|
{
|
||||||
// Set view 0 default viewport.
|
// Set view 0 default viewport.
|
||||||
|
@ -587,6 +589,7 @@ int _main_(int /*_argc*/, char** /*_argv*/)
|
||||||
last = now;
|
last = now;
|
||||||
const double freq = double(bx::getHPFrequency() );
|
const double freq = double(bx::getHPFrequency() );
|
||||||
const double toMs = 1000.0/freq;
|
const double toMs = 1000.0/freq;
|
||||||
|
float time = (float)( (now - timeOffset)/double(bx::getHPFrequency() ) );
|
||||||
|
|
||||||
// Use debug font to print information about this example.
|
// Use debug font to print information about this example.
|
||||||
bgfx::dbgTextClear();
|
bgfx::dbgTextClear();
|
||||||
|
@ -604,8 +607,6 @@ int _main_(int /*_argc*/, char** /*_argv*/)
|
||||||
// Set view and projection matrix for view 0.
|
// Set view and projection matrix for view 0.
|
||||||
bgfx::setViewTransform(0, view, proj);
|
bgfx::setViewTransform(0, view, proj);
|
||||||
|
|
||||||
float time = (float)(bx::getHPCounter()/double(bx::getHPFrequency() ) );
|
|
||||||
|
|
||||||
// Stats.
|
// Stats.
|
||||||
uint32_t numVertices = 0;
|
uint32_t numVertices = 0;
|
||||||
int64_t profUpdate = 0;
|
int64_t profUpdate = 0;
|
||||||
|
|
|
@ -172,6 +172,8 @@ int _main_(int /*_argc*/, char** /*_argv*/)
|
||||||
bgfx::destroyVertexShader(vsh);
|
bgfx::destroyVertexShader(vsh);
|
||||||
bgfx::destroyFragmentShader(fsh);
|
bgfx::destroyFragmentShader(fsh);
|
||||||
|
|
||||||
|
int64_t timeOffset = bx::getHPCounter();
|
||||||
|
|
||||||
while (!processEvents(width, height, debug, reset) )
|
while (!processEvents(width, height, debug, reset) )
|
||||||
{
|
{
|
||||||
// Set view 0 default viewport.
|
// Set view 0 default viewport.
|
||||||
|
@ -187,6 +189,7 @@ int _main_(int /*_argc*/, char** /*_argv*/)
|
||||||
last = now;
|
last = now;
|
||||||
const double freq = double(bx::getHPFrequency() );
|
const double freq = double(bx::getHPFrequency() );
|
||||||
const double toMs = 1000.0/freq;
|
const double toMs = 1000.0/freq;
|
||||||
|
float time = (float)( (now - timeOffset)/double(bx::getHPFrequency() ) );
|
||||||
|
|
||||||
// Use debug font to print information about this example.
|
// Use debug font to print information about this example.
|
||||||
bgfx::dbgTextClear();
|
bgfx::dbgTextClear();
|
||||||
|
@ -205,8 +208,6 @@ int _main_(int /*_argc*/, char** /*_argv*/)
|
||||||
// Set view and projection matrix for view 0.
|
// Set view and projection matrix for view 0.
|
||||||
bgfx::setViewTransform(0, view, proj);
|
bgfx::setViewTransform(0, view, proj);
|
||||||
|
|
||||||
float time = (float)(bx::getHPCounter()/double(bx::getHPFrequency() ) );
|
|
||||||
|
|
||||||
const uint16_t instanceStride = 80;
|
const uint16_t instanceStride = 80;
|
||||||
const bgfx::InstanceDataBuffer* idb = bgfx::allocInstanceDataBuffer(121, instanceStride);
|
const bgfx::InstanceDataBuffer* idb = bgfx::allocInstanceDataBuffer(121, instanceStride);
|
||||||
if (NULL != idb)
|
if (NULL != idb)
|
||||||
|
|
|
@ -228,6 +228,8 @@ int _main_(int /*_argc*/, char** /*_argv*/)
|
||||||
uint32_t miss = 0;
|
uint32_t miss = 0;
|
||||||
std::list<PackCube> quads;
|
std::list<PackCube> quads;
|
||||||
|
|
||||||
|
int64_t timeOffset = bx::getHPCounter();
|
||||||
|
|
||||||
while (!processEvents(width, height, debug, reset) )
|
while (!processEvents(width, height, debug, reset) )
|
||||||
{
|
{
|
||||||
// Set view 0 default viewport.
|
// Set view 0 default viewport.
|
||||||
|
@ -243,6 +245,7 @@ int _main_(int /*_argc*/, char** /*_argv*/)
|
||||||
last = now;
|
last = now;
|
||||||
const int64_t freq = bx::getHPFrequency();
|
const int64_t freq = bx::getHPFrequency();
|
||||||
const double toMs = 1000.0/double(freq);
|
const double toMs = 1000.0/double(freq);
|
||||||
|
float time = (float)( (now - timeOffset)/double(bx::getHPFrequency() ) );
|
||||||
|
|
||||||
// Use debug font to print information about this example.
|
// Use debug font to print information about this example.
|
||||||
bgfx::dbgTextClear();
|
bgfx::dbgTextClear();
|
||||||
|
@ -310,8 +313,6 @@ int _main_(int /*_argc*/, char** /*_argv*/)
|
||||||
// Set view and projection matrix for view 0.
|
// Set view and projection matrix for view 0.
|
||||||
bgfx::setViewTransform(0, view, proj);
|
bgfx::setViewTransform(0, view, proj);
|
||||||
|
|
||||||
float time = (float)(bx::getHPCounter()/double(bx::getHPFrequency() ) );
|
|
||||||
|
|
||||||
float mtx[16];
|
float mtx[16];
|
||||||
mtxRotateXY(mtx, time, time*0.37f);
|
mtxRotateXY(mtx, time, time*0.37f);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue