Skip to content

Commit

Permalink
Merge pull request #492 from danwillm/inverse-bind-matrix
Browse files Browse the repository at this point in the history
Make inverseBindMatrices optional
  • Loading branch information
syoyo authored Jul 3, 2024
2 parents cf97676 + 4ad8c82 commit cfbec35
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
Binary file added tests/issue-492.glb
Binary file not shown.
18 changes: 18 additions & 0 deletions tests/tester.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1182,3 +1182,21 @@ TEST_CASE("images-as-is", "[issue-487]") {
}
}
}

TEST_CASE("inverse-bind-matrices-optional", "[issue-492]") {
tinygltf::Model model;
tinygltf::TinyGLTF ctx;
std::string err;
std::string warn;

bool ret = ctx.LoadBinaryFromFile(&model, &err, &warn, "issue-492.glb");
if (!warn.empty()) {
std::cout << "WARN:" << warn << std::endl;
}
if (!err.empty()) {
std::cerr << "ERR:" << err << std::endl;
}

REQUIRE(true == ret);
REQUIRE(err.empty());
}
2 changes: 1 addition & 1 deletion tiny_gltf.h
Original file line number Diff line number Diff line change
Expand Up @@ -5660,7 +5660,7 @@ static bool ParseSkin(Skin *skin, std::string *err, const detail::json &o,
skin->skeleton = skeleton;

int invBind = -1;
ParseIntegerProperty(&invBind, err, o, "inverseBindMatrices", true, "Skin");
ParseIntegerProperty(&invBind, err, o, "inverseBindMatrices", false, "Skin");
skin->inverseBindMatrices = invBind;

ParseExtrasAndExtensions(skin, err, o,
Expand Down

0 comments on commit cfbec35

Please sign in to comment.