Merge pull request #492 from danwillm/inverse-bind-matrix

Make inverseBindMatrices optional
This commit is contained in:
Syoyo Fujita 2024-07-04 02:59:35 +09:00 committed by GitHub
commit cfbec35dc7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 19 additions and 1 deletions

BIN
tests/issue-492.glb Normal file

Binary file not shown.

View File

@ -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());
}

View File

@ -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,