@realsee/five 6.0.0-alpha.70 → 6.0.0-alpha.71
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.
- package/five/index.js +17 -1708
- package/five/index.mjs +30416 -17367
- package/gltf-loader/index.js +2 -8
- package/gltf-loader/index.mjs +1977 -989
- package/line/index.js +2 -201
- package/line/index.mjs +447 -433
- package/package.json +1 -1
- package/react/index.js +2 -2
- package/react/index.mjs +934 -613
- package/sticker/index.js +2 -2
- package/sticker/index.mjs +156 -91
- package/umd/five-gltf-loader.js +2 -8
- package/umd/five-line.js +2 -201
- package/umd/five-react.js +2 -2
- package/umd/five-sticker.js +2 -2
- package/umd/five-vfx.js +2 -286
- package/umd/five-vue.js +2 -2
- package/umd/five.js +104 -1795
- package/vfx/index.js +2 -286
- package/vfx/index.mjs +530 -590
- package/vue/index.js +2 -2
- package/vue/index.mjs +370 -229
package/sticker/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @license
|
|
3
3
|
* @realsee/five
|
|
4
4
|
* Generated: 12/20/2023
|
|
5
|
-
* Version: 6.0.0-alpha.
|
|
5
|
+
* Version: 6.0.0-alpha.71
|
|
6
6
|
* Terms:
|
|
7
7
|
* Realsee SDK License Agreement
|
|
8
8
|
* Update: July 28, 2021
|
|
@@ -252,4 +252,4 @@
|
|
|
252
252
|
* No amendment to or modification of this Agreement will be binding unless in
|
|
253
253
|
* writing and signed by Realsee. You and Realsee hereto confirm that this
|
|
254
254
|
* Agreement and all related documents shall be drafted in English.
|
|
255
|
-
*/"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});
|
|
255
|
+
*/"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function e(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e)for(const n in e)if("default"!==n){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}return t.default=e,Object.freeze(t)}const t=e(require("three"));var n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)};"function"==typeof SuppressedError&&SuppressedError;var r=new Float32Array([-.5,-.5,0,.5,-.5,0,-.5,.5,0,.5,.5,0]),i=new Float32Array([0,0,1,0,0,1,1,1]),o=new Uint8Array([0,1,2,1,3,2]),a=new t.BufferGeometry;a.setAttribute("position",new t.BufferAttribute(r,3)),a.setAttribute("uv",new t.BufferAttribute(i,2)),a.setIndex(new t.BufferAttribute(o,1));var s=window,u=s.requestAnimationFrame||s.mozRequestAnimationFrame||s.webkitRequestAnimationFrame||s.msRequestAnimationFrame||function(e){return setTimeout(e,16)},p="undefined"!=typeof performance&&void 0!==performance.timing?performance.timing.navigationStart:Date.now(),c="undefined"!=typeof performance?function(){return p+performance.now()}:function(){return Date.now()};function f(e,t){var n=e.dispose;e.dispose=function(){t(),n.call(e)}}var d=function(e){function r(n,r,i){var o,s,p,d,l,m,g=this,v=new t.MeshBasicMaterial;if((g=e.call(this,a,v)||this)._needsRender=!1,g.scale.set(n,r,1),"string"==typeof i){v.transparent=/\.png$/.test(i);var y=new Image;y.src=i,y.crossOrigin="",i=y}if(i instanceof HTMLImageElement){var h=v.map=new t.Texture;h.wrapS=t.ClampToEdgeWrapping,h.wrapT=t.ClampToEdgeWrapping,h.minFilter=t.LinearFilter,h.encoding=t.sRGBEncoding,f(h,function(e,t){e.naturalWidth>0&&u((function(){return t()}));var n=function(){return t()};return e.addEventListener("load",n,!1),function(){return e.removeEventListener("load",n,!1)}}(i,(function(){h.image=i,h.needsUpdate=!0,g._needsRender=!0})))}else if(i instanceof HTMLCanvasElement)v.map=new t.CanvasTexture(i);else if(i instanceof HTMLVideoElement){var w=v.map=new t.VideoTexture(i);w.wrapS=t.ClampToEdgeWrapping,w.wrapT=t.ClampToEdgeWrapping,w.minFilter=t.LinearFilter,w.encoding=t.sRGBEncoding,f(w,(o=i,s=function(){g._needsRender=!0},p=c(),d=!1,l=function(){d=!0,s(),c()-p<3e3?u(l):d=!1},m=function(){p=c(),!1===d&&l()},o.addEventListener("timeupdate",m,!1),function(){o.removeEventListener("timeupdate",m,!1),d=!1}))}return g}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}(r,e),Object.defineProperty(r,"version",{get:function(){return"6.0.0-alpha.71"},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"needsRender",{get:function(){return this._needsRender},set:function(e){this._needsRender=e,!0===e&&this.material.map&&(this.material.map.needsUpdate=!0)},enumerable:!1,configurable:!0}),r.prototype.setSize=function(e,t){this.scale.set(e,t,1),this._needsRender=!0},r.prototype.setTransparent=function(e){this.material.transparent=e,this._needsRender=!0},r.prototype.locationWithIntersection=function(e,t){void 0===t&&(t=.005);var n=e.point,r=e.face;this.position.copy(n),r&&(this.position.add(r.normal.clone().setLength(t)),this.lookAt(n.clone().add(r.normal))),this._needsRender=!0},r.prototype.dispose=function(){var e;null===(e=this.material.map)||void 0===e||e.dispose(),this.material.dispose()},r}(t.Mesh);exports.Sticker=d;
|
package/sticker/index.mjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @license
|
|
3
3
|
* @realsee/five
|
|
4
4
|
* Generated: 12/20/2023
|
|
5
|
-
* Version: 6.0.0-alpha.
|
|
5
|
+
* Version: 6.0.0-alpha.71
|
|
6
6
|
* Terms:
|
|
7
7
|
* Realsee SDK License Agreement
|
|
8
8
|
* Update: July 28, 2021
|
|
@@ -252,25 +252,31 @@
|
|
|
252
252
|
* No amendment to or modification of this Agreement will be binding unless in
|
|
253
253
|
* writing and signed by Realsee. You and Realsee hereto confirm that this
|
|
254
254
|
* Agreement and all related documents shall be drafted in English.
|
|
255
|
-
*/import * as
|
|
256
|
-
var
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
} || function(
|
|
260
|
-
for (var
|
|
261
|
-
Object.prototype.hasOwnProperty.call(
|
|
262
|
-
|
|
255
|
+
*/import * as THREE from "three";
|
|
256
|
+
var extendStatics = function(d, b) {
|
|
257
|
+
extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
|
|
258
|
+
d2.__proto__ = b2;
|
|
259
|
+
} || function(d2, b2) {
|
|
260
|
+
for (var p in b2)
|
|
261
|
+
if (Object.prototype.hasOwnProperty.call(b2, p))
|
|
262
|
+
d2[p] = b2[p];
|
|
263
|
+
};
|
|
264
|
+
return extendStatics(d, b);
|
|
263
265
|
};
|
|
264
|
-
function
|
|
265
|
-
if (typeof
|
|
266
|
-
throw new TypeError("Class extends value " + String(
|
|
267
|
-
|
|
268
|
-
function
|
|
269
|
-
this.constructor =
|
|
266
|
+
function __extends(d, b) {
|
|
267
|
+
if (typeof b !== "function" && b !== null)
|
|
268
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
269
|
+
extendStatics(d, b);
|
|
270
|
+
function __() {
|
|
271
|
+
this.constructor = d;
|
|
270
272
|
}
|
|
271
|
-
|
|
273
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
272
274
|
}
|
|
273
|
-
|
|
275
|
+
typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed, message) {
|
|
276
|
+
var e = new Error(message);
|
|
277
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
278
|
+
};
|
|
279
|
+
var vertices = new Float32Array([
|
|
274
280
|
-0.5,
|
|
275
281
|
-0.5,
|
|
276
282
|
0,
|
|
@@ -283,7 +289,8 @@ var h = new Float32Array([
|
|
|
283
289
|
0.5,
|
|
284
290
|
0.5,
|
|
285
291
|
0
|
|
286
|
-
])
|
|
292
|
+
]);
|
|
293
|
+
var uvs = new Float32Array([
|
|
287
294
|
0,
|
|
288
295
|
0,
|
|
289
296
|
1,
|
|
@@ -292,108 +299,166 @@ var h = new Float32Array([
|
|
|
292
299
|
1,
|
|
293
300
|
1,
|
|
294
301
|
1
|
|
295
|
-
])
|
|
302
|
+
]);
|
|
303
|
+
var index = new Uint8Array([
|
|
296
304
|
0,
|
|
297
305
|
1,
|
|
298
306
|
2,
|
|
299
307
|
1,
|
|
300
308
|
3,
|
|
301
309
|
2
|
|
302
|
-
])
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
return
|
|
310
|
+
]);
|
|
311
|
+
var geometry = new THREE.BufferGeometry();
|
|
312
|
+
geometry.setAttribute("position", new THREE.BufferAttribute(vertices, 3));
|
|
313
|
+
geometry.setAttribute("uv", new THREE.BufferAttribute(uvs, 2));
|
|
314
|
+
geometry.setIndex(new THREE.BufferAttribute(index, 1));
|
|
315
|
+
var window_ = window;
|
|
316
|
+
var _requestAnimationFrame = window_.requestAnimationFrame || window_.mozRequestAnimationFrame || window_.webkitRequestAnimationFrame || window_.msRequestAnimationFrame || function(fn) {
|
|
317
|
+
return setTimeout(fn, 16);
|
|
318
|
+
};
|
|
319
|
+
var start = typeof performance !== "undefined" && typeof performance.timing !== "undefined" ? performance.timing.navigationStart : Date.now();
|
|
320
|
+
var now = typeof performance !== "undefined" ? function() {
|
|
321
|
+
return start + performance.now();
|
|
310
322
|
} : function() {
|
|
311
323
|
return Date.now();
|
|
312
324
|
};
|
|
313
|
-
function
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
325
|
+
function imageReady(image, callback) {
|
|
326
|
+
if (image.naturalWidth > 0) {
|
|
327
|
+
_requestAnimationFrame(function() {
|
|
328
|
+
return callback();
|
|
329
|
+
});
|
|
330
|
+
}
|
|
331
|
+
var onLoad = function() {
|
|
332
|
+
return callback();
|
|
319
333
|
};
|
|
320
|
-
|
|
321
|
-
|
|
334
|
+
image.addEventListener("load", onLoad, false);
|
|
335
|
+
return function() {
|
|
336
|
+
return image.removeEventListener("load", onLoad, false);
|
|
322
337
|
};
|
|
323
338
|
}
|
|
324
|
-
function
|
|
325
|
-
var
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
339
|
+
function videoReady(video, callback) {
|
|
340
|
+
var lastUpdateTime = now();
|
|
341
|
+
var looping = false;
|
|
342
|
+
var loop = function() {
|
|
343
|
+
looping = true;
|
|
344
|
+
callback();
|
|
345
|
+
var updateTime = now();
|
|
346
|
+
if (updateTime - lastUpdateTime < 3e3) {
|
|
347
|
+
_requestAnimationFrame(loop);
|
|
348
|
+
} else {
|
|
349
|
+
looping = false;
|
|
350
|
+
}
|
|
351
|
+
};
|
|
352
|
+
var onUpdate = function() {
|
|
353
|
+
lastUpdateTime = now();
|
|
354
|
+
if (looping === false)
|
|
355
|
+
loop();
|
|
331
356
|
};
|
|
332
|
-
|
|
333
|
-
|
|
357
|
+
video.addEventListener("timeupdate", onUpdate, false);
|
|
358
|
+
return function() {
|
|
359
|
+
video.removeEventListener("timeupdate", onUpdate, false);
|
|
360
|
+
looping = false;
|
|
334
361
|
};
|
|
335
362
|
}
|
|
336
|
-
function
|
|
337
|
-
var
|
|
338
|
-
|
|
339
|
-
|
|
363
|
+
function injectDispose(texture, dispose) {
|
|
364
|
+
var _dispose = texture.dispose;
|
|
365
|
+
texture.dispose = function() {
|
|
366
|
+
dispose();
|
|
367
|
+
_dispose.call(texture);
|
|
340
368
|
};
|
|
341
369
|
}
|
|
342
|
-
var
|
|
370
|
+
var Sticker = (
|
|
343
371
|
/** @class */
|
|
344
|
-
function(
|
|
345
|
-
|
|
346
|
-
function
|
|
347
|
-
var
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
372
|
+
function(_super) {
|
|
373
|
+
__extends(Sticker2, _super);
|
|
374
|
+
function Sticker2(width, height, resource) {
|
|
375
|
+
var _this = this;
|
|
376
|
+
var material = new THREE.MeshBasicMaterial();
|
|
377
|
+
_this = _super.call(this, geometry, material) || this;
|
|
378
|
+
_this._needsRender = false;
|
|
379
|
+
_this.scale.set(width, height, 1);
|
|
380
|
+
if (typeof resource === "string") {
|
|
381
|
+
material.transparent = /\.png$/.test(resource);
|
|
382
|
+
var image = new Image();
|
|
383
|
+
image.src = resource;
|
|
384
|
+
image.crossOrigin = "";
|
|
385
|
+
resource = image;
|
|
352
386
|
}
|
|
353
|
-
if (
|
|
354
|
-
var
|
|
355
|
-
|
|
356
|
-
|
|
387
|
+
if (resource instanceof HTMLImageElement) {
|
|
388
|
+
var texture_1 = material.map = new THREE.Texture();
|
|
389
|
+
texture_1.wrapS = THREE.ClampToEdgeWrapping;
|
|
390
|
+
texture_1.wrapT = THREE.ClampToEdgeWrapping;
|
|
391
|
+
texture_1.minFilter = THREE.LinearFilter;
|
|
392
|
+
texture_1.encoding = THREE.sRGBEncoding;
|
|
393
|
+
injectDispose(texture_1, imageReady(resource, function() {
|
|
394
|
+
texture_1.image = resource;
|
|
395
|
+
texture_1.needsUpdate = true;
|
|
396
|
+
_this._needsRender = true;
|
|
357
397
|
}));
|
|
358
|
-
} else if (
|
|
359
|
-
|
|
360
|
-
else if (
|
|
361
|
-
var
|
|
362
|
-
|
|
363
|
-
|
|
398
|
+
} else if (resource instanceof HTMLCanvasElement) {
|
|
399
|
+
material.map = new THREE.CanvasTexture(resource);
|
|
400
|
+
} else if (resource instanceof HTMLVideoElement) {
|
|
401
|
+
var texture = material.map = new THREE.VideoTexture(resource);
|
|
402
|
+
texture.wrapS = THREE.ClampToEdgeWrapping;
|
|
403
|
+
texture.wrapT = THREE.ClampToEdgeWrapping;
|
|
404
|
+
texture.minFilter = THREE.LinearFilter;
|
|
405
|
+
texture.encoding = THREE.sRGBEncoding;
|
|
406
|
+
injectDispose(texture, videoReady(resource, function() {
|
|
407
|
+
_this._needsRender = true;
|
|
364
408
|
}));
|
|
365
409
|
}
|
|
366
|
-
return
|
|
410
|
+
return _this;
|
|
367
411
|
}
|
|
368
|
-
|
|
412
|
+
Object.defineProperty(Sticker2, "version", {
|
|
369
413
|
get: function() {
|
|
370
|
-
return "6.0.0-alpha.
|
|
414
|
+
return "6.0.0-alpha.71";
|
|
371
415
|
},
|
|
372
|
-
enumerable:
|
|
373
|
-
configurable:
|
|
374
|
-
})
|
|
416
|
+
enumerable: false,
|
|
417
|
+
configurable: true
|
|
418
|
+
});
|
|
419
|
+
Object.defineProperty(Sticker2.prototype, "needsRender", {
|
|
375
420
|
get: function() {
|
|
376
421
|
return this._needsRender;
|
|
377
422
|
},
|
|
378
|
-
set: function(
|
|
379
|
-
this._needsRender =
|
|
423
|
+
set: function(value) {
|
|
424
|
+
this._needsRender = value;
|
|
425
|
+
if (value === true) {
|
|
426
|
+
if (this.material.map) {
|
|
427
|
+
this.material.map.needsUpdate = true;
|
|
428
|
+
}
|
|
429
|
+
}
|
|
380
430
|
},
|
|
381
|
-
enumerable:
|
|
382
|
-
configurable:
|
|
383
|
-
})
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
this.
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
this.
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
(
|
|
394
|
-
|
|
395
|
-
|
|
431
|
+
enumerable: false,
|
|
432
|
+
configurable: true
|
|
433
|
+
});
|
|
434
|
+
Sticker2.prototype.setSize = function(width, height) {
|
|
435
|
+
this.scale.set(width, height, 1);
|
|
436
|
+
this._needsRender = true;
|
|
437
|
+
};
|
|
438
|
+
Sticker2.prototype.setTransparent = function(transparent) {
|
|
439
|
+
this.material.transparent = transparent;
|
|
440
|
+
this._needsRender = true;
|
|
441
|
+
};
|
|
442
|
+
Sticker2.prototype.locationWithIntersection = function(intersection, offset) {
|
|
443
|
+
if (offset === void 0) {
|
|
444
|
+
offset = 5e-3;
|
|
445
|
+
}
|
|
446
|
+
var point = intersection.point, face = intersection.face;
|
|
447
|
+
this.position.copy(point);
|
|
448
|
+
if (face) {
|
|
449
|
+
this.position.add(face.normal.clone().setLength(offset));
|
|
450
|
+
this.lookAt(point.clone().add(face.normal));
|
|
451
|
+
}
|
|
452
|
+
this._needsRender = true;
|
|
453
|
+
};
|
|
454
|
+
Sticker2.prototype.dispose = function() {
|
|
455
|
+
var _a;
|
|
456
|
+
(_a = this.material.map) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
457
|
+
this.material.dispose();
|
|
458
|
+
};
|
|
459
|
+
return Sticker2;
|
|
460
|
+
}(THREE.Mesh)
|
|
396
461
|
);
|
|
397
462
|
export {
|
|
398
|
-
|
|
463
|
+
Sticker
|
|
399
464
|
};
|
package/umd/five-gltf-loader.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @license
|
|
3
3
|
* @realsee/five
|
|
4
4
|
* Generated: 12/20/2023
|
|
5
|
-
* Version: 6.0.0-alpha.
|
|
5
|
+
* Version: 6.0.0-alpha.71
|
|
6
6
|
* Terms:
|
|
7
7
|
* Realsee SDK License Agreement
|
|
8
8
|
* Update: July 28, 2021
|
|
@@ -252,10 +252,4 @@
|
|
|
252
252
|
* No amendment to or modification of this Agreement will be binding unless in
|
|
253
253
|
* writing and signed by Realsee. You and Realsee hereto confirm that this
|
|
254
254
|
* Agreement and all related documents shall be drafted in English.
|
|
255
|
-
*/(function(V,l){typeof exports=="object"&&typeof module<"u"?l(exports,require("three")):typeof define=="function"&&define.amd?define(["exports","three"],l):(V=typeof globalThis<"u"?globalThis:V||self,l(V.FiveSDK_GLTFLoader={},V.THREE))})(this,function(V,l){"use strict";function Pe(p){const g=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(p){for(const u in p)if(u!=="default"){const A=Object.getOwnPropertyDescriptor(p,u);Object.defineProperty(g,u,A.get?A:{enumerable:!0,get:()=>p[u]})}}return g.default=p,Object.freeze(g)}const Ae=Pe(l);var Se=function(p,g){return Se=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,A){u.__proto__=A}||function(u,A){for(var m in A)Object.prototype.hasOwnProperty.call(A,m)&&(u[m]=A[m])},Se(p,g)};function Oe(p,g){if(typeof g!="function"&&g!==null)throw new TypeError("Class extends value "+String(g)+" is not a constructor or null");Se(p,g);function u(){this.constructor=p}p.prototype=g===null?Object.create(g):(u.prototype=g.prototype,new u)}typeof SuppressedError=="function"&&SuppressedError;var Fe=function(){function p(e){l.Loader.call(this,e),this.dracoLoader=null,this.ddsLoader=null}p.prototype=Object.assign(Object.create(l.Loader.prototype),{constructor:p,load:function(e,r,n,t){var a=this,i;this.resourcePath!==""?i=this.resourcePath:this.path!==""?i=this.path:i=l.LoaderUtils.extractUrlBase(e),a.manager.itemStart(e);var s=function(f){t?t(f):console.error(f),a.manager.itemError(e),a.manager.itemEnd(e)},o=new l.FileLoader(a.manager);o.setPath(this.path),o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),a.crossOrigin==="use-credentials"&&o.setWithCredentials(!0),o.load(e,function(f){try{a.parse(f,i,function(c){r(c),a.manager.itemEnd(e)},s)}catch(c){s(c)}},n,s)},setDRACOLoader:function(e){return this.dracoLoader=e,this},setDDSLoader:function(e){return this.ddsLoader=e,this},parse:function(e,r,n,t){var a,i={};if(typeof e=="string")a=e;else{var s=l.LoaderUtils.decodeText(new Uint8Array(e,0,4));if(s===P){try{i[u.KHR_BINARY_GLTF]=new k(e)}catch(h){t&&t(h);return}a=i[u.KHR_BINARY_GLTF].content}else a=l.LoaderUtils.decodeText(new Uint8Array(e))}var o=JSON.parse(a);if(o.asset===void 0||o.asset.version[0]<2){t&&t(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}if(o.extensionsUsed)for(var f=0;f<o.extensionsUsed.length;++f){var c=o.extensionsUsed[f],v=o.extensionsRequired||[];switch(c){case u.KHR_LIGHTS_PUNCTUAL:i[c]=new m(o);break;case u.KHR_MATERIALS_CLEARCOAT:i[c]=new _;break;case u.KHR_MATERIALS_TRANSMISSION:i[c]=new F;break;case u.KHR_MATERIALS_UNLIT:i[c]=new S;break;case u.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:i[c]=new X;break;case u.KHR_DRACO_MESH_COMPRESSION:i[c]=new O(o,this.dracoLoader);break;case u.MSFT_TEXTURE_DDS:i[c]=new A(this.ddsLoader);break;case u.KHR_TEXTURE_TRANSFORM:i[c]=new C;break;case u.KHR_MESH_QUANTIZATION:i[c]=new ee;break;default:v.indexOf(c)>=0&&console.warn('THREE.GLTFLoader: Unknown extension "'+c+'".')}}var d=new R(o,i,{path:r||this.resourcePath||"",crossOrigin:this.crossOrigin,manager:this.manager});d.fileLoader.setRequestHeader(this.requestHeader),d.parse(n,t)}});function g(){var e={};return{get:function(r){return e[r]},add:function(r,n){e[r]=n},remove:function(r){delete e[r]},removeAll:function(){e={}}}}var u={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:"KHR_materials_pbrSpecularGlossiness",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",MSFT_TEXTURE_DDS:"MSFT_texture_dds"};function A(e){if(!e)throw new Error("THREE.GLTFLoader: Attempting to load .dds texture without importing DDSLoader");this.name=u.MSFT_TEXTURE_DDS,this.ddsLoader=e}function m(e){this.name=u.KHR_LIGHTS_PUNCTUAL;var r=e.extensions&&e.extensions[u.KHR_LIGHTS_PUNCTUAL]||{};this.lightDefs=r.lights||[]}m.prototype.loadLight=function(e){var r=this.lightDefs[e],n,t=new l.Color(16777215);r.color!==void 0&&t.fromArray(r.color);var a=r.range!==void 0?r.range:0;switch(r.type){case"directional":n=new l.DirectionalLight(t),n.target.position.set(0,0,-1),n.add(n.target);break;case"point":n=new l.PointLight(t),n.distance=a;break;case"spot":n=new l.SpotLight(t),n.distance=a,r.spot=r.spot||{},r.spot.innerConeAngle=r.spot.innerConeAngle!==void 0?r.spot.innerConeAngle:0,r.spot.outerConeAngle=r.spot.outerConeAngle!==void 0?r.spot.outerConeAngle:Math.PI/4,n.angle=r.spot.outerConeAngle,n.penumbra=1-r.spot.innerConeAngle/r.spot.outerConeAngle,n.target.position.set(0,0,-1),n.add(n.target);break;default:throw new Error('THREE.GLTFLoader: Unexpected light type, "'+r.type+'".')}return n.position.set(0,0,0),n.decay=2,r.intensity!==void 0&&(n.intensity=r.intensity),n.name=r.name||"light_"+e,Promise.resolve(n)};function S(){this.name=u.KHR_MATERIALS_UNLIT}S.prototype.getMaterialType=function(){return l.MeshBasicMaterial},S.prototype.extendParams=function(e,r,n){var t=[];e.color=new l.Color(1,1,1),e.opacity=1;var a=r.pbrMetallicRoughness;if(a){if(Array.isArray(a.baseColorFactor)){var i=a.baseColorFactor;e.color.fromArray(i),e.opacity=i[3]}a.baseColorTexture!==void 0&&t.push(n.assignTexture(e,"map",a.baseColorTexture))}return Promise.all(t)};function _(){this.name=u.KHR_MATERIALS_CLEARCOAT}_.prototype.getMaterialType=function(){return l.MeshPhysicalMaterial},_.prototype.extendParams=function(e,r,n){var t=[],a=r.extensions[this.name];if(a.clearcoatFactor!==void 0&&(e.clearcoat=a.clearcoatFactor),a.clearcoatTexture!==void 0&&t.push(n.assignTexture(e,"clearcoatMap",a.clearcoatTexture)),a.clearcoatRoughnessFactor!==void 0&&(e.clearcoatRoughness=a.clearcoatRoughnessFactor),a.clearcoatRoughnessTexture!==void 0&&t.push(n.assignTexture(e,"clearcoatRoughnessMap",a.clearcoatRoughnessTexture)),a.clearcoatNormalTexture!==void 0&&(t.push(n.assignTexture(e,"clearcoatNormalMap",a.clearcoatNormalTexture)),a.clearcoatNormalTexture.scale!==void 0)){var i=a.clearcoatNormalTexture.scale;e.clearcoatNormalScale=new l.Vector2(i,i)}return Promise.all(t)};function F(){this.name=u.KHR_MATERIALS_TRANSMISSION}F.prototype.getMaterialType=function(){return l.MeshPhysicalMaterial},F.prototype.extendParams=function(e,r,n){var t=[],a=r.extensions[this.name];return a.transmissionFactor!==void 0&&(e.premultipliedAlpha=!0,e.transparent=!0,e.opacity=1,e.transparency=a.transmissionFactor,(e.map||e.color.r*e.color.g*e.color.b<.99)&&(e.transparency*=.75)),Promise.all(t)};var P="glTF",b=12,x={JSON:1313821514,BIN:5130562};function k(e){this.name=u.KHR_BINARY_GLTF,this.content=null,this.body=null;var r=new DataView(e,0,b);if(this.header={magic:l.LoaderUtils.decodeText(new Uint8Array(e.slice(0,4))),version:r.getUint32(4,!0),length:r.getUint32(8,!0)},this.header.magic!==P)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");for(var n=new DataView(e,b),t=0;t<n.byteLength;){var a=n.getUint32(t,!0);t+=4;var i=n.getUint32(t,!0);if(t+=4,i===x.JSON){var s=new Uint8Array(e,b+t,a);this.content=l.LoaderUtils.decodeText(s)}else if(i===x.BIN){var o=b+t;this.body=e.slice(o,o+a)}t+=a}if(this.content===null)throw new Error("THREE.GLTFLoader: JSON content not found.")}function O(e,r){if(!r)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=u.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=r,this.dracoLoader.preload()}O.prototype.decodePrimitive=function(e,r){var n=this.json,t=this.dracoLoader,a=e.extensions[this.name].bufferView,i=e.extensions[this.name].attributes,s={},o={},f={};for(var c in i){var v=z[c]||c.toLowerCase();s[v]=i[c]}for(c in e.attributes){var v=z[c]||c.toLowerCase();if(i[c]!==void 0){var d=n.accessors[e.attributes[c]],h=re[d.componentType];f[v]=h,o[v]=d.normalized===!0}}return r.getDependency("bufferView",a).then(function(T){return new Promise(function(M){t.decodeDracoFile(T,function(y){for(var w in y.attributes){var L=y.attributes[w],D=o[w];D!==void 0&&(L.normalized=D)}M(y)},s,f)})})};function C(){this.name=u.KHR_TEXTURE_TRANSFORM}C.prototype.extendTexture=function(e,r){return e=e.clone(),r.offset!==void 0&&e.offset.fromArray(r.offset),r.rotation!==void 0&&(e.rotation=r.rotation),r.scale!==void 0&&e.repeat.fromArray(r.scale),r.texCoord!==void 0&&console.warn('THREE.GLTFLoader: Custom UV sets in "'+this.name+'" extension not yet supported.'),e.needsUpdate=!0,e};function I(e){l.MeshStandardMaterial.call(this),this.isGLTFSpecularGlossinessMaterial=!0;var r=["#ifdef USE_SPECULARMAP"," uniform sampler2D specularMap;","#endif"].join(`
|
|
256
|
-
`),n=["#ifdef USE_GLOSSINESSMAP"," uniform sampler2D glossinessMap;","#endif"].join(`
|
|
257
|
-
`),t=["vec3 specularFactor = specular;","#ifdef USE_SPECULARMAP"," vec4 texelSpecular = texture2D( specularMap, vUv );"," texelSpecular = sRGBToLinear( texelSpecular );"," // reads channel RGB, compatible with a glTF Specular-Glossiness (RGBA) texture"," specularFactor *= texelSpecular.rgb;","#endif"].join(`
|
|
258
|
-
`),a=["float glossinessFactor = glossiness;","#ifdef USE_GLOSSINESSMAP"," vec4 texelGlossiness = texture2D( glossinessMap, vUv );"," // reads channel A, compatible with a glTF Specular-Glossiness (RGBA) texture"," glossinessFactor *= texelGlossiness.a;","#endif"].join(`
|
|
259
|
-
`),i=["PhysicalMaterial material;","material.diffuseColor = diffuseColor.rgb;","vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );","float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );","material.specularRoughness = max( 1.0 - glossinessFactor, 0.0525 );// 0.0525 corresponds to the base mip of a 256 cubemap.","material.specularRoughness += geometryRoughness;","material.specularRoughness = min( material.specularRoughness, 1.0 );","material.specularColor = specularFactor.rgb;"].join(`
|
|
260
|
-
`),s={specular:{value:new l.Color().setHex(16777215)},glossiness:{value:1},specularMap:{value:null},glossinessMap:{value:null}};this._extraUniforms=s,this.onBeforeCompile=function(o){for(var f in s)o.uniforms[f]=s[f];o.fragmentShader=o.fragmentShader.replace("uniform float roughness;","uniform vec3 specular;"),o.fragmentShader=o.fragmentShader.replace("uniform float metalness;","uniform float glossiness;"),o.fragmentShader=o.fragmentShader.replace("#include <roughnessmap_pars_fragment>",r),o.fragmentShader=o.fragmentShader.replace("#include <metalnessmap_pars_fragment>",n),o.fragmentShader=o.fragmentShader.replace("#include <roughnessmap_fragment>",t),o.fragmentShader=o.fragmentShader.replace("#include <metalnessmap_fragment>",a),o.fragmentShader=o.fragmentShader.replace("#include <lights_physical_fragment>",i)},Object.defineProperties(this,{specular:{get:function(){return s.specular.value},set:function(o){s.specular.value=o}},specularMap:{get:function(){return s.specularMap.value},set:function(o){s.specularMap.value=o}},glossiness:{get:function(){return s.glossiness.value},set:function(o){s.glossiness.value=o}},glossinessMap:{get:function(){return s.glossinessMap.value},set:function(o){s.glossinessMap.value=o,o?(this.defines.USE_GLOSSINESSMAP="",this.defines.USE_ROUGHNESSMAP=""):(delete this.defines.USE_ROUGHNESSMAP,delete this.defines.USE_GLOSSINESSMAP)}}}),delete this.metalness,delete this.roughness,delete this.metalnessMap,delete this.roughnessMap,this.setValues(e)}I.prototype=Object.create(l.MeshStandardMaterial.prototype),I.prototype.constructor=I,I.prototype.copy=function(e){return l.MeshStandardMaterial.prototype.copy.call(this,e),this.specularMap=e.specularMap,this.specular.copy(e.specular),this.glossinessMap=e.glossinessMap,this.glossiness=e.glossiness,delete this.metalness,delete this.roughness,delete this.metalnessMap,delete this.roughnessMap,this};function X(){return{name:u.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS,specularGlossinessParams:["color","map","lightMap","lightMapIntensity","aoMap","aoMapIntensity","emissive","emissiveIntensity","emissiveMap","bumpMap","bumpScale","normalMap","normalMapType","displacementMap","displacementScale","displacementBias","specularMap","specular","glossinessMap","glossiness","alphaMap","envMap","envMapIntensity","refractionRatio"],getMaterialType:function(){return I},extendParams:function(e,r,n){var t=r.extensions[this.name];e.color=new l.Color(1,1,1),e.opacity=1;var a=[];if(Array.isArray(t.diffuseFactor)){var i=t.diffuseFactor;e.color.fromArray(i),e.opacity=i[3]}if(t.diffuseTexture!==void 0&&a.push(n.assignTexture(e,"map",t.diffuseTexture)),e.emissive=new l.Color(0,0,0),e.glossiness=t.glossinessFactor!==void 0?t.glossinessFactor:1,e.specular=new l.Color(1,1,1),Array.isArray(t.specularFactor)&&e.specular.fromArray(t.specularFactor),t.specularGlossinessTexture!==void 0){var s=t.specularGlossinessTexture;a.push(n.assignTexture(e,"glossinessMap",s)),a.push(n.assignTexture(e,"specularMap",s))}return Promise.all(a)},createMaterial:function(e){var r=new I(e);return r.fog=!0,r.color=e.color,r.map=e.map===void 0?null:e.map,r.lightMap=null,r.lightMapIntensity=1,r.aoMap=e.aoMap===void 0?null:e.aoMap,r.aoMapIntensity=1,r.emissive=e.emissive,r.emissiveIntensity=1,r.emissiveMap=e.emissiveMap===void 0?null:e.emissiveMap,r.bumpMap=e.bumpMap===void 0?null:e.bumpMap,r.bumpScale=1,r.normalMap=e.normalMap===void 0?null:e.normalMap,r.normalMapType=l.TangentSpaceNormalMap,e.normalScale&&(r.normalScale=e.normalScale),r.displacementMap=null,r.displacementScale=1,r.displacementBias=0,r.specularMap=e.specularMap===void 0?null:e.specularMap,r.specular=e.specular,r.glossinessMap=e.glossinessMap===void 0?null:e.glossinessMap,r.glossiness=e.glossiness,r.alphaMap=null,r.envMap=e.envMap===void 0?null:e.envMap,r.envMapIntensity=1,r.refractionRatio=.98,r}}}function ee(){this.name=u.KHR_MESH_QUANTIZATION}function U(e,r,n,t){l.Interpolant.call(this,e,r,n,t)}U.prototype=Object.create(l.Interpolant.prototype),U.prototype.constructor=U,U.prototype.copySampleValue_=function(e){for(var r=this.resultBuffer,n=this.sampleValues,t=this.valueSize,a=e*t*3+t,i=0;i!==t;i++)r[i]=n[a+i];return r},U.prototype.beforeStart_=U.prototype.copySampleValue_,U.prototype.afterEnd_=U.prototype.copySampleValue_,U.prototype.interpolate_=function(e,r,n,t){for(var a=this.resultBuffer,i=this.sampleValues,s=this.valueSize,o=s*2,f=s*3,c=t-r,v=(n-r)/c,d=v*v,h=d*v,T=e*f,M=T-f,y=-2*h+3*d,w=h-d,L=1-y,D=w-d+v,N=0;N!==s;N++){var ne=i[M+N+s],ae=i[M+N+o]*c,Z=i[T+N+s],j=i[T+N]*c;a[N]=L*ne+D*ae+y*Z+w*j}return a};var K={FLOAT:5126,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,LINEAR:9729,REPEAT:10497,SAMPLER_2D:35678,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123},re={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},te={9728:l.NearestFilter,9729:l.LinearFilter,9984:l.NearestMipmapNearestFilter,9985:l.LinearMipmapNearestFilter,9986:l.NearestMipmapLinearFilter,9987:l.LinearMipmapLinearFilter},Q={33071:l.ClampToEdgeWrapping,33648:l.MirroredRepeatWrapping,10497:l.RepeatWrapping},Y={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},z={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv2",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},W={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},Te={CUBICSPLINE:void 0,LINEAR:l.InterpolateLinear,STEP:l.InterpolateDiscrete},ue={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"},pe={"image/png":l.RGBAFormat,"image/jpeg":l.RGBFormat};function he(e,r){return typeof e!="string"||e===""?"":(/^https?:\/\//i.test(r)&&/^\//.test(e)&&(r=r.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:r+e)}function Le(e){return e.DefaultMaterial===void 0&&(e.DefaultMaterial=new l.MeshStandardMaterial({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:l.FrontSide})),e.DefaultMaterial}function oe(e,r,n){for(var t in n.extensions)e[t]===void 0&&(r.userData.gltfExtensions=r.userData.gltfExtensions||{},r.userData.gltfExtensions[t]=n.extensions[t])}function q(e,r){r.extras!==void 0&&(typeof r.extras=="object"?Object.assign(e.userData,r.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+r.extras))}function _e(e,r,n){for(var t=!1,a=!1,i=0,s=r.length;i<s;i++){var o=r[i];if(o.POSITION!==void 0&&(t=!0),o.NORMAL!==void 0&&(a=!0),t&&a)break}if(!t&&!a)return Promise.resolve(e);for(var f=[],c=[],i=0,s=r.length;i<s;i++){var o=r[i];if(t){var v=o.POSITION!==void 0?n.getDependency("accessor",o.POSITION):e.attributes.position;f.push(v)}if(a){var v=o.NORMAL!==void 0?n.getDependency("accessor",o.NORMAL):e.attributes.normal;c.push(v)}}return Promise.all([Promise.all(f),Promise.all(c)]).then(function(d){var h=d[0],T=d[1];return t&&(e.morphAttributes.position=h),a&&(e.morphAttributes.normal=T),e.morphTargetsRelative=!0,e})}function Me(e,r){if(e.updateMorphTargets(),r.weights!==void 0)for(var n=0,t=r.weights.length;n<t;n++)e.morphTargetInfluences[n]=r.weights[n];if(r.extras&&Array.isArray(r.extras.targetNames)){var a=r.extras.targetNames;if(e.morphTargetInfluences.length===a.length){e.morphTargetDictionary={};for(var n=0,t=a.length;n<t;n++)e.morphTargetDictionary[a[n]]=n}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function we(e){var r=e.extensions&&e.extensions[u.KHR_DRACO_MESH_COMPRESSION],n;return r?n="draco:"+r.bufferView+":"+r.indices+":"+G(r.attributes):n=e.indices+":"+G(e.attributes)+":"+e.mode,n}function G(e){for(var r="",n=Object.keys(e).sort(),t=0,a=n.length;t<a;t++)r+=n[t]+":"+e[n[t]]+";";return r}function R(e,r,n){this.json=e||{},this.extensions=r||{},this.options=n||{},this.cache=new g,this.associations=new Map,this.primitiveCache={},this.textureLoader=new l.TextureLoader(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.fileLoader=new l.FileLoader(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}R.prototype.parse=function(e,r){var n=this,t=this.json,a=this.extensions;this.cache.removeAll(),this.markDefs(),Promise.all([this.getDependencies("scene"),this.getDependencies("animation"),this.getDependencies("camera")]).then(function(i){var s={scene:i[0][t.scene||0],scenes:i[0],animations:i[1],cameras:i[2],asset:t.asset,parser:n,userData:{}};oe(a,s,t),q(s,t),e(s)}).catch(r)},R.prototype.markDefs=function(){for(var e=this.json.nodes||[],r=this.json.skins||[],n=this.json.meshes||[],t={},a={},i=0,s=r.length;i<s;i++)for(var o=r[i].joints,f=0,c=o.length;f<c;f++)e[o[f]].isBone=!0;for(var v=0,d=e.length;v<d;v++){var h=e[v];h.mesh!==void 0&&(t[h.mesh]===void 0&&(t[h.mesh]=a[h.mesh]=0),t[h.mesh]++,h.skin!==void 0&&(n[h.mesh].isSkinnedMesh=!0))}this.json.meshReferences=t,this.json.meshUses=a},R.prototype.getDependency=function(e,r){var n=e+":"+r,t=this.cache.get(n);if(!t){switch(e){case"scene":t=this.loadScene(r);break;case"node":t=this.loadNode(r);break;case"mesh":t=this.loadMesh(r);break;case"accessor":t=this.loadAccessor(r);break;case"bufferView":t=this.loadBufferView(r);break;case"buffer":t=this.loadBuffer(r);break;case"material":t=this.loadMaterial(r);break;case"texture":t=this.loadTexture(r);break;case"skin":t=this.loadSkin(r);break;case"animation":t=this.loadAnimation(r);break;case"camera":t=this.loadCamera(r);break;case"light":t=this.extensions[u.KHR_LIGHTS_PUNCTUAL].loadLight(r);break;default:throw new Error("Unknown type: "+e)}this.cache.add(n,t)}return t},R.prototype.getDependencies=function(e){var r=this.cache.get(e);if(!r){var n=this,t=this.json[e+(e==="mesh"?"es":"s")]||[];r=Promise.all(t.map(function(a,i){return n.getDependency(e,i)})),this.cache.add(e,r)}return r},R.prototype.loadBuffer=function(e){var r=this.json.buffers[e],n=this.fileLoader;if(r.type&&r.type!=="arraybuffer")throw new Error("THREE.GLTFLoader: "+r.type+" buffer type is not supported.");if(r.uri===void 0&&e===0)return Promise.resolve(this.extensions[u.KHR_BINARY_GLTF].body);var t=this.options;return new Promise(function(a,i){n.load(he(r.uri,t.path),a,void 0,function(){i(new Error('THREE.GLTFLoader: Failed to load buffer "'+r.uri+'".'))})})},R.prototype.loadBufferView=function(e){var r=this.json.bufferViews[e];return this.getDependency("buffer",r.buffer).then(function(n){var t=r.byteLength||0,a=r.byteOffset||0;return n.slice(a,a+t)})},R.prototype.loadAccessor=function(e){var r=this,n=this.json,t=this.json.accessors[e];if(t.bufferView===void 0&&t.sparse===void 0)return Promise.resolve(null);var a=[];return t.bufferView!==void 0?a.push(this.getDependency("bufferView",t.bufferView)):a.push(null),t.sparse!==void 0&&(a.push(this.getDependency("bufferView",t.sparse.indices.bufferView)),a.push(this.getDependency("bufferView",t.sparse.values.bufferView))),Promise.all(a).then(function(i){var s=i[0],o=Y[t.type],f=re[t.componentType],c=f.BYTES_PER_ELEMENT,v=c*o,d=t.byteOffset||0,h=t.bufferView!==void 0?n.bufferViews[t.bufferView].byteStride:void 0,T=t.normalized===!0,M,y;if(h&&h!==v){var w=Math.floor(d/h),L="InterleavedBuffer:"+t.bufferView+":"+t.componentType+":"+w+":"+t.count,D=r.cache.get(L);D||(M=new f(s,w*h,t.count*h/c),D=new l.InterleavedBuffer(M,h/c),r.cache.add(L,D)),y=new l.InterleavedBufferAttribute(D,o,d%h/c,T)}else s===null?M=new f(t.count*o):M=new f(s,d,t.count*o),y=new l.BufferAttribute(M,o,T);if(t.sparse!==void 0){var N=Y.SCALAR,ne=re[t.sparse.indices.componentType],ae=t.sparse.indices.byteOffset||0,Z=t.sparse.values.byteOffset||0,j=new ne(i[1],ae,t.sparse.count*N),ie=new f(i[2],Z,t.sparse.count*o);s!==null&&(y=new l.BufferAttribute(y.array.slice(),y.itemSize,y.normalized));for(var B=0,be=j.length;B<be;B++){var se=j[B];if(y.setX(se,ie[B*o]),o>=2&&y.setY(se,ie[B*o+1]),o>=3&&y.setZ(se,ie[B*o+2]),o>=4&&y.setW(se,ie[B*o+3]),o>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return y})},R.prototype.loadTexture=function(e){var r=this,n=this.json,t=this.options,a=this.textureLoader,i=self.URL||self.webkitURL,s=n.textures[e],o=s.extensions||{},f;o[u.MSFT_TEXTURE_DDS]?f=n.images[o[u.MSFT_TEXTURE_DDS].source]:f=n.images[s.source];var c=f.uri,v=!1;return f.bufferView!==void 0&&(c=r.getDependency("bufferView",f.bufferView).then(function(d){v=!0;var h=new Blob([d],{type:f.mimeType});return c=i.createObjectURL(h),c})),Promise.resolve(c).then(function(d){var h=t.manager.getHandler(d);return h||(h=o[u.MSFT_TEXTURE_DDS]?r.extensions[u.MSFT_TEXTURE_DDS].ddsLoader:a),new Promise(function(T,M){h.load(he(d,t.path),T,void 0,M)})}).then(function(d){v===!0&&i.revokeObjectURL(c),d.flipY=!1,s.name&&(d.name=s.name),f.mimeType in pe&&(d.format=pe[f.mimeType]);var h=n.samplers||{},T=h[s.sampler]||{};return d.magFilter=te[T.magFilter]||l.LinearFilter,d.minFilter=te[T.minFilter]||l.LinearMipmapLinearFilter,d.wrapS=Q[T.wrapS]||l.RepeatWrapping,d.wrapT=Q[T.wrapT]||l.RepeatWrapping,r.associations.set(d,{type:"textures",index:e}),d})},R.prototype.assignTexture=function(e,r,n){var t=this;return this.getDependency("texture",n.index).then(function(a){if(!a.isCompressedTexture)switch(r){case"aoMap":case"emissiveMap":case"metalnessMap":case"normalMap":case"roughnessMap":a.format=l.RGBFormat;break}if(n.texCoord!==void 0&&n.texCoord!=0&&!(r==="aoMap"&&n.texCoord==1)&&console.warn("THREE.GLTFLoader: Custom UV set "+n.texCoord+" for texture "+r+" not yet supported."),t.extensions[u.KHR_TEXTURE_TRANSFORM]){var i=n.extensions!==void 0?n.extensions[u.KHR_TEXTURE_TRANSFORM]:void 0;if(i){var s=this.associations.get(a);a=t.extensions[u.KHR_TEXTURE_TRANSFORM].extendTexture(a,i),this.associations.set(a,s)}}e[r]=a})},R.prototype.assignFinalMaterial=function(e){var r=e.geometry,n=e.material,t=r.attributes.tangent!==void 0,a=r.attributes.color!==void 0,i=r.attributes.normal===void 0,s=e.isSkinnedMesh===!0,o=Object.keys(r.morphAttributes).length>0,f=o&&r.morphAttributes.normal!==void 0;if(e.isPoints){var c="PointsMaterial:"+n.uuid,v=this.cache.get(c);v||(v=new l.PointsMaterial,l.Material.prototype.copy.call(v,n),v.color.copy(n.color),v.map=n.map,v.sizeAttenuation=!1,this.cache.add(c,v)),n=v}else if(e.isLine){var c="LineBasicMaterial:"+n.uuid,d=this.cache.get(c);d||(d=new l.LineBasicMaterial,l.Material.prototype.copy.call(d,n),d.color.copy(n.color),this.cache.add(c,d)),n=d}if(t||a||i||s||o){var c="ClonedMaterial:"+n.uuid+":";n.isGLTFSpecularGlossinessMaterial&&(c+="specular-glossiness:"),s&&(c+="skinning:"),t&&(c+="vertex-tangents:"),a&&(c+="vertex-colors:"),i&&(c+="flat-shading:"),o&&(c+="morph-targets:"),f&&(c+="morph-normals:");var h=this.cache.get(c);h||(h=n.clone(),s&&(h.skinning=!0),t&&(h.vertexTangents=!0),a&&(h.vertexColors=!0),i&&(h.flatShading=!0),o&&(h.morphTargets=!0),f&&(h.morphNormals=!0),this.cache.add(c,h),this.associations.set(h,this.associations.get(n))),n=h}n.aoMap&&r.attributes.uv2===void 0&&r.attributes.uv!==void 0&&r.setAttribute("uv2",r.attributes.uv),n.normalScale&&!t&&(n.normalScale.y=-n.normalScale.y),n.clearcoatNormalScale&&!t&&(n.clearcoatNormalScale.y=-n.clearcoatNormalScale.y),e.material=n},R.prototype.loadMaterial=function(e){var r=this,n=this.json,t=this.extensions,a=n.materials[e],i,s={},o=a.extensions||{},f=[];if(o[u.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS]){var c=t[u.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS];i=c.getMaterialType(),f.push(c.extendParams(s,a,r))}else if(o[u.KHR_MATERIALS_UNLIT]){var v=t[u.KHR_MATERIALS_UNLIT];i=v.getMaterialType(),f.push(v.extendParams(s,a,r))}else{i=l.MeshStandardMaterial;var d=a.pbrMetallicRoughness||{};if(s.color=new l.Color(1,1,1),s.opacity=1,Array.isArray(d.baseColorFactor)){var h=d.baseColorFactor;s.color.fromArray(h),s.opacity=h[3]}d.baseColorTexture!==void 0&&f.push(r.assignTexture(s,"map",d.baseColorTexture)),s.metalness=d.metallicFactor!==void 0?d.metallicFactor:1,s.roughness=d.roughnessFactor!==void 0?d.roughnessFactor:1,d.metallicRoughnessTexture!==void 0&&(f.push(r.assignTexture(s,"metalnessMap",d.metallicRoughnessTexture)),f.push(r.assignTexture(s,"roughnessMap",d.metallicRoughnessTexture)))}a.doubleSided===!0&&(s.side=l.DoubleSide);var T=a.alphaMode||ue.OPAQUE;if(T===ue.BLEND?(s.transparent=!0,s.depthWrite=!1):(s.transparent=!1,T===ue.MASK&&(s.alphaTest=a.alphaCutoff!==void 0?a.alphaCutoff:.5)),a.normalTexture!==void 0&&i!==l.MeshBasicMaterial&&(f.push(r.assignTexture(s,"normalMap",a.normalTexture)),s.normalScale=new l.Vector2(1,1),a.normalTexture.scale!==void 0&&s.normalScale.set(a.normalTexture.scale,a.normalTexture.scale)),a.occlusionTexture!==void 0&&i!==l.MeshBasicMaterial&&(f.push(r.assignTexture(s,"aoMap",a.occlusionTexture)),a.occlusionTexture.strength!==void 0&&(s.aoMapIntensity=a.occlusionTexture.strength)),a.emissiveFactor!==void 0&&i!==l.MeshBasicMaterial&&(s.emissive=new l.Color().fromArray(a.emissiveFactor)),a.emissiveTexture!==void 0&&i!==l.MeshBasicMaterial&&f.push(r.assignTexture(s,"emissiveMap",a.emissiveTexture)),o[u.KHR_MATERIALS_CLEARCOAT]){var M=t[u.KHR_MATERIALS_CLEARCOAT];i=M.getMaterialType(),f.push(M.extendParams(s,{extensions:o},r))}if(o[u.KHR_MATERIALS_TRANSMISSION]){var M=t[u.KHR_MATERIALS_TRANSMISSION];i=M.getMaterialType(),f.push(M.extendParams(s,{extensions:o},r))}return Promise.all(f).then(function(){var y;return i===I?y=t[u.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS].createMaterial(s):y=new i(s),a.name&&(y.name=a.name),y.map&&(y.map.encoding=l.sRGBEncoding),y.emissiveMap&&(y.emissiveMap.encoding=l.sRGBEncoding),q(y,a),r.associations.set(y,{type:"materials",index:e}),a.extensions&&oe(t,y,a),y})};function ve(e,r,n){var t=r.attributes,a=new l.Box3;if(t.POSITION!==void 0){var i=n.json.accessors[t.POSITION],s=i.min,o=i.max;if(s!==void 0&&o!==void 0)a.set(new l.Vector3(s[0],s[1],s[2]),new l.Vector3(o[0],o[1],o[2]));else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;var f=r.targets;if(f!==void 0){for(var c=new l.Vector3,v=new l.Vector3,d=0,h=f.length;d<h;d++){var T=f[d];if(T.POSITION!==void 0){var i=n.json.accessors[T.POSITION],s=i.min,o=i.max;s!==void 0&&o!==void 0?(v.setX(Math.max(Math.abs(s[0]),Math.abs(o[0]))),v.setY(Math.max(Math.abs(s[1]),Math.abs(o[1]))),v.setZ(Math.max(Math.abs(s[2]),Math.abs(o[2]))),c.max(v)):console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}a.expandByVector(c)}e.boundingBox=a;var M=new l.Sphere;a.getCenter(M.center),M.radius=a.min.distanceTo(a.max)/2,e.boundingSphere=M}function le(e,r,n){var t=r.attributes,a=[];function i(c,v){return n.getDependency("accessor",c).then(function(d){e.setAttribute(v,d)})}for(var s in t){var o=z[s]||s.toLowerCase();o in e.attributes||a.push(i(t[s],o))}if(r.indices!==void 0&&!e.index){var f=n.getDependency("accessor",r.indices).then(function(c){e.setIndex(c)});a.push(f)}return q(e,r),ve(e,r,n),Promise.all(a).then(function(){return r.targets!==void 0?_e(e,r.targets,n):e})}function H(e,r){var n=e.getIndex();if(n===null){var t=[],a=e.getAttribute("position");if(a!==void 0){for(var i=0;i<a.count;i++)t.push(i);e.setIndex(t),n=e.getIndex()}else return console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),e}var s=n.count-2,o=[];if(r===l.TriangleFanDrawMode)for(var i=1;i<=s;i++)o.push(n.getX(0)),o.push(n.getX(i)),o.push(n.getX(i+1));else for(var i=0;i<s;i++)i%2===0?(o.push(n.getX(i)),o.push(n.getX(i+1)),o.push(n.getX(i+2))):(o.push(n.getX(i+2)),o.push(n.getX(i+1)),o.push(n.getX(i)));o.length/3!==s&&console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");var f=e.clone();return f.setIndex(o),f}return R.prototype.loadGeometries=function(e){var r=this,n=this.extensions,t=this.primitiveCache;function a(h){return n[u.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(h,r).then(function(T){return le(T,h,r)})}for(var i=[],s=0,o=e.length;s<o;s++){var f=e[s],c=we(f),v=t[c];if(v)i.push(v.promise);else{var d;f.extensions&&f.extensions[u.KHR_DRACO_MESH_COMPRESSION]?d=a(f):d=le(new l.BufferGeometry,f,r),t[c]={primitive:f,promise:d},i.push(d)}}return Promise.all(i)},R.prototype.loadMesh=function(e){for(var r=this,n=this.json,t=n.meshes[e],a=t.primitives,i=[],s=0,o=a.length;s<o;s++){var f=a[s].material===void 0?Le(this.cache):this.getDependency("material",a[s].material);i.push(f)}return i.push(r.loadGeometries(a)),Promise.all(i).then(function(c){for(var v=c.slice(0,c.length-1),d=c[c.length-1],h=[],T=0,M=d.length;T<M;T++){var y=d[T],w=a[T],L,D=v[T];if(w.mode===K.TRIANGLES||w.mode===K.TRIANGLE_STRIP||w.mode===K.TRIANGLE_FAN||w.mode===void 0)L=t.isSkinnedMesh===!0?new l.SkinnedMesh(y,D):new l.Mesh(y,D),L.isSkinnedMesh===!0&&!L.geometry.attributes.skinWeight.normalized&&L.normalizeSkinWeights(),w.mode===K.TRIANGLE_STRIP?L.geometry=H(L.geometry,l.TriangleStripDrawMode):w.mode===K.TRIANGLE_FAN&&(L.geometry=H(L.geometry,l.TriangleFanDrawMode));else if(w.mode===K.LINES)L=new l.LineSegments(y,D);else if(w.mode===K.LINE_STRIP)L=new l.Line(y,D);else if(w.mode===K.LINE_LOOP)L=new l.LineLoop(y,D);else if(w.mode===K.POINTS)L=new l.Points(y,D);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+w.mode);Object.keys(L.geometry.morphAttributes).length>0&&Me(L,t),L.name=t.name||"mesh_"+e,d.length>1&&(L.name+="_"+T),q(L,t),r.assignFinalMaterial(L),h.push(L)}if(h.length===1)return h[0];for(var N=new l.Group,T=0,M=h.length;T<M;T++)N.add(h[T]);return N})},R.prototype.loadCamera=function(e){var r,n=this.json.cameras[e],t=n[n.type];if(!t){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}return n.type==="perspective"?r=new l.PerspectiveCamera(l.MathUtils.radToDeg(t.yfov),t.aspectRatio||1,t.znear||1,t.zfar||2e6):n.type==="orthographic"&&(r=new l.OrthographicCamera(-t.xmag,t.xmag,t.ymag,-t.ymag,t.znear,t.zfar)),n.name&&(r.name=n.name),q(r,n),Promise.resolve(r)},R.prototype.loadSkin=function(e){var r=this.json.skins[e],n={joints:r.joints};return r.inverseBindMatrices===void 0?Promise.resolve(n):this.getDependency("accessor",r.inverseBindMatrices).then(function(t){return n.inverseBindMatrices=t,n})},R.prototype.loadAnimation=function(e){for(var r=this.json,n=r.animations[e],t=[],a=[],i=[],s=[],o=[],f=0,c=n.channels.length;f<c;f++){var v=n.channels[f],d=n.samplers[v.sampler],h=v.target,T=h.node!==void 0?h.node:h.id,M=n.parameters!==void 0?n.parameters[d.input]:d.input,y=n.parameters!==void 0?n.parameters[d.output]:d.output;t.push(this.getDependency("node",T)),a.push(this.getDependency("accessor",M)),i.push(this.getDependency("accessor",y)),s.push(d),o.push(h)}return Promise.all([Promise.all(t),Promise.all(a),Promise.all(i),Promise.all(s),Promise.all(o)]).then(function(w){for(var L=w[0],D=w[1],N=w[2],ne=w[3],ae=w[4],Z=[],j=0,ie=L.length;j<ie;j++){var B=L[j],be=D[j],se=N[j],Ce=ne[j],Ie=ae[j];if(B!==void 0){B.updateMatrix(),B.matrixAutoUpdate=!0;var ge;switch(W[Ie.path]){case W.weights:ge=l.NumberKeyframeTrack;break;case W.rotation:ge=l.QuaternionKeyframeTrack;break;case W.position:case W.scale:default:ge=l.VectorKeyframeTrack;break}var Ne=B.name?B.name:B.uuid,ke=Ce.interpolation!==void 0?Te[Ce.interpolation]:l.InterpolateLinear,me=[];W[Ie.path]===W.weights?B.traverse(function(fe){fe.isMesh===!0&&fe.morphTargetInfluences&&me.push(fe.name?fe.name:fe.uuid)}):me.push(Ne);var J=se.array;if(se.normalized){var ce;if(J.constructor===Int8Array)ce=1/127;else if(J.constructor===Uint8Array)ce=1/255;else if(J.constructor==Int16Array)ce=1/32767;else if(J.constructor===Uint16Array)ce=1/65535;else throw new Error("THREE.GLTFLoader: Unsupported output accessor component type.");for(var De=new Float32Array(J.length),$=0,xe=J.length;$<xe;$++)De[$]=J[$]*ce;J=De}for(var $=0,xe=me.length;$<xe;$++){var Re=new ge(me[$]+"."+W[Ie.path],be.array,J,ke);Ce.interpolation==="CUBICSPLINE"&&(Re.createInterpolant=function(Ee){return new U(this.times,this.values,this.getValueSize()/3,Ee)},Re.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0),Z.push(Re)}}}var Be=n.name?n.name:"animation_"+e;return new l.AnimationClip(Be,void 0,Z)})},R.prototype.loadNode=function(e){var r=this.json,n=this.extensions,t=this,a=r.meshReferences,i=r.meshUses,s=r.nodes[e];return function(){var o=[];return s.mesh!==void 0&&o.push(t.getDependency("mesh",s.mesh).then(function(f){var c;if(a[s.mesh]>1){var v=i[s.mesh]++;c=f.clone(),c.name+="_instance_"+v}else c=f;return s.weights!==void 0&&c.traverse(function(d){if(d.isMesh)for(var h=0,T=s.weights.length;h<T;h++)d.morphTargetInfluences[h]=s.weights[h]}),c})),s.camera!==void 0&&o.push(t.getDependency("camera",s.camera)),s.extensions&&s.extensions[u.KHR_LIGHTS_PUNCTUAL]&&s.extensions[u.KHR_LIGHTS_PUNCTUAL].light!==void 0&&o.push(t.getDependency("light",s.extensions[u.KHR_LIGHTS_PUNCTUAL].light)),Promise.all(o)}().then(function(o){var f;if(s.isBone===!0?f=new l.Bone:o.length>1?f=new l.Group:o.length===1?f=o[0]:f=new l.Object3D,f!==o[0])for(var c=0,v=o.length;c<v;c++)f.add(o[c]);if(s.name&&(f.userData.name=s.name,f.name=l.PropertyBinding.sanitizeNodeName(s.name)),q(f,s),s.extensions&&oe(n,f,s),s.matrix!==void 0){var d=new l.Matrix4;d.fromArray(s.matrix),f.applyMatrix4(d)}else s.translation!==void 0&&f.position.fromArray(s.translation),s.rotation!==void 0&&f.quaternion.fromArray(s.rotation),s.scale!==void 0&&f.scale.fromArray(s.scale);return t.associations.set(f,{type:"nodes",index:e}),f})},R.prototype.loadScene=function(){function e(r,n,t,a){var i=t.nodes[r];return a.getDependency("node",r).then(function(s){if(i.skin===void 0)return s;var o;return a.getDependency("skin",i.skin).then(function(f){o=f;for(var c=[],v=0,d=o.joints.length;v<d;v++)c.push(a.getDependency("node",o.joints[v]));return Promise.all(c)}).then(function(f){return s.traverse(function(c){if(c.isMesh){for(var v=[],d=[],h=0,T=f.length;h<T;h++){var M=f[h];if(M){v.push(M);var y=new l.Matrix4;o.inverseBindMatrices!==void 0&&y.fromArray(o.inverseBindMatrices.array,h*16),d.push(y)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',o.joints[h])}c.bind(new l.Skeleton(v,d),c.matrixWorld)}}),s})}).then(function(s){n.add(s);var o=[];if(i.children)for(var f=i.children,c=0,v=f.length;c<v;c++){var d=f[c];o.push(e(d,s,t,a))}return Promise.all(o)})}return function(n){var t=this.json,a=this.extensions,i=this.json.scenes[n],s=this,o=new l.Group;i.name&&(o.name=i.name),q(o,i),i.extensions&&oe(a,o,i);for(var f=i.nodes||[],c=[],v=0,d=f.length;v<d;v++)c.push(e(f[v],o,t,s));return Promise.all(c).then(function(){return o})}}(),p}(),E=function(p){l.Loader.call(this,p),this.decoderPath="",this.decoderConfig={},this.decoderBinary=null,this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL="",this.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},this.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"}};E.prototype=Object.assign(Object.create(l.Loader.prototype),{constructor:E,setDecoderPath:function(p){return this.decoderPath=p,this},setDecoderConfig:function(p){return this.decoderConfig=p,this},setWorkerLimit:function(p){return this.workerLimit=p,this},setVerbosity:function(){console.warn("THREE.DRACOLoader: The .setVerbosity() method has been removed.")},setDrawMode:function(){console.warn("THREE.DRACOLoader: The .setDrawMode() method has been removed.")},setSkipDequantization:function(){console.warn("THREE.DRACOLoader: The .setSkipDequantization() method has been removed.")},load:function(p,g,u,A){var m=new l.FileLoader(this.manager);m.setPath(this.path),m.setResponseType("arraybuffer"),this.crossOrigin==="use-credentials"&&m.setWithCredentials(!0),m.load(p,S=>{var _={attributeIDs:this.defaultAttributeIDs,attributeTypes:this.defaultAttributeTypes,useUniqueIDs:!1};this.decodeGeometry(S,_).then(g).catch(A)},u,A)},decodeDracoFile:function(p,g,u,A){var m={attributeIDs:u||this.defaultAttributeIDs,attributeTypes:A||this.defaultAttributeTypes,useUniqueIDs:!!u};this.decodeGeometry(p,m).then(g)},decodeGeometry:function(p,g){for(var u in g.attributeTypes){var A=g.attributeTypes[u];A.BYTES_PER_ELEMENT!==void 0&&(g.attributeTypes[u]=A.name)}var m=JSON.stringify(g);if(E.taskCache.has(p)){var S=E.taskCache.get(p);if(S.key===m)return S.promise;if(p.byteLength===0)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}var _,F=this.workerNextTaskID++,P=p.byteLength,b=this._getWorker(F,P).then(x=>(_=x,new Promise((k,O)=>{_._callbacks[F]={resolve:k,reject:O},_.postMessage({type:"decode",id:F,taskConfig:g,buffer:p},[p])}))).then(x=>this._createGeometry(x.geometry));return b.catch(()=>!0).then(()=>{_&&F&&this._releaseTask(_,F)}),E.taskCache.set(p,{key:m,promise:b}),b},_createGeometry:function(p){var g=new l.BufferGeometry;p.index&&g.setIndex(new l.BufferAttribute(p.index.array,1));for(var u=0;u<p.attributes.length;u++){var A=p.attributes[u],m=A.name,S=A.array,_=A.itemSize;g.setAttribute(m,new l.BufferAttribute(S,_))}return g},_loadLibrary:function(p,g){var u=new l.FileLoader(this.manager);return u.setPath(this.decoderPath),u.setResponseType(g),new Promise((A,m)=>{u.load(p,A,void 0,m)})},preload:function(){return this._initDecoder(),this},_initDecoder:function(){if(this.decoderPending)return this.decoderPending;var p=typeof WebAssembly!="object"||this.decoderConfig.type==="js",g=[];return p?g.push(this._loadLibrary("draco_decoder.js","text")):(g.push(this._loadLibrary("draco_wasm_wrapper.js","text")),g.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(g).then(u=>{var A=u[0];p||(this.decoderConfig.wasmBinary=u[1]);var m=E.DRACOWorker.toString(),S=["/* draco decoder */",A,"","/* worker */",m.substring(m.indexOf("{")+1,m.lastIndexOf("}"))].join(`
|
|
261
|
-
`);this.workerSourceURL=URL.createObjectURL(new Blob([S]))}),this.decoderPending},_getWorker:function(p,g){return this._initDecoder().then(()=>{if(this.workerPool.length<this.workerLimit){var u=new Worker(this.workerSourceURL);u._callbacks={},u._taskCosts={},u._taskLoad=0,u.postMessage({type:"init",decoderConfig:this.decoderConfig}),u.onmessage=function(m){var S=m.data;switch(S.type){case"decode":u._callbacks[S.id].resolve(S);break;case"error":u._callbacks[S.id].reject(S);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+S.type+'"')}},this.workerPool.push(u)}else this.workerPool.sort(function(A,m){return A._taskLoad>m._taskLoad?-1:1});var u=this.workerPool[this.workerPool.length-1];return u._taskCosts[p]=g,u._taskLoad+=g,u})},_releaseTask:function(p,g){p._taskLoad-=p._taskCosts[g],delete p._callbacks[g],delete p._taskCosts[g]},debug:function(){console.log("Task load: ",this.workerPool.map(p=>p._taskLoad))},dispose:function(){for(var p=0;p<this.workerPool.length;++p)this.workerPool[p].terminate();return this.workerPool.length=0,this}}),E.DRACOWorker=function(){var p,g;onmessage=function(m){var S=m.data;switch(S.type){case"init":p=S.decoderConfig,g=new Promise(function(P){p.onModuleLoaded=function(b){P({draco:b})},DracoDecoderModule(p)});break;case"decode":var _=S.buffer,F=S.taskConfig;g.then(P=>{var b=P.draco,x=new b.Decoder,k=new b.DecoderBuffer;k.Init(new Int8Array(_),_.byteLength);try{var O=u(b,x,k,F),C=O.attributes.map(I=>I.array.buffer);O.index&&C.push(O.index.array.buffer),self.postMessage({type:"decode",id:S.id,geometry:O},C)}catch(I){console.error(I),self.postMessage({type:"error",id:S.id,error:I.message})}finally{b.destroy(k),b.destroy(x)}});break}};function u(m,S,_,F){var P=F.attributeIDs,b=F.attributeTypes,x,k,O=S.GetEncodedGeometryType(_);if(O===m.TRIANGULAR_MESH)x=new m.Mesh,k=S.DecodeBufferToMesh(_,x);else if(O===m.POINT_CLOUD)x=new m.PointCloud,k=S.DecodeBufferToPointCloud(_,x);else throw new Error("THREE.DRACOLoader: Unexpected geometry type.");if(!k.ok()||x.ptr===0)throw new Error("THREE.DRACOLoader: Decoding failed: "+k.error_msg());var C={index:null,attributes:[]};for(var I in P){var X=self[b[I]],ee,U;if(F.useUniqueIDs)U=P[I],ee=S.GetAttributeByUniqueId(x,U);else{if(U=S.GetAttributeId(x,m[P[I]]),U===-1)continue;ee=S.GetAttribute(x,U)}C.attributes.push(A(m,S,x,I,X,ee))}if(O===m.TRIANGULAR_MESH){for(var K=x.num_faces(),re=K*3,te=new Uint32Array(re),Q=new m.DracoInt32Array,Y=0;Y<K;++Y){S.GetFaceFromMesh(x,Y,Q);for(var z=0;z<3;++z)te[Y*3+z]=Q.GetValue(z)}C.index={array:te,itemSize:1},m.destroy(Q)}return m.destroy(x),C}function A(m,S,_,F,P,b){var x=b.num_components(),k=_.num_points(),O=k*x,C,I;switch(P){case Float32Array:C=new m.DracoFloat32Array,S.GetAttributeFloatForAllPoints(_,b,C),I=new Float32Array(O);break;case Int8Array:C=new m.DracoInt8Array,S.GetAttributeInt8ForAllPoints(_,b,C),I=new Int8Array(O);break;case Int16Array:C=new m.DracoInt16Array,S.GetAttributeInt16ForAllPoints(_,b,C),I=new Int16Array(O);break;case Int32Array:C=new m.DracoInt32Array,S.GetAttributeInt32ForAllPoints(_,b,C),I=new Int32Array(O);break;case Uint8Array:C=new m.DracoUInt8Array,S.GetAttributeUInt8ForAllPoints(_,b,C),I=new Uint8Array(O);break;case Uint16Array:C=new m.DracoUInt16Array,S.GetAttributeUInt16ForAllPoints(_,b,C),I=new Uint16Array(O);break;case Uint32Array:C=new m.DracoUInt32Array,S.GetAttributeUInt32ForAllPoints(_,b,C),I=new Uint32Array(O);break;default:throw new Error("THREE.DRACOLoader: Unexpected attribute type.")}for(var X=0;X<O;X++)I[X]=C.GetValue(X);return m.destroy(C),{name:F,array:I,itemSize:x}}},E.taskCache=new WeakMap,E.setDecoderPath=function(){console.warn("THREE.DRACOLoader: The .setDecoderPath() method has been removed. Use instance methods.")},E.setDecoderConfig=function(){console.warn("THREE.DRACOLoader: The .setDecoderConfig() method has been removed. Use instance methods.")},E.releaseDecoderModule=function(){console.warn("THREE.DRACOLoader: The .releaseDecoderModule() method has been removed. Use instance methods.")},E.getDecoderModule=function(){console.warn("THREE.DRACOLoader: The .getDecoderModule() method has been removed. Use instance methods.")};var de=function(p){l.CompressedTextureLoader.call(this,p)};de.prototype=Object.assign(Object.create(l.CompressedTextureLoader.prototype),{constructor:de,parse:function(p,g){var u={mipmaps:[],width:0,height:0,format:null,mipmapCount:1},A=542327876,m=131072,S=512,_=1024,F=2048,P=4096,b=8192,x=16384,k=32768,O=4;function C(c){return c.charCodeAt(0)+(c.charCodeAt(1)<<8)+(c.charCodeAt(2)<<16)+(c.charCodeAt(3)<<24)}function I(c){return String.fromCharCode(c&255,c>>8&255,c>>16&255,c>>24&255)}function X(c,v,d,h){for(var T=d*h*4,M=new Uint8Array(c,v,T),y=new Uint8Array(T),w=0,L=0,D=0;D<h;D++)for(var N=0;N<d;N++){var ne=M[L];L++;var ae=M[L];L++;var Z=M[L];L++;var j=M[L];L++,y[w]=Z,w++,y[w]=ae,w++,y[w]=ne,w++,y[w]=j,w++}return y}var ee=C("DXT1"),U=C("DXT3"),K=C("DXT5"),re=C("ETC1"),te=31,Q=0,Y=1,z=2,W=3,Te=4,ue=7,pe=20,he=21,Le=22,oe=23,q=24,_e=25,Me=26,we=28,G=new Int32Array(p,0,te);if(G[Q]!==A)return console.error("THREE.DDSLoader.parse: Invalid magic number in DDS header."),u;if(!G[pe]&O)return console.error("THREE.DDSLoader.parse: Unsupported format, must contain a FourCC code."),u;var R,ve=G[he],le=!1;switch(ve){case ee:R=8,u.format=l.RGB_S3TC_DXT1_Format;break;case U:R=16,u.format=l.RGBA_S3TC_DXT3_Format;break;case K:R=16,u.format=l.RGBA_S3TC_DXT5_Format;break;case re:R=8,u.format=l.RGB_ETC1_Format;break;default:if(G[Le]===32&&G[oe]&16711680&&G[q]&65280&&G[_e]&255&&G[Me]&4278190080)le=!0,R=64,u.format=l.RGBAFormat;else return console.error("THREE.DDSLoader.parse: Unsupported FourCC code ",I(ve)),u}u.mipmapCount=1,G[z]&m&&g!==!1&&(u.mipmapCount=Math.max(1,G[ue]));var H=G[we];if(u.isCubemap=!!(H&S),u.isCubemap&&(!(H&_)||!(H&F)||!(H&P)||!(H&b)||!(H&x)||!(H&k)))return console.error("THREE.DDSLoader.parse: Incomplete cubemap faces"),u;u.width=G[Te],u.height=G[W];for(var e=G[Y]+4,r=u.isCubemap?6:1,n=0;n<r;n++)for(var t=u.width,a=u.height,i=0;i<u.mipmapCount;i++){if(le)var s=X(p,e,t,a),o=s.length;else var o=Math.max(4,t)/4*Math.max(4,a)/4*R,s=new Uint8Array(p,e,o);var f={data:s,width:t,height:a};u.mipmaps.push(f),e+=o,t=Math.max(t>>1,1),a=Math.max(a>>1,1)}return u}});var ye=function(p){Oe(g,p);function g(u){var A=p.call(this)||this;return A.needsRender=!0,u&&u.children.length&&A.add.apply(A,u.children),A.mixer=new Ae.AnimationMixer(A),A}return g.prototype.clone=function(){var u=p.prototype.clone.call(this,!0),A=new Ae.AnimationMixer(u);return u.mixer=A,u.needsRender=!0,u},g}(Ae.Group),Ue="https://vr-public.realsee-cdn.cn/release/static/image/release/five/resource/draco/1.5.6/",Ge=function(p){Oe(g,p);function g(u){var A=p.call(this,u)||this;return A.ddsLoader=new de(u),A.dracoLoader=new E(u),A.dracoLoader.setDecoderPath(Ue),A}return Object.defineProperty(g,"version",{get:function(){return"6.0.0-alpha.70"},enumerable:!1,configurable:!0}),g.prototype.load=function(u,A,m,S){return p.prototype.load.call(this,u,A,m,S)},g.prototype.parse=function(u,A,m,S){return p.prototype.parse.call(this,u,A,function(_){var F=new ye(_.scene),P=_.scenes.map(function(b){return b===_.scene?F:new ye(b)});m(Object.assign(_,{scene:F,scenes:P}))},S)},g}(Fe);V.DDSLoader=de,V.DRACOLoader=E,V.GLTFLoader=Ge,V.GLTFObject=ye,V.THREEGLTFLoader=Fe,Object.defineProperty(V,Symbol.toStringTag,{value:"Module"})});
|
|
255
|
+
*/!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("three")):"function"==typeof define&&define.amd?define(["exports","three"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).FiveSDK_GLTFLoader={},e.THREE)}(this,(function(e,t){"use strict";function r(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e)for(const r in e)if("default"!==r){const a=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,a.get?a:{enumerable:!0,get:()=>e[r]})}return t.default=e,Object.freeze(t)}const a=r(t);var n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)};function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}"function"==typeof SuppressedError&&SuppressedError;var s=function(){function e(e){t.Loader.call(this,e),this.dracoLoader=null,this.ddsLoader=null}function r(){var e={};return{get:function(t){return e[t]},add:function(t,r){e[t]=r},remove:function(t){delete e[t]},removeAll:function(){e={}}}}e.prototype=Object.assign(Object.create(t.Loader.prototype),{constructor:e,load:function(e,r,a,n){var o,s=this;o=""!==this.resourcePath?this.resourcePath:""!==this.path?this.path:t.LoaderUtils.extractUrlBase(e),s.manager.itemStart(e);var i=function(t){n?n(t):console.error(t),s.manager.itemError(e),s.manager.itemEnd(e)},c=new t.FileLoader(s.manager);c.setPath(this.path),c.setResponseType("arraybuffer"),c.setRequestHeader(this.requestHeader),"use-credentials"===s.crossOrigin&&c.setWithCredentials(!0),c.load(e,(function(t){try{s.parse(t,o,(function(t){r(t),s.manager.itemEnd(e)}),i)}catch(a){i(a)}}),a,i)},setDRACOLoader:function(e){return this.dracoLoader=e,this},setDDSLoader:function(e){return this.ddsLoader=e,this},parse:function(e,r,u,d){var m,y={};if("string"==typeof e)m=e;else if(t.LoaderUtils.decodeText(new Uint8Array(e,0,4))===l){try{y[a.KHR_BINARY_GLTF]=new p(e)}catch(b){return void(d&&d(b))}m=y[a.KHR_BINARY_GLTF].content}else m=t.LoaderUtils.decodeText(new Uint8Array(e));var T=JSON.parse(m);if(void 0===T.asset||T.asset.version[0]<2)d&&d(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));else{if(T.extensionsUsed)for(var M=0;M<T.extensionsUsed.length;++M){var A=T.extensionsUsed[M],R=T.extensionsRequired||[];switch(A){case a.KHR_LIGHTS_PUNCTUAL:y[A]=new o(T);break;case a.KHR_MATERIALS_CLEARCOAT:y[A]=new i;break;case a.KHR_MATERIALS_TRANSMISSION:y[A]=new c;break;case a.KHR_MATERIALS_UNLIT:y[A]=new s;break;case a.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:y[A]=new g;break;case a.KHR_DRACO_MESH_COMPRESSION:y[A]=new h(T,this.dracoLoader);break;case a.MSFT_TEXTURE_DDS:y[A]=new n(this.ddsLoader);break;case a.KHR_TEXTURE_TRANSFORM:y[A]=new f;break;case a.KHR_MESH_QUANTIZATION:y[A]=new v;break;default:R.indexOf(A)>=0&&console.warn('THREE.GLTFLoader: Unknown extension "'+A+'".')}}var S=new j(T,y,{path:r||this.resourcePath||"",crossOrigin:this.crossOrigin,manager:this.manager});S.fileLoader.setRequestHeader(this.requestHeader),S.parse(u,d)}}});var a={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:"KHR_materials_pbrSpecularGlossiness",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",MSFT_TEXTURE_DDS:"MSFT_texture_dds"};function n(e){if(!e)throw new Error("THREE.GLTFLoader: Attempting to load .dds texture without importing DDSLoader");this.name=a.MSFT_TEXTURE_DDS,this.ddsLoader=e}function o(e){this.name=a.KHR_LIGHTS_PUNCTUAL;var t=e.extensions&&e.extensions[a.KHR_LIGHTS_PUNCTUAL]||{};this.lightDefs=t.lights||[]}function s(){this.name=a.KHR_MATERIALS_UNLIT}function i(){this.name=a.KHR_MATERIALS_CLEARCOAT}function c(){this.name=a.KHR_MATERIALS_TRANSMISSION}o.prototype.loadLight=function(e){var r,a=this.lightDefs[e],n=new t.Color(16777215);void 0!==a.color&&n.fromArray(a.color);var o=void 0!==a.range?a.range:0;switch(a.type){case"directional":(r=new t.DirectionalLight(n)).target.position.set(0,0,-1),r.add(r.target);break;case"point":(r=new t.PointLight(n)).distance=o;break;case"spot":(r=new t.SpotLight(n)).distance=o,a.spot=a.spot||{},a.spot.innerConeAngle=void 0!==a.spot.innerConeAngle?a.spot.innerConeAngle:0,a.spot.outerConeAngle=void 0!==a.spot.outerConeAngle?a.spot.outerConeAngle:Math.PI/4,r.angle=a.spot.outerConeAngle,r.penumbra=1-a.spot.innerConeAngle/a.spot.outerConeAngle,r.target.position.set(0,0,-1),r.add(r.target);break;default:throw new Error('THREE.GLTFLoader: Unexpected light type, "'+a.type+'".')}return r.position.set(0,0,0),r.decay=2,void 0!==a.intensity&&(r.intensity=a.intensity),r.name=a.name||"light_"+e,Promise.resolve(r)},s.prototype.getMaterialType=function(){return t.MeshBasicMaterial},s.prototype.extendParams=function(e,r,a){var n=[];e.color=new t.Color(1,1,1),e.opacity=1;var o=r.pbrMetallicRoughness;if(o){if(Array.isArray(o.baseColorFactor)){var s=o.baseColorFactor;e.color.fromArray(s),e.opacity=s[3]}void 0!==o.baseColorTexture&&n.push(a.assignTexture(e,"map",o.baseColorTexture))}return Promise.all(n)},i.prototype.getMaterialType=function(){return t.MeshPhysicalMaterial},i.prototype.extendParams=function(e,r,a){var n=[],o=r.extensions[this.name];if(void 0!==o.clearcoatFactor&&(e.clearcoat=o.clearcoatFactor),void 0!==o.clearcoatTexture&&n.push(a.assignTexture(e,"clearcoatMap",o.clearcoatTexture)),void 0!==o.clearcoatRoughnessFactor&&(e.clearcoatRoughness=o.clearcoatRoughnessFactor),void 0!==o.clearcoatRoughnessTexture&&n.push(a.assignTexture(e,"clearcoatRoughnessMap",o.clearcoatRoughnessTexture)),void 0!==o.clearcoatNormalTexture&&(n.push(a.assignTexture(e,"clearcoatNormalMap",o.clearcoatNormalTexture)),void 0!==o.clearcoatNormalTexture.scale)){var s=o.clearcoatNormalTexture.scale;e.clearcoatNormalScale=new t.Vector2(s,s)}return Promise.all(n)},c.prototype.getMaterialType=function(){return t.MeshPhysicalMaterial},c.prototype.extendParams=function(e,t,r){var a=t.extensions[this.name];return void 0!==a.transmissionFactor&&(e.premultipliedAlpha=!0,e.transparent=!0,e.opacity=1,e.transparency=a.transmissionFactor,(e.map||e.color.r*e.color.g*e.color.b<.99)&&(e.transparency*=.75)),Promise.all([])};var l="glTF",u=12,d={JSON:1313821514,BIN:5130562};function p(e){this.name=a.KHR_BINARY_GLTF,this.content=null,this.body=null;var r=new DataView(e,0,u);if(this.header={magic:t.LoaderUtils.decodeText(new Uint8Array(e.slice(0,4))),version:r.getUint32(4,!0),length:r.getUint32(8,!0)},this.header.magic!==l)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");for(var n=new DataView(e,u),o=0;o<n.byteLength;){var s=n.getUint32(o,!0);o+=4;var i=n.getUint32(o,!0);if(o+=4,i===d.JSON){var c=new Uint8Array(e,u+o,s);this.content=t.LoaderUtils.decodeText(c)}else if(i===d.BIN){var p=u+o;this.body=e.slice(p,p+s)}o+=s}if(null===this.content)throw new Error("THREE.GLTFLoader: JSON content not found.")}function h(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=a.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}function f(){this.name=a.KHR_TEXTURE_TRANSFORM}function m(e){t.MeshStandardMaterial.call(this),this.isGLTFSpecularGlossinessMaterial=!0;var r=["#ifdef USE_SPECULARMAP","\tuniform sampler2D specularMap;","#endif"].join("\n"),a=["#ifdef USE_GLOSSINESSMAP","\tuniform sampler2D glossinessMap;","#endif"].join("\n"),n=["vec3 specularFactor = specular;","#ifdef USE_SPECULARMAP","\tvec4 texelSpecular = texture2D( specularMap, vUv );","\ttexelSpecular = sRGBToLinear( texelSpecular );","\t// reads channel RGB, compatible with a glTF Specular-Glossiness (RGBA) texture","\tspecularFactor *= texelSpecular.rgb;","#endif"].join("\n"),o=["float glossinessFactor = glossiness;","#ifdef USE_GLOSSINESSMAP","\tvec4 texelGlossiness = texture2D( glossinessMap, vUv );","\t// reads channel A, compatible with a glTF Specular-Glossiness (RGBA) texture","\tglossinessFactor *= texelGlossiness.a;","#endif"].join("\n"),s=["PhysicalMaterial material;","material.diffuseColor = diffuseColor.rgb;","vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );","float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );","material.specularRoughness = max( 1.0 - glossinessFactor, 0.0525 );// 0.0525 corresponds to the base mip of a 256 cubemap.","material.specularRoughness += geometryRoughness;","material.specularRoughness = min( material.specularRoughness, 1.0 );","material.specularColor = specularFactor.rgb;"].join("\n"),i={specular:{value:(new t.Color).setHex(16777215)},glossiness:{value:1},specularMap:{value:null},glossinessMap:{value:null}};this._extraUniforms=i,this.onBeforeCompile=function(e){for(var t in i)e.uniforms[t]=i[t];e.fragmentShader=e.fragmentShader.replace("uniform float roughness;","uniform vec3 specular;"),e.fragmentShader=e.fragmentShader.replace("uniform float metalness;","uniform float glossiness;"),e.fragmentShader=e.fragmentShader.replace("#include <roughnessmap_pars_fragment>",r),e.fragmentShader=e.fragmentShader.replace("#include <metalnessmap_pars_fragment>",a),e.fragmentShader=e.fragmentShader.replace("#include <roughnessmap_fragment>",n),e.fragmentShader=e.fragmentShader.replace("#include <metalnessmap_fragment>",o),e.fragmentShader=e.fragmentShader.replace("#include <lights_physical_fragment>",s)},Object.defineProperties(this,{specular:{get:function(){return i.specular.value},set:function(e){i.specular.value=e}},specularMap:{get:function(){return i.specularMap.value},set:function(e){i.specularMap.value=e}},glossiness:{get:function(){return i.glossiness.value},set:function(e){i.glossiness.value=e}},glossinessMap:{get:function(){return i.glossinessMap.value},set:function(e){i.glossinessMap.value=e,e?(this.defines.USE_GLOSSINESSMAP="",this.defines.USE_ROUGHNESSMAP=""):(delete this.defines.USE_ROUGHNESSMAP,delete this.defines.USE_GLOSSINESSMAP)}}}),delete this.metalness,delete this.roughness,delete this.metalnessMap,delete this.roughnessMap,this.setValues(e)}function g(){return{name:a.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS,specularGlossinessParams:["color","map","lightMap","lightMapIntensity","aoMap","aoMapIntensity","emissive","emissiveIntensity","emissiveMap","bumpMap","bumpScale","normalMap","normalMapType","displacementMap","displacementScale","displacementBias","specularMap","specular","glossinessMap","glossiness","alphaMap","envMap","envMapIntensity","refractionRatio"],getMaterialType:function(){return m},extendParams:function(e,r,a){var n=r.extensions[this.name];e.color=new t.Color(1,1,1),e.opacity=1;var o=[];if(Array.isArray(n.diffuseFactor)){var s=n.diffuseFactor;e.color.fromArray(s),e.opacity=s[3]}if(void 0!==n.diffuseTexture&&o.push(a.assignTexture(e,"map",n.diffuseTexture)),e.emissive=new t.Color(0,0,0),e.glossiness=void 0!==n.glossinessFactor?n.glossinessFactor:1,e.specular=new t.Color(1,1,1),Array.isArray(n.specularFactor)&&e.specular.fromArray(n.specularFactor),void 0!==n.specularGlossinessTexture){var i=n.specularGlossinessTexture;o.push(a.assignTexture(e,"glossinessMap",i)),o.push(a.assignTexture(e,"specularMap",i))}return Promise.all(o)},createMaterial:function(e){var r=new m(e);return r.fog=!0,r.color=e.color,r.map=void 0===e.map?null:e.map,r.lightMap=null,r.lightMapIntensity=1,r.aoMap=void 0===e.aoMap?null:e.aoMap,r.aoMapIntensity=1,r.emissive=e.emissive,r.emissiveIntensity=1,r.emissiveMap=void 0===e.emissiveMap?null:e.emissiveMap,r.bumpMap=void 0===e.bumpMap?null:e.bumpMap,r.bumpScale=1,r.normalMap=void 0===e.normalMap?null:e.normalMap,r.normalMapType=t.TangentSpaceNormalMap,e.normalScale&&(r.normalScale=e.normalScale),r.displacementMap=null,r.displacementScale=1,r.displacementBias=0,r.specularMap=void 0===e.specularMap?null:e.specularMap,r.specular=e.specular,r.glossinessMap=void 0===e.glossinessMap?null:e.glossinessMap,r.glossiness=e.glossiness,r.alphaMap=null,r.envMap=void 0===e.envMap?null:e.envMap,r.envMapIntensity=1,r.refractionRatio=.98,r}}}function v(){this.name=a.KHR_MESH_QUANTIZATION}function y(e,r,a,n){t.Interpolant.call(this,e,r,a,n)}h.prototype.decodePrimitive=function(e,t){var r=this.json,a=this.dracoLoader,n=e.extensions[this.name].bufferView,o=e.extensions[this.name].attributes,s={},i={},c={};for(var l in o){var u=I[l]||l.toLowerCase();s[u]=o[l]}for(l in e.attributes){u=I[l]||l.toLowerCase();if(void 0!==o[l]){var d=r.accessors[e.attributes[l]],p=L[d.componentType];c[u]=p,i[u]=!0===d.normalized}}return t.getDependency("bufferView",n).then((function(e){return new Promise((function(t){a.decodeDracoFile(e,(function(e){for(var r in e.attributes){var a=e.attributes[r],n=i[r];void 0!==n&&(a.normalized=n)}t(e)}),s,c)}))}))},f.prototype.extendTexture=function(e,t){return e=e.clone(),void 0!==t.offset&&e.offset.fromArray(t.offset),void 0!==t.rotation&&(e.rotation=t.rotation),void 0!==t.scale&&e.repeat.fromArray(t.scale),void 0!==t.texCoord&&console.warn('THREE.GLTFLoader: Custom UV sets in "'+this.name+'" extension not yet supported.'),e.needsUpdate=!0,e},m.prototype=Object.create(t.MeshStandardMaterial.prototype),m.prototype.constructor=m,m.prototype.copy=function(e){return t.MeshStandardMaterial.prototype.copy.call(this,e),this.specularMap=e.specularMap,this.specular.copy(e.specular),this.glossinessMap=e.glossinessMap,this.glossiness=e.glossiness,delete this.metalness,delete this.roughness,delete this.metalnessMap,delete this.roughnessMap,this},y.prototype=Object.create(t.Interpolant.prototype),y.prototype.constructor=y,y.prototype.copySampleValue_=function(e){for(var t=this.resultBuffer,r=this.sampleValues,a=this.valueSize,n=e*a*3+a,o=0;o!==a;o++)t[o]=r[n+o];return t},y.prototype.beforeStart_=y.prototype.copySampleValue_,y.prototype.afterEnd_=y.prototype.copySampleValue_,y.prototype.interpolate_=function(e,t,r,a){for(var n=this.resultBuffer,o=this.sampleValues,s=this.valueSize,i=2*s,c=3*s,l=a-t,u=(r-t)/l,d=u*u,p=d*u,h=e*c,f=h-c,m=-2*p+3*d,g=p-d,v=1-m,y=g-d+u,T=0;T!==s;T++){var M=o[f+T+s],A=o[f+T+i]*l,R=o[h+T+s],S=o[h+T]*l;n[T]=v*M+y*A+m*R+g*S}return n};var T=0,M=1,A=2,R=3,S=4,b=5,w=6,L={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},_={9728:t.NearestFilter,9729:t.LinearFilter,9984:t.NearestMipmapNearestFilter,9985:t.LinearMipmapNearestFilter,9986:t.NearestMipmapLinearFilter,9987:t.LinearMipmapLinearFilter},E={33071:t.ClampToEdgeWrapping,33648:t.MirroredRepeatWrapping,10497:t.RepeatWrapping},x={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},I={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv2",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},C={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},D={CUBICSPLINE:void 0,LINEAR:t.InterpolateLinear,STEP:t.InterpolateDiscrete},P="OPAQUE",O="MASK",U="BLEND",F={"image/png":t.RGBAFormat,"image/jpeg":t.RGBFormat};function k(e,t){return"string"!=typeof e||""===e?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}function H(e,t,r){for(var a in r.extensions)void 0===e[a]&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[a]=r.extensions[a])}function N(e,t){void 0!==t.extras&&("object"==typeof t.extras?Object.assign(e.userData,t.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras))}function G(e,t){if(e.updateMorphTargets(),void 0!==t.weights)for(var r=0,a=t.weights.length;r<a;r++)e.morphTargetInfluences[r]=t.weights[r];if(t.extras&&Array.isArray(t.extras.targetNames)){var n=t.extras.targetNames;if(e.morphTargetInfluences.length===n.length){e.morphTargetDictionary={};for(r=0,a=n.length;r<a;r++)e.morphTargetDictionary[n[r]]=r}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function B(e){for(var t="",r=Object.keys(e).sort(),a=0,n=r.length;a<n;a++)t+=r[a]+":"+e[r[a]]+";";return t}function j(e,a,n){this.json=e||{},this.extensions=a||{},this.options=n||{},this.cache=new r,this.associations=new Map,this.primitiveCache={},this.textureLoader=new t.TextureLoader(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.fileLoader=new t.FileLoader(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}function K(e,r,a){var n=r.attributes,o=[];function s(t,r){return a.getDependency("accessor",t).then((function(t){e.setAttribute(r,t)}))}for(var i in n){var c=I[i]||i.toLowerCase();c in e.attributes||o.push(s(n[i],c))}if(void 0!==r.indices&&!e.index){var l=a.getDependency("accessor",r.indices).then((function(t){e.setIndex(t)}));o.push(l)}return N(e,r),function(e,r,a){var n=r.attributes,o=new t.Box3;if(void 0!==n.POSITION){var s=(h=a.json.accessors[n.POSITION]).min,i=h.max;if(void 0!==s&&void 0!==i){o.set(new t.Vector3(s[0],s[1],s[2]),new t.Vector3(i[0],i[1],i[2]));var c=r.targets;if(void 0!==c){for(var l=new t.Vector3,u=new t.Vector3,d=0,p=c.length;d<p;d++){var h,f=c[d];if(void 0!==f.POSITION)s=(h=a.json.accessors[f.POSITION]).min,i=h.max,void 0!==s&&void 0!==i?(u.setX(Math.max(Math.abs(s[0]),Math.abs(i[0]))),u.setY(Math.max(Math.abs(s[1]),Math.abs(i[1]))),u.setZ(Math.max(Math.abs(s[2]),Math.abs(i[2]))),l.max(u)):console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}o.expandByVector(l)}e.boundingBox=o;var m=new t.Sphere;o.getCenter(m.center),m.radius=o.min.distanceTo(o.max)/2,e.boundingSphere=m}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}(e,r,a),Promise.all(o).then((function(){return void 0!==r.targets?function(e,t,r){for(var a=!1,n=!1,o=0,s=t.length;o<s&&(void 0!==(l=t[o]).POSITION&&(a=!0),void 0!==l.NORMAL&&(n=!0),!a||!n);o++);if(!a&&!n)return Promise.resolve(e);var i=[],c=[];for(o=0,s=t.length;o<s;o++){var l=t[o];if(a){var u=void 0!==l.POSITION?r.getDependency("accessor",l.POSITION):e.attributes.position;i.push(u)}n&&(u=void 0!==l.NORMAL?r.getDependency("accessor",l.NORMAL):e.attributes.normal,c.push(u))}return Promise.all([Promise.all(i),Promise.all(c)]).then((function(t){var r=t[0],o=t[1];return a&&(e.morphAttributes.position=r),n&&(e.morphAttributes.normal=o),e.morphTargetsRelative=!0,e}))}(e,r.targets,a):e}))}function V(e,r){var a=e.getIndex();if(null===a){var n=[],o=e.getAttribute("position");if(void 0===o)return console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),e;for(var s=0;s<o.count;s++)n.push(s);e.setIndex(n),a=e.getIndex()}var i=a.count-2,c=[];if(r===t.TriangleFanDrawMode)for(s=1;s<=i;s++)c.push(a.getX(0)),c.push(a.getX(s)),c.push(a.getX(s+1));else for(s=0;s<i;s++)s%2==0?(c.push(a.getX(s)),c.push(a.getX(s+1)),c.push(a.getX(s+2))):(c.push(a.getX(s+2)),c.push(a.getX(s+1)),c.push(a.getX(s)));c.length/3!==i&&console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");var l=e.clone();return l.setIndex(c),l}return j.prototype.parse=function(e,t){var r=this,a=this.json,n=this.extensions;this.cache.removeAll(),this.markDefs(),Promise.all([this.getDependencies("scene"),this.getDependencies("animation"),this.getDependencies("camera")]).then((function(t){var o={scene:t[0][a.scene||0],scenes:t[0],animations:t[1],cameras:t[2],asset:a.asset,parser:r,userData:{}};H(n,o,a),N(o,a),e(o)})).catch(t)},j.prototype.markDefs=function(){for(var e=this.json.nodes||[],t=this.json.skins||[],r=this.json.meshes||[],a={},n={},o=0,s=t.length;o<s;o++)for(var i=t[o].joints,c=0,l=i.length;c<l;c++)e[i[c]].isBone=!0;for(var u=0,d=e.length;u<d;u++){var p=e[u];void 0!==p.mesh&&(void 0===a[p.mesh]&&(a[p.mesh]=n[p.mesh]=0),a[p.mesh]++,void 0!==p.skin&&(r[p.mesh].isSkinnedMesh=!0))}this.json.meshReferences=a,this.json.meshUses=n},j.prototype.getDependency=function(e,t){var r=e+":"+t,n=this.cache.get(r);if(!n){switch(e){case"scene":n=this.loadScene(t);break;case"node":n=this.loadNode(t);break;case"mesh":n=this.loadMesh(t);break;case"accessor":n=this.loadAccessor(t);break;case"bufferView":n=this.loadBufferView(t);break;case"buffer":n=this.loadBuffer(t);break;case"material":n=this.loadMaterial(t);break;case"texture":n=this.loadTexture(t);break;case"skin":n=this.loadSkin(t);break;case"animation":n=this.loadAnimation(t);break;case"camera":n=this.loadCamera(t);break;case"light":n=this.extensions[a.KHR_LIGHTS_PUNCTUAL].loadLight(t);break;default:throw new Error("Unknown type: "+e)}this.cache.add(r,n)}return n},j.prototype.getDependencies=function(e){var t=this.cache.get(e);if(!t){var r=this,a=this.json[e+("mesh"===e?"es":"s")]||[];t=Promise.all(a.map((function(t,a){return r.getDependency(e,a)}))),this.cache.add(e,t)}return t},j.prototype.loadBuffer=function(e){var t=this.json.buffers[e],r=this.fileLoader;if(t.type&&"arraybuffer"!==t.type)throw new Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(void 0===t.uri&&0===e)return Promise.resolve(this.extensions[a.KHR_BINARY_GLTF].body);var n=this.options;return new Promise((function(e,a){r.load(k(t.uri,n.path),e,void 0,(function(){a(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))}))}))},j.prototype.loadBufferView=function(e){var t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then((function(e){var r=t.byteLength||0,a=t.byteOffset||0;return e.slice(a,a+r)}))},j.prototype.loadAccessor=function(e){var r=this,a=this.json,n=this.json.accessors[e];if(void 0===n.bufferView&&void 0===n.sparse)return Promise.resolve(null);var o=[];return void 0!==n.bufferView?o.push(this.getDependency("bufferView",n.bufferView)):o.push(null),void 0!==n.sparse&&(o.push(this.getDependency("bufferView",n.sparse.indices.bufferView)),o.push(this.getDependency("bufferView",n.sparse.values.bufferView))),Promise.all(o).then((function(e){var o,s,i=e[0],c=x[n.type],l=L[n.componentType],u=l.BYTES_PER_ELEMENT,d=u*c,p=n.byteOffset||0,h=void 0!==n.bufferView?a.bufferViews[n.bufferView].byteStride:void 0,f=!0===n.normalized;if(h&&h!==d){var m=Math.floor(p/h),g="InterleavedBuffer:"+n.bufferView+":"+n.componentType+":"+m+":"+n.count,v=r.cache.get(g);v||(o=new l(i,m*h,n.count*h/u),v=new t.InterleavedBuffer(o,h/u),r.cache.add(g,v)),s=new t.InterleavedBufferAttribute(v,c,p%h/u,f)}else o=null===i?new l(n.count*c):new l(i,p,n.count*c),s=new t.BufferAttribute(o,c,f);if(void 0!==n.sparse){var y=x.SCALAR,T=L[n.sparse.indices.componentType],M=n.sparse.indices.byteOffset||0,A=n.sparse.values.byteOffset||0,R=new T(e[1],M,n.sparse.count*y),S=new l(e[2],A,n.sparse.count*c);null!==i&&(s=new t.BufferAttribute(s.array.slice(),s.itemSize,s.normalized));for(var b=0,w=R.length;b<w;b++){var _=R[b];if(s.setX(_,S[b*c]),c>=2&&s.setY(_,S[b*c+1]),c>=3&&s.setZ(_,S[b*c+2]),c>=4&&s.setW(_,S[b*c+3]),c>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return s}))},j.prototype.loadTexture=function(e){var r,n=this,o=this.json,s=this.options,i=this.textureLoader,c=self.URL||self.webkitURL,l=o.textures[e],u=l.extensions||{},d=(r=u[a.MSFT_TEXTURE_DDS]?o.images[u[a.MSFT_TEXTURE_DDS].source]:o.images[l.source]).uri,p=!1;return void 0!==r.bufferView&&(d=n.getDependency("bufferView",r.bufferView).then((function(e){p=!0;var t=new Blob([e],{type:r.mimeType});return d=c.createObjectURL(t)}))),Promise.resolve(d).then((function(e){var t=s.manager.getHandler(e);return t||(t=u[a.MSFT_TEXTURE_DDS]?n.extensions[a.MSFT_TEXTURE_DDS].ddsLoader:i),new Promise((function(r,a){t.load(k(e,s.path),r,void 0,a)}))})).then((function(a){!0===p&&c.revokeObjectURL(d),a.flipY=!1,l.name&&(a.name=l.name),r.mimeType in F&&(a.format=F[r.mimeType]);var s=(o.samplers||{})[l.sampler]||{};return a.magFilter=_[s.magFilter]||t.LinearFilter,a.minFilter=_[s.minFilter]||t.LinearMipmapLinearFilter,a.wrapS=E[s.wrapS]||t.RepeatWrapping,a.wrapT=E[s.wrapT]||t.RepeatWrapping,n.associations.set(a,{type:"textures",index:e}),a}))},j.prototype.assignTexture=function(e,r,n){var o=this;return this.getDependency("texture",n.index).then((function(s){if(!s.isCompressedTexture)switch(r){case"aoMap":case"emissiveMap":case"metalnessMap":case"normalMap":case"roughnessMap":s.format=t.RGBFormat}if(void 0===n.texCoord||0==n.texCoord||"aoMap"===r&&1==n.texCoord||console.warn("THREE.GLTFLoader: Custom UV set "+n.texCoord+" for texture "+r+" not yet supported."),o.extensions[a.KHR_TEXTURE_TRANSFORM]){var i=void 0!==n.extensions?n.extensions[a.KHR_TEXTURE_TRANSFORM]:void 0;if(i){var c=this.associations.get(s);s=o.extensions[a.KHR_TEXTURE_TRANSFORM].extendTexture(s,i),this.associations.set(s,c)}}e[r]=s}))},j.prototype.assignFinalMaterial=function(e){var r=e.geometry,a=e.material,n=void 0!==r.attributes.tangent,o=void 0!==r.attributes.color,s=void 0===r.attributes.normal,i=!0===e.isSkinnedMesh,c=Object.keys(r.morphAttributes).length>0,l=c&&void 0!==r.morphAttributes.normal;if(e.isPoints){var u="PointsMaterial:"+a.uuid,d=this.cache.get(u);d||(d=new t.PointsMaterial,t.Material.prototype.copy.call(d,a),d.color.copy(a.color),d.map=a.map,d.sizeAttenuation=!1,this.cache.add(u,d)),a=d}else if(e.isLine){u="LineBasicMaterial:"+a.uuid;var p=this.cache.get(u);p||(p=new t.LineBasicMaterial,t.Material.prototype.copy.call(p,a),p.color.copy(a.color),this.cache.add(u,p)),a=p}if(n||o||s||i||c){u="ClonedMaterial:"+a.uuid+":";a.isGLTFSpecularGlossinessMaterial&&(u+="specular-glossiness:"),i&&(u+="skinning:"),n&&(u+="vertex-tangents:"),o&&(u+="vertex-colors:"),s&&(u+="flat-shading:"),c&&(u+="morph-targets:"),l&&(u+="morph-normals:");var h=this.cache.get(u);h||(h=a.clone(),i&&(h.skinning=!0),n&&(h.vertexTangents=!0),o&&(h.vertexColors=!0),s&&(h.flatShading=!0),c&&(h.morphTargets=!0),l&&(h.morphNormals=!0),this.cache.add(u,h),this.associations.set(h,this.associations.get(a))),a=h}a.aoMap&&void 0===r.attributes.uv2&&void 0!==r.attributes.uv&&r.setAttribute("uv2",r.attributes.uv),a.normalScale&&!n&&(a.normalScale.y=-a.normalScale.y),a.clearcoatNormalScale&&!n&&(a.clearcoatNormalScale.y=-a.clearcoatNormalScale.y),e.material=a},j.prototype.loadMaterial=function(e){var r,n=this,o=this.json,s=this.extensions,i=o.materials[e],c={},l=i.extensions||{},u=[];if(l[a.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS]){var d=s[a.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS];r=d.getMaterialType(),u.push(d.extendParams(c,i,n))}else if(l[a.KHR_MATERIALS_UNLIT]){var p=s[a.KHR_MATERIALS_UNLIT];r=p.getMaterialType(),u.push(p.extendParams(c,i,n))}else{r=t.MeshStandardMaterial;var h=i.pbrMetallicRoughness||{};if(c.color=new t.Color(1,1,1),c.opacity=1,Array.isArray(h.baseColorFactor)){var f=h.baseColorFactor;c.color.fromArray(f),c.opacity=f[3]}void 0!==h.baseColorTexture&&u.push(n.assignTexture(c,"map",h.baseColorTexture)),c.metalness=void 0!==h.metallicFactor?h.metallicFactor:1,c.roughness=void 0!==h.roughnessFactor?h.roughnessFactor:1,void 0!==h.metallicRoughnessTexture&&(u.push(n.assignTexture(c,"metalnessMap",h.metallicRoughnessTexture)),u.push(n.assignTexture(c,"roughnessMap",h.metallicRoughnessTexture)))}!0===i.doubleSided&&(c.side=t.DoubleSide);var g=i.alphaMode||P;if(g===U?(c.transparent=!0,c.depthWrite=!1):(c.transparent=!1,g===O&&(c.alphaTest=void 0!==i.alphaCutoff?i.alphaCutoff:.5)),void 0!==i.normalTexture&&r!==t.MeshBasicMaterial&&(u.push(n.assignTexture(c,"normalMap",i.normalTexture)),c.normalScale=new t.Vector2(1,1),void 0!==i.normalTexture.scale&&c.normalScale.set(i.normalTexture.scale,i.normalTexture.scale)),void 0!==i.occlusionTexture&&r!==t.MeshBasicMaterial&&(u.push(n.assignTexture(c,"aoMap",i.occlusionTexture)),void 0!==i.occlusionTexture.strength&&(c.aoMapIntensity=i.occlusionTexture.strength)),void 0!==i.emissiveFactor&&r!==t.MeshBasicMaterial&&(c.emissive=(new t.Color).fromArray(i.emissiveFactor)),void 0!==i.emissiveTexture&&r!==t.MeshBasicMaterial&&u.push(n.assignTexture(c,"emissiveMap",i.emissiveTexture)),l[a.KHR_MATERIALS_CLEARCOAT]){var v=s[a.KHR_MATERIALS_CLEARCOAT];r=v.getMaterialType(),u.push(v.extendParams(c,{extensions:l},n))}if(l[a.KHR_MATERIALS_TRANSMISSION]){v=s[a.KHR_MATERIALS_TRANSMISSION];r=v.getMaterialType(),u.push(v.extendParams(c,{extensions:l},n))}return Promise.all(u).then((function(){var o;return o=r===m?s[a.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS].createMaterial(c):new r(c),i.name&&(o.name=i.name),o.map&&(o.map.encoding=t.sRGBEncoding),o.emissiveMap&&(o.emissiveMap.encoding=t.sRGBEncoding),N(o,i),n.associations.set(o,{type:"materials",index:e}),i.extensions&&H(s,o,i),o}))},j.prototype.loadGeometries=function(e){var r=this,n=this.extensions,o=this.primitiveCache;function s(e){return n[a.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,r).then((function(t){return K(t,e,r)}))}for(var i,c,l=[],u=0,d=e.length;u<d;u++){var p,h=e[u],f=(c=void 0,(c=(i=h).extensions&&i.extensions[a.KHR_DRACO_MESH_COMPRESSION])?"draco:"+c.bufferView+":"+c.indices+":"+B(c.attributes):i.indices+":"+B(i.attributes)+":"+i.mode),m=o[f];if(m)l.push(m.promise);else p=h.extensions&&h.extensions[a.KHR_DRACO_MESH_COMPRESSION]?s(h):K(new t.BufferGeometry,h,r),o[f]={primitive:h,promise:p},l.push(p)}return Promise.all(l)},j.prototype.loadMesh=function(e){for(var r,a=this,n=this.json.meshes[e],o=n.primitives,s=[],i=0,c=o.length;i<c;i++){var l=void 0===o[i].material?(void 0===(r=this.cache).DefaultMaterial&&(r.DefaultMaterial=new t.MeshStandardMaterial({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:t.FrontSide})),r.DefaultMaterial):this.getDependency("material",o[i].material);s.push(l)}return s.push(a.loadGeometries(o)),Promise.all(s).then((function(r){for(var s=r.slice(0,r.length-1),i=r[r.length-1],c=[],l=0,u=i.length;l<u;l++){var d,p=i[l],h=o[l],f=s[l];if(h.mode===S||h.mode===b||h.mode===w||void 0===h.mode)!0!==(d=!0===n.isSkinnedMesh?new t.SkinnedMesh(p,f):new t.Mesh(p,f)).isSkinnedMesh||d.geometry.attributes.skinWeight.normalized||d.normalizeSkinWeights(),h.mode===b?d.geometry=V(d.geometry,t.TriangleStripDrawMode):h.mode===w&&(d.geometry=V(d.geometry,t.TriangleFanDrawMode));else if(h.mode===M)d=new t.LineSegments(p,f);else if(h.mode===R)d=new t.Line(p,f);else if(h.mode===A)d=new t.LineLoop(p,f);else{if(h.mode!==T)throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+h.mode);d=new t.Points(p,f)}Object.keys(d.geometry.morphAttributes).length>0&&G(d,n),d.name=n.name||"mesh_"+e,i.length>1&&(d.name+="_"+l),N(d,n),a.assignFinalMaterial(d),c.push(d)}if(1===c.length)return c[0];var m=new t.Group;for(l=0,u=c.length;l<u;l++)m.add(c[l]);return m}))},j.prototype.loadCamera=function(e){var r,a=this.json.cameras[e],n=a[a.type];if(n)return"perspective"===a.type?r=new t.PerspectiveCamera(t.MathUtils.radToDeg(n.yfov),n.aspectRatio||1,n.znear||1,n.zfar||2e6):"orthographic"===a.type&&(r=new t.OrthographicCamera(-n.xmag,n.xmag,n.ymag,-n.ymag,n.znear,n.zfar)),a.name&&(r.name=a.name),N(r,a),Promise.resolve(r);console.warn("THREE.GLTFLoader: Missing camera parameters.")},j.prototype.loadSkin=function(e){var t=this.json.skins[e],r={joints:t.joints};return void 0===t.inverseBindMatrices?Promise.resolve(r):this.getDependency("accessor",t.inverseBindMatrices).then((function(e){return r.inverseBindMatrices=e,r}))},j.prototype.loadAnimation=function(e){for(var r=this.json.animations[e],a=[],n=[],o=[],s=[],i=[],c=0,l=r.channels.length;c<l;c++){var u=r.channels[c],d=r.samplers[u.sampler],p=u.target,h=void 0!==p.node?p.node:p.id,f=void 0!==r.parameters?r.parameters[d.input]:d.input,m=void 0!==r.parameters?r.parameters[d.output]:d.output;a.push(this.getDependency("node",h)),n.push(this.getDependency("accessor",f)),o.push(this.getDependency("accessor",m)),s.push(d),i.push(p)}return Promise.all([Promise.all(a),Promise.all(n),Promise.all(o),Promise.all(s),Promise.all(i)]).then((function(a){for(var n=a[0],o=a[1],s=a[2],i=a[3],c=a[4],l=[],u=0,d=n.length;u<d;u++){var p=n[u],h=o[u],f=s[u],m=i[u],g=c[u];if(void 0!==p){var v;switch(p.updateMatrix(),p.matrixAutoUpdate=!0,C[g.path]){case C.weights:v=t.NumberKeyframeTrack;break;case C.rotation:v=t.QuaternionKeyframeTrack;break;default:v=t.VectorKeyframeTrack}var T=p.name?p.name:p.uuid,M=void 0!==m.interpolation?D[m.interpolation]:t.InterpolateLinear,A=[];C[g.path]===C.weights?p.traverse((function(e){!0===e.isMesh&&e.morphTargetInfluences&&A.push(e.name?e.name:e.uuid)})):A.push(T);var R=f.array;if(f.normalized){var S;if(R.constructor===Int8Array)S=1/127;else if(R.constructor===Uint8Array)S=1/255;else if(R.constructor==Int16Array)S=1/32767;else{if(R.constructor!==Uint16Array)throw new Error("THREE.GLTFLoader: Unsupported output accessor component type.");S=1/65535}for(var b=new Float32Array(R.length),w=0,L=R.length;w<L;w++)b[w]=R[w]*S;R=b}for(w=0,L=A.length;w<L;w++){var _=new v(A[w]+"."+C[g.path],h.array,R,M);"CUBICSPLINE"===m.interpolation&&(_.createInterpolant=function(e){return new y(this.times,this.values,this.getValueSize()/3,e)},_.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0),l.push(_)}}}var E=r.name?r.name:"animation_"+e;return new t.AnimationClip(E,void 0,l)}))},j.prototype.loadNode=function(e){var r,n=this.json,o=this.extensions,s=this,i=n.meshReferences,c=n.meshUses,l=n.nodes[e];return(r=[],void 0!==l.mesh&&r.push(s.getDependency("mesh",l.mesh).then((function(e){var t;if(i[l.mesh]>1){var r=c[l.mesh]++;(t=e.clone()).name+="_instance_"+r}else t=e;return void 0!==l.weights&&t.traverse((function(e){if(e.isMesh)for(var t=0,r=l.weights.length;t<r;t++)e.morphTargetInfluences[t]=l.weights[t]})),t}))),void 0!==l.camera&&r.push(s.getDependency("camera",l.camera)),l.extensions&&l.extensions[a.KHR_LIGHTS_PUNCTUAL]&&void 0!==l.extensions[a.KHR_LIGHTS_PUNCTUAL].light&&r.push(s.getDependency("light",l.extensions[a.KHR_LIGHTS_PUNCTUAL].light)),Promise.all(r)).then((function(r){var a;if((a=!0===l.isBone?new t.Bone:r.length>1?new t.Group:1===r.length?r[0]:new t.Object3D)!==r[0])for(var n=0,i=r.length;n<i;n++)a.add(r[n]);if(l.name&&(a.userData.name=l.name,a.name=t.PropertyBinding.sanitizeNodeName(l.name)),N(a,l),l.extensions&&H(o,a,l),void 0!==l.matrix){var c=new t.Matrix4;c.fromArray(l.matrix),a.applyMatrix4(c)}else void 0!==l.translation&&a.position.fromArray(l.translation),void 0!==l.rotation&&a.quaternion.fromArray(l.rotation),void 0!==l.scale&&a.scale.fromArray(l.scale);return s.associations.set(a,{type:"nodes",index:e}),a}))},j.prototype.loadScene=function(){function e(r,a,n,o){var s=n.nodes[r];return o.getDependency("node",r).then((function(e){return void 0===s.skin?e:o.getDependency("skin",s.skin).then((function(e){for(var t=[],a=0,n=(r=e).joints.length;a<n;a++)t.push(o.getDependency("node",r.joints[a]));return Promise.all(t)})).then((function(a){return e.traverse((function(e){if(e.isMesh){for(var n=[],o=[],s=0,i=a.length;s<i;s++){var c=a[s];if(c){n.push(c);var l=new t.Matrix4;void 0!==r.inverseBindMatrices&&l.fromArray(r.inverseBindMatrices.array,16*s),o.push(l)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',r.joints[s])}e.bind(new t.Skeleton(n,o),e.matrixWorld)}})),e}));var r})).then((function(t){a.add(t);var r=[];if(s.children)for(var i=s.children,c=0,l=i.length;c<l;c++){var u=i[c];r.push(e(u,t,n,o))}return Promise.all(r)}))}return function(r){var a=this.json,n=this.extensions,o=this.json.scenes[r],s=new t.Group;o.name&&(s.name=o.name),N(s,o),o.extensions&&H(n,s,o);for(var i=o.nodes||[],c=[],l=0,u=i.length;l<u;l++)c.push(e(i[l],s,a,this));return Promise.all(c).then((function(){return s}))}}(),e}(),i=function(e){t.Loader.call(this,e),this.decoderPath="",this.decoderConfig={},this.decoderBinary=null,this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL="",this.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},this.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"}};i.prototype=Object.assign(Object.create(t.Loader.prototype),{constructor:i,setDecoderPath:function(e){return this.decoderPath=e,this},setDecoderConfig:function(e){return this.decoderConfig=e,this},setWorkerLimit:function(e){return this.workerLimit=e,this},setVerbosity:function(){console.warn("THREE.DRACOLoader: The .setVerbosity() method has been removed.")},setDrawMode:function(){console.warn("THREE.DRACOLoader: The .setDrawMode() method has been removed.")},setSkipDequantization:function(){console.warn("THREE.DRACOLoader: The .setSkipDequantization() method has been removed.")},load:function(e,r,a,n){var o=new t.FileLoader(this.manager);o.setPath(this.path),o.setResponseType("arraybuffer"),"use-credentials"===this.crossOrigin&&o.setWithCredentials(!0),o.load(e,(e=>{var t={attributeIDs:this.defaultAttributeIDs,attributeTypes:this.defaultAttributeTypes,useUniqueIDs:!1};this.decodeGeometry(e,t).then(r).catch(n)}),a,n)},decodeDracoFile:function(e,t,r,a){var n={attributeIDs:r||this.defaultAttributeIDs,attributeTypes:a||this.defaultAttributeTypes,useUniqueIDs:!!r};this.decodeGeometry(e,n).then(t)},decodeGeometry:function(e,t){for(var r in t.attributeTypes){var a=t.attributeTypes[r];void 0!==a.BYTES_PER_ELEMENT&&(t.attributeTypes[r]=a.name)}var n,o=JSON.stringify(t);if(i.taskCache.has(e)){var s=i.taskCache.get(e);if(s.key===o)return s.promise;if(0===e.byteLength)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}var c=this.workerNextTaskID++,l=e.byteLength,u=this._getWorker(c,l).then((r=>(n=r,new Promise(((r,a)=>{n._callbacks[c]={resolve:r,reject:a},n.postMessage({type:"decode",id:c,taskConfig:t,buffer:e},[e])}))))).then((e=>this._createGeometry(e.geometry)));return u.catch((()=>!0)).then((()=>{n&&c&&this._releaseTask(n,c)})),i.taskCache.set(e,{key:o,promise:u}),u},_createGeometry:function(e){var r=new t.BufferGeometry;e.index&&r.setIndex(new t.BufferAttribute(e.index.array,1));for(var a=0;a<e.attributes.length;a++){var n=e.attributes[a],o=n.name,s=n.array,i=n.itemSize;r.setAttribute(o,new t.BufferAttribute(s,i))}return r},_loadLibrary:function(e,r){var a=new t.FileLoader(this.manager);return a.setPath(this.decoderPath),a.setResponseType(r),new Promise(((t,r)=>{a.load(e,t,void 0,r)}))},preload:function(){return this._initDecoder(),this},_initDecoder:function(){if(this.decoderPending)return this.decoderPending;var e="object"!=typeof WebAssembly||"js"===this.decoderConfig.type,t=[];return e?t.push(this._loadLibrary("draco_decoder.js","text")):(t.push(this._loadLibrary("draco_wasm_wrapper.js","text")),t.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(t).then((t=>{var r=t[0];e||(this.decoderConfig.wasmBinary=t[1]);var a=i.DRACOWorker.toString(),n=["/* draco decoder */",r,"","/* worker */",a.substring(a.indexOf("{")+1,a.lastIndexOf("}"))].join("\n");this.workerSourceURL=URL.createObjectURL(new Blob([n]))})),this.decoderPending},_getWorker:function(e,t){return this._initDecoder().then((()=>{var r;this.workerPool.length<this.workerLimit?((r=new Worker(this.workerSourceURL))._callbacks={},r._taskCosts={},r._taskLoad=0,r.postMessage({type:"init",decoderConfig:this.decoderConfig}),r.onmessage=function(e){var t=e.data;switch(t.type){case"decode":r._callbacks[t.id].resolve(t);break;case"error":r._callbacks[t.id].reject(t);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+t.type+'"')}},this.workerPool.push(r)):this.workerPool.sort((function(e,t){return e._taskLoad>t._taskLoad?-1:1}));return(r=this.workerPool[this.workerPool.length-1])._taskCosts[e]=t,r._taskLoad+=t,r}))},_releaseTask:function(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]},debug:function(){console.log("Task load: ",this.workerPool.map((e=>e._taskLoad)))},dispose:function(){for(var e=0;e<this.workerPool.length;++e)this.workerPool[e].terminate();return this.workerPool.length=0,this}}),i.DRACOWorker=function(){var e,t;function r(e,t,r,a,n,o){var s,i,c=o.num_components(),l=r.num_points()*c;switch(n){case Float32Array:s=new e.DracoFloat32Array,t.GetAttributeFloatForAllPoints(r,o,s),i=new Float32Array(l);break;case Int8Array:s=new e.DracoInt8Array,t.GetAttributeInt8ForAllPoints(r,o,s),i=new Int8Array(l);break;case Int16Array:s=new e.DracoInt16Array,t.GetAttributeInt16ForAllPoints(r,o,s),i=new Int16Array(l);break;case Int32Array:s=new e.DracoInt32Array,t.GetAttributeInt32ForAllPoints(r,o,s),i=new Int32Array(l);break;case Uint8Array:s=new e.DracoUInt8Array,t.GetAttributeUInt8ForAllPoints(r,o,s),i=new Uint8Array(l);break;case Uint16Array:s=new e.DracoUInt16Array,t.GetAttributeUInt16ForAllPoints(r,o,s),i=new Uint16Array(l);break;case Uint32Array:s=new e.DracoUInt32Array,t.GetAttributeUInt32ForAllPoints(r,o,s),i=new Uint32Array(l);break;default:throw new Error("THREE.DRACOLoader: Unexpected attribute type.")}for(var u=0;u<l;u++)i[u]=s.GetValue(u);return e.destroy(s),{name:a,array:i,itemSize:c}}onmessage=function(a){var n=a.data;switch(n.type){case"init":e=n.decoderConfig,t=new Promise((function(t){e.onModuleLoaded=function(e){t({draco:e})},DracoDecoderModule(e)}));break;case"decode":var o=n.buffer,s=n.taskConfig;t.then((e=>{var t=e.draco,a=new t.Decoder,i=new t.DecoderBuffer;i.Init(new Int8Array(o),o.byteLength);try{var c=function(e,t,a,n){var o,s,i=n.attributeIDs,c=n.attributeTypes,l=t.GetEncodedGeometryType(a);if(l===e.TRIANGULAR_MESH)o=new e.Mesh,s=t.DecodeBufferToMesh(a,o);else{if(l!==e.POINT_CLOUD)throw new Error("THREE.DRACOLoader: Unexpected geometry type.");o=new e.PointCloud,s=t.DecodeBufferToPointCloud(a,o)}if(!s.ok()||0===o.ptr)throw new Error("THREE.DRACOLoader: Decoding failed: "+s.error_msg());var u={index:null,attributes:[]};for(var d in i){var p,h,f=self[c[d]];if(n.useUniqueIDs)h=i[d],p=t.GetAttributeByUniqueId(o,h);else{if(-1===(h=t.GetAttributeId(o,e[i[d]])))continue;p=t.GetAttribute(o,h)}u.attributes.push(r(e,t,o,d,f,p))}if(l===e.TRIANGULAR_MESH){for(var m=o.num_faces(),g=new Uint32Array(3*m),v=new e.DracoInt32Array,y=0;y<m;++y){t.GetFaceFromMesh(o,y,v);for(var T=0;T<3;++T)g[3*y+T]=v.GetValue(T)}u.index={array:g,itemSize:1},e.destroy(v)}return e.destroy(o),u}(t,a,i,s),l=c.attributes.map((e=>e.array.buffer));c.index&&l.push(c.index.array.buffer),self.postMessage({type:"decode",id:n.id,geometry:c},l)}catch(u){console.error(u),self.postMessage({type:"error",id:n.id,error:u.message})}finally{t.destroy(i),t.destroy(a)}}))}}},i.taskCache=new WeakMap,i.setDecoderPath=function(){console.warn("THREE.DRACOLoader: The .setDecoderPath() method has been removed. Use instance methods.")},i.setDecoderConfig=function(){console.warn("THREE.DRACOLoader: The .setDecoderConfig() method has been removed. Use instance methods.")},i.releaseDecoderModule=function(){console.warn("THREE.DRACOLoader: The .releaseDecoderModule() method has been removed. Use instance methods.")},i.getDecoderModule=function(){console.warn("THREE.DRACOLoader: The .getDecoderModule() method has been removed. Use instance methods.")};var c=function(e){t.CompressedTextureLoader.call(this,e)};c.prototype=Object.assign(Object.create(t.CompressedTextureLoader.prototype),{constructor:c,parse:function(e,r){var a={mipmaps:[],width:0,height:0,format:null,mipmapCount:1};function n(e){return e.charCodeAt(0)+(e.charCodeAt(1)<<8)+(e.charCodeAt(2)<<16)+(e.charCodeAt(3)<<24)}function o(e,t,r,a){for(var n=r*a*4,o=new Uint8Array(e,t,n),s=new Uint8Array(n),i=0,c=0,l=0;l<a;l++)for(var u=0;u<r;u++){var d=o[c],p=o[++c],h=o[++c],f=o[++c];c++,s[i]=h,s[++i]=p,s[++i]=d,s[++i]=f,i++}return s}var s,i=n("DXT1"),c=n("DXT3"),l=n("DXT5"),u=n("ETC1"),d=new Int32Array(e,0,31);if(542327876!==d[0])return console.error("THREE.DDSLoader.parse: Invalid magic number in DDS header."),a;if(4&!d[20])return console.error("THREE.DDSLoader.parse: Unsupported format, must contain a FourCC code."),a;var p,h=d[21],f=!1;switch(h){case i:s=8,a.format=t.RGB_S3TC_DXT1_Format;break;case c:s=16,a.format=t.RGBA_S3TC_DXT3_Format;break;case l:s=16,a.format=t.RGBA_S3TC_DXT5_Format;break;case u:s=8,a.format=t.RGB_ETC1_Format;break;default:if(!(32===d[22]&&16711680&d[23]&&65280&d[24]&&255&d[25]&&4278190080&d[26]))return console.error("THREE.DDSLoader.parse: Unsupported FourCC code ",(p=h,String.fromCharCode(255&p,p>>8&255,p>>16&255,p>>24&255))),a;f=!0,s=64,a.format=t.RGBAFormat}a.mipmapCount=1,131072&d[2]&&!1!==r&&(a.mipmapCount=Math.max(1,d[7]));var m=d[28];if(a.isCubemap=!!(512&m),a.isCubemap&&(!(1024&m)||!(2048&m)||!(4096&m)||!(8192&m)||!(16384&m)||!(32768&m)))return console.error("THREE.DDSLoader.parse: Incomplete cubemap faces"),a;a.width=d[4],a.height=d[3];for(var g=d[1]+4,v=a.isCubemap?6:1,y=0;y<v;y++)for(var T=a.width,M=a.height,A=0;A<a.mipmapCount;A++){if(f)var R=(S=o(e,g,T,M)).length;else{R=Math.max(4,T)/4*Math.max(4,M)/4*s;var S=new Uint8Array(e,g,R)}var b={data:S,width:T,height:M};a.mipmaps.push(b),g+=R,T=Math.max(T>>1,1),M=Math.max(M>>1,1)}return a}});var l=function(e){function t(t){var r=e.call(this)||this;return r.needsRender=!0,t&&t.children.length&&r.add.apply(r,t.children),r.mixer=new a.AnimationMixer(r),r}return o(t,e),t.prototype.clone=function(){var t=e.prototype.clone.call(this,!0),r=new a.AnimationMixer(t);return t.mixer=r,t.needsRender=!0,t},t}(a.Group),u=function(e){function t(t){var r=e.call(this,t)||this;return r.ddsLoader=new c(t),r.dracoLoader=new i(t),r.dracoLoader.setDecoderPath("https://vr-public.realsee-cdn.cn/release/static/image/release/five/resource/draco/1.5.6/"),r}return o(t,e),Object.defineProperty(t,"version",{get:function(){return"6.0.0-alpha.71"},enumerable:!1,configurable:!0}),t.prototype.load=function(t,r,a,n){return e.prototype.load.call(this,t,r,a,n)},t.prototype.parse=function(t,r,a,n){return e.prototype.parse.call(this,t,r,(function(e){var t=new l(e.scene),r=e.scenes.map((function(r){return r===e.scene?t:new l(r)}));a(Object.assign(e,{scene:t,scenes:r}))}),n)},t}(s);e.DDSLoader=c,e.DRACOLoader=i,e.GLTFLoader=u,e.GLTFObject=l,e.THREEGLTFLoader=s,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})}));
|