mirror of
https://git.mirrors.martin98.com/https://github.com/syoyo/tinygltf.git
synced 2025-08-14 17:15:52 +08:00
refactor extension and extra serialization
Add missing serialization: accessor.extensions accessor.sparse.extensions accessor.sparse.extras accessor.sparse.indices.extensions accessor.sparse.indices.extras accessor.sparse.values.extensions accessor.sparse.values.extras animation.channel.target.extras animation.sampler.extensions buffer.extensions bufferView.extensions sampler.extensions camera.orthographic.extensions camera.perspective.extensions skin.extras skin.extensions
This commit is contained in:
parent
d852f50d49
commit
07616e8190
157
tiny_gltf.h
157
tiny_gltf.h
@ -6693,6 +6693,17 @@ static void SerializeExtensionMap(const ExtensionMap &extensions, detail::json &
|
|||||||
detail::JsonAddMember(o, "extensions", std::move(extMap));
|
detail::JsonAddMember(o, "extensions", std::move(extMap));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void SerializeExtras(const Value & extras, detail::json & o) {
|
||||||
|
if (extras.Type() != NULL_TYPE)
|
||||||
|
SerializeValue("extras", extras, o);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename GltfType>
|
||||||
|
void SerializeExtrasAndExtensions(const GltfType & obj, detail::json & o) {
|
||||||
|
SerializeExtensionMap(obj.extensions, o);
|
||||||
|
SerializeExtras(obj.extras, o);
|
||||||
|
}
|
||||||
|
|
||||||
static void SerializeGltfAccessor(const Accessor &accessor, detail::json &o) {
|
static void SerializeGltfAccessor(const Accessor &accessor, detail::json &o) {
|
||||||
if (accessor.bufferView >= 0)
|
if (accessor.bufferView >= 0)
|
||||||
SerializeNumberProperty<int>("bufferView", accessor.bufferView, o);
|
SerializeNumberProperty<int>("bufferView", accessor.bufferView, o);
|
||||||
@ -6759,9 +6770,7 @@ static void SerializeGltfAccessor(const Accessor &accessor, detail::json &o) {
|
|||||||
SerializeStringProperty("type", type, o);
|
SerializeStringProperty("type", type, o);
|
||||||
if (!accessor.name.empty()) SerializeStringProperty("name", accessor.name, o);
|
if (!accessor.name.empty()) SerializeStringProperty("name", accessor.name, o);
|
||||||
|
|
||||||
if (accessor.extras.Type() != NULL_TYPE) {
|
SerializeExtrasAndExtensions(accessor, o);
|
||||||
SerializeValue("extras", accessor.extras, o);
|
|
||||||
}
|
|
||||||
|
|
||||||
// sparse
|
// sparse
|
||||||
if (accessor.sparse.isSparse)
|
if (accessor.sparse.isSparse)
|
||||||
@ -6773,14 +6782,17 @@ static void SerializeGltfAccessor(const Accessor &accessor, detail::json &o) {
|
|||||||
SerializeNumberProperty<int>("bufferView", accessor.sparse.indices.bufferView, indices);
|
SerializeNumberProperty<int>("bufferView", accessor.sparse.indices.bufferView, indices);
|
||||||
SerializeNumberProperty<int>("byteOffset", accessor.sparse.indices.byteOffset, indices);
|
SerializeNumberProperty<int>("byteOffset", accessor.sparse.indices.byteOffset, indices);
|
||||||
SerializeNumberProperty<int>("componentType", accessor.sparse.indices.componentType, indices);
|
SerializeNumberProperty<int>("componentType", accessor.sparse.indices.componentType, indices);
|
||||||
|
SerializeExtrasAndExtensions(accessor.sparse.indices, indices);
|
||||||
detail::JsonAddMember(sparse, "indices", std::move(indices));
|
detail::JsonAddMember(sparse, "indices", std::move(indices));
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
detail::json values;
|
detail::json values;
|
||||||
SerializeNumberProperty<int>("bufferView", accessor.sparse.values.bufferView, values);
|
SerializeNumberProperty<int>("bufferView", accessor.sparse.values.bufferView, values);
|
||||||
SerializeNumberProperty<int>("byteOffset", accessor.sparse.values.byteOffset, values);
|
SerializeNumberProperty<int>("byteOffset", accessor.sparse.values.byteOffset, values);
|
||||||
|
SerializeExtrasAndExtensions(accessor.sparse.values, values);
|
||||||
detail::JsonAddMember(sparse, "values", std::move(values));
|
detail::JsonAddMember(sparse, "values", std::move(values));
|
||||||
}
|
}
|
||||||
|
SerializeExtrasAndExtensions(accessor.sparse, sparse);
|
||||||
detail::JsonAddMember(o, "sparse", std::move(sparse));
|
detail::JsonAddMember(o, "sparse", std::move(sparse));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -6798,15 +6810,12 @@ static void SerializeGltfAnimationChannel(const AnimationChannel &channel,
|
|||||||
SerializeStringProperty("path", channel.target_path, target);
|
SerializeStringProperty("path", channel.target_path, target);
|
||||||
|
|
||||||
SerializeExtensionMap(channel.target_extensions, target);
|
SerializeExtensionMap(channel.target_extensions, target);
|
||||||
|
SerializeExtras(channel.target_extras, target);
|
||||||
|
|
||||||
detail::JsonAddMember(o, "target", std::move(target));
|
detail::JsonAddMember(o, "target", std::move(target));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (channel.extras.Type() != NULL_TYPE) {
|
SerializeExtrasAndExtensions(channel, o);
|
||||||
SerializeValue("extras", channel.extras, o);
|
|
||||||
}
|
|
||||||
|
|
||||||
SerializeExtensionMap(channel.extensions, o);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SerializeGltfAnimationSampler(const AnimationSampler &sampler,
|
static void SerializeGltfAnimationSampler(const AnimationSampler &sampler,
|
||||||
@ -6815,9 +6824,7 @@ static void SerializeGltfAnimationSampler(const AnimationSampler &sampler,
|
|||||||
SerializeNumberProperty("output", sampler.output, o);
|
SerializeNumberProperty("output", sampler.output, o);
|
||||||
SerializeStringProperty("interpolation", sampler.interpolation, o);
|
SerializeStringProperty("interpolation", sampler.interpolation, o);
|
||||||
|
|
||||||
if (sampler.extras.Type() != NULL_TYPE) {
|
SerializeExtrasAndExtensions(sampler, o);
|
||||||
SerializeValue("extras", sampler.extras, o);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SerializeGltfAnimation(const Animation &animation, detail::json &o) {
|
static void SerializeGltfAnimation(const Animation &animation, detail::json &o) {
|
||||||
@ -6849,11 +6856,7 @@ static void SerializeGltfAnimation(const Animation &animation, detail::json &o)
|
|||||||
detail::JsonAddMember(o, "samplers", std::move(samplers));
|
detail::JsonAddMember(o, "samplers", std::move(samplers));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (animation.extras.Type() != NULL_TYPE) {
|
SerializeExtrasAndExtensions(animation, o);
|
||||||
SerializeValue("extras", animation.extras, o);
|
|
||||||
}
|
|
||||||
|
|
||||||
SerializeExtensionMap(animation.extensions, o);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SerializeGltfAsset(const Asset &asset, detail::json &o) {
|
static void SerializeGltfAsset(const Asset &asset, detail::json &o) {
|
||||||
@ -6875,11 +6878,7 @@ static void SerializeGltfAsset(const Asset &asset, detail::json &o) {
|
|||||||
// TODO(syoyo): Do we need to check if `version` is greater or equal to 2.0?
|
// TODO(syoyo): Do we need to check if `version` is greater or equal to 2.0?
|
||||||
SerializeStringProperty("version", version, o);
|
SerializeStringProperty("version", version, o);
|
||||||
|
|
||||||
if (asset.extras.Keys().size()) {
|
SerializeExtrasAndExtensions(asset, o);
|
||||||
SerializeValue("extras", asset.extras, o);
|
|
||||||
}
|
|
||||||
|
|
||||||
SerializeExtensionMap(asset.extensions, o);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SerializeGltfBufferBin(const Buffer &buffer, detail::json &o,
|
static void SerializeGltfBufferBin(const Buffer &buffer, detail::json &o,
|
||||||
@ -6889,9 +6888,7 @@ static void SerializeGltfBufferBin(const Buffer &buffer, detail::json &o,
|
|||||||
|
|
||||||
if (buffer.name.size()) SerializeStringProperty("name", buffer.name, o);
|
if (buffer.name.size()) SerializeStringProperty("name", buffer.name, o);
|
||||||
|
|
||||||
if (buffer.extras.Type() != NULL_TYPE) {
|
SerializeExtrasAndExtensions(buffer, o);
|
||||||
SerializeValue("extras", buffer.extras, o);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SerializeGltfBuffer(const Buffer &buffer, detail::json &o) {
|
static void SerializeGltfBuffer(const Buffer &buffer, detail::json &o) {
|
||||||
@ -6900,9 +6897,7 @@ static void SerializeGltfBuffer(const Buffer &buffer, detail::json &o) {
|
|||||||
|
|
||||||
if (buffer.name.size()) SerializeStringProperty("name", buffer.name, o);
|
if (buffer.name.size()) SerializeStringProperty("name", buffer.name, o);
|
||||||
|
|
||||||
if (buffer.extras.Type() != NULL_TYPE) {
|
SerializeExtrasAndExtensions(buffer, o);
|
||||||
SerializeValue("extras", buffer.extras, o);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool SerializeGltfBuffer(const Buffer &buffer, detail::json &o,
|
static bool SerializeGltfBuffer(const Buffer &buffer, detail::json &o,
|
||||||
@ -6914,9 +6909,7 @@ static bool SerializeGltfBuffer(const Buffer &buffer, detail::json &o,
|
|||||||
|
|
||||||
if (buffer.name.size()) SerializeStringProperty("name", buffer.name, o);
|
if (buffer.name.size()) SerializeStringProperty("name", buffer.name, o);
|
||||||
|
|
||||||
if (buffer.extras.Type() != NULL_TYPE) {
|
SerializeExtrasAndExtensions(buffer, o);
|
||||||
SerializeValue("extras", buffer.extras, o);
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -6941,9 +6934,7 @@ static void SerializeGltfBufferView(const BufferView &bufferView, detail::json &
|
|||||||
SerializeStringProperty("name", bufferView.name, o);
|
SerializeStringProperty("name", bufferView.name, o);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bufferView.extras.Type() != NULL_TYPE) {
|
SerializeExtrasAndExtensions(bufferView, o);
|
||||||
SerializeValue("extras", bufferView.extras, o);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SerializeGltfImage(const Image &image, const std::string &uri,
|
static void SerializeGltfImage(const Image &image, const std::string &uri,
|
||||||
@ -6961,11 +6952,7 @@ static void SerializeGltfImage(const Image &image, const std::string &uri,
|
|||||||
SerializeStringProperty("name", image.name, o);
|
SerializeStringProperty("name", image.name, o);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (image.extras.Type() != NULL_TYPE) {
|
SerializeExtrasAndExtensions(image, o);
|
||||||
SerializeValue("extras", image.extras, o);
|
|
||||||
}
|
|
||||||
|
|
||||||
SerializeExtensionMap(image.extensions, o);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SerializeGltfTextureInfo(const TextureInfo &texinfo, detail::json &o) {
|
static void SerializeGltfTextureInfo(const TextureInfo &texinfo, detail::json &o) {
|
||||||
@ -6975,11 +6962,7 @@ static void SerializeGltfTextureInfo(const TextureInfo &texinfo, detail::json &o
|
|||||||
SerializeNumberProperty("texCoord", texinfo.texCoord, o);
|
SerializeNumberProperty("texCoord", texinfo.texCoord, o);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (texinfo.extras.Type() != NULL_TYPE) {
|
SerializeExtrasAndExtensions(texinfo, o);
|
||||||
SerializeValue("extras", texinfo.extras, o);
|
|
||||||
}
|
|
||||||
|
|
||||||
SerializeExtensionMap(texinfo.extensions, o);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SerializeGltfNormalTextureInfo(const NormalTextureInfo &texinfo,
|
static void SerializeGltfNormalTextureInfo(const NormalTextureInfo &texinfo,
|
||||||
@ -6994,11 +6977,7 @@ static void SerializeGltfNormalTextureInfo(const NormalTextureInfo &texinfo,
|
|||||||
SerializeNumberProperty("scale", texinfo.scale, o);
|
SerializeNumberProperty("scale", texinfo.scale, o);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (texinfo.extras.Type() != NULL_TYPE) {
|
SerializeExtrasAndExtensions(texinfo, o);
|
||||||
SerializeValue("extras", texinfo.extras, o);
|
|
||||||
}
|
|
||||||
|
|
||||||
SerializeExtensionMap(texinfo.extensions, o);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SerializeGltfOcclusionTextureInfo(
|
static void SerializeGltfOcclusionTextureInfo(
|
||||||
@ -7013,11 +6992,7 @@ static void SerializeGltfOcclusionTextureInfo(
|
|||||||
SerializeNumberProperty("strength", texinfo.strength, o);
|
SerializeNumberProperty("strength", texinfo.strength, o);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (texinfo.extras.Type() != NULL_TYPE) {
|
SerializeExtrasAndExtensions(texinfo, o);
|
||||||
SerializeValue("extras", texinfo.extras, o);
|
|
||||||
}
|
|
||||||
|
|
||||||
SerializeExtensionMap(texinfo.extensions, o);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SerializeGltfPbrMetallicRoughness(const PbrMetallicRoughness &pbr,
|
static void SerializeGltfPbrMetallicRoughness(const PbrMetallicRoughness &pbr,
|
||||||
@ -7048,11 +7023,7 @@ static void SerializeGltfPbrMetallicRoughness(const PbrMetallicRoughness &pbr,
|
|||||||
detail::JsonAddMember(o, "metallicRoughnessTexture", std::move(texinfo));
|
detail::JsonAddMember(o, "metallicRoughnessTexture", std::move(texinfo));
|
||||||
}
|
}
|
||||||
|
|
||||||
SerializeExtensionMap(pbr.extensions, o);
|
SerializeExtrasAndExtensions(pbr, o);
|
||||||
|
|
||||||
if (pbr.extras.Type() != NULL_TYPE) {
|
|
||||||
SerializeValue("extras", pbr.extras, o);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SerializeGltfMaterial(const Material &material, detail::json &o) {
|
static void SerializeGltfMaterial(const Material &material, detail::json &o) {
|
||||||
@ -7124,11 +7095,7 @@ static void SerializeGltfMaterial(const Material &material, detail::json &o) {
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
SerializeExtensionMap(material.extensions, o);
|
SerializeExtrasAndExtensions(material, o);
|
||||||
|
|
||||||
if (material.extras.Type() != NULL_TYPE) {
|
|
||||||
SerializeValue("extras", material.extras, o);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SerializeGltfMesh(const Mesh &mesh, detail::json &o) {
|
static void SerializeGltfMesh(const Mesh &mesh, detail::json &o) {
|
||||||
@ -7175,11 +7142,7 @@ static void SerializeGltfMesh(const Mesh &mesh, detail::json &o) {
|
|||||||
detail::JsonAddMember(primitive, "targets", std::move(targets));
|
detail::JsonAddMember(primitive, "targets", std::move(targets));
|
||||||
}
|
}
|
||||||
|
|
||||||
SerializeExtensionMap(gltfPrimitive.extensions, primitive);
|
SerializeExtrasAndExtensions(gltfPrimitive, o);
|
||||||
|
|
||||||
if (gltfPrimitive.extras.Type() != NULL_TYPE) {
|
|
||||||
SerializeValue("extras", gltfPrimitive.extras, primitive);
|
|
||||||
}
|
|
||||||
|
|
||||||
detail::JsonPushBack(primitives, std::move(primitive));
|
detail::JsonPushBack(primitives, std::move(primitive));
|
||||||
}
|
}
|
||||||
@ -7194,19 +7157,13 @@ static void SerializeGltfMesh(const Mesh &mesh, detail::json &o) {
|
|||||||
SerializeStringProperty("name", mesh.name, o);
|
SerializeStringProperty("name", mesh.name, o);
|
||||||
}
|
}
|
||||||
|
|
||||||
SerializeExtensionMap(mesh.extensions, o);
|
SerializeExtrasAndExtensions(mesh, o);
|
||||||
if (mesh.extras.Type() != NULL_TYPE) {
|
|
||||||
SerializeValue("extras", mesh.extras, o);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SerializeSpotLight(const SpotLight &spot, detail::json &o) {
|
static void SerializeSpotLight(const SpotLight &spot, detail::json &o) {
|
||||||
SerializeNumberProperty("innerConeAngle", spot.innerConeAngle, o);
|
SerializeNumberProperty("innerConeAngle", spot.innerConeAngle, o);
|
||||||
SerializeNumberProperty("outerConeAngle", spot.outerConeAngle, o);
|
SerializeNumberProperty("outerConeAngle", spot.outerConeAngle, o);
|
||||||
SerializeExtensionMap(spot.extensions, o);
|
SerializeExtrasAndExtensions(spot, o);
|
||||||
if (spot.extras.Type() != NULL_TYPE) {
|
|
||||||
SerializeValue("extras", spot.extras, o);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SerializeGltfLight(const Light &light, detail::json &o) {
|
static void SerializeGltfLight(const Light &light, detail::json &o) {
|
||||||
@ -7222,10 +7179,7 @@ static void SerializeGltfLight(const Light &light, detail::json &o) {
|
|||||||
SerializeSpotLight(light.spot, spot);
|
SerializeSpotLight(light.spot, spot);
|
||||||
detail::JsonAddMember(o, "spot", std::move(spot));
|
detail::JsonAddMember(o, "spot", std::move(spot));
|
||||||
}
|
}
|
||||||
SerializeExtensionMap(light.extensions, o);
|
SerializeExtrasAndExtensions(light, o);
|
||||||
if (light.extras.Type() != NULL_TYPE) {
|
|
||||||
SerializeValue("extras", light.extras, o);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SerializeGltfNode(const Node &node, detail::json &o) {
|
static void SerializeGltfNode(const Node &node, detail::json &o) {
|
||||||
@ -7257,11 +7211,8 @@ static void SerializeGltfNode(const Node &node, detail::json &o) {
|
|||||||
SerializeNumberArrayProperty<double>("weights", node.weights, o);
|
SerializeNumberArrayProperty<double>("weights", node.weights, o);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (node.extras.Type() != NULL_TYPE) {
|
SerializeExtrasAndExtensions(node, o);
|
||||||
SerializeValue("extras", node.extras, o);
|
|
||||||
}
|
|
||||||
|
|
||||||
SerializeExtensionMap(node.extensions, o);
|
|
||||||
if (!node.name.empty()) SerializeStringProperty("name", node.name, o);
|
if (!node.name.empty()) SerializeStringProperty("name", node.name, o);
|
||||||
SerializeNumberArrayProperty<int>("children", node.children, o);
|
SerializeNumberArrayProperty<int>("children", node.children, o);
|
||||||
}
|
}
|
||||||
@ -7280,9 +7231,7 @@ static void SerializeGltfSampler(const Sampler &sampler, detail::json &o) {
|
|||||||
SerializeNumberProperty("wrapS", sampler.wrapS, o);
|
SerializeNumberProperty("wrapS", sampler.wrapS, o);
|
||||||
SerializeNumberProperty("wrapT", sampler.wrapT, o);
|
SerializeNumberProperty("wrapT", sampler.wrapT, o);
|
||||||
|
|
||||||
if (sampler.extras.Type() != NULL_TYPE) {
|
SerializeExtrasAndExtensions(sampler, o);
|
||||||
SerializeValue("extras", sampler.extras, o);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SerializeGltfOrthographicCamera(const OrthographicCamera &camera,
|
static void SerializeGltfOrthographicCamera(const OrthographicCamera &camera,
|
||||||
@ -7292,9 +7241,7 @@ static void SerializeGltfOrthographicCamera(const OrthographicCamera &camera,
|
|||||||
SerializeNumberProperty("xmag", camera.xmag, o);
|
SerializeNumberProperty("xmag", camera.xmag, o);
|
||||||
SerializeNumberProperty("ymag", camera.ymag, o);
|
SerializeNumberProperty("ymag", camera.ymag, o);
|
||||||
|
|
||||||
if (camera.extras.Type() != NULL_TYPE) {
|
SerializeExtrasAndExtensions(camera, o);
|
||||||
SerializeValue("extras", camera.extras, o);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SerializeGltfPerspectiveCamera(const PerspectiveCamera &camera,
|
static void SerializeGltfPerspectiveCamera(const PerspectiveCamera &camera,
|
||||||
@ -7309,9 +7256,7 @@ static void SerializeGltfPerspectiveCamera(const PerspectiveCamera &camera,
|
|||||||
SerializeNumberProperty("yfov", camera.yfov, o);
|
SerializeNumberProperty("yfov", camera.yfov, o);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (camera.extras.Type() != NULL_TYPE) {
|
SerializeExtrasAndExtensions(camera, o);
|
||||||
SerializeValue("extras", camera.extras, o);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SerializeGltfCamera(const Camera &camera, detail::json &o) {
|
static void SerializeGltfCamera(const Camera &camera, detail::json &o) {
|
||||||
@ -7332,10 +7277,7 @@ static void SerializeGltfCamera(const Camera &camera, detail::json &o) {
|
|||||||
// ???
|
// ???
|
||||||
}
|
}
|
||||||
|
|
||||||
if (camera.extras.Type() != NULL_TYPE) {
|
SerializeExtrasAndExtensions(camera, o);
|
||||||
SerializeValue("extras", camera.extras, o);
|
|
||||||
}
|
|
||||||
SerializeExtensionMap(camera.extensions, o);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SerializeGltfScene(const Scene &scene, detail::json &o) {
|
static void SerializeGltfScene(const Scene &scene, detail::json &o) {
|
||||||
@ -7344,10 +7286,7 @@ static void SerializeGltfScene(const Scene &scene, detail::json &o) {
|
|||||||
if (scene.name.size()) {
|
if (scene.name.size()) {
|
||||||
SerializeStringProperty("name", scene.name, o);
|
SerializeStringProperty("name", scene.name, o);
|
||||||
}
|
}
|
||||||
if (scene.extras.Type() != NULL_TYPE) {
|
SerializeExtrasAndExtensions(scene, o);
|
||||||
SerializeValue("extras", scene.extras, o);
|
|
||||||
}
|
|
||||||
SerializeExtensionMap(scene.extensions, o);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SerializeGltfSkin(const Skin &skin, detail::json &o) {
|
static void SerializeGltfSkin(const Skin &skin, detail::json &o) {
|
||||||
@ -7365,6 +7304,8 @@ static void SerializeGltfSkin(const Skin &skin, detail::json &o) {
|
|||||||
if (skin.name.size()) {
|
if (skin.name.size()) {
|
||||||
SerializeStringProperty("name", skin.name, o);
|
SerializeStringProperty("name", skin.name, o);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SerializeExtrasAndExtensions(skin, o);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SerializeGltfTexture(const Texture &texture, detail::json &o) {
|
static void SerializeGltfTexture(const Texture &texture, detail::json &o) {
|
||||||
@ -7377,10 +7318,7 @@ static void SerializeGltfTexture(const Texture &texture, detail::json &o) {
|
|||||||
if (texture.name.size()) {
|
if (texture.name.size()) {
|
||||||
SerializeStringProperty("name", texture.name, o);
|
SerializeStringProperty("name", texture.name, o);
|
||||||
}
|
}
|
||||||
if (texture.extras.Type() != NULL_TYPE) {
|
SerializeExtrasAndExtensions(texture, o);
|
||||||
SerializeValue("extras", texture.extras, o);
|
|
||||||
}
|
|
||||||
SerializeExtensionMap(texture.extensions, o);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
@ -7548,8 +7486,8 @@ static void SerializeGltfModel(const Model *model, detail::json &o) {
|
|||||||
detail::JsonAddMember(o, "cameras", std::move(cameras));
|
detail::JsonAddMember(o, "cameras", std::move(cameras));
|
||||||
}
|
}
|
||||||
|
|
||||||
// EXTENSIONS
|
// EXTRAS & EXTENSIONS
|
||||||
SerializeExtensionMap(model->extensions, o);
|
SerializeExtrasAndExtensions(*model, o);
|
||||||
|
|
||||||
auto extensionsUsed = model->extensionsUsed;
|
auto extensionsUsed = model->extensionsUsed;
|
||||||
|
|
||||||
@ -7595,11 +7533,6 @@ static void SerializeGltfModel(const Model *model, detail::json &o) {
|
|||||||
if (extensionsUsed.size()) {
|
if (extensionsUsed.size()) {
|
||||||
SerializeStringArrayProperty("extensionsUsed", extensionsUsed, o);
|
SerializeStringArrayProperty("extensionsUsed", extensionsUsed, o);
|
||||||
}
|
}
|
||||||
|
|
||||||
// EXTRAS
|
|
||||||
if (model->extras.Type() != NULL_TYPE) {
|
|
||||||
SerializeValue("extras", model->extras, o);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool WriteGltfStream(std::ostream &stream, const std::string &content) {
|
static bool WriteGltfStream(std::ostream &stream, const std::string &content) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user