elation-engine 0.9.113 → 0.9.115

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 (91) hide show
  1. package/css/systems/render.css +5 -1
  2. package/package.json +1 -1
  3. package/scripts/assets.js +103 -20
  4. package/scripts/assetworker.js +18 -1
  5. package/scripts/external/holoplay.js +1494 -0
  6. package/scripts/external/octree.js +0 -0
  7. package/scripts/external/three/CSS3DRenderer.js +46 -43
  8. package/scripts/external/three/CubemapToEquirectangular.js +1 -1
  9. package/scripts/external/three/three-extras.js +1553 -392
  10. package/scripts/external/three/three-icosa.js +2575 -0
  11. package/scripts/external/three/three-loaders.js +925 -133
  12. package/scripts/external/three/three-postprocessing.js +3 -3
  13. package/scripts/external/three/three-r116dev.js +50930 -0
  14. package/scripts/external/three/three-spotlighttextures.js +50953 -0
  15. package/scripts/external/three/three-vrm.js +2 -2
  16. package/scripts/external/three/three-working.js +35968 -0
  17. package/scripts/external/three/three.js +38532 -24087
  18. package/scripts/external/three-mesh-bvh.js +5370 -0
  19. package/scripts/external/three-old/BVHLoader.js +406 -0
  20. package/scripts/external/three-old/ColladaLoader.js +5519 -0
  21. package/scripts/external/three-old/ColladaLoader2.js +1694 -0
  22. package/scripts/external/three-old/CubemapToEquirectangular.js +188 -0
  23. package/scripts/external/three-old/DDSLoader.js +269 -0
  24. package/scripts/external/three-old/FBXLoader-mine.js +5063 -0
  25. package/scripts/external/three-old/FBXLoader.js +5112 -0
  26. package/scripts/external/three-old/FlyControls.js +295 -0
  27. package/scripts/external/three-old/GLTF2Loader.js +2950 -0
  28. package/scripts/external/three-old/GLTFLoader.js +2213 -0
  29. package/scripts/external/three-old/JSONLoader.js +435 -0
  30. package/scripts/external/three-old/MTLLoader.js +533 -0
  31. package/scripts/external/three-old/OBJLoader-experimental.js +874 -0
  32. package/scripts/external/three-old/OBJLoader-working.js +727 -0
  33. package/scripts/external/three-old/OBJLoader.js +723 -0
  34. package/scripts/external/three-old/OBJMTLLoader.js +440 -0
  35. package/scripts/external/three-old/OrbitControls.js +592 -0
  36. package/scripts/external/three-old/PLYLoader.js +517 -0
  37. package/scripts/external/three-old/TransformControls.js +1100 -0
  38. package/scripts/external/three-old/VRMLLoader.js +1021 -0
  39. package/scripts/external/three-old/glTFLoader-combined.js +2513 -0
  40. package/scripts/external/three-old/nodethree.js +44018 -0
  41. package/scripts/external/three-old/render/BleachBypassShader.js +64 -0
  42. package/scripts/external/three-old/render/BloomPass.js +116 -0
  43. package/scripts/external/three-old/render/CSS3DRenderer.js +310 -0
  44. package/scripts/external/three-old/render/ClearPass.js +44 -0
  45. package/scripts/external/three-old/render/ConvolutionShader.js +101 -0
  46. package/scripts/external/three-old/render/CopyShader.js +46 -0
  47. package/scripts/external/three-old/render/EffectComposer.js +211 -0
  48. package/scripts/external/three-old/render/FXAAShader.js +88 -0
  49. package/scripts/external/three-old/render/FilmPass.js +60 -0
  50. package/scripts/external/three-old/render/FilmShader.js +104 -0
  51. package/scripts/external/three-old/render/ManualMSAARenderPass.js +168 -0
  52. package/scripts/external/three-old/render/MaskPass.js +97 -0
  53. package/scripts/external/three-old/render/OculusRenderPass.js +84 -0
  54. package/scripts/external/three-old/render/OculusRiftEffect.js +240 -0
  55. package/scripts/external/three-old/render/PortalRenderPass.js +166 -0
  56. package/scripts/external/three-old/render/RecordingPass.js +208 -0
  57. package/scripts/external/three-old/render/RenderPass.js +57 -0
  58. package/scripts/external/three-old/render/SSAOShader.js +259 -0
  59. package/scripts/external/three-old/render/SepiaShader.js +54 -0
  60. package/scripts/external/three-old/render/ShaderPass.js +66 -0
  61. package/scripts/external/three-old/render/VREffect.js +482 -0
  62. package/scripts/external/three-old/shimthree.js +23 -0
  63. package/scripts/external/three-old/stats.js +6 -0
  64. package/scripts/external/three-old/three-88dev.js +45004 -0
  65. package/scripts/external/three-old/three-backgroundoptimization.js +44432 -0
  66. package/scripts/external/three-old/three-updates.js +44735 -0
  67. package/scripts/external/three-old/three-working.js +44719 -0
  68. package/scripts/external/three-old/three.js +44431 -0
  69. package/scripts/external/three-old/threex.rendererstats.js +66 -0
  70. package/scripts/external/three-old/tween.js +13 -0
  71. package/scripts/external/webvr-polyfill-new.js +3497 -0
  72. package/scripts/external/webvr-polyfill-newest.js +3491 -0
  73. package/scripts/external/webvr-polyfill-old.js +6337 -0
  74. package/scripts/geometries.js +2 -2
  75. package/scripts/math.js +6 -6
  76. package/scripts/systems/admin.js +1 -1
  77. package/scripts/systems/controls.js +6 -4
  78. package/scripts/systems/physics.js +10 -10
  79. package/scripts/systems/render.js +58 -20
  80. package/scripts/systems/render2.js +38 -0
  81. package/scripts/things/camera.js +6 -1
  82. package/scripts/things/generic-trackedvectors.js +1875 -0
  83. package/scripts/things/generic.js +3 -4
  84. package/scripts/things/label2d.js +1 -1
  85. package/scripts/things/leapmotion.js +6 -6
  86. package/scripts/things/menu.js +1 -1
  87. package/scripts/things/player-bak.js +638 -0
  88. package/scripts/things/player.js +28 -10
  89. package/scripts/things/skysphere.js +1 -1
  90. package/scripts/things/terrain.js +1 -1
  91. package/scripts/things/text.js +1 -1
@@ -1,248 +1,171 @@
1
- /**
2
- * @author mrdoob / http://mrdoob.com/
3
- */
4
-
5
- THREE.BufferGeometryUtils = {
6
-
7
- computeTangents: function ( geometry ) {
8
-
9
- var index = geometry.index;
10
- var attributes = geometry.attributes;
11
-
12
- // based on http://www.terathon.com/code/tangent.html
13
- // (per vertex tangents)
14
-
15
- if ( index === null ||
16
- attributes.position === undefined ||
17
- attributes.normal === undefined ||
18
- attributes.uv === undefined ) {
1
+ ( function () {
19
2
 
20
- console.warn( 'THREE.BufferGeometry: Missing required attributes (index, position, normal or uv) in BufferGeometry.computeTangents()' );
21
- return;
3
+ function computeTangents() {
22
4
 
23
- }
5
+ throw new Error( 'BufferGeometryUtils: computeTangents renamed to computeMikkTSpaceTangents.' );
24
6
 
25
- var indices = index.array;
26
- var positions = attributes.position.array;
27
- var normals = attributes.normal.array;
28
- var uvs = attributes.uv.array;
7
+ }
29
8
 
30
- var nVertices = positions.length / 3;
9
+ function computeMikkTSpaceTangents( geometry, MikkTSpace, negateSign = true ) {
31
10
 
32
- if ( attributes.tangent === undefined ) {
11
+ if ( ! MikkTSpace || ! MikkTSpace.isReady ) {
33
12
 
34
- geometry.setAttribute( 'tangent', new THREE.BufferAttribute( new Float32Array( 4 * nVertices ), 4 ) );
13
+ throw new Error( 'BufferGeometryUtils: Initialized MikkTSpace library required.' );
35
14
 
36
15
  }
37
16
 
38
- var tangents = attributes.tangent.array;
39
-
40
- var tan1 = [], tan2 = [];
17
+ if ( ! geometry.hasAttribute( 'position' ) || ! geometry.hasAttribute( 'normal' ) || ! geometry.hasAttribute( 'uv' ) ) {
41
18
 
42
- for ( var i = 0; i < nVertices; i ++ ) {
43
-
44
- tan1[ i ] = new THREE.Vector3();
45
- tan2[ i ] = new THREE.Vector3();
19
+ throw new Error( 'BufferGeometryUtils: Tangents require "position", "normal", and "uv" attributes.' );
46
20
 
47
21
  }
48
22
 
49
- var vA = new THREE.Vector3(),
50
- vB = new THREE.Vector3(),
51
- vC = new THREE.Vector3(),
52
-
53
- uvA = new THREE.Vector2(),
54
- uvB = new THREE.Vector2(),
55
- uvC = new THREE.Vector2(),
56
-
57
- sdir = new THREE.Vector3(),
58
- tdir = new THREE.Vector3();
59
-
60
- function handleTriangle( a, b, c ) {
23
+ function getAttributeArray( attribute ) {
61
24
 
62
- vA.fromArray( positions, a * 3 );
63
- vB.fromArray( positions, b * 3 );
64
- vC.fromArray( positions, c * 3 );
25
+ if ( attribute.normalized || attribute.isInterleavedBufferAttribute ) {
65
26
 
66
- uvA.fromArray( uvs, a * 2 );
67
- uvB.fromArray( uvs, b * 2 );
68
- uvC.fromArray( uvs, c * 2 );
27
+ const srcArray = attribute.isInterleavedBufferAttribute ? attribute.data.array : attribute.array;
28
+ const dstArray = new Float32Array( attribute.getCount() * attribute.itemSize );
69
29
 
70
- var x1 = vB.x - vA.x;
71
- var x2 = vC.x - vA.x;
30
+ for ( let i = 0, j = 0; i < attribute.getCount(); i ++ ) {
72
31
 
73
- var y1 = vB.y - vA.y;
74
- var y2 = vC.y - vA.y;
32
+ dstArray[ j ++ ] = THREE.MathUtils.denormalize( attribute.getX( i ), srcArray );
33
+ dstArray[ j ++ ] = THREE.MathUtils.denormalize( attribute.getY( i ), srcArray );
75
34
 
76
- var z1 = vB.z - vA.z;
77
- var z2 = vC.z - vA.z;
35
+ if ( attribute.itemSize > 2 ) {
78
36
 
79
- var s1 = uvB.x - uvA.x;
80
- var s2 = uvC.x - uvA.x;
37
+ dstArray[ j ++ ] = THREE.MathUtils.denormalize( attribute.getZ( i ), srcArray );
81
38
 
82
- var t1 = uvB.y - uvA.y;
83
- var t2 = uvC.y - uvA.y;
39
+ }
84
40
 
85
- var r = 1.0 / ( s1 * t2 - s2 * t1 );
41
+ }
86
42
 
87
- sdir.set(
88
- ( t2 * x1 - t1 * x2 ) * r,
89
- ( t2 * y1 - t1 * y2 ) * r,
90
- ( t2 * z1 - t1 * z2 ) * r
91
- );
43
+ return dstArray;
92
44
 
93
- tdir.set(
94
- ( s1 * x2 - s2 * x1 ) * r,
95
- ( s1 * y2 - s2 * y1 ) * r,
96
- ( s1 * z2 - s2 * z1 ) * r
97
- );
45
+ }
98
46
 
99
- tan1[ a ].add( sdir );
100
- tan1[ b ].add( sdir );
101
- tan1[ c ].add( sdir );
47
+ if ( attribute.array instanceof Float32Array ) {
102
48
 
103
- tan2[ a ].add( tdir );
104
- tan2[ b ].add( tdir );
105
- tan2[ c ].add( tdir );
49
+ return attribute.array;
106
50
 
107
- }
51
+ }
108
52
 
109
- var groups = geometry.groups;
53
+ return new Float32Array( attribute.array );
110
54
 
111
- if ( groups.length === 0 ) {
55
+ } // MikkTSpace algorithm requires non-indexed input.
112
56
 
113
- groups = [ {
114
- start: 0,
115
- count: indices.length
116
- } ];
117
57
 
118
- }
58
+ const _geometry = geometry.index ? geometry.toNonIndexed() : geometry; // Compute vertex tangents.
119
59
 
120
- for ( var i = 0, il = groups.length; i < il; ++ i ) {
121
60
 
122
- var group = groups[ i ];
61
+ const tangents = MikkTSpace.generateTangents( getAttributeArray( _geometry.attributes.position ), getAttributeArray( _geometry.attributes.normal ), getAttributeArray( _geometry.attributes.uv ) ); // Texture coordinate convention of glTF differs from the apparent
62
+ // default of the MikkTSpace library; .w component must be flipped.
123
63
 
124
- var start = group.start;
125
- var count = group.count;
64
+ if ( negateSign ) {
126
65
 
127
- for ( var j = start, jl = start + count; j < jl; j += 3 ) {
66
+ for ( let i = 3; i < tangents.length; i += 4 ) {
128
67
 
129
- handleTriangle(
130
- indices[ j + 0 ],
131
- indices[ j + 1 ],
132
- indices[ j + 2 ]
133
- );
68
+ tangents[ i ] *= - 1;
134
69
 
135
70
  }
136
71
 
137
- }
138
-
139
- var tmp = new THREE.Vector3(), tmp2 = new THREE.Vector3();
140
- var n = new THREE.Vector3(), n2 = new THREE.Vector3();
141
- var w, t, test;
142
-
143
- function handleVertex( v ) {
144
-
145
- n.fromArray( normals, v * 3 );
146
- n2.copy( n );
147
-
148
- t = tan1[ v ];
149
-
150
- // Gram-Schmidt orthogonalize
72
+ } //
151
73
 
152
- tmp.copy( t );
153
- tmp.sub( n.multiplyScalar( n.dot( t ) ) ).normalize();
154
74
 
155
- // Calculate handedness
75
+ _geometry.setAttribute( 'tangent', new THREE.BufferAttribute( tangents, 4 ) );
156
76
 
157
- tmp2.crossVectors( n2, t );
158
- test = tmp2.dot( tan2[ v ] );
159
- w = ( test < 0.0 ) ? - 1.0 : 1.0;
77
+ if ( geometry !== _geometry ) {
160
78
 
161
- tangents[ v * 4 ] = tmp.x;
162
- tangents[ v * 4 + 1 ] = tmp.y;
163
- tangents[ v * 4 + 2 ] = tmp.z;
164
- tangents[ v * 4 + 3 ] = w;
79
+ geometry.copy( _geometry );
165
80
 
166
81
  }
167
82
 
168
- for ( var i = 0, il = groups.length; i < il; ++ i ) {
83
+ return geometry;
84
+
85
+ }
86
+ /**
87
+ * @param {Array<BufferGeometry>} geometries
88
+ * @param {Boolean} useGroups
89
+ * @return {BufferGeometry}
90
+ */
169
91
 
170
- var group = groups[ i ];
171
92
 
172
- var start = group.start;
173
- var count = group.count;
93
+ function mergeBufferGeometries( geometries, useGroups = false ) {
174
94
 
175
- for ( var j = start, jl = start + count; j < jl; j += 3 ) {
95
+ const isIndexed = geometries[ 0 ].index !== null;
96
+ const attributesUsed = new Set( Object.keys( geometries[ 0 ].attributes ) );
97
+ const morphAttributesUsed = new Set( Object.keys( geometries[ 0 ].morphAttributes ) );
98
+ const attributes = {};
99
+ const morphAttributes = {};
100
+ const morphTargetsRelative = geometries[ 0 ].morphTargetsRelative;
101
+ const mergedGeometry = new THREE.BufferGeometry();
102
+ let offset = 0;
176
103
 
177
- handleVertex( indices[ j + 0 ] );
178
- handleVertex( indices[ j + 1 ] );
179
- handleVertex( indices[ j + 2 ] );
104
+ for ( let i = 0; i < geometries.length; ++ i ) {
180
105
 
181
- }
106
+ const geometry = geometries[ i ];
107
+ let attributesCount = 0; // ensure that all geometries are indexed, or none
182
108
 
183
- }
109
+ if ( isIndexed !== ( geometry.index !== null ) ) {
184
110
 
185
- },
111
+ console.error( 'THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index ' + i + '. All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them.' );
112
+ return null;
186
113
 
187
- /**
188
- * @param {Array<THREE.BufferGeometry>} geometries
189
- * @param {Boolean} useGroups
190
- * @return {THREE.BufferGeometry}
191
- */
192
- mergeBufferGeometries: function ( geometries, useGroups ) {
114
+ } // gather attributes, exit early if they're different
193
115
 
194
- var isIndexed = geometries[ 0 ].index !== null;
195
116
 
196
- var attributesUsed = new Set( Object.keys( geometries[ 0 ].attributes ) );
197
- var morphAttributesUsed = new Set( Object.keys( geometries[ 0 ].morphAttributes ) );
117
+ for ( const name in geometry.attributes ) {
198
118
 
199
- var attributes = {};
200
- var morphAttributes = {};
119
+ if ( ! attributesUsed.has( name ) ) {
201
120
 
202
- var mergedGeometry = new THREE.BufferGeometry();
121
+ console.error( 'THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index ' + i + '. All geometries must have compatible attributes; make sure "' + name + '" attribute exists among all geometries, or in none of them.' );
122
+ return null;
203
123
 
204
- var offset = 0;
124
+ }
205
125
 
206
- for ( var i = 0; i < geometries.length; ++ i ) {
126
+ if ( attributes[ name ] === undefined ) attributes[ name ] = [];
127
+ attributes[ name ].push( geometry.attributes[ name ] );
128
+ attributesCount ++;
207
129
 
208
- var geometry = geometries[ i ];
130
+ } // ensure geometries have the same number of attributes
209
131
 
210
- // ensure that all geometries are indexed, or none
211
132
 
212
- if ( isIndexed !== ( geometry.index !== null ) ) return null;
133
+ if ( attributesCount !== attributesUsed.size ) {
213
134
 
214
- // gather attributes, exit early if they're different
135
+ console.error( 'THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index ' + i + '. Make sure all geometries have the same number of attributes.' );
136
+ return null;
215
137
 
216
- for ( var name in geometry.attributes ) {
138
+ } // gather morph attributes, exit early if they're different
217
139
 
218
- if ( ! attributesUsed.has( name ) ) return null;
219
140
 
220
- if ( attributes[ name ] === undefined ) attributes[ name ] = [];
141
+ if ( morphTargetsRelative !== geometry.morphTargetsRelative ) {
221
142
 
222
- attributes[ name ].push( geometry.attributes[ name ] );
143
+ console.error( 'THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index ' + i + '. .morphTargetsRelative must be consistent throughout all geometries.' );
144
+ return null;
223
145
 
224
146
  }
225
147
 
226
- // gather morph attributes, exit early if they're different
148
+ for ( const name in geometry.morphAttributes ) {
149
+
150
+ if ( ! morphAttributesUsed.has( name ) ) {
227
151
 
228
- for ( var name in geometry.morphAttributes ) {
152
+ console.error( 'THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index ' + i + '. .morphAttributes must be consistent throughout all geometries.' );
153
+ return null;
229
154
 
230
- if ( ! morphAttributesUsed.has( name ) ) return null;
155
+ }
231
156
 
232
157
  if ( morphAttributes[ name ] === undefined ) morphAttributes[ name ] = [];
233
-
234
158
  morphAttributes[ name ].push( geometry.morphAttributes[ name ] );
235
159
 
236
- }
160
+ } // gather .userData
237
161
 
238
- // gather .userData
239
162
 
240
163
  mergedGeometry.userData.mergedUserData = mergedGeometry.userData.mergedUserData || [];
241
164
  mergedGeometry.userData.mergedUserData.push( geometry.userData );
242
165
 
243
166
  if ( useGroups ) {
244
167
 
245
- var count;
168
+ let count;
246
169
 
247
170
  if ( isIndexed ) {
248
171
 
@@ -254,30 +177,29 @@ THREE.BufferGeometryUtils = {
254
177
 
255
178
  } else {
256
179
 
180
+ console.error( 'THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index ' + i + '. The geometry must have either an index or a position attribute' );
257
181
  return null;
258
182
 
259
183
  }
260
184
 
261
185
  mergedGeometry.addGroup( offset, count, i );
262
-
263
186
  offset += count;
264
187
 
265
188
  }
266
189
 
267
- }
190
+ } // merge indices
268
191
 
269
- // merge indices
270
192
 
271
193
  if ( isIndexed ) {
272
194
 
273
- var indexOffset = 0;
274
- var mergedIndex = [];
195
+ let indexOffset = 0;
196
+ const mergedIndex = [];
275
197
 
276
- for ( var i = 0; i < geometries.length; ++ i ) {
198
+ for ( let i = 0; i < geometries.length; ++ i ) {
277
199
 
278
- var index = geometries[ i ].index;
200
+ const index = geometries[ i ].index;
279
201
 
280
- for ( var j = 0; j < index.count; ++ j ) {
202
+ for ( let j = 0; j < index.count; ++ j ) {
281
203
 
282
204
  mergedIndex.push( index.getX( j ) + indexOffset );
283
205
 
@@ -289,44 +211,50 @@ THREE.BufferGeometryUtils = {
289
211
 
290
212
  mergedGeometry.setIndex( mergedIndex );
291
213
 
292
- }
214
+ } // merge attributes
293
215
 
294
- // merge attributes
295
216
 
296
- for ( var name in attributes ) {
217
+ for ( const name in attributes ) {
297
218
 
298
- var mergedAttribute = this.mergeBufferAttributes( attributes[ name ] );
219
+ const mergedAttribute = mergeBufferAttributes( attributes[ name ] );
299
220
 
300
- if ( ! mergedAttribute ) return null;
221
+ if ( ! mergedAttribute ) {
301
222
 
302
- mergedGeometry.setAttribute( name, mergedAttribute );
223
+ console.error( 'THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the ' + name + ' attribute.' );
224
+ return null;
303
225
 
304
- }
226
+ }
227
+
228
+ mergedGeometry.setAttribute( name, mergedAttribute );
305
229
 
306
- // merge morph attributes
230
+ } // merge morph attributes
307
231
 
308
- for ( var name in morphAttributes ) {
309
232
 
310
- var numMorphTargets = morphAttributes[ name ][ 0 ].length;
233
+ for ( const name in morphAttributes ) {
311
234
 
235
+ const numMorphTargets = morphAttributes[ name ][ 0 ].length;
312
236
  if ( numMorphTargets === 0 ) break;
313
-
314
237
  mergedGeometry.morphAttributes = mergedGeometry.morphAttributes || {};
315
238
  mergedGeometry.morphAttributes[ name ] = [];
316
239
 
317
- for ( var i = 0; i < numMorphTargets; ++ i ) {
240
+ for ( let i = 0; i < numMorphTargets; ++ i ) {
318
241
 
319
- var morphAttributesToMerge = [];
242
+ const morphAttributesToMerge = [];
320
243
 
321
- for ( var j = 0; j < morphAttributes[ name ].length; ++ j ) {
244
+ for ( let j = 0; j < morphAttributes[ name ].length; ++ j ) {
322
245
 
323
246
  morphAttributesToMerge.push( morphAttributes[ name ][ j ][ i ] );
324
247
 
325
248
  }
326
249
 
327
- var mergedMorphAttribute = this.mergeBufferAttributes( morphAttributesToMerge );
250
+ const mergedMorphAttribute = mergeBufferAttributes( morphAttributesToMerge );
251
+
252
+ if ( ! mergedMorphAttribute ) {
253
+
254
+ console.error( 'THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the ' + name + ' morphAttribute.' );
255
+ return null;
328
256
 
329
- if ( ! mergedMorphAttribute ) return null;
257
+ }
330
258
 
331
259
  mergedGeometry.morphAttributes[ name ].push( mergedMorphAttribute );
332
260
 
@@ -336,74 +264,97 @@ THREE.BufferGeometryUtils = {
336
264
 
337
265
  return mergedGeometry;
338
266
 
339
- },
340
-
267
+ }
341
268
  /**
342
- * @param {Array<THREE.BufferAttribute>} attributes
343
- * @return {THREE.BufferAttribute}
344
- */
345
- mergeBufferAttributes: function ( attributes ) {
269
+ * @param {Array<BufferAttribute>} attributes
270
+ * @return {BufferAttribute}
271
+ */
272
+
346
273
 
347
- var TypedArray;
348
- var itemSize;
349
- var normalized;
350
- var arrayLength = 0;
274
+ function mergeBufferAttributes( attributes ) {
351
275
 
352
- for ( var i = 0; i < attributes.length; ++ i ) {
276
+ let TypedArray;
277
+ let itemSize;
278
+ let normalized;
279
+ let arrayLength = 0;
353
280
 
354
- var attribute = attributes[ i ];
281
+ for ( let i = 0; i < attributes.length; ++ i ) {
355
282
 
356
- if ( attribute.isInterleavedBufferAttribute ) return null;
283
+ const attribute = attributes[ i ];
284
+
285
+ if ( attribute.isInterleavedBufferAttribute ) {
286
+
287
+ console.error( 'THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. InterleavedBufferAttributes are not supported.' );
288
+ return null;
289
+
290
+ }
357
291
 
358
292
  if ( TypedArray === undefined ) TypedArray = attribute.array.constructor;
359
- if ( TypedArray !== attribute.array.constructor ) return null;
293
+
294
+ if ( TypedArray !== attribute.array.constructor ) {
295
+
296
+ console.error( 'THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. THREE.BufferAttribute.array must be of consistent array types across matching attributes.' );
297
+ return null;
298
+
299
+ }
360
300
 
361
301
  if ( itemSize === undefined ) itemSize = attribute.itemSize;
362
- if ( itemSize !== attribute.itemSize ) return null;
302
+
303
+ if ( itemSize !== attribute.itemSize ) {
304
+
305
+ console.error( 'THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. THREE.BufferAttribute.itemSize must be consistent across matching attributes.' );
306
+ return null;
307
+
308
+ }
363
309
 
364
310
  if ( normalized === undefined ) normalized = attribute.normalized;
365
- if ( normalized !== attribute.normalized ) return null;
311
+
312
+ if ( normalized !== attribute.normalized ) {
313
+
314
+ console.error( 'THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. THREE.BufferAttribute.normalized must be consistent across matching attributes.' );
315
+ return null;
316
+
317
+ }
366
318
 
367
319
  arrayLength += attribute.array.length;
368
320
 
369
321
  }
370
322
 
371
- var array = new TypedArray( arrayLength );
372
- var offset = 0;
323
+ const array = new TypedArray( arrayLength );
324
+ let offset = 0;
373
325
 
374
- for ( var i = 0; i < attributes.length; ++ i ) {
326
+ for ( let i = 0; i < attributes.length; ++ i ) {
375
327
 
376
328
  array.set( attributes[ i ].array, offset );
377
-
378
329
  offset += attributes[ i ].array.length;
379
330
 
380
331
  }
381
332
 
382
333
  return new THREE.BufferAttribute( array, itemSize, normalized );
383
334
 
384
- },
385
-
335
+ }
386
336
  /**
387
- * @param {Array<THREE.BufferAttribute>} attributes
388
- * @return {Array<THREE.InterleavedBufferAttribute>}
389
- */
390
- interleaveAttributes: function ( attributes ) {
337
+ * @param {Array<BufferAttribute>} attributes
338
+ * @return {Array<InterleavedBufferAttribute>}
339
+ */
391
340
 
392
- // Interleaves the provided attributes into an InterleavedBuffer and returns
393
- // a set of InterleavedBufferAttributes for each attribute
394
- var TypedArray;
395
- var arrayLength = 0;
396
- var stride = 0;
397
341
 
398
- // calculate the the length and type of the interleavedBuffer
399
- for ( var i = 0, l = attributes.length; i < l; ++ i ) {
342
+ function interleaveAttributes( attributes ) {
400
343
 
401
- var attribute = attributes[ i ];
344
+ // Interleaves the provided attributes into an THREE.InterleavedBuffer and returns
345
+ // a set of InterleavedBufferAttributes for each attribute
346
+ let TypedArray;
347
+ let arrayLength = 0;
348
+ let stride = 0; // calculate the the length and type of the interleavedBuffer
349
+
350
+ for ( let i = 0, l = attributes.length; i < l; ++ i ) {
402
351
 
352
+ const attribute = attributes[ i ];
403
353
  if ( TypedArray === undefined ) TypedArray = attribute.array.constructor;
354
+
404
355
  if ( TypedArray !== attribute.array.constructor ) {
405
356
 
406
- console.warn( 'AttributeBuffers of different types cannot be interleaved' );
357
+ console.error( 'AttributeBuffers of different types cannot be interleaved' );
407
358
  return null;
408
359
 
409
360
  }
@@ -411,30 +362,28 @@ THREE.BufferGeometryUtils = {
411
362
  arrayLength += attribute.array.length;
412
363
  stride += attribute.itemSize;
413
364
 
414
- }
415
-
416
- // Create the set of buffer attributes
417
- var interleavedBuffer = new THREE.InterleavedBuffer( new TypedArray( arrayLength ), stride );
418
- var offset = 0;
419
- var res = [];
420
- var getters = [ 'getX', 'getY', 'getZ', 'getW' ];
421
- var setters = [ 'setX', 'setY', 'setZ', 'setW' ];
365
+ } // Create the set of buffer attributes
422
366
 
423
- for ( var j = 0, l = attributes.length; j < l; j ++ ) {
424
367
 
425
- var attribute = attributes[ j ];
426
- var itemSize = attribute.itemSize;
427
- var count = attribute.count;
428
- var iba = new THREE.InterleavedBufferAttribute( interleavedBuffer, itemSize, offset, attribute.normalized );
429
- res.push( iba );
368
+ const interleavedBuffer = new THREE.InterleavedBuffer( new TypedArray( arrayLength ), stride );
369
+ let offset = 0;
370
+ const res = [];
371
+ const getters = [ 'getX', 'getY', 'getZ', 'getW' ];
372
+ const setters = [ 'setX', 'setY', 'setZ', 'setW' ];
430
373
 
431
- offset += itemSize;
374
+ for ( let j = 0, l = attributes.length; j < l; j ++ ) {
432
375
 
433
- // Move the data for each attribute into the new interleavedBuffer
376
+ const attribute = attributes[ j ];
377
+ const itemSize = attribute.itemSize;
378
+ const count = attribute.count;
379
+ const iba = new THREE.InterleavedBufferAttribute( interleavedBuffer, itemSize, offset, attribute.normalized );
380
+ res.push( iba );
381
+ offset += itemSize; // Move the data for each attribute into the new interleavedBuffer
434
382
  // at the appropriate offset
435
- for ( var c = 0; c < count; c ++ ) {
436
383
 
437
- for ( var k = 0; k < itemSize; k ++ ) {
384
+ for ( let c = 0; c < count; c ++ ) {
385
+
386
+ for ( let k = 0; k < itemSize; k ++ ) {
438
387
 
439
388
  iba[ setters[ k ] ]( c, attribute[ getters[ k ] ]( c ) );
440
389
 
@@ -446,99 +395,189 @@ THREE.BufferGeometryUtils = {
446
395
 
447
396
  return res;
448
397
 
449
- },
398
+ } // returns a new, non-interleaved version of the provided attribute
399
+
400
+
401
+ function deinterleaveAttribute( attribute ) {
402
+
403
+ const cons = attribute.data.array.constructor;
404
+ const count = attribute.count;
405
+ const itemSize = attribute.itemSize;
406
+ const normalized = attribute.normalized;
407
+ const array = new cons( count * itemSize );
408
+ let newAttribute;
409
+
410
+ if ( attribute.isInstancedInterleavedBufferAttribute ) {
411
+
412
+ newAttribute = new InstancedBufferAttribute( array, itemSize, normalized, attribute.meshPerAttribute );
413
+
414
+ } else {
415
+
416
+ newAttribute = new THREE.BufferAttribute( array, itemSize, normalized );
417
+
418
+ }
419
+
420
+ for ( let i = 0; i < count; i ++ ) {
421
+
422
+ newAttribute.setX( i, attribute.getX( i ) );
423
+
424
+ if ( itemSize >= 2 ) {
425
+
426
+ newAttribute.setY( i, attribute.getY( i ) );
427
+
428
+ }
429
+
430
+ if ( itemSize >= 3 ) {
431
+
432
+ newAttribute.setZ( i, attribute.getZ( i ) );
433
+
434
+ }
435
+
436
+ if ( itemSize >= 4 ) {
437
+
438
+ newAttribute.setW( i, attribute.getW( i ) );
439
+
440
+ }
441
+
442
+ }
443
+
444
+ return newAttribute;
445
+
446
+ } // deinterleaves all attributes on the geometry
447
+
448
+ function deinterleaveGeometry( geometry ) {
449
+
450
+ const attributes = geometry.attributes;
451
+ const morphTargets = geometry.morphTargets;
452
+ const attrMap = new Map();
453
+
454
+ for ( const key in attributes ) {
455
+
456
+ const attr = attributes[ key ];
457
+
458
+ if ( attr.isInterleavedBufferAttribute ) {
459
+
460
+ if ( ! attrMap.has( attr ) ) {
461
+
462
+ attrMap.set( attr, deinterleaveAttribute( attr ) );
463
+
464
+ }
465
+
466
+ attributes[ key ] = attrMap.get( attr );
467
+
468
+ }
469
+
470
+ }
471
+
472
+ for ( const key in morphTargets ) {
473
+
474
+ const attr = morphTargets[ key ];
475
+
476
+ if ( attr.isInterleavedBufferAttribute ) {
477
+
478
+ if ( ! attrMap.has( attr ) ) {
479
+
480
+ attrMap.set( attr, deinterleaveAttribute( attr ) );
481
+
482
+ }
483
+
484
+ morphTargets[ key ] = attrMap.get( attr );
485
+
486
+ }
487
+
488
+ }
450
489
 
490
+ }
451
491
  /**
452
- * @param {Array<THREE.BufferGeometry>} geometry
453
- * @return {number}
454
- */
455
- estimateBytesUsed: function ( geometry ) {
492
+ * @param {Array<BufferGeometry>} geometry
493
+ * @return {number}
494
+ */
495
+
496
+ function estimateBytesUsed( geometry ) {
456
497
 
457
498
  // Return the estimated memory used by this geometry in bytes
458
499
  // Calculate using itemSize, count, and BYTES_PER_ELEMENT to account
459
500
  // for InterleavedBufferAttributes.
460
- var mem = 0;
461
- for ( var name in geometry.attributes ) {
501
+ let mem = 0;
502
+
503
+ for ( const name in geometry.attributes ) {
462
504
 
463
- var attr = geometry.getAttribute( name );
505
+ const attr = geometry.getAttribute( name );
464
506
  mem += attr.count * attr.itemSize * attr.array.BYTES_PER_ELEMENT;
465
507
 
466
508
  }
467
509
 
468
- var indices = geometry.getIndex();
510
+ const indices = geometry.getIndex();
469
511
  mem += indices ? indices.count * indices.itemSize * indices.array.BYTES_PER_ELEMENT : 0;
470
512
  return mem;
471
513
 
472
- },
473
-
514
+ }
474
515
  /**
475
- * @param {THREE.BufferGeometry} geometry
476
- * @param {number} tolerance
477
- * @return {THREE.BufferGeometry>}
478
- */
479
- mergeVertices: function ( geometry, tolerance = 1e-4 ) {
516
+ * @param {BufferGeometry} geometry
517
+ * @param {number} tolerance
518
+ * @return {BufferGeometry>}
519
+ */
520
+
480
521
 
481
- tolerance = Math.max( tolerance, Number.EPSILON );
522
+ function mergeVertices( geometry, tolerance = 1e-4 ) {
482
523
 
483
- // Generate an index buffer if the geometry doesn't have one, or optimize it
524
+ tolerance = Math.max( tolerance, Number.EPSILON ); // Generate an index buffer if the geometry doesn't have one, or optimize it
484
525
  // if it's already available.
485
- var hashToIndex = {};
486
- var indices = geometry.getIndex();
487
- var positions = geometry.getAttribute( 'position' );
488
- var vertexCount = indices ? indices.count : positions.count;
489
526
 
490
- // next value for triangle indices
491
- var nextIndex = 0;
527
+ const hashToIndex = {};
528
+ const indices = geometry.getIndex();
529
+ const positions = geometry.getAttribute( 'position' );
530
+ const vertexCount = indices ? indices.count : positions.count; // next value for triangle indices
492
531
 
493
- // attributes and new attribute arrays
494
- var attributeNames = Object.keys( geometry.attributes );
495
- var attrArrays = {};
496
- var morphAttrsArrays = {};
497
- var newIndices = [];
498
- var getters = [ 'getX', 'getY', 'getZ', 'getW' ];
532
+ let nextIndex = 0; // attributes and new attribute arrays
499
533
 
500
- // initialize the arrays
501
- for ( var i = 0, l = attributeNames.length; i < l; i ++ ) {
534
+ const attributeNames = Object.keys( geometry.attributes );
535
+ const attrArrays = {};
536
+ const morphAttrsArrays = {};
537
+ const newIndices = [];
538
+ const getters = [ 'getX', 'getY', 'getZ', 'getW' ]; // initialize the arrays
502
539
 
503
- var name = attributeNames[ i ];
540
+ for ( let i = 0, l = attributeNames.length; i < l; i ++ ) {
504
541
 
542
+ const name = attributeNames[ i ];
505
543
  attrArrays[ name ] = [];
544
+ const morphAttr = geometry.morphAttributes[ name ];
506
545
 
507
- var morphAttr = geometry.morphAttributes[ name ];
508
546
  if ( morphAttr ) {
509
547
 
510
548
  morphAttrsArrays[ name ] = new Array( morphAttr.length ).fill().map( () => [] );
511
549
 
512
550
  }
513
551
 
514
- }
552
+ } // convert the error tolerance to an amount of decimal places to truncate to
553
+
515
554
 
516
- // convert the error tolerance to an amount of decimal places to truncate to
517
- var decimalShift = Math.log10( 1 / tolerance );
518
- var shiftMultiplier = Math.pow( 10, decimalShift );
519
- for ( var i = 0; i < vertexCount; i ++ ) {
555
+ const decimalShift = Math.log10( 1 / tolerance );
556
+ const shiftMultiplier = Math.pow( 10, decimalShift );
520
557
 
521
- var index = indices ? indices.getX( i ) : i;
558
+ for ( let i = 0; i < vertexCount; i ++ ) {
522
559
 
523
- // Generate a hash for the vertex attributes at the current index 'i'
524
- var hash = '';
525
- for ( var j = 0, l = attributeNames.length; j < l; j ++ ) {
560
+ const index = indices ? indices.getX( i ) : i; // Generate a hash for the vertex attributes at the current index 'i'
526
561
 
527
- var name = attributeNames[ j ];
528
- var attribute = geometry.getAttribute( name );
529
- var itemSize = attribute.itemSize;
562
+ let hash = '';
530
563
 
531
- for ( var k = 0; k < itemSize; k ++ ) {
564
+ for ( let j = 0, l = attributeNames.length; j < l; j ++ ) {
565
+
566
+ const name = attributeNames[ j ];
567
+ const attribute = geometry.getAttribute( name );
568
+ const itemSize = attribute.itemSize;
569
+
570
+ for ( let k = 0; k < itemSize; k ++ ) {
532
571
 
533
572
  // double tilde truncates the decimal value
534
- hash += `${ ~ ~ ( attribute[ getters[ k ] ]( index ) * shiftMultiplier ) },`;
573
+ hash += `${~ ~ ( attribute[ getters[ k ] ]( index ) * shiftMultiplier )},`;
535
574
 
536
575
  }
537
576
 
538
- }
539
-
540
- // Add another reference to the vertex if it's already
577
+ } // Add another reference to the vertex if it's already
541
578
  // used by another index
579
+
580
+
542
581
  if ( hash in hashToIndex ) {
543
582
 
544
583
  newIndices.push( hashToIndex[ hash ] );
@@ -546,23 +585,23 @@ THREE.BufferGeometryUtils = {
546
585
  } else {
547
586
 
548
587
  // copy data to the new index in the attribute arrays
549
- for ( var j = 0, l = attributeNames.length; j < l; j ++ ) {
588
+ for ( let j = 0, l = attributeNames.length; j < l; j ++ ) {
550
589
 
551
- var name = attributeNames[ j ];
552
- var attribute = geometry.getAttribute( name );
553
- var morphAttr = geometry.morphAttributes[ name ];
554
- var itemSize = attribute.itemSize;
555
- var newarray = attrArrays[ name ];
556
- var newMorphArrays = morphAttrsArrays[ name ];
590
+ const name = attributeNames[ j ];
591
+ const attribute = geometry.getAttribute( name );
592
+ const morphAttr = geometry.morphAttributes[ name ];
593
+ const itemSize = attribute.itemSize;
594
+ const newarray = attrArrays[ name ];
595
+ const newMorphArrays = morphAttrsArrays[ name ];
557
596
 
558
- for ( var k = 0; k < itemSize; k ++ ) {
597
+ for ( let k = 0; k < itemSize; k ++ ) {
559
598
 
560
- var getterFunc = getters[ k ];
599
+ const getterFunc = getters[ k ];
561
600
  newarray.push( attribute[ getterFunc ]( index ) );
562
601
 
563
602
  if ( morphAttr ) {
564
603
 
565
- for ( var m = 0, ml = morphAttr.length; m < ml; m ++ ) {
604
+ for ( let m = 0, ml = morphAttr.length; m < ml; m ++ ) {
566
605
 
567
606
  newMorphArrays[ m ].push( morphAttr[ m ][ getterFunc ]( index ) );
568
607
 
@@ -580,130 +619,538 @@ THREE.BufferGeometryUtils = {
580
619
 
581
620
  }
582
621
 
583
- }
584
-
585
- // Generate typed arrays from new attribute arrays and update
622
+ } // Generate typed arrays from new attribute arrays and update
586
623
  // the attributeBuffers
587
- const result = geometry.clone();
588
- for ( var i = 0, l = attributeNames.length; i < l; i ++ ) {
589
-
590
- var name = attributeNames[ i ];
591
- var oldAttribute = geometry.getAttribute( name );
592
- var attribute;
593
-
594
- var buffer = new oldAttribute.array.constructor( attrArrays[ name ] );
595
- if ( oldAttribute.isInterleavedBufferAttribute ) {
596
-
597
- attribute = new THREE.BufferAttribute( buffer, oldAttribute.itemSize, oldAttribute.itemSize );
598
624
 
599
- } else {
600
625
 
601
- attribute = geometry.getAttribute( name ).clone();
602
- attribute.setArray( buffer );
626
+ const result = geometry.clone();
603
627
 
604
- }
628
+ for ( let i = 0, l = attributeNames.length; i < l; i ++ ) {
605
629
 
606
- result.setAttribute( name, attribute );
630
+ const name = attributeNames[ i ];
631
+ const oldAttribute = geometry.getAttribute( name );
632
+ const buffer = new oldAttribute.array.constructor( attrArrays[ name ] );
633
+ const attribute = new THREE.BufferAttribute( buffer, oldAttribute.itemSize, oldAttribute.normalized );
634
+ result.setAttribute( name, attribute ); // Update the attribute arrays
607
635
 
608
- // Update the attribute arrays
609
636
  if ( name in morphAttrsArrays ) {
610
637
 
611
- for ( var j = 0; j < morphAttrsArrays[ name ].length; j ++ ) {
638
+ for ( let j = 0; j < morphAttrsArrays[ name ].length; j ++ ) {
612
639
 
613
- var morphAttribute = geometry.morphAttributes[ name ][ j ].clone();
614
- morphAttribute.setArray( new morphAttribute.array.constructor( morphAttrsArrays[ name ][ j ] ) );
640
+ const oldMorphAttribute = geometry.morphAttributes[ name ][ j ];
641
+ const buffer = new oldMorphAttribute.array.constructor( morphAttrsArrays[ name ][ j ] );
642
+ const morphAttribute = new THREE.BufferAttribute( buffer, oldMorphAttribute.itemSize, oldMorphAttribute.normalized );
615
643
  result.morphAttributes[ name ][ j ] = morphAttribute;
616
644
 
617
645
  }
618
646
 
619
647
  }
620
648
 
621
- }
649
+ } // indices
622
650
 
623
- // Generate an index buffer typed array
624
- var cons = Uint8Array;
625
- if ( newIndices.length >= Math.pow( 2, 8 ) ) cons = Uint16Array;
626
- if ( newIndices.length >= Math.pow( 2, 16 ) ) cons = Uint32Array;
627
651
 
628
- var newIndexBuffer = new cons( newIndices );
629
- var newIndices = null;
630
- if ( indices === null ) {
652
+ result.setIndex( newIndices );
653
+ return result;
654
+
655
+ }
656
+ /**
657
+ * @param {BufferGeometry} geometry
658
+ * @param {number} drawMode
659
+ * @return {BufferGeometry>}
660
+ */
631
661
 
632
- newIndices = new THREE.BufferAttribute( newIndexBuffer, 1 );
633
662
 
634
- } else {
663
+ function toTrianglesDrawMode( geometry, drawMode ) {
664
+
665
+ if ( drawMode === THREE.TrianglesDrawMode ) {
635
666
 
636
- newIndices = geometry.getIndex().clone();
637
- newIndices.setArray( newIndexBuffer );
667
+ console.warn( 'THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles.' );
668
+ return geometry;
638
669
 
639
670
  }
640
671
 
641
- result.setIndex( newIndices );
672
+ if ( drawMode === THREE.TriangleFanDrawMode || drawMode === THREE.TriangleStripDrawMode ) {
642
673
 
643
- return result;
674
+ let index = geometry.getIndex(); // generate index if not present
644
675
 
645
- }
676
+ if ( index === null ) {
646
677
 
647
- };
678
+ const indices = [];
679
+ const position = geometry.getAttribute( 'position' );
648
680
 
649
- /**
650
- * @author fernandojsg / http://fernandojsg.com
651
- * @author Don McCurdy / https://www.donmccurdy.com
652
- * @author Takahiro / https://github.com/takahirox
653
- */
681
+ if ( position !== undefined ) {
654
682
 
655
- //------------------------------------------------------------------------------
656
- // Constants
657
- //------------------------------------------------------------------------------
658
- var WEBGL_CONSTANTS = {
659
- POINTS: 0x0000,
660
- LINES: 0x0001,
661
- LINE_LOOP: 0x0002,
662
- LINE_STRIP: 0x0003,
663
- TRIANGLES: 0x0004,
664
- TRIANGLE_STRIP: 0x0005,
665
- TRIANGLE_FAN: 0x0006,
683
+ for ( let i = 0; i < position.count; i ++ ) {
666
684
 
667
- UNSIGNED_BYTE: 0x1401,
668
- UNSIGNED_SHORT: 0x1403,
669
- FLOAT: 0x1406,
670
- UNSIGNED_INT: 0x1405,
671
- ARRAY_BUFFER: 0x8892,
672
- ELEMENT_ARRAY_BUFFER: 0x8893,
685
+ indices.push( i );
673
686
 
674
- NEAREST: 0x2600,
675
- LINEAR: 0x2601,
676
- NEAREST_MIPMAP_NEAREST: 0x2700,
677
- LINEAR_MIPMAP_NEAREST: 0x2701,
678
- NEAREST_MIPMAP_LINEAR: 0x2702,
679
- LINEAR_MIPMAP_LINEAR: 0x2703,
687
+ }
680
688
 
681
- CLAMP_TO_EDGE: 33071,
682
- MIRRORED_REPEAT: 33648,
683
- REPEAT: 10497
684
- };
689
+ geometry.setIndex( indices );
690
+ index = geometry.getIndex();
685
691
 
686
- var THREE_TO_WEBGL = {};
692
+ } else {
687
693
 
688
- THREE_TO_WEBGL[ THREE.NearestFilter ] = WEBGL_CONSTANTS.NEAREST;
689
- THREE_TO_WEBGL[ THREE.NearestMipmapNearestFilter ] = WEBGL_CONSTANTS.NEAREST_MIPMAP_NEAREST;
690
- THREE_TO_WEBGL[ THREE.NearestMipmapLinearFilter ] = WEBGL_CONSTANTS.NEAREST_MIPMAP_LINEAR;
691
- THREE_TO_WEBGL[ THREE.LinearFilter ] = WEBGL_CONSTANTS.LINEAR;
692
- THREE_TO_WEBGL[ THREE.LinearMipmapNearestFilter ] = WEBGL_CONSTANTS.LINEAR_MIPMAP_NEAREST;
693
- THREE_TO_WEBGL[ THREE.LinearMipmapLinearFilter ] = WEBGL_CONSTANTS.LINEAR_MIPMAP_LINEAR;
694
+ console.error( 'THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible.' );
695
+ return geometry;
694
696
 
695
- THREE_TO_WEBGL[ THREE.ClampToEdgeWrapping ] = WEBGL_CONSTANTS.CLAMP_TO_EDGE;
696
- THREE_TO_WEBGL[ THREE.RepeatWrapping ] = WEBGL_CONSTANTS.REPEAT;
697
- THREE_TO_WEBGL[ THREE.MirroredRepeatWrapping ] = WEBGL_CONSTANTS.MIRRORED_REPEAT;
697
+ }
698
698
 
699
- var PATH_PROPERTIES = {
700
- scale: 'scale',
701
- position: 'translation',
702
- quaternion: 'rotation',
703
- morphTargetInfluences: 'weights'
704
- };
699
+ } //
705
700
 
706
- //------------------------------------------------------------------------------
701
+
702
+ const numberOfTriangles = index.count - 2;
703
+ const newIndices = [];
704
+
705
+ if ( drawMode === THREE.TriangleFanDrawMode ) {
706
+
707
+ // gl.TRIANGLE_FAN
708
+ for ( let i = 1; i <= numberOfTriangles; i ++ ) {
709
+
710
+ newIndices.push( index.getX( 0 ) );
711
+ newIndices.push( index.getX( i ) );
712
+ newIndices.push( index.getX( i + 1 ) );
713
+
714
+ }
715
+
716
+ } else {
717
+
718
+ // gl.TRIANGLE_STRIP
719
+ for ( let i = 0; i < numberOfTriangles; i ++ ) {
720
+
721
+ if ( i % 2 === 0 ) {
722
+
723
+ newIndices.push( index.getX( i ) );
724
+ newIndices.push( index.getX( i + 1 ) );
725
+ newIndices.push( index.getX( i + 2 ) );
726
+
727
+ } else {
728
+
729
+ newIndices.push( index.getX( i + 2 ) );
730
+ newIndices.push( index.getX( i + 1 ) );
731
+ newIndices.push( index.getX( i ) );
732
+
733
+ }
734
+
735
+ }
736
+
737
+ }
738
+
739
+ if ( newIndices.length / 3 !== numberOfTriangles ) {
740
+
741
+ console.error( 'THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.' );
742
+
743
+ } // build final geometry
744
+
745
+
746
+ const newGeometry = geometry.clone();
747
+ newGeometry.setIndex( newIndices );
748
+ newGeometry.clearGroups();
749
+ return newGeometry;
750
+
751
+ } else {
752
+
753
+ console.error( 'THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:', drawMode );
754
+ return geometry;
755
+
756
+ }
757
+
758
+ }
759
+ /**
760
+ * Calculates the morphed attributes of a morphed/skinned THREE.BufferGeometry.
761
+ * Helpful for Raytracing or Decals.
762
+ * @param {Mesh | Line | Points} object An instance of Mesh, Line or Points.
763
+ * @return {Object} An Object with original position/normal attributes and morphed ones.
764
+ */
765
+
766
+
767
+ function computeMorphedAttributes( object ) {
768
+
769
+ if ( object.geometry.isBufferGeometry !== true ) {
770
+
771
+ console.error( 'THREE.BufferGeometryUtils: Geometry is not of type THREE.BufferGeometry.' );
772
+ return null;
773
+
774
+ }
775
+
776
+ const _vA = new THREE.Vector3();
777
+
778
+ const _vB = new THREE.Vector3();
779
+
780
+ const _vC = new THREE.Vector3();
781
+
782
+ const _tempA = new THREE.Vector3();
783
+
784
+ const _tempB = new THREE.Vector3();
785
+
786
+ const _tempC = new THREE.Vector3();
787
+
788
+ const _morphA = new THREE.Vector3();
789
+
790
+ const _morphB = new THREE.Vector3();
791
+
792
+ const _morphC = new THREE.Vector3();
793
+
794
+ function _calculateMorphedAttributeData( object, attribute, morphAttribute, morphTargetsRelative, a, b, c, modifiedAttributeArray ) {
795
+
796
+ _vA.fromBufferAttribute( attribute, a );
797
+
798
+ _vB.fromBufferAttribute( attribute, b );
799
+
800
+ _vC.fromBufferAttribute( attribute, c );
801
+
802
+ const morphInfluences = object.morphTargetInfluences;
803
+
804
+ if ( morphAttribute && morphInfluences ) {
805
+
806
+ _morphA.set( 0, 0, 0 );
807
+
808
+ _morphB.set( 0, 0, 0 );
809
+
810
+ _morphC.set( 0, 0, 0 );
811
+
812
+ for ( let i = 0, il = morphAttribute.length; i < il; i ++ ) {
813
+
814
+ const influence = morphInfluences[ i ];
815
+ const morph = morphAttribute[ i ];
816
+ if ( influence === 0 ) continue;
817
+
818
+ _tempA.fromBufferAttribute( morph, a );
819
+
820
+ _tempB.fromBufferAttribute( morph, b );
821
+
822
+ _tempC.fromBufferAttribute( morph, c );
823
+
824
+ if ( morphTargetsRelative ) {
825
+
826
+ _morphA.addScaledVector( _tempA, influence );
827
+
828
+ _morphB.addScaledVector( _tempB, influence );
829
+
830
+ _morphC.addScaledVector( _tempC, influence );
831
+
832
+ } else {
833
+
834
+ _morphA.addScaledVector( _tempA.sub( _vA ), influence );
835
+
836
+ _morphB.addScaledVector( _tempB.sub( _vB ), influence );
837
+
838
+ _morphC.addScaledVector( _tempC.sub( _vC ), influence );
839
+
840
+ }
841
+
842
+ }
843
+
844
+ _vA.add( _morphA );
845
+
846
+ _vB.add( _morphB );
847
+
848
+ _vC.add( _morphC );
849
+
850
+ }
851
+
852
+ if ( object.isSkinnedMesh ) {
853
+
854
+ object.boneTransform( a, _vA );
855
+ object.boneTransform( b, _vB );
856
+ object.boneTransform( c, _vC );
857
+
858
+ }
859
+
860
+ modifiedAttributeArray[ a * 3 + 0 ] = _vA.x;
861
+ modifiedAttributeArray[ a * 3 + 1 ] = _vA.y;
862
+ modifiedAttributeArray[ a * 3 + 2 ] = _vA.z;
863
+ modifiedAttributeArray[ b * 3 + 0 ] = _vB.x;
864
+ modifiedAttributeArray[ b * 3 + 1 ] = _vB.y;
865
+ modifiedAttributeArray[ b * 3 + 2 ] = _vB.z;
866
+ modifiedAttributeArray[ c * 3 + 0 ] = _vC.x;
867
+ modifiedAttributeArray[ c * 3 + 1 ] = _vC.y;
868
+ modifiedAttributeArray[ c * 3 + 2 ] = _vC.z;
869
+
870
+ }
871
+
872
+ const geometry = object.geometry;
873
+ const material = object.material;
874
+ let a, b, c;
875
+ const index = geometry.index;
876
+ const positionAttribute = geometry.attributes.position;
877
+ const morphPosition = geometry.morphAttributes.position;
878
+ const morphTargetsRelative = geometry.morphTargetsRelative;
879
+ const normalAttribute = geometry.attributes.normal;
880
+ const morphNormal = geometry.morphAttributes.position;
881
+ const groups = geometry.groups;
882
+ const drawRange = geometry.drawRange;
883
+ let i, j, il, jl;
884
+ let group;
885
+ let start, end;
886
+ const modifiedPosition = new Float32Array( positionAttribute.count * positionAttribute.itemSize );
887
+ const modifiedNormal = new Float32Array( normalAttribute.count * normalAttribute.itemSize );
888
+
889
+ if ( index !== null ) {
890
+
891
+ // indexed buffer geometry
892
+ if ( Array.isArray( material ) ) {
893
+
894
+ for ( i = 0, il = groups.length; i < il; i ++ ) {
895
+
896
+ group = groups[ i ];
897
+ start = Math.max( group.start, drawRange.start );
898
+ end = Math.min( group.start + group.count, drawRange.start + drawRange.count );
899
+
900
+ for ( j = start, jl = end; j < jl; j += 3 ) {
901
+
902
+ a = index.getX( j );
903
+ b = index.getX( j + 1 );
904
+ c = index.getX( j + 2 );
905
+
906
+ _calculateMorphedAttributeData( object, positionAttribute, morphPosition, morphTargetsRelative, a, b, c, modifiedPosition );
907
+
908
+ _calculateMorphedAttributeData( object, normalAttribute, morphNormal, morphTargetsRelative, a, b, c, modifiedNormal );
909
+
910
+ }
911
+
912
+ }
913
+
914
+ } else {
915
+
916
+ start = Math.max( 0, drawRange.start );
917
+ end = Math.min( index.count, drawRange.start + drawRange.count );
918
+
919
+ for ( i = start, il = end; i < il; i += 3 ) {
920
+
921
+ a = index.getX( i );
922
+ b = index.getX( i + 1 );
923
+ c = index.getX( i + 2 );
924
+
925
+ _calculateMorphedAttributeData( object, positionAttribute, morphPosition, morphTargetsRelative, a, b, c, modifiedPosition );
926
+
927
+ _calculateMorphedAttributeData( object, normalAttribute, morphNormal, morphTargetsRelative, a, b, c, modifiedNormal );
928
+
929
+ }
930
+
931
+ }
932
+
933
+ } else {
934
+
935
+ // non-indexed buffer geometry
936
+ if ( Array.isArray( material ) ) {
937
+
938
+ for ( i = 0, il = groups.length; i < il; i ++ ) {
939
+
940
+ group = groups[ i ];
941
+ start = Math.max( group.start, drawRange.start );
942
+ end = Math.min( group.start + group.count, drawRange.start + drawRange.count );
943
+
944
+ for ( j = start, jl = end; j < jl; j += 3 ) {
945
+
946
+ a = j;
947
+ b = j + 1;
948
+ c = j + 2;
949
+
950
+ _calculateMorphedAttributeData( object, positionAttribute, morphPosition, morphTargetsRelative, a, b, c, modifiedPosition );
951
+
952
+ _calculateMorphedAttributeData( object, normalAttribute, morphNormal, morphTargetsRelative, a, b, c, modifiedNormal );
953
+
954
+ }
955
+
956
+ }
957
+
958
+ } else {
959
+
960
+ start = Math.max( 0, drawRange.start );
961
+ end = Math.min( positionAttribute.count, drawRange.start + drawRange.count );
962
+
963
+ for ( i = start, il = end; i < il; i += 3 ) {
964
+
965
+ a = i;
966
+ b = i + 1;
967
+ c = i + 2;
968
+
969
+ _calculateMorphedAttributeData( object, positionAttribute, morphPosition, morphTargetsRelative, a, b, c, modifiedPosition );
970
+
971
+ _calculateMorphedAttributeData( object, normalAttribute, morphNormal, morphTargetsRelative, a, b, c, modifiedNormal );
972
+
973
+ }
974
+
975
+ }
976
+
977
+ }
978
+
979
+ const morphedPositionAttribute = new THREE.Float32BufferAttribute( modifiedPosition, 3 );
980
+ const morphedNormalAttribute = new THREE.Float32BufferAttribute( modifiedNormal, 3 );
981
+ return {
982
+ positionAttribute: positionAttribute,
983
+ normalAttribute: normalAttribute,
984
+ morphedPositionAttribute: morphedPositionAttribute,
985
+ morphedNormalAttribute: morphedNormalAttribute
986
+ };
987
+
988
+ }
989
+
990
+ function mergeGroups( geometry ) {
991
+
992
+ if ( geometry.groups.length === 0 ) {
993
+
994
+ console.warn( 'THREE.BufferGeometryUtils.mergeGroups(): No groups are defined. Nothing to merge.' );
995
+ return geometry;
996
+
997
+ }
998
+
999
+ let groups = geometry.groups; // sort groups by material index
1000
+
1001
+ groups = groups.sort( ( a, b ) => {
1002
+
1003
+ if ( a.materialIndex !== b.materialIndex ) return a.materialIndex - b.materialIndex;
1004
+ return a.start - b.start;
1005
+
1006
+ } ); // create index for non-indexed geometries
1007
+
1008
+ if ( geometry.getIndex() === null ) {
1009
+
1010
+ const positionAttribute = geometry.getAttribute( 'position' );
1011
+ const indices = [];
1012
+
1013
+ for ( let i = 0; i < positionAttribute.count; i += 3 ) {
1014
+
1015
+ indices.push( i, i + 1, i + 2 );
1016
+
1017
+ }
1018
+
1019
+ geometry.setIndex( indices );
1020
+
1021
+ } // sort index
1022
+
1023
+
1024
+ const index = geometry.getIndex();
1025
+ const newIndices = [];
1026
+
1027
+ for ( let i = 0; i < groups.length; i ++ ) {
1028
+
1029
+ const group = groups[ i ];
1030
+ const groupStart = group.start;
1031
+ const groupLength = groupStart + group.count;
1032
+
1033
+ for ( let j = groupStart; j < groupLength; j ++ ) {
1034
+
1035
+ newIndices.push( index.getX( j ) );
1036
+
1037
+ }
1038
+
1039
+ }
1040
+
1041
+ geometry.dispose(); // Required to force buffer recreation
1042
+
1043
+ geometry.setIndex( newIndices ); // update groups indices
1044
+
1045
+ let start = 0;
1046
+
1047
+ for ( let i = 0; i < groups.length; i ++ ) {
1048
+
1049
+ const group = groups[ i ];
1050
+ group.start = start;
1051
+ start += group.count;
1052
+
1053
+ } // merge groups
1054
+
1055
+
1056
+ let currentGroup = groups[ 0 ];
1057
+ geometry.groups = [ currentGroup ];
1058
+
1059
+ for ( let i = 1; i < groups.length; i ++ ) {
1060
+
1061
+ const group = groups[ i ];
1062
+
1063
+ if ( currentGroup.materialIndex === group.materialIndex ) {
1064
+
1065
+ currentGroup.count += group.count;
1066
+
1067
+ } else {
1068
+
1069
+ currentGroup = group;
1070
+ geometry.groups.push( currentGroup );
1071
+
1072
+ }
1073
+
1074
+ }
1075
+
1076
+ return geometry;
1077
+
1078
+ }
1079
+
1080
+ THREE.BufferGeometryUtils = {};
1081
+ THREE.BufferGeometryUtils.computeMikkTSpaceTangents = computeMikkTSpaceTangents;
1082
+ THREE.BufferGeometryUtils.computeMorphedAttributes = computeMorphedAttributes;
1083
+ THREE.BufferGeometryUtils.computeTangents = computeTangents;
1084
+ THREE.BufferGeometryUtils.deinterleaveAttribute = deinterleaveAttribute;
1085
+ THREE.BufferGeometryUtils.deinterleaveGeometry = deinterleaveGeometry;
1086
+ THREE.BufferGeometryUtils.estimateBytesUsed = estimateBytesUsed;
1087
+ THREE.BufferGeometryUtils.interleaveAttributes = interleaveAttributes;
1088
+ THREE.BufferGeometryUtils.mergeBufferAttributes = mergeBufferAttributes;
1089
+ THREE.BufferGeometryUtils.mergeBufferGeometries = mergeBufferGeometries;
1090
+ THREE.BufferGeometryUtils.mergeGroups = mergeGroups;
1091
+ THREE.BufferGeometryUtils.mergeVertices = mergeVertices;
1092
+ THREE.BufferGeometryUtils.toTrianglesDrawMode = toTrianglesDrawMode;
1093
+
1094
+ } )();
1095
+
1096
+ /**
1097
+ * @author fernandojsg / http://fernandojsg.com
1098
+ * @author Don McCurdy / https://www.donmccurdy.com
1099
+ * @author Takahiro / https://github.com/takahirox
1100
+ */
1101
+
1102
+ //------------------------------------------------------------------------------
1103
+ // Constants
1104
+ //------------------------------------------------------------------------------
1105
+ var WEBGL_CONSTANTS = {
1106
+ POINTS: 0x0000,
1107
+ LINES: 0x0001,
1108
+ LINE_LOOP: 0x0002,
1109
+ LINE_STRIP: 0x0003,
1110
+ TRIANGLES: 0x0004,
1111
+ TRIANGLE_STRIP: 0x0005,
1112
+ TRIANGLE_FAN: 0x0006,
1113
+
1114
+ UNSIGNED_BYTE: 0x1401,
1115
+ UNSIGNED_SHORT: 0x1403,
1116
+ FLOAT: 0x1406,
1117
+ UNSIGNED_INT: 0x1405,
1118
+ ARRAY_BUFFER: 0x8892,
1119
+ ELEMENT_ARRAY_BUFFER: 0x8893,
1120
+
1121
+ NEAREST: 0x2600,
1122
+ LINEAR: 0x2601,
1123
+ NEAREST_MIPMAP_NEAREST: 0x2700,
1124
+ LINEAR_MIPMAP_NEAREST: 0x2701,
1125
+ NEAREST_MIPMAP_LINEAR: 0x2702,
1126
+ LINEAR_MIPMAP_LINEAR: 0x2703,
1127
+
1128
+ CLAMP_TO_EDGE: 33071,
1129
+ MIRRORED_REPEAT: 33648,
1130
+ REPEAT: 10497
1131
+ };
1132
+
1133
+ var THREE_TO_WEBGL = {};
1134
+
1135
+ THREE_TO_WEBGL[ THREE.NearestFilter ] = WEBGL_CONSTANTS.NEAREST;
1136
+ THREE_TO_WEBGL[ THREE.NearestMipmapNearestFilter ] = WEBGL_CONSTANTS.NEAREST_MIPMAP_NEAREST;
1137
+ THREE_TO_WEBGL[ THREE.NearestMipmapLinearFilter ] = WEBGL_CONSTANTS.NEAREST_MIPMAP_LINEAR;
1138
+ THREE_TO_WEBGL[ THREE.LinearFilter ] = WEBGL_CONSTANTS.LINEAR;
1139
+ THREE_TO_WEBGL[ THREE.LinearMipmapNearestFilter ] = WEBGL_CONSTANTS.LINEAR_MIPMAP_NEAREST;
1140
+ THREE_TO_WEBGL[ THREE.LinearMipmapLinearFilter ] = WEBGL_CONSTANTS.LINEAR_MIPMAP_LINEAR;
1141
+
1142
+ THREE_TO_WEBGL[ THREE.ClampToEdgeWrapping ] = WEBGL_CONSTANTS.CLAMP_TO_EDGE;
1143
+ THREE_TO_WEBGL[ THREE.RepeatWrapping ] = WEBGL_CONSTANTS.REPEAT;
1144
+ THREE_TO_WEBGL[ THREE.MirroredRepeatWrapping ] = WEBGL_CONSTANTS.MIRRORED_REPEAT;
1145
+
1146
+ var PATH_PROPERTIES = {
1147
+ scale: 'scale',
1148
+ position: 'translation',
1149
+ quaternion: 'rotation',
1150
+ morphTargetInfluences: 'weights'
1151
+ };
1152
+
1153
+ //------------------------------------------------------------------------------
707
1154
  // GLTF Exporter
708
1155
  //------------------------------------------------------------------------------
709
1156
  THREE.GLTFExporter = function () {};
@@ -874,7 +1321,7 @@ THREE.GLTFExporter.prototype = {
874
1321
  */
875
1322
  function isPowerOfTwo( image ) {
876
1323
 
877
- return THREE.Math.isPowerOfTwo( image.width ) && THREE.Math.isPowerOfTwo( image.height );
1324
+ return THREE.MathUtils.isPowerOfTwo( image.width ) && THREE.MathUtils.isPowerOfTwo( image.height );
878
1325
 
879
1326
  }
880
1327
 
@@ -1407,8 +1854,8 @@ THREE.GLTFExporter.prototype = {
1407
1854
 
1408
1855
  console.warn( 'GLTFExporter: Resized non-power-of-two image.', image );
1409
1856
 
1410
- canvas.width = THREE.Math.floorPowerOfTwo( canvas.width );
1411
- canvas.height = THREE.Math.floorPowerOfTwo( canvas.height );
1857
+ canvas.width = THREE.MathUtils.floorPowerOfTwo( canvas.width );
1858
+ canvas.height = THREE.MathUtils.floorPowerOfTwo( canvas.height );
1412
1859
 
1413
1860
  }
1414
1861
 
@@ -2163,7 +2610,7 @@ THREE.GLTFExporter.prototype = {
2163
2610
  gltfCamera.perspective = {
2164
2611
 
2165
2612
  aspectRatio: camera.aspect,
2166
- yfov: THREE.Math.degToRad( camera.fov ),
2613
+ yfov: THREE.MathUtils.degToRad( camera.fov ),
2167
2614
  zfar: camera.far <= 0 ? 0.001 : camera.far,
2168
2615
  znear: camera.near < 0 ? 0 : camera.near
2169
2616
 
@@ -6546,3 +6993,717 @@ THREE.SimplexNoise.prototype.noise4d = function ( x, y, z, w ) {
6546
6993
  THREE.TextGeometry = TextGeometry;
6547
6994
 
6548
6995
  } )();
6996
+ ( function () {
6997
+
6998
+ /**
6999
+ * @author Deepkolos / https://github.com/deepkolos
7000
+ */
7001
+ class WorkerPool {
7002
+
7003
+ constructor( pool = 4 ) {
7004
+
7005
+ this.pool = pool;
7006
+ this.queue = [];
7007
+ this.workers = [];
7008
+ this.workersResolve = [];
7009
+ this.workerStatus = 0;
7010
+
7011
+ }
7012
+
7013
+ _initWorker( workerId ) {
7014
+
7015
+ if ( ! this.workers[ workerId ] ) {
7016
+
7017
+ const worker = this.workerCreator();
7018
+ worker.addEventListener( 'message', this._onMessage.bind( this, workerId ) );
7019
+ this.workers[ workerId ] = worker;
7020
+
7021
+ }
7022
+
7023
+ }
7024
+
7025
+ _getIdleWorker() {
7026
+
7027
+ for ( let i = 0; i < this.pool; i ++ ) if ( ! ( this.workerStatus & 1 << i ) ) return i;
7028
+
7029
+ return - 1;
7030
+
7031
+ }
7032
+
7033
+ _onMessage( workerId, msg ) {
7034
+
7035
+ const resolve = this.workersResolve[ workerId ];
7036
+ resolve && resolve( msg );
7037
+
7038
+ if ( this.queue.length ) {
7039
+
7040
+ const {
7041
+ resolve,
7042
+ msg,
7043
+ transfer
7044
+ } = this.queue.shift();
7045
+ this.workersResolve[ workerId ] = resolve;
7046
+ this.workers[ workerId ].postMessage( msg, transfer );
7047
+
7048
+ } else {
7049
+
7050
+ this.workerStatus ^= 1 << workerId;
7051
+
7052
+ }
7053
+
7054
+ }
7055
+
7056
+ setWorkerCreator( workerCreator ) {
7057
+
7058
+ this.workerCreator = workerCreator;
7059
+
7060
+ }
7061
+
7062
+ setWorkerLimit( pool ) {
7063
+
7064
+ this.pool = pool;
7065
+
7066
+ }
7067
+
7068
+ postMessage( msg, transfer ) {
7069
+
7070
+ return new Promise( resolve => {
7071
+
7072
+ const workerId = this._getIdleWorker();
7073
+
7074
+ if ( workerId !== - 1 ) {
7075
+
7076
+ this._initWorker( workerId );
7077
+
7078
+ this.workerStatus |= 1 << workerId;
7079
+ this.workersResolve[ workerId ] = resolve;
7080
+ this.workers[ workerId ].postMessage( msg, transfer );
7081
+
7082
+ } else {
7083
+
7084
+ this.queue.push( {
7085
+ resolve,
7086
+ msg,
7087
+ transfer
7088
+ } );
7089
+
7090
+ }
7091
+
7092
+ } );
7093
+
7094
+ }
7095
+
7096
+ dispose() {
7097
+
7098
+ this.workers.forEach( worker => worker.terminate() );
7099
+ this.workersResolve.length = 0;
7100
+ this.workers.length = 0;
7101
+ this.queue.length = 0;
7102
+ this.workerStatus = 0;
7103
+
7104
+ }
7105
+
7106
+ }
7107
+
7108
+ THREE.WorkerPool = WorkerPool;
7109
+
7110
+ } )();
7111
+ ( function () {
7112
+
7113
+ // http://en.wikipedia.org/wiki/RGBE_image_format
7114
+
7115
+ class RGBELoader extends THREE.DataTextureLoader {
7116
+
7117
+ constructor( manager ) {
7118
+
7119
+ super( manager );
7120
+ this.type = THREE.HalfFloatType;
7121
+
7122
+ } // adapted from http://www.graphics.cornell.edu/~bjw/rgbe.html
7123
+
7124
+
7125
+ parse( buffer ) {
7126
+
7127
+ const
7128
+ /* return codes for rgbe routines */
7129
+ //RGBE_RETURN_SUCCESS = 0,
7130
+ RGBE_RETURN_FAILURE = - 1,
7131
+
7132
+ /* default error routine. change this to change error handling */
7133
+ rgbe_read_error = 1,
7134
+ rgbe_write_error = 2,
7135
+ rgbe_format_error = 3,
7136
+ rgbe_memory_error = 4,
7137
+ rgbe_error = function ( rgbe_error_code, msg ) {
7138
+
7139
+ switch ( rgbe_error_code ) {
7140
+
7141
+ case rgbe_read_error:
7142
+ console.error( 'THREE.RGBELoader Read Error: ' + ( msg || '' ) );
7143
+ break;
7144
+
7145
+ case rgbe_write_error:
7146
+ console.error( 'THREE.RGBELoader Write Error: ' + ( msg || '' ) );
7147
+ break;
7148
+
7149
+ case rgbe_format_error:
7150
+ console.error( 'THREE.RGBELoader Bad File Format: ' + ( msg || '' ) );
7151
+ break;
7152
+
7153
+ default:
7154
+ case rgbe_memory_error:
7155
+ console.error( 'THREE.RGBELoader: Error: ' + ( msg || '' ) );
7156
+
7157
+ }
7158
+
7159
+ return RGBE_RETURN_FAILURE;
7160
+
7161
+ },
7162
+
7163
+ /* offsets to red, green, and blue components in a data (float) pixel */
7164
+ //RGBE_DATA_RED = 0,
7165
+ //RGBE_DATA_GREEN = 1,
7166
+ //RGBE_DATA_BLUE = 2,
7167
+
7168
+ /* number of floats per pixel, use 4 since stored in rgba image format */
7169
+ //RGBE_DATA_SIZE = 4,
7170
+
7171
+ /* flags indicating which fields in an rgbe_header_info are valid */
7172
+ RGBE_VALID_PROGRAMTYPE = 1,
7173
+ RGBE_VALID_FORMAT = 2,
7174
+ RGBE_VALID_DIMENSIONS = 4,
7175
+ NEWLINE = '\n',
7176
+ fgets = function ( buffer, lineLimit, consume ) {
7177
+
7178
+ const chunkSize = 128;
7179
+ lineLimit = ! lineLimit ? 1024 : lineLimit;
7180
+ let p = buffer.pos,
7181
+ i = - 1,
7182
+ len = 0,
7183
+ s = '',
7184
+ chunk = String.fromCharCode.apply( null, new Uint16Array( buffer.subarray( p, p + chunkSize ) ) );
7185
+
7186
+ while ( 0 > ( i = chunk.indexOf( NEWLINE ) ) && len < lineLimit && p < buffer.byteLength ) {
7187
+
7188
+ s += chunk;
7189
+ len += chunk.length;
7190
+ p += chunkSize;
7191
+ chunk += String.fromCharCode.apply( null, new Uint16Array( buffer.subarray( p, p + chunkSize ) ) );
7192
+
7193
+ }
7194
+
7195
+ if ( - 1 < i ) {
7196
+
7197
+ /*for (i=l-1; i>=0; i--) {
7198
+ byteCode = m.charCodeAt(i);
7199
+ if (byteCode > 0x7f && byteCode <= 0x7ff) byteLen++;
7200
+ else if (byteCode > 0x7ff && byteCode <= 0xffff) byteLen += 2;
7201
+ if (byteCode >= 0xDC00 && byteCode <= 0xDFFF) i--; //trail surrogate
7202
+ }*/
7203
+ if ( false !== consume ) buffer.pos += len + i + 1;
7204
+ return s + chunk.slice( 0, i );
7205
+
7206
+ }
7207
+
7208
+ return false;
7209
+
7210
+ },
7211
+
7212
+ /* minimal header reading. modify if you want to parse more information */
7213
+ RGBE_ReadHeader = function ( buffer ) {
7214
+
7215
+ // regexes to parse header info fields
7216
+ const magic_token_re = /^#\?(\S+)/,
7217
+ gamma_re = /^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/,
7218
+ exposure_re = /^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/,
7219
+ format_re = /^\s*FORMAT=(\S+)\s*$/,
7220
+ dimensions_re = /^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/,
7221
+ // RGBE format header struct
7222
+ header = {
7223
+ valid: 0,
7224
+
7225
+ /* indicate which fields are valid */
7226
+ string: '',
7227
+
7228
+ /* the actual header string */
7229
+ comments: '',
7230
+
7231
+ /* comments found in header */
7232
+ programtype: 'RGBE',
7233
+
7234
+ /* listed at beginning of file to identify it after "#?". defaults to "RGBE" */
7235
+ format: '',
7236
+
7237
+ /* RGBE format, default 32-bit_rle_rgbe */
7238
+ gamma: 1.0,
7239
+
7240
+ /* image has already been gamma corrected with given gamma. defaults to 1.0 (no correction) */
7241
+ exposure: 1.0,
7242
+
7243
+ /* a value of 1.0 in an image corresponds to <exposure> watts/steradian/m^2. defaults to 1.0 */
7244
+ width: 0,
7245
+ height: 0
7246
+ /* image dimensions, width/height */
7247
+
7248
+ };
7249
+ let line, match;
7250
+
7251
+ if ( buffer.pos >= buffer.byteLength || ! ( line = fgets( buffer ) ) ) {
7252
+
7253
+ return rgbe_error( rgbe_read_error, 'no header found' );
7254
+
7255
+ }
7256
+ /* if you want to require the magic token then uncomment the next line */
7257
+
7258
+
7259
+ if ( ! ( match = line.match( magic_token_re ) ) ) {
7260
+
7261
+ return rgbe_error( rgbe_format_error, 'bad initial token' );
7262
+
7263
+ }
7264
+
7265
+ header.valid |= RGBE_VALID_PROGRAMTYPE;
7266
+ header.programtype = match[ 1 ];
7267
+ header.string += line + '\n';
7268
+
7269
+ while ( true ) {
7270
+
7271
+ line = fgets( buffer );
7272
+ if ( false === line ) break;
7273
+ header.string += line + '\n';
7274
+
7275
+ if ( '#' === line.charAt( 0 ) ) {
7276
+
7277
+ header.comments += line + '\n';
7278
+ continue; // comment line
7279
+
7280
+ }
7281
+
7282
+ if ( match = line.match( gamma_re ) ) {
7283
+
7284
+ header.gamma = parseFloat( match[ 1 ] );
7285
+
7286
+ }
7287
+
7288
+ if ( match = line.match( exposure_re ) ) {
7289
+
7290
+ header.exposure = parseFloat( match[ 1 ] );
7291
+
7292
+ }
7293
+
7294
+ if ( match = line.match( format_re ) ) {
7295
+
7296
+ header.valid |= RGBE_VALID_FORMAT;
7297
+ header.format = match[ 1 ]; //'32-bit_rle_rgbe';
7298
+
7299
+ }
7300
+
7301
+ if ( match = line.match( dimensions_re ) ) {
7302
+
7303
+ header.valid |= RGBE_VALID_DIMENSIONS;
7304
+ header.height = parseInt( match[ 1 ], 10 );
7305
+ header.width = parseInt( match[ 2 ], 10 );
7306
+
7307
+ }
7308
+
7309
+ if ( header.valid & RGBE_VALID_FORMAT && header.valid & RGBE_VALID_DIMENSIONS ) break;
7310
+
7311
+ }
7312
+
7313
+ if ( ! ( header.valid & RGBE_VALID_FORMAT ) ) {
7314
+
7315
+ return rgbe_error( rgbe_format_error, 'missing format specifier' );
7316
+
7317
+ }
7318
+
7319
+ if ( ! ( header.valid & RGBE_VALID_DIMENSIONS ) ) {
7320
+
7321
+ return rgbe_error( rgbe_format_error, 'missing image size specifier' );
7322
+
7323
+ }
7324
+
7325
+ return header;
7326
+
7327
+ },
7328
+ RGBE_ReadPixels_RLE = function ( buffer, w, h ) {
7329
+
7330
+ const scanline_width = w;
7331
+
7332
+ if ( // run length encoding is not allowed so read flat
7333
+ scanline_width < 8 || scanline_width > 0x7fff || // this file is not run length encoded
7334
+ 2 !== buffer[ 0 ] || 2 !== buffer[ 1 ] || buffer[ 2 ] & 0x80 ) {
7335
+
7336
+ // return the flat buffer
7337
+ return new Uint8Array( buffer );
7338
+
7339
+ }
7340
+
7341
+ if ( scanline_width !== ( buffer[ 2 ] << 8 | buffer[ 3 ] ) ) {
7342
+
7343
+ return rgbe_error( rgbe_format_error, 'wrong scanline width' );
7344
+
7345
+ }
7346
+
7347
+ const data_rgba = new Uint8Array( 4 * w * h );
7348
+
7349
+ if ( ! data_rgba.length ) {
7350
+
7351
+ return rgbe_error( rgbe_memory_error, 'unable to allocate buffer space' );
7352
+
7353
+ }
7354
+
7355
+ let offset = 0,
7356
+ pos = 0;
7357
+ const ptr_end = 4 * scanline_width;
7358
+ const rgbeStart = new Uint8Array( 4 );
7359
+ const scanline_buffer = new Uint8Array( ptr_end );
7360
+ let num_scanlines = h; // read in each successive scanline
7361
+
7362
+ while ( num_scanlines > 0 && pos < buffer.byteLength ) {
7363
+
7364
+ if ( pos + 4 > buffer.byteLength ) {
7365
+
7366
+ return rgbe_error( rgbe_read_error );
7367
+
7368
+ }
7369
+
7370
+ rgbeStart[ 0 ] = buffer[ pos ++ ];
7371
+ rgbeStart[ 1 ] = buffer[ pos ++ ];
7372
+ rgbeStart[ 2 ] = buffer[ pos ++ ];
7373
+ rgbeStart[ 3 ] = buffer[ pos ++ ];
7374
+
7375
+ if ( 2 != rgbeStart[ 0 ] || 2 != rgbeStart[ 1 ] || ( rgbeStart[ 2 ] << 8 | rgbeStart[ 3 ] ) != scanline_width ) {
7376
+
7377
+ return rgbe_error( rgbe_format_error, 'bad rgbe scanline format' );
7378
+
7379
+ } // read each of the four channels for the scanline into the buffer
7380
+ // first red, then green, then blue, then exponent
7381
+
7382
+
7383
+ let ptr = 0,
7384
+ count;
7385
+
7386
+ while ( ptr < ptr_end && pos < buffer.byteLength ) {
7387
+
7388
+ count = buffer[ pos ++ ];
7389
+ const isEncodedRun = count > 128;
7390
+ if ( isEncodedRun ) count -= 128;
7391
+
7392
+ if ( 0 === count || ptr + count > ptr_end ) {
7393
+
7394
+ return rgbe_error( rgbe_format_error, 'bad scanline data' );
7395
+
7396
+ }
7397
+
7398
+ if ( isEncodedRun ) {
7399
+
7400
+ // a (encoded) run of the same value
7401
+ const byteValue = buffer[ pos ++ ];
7402
+
7403
+ for ( let i = 0; i < count; i ++ ) {
7404
+
7405
+ scanline_buffer[ ptr ++ ] = byteValue;
7406
+
7407
+ } //ptr += count;
7408
+
7409
+ } else {
7410
+
7411
+ // a literal-run
7412
+ scanline_buffer.set( buffer.subarray( pos, pos + count ), ptr );
7413
+ ptr += count;
7414
+ pos += count;
7415
+
7416
+ }
7417
+
7418
+ } // now convert data from buffer into rgba
7419
+ // first red, then green, then blue, then exponent (alpha)
7420
+
7421
+
7422
+ const l = scanline_width; //scanline_buffer.byteLength;
7423
+
7424
+ for ( let i = 0; i < l; i ++ ) {
7425
+
7426
+ let off = 0;
7427
+ data_rgba[ offset ] = scanline_buffer[ i + off ];
7428
+ off += scanline_width; //1;
7429
+
7430
+ data_rgba[ offset + 1 ] = scanline_buffer[ i + off ];
7431
+ off += scanline_width; //1;
7432
+
7433
+ data_rgba[ offset + 2 ] = scanline_buffer[ i + off ];
7434
+ off += scanline_width; //1;
7435
+
7436
+ data_rgba[ offset + 3 ] = scanline_buffer[ i + off ];
7437
+ offset += 4;
7438
+
7439
+ }
7440
+
7441
+ num_scanlines --;
7442
+
7443
+ }
7444
+
7445
+ return data_rgba;
7446
+
7447
+ };
7448
+
7449
+ const RGBEByteToRGBFloat = function ( sourceArray, sourceOffset, destArray, destOffset ) {
7450
+
7451
+ const e = sourceArray[ sourceOffset + 3 ];
7452
+ const scale = Math.pow( 2.0, e - 128.0 ) / 255.0;
7453
+ destArray[ destOffset + 0 ] = sourceArray[ sourceOffset + 0 ] * scale;
7454
+ destArray[ destOffset + 1 ] = sourceArray[ sourceOffset + 1 ] * scale;
7455
+ destArray[ destOffset + 2 ] = sourceArray[ sourceOffset + 2 ] * scale;
7456
+ destArray[ destOffset + 3 ] = 1;
7457
+
7458
+ };
7459
+
7460
+ const RGBEByteToRGBHalf = function ( sourceArray, sourceOffset, destArray, destOffset ) {
7461
+
7462
+ const e = sourceArray[ sourceOffset + 3 ];
7463
+ const scale = Math.pow( 2.0, e - 128.0 ) / 255.0; // clamping to 65504, the maximum representable value in float16
7464
+
7465
+ destArray[ destOffset + 0 ] = THREE.DataUtils.toHalfFloat( Math.min( sourceArray[ sourceOffset + 0 ] * scale, 65504 ) );
7466
+ destArray[ destOffset + 1 ] = THREE.DataUtils.toHalfFloat( Math.min( sourceArray[ sourceOffset + 1 ] * scale, 65504 ) );
7467
+ destArray[ destOffset + 2 ] = THREE.DataUtils.toHalfFloat( Math.min( sourceArray[ sourceOffset + 2 ] * scale, 65504 ) );
7468
+ destArray[ destOffset + 3 ] = THREE.DataUtils.toHalfFloat( 1 );
7469
+
7470
+ };
7471
+
7472
+ const byteArray = new Uint8Array( buffer );
7473
+ byteArray.pos = 0;
7474
+ const rgbe_header_info = RGBE_ReadHeader( byteArray );
7475
+
7476
+ if ( RGBE_RETURN_FAILURE !== rgbe_header_info ) {
7477
+
7478
+ const w = rgbe_header_info.width,
7479
+ h = rgbe_header_info.height,
7480
+ image_rgba_data = RGBE_ReadPixels_RLE( byteArray.subarray( byteArray.pos ), w, h );
7481
+
7482
+ if ( RGBE_RETURN_FAILURE !== image_rgba_data ) {
7483
+
7484
+ let data, format, type;
7485
+ let numElements;
7486
+
7487
+ switch ( this.type ) {
7488
+
7489
+ case THREE.FloatType:
7490
+ numElements = image_rgba_data.length / 4;
7491
+ const floatArray = new Float32Array( numElements * 4 );
7492
+
7493
+ for ( let j = 0; j < numElements; j ++ ) {
7494
+
7495
+ RGBEByteToRGBFloat( image_rgba_data, j * 4, floatArray, j * 4 );
7496
+
7497
+ }
7498
+
7499
+ data = floatArray;
7500
+ type = THREE.FloatType;
7501
+ break;
7502
+
7503
+ case THREE.HalfFloatType:
7504
+ numElements = image_rgba_data.length / 4;
7505
+ const halfArray = new Uint16Array( numElements * 4 );
7506
+
7507
+ for ( let j = 0; j < numElements; j ++ ) {
7508
+
7509
+ RGBEByteToRGBHalf( image_rgba_data, j * 4, halfArray, j * 4 );
7510
+
7511
+ }
7512
+
7513
+ data = halfArray;
7514
+ type = THREE.HalfFloatType;
7515
+ break;
7516
+
7517
+ default:
7518
+ console.error( 'THREE.RGBELoader: unsupported type: ', this.type );
7519
+ break;
7520
+
7521
+ }
7522
+
7523
+ return {
7524
+ width: w,
7525
+ height: h,
7526
+ data: data,
7527
+ header: rgbe_header_info.string,
7528
+ gamma: rgbe_header_info.gamma,
7529
+ exposure: rgbe_header_info.exposure,
7530
+ format: format,
7531
+ type: type
7532
+ };
7533
+
7534
+ }
7535
+
7536
+ }
7537
+
7538
+ return null;
7539
+
7540
+ }
7541
+
7542
+ setDataType( value ) {
7543
+
7544
+ this.type = value;
7545
+ return this;
7546
+
7547
+ }
7548
+
7549
+ load( url, onLoad, onProgress, onError ) {
7550
+
7551
+ function onLoadCallback( texture, texData ) {
7552
+
7553
+ switch ( texture.type ) {
7554
+
7555
+ case THREE.FloatType:
7556
+ texture.encoding = THREE.LinearEncoding;
7557
+ texture.minFilter = THREE.LinearFilter;
7558
+ texture.magFilter = THREE.LinearFilter;
7559
+ texture.generateMipmaps = false;
7560
+ texture.flipY = true;
7561
+ break;
7562
+
7563
+ case THREE.HalfFloatType:
7564
+ texture.encoding = THREE.LinearEncoding;
7565
+ texture.minFilter = THREE.LinearFilter;
7566
+ texture.magFilter = THREE.LinearFilter;
7567
+ texture.generateMipmaps = false;
7568
+ texture.flipY = true;
7569
+ break;
7570
+
7571
+ }
7572
+
7573
+ if ( onLoad ) onLoad( texture, texData );
7574
+
7575
+ }
7576
+
7577
+ return super.load( url, onLoadCallback, onProgress, onError );
7578
+
7579
+ }
7580
+
7581
+ }
7582
+
7583
+ THREE.RGBELoader = RGBELoader;
7584
+
7585
+ } )();
7586
+ // This file is part of meshoptimizer library and is distributed under the terms of MIT License.
7587
+ // Copyright (C) 2016-2020, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com)
7588
+ (function() {
7589
+ var MeshoptDecoder = (function() {
7590
+ "use strict";
7591
+
7592
+ // Built with clang version 11.0.0 (https://github.com/llvm/llvm-project.git 0160ad802e899c2922bc9b29564080c22eb0908c)
7593
+ // Built from meshoptimizer 0.14
7594
+ var wasm_base = "B9h9z9tFBBBF8fL9gBB9gLaaaaaFa9gEaaaB9gFaFa9gEaaaFaEMcBFFFGGGEIIILF9wFFFLEFBFKNFaFCx/IFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBF8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBGy9t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KAcAVDQNVi8ZcMpySQ8c8dfb8e8fHVD8dBAEDBIBDyG+t+J83EBABCiJAVD8dFAEDBIBDyE+t+J83EBABCAJRBAICIJHIAF9JQBMMM9jFF97GXAGCGrAF9sHG9FQBCBRFEXABABDBBBHECND+rFCND+sFD/6FAECiD+sFCnD+rFCUUU/8EDtD+uFD/mFDMBBABCTJRBAFCIJHFAG9JQBMMM9TFEaCBCB8oGUkUUBHFABCEJC98ZJHBjGUkUUBGXGXAB8/BCTWHGuQBCaREABAGlCggEJCTrXBCa6QFMAFREMAEMMMFBCUNMIT9tBB";
7596
+
7597
+ // Uses bulk-memory and simd extensions
7598
+ var detector = new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]);
7599
+
7600
+ // Used to unpack wasm
7601
+ var wasmpack = new Uint8Array([32,0,65,253,3,1,2,34,4,106,6,5,11,8,7,20,13,33,12,16,128,9,116,64,19,113,127,15,10,21,22,14,255,66,24,54,136,107,18,23,192,26,114,118,132,17,77,101,130,144,27,87,131,44,45,74,156,154,70,167]);
7602
+
7603
+ if (typeof WebAssembly !== 'object') {
7604
+ // This module requires WebAssembly to function
7605
+ return {
7606
+ supported: false,
7607
+ };
7608
+ }
7609
+
7610
+ var wasm = wasm_base;
7611
+
7612
+ if (WebAssembly.validate(detector)) {
7613
+ wasm = wasm_simd;
7614
+ console.log("Warning: meshopt_decoder is using experimental SIMD support");
7615
+ }
7616
+
7617
+ var instance;
7618
+
7619
+ var promise =
7620
+ WebAssembly.instantiate(unpack(wasm), {})
7621
+ .then(function(result) {
7622
+ instance = result.instance;
7623
+ instance.exports.__wasm_call_ctors();
7624
+ });
7625
+
7626
+ function unpack(data) {
7627
+ var result = new Uint8Array(data.length);
7628
+ for (var i = 0; i < data.length; ++i) {
7629
+ var ch = data.charCodeAt(i);
7630
+ result[i] = ch > 96 ? ch - 71 : ch > 64 ? ch - 65 : ch > 47 ? ch + 4 : ch > 46 ? 63 : 62;
7631
+ }
7632
+ var write = 0;
7633
+ for (var i = 0; i < data.length; ++i) {
7634
+ result[write++] = (result[i] < 60) ? wasmpack[result[i]] : (result[i] - 60) * 64 + result[++i];
7635
+ }
7636
+ return result.buffer.slice(0, write);
7637
+ }
7638
+
7639
+ function decode(fun, target, count, size, source, filter) {
7640
+ var sbrk = instance.exports.sbrk;
7641
+ var count4 = (count + 3) & ~3; // pad for SIMD filter
7642
+ var tp = sbrk(count4 * size);
7643
+ var sp = sbrk(source.length);
7644
+ var heap = new Uint8Array(instance.exports.memory.buffer);
7645
+ heap.set(source, sp);
7646
+ var res = fun(tp, count, size, sp, source.length);
7647
+ if (res == 0 && filter) {
7648
+ filter(tp, count4, size);
7649
+ }
7650
+ target.set(heap.subarray(tp, tp + count * size));
7651
+ sbrk(tp - sbrk(0));
7652
+ if (res != 0) {
7653
+ throw new Error("Malformed buffer data: " + res);
7654
+ }
7655
+ };
7656
+
7657
+ var filters = {
7658
+ // legacy index-based enums for glTF
7659
+ 0: "",
7660
+ 1: "meshopt_decodeFilterOct",
7661
+ 2: "meshopt_decodeFilterQuat",
7662
+ 3: "meshopt_decodeFilterExp",
7663
+ // string-based enums for glTF
7664
+ NONE: "",
7665
+ OCTAHEDRAL: "meshopt_decodeFilterOct",
7666
+ QUATERNION: "meshopt_decodeFilterQuat",
7667
+ EXPONENTIAL: "meshopt_decodeFilterExp",
7668
+ };
7669
+
7670
+ var decoders = {
7671
+ // legacy index-based enums for glTF
7672
+ 0: "meshopt_decodeVertexBuffer",
7673
+ 1: "meshopt_decodeIndexBuffer",
7674
+ 2: "meshopt_decodeIndexSequence",
7675
+ // string-based enums for glTF
7676
+ ATTRIBUTES: "meshopt_decodeVertexBuffer",
7677
+ TRIANGLES: "meshopt_decodeIndexBuffer",
7678
+ INDICES: "meshopt_decodeIndexSequence",
7679
+ };
7680
+
7681
+ return {
7682
+ ready: promise,
7683
+ supported: true,
7684
+ decodeVertexBuffer: function(target, count, size, source, filter) {
7685
+ decode(instance.exports.meshopt_decodeVertexBuffer, target, count, size, source, instance.exports[filters[filter]]);
7686
+ },
7687
+ decodeIndexBuffer: function(target, count, size, source) {
7688
+ decode(instance.exports.meshopt_decodeIndexBuffer, target, count, size, source);
7689
+ },
7690
+ decodeIndexSequence: function(target, count, size, source) {
7691
+ decode(instance.exports.meshopt_decodeIndexSequence, target, count, size, source);
7692
+ },
7693
+ decodeGltfBuffer: function(target, count, size, source, mode, filter) {
7694
+ decode(instance.exports[decoders[mode]], target, count, size, source, instance.exports[filters[filter]]);
7695
+ }
7696
+ };
7697
+ })();
7698
+
7699
+ if (typeof exports === 'object' && typeof module === 'object')
7700
+ module.exports = MeshoptDecoder;
7701
+ else if (typeof define === 'function' && define['amd'])
7702
+ define([], function() {
7703
+ return MeshoptDecoder;
7704
+ });
7705
+ else if (typeof exports === 'object')
7706
+ exports["MeshoptDecoder"] = MeshoptDecoder;
7707
+ else
7708
+ (typeof self !== 'undefined' ? self : this).MeshoptDecoder = MeshoptDecoder;
7709
+ })();