@realsee/five 6.10.0-alpha.2 → 6.10.0-alpha.3
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/docs/assets/hierarchy.js +1 -1
- package/docs/assets/navigation.js +1 -1
- package/docs/assets/search.js +1 -1
- package/docs/classes/five.BoundingMesh.html +1 -1
- package/docs/classes/five.Camera.html +1 -1
- package/docs/classes/five.Five.html +1 -1
- package/docs/classes/five.InternalWebGLRenderer.html +1 -1
- package/docs/classes/five.Model.html +1 -1
- package/docs/classes/five.ModelScene.html +1 -1
- package/docs/classes/five.NetworkSubscribe.html +1 -1
- package/docs/classes/five.PBMContainer.html +1 -1
- package/docs/classes/five.PBMCustomShader.html +1 -1
- package/docs/classes/five.PBMGSObject.html +1 -1
- package/docs/classes/five.PBMGroup.html +1 -1
- package/docs/classes/five.PBMMesh.html +1 -1
- package/docs/classes/five.PBMMeshMaterial.html +1 -1
- package/docs/classes/five.PBMPanoFilter.html +1 -1
- package/docs/classes/five.PBMPointCloud.html +1 -1
- package/docs/classes/five.PBMPointCloudMaterial.html +1 -1
- package/docs/classes/five.PBMSkinnedMesh.html +1 -1
- package/docs/classes/five.PBMUpdateable.html +1 -1
- package/docs/classes/five.PanoCircleMesh.html +1 -1
- package/docs/classes/five.PanoCircleMeshCustom.html +1 -1
- package/docs/classes/five.PanoCircleMeshSolid.html +1 -1
- package/docs/classes/five.Parameter.html +1 -1
- package/docs/classes/five.Scene.html +1 -1
- package/docs/classes/five.Subscribe.html +1 -1
- package/docs/classes/five.Tile3D.html +1 -1
- package/docs/classes/five.TileNode.html +1 -1
- package/docs/classes/five.TrajectoryNode.html +1 -1
- package/docs/classes/five.Work.html +16 -16
- package/docs/classes/five.WorkResolvedObserver.html +15 -15
- package/docs/classes/gltf-loader.GLTFLoader.html +7 -12
- package/docs/classes/line.Line.html +1 -1
- package/docs/classes/line.LineGeometry.html +1 -1
- package/docs/classes/line.LineMaterial.html +1 -1
- package/docs/classes/line.LineSegmentsGeometry.html +1 -1
- package/docs/classes/line.THREE_Line2.html +1 -1
- package/docs/classes/line.THREE_LineSegments2.html +1 -1
- package/docs/classes/sticker.Sticker.html +1 -1
- package/docs/classes/vfx.Airflow.html +1 -1
- package/docs/classes/vfx.Flame.html +1 -1
- package/docs/classes/vfx.Particle.html +1 -1
- package/docs/classes/vfx.ParticleGPU.html +1 -1
- package/docs/classes/vfx.SpotLight.html +1 -1
- package/docs/functions/five.parseWork.html +1 -1
- package/docs/functions/five.workToJson.html +1 -1
- package/docs/functions/vue.useFiveWorks.html +2 -2
- package/docs/hierarchy.html +1 -1
- package/docs/interfaces/five.AddableObject.html +1 -1
- package/docs/interfaces/five.AjaxOptions.html +1 -1
- package/docs/interfaces/five.BaseEvent.html +1 -1
- package/docs/interfaces/five.BaseExtendableEvent.html +1 -1
- package/docs/interfaces/five.EventCallback.html +1 -1
- package/docs/interfaces/five.GestureEvent.html +1 -1
- package/docs/interfaces/five.ImageOptions.html +1 -1
- package/docs/interfaces/five.IntersectEvent.html +1 -1
- package/docs/interfaces/five.IntersectMesh.html +1 -1
- package/docs/interfaces/five.IntersectMeshInterface.html +1 -1
- package/docs/interfaces/five.Intersection.html +1 -1
- package/docs/interfaces/five.LoosePanoWork.html +2 -2
- package/docs/interfaces/five.LooseWork.html +2 -2
- package/docs/interfaces/five.LooseWorkInitial.html +2 -2
- package/docs/interfaces/five.LooseWorkModel.html +2 -2
- package/docs/interfaces/five.LooseWorkObserver.html +2 -2
- package/docs/interfaces/five.LooseWorkPanorama.html +10 -2
- package/docs/interfaces/five.LooseWorkWithExtrinsics.html +7 -7
- package/docs/interfaces/five.ModeChangeEvent.html +1 -1
- package/docs/interfaces/five.ModelControllerCustomInitArgs.html +1 -1
- package/docs/interfaces/five.ModelEvent.html +1 -1
- package/docs/interfaces/five.ModelSceneEvent.html +1 -1
- package/docs/interfaces/five.ModelTileEvent.html +1 -1
- package/docs/interfaces/five.MovePanoOptions.html +1 -1
- package/docs/interfaces/five.MoveToPositionOptions.html +1 -1
- package/docs/interfaces/five.NetworkAbortError.html +1 -1
- package/docs/interfaces/five.NetworkFirbiddenError.html +1 -1
- package/docs/interfaces/five.NetworkOptions.html +1 -1
- package/docs/interfaces/five.NetworkProxyError.html +1 -1
- package/docs/interfaces/five.NetworkResourceEvent.html +1 -1
- package/docs/interfaces/five.NetworkResponseError.html +1 -1
- package/docs/interfaces/five.NetworkTimeoutError.html +1 -1
- package/docs/interfaces/five.ObjectEvent.html +1 -1
- package/docs/interfaces/five.PBMMaterial.html +1 -1
- package/docs/interfaces/five.PBMMeshMaterialParameters.html +1 -1
- package/docs/interfaces/five.PBMPointCloudMaterialParameters.html +1 -1
- package/docs/interfaces/five.PanoCircleMeshInterface.html +1 -1
- package/docs/interfaces/five.PanoEvent.html +1 -1
- package/docs/interfaces/five.PanoPrepareEvent.html +1 -1
- package/docs/interfaces/five.PanoTextureEvent.html +1 -1
- package/docs/interfaces/five.PanoramaControllerCustomInitArgs.html +1 -1
- package/docs/interfaces/five.PanoramaLikeControllerCustomInitArgs.html +1 -1
- package/docs/interfaces/five.ParameterMaterialValue.html +1 -1
- package/docs/interfaces/five.ParameterTilesetValue.html +1 -1
- package/docs/interfaces/five.ParameterValue.html +1 -1
- package/docs/interfaces/five.Pose.html +1 -1
- package/docs/interfaces/five.RenderEvent.html +1 -1
- package/docs/interfaces/five.ResolvedParameterValue.html +1 -1
- package/docs/interfaces/five.State.html +1 -1
- package/docs/interfaces/five.StateEvent.html +1 -1
- package/docs/interfaces/five.TextureOptions.html +1 -1
- package/docs/interfaces/five.TopviewControllerCustomInitArgs.html +1 -1
- package/docs/interfaces/five.VRPanoramaControllerCustomInitArgs.html +1 -1
- package/docs/interfaces/five.ViewLayer.html +1 -1
- package/docs/interfaces/five.WorkCubeHdrGainmapImage.html +10 -0
- package/docs/interfaces/five.WorkCubeImage.html +5 -2
- package/docs/interfaces/five.WorkImage.html +8 -5
- package/docs/interfaces/five.WorkInitial.html +8 -8
- package/docs/interfaces/five.WorkModel.html +8 -8
- package/docs/interfaces/five.WorkModelLayer.html +6 -6
- package/docs/interfaces/five.WorkObserver.html +17 -17
- package/docs/interfaces/five.WorkObserverProto.html +1 -1
- package/docs/interfaces/five.WorkPanoramaJson.html +3 -2
- package/docs/interfaces/five.WorkTile.html +8 -5
- package/docs/interfaces/five.WorksEvent.html +1 -1
- package/docs/interfaces/five.XRControllerEvent.html +1 -1
- package/docs/interfaces/five.XRGestureEvent.html +1 -1
- package/docs/interfaces/five.XRPanoramaControllerCustomInitArgs.html +1 -1
- package/docs/interfaces/five.XRSessionEvent.html +1 -1
- package/docs/interfaces/gltf-loader.GLTF.html +17 -7
- package/docs/interfaces/plugins.Object3DHelperPluginType.BaseController.html +1 -1
- package/docs/interfaces/plugins.Object3DHelperPluginType.BaseHelper.html +1 -1
- package/docs/interfaces/plugins.Object3DHelperPluginType.BoundingBoxController.html +1 -1
- package/docs/interfaces/plugins.Object3DHelperPluginType.MoveController.html +1 -1
- package/docs/interfaces/plugins.Object3DHelperPluginType.MoveHelperAbstract.html +1 -1
- package/docs/interfaces/plugins.Object3DHelperPluginType.RotateController.html +1 -1
- package/docs/interfaces/plugins.Object3DHelperPluginType.RotateHelperAbstract.html +1 -1
- package/docs/interfaces/react.FiveInjectionTypes.html +1 -1
- package/docs/interfaces/react.UseFivePluginOptions.html +1 -1
- package/docs/interfaces/react.UseFivePluginOptionsWithCreate.html +1 -1
- package/docs/modules/five.html +1 -1
- package/docs/modules/gltf-loader.html +1 -1
- package/docs/types/five.LoadResultType.html +1 -1
- package/docs/types/five.ParseOptions.html +6 -6
- package/five/index.js +59 -59
- package/five/index.mjs +794 -732
- package/five/work/index.d.ts +1 -1
- package/five/work/looseWorkType.d.ts +8 -0
- package/five/work/work.d.ts +10 -0
- package/five/work/workJsonType.d.ts +1 -0
- package/gltf-loader/index.d.ts +20 -35
- package/gltf-loader/index.js +3 -9
- package/gltf-loader/index.mjs +42 -1350
- package/line/index.js +3 -3
- package/line/index.mjs +3 -3
- package/package.json +1 -1
- package/pbmGaussianSplattingObject-BDOzNal0.cjs +2 -2
- package/pbmGaussianSplattingObject-BwsrwWs6.js +2 -2
- package/plugins/index.js +2 -2
- package/plugins/index.mjs +2 -2
- package/react/index.js +2 -2
- package/react/index.mjs +2 -2
- package/shader-lib/index.js +2 -2
- package/shader-lib/index.mjs +2 -2
- package/sticker/index.js +3 -3
- package/sticker/index.mjs +3 -3
- package/umd/five-gltf-loader.js +3 -9
- package/umd/five-line.js +3 -3
- package/umd/five-plugins.js +2 -2
- package/umd/five-react.js +2 -2
- package/umd/five-shader-lib.js +2 -2
- package/umd/five-sticker.js +3 -3
- package/umd/five-vfx.js +2 -2
- package/umd/five-vue.js +2 -2
- package/umd/five.js +5 -5
- package/vfx/index.js +2 -2
- package/vfx/index.mjs +2 -2
- package/vue/index.js +2 -2
- package/vue/index.mjs +2 -2
- package/work-downloader/components/observer.d.ts +2 -0
- package/work-downloader/index.js +3 -3
- package/work-downloader/index.mjs +39 -30
- package/docs/classes/gltf-loader.DDSLoader.html +0 -3
- package/docs/classes/gltf-loader.DRACOLoader.html +0 -8
- package/docs/classes/gltf-loader.GLTFParser.html +0 -6
- package/docs/classes/gltf-loader.THREEGLTFLoader.html +0 -8
- package/docs/interfaces/gltf-loader.DDS.html +0 -7
- package/docs/interfaces/gltf-loader.GLTFReference.html +0 -3
- package/docs/interfaces/gltf-loader.THREEGLTF.html +0 -8
- package/gltf-loader/thirdparty/DDSLoader.d.ts +0 -23
- package/gltf-loader/thirdparty/DRACOLoader.d.ts +0 -18
- package/gltf-loader/thirdparty/GLTFLoader.d.ts +0 -59
package/gltf-loader/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
3
|
* @realsee/five
|
|
4
|
-
* Generated: 9/
|
|
5
|
-
* Version: 6.10.0-alpha.
|
|
4
|
+
* Generated: 2026/9/16
|
|
5
|
+
* Version: 6.10.0-alpha.3
|
|
6
6
|
* Terms:
|
|
7
7
|
* Realsee SDK License Agreement
|
|
8
8
|
* Update: July 28, 2021
|
|
@@ -252,1359 +252,51 @@
|
|
|
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
|
|
256
|
-
import
|
|
257
|
-
//#region build/gltf-loader/thirdparty/GLTFLoader.js
|
|
258
|
-
var U = (function() {
|
|
259
|
-
function e(e) {
|
|
260
|
-
E.call(this, e), this.dracoLoader = null, this.ddsLoader = null;
|
|
261
|
-
}
|
|
262
|
-
e.prototype = Object.assign(Object.create(E.prototype), {
|
|
263
|
-
constructor: e,
|
|
264
|
-
load: function(e, t, n, r) {
|
|
265
|
-
var i = this, a = this.resourcePath === "" ? this.path === "" ? D.extractUrlBase(e) : this.path : this.resourcePath;
|
|
266
|
-
i.manager.itemStart(e);
|
|
267
|
-
var o = function(t) {
|
|
268
|
-
r ? r(t) : console.error(t), i.manager.itemError(e), i.manager.itemEnd(e);
|
|
269
|
-
}, s = new d(i.manager);
|
|
270
|
-
s.setPath(this.path), s.setResponseType("arraybuffer"), s.setRequestHeader(this.requestHeader), i.crossOrigin === "use-credentials" && s.setWithCredentials(!0), s.load(e, function(n) {
|
|
271
|
-
try {
|
|
272
|
-
i.parse(n, a, function(n) {
|
|
273
|
-
t(n), i.manager.itemEnd(e);
|
|
274
|
-
}, o);
|
|
275
|
-
} catch (e) {
|
|
276
|
-
o(e);
|
|
277
|
-
}
|
|
278
|
-
}, n, o);
|
|
279
|
-
},
|
|
280
|
-
setDRACOLoader: function(e) {
|
|
281
|
-
return this.dracoLoader = e, this;
|
|
282
|
-
},
|
|
283
|
-
setDDSLoader: function(e) {
|
|
284
|
-
return this.ddsLoader = e, this;
|
|
285
|
-
},
|
|
286
|
-
parse: function(e, t, n, r) {
|
|
287
|
-
var i, a = {};
|
|
288
|
-
if (typeof e == "string") i = e;
|
|
289
|
-
else if (D.decodeText(new Uint8Array(e, 0, 4)) === G) {
|
|
290
|
-
try {
|
|
291
|
-
a[B.KHR_BINARY_GLTF] = new Ee(e);
|
|
292
|
-
} catch (e) {
|
|
293
|
-
r && r(e);
|
|
294
|
-
return;
|
|
295
|
-
}
|
|
296
|
-
i = a[B.KHR_BINARY_GLTF].content;
|
|
297
|
-
} else i = D.decodeText(new Uint8Array(e));
|
|
298
|
-
var o = JSON.parse(i);
|
|
299
|
-
if (o.asset === void 0 || o.asset.version[0] < 2) {
|
|
300
|
-
r && r(/* @__PURE__ */ Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));
|
|
301
|
-
return;
|
|
302
|
-
}
|
|
303
|
-
if (o.extensionsUsed) for (var s = 0; s < o.extensionsUsed.length; ++s) {
|
|
304
|
-
var c = o.extensionsUsed[s], l = o.extensionsRequired || [];
|
|
305
|
-
switch (c) {
|
|
306
|
-
case B.KHR_LIGHTS_PUNCTUAL:
|
|
307
|
-
a[c] = new fe(o);
|
|
308
|
-
break;
|
|
309
|
-
case B.KHR_MATERIALS_CLEARCOAT:
|
|
310
|
-
a[c] = new U();
|
|
311
|
-
break;
|
|
312
|
-
case B.KHR_MATERIALS_TRANSMISSION:
|
|
313
|
-
a[c] = new W();
|
|
314
|
-
break;
|
|
315
|
-
case B.KHR_MATERIALS_UNLIT:
|
|
316
|
-
a[c] = new V();
|
|
317
|
-
break;
|
|
318
|
-
case B.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:
|
|
319
|
-
a[c] = new ke();
|
|
320
|
-
break;
|
|
321
|
-
case B.KHR_DRACO_MESH_COMPRESSION:
|
|
322
|
-
a[c] = new De(o, this.dracoLoader);
|
|
323
|
-
break;
|
|
324
|
-
case B.MSFT_TEXTURE_DDS:
|
|
325
|
-
a[c] = new ue(this.ddsLoader);
|
|
326
|
-
break;
|
|
327
|
-
case B.KHR_TEXTURE_TRANSFORM:
|
|
328
|
-
a[c] = new Oe();
|
|
329
|
-
break;
|
|
330
|
-
case B.KHR_MESH_QUANTIZATION:
|
|
331
|
-
a[c] = new Ae();
|
|
332
|
-
break;
|
|
333
|
-
case B.REALSEE_MATERIALS_LIGHTMAP:
|
|
334
|
-
a[c] = new je();
|
|
335
|
-
break;
|
|
336
|
-
default: l.indexOf(c) >= 0 && console.warn("THREE.GLTFLoader: Unknown extension \"" + c + "\".");
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
var u = new $(o, a, {
|
|
340
|
-
path: t || this.resourcePath || "",
|
|
341
|
-
crossOrigin: this.crossOrigin,
|
|
342
|
-
manager: this.manager
|
|
343
|
-
});
|
|
344
|
-
u.fileLoader.setRequestHeader(this.requestHeader), u.parse(n, r);
|
|
345
|
-
}
|
|
346
|
-
});
|
|
347
|
-
function c() {
|
|
348
|
-
var e = {};
|
|
349
|
-
return {
|
|
350
|
-
get: function(t) {
|
|
351
|
-
return e[t];
|
|
352
|
-
},
|
|
353
|
-
add: function(t, n) {
|
|
354
|
-
e[t] = n;
|
|
355
|
-
},
|
|
356
|
-
remove: function(t) {
|
|
357
|
-
delete e[t];
|
|
358
|
-
},
|
|
359
|
-
removeAll: function() {
|
|
360
|
-
e = {};
|
|
361
|
-
}
|
|
362
|
-
};
|
|
363
|
-
}
|
|
364
|
-
var B = {
|
|
365
|
-
KHR_BINARY_GLTF: "KHR_binary_glTF",
|
|
366
|
-
KHR_DRACO_MESH_COMPRESSION: "KHR_draco_mesh_compression",
|
|
367
|
-
KHR_LIGHTS_PUNCTUAL: "KHR_lights_punctual",
|
|
368
|
-
KHR_MATERIALS_CLEARCOAT: "KHR_materials_clearcoat",
|
|
369
|
-
KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS: "KHR_materials_pbrSpecularGlossiness",
|
|
370
|
-
KHR_MATERIALS_TRANSMISSION: "KHR_materials_transmission",
|
|
371
|
-
KHR_MATERIALS_UNLIT: "KHR_materials_unlit",
|
|
372
|
-
KHR_TEXTURE_TRANSFORM: "KHR_texture_transform",
|
|
373
|
-
KHR_MESH_QUANTIZATION: "KHR_mesh_quantization",
|
|
374
|
-
MSFT_TEXTURE_DDS: "MSFT_texture_dds",
|
|
375
|
-
REALSEE_MATERIALS_LIGHTMAP: "REALSEE_materials_lightmap"
|
|
376
|
-
};
|
|
377
|
-
function ue(e) {
|
|
378
|
-
if (!e) throw Error("THREE.GLTFLoader: Attempting to load .dds texture without importing DDSLoader");
|
|
379
|
-
this.name = B.MSFT_TEXTURE_DDS, this.ddsLoader = e;
|
|
380
|
-
}
|
|
381
|
-
function fe(e) {
|
|
382
|
-
this.name = B.KHR_LIGHTS_PUNCTUAL;
|
|
383
|
-
var t = e.extensions && e.extensions[B.KHR_LIGHTS_PUNCTUAL] || {};
|
|
384
|
-
this.lightDefs = t.lights || [];
|
|
385
|
-
}
|
|
386
|
-
fe.prototype.loadLight = function(e) {
|
|
387
|
-
var t = this.lightDefs[e], n, r = new s(16777215);
|
|
388
|
-
t.color !== void 0 && r.fromArray(t.color);
|
|
389
|
-
var i = t.range === void 0 ? 0 : t.range;
|
|
390
|
-
switch (t.type) {
|
|
391
|
-
case "directional":
|
|
392
|
-
n = new l(r), n.target.position.set(0, 0, -1), n.add(n.target);
|
|
393
|
-
break;
|
|
394
|
-
case "point":
|
|
395
|
-
n = new R(r), n.distance = i;
|
|
396
|
-
break;
|
|
397
|
-
case "spot":
|
|
398
|
-
n = new _e(r), n.distance = i, t.spot = t.spot || {}, t.spot.innerConeAngle = t.spot.innerConeAngle === void 0 ? 0 : t.spot.innerConeAngle, t.spot.outerConeAngle = t.spot.outerConeAngle === void 0 ? Math.PI / 4 : t.spot.outerConeAngle, n.angle = t.spot.outerConeAngle, n.penumbra = 1 - t.spot.innerConeAngle / t.spot.outerConeAngle, n.target.position.set(0, 0, -1), n.add(n.target);
|
|
399
|
-
break;
|
|
400
|
-
default: throw Error("THREE.GLTFLoader: Unexpected light type, \"" + t.type + "\".");
|
|
401
|
-
}
|
|
402
|
-
return n.position.set(0, 0, 0), n.decay = 2, t.intensity !== void 0 && (n.intensity = t.intensity), n.name = t.name || "light_" + e, Promise.resolve(n);
|
|
403
|
-
};
|
|
404
|
-
function V() {
|
|
405
|
-
this.name = B.KHR_MATERIALS_UNLIT;
|
|
406
|
-
}
|
|
407
|
-
V.prototype.getMaterialType = function() {
|
|
408
|
-
return k;
|
|
409
|
-
}, V.prototype.extendParams = function(e, t, n) {
|
|
410
|
-
var r = [];
|
|
411
|
-
e.color = new s(1, 1, 1), e.opacity = 1;
|
|
412
|
-
var i = t.pbrMetallicRoughness;
|
|
413
|
-
if (i) {
|
|
414
|
-
if (Array.isArray(i.baseColorFactor)) {
|
|
415
|
-
var a = i.baseColorFactor;
|
|
416
|
-
e.color.fromArray(a), e.opacity = a[3];
|
|
417
|
-
}
|
|
418
|
-
i.baseColorTexture !== void 0 && r.push(n.assignTexture(e, "map", i.baseColorTexture));
|
|
419
|
-
}
|
|
420
|
-
return Promise.all(r);
|
|
421
|
-
};
|
|
422
|
-
function U() {
|
|
423
|
-
this.name = B.KHR_MATERIALS_CLEARCOAT;
|
|
424
|
-
}
|
|
425
|
-
U.prototype.getMaterialType = function() {
|
|
426
|
-
return ie;
|
|
427
|
-
}, U.prototype.extendParams = function(e, t, n) {
|
|
428
|
-
var r = [], i = t.extensions[this.name];
|
|
429
|
-
if (i.clearcoatFactor !== void 0 && (e.clearcoat = i.clearcoatFactor), i.clearcoatTexture !== void 0 && r.push(n.assignTexture(e, "clearcoatMap", i.clearcoatTexture)), i.clearcoatRoughnessFactor !== void 0 && (e.clearcoatRoughness = i.clearcoatRoughnessFactor), i.clearcoatRoughnessTexture !== void 0 && r.push(n.assignTexture(e, "clearcoatRoughnessMap", i.clearcoatRoughnessTexture)), i.clearcoatNormalTexture !== void 0 && (r.push(n.assignTexture(e, "clearcoatNormalMap", i.clearcoatNormalTexture)), i.clearcoatNormalTexture.scale !== void 0)) {
|
|
430
|
-
var a = i.clearcoatNormalTexture.scale;
|
|
431
|
-
e.clearcoatNormalScale = new Se(a, a);
|
|
432
|
-
}
|
|
433
|
-
return Promise.all(r);
|
|
434
|
-
};
|
|
435
|
-
function W() {
|
|
436
|
-
this.name = B.KHR_MATERIALS_TRANSMISSION;
|
|
437
|
-
}
|
|
438
|
-
W.prototype.getMaterialType = function() {
|
|
439
|
-
return ie;
|
|
440
|
-
}, W.prototype.extendParams = function(e, t, n) {
|
|
441
|
-
return t.extensions[this.name].transmissionFactor !== void 0 && (e.premultipliedAlpha = !0, e.transparent = !0, e.opacity = e.opacity === void 0 ? .5 : e.opacity), Promise.all([]);
|
|
442
|
-
};
|
|
443
|
-
var G = "glTF", K = 12, Te = {
|
|
444
|
-
JSON: 1313821514,
|
|
445
|
-
BIN: 5130562
|
|
446
|
-
};
|
|
447
|
-
function Ee(e) {
|
|
448
|
-
this.name = B.KHR_BINARY_GLTF, this.content = null, this.body = null;
|
|
449
|
-
var t = new DataView(e, 0, K);
|
|
450
|
-
if (this.header = {
|
|
451
|
-
magic: D.decodeText(new Uint8Array(e.slice(0, 4))),
|
|
452
|
-
version: t.getUint32(4, !0),
|
|
453
|
-
length: t.getUint32(8, !0)
|
|
454
|
-
}, this.header.magic !== G) throw Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");
|
|
455
|
-
if (this.header.version < 2) throw Error("THREE.GLTFLoader: Legacy binary file detected.");
|
|
456
|
-
for (var n = new DataView(e, K), r = 0; r < n.byteLength;) {
|
|
457
|
-
var i = n.getUint32(r, !0);
|
|
458
|
-
r += 4;
|
|
459
|
-
var a = n.getUint32(r, !0);
|
|
460
|
-
if (r += 4, a === Te.JSON) {
|
|
461
|
-
var o = new Uint8Array(e, K + r, i);
|
|
462
|
-
this.content = D.decodeText(o);
|
|
463
|
-
} else if (a === Te.BIN) {
|
|
464
|
-
var s = K + r;
|
|
465
|
-
this.body = e.slice(s, s + i);
|
|
466
|
-
}
|
|
467
|
-
r += i;
|
|
468
|
-
}
|
|
469
|
-
if (this.content === null) throw Error("THREE.GLTFLoader: JSON content not found.");
|
|
470
|
-
}
|
|
471
|
-
function De(e, t) {
|
|
472
|
-
if (!t) throw Error("THREE.GLTFLoader: No DRACOLoader instance provided.");
|
|
473
|
-
this.name = B.KHR_DRACO_MESH_COMPRESSION, this.json = e, this.dracoLoader = t, this.dracoLoader.preload();
|
|
474
|
-
}
|
|
475
|
-
De.prototype.decodePrimitive = function(e, t) {
|
|
476
|
-
var n = this.json, r = this.dracoLoader, i = e.extensions[this.name].bufferView, a = e.extensions[this.name].attributes, o = {}, s = {}, c = {};
|
|
477
|
-
for (var l in a) {
|
|
478
|
-
var u = Ie[l] || l.toLowerCase();
|
|
479
|
-
o[u] = a[l];
|
|
480
|
-
}
|
|
481
|
-
for (l in e.attributes) {
|
|
482
|
-
var u = Ie[l] || l.toLowerCase();
|
|
483
|
-
if (a[l] !== void 0) {
|
|
484
|
-
var d = n.accessors[e.attributes[l]];
|
|
485
|
-
c[u] = Me[d.componentType], s[u] = d.normalized === !0;
|
|
486
|
-
}
|
|
487
|
-
}
|
|
488
|
-
return t.getDependency("bufferView", i).then(function(e) {
|
|
489
|
-
return new Promise(function(t) {
|
|
490
|
-
r.decodeDracoFile(e, function(e) {
|
|
491
|
-
for (var n in e.attributes) {
|
|
492
|
-
var r = e.attributes[n], i = s[n];
|
|
493
|
-
i !== void 0 && (r.normalized = i);
|
|
494
|
-
}
|
|
495
|
-
t(e);
|
|
496
|
-
}, o, c);
|
|
497
|
-
});
|
|
498
|
-
});
|
|
499
|
-
};
|
|
500
|
-
function Oe() {
|
|
501
|
-
this.name = B.KHR_TEXTURE_TRANSFORM;
|
|
502
|
-
}
|
|
503
|
-
Oe.prototype.extendTexture = function(e, t) {
|
|
504
|
-
return e = e.clone(), t.offset !== void 0 && e.offset.fromArray(t.offset), t.rotation !== void 0 && (e.rotation = t.rotation), t.scale !== void 0 && e.repeat.fromArray(t.scale), t.texCoord !== void 0 && console.warn("THREE.GLTFLoader: Custom UV sets in \"" + this.name + "\" extension not yet supported."), e.needsUpdate = !0, e;
|
|
505
|
-
};
|
|
506
|
-
function q(e) {
|
|
507
|
-
A.call(this), this.isGLTFSpecularGlossinessMaterial = !0;
|
|
508
|
-
var t = [
|
|
509
|
-
"#ifdef USE_SPECULARMAP",
|
|
510
|
-
" uniform sampler2D specularMap;",
|
|
511
|
-
"#endif"
|
|
512
|
-
].join("\n"), n = [
|
|
513
|
-
"#ifdef USE_GLOSSINESSMAP",
|
|
514
|
-
" uniform sampler2D glossinessMap;",
|
|
515
|
-
"#endif"
|
|
516
|
-
].join("\n"), r = [
|
|
517
|
-
"vec3 specularFactor = specular;",
|
|
518
|
-
"#ifdef USE_SPECULARMAP",
|
|
519
|
-
" vec4 texelSpecular = texture2D( specularMap, vUv );",
|
|
520
|
-
" texelSpecular = sRGBToLinear( texelSpecular );",
|
|
521
|
-
" // reads channel RGB, compatible with a glTF Specular-Glossiness (RGBA) texture",
|
|
522
|
-
" specularFactor *= texelSpecular.rgb;",
|
|
523
|
-
"#endif"
|
|
524
|
-
].join("\n"), i = [
|
|
525
|
-
"float glossinessFactor = glossiness;",
|
|
526
|
-
"#ifdef USE_GLOSSINESSMAP",
|
|
527
|
-
" vec4 texelGlossiness = texture2D( glossinessMap, vUv );",
|
|
528
|
-
" // reads channel A, compatible with a glTF Specular-Glossiness (RGBA) texture",
|
|
529
|
-
" glossinessFactor *= texelGlossiness.a;",
|
|
530
|
-
"#endif"
|
|
531
|
-
].join("\n"), a = [
|
|
532
|
-
"PhysicalMaterial material;",
|
|
533
|
-
"material.diffuseColor = diffuseColor.rgb;",
|
|
534
|
-
"vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );",
|
|
535
|
-
"float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );",
|
|
536
|
-
"material.specularRoughness = max( 1.0 - glossinessFactor, 0.0525 );// 0.0525 corresponds to the base mip of a 256 cubemap.",
|
|
537
|
-
"material.specularRoughness += geometryRoughness;",
|
|
538
|
-
"material.specularRoughness = min( material.specularRoughness, 1.0 );",
|
|
539
|
-
"material.specularColor = specularFactor.rgb;"
|
|
540
|
-
].join("\n"), o = {
|
|
541
|
-
specular: { value: new s().setHex(16777215) },
|
|
542
|
-
glossiness: { value: 1 },
|
|
543
|
-
specularMap: { value: null },
|
|
544
|
-
glossinessMap: { value: null }
|
|
545
|
-
};
|
|
546
|
-
this._extraUniforms = o, this.onBeforeCompile = function(e) {
|
|
547
|
-
for (var s in o) e.uniforms[s] = o[s];
|
|
548
|
-
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>", t), e.fragmentShader = e.fragmentShader.replace("#include <metalnessmap_pars_fragment>", n), e.fragmentShader = e.fragmentShader.replace("#include <roughnessmap_fragment>", r), e.fragmentShader = e.fragmentShader.replace("#include <metalnessmap_fragment>", i), e.fragmentShader = e.fragmentShader.replace("#include <lights_physical_fragment>", a);
|
|
549
|
-
}, Object.defineProperties(this, {
|
|
550
|
-
specular: {
|
|
551
|
-
get: function() {
|
|
552
|
-
return o.specular.value;
|
|
553
|
-
},
|
|
554
|
-
set: function(e) {
|
|
555
|
-
o.specular.value = e;
|
|
556
|
-
}
|
|
557
|
-
},
|
|
558
|
-
specularMap: {
|
|
559
|
-
get: function() {
|
|
560
|
-
return o.specularMap.value;
|
|
561
|
-
},
|
|
562
|
-
set: function(e) {
|
|
563
|
-
o.specularMap.value = e;
|
|
564
|
-
}
|
|
565
|
-
},
|
|
566
|
-
glossiness: {
|
|
567
|
-
get: function() {
|
|
568
|
-
return o.glossiness.value;
|
|
569
|
-
},
|
|
570
|
-
set: function(e) {
|
|
571
|
-
o.glossiness.value = e;
|
|
572
|
-
}
|
|
573
|
-
},
|
|
574
|
-
glossinessMap: {
|
|
575
|
-
get: function() {
|
|
576
|
-
return o.glossinessMap.value;
|
|
577
|
-
},
|
|
578
|
-
set: function(e) {
|
|
579
|
-
o.glossinessMap.value = e, e ? (this.defines.USE_GLOSSINESSMAP = "", this.defines.USE_ROUGHNESSMAP = "") : (delete this.defines.USE_ROUGHNESSMAP, delete this.defines.USE_GLOSSINESSMAP);
|
|
580
|
-
}
|
|
581
|
-
}
|
|
582
|
-
}), delete this.metalness, delete this.roughness, delete this.metalnessMap, delete this.roughnessMap, this.setValues(e);
|
|
583
|
-
}
|
|
584
|
-
q.prototype = Object.create(A.prototype), q.prototype.constructor = q, q.prototype.copy = function(e) {
|
|
585
|
-
return A.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;
|
|
586
|
-
};
|
|
587
|
-
function ke() {
|
|
588
|
-
return {
|
|
589
|
-
name: B.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS,
|
|
590
|
-
specularGlossinessParams: [
|
|
591
|
-
"color",
|
|
592
|
-
"map",
|
|
593
|
-
"lightMap",
|
|
594
|
-
"lightMapIntensity",
|
|
595
|
-
"aoMap",
|
|
596
|
-
"aoMapIntensity",
|
|
597
|
-
"emissive",
|
|
598
|
-
"emissiveIntensity",
|
|
599
|
-
"emissiveMap",
|
|
600
|
-
"bumpMap",
|
|
601
|
-
"bumpScale",
|
|
602
|
-
"normalMap",
|
|
603
|
-
"normalMapType",
|
|
604
|
-
"displacementMap",
|
|
605
|
-
"displacementScale",
|
|
606
|
-
"displacementBias",
|
|
607
|
-
"specularMap",
|
|
608
|
-
"specular",
|
|
609
|
-
"glossinessMap",
|
|
610
|
-
"glossiness",
|
|
611
|
-
"alphaMap",
|
|
612
|
-
"envMap",
|
|
613
|
-
"envMapIntensity",
|
|
614
|
-
"refractionRatio"
|
|
615
|
-
],
|
|
616
|
-
getMaterialType: function() {
|
|
617
|
-
return q;
|
|
618
|
-
},
|
|
619
|
-
extendParams: function(e, t, n) {
|
|
620
|
-
var r = t.extensions[this.name];
|
|
621
|
-
e.color = new s(1, 1, 1), e.opacity = 1;
|
|
622
|
-
var i = [];
|
|
623
|
-
if (Array.isArray(r.diffuseFactor)) {
|
|
624
|
-
var a = r.diffuseFactor;
|
|
625
|
-
e.color.fromArray(a), e.opacity = a[3];
|
|
626
|
-
}
|
|
627
|
-
if (r.diffuseTexture !== void 0 && i.push(n.assignTexture(e, "map", r.diffuseTexture)), e.emissive = new s(0, 0, 0), e.glossiness = r.glossinessFactor === void 0 ? 1 : r.glossinessFactor, e.specular = new s(1, 1, 1), Array.isArray(r.specularFactor) && e.specular.fromArray(r.specularFactor), r.specularGlossinessTexture !== void 0) {
|
|
628
|
-
var o = r.specularGlossinessTexture;
|
|
629
|
-
i.push(n.assignTexture(e, "glossinessMap", o)), i.push(n.assignTexture(e, "specularMap", o));
|
|
630
|
-
}
|
|
631
|
-
return Promise.all(i);
|
|
632
|
-
},
|
|
633
|
-
createMaterial: function(e) {
|
|
634
|
-
var t = new q(e);
|
|
635
|
-
return t.fog = !0, t.color = e.color, t.map = e.map === void 0 ? null : e.map, t.lightMap = null, t.lightMapIntensity = 1, t.aoMap = e.aoMap === void 0 ? null : e.aoMap, t.aoMapIntensity = 1, t.emissive = e.emissive, t.emissiveIntensity = 1, t.emissiveMap = e.emissiveMap === void 0 ? null : e.emissiveMap, t.bumpMap = e.bumpMap === void 0 ? null : e.bumpMap, t.bumpScale = 1, t.normalMap = e.normalMap === void 0 ? null : e.normalMap, t.normalMapType = ve, e.normalScale && (t.normalScale = e.normalScale), t.displacementMap = null, t.displacementScale = 1, t.displacementBias = 0, t.specularMap = e.specularMap === void 0 ? null : e.specularMap, t.specular = e.specular, t.glossinessMap = e.glossinessMap === void 0 ? null : e.glossinessMap, t.glossiness = e.glossiness, t.alphaMap = null, t.envMap = e.envMap === void 0 ? null : e.envMap, t.envMapIntensity = 1, t.refractionRatio = .98, t;
|
|
636
|
-
}
|
|
637
|
-
};
|
|
638
|
-
}
|
|
639
|
-
function Ae() {
|
|
640
|
-
this.name = B.KHR_MESH_QUANTIZATION;
|
|
641
|
-
}
|
|
642
|
-
function J(e, t, n, r) {
|
|
643
|
-
g.call(this, e, t, n, r);
|
|
644
|
-
}
|
|
645
|
-
J.prototype = Object.create(g.prototype), J.prototype.constructor = J, J.prototype.copySampleValue_ = function(e) {
|
|
646
|
-
for (var t = this.resultBuffer, n = this.sampleValues, r = this.valueSize, i = e * r * 3 + r, a = 0; a !== r; a++) t[a] = n[i + a];
|
|
647
|
-
return t;
|
|
648
|
-
}, J.prototype.beforeStart_ = J.prototype.copySampleValue_, J.prototype.afterEnd_ = J.prototype.copySampleValue_, J.prototype.interpolate_ = function(e, t, n, r) {
|
|
649
|
-
for (var i = this.resultBuffer, a = this.sampleValues, o = this.valueSize, s = o * 2, c = o * 3, l = r - t, u = (n - t) / l, d = u * u, f = d * u, p = e * c, m = p - c, h = -2 * f + 3 * d, g = f - d, _ = 1 - h, v = g - d + u, y = 0; y !== o; y++) {
|
|
650
|
-
var b = a[m + y + o], x = a[m + y + s] * l, S = a[p + y + o], C = a[p + y] * l;
|
|
651
|
-
i[y] = _ * b + v * x + h * S + g * C;
|
|
652
|
-
}
|
|
653
|
-
return i;
|
|
654
|
-
};
|
|
655
|
-
function je(e) {
|
|
656
|
-
this.parser = e, this.name = B.REALSEE_MATERIALS_LIGHTMAP;
|
|
657
|
-
}
|
|
658
|
-
je.prototype.getMaterialType = function(e) {
|
|
659
|
-
return re;
|
|
660
|
-
}, je.prototype.extendParams = function(e, t, n) {
|
|
661
|
-
if (!t.extensions || !t.extensions[this.name]) return Promise.resolve();
|
|
662
|
-
var r = [], i = t.extensions[this.name];
|
|
663
|
-
return i.lightMapTexture !== void 0 && r.push(n.assignTexture(e, "lightMap", i.lightMapTexture)), i.lightMapIntensity !== void 0 && (e.lightMapIntensity = i.lightMapIntensity), Promise.all(r);
|
|
664
|
-
};
|
|
665
|
-
var Y = {
|
|
666
|
-
FLOAT: 5126,
|
|
667
|
-
FLOAT_MAT3: 35675,
|
|
668
|
-
FLOAT_MAT4: 35676,
|
|
669
|
-
FLOAT_VEC2: 35664,
|
|
670
|
-
FLOAT_VEC3: 35665,
|
|
671
|
-
FLOAT_VEC4: 35666,
|
|
672
|
-
LINEAR: 9729,
|
|
673
|
-
REPEAT: 10497,
|
|
674
|
-
SAMPLER_2D: 35678,
|
|
675
|
-
POINTS: 0,
|
|
676
|
-
LINES: 1,
|
|
677
|
-
LINE_LOOP: 2,
|
|
678
|
-
LINE_STRIP: 3,
|
|
679
|
-
TRIANGLES: 4,
|
|
680
|
-
TRIANGLE_STRIP: 5,
|
|
681
|
-
TRIANGLE_FAN: 6,
|
|
682
|
-
UNSIGNED_BYTE: 5121,
|
|
683
|
-
UNSIGNED_SHORT: 5123
|
|
684
|
-
}, Me = {
|
|
685
|
-
5120: Int8Array,
|
|
686
|
-
5121: Uint8Array,
|
|
687
|
-
5122: Int16Array,
|
|
688
|
-
5123: Uint16Array,
|
|
689
|
-
5125: Uint32Array,
|
|
690
|
-
5126: Float32Array
|
|
691
|
-
}, Ne = {
|
|
692
|
-
9728: M,
|
|
693
|
-
9729: C,
|
|
694
|
-
9984: P,
|
|
695
|
-
9985: T,
|
|
696
|
-
9986: N,
|
|
697
|
-
9987: w
|
|
698
|
-
}, Pe = {
|
|
699
|
-
33071: o,
|
|
700
|
-
33648: j,
|
|
701
|
-
10497: pe
|
|
702
|
-
}, Fe = {
|
|
703
|
-
SCALAR: 1,
|
|
704
|
-
VEC2: 2,
|
|
705
|
-
VEC3: 3,
|
|
706
|
-
VEC4: 4,
|
|
707
|
-
MAT2: 4,
|
|
708
|
-
MAT3: 9,
|
|
709
|
-
MAT4: 16
|
|
710
|
-
}, Ie = {
|
|
711
|
-
POSITION: "position",
|
|
712
|
-
NORMAL: "normal",
|
|
713
|
-
TANGENT: "tangent",
|
|
714
|
-
TEXCOORD_0: "uv",
|
|
715
|
-
TEXCOORD_1: "uv2",
|
|
716
|
-
COLOR_0: "color",
|
|
717
|
-
WEIGHTS_0: "skinWeight",
|
|
718
|
-
JOINTS_0: "skinIndex"
|
|
719
|
-
}, X = {
|
|
720
|
-
scale: "scale",
|
|
721
|
-
translation: "position",
|
|
722
|
-
rotation: "quaternion",
|
|
723
|
-
weights: "morphTargetInfluences"
|
|
724
|
-
}, Le = {
|
|
725
|
-
CUBICSPLINE: void 0,
|
|
726
|
-
LINEAR: v,
|
|
727
|
-
STEP: _
|
|
728
|
-
}, Re = {
|
|
729
|
-
OPAQUE: "OPAQUE",
|
|
730
|
-
MASK: "MASK",
|
|
731
|
-
BLEND: "BLEND"
|
|
732
|
-
}, ze = {
|
|
733
|
-
"image/png": le,
|
|
734
|
-
"image/jpeg": de
|
|
735
|
-
};
|
|
736
|
-
function Be(e, t) {
|
|
737
|
-
return typeof e != "string" || 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);
|
|
738
|
-
}
|
|
739
|
-
function Ve(e) {
|
|
740
|
-
return e.DefaultMaterial === void 0 && (e.DefaultMaterial = new A({
|
|
741
|
-
color: 16777215,
|
|
742
|
-
emissive: 0,
|
|
743
|
-
metalness: 1,
|
|
744
|
-
roughness: 1,
|
|
745
|
-
transparent: !1,
|
|
746
|
-
depthTest: !0,
|
|
747
|
-
side: f
|
|
748
|
-
})), e.DefaultMaterial;
|
|
749
|
-
}
|
|
750
|
-
function Z(e, t, n) {
|
|
751
|
-
for (var r in n.extensions) e[r] === void 0 && (t.userData.gltfExtensions = t.userData.gltfExtensions || {}, t.userData.gltfExtensions[r] = n.extensions[r]);
|
|
752
|
-
}
|
|
753
|
-
function Q(e, t) {
|
|
754
|
-
t.extras !== void 0 && (typeof t.extras == "object" ? Object.assign(e.userData, t.extras) : console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, " + t.extras));
|
|
755
|
-
}
|
|
756
|
-
function He(e, t, n) {
|
|
757
|
-
for (var r = !1, i = !1, a = 0, o = t.length; a < o; a++) {
|
|
758
|
-
var s = t[a];
|
|
759
|
-
if (s.POSITION !== void 0 && (r = !0), s.NORMAL !== void 0 && (i = !0), r && i) break;
|
|
760
|
-
}
|
|
761
|
-
if (!r && !i) return Promise.resolve(e);
|
|
762
|
-
for (var c = [], l = [], a = 0, o = t.length; a < o; a++) {
|
|
763
|
-
var s = t[a];
|
|
764
|
-
if (r) {
|
|
765
|
-
var u = s.POSITION === void 0 ? e.attributes.position : n.getDependency("accessor", s.POSITION);
|
|
766
|
-
c.push(u);
|
|
767
|
-
}
|
|
768
|
-
if (i) {
|
|
769
|
-
var u = s.NORMAL === void 0 ? e.attributes.normal : n.getDependency("accessor", s.NORMAL);
|
|
770
|
-
l.push(u);
|
|
771
|
-
}
|
|
772
|
-
}
|
|
773
|
-
return Promise.all([Promise.all(c), Promise.all(l)]).then(function(t) {
|
|
774
|
-
var n = t[0], a = t[1];
|
|
775
|
-
return r && (e.morphAttributes.position = n), i && (e.morphAttributes.normal = a), e.morphTargetsRelative = !0, e;
|
|
776
|
-
});
|
|
777
|
-
}
|
|
778
|
-
function Ue(e, t) {
|
|
779
|
-
if (e.updateMorphTargets(), t.weights !== void 0) for (var n = 0, r = t.weights.length; n < r; n++) e.morphTargetInfluences[n] = t.weights[n];
|
|
780
|
-
if (t.extras && Array.isArray(t.extras.targetNames)) {
|
|
781
|
-
var i = t.extras.targetNames;
|
|
782
|
-
if (e.morphTargetInfluences.length === i.length) {
|
|
783
|
-
e.morphTargetDictionary = {};
|
|
784
|
-
for (var n = 0, r = i.length; n < r; n++) e.morphTargetDictionary[i[n]] = n;
|
|
785
|
-
} else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.");
|
|
786
|
-
}
|
|
787
|
-
}
|
|
788
|
-
function We(e) {
|
|
789
|
-
var t = e.extensions && e.extensions[B.KHR_DRACO_MESH_COMPRESSION];
|
|
790
|
-
return t ? "draco:" + t.bufferView + ":" + t.indices + ":" + Ge(t.attributes) : e.indices + ":" + Ge(e.attributes) + ":" + e.mode;
|
|
791
|
-
}
|
|
792
|
-
function Ge(e) {
|
|
793
|
-
for (var t = "", n = Object.keys(e).sort(), r = 0, i = n.length; r < i; r++) t += n[r] + ":" + e[n[r]] + ";";
|
|
794
|
-
return t;
|
|
795
|
-
}
|
|
796
|
-
function $(e, t, n) {
|
|
797
|
-
this.json = e || {}, this.extensions = t || {}, this.options = n || {}, this.cache = new c(), this.associations = /* @__PURE__ */ new Map(), this.primitiveCache = {}, this.textureLoader = new ye(this.options.manager), this.textureLoader.setCrossOrigin(this.options.crossOrigin), this.fileLoader = new d(this.options.manager), this.fileLoader.setResponseType("arraybuffer"), this.options.crossOrigin === "use-credentials" && this.fileLoader.setWithCredentials(!0);
|
|
798
|
-
}
|
|
799
|
-
$.prototype.parse = function(e, t) {
|
|
800
|
-
var n = this, r = this.json, i = this.extensions;
|
|
801
|
-
this.cache.removeAll(), this.markDefs(), Promise.all([
|
|
802
|
-
this.getDependencies("scene"),
|
|
803
|
-
this.getDependencies("animation"),
|
|
804
|
-
this.getDependencies("camera")
|
|
805
|
-
]).then(function(t) {
|
|
806
|
-
var a = {
|
|
807
|
-
scene: t[0][r.scene || 0],
|
|
808
|
-
scenes: t[0],
|
|
809
|
-
animations: t[1],
|
|
810
|
-
cameras: t[2],
|
|
811
|
-
asset: r.asset,
|
|
812
|
-
parser: n,
|
|
813
|
-
userData: {}
|
|
814
|
-
};
|
|
815
|
-
Z(i, a, r), Q(a, r), e(a);
|
|
816
|
-
}).catch(t);
|
|
817
|
-
}, $.prototype.markDefs = function() {
|
|
818
|
-
for (var e = this.json.nodes || [], t = this.json.skins || [], n = this.json.meshes || [], r = {}, i = {}, a = 0, o = t.length; a < o; a++) for (var s = t[a].joints, c = 0, l = s.length; c < l; c++) e[s[c]].isBone = !0;
|
|
819
|
-
for (var u = 0, d = e.length; u < d; u++) {
|
|
820
|
-
var f = e[u];
|
|
821
|
-
f.mesh !== void 0 && (r[f.mesh] === void 0 && (r[f.mesh] = i[f.mesh] = 0), r[f.mesh]++, f.skin !== void 0 && (n[f.mesh].isSkinnedMesh = !0));
|
|
822
|
-
}
|
|
823
|
-
this.json.meshReferences = r, this.json.meshUses = i;
|
|
824
|
-
}, $.prototype.getDependency = function(e, t) {
|
|
825
|
-
var n = e + ":" + t, r = this.cache.get(n);
|
|
826
|
-
if (!r) {
|
|
827
|
-
switch (e) {
|
|
828
|
-
case "scene":
|
|
829
|
-
r = this.loadScene(t);
|
|
830
|
-
break;
|
|
831
|
-
case "node":
|
|
832
|
-
r = this.loadNode(t);
|
|
833
|
-
break;
|
|
834
|
-
case "mesh":
|
|
835
|
-
r = this.loadMesh(t);
|
|
836
|
-
break;
|
|
837
|
-
case "accessor":
|
|
838
|
-
r = this.loadAccessor(t);
|
|
839
|
-
break;
|
|
840
|
-
case "bufferView":
|
|
841
|
-
r = this.loadBufferView(t);
|
|
842
|
-
break;
|
|
843
|
-
case "buffer":
|
|
844
|
-
r = this.loadBuffer(t);
|
|
845
|
-
break;
|
|
846
|
-
case "material":
|
|
847
|
-
r = this.loadMaterial(t);
|
|
848
|
-
break;
|
|
849
|
-
case "texture":
|
|
850
|
-
r = this.loadTexture(t);
|
|
851
|
-
break;
|
|
852
|
-
case "skin":
|
|
853
|
-
r = this.loadSkin(t);
|
|
854
|
-
break;
|
|
855
|
-
case "animation":
|
|
856
|
-
r = this.loadAnimation(t);
|
|
857
|
-
break;
|
|
858
|
-
case "camera":
|
|
859
|
-
r = this.loadCamera(t);
|
|
860
|
-
break;
|
|
861
|
-
case "light":
|
|
862
|
-
r = this.extensions[B.KHR_LIGHTS_PUNCTUAL].loadLight(t);
|
|
863
|
-
break;
|
|
864
|
-
default: throw Error("Unknown type: " + e);
|
|
865
|
-
}
|
|
866
|
-
this.cache.add(n, r);
|
|
867
|
-
}
|
|
868
|
-
return r;
|
|
869
|
-
}, $.prototype.getDependencies = function(e) {
|
|
870
|
-
var t = this.cache.get(e);
|
|
871
|
-
if (!t) {
|
|
872
|
-
var n = this, r = this.json[e + (e === "mesh" ? "es" : "s")] || [];
|
|
873
|
-
t = Promise.all(r.map(function(t, r) {
|
|
874
|
-
return n.getDependency(e, r);
|
|
875
|
-
})), this.cache.add(e, t);
|
|
876
|
-
}
|
|
877
|
-
return t;
|
|
878
|
-
}, $.prototype.loadBuffer = function(e) {
|
|
879
|
-
var t = this.json.buffers[e], n = this.fileLoader;
|
|
880
|
-
if (t.type && t.type !== "arraybuffer") throw Error("THREE.GLTFLoader: " + t.type + " buffer type is not supported.");
|
|
881
|
-
if (t.uri === void 0 && e === 0) return Promise.resolve(this.extensions[B.KHR_BINARY_GLTF].body);
|
|
882
|
-
var r = this.options;
|
|
883
|
-
return new Promise(function(e, i) {
|
|
884
|
-
n.load(Be(t.uri, r.path), e, void 0, function() {
|
|
885
|
-
i(/* @__PURE__ */ Error("THREE.GLTFLoader: Failed to load buffer \"" + t.uri + "\"."));
|
|
886
|
-
});
|
|
887
|
-
});
|
|
888
|
-
}, $.prototype.loadBufferView = function(e) {
|
|
889
|
-
var t = this.json.bufferViews[e];
|
|
890
|
-
return this.getDependency("buffer", t.buffer).then(function(e) {
|
|
891
|
-
var n = t.byteLength || 0, r = t.byteOffset || 0;
|
|
892
|
-
return e.slice(r, r + n);
|
|
893
|
-
});
|
|
894
|
-
}, $.prototype.loadAccessor = function(e) {
|
|
895
|
-
var t = this, n = this.json, r = this.json.accessors[e];
|
|
896
|
-
if (r.bufferView === void 0 && r.sparse === void 0) return Promise.resolve(null);
|
|
897
|
-
var a = [];
|
|
898
|
-
return r.bufferView === void 0 ? a.push(null) : a.push(this.getDependency("bufferView", r.bufferView)), r.sparse !== void 0 && (a.push(this.getDependency("bufferView", r.sparse.indices.bufferView)), a.push(this.getDependency("bufferView", r.sparse.values.bufferView))), Promise.all(a).then(function(e) {
|
|
899
|
-
var a = e[0], o = Fe[r.type], s = Me[r.componentType], c = s.BYTES_PER_ELEMENT, l = c * o, u = r.byteOffset || 0, d = r.bufferView === void 0 ? void 0 : n.bufferViews[r.bufferView].byteStride, f = r.normalized === !0, p, g;
|
|
900
|
-
if (d && d !== l) {
|
|
901
|
-
var _ = Math.floor(u / d), v = "InterleavedBuffer:" + r.bufferView + ":" + r.componentType + ":" + _ + ":" + r.count, y = t.cache.get(v);
|
|
902
|
-
y || (p = new s(a, _ * d, r.count * d / c), y = new m(p, d / c), t.cache.add(v, y)), g = new h(y, o, u % d / c, f);
|
|
903
|
-
} else p = a === null ? new s(r.count * o) : new s(a, u, r.count * o), g = new i(p, o, f);
|
|
904
|
-
if (r.sparse !== void 0) {
|
|
905
|
-
var b = Fe.SCALAR, x = Me[r.sparse.indices.componentType], S = r.sparse.indices.byteOffset || 0, C = r.sparse.values.byteOffset || 0, w = new x(e[1], S, r.sparse.count * b), T = new s(e[2], C, r.sparse.count * o);
|
|
906
|
-
a !== null && (g = new i(g.array.slice(), g.itemSize, g.normalized));
|
|
907
|
-
for (var E = 0, D = w.length; E < D; E++) {
|
|
908
|
-
var O = w[E];
|
|
909
|
-
if (g.setX(O, T[E * o]), o >= 2 && g.setY(O, T[E * o + 1]), o >= 3 && g.setZ(O, T[E * o + 2]), o >= 4 && g.setW(O, T[E * o + 3]), o >= 5) throw Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.");
|
|
910
|
-
}
|
|
911
|
-
}
|
|
912
|
-
return g;
|
|
913
|
-
});
|
|
914
|
-
}, $.prototype.loadTexture = function(e) {
|
|
915
|
-
var t = this, n = this.json, r = this.options, i = this.textureLoader, a = self.URL || self.webkitURL, o = n.textures[e], s = o.extensions || {}, c = s[B.MSFT_TEXTURE_DDS] ? n.images[s[B.MSFT_TEXTURE_DDS].source] : n.images[o.source], l = c.uri, u = !1;
|
|
916
|
-
return c.bufferView !== void 0 && (l = t.getDependency("bufferView", c.bufferView).then(function(e) {
|
|
917
|
-
u = !0;
|
|
918
|
-
var t = new Blob([e], { type: c.mimeType });
|
|
919
|
-
return l = a.createObjectURL(t), l;
|
|
920
|
-
})), Promise.resolve(l).then(function(e) {
|
|
921
|
-
var n = r.manager.getHandler(e);
|
|
922
|
-
return n || (n = s[B.MSFT_TEXTURE_DDS] ? t.extensions[B.MSFT_TEXTURE_DDS].ddsLoader : i), new Promise(function(t, i) {
|
|
923
|
-
n.load(Be(e, r.path), t, void 0, i);
|
|
924
|
-
});
|
|
925
|
-
}).then(function(r) {
|
|
926
|
-
u === !0 && a.revokeObjectURL(l), r.flipY = !1, o.name && (r.name = o.name), c.mimeType in ze && (r.format = ze[c.mimeType]);
|
|
927
|
-
var i = (n.samplers || {})[o.sampler] || {};
|
|
928
|
-
return r.magFilter = Ne[i.magFilter] || C, r.minFilter = Ne[i.minFilter] || w, r.wrapS = Pe[i.wrapS] || pe, r.wrapT = Pe[i.wrapT] || pe, t.associations.set(r, {
|
|
929
|
-
type: "textures",
|
|
930
|
-
index: e
|
|
931
|
-
}), r;
|
|
932
|
-
});
|
|
933
|
-
}, $.prototype.assignTexture = function(e, t, n) {
|
|
934
|
-
var r = this;
|
|
935
|
-
return this.getDependency("texture", n.index).then(function(i) {
|
|
936
|
-
if (!i.isCompressedTexture) switch (t) {
|
|
937
|
-
case "aoMap":
|
|
938
|
-
case "emissiveMap":
|
|
939
|
-
case "metalnessMap":
|
|
940
|
-
case "normalMap":
|
|
941
|
-
case "roughnessMap":
|
|
942
|
-
i.format = de;
|
|
943
|
-
break;
|
|
944
|
-
}
|
|
945
|
-
if (n.texCoord !== void 0 && n.texCoord != 0 && !(t === "aoMap" && n.texCoord == 1) && console.warn("THREE.GLTFLoader: Custom UV set " + n.texCoord + " for texture " + t + " not yet supported."), r.extensions[B.KHR_TEXTURE_TRANSFORM]) {
|
|
946
|
-
var a = n.extensions === void 0 ? void 0 : n.extensions[B.KHR_TEXTURE_TRANSFORM];
|
|
947
|
-
if (a) {
|
|
948
|
-
var o = r.associations.get(i);
|
|
949
|
-
i = r.extensions[B.KHR_TEXTURE_TRANSFORM].extendTexture(i, a), r.associations.set(i, o);
|
|
950
|
-
}
|
|
951
|
-
}
|
|
952
|
-
e[t] = i;
|
|
953
|
-
});
|
|
954
|
-
}, $.prototype.assignFinalMaterial = function(e) {
|
|
955
|
-
var t = e.geometry, n = e.material, r = t.attributes.tangent !== void 0, i = t.attributes.color !== void 0, a = t.attributes.normal === void 0, o = e.isSkinnedMesh === !0, s = Object.keys(t.morphAttributes).length > 0, c = s && t.morphAttributes.normal !== void 0;
|
|
956
|
-
if (e.isPoints) {
|
|
957
|
-
var l = "PointsMaterial:" + n.uuid, u = this.cache.get(l);
|
|
958
|
-
u || (u = new oe(), O.prototype.copy.call(u, n), u.color.copy(n.color), u.map = n.map, u.sizeAttenuation = !1, this.cache.add(l, u)), n = u;
|
|
959
|
-
} else if (e.isLine) {
|
|
960
|
-
var l = "LineBasicMaterial:" + n.uuid, d = this.cache.get(l);
|
|
961
|
-
d || (d = new b(), O.prototype.copy.call(d, n), d.color.copy(n.color), this.cache.add(l, d)), n = d;
|
|
962
|
-
}
|
|
963
|
-
if (r || i || a || o || s) {
|
|
964
|
-
var l = "ClonedMaterial:" + n.uuid + ":";
|
|
965
|
-
n.isGLTFSpecularGlossinessMaterial && (l += "specular-glossiness:"), o && (l += "skinning:"), r && (l += "vertex-tangents:"), i && (l += "vertex-colors:"), a && (l += "flat-shading:"), s && (l += "morph-targets:"), c && (l += "morph-normals:");
|
|
966
|
-
var f = this.cache.get(l);
|
|
967
|
-
f || (f = n.clone(), o && (f.skinning = !0), r && (f.vertexTangents = !0), i && (f.vertexColors = !0), a && (f.flatShading = !0), s && (f.morphTargets = !0), c && (f.morphNormals = !0), this.cache.add(l, f), this.associations.set(f, this.associations.get(n))), n = f;
|
|
968
|
-
}
|
|
969
|
-
n.aoMap && t.attributes.uv2 === void 0 && t.attributes.uv !== void 0 && t.setAttribute("uv2", t.attributes.uv), n.normalScale && !r && (n.normalScale.y = -n.normalScale.y), n.clearcoatNormalScale && !r && (n.clearcoatNormalScale.y = -n.clearcoatNormalScale.y), e.material = n;
|
|
970
|
-
}, $.prototype.loadMaterial = function(e) {
|
|
971
|
-
var t = this, n = this.json, r = this.extensions, i = n.materials[e], a, o = {}, c = i.extensions || {}, l = [];
|
|
972
|
-
if (c[B.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS]) {
|
|
973
|
-
var d = r[B.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS];
|
|
974
|
-
a = d.getMaterialType(), l.push(d.extendParams(o, i, t));
|
|
975
|
-
} else if (c[B.KHR_MATERIALS_UNLIT]) {
|
|
976
|
-
var f = r[B.KHR_MATERIALS_UNLIT];
|
|
977
|
-
a = f.getMaterialType(), l.push(f.extendParams(o, i, t));
|
|
978
|
-
} else {
|
|
979
|
-
a = A;
|
|
980
|
-
var p = i.pbrMetallicRoughness || {};
|
|
981
|
-
if (o.color = new s(1, 1, 1), o.opacity = 1, Array.isArray(p.baseColorFactor)) {
|
|
982
|
-
var m = p.baseColorFactor;
|
|
983
|
-
o.color.fromArray(m), o.opacity = m[3];
|
|
984
|
-
}
|
|
985
|
-
p.baseColorTexture !== void 0 && l.push(t.assignTexture(o, "map", p.baseColorTexture)), o.metalness = p.metallicFactor === void 0 ? 1 : p.metallicFactor, o.roughness = p.roughnessFactor === void 0 ? 1 : p.roughnessFactor, p.metallicRoughnessTexture !== void 0 && (l.push(t.assignTexture(o, "metalnessMap", p.metallicRoughnessTexture)), l.push(t.assignTexture(o, "roughnessMap", p.metallicRoughnessTexture)));
|
|
986
|
-
}
|
|
987
|
-
i.doubleSided === !0 && (o.side = u);
|
|
988
|
-
var h = i.alphaMode || Re.OPAQUE;
|
|
989
|
-
if (h === Re.BLEND ? (o.transparent = !0, o.depthWrite = !1) : (o.transparent = !1, h === Re.MASK && (o.alphaTest = i.alphaCutoff === void 0 ? .5 : i.alphaCutoff)), i.normalTexture !== void 0 && a !== k && (l.push(t.assignTexture(o, "normalMap", i.normalTexture)), o.normalScale = new Se(1, 1), i.normalTexture.scale !== void 0 && o.normalScale.set(i.normalTexture.scale, i.normalTexture.scale)), i.occlusionTexture !== void 0 && a !== k && (l.push(t.assignTexture(o, "aoMap", i.occlusionTexture)), i.occlusionTexture.strength !== void 0 && (o.aoMapIntensity = i.occlusionTexture.strength)), i.emissiveFactor !== void 0 && a !== k && (o.emissive = new s().fromArray(i.emissiveFactor)), i.emissiveTexture !== void 0 && a !== k && l.push(t.assignTexture(o, "emissiveMap", i.emissiveTexture)), c[B.KHR_MATERIALS_CLEARCOAT]) {
|
|
990
|
-
var g = r[B.KHR_MATERIALS_CLEARCOAT];
|
|
991
|
-
a = g.getMaterialType(), l.push(g.extendParams(o, { extensions: c }, t));
|
|
992
|
-
}
|
|
993
|
-
if (c[B.KHR_MATERIALS_TRANSMISSION]) {
|
|
994
|
-
var g = r[B.KHR_MATERIALS_TRANSMISSION];
|
|
995
|
-
a = g.getMaterialType(), l.push(g.extendParams(o, { extensions: c }, t));
|
|
996
|
-
}
|
|
997
|
-
if (c[B.REALSEE_MATERIALS_LIGHTMAP]) {
|
|
998
|
-
var _ = r[B.REALSEE_MATERIALS_LIGHTMAP];
|
|
999
|
-
a = _.getMaterialType(), l.push(_.extendParams(o, { extensions: c }, t));
|
|
1000
|
-
}
|
|
1001
|
-
return Promise.all(l).then(function() {
|
|
1002
|
-
var n = a === q ? r[B.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS].createMaterial(o) : new a(o);
|
|
1003
|
-
return i.name && (n.name = i.name), n.map && (n.map.encoding = we), n.emissiveMap && (n.emissiveMap.encoding = we), Q(n, i), t.associations.set(n, {
|
|
1004
|
-
type: "materials",
|
|
1005
|
-
index: e
|
|
1006
|
-
}), i.extensions && Z(r, n, i), n;
|
|
1007
|
-
});
|
|
1008
|
-
};
|
|
1009
|
-
function Ke(e, t, n) {
|
|
1010
|
-
var i = t.attributes, a = new r();
|
|
1011
|
-
if (i.POSITION !== void 0) {
|
|
1012
|
-
var o = n.json.accessors[i.POSITION], s = o.min, c = o.max;
|
|
1013
|
-
if (s !== void 0 && c !== void 0) a.set(new H(s[0], s[1], s[2]), new H(c[0], c[1], c[2]));
|
|
1014
|
-
else {
|
|
1015
|
-
console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");
|
|
1016
|
-
return;
|
|
1017
|
-
}
|
|
1018
|
-
} else return;
|
|
1019
|
-
var l = t.targets;
|
|
1020
|
-
if (l !== void 0) {
|
|
1021
|
-
for (var u = new H(), d = new H(), f = 0, p = l.length; f < p; f++) {
|
|
1022
|
-
var m = l[f];
|
|
1023
|
-
if (m.POSITION !== void 0) {
|
|
1024
|
-
var o = n.json.accessors[m.POSITION], s = o.min, c = o.max;
|
|
1025
|
-
s !== void 0 && c !== void 0 ? (d.setX(Math.max(Math.abs(s[0]), Math.abs(c[0]))), d.setY(Math.max(Math.abs(s[1]), Math.abs(c[1]))), d.setZ(Math.max(Math.abs(s[2]), Math.abs(c[2]))), u.max(d)) : console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");
|
|
1026
|
-
}
|
|
1027
|
-
}
|
|
1028
|
-
a.expandByVector(u);
|
|
1029
|
-
}
|
|
1030
|
-
e.boundingBox = a;
|
|
1031
|
-
var h = new ge();
|
|
1032
|
-
a.getCenter(h.center), h.radius = a.min.distanceTo(a.max) / 2, e.boundingSphere = h;
|
|
1033
|
-
}
|
|
1034
|
-
function qe(e, t, n) {
|
|
1035
|
-
var r = t.attributes, i = [];
|
|
1036
|
-
function a(t, r) {
|
|
1037
|
-
return n.getDependency("accessor", t).then(function(t) {
|
|
1038
|
-
e.setAttribute(r, t);
|
|
1039
|
-
});
|
|
1040
|
-
}
|
|
1041
|
-
for (var o in r) {
|
|
1042
|
-
var s = Ie[o] || o.toLowerCase();
|
|
1043
|
-
s in e.attributes || i.push(a(r[o], s));
|
|
1044
|
-
}
|
|
1045
|
-
if (t.indices !== void 0 && !e.index) {
|
|
1046
|
-
var c = n.getDependency("accessor", t.indices).then(function(t) {
|
|
1047
|
-
e.setIndex(t);
|
|
1048
|
-
});
|
|
1049
|
-
i.push(c);
|
|
1050
|
-
}
|
|
1051
|
-
return Q(e, t), Ke(e, t, n), Promise.all(i).then(function() {
|
|
1052
|
-
return t.targets === void 0 ? e : He(e, t.targets, n);
|
|
1053
|
-
});
|
|
1054
|
-
}
|
|
1055
|
-
function Je(e, t) {
|
|
1056
|
-
var n = e.getIndex();
|
|
1057
|
-
if (n === null) {
|
|
1058
|
-
var r = [], i = e.getAttribute("position");
|
|
1059
|
-
if (i !== void 0) {
|
|
1060
|
-
for (var a = 0; a < i.count; a++) r.push(a);
|
|
1061
|
-
e.setIndex(r), n = e.getIndex();
|
|
1062
|
-
} else return console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."), e;
|
|
1063
|
-
}
|
|
1064
|
-
var o = n.count - 2, s = [];
|
|
1065
|
-
if (t === be) for (var a = 1; a <= o; a++) s.push(n.getX(0)), s.push(n.getX(a)), s.push(n.getX(a + 1));
|
|
1066
|
-
else for (var a = 0; a < o; a++) a % 2 == 0 ? (s.push(n.getX(a)), s.push(n.getX(a + 1)), s.push(n.getX(a + 2))) : (s.push(n.getX(a + 2)), s.push(n.getX(a + 1)), s.push(n.getX(a)));
|
|
1067
|
-
s.length / 3 !== o && console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");
|
|
1068
|
-
var c = e.clone();
|
|
1069
|
-
return c.setIndex(s), c;
|
|
1070
|
-
}
|
|
1071
|
-
return $.prototype.loadGeometries = function(e) {
|
|
1072
|
-
var t = this, n = this.extensions, r = this.primitiveCache;
|
|
1073
|
-
function i(e) {
|
|
1074
|
-
return n[B.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e, t).then(function(n) {
|
|
1075
|
-
return qe(n, e, t);
|
|
1076
|
-
});
|
|
1077
|
-
}
|
|
1078
|
-
for (var o = [], s = 0, c = e.length; s < c; s++) {
|
|
1079
|
-
var l = e[s], u = We(l), d = r[u];
|
|
1080
|
-
if (d) o.push(d.promise);
|
|
1081
|
-
else {
|
|
1082
|
-
var f = l.extensions && l.extensions[B.KHR_DRACO_MESH_COMPRESSION] ? i(l) : qe(new a(), l, t);
|
|
1083
|
-
r[u] = {
|
|
1084
|
-
primitive: l,
|
|
1085
|
-
promise: f
|
|
1086
|
-
}, o.push(f);
|
|
1087
|
-
}
|
|
1088
|
-
}
|
|
1089
|
-
return Promise.all(o);
|
|
1090
|
-
}, $.prototype.loadMesh = function(e) {
|
|
1091
|
-
for (var t = this, n = this.json.meshes[e], r = n.primitives, i = [], a = 0, o = r.length; a < o; a++) {
|
|
1092
|
-
var s = r[a].material === void 0 ? Ve(this.cache) : this.getDependency("material", r[a].material);
|
|
1093
|
-
i.push(s);
|
|
1094
|
-
}
|
|
1095
|
-
return i.push(t.loadGeometries(r)), Promise.all(i).then(function(i) {
|
|
1096
|
-
for (var a = i.slice(0, i.length - 1), o = i[i.length - 1], s = [], c = 0, l = o.length; c < l; c++) {
|
|
1097
|
-
var u = o[c], d = r[c], f, m = a[c];
|
|
1098
|
-
if (d.mode === Y.TRIANGLES || d.mode === Y.TRIANGLE_STRIP || d.mode === Y.TRIANGLE_FAN || d.mode === void 0) f = n.isSkinnedMesh === !0 ? new he(u, m) : new ne(u, m), f.isSkinnedMesh === !0 && !f.geometry.attributes.skinWeight.normalized && f.normalizeSkinWeights(), d.mode === Y.TRIANGLE_STRIP ? f.geometry = Je(f.geometry, xe) : d.mode === Y.TRIANGLE_FAN && (f.geometry = Je(f.geometry, be));
|
|
1099
|
-
else if (d.mode === Y.LINES) f = new S(u, m);
|
|
1100
|
-
else if (d.mode === Y.LINE_STRIP) f = new y(u, m);
|
|
1101
|
-
else if (d.mode === Y.LINE_LOOP) f = new x(u, m);
|
|
1102
|
-
else if (d.mode === Y.POINTS) f = new z(u, m);
|
|
1103
|
-
else throw Error("THREE.GLTFLoader: Primitive mode unsupported: " + d.mode);
|
|
1104
|
-
Object.keys(f.geometry.morphAttributes).length > 0 && Ue(f, n), f.name = n.name || "mesh_" + e, o.length > 1 && (f.name += "_" + c), Q(f, n), t.assignFinalMaterial(f), s.push(f);
|
|
1105
|
-
}
|
|
1106
|
-
if (s.length === 1) return s[0];
|
|
1107
|
-
for (var h = new p(), c = 0, l = s.length; c < l; c++) h.add(s[c]);
|
|
1108
|
-
return h;
|
|
1109
|
-
});
|
|
1110
|
-
}, $.prototype.loadCamera = function(e) {
|
|
1111
|
-
var t, n = this.json.cameras[e], r = n[n.type];
|
|
1112
|
-
if (!r) {
|
|
1113
|
-
console.warn("THREE.GLTFLoader: Missing camera parameters.");
|
|
1114
|
-
return;
|
|
1115
|
-
}
|
|
1116
|
-
return n.type === "perspective" ? t = new L(ee.radToDeg(r.yfov), r.aspectRatio || 1, r.znear || 1, r.zfar || 2e6) : n.type === "orthographic" && (t = new I(-r.xmag, r.xmag, r.ymag, -r.ymag, r.znear, r.zfar)), n.name && (t.name = n.name), Q(t, n), Promise.resolve(t);
|
|
1117
|
-
}, $.prototype.loadSkin = function(e) {
|
|
1118
|
-
var t = this.json.skins[e], n = { joints: t.joints };
|
|
1119
|
-
return t.inverseBindMatrices === void 0 ? Promise.resolve(n) : this.getDependency("accessor", t.inverseBindMatrices).then(function(e) {
|
|
1120
|
-
return n.inverseBindMatrices = e, n;
|
|
1121
|
-
});
|
|
1122
|
-
}, $.prototype.loadAnimation = function(e) {
|
|
1123
|
-
for (var n = this.json.animations[e], r = [], i = [], a = [], o = [], s = [], c = 0, l = n.channels.length; c < l; c++) {
|
|
1124
|
-
var u = n.channels[c], d = n.samplers[u.sampler], f = u.target, p = f.node === void 0 ? f.id : f.node, m = n.parameters === void 0 ? d.input : n.parameters[d.input], h = n.parameters === void 0 ? d.output : n.parameters[d.output];
|
|
1125
|
-
r.push(this.getDependency("node", p)), i.push(this.getDependency("accessor", m)), a.push(this.getDependency("accessor", h)), o.push(d), s.push(f);
|
|
1126
|
-
}
|
|
1127
|
-
return Promise.all([
|
|
1128
|
-
Promise.all(r),
|
|
1129
|
-
Promise.all(i),
|
|
1130
|
-
Promise.all(a),
|
|
1131
|
-
Promise.all(o),
|
|
1132
|
-
Promise.all(s)
|
|
1133
|
-
]).then(function(r) {
|
|
1134
|
-
for (var i = r[0], a = r[1], o = r[2], s = r[3], c = r[4], l = [], u = 0, d = i.length; u < d; u++) {
|
|
1135
|
-
var f = i[u], p = a[u], m = o[u], h = s[u], g = c[u];
|
|
1136
|
-
if (f !== void 0) {
|
|
1137
|
-
f.updateMatrix(), f.matrixAutoUpdate = !0;
|
|
1138
|
-
var _;
|
|
1139
|
-
switch (X[g.path]) {
|
|
1140
|
-
case X.weights:
|
|
1141
|
-
_ = F;
|
|
1142
|
-
break;
|
|
1143
|
-
case X.rotation:
|
|
1144
|
-
_ = ce;
|
|
1145
|
-
break;
|
|
1146
|
-
case X.position:
|
|
1147
|
-
case X.scale:
|
|
1148
|
-
default:
|
|
1149
|
-
_ = Ce;
|
|
1150
|
-
break;
|
|
1151
|
-
}
|
|
1152
|
-
var y = f.name ? f.name : f.uuid, b = h.interpolation === void 0 ? v : Le[h.interpolation], x = [];
|
|
1153
|
-
X[g.path] === X.weights ? f.traverse(function(e) {
|
|
1154
|
-
e.isMesh === !0 && e.morphTargetInfluences && x.push(e.name ? e.name : e.uuid);
|
|
1155
|
-
}) : x.push(y);
|
|
1156
|
-
var S = m.array;
|
|
1157
|
-
if (m.normalized) {
|
|
1158
|
-
var C;
|
|
1159
|
-
if (S.constructor === Int8Array) C = 1 / 127;
|
|
1160
|
-
else if (S.constructor === Uint8Array) C = 1 / 255;
|
|
1161
|
-
else if (S.constructor == Int16Array) C = 1 / 32767;
|
|
1162
|
-
else if (S.constructor === Uint16Array) C = 1 / 65535;
|
|
1163
|
-
else throw Error("THREE.GLTFLoader: Unsupported output accessor component type.");
|
|
1164
|
-
for (var w = new Float32Array(S.length), T = 0, E = S.length; T < E; T++) w[T] = S[T] * C;
|
|
1165
|
-
S = w;
|
|
1166
|
-
}
|
|
1167
|
-
for (var T = 0, E = x.length; T < E; T++) {
|
|
1168
|
-
var D = new _(x[T] + "." + X[g.path], p.array, S, b);
|
|
1169
|
-
h.interpolation === "CUBICSPLINE" && (D.createInterpolant = function(e) {
|
|
1170
|
-
return new J(this.times, this.values, this.getValueSize() / 3, e);
|
|
1171
|
-
}, D.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline = !0), l.push(D);
|
|
1172
|
-
}
|
|
1173
|
-
}
|
|
1174
|
-
}
|
|
1175
|
-
return new t(n.name ? n.name : "animation_" + e, void 0, l);
|
|
1176
|
-
});
|
|
1177
|
-
}, $.prototype.loadNode = function(e) {
|
|
1178
|
-
var t = this.json, r = this.extensions, i = this, a = t.meshReferences, o = t.meshUses, s = t.nodes[e];
|
|
1179
|
-
return function() {
|
|
1180
|
-
var e = [];
|
|
1181
|
-
return s.mesh !== void 0 && e.push(i.getDependency("mesh", s.mesh).then(function(e) {
|
|
1182
|
-
var t;
|
|
1183
|
-
if (a[s.mesh] > 1) {
|
|
1184
|
-
var n = o[s.mesh]++;
|
|
1185
|
-
t = e.clone(), t.name += "_instance_" + n;
|
|
1186
|
-
} else t = e;
|
|
1187
|
-
return s.weights !== void 0 && t.traverse(function(e) {
|
|
1188
|
-
if (e.isMesh) for (var t = 0, n = s.weights.length; t < n; t++) e.morphTargetInfluences[t] = s.weights[t];
|
|
1189
|
-
}), t;
|
|
1190
|
-
})), s.camera !== void 0 && e.push(i.getDependency("camera", s.camera)), s.extensions && s.extensions[B.KHR_LIGHTS_PUNCTUAL] && s.extensions[B.KHR_LIGHTS_PUNCTUAL].light !== void 0 && e.push(i.getDependency("light", s.extensions[B.KHR_LIGHTS_PUNCTUAL].light)), Promise.all(e);
|
|
1191
|
-
}().then(function(t) {
|
|
1192
|
-
var a = s.isBone === !0 ? new n() : t.length > 1 ? new p() : t.length === 1 ? t[0] : new ae();
|
|
1193
|
-
if (a !== t[0]) for (var o = 0, c = t.length; o < c; o++) a.add(t[o]);
|
|
1194
|
-
if (s.name && (a.userData.name = s.name, a.name = se.sanitizeNodeName(s.name)), Q(a, s), s.extensions && Z(r, a, s), s.matrix !== void 0) {
|
|
1195
|
-
var l = new te();
|
|
1196
|
-
l.fromArray(s.matrix), a.applyMatrix4(l);
|
|
1197
|
-
} else s.translation !== void 0 && a.position.fromArray(s.translation), s.rotation !== void 0 && a.quaternion.fromArray(s.rotation), s.scale !== void 0 && a.scale.fromArray(s.scale);
|
|
1198
|
-
return i.associations.set(a, {
|
|
1199
|
-
type: "nodes",
|
|
1200
|
-
index: e
|
|
1201
|
-
}), a;
|
|
1202
|
-
});
|
|
1203
|
-
}, $.prototype.loadScene = function() {
|
|
1204
|
-
function e(t, n, r, i) {
|
|
1205
|
-
var a = r.nodes[t];
|
|
1206
|
-
return i.getDependency("node", t).then(function(e) {
|
|
1207
|
-
if (a.skin === void 0) return e;
|
|
1208
|
-
var t;
|
|
1209
|
-
return i.getDependency("skin", a.skin).then(function(e) {
|
|
1210
|
-
t = e;
|
|
1211
|
-
for (var n = [], r = 0, a = t.joints.length; r < a; r++) n.push(i.getDependency("node", t.joints[r]));
|
|
1212
|
-
return Promise.all(n);
|
|
1213
|
-
}).then(function(n) {
|
|
1214
|
-
return e.traverse(function(e) {
|
|
1215
|
-
if (e.isMesh) {
|
|
1216
|
-
for (var r = [], i = [], a = 0, o = n.length; a < o; a++) {
|
|
1217
|
-
var s = n[a];
|
|
1218
|
-
if (s) {
|
|
1219
|
-
r.push(s);
|
|
1220
|
-
var c = new te();
|
|
1221
|
-
t.inverseBindMatrices !== void 0 && c.fromArray(t.inverseBindMatrices.array, a * 16), i.push(c);
|
|
1222
|
-
} else console.warn("THREE.GLTFLoader: Joint \"%s\" could not be found.", t.joints[a]);
|
|
1223
|
-
}
|
|
1224
|
-
e.bind(new me(r, i), e.matrixWorld);
|
|
1225
|
-
}
|
|
1226
|
-
}), e;
|
|
1227
|
-
});
|
|
1228
|
-
}).then(function(t) {
|
|
1229
|
-
n.add(t);
|
|
1230
|
-
var o = [];
|
|
1231
|
-
if (a.children) for (var s = a.children, c = 0, l = s.length; c < l; c++) {
|
|
1232
|
-
var u = s[c];
|
|
1233
|
-
o.push(e(u, t, r, i));
|
|
1234
|
-
}
|
|
1235
|
-
return Promise.all(o);
|
|
1236
|
-
});
|
|
1237
|
-
}
|
|
1238
|
-
return function(t) {
|
|
1239
|
-
var n = this.json, r = this.extensions, i = this.json.scenes[t], a = this, o = new p();
|
|
1240
|
-
i.name && (o.name = i.name), Q(o, i), i.extensions && Z(r, o, i);
|
|
1241
|
-
for (var s = i.nodes || [], c = [], l = 0, u = s.length; l < u; l++) c.push(e(s[l], o, n, a));
|
|
1242
|
-
return Promise.all(c).then(function() {
|
|
1243
|
-
return o;
|
|
1244
|
-
});
|
|
1245
|
-
};
|
|
1246
|
-
}(), e;
|
|
1247
|
-
})(), W = function(e) {
|
|
1248
|
-
E.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 = {
|
|
1249
|
-
position: "POSITION",
|
|
1250
|
-
normal: "NORMAL",
|
|
1251
|
-
color: "COLOR",
|
|
1252
|
-
uv: "TEX_COORD"
|
|
1253
|
-
}, this.defaultAttributeTypes = {
|
|
1254
|
-
position: "Float32Array",
|
|
1255
|
-
normal: "Float32Array",
|
|
1256
|
-
color: "Float32Array",
|
|
1257
|
-
uv: "Float32Array"
|
|
1258
|
-
};
|
|
1259
|
-
};
|
|
1260
|
-
W.prototype = Object.assign(Object.create(E.prototype), {
|
|
1261
|
-
constructor: W,
|
|
1262
|
-
setDecoderPath: function(e) {
|
|
1263
|
-
return this.decoderPath = e, this;
|
|
1264
|
-
},
|
|
1265
|
-
setDecoderConfig: function(e) {
|
|
1266
|
-
return this.decoderConfig = e, this;
|
|
1267
|
-
},
|
|
1268
|
-
setWorkerLimit: function(e) {
|
|
1269
|
-
return this.workerLimit = e, this;
|
|
1270
|
-
},
|
|
1271
|
-
setVerbosity: function() {
|
|
1272
|
-
console.warn("THREE.DRACOLoader: The .setVerbosity() method has been removed.");
|
|
1273
|
-
},
|
|
1274
|
-
setDrawMode: function() {
|
|
1275
|
-
console.warn("THREE.DRACOLoader: The .setDrawMode() method has been removed.");
|
|
1276
|
-
},
|
|
1277
|
-
setSkipDequantization: function() {
|
|
1278
|
-
console.warn("THREE.DRACOLoader: The .setSkipDequantization() method has been removed.");
|
|
1279
|
-
},
|
|
1280
|
-
load: function(e, t, n, r) {
|
|
1281
|
-
var i = new d(this.manager);
|
|
1282
|
-
i.setPath(this.path), i.setResponseType("arraybuffer"), this.crossOrigin === "use-credentials" && i.setWithCredentials(!0), i.load(e, (e) => {
|
|
1283
|
-
var n = {
|
|
1284
|
-
attributeIDs: this.defaultAttributeIDs,
|
|
1285
|
-
attributeTypes: this.defaultAttributeTypes,
|
|
1286
|
-
useUniqueIDs: !1
|
|
1287
|
-
};
|
|
1288
|
-
this.decodeGeometry(e, n).then(t).catch(r);
|
|
1289
|
-
}, n, r);
|
|
1290
|
-
},
|
|
1291
|
-
decodeDracoFile: function(e, t, n, r) {
|
|
1292
|
-
var i = {
|
|
1293
|
-
attributeIDs: n || this.defaultAttributeIDs,
|
|
1294
|
-
attributeTypes: r || this.defaultAttributeTypes,
|
|
1295
|
-
useUniqueIDs: !!n
|
|
1296
|
-
};
|
|
1297
|
-
this.decodeGeometry(e, i).then(t);
|
|
1298
|
-
},
|
|
1299
|
-
decodeGeometry: function(e, t) {
|
|
1300
|
-
for (var n in t.attributeTypes) {
|
|
1301
|
-
var r = t.attributeTypes[n];
|
|
1302
|
-
r.BYTES_PER_ELEMENT !== void 0 && (t.attributeTypes[n] = r.name);
|
|
1303
|
-
}
|
|
1304
|
-
var i = JSON.stringify(t);
|
|
1305
|
-
if (W.taskCache.has(e)) {
|
|
1306
|
-
var a = W.taskCache.get(e);
|
|
1307
|
-
if (a.key === i) return a.promise;
|
|
1308
|
-
if (e.byteLength === 0) throw Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.");
|
|
1309
|
-
}
|
|
1310
|
-
var o, s = this.workerNextTaskID++, c = e.byteLength, l = this._getWorker(s, c).then((n) => (o = n, new Promise((n, r) => {
|
|
1311
|
-
o._callbacks[s] = {
|
|
1312
|
-
resolve: n,
|
|
1313
|
-
reject: r
|
|
1314
|
-
}, o.postMessage({
|
|
1315
|
-
type: "decode",
|
|
1316
|
-
id: s,
|
|
1317
|
-
taskConfig: t,
|
|
1318
|
-
buffer: e
|
|
1319
|
-
}, [e]);
|
|
1320
|
-
}))).then((e) => this._createGeometry(e.geometry));
|
|
1321
|
-
return l.catch(() => !0).then(() => {
|
|
1322
|
-
o && s && this._releaseTask(o, s);
|
|
1323
|
-
}), W.taskCache.set(e, {
|
|
1324
|
-
key: i,
|
|
1325
|
-
promise: l
|
|
1326
|
-
}), l;
|
|
1327
|
-
},
|
|
1328
|
-
_createGeometry: function(e) {
|
|
1329
|
-
var t = new a();
|
|
1330
|
-
e.index && t.setIndex(new i(e.index.array, 1));
|
|
1331
|
-
for (var n = 0; n < e.attributes.length; n++) {
|
|
1332
|
-
var r = e.attributes[n], o = r.name, s = r.array, c = r.itemSize;
|
|
1333
|
-
t.setAttribute(o, new i(s, c));
|
|
1334
|
-
}
|
|
1335
|
-
return t;
|
|
1336
|
-
},
|
|
1337
|
-
_loadLibrary: function(e, t) {
|
|
1338
|
-
var n = new d(this.manager);
|
|
1339
|
-
return n.setPath(this.decoderPath), n.setResponseType(t), new Promise((t, r) => {
|
|
1340
|
-
n.load(e, t, void 0, r);
|
|
1341
|
-
});
|
|
1342
|
-
},
|
|
1343
|
-
preload: function() {
|
|
1344
|
-
return this._initDecoder(), this;
|
|
1345
|
-
},
|
|
1346
|
-
_initDecoder: function() {
|
|
1347
|
-
if (this.decoderPending) return this.decoderPending;
|
|
1348
|
-
var e = typeof WebAssembly != "object" || this.decoderConfig.type === "js", t = [];
|
|
1349
|
-
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) => {
|
|
1350
|
-
var n = t[0];
|
|
1351
|
-
e || (this.decoderConfig.wasmBinary = t[1]);
|
|
1352
|
-
var r = W.DRACOWorker.toString(), i = [
|
|
1353
|
-
"/* draco decoder */",
|
|
1354
|
-
n,
|
|
1355
|
-
"",
|
|
1356
|
-
"/* worker */",
|
|
1357
|
-
r.substring(r.indexOf("{") + 1, r.lastIndexOf("}"))
|
|
1358
|
-
].join("\n");
|
|
1359
|
-
this.workerSourceURL = URL.createObjectURL(new Blob([i]));
|
|
1360
|
-
}), this.decoderPending;
|
|
1361
|
-
},
|
|
1362
|
-
_getWorker: function(e, t) {
|
|
1363
|
-
return this._initDecoder().then(() => {
|
|
1364
|
-
if (this.workerPool.length < this.workerLimit) {
|
|
1365
|
-
var n = new Worker(this.workerSourceURL);
|
|
1366
|
-
n._callbacks = {}, n._taskCosts = {}, n._taskLoad = 0, n.postMessage({
|
|
1367
|
-
type: "init",
|
|
1368
|
-
decoderConfig: this.decoderConfig
|
|
1369
|
-
}), n.onmessage = function(e) {
|
|
1370
|
-
var t = e.data;
|
|
1371
|
-
switch (t.type) {
|
|
1372
|
-
case "decode":
|
|
1373
|
-
n._callbacks[t.id].resolve(t);
|
|
1374
|
-
break;
|
|
1375
|
-
case "error":
|
|
1376
|
-
n._callbacks[t.id].reject(t);
|
|
1377
|
-
break;
|
|
1378
|
-
default: console.error("THREE.DRACOLoader: Unexpected message, \"" + t.type + "\"");
|
|
1379
|
-
}
|
|
1380
|
-
}, this.workerPool.push(n);
|
|
1381
|
-
} else this.workerPool.sort(function(e, t) {
|
|
1382
|
-
return e._taskLoad > t._taskLoad ? -1 : 1;
|
|
1383
|
-
});
|
|
1384
|
-
var n = this.workerPool[this.workerPool.length - 1];
|
|
1385
|
-
return n._taskCosts[e] = t, n._taskLoad += t, n;
|
|
1386
|
-
});
|
|
1387
|
-
},
|
|
1388
|
-
_releaseTask: function(e, t) {
|
|
1389
|
-
e._taskLoad -= e._taskCosts[t], delete e._callbacks[t], delete e._taskCosts[t];
|
|
1390
|
-
},
|
|
1391
|
-
debug: function() {
|
|
1392
|
-
console.log("Task load: ", this.workerPool.map((e) => e._taskLoad));
|
|
1393
|
-
},
|
|
1394
|
-
dispose: function() {
|
|
1395
|
-
for (var e = 0; e < this.workerPool.length; ++e) this.workerPool[e].terminate();
|
|
1396
|
-
return this.workerPool.length = 0, this;
|
|
1397
|
-
}
|
|
1398
|
-
}), W.DRACOWorker = function() {
|
|
1399
|
-
var e, t;
|
|
1400
|
-
onmessage = function(r) {
|
|
1401
|
-
var i = r.data;
|
|
1402
|
-
switch (i.type) {
|
|
1403
|
-
case "init":
|
|
1404
|
-
e = i.decoderConfig, t = new Promise(function(t) {
|
|
1405
|
-
e.onModuleLoaded = function(e) {
|
|
1406
|
-
t({ draco: e });
|
|
1407
|
-
}, DracoDecoderModule(e);
|
|
1408
|
-
});
|
|
1409
|
-
break;
|
|
1410
|
-
case "decode":
|
|
1411
|
-
var a = i.buffer, o = i.taskConfig;
|
|
1412
|
-
t.then((e) => {
|
|
1413
|
-
var t = e.draco, r = new t.Decoder(), s = new t.DecoderBuffer();
|
|
1414
|
-
s.Init(new Int8Array(a), a.byteLength);
|
|
1415
|
-
try {
|
|
1416
|
-
var c = n(t, r, s, o), l = c.attributes.map((e) => e.array.buffer);
|
|
1417
|
-
c.index && l.push(c.index.array.buffer), self.postMessage({
|
|
1418
|
-
type: "decode",
|
|
1419
|
-
id: i.id,
|
|
1420
|
-
geometry: c
|
|
1421
|
-
}, l);
|
|
1422
|
-
} catch (e) {
|
|
1423
|
-
console.error(e), self.postMessage({
|
|
1424
|
-
type: "error",
|
|
1425
|
-
id: i.id,
|
|
1426
|
-
error: e.message
|
|
1427
|
-
});
|
|
1428
|
-
} finally {
|
|
1429
|
-
t.destroy(s), t.destroy(r);
|
|
1430
|
-
}
|
|
1431
|
-
});
|
|
1432
|
-
break;
|
|
1433
|
-
}
|
|
1434
|
-
};
|
|
1435
|
-
function n(e, t, n, i) {
|
|
1436
|
-
var a = i.attributeIDs, o = i.attributeTypes, s, c, l = t.GetEncodedGeometryType(n);
|
|
1437
|
-
if (l === e.TRIANGULAR_MESH) s = new e.Mesh(), c = t.DecodeBufferToMesh(n, s);
|
|
1438
|
-
else if (l === e.POINT_CLOUD) s = new e.PointCloud(), c = t.DecodeBufferToPointCloud(n, s);
|
|
1439
|
-
else throw Error("THREE.DRACOLoader: Unexpected geometry type.");
|
|
1440
|
-
if (!c.ok() || s.ptr === 0) throw Error("THREE.DRACOLoader: Decoding failed: " + c.error_msg());
|
|
1441
|
-
var u = {
|
|
1442
|
-
index: null,
|
|
1443
|
-
attributes: []
|
|
1444
|
-
};
|
|
1445
|
-
for (var d in a) {
|
|
1446
|
-
var f = self[o[d]], p, m;
|
|
1447
|
-
if (i.useUniqueIDs) m = a[d], p = t.GetAttributeByUniqueId(s, m);
|
|
1448
|
-
else {
|
|
1449
|
-
if (m = t.GetAttributeId(s, e[a[d]]), m === -1) continue;
|
|
1450
|
-
p = t.GetAttribute(s, m);
|
|
1451
|
-
}
|
|
1452
|
-
u.attributes.push(r(e, t, s, d, f, p));
|
|
1453
|
-
}
|
|
1454
|
-
if (l === e.TRIANGULAR_MESH) {
|
|
1455
|
-
for (var h = s.num_faces(), g = h * 3, _ = new Uint32Array(g), v = new e.DracoInt32Array(), y = 0; y < h; ++y) {
|
|
1456
|
-
t.GetFaceFromMesh(s, y, v);
|
|
1457
|
-
for (var b = 0; b < 3; ++b) _[y * 3 + b] = v.GetValue(b);
|
|
1458
|
-
}
|
|
1459
|
-
u.index = {
|
|
1460
|
-
array: _,
|
|
1461
|
-
itemSize: 1
|
|
1462
|
-
}, e.destroy(v);
|
|
1463
|
-
}
|
|
1464
|
-
return e.destroy(s), u;
|
|
1465
|
-
}
|
|
1466
|
-
function r(e, t, n, r, i, a) {
|
|
1467
|
-
var o = a.num_components(), s = n.num_points() * o, c, l;
|
|
1468
|
-
switch (i) {
|
|
1469
|
-
case Float32Array:
|
|
1470
|
-
c = new e.DracoFloat32Array(), t.GetAttributeFloatForAllPoints(n, a, c), l = new Float32Array(s);
|
|
1471
|
-
break;
|
|
1472
|
-
case Int8Array:
|
|
1473
|
-
c = new e.DracoInt8Array(), t.GetAttributeInt8ForAllPoints(n, a, c), l = new Int8Array(s);
|
|
1474
|
-
break;
|
|
1475
|
-
case Int16Array:
|
|
1476
|
-
c = new e.DracoInt16Array(), t.GetAttributeInt16ForAllPoints(n, a, c), l = new Int16Array(s);
|
|
1477
|
-
break;
|
|
1478
|
-
case Int32Array:
|
|
1479
|
-
c = new e.DracoInt32Array(), t.GetAttributeInt32ForAllPoints(n, a, c), l = new Int32Array(s);
|
|
1480
|
-
break;
|
|
1481
|
-
case Uint8Array:
|
|
1482
|
-
c = new e.DracoUInt8Array(), t.GetAttributeUInt8ForAllPoints(n, a, c), l = new Uint8Array(s);
|
|
1483
|
-
break;
|
|
1484
|
-
case Uint16Array:
|
|
1485
|
-
c = new e.DracoUInt16Array(), t.GetAttributeUInt16ForAllPoints(n, a, c), l = new Uint16Array(s);
|
|
1486
|
-
break;
|
|
1487
|
-
case Uint32Array:
|
|
1488
|
-
c = new e.DracoUInt32Array(), t.GetAttributeUInt32ForAllPoints(n, a, c), l = new Uint32Array(s);
|
|
1489
|
-
break;
|
|
1490
|
-
default: throw Error("THREE.DRACOLoader: Unexpected attribute type.");
|
|
1491
|
-
}
|
|
1492
|
-
for (var u = 0; u < s; u++) l[u] = c.GetValue(u);
|
|
1493
|
-
return e.destroy(c), {
|
|
1494
|
-
name: r,
|
|
1495
|
-
array: l,
|
|
1496
|
-
itemSize: o
|
|
1497
|
-
};
|
|
1498
|
-
}
|
|
1499
|
-
}, W.taskCache = /* @__PURE__ */ new WeakMap(), W.setDecoderPath = function() {
|
|
1500
|
-
console.warn("THREE.DRACOLoader: The .setDecoderPath() method has been removed. Use instance methods.");
|
|
1501
|
-
}, W.setDecoderConfig = function() {
|
|
1502
|
-
console.warn("THREE.DRACOLoader: The .setDecoderConfig() method has been removed. Use instance methods.");
|
|
1503
|
-
}, W.releaseDecoderModule = function() {
|
|
1504
|
-
console.warn("THREE.DRACOLoader: The .releaseDecoderModule() method has been removed. Use instance methods.");
|
|
1505
|
-
}, W.getDecoderModule = function() {
|
|
1506
|
-
console.warn("THREE.DRACOLoader: The .getDecoderModule() method has been removed. Use instance methods.");
|
|
1507
|
-
};
|
|
1508
|
-
//#endregion
|
|
1509
|
-
//#region build/gltf-loader/thirdparty/DDSLoader.js
|
|
1510
|
-
var G = function(e) {
|
|
1511
|
-
c.call(this, e);
|
|
1512
|
-
};
|
|
1513
|
-
G.prototype = Object.assign(Object.create(c.prototype), {
|
|
1514
|
-
constructor: G,
|
|
1515
|
-
parse: function(e, t) {
|
|
1516
|
-
var n = {
|
|
1517
|
-
mipmaps: [],
|
|
1518
|
-
width: 0,
|
|
1519
|
-
height: 0,
|
|
1520
|
-
format: null,
|
|
1521
|
-
mipmapCount: 1
|
|
1522
|
-
}, r = 542327876, i = 131072, a = 512, o = 1024, s = 2048, c = 4096, l = 8192, u = 16384, d = 32768, f = 4;
|
|
1523
|
-
function p(e) {
|
|
1524
|
-
return e.charCodeAt(0) + (e.charCodeAt(1) << 8) + (e.charCodeAt(2) << 16) + (e.charCodeAt(3) << 24);
|
|
1525
|
-
}
|
|
1526
|
-
function m(e) {
|
|
1527
|
-
return String.fromCharCode(e & 255, e >> 8 & 255, e >> 16 & 255, e >> 24 & 255);
|
|
1528
|
-
}
|
|
1529
|
-
function h(e, t, n, r) {
|
|
1530
|
-
for (var i = n * r * 4, a = new Uint8Array(e, t, i), o = new Uint8Array(i), s = 0, c = 0, l = 0; l < r; l++) for (var u = 0; u < n; u++) {
|
|
1531
|
-
var d = a[c];
|
|
1532
|
-
c++;
|
|
1533
|
-
var f = a[c];
|
|
1534
|
-
c++;
|
|
1535
|
-
var p = a[c];
|
|
1536
|
-
c++;
|
|
1537
|
-
var m = a[c];
|
|
1538
|
-
c++, o[s] = p, s++, o[s] = f, s++, o[s] = d, s++, o[s] = m, s++;
|
|
1539
|
-
}
|
|
1540
|
-
return o;
|
|
1541
|
-
}
|
|
1542
|
-
var g = p("DXT1"), _ = p("DXT3"), v = p("DXT5"), y = p("ETC1"), b = 31, x = 0, S = 1, C = 2, w = 3, T = 4, E = 7, D = 20, O = 21, ee = 22, te = 23, ne = 24, k = 25, re = 26, ie = 28, A = new Int32Array(e, 0, b);
|
|
1543
|
-
if (A[x] !== r) return console.error("THREE.DDSLoader.parse: Invalid magic number in DDS header."), n;
|
|
1544
|
-
if (!A[D] & f) return console.error("THREE.DDSLoader.parse: Unsupported format, must contain a FourCC code."), n;
|
|
1545
|
-
var j, M = A[O], N = !1;
|
|
1546
|
-
switch (M) {
|
|
1547
|
-
case g:
|
|
1548
|
-
j = 8, n.format = V;
|
|
1549
|
-
break;
|
|
1550
|
-
case _:
|
|
1551
|
-
j = 16, n.format = B;
|
|
1552
|
-
break;
|
|
1553
|
-
case v:
|
|
1554
|
-
j = 16, n.format = ue;
|
|
1555
|
-
break;
|
|
1556
|
-
case y:
|
|
1557
|
-
j = 8, n.format = fe;
|
|
1558
|
-
break;
|
|
1559
|
-
default: if (A[ee] === 32 && A[te] & 16711680 && A[ne] & 65280 && A[k] & 255 && A[re] & 4278190080) N = !0, j = 64, n.format = le;
|
|
1560
|
-
else return console.error("THREE.DDSLoader.parse: Unsupported FourCC code ", m(M)), n;
|
|
1561
|
-
}
|
|
1562
|
-
n.mipmapCount = 1, A[C] & i && t !== !1 && (n.mipmapCount = Math.max(1, A[E]));
|
|
1563
|
-
var P = A[ie];
|
|
1564
|
-
if (n.isCubemap = !!(P & a), n.isCubemap && (!(P & o) || !(P & s) || !(P & c) || !(P & l) || !(P & u) || !(P & d))) return console.error("THREE.DDSLoader.parse: Incomplete cubemap faces"), n;
|
|
1565
|
-
n.width = A[T], n.height = A[w];
|
|
1566
|
-
for (var F = A[S] + 4, ae = n.isCubemap ? 6 : 1, I = 0; I < ae; I++) for (var L = n.width, R = n.height, z = 0; z < n.mipmapCount; z++) {
|
|
1567
|
-
if (N) var oe = h(e, F, L, R), se = oe.length;
|
|
1568
|
-
else var se = Math.max(4, L) / 4 * Math.max(4, R) / 4 * j, oe = new Uint8Array(e, F, se);
|
|
1569
|
-
var ce = {
|
|
1570
|
-
data: oe,
|
|
1571
|
-
width: L,
|
|
1572
|
-
height: R
|
|
1573
|
-
};
|
|
1574
|
-
n.mipmaps.push(ce), F += se, L = Math.max(L >> 1, 1), R = Math.max(R >> 1, 1);
|
|
1575
|
-
}
|
|
1576
|
-
return n;
|
|
1577
|
-
}
|
|
1578
|
-
});
|
|
1579
|
-
//#endregion
|
|
255
|
+
*/import { loadGltf as e } from "@realsee/five";
|
|
256
|
+
import * as t from "three";
|
|
1580
257
|
//#region build/gltf-loader/gltf-object.js
|
|
1581
|
-
var
|
|
1582
|
-
constructor(
|
|
1583
|
-
super(), this.needsRender = !0,
|
|
258
|
+
var n = class extends t.Group {
|
|
259
|
+
constructor(e) {
|
|
260
|
+
super(), this.needsRender = !0, e && e.children.length && this.add(...e.children), this.mixer = new t.AnimationMixer(this);
|
|
1584
261
|
}
|
|
1585
262
|
clone() {
|
|
1586
|
-
let
|
|
1587
|
-
return
|
|
263
|
+
let e = super.clone(!0);
|
|
264
|
+
return e.mixer = new t.AnimationMixer(e), e.needsRender = !0, e;
|
|
1588
265
|
}
|
|
1589
|
-
}
|
|
266
|
+
};
|
|
267
|
+
//#endregion
|
|
268
|
+
//#region build/gltf-loader/index.js
|
|
269
|
+
function r(e) {
|
|
270
|
+
let t = new n(e.scene);
|
|
271
|
+
return t.position.copy(e.scene.position), t.quaternion.copy(e.scene.quaternion), t.scale.copy(e.scene.scale), Object.assign(Object.assign({}, e), {
|
|
272
|
+
scene: t,
|
|
273
|
+
scenes: [t]
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
var i = class {
|
|
1590
277
|
static get version() {
|
|
1591
|
-
return "6.10.0-alpha.
|
|
1592
|
-
}
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
}
|
|
278
|
+
return "6.10.0-alpha.3";
|
|
279
|
+
}
|
|
280
|
+
load(t, n, i, a) {
|
|
281
|
+
e(t, {
|
|
282
|
+
modelUpAxis: "Y",
|
|
283
|
+
upAxis: "Y",
|
|
284
|
+
onDownloadProgress(e, t, n) {
|
|
285
|
+
i && i(new ProgressEvent("progress", {
|
|
286
|
+
lengthComputable: typeof n == "number",
|
|
287
|
+
loaded: t == null ? 0 : t,
|
|
288
|
+
total: n == null ? 0 : n
|
|
289
|
+
}));
|
|
290
|
+
}
|
|
291
|
+
}).then((e) => {
|
|
292
|
+
n(r(e));
|
|
293
|
+
}).catch((e) => {
|
|
294
|
+
a ? a(new ErrorEvent("error", {
|
|
295
|
+
error: e,
|
|
296
|
+
message: e instanceof Error ? e.message : String(e)
|
|
297
|
+
})) : console.error(e);
|
|
298
|
+
});
|
|
1607
299
|
}
|
|
1608
300
|
};
|
|
1609
301
|
//#endregion
|
|
1610
|
-
export {
|
|
302
|
+
export { i as GLTFLoader, n as GLTFObject };
|