mirror of
https://github.com/syoyo/tinygltf.git
synced 2026-06-17 12:48:52 +00:00
Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
98adbb3fb3 | ||
|
|
283b552a4e | ||
|
|
c2ca97b38b | ||
|
|
f051892c55 | ||
|
|
137a7ca999 | ||
|
|
477d977fea | ||
|
|
8cd5e759d0 |
@@ -2,13 +2,13 @@
|
||||
|
||||
`TinyGLTF` is a header only C++11 glTF 2.0 https://github.com/KhronosGroup/glTF library.
|
||||
|
||||
`TinyGLTF` uses Niels Lohmann's json library(https://github.com/nlohmann/json), so now it requires C++11 compiler.
|
||||
`TinyGLTF` uses Niels Lohmann's json library (https://github.com/nlohmann/json), so now it requires C++11 compiler.
|
||||
(Also, you can use RadpidJSON as an JSON backend)
|
||||
If you are looking for old, C++03 version, please use `devel-picojson` branch(but not maintained anymore).
|
||||
If you are looking for old, C++03 version, please use `devel-picojson` branch (but not maintained anymore).
|
||||
|
||||
## Status
|
||||
|
||||
Currently TinyGLTF is stable and maintainance mode. No drastic changes and feature additions planned.
|
||||
Currently TinyGLTF is stable and maintenance mode. No drastic changes and feature additions planned.
|
||||
|
||||
- v2.8.0 Add URICallbacks for custom URI handling in Buffer and Image. PR#397
|
||||
- v2.7.0 Change WriteImageDataFunction user callback function signature. PR#393
|
||||
|
||||
24
tiny_gltf.h
24
tiny_gltf.h
@@ -26,6 +26,7 @@
|
||||
// THE SOFTWARE.
|
||||
|
||||
// Version:
|
||||
// - v2.8.1 Missed serialization texture sampler name fixed. PR#399.
|
||||
// - v2.8.0 Add URICallbacks for custom URI handling in Buffer and Image. PR#397.
|
||||
// - v2.7.0 Change WriteImageDataFunction user callback function signature. PR#393.
|
||||
// - v2.6.3 Fix GLB file with empty BIN chunk was not handled. PR#382 and PR#383.
|
||||
@@ -546,9 +547,10 @@ typedef std::map<std::string, Value> ExtensionMap;
|
||||
|
||||
struct AnimationChannel {
|
||||
int sampler; // required
|
||||
int target_node; // required (index of the node to target)
|
||||
std::string target_path; // required in ["translation", "rotation", "scale",
|
||||
// "weights"]
|
||||
int target_node; // optional index of the node to target (alternative
|
||||
// target should be provided by extension)
|
||||
std::string target_path; // required with standard values of ["translation",
|
||||
// "rotation", "scale", "weights"]
|
||||
Value extras;
|
||||
ExtensionMap extensions;
|
||||
ExtensionMap target_extensions;
|
||||
@@ -5102,12 +5104,7 @@ static bool ParseAnimationChannel(
|
||||
if (FindMember(o, "target", targetIt) && IsObject(GetValue(targetIt))) {
|
||||
const json &target_object = GetValue(targetIt);
|
||||
|
||||
if (!ParseIntegerProperty(&targetIndex, err, target_object, "node", true)) {
|
||||
if (err) {
|
||||
(*err) += "`node` field is missing in animation.channels.target\n";
|
||||
}
|
||||
return false;
|
||||
}
|
||||
ParseIntegerProperty(&targetIndex, err, target_object, "node", false);
|
||||
|
||||
if (!ParseStringProperty(&channel->target_path, err, target_object, "path",
|
||||
true)) {
|
||||
@@ -6967,7 +6964,11 @@ static void SerializeGltfAnimationChannel(const AnimationChannel &channel,
|
||||
SerializeNumberProperty("sampler", channel.sampler, o);
|
||||
{
|
||||
json target;
|
||||
SerializeNumberProperty("node", channel.target_node, target);
|
||||
|
||||
if (channel.target_node > 0) {
|
||||
SerializeNumberProperty("node", channel.target_node, target);
|
||||
}
|
||||
|
||||
SerializeStringProperty("path", channel.target_path, target);
|
||||
|
||||
SerializeExtensionMap(channel.target_extensions, target);
|
||||
@@ -7440,6 +7441,9 @@ static void SerializeGltfNode(const Node &node, json &o) {
|
||||
}
|
||||
|
||||
static void SerializeGltfSampler(const Sampler &sampler, json &o) {
|
||||
if (!sampler.name.empty()) {
|
||||
SerializeStringProperty("name", sampler.name, o);
|
||||
}
|
||||
if (sampler.magFilter != -1) {
|
||||
SerializeNumberProperty("magFilter", sampler.magFilter, o);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user