@realsee/five 6.8.0-alpha.2 → 6.8.0-alpha.21
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/AGENTS_READ_ME.md +4 -0
- package/AI_CONTEXT.md +4 -0
- package/README.md +9 -6
- package/{guides → ai_guides}/README.md +12 -2
- package/ai_guides/ai-doc-guidelines.md +102 -0
- package/{guides → ai_guides}/api.md +24 -1
- package/ai_guides/features/3dtile.md +172 -0
- package/{guides → ai_guides}/features/camera-animation.md +24 -3
- package/{guides → ai_guides}/features/clipper.md +2 -0
- package/{guides/features/coordnate-system.md → ai_guides/features/coordinate-system.md} +2 -0
- package/{guides → ai_guides}/features/event.md +2 -0
- package/{guides → ai_guides}/features/five.md +4 -0
- package/ai_guides/features/flowing-light-2d-pass.md +438 -0
- package/ai_guides/features/flowing-light-3d-pass.md +420 -0
- package/ai_guides/features/gaussian-blur-pass.md +202 -0
- package/{guides → ai_guides}/features/gesture.md +3 -0
- package/{guides → ai_guides}/features/get-screen-pixels.md +2 -0
- package/{guides → ai_guides}/features/image-options.md +3 -0
- package/{guides → ai_guides}/features/load-external-model.md +21 -0
- package/ai_guides/features/load-progress.md +140 -0
- package/ai_guides/features/material.md +153 -0
- package/{guides → ai_guides}/features/mode.md +4 -0
- package/{guides → ai_guides}/features/model.md +4 -1
- package/{guides → ai_guides}/features/move-pano-effect.md +2 -0
- package/{guides → ai_guides}/features/multi-work.md +2 -0
- package/ai_guides/features/pano-filter.md +148 -0
- package/{guides → ai_guides}/features/pano-tile.md +7 -14
- package/ai_guides/features/pano-uv.md +131 -0
- package/ai_guides/features/parameter.md +153 -0
- package/ai_guides/features/plugin.md +210 -0
- package/{guides → ai_guides}/features/postprocessing.md +39 -4
- package/{guides → ai_guides}/features/raycast.md +11 -0
- package/{guides → ai_guides}/features/request-proxy.md +2 -0
- package/{guides → ai_guides}/features/screen-project.md +2 -0
- package/{guides → ai_guides}/features/state.md +2 -0
- package/ai_guides/features/view-layer.md +187 -0
- package/{guides → ai_guides}/features/work.md +63 -2
- package/{guides → ai_guides}/glossary.md +26 -5
- package/{guides → ai_guides}/intro.md +1 -1
- package/{guides → ai_guides}/quick-start.md +1 -0
- package/ai_guides/release_notes/6.8.md +208 -0
- package/{guides → ai_guides}/template.md +17 -3
- package/docs/00_FOR_AI_AGENTS.md +11 -0
- package/docs/README.md +4 -7
- 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.AdaptiveLuminancePass.html +7 -6
- package/docs/classes/five.BoundingMesh.html +2 -2
- package/docs/classes/five.Camera.html +1 -1
- package/docs/classes/five.EyeDomeLightingPass.html +1 -1
- package/docs/classes/five.Five.html +73 -72
- package/docs/classes/five.FivePass.html +1 -1
- package/docs/classes/five.Histogram.html +19 -0
- package/docs/classes/five.InternalWebGLRenderer.html +1 -1
- package/docs/classes/five.Model.html +31 -31
- 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 +42 -3
- package/docs/classes/five.PBMGSObject.html +5 -3
- package/docs/classes/five.PBMGroup.html +1 -1
- package/docs/classes/five.PBMMesh.html +1 -1
- package/docs/classes/five.PBMMeshMaterial.html +16 -7
- package/docs/classes/five.PBMPanoFilter.html +61 -0
- package/docs/classes/five.PBMPointCloud.html +1 -1
- package/docs/classes/five.PBMPointCloudMaterial.html +5 -6
- package/docs/classes/five.PBMSkinnedMesh.html +1 -1
- package/docs/classes/five.PBMUpdateable.html +41 -0
- 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 +57 -53
- package/docs/classes/five.Scene.html +1 -1
- package/docs/classes/five.Subscribe.html +1 -1
- package/docs/classes/five.Tile.html +1 -1
- package/docs/classes/five.Tile3D.html +30 -26
- package/docs/classes/five.TileNode.html +1 -1
- package/docs/classes/five.Trajectory.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 +27 -2
- package/docs/classes/gltf-loader.DDSLoader.html +1 -1
- package/docs/classes/gltf-loader.DRACOLoader.html +1 -1
- package/docs/classes/gltf-loader.GLTFLoader.html +1 -1
- package/docs/classes/gltf-loader.GLTFObject.html +1 -1
- package/docs/classes/gltf-loader.GLTFParser.html +1 -1
- package/docs/classes/gltf-loader.THREEGLTFLoader.html +1 -1
- 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/plugins.BasePlugin.Controller.html +1 -1
- package/docs/classes/plugins.RoundedBoxGeometry.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/documents/README.html +11 -2
- package/docs/documents/ai-doc-guidelines.html +60 -15
- package/docs/documents/api.html +40 -15
- package/docs/documents/features_3dtile.html +142 -45
- package/docs/documents/features_camera-animation.html +62 -5
- package/docs/documents/features_clipper.html +3 -0
- package/docs/documents/{features_coordnate-system.html → features_coordinate-system.html} +4 -1
- package/docs/documents/features_event.html +3 -0
- package/docs/documents/features_five.html +4 -0
- package/docs/documents/features_flowing-light-2d-pass.html +356 -0
- package/docs/documents/features_flowing-light-3d-pass.html +351 -0
- package/docs/documents/features_gaussian-blur-pass.html +182 -0
- package/docs/documents/features_gesture.html +4 -0
- package/docs/documents/features_get-screen-pixels.html +3 -0
- package/docs/documents/features_image-options.html +3 -0
- package/docs/documents/features_load-external-model.html +25 -2
- package/docs/documents/features_load-progress.html +110 -0
- package/docs/documents/features_material.html +341 -0
- package/docs/documents/features_mode.html +5 -0
- package/docs/documents/features_model.html +5 -1
- package/docs/documents/features_move-pano-effect.html +3 -0
- package/docs/documents/features_multi-work.html +3 -0
- package/docs/documents/features_pano-filter.html +122 -0
- package/docs/documents/features_pano-tile.html +34 -19
- package/docs/documents/features_pano-uv.html +82 -0
- package/docs/documents/features_parameter.html +76 -56
- package/docs/documents/features_plugin.html +105 -0
- package/docs/documents/features_postprocessing.html +22 -5
- package/docs/documents/features_raycast.html +4 -1
- package/docs/documents/features_request-proxy.html +3 -0
- package/docs/documents/features_screen-project.html +3 -0
- package/docs/documents/features_state.html +3 -0
- package/docs/documents/features_view-layer.html +158 -0
- package/docs/documents/features_work.html +63 -2
- package/docs/documents/glossary.html +31 -6
- package/docs/documents/intro.html +1 -1
- package/docs/documents/quick-start.html +1 -0
- package/docs/documents/release_notes_6.8.html +189 -0
- package/docs/documents/template.html +45 -4
- package/docs/functions/five.loadAt3d.html +1 -1
- package/docs/functions/five.loadB3dm.html +1 -1
- package/docs/functions/five.loadDome.html +1 -1
- package/docs/functions/five.loadDomez.html +1 -1
- package/docs/functions/five.loadFbx.html +1 -1
- package/docs/functions/five.loadGltf.html +1 -1
- package/docs/functions/five.loadPbm.html +1 -1
- package/docs/functions/five.loadPly.html +1 -1
- package/docs/functions/five.loadPnts.html +1 -1
- package/docs/functions/five.loadSplat.html +1 -1
- package/docs/functions/five.loadSpz.html +1 -1
- package/docs/functions/five.loadX3p.html +1 -1
- package/docs/functions/five.parseWork.html +1 -1
- package/docs/functions/vue.useFiveWorks.html +2 -2
- package/docs/hierarchy.html +1 -1
- package/docs/index.html +11 -2
- package/docs/interfaces/five.AddableObject.html +1 -1
- package/docs/interfaces/five.AjaxOptions.html +1 -1
- package/docs/interfaces/five.BaseEvent.html +2 -2
- package/docs/interfaces/five.EventCallback.html +53 -47
- package/docs/interfaces/five.FloorplanControllerCustomInitArgs.html +9 -9
- package/docs/interfaces/five.GestureEvent.html +2 -2
- package/docs/interfaces/five.ImageOptions.html +1 -1
- package/docs/interfaces/five.IntersectEvent.html +2 -2
- package/docs/interfaces/five.IntersectMesh.html +1 -1
- package/docs/interfaces/five.IntersectMeshInterface.html +1 -1
- package/docs/interfaces/five.Intersection.html +4 -3
- package/docs/interfaces/five.LooseWorkWithExtrinsics.html +6 -6
- package/docs/interfaces/five.MapviewControllerCustomInitArgs.html +9 -9
- package/docs/interfaces/five.ModeChangeEvent.html +2 -2
- package/docs/interfaces/five.ModelControllerCustomInitArgs.html +1 -1
- package/docs/interfaces/five.ModelEvent.html +2 -2
- package/docs/interfaces/five.ModelSceneEvent.html +2 -2
- package/docs/interfaces/five.ModelTileEvent.html +8 -0
- package/docs/interfaces/five.MovePanoOptions.html +7 -7
- 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 +2 -2
- package/docs/interfaces/five.NetworkResponseError.html +1 -1
- package/docs/interfaces/five.NetworkTimeoutError.html +1 -1
- package/docs/interfaces/five.ObjectEvent.html +2 -2
- package/docs/interfaces/five.PBMClipperParameter.html +2 -2
- package/docs/interfaces/five.PBMCustomShaderInitArgs.html +2 -2
- package/docs/interfaces/five.PBMCustomShaderSlots.html +2 -2
- package/docs/interfaces/five.PBMMaterial.html +1 -1
- package/docs/interfaces/five.PBMMeshMaterialParameters.html +5 -3
- package/docs/interfaces/five.PBMPanoDepth.html +5 -5
- package/docs/interfaces/five.PBMPanoFilterValue.html +6 -0
- package/docs/interfaces/five.PBMPanoPicture.html +8 -6
- package/docs/interfaces/five.PBMPointCloudMaterialParameters.html +2 -3
- package/docs/interfaces/five.PBMRefinedScreen.html +2 -2
- package/docs/interfaces/five.PanoCircleMeshInterface.html +1 -1
- package/docs/interfaces/five.PanoEvent.html +2 -2
- package/docs/interfaces/five.PanoTextureEvent.html +2 -2
- package/docs/interfaces/five.PanoramaControllerCustomInitArgs.html +1 -1
- package/docs/interfaces/five.PanoramaLikeControllerCustomInitArgs.html +1 -1
- package/docs/interfaces/five.ParameterMaterialValue.html +42 -38
- package/docs/interfaces/five.ParameterTilesetValue.html +15 -15
- package/docs/interfaces/five.ParameterValue.html +56 -52
- package/docs/interfaces/five.Pose.html +1 -1
- package/docs/interfaces/five.RenderEvent.html +2 -2
- package/docs/interfaces/five.ResolvedParameterValue.html +56 -52
- package/docs/interfaces/five.RgbaData.html +7 -0
- package/docs/interfaces/five.SplatData.html +2 -2
- package/docs/interfaces/five.State.html +1 -1
- package/docs/interfaces/five.StateEvent.html +2 -2
- package/docs/interfaces/five.TextureOptions.html +1 -1
- package/docs/interfaces/five.Tile3DOptions.html +2 -2
- package/docs/interfaces/five.TopviewControllerCustomInitArgs.html +7 -7
- package/docs/interfaces/five.VRPanoramaControllerCustomInitArgs.html +1 -1
- package/docs/interfaces/five.ViewLayer.html +30 -26
- package/docs/interfaces/five.WorkCubeImage.html +1 -1
- package/docs/interfaces/five.WorkImage.html +1 -1
- package/docs/interfaces/five.WorkModel.html +8 -8
- package/docs/interfaces/five.WorkModelLayer.html +6 -6
- package/docs/interfaces/five.WorkObserver.html +27 -2
- package/docs/interfaces/five.WorkTile.html +1 -1
- package/docs/interfaces/five.WorksEvent.html +2 -2
- package/docs/interfaces/five.XRControllerEvent.html +2 -2
- package/docs/interfaces/five.XRGestureEvent.html +2 -2
- package/docs/interfaces/five.XRPanoramaControllerCustomInitArgs.html +1 -1
- package/docs/interfaces/five.XRSessionEvent.html +2 -2
- package/docs/interfaces/plugins.BackgroundPluginController.html +1 -1
- package/docs/interfaces/plugins.BackgroundPluginType.EventMap.html +1 -1
- package/docs/interfaces/plugins.BasePlugin.State.html +1 -1
- package/docs/interfaces/plugins.DynamicPathLinePluginController.html +1 -1
- package/docs/interfaces/plugins.DynamicPathLinePluginType.EventMap.html +1 -1
- package/docs/interfaces/plugins.DynamicPathLinePluginType.State.html +1 -1
- package/docs/interfaces/plugins.ItemMaskController.html +1 -1
- package/docs/interfaces/plugins.ItemMaskPluginType.EventMap.html +1 -1
- package/docs/interfaces/plugins.ItemMaskPluginType.State.html +1 -1
- package/docs/interfaces/plugins.OrientationPluginController.html +1 -1
- package/docs/interfaces/plugins.OrientationPluginType.EventMap.html +1 -1
- package/docs/interfaces/plugins.OrientationPluginType.State.html +1 -1
- package/docs/interfaces/plugins.PanoAnimeController.html +1 -1
- package/docs/interfaces/plugins.PanoAnimePluginType.EventMap.html +1 -1
- package/docs/interfaces/plugins.PanoAnimePluginType.State.html +1 -1
- package/docs/interfaces/plugins.PluginTemplateType.EventMap.html +1 -1
- package/docs/interfaces/plugins.PluginTemplateType.State.html +1 -1
- package/docs/interfaces/plugins.TrajectoryController.html +1 -1
- package/docs/interfaces/react.FiveInjectionTypes.html +13 -13
- package/docs/modules/five.html +1 -1
- package/docs/modules.html +1 -1
- package/docs/types/five.ControllerEventTypes.html +27 -25
- package/docs/types/five.EasingFunction.html +1 -0
- package/docs/types/five.EventTypes.html +27 -25
- package/docs/types/five.FivePlugin.html +1 -1
- package/docs/types/five.FivePluginInit.html +1 -1
- package/docs/types/five.FivePluginInstance.html +1 -1
- package/docs/types/five.NetworkProgressCallback.html +1 -1
- package/docs/types/five.PBMAlphaMode.html +1 -1
- package/docs/types/five.PBMColorStyle.html +1 -1
- package/docs/types/five.PBMFloorStyle.html +1 -1
- package/docs/types/five.PBMMeshShaderType.html +1 -1
- package/docs/types/five.PBMPointBack.html +1 -1
- package/docs/types/five.PBMPointCloudShaderType.html +1 -1
- package/docs/types/five.PBMPointShape.html +1 -1
- package/docs/types/five.PBMPointSize.html +1 -1
- package/docs/types/five.PBMTransition.html +1 -1
- package/docs/types/five.ParseOptions.html +6 -6
- package/docs/types/plugins.BasePlugin.EventMap.html +1 -1
- package/docs/variables/five.PROXY_CONTROLLER_EVENT_NAMES.html +1 -1
- package/five/application/analysis.d.ts +40 -0
- package/five/application/controllers.d.ts +41 -0
- package/five/application/events-legacy.d.ts +454 -0
- package/five/application/events.d.ts +69 -0
- package/five/application/five.d.ts +519 -0
- package/five/application/fiveInitArgs.d.ts +176 -0
- package/five/application/fiveLoadOptions.d.ts +21 -0
- package/five/application/generateDefaultVideoElement.d.ts +2 -0
- package/five/application/getViewportScale.d.ts +2 -0
- package/five/application/initLights.d.ts +3 -0
- package/five/application/mode.d.ts +28 -0
- package/five/application/renderPoweredByRealsee.d.ts +3 -0
- package/five/assets/cardboard-png-data-url.d.ts +2 -0
- package/five/assets/gradient-png-data-url.d.ts +2 -0
- package/five/assets/loading-png-data-url.d.ts +2 -0
- package/five/assets/phone-png-data-url.d.ts +2 -0
- package/five/assets/realsee-png-data-url.d.ts +2 -0
- package/five/bvh/bvhMath.d.ts +33 -0
- package/five/bvh/bvhMesh.d.ts +7 -0
- package/five/bvh/bvhNode.d.ts +29 -0
- package/five/bvh/bvhObject.d.ts +18 -0
- package/five/bvh/bvhPoints.d.ts +6 -0
- package/five/bvh/index.d.ts +10 -0
- package/five/bvh/worker.d.ts +35 -0
- package/five/cardboard/helper.d.ts +2 -0
- package/five/cardboard/index.d.ts +13 -0
- package/five/cardboard/sensor.d.ts +158 -0
- package/five/certificates/hardware.d.ts +1 -0
- package/five/controllers/base.d.ts +167 -0
- package/five/controllers/events.d.ts +71 -0
- package/five/controllers/floorplan.d.ts +119 -0
- package/five/controllers/mapview.d.ts +139 -0
- package/five/controllers/model.d.ts +57 -0
- package/five/controllers/panorama.d.ts +143 -0
- package/five/controllers/panoramaLike.d.ts +87 -0
- package/five/controllers/topview.d.ts +42 -0
- package/five/controllers/vrPanorama.d.ts +56 -0
- package/five/controllers/xrPanorama.d.ts +81 -0
- package/five/core/camera.d.ts +65 -0
- package/five/core/internalWebGLRenderer.d.ts +14 -0
- package/five/core/panoVideo.d.ts +18 -0
- package/five/core/scene.d.ts +10 -0
- package/five/core/tiling.d.ts +43 -0
- package/five/declare.d.ts +2 -1
- package/five/gaussian-splatting/util/renderData.d.ts +52 -0
- package/five/gaussian-splatting/wasm/data.d.ts +20 -0
- package/five/gaussian-splatting/wasm/sort.d.ts +18 -0
- package/five/gaussian-splatting/worker/dataWorker.d.ts +1 -0
- package/five/gaussian-splatting/worker/sortWorker.d.ts +1 -0
- package/five/index.d.ts +60 -4637
- package/five/index.js +193 -341
- package/five/index.mjs +26455 -31011
- package/five/meshes/boundingMesh.d.ts +12 -0
- package/five/meshes/intersectMesh.d.ts +8 -0
- package/five/meshes/panoCircleMesh.d.ts +35 -0
- package/five/meshes/panoCircleMeshCustom.d.ts +40 -0
- package/five/meshes/panoCircleMeshSolid.d.ts +34 -0
- package/five/meshes/panoSphereMesh.d.ts +27 -0
- package/five/model/helpers/coordinate-transform.d.ts +3 -0
- package/five/model/helpers/ellipsoid-coordinates.d.ts +14 -0
- package/five/model/helpers/get-edges-by-sphere.d.ts +8 -0
- package/five/model/helpers/get-recommend-tile3d-parameters.d.ts +8 -0
- package/five/model/index.d.ts +70 -0
- package/five/model/intersection.d.ts +18 -0
- package/five/model/loaders/at3d.d.ts +12 -0
- package/five/model/loaders/b3dm.d.ts +9 -0
- package/five/model/loaders/dome.d.ts +22 -0
- package/five/model/loaders/domez.d.ts +11 -0
- package/five/model/loaders/fbx.d.ts +8 -0
- package/five/model/loaders/glTF-helpers/extensions/CESIUM_RTC.d.ts +9 -0
- package/five/model/loaders/glTF-helpers/extensions/EXT_meshopt_compression.d.ts +8 -0
- package/five/model/loaders/glTF-helpers/extensions/EXT_texture_webp.d.ts +11 -0
- package/five/model/loaders/glTF-helpers/extensions/KHR_animation_pointer.d.ts +6 -0
- package/five/model/loaders/glTF-helpers/extensions/KHR_binary_glTF.d.ts +25 -0
- package/five/model/loaders/glTF-helpers/extensions/KHR_draco_mesh_compression.d.ts +11 -0
- package/five/model/loaders/glTF-helpers/extensions/KHR_gaussian_splatting_compression_spz.d.ts +9 -0
- package/five/model/loaders/glTF-helpers/extensions/KHR_materials_clearcoat.d.ts +10 -0
- package/five/model/loaders/glTF-helpers/extensions/KHR_materials_emissive_strength.d.ts +10 -0
- package/five/model/loaders/glTF-helpers/extensions/KHR_materials_sheen.d.ts +10 -0
- package/five/model/loaders/glTF-helpers/extensions/KHR_materials_transmission.d.ts +10 -0
- package/five/model/loaders/glTF-helpers/extensions/KHR_materials_unlit.d.ts +10 -0
- package/five/model/loaders/glTF-helpers/extensions/KHR_mesh_quantization.d.ts +6 -0
- package/five/model/loaders/glTF-helpers/extensions/KHR_node_visibility.d.ts +10 -0
- package/five/model/loaders/glTF-helpers/extensions/KHR_texture_basisu.d.ts +9 -0
- package/five/model/loaders/glTF-helpers/extensions/KHR_texture_transform.d.ts +10 -0
- package/five/model/loaders/glTF-helpers/extensions/REALSEE_materials_lightmap.d.ts +7 -0
- package/five/model/loaders/glTF-helpers/extensions/base.d.ts +24 -0
- package/five/model/loaders/glTF-helpers/glTF.d.ts +713 -0
- package/five/model/loaders/glTF-helpers/index.d.ts +47 -0
- package/five/model/loaders/glTF-helpers/parser.d.ts +114 -0
- package/five/model/loaders/glTF-helpers/type.d.ts +14 -0
- package/five/model/loaders/gltf.d.ts +10 -0
- package/five/model/loaders/obj.d.ts +9 -0
- package/five/model/loaders/pbm.d.ts +26 -0
- package/five/model/loaders/ply.d.ts +24 -0
- package/five/model/loaders/pnts.d.ts +8 -0
- package/five/model/loaders/protobuf/dome.d.ts +540 -0
- package/five/model/loaders/protobuf/pbm.d.ts +203 -0
- package/five/model/loaders/shared.d.ts +16 -0
- package/five/model/loaders/splat.d.ts +8 -0
- package/five/model/loaders/spz.d.ts +14 -0
- package/five/model/loaders/tile3d-helpers/feature-table.d.ts +15 -0
- package/five/model/loaders/tile3d-helpers/gl-type.d.ts +20 -0
- package/five/model/loaders/tile3d-helpers/parse-gltf-array-buffer.d.ts +2 -0
- package/five/model/loaders/tile3d-helpers/parse-header.d.ts +2 -0
- package/five/model/loaders/tile3d-helpers/parse-point-cloud-attributes.d.ts +2 -0
- package/five/model/loaders/tile3d-helpers/parse-point-cloud-attributes.worker.d.ts +6 -0
- package/five/model/loaders/tile3d-helpers/parse-table.d.ts +3 -0
- package/five/model/loaders/tile3d-helpers/tile3d-type.d.ts +35 -0
- package/five/model/loaders/x3p.d.ts +22 -0
- package/five/model/materials/pbmMaterial.d.ts +137 -0
- package/five/model/materials/pbmMeshMaterial.d.ts +126 -0
- package/five/model/materials/pbmPointCloudMaterial.d.ts +70 -0
- package/five/model/model-scene.d.ts +172 -0
- package/five/model/model.d.ts +209 -0
- package/five/model/objects/pbmContainer.d.ts +28 -0
- package/five/model/objects/pbmGaussianSplattingObject.d.ts +43 -0
- package/five/model/objects/pbmGaussianSplattingRenderMesh.d.ts +55 -0
- package/five/model/objects/pbmGaussianSplattingTestMesh.d.ts +7 -0
- package/five/model/objects/pbmGroup.d.ts +8 -0
- package/five/model/objects/pbmMesh.d.ts +10 -0
- package/five/model/objects/pbmPointCloud.d.ts +7 -0
- package/five/model/parameter.d.ts +140 -0
- package/five/model/shaders/pbm_gaussian_splatting/fragment.d.ts +2 -0
- package/five/model/shaders/pbm_gaussian_splatting/vertex.d.ts +2 -0
- package/five/model/shaders/pbm_mesh_basic/fragment.d.ts +2 -0
- package/five/model/shaders/pbm_mesh_basic/vertex.d.ts +2 -0
- package/five/model/shaders/pbm_mesh_none/fragment.d.ts +2 -0
- package/five/model/shaders/pbm_mesh_none/vertex.d.ts +2 -0
- package/five/model/shaders/pbm_mesh_phong/fragment.d.ts +2 -0
- package/five/model/shaders/pbm_mesh_phong/vertex.d.ts +2 -0
- package/five/model/shaders/pbm_mesh_standard/fragment.d.ts +2 -0
- package/five/model/shaders/pbm_mesh_standard/vertex.d.ts +2 -0
- package/five/model/shaders/pbm_pointcloud/fragment.d.ts +2 -0
- package/five/model/shaders/pbm_pointcloud/vertex.d.ts +2 -0
- package/five/model/tile3d/header.d.ts +88 -0
- package/five/model/tile3d/index.d.ts +214 -0
- package/five/model/tile3d/tile-cache.d.ts +18 -0
- package/five/model/tile3d/tile-content.d.ts +10 -0
- package/five/model/tile3d/tile-node.d.ts +24 -0
- package/five/model/tile3d/tile-request-scheduler.d.ts +17 -0
- package/five/model/tile3d/tile.d.ts +79 -0
- package/five/model/tile3d/tileset-base-traverser.d.ts +59 -0
- package/five/model/tile3d/tileset-most-detail-traverser.d.ts +14 -0
- package/five/model/tile3d/tileset-normal-traverser.d.ts +15 -0
- package/five/model/tile3d/tileset-skip-traverser.d.ts +60 -0
- package/five/model/tile3d/tileset.d.ts +69 -0
- package/five/model/tile3d/trajectory-content.d.ts +9 -0
- package/five/model/tile3d/trajectory-node.d.ts +15 -0
- package/five/model/tile3d/trajectory.d.ts +30 -0
- package/five/model/tile3d/types.d.ts +33 -0
- package/five/model/view-layer.d.ts +20 -0
- package/five/renderer/five-renderer.d.ts +17 -0
- package/five/renderer/index.d.ts +3 -0
- package/five/renderer/postprocessing/composer.d.ts +37 -0
- package/five/renderer/postprocessing/index.d.ts +7 -0
- package/five/renderer/postprocessing/passes/adaptive-luminance-pass.d.ts +17 -0
- package/five/renderer/postprocessing/passes/eye-dome-lighting-pass.d.ts +14 -0
- package/five/renderer/postprocessing/passes/flowing-light-2d-pass.d.ts +36 -0
- package/five/renderer/postprocessing/passes/flowing-light-3d-pass.d.ts +36 -0
- package/five/renderer/postprocessing/passes/gaussian-blur-pass.d.ts +12 -0
- package/five/renderer/postprocessing/passes/pass.d.ts +38 -0
- package/five/renderer/scene-renderers/point-cloud-high-quality-scene-renderer.d.ts +11 -0
- package/five/renderer/scene-renderers/scene-renderer.d.ts +9 -0
- package/five/renderer/scene-renderers/ssaa-scene-renderer.d.ts +15 -0
- package/five/renderer/tools/full-screen-quad.d.ts +15 -0
- package/five/renderer/tools/render-cube-to-equirectangular.d.ts +7 -0
- package/five/renderer/tools/render-full-screen-depth.d.ts +2 -0
- package/five/renderer/tools/render-full-screen.d.ts +2 -0
- package/five/texture/histogram.d.ts +54 -0
- package/five/texture/imageBitmap.d.ts +13 -0
- package/five/texture/initTexture.d.ts +3 -0
- package/five/texture/loader.d.ts +39 -0
- package/five/texture/textureData.d.ts +11 -0
- package/five/thirdparty/fflate.d.ts +1407 -0
- package/five/thirdparty/hammer.d.ts +375 -0
- package/five/thirdparty/jsrsasign.d.ts +753 -0
- package/five/thirdparty/meshopt_decoder.d.ts +15 -0
- package/five/three-version-check.d.ts +1 -0
- package/five/types/addableObject.d.ts +12 -0
- package/five/types/cube.d.ts +1 -0
- package/five/types/gestureInput.d.ts +24 -0
- package/five/types/imageOptions.d.ts +20 -0
- package/five/types/intersectMeshInterface.d.ts +8 -0
- package/five/types/movePanoEffect.d.ts +13 -0
- package/five/types/movePanoOptions.d.ts +36 -0
- package/five/types/panoCircleMeshInterface.d.ts +34 -0
- package/five/types/plugin.d.ts +25 -0
- package/five/types/pose.d.ts +17 -0
- package/five/types/state.d.ts +20 -0
- package/five/types/viewport.d.ts +22 -0
- package/five/utils/ajax.d.ts +66 -0
- package/five/utils/animationFrameLoop.d.ts +45 -0
- package/five/utils/array.d.ts +31 -0
- package/five/utils/asyncTaskQueue.d.ts +8 -0
- package/five/utils/bufferGeometry.d.ts +33 -0
- package/five/utils/calculateProgress.d.ts +39 -0
- package/five/utils/calculateThreeMouse.d.ts +13 -0
- package/five/utils/canplayVideo.d.ts +2 -0
- package/five/utils/clamp.d.ts +2 -0
- package/five/utils/clock.d.ts +17 -0
- package/five/utils/createSymbol.d.ts +5 -0
- package/five/utils/decodeText.d.ts +2 -0
- package/five/utils/deepEqual.d.ts +2 -0
- package/five/utils/deepFreeze.d.ts +2 -0
- package/five/utils/defineProperty.d.ts +9 -0
- package/five/utils/detector.d.ts +14 -0
- package/five/utils/distance.d.ts +10 -0
- package/five/utils/draco.d.ts +26 -0
- package/five/utils/easing.d.ts +63 -0
- package/five/utils/event.d.ts +159 -0
- package/five/utils/formatRad.d.ts +7 -0
- package/five/utils/imageSupport.d.ts +6 -0
- package/five/utils/imageURL.d.ts +42 -0
- package/five/utils/isEmptyObject.d.ts +2 -0
- package/five/utils/isNil.d.ts +6 -0
- package/five/utils/isNumber.d.ts +2 -0
- package/five/utils/isPowerOfTwo.d.ts +2 -0
- package/five/utils/isPromise.d.ts +2 -0
- package/five/utils/isSimilar.d.ts +6 -0
- package/five/utils/json.d.ts +7 -0
- package/five/utils/ktx2.d.ts +30 -0
- package/five/utils/lzma/index.d.ts +2 -0
- package/five/utils/lzma/lzma.d.ts +3 -0
- package/five/utils/lzma/lzmaWASM.d.ts +2 -0
- package/five/utils/lzma/lzmaWorker.d.ts +14 -0
- package/five/utils/memoryUsage.d.ts +29 -0
- package/five/utils/motion.d.ts +38 -0
- package/five/utils/noop.d.ts +6 -0
- package/five/utils/now.d.ts +7 -0
- package/five/utils/pano.d.ts +9 -0
- package/five/utils/pick.d.ts +3 -0
- package/five/utils/poseUtils.d.ts +5 -0
- package/five/utils/renderCubeTextureToCubeRenderTarget.d.ts +3 -0
- package/five/utils/renderDepth.d.ts +2 -0
- package/five/utils/renderTexturesToCubeRenderTarget.d.ts +10 -0
- package/five/utils/requestPermission.d.ts +3 -0
- package/five/utils/shaderContentFix.d.ts +7 -0
- package/five/utils/shaderMaterial.d.ts +20 -0
- package/five/utils/stateUtils.d.ts +5 -0
- package/five/utils/string-pattern.d.ts +8 -0
- package/five/utils/subscribe.d.ts +67 -0
- package/five/utils/tileCube.d.ts +19 -0
- package/five/utils/toFastProperties.d.ts +1 -0
- package/five/utils/typedCache.d.ts +10 -0
- package/five/utils/uniform.d.ts +15 -0
- package/five/utils/url.d.ts +35 -0
- package/five/utils/uuid.d.ts +5 -0
- package/five/utils/values.d.ts +2 -0
- package/five/utils/vectorCoordinates.d.ts +29 -0
- package/five/utils/volume.d.ts +111 -0
- package/five/utils/webglError.d.ts +7 -0
- package/five/utils/worker.d.ts +26 -0
- package/five/webxr/XRControllerModelFactory.d.ts +28 -0
- package/five/webxr/motionHelper.d.ts +68 -0
- package/five/webxr/xrButton.d.ts +4 -0
- package/five/webxr/xrController.d.ts +24 -0
- package/five/webxr/xrManager.d.ts +84 -0
- package/five/work/_ALLOW_HOST.d.ts +2 -0
- package/five/work/index.d.ts +6 -0
- package/five/work/keychain.d.ts +5 -0
- package/five/work/looseWorkType.d.ts +121 -0
- package/five/work/verify.d.ts +7 -0
- package/five/work/work.d.ts +236 -0
- package/five/work/workFetcher.d.ts +4 -0
- package/five/work/workJson.d.ts +3 -0
- package/five/work/workJsonType.d.ts +73 -0
- package/five/work/workObserverUtils.d.ts +36 -0
- package/five/work/workParser.d.ts +6 -0
- package/five/work/workResolvedObserver.d.ts +12 -0
- package/five/work/workVerify.d.ts +2 -0
- package/five/work/works.d.ts +10 -0
- package/gltf-loader/gltf-object.d.ts +17 -0
- package/gltf-loader/index.d.ts +60 -160
- package/gltf-loader/index.js +9 -9
- package/gltf-loader/index.mjs +1351 -1451
- package/gltf-loader/thirdparty/DDSLoader.d.ts +23 -0
- package/gltf-loader/thirdparty/DRACOLoader.d.ts +18 -0
- package/gltf-loader/thirdparty/GLTFLoader.d.ts +59 -0
- package/line/circle_png.d.ts +1 -0
- package/line/index.d.ts +19 -69
- package/line/index.js +4 -4
- package/line/index.mjs +334 -513
- package/line/utils/Line2.d.ts +7 -0
- package/line/utils/LineGeometry.d.ts +10 -0
- package/line/utils/LineMaterial.d.ts +20 -0
- package/line/utils/LineSegments2.d.ts +11 -0
- package/line/utils/LineSegmentsGeometry.d.ts +15 -0
- package/llms.txt +43 -31
- package/package.json +11 -2
- package/plugins/BackgroundPlugin/Controller.d.ts +20 -0
- package/plugins/BackgroundPlugin/index.d.ts +5 -0
- package/plugins/BackgroundPlugin/typings.d.ts +44 -0
- package/plugins/BasePlugin/index.d.ts +119 -0
- package/plugins/DynamicPathLinePlugin/Controller.d.ts +167 -0
- package/plugins/DynamicPathLinePlugin/index.d.ts +5 -0
- package/plugins/DynamicPathLinePlugin/line2/Line2.d.ts +7 -0
- package/plugins/DynamicPathLinePlugin/line2/LineGeometry.d.ts +10 -0
- package/plugins/DynamicPathLinePlugin/line2/LineMaterial.d.ts +17 -0
- package/plugins/DynamicPathLinePlugin/line2/LineSegments2.d.ts +11 -0
- package/plugins/DynamicPathLinePlugin/line2/LineSegmentsGeometry.d.ts +15 -0
- package/plugins/DynamicPathLinePlugin/typing.d.ts +129 -0
- package/plugins/DynamicPathLinePlugin/typings.d.ts +72 -0
- package/plugins/ItemMaskPlugin/Controller.d.ts +48 -0
- package/plugins/ItemMaskPlugin/index.d.ts +5 -0
- package/plugins/ItemMaskPlugin/typing.d.ts +58 -0
- package/plugins/OrientationPlugin/Controller.d.ts +82 -0
- package/plugins/OrientationPlugin/RoundedBoxGeometry.d.ts +11 -0
- package/plugins/OrientationPlugin/index.d.ts +6 -0
- package/plugins/OrientationPlugin/typing.d.ts +25 -0
- package/plugins/PanoAnimePlugin/Controller.d.ts +46 -0
- package/plugins/PanoAnimePlugin/index.d.ts +5 -0
- package/plugins/PanoAnimePlugin/typing.d.ts +37 -0
- package/plugins/PluginTemplate/Controller.d.ts +27 -0
- package/plugins/PluginTemplate/index.d.ts +5 -0
- package/plugins/PluginTemplate/typing.d.ts +21 -0
- package/plugins/TrajectoryPlugin/Controller.d.ts +85 -0
- package/plugins/TrajectoryPlugin/index.d.ts +6 -0
- package/plugins/TrajectoryPlugin/typing.d.ts +25 -0
- package/plugins/index.d.ts +9 -1102
- package/plugins/index.js +17 -21
- package/plugins/index.mjs +3342 -4245
- package/plugins/thirdParty/CSS3DRenderer.d.ts +32 -0
- package/plugins/thirdParty/OrbitControls.d.ts +78 -0
- package/plugins/utils/absoluteUrl.d.ts +5 -0
- package/plugins/utils/clamp.d.ts +2 -0
- package/plugins/utils/loadImage.d.ts +1 -0
- package/plugins/utils/motion.d.ts +38 -0
- package/plugins/utils/now.d.ts +6 -0
- package/plugins/utils/uuid.d.ts +5 -0
- package/react/canvas.d.ts +19 -0
- package/react/context.d.ts +11 -0
- package/react/createProvider.d.ts +95 -0
- package/react/createStore.d.ts +144 -0
- package/react/hooks/unsafe__useFiveInstance.d.ts +9 -0
- package/react/hooks/useFiveAction.d.ts +147 -0
- package/react/hooks/useFiveCameraDirection.d.ts +7 -0
- package/react/hooks/useFiveCameraRaycaster.d.ts +7 -0
- package/react/hooks/useFiveCurrentObserver.d.ts +11 -0
- package/react/hooks/useFiveCurrentState.d.ts +15 -0
- package/react/hooks/useFiveEventCallback.d.ts +12 -0
- package/react/hooks/useFiveFloor.d.ts +15 -0
- package/react/hooks/useFiveHelper.d.ts +14 -0
- package/react/hooks/useFiveModelBounding.d.ts +5 -0
- package/react/hooks/useFiveModelEffect.d.ts +14 -0
- package/react/hooks/useFiveModelIntersectRaycaster.d.ts +22 -0
- package/react/hooks/useFiveModelReadyState.d.ts +8 -0
- package/react/hooks/useFiveProject2d.d.ts +20 -0
- package/react/hooks/useFiveSceneEffect.d.ts +21 -0
- package/react/hooks/useFiveState.d.ts +6 -0
- package/react/hooks/useFiveWork.d.ts +29 -0
- package/react/index.d.ts +24 -830
- package/react/index.js +3 -3
- package/react/index.mjs +572 -783
- package/react/rendererPool.d.ts +7 -0
- package/react/withFive.d.ts +213 -0
- package/shader-lib/EvenessPlane/index.d.ts +10 -0
- package/shader-lib/PointCloudExpand/index.d.ts +59 -0
- package/shader-lib/PolygonCuter/index.d.ts +52 -0
- package/shader-lib/PolygonCuter/worker.d.ts +14 -0
- package/shader-lib/ShineModel/index.d.ts +7 -0
- package/shader-lib/SweepModel/index.d.ts +7 -0
- package/shader-lib/index.d.ts +5 -86
- package/shader-lib/index.js +13 -14
- package/shader-lib/index.mjs +424 -824
- package/sticker/geometry.d.ts +3 -0
- package/sticker/index.d.ts +68 -71
- package/sticker/index.js +3 -3
- package/sticker/index.mjs +102 -142
- package/umd/five-gltf-loader.js +9 -9
- package/umd/five-line.js +4 -4
- package/umd/five-plugins.js +17 -21
- package/umd/five-react.js +3 -3
- package/umd/five-shader-lib.js +13 -14
- package/umd/five-sticker.js +3 -3
- package/umd/five-vfx.js +21 -21
- package/umd/five-vue.js +3 -3
- package/umd/five.js +188 -336
- package/vfx/airflow/airflow.d.ts +18 -0
- package/vfx/airflow/fragment-shader.d.ts +2 -0
- package/vfx/airflow/vertex-shader.d.ts +2 -0
- package/vfx/common/scale-shader.d.ts +2 -0
- package/vfx/common/simplex-noise-shader.d.ts +2 -0
- package/vfx/frame/fragment-shader.d.ts +2 -0
- package/vfx/frame/frame.d.ts +22 -0
- package/vfx/frame/vertex-shader.d.ts +2 -0
- package/vfx/index.d.ts +7 -363
- package/vfx/index.js +21 -21
- package/vfx/index.mjs +454 -910
- package/vfx/particle/fragment-shader.d.ts +2 -0
- package/vfx/particle/instance.d.ts +36 -0
- package/vfx/particle/particle.d.ts +205 -0
- package/vfx/particle/utils.d.ts +11 -0
- package/vfx/particle/vertex-shader.d.ts +2 -0
- package/vfx/particle-gpu/fragment-shader.d.ts +2 -0
- package/vfx/particle-gpu/instance.d.ts +36 -0
- package/vfx/particle-gpu/particle.d.ts +95 -0
- package/vfx/particle-gpu/utils.d.ts +11 -0
- package/vfx/particle-gpu/vertex-shader.d.ts +2 -0
- package/vfx/spotLight/fragment-shader.d.ts +2 -0
- package/vfx/spotLight/spotLight.d.ts +15 -0
- package/vfx/spotLight/vertex-shader.d.ts +2 -0
- package/vue/context.d.ts +7 -0
- package/vue/hooks/FiveCanvas.d.ts +36 -0
- package/vue/hooks/FiveProvider.d.ts +35 -0
- package/vue/hooks/unsafe__useFiveInject.d.ts +9 -0
- package/vue/hooks/useFiveAction.d.ts +178 -0
- package/vue/hooks/useFiveCameraDirection.d.ts +8 -0
- package/vue/hooks/useFiveCameraRaycaster.d.ts +8 -0
- package/vue/hooks/useFiveCurrentObserver.d.ts +12 -0
- package/vue/hooks/useFiveCurrentState.d.ts +16 -0
- package/vue/hooks/useFiveEventCallback.d.ts +11 -0
- package/vue/hooks/useFiveFloor.d.ts +16 -0
- package/vue/hooks/useFiveHelper.d.ts +15 -0
- package/vue/hooks/useFiveModel.d.ts +7 -0
- package/vue/hooks/useFiveModelBounding.d.ts +7 -0
- package/vue/hooks/useFiveModelIntersectRaycaster.d.ts +23 -0
- package/vue/hooks/useFiveModelReadyState.d.ts +9 -0
- package/vue/hooks/useFiveProject2d.d.ts +26 -0
- package/vue/hooks/useFiveScene.d.ts +6 -0
- package/vue/hooks/useFiveState.d.ts +16 -0
- package/vue/hooks/useFiveWork.d.ts +30 -0
- package/vue/index.d.ts +23 -467
- package/vue/index.js +3 -3
- package/vue/index.mjs +309 -301
- package/vue/rendererPool.d.ts +10 -0
- package/work-downloader/components/model-3d-tile.d.ts +2 -0
- package/work-downloader/components/model.d.ts +3 -0
- package/work-downloader/components/observer.d.ts +7 -0
- package/work-downloader/download.d.ts +16 -0
- package/work-downloader/index.d.ts +2 -33
- package/work-downloader/index.js +3 -3
- package/work-downloader/index.mjs +317 -556
- package/work-downloader/type.d.ts +28 -0
- package/work-downloader/utils/download-to-file.d.ts +1 -0
- package/work-downloader/utils/image-processing.d.ts +7 -0
- package/work-downloader/utils/join-url.d.ts +2 -0
- package/work-downloader/utils/log.d.ts +1 -0
- package/work-downloader/utils/relative-url.d.ts +1 -0
- package/docs/documents/five.FivePlugin.plugin.html +0 -60
- package/docs/documents/plugin.html +0 -60
- package/docs/media/five.ts +0 -2881
- package/docs/media/pass.ts +0 -64
- package/guides/ai-doc-guidelines.md +0 -72
- package/guides/features/3dtile.md +0 -264
- package/guides/features/parameter.md +0 -178
- package/guides/plugin.md +0 -206
- /package/{guides → ai_guides}/release_notes/6.6.md +0 -0
- /package/{guides → ai_guides}/release_notes/6.7.md +0 -0
- /package/{guides → ai_guides}/support.md +0 -0
package/gltf-loader/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
3
|
* @realsee/five
|
|
4
|
-
* Generated:
|
|
5
|
-
* Version: 6.8.0-alpha.
|
|
4
|
+
* Generated: 3/19/2026
|
|
5
|
+
* Version: 6.8.0-alpha.21
|
|
6
6
|
* Terms:
|
|
7
7
|
* Realsee SDK License Agreement
|
|
8
8
|
* Update: July 28, 2021
|
|
@@ -252,1457 +252,1357 @@
|
|
|
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
|
-
import {
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
255
|
+
*/import * as e from "three";
|
|
256
|
+
import { AnimationClip as t, Bone as n, Box3 as r, BufferAttribute as i, BufferGeometry as a, ClampToEdgeWrapping as o, Color as s, CompressedTextureLoader as c, DirectionalLight as l, DoubleSide as u, FileLoader as d, FrontSide as f, Group as p, InterleavedBuffer as m, InterleavedBufferAttribute as h, Interpolant as g, InterpolateDiscrete as _, InterpolateLinear as v, Line as y, LineBasicMaterial as b, LineLoop as x, LineSegments as S, LinearFilter as C, LinearMipmapLinearFilter as w, LinearMipmapNearestFilter as T, Loader as E, LoaderUtils as D, Material as O, MathUtils as ee, Matrix4 as te, Mesh as ne, MeshBasicMaterial as k, MeshPhongMaterial as re, MeshPhysicalMaterial as ie, MeshStandardMaterial as A, MirroredRepeatWrapping as j, NearestFilter as M, NearestMipmapLinearFilter as N, NearestMipmapNearestFilter as P, NumberKeyframeTrack as F, Object3D as ae, OrthographicCamera as I, PerspectiveCamera as L, PointLight as R, Points as z, PointsMaterial as oe, PropertyBinding as se, QuaternionKeyframeTrack as ce, RGBAFormat as le, RGBA_S3TC_DXT3_Format as B, RGBA_S3TC_DXT5_Format as ue, RGBFormat as de, RGB_ETC1_Format as fe, RGB_S3TC_DXT1_Format as V, RepeatWrapping as pe, Skeleton as me, SkinnedMesh as he, Sphere as ge, SpotLight as _e, TangentSpaceNormalMap as ve, TextureLoader as ye, TriangleFanDrawMode as be, TriangleStripDrawMode as xe, Vector2 as Se, Vector3 as H, VectorKeyframeTrack as Ce, sRGBEncoding as we } from "three";
|
|
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, this.lightDefs = (e.extensions && e.extensions[B.KHR_LIGHTS_PUNCTUAL] || {}).lights || [];
|
|
383
|
+
}
|
|
384
|
+
fe.prototype.loadLight = function(e) {
|
|
385
|
+
var t = this.lightDefs[e], n, r = new s(16777215);
|
|
386
|
+
t.color !== void 0 && r.fromArray(t.color);
|
|
387
|
+
var i = t.range === void 0 ? 0 : t.range;
|
|
388
|
+
switch (t.type) {
|
|
389
|
+
case "directional":
|
|
390
|
+
n = new l(r), n.target.position.set(0, 0, -1), n.add(n.target);
|
|
391
|
+
break;
|
|
392
|
+
case "point":
|
|
393
|
+
n = new R(r), n.distance = i;
|
|
394
|
+
break;
|
|
395
|
+
case "spot":
|
|
396
|
+
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);
|
|
397
|
+
break;
|
|
398
|
+
default: throw Error("THREE.GLTFLoader: Unexpected light type, \"" + t.type + "\".");
|
|
399
|
+
}
|
|
400
|
+
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);
|
|
401
|
+
};
|
|
402
|
+
function V() {
|
|
403
|
+
this.name = B.KHR_MATERIALS_UNLIT;
|
|
404
|
+
}
|
|
405
|
+
V.prototype.getMaterialType = function() {
|
|
406
|
+
return k;
|
|
407
|
+
}, V.prototype.extendParams = function(e, t, n) {
|
|
408
|
+
var r = [];
|
|
409
|
+
e.color = new s(1, 1, 1), e.opacity = 1;
|
|
410
|
+
var i = t.pbrMetallicRoughness;
|
|
411
|
+
if (i) {
|
|
412
|
+
if (Array.isArray(i.baseColorFactor)) {
|
|
413
|
+
var a = i.baseColorFactor;
|
|
414
|
+
e.color.fromArray(a), e.opacity = a[3];
|
|
415
|
+
}
|
|
416
|
+
i.baseColorTexture !== void 0 && r.push(n.assignTexture(e, "map", i.baseColorTexture));
|
|
417
|
+
}
|
|
418
|
+
return Promise.all(r);
|
|
419
|
+
};
|
|
420
|
+
function U() {
|
|
421
|
+
this.name = B.KHR_MATERIALS_CLEARCOAT;
|
|
422
|
+
}
|
|
423
|
+
U.prototype.getMaterialType = function() {
|
|
424
|
+
return ie;
|
|
425
|
+
}, U.prototype.extendParams = function(e, t, n) {
|
|
426
|
+
var r = [], i = t.extensions[this.name];
|
|
427
|
+
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)) {
|
|
428
|
+
var a = i.clearcoatNormalTexture.scale;
|
|
429
|
+
e.clearcoatNormalScale = new Se(a, a);
|
|
430
|
+
}
|
|
431
|
+
return Promise.all(r);
|
|
432
|
+
};
|
|
433
|
+
function W() {
|
|
434
|
+
this.name = B.KHR_MATERIALS_TRANSMISSION;
|
|
435
|
+
}
|
|
436
|
+
W.prototype.getMaterialType = function() {
|
|
437
|
+
return ie;
|
|
438
|
+
}, W.prototype.extendParams = function(e, t, n) {
|
|
439
|
+
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([]);
|
|
440
|
+
};
|
|
441
|
+
var G = "glTF", K = 12, Te = {
|
|
442
|
+
JSON: 1313821514,
|
|
443
|
+
BIN: 5130562
|
|
444
|
+
};
|
|
445
|
+
function Ee(e) {
|
|
446
|
+
this.name = B.KHR_BINARY_GLTF, this.content = null, this.body = null;
|
|
447
|
+
var t = new DataView(e, 0, K);
|
|
448
|
+
if (this.header = {
|
|
449
|
+
magic: D.decodeText(new Uint8Array(e.slice(0, 4))),
|
|
450
|
+
version: t.getUint32(4, !0),
|
|
451
|
+
length: t.getUint32(8, !0)
|
|
452
|
+
}, this.header.magic !== G) throw Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");
|
|
453
|
+
if (this.header.version < 2) throw Error("THREE.GLTFLoader: Legacy binary file detected.");
|
|
454
|
+
for (var n = new DataView(e, K), r = 0; r < n.byteLength;) {
|
|
455
|
+
var i = n.getUint32(r, !0);
|
|
456
|
+
r += 4;
|
|
457
|
+
var a = n.getUint32(r, !0);
|
|
458
|
+
if (r += 4, a === Te.JSON) {
|
|
459
|
+
var o = new Uint8Array(e, K + r, i);
|
|
460
|
+
this.content = D.decodeText(o);
|
|
461
|
+
} else if (a === Te.BIN) {
|
|
462
|
+
var s = K + r;
|
|
463
|
+
this.body = e.slice(s, s + i);
|
|
464
|
+
}
|
|
465
|
+
r += i;
|
|
466
|
+
}
|
|
467
|
+
if (this.content === null) throw Error("THREE.GLTFLoader: JSON content not found.");
|
|
468
|
+
}
|
|
469
|
+
function De(e, t) {
|
|
470
|
+
if (!t) throw Error("THREE.GLTFLoader: No DRACOLoader instance provided.");
|
|
471
|
+
this.name = B.KHR_DRACO_MESH_COMPRESSION, this.json = e, this.dracoLoader = t, this.dracoLoader.preload();
|
|
472
|
+
}
|
|
473
|
+
De.prototype.decodePrimitive = function(e, t) {
|
|
474
|
+
var n = this.json, r = this.dracoLoader, i = e.extensions[this.name].bufferView, a = e.extensions[this.name].attributes, o = {}, s = {}, c = {};
|
|
475
|
+
for (var l in a) {
|
|
476
|
+
var u = Ie[l] || l.toLowerCase();
|
|
477
|
+
o[u] = a[l];
|
|
478
|
+
}
|
|
479
|
+
for (l in e.attributes) {
|
|
480
|
+
var u = Ie[l] || l.toLowerCase();
|
|
481
|
+
if (a[l] !== void 0) {
|
|
482
|
+
var d = n.accessors[e.attributes[l]];
|
|
483
|
+
c[u] = Me[d.componentType], s[u] = d.normalized === !0;
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
return t.getDependency("bufferView", i).then(function(e) {
|
|
487
|
+
return new Promise(function(t) {
|
|
488
|
+
r.decodeDracoFile(e, function(e) {
|
|
489
|
+
for (var n in e.attributes) {
|
|
490
|
+
var r = e.attributes[n], i = s[n];
|
|
491
|
+
i !== void 0 && (r.normalized = i);
|
|
492
|
+
}
|
|
493
|
+
t(e);
|
|
494
|
+
}, o, c);
|
|
495
|
+
});
|
|
496
|
+
});
|
|
497
|
+
};
|
|
498
|
+
function Oe() {
|
|
499
|
+
this.name = B.KHR_TEXTURE_TRANSFORM;
|
|
500
|
+
}
|
|
501
|
+
Oe.prototype.extendTexture = function(e, t) {
|
|
502
|
+
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;
|
|
503
|
+
};
|
|
504
|
+
function q(e) {
|
|
505
|
+
A.call(this), this.isGLTFSpecularGlossinessMaterial = !0;
|
|
506
|
+
var t = [
|
|
507
|
+
"#ifdef USE_SPECULARMAP",
|
|
508
|
+
" uniform sampler2D specularMap;",
|
|
509
|
+
"#endif"
|
|
510
|
+
].join("\n"), n = [
|
|
511
|
+
"#ifdef USE_GLOSSINESSMAP",
|
|
512
|
+
" uniform sampler2D glossinessMap;",
|
|
513
|
+
"#endif"
|
|
514
|
+
].join("\n"), r = [
|
|
515
|
+
"vec3 specularFactor = specular;",
|
|
516
|
+
"#ifdef USE_SPECULARMAP",
|
|
517
|
+
" vec4 texelSpecular = texture2D( specularMap, vUv );",
|
|
518
|
+
" texelSpecular = sRGBToLinear( texelSpecular );",
|
|
519
|
+
" // reads channel RGB, compatible with a glTF Specular-Glossiness (RGBA) texture",
|
|
520
|
+
" specularFactor *= texelSpecular.rgb;",
|
|
521
|
+
"#endif"
|
|
522
|
+
].join("\n"), i = [
|
|
523
|
+
"float glossinessFactor = glossiness;",
|
|
524
|
+
"#ifdef USE_GLOSSINESSMAP",
|
|
525
|
+
" vec4 texelGlossiness = texture2D( glossinessMap, vUv );",
|
|
526
|
+
" // reads channel A, compatible with a glTF Specular-Glossiness (RGBA) texture",
|
|
527
|
+
" glossinessFactor *= texelGlossiness.a;",
|
|
528
|
+
"#endif"
|
|
529
|
+
].join("\n"), a = [
|
|
530
|
+
"PhysicalMaterial material;",
|
|
531
|
+
"material.diffuseColor = diffuseColor.rgb;",
|
|
532
|
+
"vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );",
|
|
533
|
+
"float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );",
|
|
534
|
+
"material.specularRoughness = max( 1.0 - glossinessFactor, 0.0525 );// 0.0525 corresponds to the base mip of a 256 cubemap.",
|
|
535
|
+
"material.specularRoughness += geometryRoughness;",
|
|
536
|
+
"material.specularRoughness = min( material.specularRoughness, 1.0 );",
|
|
537
|
+
"material.specularColor = specularFactor.rgb;"
|
|
538
|
+
].join("\n"), o = {
|
|
539
|
+
specular: { value: new s().setHex(16777215) },
|
|
540
|
+
glossiness: { value: 1 },
|
|
541
|
+
specularMap: { value: null },
|
|
542
|
+
glossinessMap: { value: null }
|
|
543
|
+
};
|
|
544
|
+
this._extraUniforms = o, this.onBeforeCompile = function(e) {
|
|
545
|
+
for (var s in o) e.uniforms[s] = o[s];
|
|
546
|
+
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);
|
|
547
|
+
}, Object.defineProperties(this, {
|
|
548
|
+
specular: {
|
|
549
|
+
get: function() {
|
|
550
|
+
return o.specular.value;
|
|
551
|
+
},
|
|
552
|
+
set: function(e) {
|
|
553
|
+
o.specular.value = e;
|
|
554
|
+
}
|
|
555
|
+
},
|
|
556
|
+
specularMap: {
|
|
557
|
+
get: function() {
|
|
558
|
+
return o.specularMap.value;
|
|
559
|
+
},
|
|
560
|
+
set: function(e) {
|
|
561
|
+
o.specularMap.value = e;
|
|
562
|
+
}
|
|
563
|
+
},
|
|
564
|
+
glossiness: {
|
|
565
|
+
get: function() {
|
|
566
|
+
return o.glossiness.value;
|
|
567
|
+
},
|
|
568
|
+
set: function(e) {
|
|
569
|
+
o.glossiness.value = e;
|
|
570
|
+
}
|
|
571
|
+
},
|
|
572
|
+
glossinessMap: {
|
|
573
|
+
get: function() {
|
|
574
|
+
return o.glossinessMap.value;
|
|
575
|
+
},
|
|
576
|
+
set: function(e) {
|
|
577
|
+
o.glossinessMap.value = e, e ? (this.defines.USE_GLOSSINESSMAP = "", this.defines.USE_ROUGHNESSMAP = "") : (delete this.defines.USE_ROUGHNESSMAP, delete this.defines.USE_GLOSSINESSMAP);
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
}), delete this.metalness, delete this.roughness, delete this.metalnessMap, delete this.roughnessMap, this.setValues(e);
|
|
581
|
+
}
|
|
582
|
+
q.prototype = Object.create(A.prototype), q.prototype.constructor = q, q.prototype.copy = function(e) {
|
|
583
|
+
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;
|
|
584
|
+
};
|
|
585
|
+
function ke() {
|
|
586
|
+
return {
|
|
587
|
+
name: B.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS,
|
|
588
|
+
specularGlossinessParams: [
|
|
589
|
+
"color",
|
|
590
|
+
"map",
|
|
591
|
+
"lightMap",
|
|
592
|
+
"lightMapIntensity",
|
|
593
|
+
"aoMap",
|
|
594
|
+
"aoMapIntensity",
|
|
595
|
+
"emissive",
|
|
596
|
+
"emissiveIntensity",
|
|
597
|
+
"emissiveMap",
|
|
598
|
+
"bumpMap",
|
|
599
|
+
"bumpScale",
|
|
600
|
+
"normalMap",
|
|
601
|
+
"normalMapType",
|
|
602
|
+
"displacementMap",
|
|
603
|
+
"displacementScale",
|
|
604
|
+
"displacementBias",
|
|
605
|
+
"specularMap",
|
|
606
|
+
"specular",
|
|
607
|
+
"glossinessMap",
|
|
608
|
+
"glossiness",
|
|
609
|
+
"alphaMap",
|
|
610
|
+
"envMap",
|
|
611
|
+
"envMapIntensity",
|
|
612
|
+
"refractionRatio"
|
|
613
|
+
],
|
|
614
|
+
getMaterialType: function() {
|
|
615
|
+
return q;
|
|
616
|
+
},
|
|
617
|
+
extendParams: function(e, t, n) {
|
|
618
|
+
var r = t.extensions[this.name];
|
|
619
|
+
e.color = new s(1, 1, 1), e.opacity = 1;
|
|
620
|
+
var i = [];
|
|
621
|
+
if (Array.isArray(r.diffuseFactor)) {
|
|
622
|
+
var a = r.diffuseFactor;
|
|
623
|
+
e.color.fromArray(a), e.opacity = a[3];
|
|
624
|
+
}
|
|
625
|
+
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) {
|
|
626
|
+
var o = r.specularGlossinessTexture;
|
|
627
|
+
i.push(n.assignTexture(e, "glossinessMap", o)), i.push(n.assignTexture(e, "specularMap", o));
|
|
628
|
+
}
|
|
629
|
+
return Promise.all(i);
|
|
630
|
+
},
|
|
631
|
+
createMaterial: function(e) {
|
|
632
|
+
var t = new q(e);
|
|
633
|
+
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;
|
|
634
|
+
}
|
|
635
|
+
};
|
|
636
|
+
}
|
|
637
|
+
function Ae() {
|
|
638
|
+
this.name = B.KHR_MESH_QUANTIZATION;
|
|
639
|
+
}
|
|
640
|
+
function J(e, t, n, r) {
|
|
641
|
+
g.call(this, e, t, n, r);
|
|
642
|
+
}
|
|
643
|
+
J.prototype = Object.create(g.prototype), J.prototype.constructor = J, J.prototype.copySampleValue_ = function(e) {
|
|
644
|
+
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];
|
|
645
|
+
return t;
|
|
646
|
+
}, J.prototype.beforeStart_ = J.prototype.copySampleValue_, J.prototype.afterEnd_ = J.prototype.copySampleValue_, J.prototype.interpolate_ = function(e, t, n, r) {
|
|
647
|
+
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++) {
|
|
648
|
+
var b = a[m + y + o], x = a[m + y + s] * l, S = a[p + y + o], C = a[p + y] * l;
|
|
649
|
+
i[y] = _ * b + v * x + h * S + g * C;
|
|
650
|
+
}
|
|
651
|
+
return i;
|
|
652
|
+
};
|
|
653
|
+
function je(e) {
|
|
654
|
+
this.parser = e, this.name = B.REALSEE_MATERIALS_LIGHTMAP;
|
|
655
|
+
}
|
|
656
|
+
je.prototype.getMaterialType = function(e) {
|
|
657
|
+
return re;
|
|
658
|
+
}, je.prototype.extendParams = function(e, t, n) {
|
|
659
|
+
if (!t.extensions || !t.extensions[this.name]) return Promise.resolve();
|
|
660
|
+
var r = [], i = t.extensions[this.name];
|
|
661
|
+
return i.lightMapTexture !== void 0 && r.push(n.assignTexture(e, "lightMap", i.lightMapTexture)), i.lightMapIntensity !== void 0 && (e.lightMapIntensity = i.lightMapIntensity), Promise.all(r);
|
|
662
|
+
};
|
|
663
|
+
var Y = {
|
|
664
|
+
FLOAT: 5126,
|
|
665
|
+
FLOAT_MAT3: 35675,
|
|
666
|
+
FLOAT_MAT4: 35676,
|
|
667
|
+
FLOAT_VEC2: 35664,
|
|
668
|
+
FLOAT_VEC3: 35665,
|
|
669
|
+
FLOAT_VEC4: 35666,
|
|
670
|
+
LINEAR: 9729,
|
|
671
|
+
REPEAT: 10497,
|
|
672
|
+
SAMPLER_2D: 35678,
|
|
673
|
+
POINTS: 0,
|
|
674
|
+
LINES: 1,
|
|
675
|
+
LINE_LOOP: 2,
|
|
676
|
+
LINE_STRIP: 3,
|
|
677
|
+
TRIANGLES: 4,
|
|
678
|
+
TRIANGLE_STRIP: 5,
|
|
679
|
+
TRIANGLE_FAN: 6,
|
|
680
|
+
UNSIGNED_BYTE: 5121,
|
|
681
|
+
UNSIGNED_SHORT: 5123
|
|
682
|
+
}, Me = {
|
|
683
|
+
5120: Int8Array,
|
|
684
|
+
5121: Uint8Array,
|
|
685
|
+
5122: Int16Array,
|
|
686
|
+
5123: Uint16Array,
|
|
687
|
+
5125: Uint32Array,
|
|
688
|
+
5126: Float32Array
|
|
689
|
+
}, Ne = {
|
|
690
|
+
9728: M,
|
|
691
|
+
9729: C,
|
|
692
|
+
9984: P,
|
|
693
|
+
9985: T,
|
|
694
|
+
9986: N,
|
|
695
|
+
9987: w
|
|
696
|
+
}, Pe = {
|
|
697
|
+
33071: o,
|
|
698
|
+
33648: j,
|
|
699
|
+
10497: pe
|
|
700
|
+
}, Fe = {
|
|
701
|
+
SCALAR: 1,
|
|
702
|
+
VEC2: 2,
|
|
703
|
+
VEC3: 3,
|
|
704
|
+
VEC4: 4,
|
|
705
|
+
MAT2: 4,
|
|
706
|
+
MAT3: 9,
|
|
707
|
+
MAT4: 16
|
|
708
|
+
}, Ie = {
|
|
709
|
+
POSITION: "position",
|
|
710
|
+
NORMAL: "normal",
|
|
711
|
+
TANGENT: "tangent",
|
|
712
|
+
TEXCOORD_0: "uv",
|
|
713
|
+
TEXCOORD_1: "uv2",
|
|
714
|
+
COLOR_0: "color",
|
|
715
|
+
WEIGHTS_0: "skinWeight",
|
|
716
|
+
JOINTS_0: "skinIndex"
|
|
717
|
+
}, X = {
|
|
718
|
+
scale: "scale",
|
|
719
|
+
translation: "position",
|
|
720
|
+
rotation: "quaternion",
|
|
721
|
+
weights: "morphTargetInfluences"
|
|
722
|
+
}, Le = {
|
|
723
|
+
CUBICSPLINE: void 0,
|
|
724
|
+
LINEAR: v,
|
|
725
|
+
STEP: _
|
|
726
|
+
}, Re = {
|
|
727
|
+
OPAQUE: "OPAQUE",
|
|
728
|
+
MASK: "MASK",
|
|
729
|
+
BLEND: "BLEND"
|
|
730
|
+
}, ze = {
|
|
731
|
+
"image/png": le,
|
|
732
|
+
"image/jpeg": de
|
|
733
|
+
};
|
|
734
|
+
function Be(e, t) {
|
|
735
|
+
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);
|
|
736
|
+
}
|
|
737
|
+
function Ve(e) {
|
|
738
|
+
return e.DefaultMaterial === void 0 && (e.DefaultMaterial = new A({
|
|
739
|
+
color: 16777215,
|
|
740
|
+
emissive: 0,
|
|
741
|
+
metalness: 1,
|
|
742
|
+
roughness: 1,
|
|
743
|
+
transparent: !1,
|
|
744
|
+
depthTest: !0,
|
|
745
|
+
side: f
|
|
746
|
+
})), e.DefaultMaterial;
|
|
747
|
+
}
|
|
748
|
+
function Z(e, t, n) {
|
|
749
|
+
for (var r in n.extensions) e[r] === void 0 && (t.userData.gltfExtensions = t.userData.gltfExtensions || {}, t.userData.gltfExtensions[r] = n.extensions[r]);
|
|
750
|
+
}
|
|
751
|
+
function Q(e, t) {
|
|
752
|
+
t.extras !== void 0 && (typeof t.extras == "object" ? Object.assign(e.userData, t.extras) : console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, " + t.extras));
|
|
753
|
+
}
|
|
754
|
+
function He(e, t, n) {
|
|
755
|
+
for (var r = !1, i = !1, a = 0, o = t.length; a < o; a++) {
|
|
756
|
+
var s = t[a];
|
|
757
|
+
if (s.POSITION !== void 0 && (r = !0), s.NORMAL !== void 0 && (i = !0), r && i) break;
|
|
758
|
+
}
|
|
759
|
+
if (!r && !i) return Promise.resolve(e);
|
|
760
|
+
for (var c = [], l = [], a = 0, o = t.length; a < o; a++) {
|
|
761
|
+
var s = t[a];
|
|
762
|
+
if (r) {
|
|
763
|
+
var u = s.POSITION === void 0 ? e.attributes.position : n.getDependency("accessor", s.POSITION);
|
|
764
|
+
c.push(u);
|
|
765
|
+
}
|
|
766
|
+
if (i) {
|
|
767
|
+
var u = s.NORMAL === void 0 ? e.attributes.normal : n.getDependency("accessor", s.NORMAL);
|
|
768
|
+
l.push(u);
|
|
769
|
+
}
|
|
770
|
+
}
|
|
771
|
+
return Promise.all([Promise.all(c), Promise.all(l)]).then(function(t) {
|
|
772
|
+
var n = t[0], a = t[1];
|
|
773
|
+
return r && (e.morphAttributes.position = n), i && (e.morphAttributes.normal = a), e.morphTargetsRelative = !0, e;
|
|
774
|
+
});
|
|
775
|
+
}
|
|
776
|
+
function Ue(e, t) {
|
|
777
|
+
if (e.updateMorphTargets(), t.weights !== void 0) for (var n = 0, r = t.weights.length; n < r; n++) e.morphTargetInfluences[n] = t.weights[n];
|
|
778
|
+
if (t.extras && Array.isArray(t.extras.targetNames)) {
|
|
779
|
+
var i = t.extras.targetNames;
|
|
780
|
+
if (e.morphTargetInfluences.length === i.length) {
|
|
781
|
+
e.morphTargetDictionary = {};
|
|
782
|
+
for (var n = 0, r = i.length; n < r; n++) e.morphTargetDictionary[i[n]] = n;
|
|
783
|
+
} else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.");
|
|
784
|
+
}
|
|
785
|
+
}
|
|
786
|
+
function We(e) {
|
|
787
|
+
var t = e.extensions && e.extensions[B.KHR_DRACO_MESH_COMPRESSION];
|
|
788
|
+
return t ? "draco:" + t.bufferView + ":" + t.indices + ":" + Ge(t.attributes) : e.indices + ":" + Ge(e.attributes) + ":" + e.mode;
|
|
789
|
+
}
|
|
790
|
+
function Ge(e) {
|
|
791
|
+
for (var t = "", n = Object.keys(e).sort(), r = 0, i = n.length; r < i; r++) t += n[r] + ":" + e[n[r]] + ";";
|
|
792
|
+
return t;
|
|
793
|
+
}
|
|
794
|
+
function $(e, t, n) {
|
|
795
|
+
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);
|
|
796
|
+
}
|
|
797
|
+
$.prototype.parse = function(e, t) {
|
|
798
|
+
var n = this, r = this.json, i = this.extensions;
|
|
799
|
+
this.cache.removeAll(), this.markDefs(), Promise.all([
|
|
800
|
+
this.getDependencies("scene"),
|
|
801
|
+
this.getDependencies("animation"),
|
|
802
|
+
this.getDependencies("camera")
|
|
803
|
+
]).then(function(t) {
|
|
804
|
+
var a = {
|
|
805
|
+
scene: t[0][r.scene || 0],
|
|
806
|
+
scenes: t[0],
|
|
807
|
+
animations: t[1],
|
|
808
|
+
cameras: t[2],
|
|
809
|
+
asset: r.asset,
|
|
810
|
+
parser: n,
|
|
811
|
+
userData: {}
|
|
812
|
+
};
|
|
813
|
+
Z(i, a, r), Q(a, r), e(a);
|
|
814
|
+
}).catch(t);
|
|
815
|
+
}, $.prototype.markDefs = function() {
|
|
816
|
+
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;
|
|
817
|
+
for (var u = 0, d = e.length; u < d; u++) {
|
|
818
|
+
var f = e[u];
|
|
819
|
+
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));
|
|
820
|
+
}
|
|
821
|
+
this.json.meshReferences = r, this.json.meshUses = i;
|
|
822
|
+
}, $.prototype.getDependency = function(e, t) {
|
|
823
|
+
var n = e + ":" + t, r = this.cache.get(n);
|
|
824
|
+
if (!r) {
|
|
825
|
+
switch (e) {
|
|
826
|
+
case "scene":
|
|
827
|
+
r = this.loadScene(t);
|
|
828
|
+
break;
|
|
829
|
+
case "node":
|
|
830
|
+
r = this.loadNode(t);
|
|
831
|
+
break;
|
|
832
|
+
case "mesh":
|
|
833
|
+
r = this.loadMesh(t);
|
|
834
|
+
break;
|
|
835
|
+
case "accessor":
|
|
836
|
+
r = this.loadAccessor(t);
|
|
837
|
+
break;
|
|
838
|
+
case "bufferView":
|
|
839
|
+
r = this.loadBufferView(t);
|
|
840
|
+
break;
|
|
841
|
+
case "buffer":
|
|
842
|
+
r = this.loadBuffer(t);
|
|
843
|
+
break;
|
|
844
|
+
case "material":
|
|
845
|
+
r = this.loadMaterial(t);
|
|
846
|
+
break;
|
|
847
|
+
case "texture":
|
|
848
|
+
r = this.loadTexture(t);
|
|
849
|
+
break;
|
|
850
|
+
case "skin":
|
|
851
|
+
r = this.loadSkin(t);
|
|
852
|
+
break;
|
|
853
|
+
case "animation":
|
|
854
|
+
r = this.loadAnimation(t);
|
|
855
|
+
break;
|
|
856
|
+
case "camera":
|
|
857
|
+
r = this.loadCamera(t);
|
|
858
|
+
break;
|
|
859
|
+
case "light":
|
|
860
|
+
r = this.extensions[B.KHR_LIGHTS_PUNCTUAL].loadLight(t);
|
|
861
|
+
break;
|
|
862
|
+
default: throw Error("Unknown type: " + e);
|
|
863
|
+
}
|
|
864
|
+
this.cache.add(n, r);
|
|
865
|
+
}
|
|
866
|
+
return r;
|
|
867
|
+
}, $.prototype.getDependencies = function(e) {
|
|
868
|
+
var t = this.cache.get(e);
|
|
869
|
+
if (!t) {
|
|
870
|
+
var n = this, r = this.json[e + (e === "mesh" ? "es" : "s")] || [];
|
|
871
|
+
t = Promise.all(r.map(function(t, r) {
|
|
872
|
+
return n.getDependency(e, r);
|
|
873
|
+
})), this.cache.add(e, t);
|
|
874
|
+
}
|
|
875
|
+
return t;
|
|
876
|
+
}, $.prototype.loadBuffer = function(e) {
|
|
877
|
+
var t = this.json.buffers[e], n = this.fileLoader;
|
|
878
|
+
if (t.type && t.type !== "arraybuffer") throw Error("THREE.GLTFLoader: " + t.type + " buffer type is not supported.");
|
|
879
|
+
if (t.uri === void 0 && e === 0) return Promise.resolve(this.extensions[B.KHR_BINARY_GLTF].body);
|
|
880
|
+
var r = this.options;
|
|
881
|
+
return new Promise(function(e, i) {
|
|
882
|
+
n.load(Be(t.uri, r.path), e, void 0, function() {
|
|
883
|
+
i(/* @__PURE__ */ Error("THREE.GLTFLoader: Failed to load buffer \"" + t.uri + "\"."));
|
|
884
|
+
});
|
|
885
|
+
});
|
|
886
|
+
}, $.prototype.loadBufferView = function(e) {
|
|
887
|
+
var t = this.json.bufferViews[e];
|
|
888
|
+
return this.getDependency("buffer", t.buffer).then(function(e) {
|
|
889
|
+
var n = t.byteLength || 0, r = t.byteOffset || 0;
|
|
890
|
+
return e.slice(r, r + n);
|
|
891
|
+
});
|
|
892
|
+
}, $.prototype.loadAccessor = function(e) {
|
|
893
|
+
var t = this, n = this.json, r = this.json.accessors[e];
|
|
894
|
+
if (r.bufferView === void 0 && r.sparse === void 0) return Promise.resolve(null);
|
|
895
|
+
var a = [];
|
|
896
|
+
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) {
|
|
897
|
+
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;
|
|
898
|
+
if (d && d !== l) {
|
|
899
|
+
var _ = Math.floor(u / d), v = "InterleavedBuffer:" + r.bufferView + ":" + r.componentType + ":" + _ + ":" + r.count, y = t.cache.get(v);
|
|
900
|
+
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);
|
|
901
|
+
} else p = a === null ? new s(r.count * o) : new s(a, u, r.count * o), g = new i(p, o, f);
|
|
902
|
+
if (r.sparse !== void 0) {
|
|
903
|
+
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);
|
|
904
|
+
a !== null && (g = new i(g.array.slice(), g.itemSize, g.normalized));
|
|
905
|
+
for (var E = 0, D = w.length; E < D; E++) {
|
|
906
|
+
var O = w[E];
|
|
907
|
+
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.");
|
|
908
|
+
}
|
|
909
|
+
}
|
|
910
|
+
return g;
|
|
911
|
+
});
|
|
912
|
+
}, $.prototype.loadTexture = function(e) {
|
|
913
|
+
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;
|
|
914
|
+
return c.bufferView !== void 0 && (l = t.getDependency("bufferView", c.bufferView).then(function(e) {
|
|
915
|
+
u = !0;
|
|
916
|
+
var t = new Blob([e], { type: c.mimeType });
|
|
917
|
+
return l = a.createObjectURL(t), l;
|
|
918
|
+
})), Promise.resolve(l).then(function(e) {
|
|
919
|
+
var n = r.manager.getHandler(e);
|
|
920
|
+
return n || (n = s[B.MSFT_TEXTURE_DDS] ? t.extensions[B.MSFT_TEXTURE_DDS].ddsLoader : i), new Promise(function(t, i) {
|
|
921
|
+
n.load(Be(e, r.path), t, void 0, i);
|
|
922
|
+
});
|
|
923
|
+
}).then(function(r) {
|
|
924
|
+
u === !0 && a.revokeObjectURL(l), r.flipY = !1, o.name && (r.name = o.name), c.mimeType in ze && (r.format = ze[c.mimeType]);
|
|
925
|
+
var i = (n.samplers || {})[o.sampler] || {};
|
|
926
|
+
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, {
|
|
927
|
+
type: "textures",
|
|
928
|
+
index: e
|
|
929
|
+
}), r;
|
|
930
|
+
});
|
|
931
|
+
}, $.prototype.assignTexture = function(e, t, n) {
|
|
932
|
+
var r = this;
|
|
933
|
+
return this.getDependency("texture", n.index).then(function(i) {
|
|
934
|
+
if (!i.isCompressedTexture) switch (t) {
|
|
935
|
+
case "aoMap":
|
|
936
|
+
case "emissiveMap":
|
|
937
|
+
case "metalnessMap":
|
|
938
|
+
case "normalMap":
|
|
939
|
+
case "roughnessMap":
|
|
940
|
+
i.format = de;
|
|
941
|
+
break;
|
|
942
|
+
}
|
|
943
|
+
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]) {
|
|
944
|
+
var a = n.extensions === void 0 ? void 0 : n.extensions[B.KHR_TEXTURE_TRANSFORM];
|
|
945
|
+
if (a) {
|
|
946
|
+
var o = r.associations.get(i);
|
|
947
|
+
i = r.extensions[B.KHR_TEXTURE_TRANSFORM].extendTexture(i, a), r.associations.set(i, o);
|
|
948
|
+
}
|
|
949
|
+
}
|
|
950
|
+
e[t] = i;
|
|
951
|
+
});
|
|
952
|
+
}, $.prototype.assignFinalMaterial = function(e) {
|
|
953
|
+
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;
|
|
954
|
+
if (e.isPoints) {
|
|
955
|
+
var l = "PointsMaterial:" + n.uuid, u = this.cache.get(l);
|
|
956
|
+
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;
|
|
957
|
+
} else if (e.isLine) {
|
|
958
|
+
var l = "LineBasicMaterial:" + n.uuid, d = this.cache.get(l);
|
|
959
|
+
d || (d = new b(), O.prototype.copy.call(d, n), d.color.copy(n.color), this.cache.add(l, d)), n = d;
|
|
960
|
+
}
|
|
961
|
+
if (r || i || a || o || s) {
|
|
962
|
+
var l = "ClonedMaterial:" + n.uuid + ":";
|
|
963
|
+
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:");
|
|
964
|
+
var f = this.cache.get(l);
|
|
965
|
+
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;
|
|
966
|
+
}
|
|
967
|
+
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;
|
|
968
|
+
}, $.prototype.loadMaterial = function(e) {
|
|
969
|
+
var t = this, n = this.json, r = this.extensions, i = n.materials[e], a, o = {}, c = i.extensions || {}, l = [];
|
|
970
|
+
if (c[B.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS]) {
|
|
971
|
+
var d = r[B.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS];
|
|
972
|
+
a = d.getMaterialType(), l.push(d.extendParams(o, i, t));
|
|
973
|
+
} else if (c[B.KHR_MATERIALS_UNLIT]) {
|
|
974
|
+
var f = r[B.KHR_MATERIALS_UNLIT];
|
|
975
|
+
a = f.getMaterialType(), l.push(f.extendParams(o, i, t));
|
|
976
|
+
} else {
|
|
977
|
+
a = A;
|
|
978
|
+
var p = i.pbrMetallicRoughness || {};
|
|
979
|
+
if (o.color = new s(1, 1, 1), o.opacity = 1, Array.isArray(p.baseColorFactor)) {
|
|
980
|
+
var m = p.baseColorFactor;
|
|
981
|
+
o.color.fromArray(m), o.opacity = m[3];
|
|
982
|
+
}
|
|
983
|
+
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)));
|
|
984
|
+
}
|
|
985
|
+
i.doubleSided === !0 && (o.side = u);
|
|
986
|
+
var h = i.alphaMode || Re.OPAQUE;
|
|
987
|
+
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]) {
|
|
988
|
+
var g = r[B.KHR_MATERIALS_CLEARCOAT];
|
|
989
|
+
a = g.getMaterialType(), l.push(g.extendParams(o, { extensions: c }, t));
|
|
990
|
+
}
|
|
991
|
+
if (c[B.KHR_MATERIALS_TRANSMISSION]) {
|
|
992
|
+
var g = r[B.KHR_MATERIALS_TRANSMISSION];
|
|
993
|
+
a = g.getMaterialType(), l.push(g.extendParams(o, { extensions: c }, t));
|
|
994
|
+
}
|
|
995
|
+
if (c[B.REALSEE_MATERIALS_LIGHTMAP]) {
|
|
996
|
+
var _ = r[B.REALSEE_MATERIALS_LIGHTMAP];
|
|
997
|
+
a = _.getMaterialType(), l.push(_.extendParams(o, { extensions: c }, t));
|
|
998
|
+
}
|
|
999
|
+
return Promise.all(l).then(function() {
|
|
1000
|
+
var n = a === q ? r[B.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS].createMaterial(o) : new a(o);
|
|
1001
|
+
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, {
|
|
1002
|
+
type: "materials",
|
|
1003
|
+
index: e
|
|
1004
|
+
}), i.extensions && Z(r, n, i), n;
|
|
1005
|
+
});
|
|
1006
|
+
};
|
|
1007
|
+
function Ke(e, t, n) {
|
|
1008
|
+
var i = t.attributes, a = new r();
|
|
1009
|
+
if (i.POSITION !== void 0) {
|
|
1010
|
+
var o = n.json.accessors[i.POSITION], s = o.min, c = o.max;
|
|
1011
|
+
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]));
|
|
1012
|
+
else {
|
|
1013
|
+
console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");
|
|
1014
|
+
return;
|
|
1015
|
+
}
|
|
1016
|
+
} else return;
|
|
1017
|
+
var l = t.targets;
|
|
1018
|
+
if (l !== void 0) {
|
|
1019
|
+
for (var u = new H(), d = new H(), f = 0, p = l.length; f < p; f++) {
|
|
1020
|
+
var m = l[f];
|
|
1021
|
+
if (m.POSITION !== void 0) {
|
|
1022
|
+
var o = n.json.accessors[m.POSITION], s = o.min, c = o.max;
|
|
1023
|
+
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.");
|
|
1024
|
+
}
|
|
1025
|
+
}
|
|
1026
|
+
a.expandByVector(u);
|
|
1027
|
+
}
|
|
1028
|
+
e.boundingBox = a;
|
|
1029
|
+
var h = new ge();
|
|
1030
|
+
a.getCenter(h.center), h.radius = a.min.distanceTo(a.max) / 2, e.boundingSphere = h;
|
|
1031
|
+
}
|
|
1032
|
+
function qe(e, t, n) {
|
|
1033
|
+
var r = t.attributes, i = [];
|
|
1034
|
+
function a(t, r) {
|
|
1035
|
+
return n.getDependency("accessor", t).then(function(t) {
|
|
1036
|
+
e.setAttribute(r, t);
|
|
1037
|
+
});
|
|
1038
|
+
}
|
|
1039
|
+
for (var o in r) {
|
|
1040
|
+
var s = Ie[o] || o.toLowerCase();
|
|
1041
|
+
s in e.attributes || i.push(a(r[o], s));
|
|
1042
|
+
}
|
|
1043
|
+
if (t.indices !== void 0 && !e.index) {
|
|
1044
|
+
var c = n.getDependency("accessor", t.indices).then(function(t) {
|
|
1045
|
+
e.setIndex(t);
|
|
1046
|
+
});
|
|
1047
|
+
i.push(c);
|
|
1048
|
+
}
|
|
1049
|
+
return Q(e, t), Ke(e, t, n), Promise.all(i).then(function() {
|
|
1050
|
+
return t.targets === void 0 ? e : He(e, t.targets, n);
|
|
1051
|
+
});
|
|
1052
|
+
}
|
|
1053
|
+
function Je(e, t) {
|
|
1054
|
+
var n = e.getIndex();
|
|
1055
|
+
if (n === null) {
|
|
1056
|
+
var r = [], i = e.getAttribute("position");
|
|
1057
|
+
if (i !== void 0) {
|
|
1058
|
+
for (var a = 0; a < i.count; a++) r.push(a);
|
|
1059
|
+
e.setIndex(r), n = e.getIndex();
|
|
1060
|
+
} else return console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."), e;
|
|
1061
|
+
}
|
|
1062
|
+
var o = n.count - 2, s = [];
|
|
1063
|
+
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));
|
|
1064
|
+
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)));
|
|
1065
|
+
s.length / 3 !== o && console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");
|
|
1066
|
+
var c = e.clone();
|
|
1067
|
+
return c.setIndex(s), c;
|
|
1068
|
+
}
|
|
1069
|
+
return $.prototype.loadGeometries = function(e) {
|
|
1070
|
+
var t = this, n = this.extensions, r = this.primitiveCache;
|
|
1071
|
+
function i(e) {
|
|
1072
|
+
return n[B.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e, t).then(function(n) {
|
|
1073
|
+
return qe(n, e, t);
|
|
1074
|
+
});
|
|
1075
|
+
}
|
|
1076
|
+
for (var o = [], s = 0, c = e.length; s < c; s++) {
|
|
1077
|
+
var l = e[s], u = We(l), d = r[u];
|
|
1078
|
+
if (d) o.push(d.promise);
|
|
1079
|
+
else {
|
|
1080
|
+
var f = l.extensions && l.extensions[B.KHR_DRACO_MESH_COMPRESSION] ? i(l) : qe(new a(), l, t);
|
|
1081
|
+
r[u] = {
|
|
1082
|
+
primitive: l,
|
|
1083
|
+
promise: f
|
|
1084
|
+
}, o.push(f);
|
|
1085
|
+
}
|
|
1086
|
+
}
|
|
1087
|
+
return Promise.all(o);
|
|
1088
|
+
}, $.prototype.loadMesh = function(e) {
|
|
1089
|
+
for (var t = this, n = this.json.meshes[e], r = n.primitives, i = [], a = 0, o = r.length; a < o; a++) {
|
|
1090
|
+
var s = r[a].material === void 0 ? Ve(this.cache) : this.getDependency("material", r[a].material);
|
|
1091
|
+
i.push(s);
|
|
1092
|
+
}
|
|
1093
|
+
return i.push(t.loadGeometries(r)), Promise.all(i).then(function(i) {
|
|
1094
|
+
for (var a = i.slice(0, i.length - 1), o = i[i.length - 1], s = [], c = 0, l = o.length; c < l; c++) {
|
|
1095
|
+
var u = o[c], d = r[c], f, m = a[c];
|
|
1096
|
+
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));
|
|
1097
|
+
else if (d.mode === Y.LINES) f = new S(u, m);
|
|
1098
|
+
else if (d.mode === Y.LINE_STRIP) f = new y(u, m);
|
|
1099
|
+
else if (d.mode === Y.LINE_LOOP) f = new x(u, m);
|
|
1100
|
+
else if (d.mode === Y.POINTS) f = new z(u, m);
|
|
1101
|
+
else throw Error("THREE.GLTFLoader: Primitive mode unsupported: " + d.mode);
|
|
1102
|
+
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);
|
|
1103
|
+
}
|
|
1104
|
+
if (s.length === 1) return s[0];
|
|
1105
|
+
for (var h = new p(), c = 0, l = s.length; c < l; c++) h.add(s[c]);
|
|
1106
|
+
return h;
|
|
1107
|
+
});
|
|
1108
|
+
}, $.prototype.loadCamera = function(e) {
|
|
1109
|
+
var t, n = this.json.cameras[e], r = n[n.type];
|
|
1110
|
+
if (!r) {
|
|
1111
|
+
console.warn("THREE.GLTFLoader: Missing camera parameters.");
|
|
1112
|
+
return;
|
|
1113
|
+
}
|
|
1114
|
+
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);
|
|
1115
|
+
}, $.prototype.loadSkin = function(e) {
|
|
1116
|
+
var t = this.json.skins[e], n = { joints: t.joints };
|
|
1117
|
+
return t.inverseBindMatrices === void 0 ? Promise.resolve(n) : this.getDependency("accessor", t.inverseBindMatrices).then(function(e) {
|
|
1118
|
+
return n.inverseBindMatrices = e, n;
|
|
1119
|
+
});
|
|
1120
|
+
}, $.prototype.loadAnimation = function(e) {
|
|
1121
|
+
for (var n = this.json.animations[e], r = [], i = [], a = [], o = [], s = [], c = 0, l = n.channels.length; c < l; c++) {
|
|
1122
|
+
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];
|
|
1123
|
+
r.push(this.getDependency("node", p)), i.push(this.getDependency("accessor", m)), a.push(this.getDependency("accessor", h)), o.push(d), s.push(f);
|
|
1124
|
+
}
|
|
1125
|
+
return Promise.all([
|
|
1126
|
+
Promise.all(r),
|
|
1127
|
+
Promise.all(i),
|
|
1128
|
+
Promise.all(a),
|
|
1129
|
+
Promise.all(o),
|
|
1130
|
+
Promise.all(s)
|
|
1131
|
+
]).then(function(r) {
|
|
1132
|
+
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++) {
|
|
1133
|
+
var f = i[u], p = a[u], m = o[u], h = s[u], g = c[u];
|
|
1134
|
+
if (f !== void 0) {
|
|
1135
|
+
f.updateMatrix(), f.matrixAutoUpdate = !0;
|
|
1136
|
+
var _;
|
|
1137
|
+
switch (X[g.path]) {
|
|
1138
|
+
case X.weights:
|
|
1139
|
+
_ = F;
|
|
1140
|
+
break;
|
|
1141
|
+
case X.rotation:
|
|
1142
|
+
_ = ce;
|
|
1143
|
+
break;
|
|
1144
|
+
case X.position:
|
|
1145
|
+
case X.scale:
|
|
1146
|
+
default:
|
|
1147
|
+
_ = Ce;
|
|
1148
|
+
break;
|
|
1149
|
+
}
|
|
1150
|
+
var y = f.name ? f.name : f.uuid, b = h.interpolation === void 0 ? v : Le[h.interpolation], x = [];
|
|
1151
|
+
X[g.path] === X.weights ? f.traverse(function(e) {
|
|
1152
|
+
e.isMesh === !0 && e.morphTargetInfluences && x.push(e.name ? e.name : e.uuid);
|
|
1153
|
+
}) : x.push(y);
|
|
1154
|
+
var S = m.array;
|
|
1155
|
+
if (m.normalized) {
|
|
1156
|
+
var C;
|
|
1157
|
+
if (S.constructor === Int8Array) C = 1 / 127;
|
|
1158
|
+
else if (S.constructor === Uint8Array) C = 1 / 255;
|
|
1159
|
+
else if (S.constructor == Int16Array) C = 1 / 32767;
|
|
1160
|
+
else if (S.constructor === Uint16Array) C = 1 / 65535;
|
|
1161
|
+
else throw Error("THREE.GLTFLoader: Unsupported output accessor component type.");
|
|
1162
|
+
for (var w = new Float32Array(S.length), T = 0, E = S.length; T < E; T++) w[T] = S[T] * C;
|
|
1163
|
+
S = w;
|
|
1164
|
+
}
|
|
1165
|
+
for (var T = 0, E = x.length; T < E; T++) {
|
|
1166
|
+
var D = new _(x[T] + "." + X[g.path], p.array, S, b);
|
|
1167
|
+
h.interpolation === "CUBICSPLINE" && (D.createInterpolant = function(e) {
|
|
1168
|
+
return new J(this.times, this.values, this.getValueSize() / 3, e);
|
|
1169
|
+
}, D.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline = !0), l.push(D);
|
|
1170
|
+
}
|
|
1171
|
+
}
|
|
1172
|
+
}
|
|
1173
|
+
return new t(n.name ? n.name : "animation_" + e, void 0, l);
|
|
1174
|
+
});
|
|
1175
|
+
}, $.prototype.loadNode = function(e) {
|
|
1176
|
+
var t = this.json, r = this.extensions, i = this, a = t.meshReferences, o = t.meshUses, s = t.nodes[e];
|
|
1177
|
+
return function() {
|
|
1178
|
+
var e = [];
|
|
1179
|
+
return s.mesh !== void 0 && e.push(i.getDependency("mesh", s.mesh).then(function(e) {
|
|
1180
|
+
var t;
|
|
1181
|
+
if (a[s.mesh] > 1) {
|
|
1182
|
+
var n = o[s.mesh]++;
|
|
1183
|
+
t = e.clone(), t.name += "_instance_" + n;
|
|
1184
|
+
} else t = e;
|
|
1185
|
+
return s.weights !== void 0 && t.traverse(function(e) {
|
|
1186
|
+
if (e.isMesh) for (var t = 0, n = s.weights.length; t < n; t++) e.morphTargetInfluences[t] = s.weights[t];
|
|
1187
|
+
}), t;
|
|
1188
|
+
})), 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);
|
|
1189
|
+
}().then(function(t) {
|
|
1190
|
+
var a = s.isBone === !0 ? new n() : t.length > 1 ? new p() : t.length === 1 ? t[0] : new ae();
|
|
1191
|
+
if (a !== t[0]) for (var o = 0, c = t.length; o < c; o++) a.add(t[o]);
|
|
1192
|
+
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) {
|
|
1193
|
+
var l = new te();
|
|
1194
|
+
l.fromArray(s.matrix), a.applyMatrix4(l);
|
|
1195
|
+
} 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);
|
|
1196
|
+
return i.associations.set(a, {
|
|
1197
|
+
type: "nodes",
|
|
1198
|
+
index: e
|
|
1199
|
+
}), a;
|
|
1200
|
+
});
|
|
1201
|
+
}, $.prototype.loadScene = function() {
|
|
1202
|
+
function e(t, n, r, i) {
|
|
1203
|
+
var a = r.nodes[t];
|
|
1204
|
+
return i.getDependency("node", t).then(function(e) {
|
|
1205
|
+
if (a.skin === void 0) return e;
|
|
1206
|
+
var t;
|
|
1207
|
+
return i.getDependency("skin", a.skin).then(function(e) {
|
|
1208
|
+
t = e;
|
|
1209
|
+
for (var n = [], r = 0, a = t.joints.length; r < a; r++) n.push(i.getDependency("node", t.joints[r]));
|
|
1210
|
+
return Promise.all(n);
|
|
1211
|
+
}).then(function(n) {
|
|
1212
|
+
return e.traverse(function(e) {
|
|
1213
|
+
if (e.isMesh) {
|
|
1214
|
+
for (var r = [], i = [], a = 0, o = n.length; a < o; a++) {
|
|
1215
|
+
var s = n[a];
|
|
1216
|
+
if (s) {
|
|
1217
|
+
r.push(s);
|
|
1218
|
+
var c = new te();
|
|
1219
|
+
t.inverseBindMatrices !== void 0 && c.fromArray(t.inverseBindMatrices.array, a * 16), i.push(c);
|
|
1220
|
+
} else console.warn("THREE.GLTFLoader: Joint \"%s\" could not be found.", t.joints[a]);
|
|
1221
|
+
}
|
|
1222
|
+
e.bind(new me(r, i), e.matrixWorld);
|
|
1223
|
+
}
|
|
1224
|
+
}), e;
|
|
1225
|
+
});
|
|
1226
|
+
}).then(function(t) {
|
|
1227
|
+
n.add(t);
|
|
1228
|
+
var o = [];
|
|
1229
|
+
if (a.children) for (var s = a.children, c = 0, l = s.length; c < l; c++) {
|
|
1230
|
+
var u = s[c];
|
|
1231
|
+
o.push(e(u, t, r, i));
|
|
1232
|
+
}
|
|
1233
|
+
return Promise.all(o);
|
|
1234
|
+
});
|
|
1235
|
+
}
|
|
1236
|
+
return function(t) {
|
|
1237
|
+
var n = this.json, r = this.extensions, i = this.json.scenes[t], a = this, o = new p();
|
|
1238
|
+
i.name && (o.name = i.name), Q(o, i), i.extensions && Z(r, o, i);
|
|
1239
|
+
for (var s = i.nodes || [], c = [], l = 0, u = s.length; l < u; l++) c.push(e(s[l], o, n, a));
|
|
1240
|
+
return Promise.all(c).then(function() {
|
|
1241
|
+
return o;
|
|
1242
|
+
});
|
|
1243
|
+
};
|
|
1244
|
+
}(), e;
|
|
1245
|
+
})(), W = function(e) {
|
|
1246
|
+
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 = {
|
|
1247
|
+
position: "POSITION",
|
|
1248
|
+
normal: "NORMAL",
|
|
1249
|
+
color: "COLOR",
|
|
1250
|
+
uv: "TEX_COORD"
|
|
1251
|
+
}, this.defaultAttributeTypes = {
|
|
1252
|
+
position: "Float32Array",
|
|
1253
|
+
normal: "Float32Array",
|
|
1254
|
+
color: "Float32Array",
|
|
1255
|
+
uv: "Float32Array"
|
|
1256
|
+
};
|
|
263
1257
|
};
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
l[h] = d, o[h] = c.normalized === !0;
|
|
512
|
-
}
|
|
513
|
-
}
|
|
514
|
-
return r.getDependency("bufferView", a).then(function(A) {
|
|
515
|
-
return new Promise(function(E) {
|
|
516
|
-
n.decodeDracoFile(A, function(y) {
|
|
517
|
-
for (var S in y.attributes) {
|
|
518
|
-
var L = y.attributes[S], O = o[S];
|
|
519
|
-
O !== void 0 && (L.normalized = O);
|
|
520
|
-
}
|
|
521
|
-
E(y);
|
|
522
|
-
}, s, l);
|
|
523
|
-
});
|
|
524
|
-
});
|
|
525
|
-
};
|
|
526
|
-
function M() {
|
|
527
|
-
this.name = u.KHR_TEXTURE_TRANSFORM;
|
|
528
|
-
}
|
|
529
|
-
M.prototype.extendTexture = function(e, r) {
|
|
530
|
-
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;
|
|
531
|
-
};
|
|
532
|
-
function w(e) {
|
|
533
|
-
ve.call(this), this.isGLTFSpecularGlossinessMaterial = !0;
|
|
534
|
-
var r = [
|
|
535
|
-
"#ifdef USE_SPECULARMAP",
|
|
536
|
-
" uniform sampler2D specularMap;",
|
|
537
|
-
"#endif"
|
|
538
|
-
].join(`
|
|
539
|
-
`), t = [
|
|
540
|
-
"#ifdef USE_GLOSSINESSMAP",
|
|
541
|
-
" uniform sampler2D glossinessMap;",
|
|
542
|
-
"#endif"
|
|
543
|
-
].join(`
|
|
544
|
-
`), n = [
|
|
545
|
-
"vec3 specularFactor = specular;",
|
|
546
|
-
"#ifdef USE_SPECULARMAP",
|
|
547
|
-
" vec4 texelSpecular = texture2D( specularMap, vUv );",
|
|
548
|
-
" texelSpecular = sRGBToLinear( texelSpecular );",
|
|
549
|
-
" // reads channel RGB, compatible with a glTF Specular-Glossiness (RGBA) texture",
|
|
550
|
-
" specularFactor *= texelSpecular.rgb;",
|
|
551
|
-
"#endif"
|
|
552
|
-
].join(`
|
|
553
|
-
`), a = [
|
|
554
|
-
"float glossinessFactor = glossiness;",
|
|
555
|
-
"#ifdef USE_GLOSSINESSMAP",
|
|
556
|
-
" vec4 texelGlossiness = texture2D( glossinessMap, vUv );",
|
|
557
|
-
" // reads channel A, compatible with a glTF Specular-Glossiness (RGBA) texture",
|
|
558
|
-
" glossinessFactor *= texelGlossiness.a;",
|
|
559
|
-
"#endif"
|
|
560
|
-
].join(`
|
|
561
|
-
`), i = [
|
|
562
|
-
"PhysicalMaterial material;",
|
|
563
|
-
"material.diffuseColor = diffuseColor.rgb;",
|
|
564
|
-
"vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );",
|
|
565
|
-
"float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );",
|
|
566
|
-
"material.specularRoughness = max( 1.0 - glossinessFactor, 0.0525 );// 0.0525 corresponds to the base mip of a 256 cubemap.",
|
|
567
|
-
"material.specularRoughness += geometryRoughness;",
|
|
568
|
-
"material.specularRoughness = min( material.specularRoughness, 1.0 );",
|
|
569
|
-
"material.specularColor = specularFactor.rgb;"
|
|
570
|
-
].join(`
|
|
571
|
-
`), s = {
|
|
572
|
-
specular: { value: new re().setHex(16777215) },
|
|
573
|
-
glossiness: { value: 1 },
|
|
574
|
-
specularMap: { value: null },
|
|
575
|
-
glossinessMap: { value: null }
|
|
576
|
-
};
|
|
577
|
-
this._extraUniforms = s, this.onBeforeCompile = function(o) {
|
|
578
|
-
for (var l in s)
|
|
579
|
-
o.uniforms[l] = s[l];
|
|
580
|
-
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>", t), o.fragmentShader = o.fragmentShader.replace("#include <roughnessmap_fragment>", n), o.fragmentShader = o.fragmentShader.replace("#include <metalnessmap_fragment>", a), o.fragmentShader = o.fragmentShader.replace("#include <lights_physical_fragment>", i);
|
|
581
|
-
}, Object.defineProperties(
|
|
582
|
-
this,
|
|
583
|
-
{
|
|
584
|
-
specular: {
|
|
585
|
-
get: function() {
|
|
586
|
-
return s.specular.value;
|
|
587
|
-
},
|
|
588
|
-
set: function(o) {
|
|
589
|
-
s.specular.value = o;
|
|
590
|
-
}
|
|
591
|
-
},
|
|
592
|
-
specularMap: {
|
|
593
|
-
get: function() {
|
|
594
|
-
return s.specularMap.value;
|
|
595
|
-
},
|
|
596
|
-
set: function(o) {
|
|
597
|
-
s.specularMap.value = o;
|
|
598
|
-
}
|
|
599
|
-
},
|
|
600
|
-
glossiness: {
|
|
601
|
-
get: function() {
|
|
602
|
-
return s.glossiness.value;
|
|
603
|
-
},
|
|
604
|
-
set: function(o) {
|
|
605
|
-
s.glossiness.value = o;
|
|
606
|
-
}
|
|
607
|
-
},
|
|
608
|
-
glossinessMap: {
|
|
609
|
-
get: function() {
|
|
610
|
-
return s.glossinessMap.value;
|
|
611
|
-
},
|
|
612
|
-
set: function(o) {
|
|
613
|
-
s.glossinessMap.value = o, o ? (this.defines.USE_GLOSSINESSMAP = "", this.defines.USE_ROUGHNESSMAP = "") : (delete this.defines.USE_ROUGHNESSMAP, delete this.defines.USE_GLOSSINESSMAP);
|
|
614
|
-
}
|
|
615
|
-
}
|
|
616
|
-
}
|
|
617
|
-
), delete this.metalness, delete this.roughness, delete this.metalnessMap, delete this.roughnessMap, this.setValues(e);
|
|
618
|
-
}
|
|
619
|
-
w.prototype = Object.create(ve.prototype), w.prototype.constructor = w, w.prototype.copy = function(e) {
|
|
620
|
-
return ve.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;
|
|
621
|
-
};
|
|
622
|
-
function K() {
|
|
623
|
-
return {
|
|
624
|
-
name: u.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS,
|
|
625
|
-
specularGlossinessParams: [
|
|
626
|
-
"color",
|
|
627
|
-
"map",
|
|
628
|
-
"lightMap",
|
|
629
|
-
"lightMapIntensity",
|
|
630
|
-
"aoMap",
|
|
631
|
-
"aoMapIntensity",
|
|
632
|
-
"emissive",
|
|
633
|
-
"emissiveIntensity",
|
|
634
|
-
"emissiveMap",
|
|
635
|
-
"bumpMap",
|
|
636
|
-
"bumpScale",
|
|
637
|
-
"normalMap",
|
|
638
|
-
"normalMapType",
|
|
639
|
-
"displacementMap",
|
|
640
|
-
"displacementScale",
|
|
641
|
-
"displacementBias",
|
|
642
|
-
"specularMap",
|
|
643
|
-
"specular",
|
|
644
|
-
"glossinessMap",
|
|
645
|
-
"glossiness",
|
|
646
|
-
"alphaMap",
|
|
647
|
-
"envMap",
|
|
648
|
-
"envMapIntensity",
|
|
649
|
-
"refractionRatio"
|
|
650
|
-
],
|
|
651
|
-
getMaterialType: function() {
|
|
652
|
-
return w;
|
|
653
|
-
},
|
|
654
|
-
extendParams: function(e, r, t) {
|
|
655
|
-
var n = r.extensions[this.name];
|
|
656
|
-
e.color = new re(1, 1, 1), e.opacity = 1;
|
|
657
|
-
var a = [];
|
|
658
|
-
if (Array.isArray(n.diffuseFactor)) {
|
|
659
|
-
var i = n.diffuseFactor;
|
|
660
|
-
e.color.fromArray(i), e.opacity = i[3];
|
|
661
|
-
}
|
|
662
|
-
if (n.diffuseTexture !== void 0 && a.push(t.assignTexture(e, "map", n.diffuseTexture)), e.emissive = new re(0, 0, 0), e.glossiness = n.glossinessFactor !== void 0 ? n.glossinessFactor : 1, e.specular = new re(1, 1, 1), Array.isArray(n.specularFactor) && e.specular.fromArray(n.specularFactor), n.specularGlossinessTexture !== void 0) {
|
|
663
|
-
var s = n.specularGlossinessTexture;
|
|
664
|
-
a.push(t.assignTexture(e, "glossinessMap", s)), a.push(t.assignTexture(e, "specularMap", s));
|
|
665
|
-
}
|
|
666
|
-
return Promise.all(a);
|
|
667
|
-
},
|
|
668
|
-
createMaterial: function(e) {
|
|
669
|
-
var r = new w(e);
|
|
670
|
-
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 = lr, 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 = 0.98, r;
|
|
671
|
-
}
|
|
672
|
-
};
|
|
673
|
-
}
|
|
674
|
-
function ne() {
|
|
675
|
-
this.name = u.KHR_MESH_QUANTIZATION;
|
|
676
|
-
}
|
|
677
|
-
function D(e, r, t, n) {
|
|
678
|
-
Ke.call(this, e, r, t, n);
|
|
679
|
-
}
|
|
680
|
-
D.prototype = Object.create(Ke.prototype), D.prototype.constructor = D, D.prototype.copySampleValue_ = function(e) {
|
|
681
|
-
for (var r = this.resultBuffer, t = this.sampleValues, n = this.valueSize, a = e * n * 3 + n, i = 0; i !== n; i++)
|
|
682
|
-
r[i] = t[a + i];
|
|
683
|
-
return r;
|
|
684
|
-
}, D.prototype.beforeStart_ = D.prototype.copySampleValue_, D.prototype.afterEnd_ = D.prototype.copySampleValue_, D.prototype.interpolate_ = function(e, r, t, n) {
|
|
685
|
-
for (var a = this.resultBuffer, i = this.sampleValues, s = this.valueSize, o = s * 2, l = s * 3, f = n - r, h = (t - r) / f, c = h * h, d = c * h, A = e * l, E = A - l, y = -2 * d + 3 * c, S = d - c, L = 1 - y, O = S - c + h, G = 0; G !== s; G++) {
|
|
686
|
-
var te = i[E + G + s], ae = i[E + G + o] * f, $ = i[A + G + s], B = i[A + G] * f;
|
|
687
|
-
a[G] = L * te + O * ae + y * $ + S * B;
|
|
688
|
-
}
|
|
689
|
-
return a;
|
|
690
|
-
};
|
|
691
|
-
function J(e) {
|
|
692
|
-
this.parser = e, this.name = u.REALSEE_MATERIALS_LIGHTMAP;
|
|
693
|
-
}
|
|
694
|
-
J.prototype.getMaterialType = function(e) {
|
|
695
|
-
return fr;
|
|
696
|
-
}, J.prototype.extendParams = function(e, r, t) {
|
|
697
|
-
if (!r.extensions || !r.extensions[this.name])
|
|
698
|
-
return Promise.resolve();
|
|
699
|
-
var n = [], a = r.extensions[this.name];
|
|
700
|
-
return a.lightMapTexture !== void 0 && n.push(t.assignTexture(e, "lightMap", a.lightMapTexture)), a.lightMapIntensity !== void 0 && (e.lightMapIntensity = a.lightMapIntensity), Promise.all(n);
|
|
701
|
-
};
|
|
702
|
-
var N = {
|
|
703
|
-
POINTS: 0,
|
|
704
|
-
LINES: 1,
|
|
705
|
-
LINE_LOOP: 2,
|
|
706
|
-
LINE_STRIP: 3,
|
|
707
|
-
TRIANGLES: 4,
|
|
708
|
-
TRIANGLE_STRIP: 5,
|
|
709
|
-
TRIANGLE_FAN: 6
|
|
710
|
-
}, Q = {
|
|
711
|
-
5120: Int8Array,
|
|
712
|
-
5121: Uint8Array,
|
|
713
|
-
5122: Int16Array,
|
|
714
|
-
5123: Uint16Array,
|
|
715
|
-
5125: Uint32Array,
|
|
716
|
-
5126: Float32Array
|
|
717
|
-
}, Z = {
|
|
718
|
-
9728: gr,
|
|
719
|
-
9729: Xe,
|
|
720
|
-
9984: Tr,
|
|
721
|
-
9985: vr,
|
|
722
|
-
9986: hr,
|
|
723
|
-
9987: Ve
|
|
724
|
-
}, X = {
|
|
725
|
-
33071: Ar,
|
|
726
|
-
33648: mr,
|
|
727
|
-
10497: Fe
|
|
728
|
-
}, z = {
|
|
729
|
-
SCALAR: 1,
|
|
730
|
-
VEC2: 2,
|
|
731
|
-
VEC3: 3,
|
|
732
|
-
VEC4: 4,
|
|
733
|
-
MAT2: 4,
|
|
734
|
-
MAT3: 9,
|
|
735
|
-
MAT4: 16
|
|
736
|
-
}, le = {
|
|
737
|
-
POSITION: "position",
|
|
738
|
-
NORMAL: "normal",
|
|
739
|
-
TANGENT: "tangent",
|
|
740
|
-
TEXCOORD_0: "uv",
|
|
741
|
-
TEXCOORD_1: "uv2",
|
|
742
|
-
COLOR_0: "color",
|
|
743
|
-
WEIGHTS_0: "skinWeight",
|
|
744
|
-
JOINTS_0: "skinIndex"
|
|
745
|
-
}, j = {
|
|
746
|
-
scale: "scale",
|
|
747
|
-
translation: "position",
|
|
748
|
-
rotation: "quaternion",
|
|
749
|
-
weights: "morphTargetInfluences"
|
|
750
|
-
}, Le = {
|
|
751
|
-
CUBICSPLINE: void 0,
|
|
752
|
-
// We use a custom interpolant (GLTFCubicSplineInterpolation) for CUBICSPLINE tracks. Each
|
|
753
|
-
// keyframe track will be initialized with a default interpolation type, then modified.
|
|
754
|
-
LINEAR: Ye,
|
|
755
|
-
STEP: Or
|
|
756
|
-
}, fe = {
|
|
757
|
-
OPAQUE: "OPAQUE",
|
|
758
|
-
MASK: "MASK",
|
|
759
|
-
BLEND: "BLEND"
|
|
760
|
-
}, Te = {
|
|
761
|
-
"image/png": Ze,
|
|
762
|
-
"image/jpeg": je
|
|
763
|
-
};
|
|
764
|
-
function ge(e, r) {
|
|
765
|
-
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);
|
|
766
|
-
}
|
|
767
|
-
function Me(e) {
|
|
768
|
-
return e.DefaultMaterial === void 0 && (e.DefaultMaterial = new ve({
|
|
769
|
-
color: 16777215,
|
|
770
|
-
emissive: 0,
|
|
771
|
-
metalness: 1,
|
|
772
|
-
roughness: 1,
|
|
773
|
-
transparent: !1,
|
|
774
|
-
depthTest: !0,
|
|
775
|
-
side: Gr
|
|
776
|
-
})), e.DefaultMaterial;
|
|
777
|
-
}
|
|
778
|
-
function oe(e, r, t) {
|
|
779
|
-
for (var n in t.extensions)
|
|
780
|
-
e[n] === void 0 && (r.userData.gltfExtensions = r.userData.gltfExtensions || {}, r.userData.gltfExtensions[n] = t.extensions[n]);
|
|
781
|
-
}
|
|
782
|
-
function W(e, r) {
|
|
783
|
-
r.extras !== void 0 && (typeof r.extras == "object" ? Object.assign(e.userData, r.extras) : console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, " + r.extras));
|
|
784
|
-
}
|
|
785
|
-
function we(e, r, t) {
|
|
786
|
-
for (var n = !1, a = !1, i = 0, s = r.length; i < s; i++) {
|
|
787
|
-
var o = r[i];
|
|
788
|
-
if (o.POSITION !== void 0 && (n = !0), o.NORMAL !== void 0 && (a = !0), n && a) break;
|
|
789
|
-
}
|
|
790
|
-
if (!n && !a) return Promise.resolve(e);
|
|
791
|
-
for (var l = [], f = [], i = 0, s = r.length; i < s; i++) {
|
|
792
|
-
var o = r[i];
|
|
793
|
-
if (n) {
|
|
794
|
-
var h = o.POSITION !== void 0 ? t.getDependency("accessor", o.POSITION) : e.attributes.position;
|
|
795
|
-
l.push(h);
|
|
796
|
-
}
|
|
797
|
-
if (a) {
|
|
798
|
-
var h = o.NORMAL !== void 0 ? t.getDependency("accessor", o.NORMAL) : e.attributes.normal;
|
|
799
|
-
f.push(h);
|
|
800
|
-
}
|
|
801
|
-
}
|
|
802
|
-
return Promise.all([
|
|
803
|
-
Promise.all(l),
|
|
804
|
-
Promise.all(f)
|
|
805
|
-
]).then(function(c) {
|
|
806
|
-
var d = c[0], A = c[1];
|
|
807
|
-
return n && (e.morphAttributes.position = d), a && (e.morphAttributes.normal = A), e.morphTargetsRelative = !0, e;
|
|
808
|
-
});
|
|
809
|
-
}
|
|
810
|
-
function Ie(e, r) {
|
|
811
|
-
if (e.updateMorphTargets(), r.weights !== void 0)
|
|
812
|
-
for (var t = 0, n = r.weights.length; t < n; t++)
|
|
813
|
-
e.morphTargetInfluences[t] = r.weights[t];
|
|
814
|
-
if (r.extras && Array.isArray(r.extras.targetNames)) {
|
|
815
|
-
var a = r.extras.targetNames;
|
|
816
|
-
if (e.morphTargetInfluences.length === a.length) {
|
|
817
|
-
e.morphTargetDictionary = {};
|
|
818
|
-
for (var t = 0, n = a.length; t < n; t++)
|
|
819
|
-
e.morphTargetDictionary[a[t]] = t;
|
|
820
|
-
} else
|
|
821
|
-
console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.");
|
|
822
|
-
}
|
|
823
|
-
}
|
|
824
|
-
function U(e) {
|
|
825
|
-
var r = e.extensions && e.extensions[u.KHR_DRACO_MESH_COMPRESSION], t;
|
|
826
|
-
return r ? t = "draco:" + r.bufferView + ":" + r.indices + ":" + Y(r.attributes) : t = e.indices + ":" + Y(e.attributes) + ":" + e.mode, t;
|
|
827
|
-
}
|
|
828
|
-
function Y(e) {
|
|
829
|
-
for (var r = "", t = Object.keys(e).sort(), n = 0, a = t.length; n < a; n++)
|
|
830
|
-
r += t[n] + ":" + e[t[n]] + ";";
|
|
831
|
-
return r;
|
|
832
|
-
}
|
|
833
|
-
function C(e, r, t) {
|
|
834
|
-
this.json = e || {}, this.extensions = r || {}, this.options = t || {}, this.cache = new T(), this.associations = /* @__PURE__ */ new Map(), this.primitiveCache = {}, this.textureLoader = new cr(this.options.manager), this.textureLoader.setCrossOrigin(this.options.crossOrigin), this.fileLoader = new _e(this.options.manager), this.fileLoader.setResponseType("arraybuffer"), this.options.crossOrigin === "use-credentials" && this.fileLoader.setWithCredentials(!0);
|
|
835
|
-
}
|
|
836
|
-
C.prototype.parse = function(e, r) {
|
|
837
|
-
var t = this, n = this.json, a = this.extensions;
|
|
838
|
-
this.cache.removeAll(), this.markDefs(), Promise.all([
|
|
839
|
-
this.getDependencies("scene"),
|
|
840
|
-
this.getDependencies("animation"),
|
|
841
|
-
this.getDependencies("camera")
|
|
842
|
-
]).then(function(i) {
|
|
843
|
-
var s = {
|
|
844
|
-
scene: i[0][n.scene || 0],
|
|
845
|
-
scenes: i[0],
|
|
846
|
-
animations: i[1],
|
|
847
|
-
cameras: i[2],
|
|
848
|
-
asset: n.asset,
|
|
849
|
-
parser: t,
|
|
850
|
-
userData: {}
|
|
851
|
-
};
|
|
852
|
-
oe(a, s, n), W(s, n), e(s);
|
|
853
|
-
}).catch(r);
|
|
854
|
-
}, C.prototype.markDefs = function() {
|
|
855
|
-
for (var e = this.json.nodes || [], r = this.json.skins || [], t = this.json.meshes || [], n = {}, a = {}, i = 0, s = r.length; i < s; i++)
|
|
856
|
-
for (var o = r[i].joints, l = 0, f = o.length; l < f; l++)
|
|
857
|
-
e[o[l]].isBone = !0;
|
|
858
|
-
for (var h = 0, c = e.length; h < c; h++) {
|
|
859
|
-
var d = e[h];
|
|
860
|
-
d.mesh !== void 0 && (n[d.mesh] === void 0 && (n[d.mesh] = a[d.mesh] = 0), n[d.mesh]++, d.skin !== void 0 && (t[d.mesh].isSkinnedMesh = !0));
|
|
861
|
-
}
|
|
862
|
-
this.json.meshReferences = n, this.json.meshUses = a;
|
|
863
|
-
}, C.prototype.getDependency = function(e, r) {
|
|
864
|
-
var t = e + ":" + r, n = this.cache.get(t);
|
|
865
|
-
if (!n) {
|
|
866
|
-
switch (e) {
|
|
867
|
-
case "scene":
|
|
868
|
-
n = this.loadScene(r);
|
|
869
|
-
break;
|
|
870
|
-
case "node":
|
|
871
|
-
n = this.loadNode(r);
|
|
872
|
-
break;
|
|
873
|
-
case "mesh":
|
|
874
|
-
n = this.loadMesh(r);
|
|
875
|
-
break;
|
|
876
|
-
case "accessor":
|
|
877
|
-
n = this.loadAccessor(r);
|
|
878
|
-
break;
|
|
879
|
-
case "bufferView":
|
|
880
|
-
n = this.loadBufferView(r);
|
|
881
|
-
break;
|
|
882
|
-
case "buffer":
|
|
883
|
-
n = this.loadBuffer(r);
|
|
884
|
-
break;
|
|
885
|
-
case "material":
|
|
886
|
-
n = this.loadMaterial(r);
|
|
887
|
-
break;
|
|
888
|
-
case "texture":
|
|
889
|
-
n = this.loadTexture(r);
|
|
890
|
-
break;
|
|
891
|
-
case "skin":
|
|
892
|
-
n = this.loadSkin(r);
|
|
893
|
-
break;
|
|
894
|
-
case "animation":
|
|
895
|
-
n = this.loadAnimation(r);
|
|
896
|
-
break;
|
|
897
|
-
case "camera":
|
|
898
|
-
n = this.loadCamera(r);
|
|
899
|
-
break;
|
|
900
|
-
case "light":
|
|
901
|
-
n = this.extensions[u.KHR_LIGHTS_PUNCTUAL].loadLight(r);
|
|
902
|
-
break;
|
|
903
|
-
default:
|
|
904
|
-
throw new Error("Unknown type: " + e);
|
|
905
|
-
}
|
|
906
|
-
this.cache.add(t, n);
|
|
907
|
-
}
|
|
908
|
-
return n;
|
|
909
|
-
}, C.prototype.getDependencies = function(e) {
|
|
910
|
-
var r = this.cache.get(e);
|
|
911
|
-
if (!r) {
|
|
912
|
-
var t = this, n = this.json[e + (e === "mesh" ? "es" : "s")] || [];
|
|
913
|
-
r = Promise.all(n.map(function(a, i) {
|
|
914
|
-
return t.getDependency(e, i);
|
|
915
|
-
})), this.cache.add(e, r);
|
|
916
|
-
}
|
|
917
|
-
return r;
|
|
918
|
-
}, C.prototype.loadBuffer = function(e) {
|
|
919
|
-
var r = this.json.buffers[e], t = this.fileLoader;
|
|
920
|
-
if (r.type && r.type !== "arraybuffer")
|
|
921
|
-
throw new Error("THREE.GLTFLoader: " + r.type + " buffer type is not supported.");
|
|
922
|
-
if (r.uri === void 0 && e === 0)
|
|
923
|
-
return Promise.resolve(this.extensions[u.KHR_BINARY_GLTF].body);
|
|
924
|
-
var n = this.options;
|
|
925
|
-
return new Promise(function(a, i) {
|
|
926
|
-
t.load(ge(r.uri, n.path), a, void 0, function() {
|
|
927
|
-
i(new Error('THREE.GLTFLoader: Failed to load buffer "' + r.uri + '".'));
|
|
928
|
-
});
|
|
929
|
-
});
|
|
930
|
-
}, C.prototype.loadBufferView = function(e) {
|
|
931
|
-
var r = this.json.bufferViews[e];
|
|
932
|
-
return this.getDependency("buffer", r.buffer).then(function(t) {
|
|
933
|
-
var n = r.byteLength || 0, a = r.byteOffset || 0;
|
|
934
|
-
return t.slice(a, a + n);
|
|
935
|
-
});
|
|
936
|
-
}, C.prototype.loadAccessor = function(e) {
|
|
937
|
-
var r = this, t = this.json, n = this.json.accessors[e];
|
|
938
|
-
if (n.bufferView === void 0 && n.sparse === void 0)
|
|
939
|
-
return Promise.resolve(null);
|
|
940
|
-
var a = [];
|
|
941
|
-
return n.bufferView !== void 0 ? a.push(this.getDependency("bufferView", n.bufferView)) : a.push(null), n.sparse !== void 0 && (a.push(this.getDependency("bufferView", n.sparse.indices.bufferView)), a.push(this.getDependency("bufferView", n.sparse.values.bufferView))), Promise.all(a).then(function(i) {
|
|
942
|
-
var s = i[0], o = z[n.type], l = Q[n.componentType], f = l.BYTES_PER_ELEMENT, h = f * o, c = n.byteOffset || 0, d = n.bufferView !== void 0 ? t.bufferViews[n.bufferView].byteStride : void 0, A = n.normalized === !0, E, y;
|
|
943
|
-
if (d && d !== h) {
|
|
944
|
-
var S = Math.floor(c / d), L = "InterleavedBuffer:" + n.bufferView + ":" + n.componentType + ":" + S + ":" + n.count, O = r.cache.get(L);
|
|
945
|
-
O || (E = new l(s, S * d, n.count * d / f), O = new dr(E, d / f), r.cache.add(L, O)), y = new pr(O, o, c % d / f, A);
|
|
946
|
-
} else
|
|
947
|
-
s === null ? E = new l(n.count * o) : E = new l(s, c, n.count * o), y = new Re(E, o, A);
|
|
948
|
-
if (n.sparse !== void 0) {
|
|
949
|
-
var G = z.SCALAR, te = Q[n.sparse.indices.componentType], ae = n.sparse.indices.byteOffset || 0, $ = n.sparse.values.byteOffset || 0, B = new te(i[1], ae, n.sparse.count * G), ue = new l(i[2], $, n.sparse.count * o);
|
|
950
|
-
s !== null && (y = new Re(y.array.slice(), y.itemSize, y.normalized));
|
|
951
|
-
for (var H = 0, be = B.length; H < be; H++) {
|
|
952
|
-
var se = B[H];
|
|
953
|
-
if (y.setX(se, ue[H * o]), o >= 2 && y.setY(se, ue[H * o + 1]), o >= 3 && y.setZ(se, ue[H * o + 2]), o >= 4 && y.setW(se, ue[H * o + 3]), o >= 5) throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.");
|
|
954
|
-
}
|
|
955
|
-
}
|
|
956
|
-
return y;
|
|
957
|
-
});
|
|
958
|
-
}, C.prototype.loadTexture = function(e) {
|
|
959
|
-
var r = this, t = this.json, n = this.options, a = this.textureLoader, i = self.URL || self.webkitURL, s = t.textures[e], o = s.extensions || {}, l;
|
|
960
|
-
o[u.MSFT_TEXTURE_DDS] ? l = t.images[o[u.MSFT_TEXTURE_DDS].source] : l = t.images[s.source];
|
|
961
|
-
var f = l.uri, h = !1;
|
|
962
|
-
return l.bufferView !== void 0 && (f = r.getDependency("bufferView", l.bufferView).then(function(c) {
|
|
963
|
-
h = !0;
|
|
964
|
-
var d = new Blob([c], { type: l.mimeType });
|
|
965
|
-
return f = i.createObjectURL(d), f;
|
|
966
|
-
})), Promise.resolve(f).then(function(c) {
|
|
967
|
-
var d = n.manager.getHandler(c);
|
|
968
|
-
return d || (d = o[u.MSFT_TEXTURE_DDS] ? r.extensions[u.MSFT_TEXTURE_DDS].ddsLoader : a), new Promise(function(A, E) {
|
|
969
|
-
d.load(ge(c, n.path), A, void 0, E);
|
|
970
|
-
});
|
|
971
|
-
}).then(function(c) {
|
|
972
|
-
h === !0 && i.revokeObjectURL(f), c.flipY = !1, s.name && (c.name = s.name), l.mimeType in Te && (c.format = Te[l.mimeType]);
|
|
973
|
-
var d = t.samplers || {}, A = d[s.sampler] || {};
|
|
974
|
-
return c.magFilter = Z[A.magFilter] || Xe, c.minFilter = Z[A.minFilter] || Ve, c.wrapS = X[A.wrapS] || Fe, c.wrapT = X[A.wrapT] || Fe, r.associations.set(c, {
|
|
975
|
-
type: "textures",
|
|
976
|
-
index: e
|
|
977
|
-
}), c;
|
|
978
|
-
});
|
|
979
|
-
}, C.prototype.assignTexture = function(e, r, t) {
|
|
980
|
-
var n = this;
|
|
981
|
-
return this.getDependency("texture", t.index).then(function(a) {
|
|
982
|
-
if (!a.isCompressedTexture)
|
|
983
|
-
switch (r) {
|
|
984
|
-
case "aoMap":
|
|
985
|
-
case "emissiveMap":
|
|
986
|
-
case "metalnessMap":
|
|
987
|
-
case "normalMap":
|
|
988
|
-
case "roughnessMap":
|
|
989
|
-
a.format = je;
|
|
990
|
-
break;
|
|
991
|
-
}
|
|
992
|
-
if (t.texCoord !== void 0 && t.texCoord != 0 && !(r === "aoMap" && t.texCoord == 1) && console.warn("THREE.GLTFLoader: Custom UV set " + t.texCoord + " for texture " + r + " not yet supported."), n.extensions[u.KHR_TEXTURE_TRANSFORM]) {
|
|
993
|
-
var i = t.extensions !== void 0 ? t.extensions[u.KHR_TEXTURE_TRANSFORM] : void 0;
|
|
994
|
-
if (i) {
|
|
995
|
-
var s = n.associations.get(a);
|
|
996
|
-
a = n.extensions[u.KHR_TEXTURE_TRANSFORM].extendTexture(a, i), n.associations.set(a, s);
|
|
997
|
-
}
|
|
998
|
-
}
|
|
999
|
-
e[r] = a;
|
|
1000
|
-
});
|
|
1001
|
-
}, C.prototype.assignFinalMaterial = function(e) {
|
|
1002
|
-
var r = e.geometry, t = e.material, n = 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, l = o && r.morphAttributes.normal !== void 0;
|
|
1003
|
-
if (e.isPoints) {
|
|
1004
|
-
var f = "PointsMaterial:" + t.uuid, h = this.cache.get(f);
|
|
1005
|
-
h || (h = new Sr(), ze.prototype.copy.call(h, t), h.color.copy(t.color), h.map = t.map, h.sizeAttenuation = !1, this.cache.add(f, h)), t = h;
|
|
1006
|
-
} else if (e.isLine) {
|
|
1007
|
-
var f = "LineBasicMaterial:" + t.uuid, c = this.cache.get(f);
|
|
1008
|
-
c || (c = new yr(), ze.prototype.copy.call(c, t), c.color.copy(t.color), this.cache.add(f, c)), t = c;
|
|
1009
|
-
}
|
|
1010
|
-
if (n || a || i || s || o) {
|
|
1011
|
-
var f = "ClonedMaterial:" + t.uuid + ":";
|
|
1012
|
-
t.isGLTFSpecularGlossinessMaterial && (f += "specular-glossiness:"), s && (f += "skinning:"), n && (f += "vertex-tangents:"), a && (f += "vertex-colors:"), i && (f += "flat-shading:"), o && (f += "morph-targets:"), l && (f += "morph-normals:");
|
|
1013
|
-
var d = this.cache.get(f);
|
|
1014
|
-
d || (d = t.clone(), s && (d.skinning = !0), n && (d.vertexTangents = !0), a && (d.vertexColors = !0), i && (d.flatShading = !0), o && (d.morphTargets = !0), l && (d.morphNormals = !0), this.cache.add(f, d), this.associations.set(d, this.associations.get(t))), t = d;
|
|
1015
|
-
}
|
|
1016
|
-
t.aoMap && r.attributes.uv2 === void 0 && r.attributes.uv !== void 0 && r.setAttribute("uv2", r.attributes.uv), t.normalScale && !n && (t.normalScale.y = -t.normalScale.y), t.clearcoatNormalScale && !n && (t.clearcoatNormalScale.y = -t.clearcoatNormalScale.y), e.material = t;
|
|
1017
|
-
}, C.prototype.loadMaterial = function(e) {
|
|
1018
|
-
var r = this, t = this.json, n = this.extensions, a = t.materials[e], i, s = {}, o = a.extensions || {}, l = [];
|
|
1019
|
-
if (o[u.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS]) {
|
|
1020
|
-
var f = n[u.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS];
|
|
1021
|
-
i = f.getMaterialType(), l.push(f.extendParams(s, a, r));
|
|
1022
|
-
} else if (o[u.KHR_MATERIALS_UNLIT]) {
|
|
1023
|
-
var h = n[u.KHR_MATERIALS_UNLIT];
|
|
1024
|
-
i = h.getMaterialType(), l.push(h.extendParams(s, a, r));
|
|
1025
|
-
} else {
|
|
1026
|
-
i = ve;
|
|
1027
|
-
var c = a.pbrMetallicRoughness || {};
|
|
1028
|
-
if (s.color = new re(1, 1, 1), s.opacity = 1, Array.isArray(c.baseColorFactor)) {
|
|
1029
|
-
var d = c.baseColorFactor;
|
|
1030
|
-
s.color.fromArray(d), s.opacity = d[3];
|
|
1031
|
-
}
|
|
1032
|
-
c.baseColorTexture !== void 0 && l.push(r.assignTexture(s, "map", c.baseColorTexture)), s.metalness = c.metallicFactor !== void 0 ? c.metallicFactor : 1, s.roughness = c.roughnessFactor !== void 0 ? c.roughnessFactor : 1, c.metallicRoughnessTexture !== void 0 && (l.push(r.assignTexture(s, "metalnessMap", c.metallicRoughnessTexture)), l.push(r.assignTexture(s, "roughnessMap", c.metallicRoughnessTexture)));
|
|
1033
|
-
}
|
|
1034
|
-
a.doubleSided === !0 && (s.side = Er);
|
|
1035
|
-
var A = a.alphaMode || fe.OPAQUE;
|
|
1036
|
-
if (A === fe.BLEND ? (s.transparent = !0, s.depthWrite = !1) : (s.transparent = !1, A === fe.MASK && (s.alphaTest = a.alphaCutoff !== void 0 ? a.alphaCutoff : 0.5)), a.normalTexture !== void 0 && i !== he && (l.push(r.assignTexture(s, "normalMap", a.normalTexture)), s.normalScale = new Be(1, 1), a.normalTexture.scale !== void 0 && s.normalScale.set(a.normalTexture.scale, a.normalTexture.scale)), a.occlusionTexture !== void 0 && i !== he && (l.push(r.assignTexture(s, "aoMap", a.occlusionTexture)), a.occlusionTexture.strength !== void 0 && (s.aoMapIntensity = a.occlusionTexture.strength)), a.emissiveFactor !== void 0 && i !== he && (s.emissive = new re().fromArray(a.emissiveFactor)), a.emissiveTexture !== void 0 && i !== he && l.push(r.assignTexture(s, "emissiveMap", a.emissiveTexture)), o[u.KHR_MATERIALS_CLEARCOAT]) {
|
|
1037
|
-
var E = n[u.KHR_MATERIALS_CLEARCOAT];
|
|
1038
|
-
i = E.getMaterialType(), l.push(E.extendParams(s, { extensions: o }, r));
|
|
1039
|
-
}
|
|
1040
|
-
if (o[u.KHR_MATERIALS_TRANSMISSION]) {
|
|
1041
|
-
var E = n[u.KHR_MATERIALS_TRANSMISSION];
|
|
1042
|
-
i = E.getMaterialType(), l.push(E.extendParams(s, { extensions: o }, r));
|
|
1043
|
-
}
|
|
1044
|
-
if (o[u.REALSEE_MATERIALS_LIGHTMAP]) {
|
|
1045
|
-
var y = n[u.REALSEE_MATERIALS_LIGHTMAP];
|
|
1046
|
-
i = y.getMaterialType(), l.push(y.extendParams(s, { extensions: o }, r));
|
|
1047
|
-
}
|
|
1048
|
-
return Promise.all(l).then(function() {
|
|
1049
|
-
var S;
|
|
1050
|
-
return i === w ? S = n[u.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS].createMaterial(s) : S = new i(s), a.name && (S.name = a.name), S.map && (S.map.encoding = We), S.emissiveMap && (S.emissiveMap.encoding = We), W(S, a), r.associations.set(S, { type: "materials", index: e }), a.extensions && oe(n, S, a), S;
|
|
1051
|
-
});
|
|
1052
|
-
};
|
|
1053
|
-
function me(e, r, t) {
|
|
1054
|
-
var n = r.attributes, a = new Nr();
|
|
1055
|
-
if (n.POSITION !== void 0) {
|
|
1056
|
-
var i = t.json.accessors[n.POSITION], s = i.min, o = i.max;
|
|
1057
|
-
if (s !== void 0 && o !== void 0)
|
|
1058
|
-
a.set(
|
|
1059
|
-
new ye(s[0], s[1], s[2]),
|
|
1060
|
-
new ye(o[0], o[1], o[2])
|
|
1061
|
-
);
|
|
1062
|
-
else {
|
|
1063
|
-
console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");
|
|
1064
|
-
return;
|
|
1065
|
-
}
|
|
1066
|
-
} else
|
|
1067
|
-
return;
|
|
1068
|
-
var l = r.targets;
|
|
1069
|
-
if (l !== void 0) {
|
|
1070
|
-
for (var f = new ye(), h = new ye(), c = 0, d = l.length; c < d; c++) {
|
|
1071
|
-
var A = l[c];
|
|
1072
|
-
if (A.POSITION !== void 0) {
|
|
1073
|
-
var i = t.json.accessors[A.POSITION], s = i.min, o = i.max;
|
|
1074
|
-
s !== void 0 && o !== void 0 ? (h.setX(Math.max(Math.abs(s[0]), Math.abs(o[0]))), h.setY(Math.max(Math.abs(s[1]), Math.abs(o[1]))), h.setZ(Math.max(Math.abs(s[2]), Math.abs(o[2]))), f.max(h)) : console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");
|
|
1075
|
-
}
|
|
1076
|
-
}
|
|
1077
|
-
a.expandByVector(f);
|
|
1078
|
-
}
|
|
1079
|
-
e.boundingBox = a;
|
|
1080
|
-
var E = new kr();
|
|
1081
|
-
a.getCenter(E.center), E.radius = a.min.distanceTo(a.max) / 2, e.boundingSphere = E;
|
|
1082
|
-
}
|
|
1083
|
-
function V(e, r, t) {
|
|
1084
|
-
var n = r.attributes, a = [];
|
|
1085
|
-
function i(f, h) {
|
|
1086
|
-
return t.getDependency("accessor", f).then(function(c) {
|
|
1087
|
-
e.setAttribute(h, c);
|
|
1088
|
-
});
|
|
1089
|
-
}
|
|
1090
|
-
for (var s in n) {
|
|
1091
|
-
var o = le[s] || s.toLowerCase();
|
|
1092
|
-
o in e.attributes || a.push(i(n[s], o));
|
|
1093
|
-
}
|
|
1094
|
-
if (r.indices !== void 0 && !e.index) {
|
|
1095
|
-
var l = t.getDependency("accessor", r.indices).then(function(f) {
|
|
1096
|
-
e.setIndex(f);
|
|
1097
|
-
});
|
|
1098
|
-
a.push(l);
|
|
1099
|
-
}
|
|
1100
|
-
return W(e, r), me(e, r, t), Promise.all(a).then(function() {
|
|
1101
|
-
return r.targets !== void 0 ? we(e, r.targets, t) : e;
|
|
1102
|
-
});
|
|
1103
|
-
}
|
|
1104
|
-
function ie(e, r) {
|
|
1105
|
-
var t = e.getIndex();
|
|
1106
|
-
if (t === null) {
|
|
1107
|
-
var n = [], a = e.getAttribute("position");
|
|
1108
|
-
if (a !== void 0) {
|
|
1109
|
-
for (var i = 0; i < a.count; i++)
|
|
1110
|
-
n.push(i);
|
|
1111
|
-
e.setIndex(n), t = e.getIndex();
|
|
1112
|
-
} else
|
|
1113
|
-
return console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."), e;
|
|
1114
|
-
}
|
|
1115
|
-
var s = t.count - 2, o = [];
|
|
1116
|
-
if (r === Je)
|
|
1117
|
-
for (var i = 1; i <= s; i++)
|
|
1118
|
-
o.push(t.getX(0)), o.push(t.getX(i)), o.push(t.getX(i + 1));
|
|
1119
|
-
else
|
|
1120
|
-
for (var i = 0; i < s; i++)
|
|
1121
|
-
i % 2 === 0 ? (o.push(t.getX(i)), o.push(t.getX(i + 1)), o.push(t.getX(i + 2))) : (o.push(t.getX(i + 2)), o.push(t.getX(i + 1)), o.push(t.getX(i)));
|
|
1122
|
-
o.length / 3 !== s && console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");
|
|
1123
|
-
var l = e.clone();
|
|
1124
|
-
return l.setIndex(o), l;
|
|
1125
|
-
}
|
|
1126
|
-
return C.prototype.loadGeometries = function(e) {
|
|
1127
|
-
var r = this, t = this.extensions, n = this.primitiveCache;
|
|
1128
|
-
function a(d) {
|
|
1129
|
-
return t[u.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(d, r).then(function(A) {
|
|
1130
|
-
return V(A, d, r);
|
|
1131
|
-
});
|
|
1132
|
-
}
|
|
1133
|
-
for (var i = [], s = 0, o = e.length; s < o; s++) {
|
|
1134
|
-
var l = e[s], f = U(l), h = n[f];
|
|
1135
|
-
if (h)
|
|
1136
|
-
i.push(h.promise);
|
|
1137
|
-
else {
|
|
1138
|
-
var c;
|
|
1139
|
-
l.extensions && l.extensions[u.KHR_DRACO_MESH_COMPRESSION] ? c = a(l) : c = V(new $e(), l, r), n[f] = { primitive: l, promise: c }, i.push(c);
|
|
1140
|
-
}
|
|
1141
|
-
}
|
|
1142
|
-
return Promise.all(i);
|
|
1143
|
-
}, C.prototype.loadMesh = function(e) {
|
|
1144
|
-
for (var r = this, t = this.json, n = t.meshes[e], a = n.primitives, i = [], s = 0, o = a.length; s < o; s++) {
|
|
1145
|
-
var l = a[s].material === void 0 ? Me(this.cache) : this.getDependency("material", a[s].material);
|
|
1146
|
-
i.push(l);
|
|
1147
|
-
}
|
|
1148
|
-
return i.push(r.loadGeometries(a)), Promise.all(i).then(function(f) {
|
|
1149
|
-
for (var h = f.slice(0, f.length - 1), c = f[f.length - 1], d = [], A = 0, E = c.length; A < E; A++) {
|
|
1150
|
-
var y = c[A], S = a[A], L, O = h[A];
|
|
1151
|
-
if (S.mode === N.TRIANGLES || S.mode === N.TRIANGLE_STRIP || S.mode === N.TRIANGLE_FAN || S.mode === void 0)
|
|
1152
|
-
L = n.isSkinnedMesh === !0 ? new _r(y, O) : new Rr(y, O), L.isSkinnedMesh === !0 && !L.geometry.attributes.skinWeight.normalized && L.normalizeSkinWeights(), S.mode === N.TRIANGLE_STRIP ? L.geometry = ie(L.geometry, Br) : S.mode === N.TRIANGLE_FAN && (L.geometry = ie(L.geometry, Je));
|
|
1153
|
-
else if (S.mode === N.LINES)
|
|
1154
|
-
L = new Lr(y, O);
|
|
1155
|
-
else if (S.mode === N.LINE_STRIP)
|
|
1156
|
-
L = new Mr(y, O);
|
|
1157
|
-
else if (S.mode === N.LINE_LOOP)
|
|
1158
|
-
L = new wr(y, O);
|
|
1159
|
-
else if (S.mode === N.POINTS)
|
|
1160
|
-
L = new Ir(y, O);
|
|
1161
|
-
else
|
|
1162
|
-
throw new Error("THREE.GLTFLoader: Primitive mode unsupported: " + S.mode);
|
|
1163
|
-
Object.keys(L.geometry.morphAttributes).length > 0 && Ie(L, n), L.name = n.name || "mesh_" + e, c.length > 1 && (L.name += "_" + A), W(L, n), r.assignFinalMaterial(L), d.push(L);
|
|
1164
|
-
}
|
|
1165
|
-
if (d.length === 1)
|
|
1166
|
-
return d[0];
|
|
1167
|
-
for (var G = new Ue(), A = 0, E = d.length; A < E; A++)
|
|
1168
|
-
G.add(d[A]);
|
|
1169
|
-
return G;
|
|
1170
|
-
});
|
|
1171
|
-
}, C.prototype.loadCamera = function(e) {
|
|
1172
|
-
var r, t = this.json.cameras[e], n = t[t.type];
|
|
1173
|
-
if (!n) {
|
|
1174
|
-
console.warn("THREE.GLTFLoader: Missing camera parameters.");
|
|
1175
|
-
return;
|
|
1176
|
-
}
|
|
1177
|
-
return t.type === "perspective" ? r = new br(xr.radToDeg(n.yfov), n.aspectRatio || 1, n.znear || 1, n.zfar || 2e6) : t.type === "orthographic" && (r = new Cr(-n.xmag, n.xmag, n.ymag, -n.ymag, n.znear, n.zfar)), t.name && (r.name = t.name), W(r, t), Promise.resolve(r);
|
|
1178
|
-
}, C.prototype.loadSkin = function(e) {
|
|
1179
|
-
var r = this.json.skins[e], t = { joints: r.joints };
|
|
1180
|
-
return r.inverseBindMatrices === void 0 ? Promise.resolve(t) : this.getDependency("accessor", r.inverseBindMatrices).then(function(n) {
|
|
1181
|
-
return t.inverseBindMatrices = n, t;
|
|
1182
|
-
});
|
|
1183
|
-
}, C.prototype.loadAnimation = function(e) {
|
|
1184
|
-
for (var r = this.json, t = r.animations[e], n = [], a = [], i = [], s = [], o = [], l = 0, f = t.channels.length; l < f; l++) {
|
|
1185
|
-
var h = t.channels[l], c = t.samplers[h.sampler], d = h.target, A = d.node !== void 0 ? d.node : d.id, E = t.parameters !== void 0 ? t.parameters[c.input] : c.input, y = t.parameters !== void 0 ? t.parameters[c.output] : c.output;
|
|
1186
|
-
n.push(this.getDependency("node", A)), a.push(this.getDependency("accessor", E)), i.push(this.getDependency("accessor", y)), s.push(c), o.push(d);
|
|
1187
|
-
}
|
|
1188
|
-
return Promise.all([
|
|
1189
|
-
Promise.all(n),
|
|
1190
|
-
Promise.all(a),
|
|
1191
|
-
Promise.all(i),
|
|
1192
|
-
Promise.all(s),
|
|
1193
|
-
Promise.all(o)
|
|
1194
|
-
]).then(function(S) {
|
|
1195
|
-
for (var L = S[0], O = S[1], G = S[2], te = S[3], ae = S[4], $ = [], B = 0, ue = L.length; B < ue; B++) {
|
|
1196
|
-
var H = L[B], be = O[B], se = G[B], xe = te[B], Ce = ae[B];
|
|
1197
|
-
if (H !== void 0) {
|
|
1198
|
-
H.updateMatrix(), H.matrixAutoUpdate = !0;
|
|
1199
|
-
var Ae;
|
|
1200
|
-
switch (j[Ce.path]) {
|
|
1201
|
-
case j.weights:
|
|
1202
|
-
Ae = Vr;
|
|
1203
|
-
break;
|
|
1204
|
-
case j.rotation:
|
|
1205
|
-
Ae = jr;
|
|
1206
|
-
break;
|
|
1207
|
-
case j.position:
|
|
1208
|
-
case j.scale:
|
|
1209
|
-
default:
|
|
1210
|
-
Ae = Kr;
|
|
1211
|
-
break;
|
|
1212
|
-
}
|
|
1213
|
-
var nr = H.name ? H.name : H.uuid, tr = xe.interpolation !== void 0 ? Le[xe.interpolation] : Ye, Se = [];
|
|
1214
|
-
j[Ce.path] === j.weights ? H.traverse(function(de) {
|
|
1215
|
-
de.isMesh === !0 && de.morphTargetInfluences && Se.push(de.name ? de.name : de.uuid);
|
|
1216
|
-
}) : Se.push(nr);
|
|
1217
|
-
var q = se.array;
|
|
1218
|
-
if (se.normalized) {
|
|
1219
|
-
var ce;
|
|
1220
|
-
if (q.constructor === Int8Array)
|
|
1221
|
-
ce = 1 / 127;
|
|
1222
|
-
else if (q.constructor === Uint8Array)
|
|
1223
|
-
ce = 1 / 255;
|
|
1224
|
-
else if (q.constructor == Int16Array)
|
|
1225
|
-
ce = 1 / 32767;
|
|
1226
|
-
else if (q.constructor === Uint16Array)
|
|
1227
|
-
ce = 1 / 65535;
|
|
1228
|
-
else
|
|
1229
|
-
throw new Error("THREE.GLTFLoader: Unsupported output accessor component type.");
|
|
1230
|
-
for (var Ne = new Float32Array(q.length), ee = 0, Oe = q.length; ee < Oe; ee++)
|
|
1231
|
-
Ne[ee] = q[ee] * ce;
|
|
1232
|
-
q = Ne;
|
|
1233
|
-
}
|
|
1234
|
-
for (var ee = 0, Oe = Se.length; ee < Oe; ee++) {
|
|
1235
|
-
var Pe = new Ae(
|
|
1236
|
-
Se[ee] + "." + j[Ce.path],
|
|
1237
|
-
be.array,
|
|
1238
|
-
q,
|
|
1239
|
-
tr
|
|
1240
|
-
);
|
|
1241
|
-
xe.interpolation === "CUBICSPLINE" && (Pe.createInterpolant = function(sr) {
|
|
1242
|
-
return new D(this.times, this.values, this.getValueSize() / 3, sr);
|
|
1243
|
-
}, Pe.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline = !0), $.push(Pe);
|
|
1244
|
-
}
|
|
1245
|
-
}
|
|
1246
|
-
}
|
|
1247
|
-
var ar = t.name ? t.name : "animation_" + e;
|
|
1248
|
-
return new Pr(ar, void 0, $);
|
|
1249
|
-
});
|
|
1250
|
-
}, C.prototype.loadNode = function(e) {
|
|
1251
|
-
var r = this.json, t = this.extensions, n = this, a = r.meshReferences, i = r.meshUses, s = r.nodes[e];
|
|
1252
|
-
return (function() {
|
|
1253
|
-
var o = [];
|
|
1254
|
-
return s.mesh !== void 0 && o.push(n.getDependency("mesh", s.mesh).then(function(l) {
|
|
1255
|
-
var f;
|
|
1256
|
-
if (a[s.mesh] > 1) {
|
|
1257
|
-
var h = i[s.mesh]++;
|
|
1258
|
-
f = l.clone(), f.name += "_instance_" + h;
|
|
1259
|
-
} else
|
|
1260
|
-
f = l;
|
|
1261
|
-
return s.weights !== void 0 && f.traverse(function(c) {
|
|
1262
|
-
if (c.isMesh)
|
|
1263
|
-
for (var d = 0, A = s.weights.length; d < A; d++)
|
|
1264
|
-
c.morphTargetInfluences[d] = s.weights[d];
|
|
1265
|
-
}), f;
|
|
1266
|
-
})), s.camera !== void 0 && o.push(n.getDependency("camera", s.camera)), s.extensions && s.extensions[u.KHR_LIGHTS_PUNCTUAL] && s.extensions[u.KHR_LIGHTS_PUNCTUAL].light !== void 0 && o.push(n.getDependency("light", s.extensions[u.KHR_LIGHTS_PUNCTUAL].light)), Promise.all(o);
|
|
1267
|
-
})().then(function(o) {
|
|
1268
|
-
var l;
|
|
1269
|
-
if (s.isBone === !0 ? l = new Dr() : o.length > 1 ? l = new Ue() : o.length === 1 ? l = o[0] : l = new Fr(), l !== o[0])
|
|
1270
|
-
for (var f = 0, h = o.length; f < h; f++)
|
|
1271
|
-
l.add(o[f]);
|
|
1272
|
-
if (s.name && (l.userData.name = s.name, l.name = Ur.sanitizeNodeName(s.name)), W(l, s), s.extensions && oe(t, l, s), s.matrix !== void 0) {
|
|
1273
|
-
var c = new qe();
|
|
1274
|
-
c.fromArray(s.matrix), l.applyMatrix4(c);
|
|
1275
|
-
} else
|
|
1276
|
-
s.translation !== void 0 && l.position.fromArray(s.translation), s.rotation !== void 0 && l.quaternion.fromArray(s.rotation), s.scale !== void 0 && l.scale.fromArray(s.scale);
|
|
1277
|
-
return n.associations.set(l, { type: "nodes", index: e }), l;
|
|
1278
|
-
});
|
|
1279
|
-
}, C.prototype.loadScene = /* @__PURE__ */ (function() {
|
|
1280
|
-
function e(r, t, n, a) {
|
|
1281
|
-
var i = n.nodes[r];
|
|
1282
|
-
return a.getDependency("node", r).then(function(s) {
|
|
1283
|
-
if (i.skin === void 0) return s;
|
|
1284
|
-
var o;
|
|
1285
|
-
return a.getDependency("skin", i.skin).then(function(l) {
|
|
1286
|
-
o = l;
|
|
1287
|
-
for (var f = [], h = 0, c = o.joints.length; h < c; h++)
|
|
1288
|
-
f.push(a.getDependency("node", o.joints[h]));
|
|
1289
|
-
return Promise.all(f);
|
|
1290
|
-
}).then(function(l) {
|
|
1291
|
-
return s.traverse(function(f) {
|
|
1292
|
-
if (f.isMesh) {
|
|
1293
|
-
for (var h = [], c = [], d = 0, A = l.length; d < A; d++) {
|
|
1294
|
-
var E = l[d];
|
|
1295
|
-
if (E) {
|
|
1296
|
-
h.push(E);
|
|
1297
|
-
var y = new qe();
|
|
1298
|
-
o.inverseBindMatrices !== void 0 && y.fromArray(o.inverseBindMatrices.array, d * 16), c.push(y);
|
|
1299
|
-
} else
|
|
1300
|
-
console.warn('THREE.GLTFLoader: Joint "%s" could not be found.', o.joints[d]);
|
|
1301
|
-
}
|
|
1302
|
-
f.bind(new Hr(h, c), f.matrixWorld);
|
|
1303
|
-
}
|
|
1304
|
-
}), s;
|
|
1305
|
-
});
|
|
1306
|
-
}).then(function(s) {
|
|
1307
|
-
t.add(s);
|
|
1308
|
-
var o = [];
|
|
1309
|
-
if (i.children)
|
|
1310
|
-
for (var l = i.children, f = 0, h = l.length; f < h; f++) {
|
|
1311
|
-
var c = l[f];
|
|
1312
|
-
o.push(e(c, s, n, a));
|
|
1313
|
-
}
|
|
1314
|
-
return Promise.all(o);
|
|
1315
|
-
});
|
|
1316
|
-
}
|
|
1317
|
-
return function(t) {
|
|
1318
|
-
var n = this.json, a = this.extensions, i = this.json.scenes[t], s = this, o = new Ue();
|
|
1319
|
-
i.name && (o.name = i.name), W(o, i), i.extensions && oe(a, o, i);
|
|
1320
|
-
for (var l = i.nodes || [], f = [], h = 0, c = l.length; h < c; h++)
|
|
1321
|
-
f.push(e(l[h], o, n, s));
|
|
1322
|
-
return Promise.all(f).then(function() {
|
|
1323
|
-
return o;
|
|
1324
|
-
});
|
|
1325
|
-
};
|
|
1326
|
-
})(), p;
|
|
1327
|
-
})(), k = function(p) {
|
|
1328
|
-
Ee.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 = {
|
|
1329
|
-
position: "POSITION",
|
|
1330
|
-
normal: "NORMAL",
|
|
1331
|
-
color: "COLOR",
|
|
1332
|
-
uv: "TEX_COORD"
|
|
1333
|
-
}, this.defaultAttributeTypes = {
|
|
1334
|
-
position: "Float32Array",
|
|
1335
|
-
normal: "Float32Array",
|
|
1336
|
-
color: "Float32Array",
|
|
1337
|
-
uv: "Float32Array"
|
|
1338
|
-
};
|
|
1258
|
+
W.prototype = Object.assign(Object.create(E.prototype), {
|
|
1259
|
+
constructor: W,
|
|
1260
|
+
setDecoderPath: function(e) {
|
|
1261
|
+
return this.decoderPath = e, this;
|
|
1262
|
+
},
|
|
1263
|
+
setDecoderConfig: function(e) {
|
|
1264
|
+
return this.decoderConfig = e, this;
|
|
1265
|
+
},
|
|
1266
|
+
setWorkerLimit: function(e) {
|
|
1267
|
+
return this.workerLimit = e, this;
|
|
1268
|
+
},
|
|
1269
|
+
setVerbosity: function() {
|
|
1270
|
+
console.warn("THREE.DRACOLoader: The .setVerbosity() method has been removed.");
|
|
1271
|
+
},
|
|
1272
|
+
setDrawMode: function() {
|
|
1273
|
+
console.warn("THREE.DRACOLoader: The .setDrawMode() method has been removed.");
|
|
1274
|
+
},
|
|
1275
|
+
setSkipDequantization: function() {
|
|
1276
|
+
console.warn("THREE.DRACOLoader: The .setSkipDequantization() method has been removed.");
|
|
1277
|
+
},
|
|
1278
|
+
load: function(e, t, n, r) {
|
|
1279
|
+
var i = new d(this.manager);
|
|
1280
|
+
i.setPath(this.path), i.setResponseType("arraybuffer"), this.crossOrigin === "use-credentials" && i.setWithCredentials(!0), i.load(e, (e) => {
|
|
1281
|
+
var n = {
|
|
1282
|
+
attributeIDs: this.defaultAttributeIDs,
|
|
1283
|
+
attributeTypes: this.defaultAttributeTypes,
|
|
1284
|
+
useUniqueIDs: !1
|
|
1285
|
+
};
|
|
1286
|
+
this.decodeGeometry(e, n).then(t).catch(r);
|
|
1287
|
+
}, n, r);
|
|
1288
|
+
},
|
|
1289
|
+
decodeDracoFile: function(e, t, n, r) {
|
|
1290
|
+
var i = {
|
|
1291
|
+
attributeIDs: n || this.defaultAttributeIDs,
|
|
1292
|
+
attributeTypes: r || this.defaultAttributeTypes,
|
|
1293
|
+
useUniqueIDs: !!n
|
|
1294
|
+
};
|
|
1295
|
+
this.decodeGeometry(e, i).then(t);
|
|
1296
|
+
},
|
|
1297
|
+
decodeGeometry: function(e, t) {
|
|
1298
|
+
for (var n in t.attributeTypes) {
|
|
1299
|
+
var r = t.attributeTypes[n];
|
|
1300
|
+
r.BYTES_PER_ELEMENT !== void 0 && (t.attributeTypes[n] = r.name);
|
|
1301
|
+
}
|
|
1302
|
+
var i = JSON.stringify(t);
|
|
1303
|
+
if (W.taskCache.has(e)) {
|
|
1304
|
+
var a = W.taskCache.get(e);
|
|
1305
|
+
if (a.key === i) return a.promise;
|
|
1306
|
+
if (e.byteLength === 0) throw Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.");
|
|
1307
|
+
}
|
|
1308
|
+
var o, s = this.workerNextTaskID++, c = e.byteLength, l = this._getWorker(s, c).then((n) => (o = n, new Promise((n, r) => {
|
|
1309
|
+
o._callbacks[s] = {
|
|
1310
|
+
resolve: n,
|
|
1311
|
+
reject: r
|
|
1312
|
+
}, o.postMessage({
|
|
1313
|
+
type: "decode",
|
|
1314
|
+
id: s,
|
|
1315
|
+
taskConfig: t,
|
|
1316
|
+
buffer: e
|
|
1317
|
+
}, [e]);
|
|
1318
|
+
}))).then((e) => this._createGeometry(e.geometry));
|
|
1319
|
+
return l.catch(() => !0).then(() => {
|
|
1320
|
+
o && s && this._releaseTask(o, s);
|
|
1321
|
+
}), W.taskCache.set(e, {
|
|
1322
|
+
key: i,
|
|
1323
|
+
promise: l
|
|
1324
|
+
}), l;
|
|
1325
|
+
},
|
|
1326
|
+
_createGeometry: function(e) {
|
|
1327
|
+
var t = new a();
|
|
1328
|
+
e.index && t.setIndex(new i(e.index.array, 1));
|
|
1329
|
+
for (var n = 0; n < e.attributes.length; n++) {
|
|
1330
|
+
var r = e.attributes[n], o = r.name, s = r.array, c = r.itemSize;
|
|
1331
|
+
t.setAttribute(o, new i(s, c));
|
|
1332
|
+
}
|
|
1333
|
+
return t;
|
|
1334
|
+
},
|
|
1335
|
+
_loadLibrary: function(e, t) {
|
|
1336
|
+
var n = new d(this.manager);
|
|
1337
|
+
return n.setPath(this.decoderPath), n.setResponseType(t), new Promise((t, r) => {
|
|
1338
|
+
n.load(e, t, void 0, r);
|
|
1339
|
+
});
|
|
1340
|
+
},
|
|
1341
|
+
preload: function() {
|
|
1342
|
+
return this._initDecoder(), this;
|
|
1343
|
+
},
|
|
1344
|
+
_initDecoder: function() {
|
|
1345
|
+
if (this.decoderPending) return this.decoderPending;
|
|
1346
|
+
var e = typeof WebAssembly != "object" || this.decoderConfig.type === "js", t = [];
|
|
1347
|
+
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) => {
|
|
1348
|
+
var n = t[0];
|
|
1349
|
+
e || (this.decoderConfig.wasmBinary = t[1]);
|
|
1350
|
+
var r = W.DRACOWorker.toString(), i = [
|
|
1351
|
+
"/* draco decoder */",
|
|
1352
|
+
n,
|
|
1353
|
+
"",
|
|
1354
|
+
"/* worker */",
|
|
1355
|
+
r.substring(r.indexOf("{") + 1, r.lastIndexOf("}"))
|
|
1356
|
+
].join("\n");
|
|
1357
|
+
this.workerSourceURL = URL.createObjectURL(new Blob([i]));
|
|
1358
|
+
}), this.decoderPending;
|
|
1359
|
+
},
|
|
1360
|
+
_getWorker: function(e, t) {
|
|
1361
|
+
return this._initDecoder().then(() => {
|
|
1362
|
+
if (this.workerPool.length < this.workerLimit) {
|
|
1363
|
+
var n = new Worker(this.workerSourceURL);
|
|
1364
|
+
n._callbacks = {}, n._taskCosts = {}, n._taskLoad = 0, n.postMessage({
|
|
1365
|
+
type: "init",
|
|
1366
|
+
decoderConfig: this.decoderConfig
|
|
1367
|
+
}), n.onmessage = function(e) {
|
|
1368
|
+
var t = e.data;
|
|
1369
|
+
switch (t.type) {
|
|
1370
|
+
case "decode":
|
|
1371
|
+
n._callbacks[t.id].resolve(t);
|
|
1372
|
+
break;
|
|
1373
|
+
case "error":
|
|
1374
|
+
n._callbacks[t.id].reject(t);
|
|
1375
|
+
break;
|
|
1376
|
+
default: console.error("THREE.DRACOLoader: Unexpected message, \"" + t.type + "\"");
|
|
1377
|
+
}
|
|
1378
|
+
}, this.workerPool.push(n);
|
|
1379
|
+
} else this.workerPool.sort(function(e, t) {
|
|
1380
|
+
return e._taskLoad > t._taskLoad ? -1 : 1;
|
|
1381
|
+
});
|
|
1382
|
+
var n = this.workerPool[this.workerPool.length - 1];
|
|
1383
|
+
return n._taskCosts[e] = t, n._taskLoad += t, n;
|
|
1384
|
+
});
|
|
1385
|
+
},
|
|
1386
|
+
_releaseTask: function(e, t) {
|
|
1387
|
+
e._taskLoad -= e._taskCosts[t], delete e._callbacks[t], delete e._taskCosts[t];
|
|
1388
|
+
},
|
|
1389
|
+
debug: function() {
|
|
1390
|
+
console.log("Task load: ", this.workerPool.map((e) => e._taskLoad));
|
|
1391
|
+
},
|
|
1392
|
+
dispose: function() {
|
|
1393
|
+
for (var e = 0; e < this.workerPool.length; ++e) this.workerPool[e].terminate();
|
|
1394
|
+
return this.workerPool.length = 0, this;
|
|
1395
|
+
}
|
|
1396
|
+
}), W.DRACOWorker = function() {
|
|
1397
|
+
var e, t;
|
|
1398
|
+
onmessage = function(r) {
|
|
1399
|
+
var i = r.data;
|
|
1400
|
+
switch (i.type) {
|
|
1401
|
+
case "init":
|
|
1402
|
+
e = i.decoderConfig, t = new Promise(function(t) {
|
|
1403
|
+
e.onModuleLoaded = function(e) {
|
|
1404
|
+
t({ draco: e });
|
|
1405
|
+
}, DracoDecoderModule(e);
|
|
1406
|
+
});
|
|
1407
|
+
break;
|
|
1408
|
+
case "decode":
|
|
1409
|
+
var a = i.buffer, o = i.taskConfig;
|
|
1410
|
+
t.then((e) => {
|
|
1411
|
+
var t = e.draco, r = new t.Decoder(), s = new t.DecoderBuffer();
|
|
1412
|
+
s.Init(new Int8Array(a), a.byteLength);
|
|
1413
|
+
try {
|
|
1414
|
+
var c = n(t, r, s, o), l = c.attributes.map((e) => e.array.buffer);
|
|
1415
|
+
c.index && l.push(c.index.array.buffer), self.postMessage({
|
|
1416
|
+
type: "decode",
|
|
1417
|
+
id: i.id,
|
|
1418
|
+
geometry: c
|
|
1419
|
+
}, l);
|
|
1420
|
+
} catch (e) {
|
|
1421
|
+
console.error(e), self.postMessage({
|
|
1422
|
+
type: "error",
|
|
1423
|
+
id: i.id,
|
|
1424
|
+
error: e.message
|
|
1425
|
+
});
|
|
1426
|
+
} finally {
|
|
1427
|
+
t.destroy(s), t.destroy(r);
|
|
1428
|
+
}
|
|
1429
|
+
});
|
|
1430
|
+
break;
|
|
1431
|
+
}
|
|
1432
|
+
};
|
|
1433
|
+
function n(e, t, n, i) {
|
|
1434
|
+
var a = i.attributeIDs, o = i.attributeTypes, s, c, l = t.GetEncodedGeometryType(n);
|
|
1435
|
+
if (l === e.TRIANGULAR_MESH) s = new e.Mesh(), c = t.DecodeBufferToMesh(n, s);
|
|
1436
|
+
else if (l === e.POINT_CLOUD) s = new e.PointCloud(), c = t.DecodeBufferToPointCloud(n, s);
|
|
1437
|
+
else throw Error("THREE.DRACOLoader: Unexpected geometry type.");
|
|
1438
|
+
if (!c.ok() || s.ptr === 0) throw Error("THREE.DRACOLoader: Decoding failed: " + c.error_msg());
|
|
1439
|
+
var u = {
|
|
1440
|
+
index: null,
|
|
1441
|
+
attributes: []
|
|
1442
|
+
};
|
|
1443
|
+
for (var d in a) {
|
|
1444
|
+
var f = self[o[d]], p, m;
|
|
1445
|
+
if (i.useUniqueIDs) m = a[d], p = t.GetAttributeByUniqueId(s, m);
|
|
1446
|
+
else {
|
|
1447
|
+
if (m = t.GetAttributeId(s, e[a[d]]), m === -1) continue;
|
|
1448
|
+
p = t.GetAttribute(s, m);
|
|
1449
|
+
}
|
|
1450
|
+
u.attributes.push(r(e, t, s, d, f, p));
|
|
1451
|
+
}
|
|
1452
|
+
if (l === e.TRIANGULAR_MESH) {
|
|
1453
|
+
for (var h = s.num_faces(), g = h * 3, _ = new Uint32Array(g), v = new e.DracoInt32Array(), y = 0; y < h; ++y) {
|
|
1454
|
+
t.GetFaceFromMesh(s, y, v);
|
|
1455
|
+
for (var b = 0; b < 3; ++b) _[y * 3 + b] = v.GetValue(b);
|
|
1456
|
+
}
|
|
1457
|
+
u.index = {
|
|
1458
|
+
array: _,
|
|
1459
|
+
itemSize: 1
|
|
1460
|
+
}, e.destroy(v);
|
|
1461
|
+
}
|
|
1462
|
+
return e.destroy(s), u;
|
|
1463
|
+
}
|
|
1464
|
+
function r(e, t, n, r, i, a) {
|
|
1465
|
+
var o = a.num_components(), s = n.num_points() * o, c, l;
|
|
1466
|
+
switch (i) {
|
|
1467
|
+
case Float32Array:
|
|
1468
|
+
c = new e.DracoFloat32Array(), t.GetAttributeFloatForAllPoints(n, a, c), l = new Float32Array(s);
|
|
1469
|
+
break;
|
|
1470
|
+
case Int8Array:
|
|
1471
|
+
c = new e.DracoInt8Array(), t.GetAttributeInt8ForAllPoints(n, a, c), l = new Int8Array(s);
|
|
1472
|
+
break;
|
|
1473
|
+
case Int16Array:
|
|
1474
|
+
c = new e.DracoInt16Array(), t.GetAttributeInt16ForAllPoints(n, a, c), l = new Int16Array(s);
|
|
1475
|
+
break;
|
|
1476
|
+
case Int32Array:
|
|
1477
|
+
c = new e.DracoInt32Array(), t.GetAttributeInt32ForAllPoints(n, a, c), l = new Int32Array(s);
|
|
1478
|
+
break;
|
|
1479
|
+
case Uint8Array:
|
|
1480
|
+
c = new e.DracoUInt8Array(), t.GetAttributeUInt8ForAllPoints(n, a, c), l = new Uint8Array(s);
|
|
1481
|
+
break;
|
|
1482
|
+
case Uint16Array:
|
|
1483
|
+
c = new e.DracoUInt16Array(), t.GetAttributeUInt16ForAllPoints(n, a, c), l = new Uint16Array(s);
|
|
1484
|
+
break;
|
|
1485
|
+
case Uint32Array:
|
|
1486
|
+
c = new e.DracoUInt32Array(), t.GetAttributeUInt32ForAllPoints(n, a, c), l = new Uint32Array(s);
|
|
1487
|
+
break;
|
|
1488
|
+
default: throw Error("THREE.DRACOLoader: Unexpected attribute type.");
|
|
1489
|
+
}
|
|
1490
|
+
for (var u = 0; u < s; u++) l[u] = c.GetValue(u);
|
|
1491
|
+
return e.destroy(c), {
|
|
1492
|
+
name: r,
|
|
1493
|
+
array: l,
|
|
1494
|
+
itemSize: o
|
|
1495
|
+
};
|
|
1496
|
+
}
|
|
1497
|
+
}, W.taskCache = /* @__PURE__ */ new WeakMap(), W.setDecoderPath = function() {
|
|
1498
|
+
console.warn("THREE.DRACOLoader: The .setDecoderPath() method has been removed. Use instance methods.");
|
|
1499
|
+
}, W.setDecoderConfig = function() {
|
|
1500
|
+
console.warn("THREE.DRACOLoader: The .setDecoderConfig() method has been removed. Use instance methods.");
|
|
1501
|
+
}, W.releaseDecoderModule = function() {
|
|
1502
|
+
console.warn("THREE.DRACOLoader: The .releaseDecoderModule() method has been removed. Use instance methods.");
|
|
1503
|
+
}, W.getDecoderModule = function() {
|
|
1504
|
+
console.warn("THREE.DRACOLoader: The .getDecoderModule() method has been removed. Use instance methods.");
|
|
1339
1505
|
};
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
},
|
|
1345
|
-
setDecoderConfig: function(p) {
|
|
1346
|
-
return this.decoderConfig = p, this;
|
|
1347
|
-
},
|
|
1348
|
-
setWorkerLimit: function(p) {
|
|
1349
|
-
return this.workerLimit = p, this;
|
|
1350
|
-
},
|
|
1351
|
-
/** @deprecated */
|
|
1352
|
-
setVerbosity: function() {
|
|
1353
|
-
console.warn("THREE.DRACOLoader: The .setVerbosity() method has been removed.");
|
|
1354
|
-
},
|
|
1355
|
-
/** @deprecated */
|
|
1356
|
-
setDrawMode: function() {
|
|
1357
|
-
console.warn("THREE.DRACOLoader: The .setDrawMode() method has been removed.");
|
|
1358
|
-
},
|
|
1359
|
-
/** @deprecated */
|
|
1360
|
-
setSkipDequantization: function() {
|
|
1361
|
-
console.warn("THREE.DRACOLoader: The .setSkipDequantization() method has been removed.");
|
|
1362
|
-
},
|
|
1363
|
-
load: function(p, T, u, m) {
|
|
1364
|
-
var v = new _e(this.manager);
|
|
1365
|
-
v.setPath(this.path), v.setResponseType("arraybuffer"), this.crossOrigin === "use-credentials" && v.setWithCredentials(!0), v.load(p, (g) => {
|
|
1366
|
-
var _ = {
|
|
1367
|
-
attributeIDs: this.defaultAttributeIDs,
|
|
1368
|
-
attributeTypes: this.defaultAttributeTypes,
|
|
1369
|
-
useUniqueIDs: !1
|
|
1370
|
-
};
|
|
1371
|
-
this.decodeGeometry(g, _).then(T).catch(m);
|
|
1372
|
-
}, u, m);
|
|
1373
|
-
},
|
|
1374
|
-
/** @deprecated Kept for backward-compatibility with previous DRACOLoader versions. */
|
|
1375
|
-
decodeDracoFile: function(p, T, u, m) {
|
|
1376
|
-
var v = {
|
|
1377
|
-
attributeIDs: u || this.defaultAttributeIDs,
|
|
1378
|
-
attributeTypes: m || this.defaultAttributeTypes,
|
|
1379
|
-
useUniqueIDs: !!u
|
|
1380
|
-
};
|
|
1381
|
-
this.decodeGeometry(p, v).then(T);
|
|
1382
|
-
},
|
|
1383
|
-
decodeGeometry: function(p, T) {
|
|
1384
|
-
for (var u in T.attributeTypes) {
|
|
1385
|
-
var m = T.attributeTypes[u];
|
|
1386
|
-
m.BYTES_PER_ELEMENT !== void 0 && (T.attributeTypes[u] = m.name);
|
|
1387
|
-
}
|
|
1388
|
-
var v = JSON.stringify(T);
|
|
1389
|
-
if (k.taskCache.has(p)) {
|
|
1390
|
-
var g = k.taskCache.get(p);
|
|
1391
|
-
if (g.key === v)
|
|
1392
|
-
return g.promise;
|
|
1393
|
-
if (p.byteLength === 0)
|
|
1394
|
-
throw new Error(
|
|
1395
|
-
"THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred."
|
|
1396
|
-
);
|
|
1397
|
-
}
|
|
1398
|
-
var _, x = this.workerNextTaskID++, P = p.byteLength, R = this._getWorker(x, P).then((I) => (_ = I, new Promise((F, b) => {
|
|
1399
|
-
_._callbacks[x] = { resolve: F, reject: b }, _.postMessage({ type: "decode", id: x, taskConfig: T, buffer: p }, [p]);
|
|
1400
|
-
}))).then((I) => this._createGeometry(I.geometry));
|
|
1401
|
-
return R.catch(() => !0).then(() => {
|
|
1402
|
-
_ && x && this._releaseTask(_, x);
|
|
1403
|
-
}), k.taskCache.set(p, {
|
|
1404
|
-
key: v,
|
|
1405
|
-
promise: R
|
|
1406
|
-
}), R;
|
|
1407
|
-
},
|
|
1408
|
-
_createGeometry: function(p) {
|
|
1409
|
-
var T = new $e();
|
|
1410
|
-
p.index && T.setIndex(new Re(p.index.array, 1));
|
|
1411
|
-
for (var u = 0; u < p.attributes.length; u++) {
|
|
1412
|
-
var m = p.attributes[u], v = m.name, g = m.array, _ = m.itemSize;
|
|
1413
|
-
T.setAttribute(v, new Re(g, _));
|
|
1414
|
-
}
|
|
1415
|
-
return T;
|
|
1416
|
-
},
|
|
1417
|
-
_loadLibrary: function(p, T) {
|
|
1418
|
-
var u = new _e(this.manager);
|
|
1419
|
-
return u.setPath(this.decoderPath), u.setResponseType(T), new Promise((m, v) => {
|
|
1420
|
-
u.load(p, m, void 0, v);
|
|
1421
|
-
});
|
|
1422
|
-
},
|
|
1423
|
-
preload: function() {
|
|
1424
|
-
return this._initDecoder(), this;
|
|
1425
|
-
},
|
|
1426
|
-
_initDecoder: function() {
|
|
1427
|
-
if (this.decoderPending) return this.decoderPending;
|
|
1428
|
-
var p = typeof WebAssembly != "object" || this.decoderConfig.type === "js", T = [];
|
|
1429
|
-
return p ? 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((u) => {
|
|
1430
|
-
var m = u[0];
|
|
1431
|
-
p || (this.decoderConfig.wasmBinary = u[1]);
|
|
1432
|
-
var v = k.DRACOWorker.toString(), g = [
|
|
1433
|
-
"/* draco decoder */",
|
|
1434
|
-
m,
|
|
1435
|
-
"",
|
|
1436
|
-
"/* worker */",
|
|
1437
|
-
v.substring(v.indexOf("{") + 1, v.lastIndexOf("}"))
|
|
1438
|
-
].join(`
|
|
1439
|
-
`);
|
|
1440
|
-
this.workerSourceURL = URL.createObjectURL(new Blob([g]));
|
|
1441
|
-
}), this.decoderPending;
|
|
1442
|
-
},
|
|
1443
|
-
_getWorker: function(p, T) {
|
|
1444
|
-
return this._initDecoder().then(() => {
|
|
1445
|
-
if (this.workerPool.length < this.workerLimit) {
|
|
1446
|
-
var u = new Worker(this.workerSourceURL);
|
|
1447
|
-
u._callbacks = {}, u._taskCosts = {}, u._taskLoad = 0, u.postMessage({ type: "init", decoderConfig: this.decoderConfig }), u.onmessage = function(v) {
|
|
1448
|
-
var g = v.data;
|
|
1449
|
-
switch (g.type) {
|
|
1450
|
-
case "decode":
|
|
1451
|
-
u._callbacks[g.id].resolve(g);
|
|
1452
|
-
break;
|
|
1453
|
-
case "error":
|
|
1454
|
-
u._callbacks[g.id].reject(g);
|
|
1455
|
-
break;
|
|
1456
|
-
default:
|
|
1457
|
-
console.error('THREE.DRACOLoader: Unexpected message, "' + g.type + '"');
|
|
1458
|
-
}
|
|
1459
|
-
}, this.workerPool.push(u);
|
|
1460
|
-
} else
|
|
1461
|
-
this.workerPool.sort(function(m, v) {
|
|
1462
|
-
return m._taskLoad > v._taskLoad ? -1 : 1;
|
|
1463
|
-
});
|
|
1464
|
-
var u = this.workerPool[this.workerPool.length - 1];
|
|
1465
|
-
return u._taskCosts[p] = T, u._taskLoad += T, u;
|
|
1466
|
-
});
|
|
1467
|
-
},
|
|
1468
|
-
_releaseTask: function(p, T) {
|
|
1469
|
-
p._taskLoad -= p._taskCosts[T], delete p._callbacks[T], delete p._taskCosts[T];
|
|
1470
|
-
},
|
|
1471
|
-
debug: function() {
|
|
1472
|
-
console.log("Task load: ", this.workerPool.map((p) => p._taskLoad));
|
|
1473
|
-
},
|
|
1474
|
-
dispose: function() {
|
|
1475
|
-
for (var p = 0; p < this.workerPool.length; ++p)
|
|
1476
|
-
this.workerPool[p].terminate();
|
|
1477
|
-
return this.workerPool.length = 0, this;
|
|
1478
|
-
}
|
|
1479
|
-
});
|
|
1480
|
-
k.DRACOWorker = function() {
|
|
1481
|
-
var p, T;
|
|
1482
|
-
onmessage = function(v) {
|
|
1483
|
-
var g = v.data;
|
|
1484
|
-
switch (g.type) {
|
|
1485
|
-
case "init":
|
|
1486
|
-
p = g.decoderConfig, T = new Promise(function(P) {
|
|
1487
|
-
p.onModuleLoaded = function(R) {
|
|
1488
|
-
P({ draco: R });
|
|
1489
|
-
}, DracoDecoderModule(p);
|
|
1490
|
-
});
|
|
1491
|
-
break;
|
|
1492
|
-
case "decode":
|
|
1493
|
-
var _ = g.buffer, x = g.taskConfig;
|
|
1494
|
-
T.then((P) => {
|
|
1495
|
-
var R = P.draco, I = new R.Decoder(), F = new R.DecoderBuffer();
|
|
1496
|
-
F.Init(new Int8Array(_), _.byteLength);
|
|
1497
|
-
try {
|
|
1498
|
-
var b = u(R, I, F, x), M = b.attributes.map((w) => w.array.buffer);
|
|
1499
|
-
b.index && M.push(b.index.array.buffer), self.postMessage({ type: "decode", id: g.id, geometry: b }, M);
|
|
1500
|
-
} catch (w) {
|
|
1501
|
-
console.error(w), self.postMessage({ type: "error", id: g.id, error: w.message });
|
|
1502
|
-
} finally {
|
|
1503
|
-
R.destroy(F), R.destroy(I);
|
|
1504
|
-
}
|
|
1505
|
-
});
|
|
1506
|
-
break;
|
|
1507
|
-
}
|
|
1508
|
-
};
|
|
1509
|
-
function u(v, g, _, x) {
|
|
1510
|
-
var P = x.attributeIDs, R = x.attributeTypes, I, F, b = g.GetEncodedGeometryType(_);
|
|
1511
|
-
if (b === v.TRIANGULAR_MESH)
|
|
1512
|
-
I = new v.Mesh(), F = g.DecodeBufferToMesh(_, I);
|
|
1513
|
-
else if (b === v.POINT_CLOUD)
|
|
1514
|
-
I = new v.PointCloud(), F = g.DecodeBufferToPointCloud(_, I);
|
|
1515
|
-
else
|
|
1516
|
-
throw new Error("THREE.DRACOLoader: Unexpected geometry type.");
|
|
1517
|
-
if (!F.ok() || I.ptr === 0)
|
|
1518
|
-
throw new Error("THREE.DRACOLoader: Decoding failed: " + F.error_msg());
|
|
1519
|
-
var M = { index: null, attributes: [] };
|
|
1520
|
-
for (var w in P) {
|
|
1521
|
-
var K = self[R[w]], ne, D;
|
|
1522
|
-
if (x.useUniqueIDs)
|
|
1523
|
-
D = P[w], ne = g.GetAttributeByUniqueId(I, D);
|
|
1524
|
-
else {
|
|
1525
|
-
if (D = g.GetAttributeId(I, v[P[w]]), D === -1) continue;
|
|
1526
|
-
ne = g.GetAttribute(I, D);
|
|
1527
|
-
}
|
|
1528
|
-
M.attributes.push(m(v, g, I, w, K, ne));
|
|
1529
|
-
}
|
|
1530
|
-
if (b === v.TRIANGULAR_MESH) {
|
|
1531
|
-
for (var J = I.num_faces(), N = J * 3, Q = new Uint32Array(N), Z = new v.DracoInt32Array(), X = 0; X < J; ++X) {
|
|
1532
|
-
g.GetFaceFromMesh(I, X, Z);
|
|
1533
|
-
for (var z = 0; z < 3; ++z)
|
|
1534
|
-
Q[X * 3 + z] = Z.GetValue(z);
|
|
1535
|
-
}
|
|
1536
|
-
M.index = { array: Q, itemSize: 1 }, v.destroy(Z);
|
|
1537
|
-
}
|
|
1538
|
-
return v.destroy(I), M;
|
|
1539
|
-
}
|
|
1540
|
-
function m(v, g, _, x, P, R) {
|
|
1541
|
-
var I = R.num_components(), F = _.num_points(), b = F * I, M, w;
|
|
1542
|
-
switch (P) {
|
|
1543
|
-
case Float32Array:
|
|
1544
|
-
M = new v.DracoFloat32Array(), g.GetAttributeFloatForAllPoints(_, R, M), w = new Float32Array(b);
|
|
1545
|
-
break;
|
|
1546
|
-
case Int8Array:
|
|
1547
|
-
M = new v.DracoInt8Array(), g.GetAttributeInt8ForAllPoints(_, R, M), w = new Int8Array(b);
|
|
1548
|
-
break;
|
|
1549
|
-
case Int16Array:
|
|
1550
|
-
M = new v.DracoInt16Array(), g.GetAttributeInt16ForAllPoints(_, R, M), w = new Int16Array(b);
|
|
1551
|
-
break;
|
|
1552
|
-
case Int32Array:
|
|
1553
|
-
M = new v.DracoInt32Array(), g.GetAttributeInt32ForAllPoints(_, R, M), w = new Int32Array(b);
|
|
1554
|
-
break;
|
|
1555
|
-
case Uint8Array:
|
|
1556
|
-
M = new v.DracoUInt8Array(), g.GetAttributeUInt8ForAllPoints(_, R, M), w = new Uint8Array(b);
|
|
1557
|
-
break;
|
|
1558
|
-
case Uint16Array:
|
|
1559
|
-
M = new v.DracoUInt16Array(), g.GetAttributeUInt16ForAllPoints(_, R, M), w = new Uint16Array(b);
|
|
1560
|
-
break;
|
|
1561
|
-
case Uint32Array:
|
|
1562
|
-
M = new v.DracoUInt32Array(), g.GetAttributeUInt32ForAllPoints(_, R, M), w = new Uint32Array(b);
|
|
1563
|
-
break;
|
|
1564
|
-
default:
|
|
1565
|
-
throw new Error("THREE.DRACOLoader: Unexpected attribute type.");
|
|
1566
|
-
}
|
|
1567
|
-
for (var K = 0; K < b; K++)
|
|
1568
|
-
w[K] = M.GetValue(K);
|
|
1569
|
-
return v.destroy(M), {
|
|
1570
|
-
name: x,
|
|
1571
|
-
array: w,
|
|
1572
|
-
itemSize: I
|
|
1573
|
-
};
|
|
1574
|
-
}
|
|
1575
|
-
};
|
|
1576
|
-
k.taskCache = /* @__PURE__ */ new WeakMap();
|
|
1577
|
-
k.setDecoderPath = function() {
|
|
1578
|
-
console.warn("THREE.DRACOLoader: The .setDecoderPath() method has been removed. Use instance methods.");
|
|
1579
|
-
};
|
|
1580
|
-
k.setDecoderConfig = function() {
|
|
1581
|
-
console.warn("THREE.DRACOLoader: The .setDecoderConfig() method has been removed. Use instance methods.");
|
|
1582
|
-
};
|
|
1583
|
-
k.releaseDecoderModule = function() {
|
|
1584
|
-
console.warn("THREE.DRACOLoader: The .releaseDecoderModule() method has been removed. Use instance methods.");
|
|
1585
|
-
};
|
|
1586
|
-
k.getDecoderModule = function() {
|
|
1587
|
-
console.warn("THREE.DRACOLoader: The .getDecoderModule() method has been removed. Use instance methods.");
|
|
1588
|
-
};
|
|
1589
|
-
var He = function(p) {
|
|
1590
|
-
er.call(this, p);
|
|
1506
|
+
//#endregion
|
|
1507
|
+
//#region build/gltf-loader/thirdparty/DDSLoader.js
|
|
1508
|
+
var G = function(e) {
|
|
1509
|
+
c.call(this, e);
|
|
1591
1510
|
};
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
var o = { data: i, width: t, height: n };
|
|
1658
|
-
u.mipmaps.push(o), ie += s, t = Math.max(t >> 1, 1), n = Math.max(n >> 1, 1);
|
|
1659
|
-
}
|
|
1660
|
-
return u;
|
|
1661
|
-
}
|
|
1511
|
+
G.prototype = Object.assign(Object.create(c.prototype), {
|
|
1512
|
+
constructor: G,
|
|
1513
|
+
parse: function(e, t) {
|
|
1514
|
+
var n = {
|
|
1515
|
+
mipmaps: [],
|
|
1516
|
+
width: 0,
|
|
1517
|
+
height: 0,
|
|
1518
|
+
format: null,
|
|
1519
|
+
mipmapCount: 1
|
|
1520
|
+
}, r = 542327876, i = 131072, a = 512, o = 1024, s = 2048, c = 4096, l = 8192, u = 16384, d = 32768, f = 4;
|
|
1521
|
+
function p(e) {
|
|
1522
|
+
return e.charCodeAt(0) + (e.charCodeAt(1) << 8) + (e.charCodeAt(2) << 16) + (e.charCodeAt(3) << 24);
|
|
1523
|
+
}
|
|
1524
|
+
function m(e) {
|
|
1525
|
+
return String.fromCharCode(e & 255, e >> 8 & 255, e >> 16 & 255, e >> 24 & 255);
|
|
1526
|
+
}
|
|
1527
|
+
function h(e, t, n, r) {
|
|
1528
|
+
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++) {
|
|
1529
|
+
var d = a[c];
|
|
1530
|
+
c++;
|
|
1531
|
+
var f = a[c];
|
|
1532
|
+
c++;
|
|
1533
|
+
var p = a[c];
|
|
1534
|
+
c++;
|
|
1535
|
+
var m = a[c];
|
|
1536
|
+
c++, o[s] = p, s++, o[s] = f, s++, o[s] = d, s++, o[s] = m, s++;
|
|
1537
|
+
}
|
|
1538
|
+
return o;
|
|
1539
|
+
}
|
|
1540
|
+
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);
|
|
1541
|
+
if (A[x] !== r) return console.error("THREE.DDSLoader.parse: Invalid magic number in DDS header."), n;
|
|
1542
|
+
if (!A[D] & f) return console.error("THREE.DDSLoader.parse: Unsupported format, must contain a FourCC code."), n;
|
|
1543
|
+
var j, M = A[O], N = !1;
|
|
1544
|
+
switch (M) {
|
|
1545
|
+
case g:
|
|
1546
|
+
j = 8, n.format = V;
|
|
1547
|
+
break;
|
|
1548
|
+
case _:
|
|
1549
|
+
j = 16, n.format = B;
|
|
1550
|
+
break;
|
|
1551
|
+
case v:
|
|
1552
|
+
j = 16, n.format = ue;
|
|
1553
|
+
break;
|
|
1554
|
+
case y:
|
|
1555
|
+
j = 8, n.format = fe;
|
|
1556
|
+
break;
|
|
1557
|
+
default: if (A[ee] === 32 && A[te] & 16711680 && A[ne] & 65280 && A[k] & 255 && A[re] & 4278190080) N = !0, j = 64, n.format = le;
|
|
1558
|
+
else return console.error("THREE.DDSLoader.parse: Unsupported FourCC code ", m(M)), n;
|
|
1559
|
+
}
|
|
1560
|
+
n.mipmapCount = 1, A[C] & i && t !== !1 && (n.mipmapCount = Math.max(1, A[E]));
|
|
1561
|
+
var P = A[ie];
|
|
1562
|
+
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;
|
|
1563
|
+
n.width = A[T], n.height = A[w];
|
|
1564
|
+
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++) {
|
|
1565
|
+
if (N) var oe = h(e, F, L, R), se = oe.length;
|
|
1566
|
+
else var se = Math.max(4, L) / 4 * Math.max(4, R) / 4 * j, oe = new Uint8Array(e, F, se);
|
|
1567
|
+
var ce = {
|
|
1568
|
+
data: oe,
|
|
1569
|
+
width: L,
|
|
1570
|
+
height: R
|
|
1571
|
+
};
|
|
1572
|
+
n.mipmaps.push(ce), F += se, L = Math.max(L >> 1, 1), R = Math.max(R >> 1, 1);
|
|
1573
|
+
}
|
|
1574
|
+
return n;
|
|
1575
|
+
}
|
|
1662
1576
|
});
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
}, T.prototype.parse = function(u, m, v, g) {
|
|
1693
|
-
return p.prototype.parse.call(this, u, m, function(_) {
|
|
1694
|
-
var x = new Qe(_.scene), P = _.scenes.map(function(R) {
|
|
1695
|
-
return R === _.scene ? x : new Qe(R);
|
|
1696
|
-
});
|
|
1697
|
-
v(Object.assign(_, { scene: x, scenes: P }));
|
|
1698
|
-
}, g);
|
|
1699
|
-
}, T;
|
|
1700
|
-
})(qr)
|
|
1701
|
-
);
|
|
1702
|
-
export {
|
|
1703
|
-
He as DDSLoader,
|
|
1704
|
-
k as DRACOLoader,
|
|
1705
|
-
$r as GLTFLoader,
|
|
1706
|
-
Qe as GLTFObject,
|
|
1707
|
-
qr as THREEGLTFLoader
|
|
1577
|
+
//#endregion
|
|
1578
|
+
//#region build/gltf-loader/gltf-object.js
|
|
1579
|
+
var K = class extends e.Group {
|
|
1580
|
+
constructor(t) {
|
|
1581
|
+
super(), this.needsRender = !0, t && t.children.length && this.add(...t.children), this.mixer = new e.AnimationMixer(this);
|
|
1582
|
+
}
|
|
1583
|
+
clone() {
|
|
1584
|
+
let t = super.clone(!0);
|
|
1585
|
+
return t.mixer = new e.AnimationMixer(t), t.needsRender = !0, t;
|
|
1586
|
+
}
|
|
1587
|
+
}, Te = "https://vr-public.realsee-cdn.cn/release/static/image/release/five/resource/draco/1.5.6/", Ee = class extends U {
|
|
1588
|
+
static get version() {
|
|
1589
|
+
return "6.8.0-alpha.21";
|
|
1590
|
+
}
|
|
1591
|
+
constructor(e) {
|
|
1592
|
+
super(e), this.ddsLoader = new G(e), this.dracoLoader = new W(e), this.dracoLoader.setDecoderPath(Te);
|
|
1593
|
+
}
|
|
1594
|
+
load(e, t, n, r) {
|
|
1595
|
+
return super.load(e, t, n, r);
|
|
1596
|
+
}
|
|
1597
|
+
parse(e, t, n, r) {
|
|
1598
|
+
return super.parse(e, t, (e) => {
|
|
1599
|
+
let t = new K(e.scene), r = e.scenes.map((n) => n === e.scene ? t : new K(n));
|
|
1600
|
+
n(Object.assign(e, {
|
|
1601
|
+
scene: t,
|
|
1602
|
+
scenes: r
|
|
1603
|
+
}));
|
|
1604
|
+
}, r);
|
|
1605
|
+
}
|
|
1708
1606
|
};
|
|
1607
|
+
//#endregion
|
|
1608
|
+
export { G as DDSLoader, W as DRACOLoader, Ee as GLTFLoader, K as GLTFObject, U as THREEGLTFLoader };
|