mirror of
https://github.com/syoyo/tinygltf.git
synced 2026-06-09 19:53:49 +00:00
Compare commits
8 Commits
filesize-c
...
wuffs
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
147a00a601 | ||
|
|
350c296802 | ||
|
|
cc93e1fd25 | ||
|
|
59cc44ad4f | ||
|
|
5c06b7d03b | ||
|
|
a75355b018 | ||
|
|
a977f7a16f | ||
|
|
49caa65177 |
12
README.md
12
README.md
@@ -197,6 +197,18 @@ if (!ret) {
|
||||
* `TINYGLTF_USE_RAPIDJSON` : Use RapidJSON as a JSON parser/serializer. RapidJSON files are not included in TinyGLTF repo. Please set an include path to RapidJSON if you enable this feature.
|
||||
* `TINYGLTF_USE_CPP14` : Use C++14 feature(requires C++14 compiler). This may give better performance than C++11.
|
||||
|
||||
### Wuffs image loader option(faster and secure JPEG/PNG deocoding)
|
||||
|
||||
You can use `wuffs` image loader to load JPEG and PNG in fast and securely.
|
||||
(`stb_image` has some security issues, whereas `wuffs` is well fuzz tested)
|
||||
|
||||
Not that some uncommon JPEG format is unsupported in `wuffs` `std/jpeg` decoder.
|
||||
|
||||
* `TINYGLTF_USE_WUFFS_IMAGE_LOADER` : Use `wuffs` to load images. `stb_image` related stuff will be disabled.
|
||||
* `TINYGLTF_NO_STB_IMAGE` supercedes `wuffs` macros. i.e. when `TINYGLTF_NO_STB_IMAGE` is defined, both `stb_image` and `wuffs` are disabled.
|
||||
* `TINYGLTF_NO_WUFFS_IMPLEMENTATION` : Do not define `WUFFS_IMPLEMENTATION` inside `tiny_gltf.h`. Define this macro if you use `wuffs` in another C/C++ file.
|
||||
|
||||
|
||||
## CMake options
|
||||
|
||||
You can add tinygltf using `add_subdirectory` feature.
|
||||
|
||||
18
tiny_gltf.h
18
tiny_gltf.h
@@ -301,6 +301,9 @@ class Value {
|
||||
}
|
||||
explicit Value(std::string &&s)
|
||||
: type_(STRING_TYPE), string_value_(std::move(s)) {}
|
||||
explicit Value(const char *s) : type_(STRING_TYPE) {
|
||||
string_value_ = s;
|
||||
}
|
||||
explicit Value(const unsigned char *p, size_t n) : type_(BINARY_TYPE) {
|
||||
binary_value_.resize(n);
|
||||
memcpy(binary_value_.data(), p, n);
|
||||
@@ -2422,7 +2425,7 @@ static bool LoadExternalFile(std::vector<unsigned char> *out, std::string *err,
|
||||
|
||||
size_t file_size{0};
|
||||
std::string _err;
|
||||
bool ok = fs-GetFileSizeInBytes(&file_size, &_err, filepath, fs->user_data);
|
||||
bool ok = fs->GetFileSizeInBytes(&file_size, &_err, filepath, fs->user_data);
|
||||
if (!ok) {
|
||||
if (_err.size()) {
|
||||
if (failMsgOut) {
|
||||
@@ -6764,7 +6767,16 @@ void JsonAddMember(detail::json &o, const char *key, detail::json &&value) {
|
||||
if (!o.IsObject()) {
|
||||
o.SetObject();
|
||||
}
|
||||
o.AddMember(detail::json(key, detail::GetAllocator()), std::move(value), detail::GetAllocator());
|
||||
|
||||
// Issue 420.
|
||||
// AddMember may create duplicated key, so use [] API when a key already exists.
|
||||
// https://github.com/Tencent/rapidjson/issues/771#issuecomment-254386863
|
||||
detail::json_const_iterator it;
|
||||
if (detail::FindMember(o, key, it)) {
|
||||
o[key] = std::move(value); // replace
|
||||
} else {
|
||||
o.AddMember(detail::json(key, detail::GetAllocator()), std::move(value), detail::GetAllocator());
|
||||
}
|
||||
#else
|
||||
o[key] = std::move(value);
|
||||
#endif
|
||||
@@ -7155,7 +7167,7 @@ static void SerializeGltfAnimationChannel(const AnimationChannel &channel,
|
||||
{
|
||||
detail::json target;
|
||||
|
||||
if (channel.target_node > 0) {
|
||||
if (channel.target_node >= 0) {
|
||||
SerializeNumberProperty("node", channel.target_node, target);
|
||||
}
|
||||
|
||||
|
||||
55830
wuffs-unsupported-snapshot.c
Normal file
55830
wuffs-unsupported-snapshot.c
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user