Compare commits

..

3 Commits

Author SHA1 Message Date
Syoyo Fujita
cfbec35dc7 Merge pull request #492 from danwillm/inverse-bind-matrix
Make inverseBindMatrices optional
2024-07-04 02:59:35 +09:00
danwillm
4ad8c82c9e Add test for inverse bind matrices being optional 2024-07-01 22:32:17 +01:00
danwillm
2e7ba45a6c Make inverseBindMatrices optional 2024-07-01 18:31:00 +01:00
5 changed files with 19 additions and 3192 deletions

View File

@@ -1,7 +1,6 @@
//
// TODO(syoyo): Print extensions and extras for each glTF object.
//
#include <iostream>
#define TINYGLTF_IMPLEMENTATION
#define STB_IMAGE_IMPLEMENTATION
#define STB_IMAGE_WRITE_IMPLEMENTATION

3186
minijson.h

File diff suppressed because it is too large Load Diff

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

@@ -1721,9 +1721,6 @@ class TinyGLTF {
#endif // __GNUC__
#ifndef TINYGLTF_NO_INCLUDE_JSON
#ifdef TINYGLTF_USE_MINIJSON
#include "minijson.h"
#else // !TINYGLTF_USE_MINIJSON
#ifndef TINYGLTF_USE_RAPIDJSON
#include "json.hpp"
#else
@@ -1735,7 +1732,6 @@ class TinyGLTF {
#include "writer.h"
#endif
#endif
#endif // !TINYGLTF_USE_MINIJSON
#endif
#ifdef TINYGLTF_ENABLE_DRACO
@@ -5664,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,