Skip to content

Commit

Permalink
simplify: Use next[e+1] instead of next[next[e]]
Browse files Browse the repository at this point in the history
This makes the code more consistent between simplifier and
indexgenerator (which also uses a 4-element next LUT for one algorithm),
and results in a minor (0.1%) reduction in executed instructions on
some meshes.
  • Loading branch information
zeux committed Jul 15, 2023
1 parent b8366f6 commit 03606ee
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/simplifier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -743,7 +743,7 @@ static void fillEdgeQuadrics(Quadric* vertex_quadrics, const unsigned int* indic
{
for (size_t i = 0; i < index_count; i += 3)
{
static const int next[3] = {1, 2, 0};
static const int next[4] = {1, 2, 0, 1};

for (int e = 0; e < 3; ++e)
{
Expand All @@ -769,7 +769,7 @@ static void fillEdgeQuadrics(Quadric* vertex_quadrics, const unsigned int* indic
if (kHasOpposite[k0][k1] && remap[i1] > remap[i0])
continue;

unsigned int i2 = indices[i + next[next[e]]];
unsigned int i2 = indices[i + next[e + 1]];

// we try hard to maintain border edge geometry; seam edges can move more freely
// due to topological restrictions on collapses, seam quadrics slightly improves collapse structure but aren't critical
Expand Down

0 comments on commit 03606ee

Please sign in to comment.