vibeeditor-render 0.3.2 → 0.4.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.
@@ -0,0 +1,946 @@
1
+ "use strict";
2
+ (self["webpackChunkvibeeditor_render"] = self["webpackChunkvibeeditor_render"] || []).push([[129],{
3
+
4
+ /***/ 9129
5
+ (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
6
+
7
+ // ESM COMPAT FLAG
8
+ __webpack_require__.r(__webpack_exports__);
9
+
10
+ // EXPORTS
11
+ __webpack_require__.d(__webpack_exports__, {
12
+ TextureLoader: () => (/* binding */ TextureLoader)
13
+ });
14
+
15
+ ;// ./node_modules/three/src/loaders/Cache.js
16
+ /**
17
+ * @class
18
+ * @classdesc A simple caching system, used internally by {@link FileLoader}.
19
+ * To enable caching across all loaders that use {@link FileLoader}, add `THREE.Cache.enabled = true.` once in your app.
20
+ * @hideconstructor
21
+ */
22
+ const Cache = {
23
+
24
+ /**
25
+ * Whether caching is enabled or not.
26
+ *
27
+ * @static
28
+ * @type {boolean}
29
+ * @default false
30
+ */
31
+ enabled: false,
32
+
33
+ /**
34
+ * A dictionary that holds cached files.
35
+ *
36
+ * @static
37
+ * @type {Object<string,Object>}
38
+ */
39
+ files: {},
40
+
41
+ /**
42
+ * Adds a cache entry with a key to reference the file. If this key already
43
+ * holds a file, it is overwritten.
44
+ *
45
+ * @static
46
+ * @param {string} key - The key to reference the cached file.
47
+ * @param {Object} file - The file to be cached.
48
+ */
49
+ add: function ( key, file ) {
50
+
51
+ if ( this.enabled === false ) return;
52
+
53
+ if ( isBlobURL( key ) ) return;
54
+
55
+ // log( 'Cache', 'Adding key:', key );
56
+
57
+ this.files[ key ] = file;
58
+
59
+ },
60
+
61
+ /**
62
+ * Gets the cached value for the given key.
63
+ *
64
+ * @static
65
+ * @param {string} key - The key to reference the cached file.
66
+ * @return {Object|undefined} The cached file. If the key does not exist `undefined` is returned.
67
+ */
68
+ get: function ( key ) {
69
+
70
+ if ( this.enabled === false ) return;
71
+
72
+ if ( isBlobURL( key ) ) return;
73
+
74
+ // log( 'Cache', 'Checking key:', key );
75
+
76
+ return this.files[ key ];
77
+
78
+ },
79
+
80
+ /**
81
+ * Removes the cached file associated with the given key.
82
+ *
83
+ * @static
84
+ * @param {string} key - The key to reference the cached file.
85
+ */
86
+ remove: function ( key ) {
87
+
88
+ delete this.files[ key ];
89
+
90
+ },
91
+
92
+ /**
93
+ * Remove all values from the cache.
94
+ *
95
+ * @static
96
+ */
97
+ clear: function () {
98
+
99
+ this.files = {};
100
+
101
+ }
102
+
103
+ };
104
+
105
+ /**
106
+ * Returns true if the given cache key contains the blob: scheme.
107
+ *
108
+ * @private
109
+ * @param {string} key - The cache key.
110
+ * @return {boolean} Whether the given cache key contains the blob: scheme or not.
111
+ */
112
+ function isBlobURL( key ) {
113
+
114
+ try {
115
+
116
+ const urlString = key.slice( key.indexOf( ':' ) + 1 ); // remove type identifier
117
+
118
+ const url = new URL( urlString );
119
+ return url.protocol === 'blob:';
120
+
121
+ } catch ( e ) {
122
+
123
+ // If the string is not a valid URL, it throws an error
124
+ return false;
125
+
126
+ }
127
+
128
+ }
129
+
130
+
131
+
132
+ ;// ./node_modules/three/src/loaders/LoadingManager.js
133
+ /**
134
+ * Handles and keeps track of loaded and pending data. A default global
135
+ * instance of this class is created and used by loaders if not supplied
136
+ * manually.
137
+ *
138
+ * In general that should be sufficient, however there are times when it can
139
+ * be useful to have separate loaders - for example if you want to show
140
+ * separate loading bars for objects and textures.
141
+ *
142
+ * ```js
143
+ * const manager = new THREE.LoadingManager();
144
+ * manager.onLoad = () => console.log( 'Loading complete!' );
145
+ *
146
+ * const loader1 = new OBJLoader( manager );
147
+ * const loader2 = new ColladaLoader( manager );
148
+ * ```
149
+ */
150
+ class LoadingManager {
151
+
152
+ /**
153
+ * Constructs a new loading manager.
154
+ *
155
+ * @param {Function} [onLoad] - Executes when all items have been loaded.
156
+ * @param {Function} [onProgress] - Executes when single items have been loaded.
157
+ * @param {Function} [onError] - Executes when an error occurs.
158
+ */
159
+ constructor( onLoad, onProgress, onError ) {
160
+
161
+ const scope = this;
162
+
163
+ let isLoading = false;
164
+ let itemsLoaded = 0;
165
+ let itemsTotal = 0;
166
+ let urlModifier = undefined;
167
+ const handlers = [];
168
+
169
+ // Refer to #5689 for the reason why we don't set .onStart
170
+ // in the constructor
171
+
172
+ /**
173
+ * Executes when an item starts loading.
174
+ *
175
+ * @type {Function|undefined}
176
+ * @default undefined
177
+ */
178
+ this.onStart = undefined;
179
+
180
+ /**
181
+ * Executes when all items have been loaded.
182
+ *
183
+ * @type {Function|undefined}
184
+ * @default undefined
185
+ */
186
+ this.onLoad = onLoad;
187
+
188
+ /**
189
+ * Executes when single items have been loaded.
190
+ *
191
+ * @type {Function|undefined}
192
+ * @default undefined
193
+ */
194
+ this.onProgress = onProgress;
195
+
196
+ /**
197
+ * Executes when an error occurs.
198
+ *
199
+ * @type {Function|undefined}
200
+ * @default undefined
201
+ */
202
+ this.onError = onError;
203
+
204
+ /**
205
+ * Used for aborting ongoing requests in loaders using this manager.
206
+ *
207
+ * @private
208
+ * @type {AbortController | null}
209
+ */
210
+ this._abortController = null;
211
+
212
+ /**
213
+ * This should be called by any loader using the manager when the loader
214
+ * starts loading an item.
215
+ *
216
+ * @param {string} url - The URL to load.
217
+ */
218
+ this.itemStart = function ( url ) {
219
+
220
+ itemsTotal ++;
221
+
222
+ if ( isLoading === false ) {
223
+
224
+ if ( scope.onStart !== undefined ) {
225
+
226
+ scope.onStart( url, itemsLoaded, itemsTotal );
227
+
228
+ }
229
+
230
+ }
231
+
232
+ isLoading = true;
233
+
234
+ };
235
+
236
+ /**
237
+ * This should be called by any loader using the manager when the loader
238
+ * ended loading an item.
239
+ *
240
+ * @param {string} url - The URL of the loaded item.
241
+ */
242
+ this.itemEnd = function ( url ) {
243
+
244
+ itemsLoaded ++;
245
+
246
+ if ( scope.onProgress !== undefined ) {
247
+
248
+ scope.onProgress( url, itemsLoaded, itemsTotal );
249
+
250
+ }
251
+
252
+ if ( itemsLoaded === itemsTotal ) {
253
+
254
+ isLoading = false;
255
+
256
+ if ( scope.onLoad !== undefined ) {
257
+
258
+ scope.onLoad();
259
+
260
+ }
261
+
262
+ }
263
+
264
+ };
265
+
266
+ /**
267
+ * This should be called by any loader using the manager when the loader
268
+ * encounters an error when loading an item.
269
+ *
270
+ * @param {string} url - The URL of the item that produces an error.
271
+ */
272
+ this.itemError = function ( url ) {
273
+
274
+ if ( scope.onError !== undefined ) {
275
+
276
+ scope.onError( url );
277
+
278
+ }
279
+
280
+ };
281
+
282
+ /**
283
+ * Given a URL, uses the URL modifier callback (if any) and returns a
284
+ * resolved URL. If no URL modifier is set, returns the original URL.
285
+ *
286
+ * @param {string} url - The URL to load.
287
+ * @return {string} The resolved URL.
288
+ */
289
+ this.resolveURL = function ( url ) {
290
+
291
+ // Normalize to NFC so that Unicode URIs (e.g. from glTF)
292
+ // are percent-encoded correctly per RFC 3987.
293
+
294
+ url = url.normalize( 'NFC' );
295
+
296
+ if ( urlModifier ) {
297
+
298
+ return urlModifier( url );
299
+
300
+ }
301
+
302
+ return url;
303
+
304
+ };
305
+
306
+ /**
307
+ * If provided, the callback will be passed each resource URL before a
308
+ * request is sent. The callback may return the original URL, or a new URL to
309
+ * override loading behavior. This behavior can be used to load assets from
310
+ * .ZIP files, drag-and-drop APIs, and Data URIs.
311
+ *
312
+ * ```js
313
+ * const blobs = {'fish.gltf': blob1, 'diffuse.png': blob2, 'normal.png': blob3};
314
+ *
315
+ * const manager = new THREE.LoadingManager();
316
+ *
317
+ * // Initialize loading manager with URL callback.
318
+ * const objectURLs = [];
319
+ * manager.setURLModifier( ( url ) => {
320
+ *
321
+ * url = URL.createObjectURL( blobs[ url ] );
322
+ * objectURLs.push( url );
323
+ * return url;
324
+ *
325
+ * } );
326
+ *
327
+ * // Load as usual, then revoke the blob URLs.
328
+ * const loader = new GLTFLoader( manager );
329
+ * loader.load( 'fish.gltf', (gltf) => {
330
+ *
331
+ * scene.add( gltf.scene );
332
+ * objectURLs.forEach( ( url ) => URL.revokeObjectURL( url ) );
333
+ *
334
+ * } );
335
+ * ```
336
+ *
337
+ * @param {function(string):string} transform - URL modifier callback. Called with an URL and must return a resolved URL.
338
+ * @return {LoadingManager} A reference to this loading manager.
339
+ */
340
+ this.setURLModifier = function ( transform ) {
341
+
342
+ urlModifier = transform;
343
+
344
+ return this;
345
+
346
+ };
347
+
348
+ /**
349
+ * Registers a loader with the given regular expression. Can be used to
350
+ * define what loader should be used in order to load specific files. A
351
+ * typical use case is to overwrite the default loader for textures.
352
+ *
353
+ * ```js
354
+ * // add handler for TGA textures
355
+ * manager.addHandler( /\.tga$/i, new TGALoader() );
356
+ * ```
357
+ *
358
+ * @param {string} regex - A regular expression.
359
+ * @param {Loader} loader - A loader that should handle matched cases.
360
+ * @return {LoadingManager} A reference to this loading manager.
361
+ */
362
+ this.addHandler = function ( regex, loader ) {
363
+
364
+ handlers.push( regex, loader );
365
+
366
+ return this;
367
+
368
+ };
369
+
370
+ /**
371
+ * Removes the loader for the given regular expression.
372
+ *
373
+ * @param {string} regex - A regular expression.
374
+ * @return {LoadingManager} A reference to this loading manager.
375
+ */
376
+ this.removeHandler = function ( regex ) {
377
+
378
+ const index = handlers.indexOf( regex );
379
+
380
+ if ( index !== - 1 ) {
381
+
382
+ handlers.splice( index, 2 );
383
+
384
+ }
385
+
386
+ return this;
387
+
388
+ };
389
+
390
+ /**
391
+ * Can be used to retrieve the registered loader for the given file path.
392
+ *
393
+ * @param {string} file - The file path.
394
+ * @return {?Loader} The registered loader. Returns `null` if no loader was found.
395
+ */
396
+ this.getHandler = function ( file ) {
397
+
398
+ for ( let i = 0, l = handlers.length; i < l; i += 2 ) {
399
+
400
+ const regex = handlers[ i ];
401
+ const loader = handlers[ i + 1 ];
402
+
403
+ if ( regex.global ) regex.lastIndex = 0; // see #17920
404
+
405
+ if ( regex.test( file ) ) {
406
+
407
+ return loader;
408
+
409
+ }
410
+
411
+ }
412
+
413
+ return null;
414
+
415
+ };
416
+
417
+ /**
418
+ * Can be used to abort ongoing loading requests in loaders using this manager.
419
+ * The abort only works if the loaders implement {@link Loader#abort} and `AbortSignal.any()`
420
+ * is supported in the browser.
421
+ *
422
+ * @return {LoadingManager} A reference to this loading manager.
423
+ */
424
+ this.abort = function () {
425
+
426
+
427
+ this.abortController.abort();
428
+ this._abortController = null;
429
+
430
+ return this;
431
+
432
+ };
433
+
434
+ }
435
+
436
+ // TODO: Revert this back to a single member variable once this issue has been fixed
437
+ // https://github.com/cloudflare/workerd/issues/3657
438
+
439
+ /**
440
+ * Used for aborting ongoing requests in loaders using this manager.
441
+ *
442
+ * @type {AbortController}
443
+ */
444
+ get abortController() {
445
+
446
+ if ( ! this._abortController ) {
447
+
448
+ this._abortController = new AbortController();
449
+
450
+ }
451
+
452
+ return this._abortController;
453
+
454
+ }
455
+
456
+ }
457
+
458
+ /**
459
+ * The global default loading manager.
460
+ *
461
+ * @constant
462
+ * @type {LoadingManager}
463
+ */
464
+ const DefaultLoadingManager = /*@__PURE__*/ new LoadingManager();
465
+
466
+
467
+
468
+ ;// ./node_modules/three/src/loaders/Loader.js
469
+
470
+
471
+ /**
472
+ * Abstract base class for loaders.
473
+ *
474
+ * @abstract
475
+ */
476
+ class Loader {
477
+
478
+ /**
479
+ * Constructs a new loader.
480
+ *
481
+ * @param {LoadingManager} [manager] - The loading manager.
482
+ */
483
+ constructor( manager ) {
484
+
485
+ /**
486
+ * The loading manager.
487
+ *
488
+ * @type {LoadingManager}
489
+ * @default DefaultLoadingManager
490
+ */
491
+ this.manager = ( manager !== undefined ) ? manager : DefaultLoadingManager;
492
+
493
+ /**
494
+ * The crossOrigin string to implement CORS for loading the url from a
495
+ * different domain that allows CORS.
496
+ *
497
+ * @type {string}
498
+ * @default 'anonymous'
499
+ */
500
+ this.crossOrigin = 'anonymous';
501
+
502
+ /**
503
+ * Whether the XMLHttpRequest uses credentials.
504
+ *
505
+ * @type {boolean}
506
+ * @default false
507
+ */
508
+ this.withCredentials = false;
509
+
510
+ /**
511
+ * The base path from which the asset will be loaded.
512
+ *
513
+ * @type {string}
514
+ */
515
+ this.path = '';
516
+
517
+ /**
518
+ * The base path from which additional resources like textures will be loaded.
519
+ *
520
+ * @type {string}
521
+ */
522
+ this.resourcePath = '';
523
+
524
+ /**
525
+ * The [request header](https://developer.mozilla.org/en-US/docs/Glossary/Request_header)
526
+ * used in HTTP request.
527
+ *
528
+ * @type {Object<string, any>}
529
+ */
530
+ this.requestHeader = {};
531
+
532
+ if ( typeof __THREE_DEVTOOLS__ !== 'undefined' ) {
533
+
534
+ __THREE_DEVTOOLS__.dispatchEvent( new CustomEvent( 'observe', { detail: this } ) );
535
+
536
+ }
537
+
538
+ }
539
+
540
+ /**
541
+ * This method needs to be implemented by all concrete loaders. It holds the
542
+ * logic for loading assets from the backend.
543
+ *
544
+ * @abstract
545
+ * @param {string} url - The path/URL of the file to be loaded.
546
+ * @param {Function} onLoad - Executed when the loading process has been finished.
547
+ * @param {onProgressCallback} [onProgress] - Executed while the loading is in progress.
548
+ * @param {onErrorCallback} [onError] - Executed when errors occur.
549
+ */
550
+ load( /* url, onLoad, onProgress, onError */ ) {}
551
+
552
+ /**
553
+ * A async version of {@link Loader#load}.
554
+ *
555
+ * @param {string} url - The path/URL of the file to be loaded.
556
+ * @param {onProgressCallback} [onProgress] - Executed while the loading is in progress.
557
+ * @return {Promise} A Promise that resolves when the asset has been loaded.
558
+ */
559
+ loadAsync( url, onProgress ) {
560
+
561
+ const scope = this;
562
+
563
+ return new Promise( function ( resolve, reject ) {
564
+
565
+ scope.load( url, resolve, onProgress, reject );
566
+
567
+ } );
568
+
569
+ }
570
+
571
+ /**
572
+ * This method needs to be implemented by all concrete loaders. It holds the
573
+ * logic for parsing the asset into three.js entities.
574
+ *
575
+ * @abstract
576
+ * @param {any} data - The data to parse.
577
+ */
578
+ parse( /* data */ ) {}
579
+
580
+ /**
581
+ * Sets the `crossOrigin` String to implement CORS for loading the URL
582
+ * from a different domain that allows CORS.
583
+ *
584
+ * @param {string} crossOrigin - The `crossOrigin` value.
585
+ * @return {Loader} A reference to this instance.
586
+ */
587
+ setCrossOrigin( crossOrigin ) {
588
+
589
+ this.crossOrigin = crossOrigin;
590
+ return this;
591
+
592
+ }
593
+
594
+ /**
595
+ * Whether the XMLHttpRequest uses credentials such as cookies, authorization
596
+ * headers or TLS client certificates, see [XMLHttpRequest.withCredentials](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/withCredentials).
597
+ *
598
+ * Note: This setting has no effect if you are loading files locally or from the same domain.
599
+ *
600
+ * @param {boolean} value - The `withCredentials` value.
601
+ * @return {Loader} A reference to this instance.
602
+ */
603
+ setWithCredentials( value ) {
604
+
605
+ this.withCredentials = value;
606
+ return this;
607
+
608
+ }
609
+
610
+ /**
611
+ * Sets the base path for the asset.
612
+ *
613
+ * @param {string} path - The base path.
614
+ * @return {Loader} A reference to this instance.
615
+ */
616
+ setPath( path ) {
617
+
618
+ this.path = path;
619
+ return this;
620
+
621
+ }
622
+
623
+ /**
624
+ * Sets the base path for dependent resources like textures.
625
+ *
626
+ * @param {string} resourcePath - The resource path.
627
+ * @return {Loader} A reference to this instance.
628
+ */
629
+ setResourcePath( resourcePath ) {
630
+
631
+ this.resourcePath = resourcePath;
632
+ return this;
633
+
634
+ }
635
+
636
+ /**
637
+ * Sets the given request header.
638
+ *
639
+ * @param {Object} requestHeader - A [request header](https://developer.mozilla.org/en-US/docs/Glossary/Request_header)
640
+ * for configuring the HTTP request.
641
+ * @return {Loader} A reference to this instance.
642
+ */
643
+ setRequestHeader( requestHeader ) {
644
+
645
+ this.requestHeader = requestHeader;
646
+ return this;
647
+
648
+ }
649
+
650
+ /**
651
+ * This method can be implemented in loaders for aborting ongoing requests.
652
+ *
653
+ * @abstract
654
+ * @return {Loader} A reference to this instance.
655
+ */
656
+ abort() {
657
+
658
+ return this;
659
+
660
+ }
661
+
662
+ }
663
+
664
+ /**
665
+ * Callback for onProgress in loaders.
666
+ *
667
+ * @callback onProgressCallback
668
+ * @param {ProgressEvent} event - An instance of `ProgressEvent` that represents the current loading status.
669
+ */
670
+
671
+ /**
672
+ * Callback for onError in loaders.
673
+ *
674
+ * @callback onErrorCallback
675
+ * @param {Error} error - The error which occurred during the loading process.
676
+ */
677
+
678
+ /**
679
+ * The default material name that is used by loaders
680
+ * when creating materials for loaded 3D objects.
681
+ *
682
+ * Note: Not all loaders might honor this setting.
683
+ *
684
+ * @static
685
+ * @type {string}
686
+ * @default '__DEFAULT'
687
+ */
688
+ Loader.DEFAULT_MATERIAL_NAME = '__DEFAULT';
689
+
690
+
691
+
692
+ // EXTERNAL MODULE: ./node_modules/three/src/utils.js
693
+ var utils = __webpack_require__(8108);
694
+ ;// ./node_modules/three/src/loaders/ImageLoader.js
695
+
696
+
697
+
698
+
699
+ const _loading = new WeakMap();
700
+
701
+ /**
702
+ * A loader for loading images. The class loads images with the HTML `Image` API.
703
+ *
704
+ * ```js
705
+ * const loader = new THREE.ImageLoader();
706
+ * const image = await loader.loadAsync( 'image.png' );
707
+ * ```
708
+ * Please note that `ImageLoader` has dropped support for progress
709
+ * events in `r84`. For an `ImageLoader` that supports progress events, see
710
+ * [this thread](https://github.com/mrdoob/three.js/issues/10439#issuecomment-275785639).
711
+ *
712
+ * @augments Loader
713
+ */
714
+ class ImageLoader extends Loader {
715
+
716
+ /**
717
+ * Constructs a new image loader.
718
+ *
719
+ * @param {LoadingManager} [manager] - The loading manager.
720
+ */
721
+ constructor( manager ) {
722
+
723
+ super( manager );
724
+
725
+ }
726
+
727
+ /**
728
+ * Starts loading from the given URL and passes the loaded image
729
+ * to the `onLoad()` callback. The method also returns a new `Image` object which can
730
+ * directly be used for texture creation. If you do it this way, the texture
731
+ * may pop up in your scene once the respective loading process is finished.
732
+ *
733
+ * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI.
734
+ * @param {function(Image)} onLoad - Executed when the loading process has been finished.
735
+ * @param {onProgressCallback} onProgress - Unsupported in this loader.
736
+ * @param {onErrorCallback} onError - Executed when errors occur.
737
+ * @return {Image} The image.
738
+ */
739
+ load( url, onLoad, onProgress, onError ) {
740
+
741
+ if ( this.path !== undefined ) url = this.path + url;
742
+
743
+ url = this.manager.resolveURL( url );
744
+
745
+ const scope = this;
746
+
747
+ const cached = Cache.get( `image:${url}` );
748
+
749
+ if ( cached !== undefined ) {
750
+
751
+ if ( cached.complete === true ) {
752
+
753
+ scope.manager.itemStart( url );
754
+
755
+ setTimeout( function () {
756
+
757
+ if ( onLoad ) onLoad( cached );
758
+
759
+ scope.manager.itemEnd( url );
760
+
761
+ }, 0 );
762
+
763
+ } else {
764
+
765
+ let arr = _loading.get( cached );
766
+
767
+ if ( arr === undefined ) {
768
+
769
+ arr = [];
770
+ _loading.set( cached, arr );
771
+
772
+ }
773
+
774
+ arr.push( { onLoad, onError } );
775
+
776
+ }
777
+
778
+ return cached;
779
+
780
+ }
781
+
782
+ const image = (0,utils/* createElementNS */.qq)( 'img' );
783
+
784
+ function onImageLoad() {
785
+
786
+ removeEventListeners();
787
+
788
+ if ( onLoad ) onLoad( this );
789
+
790
+ //
791
+
792
+ const callbacks = _loading.get( this ) || [];
793
+
794
+ for ( let i = 0; i < callbacks.length; i ++ ) {
795
+
796
+ const callback = callbacks[ i ];
797
+ if ( callback.onLoad ) callback.onLoad( this );
798
+
799
+ }
800
+
801
+ _loading.delete( this );
802
+
803
+ scope.manager.itemEnd( url );
804
+
805
+ }
806
+
807
+ function onImageError( event ) {
808
+
809
+ removeEventListeners();
810
+
811
+ if ( onError ) onError( event );
812
+
813
+ Cache.remove( `image:${url}` );
814
+
815
+ //
816
+
817
+ const callbacks = _loading.get( this ) || [];
818
+
819
+ for ( let i = 0; i < callbacks.length; i ++ ) {
820
+
821
+ const callback = callbacks[ i ];
822
+ if ( callback.onError ) callback.onError( event );
823
+
824
+ }
825
+
826
+ _loading.delete( this );
827
+
828
+
829
+ scope.manager.itemError( url );
830
+ scope.manager.itemEnd( url );
831
+
832
+ }
833
+
834
+ function removeEventListeners() {
835
+
836
+ image.removeEventListener( 'load', onImageLoad, false );
837
+ image.removeEventListener( 'error', onImageError, false );
838
+
839
+ }
840
+
841
+ image.addEventListener( 'load', onImageLoad, false );
842
+ image.addEventListener( 'error', onImageError, false );
843
+
844
+ if ( url.slice( 0, 5 ) !== 'data:' ) {
845
+
846
+ if ( this.crossOrigin !== undefined ) image.crossOrigin = this.crossOrigin;
847
+
848
+ }
849
+
850
+ Cache.add( `image:${url}`, image );
851
+ scope.manager.itemStart( url );
852
+
853
+ image.src = url;
854
+
855
+ return image;
856
+
857
+ }
858
+
859
+ }
860
+
861
+
862
+
863
+
864
+ // EXTERNAL MODULE: ./node_modules/three/src/textures/Texture.js + 9 modules
865
+ var Texture = __webpack_require__(5805);
866
+ ;// ./node_modules/three/src/loaders/TextureLoader.js
867
+
868
+
869
+
870
+
871
+ /**
872
+ * Class for loading textures. Images are internally
873
+ * loaded via {@link ImageLoader}.
874
+ *
875
+ * ```js
876
+ * const loader = new THREE.TextureLoader();
877
+ * const texture = await loader.loadAsync( 'textures/land_ocean_ice_cloud_2048.jpg' );
878
+ *
879
+ * const material = new THREE.MeshBasicMaterial( { map:texture } );
880
+ * ```
881
+ * Please note that `TextureLoader` has dropped support for progress
882
+ * events in `r84`. For a `TextureLoader` that supports progress events, see
883
+ * [this thread](https://github.com/mrdoob/three.js/issues/10439#issuecomment-293260145).
884
+ *
885
+ * @augments Loader
886
+ */
887
+ class TextureLoader extends Loader {
888
+
889
+ /**
890
+ * Constructs a new texture loader.
891
+ *
892
+ * @param {LoadingManager} [manager] - The loading manager.
893
+ */
894
+ constructor( manager ) {
895
+
896
+ super( manager );
897
+
898
+ }
899
+
900
+ /**
901
+ * Starts loading from the given URL and pass the fully loaded texture
902
+ * to the `onLoad()` callback. The method also returns a new texture object which can
903
+ * directly be used for material creation. If you do it this way, the texture
904
+ * may pop up in your scene once the respective loading process is finished.
905
+ *
906
+ * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI.
907
+ * @param {function(Texture)} onLoad - Executed when the loading process has been finished.
908
+ * @param {onProgressCallback} onProgress - Unsupported in this loader.
909
+ * @param {onErrorCallback} onError - Executed when errors occur.
910
+ * @return {Texture} The texture.
911
+ */
912
+ load( url, onLoad, onProgress, onError ) {
913
+
914
+ const texture = new Texture/* Texture */.g();
915
+
916
+ const loader = new ImageLoader( this.manager );
917
+ loader.setCrossOrigin( this.crossOrigin );
918
+ loader.setPath( this.path );
919
+
920
+ loader.load( url, function ( image ) {
921
+
922
+ texture.image = image;
923
+ texture.needsUpdate = true;
924
+
925
+ if ( onLoad !== undefined ) {
926
+
927
+ onLoad( texture );
928
+
929
+ }
930
+
931
+ }, onProgress, onError );
932
+
933
+ return texture;
934
+
935
+ }
936
+
937
+ }
938
+
939
+
940
+
941
+
942
+
943
+ /***/ }
944
+
945
+ }]);
946
+ //# sourceMappingURL=129.bundle.js.map