Coverage Report

Created: 2026-10-28 07:46

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/assimp/code/AssetLib/glTF/glTFAssetWriter.inl
Line
Count
Source
1
/*
2
Open Asset Import Library (assimp)
3
----------------------------------------------------------------------
4
5
Copyright (c) 2006-2026, assimp team
6
7
All rights reserved.
8
9
Redistribution and use of this software in source and binary forms,
10
with or without modification, are permitted provided that the
11
following conditions are met:
12
13
* Redistributions of source code must retain the above
14
copyright notice, this list of conditions and the
15
following disclaimer.
16
17
* Redistributions in binary form must reproduce the above
18
copyright notice, this list of conditions and the
19
following disclaimer in the documentation and/or other
20
materials provided with the distribution.
21
22
* Neither the name of the assimp team, nor the names of its
23
contributors may be used to endorse or promote products
24
derived from this software without specific prior
25
written permission of the assimp team.
26
27
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
28
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
29
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
30
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
31
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
32
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
33
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
34
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
35
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
36
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
37
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38
39
----------------------------------------------------------------------
40
*/
41
42
#include <assimp/Base64.hpp>
43
44
#include <rapidjson/stringbuffer.h>
45
#include <rapidjson/writer.h>
46
#include <rapidjson/prettywriter.h>
47
48
#if _MSC_VER
49
#    pragma warning(push)
50
#    pragma warning( disable : 4706)
51
#endif // _MSC_VER
52
53
namespace glTF {
54
55
    using rapidjson::StringBuffer;
56
    using rapidjson::PrettyWriter;
57
    using rapidjson::Writer;
58
    using rapidjson::StringRef;
59
    using rapidjson::StringRef;
60
61
    namespace {
62
63
        template<typename T, size_t N>
64
        inline
65
21.4k
        Value& MakeValue(Value& val, T(&r)[N], MemoryPoolAllocator<>& al) {
66
21.4k
            val.SetArray();
67
21.4k
            val.Reserve(N, al);
68
184k
            for (decltype(N) i = 0; i < N; ++i) {
69
163k
                val.PushBack(r[i], al);
70
163k
            }
71
21.4k
            return val;
72
21.4k
        }
Unexecuted instantiation: glTFImporter.cpp:rapidjson::GenericValue<rapidjson::UTF8<char>, rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator> >& glTF::(anonymous namespace)::MakeValue<float, 4ul>(rapidjson::GenericValue<rapidjson::UTF8<char>, rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator> >&, float (&) [4ul], rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator>&)
Unexecuted instantiation: glTFImporter.cpp:rapidjson::GenericValue<rapidjson::UTF8<char>, rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator> >& glTF::(anonymous namespace)::MakeValue<float, 16ul>(rapidjson::GenericValue<rapidjson::UTF8<char>, rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator> >&, float (&) [16ul], rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator>&)
Unexecuted instantiation: glTFImporter.cpp:rapidjson::GenericValue<rapidjson::UTF8<char>, rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator> >& glTF::(anonymous namespace)::MakeValue<float, 3ul>(rapidjson::GenericValue<rapidjson::UTF8<char>, rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator> >&, float (&) [3ul], rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator>&)
glTFExporter.cpp:rapidjson::GenericValue<rapidjson::UTF8<char>, rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator> >& glTF::(anonymous namespace)::MakeValue<float, 4ul>(rapidjson::GenericValue<rapidjson::UTF8<char>, rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator> >&, float (&) [4ul], rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator>&)
Line
Count
Source
65
14.9k
        Value& MakeValue(Value& val, T(&r)[N], MemoryPoolAllocator<>& al) {
66
14.9k
            val.SetArray();
67
14.9k
            val.Reserve(N, al);
68
74.8k
            for (decltype(N) i = 0; i < N; ++i) {
69
59.8k
                val.PushBack(r[i], al);
70
59.8k
            }
71
14.9k
            return val;
72
14.9k
        }
glTFExporter.cpp:rapidjson::GenericValue<rapidjson::UTF8<char>, rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator> >& glTF::(anonymous namespace)::MakeValue<float, 16ul>(rapidjson::GenericValue<rapidjson::UTF8<char>, rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator> >&, float (&) [16ul], rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator>&)
Line
Count
Source
65
6.46k
        Value& MakeValue(Value& val, T(&r)[N], MemoryPoolAllocator<>& al) {
66
6.46k
            val.SetArray();
67
6.46k
            val.Reserve(N, al);
68
109k
            for (decltype(N) i = 0; i < N; ++i) {
69
103k
                val.PushBack(r[i], al);
70
103k
            }
71
6.46k
            return val;
72
6.46k
        }
Unexecuted instantiation: glTFExporter.cpp:rapidjson::GenericValue<rapidjson::UTF8<char>, rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator> >& glTF::(anonymous namespace)::MakeValue<float, 3ul>(rapidjson::GenericValue<rapidjson::UTF8<char>, rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator> >&, float (&) [3ul], rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator>&)
73
74
        template<typename T>
75
        inline
76
183k
        Value& MakeValue(Value& val, const std::vector<T> & r, MemoryPoolAllocator<>& al) {
77
183k
            val.SetArray();
78
183k
            val.Reserve(static_cast<rapidjson::SizeType>(r.size()), al);
79
728k
            for (unsigned int i = 0; i < r.size(); ++i) {
80
545k
                val.PushBack(r[i], al);
81
545k
            }
82
183k
            return val;
83
183k
        }
Unexecuted instantiation: glTFImporter.cpp:rapidjson::GenericValue<rapidjson::UTF8<char>, rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator> >& glTF::(anonymous namespace)::MakeValue<double>(rapidjson::GenericValue<rapidjson::UTF8<char>, rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator> >&, std::__1::vector<double, std::__1::allocator<double> > const&, rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator>&)
glTFExporter.cpp:rapidjson::GenericValue<rapidjson::UTF8<char>, rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator> >& glTF::(anonymous namespace)::MakeValue<double>(rapidjson::GenericValue<rapidjson::UTF8<char>, rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator> >&, std::__1::vector<double, std::__1::allocator<double> > const&, rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator>&)
Line
Count
Source
76
183k
        Value& MakeValue(Value& val, const std::vector<T> & r, MemoryPoolAllocator<>& al) {
77
183k
            val.SetArray();
78
183k
            val.Reserve(static_cast<rapidjson::SizeType>(r.size()), al);
79
728k
            for (unsigned int i = 0; i < r.size(); ++i) {
80
545k
                val.PushBack(r[i], al);
81
545k
            }
82
183k
            return val;
83
183k
        }
84
85
        template<typename C, typename T>
86
82.8k
        inline Value& MakeValueCast(Value& val, const std::vector<T> & r, MemoryPoolAllocator<>& al) {
87
82.8k
            val.SetArray();
88
82.8k
            val.Reserve(static_cast<rapidjson::SizeType>(r.size()), al);
89
165k
            for (unsigned int i = 0; i < r.size(); ++i) {
90
82.8k
                val.PushBack(static_cast<C>(r[i]), al);
91
82.8k
            }
92
82.8k
            return val;
93
82.8k
        }
Unexecuted instantiation: glTFImporter.cpp:rapidjson::GenericValue<rapidjson::UTF8<char>, rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator> >& glTF::(anonymous namespace)::MakeValueCast<long, double>(rapidjson::GenericValue<rapidjson::UTF8<char>, rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator> >&, std::__1::vector<double, std::__1::allocator<double> > const&, rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator>&)
glTFExporter.cpp:rapidjson::GenericValue<rapidjson::UTF8<char>, rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator> >& glTF::(anonymous namespace)::MakeValueCast<long, double>(rapidjson::GenericValue<rapidjson::UTF8<char>, rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator> >&, std::__1::vector<double, std::__1::allocator<double> > const&, rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator>&)
Line
Count
Source
86
82.8k
        inline Value& MakeValueCast(Value& val, const std::vector<T> & r, MemoryPoolAllocator<>& al) {
87
82.8k
            val.SetArray();
88
82.8k
            val.Reserve(static_cast<rapidjson::SizeType>(r.size()), al);
89
165k
            for (unsigned int i = 0; i < r.size(); ++i) {
90
82.8k
                val.PushBack(static_cast<C>(r[i]), al);
91
82.8k
            }
92
82.8k
            return val;
93
82.8k
        }
94
95
        template<class T>
96
599k
        inline void AddRefsVector(Value& obj, const char* fieldId, std::vector< Ref<T> >& v, MemoryPoolAllocator<>& al) {
97
599k
            if (v.empty()) return;
98
42.0k
            Value lst;
99
42.0k
            lst.SetArray();
100
42.0k
            lst.Reserve(unsigned(v.size()), al);
101
282k
            for (size_t i = 0; i < v.size(); ++i) {
102
240k
                lst.PushBack(StringRef(v[i]->id), al);
103
240k
            }
104
42.0k
            obj.AddMember(StringRef(fieldId), lst, al);
105
42.0k
        }
Unexecuted instantiation: glTFImporter.cpp:void glTF::(anonymous namespace)::AddRefsVector<glTF::Node>(rapidjson::GenericValue<rapidjson::UTF8<char>, rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator> >&, char const*, std::__1::vector<glTFCommon::Ref<glTF::Node>, std::__1::allocator<glTFCommon::Ref<glTF::Node> > >&, rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator>&)
Unexecuted instantiation: glTFImporter.cpp:void glTF::(anonymous namespace)::AddRefsVector<glTF::Mesh>(rapidjson::GenericValue<rapidjson::UTF8<char>, rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator> >&, char const*, std::__1::vector<glTFCommon::Ref<glTF::Mesh>, std::__1::allocator<glTFCommon::Ref<glTF::Mesh> > >&, rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator>&)
glTFExporter.cpp:void glTF::(anonymous namespace)::AddRefsVector<glTF::Node>(rapidjson::GenericValue<rapidjson::UTF8<char>, rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator> >&, char const*, std::__1::vector<glTFCommon::Ref<glTF::Node>, std::__1::allocator<glTFCommon::Ref<glTF::Node> > >&, rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator>&)
Line
Count
Source
96
400k
        inline void AddRefsVector(Value& obj, const char* fieldId, std::vector< Ref<T> >& v, MemoryPoolAllocator<>& al) {
97
400k
            if (v.empty()) return;
98
18.5k
            Value lst;
99
18.5k
            lst.SetArray();
100
18.5k
            lst.Reserve(unsigned(v.size()), al);
101
217k
            for (size_t i = 0; i < v.size(); ++i) {
102
198k
                lst.PushBack(StringRef(v[i]->id), al);
103
198k
            }
104
18.5k
            obj.AddMember(StringRef(fieldId), lst, al);
105
18.5k
        }
glTFExporter.cpp:void glTF::(anonymous namespace)::AddRefsVector<glTF::Mesh>(rapidjson::GenericValue<rapidjson::UTF8<char>, rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator> >&, char const*, std::__1::vector<glTFCommon::Ref<glTF::Mesh>, std::__1::allocator<glTFCommon::Ref<glTF::Mesh> > >&, rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator>&)
Line
Count
Source
96
198k
        inline void AddRefsVector(Value& obj, const char* fieldId, std::vector< Ref<T> >& v, MemoryPoolAllocator<>& al) {
97
198k
            if (v.empty()) return;
98
23.5k
            Value lst;
99
23.5k
            lst.SetArray();
100
23.5k
            lst.Reserve(unsigned(v.size()), al);
101
64.9k
            for (size_t i = 0; i < v.size(); ++i) {
102
41.4k
                lst.PushBack(StringRef(v[i]->id), al);
103
41.4k
            }
104
23.5k
            obj.AddMember(StringRef(fieldId), lst, al);
105
23.5k
        }
106
107
108
    }
109
110
    inline void Write(Value& obj, Accessor& a, AssetWriter& w)
111
132k
    {
112
132k
        obj.AddMember("bufferView", Value(a.bufferView->id, w.mAl).Move(), w.mAl);
113
132k
        obj.AddMember("byteOffset", a.byteOffset, w.mAl);
114
132k
        obj.AddMember("byteStride", a.byteStride, w.mAl);
115
132k
        obj.AddMember("componentType", int(a.componentType), w.mAl);
116
132k
        obj.AddMember("count", a.count, w.mAl);
117
132k
        obj.AddMember("type", StringRef(AttribType::ToString(a.type)), w.mAl);
118
119
132k
        Value vTmpMax, vTmpMin;
120
132k
    if (a.componentType == ComponentType_FLOAT) {
121
91.5k
      obj.AddMember("max", MakeValue(vTmpMax, a.max, w.mAl), w.mAl);
122
91.5k
      obj.AddMember("min", MakeValue(vTmpMin, a.min, w.mAl), w.mAl);
123
91.5k
    } else {
124
41.4k
      obj.AddMember("max", MakeValueCast<int64_t>(vTmpMax, a.max, w.mAl), w.mAl);
125
41.4k
      obj.AddMember("min", MakeValueCast<int64_t>(vTmpMin, a.min, w.mAl), w.mAl);
126
41.4k
    }
127
132k
    }
128
129
    inline void Write(Value& obj, Animation& a, AssetWriter& w)
130
1.67k
    {
131
        /****************** Channels *******************/
132
1.67k
        Value channels;
133
1.67k
        channels.SetArray();
134
1.67k
        channels.Reserve(unsigned(a.Channels.size()), w.mAl);
135
136
6.68k
        for (size_t i = 0; i < unsigned(a.Channels.size()); ++i) {
137
5.01k
            Animation::AnimChannel& c = a.Channels[i];
138
5.01k
            Value valChannel;
139
5.01k
            valChannel.SetObject();
140
5.01k
            {
141
5.01k
                valChannel.AddMember("sampler", c.sampler, w.mAl);
142
143
5.01k
                Value valTarget;
144
5.01k
                valTarget.SetObject();
145
5.01k
                {
146
5.01k
                    valTarget.AddMember("id", StringRef(c.target.id->id), w.mAl);
147
5.01k
                    valTarget.AddMember("path", c.target.path, w.mAl);
148
5.01k
                }
149
5.01k
                valChannel.AddMember("target", valTarget, w.mAl);
150
5.01k
            }
151
5.01k
            channels.PushBack(valChannel, w.mAl);
152
5.01k
        }
153
1.67k
        obj.AddMember("channels", channels, w.mAl);
154
155
        /****************** Parameters *******************/
156
1.67k
        Value valParameters;
157
1.67k
        valParameters.SetObject();
158
1.67k
        {
159
1.67k
            if (a.Parameters.TIME) {
160
1.67k
                valParameters.AddMember("TIME", StringRef(a.Parameters.TIME->id), w.mAl);
161
1.67k
            }
162
1.67k
            if (a.Parameters.rotation) {
163
1.67k
                valParameters.AddMember("rotation", StringRef(a.Parameters.rotation->id), w.mAl);
164
1.67k
            }
165
1.67k
            if (a.Parameters.scale) {
166
1.67k
                valParameters.AddMember("scale", StringRef(a.Parameters.scale->id), w.mAl);
167
1.67k
            }
168
1.67k
            if (a.Parameters.translation) {
169
1.67k
                valParameters.AddMember("translation", StringRef(a.Parameters.translation->id), w.mAl);
170
1.67k
            }
171
1.67k
        }
172
1.67k
        obj.AddMember("parameters", valParameters, w.mAl);
173
174
        /****************** Samplers *******************/
175
1.67k
        Value valSamplers;
176
1.67k
        valSamplers.SetObject();
177
178
6.68k
        for (size_t i = 0; i < unsigned(a.Samplers.size()); ++i) {
179
5.01k
            Animation::AnimSampler& s = a.Samplers[i];
180
5.01k
            Value valSampler;
181
5.01k
            valSampler.SetObject();
182
5.01k
            {
183
5.01k
                valSampler.AddMember("input", s.input, w.mAl);
184
5.01k
                valSampler.AddMember("interpolation", s.interpolation, w.mAl);
185
5.01k
                valSampler.AddMember("output", s.output, w.mAl);
186
5.01k
            }
187
5.01k
            valSamplers.AddMember(StringRef(s.id), valSampler, w.mAl);
188
5.01k
        }
189
1.67k
        obj.AddMember("samplers", valSamplers, w.mAl);
190
1.67k
    }
191
192
    inline void Write(Value& obj, Buffer& b, AssetWriter& w)
193
1.81k
    {
194
1.81k
        const char* type;
195
1.81k
        switch (b.type) {
196
0
            case Buffer::Type_text:
197
0
                type = "text"; break;
198
1.81k
            default:
199
1.81k
                type = "arraybuffer";
200
1.81k
        }
201
202
1.81k
        obj.AddMember("byteLength", static_cast<uint64_t>(b.byteLength), w.mAl);
203
1.81k
        obj.AddMember("type", StringRef(type), w.mAl);
204
1.81k
        obj.AddMember("uri", Value(b.GetURI(), w.mAl).Move(), w.mAl);
205
1.81k
    }
206
207
    inline void Write(Value& obj, BufferView& bv, AssetWriter& w)
208
133k
    {
209
133k
        obj.AddMember("buffer", Value(bv.buffer->id, w.mAl).Move(), w.mAl);
210
133k
        obj.AddMember("byteOffset", static_cast<uint64_t>(bv.byteOffset), w.mAl);
211
133k
        obj.AddMember("byteLength", static_cast<uint64_t>(bv.byteLength), w.mAl);
212
133k
        if (bv.target != BufferViewTarget_NONE) {
213
123k
            obj.AddMember("target", int(bv.target), w.mAl);
214
123k
        }
215
133k
    }
216
217
    inline void Write(Value& /*obj*/, Camera& /*c*/, AssetWriter& /*w*/)
218
0
    {
219
220
0
    }
221
222
    inline void Write(Value& obj, Image& img, AssetWriter& w)
223
1.05k
    {
224
1.05k
        std::string uri;
225
1.05k
        if (w.mAsset.extensionsUsed.KHR_binary_glTF && img.bufferView) {
226
52
            Value exts, ext;
227
52
            exts.SetObject();
228
52
            ext.SetObject();
229
230
52
            ext.AddMember("bufferView", StringRef(img.bufferView->id), w.mAl);
231
232
52
            if (!img.mimeType.empty())
233
47
                ext.AddMember("mimeType", StringRef(img.mimeType), w.mAl);
234
235
52
            exts.AddMember("KHR_binary_glTF", ext, w.mAl);
236
52
            obj.AddMember("extensions", exts, w.mAl);
237
52
            return;
238
52
        }
239
998
        else if (img.HasData()) {
240
52
            uri = "data:" + (img.mimeType.empty() ? "application/octet-stream" : img.mimeType);
241
52
            uri += ";base64,";
242
52
            Base64::Encode(img.GetData(), img.GetDataLength(), uri);
243
52
        }
244
946
        else {
245
946
            uri = img.uri;
246
946
        }
247
248
998
        obj.AddMember("uri", Value(uri, w.mAl).Move(), w.mAl);
249
998
    }
250
251
    namespace {
252
        inline void WriteColorOrTex(Value& obj, TexProperty& prop, const char* propName, MemoryPoolAllocator<>& al)
253
16.0k
        {
254
16.0k
            if (prop.texture)
255
1.10k
                obj.AddMember(StringRef(propName), Value(prop.texture->id, al).Move(), al);
256
14.9k
            else {
257
14.9k
                Value col;
258
14.9k
                obj.AddMember(StringRef(propName), MakeValue(col, prop.color, al), al);
259
14.9k
            }
260
16.0k
        }
Unexecuted instantiation: glTFImporter.cpp:glTF::(anonymous namespace)::WriteColorOrTex(rapidjson::GenericValue<rapidjson::UTF8<char>, rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator> >&, glTF::TexProperty&, char const*, rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator>&)
glTFExporter.cpp:glTF::(anonymous namespace)::WriteColorOrTex(rapidjson::GenericValue<rapidjson::UTF8<char>, rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator> >&, glTF::TexProperty&, char const*, rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator>&)
Line
Count
Source
253
16.0k
        {
254
16.0k
            if (prop.texture)
255
1.10k
                obj.AddMember(StringRef(propName), Value(prop.texture->id, al).Move(), al);
256
14.9k
            else {
257
14.9k
                Value col;
258
14.9k
                obj.AddMember(StringRef(propName), MakeValue(col, prop.color, al), al);
259
14.9k
            }
260
16.0k
        }
261
    }
262
263
    inline void Write(Value& obj, Material& m, AssetWriter& w)
264
4.01k
    {
265
4.01k
        Value v;
266
4.01k
        v.SetObject();
267
4.01k
        {
268
4.01k
            WriteColorOrTex(v, m.ambient, "ambient", w.mAl);
269
4.01k
            WriteColorOrTex(v, m.diffuse, "diffuse", w.mAl);
270
4.01k
            WriteColorOrTex(v, m.specular, "specular", w.mAl);
271
4.01k
            WriteColorOrTex(v, m.emission, "emission", w.mAl);
272
273
4.01k
            if (m.transparent)
274
356
                v.AddMember("transparency", m.transparency, w.mAl);
275
276
4.01k
            v.AddMember("shininess", m.shininess, w.mAl);
277
4.01k
        }
278
4.01k
        obj.AddMember("values", v, w.mAl);
279
4.01k
    }
280
281
    namespace {
282
        inline void WriteAttrs(AssetWriter& w, Value& attrs, Mesh::AccessorList& lst,
283
            const char* semantic, bool forceNumber = false)
284
289k
        {
285
289k
            if (lst.empty()) return;
286
84.5k
            if (lst.size() == 1 && !forceNumber) {
287
77.5k
                attrs.AddMember(StringRef(semantic), Value(lst[0]->id, w.mAl).Move(), w.mAl);
288
77.5k
            }
289
6.97k
            else {
290
13.9k
                for (size_t i = 0; i < lst.size(); ++i) {
291
7.00k
                    char buffer[32];
292
7.00k
                    ai_snprintf(buffer, 32, "%s_%d", semantic, int(i));
293
7.00k
                    attrs.AddMember(Value(buffer, w.mAl).Move(), Value(lst[i]->id, w.mAl).Move(), w.mAl);
294
7.00k
                }
295
6.97k
            }
296
84.5k
        }
Unexecuted instantiation: glTFImporter.cpp:glTF::(anonymous namespace)::WriteAttrs(glTF::AssetWriter&, rapidjson::GenericValue<rapidjson::UTF8<char>, rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator> >&, std::__1::vector<glTFCommon::Ref<glTF::Accessor>, std::__1::allocator<glTFCommon::Ref<glTF::Accessor> > >&, char const*, bool)
glTFExporter.cpp:glTF::(anonymous namespace)::WriteAttrs(glTF::AssetWriter&, rapidjson::GenericValue<rapidjson::UTF8<char>, rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator> >&, std::__1::vector<glTFCommon::Ref<glTF::Accessor>, std::__1::allocator<glTFCommon::Ref<glTF::Accessor> > >&, char const*, bool)
Line
Count
Source
284
289k
        {
285
289k
            if (lst.empty()) return;
286
84.5k
            if (lst.size() == 1 && !forceNumber) {
287
77.5k
                attrs.AddMember(StringRef(semantic), Value(lst[0]->id, w.mAl).Move(), w.mAl);
288
77.5k
            }
289
6.97k
            else {
290
13.9k
                for (size_t i = 0; i < lst.size(); ++i) {
291
7.00k
                    char buffer[32];
292
                    ai_snprintf(buffer, 32, "%s_%d", semantic, int(i));
293
7.00k
                    attrs.AddMember(Value(buffer, w.mAl).Move(), Value(lst[i]->id, w.mAl).Move(), w.mAl);
294
7.00k
                }
295
6.97k
            }
296
84.5k
        }
297
    }
298
299
    inline void Write(Value& obj, Mesh& m, AssetWriter& w)
300
41.4k
    {
301
    /********************* Name **********************/
302
41.4k
    obj.AddMember("name", m.name, w.mAl);
303
304
    /**************** Mesh extensions ****************/
305
41.4k
    if(m.Extension.size() > 0)
306
0
    {
307
0
      Value json_extensions;
308
309
0
      json_extensions.SetObject();
310
0
#ifdef ASSIMP_IMPORTER_GLTF_USE_OPEN3DGC
311
0
      for(Mesh::SExtension* ptr_ext : m.Extension)
312
0
      {
313
0
        switch(ptr_ext->Type)
314
0
        {
315
0
          case Mesh::SExtension::EType::Compression_Open3DGC:
316
0
            {
317
0
              Value json_comp_data;
318
0
              Mesh::SCompression_Open3DGC* ptr_ext_comp = (Mesh::SCompression_Open3DGC*)ptr_ext;
319
320
              // filling object "compressedData"
321
0
              json_comp_data.SetObject();
322
0
              json_comp_data.AddMember("buffer", ptr_ext_comp->Buffer, w.mAl);
323
0
              json_comp_data.AddMember("byteOffset", static_cast<uint64_t>(ptr_ext_comp->Offset), w.mAl);
324
0
              json_comp_data.AddMember("componentType", 5121, w.mAl);
325
0
              json_comp_data.AddMember("type", "SCALAR", w.mAl);
326
0
              json_comp_data.AddMember("count", static_cast<uint64_t>(ptr_ext_comp->Count), w.mAl);
327
0
              if(ptr_ext_comp->Binary)
328
0
                json_comp_data.AddMember("mode", "binary", w.mAl);
329
0
              else
330
0
                json_comp_data.AddMember("mode", "ascii", w.mAl);
331
332
0
              json_comp_data.AddMember("indicesCount", static_cast<uint64_t>(ptr_ext_comp->IndicesCount), w.mAl);
333
0
              json_comp_data.AddMember("verticesCount", static_cast<uint64_t>(ptr_ext_comp->VerticesCount), w.mAl);
334
              // filling object "Open3DGC-compression"
335
0
              Value json_o3dgc;
336
337
0
              json_o3dgc.SetObject();
338
0
              json_o3dgc.AddMember("compressedData", json_comp_data, w.mAl);
339
              // add member to object "extensions"
340
0
              json_extensions.AddMember("Open3DGC-compression", json_o3dgc, w.mAl);
341
0
            }
342
343
0
            break;
344
0
          default:
345
0
            throw DeadlyImportError("GLTF: Can not write mesh: unknown mesh extension, only Open3DGC is supported.");
346
0
        }// switch(ptr_ext->Type)
347
0
      }// for(Mesh::SExtension* ptr_ext : m.Extension)
348
0
#endif
349
350
      // Add extensions to mesh
351
0
      obj.AddMember("extensions", json_extensions, w.mAl);
352
0
    }// if(m.Extension.size() > 0)
353
354
    /****************** Primitives *******************/
355
41.4k
        Value primitives;
356
41.4k
        primitives.SetArray();
357
41.4k
        primitives.Reserve(unsigned(m.primitives.size()), w.mAl);
358
359
82.8k
        for (size_t i = 0; i < m.primitives.size(); ++i) {
360
41.4k
            Mesh::Primitive& p = m.primitives[i];
361
41.4k
            Value prim;
362
41.4k
            prim.SetObject();
363
41.4k
            {
364
41.4k
                prim.AddMember("mode", Value(int(p.mode)).Move(), w.mAl);
365
366
41.4k
                if (p.material)
367
41.4k
                    prim.AddMember("material", p.material->id, w.mAl);
368
369
41.4k
                if (p.indices)
370
41.4k
                    prim.AddMember("indices", Value(p.indices->id, w.mAl).Move(), w.mAl);
371
372
41.4k
                Value attrs;
373
41.4k
                attrs.SetObject();
374
41.4k
                {
375
41.4k
                    WriteAttrs(w, attrs, p.attributes.position, "POSITION");
376
41.4k
                    WriteAttrs(w, attrs, p.attributes.normal, "NORMAL");
377
41.4k
                    WriteAttrs(w, attrs, p.attributes.texcoord, "TEXCOORD", true);
378
41.4k
                    WriteAttrs(w, attrs, p.attributes.color, "COLOR");
379
41.4k
                    WriteAttrs(w, attrs, p.attributes.joint, "JOINT");
380
41.4k
                    WriteAttrs(w, attrs, p.attributes.jointmatrix, "JOINTMATRIX");
381
41.4k
                    WriteAttrs(w, attrs, p.attributes.weight, "WEIGHT");
382
41.4k
                }
383
41.4k
                prim.AddMember("attributes", attrs, w.mAl);
384
41.4k
            }
385
41.4k
            primitives.PushBack(prim, w.mAl);
386
41.4k
        }
387
388
41.4k
        obj.AddMember("primitives", primitives, w.mAl);
389
41.4k
    }
390
391
    inline void Write(Value& obj, Node& n, AssetWriter& w)
392
198k
    {
393
394
198k
        if (n.matrix.isPresent) {
395
6.13k
            Value val;
396
6.13k
            obj.AddMember("matrix", MakeValue(val, n.matrix.value, w.mAl).Move(), w.mAl);
397
6.13k
        }
398
399
198k
        if (n.translation.isPresent) {
400
0
            Value val;
401
0
            obj.AddMember("translation", MakeValue(val, n.translation.value, w.mAl).Move(), w.mAl);
402
0
        }
403
404
198k
        if (n.scale.isPresent) {
405
0
            Value val;
406
0
            obj.AddMember("scale", MakeValue(val, n.scale.value, w.mAl).Move(), w.mAl);
407
0
        }
408
198k
        if (n.rotation.isPresent) {
409
0
            Value val;
410
0
            obj.AddMember("rotation", MakeValue(val, n.rotation.value, w.mAl).Move(), w.mAl);
411
0
        }
412
413
198k
        AddRefsVector(obj, "children", n.children, w.mAl);
414
415
198k
        AddRefsVector(obj, "meshes", n.meshes, w.mAl);
416
417
198k
        AddRefsVector(obj, "skeletons", n.skeletons, w.mAl);
418
419
198k
        if (n.skin) {
420
338
            obj.AddMember("skin", Value(n.skin->id, w.mAl).Move(), w.mAl);
421
338
        }
422
423
198k
        if (!n.jointName.empty()) {
424
1.25k
          obj.AddMember("jointName", n.jointName, w.mAl);
425
1.25k
        }
426
198k
    }
427
428
    inline void Write(Value& /*obj*/, Program& /*b*/, AssetWriter& /*w*/)
429
0
    {
430
0
431
0
    }
432
433
    inline void Write(Value& obj, Sampler& b, AssetWriter& w)
434
1.05k
    {
435
1.05k
        if (b.wrapS) {
436
1.05k
            obj.AddMember("wrapS", b.wrapS, w.mAl);
437
1.05k
        }
438
1.05k
        if (b.wrapT) {
439
1.05k
            obj.AddMember("wrapT", b.wrapT, w.mAl);
440
1.05k
        }
441
1.05k
        if (b.magFilter) {
442
1.05k
            obj.AddMember("magFilter", b.magFilter, w.mAl);
443
1.05k
        }
444
1.05k
        if (b.minFilter) {
445
1.05k
            obj.AddMember("minFilter", b.minFilter, w.mAl);
446
1.05k
        }
447
1.05k
    }
448
449
    inline void Write(Value& scene, Scene& s, AssetWriter& w)
450
3.63k
    {
451
3.63k
        AddRefsVector(scene, "nodes", s.nodes, w.mAl);
452
3.63k
    }
453
454
    inline void Write(Value& /*obj*/, Shader& /*b*/, AssetWriter& /*w*/)
455
0
    {
456
0
457
0
    }
458
459
    inline void Write(Value& obj, Skin& b, AssetWriter& w)
460
338
    {
461
        /****************** jointNames *******************/
462
338
        Value vJointNames;
463
338
        vJointNames.SetArray();
464
338
        vJointNames.Reserve(unsigned(b.jointNames.size()), w.mAl);
465
466
1.59k
        for (size_t i = 0; i < unsigned(b.jointNames.size()); ++i) {
467
1.25k
            vJointNames.PushBack(StringRef(b.jointNames[i]->jointName), w.mAl);
468
1.25k
        }
469
338
        obj.AddMember("jointNames", vJointNames, w.mAl);
470
471
338
        if (b.bindShapeMatrix.isPresent) {
472
338
            Value val;
473
338
            obj.AddMember("bindShapeMatrix", MakeValue(val, b.bindShapeMatrix.value, w.mAl).Move(), w.mAl);
474
338
        }
475
476
338
        if (b.inverseBindMatrices) {
477
338
            obj.AddMember("inverseBindMatrices", Value(b.inverseBindMatrices->id, w.mAl).Move(), w.mAl);
478
338
        }
479
480
338
    }
481
482
    inline void Write(Value& /*obj*/, Technique& /*b*/, AssetWriter& /*w*/)
483
0
    {
484
0
485
0
    }
486
487
    inline void Write(Value& obj, Texture& tex, AssetWriter& w)
488
1.05k
    {
489
1.05k
        if (tex.source) {
490
1.05k
            obj.AddMember("source", Value(tex.source->id, w.mAl).Move(), w.mAl);
491
1.05k
        }
492
1.05k
        if (tex.sampler) {
493
1.05k
            obj.AddMember("sampler", Value(tex.sampler->id, w.mAl).Move(), w.mAl);
494
1.05k
        }
495
1.05k
    }
496
497
    inline void Write(Value& /*obj*/, Light& /*b*/, AssetWriter& /*w*/)
498
0
    {
499
500
0
    }
501
502
503
    inline AssetWriter::AssetWriter(Asset& a)
504
3.63k
        : mDoc()
505
3.63k
        , mAsset(a)
506
3.63k
        , mAl(mDoc.GetAllocator())
507
3.63k
    {
508
3.63k
        mDoc.SetObject();
509
510
3.63k
        WriteMetadata();
511
3.63k
        WriteExtensionsUsed();
512
513
        // Dump the contents of the dictionaries
514
54.5k
        for (size_t i = 0; i < a.mDicts.size(); ++i) {
515
50.9k
            a.mDicts[i]->WriteObjects(*this);
516
50.9k
        }
517
518
        // Add the target scene field
519
3.63k
        if (mAsset.scene) {
520
3.63k
            mDoc.AddMember("scene", StringRef(mAsset.scene->id), mAl);
521
3.63k
        }
522
3.63k
    }
523
524
    inline void AssetWriter::WriteFile(const char* path)
525
0
    {
526
0
        std::unique_ptr<IOStream> jsonOutFile(mAsset.OpenFile(path, "wt", true));
527
0
528
0
        if (jsonOutFile == nullptr) {
529
0
            throw DeadlyExportError("Could not open output file: " + std::string(path));
530
0
        }
531
0
532
0
        StringBuffer docBuffer;
533
0
534
0
        PrettyWriter<StringBuffer> writer(docBuffer);
535
0
        if (!mDoc.Accept(writer)) {
536
0
            throw DeadlyExportError("Failed to write scene data!");
537
0
        }
538
0
539
0
        if (jsonOutFile->Write(docBuffer.GetString(), docBuffer.GetSize(), 1) != 1) {
540
0
            throw DeadlyExportError("Failed to write scene data!");
541
0
        }
542
0
543
0
        // Write buffer data to separate .bin files
544
0
        for (unsigned int i = 0; i < mAsset.buffers.Size(); ++i) {
545
0
            Ref<Buffer> b = mAsset.buffers.Get(i);
546
0
547
0
            std::string binPath = b->GetURI();
548
0
549
0
            std::unique_ptr<IOStream> binOutFile(mAsset.OpenFile(binPath, "wb", true));
550
0
551
0
            if (binOutFile == nullptr) {
552
0
                throw DeadlyExportError("Could not open output file: " + binPath);
553
0
            }
554
0
555
0
            if (b->byteLength > 0) {
556
0
                if (binOutFile->Write(b->GetPointer(), b->byteLength, 1) != 1) {
557
0
                    throw DeadlyExportError("Failed to write binary file: " + binPath);
558
0
                }
559
0
            }
560
0
        }
561
0
    }
562
563
    inline void AssetWriter::WriteGLBFile(const char* path)
564
0
    {
565
0
        std::unique_ptr<IOStream> outfile(mAsset.OpenFile(path, "wb", true));
566
0
567
0
        if (outfile == nullptr) {
568
0
            throw DeadlyExportError("Could not open output file: " + std::string(path));
569
0
        }
570
0
571
0
        // we will write the header later, skip its size
572
0
        outfile->Seek(sizeof(GLB_Header), aiOrigin_SET);
573
0
574
0
        StringBuffer docBuffer;
575
0
        Writer<StringBuffer> writer(docBuffer);
576
0
        if (!mDoc.Accept(writer)) {
577
0
            throw DeadlyExportError("Failed to write scene data!");
578
0
        }
579
0
580
0
        if (outfile->Write(docBuffer.GetString(), docBuffer.GetSize(), 1) != 1) {
581
0
            throw DeadlyExportError("Failed to write scene data!");
582
0
        }
583
0
584
0
        WriteBinaryData(outfile.get(), docBuffer.GetSize());
585
0
    }
586
587
    inline void AssetWriter::WriteBinaryData(IOStream* outfile, size_t sceneLength)
588
1.80k
    {
589
        //
590
        // write the body data
591
        //
592
593
1.80k
        size_t bodyLength = 0;
594
1.80k
        if (Ref<Buffer> b = mAsset.GetBodyBuffer()) {
595
1.80k
            bodyLength = b->byteLength;
596
597
1.80k
            if (bodyLength > 0) {
598
1.51k
                size_t bodyOffset = sizeof(GLB_Header) + sceneLength;
599
1.51k
                bodyOffset = (bodyOffset + 3) & ~3; // Round up to next multiple of 4
600
601
1.51k
                outfile->Seek(bodyOffset, aiOrigin_SET);
602
603
1.51k
                if (outfile->Write(b->GetPointer(), b->byteLength, 1) != 1) {
604
0
                    throw DeadlyExportError("Failed to write body data!");
605
0
                }
606
1.51k
            }
607
1.80k
        }
608
609
        //
610
        // write the header
611
        //
612
613
1.80k
        GLB_Header header;
614
1.80k
        memcpy(header.magic, AI_GLB_MAGIC_NUMBER, sizeof(header.magic));
615
616
1.80k
        header.version = 1;
617
1.80k
        AI_SWAP4(header.version);
618
619
1.80k
        header.length = uint32_t(sizeof(header) + sceneLength + bodyLength);
620
1.80k
        AI_SWAP4(header.length);
621
622
1.80k
        header.sceneLength = uint32_t(sceneLength);
623
1.80k
        AI_SWAP4(header.sceneLength);
624
625
1.80k
        header.sceneFormat = SceneFormat_JSON;
626
1.80k
        AI_SWAP4(header.sceneFormat);
627
628
1.80k
        outfile->Seek(0, aiOrigin_SET);
629
630
1.80k
        if (outfile->Write(&header, 1, sizeof(header)) != sizeof(header)) {
631
0
            throw DeadlyExportError("Failed to write the header!");
632
0
        }
633
1.80k
    }
Unexecuted instantiation: glTF::AssetWriter::WriteBinaryData(Assimp::IOStream*, unsigned long)
glTF::AssetWriter::WriteBinaryData(Assimp::IOStream*, unsigned long)
Line
Count
Source
588
1.80k
    {
589
        //
590
        // write the body data
591
        //
592
593
1.80k
        size_t bodyLength = 0;
594
1.80k
        if (Ref<Buffer> b = mAsset.GetBodyBuffer()) {
595
1.80k
            bodyLength = b->byteLength;
596
597
1.80k
            if (bodyLength > 0) {
598
1.51k
                size_t bodyOffset = sizeof(GLB_Header) + sceneLength;
599
1.51k
                bodyOffset = (bodyOffset + 3) & ~3; // Round up to next multiple of 4
600
601
1.51k
                outfile->Seek(bodyOffset, aiOrigin_SET);
602
603
1.51k
                if (outfile->Write(b->GetPointer(), b->byteLength, 1) != 1) {
604
0
                    throw DeadlyExportError("Failed to write body data!");
605
0
                }
606
1.51k
            }
607
1.80k
        }
608
609
        //
610
        // write the header
611
        //
612
613
1.80k
        GLB_Header header;
614
1.80k
        memcpy(header.magic, AI_GLB_MAGIC_NUMBER, sizeof(header.magic));
615
616
1.80k
        header.version = 1;
617
1.80k
        AI_SWAP4(header.version);
618
619
1.80k
        header.length = uint32_t(sizeof(header) + sceneLength + bodyLength);
620
1.80k
        AI_SWAP4(header.length);
621
622
1.80k
        header.sceneLength = uint32_t(sceneLength);
623
1.80k
        AI_SWAP4(header.sceneLength);
624
625
1.80k
        header.sceneFormat = SceneFormat_JSON;
626
1.80k
        AI_SWAP4(header.sceneFormat);
627
628
1.80k
        outfile->Seek(0, aiOrigin_SET);
629
630
1.80k
        if (outfile->Write(&header, 1, sizeof(header)) != sizeof(header)) {
631
0
            throw DeadlyExportError("Failed to write the header!");
632
0
        }
633
1.80k
    }
634
635
636
    inline void AssetWriter::WriteMetadata()
637
3.63k
    {
638
3.63k
        Value asset;
639
3.63k
        asset.SetObject();
640
3.63k
        asset.AddMember("version", Value(mAsset.asset.version, mAl).Move(), mAl);
641
3.63k
        asset.AddMember("generator", Value(mAsset.asset.generator, mAl).Move(), mAl);
642
3.63k
        if (!mAsset.asset.copyright.empty())
643
70
            asset.AddMember("copyright", Value(mAsset.asset.copyright, mAl).Move(), mAl);
644
645
3.63k
        mDoc.AddMember("asset", asset, mAl);
646
3.63k
    }
647
648
    inline void AssetWriter::WriteExtensionsUsed()
649
3.63k
    {
650
3.63k
        Value exts;
651
3.63k
        exts.SetArray();
652
3.63k
        {
653
3.63k
            if (false)
654
0
                exts.PushBack(StringRef("KHR_binary_glTF"), mAl);
655
656
3.63k
            if (false)
657
0
                exts.PushBack(StringRef("KHR_materials_common"), mAl);
658
3.63k
        }
659
660
3.63k
        if (!exts.Empty())
661
0
            mDoc.AddMember("extensionsUsed", exts, mAl);
662
3.63k
    }
663
664
    template<class T>
665
    void AssetWriter::WriteObjects(LazyDict<T>& d)
666
50.9k
    {
667
50.9k
        if (d.mObjs.empty()) return;
668
669
25.9k
        Value* container = &mDoc;
670
671
25.9k
        if (d.mExtId) {
672
0
            Value* exts = FindObject(mDoc, "extensions");
673
0
            if (!exts) {
674
0
                mDoc.AddMember("extensions", Value().SetObject().Move(), mDoc.GetAllocator());
675
0
                exts = FindObject(mDoc, "extensions");
676
0
            }
677
678
0
            if (!(container = FindObject(*exts, d.mExtId))) {
679
0
                exts->AddMember(StringRef(d.mExtId), Value().SetObject().Move(), mDoc.GetAllocator());
680
0
                container = FindObject(*exts, d.mExtId);
681
0
            }
682
0
        }
683
684
25.9k
        Value* dict;
685
25.9k
        if (!(dict = FindObject(*container, d.mDictId))) {
686
25.9k
            container->AddMember(StringRef(d.mDictId), Value().SetObject().Move(), mDoc.GetAllocator());
687
25.9k
            dict = FindObject(*container, d.mDictId);
688
25.9k
        }
689
690
548k
        for (size_t i = 0; i < d.mObjs.size(); ++i) {
691
522k
            if (d.mObjs[i]->IsSpecial()) continue;
692
693
520k
            Value obj;
694
520k
            obj.SetObject();
695
696
520k
            if (!d.mObjs[i]->name.empty()) {
697
354
                obj.AddMember("name", StringRef(d.mObjs[i]->name.c_str()), mAl);
698
354
            }
699
700
520k
            Write(obj, *d.mObjs[i], *this);
701
702
520k
            dict->AddMember(StringRef(d.mObjs[i]->id), obj, mAl);
703
520k
        }
704
25.9k
    }
void glTF::AssetWriter::WriteObjects<glTF::Accessor>(glTF::LazyDict<glTF::Accessor>&)
Line
Count
Source
666
3.63k
    {
667
3.63k
        if (d.mObjs.empty()) return;
668
669
3.06k
        Value* container = &mDoc;
670
671
3.06k
        if (d.mExtId) {
672
0
            Value* exts = FindObject(mDoc, "extensions");
673
0
            if (!exts) {
674
0
                mDoc.AddMember("extensions", Value().SetObject().Move(), mDoc.GetAllocator());
675
0
                exts = FindObject(mDoc, "extensions");
676
0
            }
677
678
0
            if (!(container = FindObject(*exts, d.mExtId))) {
679
0
                exts->AddMember(StringRef(d.mExtId), Value().SetObject().Move(), mDoc.GetAllocator());
680
0
                container = FindObject(*exts, d.mExtId);
681
0
            }
682
0
        }
683
684
3.06k
        Value* dict;
685
3.06k
        if (!(dict = FindObject(*container, d.mDictId))) {
686
3.06k
            container->AddMember(StringRef(d.mDictId), Value().SetObject().Move(), mDoc.GetAllocator());
687
3.06k
            dict = FindObject(*container, d.mDictId);
688
3.06k
        }
689
690
136k
        for (size_t i = 0; i < d.mObjs.size(); ++i) {
691
132k
            if (d.mObjs[i]->IsSpecial()) continue;
692
693
132k
            Value obj;
694
132k
            obj.SetObject();
695
696
132k
            if (!d.mObjs[i]->name.empty()) {
697
0
                obj.AddMember("name", StringRef(d.mObjs[i]->name.c_str()), mAl);
698
0
            }
699
700
132k
            Write(obj, *d.mObjs[i], *this);
701
702
132k
            dict->AddMember(StringRef(d.mObjs[i]->id), obj, mAl);
703
132k
        }
704
3.06k
    }
void glTF::AssetWriter::WriteObjects<glTF::Animation>(glTF::LazyDict<glTF::Animation>&)
Line
Count
Source
666
3.63k
    {
667
3.63k
        if (d.mObjs.empty()) return;
668
669
412
        Value* container = &mDoc;
670
671
412
        if (d.mExtId) {
672
0
            Value* exts = FindObject(mDoc, "extensions");
673
0
            if (!exts) {
674
0
                mDoc.AddMember("extensions", Value().SetObject().Move(), mDoc.GetAllocator());
675
0
                exts = FindObject(mDoc, "extensions");
676
0
            }
677
678
0
            if (!(container = FindObject(*exts, d.mExtId))) {
679
0
                exts->AddMember(StringRef(d.mExtId), Value().SetObject().Move(), mDoc.GetAllocator());
680
0
                container = FindObject(*exts, d.mExtId);
681
0
            }
682
0
        }
683
684
412
        Value* dict;
685
412
        if (!(dict = FindObject(*container, d.mDictId))) {
686
412
            container->AddMember(StringRef(d.mDictId), Value().SetObject().Move(), mDoc.GetAllocator());
687
412
            dict = FindObject(*container, d.mDictId);
688
412
        }
689
690
2.08k
        for (size_t i = 0; i < d.mObjs.size(); ++i) {
691
1.67k
            if (d.mObjs[i]->IsSpecial()) continue;
692
693
1.67k
            Value obj;
694
1.67k
            obj.SetObject();
695
696
1.67k
            if (!d.mObjs[i]->name.empty()) {
697
0
                obj.AddMember("name", StringRef(d.mObjs[i]->name.c_str()), mAl);
698
0
            }
699
700
1.67k
            Write(obj, *d.mObjs[i], *this);
701
702
1.67k
            dict->AddMember(StringRef(d.mObjs[i]->id), obj, mAl);
703
1.67k
        }
704
412
    }
void glTF::AssetWriter::WriteObjects<glTF::Buffer>(glTF::LazyDict<glTF::Buffer>&)
Line
Count
Source
666
3.63k
    {
667
3.63k
        if (d.mObjs.empty()) return;
668
669
3.63k
        Value* container = &mDoc;
670
671
3.63k
        if (d.mExtId) {
672
0
            Value* exts = FindObject(mDoc, "extensions");
673
0
            if (!exts) {
674
0
                mDoc.AddMember("extensions", Value().SetObject().Move(), mDoc.GetAllocator());
675
0
                exts = FindObject(mDoc, "extensions");
676
0
            }
677
678
0
            if (!(container = FindObject(*exts, d.mExtId))) {
679
0
                exts->AddMember(StringRef(d.mExtId), Value().SetObject().Move(), mDoc.GetAllocator());
680
0
                container = FindObject(*exts, d.mExtId);
681
0
            }
682
0
        }
683
684
3.63k
        Value* dict;
685
3.63k
        if (!(dict = FindObject(*container, d.mDictId))) {
686
3.63k
            container->AddMember(StringRef(d.mDictId), Value().SetObject().Move(), mDoc.GetAllocator());
687
3.63k
            dict = FindObject(*container, d.mDictId);
688
3.63k
        }
689
690
7.27k
        for (size_t i = 0; i < d.mObjs.size(); ++i) {
691
3.63k
            if (d.mObjs[i]->IsSpecial()) continue;
692
693
1.81k
            Value obj;
694
1.81k
            obj.SetObject();
695
696
1.81k
            if (!d.mObjs[i]->name.empty()) {
697
0
                obj.AddMember("name", StringRef(d.mObjs[i]->name.c_str()), mAl);
698
0
            }
699
700
1.81k
            Write(obj, *d.mObjs[i], *this);
701
702
1.81k
            dict->AddMember(StringRef(d.mObjs[i]->id), obj, mAl);
703
1.81k
        }
704
3.63k
    }
void glTF::AssetWriter::WriteObjects<glTF::BufferView>(glTF::LazyDict<glTF::BufferView>&)
Line
Count
Source
666
3.63k
    {
667
3.63k
        if (d.mObjs.empty()) return;
668
669
3.06k
        Value* container = &mDoc;
670
671
3.06k
        if (d.mExtId) {
672
0
            Value* exts = FindObject(mDoc, "extensions");
673
0
            if (!exts) {
674
0
                mDoc.AddMember("extensions", Value().SetObject().Move(), mDoc.GetAllocator());
675
0
                exts = FindObject(mDoc, "extensions");
676
0
            }
677
678
0
            if (!(container = FindObject(*exts, d.mExtId))) {
679
0
                exts->AddMember(StringRef(d.mExtId), Value().SetObject().Move(), mDoc.GetAllocator());
680
0
                container = FindObject(*exts, d.mExtId);
681
0
            }
682
0
        }
683
684
3.06k
        Value* dict;
685
3.06k
        if (!(dict = FindObject(*container, d.mDictId))) {
686
3.06k
            container->AddMember(StringRef(d.mDictId), Value().SetObject().Move(), mDoc.GetAllocator());
687
3.06k
            dict = FindObject(*container, d.mDictId);
688
3.06k
        }
689
690
136k
        for (size_t i = 0; i < d.mObjs.size(); ++i) {
691
133k
            if (d.mObjs[i]->IsSpecial()) continue;
692
693
133k
            Value obj;
694
133k
            obj.SetObject();
695
696
133k
            if (!d.mObjs[i]->name.empty()) {
697
0
                obj.AddMember("name", StringRef(d.mObjs[i]->name.c_str()), mAl);
698
0
            }
699
700
133k
            Write(obj, *d.mObjs[i], *this);
701
702
133k
            dict->AddMember(StringRef(d.mObjs[i]->id), obj, mAl);
703
133k
        }
704
3.06k
    }
void glTF::AssetWriter::WriteObjects<glTF::Camera>(glTF::LazyDict<glTF::Camera>&)
Line
Count
Source
666
3.63k
    {
667
3.63k
        if (d.mObjs.empty()) return;
668
669
0
        Value* container = &mDoc;
670
671
0
        if (d.mExtId) {
672
0
            Value* exts = FindObject(mDoc, "extensions");
673
0
            if (!exts) {
674
0
                mDoc.AddMember("extensions", Value().SetObject().Move(), mDoc.GetAllocator());
675
0
                exts = FindObject(mDoc, "extensions");
676
0
            }
677
678
0
            if (!(container = FindObject(*exts, d.mExtId))) {
679
0
                exts->AddMember(StringRef(d.mExtId), Value().SetObject().Move(), mDoc.GetAllocator());
680
0
                container = FindObject(*exts, d.mExtId);
681
0
            }
682
0
        }
683
684
0
        Value* dict;
685
0
        if (!(dict = FindObject(*container, d.mDictId))) {
686
0
            container->AddMember(StringRef(d.mDictId), Value().SetObject().Move(), mDoc.GetAllocator());
687
0
            dict = FindObject(*container, d.mDictId);
688
0
        }
689
690
0
        for (size_t i = 0; i < d.mObjs.size(); ++i) {
691
0
            if (d.mObjs[i]->IsSpecial()) continue;
692
693
0
            Value obj;
694
0
            obj.SetObject();
695
696
0
            if (!d.mObjs[i]->name.empty()) {
697
0
                obj.AddMember("name", StringRef(d.mObjs[i]->name.c_str()), mAl);
698
0
            }
699
700
0
            Write(obj, *d.mObjs[i], *this);
701
702
0
            dict->AddMember(StringRef(d.mObjs[i]->id), obj, mAl);
703
0
        }
704
0
    }
void glTF::AssetWriter::WriteObjects<glTF::Image>(glTF::LazyDict<glTF::Image>&)
Line
Count
Source
666
3.63k
    {
667
3.63k
        if (d.mObjs.empty()) return;
668
669
672
        Value* container = &mDoc;
670
671
672
        if (d.mExtId) {
672
0
            Value* exts = FindObject(mDoc, "extensions");
673
0
            if (!exts) {
674
0
                mDoc.AddMember("extensions", Value().SetObject().Move(), mDoc.GetAllocator());
675
0
                exts = FindObject(mDoc, "extensions");
676
0
            }
677
678
0
            if (!(container = FindObject(*exts, d.mExtId))) {
679
0
                exts->AddMember(StringRef(d.mExtId), Value().SetObject().Move(), mDoc.GetAllocator());
680
0
                container = FindObject(*exts, d.mExtId);
681
0
            }
682
0
        }
683
684
672
        Value* dict;
685
672
        if (!(dict = FindObject(*container, d.mDictId))) {
686
672
            container->AddMember(StringRef(d.mDictId), Value().SetObject().Move(), mDoc.GetAllocator());
687
672
            dict = FindObject(*container, d.mDictId);
688
672
        }
689
690
1.72k
        for (size_t i = 0; i < d.mObjs.size(); ++i) {
691
1.05k
            if (d.mObjs[i]->IsSpecial()) continue;
692
693
1.05k
            Value obj;
694
1.05k
            obj.SetObject();
695
696
1.05k
            if (!d.mObjs[i]->name.empty()) {
697
16
                obj.AddMember("name", StringRef(d.mObjs[i]->name.c_str()), mAl);
698
16
            }
699
700
1.05k
            Write(obj, *d.mObjs[i], *this);
701
702
1.05k
            dict->AddMember(StringRef(d.mObjs[i]->id), obj, mAl);
703
1.05k
        }
704
672
    }
void glTF::AssetWriter::WriteObjects<glTF::Material>(glTF::LazyDict<glTF::Material>&)
Line
Count
Source
666
3.63k
    {
667
3.63k
        if (d.mObjs.empty()) return;
668
669
3.06k
        Value* container = &mDoc;
670
671
3.06k
        if (d.mExtId) {
672
0
            Value* exts = FindObject(mDoc, "extensions");
673
0
            if (!exts) {
674
0
                mDoc.AddMember("extensions", Value().SetObject().Move(), mDoc.GetAllocator());
675
0
                exts = FindObject(mDoc, "extensions");
676
0
            }
677
678
0
            if (!(container = FindObject(*exts, d.mExtId))) {
679
0
                exts->AddMember(StringRef(d.mExtId), Value().SetObject().Move(), mDoc.GetAllocator());
680
0
                container = FindObject(*exts, d.mExtId);
681
0
            }
682
0
        }
683
684
3.06k
        Value* dict;
685
3.06k
        if (!(dict = FindObject(*container, d.mDictId))) {
686
3.06k
            container->AddMember(StringRef(d.mDictId), Value().SetObject().Move(), mDoc.GetAllocator());
687
3.06k
            dict = FindObject(*container, d.mDictId);
688
3.06k
        }
689
690
7.08k
        for (size_t i = 0; i < d.mObjs.size(); ++i) {
691
4.01k
            if (d.mObjs[i]->IsSpecial()) continue;
692
693
4.01k
            Value obj;
694
4.01k
            obj.SetObject();
695
696
4.01k
            if (!d.mObjs[i]->name.empty()) {
697
0
                obj.AddMember("name", StringRef(d.mObjs[i]->name.c_str()), mAl);
698
0
            }
699
700
4.01k
            Write(obj, *d.mObjs[i], *this);
701
702
4.01k
            dict->AddMember(StringRef(d.mObjs[i]->id), obj, mAl);
703
4.01k
        }
704
3.06k
    }
void glTF::AssetWriter::WriteObjects<glTF::Mesh>(glTF::LazyDict<glTF::Mesh>&)
Line
Count
Source
666
3.63k
    {
667
3.63k
        if (d.mObjs.empty()) return;
668
669
3.06k
        Value* container = &mDoc;
670
671
3.06k
        if (d.mExtId) {
672
0
            Value* exts = FindObject(mDoc, "extensions");
673
0
            if (!exts) {
674
0
                mDoc.AddMember("extensions", Value().SetObject().Move(), mDoc.GetAllocator());
675
0
                exts = FindObject(mDoc, "extensions");
676
0
            }
677
678
0
            if (!(container = FindObject(*exts, d.mExtId))) {
679
0
                exts->AddMember(StringRef(d.mExtId), Value().SetObject().Move(), mDoc.GetAllocator());
680
0
                container = FindObject(*exts, d.mExtId);
681
0
            }
682
0
        }
683
684
3.06k
        Value* dict;
685
3.06k
        if (!(dict = FindObject(*container, d.mDictId))) {
686
3.06k
            container->AddMember(StringRef(d.mDictId), Value().SetObject().Move(), mDoc.GetAllocator());
687
3.06k
            dict = FindObject(*container, d.mDictId);
688
3.06k
        }
689
690
44.4k
        for (size_t i = 0; i < d.mObjs.size(); ++i) {
691
41.4k
            if (d.mObjs[i]->IsSpecial()) continue;
692
693
41.4k
            Value obj;
694
41.4k
            obj.SetObject();
695
696
41.4k
            if (!d.mObjs[i]->name.empty()) {
697
0
                obj.AddMember("name", StringRef(d.mObjs[i]->name.c_str()), mAl);
698
0
            }
699
700
41.4k
            Write(obj, *d.mObjs[i], *this);
701
702
41.4k
            dict->AddMember(StringRef(d.mObjs[i]->id), obj, mAl);
703
41.4k
        }
704
3.06k
    }
void glTF::AssetWriter::WriteObjects<glTF::Node>(glTF::LazyDict<glTF::Node>&)
Line
Count
Source
666
3.63k
    {
667
3.63k
        if (d.mObjs.empty()) return;
668
669
3.63k
        Value* container = &mDoc;
670
671
3.63k
        if (d.mExtId) {
672
0
            Value* exts = FindObject(mDoc, "extensions");
673
0
            if (!exts) {
674
0
                mDoc.AddMember("extensions", Value().SetObject().Move(), mDoc.GetAllocator());
675
0
                exts = FindObject(mDoc, "extensions");
676
0
            }
677
678
0
            if (!(container = FindObject(*exts, d.mExtId))) {
679
0
                exts->AddMember(StringRef(d.mExtId), Value().SetObject().Move(), mDoc.GetAllocator());
680
0
                container = FindObject(*exts, d.mExtId);
681
0
            }
682
0
        }
683
684
3.63k
        Value* dict;
685
3.63k
        if (!(dict = FindObject(*container, d.mDictId))) {
686
3.63k
            container->AddMember(StringRef(d.mDictId), Value().SetObject().Move(), mDoc.GetAllocator());
687
3.63k
            dict = FindObject(*container, d.mDictId);
688
3.63k
        }
689
690
202k
        for (size_t i = 0; i < d.mObjs.size(); ++i) {
691
198k
            if (d.mObjs[i]->IsSpecial()) continue;
692
693
198k
            Value obj;
694
198k
            obj.SetObject();
695
696
198k
            if (!d.mObjs[i]->name.empty()) {
697
0
                obj.AddMember("name", StringRef(d.mObjs[i]->name.c_str()), mAl);
698
0
            }
699
700
198k
            Write(obj, *d.mObjs[i], *this);
701
702
198k
            dict->AddMember(StringRef(d.mObjs[i]->id), obj, mAl);
703
198k
        }
704
3.63k
    }
void glTF::AssetWriter::WriteObjects<glTF::Sampler>(glTF::LazyDict<glTF::Sampler>&)
Line
Count
Source
666
3.63k
    {
667
3.63k
        if (d.mObjs.empty()) return;
668
669
672
        Value* container = &mDoc;
670
671
672
        if (d.mExtId) {
672
0
            Value* exts = FindObject(mDoc, "extensions");
673
0
            if (!exts) {
674
0
                mDoc.AddMember("extensions", Value().SetObject().Move(), mDoc.GetAllocator());
675
0
                exts = FindObject(mDoc, "extensions");
676
0
            }
677
678
0
            if (!(container = FindObject(*exts, d.mExtId))) {
679
0
                exts->AddMember(StringRef(d.mExtId), Value().SetObject().Move(), mDoc.GetAllocator());
680
0
                container = FindObject(*exts, d.mExtId);
681
0
            }
682
0
        }
683
684
672
        Value* dict;
685
672
        if (!(dict = FindObject(*container, d.mDictId))) {
686
672
            container->AddMember(StringRef(d.mDictId), Value().SetObject().Move(), mDoc.GetAllocator());
687
672
            dict = FindObject(*container, d.mDictId);
688
672
        }
689
690
1.72k
        for (size_t i = 0; i < d.mObjs.size(); ++i) {
691
1.05k
            if (d.mObjs[i]->IsSpecial()) continue;
692
693
1.05k
            Value obj;
694
1.05k
            obj.SetObject();
695
696
1.05k
            if (!d.mObjs[i]->name.empty()) {
697
0
                obj.AddMember("name", StringRef(d.mObjs[i]->name.c_str()), mAl);
698
0
            }
699
700
1.05k
            Write(obj, *d.mObjs[i], *this);
701
702
1.05k
            dict->AddMember(StringRef(d.mObjs[i]->id), obj, mAl);
703
1.05k
        }
704
672
    }
void glTF::AssetWriter::WriteObjects<glTF::Scene>(glTF::LazyDict<glTF::Scene>&)
Line
Count
Source
666
3.63k
    {
667
3.63k
        if (d.mObjs.empty()) return;
668
669
3.63k
        Value* container = &mDoc;
670
671
3.63k
        if (d.mExtId) {
672
0
            Value* exts = FindObject(mDoc, "extensions");
673
0
            if (!exts) {
674
0
                mDoc.AddMember("extensions", Value().SetObject().Move(), mDoc.GetAllocator());
675
0
                exts = FindObject(mDoc, "extensions");
676
0
            }
677
678
0
            if (!(container = FindObject(*exts, d.mExtId))) {
679
0
                exts->AddMember(StringRef(d.mExtId), Value().SetObject().Move(), mDoc.GetAllocator());
680
0
                container = FindObject(*exts, d.mExtId);
681
0
            }
682
0
        }
683
684
3.63k
        Value* dict;
685
3.63k
        if (!(dict = FindObject(*container, d.mDictId))) {
686
3.63k
            container->AddMember(StringRef(d.mDictId), Value().SetObject().Move(), mDoc.GetAllocator());
687
3.63k
            dict = FindObject(*container, d.mDictId);
688
3.63k
        }
689
690
7.27k
        for (size_t i = 0; i < d.mObjs.size(); ++i) {
691
3.63k
            if (d.mObjs[i]->IsSpecial()) continue;
692
693
3.63k
            Value obj;
694
3.63k
            obj.SetObject();
695
696
3.63k
            if (!d.mObjs[i]->name.empty()) {
697
0
                obj.AddMember("name", StringRef(d.mObjs[i]->name.c_str()), mAl);
698
0
            }
699
700
3.63k
            Write(obj, *d.mObjs[i], *this);
701
702
3.63k
            dict->AddMember(StringRef(d.mObjs[i]->id), obj, mAl);
703
3.63k
        }
704
3.63k
    }
void glTF::AssetWriter::WriteObjects<glTF::Skin>(glTF::LazyDict<glTF::Skin>&)
Line
Count
Source
666
3.63k
    {
667
3.63k
        if (d.mObjs.empty()) return;
668
669
338
        Value* container = &mDoc;
670
671
338
        if (d.mExtId) {
672
0
            Value* exts = FindObject(mDoc, "extensions");
673
0
            if (!exts) {
674
0
                mDoc.AddMember("extensions", Value().SetObject().Move(), mDoc.GetAllocator());
675
0
                exts = FindObject(mDoc, "extensions");
676
0
            }
677
678
0
            if (!(container = FindObject(*exts, d.mExtId))) {
679
0
                exts->AddMember(StringRef(d.mExtId), Value().SetObject().Move(), mDoc.GetAllocator());
680
0
                container = FindObject(*exts, d.mExtId);
681
0
            }
682
0
        }
683
684
338
        Value* dict;
685
338
        if (!(dict = FindObject(*container, d.mDictId))) {
686
338
            container->AddMember(StringRef(d.mDictId), Value().SetObject().Move(), mDoc.GetAllocator());
687
338
            dict = FindObject(*container, d.mDictId);
688
338
        }
689
690
676
        for (size_t i = 0; i < d.mObjs.size(); ++i) {
691
338
            if (d.mObjs[i]->IsSpecial()) continue;
692
693
338
            Value obj;
694
338
            obj.SetObject();
695
696
338
            if (!d.mObjs[i]->name.empty()) {
697
338
                obj.AddMember("name", StringRef(d.mObjs[i]->name.c_str()), mAl);
698
338
            }
699
700
338
            Write(obj, *d.mObjs[i], *this);
701
702
338
            dict->AddMember(StringRef(d.mObjs[i]->id), obj, mAl);
703
338
        }
704
338
    }
void glTF::AssetWriter::WriteObjects<glTF::Texture>(glTF::LazyDict<glTF::Texture>&)
Line
Count
Source
666
3.63k
    {
667
3.63k
        if (d.mObjs.empty()) return;
668
669
672
        Value* container = &mDoc;
670
671
672
        if (d.mExtId) {
672
0
            Value* exts = FindObject(mDoc, "extensions");
673
0
            if (!exts) {
674
0
                mDoc.AddMember("extensions", Value().SetObject().Move(), mDoc.GetAllocator());
675
0
                exts = FindObject(mDoc, "extensions");
676
0
            }
677
678
0
            if (!(container = FindObject(*exts, d.mExtId))) {
679
0
                exts->AddMember(StringRef(d.mExtId), Value().SetObject().Move(), mDoc.GetAllocator());
680
0
                container = FindObject(*exts, d.mExtId);
681
0
            }
682
0
        }
683
684
672
        Value* dict;
685
672
        if (!(dict = FindObject(*container, d.mDictId))) {
686
672
            container->AddMember(StringRef(d.mDictId), Value().SetObject().Move(), mDoc.GetAllocator());
687
672
            dict = FindObject(*container, d.mDictId);
688
672
        }
689
690
1.72k
        for (size_t i = 0; i < d.mObjs.size(); ++i) {
691
1.05k
            if (d.mObjs[i]->IsSpecial()) continue;
692
693
1.05k
            Value obj;
694
1.05k
            obj.SetObject();
695
696
1.05k
            if (!d.mObjs[i]->name.empty()) {
697
0
                obj.AddMember("name", StringRef(d.mObjs[i]->name.c_str()), mAl);
698
0
            }
699
700
1.05k
            Write(obj, *d.mObjs[i], *this);
701
702
1.05k
            dict->AddMember(StringRef(d.mObjs[i]->id), obj, mAl);
703
1.05k
        }
704
672
    }
void glTF::AssetWriter::WriteObjects<glTF::Light>(glTF::LazyDict<glTF::Light>&)
Line
Count
Source
666
3.63k
    {
667
3.63k
        if (d.mObjs.empty()) return;
668
669
0
        Value* container = &mDoc;
670
671
0
        if (d.mExtId) {
672
0
            Value* exts = FindObject(mDoc, "extensions");
673
0
            if (!exts) {
674
0
                mDoc.AddMember("extensions", Value().SetObject().Move(), mDoc.GetAllocator());
675
0
                exts = FindObject(mDoc, "extensions");
676
0
            }
677
678
0
            if (!(container = FindObject(*exts, d.mExtId))) {
679
0
                exts->AddMember(StringRef(d.mExtId), Value().SetObject().Move(), mDoc.GetAllocator());
680
0
                container = FindObject(*exts, d.mExtId);
681
0
            }
682
0
        }
683
684
0
        Value* dict;
685
0
        if (!(dict = FindObject(*container, d.mDictId))) {
686
0
            container->AddMember(StringRef(d.mDictId), Value().SetObject().Move(), mDoc.GetAllocator());
687
0
            dict = FindObject(*container, d.mDictId);
688
0
        }
689
690
0
        for (size_t i = 0; i < d.mObjs.size(); ++i) {
691
0
            if (d.mObjs[i]->IsSpecial()) continue;
692
693
0
            Value obj;
694
0
            obj.SetObject();
695
696
0
            if (!d.mObjs[i]->name.empty()) {
697
0
                obj.AddMember("name", StringRef(d.mObjs[i]->name.c_str()), mAl);
698
0
            }
699
700
0
            Write(obj, *d.mObjs[i], *this);
701
702
0
            dict->AddMember(StringRef(d.mObjs[i]->id), obj, mAl);
703
0
        }
704
0
    }
705
706
    template<class T>
707
    void WriteLazyDict(LazyDict<T>& d, AssetWriter& w)
708
50.9k
    {
709
50.9k
        w.WriteObjects(d);
710
50.9k
    }
void glTF::WriteLazyDict<glTF::Accessor>(glTF::LazyDict<glTF::Accessor>&, glTF::AssetWriter&)
Line
Count
Source
708
3.63k
    {
709
3.63k
        w.WriteObjects(d);
710
3.63k
    }
void glTF::WriteLazyDict<glTF::Animation>(glTF::LazyDict<glTF::Animation>&, glTF::AssetWriter&)
Line
Count
Source
708
3.63k
    {
709
3.63k
        w.WriteObjects(d);
710
3.63k
    }
void glTF::WriteLazyDict<glTF::Buffer>(glTF::LazyDict<glTF::Buffer>&, glTF::AssetWriter&)
Line
Count
Source
708
3.63k
    {
709
3.63k
        w.WriteObjects(d);
710
3.63k
    }
void glTF::WriteLazyDict<glTF::BufferView>(glTF::LazyDict<glTF::BufferView>&, glTF::AssetWriter&)
Line
Count
Source
708
3.63k
    {
709
3.63k
        w.WriteObjects(d);
710
3.63k
    }
void glTF::WriteLazyDict<glTF::Camera>(glTF::LazyDict<glTF::Camera>&, glTF::AssetWriter&)
Line
Count
Source
708
3.63k
    {
709
3.63k
        w.WriteObjects(d);
710
3.63k
    }
void glTF::WriteLazyDict<glTF::Image>(glTF::LazyDict<glTF::Image>&, glTF::AssetWriter&)
Line
Count
Source
708
3.63k
    {
709
3.63k
        w.WriteObjects(d);
710
3.63k
    }
void glTF::WriteLazyDict<glTF::Material>(glTF::LazyDict<glTF::Material>&, glTF::AssetWriter&)
Line
Count
Source
708
3.63k
    {
709
3.63k
        w.WriteObjects(d);
710
3.63k
    }
void glTF::WriteLazyDict<glTF::Mesh>(glTF::LazyDict<glTF::Mesh>&, glTF::AssetWriter&)
Line
Count
Source
708
3.63k
    {
709
3.63k
        w.WriteObjects(d);
710
3.63k
    }
void glTF::WriteLazyDict<glTF::Node>(glTF::LazyDict<glTF::Node>&, glTF::AssetWriter&)
Line
Count
Source
708
3.63k
    {
709
3.63k
        w.WriteObjects(d);
710
3.63k
    }
void glTF::WriteLazyDict<glTF::Sampler>(glTF::LazyDict<glTF::Sampler>&, glTF::AssetWriter&)
Line
Count
Source
708
3.63k
    {
709
3.63k
        w.WriteObjects(d);
710
3.63k
    }
void glTF::WriteLazyDict<glTF::Scene>(glTF::LazyDict<glTF::Scene>&, glTF::AssetWriter&)
Line
Count
Source
708
3.63k
    {
709
3.63k
        w.WriteObjects(d);
710
3.63k
    }
void glTF::WriteLazyDict<glTF::Skin>(glTF::LazyDict<glTF::Skin>&, glTF::AssetWriter&)
Line
Count
Source
708
3.63k
    {
709
3.63k
        w.WriteObjects(d);
710
3.63k
    }
void glTF::WriteLazyDict<glTF::Texture>(glTF::LazyDict<glTF::Texture>&, glTF::AssetWriter&)
Line
Count
Source
708
3.63k
    {
709
3.63k
        w.WriteObjects(d);
710
3.63k
    }
void glTF::WriteLazyDict<glTF::Light>(glTF::LazyDict<glTF::Light>&, glTF::AssetWriter&)
Line
Count
Source
708
3.63k
    {
709
3.63k
        w.WriteObjects(d);
710
3.63k
    }
711
712
#if _MSC_VER
713
#    pragma warning(pop)
714
#endif // _WIN32
715
716
}