summaryrefslogtreecommitdiffstatshomepage
path: root/3rdparty/bgfx/examples/05-instancing/instancing.cpp
diff options
context:
space:
mode:
author Miodrag Milanovic <mmicko@gmail.com>2015-04-16 14:16:14 +0200
committer Miodrag Milanovic <mmicko@gmail.com>2015-04-16 14:16:14 +0200
commit2b97bfba29e2ff0ed1864f6111a687ac1b61da43 (patch)
tree5913c15c09f03992d7f744d97957f978d2c8723a /3rdparty/bgfx/examples/05-instancing/instancing.cpp
parent08747b36ecb01d5d77e33908372ac132fdd61453 (diff)
update to latest 3rdparty, rollback of genie change (nw)
Diffstat (limited to '3rdparty/bgfx/examples/05-instancing/instancing.cpp')
-rw-r--r--3rdparty/bgfx/examples/05-instancing/instancing.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/3rdparty/bgfx/examples/05-instancing/instancing.cpp b/3rdparty/bgfx/examples/05-instancing/instancing.cpp
index 40b180ea857..bac9b68547f 100644
--- a/3rdparty/bgfx/examples/05-instancing/instancing.cpp
+++ b/3rdparty/bgfx/examples/05-instancing/instancing.cpp
@@ -132,7 +132,7 @@ int _main_(int /*_argc*/, char** /*_argv*/)
{
float at[3] = { 0.0f, 0.0f, 0.0f };
float eye[3] = { 0.0f, 0.0f, -35.0f };
-
+
// Set view and projection matrix for view 0.
const bgfx::HMD* hmd = bgfx::getHMD();
if (NULL != hmd)
@@ -171,9 +171,9 @@ int _main_(int /*_argc*/, char** /*_argv*/)
uint8_t* data = idb->data;
// Write instance data for 11x11 cubes.
- for (uint32_t yy = 0; yy < 11; ++yy)
+ for (uint32_t yy = 0, numInstances = 0; yy < 11 && numInstances < idb->num; ++yy)
{
- for (uint32_t xx = 0; xx < 11; ++xx)
+ for (uint32_t xx = 0; xx < 11 && numInstances < idb->num; ++xx, ++numInstances)
{
float* mtx = (float*)data;
bx::mtxRotateXY(mtx, time + xx*0.21f, time + yy*0.37f);
@@ -209,7 +209,7 @@ int _main_(int /*_argc*/, char** /*_argv*/)
}
}
- // Advance to next frame. Rendering thread will be kicked to
+ // Advance to next frame. Rendering thread will be kicked to
// process submitted rendering primitives.
bgfx::frame();
}