Skip to content

Commit

Permalink
Merge pull request #606 from zeux/simpatt-test
Browse files Browse the repository at this point in the history
Stabilize simplifyWithAttributes tests by adjusting pos.z
  • Loading branch information
zeux authored Sep 30, 2023
2 parents 83fea04 + ee8ca88 commit 65c5cb8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
13 changes: 6 additions & 7 deletions demo/tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1151,7 +1151,7 @@ static void simplifyAttr()
{
vb[y * 3 + x][0] = float(x);
vb[y * 3 + x][1] = float(y);
vb[y * 3 + x][2] = 0.f;
vb[y * 3 + x][2] = 0.03f * x;
vb[y * 3 + x][3] = r;
vb[y * 3 + x][4] = g;
vb[y * 3 + x][5] = b;
Expand All @@ -1175,12 +1175,11 @@ static void simplifyAttr()

float attr_weights[3] = {0.01f, 0.01f, 0.01f};

unsigned int expected[3][6] =
{
{0, 2, 9, 9, 2, 11},
{9, 11, 12, 12, 11, 14},
{12, 14, 21, 21, 14, 23},
};
unsigned int expected[3][6] = {
{0, 2, 9, 9, 2, 11},
{9, 11, 12, 12, 11, 14},
{12, 14, 21, 21, 14, 23},
};

assert(meshopt_simplifyWithAttributes(ib[0], ib[0], 7 * 2 * 6, vb[0], 8 * 3, 6 * sizeof(float), vb[0] + 3, 6 * sizeof(float), attr_weights, 3, 6 * 3, 1e-2f) == 18);
assert(memcmp(ib, expected, sizeof(expected)) == 0);
Expand Down
2 changes: 1 addition & 1 deletion js/meshopt_simplifier.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ var tests = {
{
vb_pos[(y * 3 + x) * 3 + 0] = x;
vb_pos[(y * 3 + x) * 3 + 1] = y;
vb_pos[(y * 3 + x) * 3 + 2] = 0;
vb_pos[(y * 3 + x) * 3 + 2] = 0.03 * x;
vb_att[(y * 3 + x) * 3 + 0] = r;
vb_att[(y * 3 + x) * 3 + 1] = g;
vb_att[(y * 3 + x) * 3 + 2] = b;
Expand Down

0 comments on commit 65c5cb8

Please sign in to comment.