From 0ee273fdfaf18d6088bdee2b824d7a1c1c233fe6 Mon Sep 17 00:00:00 2001 From: Syoyo Fujita Date: Wed, 24 Jul 2019 19:52:22 +0900 Subject: [PATCH] Update README. Add note on `tinygltf::Value` for extensions. --- README.md | 9 ++++++++- tests/tester.cc | 4 +++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 3d5dc79..bf25870 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,7 @@ If you are looking for old, C++03 version, please use `devel-picojson` branch. ## Status + - v2.3.0 Modified Material representation according to glTF 2.0 schema(and introduced TextureInfo class) - v2.2.0 release(Support loading 16bit PNG. Sparse accessor support) - v2.1.0 release(Draco support) - v2.0.0 release(22 Aug, 2018)! @@ -54,6 +55,12 @@ If you are looking for old, C++03 version, please use `devel-picojson` branch. * Extensions * [x] Draco mesh decoding +## Note on extension property + +In extension(`ExtensionMap`), JSON number value is parsed as int or float(number) and stored as `tinygltf::Value` object. If you want a floating point value from `tinygltf::Value`, use `GetAsFloat()` method. + +`IsNumber()` only returns true if the underlying value is a floating point value. If you wan to check if the value is `number`(int or real, in the context of JSON), Plese use `IsNumberOrInt()` method. + ## Examples * [glview](examples/glview) : Simple glTF geometry viewer. @@ -76,7 +83,7 @@ If you are looking for old, C++03 version, please use `devel-picojson` branch. * [x] Load Draco compressed mesh * [ ] Save Draco compressed mesh * [ ] Open3DGC? -* [ ] Support `extensions` and `extras` property +* [x] Support `extensions` and `extras` property * [ ] HDR image? * [ ] OpenEXR extension through TinyEXR. * [ ] 16bit PNG support in Serialization diff --git a/tests/tester.cc b/tests/tester.cc index 2fcc21d..b2ba048 100644 --- a/tests/tester.cc +++ b/tests/tester.cc @@ -301,7 +301,9 @@ TEST_CASE("pbr-khr-texture-transform", "[material]") { REQUIRE(texform.count("scale")); REQUIRE(texform["scale"].IsArray()); - std::cout << "ty " << int(texform["scale"].Get(0).Type()) << "\n"; + + // It looks json.hpp parse integer JSON number as integer, not floating point. + // so we'll check if Value is number(floating point) or integer value. REQUIRE(texform["scale"].Get(0).IsNumberOrInt()); REQUIRE(texform["scale"].Get(1).IsNumberOrInt());