Skip to content

Commit

Permalink
bugfix and remove mergeIndices() (bkaradzic#2772)
Browse files Browse the repository at this point in the history
  • Loading branch information
cloudwu authored Apr 18, 2022
1 parent cae7c83 commit c6d66c2
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions examples/42-bunnylod/bunnylod.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,13 @@ class ExampleBunnyLOD : public entry::AppI
}
}

static void mergeIndices(uint32_t* _indices, uint32_t _num)
static void rearrangeIndices(uint32_t* _indices, uint32_t _num)
{
uint32_t target = 0;
for (uint32_t i = 0; i < _num; i++) {
uint32_t map = _indices[i];
while (_indices[map] != map)
map = _indices[map];
if (i != map) {
_indices[i] = map;
_indices[i] = _indices[map];
} else {
_indices[i] = target;
++target;
Expand Down Expand Up @@ -153,7 +151,7 @@ class ExampleBunnyLOD : public entry::AppI
m_cacheWeld = (uint32_t*)BX_ALLOC(entry::getAllocator(), numVertices * sizeof(uint32_t) );

m_totalVertices = bgfx::weldVertices(m_cacheWeld, _mesh->m_layout, vbData, numVertices, true, 0.00001f);
mergeIndices(m_cacheWeld, numVertices);
rearrangeIndices(m_cacheWeld, numVertices);
}

const bgfx::Memory* vb = mergeVertices(
Expand Down

0 comments on commit c6d66c2

Please sign in to comment.