Compare commits

..

7 Commits

Author SHA1 Message Date
Syoyo Fujita
98adbb3fb3 Merge pull request #401 from jmousseau/animation-channel-node-optionality
Fix animation channel target node optionality
2023-01-16 05:33:40 +09:00
Jack Mousseau
283b552a4e Fix animation channel target node optionality 2023-01-15 11:45:45 -08:00
Syoyo Fujita
c2ca97b38b v2.8.1 2023-01-13 18:15:21 +09:00
Syoyo Fujita
f051892c55 Merge pull request #399 from e2e4e6/texture_sampler_name_fix
Missed serialization texture sampler name fixed.
2023-01-13 18:13:12 +09:00
s00665032
137a7ca999 Missed serialization texture sampler name fixed.
According to the glTF 2.0 specification it exists, the internal tinygltf structure contains 'name' field as well.
2023-01-13 12:52:08 +07:00
Syoyo Fujita
477d977fea Merge pull request #398 from nicolas-raoul/patch-1
Fixed typo
2023-01-12 16:21:35 +09:00
Nicolas Raoul
8cd5e759d0 Fixed typo 2023-01-12 15:29:32 +09:00
2 changed files with 17 additions and 13 deletions

View File

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

View File

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