-
Notifications
You must be signed in to change notification settings - Fork 0
/
glTF.fbs
1027 lines (805 loc) · 44.7 KB
/
glTF.fbs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
///----------------------------------------------------------------------------
/// The datatype of components in the attribute.
/// gltf_detailedDescription: The datatype of components in the attribute. All valid values correspond to WebGL enums. The corresponding typed arrays are `Int8Array`, `Uint8Array`, `Int16Array`, `Uint16Array`, `Uint32Array`, and `Float32Array`, respectively. 5125 (UNSIGNED_INT) is only allowed when the accessor contains indices, i.e., the accessor is only referenced by `primitive.indices`.
/// gltf_webgl: `vertexAttribPointer()` type parameter
enum ComponentType: uint {
BYTE = 5120,
UNSIGNED_BYTE = 5121,
SHORT = 5122,
UNSIGNED_SHORT = 5123,
UNSIGNED_INT = 5125,
FLOAT = 5126,
}
/// "description": "Specifies if the attribute is a scalar, vector, or matrix."
enum AccessorType: byte { //string
SCALAR,
VEC2,
VEC3,
VEC4,
MAT2,
MAT3,
MAT4
}
table AccessorSparseIndices {
/// "description": "The index of the bufferView with sparse indices. Referenced bufferView can't have ARRAY_BUFFER or ELEMENT_ARRAY_BUFFER target."
bufferView: int = -1; //glTFid
/// "description": "The offset relative to the start of the bufferView in bytes. Must be aligned."
byteOffset: uint = 0;
componentType: ComponentType = UNSIGNED_BYTE;
/// Dictionary object with extension-specific objects.
extensions: [ubyte](flexbuffer);
/// Application-specific data.
extras: [ubyte](flexbuffer);
}
table AccessorSparseValues {
/// "description": "The index of the bufferView with sparse values. Referenced bufferView can't have ARRAY_BUFFER or ELEMENT_ARRAY_BUFFER target."
bufferView: int = -1; //glTFid
/// "description": "The offset relative to the start of the bufferView in bytes. Must be aligned."
byteOffset: int = 0; //uint
/// Dictionary object with extension-specific objects.
extensions: [ubyte](flexbuffer);
/// Application-specific data.
extras: [ubyte](flexbuffer);
}
/// Accessor Sparse
table AccessorSparse {
/// "description": "Number of entries stored in the sparse array."
/// "gltf_detailedDescription": "The number of attributes encoded in this sparse accessor."
/// "minimum": 1
count: int; //uint
/// "description": "Index array of size `count` that points to those accessor attributes that deviate from their initialization value. Indices must strictly increase."
indices: AccessorSparseIndices(required);
/// "description": "Array of size `count` times number of components, storing the displaced accessor attributes pointed by `indices`. Substituted values must have the same `componentType` and number of components as the base accessor."
values: AccessorSparseValues(required);
/// Dictionary object with extension-specific objects.
extensions: [ubyte](flexbuffer);
/// Application-specific data.
extras: [ubyte](flexbuffer);
}
/// A typed view into a bufferView. A bufferView contains raw binary data. An accessor provides a typed view into a bufferView or a subset of a bufferView similar to how WebGL's `vertexAttribPointer()` defines an attribute in a buffer.
table Accessor
{
/// "description": "The index of the bufferView."
/// "gltf_detailedDescription": "The index of the bufferView. When not defined, accessor must be initialized with zeros; `sparse` property or extensions could override zeros with actual values."
bufferView: int = -1; //glTFid
// 4 OK
/// "description": "The offset relative to the start of the bufferView in bytes."
/// "gltf_detailedDescription": "The offset relative to the start of the bufferView in bytes. This must be a multiple of the size of the component datatype."
/// "gltf_webgl": "`vertexAttribPointer()` offset parameter"
byteOffset: int = 0; //uint
// 6 OK
/// "description": "The datatype of components in the attribute."
/// "gltf_detailedDescription": "The datatype of components in the attribute. All valid values correspond to WebGL enums. The corresponding typed arrays are `Int8Array`, `Uint8Array`, `Int16Array`, `Uint16Array`, `Uint32Array`, and `Float32Array`, respectively. 5125 (UNSIGNED_INT) is only allowed when the accessor contains indices, i.e., the accessor is only referenced by `primitive.indices`."
/// "gltf_webgl": "`vertexAttribPointer()` type parameter"
componentType: ComponentType = BYTE;
// 8 OK
/// "description": "The number of attributes referenced by this accessor."
/// "gltf_detailedDescription": "The number of attributes referenced by this accessor, not to be confused with the number of bytes or number of components."
count: int = 0; //uint
// 10 OK
/// "description": "Sparse storage of attributes that deviate from their initialization value."
sparse: AccessorSparse;
/// The user-defined name of this object.
/// gltf_detailedDescription: The user-defined name of this object. This is not necessarily unique, e.g., an accessor and a buffer could have the same name, or two accessors could even have the same name.
name: string;
/// "description": "Maximum value of each component in this attribute."
/// "minItems": 1,
/// "maxItems": 16,
/// "gltf_detailedDescription": "Maximum value of each component in this attribute. Array elements must be treated as having the same data type as accessor's `componentType`. Both min and max arrays have the same length. The length is determined by the value of the type property; it can be 1, 2, 3, 4, 9, or 16.\n\n`normalized` property has no effect on array values: they always correspond to the actual values stored in the buffer. When accessor is sparse, this property must contain max values of accessor data with sparse substitution applied."
max: [float]; // Number
// 16 OK
/// "description": "Minimum value of each component in this attribute."
/// "minItems": 1,
/// "maxItems": 16,
/// "gltf_detailedDescription": "Minimum value of each component in this attribute. Array elements must be treated as having the same data type as accessor's `componentType`. Both min and max arrays have the same length. The length is determined by the value of the type property; it can be 1, 2, 3, 4, 9, or 16.\n\n`normalized` property has no effect on array values: they always correspond to the actual values stored in the buffer. When accessor is sparse, this property must contain min values of accessor data with sparse substitution applied."
min: [float]; // Number
// 18 OK
/// Dictionary object with extension-specific objects.
extensions: [ubyte](flexbuffer);
/// "description": "Specifies whether integer data values should be normalized."
/// "gltf_detailedDescription": "Specifies whether integer data values should be normalized (`true`) to [0, 1] (for unsigned types) or [-1, 1] (for signed types), or converted directly (`false`) when they are accessed. This property is defined only for accessors that contain vertex attributes or animation output data."
/// "gltf_webgl": "`vertexAttribPointer()` normalized parameter"
normalized: bool = false;
/// Application-specific data.
extras: [ubyte](flexbuffer);
/// "description": "Specifies if the attribute is a scalar, vector, or matrix."
type: AccessorType = SCALAR;
// 26 OK
}
///----------------------------------------------------------------------------
/// Asset
/// Metadata about the glTF asset.
table Asset
{
/// The user-defined name of this object.
/// gltf_detailedDescription: The user-defined name of this object. This is not necessarily unique, e.g., an accessor and a buffer could have the same name, or two accessors could even have the same name.
name: string;
/// Dictionary object with extension-specific objects.
extensions: [ubyte](flexbuffer);
/// Application-specific data.
extras: [ubyte](flexbuffer);
/// Tool that generated this glTF model. Useful for debugging.
generator: string;
// 10 OK
/// The minimum glTF version that this asset targets.
/// pattern": "^[0-9]+\\.[0-9]+$
minVersion: string;
/// The glTF version that this asset targets.
/// pattern: "^[0-9]+\\.[0-9]+$"
version: string(required);
// 14 OK
/// A copyright message suitable for display to credit the content creator.
copyright: string;
}
///----------------------------------------------------------------------------
/// "description": "The name of the node's TRS property to modify, or the \"weights\" of the Morph Targets it instantiates."
enum AnimationChannelTargetPath: byte { //string
translation,
rotation,
scale,
weights
}
/// Animation Channel Target
/// "description": "The index of the node and TRS property that an animation channel targets."
table AnimationChannelTarget {
/// Dictionary object with extension-specific objects.
extensions: [ubyte](flexbuffer);
/// Application-specific data.
extras: [ubyte](flexbuffer);
/// "description": "The index of the node to target."
node: int = -1; //glTFid
// 8 OK
/// "description": "The name of the node's TRS property to modify, or the \"weights\" of the Morph Targets it instantiates."
path: AnimationChannelTargetPath = translation;
// 10 OK
}
/// Animation Channel
/// "description": "Targets an animation's sampler at a node's property."
table AnimationChannel {
/// Dictionary object with extension-specific objects.
extensions: [ubyte](flexbuffer);
/// Application-specific data.
extras: [ubyte](flexbuffer);
/// "description": "The index of a sampler in this animation used to compute the value for the target."
/// "gltf_detailedDescription": "The index of a sampler in this animation used to compute the value for the target, e.g., a node's translation, rotation, or scale (TRS)."
sampler: int; //glTFid
// 8 OK
/// "description": "The index of the node and TRS property to target."
target: AnimationChannelTarget(required);
// 10 OK
}
/// "description": "Interpolation algorithm."
/// "gltf_detailedDescription": "Interpolation algorithm."
enum AnimationSamplerInterpolationAlgorithm: byte { // string
/// "description": "The animated values are linearly interpolated between keyframes. When targeting a rotation, spherical linear interpolation (slerp) should be used to interpolate quaternions. The number output of elements must equal the number of input elements."
LINEAR,
/// "description": "The animated values remain constant to the output of the first keyframe, until the next keyframe. The number of output elements must equal the number of input elements."
STEP,
/// "description": "The animation's interpolation is computed using a uniform Catmull-Rom spline. The number of output elements must equal two more than the number of input elements. The first and last output elements represent the start and end tangents of the spline. There must be at least four keyframes when using this interpolation."
CATMULLROMSPLINE,
/// "description": "The animation's interpolation is computed using a cubic spline with specified tangents. The number of output elements must equal three times the number of input elements. For each input element, the output stores three elements, an in-tangent, a spline vertex, and an out-tangent. There must be at least two keyframes when using this interpolation."
CUBICSPLINE,
}
/// Animation Sampler
/// "description": "Combines input and output accessors with an interpolation algorithm to define a keyframe graph (but not its target)."
table AnimationSampler {
/// Application-specific data.
extras: [ubyte](flexbuffer);
/// Dictionary object with extension-specific objects.
extensions: [ubyte](flexbuffer);
/// "description": "The index of an accessor containing keyframe input values, e.g., time."
/// "gltf_detailedDescription": "The index of an accessor containing keyframe input values, e.g., time. That accessor must have componentType `FLOAT`. The values represent time in seconds with `time[0] >= 0.0`, and strictly increasing values, i.e., `time[n + 1] > time[n]`."
input: int; //glTFid
// 8 OK
/// "description": "Interpolation algorithm."
/// "gltf_detailedDescription": "Interpolation algorithm."
interpolation: AnimationSamplerInterpolationAlgorithm = LINEAR;
// 10 OK
/// "description": "The index of an accessor, containing keyframe output values."
/// "gltf_detailedDescription": "The index of an accessor containing keyframe output values. When targeting TRS target, the `accessor.componentType` of the output values must be `FLOAT`. When targeting morph weights, the `accessor.componentType` of the output values must be `FLOAT` or normalized integer where each output element stores values with a count equal to the number of morph targets."
output: int; //glTFid
// 12 OK
}
/// Animation
/// "description": "A keyframe animation."
table Animation {
/// "description": "An array of channels, each of which targets an animation's sampler at a node's property. Different channels of the same animation can't have equal targets."
channels: [AnimationChannel](required);
// 4 OK
/// Dictionary object with extension-specific objects.
extensions: [ubyte](flexbuffer);
/// Application-specific data.
extras: [ubyte](flexbuffer);
/// The user-defined name of this object.
/// gltf_detailedDescription: The user-defined name of this object. This is not necessarily unique, e.g., an accessor and a buffer could have the same name, or two accessors could even have the same name.
name: string;
// 10 OK
/// "description": "An array of samplers that combines input and output accessors with an interpolation algorithm to define a keyframe graph (but not its target)."
samplers: [AnimationSampler](required);
// 12 OK
}
///----------------------------------------------------------------------------
/// Buffer
/// "description": "A buffer points to binary geometry, animation, or skins."
table Buffer {
/// "description": "The length of the buffer in bytes."
byteLength: uint = 0;
// 4 OK
/// "description": "The uri of the buffer."
/// "format": "uriref"
/// "gltf_detailedDescription": "The uri of the buffer. Relative paths are relative to the .gltf file. Instead of referencing an external file, the uri can also be a data-uri."
/// "gltf_uriType": "application"
uri: string;
/// The user-defined name of this object.
/// gltf_detailedDescription: The user-defined name of this object. This is not necessarily unique, e.g., an accessor and a buffer could have the same name, or two accessors could even have the same name.
name: string;
/// Dictionary object with extension-specific objects.
extensions: [ubyte](flexbuffer);
/// Application-specific data.
extras: [ubyte](flexbuffer);
}
///----------------------------------------------------------------------------
/// "description": "The target that the GPU buffer should be bound to."
/// "gltf_webgl": "`bindBuffer()`"
enum BufferViewTarget: int {
ARRAY_BUFFER = 34962,
ELEMENT_ARRAY_BUFFER = 34963,
/// originally added for flatgltf
UNIFORM_BUFFER = 35345,
}
/// Buffer View
/// "description": "A view into a buffer generally representing a subset of the buffer."
table BufferView {
/// "description": "The index of the buffer."
buffer: uint = 0; //glTFid
// 4 OK
// "description": "The length of the bufferView in bytes."
// "minimum": 1
byteLength: uint; //uint
// 6 OK
/// "description": "The offset into the buffer in bytes."
byteOffset: uint = 0; //uint
// 8 OK
/// "description": "The stride, in bytes."
/// "minimum": 4
/// "maximum": 252
/// "multipleOf": 4
/// "gltf_detailedDescription": "The stride, in bytes, between vertex attributes. When this is not defined, data is tightly packed. When two or more accessors use the same bufferView, this field must be defined."
/// "gltf_webgl": "`vertexAttribPointer()` stride parameter"
byteStride: uint; //uint
// 10 OK
/// "description": "The target that the GPU buffer should be bound to."
/// "gltf_webgl": "`bindBuffer()`"
target: BufferViewTarget = ARRAY_BUFFER; // BufferViewTarget = UNIFORM_BUFFER;
// 12 OK
/// The user-defined name of this object.
/// gltf_detailedDescription: The user-defined name of this object. This is not necessarily unique, e.g., an accessor and a buffer could have the same name, or two accessors could even have the same name.
name: string;
/// Dictionary object with extension-specific objects.
extensions: [ubyte](flexbuffer);
/// Application-specific data.
extras: [ubyte](flexbuffer);
}
///----------------------------------------------------------------------------
/// Camera Orthographic
/// "description": "An orthographic camera containing properties to create an orthographic projection matrix."
table CameraOrthographic {
/// "description": "The floating-point horizontal magnification of the view. Must not be zero."
xmag: float; // Number
/// "description": "The floating-point vertical magnification of the view. Must not be zero."
ymag: float; // Number
/// "description": "The floating-point distance to the far clipping plane. `zfar` must be greater than `znear`."
zfar: float; // Number
/// "description": "The floating-point distance to the near clipping plane."
znear: float; // Number
/// Dictionary object with extension-specific objects.
extensions: [ubyte](flexbuffer);
/// Application-specific data.
extras: [ubyte](flexbuffer);
}
/// Camera Perspective
/// "description": "A perspective camera containing properties to create a perspective projection matrix."
table CameraPerspective {
/// "description": "The floating-point aspect ratio of the field of view."
/// "gltf_detailedDescription": "The floating-point aspect ratio of the field of view. When this is undefined, the aspect ratio of the canvas is used."
aspectRatio: float; // Number
// 4 OK
/// Dictionary object with extension-specific objects.
extensions: [ubyte](flexbuffer);
/// Application-specific data.
extras: [ubyte](flexbuffer);
/// "description": "The floating-point vertical field of view in radians."
yfov: float; // Number
// 10 OK
/// "description": "The floating-point distance to the far clipping plane."
/// "gltf_detailedDescription": "The floating-point distance to the far clipping plane. When defined, `zfar` must be greater than `znear`. If `zfar` is undefined, runtime must use infinite projection matrix."
zfar: float; // Number
// 12 OK
/// "description": "The floating-point distance to the near clipping plane."
/// "gltf_detailedDescription": "The floating-point distance to the near clipping plane."
znear: float; // Number
// 14 OK
}
/// "description": "Specifies if the camera uses a perspective or orthographic projection."
/// "gltf_detailedDescription": "Specifies if the camera uses a perspective or orthographic projection. Based on this, either the camera's `perspective` or `orthographic` property will be defined."
enum CameraType: short {//string
perspective,
orthographic,
}
table Camera {
/// Dictionary object with extension-specific objects.
extensions: [ubyte](flexbuffer);
/// Application-specific data.
extras: [ubyte](flexbuffer);
/// "description": "Specifies if the camera uses a perspective or orthographic projection."
/// "gltf_detailedDescription": "Specifies if the camera uses a perspective or orthographic projection. Based on this, either the camera's `perspective` or `orthographic` property will be defined."
type: CameraType;
// 8 OK
/// The user-defined name of this object.
/// gltf_detailedDescription: The user-defined name of this object. This is not necessarily unique, e.g., an accessor and a buffer could have the same name, or two accessors could even have the same name.
name: string;
// 10
/// "description": "A perspective camera containing properties to create a perspective projection matrix."
perspective: CameraPerspective;
// 12 OK
/// "description": "An orthographic camera containing properties to create an orthographic projection matrix."
orthographic: CameraOrthographic;
// 14
}
///----------------------------------------------------------------------------
/// Image
/// "description": "Image data used to create a texture. Image can be referenced by URI or `bufferView` index. `mimeType` is required in the latter case."
table Image {
/// Dictionary object with extension-specific objects.
extensions: [ubyte](flexbuffer);
/// Application-specific data.
extras: [ubyte](flexbuffer);
/// "description": "The index of the bufferView that contains the image. Use this instead of the image's uri property."
bufferView: int = -1; //glTFid
/// "description": "The image's MIME type."
/// NOTE: JsonSchema states enum { "image/jpeg" "image/png" }, but this type of variables are not possible with flatbuffers, hence keeping the mimeType as string
mimeType: string;
// 10 OK
/// The user-defined name of this object.
/// gltf_detailedDescription: The user-defined name of this object. This is not necessarily unique, e.g., an accessor and a buffer could have the same name, or two accessors could even have the same name.
name: string;
// 12 OK
/// "description": "The uri of the image."
/// "gltf_detailedDescription": "The uri of the image. Relative paths are relative to the .gltf file. Instead of referencing an external file, the uri can also be a data-uri. The image format must be jpg or png."
/// "gltf_uriType": "image"
/// "format": "uriref"
uri: string;
// 14 OK
}
///----------------------------------------------------------------------------
/// Texture Info
/// "description": "Reference to a texture."
table TextureInfo {
/// "description": "The index of the texture."
index: int = -1; //glTFId
/// "description": "The set index of texture's TEXCOORD attribute used for texture coordinate mapping."
/// "gltf_detailedDescription": "This integer value is used to construct a string in the format TEXCOORD_<set index> which is a reference to a key in mesh.primitives.attributes (e.g. A value of 0 corresponds to TEXCOORD_0)."
texCoord: int; //uint
/// Dictionary object with extension-specific objects.
extensions: [ubyte](flexbuffer);
/// Application-specific data.
extras: [ubyte](flexbuffer);
}
///----------------------------------------------------------------------------
/// Material Normal Texture Info
table MaterialNormalTextureInfo {
/// "description": "The scalar multiplier applied to each normal vector of the normal texture."
/// "gltf_detailedDescription": "The scalar multiplier applied to each normal vector of the texture. This value scales the normal vector using the formula: `scaledNormal = normalize((normalize(<sampled normal texture value>) * 2.0 - 1.0) * vec3(<normal scale>, <normal scale>, 1.0))`. This value is ignored if normalTexture is not specified. This value is linear."
scale: float = 1.0; // Number
///-- TextureInfo
/// "description": "The index of the texture."
index: int = -1; //glTFId
/// "description": "The set index of texture's TEXCOORD attribute used for texture coordinate mapping."
/// "gltf_detailedDescription": "This integer value is used to construct a string in the format TEXCOORD_<set index> which is a reference to a key in mesh.primitives.attributes (e.g. A value of 0 corresponds to TEXCOORD_0)."
texCoord: int; //uint
/// Dictionary object with extension-specific objects.
extensions: [ubyte](flexbuffer);
/// Application-specific data.
extras: [ubyte](flexbuffer);
}
/// Material Occlusion Texture Info
table MaterialOcclusionTextureInfo {
/// "description": "A scalar multiplier controlling the amount of occlusion applied."
/// "gltf_detailedDescription": "A scalar multiplier controlling the amount of occlusion applied. A value of 0.0 means no occlusion. A value of 1.0 means full occlusion. This value affects the resulting color using the formula: `occludedColor = lerp(color, color * <sampled occlusion texture value>, <occlusion strength>)`. This value is ignored if the corresponding texture is not specified. This value is linear.
strength: float = 1.0; // Number
/// "description": "The index of the texture."
index: int = -1; //glTFId
/// "description": "The set index of texture's TEXCOORD attribute used for texture coordinate mapping."
/// "gltf_detailedDescription": "This integer value is used to construct a string in the format TEXCOORD_<set index> which is a reference to a key in mesh.primitives.attributes (e.g. A value of 0 corresponds to TEXCOORD_0)."
texCoord: int; //uint
/// Dictionary object with extension-specific objects.
extensions: [ubyte](flexbuffer);
/// Application-specific data.
extras: [ubyte](flexbuffer);
}
/// Material PBR Metallic Roughness
/// "description": "A set of parameter values that are used to define the metallic-roughness material model from Physically-Based Rendering (PBR) methodology."
table MaterialPbrMetallicRoughness {
/// "description": "The material's base color factor."
/// "gltf_detailedDescription": "The RGBA components of the base color of the material. The fourth component (A) is the alpha coverage of the material. The `alphaMode` property specifies how alpha is interpreted. These values are linear. If a baseColorTexture is specified, this value is multiplied with the texel values."
/// "minItems": 4
/// "maxItems": 4
/// "default": [ 1.0, 1.0, 1.0, 1.0 ]
baseColorFactor: [float]; // Number
/// "description": "The base color texture."
/// "gltf_detailedDescription": "The base color texture. This texture contains RGB(A) components in sRGB color space. The first three components (RGB) specify the base color of the material. If the fourth component (A) is present, it represents the alpha coverage of the material. Otherwise, an alpha of 1.0 is assumed. The `alphaMode` property specifies how alpha is interpreted. The stored texels must not be premultiplied."
baseColorTexture: TextureInfo;
/// "description": "The metalness of the material."
/// "gltf_detailedDescription": "The metalness of the material. A value of 1.0 means the material is a metal. A value of 0.0 means the material is a dielectric. Values in between are for blending between metals and dielectrics such as dirty metallic surfaces. This value is linear. If a metallicRoughnessTexture is specified, this value is multiplied with the metallic texel values."
// "minimum": 0.0
// "maximum": 1.0
// "default": 1.0
metallicFactor: float = 1.0; // Number
/// "description": "The roughness of the material."
/// "gltf_detailedDescription": "The roughness of the material. A value of 1.0 means the material is completely rough. A value of 0.0 means the material is completely smooth. This value is linear. If a metallicRoughnessTexture is specified, this value is multiplied with the roughness texel values."
/// "minimum": 0.0
/// "maximum": 1.0
/// "default": 1.0
roughnessFactor: float = 1.0; // Number
/// "description": "The metallic-roughness texture."
/// "gltf_detailedDescription": "The metallic-roughness texture. The metalness values are sampled from the B channel. The roughness values are sampled from the G channel. These values are linear. If other channels are present (R or A), they are ignored for metallic-roughness calculations."
metallicRoughnessTexture: TextureInfo;
/// Dictionary object with extension-specific objects.
extensions: [ubyte](flexbuffer);
/// Application-specific data.
extras: [ubyte](flexbuffer);
}
/// "description": "The alpha rendering mode of the material."
/// "gltf_detailedDescription": "The material's alpha rendering mode enumeration specifying the interpretation of the alpha value of the main factor and texture."
enum MaterialAlphaMode: short {
/// "description": "The alpha value is ignored and the rendered output is fully opaque."
OPAQUE,
/// "description": "The rendered output is either fully opaque or fully transparent depending on the alpha value and the specified alpha cutoff value."
MASK,
/// "description": "The alpha value is used to composite the source and destination areas. The rendered output is combined with the background using the normal painting operation (i.e. the Porter and Duff over operator)."
BLEND,
}
/// Material
/// "description": "The material appearance of a primitive."
table Material {
/// "description": "A set of parameter values that are used to define the metallic-roughness material model from Physically-Based Rendering (PBR) methodology. When not specified, all the default values of `pbrMetallicRoughness` apply."
pbrMetallicRoughness: MaterialPbrMetallicRoughness;
// 4
/// "description": "The normal map texture."
/// "gltf_detailedDescription": "A tangent space normal map. The texture contains RGB components in linear space. Each texel represents the XYZ components of a normal vector in tangent space. Red [0 to 255] maps to X [-1 to 1]. Green [0 to 255] maps to Y [-1 to 1]. Blue [128 to 255] maps to Z [1/255 to 1]. The normal vectors use OpenGL conventions where +X is right and +Y is up. +Z points toward the viewer. In GLSL, this vector would be unpacked like so: `float3 normalVector = tex2D(<sampled normal map texture value>, texCoord) * 2 - 1`."
normalTexture: MaterialNormalTextureInfo;
// 6
/// "description": "The occlusion map texture."
/// "gltf_detailedDescription": "The occlusion map texture. The occlusion values are sampled from the R channel. Higher values indicate areas that should receive full indirect lighting and lower values indicate no indirect lighting. These values are linear. If other channels are present (GBA), they are ignored for occlusion calculations."
occlusionTexture: MaterialOcclusionTextureInfo;
// 8
/// "description": "The emissive map texture."
/// "gltf_detailedDescription": "The emissive map controls the color and intensity of the light being emitted by the material. This texture contains RGB components in sRGB color space. If a fourth component (A) is present, it is ignored."
emissiveTexture: TextureInfo;
// 10
/// "description": "The emissive color of the material."
/// "gltf_detailedDescription": "The RGB components of the emissive color of the material. These values are linear. If an emissiveTexture is specified, this value is multiplied with the texel values."
/// "minItems": 3,
/// "maxItems": 3,
/// "default": [ 0.0, 0.0, 0.0 ],
emissiveFactor: [float]; // Number
// 12
/// Dictionary object with extension-specific objects.
extensions: [ubyte](flexbuffer);
// 14 OK
/// Application-specific data.
extras: [ubyte](flexbuffer);
// 16 OK
/// "description": "Specifies whether the material is double sided."
/// "gltf_detailedDescription": "Specifies whether the material is double sided. When this value is false, back-face culling is enabled. When this value is true, back-face culling is disabled and double sided lighting is enabled. The back-face must have its normals reversed before the lighting equation is evaluated."
doubleSided: bool = false;
// 18
/// The user-defined name of this object.
/// gltf_detailedDescription: The user-defined name of this object. This is not necessarily unique, e.g., an accessor and a buffer could have the same name, or two accessors could even have the same name.
name: string;
// 20
/// "description": "The alpha cutoff value of the material."
/// "gltf_detailedDescription": "Specifies the cutoff threshold when in `MASK` mode. If the alpha value is greater than or equal to this value then it is rendered as fully opaque, otherwise, it is rendered as fully transparent. A value greater than 1.0 will render the entire material as fully transparent. This value is ignored for other modes."
alphaCutoff: float = 0.5; // Number
// 22
/// "description": "The alpha rendering mode of the material."
/// "gltf_detailedDescription": "The material's alpha rendering mode enumeration specifying the interpretation of the alpha value of the main factor and texture."
alphaMode: MaterialAlphaMode = OPAQUE;
// 24
}
///----------------------------------------------------------------------------
enum MeshPrimitiveMode: ubyte {
POINTS = 0,
LINES = 1,
LINE_LOOP = 2,
LINE_STRIP = 3,
TRIANGLES = 4,
TRIANGLE_STRIP = 5,
TRIANGLE_FAN = 6,
}
table MeshPrimitiveAttribute {
id: string(key);
value: int = -1; //glTFid
}
/// Mesh Primitive
/// "description": "Geometry to be rendered with the given material."
/// "gltf_webgl": "`drawElements()` and `drawArrays()`"
table MeshPrimitive {
/// "description": "A dictionary object, where each key corresponds to mesh attribute semantic and each value is the index of the accessor containing attribute's data."
///! NOTE: dictionary objects are not possible with flatbuffers (yet), hence this workaround
attributes: [ubyte](flexbuffer, required);
// 4 OK
/// Dictionary object with extension-specific objects.
extensions: [ubyte](flexbuffer);
// 6 OK
/// "description": "An array of Morph Targets, each Morph Target is a dictionary mapping attributes (only `POSITION`, `NORMAL`, and `TANGENT` supported) to their deviations in the Morph Target."
/// "description": "A dictionary object specifying attributes displacements in a Morph Target, where each key corresponds to one of the three supported attribute semantic (`POSITION`, `NORMAL`, or `TANGENT`) and each value is the index of the accessor containing the attribute displacements' data."
targets: [ubyte](flexbuffer);
// 8 OK
/// "description": "The index of the accessor that contains the indices."
/// "gltf_detailedDescription": "The index of the accessor that contains mesh indices. When this is not defined, the primitives should be rendered without indices using `drawArrays()`. When defined, the accessor must contain indices: the `bufferView` referenced by the accessor should have a `target` equal to 34963 (ELEMENT_ARRAY_BUFFER); `componentType` must be 5121 (UNSIGNED_BYTE), 5123 (UNSIGNED_SHORT) or 5125 (UNSIGNED_INT), the latter may require enabling additional hardware support; `type` must be `\"SCALAR\"`. For triangle primitives, the front face has a counter-clockwise (CCW) winding order."
indices: int = -1; //glTFid
// 10 OK
/// "description": "The index of the material to apply to this primitive when rendering."
material: int = -1; //glTFid
// 12 OK
/// "description": "The type of primitives to render."
/// "gltf_detailedDescription": "The type of primitives to render. All valid values correspond to WebGL enums."
mode: MeshPrimitiveMode = TRIANGLES;
// 14
/// Application-specific data.
extras: [ubyte](flexbuffer);
// 16
}
/// Mesh
/// "description": "A set of primitives to be rendered. A node can contain one mesh. A node's transform places the mesh in the scene."
table Mesh {
/// Dictionary object with extension-specific objects.
extensions: [ubyte](flexbuffer);
// 4
/// Application-specific data.
extras: [ubyte](flexbuffer);
// 6
/// The user-defined name of this object.
/// gltf_detailedDescription: The user-defined name of this object. This is not necessarily unique, e.g., an accessor and a buffer could have the same name, or two accessors could even have the same name.
name: string;
// 8 OK
/// "description": "An array of primitives, each defining geometry to be rendered with a material."
primitives: [MeshPrimitive](required);
// 10 OK
/// "description": "Array of weights to be applied to the Morph Targets."
weights: [float]; // Number
// 12
}
///----------------------------------------------------------------------------
/// Node
/// "description": "A node in the node hierarchy. When the node contains `skin`, all `mesh.primitives` must contain `JOINTS_0` and `WEIGHTS_0` attributes. A node can have either a `matrix` or any combination of `translation`/`rotation`/`scale` (TRS) properties. TRS properties are converted to matrices and postmultiplied in the `T * R * S` order to compose the transformation matrix; first the scale is applied to the vertices, then the rotation, and then the translation. If none are provided, the transform is the identity. When a node is targeted for animation (referenced by an animation.channel.target), only TRS properties may be present; `matrix` will not be present."
table Node {
/// "description": "The index of the camera referenced by this node."
camera: int = -1; //glTFid
// 4 OK
/// "description": "The indices of this node's children."
children: [int]; //glTFid
// 6 OK
/// Dictionary object with extension-specific objects.
extensions: [ubyte](flexbuffer);
/// Application-specific data.
extras: [ubyte](flexbuffer);
/// "description": "The weights of the instantiated Morph Target. Number of elements must match number of Morph Targets of used mesh."
/// "minItems": 1
weights: [float]; // Number
/// "description": "The index of the mesh in this node."
mesh: int = -1; //glTFid
// 14 OK
/// The user-defined name of this object.
/// gltf_detailedDescription: The user-defined name of this object. This is not necessarily unique, e.g., an accessor and a buffer could have the same name, or two accessors could even have the same name.
name: string;
// 16 OK
/// "description": "The node's unit quaternion rotation in the order (x, y, z, w), where w is the scalar."
/// "minimum": -1.0
/// "maximum": 1.0
/// "minItems": 4
/// "maxItems": 4
/// "default": [ 0.0, 0.0, 0.0, 1.0 ]
rotation: [float]; // Number
// 18 OK
/// "description": "The node's non-uniform scale."
/// "minItems": 3
/// "maxItems": 3
/// "default": [ 1.0, 1.0, 1.0 ]
scale: [float]; // Number
// 20 OK
/// "description": "The index of the skin referenced by this node."
skin: int = -1; //glTFid
// 22 OK
/// "description": "The node's translation."
/// "minItems": 3
/// "maxItems": 3
/// "default": [ 0.0, 0.0, 0.0 ]
translation: [float]; // Number
// 24 OK
/// "description": "A floating-point 4x4 transformation matrix stored in column-major order."
/// "gltf_detailedDescription": "A floating-point 4x4 transformation matrix stored in column-major order."
/// "gltf_webgl": "`uniformMatrix4fv()` with the transpose parameter equal to false"
/// "minItems": 16
/// "maxItems": 16
/// "default": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ],
matrix: [float]; // Number
}
///----------------------------------------------------------------------------
/// Scene
/// "description": "The root nodes of a scene."
table Scene {
/// Dictionary object with extension-specific objects.
extensions: [ubyte](flexbuffer);
/// Application-specific data.
extras: [ubyte](flexbuffer);
/// The user-defined name of this object.
/// gltf_detailedDescription: The user-defined name of this object. This is not necessarily unique, e.g., an accessor and a buffer could have the same name, or two accessors could even have the same name.
name: string;
/// "description": "The indices of each root node."
nodes: [int]; //glTFid
// 10 OK
}
///----------------------------------------------------------------------------
/// "gltf_detailedDescription": "All valid values correspond to WebGL enums."
enum SamplerFilter: ushort {
NEAREST = 9728,
LINEAR = 9729,
NEAREST_MIPMAP_NEAREST = 9984,
LINEAR_MIPMAP_NEAREST = 9985,
NEAREST_MIPMAP_LINEAR = 9986,
LINEAR_MIPMAP_LINEAR = 9987,
}
/// "gltf_detailedDescription": "All valid values correspond to WebGL enums."
enum WrapMode: int {
REPEAT = 10497,
CLAMP_TO_EDGE = 33071,
MIRRORED_REPEAT = 33648,
}
/// Sampler
/// "description": "Texture sampler properties for filtering and wrapping modes."
/// "gltf_webgl": "`texParameterf()`"
table Sampler {
/// "description": "s wrapping mode."
/// "gltf_detailedDescription": "s wrapping mode. All valid values correspond to WebGL enums."
/// "gltf_webgl": "`texParameterf()` with pname equal to TEXTURE_WRAP_S"
wrapS: WrapMode = REPEAT;
// 4 OK
/// "description": "t wrapping mode."
/// "gltf_detailedDescription": "t wrapping mode. All valid values correspond to WebGL enums."
/// "gltf_webgl": "`texParameterf()` with pname equal to TEXTURE_WRAP_T"
wrapT: WrapMode = REPEAT;
// 6 OK
/// "description": "Magnification filter."
/// "gltf_detailedDescription": "Magnification filter. Valid values correspond to WebGL enums: `9728` (NEAREST) and `9729` (LINEAR)."
/// "gltf_webgl": "`texParameterf()` with pname equal to TEXTURE_MAG_FILTER"
magFilter: SamplerFilter = NEAREST;
// 8 OK
/// "description": "Minification filter."
/// "gltf_detailedDescription": "Minification filter. All valid values correspond to WebGL enums."
/// "gltf_webgl": "`texParameterf()` with pname equal to TEXTURE_MIN_FILTER"
minFilter: SamplerFilter = NEAREST;
// 10 OK
/// The user-defined name of this object.
/// gltf_detailedDescription: The user-defined name of this object. This is not necessarily unique, e.g., an accessor and a buffer could have the same name, or two accessors could even have the same name.
name: string;
/// Dictionary object with extension-specific objects.
extensions: [ubyte](flexbuffer);
/// Application-specific data.
extras: [ubyte](flexbuffer);
}
///----------------------------------------------------------------------------
/// Texture
/// "description": "A texture and its sampler."
/// "gltf_webgl": "`createTexture()`, `deleteTexture()`, `bindTexture()`, `texImage2D()`, and `texParameterf()`"
table Texture {
/// The user-defined name of this object.
/// gltf_detailedDescription: The user-defined name of this object. This is not necessarily unique, e.g., an accessor and a buffer could have the same name, or two accessors could even have the same name.
name: string;
/// Dictionary object with extension-specific objects.
extensions: [ubyte](flexbuffer);
/// Application-specific data.
extras: [ubyte](flexbuffer);
/// "description": "The index of the sampler used by this texture. When undefined, a sampler with repeat wrapping and auto filtering should be used."
sampler: int = -1; //glTFid
// 10 OK
/// "description": "The index of the image used by this texture."
source: int = -1; //glTFid
// 12 OK
}
///----------------------------------------------------------------------------
/// Skin
/// "description": "Joints and matrices defining a skin."
table Skin {
/// Dictionary object with extension-specific objects.
extensions: [ubyte](flexbuffer);
/// Application-specific data.
extras: [ubyte](flexbuffer);
/// "description": "The index of the accessor containing the floating-point 4x4 inverse-bind matrices. The default is that each matrix is a 4x4 identity matrix, which implies that inverse-bind matrices were pre-applied."
inverseBindMatrices: int = -1; //glTFid
// 8 OK
/// "description": "Indices of skeleton nodes, used as joints in this skin."
/// "gltf_detailedDescription": "Indices of skeleton nodes, used as joints in this skin. The array length must be the same as the `count` property of the `inverseBindMatrices` accessor (when defined)."
joints: [int](required); //glTFid
// 10 OK
/// The user-defined name of this object.
/// gltf_detailedDescription: The user-defined name of this object. This is not necessarily unique, e.g., an accessor and a buffer could have the same name, or two accessors could even have the same name.
name: string;
// 12 OK
/// "description": "The index of the node used as a skeleton root. When undefined, joints transforms resolve to scene root."
skeleton: int = -1; //glTFid
}
///----------------------------------------------------------------------------
/// The root object for a glTF asset.
table Root {
/// An array of accessors.
/// gltf_detailedDescription: An array of accessors. An accessor is a typed view into a bufferView.
accessors: [Accessor];
// 4 OK
/// An array of keyframe animations.
animations: [Animation];
// 6 OK
/// Metadata about the glTF asset.
asset: Asset;
// 8 OK
/// An array of bufferViews.
/// gltf_detailedDescription: An array of bufferViews. A bufferView is a view into a buffer generally representing a subset of the buffer.
bufferViews: [BufferView];
// 10 OK
/// An array of buffers.
/// gltf_detailedDescription: An array of buffers. A buffer points to binary geometry, animation, or skins.
buffers: [Buffer];
// 12 OK
/// An array of cameras.
/// gltf_detailedDescription: An array of cameras. A camera defines a projection matrix.
cameras: [Camera];
// 14 OK
///-- glTFProperty
/// Dictionary object with extension-specific objects.
extensions: [ubyte](flexbuffer);
// 16
/// Names of glTF extensions required to properly load this asset.
extensionsRequired: [string];
// 18 OK
/// Names of glTF extensions used somewhere in this asset.
extensionsUsed: [string];
// 20 OK
/// Application-specific data.
extras: [ubyte](flexbuffer);
// 22
/// An array of images.
/// gltf_detailedDescription: An array of images. An image defines data used to create a texture.
images: [Image];
// 24 OK
/// An array of materials.
/// gltf_detailedDescription: An array of materials. A material defines the appearance of a primitive.
materials: [Material];
// 26 OK
/// An array of meshes.
/// gltf_detailedDescription: An array of meshes. A mesh is a set of primitives to be rendered.
meshes: [Mesh];
// 28 OK
/// An array of nodes.
nodes: [Node];
// 30 OK