Skip to content

Commit

Permalink
js: Fix test behavior changes following a predicate fix (zeux#563)
Browse files Browse the repository at this point in the history
This mostly required an update to the WASM binary but I also adjusted the test data and replicated the test in C++ for consistency.
  • Loading branch information
zeux authored Jun 2, 2023
1 parent e677ebf commit c6da3de
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 9 deletions.
32 changes: 32 additions & 0 deletions demo/tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -903,6 +903,37 @@ static void emptyMesh()
meshopt_optimizeOverdraw(0, 0, 0, 0, 0, 12, 1.f);
}

static void simplify()
{
// 0
// 1 2
// 3 4 5
unsigned int ib[] = {
0, 2, 1,
1, 2, 3,
3, 2, 4,
2, 5, 4,
};

float vb[] = {
0, 4, 0,
0, 1, 0,
2, 2, 0,
0, 0, 0,
1, 0, 0,
4, 0, 0,
};

unsigned int expected[] = {
0, 5, 3,
};

float error;
assert(meshopt_simplify(ib, ib, 12, vb, 6, 12, 3, 1e-2f, 0, &error) == 3);
assert(error == 0.f);
assert(memcmp(ib, expected, sizeof(expected)) == 0);
}

static void simplifyStuck()
{
// tetrahedron can't be simplified due to collapse error restrictions
Expand Down Expand Up @@ -1191,6 +1222,7 @@ void runTests()

emptyMesh();

simplify();
simplifyStuck();
simplifySloppyStuck();
simplifyPointsStuck();
Expand Down
Loading

0 comments on commit c6da3de

Please sign in to comment.