@babylonjs/serializers 5.0.0-rc.6 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/OBJ/index.d.ts +1 -1
  2. package/OBJ/index.js +1 -1
  3. package/OBJ/objSerializer.d.ts +21 -21
  4. package/OBJ/objSerializer.js +174 -174
  5. package/OBJ/objSerializer.js.map +1 -1
  6. package/glTF/2.0/Extensions/KHR_lights_punctual.d.ts +41 -41
  7. package/glTF/2.0/Extensions/KHR_lights_punctual.js +189 -189
  8. package/glTF/2.0/Extensions/KHR_lights_punctual.js.map +1 -1
  9. package/glTF/2.0/Extensions/KHR_materials_clearcoat.d.ts +24 -24
  10. package/glTF/2.0/Extensions/KHR_materials_clearcoat.js +90 -90
  11. package/glTF/2.0/Extensions/KHR_materials_clearcoat.js.map +1 -1
  12. package/glTF/2.0/Extensions/KHR_materials_sheen.d.ts +24 -24
  13. package/glTF/2.0/Extensions/KHR_materials_sheen.js +73 -73
  14. package/glTF/2.0/Extensions/KHR_materials_sheen.js.map +1 -1
  15. package/glTF/2.0/Extensions/KHR_materials_unlit.d.ts +20 -20
  16. package/glTF/2.0/Extensions/KHR_materials_unlit.js +51 -51
  17. package/glTF/2.0/Extensions/KHR_materials_unlit.js.map +1 -1
  18. package/glTF/2.0/Extensions/KHR_texture_transform.d.ts +30 -30
  19. package/glTF/2.0/Extensions/KHR_texture_transform.js +137 -137
  20. package/glTF/2.0/Extensions/KHR_texture_transform.js.map +1 -1
  21. package/glTF/2.0/Extensions/index.d.ts +5 -5
  22. package/glTF/2.0/Extensions/index.js +5 -5
  23. package/glTF/2.0/glTFAnimation.d.ts +206 -205
  24. package/glTF/2.0/glTFAnimation.js +852 -852
  25. package/glTF/2.0/glTFAnimation.js.map +1 -1
  26. package/glTF/2.0/glTFData.d.ts +19 -19
  27. package/glTF/2.0/glTFData.js +52 -52
  28. package/glTF/2.0/glTFExporter.d.ts +456 -455
  29. package/glTF/2.0/glTFExporter.js +1975 -1972
  30. package/glTF/2.0/glTFExporter.js.map +1 -1
  31. package/glTF/2.0/glTFExporterExtension.d.ts +74 -74
  32. package/glTF/2.0/glTFExporterExtension.js +3 -3
  33. package/glTF/2.0/glTFExporterExtension.js.map +1 -1
  34. package/glTF/2.0/glTFMaterialExporter.d.ts +208 -207
  35. package/glTF/2.0/glTFMaterialExporter.js +1114 -1110
  36. package/glTF/2.0/glTFMaterialExporter.js.map +1 -1
  37. package/glTF/2.0/glTFSerializer.d.ts +60 -60
  38. package/glTF/2.0/glTFSerializer.js +62 -62
  39. package/glTF/2.0/glTFSerializer.js.map +1 -1
  40. package/glTF/2.0/glTFUtilities.d.ts +99 -97
  41. package/glTF/2.0/glTFUtilities.js +196 -196
  42. package/glTF/2.0/glTFUtilities.js.map +1 -1
  43. package/glTF/2.0/index.d.ts +8 -8
  44. package/glTF/2.0/index.js +9 -8
  45. package/glTF/2.0/index.js.map +1 -1
  46. package/glTF/2.0/shaders/textureTransform.fragment.d.ts +5 -5
  47. package/glTF/2.0/shaders/textureTransform.fragment.js +8 -8
  48. package/glTF/glTFFileExporter.d.ts +20 -20
  49. package/glTF/glTFFileExporter.js +3 -3
  50. package/glTF/index.d.ts +2 -2
  51. package/glTF/index.js +3 -2
  52. package/glTF/index.js.map +1 -1
  53. package/index.d.ts +3 -3
  54. package/index.js +4 -3
  55. package/index.js.map +1 -1
  56. package/legacy/legacy-glTF2Serializer.d.ts +2 -2
  57. package/legacy/legacy-glTF2Serializer.js +44 -43
  58. package/legacy/legacy-glTF2Serializer.js.map +1 -1
  59. package/legacy/legacy-objSerializer.d.ts +1 -1
  60. package/legacy/legacy-objSerializer.js +13 -12
  61. package/legacy/legacy-objSerializer.js.map +1 -1
  62. package/legacy/legacy-stlSerializer.d.ts +1 -1
  63. package/legacy/legacy-stlSerializer.js +13 -12
  64. package/legacy/legacy-stlSerializer.js.map +1 -1
  65. package/legacy/legacy.d.ts +4 -4
  66. package/legacy/legacy.js +6 -5
  67. package/legacy/legacy.js.map +1 -1
  68. package/license.md +71 -0
  69. package/package.json +25 -6
  70. package/stl/index.d.ts +1 -1
  71. package/stl/index.js +1 -1
  72. package/stl/stlSerializer.d.ts +17 -17
  73. package/stl/stlSerializer.js +107 -107
  74. package/stl/stlSerializer.js.map +1 -1
@@ -1,197 +1,197 @@
1
- import { Vector3 } from "@babylonjs/core/Maths/math.vector.js";
2
- /**
3
- * @hidden
4
- */
5
- var _GLTFUtilities = /** @class */ (function () {
6
- function _GLTFUtilities() {
7
- }
8
- /**
9
- * Creates a buffer view based on the supplied arguments
10
- * @param bufferIndex index value of the specified buffer
11
- * @param byteOffset byte offset value
12
- * @param byteLength byte length of the bufferView
13
- * @param byteStride byte distance between conequential elements
14
- * @param name name of the buffer view
15
- * @returns bufferView for glTF
16
- */
17
- _GLTFUtilities._CreateBufferView = function (bufferIndex, byteOffset, byteLength, byteStride, name) {
18
- var bufferview = { buffer: bufferIndex, byteLength: byteLength };
19
- if (byteOffset) {
20
- bufferview.byteOffset = byteOffset;
21
- }
22
- if (name) {
23
- bufferview.name = name;
24
- }
25
- if (byteStride) {
26
- bufferview.byteStride = byteStride;
27
- }
28
- return bufferview;
29
- };
30
- /**
31
- * Creates an accessor based on the supplied arguments
32
- * @param bufferviewIndex The index of the bufferview referenced by this accessor
33
- * @param name The name of the accessor
34
- * @param type The type of the accessor
35
- * @param componentType The datatype of components in the attribute
36
- * @param count The number of attributes referenced by this accessor
37
- * @param byteOffset The offset relative to the start of the bufferView in bytes
38
- * @param min Minimum value of each component in this attribute
39
- * @param max Maximum value of each component in this attribute
40
- * @returns accessor for glTF
41
- */
42
- _GLTFUtilities._CreateAccessor = function (bufferviewIndex, name, type, componentType, count, byteOffset, min, max) {
43
- var accessor = { name: name, bufferView: bufferviewIndex, componentType: componentType, count: count, type: type };
44
- if (min != null) {
45
- accessor.min = min;
46
- }
47
- if (max != null) {
48
- accessor.max = max;
49
- }
50
- if (byteOffset != null) {
51
- accessor.byteOffset = byteOffset;
52
- }
53
- return accessor;
54
- };
55
- /**
56
- * Calculates the minimum and maximum values of an array of position floats
57
- * @param positions Positions array of a mesh
58
- * @param vertexStart Starting vertex offset to calculate min and max values
59
- * @param vertexCount Number of vertices to check for min and max values
60
- * @param convertToRightHandedSystem
61
- * @returns min number array and max number array
62
- */
63
- _GLTFUtilities._CalculateMinMaxPositions = function (positions, vertexStart, vertexCount, convertToRightHandedSystem) {
64
- var min = [Infinity, Infinity, Infinity];
65
- var max = [-Infinity, -Infinity, -Infinity];
66
- var positionStrideSize = 3;
67
- var indexOffset;
68
- var position;
69
- var vector;
70
- if (vertexCount) {
71
- for (var i = vertexStart, length_1 = vertexStart + vertexCount; i < length_1; ++i) {
72
- indexOffset = positionStrideSize * i;
73
- position = Vector3.FromArray(positions, indexOffset);
74
- if (convertToRightHandedSystem) {
75
- _GLTFUtilities._GetRightHandedPositionVector3FromRef(position);
76
- }
77
- vector = position.asArray();
78
- for (var j = 0; j < positionStrideSize; ++j) {
79
- var num = vector[j];
80
- if (num < min[j]) {
81
- min[j] = num;
82
- }
83
- if (num > max[j]) {
84
- max[j] = num;
85
- }
86
- ++indexOffset;
87
- }
88
- }
89
- }
90
- return { min: min, max: max };
91
- };
92
- /**
93
- * Converts a new right-handed Vector3
94
- * @param vector vector3 array
95
- * @returns right-handed Vector3
96
- */
97
- _GLTFUtilities._GetRightHandedPositionVector3 = function (vector) {
98
- return new Vector3(vector.x, vector.y, -vector.z);
99
- };
100
- /**
101
- * Converts a Vector3 to right-handed
102
- * @param vector Vector3 to convert to right-handed
103
- */
104
- _GLTFUtilities._GetRightHandedPositionVector3FromRef = function (vector) {
105
- vector.z *= -1;
106
- };
107
- /**
108
- * Converts a three element number array to right-handed
109
- * @param vector number array to convert to right-handed
110
- */
111
- _GLTFUtilities._GetRightHandedPositionArray3FromRef = function (vector) {
112
- vector[2] *= -1;
113
- };
114
- /**
115
- * Converts a new right-handed Vector3
116
- * @param vector vector3 array
117
- * @returns right-handed Vector3
118
- */
119
- _GLTFUtilities._GetRightHandedNormalVector3 = function (vector) {
120
- return new Vector3(vector.x, vector.y, -vector.z);
121
- };
122
- /**
123
- * Converts a Vector3 to right-handed
124
- * @param vector Vector3 to convert to right-handed
125
- */
126
- _GLTFUtilities._GetRightHandedNormalVector3FromRef = function (vector) {
127
- vector.z *= -1;
128
- };
129
- /**
130
- * Converts a three element number array to right-handed
131
- * @param vector number array to convert to right-handed
132
- */
133
- _GLTFUtilities._GetRightHandedNormalArray3FromRef = function (vector) {
134
- vector[2] *= -1;
135
- };
136
- /**
137
- * Converts a Vector4 to right-handed
138
- * @param vector Vector4 to convert to right-handed
139
- */
140
- _GLTFUtilities._GetRightHandedVector4FromRef = function (vector) {
141
- vector.z *= -1;
142
- vector.w *= -1;
143
- };
144
- /**
145
- * Converts a Vector4 to right-handed
146
- * @param vector Vector4 to convert to right-handed
147
- */
148
- _GLTFUtilities._GetRightHandedArray4FromRef = function (vector) {
149
- vector[2] *= -1;
150
- vector[3] *= -1;
151
- };
152
- /**
153
- * Converts a Quaternion to right-handed
154
- * @param quaternion Source quaternion to convert to right-handed
155
- */
156
- _GLTFUtilities._GetRightHandedQuaternionFromRef = function (quaternion) {
157
- quaternion.x *= -1;
158
- quaternion.y *= -1;
159
- };
160
- /**
161
- * Converts a Quaternion to right-handed
162
- * @param quaternion Source quaternion to convert to right-handed
163
- */
164
- _GLTFUtilities._GetRightHandedQuaternionArrayFromRef = function (quaternion) {
165
- quaternion[0] *= -1;
166
- quaternion[1] *= -1;
167
- };
168
- _GLTFUtilities._NormalizeTangentFromRef = function (tangent) {
169
- var length = Math.sqrt(tangent.x * tangent.x + tangent.y * tangent.y + tangent.z * tangent.z);
170
- if (length > 0) {
171
- tangent.x /= length;
172
- tangent.y /= length;
173
- tangent.z /= length;
174
- }
175
- };
176
- _GLTFUtilities._GetDataAccessorElementCount = function (accessorType) {
177
- switch (accessorType) {
178
- case "MAT2" /* MAT2 */:
179
- return 4;
180
- case "MAT3" /* MAT3 */:
181
- return 9;
182
- case "MAT4" /* MAT4 */:
183
- return 16;
184
- case "SCALAR" /* SCALAR */:
185
- return 1;
186
- case "VEC2" /* VEC2 */:
187
- return 2;
188
- case "VEC3" /* VEC3 */:
189
- return 3;
190
- case "VEC4" /* VEC4 */:
191
- return 4;
192
- }
193
- };
194
- return _GLTFUtilities;
195
- }());
196
- export { _GLTFUtilities };
1
+ import { Vector3 } from "@babylonjs/core/Maths/math.vector.js";
2
+ /**
3
+ * @hidden
4
+ */
5
+ var _GLTFUtilities = /** @class */ (function () {
6
+ function _GLTFUtilities() {
7
+ }
8
+ /**
9
+ * Creates a buffer view based on the supplied arguments
10
+ * @param bufferIndex index value of the specified buffer
11
+ * @param byteOffset byte offset value
12
+ * @param byteLength byte length of the bufferView
13
+ * @param byteStride byte distance between conequential elements
14
+ * @param name name of the buffer view
15
+ * @returns bufferView for glTF
16
+ */
17
+ _GLTFUtilities._CreateBufferView = function (bufferIndex, byteOffset, byteLength, byteStride, name) {
18
+ var bufferview = { buffer: bufferIndex, byteLength: byteLength };
19
+ if (byteOffset) {
20
+ bufferview.byteOffset = byteOffset;
21
+ }
22
+ if (name) {
23
+ bufferview.name = name;
24
+ }
25
+ if (byteStride) {
26
+ bufferview.byteStride = byteStride;
27
+ }
28
+ return bufferview;
29
+ };
30
+ /**
31
+ * Creates an accessor based on the supplied arguments
32
+ * @param bufferviewIndex The index of the bufferview referenced by this accessor
33
+ * @param name The name of the accessor
34
+ * @param type The type of the accessor
35
+ * @param componentType The datatype of components in the attribute
36
+ * @param count The number of attributes referenced by this accessor
37
+ * @param byteOffset The offset relative to the start of the bufferView in bytes
38
+ * @param min Minimum value of each component in this attribute
39
+ * @param max Maximum value of each component in this attribute
40
+ * @returns accessor for glTF
41
+ */
42
+ _GLTFUtilities._CreateAccessor = function (bufferviewIndex, name, type, componentType, count, byteOffset, min, max) {
43
+ var accessor = { name: name, bufferView: bufferviewIndex, componentType: componentType, count: count, type: type };
44
+ if (min != null) {
45
+ accessor.min = min;
46
+ }
47
+ if (max != null) {
48
+ accessor.max = max;
49
+ }
50
+ if (byteOffset != null) {
51
+ accessor.byteOffset = byteOffset;
52
+ }
53
+ return accessor;
54
+ };
55
+ /**
56
+ * Calculates the minimum and maximum values of an array of position floats
57
+ * @param positions Positions array of a mesh
58
+ * @param vertexStart Starting vertex offset to calculate min and max values
59
+ * @param vertexCount Number of vertices to check for min and max values
60
+ * @param convertToRightHandedSystem
61
+ * @returns min number array and max number array
62
+ */
63
+ _GLTFUtilities._CalculateMinMaxPositions = function (positions, vertexStart, vertexCount, convertToRightHandedSystem) {
64
+ var min = [Infinity, Infinity, Infinity];
65
+ var max = [-Infinity, -Infinity, -Infinity];
66
+ var positionStrideSize = 3;
67
+ var indexOffset;
68
+ var position;
69
+ var vector;
70
+ if (vertexCount) {
71
+ for (var i = vertexStart, length_1 = vertexStart + vertexCount; i < length_1; ++i) {
72
+ indexOffset = positionStrideSize * i;
73
+ position = Vector3.FromArray(positions, indexOffset);
74
+ if (convertToRightHandedSystem) {
75
+ _GLTFUtilities._GetRightHandedPositionVector3FromRef(position);
76
+ }
77
+ vector = position.asArray();
78
+ for (var j = 0; j < positionStrideSize; ++j) {
79
+ var num = vector[j];
80
+ if (num < min[j]) {
81
+ min[j] = num;
82
+ }
83
+ if (num > max[j]) {
84
+ max[j] = num;
85
+ }
86
+ ++indexOffset;
87
+ }
88
+ }
89
+ }
90
+ return { min: min, max: max };
91
+ };
92
+ /**
93
+ * Converts a new right-handed Vector3
94
+ * @param vector vector3 array
95
+ * @returns right-handed Vector3
96
+ */
97
+ _GLTFUtilities._GetRightHandedPositionVector3 = function (vector) {
98
+ return new Vector3(vector.x, vector.y, -vector.z);
99
+ };
100
+ /**
101
+ * Converts a Vector3 to right-handed
102
+ * @param vector Vector3 to convert to right-handed
103
+ */
104
+ _GLTFUtilities._GetRightHandedPositionVector3FromRef = function (vector) {
105
+ vector.z *= -1;
106
+ };
107
+ /**
108
+ * Converts a three element number array to right-handed
109
+ * @param vector number array to convert to right-handed
110
+ */
111
+ _GLTFUtilities._GetRightHandedPositionArray3FromRef = function (vector) {
112
+ vector[2] *= -1;
113
+ };
114
+ /**
115
+ * Converts a new right-handed Vector3
116
+ * @param vector vector3 array
117
+ * @returns right-handed Vector3
118
+ */
119
+ _GLTFUtilities._GetRightHandedNormalVector3 = function (vector) {
120
+ return new Vector3(vector.x, vector.y, -vector.z);
121
+ };
122
+ /**
123
+ * Converts a Vector3 to right-handed
124
+ * @param vector Vector3 to convert to right-handed
125
+ */
126
+ _GLTFUtilities._GetRightHandedNormalVector3FromRef = function (vector) {
127
+ vector.z *= -1;
128
+ };
129
+ /**
130
+ * Converts a three element number array to right-handed
131
+ * @param vector number array to convert to right-handed
132
+ */
133
+ _GLTFUtilities._GetRightHandedNormalArray3FromRef = function (vector) {
134
+ vector[2] *= -1;
135
+ };
136
+ /**
137
+ * Converts a Vector4 to right-handed
138
+ * @param vector Vector4 to convert to right-handed
139
+ */
140
+ _GLTFUtilities._GetRightHandedVector4FromRef = function (vector) {
141
+ vector.z *= -1;
142
+ vector.w *= -1;
143
+ };
144
+ /**
145
+ * Converts a Vector4 to right-handed
146
+ * @param vector Vector4 to convert to right-handed
147
+ */
148
+ _GLTFUtilities._GetRightHandedArray4FromRef = function (vector) {
149
+ vector[2] *= -1;
150
+ vector[3] *= -1;
151
+ };
152
+ /**
153
+ * Converts a Quaternion to right-handed
154
+ * @param quaternion Source quaternion to convert to right-handed
155
+ */
156
+ _GLTFUtilities._GetRightHandedQuaternionFromRef = function (quaternion) {
157
+ quaternion.x *= -1;
158
+ quaternion.y *= -1;
159
+ };
160
+ /**
161
+ * Converts a Quaternion to right-handed
162
+ * @param quaternion Source quaternion to convert to right-handed
163
+ */
164
+ _GLTFUtilities._GetRightHandedQuaternionArrayFromRef = function (quaternion) {
165
+ quaternion[0] *= -1;
166
+ quaternion[1] *= -1;
167
+ };
168
+ _GLTFUtilities._NormalizeTangentFromRef = function (tangent) {
169
+ var length = Math.sqrt(tangent.x * tangent.x + tangent.y * tangent.y + tangent.z * tangent.z);
170
+ if (length > 0) {
171
+ tangent.x /= length;
172
+ tangent.y /= length;
173
+ tangent.z /= length;
174
+ }
175
+ };
176
+ _GLTFUtilities._GetDataAccessorElementCount = function (accessorType) {
177
+ switch (accessorType) {
178
+ case "MAT2" /* MAT2 */:
179
+ return 4;
180
+ case "MAT3" /* MAT3 */:
181
+ return 9;
182
+ case "MAT4" /* MAT4 */:
183
+ return 16;
184
+ case "SCALAR" /* SCALAR */:
185
+ return 1;
186
+ case "VEC2" /* VEC2 */:
187
+ return 2;
188
+ case "VEC3" /* VEC3 */:
189
+ return 3;
190
+ case "VEC4" /* VEC4 */:
191
+ return 4;
192
+ }
193
+ };
194
+ return _GLTFUtilities;
195
+ }());
196
+ export { _GLTFUtilities };
197
197
  //# sourceMappingURL=glTFUtilities.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"glTFUtilities.js","sourceRoot":"","sources":["../../../../../../lts/serializers/generated/glTF/2.0/glTFUtilities.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAuB,6CAA+B;AAEtE;;GAEG;AACH;IAAA;IA6NA,CAAC;IA5NG;;;;;;;;OAQG;IACW,gCAAiB,GAA/B,UAAgC,WAAmB,EAAE,UAAkB,EAAE,UAAkB,EAAE,UAAmB,EAAE,IAAa;QAC3H,IAAM,UAAU,GAAgB,EAAE,MAAM,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE,CAAC;QAChF,IAAI,UAAU,EAAE;YACZ,UAAU,CAAC,UAAU,GAAG,UAAU,CAAC;SACtC;QACD,IAAI,IAAI,EAAE;YACN,UAAU,CAAC,IAAI,GAAG,IAAI,CAAC;SAC1B;QACD,IAAI,UAAU,EAAE;YACZ,UAAU,CAAC,UAAU,GAAG,UAAU,CAAC;SACtC;QAED,OAAO,UAAU,CAAC;IACtB,CAAC;IAED;;;;;;;;;;;OAWG;IACW,8BAAe,GAA7B,UACI,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A0B;QACjE,QAAQ,YAAY,EAAE;YAClB;gBACI,OAAO,CAAC,CAAC;YACb;gBACI,OAAO,CAAC,CAAC;YACb;gBACI,OAAO,EAAE,CAAC;YACd;gBACI,OAAO,CAAC,CAAC;YACb;gBACI,OAAO,CAAC,CAAC;YACb;gBACI,OAAO,CAAC,CAAC;YACb;gBACI,OAAO,CAAC,CAAC;SAChB;IACL,CAAC;IACL,qBAAC;AAAD,CAAC,AA7ND,IA6NC","sourcesContent":["import { IBufferView, AccessorType, AccessorComponentType, IAccessor } from \"babylonjs-gltf2interface\";\r\n\r\nimport { FloatArray, Nullable } from \"core/types\";\r\nimport { Vector3, Vector4, Quaternion } from \"core/Maths/math.vector\";\r\n\r\n/**\r\n * @hidden\r\n */\r\nexport class _GLTFUtilities {\r\n /**\r\n * Creates a buffer view based on the supplied arguments\r\n * @param bufferIndex index value of the specified buffer\r\n * @param byteOffset byte offset value\r\n * @param byteLength byte length of the bufferView\r\n * @param byteStride byte distance between conequential elements\r\n * @param name name of the buffer view\r\n * @returns bufferView for glTF\r\n */\r\n public static _CreateBufferView(bufferIndex: number, byteOffset: number, byteLength: number, byteStride?: number, name?: string): IBufferView {\r\n const bufferview: IBufferView = { buffer: bufferIndex, byteLength: byteLength };\r\n if (byteOffset) {\r\n bufferview.byteOffset = byteOffset;\r\n }\r\n if (name) {\r\n bufferview.name = name;\r\n }\r\n if (byteStride) {\r\n bufferview.byteStride = byteStride;\r\n }\r\n\r\n return bufferview;\r\n }\r\n\r\n /**\r\n * Creates an accessor based on the supplied arguments\r\n * @param bufferviewIndex The index of the bufferview referenced by this accessor\r\n * @param name The name of the accessor\r\n * @param type The type of the accessor\r\n * @param componentType The datatype of components in the attribute\r\n * @param count The number of attributes referenced by this accessor\r\n * @param byteOffset The offset relative to the start of the bufferView in bytes\r\n * @param min Minimum value of each component in this attribute\r\n * @param max Maximum value of each component in this attribute\r\n * @returns accessor for glTF\r\n */\r\n public static _CreateAccessor(\r\n bufferviewIndex: number,\r\n name: string,\r\n type: AccessorType,\r\n componentType: AccessorComponentType,\r\n count: number,\r\n byteOffset: Nullable<number>,\r\n min: Nullable<number[]>,\r\n max: Nullable<number[]>\r\n ): IAccessor {\r\n const accessor: IAccessor = { name: name, bufferView: bufferviewIndex, componentType: componentType, count: count, type: type };\r\n\r\n if (min != null) {\r\n accessor.min = min;\r\n }\r\n if (max != null) {\r\n accessor.max = max;\r\n }\r\n if (byteOffset != null) {\r\n accessor.byteOffset = byteOffset;\r\n }\r\n\r\n return accessor;\r\n }\r\n\r\n /**\r\n * Calculates the minimum and maximum values of an array of position floats\r\n * @param positions Positions array of a mesh\r\n * @param vertexStart Starting vertex offset to calculate min and max values\r\n * @param vertexCount Number of vertices to check for min and max values\r\n * @param convertToRightHandedSystem\r\n * @returns min number array and max number array\r\n */\r\n public static _CalculateMinMaxPositions(\r\n positions: FloatArray,\r\n vertexStart: number,\r\n vertexCount: number,\r\n convertToRightHandedSystem: boolean\r\n ): { min: number[]; max: number[] } {\r\n const min = [Infinity, Infinity, Infinity];\r\n const max = [-Infinity, -Infinity, -Infinity];\r\n const positionStrideSize = 3;\r\n let indexOffset: number;\r\n let position: Vector3;\r\n let vector: number[];\r\n\r\n if (vertexCount) {\r\n for (let i = vertexStart, length = vertexStart + vertexCount; i < length; ++i) {\r\n indexOffset = positionStrideSize * i;\r\n\r\n position = Vector3.FromArray(positions, indexOffset);\r\n if (convertToRightHandedSystem) {\r\n _GLTFUtilities._GetRightHandedPositionVector3FromRef(position);\r\n }\r\n vector = position.asArray();\r\n\r\n for (let j = 0; j < positionStrideSize; ++j) {\r\n const num = vector[j];\r\n if (num < min[j]) {\r\n min[j] = num;\r\n }\r\n if (num > max[j]) {\r\n max[j] = num;\r\n }\r\n ++indexOffset;\r\n }\r\n }\r\n }\r\n return { min, max };\r\n }\r\n\r\n /**\r\n * Converts a new right-handed Vector3\r\n * @param vector vector3 array\r\n * @returns right-handed Vector3\r\n */\r\n public static _GetRightHandedPositionVector3(vector: Vector3): Vector3 {\r\n return new Vector3(vector.x, vector.y, -vector.z);\r\n }\r\n\r\n /**\r\n * Converts a Vector3 to right-handed\r\n * @param vector Vector3 to convert to right-handed\r\n */\r\n public static _GetRightHandedPositionVector3FromRef(vector: Vector3) {\r\n vector.z *= -1;\r\n }\r\n\r\n /**\r\n * Converts a three element number array to right-handed\r\n * @param vector number array to convert to right-handed\r\n */\r\n public static _GetRightHandedPositionArray3FromRef(vector: number[]) {\r\n vector[2] *= -1;\r\n }\r\n\r\n /**\r\n * Converts a new right-handed Vector3\r\n * @param vector vector3 array\r\n * @returns right-handed Vector3\r\n */\r\n public static _GetRightHandedNormalVector3(vector: Vector3): Vector3 {\r\n return new Vector3(vector.x, vector.y, -vector.z);\r\n }\r\n\r\n /**\r\n * Converts a Vector3 to right-handed\r\n * @param vector Vector3 to convert to right-handed\r\n */\r\n public static _GetRightHandedNormalVector3FromRef(vector: Vector3) {\r\n vector.z *= -1;\r\n }\r\n\r\n /**\r\n * Converts a three element number array to right-handed\r\n * @param vector number array to convert to right-handed\r\n */\r\n public static _GetRightHandedNormalArray3FromRef(vector: number[]) {\r\n vector[2] *= -1;\r\n }\r\n\r\n /**\r\n * Converts a Vector4 to right-handed\r\n * @param vector Vector4 to convert to right-handed\r\n */\r\n public static _GetRightHandedVector4FromRef(vector: Vector4) {\r\n vector.z *= -1;\r\n vector.w *= -1;\r\n }\r\n\r\n /**\r\n * Converts a Vector4 to right-handed\r\n * @param vector Vector4 to convert to right-handed\r\n */\r\n public static _GetRightHandedArray4FromRef(vector: number[]) {\r\n vector[2] *= -1;\r\n vector[3] *= -1;\r\n }\r\n\r\n /**\r\n * Converts a Quaternion to right-handed\r\n * @param quaternion Source quaternion to convert to right-handed\r\n */\r\n public static _GetRightHandedQuaternionFromRef(quaternion: Quaternion) {\r\n quaternion.x *= -1;\r\n quaternion.y *= -1;\r\n }\r\n\r\n /**\r\n * Converts a Quaternion to right-handed\r\n * @param quaternion Source quaternion to convert to right-handed\r\n */\r\n public static _GetRightHandedQuaternionArrayFromRef(quaternion: number[]) {\r\n quaternion[0] *= -1;\r\n quaternion[1] *= -1;\r\n }\r\n\r\n public static _NormalizeTangentFromRef(tangent: Vector4) {\r\n const length = Math.sqrt(tangent.x * tangent.x + tangent.y * tangent.y + tangent.z * tangent.z);\r\n if (length > 0) {\r\n tangent.x /= length;\r\n tangent.y /= length;\r\n tangent.z /= length;\r\n }\r\n }\r\n\r\n public static _GetDataAccessorElementCount(accessorType: AccessorType) {\r\n switch (accessorType) {\r\n case AccessorType.MAT2:\r\n return 4;\r\n case AccessorType.MAT3:\r\n return 9;\r\n case AccessorType.MAT4:\r\n return 16;\r\n case AccessorType.SCALAR:\r\n return 1;\r\n case AccessorType.VEC2:\r\n return 2;\r\n case AccessorType.VEC3:\r\n return 3;\r\n case AccessorType.VEC4:\r\n return 4;\r\n }\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"glTFUtilities.js","sourceRoot":"","sources":["../../../../../../lts/serializers/generated/glTF/2.0/glTFUtilities.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,OAAO,EAAE,6CAA+B;AAEjD;;GAEG;AACH;IAAA;IA6NA,CAAC;IA5NG;;;;;;;;OAQG;IACW,gCAAiB,GAA/B,UAAgC,WAAmB,EAAE,UAAkB,EAAE,UAAkB,EAAE,UAAmB,EAAE,IAAa;QAC3H,IAAM,UAAU,GAAgB,EAAE,MAAM,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE,CAAC;QAChF,IAAI,UAAU,EAAE;YACZ,UAAU,CAAC,UAAU,GAAG,UAAU,CAAC;SACtC;QACD,IAAI,IAAI,EAAE;YACN,UAAU,CAAC,IAAI,GAAG,IAAI,CAAC;SAC1B;QACD,IAAI,UAAU,EAAE;YACZ,UAAU,CAAC,UAAU,GAAG,UAAU,CAAC;SACtC;QAED,OAAO,UAAU,CAAC;IACtB,CAAC;IAED;;;;;;;;;;;OAWG;IACW,8BAAe,GAA7B,UACI,eAAuB,EACvB,IA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,YAAY,EAAE;YAClB;gBACI,OAAO,CAAC,CAAC;YACb;gBACI,OAAO,CAAC,CAAC;YACb;gBACI,OAAO,EAAE,CAAC;YACd;gBACI,OAAO,CAAC,CAAC;YACb;gBACI,OAAO,CAAC,CAAC;YACb;gBACI,OAAO,CAAC,CAAC;YACb;gBACI,OAAO,CAAC,CAAC;SAChB;IACL,CAAC;IACL,qBAAC;AAAD,CAAC,AA7ND,IA6NC","sourcesContent":["import type { IBufferView, AccessorComponentType, IAccessor } from \"babylonjs-gltf2interface\";\r\nimport { AccessorType } from \"babylonjs-gltf2interface\";\r\n\r\nimport type { FloatArray, Nullable } from \"core/types\";\r\nimport type { Vector4, Quaternion } from \"core/Maths/math.vector\";\r\nimport { Vector3 } from \"core/Maths/math.vector\";\r\n\r\n/**\r\n * @hidden\r\n */\r\nexport class _GLTFUtilities {\r\n /**\r\n * Creates a buffer view based on the supplied arguments\r\n * @param bufferIndex index value of the specified buffer\r\n * @param byteOffset byte offset value\r\n * @param byteLength byte length of the bufferView\r\n * @param byteStride byte distance between conequential elements\r\n * @param name name of the buffer view\r\n * @returns bufferView for glTF\r\n */\r\n public static _CreateBufferView(bufferIndex: number, byteOffset: number, byteLength: number, byteStride?: number, name?: string): IBufferView {\r\n const bufferview: IBufferView = { buffer: bufferIndex, byteLength: byteLength };\r\n if (byteOffset) {\r\n bufferview.byteOffset = byteOffset;\r\n }\r\n if (name) {\r\n bufferview.name = name;\r\n }\r\n if (byteStride) {\r\n bufferview.byteStride = byteStride;\r\n }\r\n\r\n return bufferview;\r\n }\r\n\r\n /**\r\n * Creates an accessor based on the supplied arguments\r\n * @param bufferviewIndex The index of the bufferview referenced by this accessor\r\n * @param name The name of the accessor\r\n * @param type The type of the accessor\r\n * @param componentType The datatype of components in the attribute\r\n * @param count The number of attributes referenced by this accessor\r\n * @param byteOffset The offset relative to the start of the bufferView in bytes\r\n * @param min Minimum value of each component in this attribute\r\n * @param max Maximum value of each component in this attribute\r\n * @returns accessor for glTF\r\n */\r\n public static _CreateAccessor(\r\n bufferviewIndex: number,\r\n name: string,\r\n type: AccessorType,\r\n componentType: AccessorComponentType,\r\n count: number,\r\n byteOffset: Nullable<number>,\r\n min: Nullable<number[]>,\r\n max: Nullable<number[]>\r\n ): IAccessor {\r\n const accessor: IAccessor = { name: name, bufferView: bufferviewIndex, componentType: componentType, count: count, type: type };\r\n\r\n if (min != null) {\r\n accessor.min = min;\r\n }\r\n if (max != null) {\r\n accessor.max = max;\r\n }\r\n if (byteOffset != null) {\r\n accessor.byteOffset = byteOffset;\r\n }\r\n\r\n return accessor;\r\n }\r\n\r\n /**\r\n * Calculates the minimum and maximum values of an array of position floats\r\n * @param positions Positions array of a mesh\r\n * @param vertexStart Starting vertex offset to calculate min and max values\r\n * @param vertexCount Number of vertices to check for min and max values\r\n * @param convertToRightHandedSystem\r\n * @returns min number array and max number array\r\n */\r\n public static _CalculateMinMaxPositions(\r\n positions: FloatArray,\r\n vertexStart: number,\r\n vertexCount: number,\r\n convertToRightHandedSystem: boolean\r\n ): { min: number[]; max: number[] } {\r\n const min = [Infinity, Infinity, Infinity];\r\n const max = [-Infinity, -Infinity, -Infinity];\r\n const positionStrideSize = 3;\r\n let indexOffset: number;\r\n let position: Vector3;\r\n let vector: number[];\r\n\r\n if (vertexCount) {\r\n for (let i = vertexStart, length = vertexStart + vertexCount; i < length; ++i) {\r\n indexOffset = positionStrideSize * i;\r\n\r\n position = Vector3.FromArray(positions, indexOffset);\r\n if (convertToRightHandedSystem) {\r\n _GLTFUtilities._GetRightHandedPositionVector3FromRef(position);\r\n }\r\n vector = position.asArray();\r\n\r\n for (let j = 0; j < positionStrideSize; ++j) {\r\n const num = vector[j];\r\n if (num < min[j]) {\r\n min[j] = num;\r\n }\r\n if (num > max[j]) {\r\n max[j] = num;\r\n }\r\n ++indexOffset;\r\n }\r\n }\r\n }\r\n return { min, max };\r\n }\r\n\r\n /**\r\n * Converts a new right-handed Vector3\r\n * @param vector vector3 array\r\n * @returns right-handed Vector3\r\n */\r\n public static _GetRightHandedPositionVector3(vector: Vector3): Vector3 {\r\n return new Vector3(vector.x, vector.y, -vector.z);\r\n }\r\n\r\n /**\r\n * Converts a Vector3 to right-handed\r\n * @param vector Vector3 to convert to right-handed\r\n */\r\n public static _GetRightHandedPositionVector3FromRef(vector: Vector3) {\r\n vector.z *= -1;\r\n }\r\n\r\n /**\r\n * Converts a three element number array to right-handed\r\n * @param vector number array to convert to right-handed\r\n */\r\n public static _GetRightHandedPositionArray3FromRef(vector: number[]) {\r\n vector[2] *= -1;\r\n }\r\n\r\n /**\r\n * Converts a new right-handed Vector3\r\n * @param vector vector3 array\r\n * @returns right-handed Vector3\r\n */\r\n public static _GetRightHandedNormalVector3(vector: Vector3): Vector3 {\r\n return new Vector3(vector.x, vector.y, -vector.z);\r\n }\r\n\r\n /**\r\n * Converts a Vector3 to right-handed\r\n * @param vector Vector3 to convert to right-handed\r\n */\r\n public static _GetRightHandedNormalVector3FromRef(vector: Vector3) {\r\n vector.z *= -1;\r\n }\r\n\r\n /**\r\n * Converts a three element number array to right-handed\r\n * @param vector number array to convert to right-handed\r\n */\r\n public static _GetRightHandedNormalArray3FromRef(vector: number[]) {\r\n vector[2] *= -1;\r\n }\r\n\r\n /**\r\n * Converts a Vector4 to right-handed\r\n * @param vector Vector4 to convert to right-handed\r\n */\r\n public static _GetRightHandedVector4FromRef(vector: Vector4) {\r\n vector.z *= -1;\r\n vector.w *= -1;\r\n }\r\n\r\n /**\r\n * Converts a Vector4 to right-handed\r\n * @param vector Vector4 to convert to right-handed\r\n */\r\n public static _GetRightHandedArray4FromRef(vector: number[]) {\r\n vector[2] *= -1;\r\n vector[3] *= -1;\r\n }\r\n\r\n /**\r\n * Converts a Quaternion to right-handed\r\n * @param quaternion Source quaternion to convert to right-handed\r\n */\r\n public static _GetRightHandedQuaternionFromRef(quaternion: Quaternion) {\r\n quaternion.x *= -1;\r\n quaternion.y *= -1;\r\n }\r\n\r\n /**\r\n * Converts a Quaternion to right-handed\r\n * @param quaternion Source quaternion to convert to right-handed\r\n */\r\n public static _GetRightHandedQuaternionArrayFromRef(quaternion: number[]) {\r\n quaternion[0] *= -1;\r\n quaternion[1] *= -1;\r\n }\r\n\r\n public static _NormalizeTangentFromRef(tangent: Vector4) {\r\n const length = Math.sqrt(tangent.x * tangent.x + tangent.y * tangent.y + tangent.z * tangent.z);\r\n if (length > 0) {\r\n tangent.x /= length;\r\n tangent.y /= length;\r\n tangent.z /= length;\r\n }\r\n }\r\n\r\n public static _GetDataAccessorElementCount(accessorType: AccessorType) {\r\n switch (accessorType) {\r\n case AccessorType.MAT2:\r\n return 4;\r\n case AccessorType.MAT3:\r\n return 9;\r\n case AccessorType.MAT4:\r\n return 16;\r\n case AccessorType.SCALAR:\r\n return 1;\r\n case AccessorType.VEC2:\r\n return 2;\r\n case AccessorType.VEC3:\r\n return 3;\r\n case AccessorType.VEC4:\r\n return 4;\r\n }\r\n }\r\n}\r\n"]}
@@ -1,8 +1,8 @@
1
- export * from "./glTFAnimation";
2
- export * from "./glTFData";
3
- export * from "./glTFExporter";
4
- export * from "./glTFExporterExtension";
5
- export * from "./glTFMaterialExporter";
6
- export * from "./glTFSerializer";
7
- export * from "./glTFUtilities";
8
- export * from "./Extensions/index";
1
+ export * from "./glTFAnimation";
2
+ export * from "./glTFData";
3
+ export * from "./glTFExporter";
4
+ export * from "./glTFExporterExtension";
5
+ export * from "./glTFMaterialExporter";
6
+ export * from "./glTFSerializer";
7
+ export * from "./glTFUtilities";
8
+ export * from "./Extensions/index";
package/glTF/2.0/index.js CHANGED
@@ -1,9 +1,10 @@
1
- export * from "./glTFAnimation.js";
2
- export * from "./glTFData.js";
3
- export * from "./glTFExporter.js";
4
- export * from "./glTFExporterExtension.js";
5
- export * from "./glTFMaterialExporter.js";
6
- export * from "./glTFSerializer.js";
7
- export * from "./glTFUtilities.js";
8
- export * from "./Extensions/index.js";
1
+ /* eslint-disable import/no-internal-modules */
2
+ export * from "./glTFAnimation.js";
3
+ export * from "./glTFData.js";
4
+ export * from "./glTFExporter.js";
5
+ export * from "./glTFExporterExtension.js";
6
+ export * from "./glTFMaterialExporter.js";
7
+ export * from "./glTFSerializer.js";
8
+ export * from "./glTFUtilities.js";
9
+ export * from "./Extensions/index.js";
9
10
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../lts/serializers/generated/glTF/2.0/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AACvC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC","sourcesContent":["export * from \"./glTFAnimation\";\r\nexport * from \"./glTFData\";\r\nexport * from \"./glTFExporter\";\r\nexport * from \"./glTFExporterExtension\";\r\nexport * from \"./glTFMaterialExporter\";\r\nexport * from \"./glTFSerializer\";\r\nexport * from \"./glTFUtilities\";\r\nexport * from \"./Extensions/index\";\r\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../lts/serializers/generated/glTF/2.0/index.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AACvC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC","sourcesContent":["/* eslint-disable import/no-internal-modules */\r\nexport * from \"./glTFAnimation\";\r\nexport * from \"./glTFData\";\r\nexport * from \"./glTFExporter\";\r\nexport * from \"./glTFExporterExtension\";\r\nexport * from \"./glTFMaterialExporter\";\r\nexport * from \"./glTFSerializer\";\r\nexport * from \"./glTFUtilities\";\r\nexport * from \"./Extensions/index\";\r\n"]}
@@ -1,5 +1,5 @@
1
- /** @hidden */
2
- export declare const textureTransformPixelShader: {
3
- name: string;
4
- shader: string;
5
- };
1
+ /** @hidden */
2
+ export declare const textureTransformPixelShader: {
3
+ name: string;
4
+ shader: string;
5
+ };
@@ -1,9 +1,9 @@
1
- // Do not edit.
2
- import { ShaderStore } from "@babylonjs/core/Engines/shaderStore.js";
3
- var name = "textureTransformPixelShader";
4
- var shader = "precision highp float;varying vec2 vUV;uniform sampler2D textureSampler;uniform mat4 textureTransformMat;void main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\nvec2 uvTransformed=(textureTransformMat*vec4(vUV.xy,1,1)).xy;gl_FragColor=texture2D(textureSampler,uvTransformed);\n#define CUSTOM_FRAGMENT_MAIN_END\n}";
5
- // Sideeffect
6
- ShaderStore.ShadersStore[name] = shader;
7
- /** @hidden */
8
- export var textureTransformPixelShader = { name: name, shader: shader };
1
+ // Do not edit.
2
+ import { ShaderStore } from "@babylonjs/core/Engines/shaderStore.js";
3
+ var name = "textureTransformPixelShader";
4
+ var shader = "precision highp float;varying vec2 vUV;uniform sampler2D textureSampler;uniform mat4 textureTransformMat;void main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\nvec2 uvTransformed=(textureTransformMat*vec4(vUV.xy,1,1)).xy;gl_FragColor=texture2D(textureSampler,uvTransformed);\n#define CUSTOM_FRAGMENT_MAIN_END\n}";
5
+ // Sideeffect
6
+ ShaderStore.ShadersStore[name] = shader;
7
+ /** @hidden */
8
+ export var textureTransformPixelShader = { name: name, shader: shader };
9
9
  //# sourceMappingURL=textureTransform.fragment.js.map
@@ -1,20 +1,20 @@
1
- /** @hidden */
2
- export declare var __IGLTFExporterExtension: number;
3
- /**
4
- * Interface for extending the exporter
5
- * @hidden
6
- */
7
- export interface IGLTFExporterExtension {
8
- /**
9
- * The name of this extension
10
- */
11
- readonly name: string;
12
- /**
13
- * Defines whether this extension is enabled
14
- */
15
- enabled: boolean;
16
- /**
17
- * Defines whether this extension is required
18
- */
19
- required: boolean;
20
- }
1
+ /** @hidden */
2
+ export declare var __IGLTFExporterExtension: number;
3
+ /**
4
+ * Interface for extending the exporter
5
+ * @hidden
6
+ */
7
+ export interface IGLTFExporterExtension {
8
+ /**
9
+ * The name of this extension
10
+ */
11
+ readonly name: string;
12
+ /**
13
+ * Defines whether this extension is enabled
14
+ */
15
+ enabled: boolean;
16
+ /**
17
+ * Defines whether this extension is required
18
+ */
19
+ required: boolean;
20
+ }
@@ -1,4 +1,4 @@
1
- /** @hidden */
2
- // eslint-disable-next-line no-var, @typescript-eslint/naming-convention
3
- export var __IGLTFExporterExtension = 0; // I am here to allow dts to be created
1
+ /** @hidden */
2
+ // eslint-disable-next-line no-var, @typescript-eslint/naming-convention
3
+ export var __IGLTFExporterExtension = 0; // I am here to allow dts to be created
4
4
  //# sourceMappingURL=glTFFileExporter.js.map
package/glTF/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export * from "./glTFFileExporter";
2
- export * from "./2.0/index";
1
+ export * from "./glTFFileExporter";
2
+ export * from "./2.0/index";
package/glTF/index.js CHANGED
@@ -1,3 +1,4 @@
1
- export * from "./glTFFileExporter.js";
2
- export * from "./2.0/index.js";
1
+ /* eslint-disable import/no-internal-modules */
2
+ export * from "./glTFFileExporter.js";
3
+ export * from "./2.0/index.js";
3
4
  //# sourceMappingURL=index.js.map
package/glTF/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../lts/serializers/generated/glTF/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,aAAa,CAAC","sourcesContent":["export * from \"./glTFFileExporter\";\r\nexport * from \"./2.0/index\";\r\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../lts/serializers/generated/glTF/index.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,cAAc,oBAAoB,CAAC;AACnC,cAAc,aAAa,CAAC","sourcesContent":["/* eslint-disable import/no-internal-modules */\r\nexport * from \"./glTFFileExporter\";\r\nexport * from \"./2.0/index\";\r\n"]}
package/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- export * from "./OBJ/index";
2
- export * from "./glTF/index";
3
- export * from "./stl/index";
1
+ export * from "./OBJ/index";
2
+ export * from "./glTF/index";
3
+ export * from "./stl/index";
package/index.js CHANGED
@@ -1,4 +1,5 @@
1
- export * from "./OBJ/index.js";
2
- export * from "./glTF/index.js";
3
- export * from "./stl/index.js";
1
+ /* eslint-disable import/no-internal-modules */
2
+ export * from "./OBJ/index.js";
3
+ export * from "./glTF/index.js";
4
+ export * from "./stl/index.js";
4
5
  //# sourceMappingURL=index.js.map
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../lts/serializers/generated/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC","sourcesContent":["export * from \"./OBJ/index\";\r\nexport * from \"./glTF/index\";\r\nexport * from \"./stl/index\";\r\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../lts/serializers/generated/index.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC","sourcesContent":["/* eslint-disable import/no-internal-modules */\r\nexport * from \"./OBJ/index\";\r\nexport * from \"./glTF/index\";\r\nexport * from \"./stl/index\";\r\n"]}
@@ -1,2 +1,2 @@
1
- export * from "./glTF/glTFFileExporter.js";
2
- export * from "./glTF/2.0/index.js";
1
+ export * from "../glTF/glTFFileExporter";
2
+ export * from "../glTF/2.0/index";