three-stdlib 2.15.1 → 2.15.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (1218) hide show
  1. package/animation/AnimationClipCreator.js +32 -52
  2. package/animation/AnimationClipCreator.mjs +57 -0
  3. package/animation/CCDIKSolver.js +66 -161
  4. package/animation/CCDIKSolver.mjs +234 -0
  5. package/animation/MMDAnimationHelper.js +150 -341
  6. package/animation/MMDAnimationHelper.mjs +514 -0
  7. package/animation/MMDPhysics.js +154 -361
  8. package/animation/MMDPhysics.mjs +769 -0
  9. package/cameras/CinematicCamera.js +67 -77
  10. package/cameras/CinematicCamera.mjs +129 -0
  11. package/controls/ArcballControls.js +544 -1449
  12. package/controls/ArcballControls.mjs +1737 -0
  13. package/controls/DeviceOrientationControls.js +52 -97
  14. package/controls/DeviceOrientationControls.mjs +74 -0
  15. package/controls/DragControls.js +85 -187
  16. package/controls/DragControls.mjs +172 -0
  17. package/controls/FirstPersonControls.js +123 -193
  18. package/controls/FirstPersonControls.mjs +220 -0
  19. package/controls/FlyControls.js +82 -152
  20. package/controls/FlyControls.mjs +239 -0
  21. package/controls/OrbitControls.js +232 -481
  22. package/controls/OrbitControls.mjs +731 -0
  23. package/controls/PointerLockControls.js +63 -99
  24. package/controls/PointerLockControls.mjs +88 -0
  25. package/controls/TrackballControls.js +211 -383
  26. package/controls/TrackballControls.mjs +481 -0
  27. package/controls/TransformControls.js +575 -782
  28. package/controls/TransformControls.mjs +1068 -0
  29. package/controls/experimental/CameraControls.js +329 -609
  30. package/controls/experimental/CameraControls.mjs +673 -0
  31. package/csm/CSM.js +47 -108
  32. package/csm/CSM.mjs +244 -0
  33. package/csm/CSMFrustum.js +14 -29
  34. package/csm/CSMFrustum.mjs +75 -0
  35. package/csm/CSMHelper.js +20 -34
  36. package/csm/CSMHelper.mjs +114 -0
  37. package/csm/CSMShader.js +7 -11
  38. package/csm/CSMShader.mjs +251 -0
  39. package/curves/CurveExtras.js +73 -115
  40. package/curves/CurveExtras.mjs +224 -0
  41. package/curves/NURBSCurve.js +15 -43
  42. package/curves/NURBSCurve.mjs +35 -0
  43. package/curves/NURBSSurface.js +11 -27
  44. package/curves/NURBSSurface.mjs +28 -0
  45. package/curves/NURBSUtils.js +54 -203
  46. package/curves/NURBSUtils.mjs +226 -0
  47. package/deprecated/Geometry.js +191 -486
  48. package/deprecated/Geometry.mjs +966 -0
  49. package/effects/AnaglyphEffect.js +95 -60
  50. package/effects/AnaglyphEffect.mjs +120 -0
  51. package/effects/AsciiEffect.js +80 -110
  52. package/effects/AsciiEffect.mjs +173 -0
  53. package/effects/OutlineEffect.js +121 -204
  54. package/effects/OutlineEffect.mjs +295 -0
  55. package/effects/ParallaxBarrierEffect.js +39 -38
  56. package/effects/ParallaxBarrierEffect.mjs +64 -0
  57. package/effects/PeppersGhostEffect.js +19 -68
  58. package/effects/PeppersGhostEffect.mjs +85 -0
  59. package/effects/StereoEffect.js +12 -16
  60. package/effects/StereoEffect.mjs +32 -0
  61. package/environments/RoomEnvironment.js +52 -47
  62. package/environments/RoomEnvironment.mjs +78 -0
  63. package/exporters/ColladaExporter.js +115 -241
  64. package/exporters/ColladaExporter.mjs +299 -0
  65. package/exporters/DRACOExporter.js +67 -121
  66. package/exporters/DRACOExporter.mjs +132 -0
  67. package/exporters/GLTFExporter.js +463 -1014
  68. package/exporters/GLTFExporter.mjs +1381 -0
  69. package/exporters/MMDExporter.js +44 -102
  70. package/exporters/MMDExporter.mjs +102 -0
  71. package/exporters/OBJExporter.js +78 -140
  72. package/exporters/OBJExporter.mjs +166 -0
  73. package/exporters/PLYExporter.js +93 -154
  74. package/exporters/PLYExporter.mjs +278 -0
  75. package/exporters/STLExporter.js +30 -81
  76. package/exporters/STLExporter.mjs +129 -0
  77. package/exporters/USDZExporter.js +84 -144
  78. package/exporters/USDZExporter.mjs +328 -0
  79. package/geometries/BoxLineGeometry.js +7 -14
  80. package/geometries/BoxLineGeometry.mjs +45 -0
  81. package/geometries/ConvexGeometry.js +14 -23
  82. package/geometries/ConvexGeometry.mjs +29 -0
  83. package/geometries/DecalGeometry.js +108 -162
  84. package/geometries/DecalGeometry.mjs +184 -0
  85. package/geometries/LightningStrike.js +101 -294
  86. package/geometries/LightningStrike.mjs +547 -0
  87. package/geometries/ParametricGeometries.js +26 -76
  88. package/geometries/ParametricGeometries.mjs +129 -0
  89. package/geometries/ParametricGeometry.js +24 -48
  90. package/geometries/ParametricGeometry.mjs +63 -0
  91. package/geometries/RoundedBoxGeometry.js +33 -64
  92. package/geometries/RoundedBoxGeometry.mjs +91 -0
  93. package/geometries/TeapotGeometry.js +1434 -174
  94. package/geometries/TeapotGeometry.mjs +1557 -0
  95. package/geometries/TextGeometry.js +9 -17
  96. package/geometries/TextGeometry.mjs +23 -0
  97. package/helpers/LightProbeHelper.js +53 -21
  98. package/helpers/LightProbeHelper.mjs +72 -0
  99. package/helpers/PositionalAudioHelper.js +23 -30
  100. package/helpers/PositionalAudioHelper.mjs +68 -0
  101. package/helpers/RectAreaLightHelper.js +17 -33
  102. package/helpers/RectAreaLightHelper.mjs +44 -0
  103. package/helpers/VertexNormalsHelper.js +20 -41
  104. package/helpers/VertexNormalsHelper.mjs +54 -0
  105. package/helpers/VertexTangentsHelper.js +18 -36
  106. package/helpers/VertexTangentsHelper.mjs +45 -0
  107. package/index.js +968 -333
  108. package/index.mjs +968 -0
  109. package/interactive/SelectionBox.js +31 -46
  110. package/interactive/SelectionBox.mjs +137 -0
  111. package/interactive/SelectionHelper.js +16 -21
  112. package/interactive/SelectionHelper.mjs +54 -0
  113. package/libs/MeshoptDecoder.js +147 -58
  114. package/libs/MeshoptDecoder.mjs +210 -0
  115. package/libs/MotionControllers.js +66 -208
  116. package/libs/MotionControllers.mjs +261 -0
  117. package/lights/LightProbeGenerator.js +40 -96
  118. package/lights/LightProbeGenerator.mjs +145 -0
  119. package/lights/RectAreaLightUniformsLib.js +32842 -9
  120. package/lights/RectAreaLightUniformsLib.mjs +32842 -0
  121. package/lines/Line2.js +9 -12
  122. package/lines/Line2.mjs +13 -0
  123. package/lines/LineGeometry.js +7 -19
  124. package/lines/LineGeometry.mjs +44 -0
  125. package/lines/LineMaterial.js +51 -89
  126. package/lines/LineMaterial.mjs +539 -0
  127. package/lines/LineSegments2.js +56 -165
  128. package/lines/LineSegments2.mjs +202 -0
  129. package/lines/LineSegmentsGeometry.js +29 -71
  130. package/lines/LineSegmentsGeometry.mjs +124 -0
  131. package/lines/Wireframe.js +15 -29
  132. package/lines/Wireframe.mjs +31 -0
  133. package/lines/WireframeGeometry2.js +8 -9
  134. package/lines/WireframeGeometry2.mjs +13 -0
  135. package/loaders/3DMLoader.js +234 -469
  136. package/loaders/3DMLoader.mjs +802 -0
  137. package/loaders/3MFLoader.js +340 -555
  138. package/loaders/3MFLoader.mjs +837 -0
  139. package/loaders/AMFLoader.js +114 -219
  140. package/loaders/AMFLoader.mjs +284 -0
  141. package/loaders/AssimpLoader.js +328 -725
  142. package/loaders/AssimpLoader.mjs +1396 -0
  143. package/loaders/BVHLoader.js +94 -200
  144. package/loaders/BVHLoader.mjs +207 -0
  145. package/loaders/BasisTextureLoader.js +229 -357
  146. package/loaders/BasisTextureLoader.mjs +474 -0
  147. package/loaders/ColladaLoader.js +932 -1522
  148. package/loaders/ColladaLoader.mjs +2403 -0
  149. package/loaders/DDSLoader.js +42 -108
  150. package/loaders/DDSLoader.mjs +148 -0
  151. package/loaders/DRACOLoader.js +103 -210
  152. package/loaders/DRACOLoader.mjs +340 -0
  153. package/loaders/EXRLoader.js +461 -809
  154. package/loaders/EXRLoader.mjs +1351 -0
  155. package/loaders/FBXLoader.js +842 -1397
  156. package/loaders/FBXLoader.mjs +2362 -0
  157. package/loaders/FontLoader.js +33 -66
  158. package/loaders/FontLoader.mjs +111 -0
  159. package/loaders/GCodeLoader.js +63 -111
  160. package/loaders/GCodeLoader.mjs +141 -0
  161. package/loaders/GLTFLoader.js +771 -1484
  162. package/loaders/GLTFLoader.mjs +2316 -0
  163. package/loaders/HDRCubeTextureLoader.js +45 -50
  164. package/loaders/HDRCubeTextureLoader.mjs +77 -0
  165. package/loaders/KMZLoader.js +42 -55
  166. package/loaders/KMZLoader.mjs +75 -0
  167. package/loaders/KTX2Loader.js +229 -362
  168. package/loaders/KTX2Loader.mjs +427 -0
  169. package/loaders/KTXLoader.js +37 -99
  170. package/loaders/KTXLoader.mjs +87 -0
  171. package/loaders/LDrawLoader.js +313 -746
  172. package/loaders/LDrawLoader.mjs +1409 -0
  173. package/loaders/LUT3dlLoader.js +50 -62
  174. package/loaders/LUT3dlLoader.mjs +100 -0
  175. package/loaders/LUTCubeLoader.js +45 -56
  176. package/loaders/LUTCubeLoader.mjs +104 -0
  177. package/loaders/LWOLoader.js +227 -339
  178. package/loaders/LWOLoader.mjs +625 -0
  179. package/loaders/LottieLoader.js +36 -38
  180. package/loaders/LottieLoader.mjs +47 -0
  181. package/loaders/MD2Loader.js +248 -91
  182. package/loaders/MD2Loader.mjs +359 -0
  183. package/loaders/MDDLoader.js +25 -45
  184. package/loaders/MDDLoader.mjs +58 -0
  185. package/loaders/MMDLoader.js +359 -795
  186. package/loaders/MMDLoader.mjs +998 -0
  187. package/loaders/MTLLoader.js +91 -201
  188. package/loaders/MTLLoader.mjs +280 -0
  189. package/loaders/NRRDLoader.js +182 -263
  190. package/loaders/NRRDLoader.mjs +401 -0
  191. package/loaders/NodeMaterialLoader.js +121 -14
  192. package/loaders/NodeMaterialLoader.mjs +146 -0
  193. package/loaders/OBJLoader.js +161 -283
  194. package/loaders/OBJLoader.mjs +487 -0
  195. package/loaders/PCDLoader.js +145 -164
  196. package/loaders/PCDLoader.mjs +248 -0
  197. package/loaders/PDBLoader.js +45 -63
  198. package/loaders/PDBLoader.mjs +246 -0
  199. package/loaders/PLYLoader.js +106 -203
  200. package/loaders/PLYLoader.mjs +317 -0
  201. package/loaders/PRWMLoader.js +73 -110
  202. package/loaders/PRWMLoader.mjs +160 -0
  203. package/loaders/PVRLoader.js +32 -93
  204. package/loaders/PVRLoader.mjs +131 -0
  205. package/loaders/RGBELoader.js +96 -233
  206. package/loaders/RGBELoader.mjs +244 -0
  207. package/loaders/RGBMLoader.js +344 -514
  208. package/loaders/RGBMLoader.mjs +998 -0
  209. package/loaders/STLLoader.js +59 -165
  210. package/loaders/STLLoader.mjs +190 -0
  211. package/loaders/SVGLoader.js +481 -851
  212. package/loaders/SVGLoader.mjs +1709 -0
  213. package/loaders/TDSLoader.js +137 -527
  214. package/loaders/TDSLoader.mjs +480 -0
  215. package/loaders/TGALoader.js +94 -205
  216. package/loaders/TGALoader.mjs +285 -0
  217. package/loaders/TTFLoader.js +58 -79
  218. package/loaders/TTFLoader.mjs +131 -0
  219. package/loaders/TiltLoader.js +129 -167
  220. package/loaders/TiltLoader.mjs +373 -0
  221. package/loaders/VOXLoader.js +320 -84
  222. package/loaders/VOXLoader.mjs +431 -0
  223. package/loaders/VRMLLoader.js +786 -1268
  224. package/loaders/VRMLLoader.mjs +2093 -0
  225. package/loaders/VRMLoader.js +23 -31
  226. package/loaders/VRMLoader.mjs +38 -0
  227. package/loaders/VTKLoader.js +219 -407
  228. package/loaders/VTKLoader.mjs +646 -0
  229. package/loaders/XLoader.js +1083 -1259
  230. package/loaders/XLoader.mjs +1258 -0
  231. package/loaders/XYZLoader.js +28 -34
  232. package/loaders/XYZLoader.mjs +60 -0
  233. package/loaders/lwo/IFFParser.js +238 -492
  234. package/loaders/lwo/IFFParser.mjs +697 -0
  235. package/loaders/lwo/LWO2Parser.js +176 -279
  236. package/loaders/lwo/LWO2Parser.mjs +327 -0
  237. package/loaders/lwo/LWO3Parser.js +160 -247
  238. package/loaders/lwo/LWO3Parser.mjs +298 -0
  239. package/math/Capsule.js +56 -43
  240. package/math/Capsule.mjs +100 -0
  241. package/math/ColorConverter.js +18 -32
  242. package/math/ColorConverter.mjs +51 -0
  243. package/math/ConvexHull.js +97 -357
  244. package/math/ConvexHull.mjs +574 -0
  245. package/math/ImprovedNoise.js +282 -32
  246. package/math/ImprovedNoise.mjs +302 -0
  247. package/math/Lut.js +51 -35
  248. package/math/Lut.mjs +135 -0
  249. package/math/MeshSurfaceSampler.js +25 -68
  250. package/math/MeshSurfaceSampler.mjs +107 -0
  251. package/math/OBB.js +91 -152
  252. package/math/OBB.mjs +235 -0
  253. package/math/Octree.js +76 -139
  254. package/math/Octree.mjs +278 -0
  255. package/math/SimplexNoise.js +217 -238
  256. package/math/SimplexNoise.mjs +425 -0
  257. package/misc/ConvexObjectBreaker.js +79 -185
  258. package/misc/ConvexObjectBreaker.mjs +292 -0
  259. package/misc/GPUComputationRenderer.js +69 -194
  260. package/misc/GPUComputationRenderer.mjs +171 -0
  261. package/misc/Gyroscope.js +16 -22
  262. package/misc/Gyroscope.mjs +35 -0
  263. package/misc/MD2Character.js +52 -74
  264. package/misc/MD2Character.mjs +162 -0
  265. package/misc/MD2CharacterComplex.js +112 -163
  266. package/misc/MD2CharacterComplex.mjs +328 -0
  267. package/misc/MorphAnimMesh.js +20 -28
  268. package/misc/MorphAnimMesh.mjs +40 -0
  269. package/misc/MorphBlendMesh.js +45 -69
  270. package/misc/MorphBlendMesh.mjs +179 -0
  271. package/misc/ProgressiveLightmap.js +70 -187
  272. package/misc/ProgressiveLightmap.mjs +166 -0
  273. package/misc/RollerCoaster.js +106 -135
  274. package/misc/RollerCoaster.mjs +346 -0
  275. package/misc/TubePainter.js +74 -92
  276. package/misc/TubePainter.mjs +123 -0
  277. package/misc/Volume.js +108 -270
  278. package/misc/Volume.mjs +244 -0
  279. package/misc/VolumeSlice.js +34 -122
  280. package/misc/VolumeSlice.mjs +106 -0
  281. package/misc/WebGL.js +37 -34
  282. package/misc/WebGL.mjs +74 -0
  283. package/modifiers/CurveModifier.js +46 -151
  284. package/modifiers/CurveModifier.mjs +182 -0
  285. package/modifiers/EdgeSplitModifier.js +46 -90
  286. package/modifiers/EdgeSplitModifier.mjs +162 -0
  287. package/modifiers/SimplifyModifier.js +77 -202
  288. package/modifiers/SimplifyModifier.mjs +282 -0
  289. package/modifiers/TessellateModifier.js +65 -90
  290. package/modifiers/TessellateModifier.mjs +206 -0
  291. package/nodes/Nodes.js +274 -140
  292. package/nodes/Nodes.mjs +400 -0
  293. package/nodes/ShaderNode.js +296 -196
  294. package/nodes/ShaderNode.mjs +408 -0
  295. package/nodes/accessors/BufferNode.js +4 -8
  296. package/nodes/accessors/BufferNode.mjs +15 -0
  297. package/nodes/accessors/CameraNode.js +20 -25
  298. package/nodes/accessors/CameraNode.mjs +44 -0
  299. package/nodes/accessors/CubeTextureNode.js +14 -26
  300. package/nodes/accessors/CubeTextureNode.mjs +42 -0
  301. package/nodes/accessors/MaterialNode.js +43 -53
  302. package/nodes/accessors/MaterialNode.mjs +71 -0
  303. package/nodes/accessors/MaterialReferenceNode.js +3 -6
  304. package/nodes/accessors/MaterialReferenceNode.mjs +14 -0
  305. package/nodes/accessors/ModelNode.js +3 -5
  306. package/nodes/accessors/ModelNode.mjs +9 -0
  307. package/nodes/accessors/ModelViewProjectionNode.js +14 -13
  308. package/nodes/accessors/ModelViewProjectionNode.mjs +24 -0
  309. package/nodes/accessors/NormalNode.js +40 -39
  310. package/nodes/accessors/NormalNode.mjs +62 -0
  311. package/nodes/accessors/Object3DNode.js +40 -50
  312. package/nodes/accessors/Object3DNode.mjs +76 -0
  313. package/nodes/accessors/PointUVNode.js +5 -9
  314. package/nodes/accessors/PointUVNode.mjs +13 -0
  315. package/nodes/accessors/PositionNode.js +42 -41
  316. package/nodes/accessors/PositionNode.mjs +65 -0
  317. package/nodes/accessors/ReferenceNode.js +10 -17
  318. package/nodes/accessors/ReferenceNode.mjs +37 -0
  319. package/nodes/accessors/ReflectNode.js +23 -26
  320. package/nodes/accessors/ReflectNode.mjs +43 -0
  321. package/nodes/accessors/SkinningNode.js +46 -48
  322. package/nodes/accessors/SkinningNode.mjs +58 -0
  323. package/nodes/accessors/TextureNode.js +14 -29
  324. package/nodes/accessors/TextureNode.mjs +54 -0
  325. package/nodes/accessors/UVNode.js +5 -11
  326. package/nodes/accessors/UVNode.mjs +23 -0
  327. package/nodes/core/ArrayUniformNode.js +3 -7
  328. package/nodes/core/ArrayUniformNode.mjs +14 -0
  329. package/nodes/core/AttributeNode.js +5 -12
  330. package/nodes/core/AttributeNode.mjs +30 -0
  331. package/nodes/core/BypassNode.js +5 -12
  332. package/nodes/core/BypassNode.mjs +22 -0
  333. package/nodes/core/CodeNode.js +4 -12
  334. package/nodes/core/CodeNode.mjs +28 -0
  335. package/nodes/core/ConstNode.js +3 -7
  336. package/nodes/core/ConstNode.mjs +14 -0
  337. package/nodes/core/ContextNode.js +3 -8
  338. package/nodes/core/ContextNode.mjs +22 -0
  339. package/nodes/core/ExpressionNode.js +5 -9
  340. package/nodes/core/ExpressionNode.mjs +19 -0
  341. package/nodes/core/FunctionCallNode.js +6 -15
  342. package/nodes/core/FunctionCallNode.mjs +37 -0
  343. package/nodes/core/FunctionNode.js +10 -25
  344. package/nodes/core/FunctionNode.mjs +56 -0
  345. package/nodes/core/InputNode.js +12 -23
  346. package/nodes/core/InputNode.mjs +38 -0
  347. package/nodes/core/Node.js +35 -75
  348. package/nodes/core/Node.mjs +139 -0
  349. package/nodes/core/NodeAttribute.js +2 -4
  350. package/nodes/core/NodeAttribute.mjs +10 -0
  351. package/nodes/core/NodeBuilder.js +110 -224
  352. package/nodes/core/NodeBuilder.mjs +395 -0
  353. package/nodes/core/NodeCode.js +4 -7
  354. package/nodes/core/NodeCode.mjs +11 -0
  355. package/nodes/core/NodeFrame.js +9 -12
  356. package/nodes/core/NodeFrame.mjs +35 -0
  357. package/nodes/core/NodeFunctionInput.js +3 -5
  358. package/nodes/core/NodeFunctionInput.mjs +13 -0
  359. package/nodes/core/NodeKeywords.js +5 -16
  360. package/nodes/core/NodeKeywords.mjs +44 -0
  361. package/nodes/core/NodeUniform.js +3 -7
  362. package/nodes/core/NodeUniform.mjs +18 -0
  363. package/nodes/core/NodeUtils.js +39 -43
  364. package/nodes/core/NodeUtils.mjs +57 -0
  365. package/nodes/core/NodeVar.js +2 -4
  366. package/nodes/core/NodeVar.mjs +10 -0
  367. package/nodes/core/NodeVary.js +2 -4
  368. package/nodes/core/NodeVary.mjs +10 -0
  369. package/nodes/core/PropertyNode.js +4 -10
  370. package/nodes/core/PropertyNode.mjs +21 -0
  371. package/nodes/core/TempNode.js +5 -11
  372. package/nodes/core/TempNode.mjs +25 -0
  373. package/nodes/core/UniformNode.js +4 -10
  374. package/nodes/core/UniformNode.mjs +23 -0
  375. package/nodes/core/VarNode.js +3 -11
  376. package/nodes/core/VarNode.mjs +31 -0
  377. package/nodes/core/VaryNode.js +6 -15
  378. package/nodes/core/VaryNode.mjs +30 -0
  379. package/nodes/core/constants.js +20 -7
  380. package/nodes/core/constants.mjs +24 -0
  381. package/nodes/display/ColorSpaceNode.js +34 -38
  382. package/nodes/display/ColorSpaceNode.mjs +63 -0
  383. package/nodes/display/NormalMapNode.js +35 -53
  384. package/nodes/display/NormalMapNode.mjs +54 -0
  385. package/nodes/fog/FogNode.js +5 -9
  386. package/nodes/fog/FogNode.mjs +15 -0
  387. package/nodes/fog/FogRangeNode.js +5 -9
  388. package/nodes/fog/FogRangeNode.mjs +17 -0
  389. package/nodes/functions/BSDFs.js +61 -118
  390. package/nodes/functions/BSDFs.mjs +64 -0
  391. package/nodes/lights/LightContextNode.js +14 -23
  392. package/nodes/lights/LightContextNode.mjs +35 -0
  393. package/nodes/lights/LightNode.js +27 -31
  394. package/nodes/lights/LightNode.mjs +58 -0
  395. package/nodes/lights/LightsNode.js +9 -28
  396. package/nodes/lights/LightsNode.mjs +59 -0
  397. package/nodes/loaders/NodeLoader.js +27 -42
  398. package/nodes/loaders/NodeLoader.mjs +66 -0
  399. package/nodes/loaders/NodeMaterialLoader.js +4 -10
  400. package/nodes/loaders/NodeMaterialLoader.mjs +24 -0
  401. package/nodes/loaders/NodeObjectLoader.js +9 -19
  402. package/nodes/loaders/NodeObjectLoader.mjs +40 -0
  403. package/nodes/materials/LineBasicNodeMaterial.js +5 -10
  404. package/nodes/materials/LineBasicNodeMaterial.mjs +27 -0
  405. package/nodes/materials/Materials.js +14 -17
  406. package/nodes/materials/Materials.mjs +28 -0
  407. package/nodes/materials/MeshBasicNodeMaterial.js +5 -10
  408. package/nodes/materials/MeshBasicNodeMaterial.mjs +28 -0
  409. package/nodes/materials/MeshStandardNodeMaterial.js +5 -8
  410. package/nodes/materials/MeshStandardNodeMaterial.mjs +41 -0
  411. package/nodes/materials/NodeMaterial.js +20 -36
  412. package/nodes/materials/NodeMaterial.mjs +64 -0
  413. package/nodes/materials/PointsNodeMaterial.js +5 -10
  414. package/nodes/materials/PointsNodeMaterial.mjs +30 -0
  415. package/nodes/math/CondNode.js +11 -23
  416. package/nodes/math/CondNode.mjs +38 -0
  417. package/nodes/math/MathNode.js +98 -142
  418. package/nodes/math/MathNode.mjs +163 -0
  419. package/nodes/math/OperatorNode.js +24 -46
  420. package/nodes/math/OperatorNode.mjs +103 -0
  421. package/nodes/procedural/CheckerNode.js +13 -19
  422. package/nodes/procedural/CheckerNode.mjs +21 -0
  423. package/nodes/utils/ArrayElementNode.js +4 -8
  424. package/nodes/utils/ArrayElementNode.mjs +19 -0
  425. package/nodes/utils/ConvertNode.js +3 -8
  426. package/nodes/utils/ConvertNode.mjs +25 -0
  427. package/nodes/utils/JoinNode.js +7 -11
  428. package/nodes/utils/JoinNode.mjs +26 -0
  429. package/nodes/utils/MatcapUVNode.js +8 -11
  430. package/nodes/utils/MatcapUVNode.mjs +16 -0
  431. package/nodes/utils/OscNode.js +27 -33
  432. package/nodes/utils/OscNode.mjs +50 -0
  433. package/nodes/utils/SplitNode.js +6 -20
  434. package/nodes/utils/SplitNode.mjs +45 -0
  435. package/nodes/utils/SpriteSheetUVNode.js +23 -23
  436. package/nodes/utils/SpriteSheetUVNode.mjs +40 -0
  437. package/nodes/utils/TimerNode.js +20 -24
  438. package/nodes/utils/TimerNode.mjs +44 -0
  439. package/objects/GroundProjectedEnv.js +22 -37
  440. package/objects/GroundProjectedEnv.mjs +130 -0
  441. package/objects/Lensflare.js +86 -156
  442. package/objects/Lensflare.mjs +262 -0
  443. package/objects/LightningStorm.js +38 -102
  444. package/objects/LightningStorm.mjs +110 -0
  445. package/objects/MarchingCubes.js +150 -303
  446. package/objects/MarchingCubes.mjs +457 -0
  447. package/objects/Reflector.js +50 -72
  448. package/objects/Reflector.mjs +166 -0
  449. package/objects/ReflectorForSSRPass.js +80 -131
  450. package/objects/ReflectorForSSRPass.mjs +247 -0
  451. package/objects/ReflectorRTT.js +6 -7
  452. package/objects/ReflectorRTT.mjs +10 -0
  453. package/objects/Refractor.js +64 -106
  454. package/objects/Refractor.mjs +178 -0
  455. package/objects/ShadowMesh.js +8 -17
  456. package/objects/ShadowMesh.mjs +41 -0
  457. package/objects/Sky.js +119 -80
  458. package/objects/Sky.mjs +124 -0
  459. package/objects/Water.js +83 -127
  460. package/objects/Water.mjs +235 -0
  461. package/objects/Water2.js +72 -108
  462. package/objects/Water2.mjs +252 -0
  463. package/offscreen/jank.js +10 -14
  464. package/offscreen/jank.mjs +27 -0
  465. package/offscreen/offscreen.js +4 -5
  466. package/offscreen/offscreen.mjs +5 -0
  467. package/offscreen/scene.js +45 -48
  468. package/offscreen/scene.mjs +52 -0
  469. package/package.json +3 -3
  470. package/physics/AmmoPhysics.js +30 -71
  471. package/physics/AmmoPhysics.mjs +165 -0
  472. package/postprocessing/AdaptiveToneMappingPass.js +97 -123
  473. package/postprocessing/AdaptiveToneMappingPass.mjs +221 -0
  474. package/postprocessing/AfterimagePass.js +28 -49
  475. package/postprocessing/AfterimagePass.mjs +55 -0
  476. package/postprocessing/BloomPass.js +43 -69
  477. package/postprocessing/BloomPass.mjs +90 -0
  478. package/postprocessing/BokehPass.js +39 -69
  479. package/postprocessing/BokehPass.mjs +76 -0
  480. package/postprocessing/ClearPass.js +10 -25
  481. package/postprocessing/ClearPass.mjs +27 -0
  482. package/postprocessing/CubeTexturePass.js +28 -27
  483. package/postprocessing/CubeTexturePass.mjs +49 -0
  484. package/postprocessing/DotScreenPass.js +24 -32
  485. package/postprocessing/DotScreenPass.mjs +40 -0
  486. package/postprocessing/EffectComposer.js +39 -86
  487. package/postprocessing/EffectComposer.mjs +139 -0
  488. package/postprocessing/FilmPass.js +25 -30
  489. package/postprocessing/FilmPass.mjs +42 -0
  490. package/postprocessing/GlitchPass.js +38 -61
  491. package/postprocessing/GlitchPass.mjs +75 -0
  492. package/postprocessing/HalftonePass.js +19 -39
  493. package/postprocessing/HalftonePass.mjs +44 -0
  494. package/postprocessing/LUTPass.js +13 -38
  495. package/postprocessing/LUTPass.mjs +136 -0
  496. package/postprocessing/MaskPass.js +19 -38
  497. package/postprocessing/MaskPass.mjs +60 -0
  498. package/postprocessing/OutlinePass.js +135 -277
  499. package/postprocessing/OutlinePass.mjs +438 -0
  500. package/postprocessing/Pass.js +20 -44
  501. package/postprocessing/Pass.mjs +37 -0
  502. package/postprocessing/RenderPass.js +13 -36
  503. package/postprocessing/RenderPass.mjs +48 -0
  504. package/postprocessing/RenderPixelatedPass.js +44 -58
  505. package/postprocessing/RenderPixelatedPass.mjs +199 -0
  506. package/postprocessing/SAOPass.js +154 -189
  507. package/postprocessing/SAOPass.mjs +282 -0
  508. package/postprocessing/SMAAPass.js +64 -84
  509. package/postprocessing/SMAAPass.mjs +112 -0
  510. package/postprocessing/SSAARenderPass.js +121 -69
  511. package/postprocessing/SSAARenderPass.mjs +170 -0
  512. package/postprocessing/SSAOPass.js +123 -172
  513. package/postprocessing/SSAOPass.mjs +265 -0
  514. package/postprocessing/SSRPass.js +211 -280
  515. package/postprocessing/SSRPass.mjs +432 -0
  516. package/postprocessing/SavePass.js +20 -25
  517. package/postprocessing/SavePass.mjs +37 -0
  518. package/postprocessing/ShaderPass.js +14 -30
  519. package/postprocessing/ShaderPass.mjs +39 -0
  520. package/postprocessing/TAARenderPass.js +42 -61
  521. package/postprocessing/TAARenderPass.mjs +88 -0
  522. package/postprocessing/TexturePass.js +21 -22
  523. package/postprocessing/TexturePass.mjs +39 -0
  524. package/postprocessing/UnrealBloomPass.js +105 -213
  525. package/postprocessing/UnrealBloomPass.mjs +220 -0
  526. package/renderers/CSS2DRenderer.js +44 -56
  527. package/renderers/CSS2DRenderer.mjs +112 -0
  528. package/renderers/CSS3DRenderer.js +53 -86
  529. package/renderers/CSS3DRenderer.mjs +133 -0
  530. package/renderers/Projector.js +107 -274
  531. package/renderers/Projector.mjs +511 -0
  532. package/renderers/SVGRenderer.js +72 -182
  533. package/renderers/SVGRenderer.mjs +306 -0
  534. package/renderers/nodes/accessors/CameraNode.js +29 -40
  535. package/renderers/nodes/accessors/CameraNode.mjs +63 -0
  536. package/renderers/nodes/accessors/ModelNode.js +28 -37
  537. package/renderers/nodes/accessors/ModelNode.mjs +61 -0
  538. package/renderers/nodes/accessors/ModelViewProjectionNode.js +10 -23
  539. package/renderers/nodes/accessors/ModelViewProjectionNode.mjs +21 -0
  540. package/renderers/nodes/accessors/NormalNode.js +35 -45
  541. package/renderers/nodes/accessors/NormalNode.mjs +61 -0
  542. package/renderers/nodes/accessors/PositionNode.js +18 -19
  543. package/renderers/nodes/accessors/PositionNode.mjs +30 -0
  544. package/renderers/nodes/accessors/UVNode.js +5 -10
  545. package/renderers/nodes/accessors/UVNode.mjs +13 -0
  546. package/renderers/nodes/core/AttributeNode.js +5 -14
  547. package/renderers/nodes/core/AttributeNode.mjs +35 -0
  548. package/renderers/nodes/core/InputNode.js +4 -14
  549. package/renderers/nodes/core/InputNode.mjs +31 -0
  550. package/renderers/nodes/core/Node.js +7 -17
  551. package/renderers/nodes/core/Node.mjs +34 -0
  552. package/renderers/nodes/core/NodeAttribute.js +3 -6
  553. package/renderers/nodes/core/NodeAttribute.mjs +10 -0
  554. package/renderers/nodes/core/NodeBuilder.js +87 -154
  555. package/renderers/nodes/core/NodeBuilder.mjs +243 -0
  556. package/renderers/nodes/core/NodeFrame.js +9 -12
  557. package/renderers/nodes/core/NodeFrame.mjs +35 -0
  558. package/renderers/nodes/core/NodeSlot.js +2 -3
  559. package/renderers/nodes/core/NodeSlot.mjs +10 -0
  560. package/renderers/nodes/core/NodeUniform.js +4 -9
  561. package/renderers/nodes/core/NodeUniform.mjs +18 -0
  562. package/renderers/nodes/core/NodeVary.js +4 -7
  563. package/renderers/nodes/core/NodeVary.mjs +11 -0
  564. package/renderers/nodes/core/VaryNode.js +6 -12
  565. package/renderers/nodes/core/VaryNode.mjs +22 -0
  566. package/renderers/nodes/core/constants.js +16 -13
  567. package/renderers/nodes/core/constants.mjs +22 -0
  568. package/renderers/nodes/inputs/ColorNode.js +5 -11
  569. package/renderers/nodes/inputs/ColorNode.mjs +11 -0
  570. package/renderers/nodes/inputs/FloatNode.js +5 -11
  571. package/renderers/nodes/inputs/FloatNode.mjs +11 -0
  572. package/renderers/nodes/inputs/Matrix3Node.js +7 -13
  573. package/renderers/nodes/inputs/Matrix3Node.mjs +12 -0
  574. package/renderers/nodes/inputs/Matrix4Node.js +7 -13
  575. package/renderers/nodes/inputs/Matrix4Node.mjs +12 -0
  576. package/renderers/nodes/inputs/TextureNode.js +7 -15
  577. package/renderers/nodes/inputs/TextureNode.mjs +20 -0
  578. package/renderers/nodes/inputs/Vector2Node.js +5 -11
  579. package/renderers/nodes/inputs/Vector2Node.mjs +11 -0
  580. package/renderers/nodes/inputs/Vector3Node.js +7 -13
  581. package/renderers/nodes/inputs/Vector3Node.mjs +12 -0
  582. package/renderers/nodes/inputs/Vector4Node.js +7 -13
  583. package/renderers/nodes/inputs/Vector4Node.mjs +12 -0
  584. package/renderers/nodes/math/MathNode.js +20 -30
  585. package/renderers/nodes/math/MathNode.mjs +55 -0
  586. package/renderers/nodes/math/OperatorNode.js +4 -20
  587. package/renderers/nodes/math/OperatorNode.mjs +42 -0
  588. package/renderers/nodes/utils/SwitchNode.js +4 -9
  589. package/renderers/nodes/utils/SwitchNode.mjs +20 -0
  590. package/renderers/nodes/utils/TimerNode.js +5 -10
  591. package/renderers/nodes/utils/TimerNode.mjs +14 -0
  592. package/renderers/webgpu/WebGPU.js +14 -16
  593. package/renderers/webgpu/WebGPU.mjs +24 -0
  594. package/renderers/webgpu/WebGPUAttributes.js +16 -23
  595. package/renderers/webgpu/WebGPUAttributes.mjs +69 -0
  596. package/renderers/webgpu/WebGPUBackground.js +13 -30
  597. package/renderers/webgpu/WebGPUBackground.mjs +61 -0
  598. package/renderers/webgpu/WebGPUBinding.js +4 -7
  599. package/renderers/webgpu/WebGPUBinding.mjs +14 -0
  600. package/renderers/webgpu/WebGPUBindings.js +21 -57
  601. package/renderers/webgpu/WebGPUBindings.mjs +155 -0
  602. package/renderers/webgpu/WebGPUComputePipelines.js +14 -25
  603. package/renderers/webgpu/WebGPUComputePipelines.mjs +44 -0
  604. package/renderers/webgpu/WebGPUGeometries.js +5 -15
  605. package/renderers/webgpu/WebGPUGeometries.mjs +41 -0
  606. package/renderers/webgpu/WebGPUInfo.js +3 -8
  607. package/renderers/webgpu/WebGPUInfo.mjs +46 -0
  608. package/renderers/webgpu/WebGPUObjects.js +5 -10
  609. package/renderers/webgpu/WebGPUObjects.mjs +25 -0
  610. package/renderers/webgpu/WebGPUProperties.js +5 -11
  611. package/renderers/webgpu/WebGPUProperties.mjs +22 -0
  612. package/renderers/webgpu/WebGPURenderLists.js +20 -36
  613. package/renderers/webgpu/WebGPURenderLists.mjs +119 -0
  614. package/renderers/webgpu/WebGPURenderPipelines.js +260 -387
  615. package/renderers/webgpu/WebGPURenderPipelines.mjs +545 -0
  616. package/renderers/webgpu/WebGPURenderer.js +124 -262
  617. package/renderers/webgpu/WebGPURenderer.mjs +574 -0
  618. package/renderers/webgpu/WebGPUSampledTexture.js +18 -31
  619. package/renderers/webgpu/WebGPUSampledTexture.mjs +40 -0
  620. package/renderers/webgpu/WebGPUSampler.js +7 -12
  621. package/renderers/webgpu/WebGPUSampler.mjs +15 -0
  622. package/renderers/webgpu/WebGPUStorageBuffer.js +7 -12
  623. package/renderers/webgpu/WebGPUStorageBuffer.mjs +15 -0
  624. package/renderers/webgpu/WebGPUTextureRenderer.js +5 -11
  625. package/renderers/webgpu/WebGPUTextureRenderer.mjs +23 -0
  626. package/renderers/webgpu/WebGPUTextureUtils.js +29 -40
  627. package/renderers/webgpu/WebGPUTextureUtils.mjs +98 -0
  628. package/renderers/webgpu/WebGPUTextures.js +186 -333
  629. package/renderers/webgpu/WebGPUTextures.mjs +484 -0
  630. package/renderers/webgpu/WebGPUUniform.js +25 -51
  631. package/renderers/webgpu/WebGPUUniform.mjs +81 -0
  632. package/renderers/webgpu/WebGPUUniformsGroup.js +32 -72
  633. package/renderers/webgpu/WebGPUUniformsGroup.mjs +176 -0
  634. package/renderers/webgpu/constants.js +190 -181
  635. package/renderers/webgpu/constants.mjs +230 -0
  636. package/renderers/webgpu/nodes/ShaderLib.js +2 -2
  637. package/renderers/webgpu/nodes/ShaderLib.mjs +42 -0
  638. package/renderers/webgpu/nodes/WebGPUNodeBuilder.js +53 -124
  639. package/renderers/webgpu/nodes/WebGPUNodeBuilder.mjs +165 -0
  640. package/renderers/webgpu/nodes/WebGPUNodeUniform.js +17 -31
  641. package/renderers/webgpu/nodes/WebGPUNodeUniform.mjs +73 -0
  642. package/renderers/webgpu/nodes/WebGPUNodeUniformsGroup.js +8 -9
  643. package/renderers/webgpu/nodes/WebGPUNodeUniformsGroup.mjs +15 -0
  644. package/renderers/webgpu/nodes/WebGPUNodes.js +7 -45
  645. package/renderers/webgpu/nodes/WebGPUNodes.mjs +40 -0
  646. package/shaders/ACESFilmicToneMappingShader.js +44 -24
  647. package/shaders/ACESFilmicToneMappingShader.mjs +48 -0
  648. package/shaders/AfterimageShader.js +28 -18
  649. package/shaders/AfterimageShader.mjs +32 -0
  650. package/shaders/BasicShader.js +9 -7
  651. package/shaders/BasicShader.mjs +12 -0
  652. package/shaders/BleachBypassShader.js +31 -15
  653. package/shaders/BleachBypassShader.mjs +35 -0
  654. package/shaders/BlendShader.js +26 -19
  655. package/shaders/BlendShader.mjs +30 -0
  656. package/shaders/BokehShader.js +98 -36
  657. package/shaders/BokehShader.mjs +106 -0
  658. package/shaders/BokehShader2.js +261 -90
  659. package/shaders/BokehShader2.mjs +269 -0
  660. package/shaders/BrightnessContrastShader.js +28 -19
  661. package/shaders/BrightnessContrastShader.mjs +32 -0
  662. package/shaders/ColorCorrectionShader.js +26 -22
  663. package/shaders/ColorCorrectionShader.mjs +30 -0
  664. package/shaders/ColorifyShader.js +24 -16
  665. package/shaders/ColorifyShader.mjs +28 -0
  666. package/shaders/ConvolutionShader.js +40 -36
  667. package/shaders/ConvolutionShader.mjs +55 -0
  668. package/shaders/CopyShader.js +21 -13
  669. package/shaders/CopyShader.mjs +25 -0
  670. package/shaders/DOFMipMapShader.js +28 -21
  671. package/shaders/DOFMipMapShader.mjs +32 -0
  672. package/shaders/DepthLimitedBlurShader.js +85 -40
  673. package/shaders/DepthLimitedBlurShader.mjs +114 -0
  674. package/shaders/DigitalGlitch.js +74 -46
  675. package/shaders/DigitalGlitch.mjs +78 -0
  676. package/shaders/DotScreenShader.js +35 -27
  677. package/shaders/DotScreenShader.mjs +39 -0
  678. package/shaders/FXAAShader.js +1094 -19
  679. package/shaders/FXAAShader.mjs +1098 -0
  680. package/shaders/FilmShader.js +38 -52
  681. package/shaders/FilmShader.mjs +42 -0
  682. package/shaders/FocusShader.js +51 -24
  683. package/shaders/FocusShader.mjs +55 -0
  684. package/shaders/FreiChenShader.js +57 -24
  685. package/shaders/FreiChenShader.mjs +61 -0
  686. package/shaders/FresnelShader.js +43 -22
  687. package/shaders/FresnelShader.mjs +47 -0
  688. package/shaders/GammaCorrectionShader.js +19 -11
  689. package/shaders/GammaCorrectionShader.mjs +23 -0
  690. package/shaders/GodRaysShader.js +103 -94
  691. package/shaders/GodRaysShader.mjs +146 -0
  692. package/shaders/HalftoneShader.js +208 -65
  693. package/shaders/HalftoneShader.mjs +212 -0
  694. package/shaders/HorizontalBlurShader.js +7 -23
  695. package/shaders/HorizontalBlurShader.mjs +43 -0
  696. package/shaders/HorizontalTiltShiftShader.js +33 -21
  697. package/shaders/HorizontalTiltShiftShader.mjs +37 -0
  698. package/shaders/HueSaturationShader.js +37 -21
  699. package/shaders/HueSaturationShader.mjs +41 -0
  700. package/shaders/KaleidoShader.js +30 -22
  701. package/shaders/KaleidoShader.mjs +34 -0
  702. package/shaders/LuminosityHighPassShader.js +33 -27
  703. package/shaders/LuminosityHighPassShader.mjs +37 -0
  704. package/shaders/LuminosityShader.js +21 -11
  705. package/shaders/LuminosityShader.mjs +25 -0
  706. package/shaders/MirrorShader.js +31 -16
  707. package/shaders/MirrorShader.mjs +35 -0
  708. package/shaders/NormalMapShader.js +27 -23
  709. package/shaders/NormalMapShader.mjs +31 -0
  710. package/shaders/ParallaxShader.js +107 -48
  711. package/shaders/ParallaxShader.mjs +113 -0
  712. package/shaders/PixelShader.js +24 -16
  713. package/shaders/PixelShader.mjs +28 -0
  714. package/shaders/RGBShiftShader.js +26 -22
  715. package/shaders/RGBShiftShader.mjs +30 -0
  716. package/shaders/SAOShader.js +132 -48
  717. package/shaders/SAOShader.mjs +144 -0
  718. package/shaders/SMAAShader.js +256 -135
  719. package/shaders/SMAAShader.mjs +272 -0
  720. package/shaders/SSAOShader.js +153 -81
  721. package/shaders/SSAOShader.mjs +172 -0
  722. package/shaders/SSRShader.js +32 -87
  723. package/shaders/SSRShader.mjs +324 -0
  724. package/shaders/SepiaShader.js +25 -15
  725. package/shaders/SepiaShader.mjs +29 -0
  726. package/shaders/SobelOperatorShader.js +40 -29
  727. package/shaders/SobelOperatorShader.mjs +44 -0
  728. package/shaders/SubsurfaceScatteringShader.js +53 -39
  729. package/shaders/SubsurfaceScatteringShader.mjs +59 -0
  730. package/shaders/TechnicolorShader.js +20 -13
  731. package/shaders/TechnicolorShader.mjs +24 -0
  732. package/shaders/ToneMapShader.js +44 -28
  733. package/shaders/ToneMapShader.mjs +48 -0
  734. package/shaders/ToonShader.js +172 -96
  735. package/shaders/ToonShader.mjs +188 -0
  736. package/shaders/TriangleBlurShader.js +32 -23
  737. package/shaders/TriangleBlurShader.mjs +36 -0
  738. package/shaders/UnpackDepthRGBAShader.js +22 -14
  739. package/shaders/UnpackDepthRGBAShader.mjs +26 -0
  740. package/shaders/VerticalBlurShader.js +7 -23
  741. package/shaders/VerticalBlurShader.mjs +44 -0
  742. package/shaders/VerticalTiltShiftShader.js +33 -21
  743. package/shaders/VerticalTiltShiftShader.mjs +37 -0
  744. package/shaders/VignetteShader.js +24 -28
  745. package/shaders/VignetteShader.mjs +28 -0
  746. package/shaders/VolumeShader.js +174 -77
  747. package/shaders/VolumeShader.mjs +178 -0
  748. package/shaders/WaterRefractionShader.js +38 -6
  749. package/shaders/WaterRefractionShader.mjs +57 -0
  750. package/shaders/types.js +1 -1
  751. package/{custom.d.js → shaders/types.mjs} +0 -0
  752. package/textures/FlakesTexture.js +8 -10
  753. package/textures/FlakesTexture.mjs +30 -0
  754. package/types/helpers.js +3 -2
  755. package/types/helpers.mjs +4 -0
  756. package/utils/BufferGeometryUtils.js +251 -325
  757. package/utils/BufferGeometryUtils.mjs +570 -0
  758. package/utils/GeometryCompressionUtils.js +241 -239
  759. package/utils/GeometryCompressionUtils.mjs +547 -0
  760. package/utils/GeometryUtils.js +41 -94
  761. package/utils/GeometryUtils.mjs +108 -0
  762. package/utils/RoughnessMipmapper.js +38 -82
  763. package/utils/RoughnessMipmapper.mjs +213 -0
  764. package/utils/SceneUtils.js +15 -20
  765. package/utils/SceneUtils.mjs +36 -0
  766. package/utils/ShadowMapViewer.js +49 -95
  767. package/utils/ShadowMapViewer.mjs +114 -0
  768. package/utils/SkeletonUtils.js +74 -165
  769. package/utils/SkeletonUtils.mjs +292 -0
  770. package/utils/UVsDebug.js +32 -62
  771. package/utils/UVsDebug.mjs +85 -0
  772. package/utils/WorkerPool.js +13 -33
  773. package/utils/WorkerPool.mjs +62 -0
  774. package/webxr/ARButton.js +72 -98
  775. package/webxr/ARButton.mjs +119 -0
  776. package/webxr/OculusHandModel.js +18 -37
  777. package/webxr/OculusHandModel.mjs +71 -0
  778. package/webxr/OculusHandPointerModel.js +58 -80
  779. package/webxr/OculusHandPointerModel.mjs +207 -0
  780. package/webxr/Text2D.js +37 -19
  781. package/webxr/Text2D.mjs +31 -0
  782. package/webxr/VRButton.js +59 -90
  783. package/webxr/VRButton.mjs +105 -0
  784. package/webxr/XRControllerModelFactory.js +58 -116
  785. package/webxr/XRControllerModelFactory.mjs +146 -0
  786. package/webxr/XREstimatedLight.js +39 -66
  787. package/webxr/XREstimatedLight.mjs +126 -0
  788. package/webxr/XRHandMeshModel.js +40 -29
  789. package/webxr/XRHandMeshModel.mjs +73 -0
  790. package/webxr/XRHandModelFactory.js +28 -31
  791. package/webxr/XRHandModelFactory.mjs +61 -0
  792. package/webxr/XRHandPrimitiveModel.js +41 -27
  793. package/webxr/XRHandPrimitiveModel.mjs +68 -0
  794. package/BufferGeometryUtils-1a7a235c.js +0 -655
  795. package/BufferGeometryUtils-971dfde3.js +0 -1
  796. package/Nodes-4f766d71.js +0 -471
  797. package/Nodes-9aa16d74.js +0 -1
  798. package/animation/AnimationClipCreator.cjs.js +0 -1
  799. package/animation/CCDIKSolver.cjs.js +0 -1
  800. package/animation/MMDAnimationHelper.cjs.js +0 -1
  801. package/animation/MMDPhysics.cjs.js +0 -1
  802. package/cameras/CinematicCamera.cjs.js +0 -1
  803. package/controls/ArcballControls.cjs.js +0 -1
  804. package/controls/DeviceOrientationControls.cjs.js +0 -1
  805. package/controls/DragControls.cjs.js +0 -1
  806. package/controls/FirstPersonControls.cjs.js +0 -1
  807. package/controls/FlyControls.cjs.js +0 -1
  808. package/controls/OrbitControls.cjs.js +0 -1
  809. package/controls/PointerLockControls.cjs.js +0 -1
  810. package/controls/TrackballControls.cjs.js +0 -1
  811. package/controls/TransformControls.cjs.js +0 -1
  812. package/controls/experimental/CameraControls.cjs.js +0 -1
  813. package/csm/CSM.cjs.js +0 -1
  814. package/csm/CSMFrustum.cjs.js +0 -1
  815. package/csm/CSMHelper.cjs.js +0 -1
  816. package/csm/CSMShader.cjs.js +0 -1
  817. package/curves/CurveExtras.cjs.js +0 -1
  818. package/curves/NURBSCurve.cjs.js +0 -1
  819. package/curves/NURBSSurface.cjs.js +0 -1
  820. package/curves/NURBSUtils.cjs.js +0 -1
  821. package/custom.d.cjs.js +0 -1
  822. package/deprecated/Geometry.cjs.js +0 -1
  823. package/effects/AnaglyphEffect.cjs.js +0 -1
  824. package/effects/AsciiEffect.cjs.js +0 -1
  825. package/effects/OutlineEffect.cjs.js +0 -1
  826. package/effects/ParallaxBarrierEffect.cjs.js +0 -1
  827. package/effects/PeppersGhostEffect.cjs.js +0 -1
  828. package/effects/StereoEffect.cjs.js +0 -1
  829. package/environments/RoomEnvironment.cjs.js +0 -1
  830. package/exporters/ColladaExporter.cjs.js +0 -1
  831. package/exporters/DRACOExporter.cjs.js +0 -1
  832. package/exporters/GLTFExporter.cjs.js +0 -1
  833. package/exporters/MMDExporter.cjs.js +0 -1
  834. package/exporters/OBJExporter.cjs.js +0 -1
  835. package/exporters/PLYExporter.cjs.js +0 -1
  836. package/exporters/STLExporter.cjs.js +0 -1
  837. package/exporters/USDZExporter.cjs.js +0 -1
  838. package/geometries/BoxLineGeometry.cjs.js +0 -1
  839. package/geometries/ConvexGeometry.cjs.js +0 -1
  840. package/geometries/DecalGeometry.cjs.js +0 -1
  841. package/geometries/LightningStrike.cjs.js +0 -1
  842. package/geometries/ParametricGeometries.cjs.js +0 -1
  843. package/geometries/ParametricGeometry.cjs.js +0 -1
  844. package/geometries/RoundedBoxGeometry.cjs.js +0 -1
  845. package/geometries/TeapotGeometry.cjs.js +0 -1
  846. package/geometries/TextGeometry.cjs.js +0 -1
  847. package/helpers/LightProbeHelper.cjs.js +0 -1
  848. package/helpers/PositionalAudioHelper.cjs.js +0 -1
  849. package/helpers/RectAreaLightHelper.cjs.js +0 -1
  850. package/helpers/VertexNormalsHelper.cjs.js +0 -1
  851. package/helpers/VertexTangentsHelper.cjs.js +0 -1
  852. package/index.cjs.js +0 -1
  853. package/interactive/InteractiveGroup.cjs.js +0 -1
  854. package/interactive/InteractiveGroup.d.ts +0 -5
  855. package/interactive/InteractiveGroup.js +0 -87
  856. package/interactive/SelectionBox.cjs.js +0 -1
  857. package/interactive/SelectionHelper.cjs.js +0 -1
  858. package/libs/MeshoptDecoder.cjs.js +0 -1
  859. package/libs/MotionControllers.cjs.js +0 -1
  860. package/lights/LightProbeGenerator.cjs.js +0 -1
  861. package/lights/RectAreaLightUniformsLib.cjs.js +0 -1
  862. package/lines/Line2.cjs.js +0 -1
  863. package/lines/LineGeometry.cjs.js +0 -1
  864. package/lines/LineMaterial.cjs.js +0 -1
  865. package/lines/LineSegments2.cjs.js +0 -1
  866. package/lines/LineSegmentsGeometry.cjs.js +0 -1
  867. package/lines/Wireframe.cjs.js +0 -1
  868. package/lines/WireframeGeometry2.cjs.js +0 -1
  869. package/loaders/3DMLoader.cjs.js +0 -1
  870. package/loaders/3MFLoader.cjs.js +0 -1
  871. package/loaders/AMFLoader.cjs.js +0 -1
  872. package/loaders/AssimpLoader.cjs.js +0 -1
  873. package/loaders/BVHLoader.cjs.js +0 -1
  874. package/loaders/BasisTextureLoader.cjs.js +0 -1
  875. package/loaders/ColladaLoader.cjs.js +0 -1
  876. package/loaders/DDSLoader.cjs.js +0 -1
  877. package/loaders/DRACOLoader.cjs.js +0 -1
  878. package/loaders/EXRLoader.cjs.js +0 -1
  879. package/loaders/FBXLoader.cjs.js +0 -1
  880. package/loaders/FontLoader.cjs.js +0 -1
  881. package/loaders/GCodeLoader.cjs.js +0 -1
  882. package/loaders/GLTFLoader.cjs.js +0 -1
  883. package/loaders/HDRCubeTextureLoader.cjs.js +0 -1
  884. package/loaders/KMZLoader.cjs.js +0 -1
  885. package/loaders/KTX2Loader.cjs.js +0 -1
  886. package/loaders/KTXLoader.cjs.js +0 -1
  887. package/loaders/LDrawLoader.cjs.js +0 -1
  888. package/loaders/LUT3dlLoader.cjs.js +0 -1
  889. package/loaders/LUTCubeLoader.cjs.js +0 -1
  890. package/loaders/LWOLoader.cjs.js +0 -1
  891. package/loaders/LottieLoader.cjs.js +0 -1
  892. package/loaders/MD2Loader.cjs.js +0 -1
  893. package/loaders/MDDLoader.cjs.js +0 -1
  894. package/loaders/MMDLoader.cjs.js +0 -1
  895. package/loaders/MTLLoader.cjs.js +0 -1
  896. package/loaders/NRRDLoader.cjs.js +0 -1
  897. package/loaders/NodeMaterialLoader.cjs.js +0 -1
  898. package/loaders/OBJLoader.cjs.js +0 -1
  899. package/loaders/PCDLoader.cjs.js +0 -1
  900. package/loaders/PDBLoader.cjs.js +0 -1
  901. package/loaders/PLYLoader.cjs.js +0 -1
  902. package/loaders/PRWMLoader.cjs.js +0 -1
  903. package/loaders/PVRLoader.cjs.js +0 -1
  904. package/loaders/RGBELoader.cjs.js +0 -1
  905. package/loaders/RGBMLoader.cjs.js +0 -1
  906. package/loaders/STLLoader.cjs.js +0 -1
  907. package/loaders/SVGLoader.cjs.js +0 -1
  908. package/loaders/TDSLoader.cjs.js +0 -1
  909. package/loaders/TGALoader.cjs.js +0 -1
  910. package/loaders/TTFLoader.cjs.js +0 -1
  911. package/loaders/TiltLoader.cjs.js +0 -1
  912. package/loaders/VOXLoader.cjs.js +0 -1
  913. package/loaders/VRMLLoader.cjs.js +0 -1
  914. package/loaders/VRMLoader.cjs.js +0 -1
  915. package/loaders/VTKLoader.cjs.js +0 -1
  916. package/loaders/XLoader.cjs.js +0 -1
  917. package/loaders/XYZLoader.cjs.js +0 -1
  918. package/loaders/lwo/IFFParser.cjs.js +0 -1
  919. package/loaders/lwo/LWO2Parser.cjs.js +0 -1
  920. package/loaders/lwo/LWO3Parser.cjs.js +0 -1
  921. package/math/Capsule.cjs.js +0 -1
  922. package/math/ColorConverter.cjs.js +0 -1
  923. package/math/ConvexHull.cjs.js +0 -1
  924. package/math/ImprovedNoise.cjs.js +0 -1
  925. package/math/Lut.cjs.js +0 -1
  926. package/math/MeshSurfaceSampler.cjs.js +0 -1
  927. package/math/OBB.cjs.js +0 -1
  928. package/math/Octree.cjs.js +0 -1
  929. package/math/SimplexNoise.cjs.js +0 -1
  930. package/misc/ConvexObjectBreaker.cjs.js +0 -1
  931. package/misc/GPUComputationRenderer.cjs.js +0 -1
  932. package/misc/Gyroscope.cjs.js +0 -1
  933. package/misc/MD2Character.cjs.js +0 -1
  934. package/misc/MD2CharacterComplex.cjs.js +0 -1
  935. package/misc/MorphAnimMesh.cjs.js +0 -1
  936. package/misc/MorphBlendMesh.cjs.js +0 -1
  937. package/misc/ProgressiveLightmap.cjs.js +0 -1
  938. package/misc/RollerCoaster.cjs.js +0 -1
  939. package/misc/TubePainter.cjs.js +0 -1
  940. package/misc/Volume.cjs.js +0 -1
  941. package/misc/VolumeSlice.cjs.js +0 -1
  942. package/misc/WebGL.cjs.js +0 -1
  943. package/modifiers/CurveModifier.cjs.js +0 -1
  944. package/modifiers/EdgeSplitModifier.cjs.js +0 -1
  945. package/modifiers/SimplifyModifier.cjs.js +0 -1
  946. package/modifiers/TessellateModifier.cjs.js +0 -1
  947. package/nodes/Nodes.cjs.js +0 -1
  948. package/nodes/ShaderNode.cjs.js +0 -1
  949. package/nodes/accessors/BufferNode.cjs.js +0 -1
  950. package/nodes/accessors/CameraNode.cjs.js +0 -1
  951. package/nodes/accessors/CubeTextureNode.cjs.js +0 -1
  952. package/nodes/accessors/MaterialNode.cjs.js +0 -1
  953. package/nodes/accessors/MaterialReferenceNode.cjs.js +0 -1
  954. package/nodes/accessors/ModelNode.cjs.js +0 -1
  955. package/nodes/accessors/ModelViewProjectionNode.cjs.js +0 -1
  956. package/nodes/accessors/NormalNode.cjs.js +0 -1
  957. package/nodes/accessors/Object3DNode.cjs.js +0 -1
  958. package/nodes/accessors/PointUVNode.cjs.js +0 -1
  959. package/nodes/accessors/PositionNode.cjs.js +0 -1
  960. package/nodes/accessors/ReferenceNode.cjs.js +0 -1
  961. package/nodes/accessors/ReflectNode.cjs.js +0 -1
  962. package/nodes/accessors/SkinningNode.cjs.js +0 -1
  963. package/nodes/accessors/TextureNode.cjs.js +0 -1
  964. package/nodes/accessors/UVNode.cjs.js +0 -1
  965. package/nodes/core/ArrayUniformNode.cjs.js +0 -1
  966. package/nodes/core/AttributeNode.cjs.js +0 -1
  967. package/nodes/core/BypassNode.cjs.js +0 -1
  968. package/nodes/core/CodeNode.cjs.js +0 -1
  969. package/nodes/core/ConstNode.cjs.js +0 -1
  970. package/nodes/core/ContextNode.cjs.js +0 -1
  971. package/nodes/core/ExpressionNode.cjs.js +0 -1
  972. package/nodes/core/FunctionCallNode.cjs.js +0 -1
  973. package/nodes/core/FunctionNode.cjs.js +0 -1
  974. package/nodes/core/InputNode.cjs.js +0 -1
  975. package/nodes/core/Node.cjs.js +0 -1
  976. package/nodes/core/NodeAttribute.cjs.js +0 -1
  977. package/nodes/core/NodeBuilder.cjs.js +0 -1
  978. package/nodes/core/NodeCode.cjs.js +0 -1
  979. package/nodes/core/NodeFrame.cjs.js +0 -1
  980. package/nodes/core/NodeFunction.cjs.js +0 -1
  981. package/nodes/core/NodeFunction.js +0 -17
  982. package/nodes/core/NodeFunctionInput.cjs.js +0 -1
  983. package/nodes/core/NodeKeywords.cjs.js +0 -1
  984. package/nodes/core/NodeParser.cjs.js +0 -1
  985. package/nodes/core/NodeParser.js +0 -8
  986. package/nodes/core/NodeUniform.cjs.js +0 -1
  987. package/nodes/core/NodeUtils.cjs.js +0 -1
  988. package/nodes/core/NodeVar.cjs.js +0 -1
  989. package/nodes/core/NodeVary.cjs.js +0 -1
  990. package/nodes/core/PropertyNode.cjs.js +0 -1
  991. package/nodes/core/TempNode.cjs.js +0 -1
  992. package/nodes/core/UniformNode.cjs.js +0 -1
  993. package/nodes/core/VarNode.cjs.js +0 -1
  994. package/nodes/core/VaryNode.cjs.js +0 -1
  995. package/nodes/core/constants.cjs.js +0 -1
  996. package/nodes/display/ColorSpaceNode.cjs.js +0 -1
  997. package/nodes/display/NormalMapNode.cjs.js +0 -1
  998. package/nodes/fog/FogNode.cjs.js +0 -1
  999. package/nodes/fog/FogRangeNode.cjs.js +0 -1
  1000. package/nodes/functions/BSDFs.cjs.js +0 -1
  1001. package/nodes/functions/PhysicalMaterialFunctions.cjs.js +0 -1
  1002. package/nodes/functions/PhysicalMaterialFunctions.js +0 -57
  1003. package/nodes/lights/LightContextNode.cjs.js +0 -1
  1004. package/nodes/lights/LightNode.cjs.js +0 -1
  1005. package/nodes/lights/LightsNode.cjs.js +0 -1
  1006. package/nodes/loaders/NodeLoader.cjs.js +0 -1
  1007. package/nodes/loaders/NodeMaterialLoader.cjs.js +0 -1
  1008. package/nodes/loaders/NodeObjectLoader.cjs.js +0 -1
  1009. package/nodes/materials/LineBasicNodeMaterial.cjs.js +0 -1
  1010. package/nodes/materials/Materials.cjs.js +0 -1
  1011. package/nodes/materials/MeshBasicNodeMaterial.cjs.js +0 -1
  1012. package/nodes/materials/MeshStandardNodeMaterial.cjs.js +0 -1
  1013. package/nodes/materials/NodeMaterial.cjs.js +0 -1
  1014. package/nodes/materials/PointsNodeMaterial.cjs.js +0 -1
  1015. package/nodes/math/CondNode.cjs.js +0 -1
  1016. package/nodes/math/MathNode.cjs.js +0 -1
  1017. package/nodes/math/OperatorNode.cjs.js +0 -1
  1018. package/nodes/parsers/GLSLNodeFunction.cjs.js +0 -1
  1019. package/nodes/parsers/GLSLNodeFunction.js +0 -101
  1020. package/nodes/parsers/GLSLNodeParser.cjs.js +0 -1
  1021. package/nodes/parsers/GLSLNodeParser.js +0 -13
  1022. package/nodes/parsers/WGSLNodeFunction.cjs.js +0 -1
  1023. package/nodes/parsers/WGSLNodeFunction.js +0 -71
  1024. package/nodes/parsers/WGSLNodeParser.cjs.js +0 -1
  1025. package/nodes/parsers/WGSLNodeParser.js +0 -13
  1026. package/nodes/procedural/CheckerNode.cjs.js +0 -1
  1027. package/nodes/utils/ArrayElementNode.cjs.js +0 -1
  1028. package/nodes/utils/ConvertNode.cjs.js +0 -1
  1029. package/nodes/utils/JoinNode.cjs.js +0 -1
  1030. package/nodes/utils/MatcapUVNode.cjs.js +0 -1
  1031. package/nodes/utils/OscNode.cjs.js +0 -1
  1032. package/nodes/utils/SplitNode.cjs.js +0 -1
  1033. package/nodes/utils/SpriteSheetUVNode.cjs.js +0 -1
  1034. package/nodes/utils/TimerNode.cjs.js +0 -1
  1035. package/objects/GroundProjectedEnv.cjs.js +0 -1
  1036. package/objects/Lensflare.cjs.js +0 -1
  1037. package/objects/LightningStorm.cjs.js +0 -1
  1038. package/objects/MarchingCubes.cjs.js +0 -1
  1039. package/objects/Reflector.cjs.js +0 -1
  1040. package/objects/ReflectorForSSRPass.cjs.js +0 -1
  1041. package/objects/ReflectorRTT.cjs.js +0 -1
  1042. package/objects/Refractor.cjs.js +0 -1
  1043. package/objects/ShadowMesh.cjs.js +0 -1
  1044. package/objects/Sky.cjs.js +0 -1
  1045. package/objects/Water.cjs.js +0 -1
  1046. package/objects/Water2.cjs.js +0 -1
  1047. package/offscreen/jank.cjs.js +0 -1
  1048. package/offscreen/offscreen.cjs.js +0 -1
  1049. package/offscreen/scene.cjs.js +0 -1
  1050. package/physics/AmmoPhysics.cjs.js +0 -1
  1051. package/postprocessing/AdaptiveToneMappingPass.cjs.js +0 -1
  1052. package/postprocessing/AfterimagePass.cjs.js +0 -1
  1053. package/postprocessing/BloomPass.cjs.js +0 -1
  1054. package/postprocessing/BokehPass.cjs.js +0 -1
  1055. package/postprocessing/ClearPass.cjs.js +0 -1
  1056. package/postprocessing/CubeTexturePass.cjs.js +0 -1
  1057. package/postprocessing/DotScreenPass.cjs.js +0 -1
  1058. package/postprocessing/EffectComposer.cjs.js +0 -1
  1059. package/postprocessing/FilmPass.cjs.js +0 -1
  1060. package/postprocessing/GlitchPass.cjs.js +0 -1
  1061. package/postprocessing/HalftonePass.cjs.js +0 -1
  1062. package/postprocessing/LUTPass.cjs.js +0 -1
  1063. package/postprocessing/MaskPass.cjs.js +0 -1
  1064. package/postprocessing/OutlinePass.cjs.js +0 -1
  1065. package/postprocessing/Pass.cjs.js +0 -1
  1066. package/postprocessing/RenderPass.cjs.js +0 -1
  1067. package/postprocessing/RenderPixelatedPass.cjs.js +0 -1
  1068. package/postprocessing/SAOPass.cjs.js +0 -1
  1069. package/postprocessing/SMAAPass.cjs.js +0 -1
  1070. package/postprocessing/SSAARenderPass.cjs.js +0 -1
  1071. package/postprocessing/SSAOPass.cjs.js +0 -1
  1072. package/postprocessing/SSRPass.cjs.js +0 -1
  1073. package/postprocessing/SavePass.cjs.js +0 -1
  1074. package/postprocessing/ShaderPass.cjs.js +0 -1
  1075. package/postprocessing/TAARenderPass.cjs.js +0 -1
  1076. package/postprocessing/TexturePass.cjs.js +0 -1
  1077. package/postprocessing/UnrealBloomPass.cjs.js +0 -1
  1078. package/renderers/CSS2DRenderer.cjs.js +0 -1
  1079. package/renderers/CSS3DRenderer.cjs.js +0 -1
  1080. package/renderers/Projector.cjs.js +0 -1
  1081. package/renderers/SVGRenderer.cjs.js +0 -1
  1082. package/renderers/nodes/accessors/CameraNode.cjs.js +0 -1
  1083. package/renderers/nodes/accessors/ModelNode.cjs.js +0 -1
  1084. package/renderers/nodes/accessors/ModelViewProjectionNode.cjs.js +0 -1
  1085. package/renderers/nodes/accessors/NormalNode.cjs.js +0 -1
  1086. package/renderers/nodes/accessors/PositionNode.cjs.js +0 -1
  1087. package/renderers/nodes/accessors/UVNode.cjs.js +0 -1
  1088. package/renderers/nodes/core/AttributeNode.cjs.js +0 -1
  1089. package/renderers/nodes/core/InputNode.cjs.js +0 -1
  1090. package/renderers/nodes/core/Node.cjs.js +0 -1
  1091. package/renderers/nodes/core/NodeAttribute.cjs.js +0 -1
  1092. package/renderers/nodes/core/NodeBuilder.cjs.js +0 -1
  1093. package/renderers/nodes/core/NodeFrame.cjs.js +0 -1
  1094. package/renderers/nodes/core/NodeSlot.cjs.js +0 -1
  1095. package/renderers/nodes/core/NodeUniform.cjs.js +0 -1
  1096. package/renderers/nodes/core/NodeVary.cjs.js +0 -1
  1097. package/renderers/nodes/core/VaryNode.cjs.js +0 -1
  1098. package/renderers/nodes/core/constants.cjs.js +0 -1
  1099. package/renderers/nodes/inputs/ColorNode.cjs.js +0 -1
  1100. package/renderers/nodes/inputs/FloatNode.cjs.js +0 -1
  1101. package/renderers/nodes/inputs/Matrix3Node.cjs.js +0 -1
  1102. package/renderers/nodes/inputs/Matrix4Node.cjs.js +0 -1
  1103. package/renderers/nodes/inputs/TextureNode.cjs.js +0 -1
  1104. package/renderers/nodes/inputs/Vector2Node.cjs.js +0 -1
  1105. package/renderers/nodes/inputs/Vector3Node.cjs.js +0 -1
  1106. package/renderers/nodes/inputs/Vector4Node.cjs.js +0 -1
  1107. package/renderers/nodes/math/MathNode.cjs.js +0 -1
  1108. package/renderers/nodes/math/OperatorNode.cjs.js +0 -1
  1109. package/renderers/nodes/utils/SwitchNode.cjs.js +0 -1
  1110. package/renderers/nodes/utils/TimerNode.cjs.js +0 -1
  1111. package/renderers/webgpu/WebGPU.cjs.js +0 -1
  1112. package/renderers/webgpu/WebGPUAttributes.cjs.js +0 -1
  1113. package/renderers/webgpu/WebGPUBackground.cjs.js +0 -1
  1114. package/renderers/webgpu/WebGPUBinding.cjs.js +0 -1
  1115. package/renderers/webgpu/WebGPUBindings.cjs.js +0 -1
  1116. package/renderers/webgpu/WebGPUComputePipelines.cjs.js +0 -1
  1117. package/renderers/webgpu/WebGPUGeometries.cjs.js +0 -1
  1118. package/renderers/webgpu/WebGPUInfo.cjs.js +0 -1
  1119. package/renderers/webgpu/WebGPUObjects.cjs.js +0 -1
  1120. package/renderers/webgpu/WebGPUProperties.cjs.js +0 -1
  1121. package/renderers/webgpu/WebGPURenderLists.cjs.js +0 -1
  1122. package/renderers/webgpu/WebGPURenderPipelines.cjs.js +0 -1
  1123. package/renderers/webgpu/WebGPURenderer.cjs.js +0 -1
  1124. package/renderers/webgpu/WebGPUSampledTexture.cjs.js +0 -1
  1125. package/renderers/webgpu/WebGPUSampler.cjs.js +0 -1
  1126. package/renderers/webgpu/WebGPUStorageBuffer.cjs.js +0 -1
  1127. package/renderers/webgpu/WebGPUTextureRenderer.cjs.js +0 -1
  1128. package/renderers/webgpu/WebGPUTextureUtils.cjs.js +0 -1
  1129. package/renderers/webgpu/WebGPUTextures.cjs.js +0 -1
  1130. package/renderers/webgpu/WebGPUUniform.cjs.js +0 -1
  1131. package/renderers/webgpu/WebGPUUniformsGroup.cjs.js +0 -1
  1132. package/renderers/webgpu/constants.cjs.js +0 -1
  1133. package/renderers/webgpu/nodes/ShaderLib.cjs.js +0 -1
  1134. package/renderers/webgpu/nodes/WebGPUNodeBuilder.cjs.js +0 -1
  1135. package/renderers/webgpu/nodes/WebGPUNodeUniform.cjs.js +0 -1
  1136. package/renderers/webgpu/nodes/WebGPUNodeUniformsGroup.cjs.js +0 -1
  1137. package/renderers/webgpu/nodes/WebGPUNodes.cjs.js +0 -1
  1138. package/shaders/ACESFilmicToneMappingShader.cjs.js +0 -1
  1139. package/shaders/AfterimageShader.cjs.js +0 -1
  1140. package/shaders/BasicShader.cjs.js +0 -1
  1141. package/shaders/BleachBypassShader.cjs.js +0 -1
  1142. package/shaders/BlendShader.cjs.js +0 -1
  1143. package/shaders/BokehShader.cjs.js +0 -1
  1144. package/shaders/BokehShader2.cjs.js +0 -1
  1145. package/shaders/BrightnessContrastShader.cjs.js +0 -1
  1146. package/shaders/ColorCorrectionShader.cjs.js +0 -1
  1147. package/shaders/ColorifyShader.cjs.js +0 -1
  1148. package/shaders/ConvolutionShader.cjs.js +0 -1
  1149. package/shaders/CopyShader.cjs.js +0 -1
  1150. package/shaders/DOFMipMapShader.cjs.js +0 -1
  1151. package/shaders/DepthLimitedBlurShader.cjs.js +0 -1
  1152. package/shaders/DigitalGlitch.cjs.js +0 -1
  1153. package/shaders/DotScreenShader.cjs.js +0 -1
  1154. package/shaders/FXAAShader.cjs.js +0 -1
  1155. package/shaders/FilmShader.cjs.js +0 -1
  1156. package/shaders/FocusShader.cjs.js +0 -1
  1157. package/shaders/FreiChenShader.cjs.js +0 -1
  1158. package/shaders/FresnelShader.cjs.js +0 -1
  1159. package/shaders/GammaCorrectionShader.cjs.js +0 -1
  1160. package/shaders/GodRaysShader.cjs.js +0 -1
  1161. package/shaders/HalftoneShader.cjs.js +0 -1
  1162. package/shaders/HorizontalBlurShader.cjs.js +0 -1
  1163. package/shaders/HorizontalTiltShiftShader.cjs.js +0 -1
  1164. package/shaders/HueSaturationShader.cjs.js +0 -1
  1165. package/shaders/KaleidoShader.cjs.js +0 -1
  1166. package/shaders/LuminosityHighPassShader.cjs.js +0 -1
  1167. package/shaders/LuminosityShader.cjs.js +0 -1
  1168. package/shaders/MirrorShader.cjs.js +0 -1
  1169. package/shaders/NormalMapShader.cjs.js +0 -1
  1170. package/shaders/ParallaxShader.cjs.js +0 -1
  1171. package/shaders/PixelShader.cjs.js +0 -1
  1172. package/shaders/RGBShiftShader.cjs.js +0 -1
  1173. package/shaders/SAOShader.cjs.js +0 -1
  1174. package/shaders/SMAAShader.cjs.js +0 -1
  1175. package/shaders/SSAOShader.cjs.js +0 -1
  1176. package/shaders/SSRShader.cjs.js +0 -1
  1177. package/shaders/SepiaShader.cjs.js +0 -1
  1178. package/shaders/SobelOperatorShader.cjs.js +0 -1
  1179. package/shaders/SubsurfaceScatteringShader.cjs.js +0 -1
  1180. package/shaders/TechnicolorShader.cjs.js +0 -1
  1181. package/shaders/ToneMapShader.cjs.js +0 -1
  1182. package/shaders/ToonShader.cjs.js +0 -1
  1183. package/shaders/TriangleBlurShader.cjs.js +0 -1
  1184. package/shaders/UnpackDepthRGBAShader.cjs.js +0 -1
  1185. package/shaders/VerticalBlurShader.cjs.js +0 -1
  1186. package/shaders/VerticalTiltShiftShader.cjs.js +0 -1
  1187. package/shaders/VignetteShader.cjs.js +0 -1
  1188. package/shaders/VolumeShader.cjs.js +0 -1
  1189. package/shaders/WaterRefractionShader.cjs.js +0 -1
  1190. package/shaders/types.cjs.js +0 -1
  1191. package/textures/FlakesTexture.cjs.js +0 -1
  1192. package/types/helpers.cjs.js +0 -1
  1193. package/types/shared.cjs.js +0 -1
  1194. package/types/shared.js +0 -1
  1195. package/types/utils.cjs.js +0 -1
  1196. package/types/utils.js +0 -1
  1197. package/utils/BufferGeometryUtils.cjs.js +0 -1
  1198. package/utils/GeometryCompressionUtils.cjs.js +0 -1
  1199. package/utils/GeometryUtils.cjs.js +0 -1
  1200. package/utils/LDrawUtils.cjs.js +0 -1
  1201. package/utils/LDrawUtils.d.ts +0 -5
  1202. package/utils/LDrawUtils.js +0 -144
  1203. package/utils/RoughnessMipmapper.cjs.js +0 -1
  1204. package/utils/SceneUtils.cjs.js +0 -1
  1205. package/utils/ShadowMapViewer.cjs.js +0 -1
  1206. package/utils/SkeletonUtils.cjs.js +0 -1
  1207. package/utils/UVsDebug.cjs.js +0 -1
  1208. package/utils/WorkerPool.cjs.js +0 -1
  1209. package/webxr/ARButton.cjs.js +0 -1
  1210. package/webxr/OculusHandModel.cjs.js +0 -1
  1211. package/webxr/OculusHandPointerModel.cjs.js +0 -1
  1212. package/webxr/Text2D.cjs.js +0 -1
  1213. package/webxr/VRButton.cjs.js +0 -1
  1214. package/webxr/XRControllerModelFactory.cjs.js +0 -1
  1215. package/webxr/XREstimatedLight.cjs.js +0 -1
  1216. package/webxr/XRHandMeshModel.cjs.js +0 -1
  1217. package/webxr/XRHandModelFactory.cjs.js +0 -1
  1218. package/webxr/XRHandPrimitiveModel.cjs.js +0 -1
@@ -1,157 +1,146 @@
1
- import { Loader, LoaderUtils, FileLoader, Color, SpotLight, PointLight, DirectionalLight, MeshBasicMaterial, MeshPhysicalMaterial, Vector2, sRGBEncoding, TangentSpaceNormalMap, Quaternion, ImageBitmapLoader, TextureLoader, InterleavedBuffer, InterleavedBufferAttribute, BufferAttribute, LinearFilter, LinearMipmapLinearFilter, RepeatWrapping, PointsMaterial, Material, LineBasicMaterial, MeshStandardMaterial, DoubleSide, PropertyBinding, BufferGeometry, SkinnedMesh, Mesh, LineSegments, Line, LineLoop, Points, Group, PerspectiveCamera, MathUtils, OrthographicCamera, InterpolateLinear, AnimationClip, Bone, Object3D, Matrix4, Skeleton, TriangleFanDrawMode, NearestFilter, NearestMipmapNearestFilter, LinearMipmapNearestFilter, NearestMipmapLinearFilter, ClampToEdgeWrapping, MirroredRepeatWrapping, InterpolateDiscrete, FrontSide, Texture, TriangleStripDrawMode, VectorKeyframeTrack, QuaternionKeyframeTrack, NumberKeyframeTrack, Box3, Vector3, Sphere, Interpolant } from 'three';
2
-
3
- class GLTFLoader extends Loader {
1
+ "use strict";
2
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
+ const THREE = require("three");
4
+ class GLTFLoader extends THREE.Loader {
4
5
  constructor(manager) {
5
6
  super(manager);
6
7
  this.dracoLoader = null;
7
8
  this.ktx2Loader = null;
8
9
  this.meshoptDecoder = null;
9
10
  this.pluginCallbacks = [];
10
- this.register(function (parser) {
11
+ this.register(function(parser) {
11
12
  return new GLTFMaterialsClearcoatExtension(parser);
12
13
  });
13
- this.register(function (parser) {
14
+ this.register(function(parser) {
14
15
  return new GLTFTextureBasisUExtension(parser);
15
16
  });
16
- this.register(function (parser) {
17
+ this.register(function(parser) {
17
18
  return new GLTFTextureWebPExtension(parser);
18
19
  });
19
- this.register(function (parser) {
20
+ this.register(function(parser) {
20
21
  return new GLTFMaterialsSheenExtension(parser);
21
22
  });
22
- this.register(function (parser) {
23
+ this.register(function(parser) {
23
24
  return new GLTFMaterialsTransmissionExtension(parser);
24
25
  });
25
- this.register(function (parser) {
26
+ this.register(function(parser) {
26
27
  return new GLTFMaterialsVolumeExtension(parser);
27
28
  });
28
- this.register(function (parser) {
29
+ this.register(function(parser) {
29
30
  return new GLTFMaterialsIorExtension(parser);
30
31
  });
31
- this.register(function (parser) {
32
+ this.register(function(parser) {
32
33
  return new GLTFMaterialsSpecularExtension(parser);
33
34
  });
34
- this.register(function (parser) {
35
+ this.register(function(parser) {
35
36
  return new GLTFLightsExtension(parser);
36
37
  });
37
- this.register(function (parser) {
38
+ this.register(function(parser) {
38
39
  return new GLTFMeshoptCompression(parser);
39
40
  });
40
41
  }
41
-
42
42
  load(url, onLoad, onProgress, onError) {
43
43
  const scope = this;
44
44
  let resourcePath;
45
-
46
- if (this.resourcePath !== '') {
45
+ if (this.resourcePath !== "") {
47
46
  resourcePath = this.resourcePath;
48
- } else if (this.path !== '') {
47
+ } else if (this.path !== "") {
49
48
  resourcePath = this.path;
50
49
  } else {
51
- resourcePath = LoaderUtils.extractUrlBase(url);
52
- } // Tells the LoadingManager to track an extra item, which resolves after
53
- // the model is fully loaded. This means the count of items loaded will
54
- // be incorrect, but ensures manager.onLoad() does not fire early.
55
-
56
-
50
+ resourcePath = THREE.LoaderUtils.extractUrlBase(url);
51
+ }
57
52
  this.manager.itemStart(url);
58
-
59
- const _onError = function (e) {
53
+ const _onError = function(e) {
60
54
  if (onError) {
61
55
  onError(e);
62
56
  } else {
63
57
  console.error(e);
64
58
  }
65
-
66
59
  scope.manager.itemError(url);
67
60
  scope.manager.itemEnd(url);
68
61
  };
69
-
70
- const loader = new FileLoader(this.manager);
62
+ const loader = new THREE.FileLoader(this.manager);
71
63
  loader.setPath(this.path);
72
- loader.setResponseType('arraybuffer');
64
+ loader.setResponseType("arraybuffer");
73
65
  loader.setRequestHeader(this.requestHeader);
74
66
  loader.setWithCredentials(this.withCredentials);
75
- loader.load(url, function (data) {
76
- try {
77
- scope.parse(data, resourcePath, function (gltf) {
78
- onLoad(gltf);
79
- scope.manager.itemEnd(url);
80
- }, _onError);
81
- } catch (e) {
82
- _onError(e);
83
- }
84
- }, onProgress, _onError);
67
+ loader.load(
68
+ url,
69
+ function(data) {
70
+ try {
71
+ scope.parse(
72
+ data,
73
+ resourcePath,
74
+ function(gltf) {
75
+ onLoad(gltf);
76
+ scope.manager.itemEnd(url);
77
+ },
78
+ _onError
79
+ );
80
+ } catch (e) {
81
+ _onError(e);
82
+ }
83
+ },
84
+ onProgress,
85
+ _onError
86
+ );
85
87
  }
86
-
87
88
  setDRACOLoader(dracoLoader) {
88
89
  this.dracoLoader = dracoLoader;
89
90
  return this;
90
91
  }
91
-
92
92
  setDDSLoader() {
93
93
  throw new Error('THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".');
94
94
  }
95
-
96
95
  setKTX2Loader(ktx2Loader) {
97
96
  this.ktx2Loader = ktx2Loader;
98
97
  return this;
99
98
  }
100
-
101
99
  setMeshoptDecoder(meshoptDecoder) {
102
100
  this.meshoptDecoder = meshoptDecoder;
103
101
  return this;
104
102
  }
105
-
106
103
  register(callback) {
107
104
  if (this.pluginCallbacks.indexOf(callback) === -1) {
108
105
  this.pluginCallbacks.push(callback);
109
106
  }
110
-
111
107
  return this;
112
108
  }
113
-
114
109
  unregister(callback) {
115
110
  if (this.pluginCallbacks.indexOf(callback) !== -1) {
116
111
  this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(callback), 1);
117
112
  }
118
-
119
113
  return this;
120
114
  }
121
-
122
115
  parse(data, path, onLoad, onError) {
123
116
  let content;
124
117
  const extensions = {};
125
118
  const plugins = {};
126
-
127
- if (typeof data === 'string') {
119
+ if (typeof data === "string") {
128
120
  content = data;
129
121
  } else {
130
- const magic = LoaderUtils.decodeText(new Uint8Array(data, 0, 4));
131
-
122
+ const magic = THREE.LoaderUtils.decodeText(new Uint8Array(data, 0, 4));
132
123
  if (magic === BINARY_EXTENSION_HEADER_MAGIC) {
133
124
  try {
134
125
  extensions[EXTENSIONS.KHR_BINARY_GLTF] = new GLTFBinaryExtension(data);
135
126
  } catch (error) {
136
- if (onError) onError(error);
127
+ if (onError)
128
+ onError(error);
137
129
  return;
138
130
  }
139
-
140
131
  content = extensions[EXTENSIONS.KHR_BINARY_GLTF].content;
141
132
  } else {
142
- content = LoaderUtils.decodeText(new Uint8Array(data));
133
+ content = THREE.LoaderUtils.decodeText(new Uint8Array(data));
143
134
  }
144
135
  }
145
-
146
136
  const json = JSON.parse(content);
147
-
148
- if (json.asset === undefined || json.asset.version[0] < 2) {
149
- if (onError) onError(new Error('THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported.'));
137
+ if (json.asset === void 0 || json.asset.version[0] < 2) {
138
+ if (onError)
139
+ onError(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));
150
140
  return;
151
141
  }
152
-
153
142
  const parser = new GLTFParser(json, {
154
- path: path || this.resourcePath || '',
143
+ path: path || this.resourcePath || "",
155
144
  crossOrigin: this.crossOrigin,
156
145
  requestHeader: this.requestHeader,
157
146
  manager: this.manager,
@@ -159,664 +148,474 @@ class GLTFLoader extends Loader {
159
148
  meshoptDecoder: this.meshoptDecoder
160
149
  });
161
150
  parser.fileLoader.setRequestHeader(this.requestHeader);
162
-
163
151
  for (let i = 0; i < this.pluginCallbacks.length; i++) {
164
152
  const plugin = this.pluginCallbacks[i](parser);
165
- plugins[plugin.name] = plugin; // Workaround to avoid determining as unknown extension
166
- // in addUnknownExtensionsToUserData().
167
- // Remove this workaround if we move all the existing
168
- // extension handlers to plugin system
169
-
153
+ plugins[plugin.name] = plugin;
170
154
  extensions[plugin.name] = true;
171
155
  }
172
-
173
156
  if (json.extensionsUsed) {
174
157
  for (let i = 0; i < json.extensionsUsed.length; ++i) {
175
158
  const extensionName = json.extensionsUsed[i];
176
159
  const extensionsRequired = json.extensionsRequired || [];
177
-
178
160
  switch (extensionName) {
179
161
  case EXTENSIONS.KHR_MATERIALS_UNLIT:
180
162
  extensions[extensionName] = new GLTFMaterialsUnlitExtension();
181
163
  break;
182
-
183
164
  case EXTENSIONS.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:
184
165
  extensions[extensionName] = new GLTFMaterialsPbrSpecularGlossinessExtension();
185
166
  break;
186
-
187
167
  case EXTENSIONS.KHR_DRACO_MESH_COMPRESSION:
188
168
  extensions[extensionName] = new GLTFDracoMeshCompressionExtension(json, this.dracoLoader);
189
169
  break;
190
-
191
170
  case EXTENSIONS.KHR_TEXTURE_TRANSFORM:
192
171
  extensions[extensionName] = new GLTFTextureTransformExtension();
193
172
  break;
194
-
195
173
  case EXTENSIONS.KHR_MESH_QUANTIZATION:
196
174
  extensions[extensionName] = new GLTFMeshQuantizationExtension();
197
175
  break;
198
-
199
176
  default:
200
- if (extensionsRequired.indexOf(extensionName) >= 0 && plugins[extensionName] === undefined) {
177
+ if (extensionsRequired.indexOf(extensionName) >= 0 && plugins[extensionName] === void 0) {
201
178
  console.warn('THREE.GLTFLoader: Unknown extension "' + extensionName + '".');
202
179
  }
203
-
204
180
  }
205
181
  }
206
182
  }
207
-
208
183
  parser.setExtensions(extensions);
209
184
  parser.setPlugins(plugins);
210
185
  parser.parse(onLoad, onError);
211
186
  }
212
-
213
187
  parseAsync(data, path) {
214
188
  const scope = this;
215
- return new Promise(function (resolve, reject) {
189
+ return new Promise(function(resolve, reject) {
216
190
  scope.parse(data, path, resolve, reject);
217
191
  });
218
192
  }
219
-
220
193
  }
221
- /* GLTFREGISTRY */
222
-
223
-
224
194
  function GLTFRegistry() {
225
195
  let objects = {};
226
196
  return {
227
- get: function (key) {
197
+ get: function(key) {
228
198
  return objects[key];
229
199
  },
230
- add: function (key, object) {
200
+ add: function(key, object) {
231
201
  objects[key] = object;
232
202
  },
233
- remove: function (key) {
203
+ remove: function(key) {
234
204
  delete objects[key];
235
205
  },
236
- removeAll: function () {
206
+ removeAll: function() {
237
207
  objects = {};
238
208
  }
239
209
  };
240
210
  }
241
- /*********************************/
242
-
243
- /********** EXTENSIONS ***********/
244
-
245
- /*********************************/
246
-
247
-
248
211
  const EXTENSIONS = {
249
- KHR_BINARY_GLTF: 'KHR_binary_glTF',
250
- KHR_DRACO_MESH_COMPRESSION: 'KHR_draco_mesh_compression',
251
- KHR_LIGHTS_PUNCTUAL: 'KHR_lights_punctual',
252
- KHR_MATERIALS_CLEARCOAT: 'KHR_materials_clearcoat',
253
- KHR_MATERIALS_IOR: 'KHR_materials_ior',
254
- KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS: 'KHR_materials_pbrSpecularGlossiness',
255
- KHR_MATERIALS_SHEEN: 'KHR_materials_sheen',
256
- KHR_MATERIALS_SPECULAR: 'KHR_materials_specular',
257
- KHR_MATERIALS_TRANSMISSION: 'KHR_materials_transmission',
258
- KHR_MATERIALS_UNLIT: 'KHR_materials_unlit',
259
- KHR_MATERIALS_VOLUME: 'KHR_materials_volume',
260
- KHR_TEXTURE_BASISU: 'KHR_texture_basisu',
261
- KHR_TEXTURE_TRANSFORM: 'KHR_texture_transform',
262
- KHR_MESH_QUANTIZATION: 'KHR_mesh_quantization',
263
- EXT_TEXTURE_WEBP: 'EXT_texture_webp',
264
- EXT_MESHOPT_COMPRESSION: 'EXT_meshopt_compression'
212
+ KHR_BINARY_GLTF: "KHR_binary_glTF",
213
+ KHR_DRACO_MESH_COMPRESSION: "KHR_draco_mesh_compression",
214
+ KHR_LIGHTS_PUNCTUAL: "KHR_lights_punctual",
215
+ KHR_MATERIALS_CLEARCOAT: "KHR_materials_clearcoat",
216
+ KHR_MATERIALS_IOR: "KHR_materials_ior",
217
+ KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS: "KHR_materials_pbrSpecularGlossiness",
218
+ KHR_MATERIALS_SHEEN: "KHR_materials_sheen",
219
+ KHR_MATERIALS_SPECULAR: "KHR_materials_specular",
220
+ KHR_MATERIALS_TRANSMISSION: "KHR_materials_transmission",
221
+ KHR_MATERIALS_UNLIT: "KHR_materials_unlit",
222
+ KHR_MATERIALS_VOLUME: "KHR_materials_volume",
223
+ KHR_TEXTURE_BASISU: "KHR_texture_basisu",
224
+ KHR_TEXTURE_TRANSFORM: "KHR_texture_transform",
225
+ KHR_MESH_QUANTIZATION: "KHR_mesh_quantization",
226
+ EXT_TEXTURE_WEBP: "EXT_texture_webp",
227
+ EXT_MESHOPT_COMPRESSION: "EXT_meshopt_compression"
265
228
  };
266
- /**
267
- * Punctual Lights Extension
268
- *
269
- * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_lights_punctual
270
- */
271
-
272
229
  class GLTFLightsExtension {
273
230
  constructor(parser) {
274
231
  this.parser = parser;
275
- this.name = EXTENSIONS.KHR_LIGHTS_PUNCTUAL; // Object3D instance caches
276
-
277
- this.cache = {
278
- refs: {},
279
- uses: {}
280
- };
232
+ this.name = EXTENSIONS.KHR_LIGHTS_PUNCTUAL;
233
+ this.cache = { refs: {}, uses: {} };
281
234
  }
282
-
283
235
  _markDefs() {
284
236
  const parser = this.parser;
285
237
  const nodeDefs = this.parser.json.nodes || [];
286
-
287
238
  for (let nodeIndex = 0, nodeLength = nodeDefs.length; nodeIndex < nodeLength; nodeIndex++) {
288
239
  const nodeDef = nodeDefs[nodeIndex];
289
-
290
- if (nodeDef.extensions && nodeDef.extensions[this.name] && nodeDef.extensions[this.name].light !== undefined) {
240
+ if (nodeDef.extensions && nodeDef.extensions[this.name] && nodeDef.extensions[this.name].light !== void 0) {
291
241
  parser._addNodeRef(this.cache, nodeDef.extensions[this.name].light);
292
242
  }
293
243
  }
294
244
  }
295
-
296
245
  _loadLight(lightIndex) {
297
246
  const parser = this.parser;
298
- const cacheKey = 'light:' + lightIndex;
247
+ const cacheKey = "light:" + lightIndex;
299
248
  let dependency = parser.cache.get(cacheKey);
300
- if (dependency) return dependency;
249
+ if (dependency)
250
+ return dependency;
301
251
  const json = parser.json;
302
252
  const extensions = json.extensions && json.extensions[this.name] || {};
303
253
  const lightDefs = extensions.lights || [];
304
254
  const lightDef = lightDefs[lightIndex];
305
255
  let lightNode;
306
- const color = new Color(0xffffff);
307
- if (lightDef.color !== undefined) color.fromArray(lightDef.color);
308
- const range = lightDef.range !== undefined ? lightDef.range : 0;
309
-
256
+ const color = new THREE.Color(16777215);
257
+ if (lightDef.color !== void 0)
258
+ color.fromArray(lightDef.color);
259
+ const range = lightDef.range !== void 0 ? lightDef.range : 0;
310
260
  switch (lightDef.type) {
311
- case 'directional':
312
- lightNode = new DirectionalLight(color);
261
+ case "directional":
262
+ lightNode = new THREE.DirectionalLight(color);
313
263
  lightNode.target.position.set(0, 0, -1);
314
264
  lightNode.add(lightNode.target);
315
265
  break;
316
-
317
- case 'point':
318
- lightNode = new PointLight(color);
266
+ case "point":
267
+ lightNode = new THREE.PointLight(color);
319
268
  lightNode.distance = range;
320
269
  break;
321
-
322
- case 'spot':
323
- lightNode = new SpotLight(color);
324
- lightNode.distance = range; // Handle spotlight properties.
325
-
270
+ case "spot":
271
+ lightNode = new THREE.SpotLight(color);
272
+ lightNode.distance = range;
326
273
  lightDef.spot = lightDef.spot || {};
327
- lightDef.spot.innerConeAngle = lightDef.spot.innerConeAngle !== undefined ? lightDef.spot.innerConeAngle : 0;
328
- lightDef.spot.outerConeAngle = lightDef.spot.outerConeAngle !== undefined ? lightDef.spot.outerConeAngle : Math.PI / 4.0;
274
+ lightDef.spot.innerConeAngle = lightDef.spot.innerConeAngle !== void 0 ? lightDef.spot.innerConeAngle : 0;
275
+ lightDef.spot.outerConeAngle = lightDef.spot.outerConeAngle !== void 0 ? lightDef.spot.outerConeAngle : Math.PI / 4;
329
276
  lightNode.angle = lightDef.spot.outerConeAngle;
330
- lightNode.penumbra = 1.0 - lightDef.spot.innerConeAngle / lightDef.spot.outerConeAngle;
277
+ lightNode.penumbra = 1 - lightDef.spot.innerConeAngle / lightDef.spot.outerConeAngle;
331
278
  lightNode.target.position.set(0, 0, -1);
332
279
  lightNode.add(lightNode.target);
333
280
  break;
334
-
335
281
  default:
336
- throw new Error('THREE.GLTFLoader: Unexpected light type: ' + lightDef.type);
337
- } // Some lights (e.g. spot) default to a position other than the origin. Reset the position
338
- // here, because node-level parsing will only override position if explicitly specified.
339
-
340
-
282
+ throw new Error("THREE.GLTFLoader: Unexpected light type: " + lightDef.type);
283
+ }
341
284
  lightNode.position.set(0, 0, 0);
342
285
  lightNode.decay = 2;
343
- if (lightDef.intensity !== undefined) lightNode.intensity = lightDef.intensity;
344
- lightNode.name = parser.createUniqueName(lightDef.name || 'light_' + lightIndex);
286
+ if (lightDef.intensity !== void 0)
287
+ lightNode.intensity = lightDef.intensity;
288
+ lightNode.name = parser.createUniqueName(lightDef.name || "light_" + lightIndex);
345
289
  dependency = Promise.resolve(lightNode);
346
290
  parser.cache.add(cacheKey, dependency);
347
291
  return dependency;
348
292
  }
349
-
350
293
  createNodeAttachment(nodeIndex) {
351
- const self = this;
294
+ const self2 = this;
352
295
  const parser = this.parser;
353
296
  const json = parser.json;
354
297
  const nodeDef = json.nodes[nodeIndex];
355
298
  const lightDef = nodeDef.extensions && nodeDef.extensions[this.name] || {};
356
299
  const lightIndex = lightDef.light;
357
- if (lightIndex === undefined) return null;
358
- return this._loadLight(lightIndex).then(function (light) {
359
- return parser._getNodeRef(self.cache, lightIndex, light);
300
+ if (lightIndex === void 0)
301
+ return null;
302
+ return this._loadLight(lightIndex).then(function(light) {
303
+ return parser._getNodeRef(self2.cache, lightIndex, light);
360
304
  });
361
305
  }
362
-
363
306
  }
364
- /**
365
- * Unlit Materials Extension
366
- *
367
- * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_unlit
368
- */
369
-
370
-
371
307
  class GLTFMaterialsUnlitExtension {
372
308
  constructor() {
373
309
  this.name = EXTENSIONS.KHR_MATERIALS_UNLIT;
374
310
  }
375
-
376
311
  getMaterialType() {
377
- return MeshBasicMaterial;
312
+ return THREE.MeshBasicMaterial;
378
313
  }
379
-
380
314
  extendParams(materialParams, materialDef, parser) {
381
315
  const pending = [];
382
- materialParams.color = new Color(1.0, 1.0, 1.0);
383
- materialParams.opacity = 1.0;
316
+ materialParams.color = new THREE.Color(1, 1, 1);
317
+ materialParams.opacity = 1;
384
318
  const metallicRoughness = materialDef.pbrMetallicRoughness;
385
-
386
319
  if (metallicRoughness) {
387
320
  if (Array.isArray(metallicRoughness.baseColorFactor)) {
388
321
  const array = metallicRoughness.baseColorFactor;
389
322
  materialParams.color.fromArray(array);
390
323
  materialParams.opacity = array[3];
391
324
  }
392
-
393
- if (metallicRoughness.baseColorTexture !== undefined) {
394
- pending.push(parser.assignTexture(materialParams, 'map', metallicRoughness.baseColorTexture));
325
+ if (metallicRoughness.baseColorTexture !== void 0) {
326
+ pending.push(parser.assignTexture(materialParams, "map", metallicRoughness.baseColorTexture));
395
327
  }
396
328
  }
397
-
398
329
  return Promise.all(pending);
399
330
  }
400
-
401
331
  }
402
- /**
403
- * Clearcoat Materials Extension
404
- *
405
- * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_clearcoat
406
- */
407
-
408
-
409
332
  class GLTFMaterialsClearcoatExtension {
410
333
  constructor(parser) {
411
334
  this.parser = parser;
412
335
  this.name = EXTENSIONS.KHR_MATERIALS_CLEARCOAT;
413
336
  }
414
-
415
337
  getMaterialType(materialIndex) {
416
338
  const parser = this.parser;
417
339
  const materialDef = parser.json.materials[materialIndex];
418
- if (!materialDef.extensions || !materialDef.extensions[this.name]) return null;
419
- return MeshPhysicalMaterial;
340
+ if (!materialDef.extensions || !materialDef.extensions[this.name])
341
+ return null;
342
+ return THREE.MeshPhysicalMaterial;
420
343
  }
421
-
422
344
  extendMaterialParams(materialIndex, materialParams) {
423
345
  const parser = this.parser;
424
346
  const materialDef = parser.json.materials[materialIndex];
425
-
426
347
  if (!materialDef.extensions || !materialDef.extensions[this.name]) {
427
348
  return Promise.resolve();
428
349
  }
429
-
430
350
  const pending = [];
431
351
  const extension = materialDef.extensions[this.name];
432
-
433
- if (extension.clearcoatFactor !== undefined) {
352
+ if (extension.clearcoatFactor !== void 0) {
434
353
  materialParams.clearcoat = extension.clearcoatFactor;
435
354
  }
436
-
437
- if (extension.clearcoatTexture !== undefined) {
438
- pending.push(parser.assignTexture(materialParams, 'clearcoatMap', extension.clearcoatTexture));
355
+ if (extension.clearcoatTexture !== void 0) {
356
+ pending.push(parser.assignTexture(materialParams, "clearcoatMap", extension.clearcoatTexture));
439
357
  }
440
-
441
- if (extension.clearcoatRoughnessFactor !== undefined) {
358
+ if (extension.clearcoatRoughnessFactor !== void 0) {
442
359
  materialParams.clearcoatRoughness = extension.clearcoatRoughnessFactor;
443
360
  }
444
-
445
- if (extension.clearcoatRoughnessTexture !== undefined) {
446
- pending.push(parser.assignTexture(materialParams, 'clearcoatRoughnessMap', extension.clearcoatRoughnessTexture));
361
+ if (extension.clearcoatRoughnessTexture !== void 0) {
362
+ pending.push(parser.assignTexture(materialParams, "clearcoatRoughnessMap", extension.clearcoatRoughnessTexture));
447
363
  }
448
-
449
- if (extension.clearcoatNormalTexture !== undefined) {
450
- pending.push(parser.assignTexture(materialParams, 'clearcoatNormalMap', extension.clearcoatNormalTexture));
451
-
452
- if (extension.clearcoatNormalTexture.scale !== undefined) {
364
+ if (extension.clearcoatNormalTexture !== void 0) {
365
+ pending.push(parser.assignTexture(materialParams, "clearcoatNormalMap", extension.clearcoatNormalTexture));
366
+ if (extension.clearcoatNormalTexture.scale !== void 0) {
453
367
  const scale = extension.clearcoatNormalTexture.scale;
454
- materialParams.clearcoatNormalScale = new Vector2(scale, scale);
368
+ materialParams.clearcoatNormalScale = new THREE.Vector2(scale, scale);
455
369
  }
456
370
  }
457
-
458
371
  return Promise.all(pending);
459
372
  }
460
-
461
373
  }
462
- /**
463
- * Sheen Materials Extension
464
- *
465
- * Specification: https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Khronos/KHR_materials_sheen
466
- */
467
-
468
-
469
374
  class GLTFMaterialsSheenExtension {
470
375
  constructor(parser) {
471
376
  this.parser = parser;
472
377
  this.name = EXTENSIONS.KHR_MATERIALS_SHEEN;
473
378
  }
474
-
475
379
  getMaterialType(materialIndex) {
476
380
  const parser = this.parser;
477
381
  const materialDef = parser.json.materials[materialIndex];
478
- if (!materialDef.extensions || !materialDef.extensions[this.name]) return null;
479
- return MeshPhysicalMaterial;
382
+ if (!materialDef.extensions || !materialDef.extensions[this.name])
383
+ return null;
384
+ return THREE.MeshPhysicalMaterial;
480
385
  }
481
-
482
386
  extendMaterialParams(materialIndex, materialParams) {
483
387
  const parser = this.parser;
484
388
  const materialDef = parser.json.materials[materialIndex];
485
-
486
389
  if (!materialDef.extensions || !materialDef.extensions[this.name]) {
487
390
  return Promise.resolve();
488
391
  }
489
-
490
392
  const pending = [];
491
- materialParams.sheenColor = new Color(0, 0, 0);
393
+ materialParams.sheenColor = new THREE.Color(0, 0, 0);
492
394
  materialParams.sheenRoughness = 0;
493
395
  materialParams.sheen = 1;
494
396
  const extension = materialDef.extensions[this.name];
495
-
496
- if (extension.sheenColorFactor !== undefined) {
397
+ if (extension.sheenColorFactor !== void 0) {
497
398
  materialParams.sheenColor.fromArray(extension.sheenColorFactor);
498
399
  }
499
-
500
- if (extension.sheenRoughnessFactor !== undefined) {
400
+ if (extension.sheenRoughnessFactor !== void 0) {
501
401
  materialParams.sheenRoughness = extension.sheenRoughnessFactor;
502
402
  }
503
-
504
- if (extension.sheenColorTexture !== undefined) {
505
- pending.push(parser.assignTexture(materialParams, 'sheenColorMap', extension.sheenColorTexture));
403
+ if (extension.sheenColorTexture !== void 0) {
404
+ pending.push(parser.assignTexture(materialParams, "sheenColorMap", extension.sheenColorTexture));
506
405
  }
507
-
508
- if (extension.sheenRoughnessTexture !== undefined) {
509
- pending.push(parser.assignTexture(materialParams, 'sheenRoughnessMap', extension.sheenRoughnessTexture));
406
+ if (extension.sheenRoughnessTexture !== void 0) {
407
+ pending.push(parser.assignTexture(materialParams, "sheenRoughnessMap", extension.sheenRoughnessTexture));
510
408
  }
511
-
512
409
  return Promise.all(pending);
513
410
  }
514
-
515
411
  }
516
- /**
517
- * Transmission Materials Extension
518
- *
519
- * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_transmission
520
- * Draft: https://github.com/KhronosGroup/glTF/pull/1698
521
- */
522
-
523
-
524
412
  class GLTFMaterialsTransmissionExtension {
525
413
  constructor(parser) {
526
414
  this.parser = parser;
527
415
  this.name = EXTENSIONS.KHR_MATERIALS_TRANSMISSION;
528
416
  }
529
-
530
417
  getMaterialType(materialIndex) {
531
418
  const parser = this.parser;
532
419
  const materialDef = parser.json.materials[materialIndex];
533
- if (!materialDef.extensions || !materialDef.extensions[this.name]) return null;
534
- return MeshPhysicalMaterial;
420
+ if (!materialDef.extensions || !materialDef.extensions[this.name])
421
+ return null;
422
+ return THREE.MeshPhysicalMaterial;
535
423
  }
536
-
537
424
  extendMaterialParams(materialIndex, materialParams) {
538
425
  const parser = this.parser;
539
426
  const materialDef = parser.json.materials[materialIndex];
540
-
541
427
  if (!materialDef.extensions || !materialDef.extensions[this.name]) {
542
428
  return Promise.resolve();
543
429
  }
544
-
545
430
  const pending = [];
546
431
  const extension = materialDef.extensions[this.name];
547
-
548
- if (extension.transmissionFactor !== undefined) {
432
+ if (extension.transmissionFactor !== void 0) {
549
433
  materialParams.transmission = extension.transmissionFactor;
550
434
  }
551
-
552
- if (extension.transmissionTexture !== undefined) {
553
- pending.push(parser.assignTexture(materialParams, 'transmissionMap', extension.transmissionTexture));
435
+ if (extension.transmissionTexture !== void 0) {
436
+ pending.push(parser.assignTexture(materialParams, "transmissionMap", extension.transmissionTexture));
554
437
  }
555
-
556
438
  return Promise.all(pending);
557
439
  }
558
-
559
440
  }
560
- /**
561
- * Materials Volume Extension
562
- *
563
- * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_volume
564
- */
565
-
566
-
567
441
  class GLTFMaterialsVolumeExtension {
568
442
  constructor(parser) {
569
443
  this.parser = parser;
570
444
  this.name = EXTENSIONS.KHR_MATERIALS_VOLUME;
571
445
  }
572
-
573
446
  getMaterialType(materialIndex) {
574
447
  const parser = this.parser;
575
448
  const materialDef = parser.json.materials[materialIndex];
576
- if (!materialDef.extensions || !materialDef.extensions[this.name]) return null;
577
- return MeshPhysicalMaterial;
449
+ if (!materialDef.extensions || !materialDef.extensions[this.name])
450
+ return null;
451
+ return THREE.MeshPhysicalMaterial;
578
452
  }
579
-
580
453
  extendMaterialParams(materialIndex, materialParams) {
581
454
  const parser = this.parser;
582
455
  const materialDef = parser.json.materials[materialIndex];
583
-
584
456
  if (!materialDef.extensions || !materialDef.extensions[this.name]) {
585
457
  return Promise.resolve();
586
458
  }
587
-
588
459
  const pending = [];
589
460
  const extension = materialDef.extensions[this.name];
590
- materialParams.thickness = extension.thicknessFactor !== undefined ? extension.thicknessFactor : 0;
591
-
592
- if (extension.thicknessTexture !== undefined) {
593
- pending.push(parser.assignTexture(materialParams, 'thicknessMap', extension.thicknessTexture));
461
+ materialParams.thickness = extension.thicknessFactor !== void 0 ? extension.thicknessFactor : 0;
462
+ if (extension.thicknessTexture !== void 0) {
463
+ pending.push(parser.assignTexture(materialParams, "thicknessMap", extension.thicknessTexture));
594
464
  }
595
-
596
465
  materialParams.attenuationDistance = extension.attenuationDistance || 0;
597
466
  const colorArray = extension.attenuationColor || [1, 1, 1];
598
- materialParams.attenuationColor = new Color(colorArray[0], colorArray[1], colorArray[2]);
467
+ materialParams.attenuationColor = new THREE.Color(colorArray[0], colorArray[1], colorArray[2]);
599
468
  return Promise.all(pending);
600
469
  }
601
-
602
470
  }
603
- /**
604
- * Materials ior Extension
605
- *
606
- * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_ior
607
- */
608
-
609
-
610
471
  class GLTFMaterialsIorExtension {
611
472
  constructor(parser) {
612
473
  this.parser = parser;
613
474
  this.name = EXTENSIONS.KHR_MATERIALS_IOR;
614
475
  }
615
-
616
476
  getMaterialType(materialIndex) {
617
477
  const parser = this.parser;
618
478
  const materialDef = parser.json.materials[materialIndex];
619
- if (!materialDef.extensions || !materialDef.extensions[this.name]) return null;
620
- return MeshPhysicalMaterial;
479
+ if (!materialDef.extensions || !materialDef.extensions[this.name])
480
+ return null;
481
+ return THREE.MeshPhysicalMaterial;
621
482
  }
622
-
623
483
  extendMaterialParams(materialIndex, materialParams) {
624
484
  const parser = this.parser;
625
485
  const materialDef = parser.json.materials[materialIndex];
626
-
627
486
  if (!materialDef.extensions || !materialDef.extensions[this.name]) {
628
487
  return Promise.resolve();
629
488
  }
630
-
631
489
  const extension = materialDef.extensions[this.name];
632
- materialParams.ior = extension.ior !== undefined ? extension.ior : 1.5;
490
+ materialParams.ior = extension.ior !== void 0 ? extension.ior : 1.5;
633
491
  return Promise.resolve();
634
492
  }
635
-
636
493
  }
637
- /**
638
- * Materials specular Extension
639
- *
640
- * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_specular
641
- */
642
-
643
-
644
494
  class GLTFMaterialsSpecularExtension {
645
495
  constructor(parser) {
646
496
  this.parser = parser;
647
497
  this.name = EXTENSIONS.KHR_MATERIALS_SPECULAR;
648
498
  }
649
-
650
499
  getMaterialType(materialIndex) {
651
500
  const parser = this.parser;
652
501
  const materialDef = parser.json.materials[materialIndex];
653
- if (!materialDef.extensions || !materialDef.extensions[this.name]) return null;
654
- return MeshPhysicalMaterial;
502
+ if (!materialDef.extensions || !materialDef.extensions[this.name])
503
+ return null;
504
+ return THREE.MeshPhysicalMaterial;
655
505
  }
656
-
657
506
  extendMaterialParams(materialIndex, materialParams) {
658
507
  const parser = this.parser;
659
508
  const materialDef = parser.json.materials[materialIndex];
660
-
661
509
  if (!materialDef.extensions || !materialDef.extensions[this.name]) {
662
510
  return Promise.resolve();
663
511
  }
664
-
665
512
  const pending = [];
666
513
  const extension = materialDef.extensions[this.name];
667
- materialParams.specularIntensity = extension.specularFactor !== undefined ? extension.specularFactor : 1.0;
668
-
669
- if (extension.specularTexture !== undefined) {
670
- pending.push(parser.assignTexture(materialParams, 'specularIntensityMap', extension.specularTexture));
514
+ materialParams.specularIntensity = extension.specularFactor !== void 0 ? extension.specularFactor : 1;
515
+ if (extension.specularTexture !== void 0) {
516
+ pending.push(parser.assignTexture(materialParams, "specularIntensityMap", extension.specularTexture));
671
517
  }
672
-
673
518
  const colorArray = extension.specularColorFactor || [1, 1, 1];
674
- materialParams.specularColor = new Color(colorArray[0], colorArray[1], colorArray[2]);
675
-
676
- if (extension.specularColorTexture !== undefined) {
677
- pending.push(parser.assignTexture(materialParams, 'specularColorMap', extension.specularColorTexture).then(function (texture) {
678
- texture.encoding = sRGBEncoding;
679
- }));
680
- }
681
-
519
+ materialParams.specularColor = new THREE.Color(colorArray[0], colorArray[1], colorArray[2]);
520
+ if (extension.specularColorTexture !== void 0) {
521
+ pending.push(
522
+ parser.assignTexture(materialParams, "specularColorMap", extension.specularColorTexture).then(function(texture) {
523
+ texture.encoding = THREE.sRGBEncoding;
524
+ })
525
+ );
526
+ }
682
527
  return Promise.all(pending);
683
528
  }
684
-
685
529
  }
686
- /**
687
- * BasisU Texture Extension
688
- *
689
- * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_texture_basisu
690
- */
691
-
692
-
693
530
  class GLTFTextureBasisUExtension {
694
531
  constructor(parser) {
695
532
  this.parser = parser;
696
533
  this.name = EXTENSIONS.KHR_TEXTURE_BASISU;
697
534
  }
698
-
699
535
  loadTexture(textureIndex) {
700
536
  const parser = this.parser;
701
537
  const json = parser.json;
702
538
  const textureDef = json.textures[textureIndex];
703
-
704
539
  if (!textureDef.extensions || !textureDef.extensions[this.name]) {
705
540
  return null;
706
541
  }
707
-
708
542
  const extension = textureDef.extensions[this.name];
709
543
  const source = json.images[extension.source];
710
544
  const loader = parser.options.ktx2Loader;
711
-
712
545
  if (!loader) {
713
546
  if (json.extensionsRequired && json.extensionsRequired.indexOf(this.name) >= 0) {
714
- throw new Error('THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures');
547
+ throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");
715
548
  } else {
716
- // Assumes that the extension is optional and that a fallback texture is present
717
549
  return null;
718
550
  }
719
551
  }
720
-
721
552
  return parser.loadTextureImage(textureIndex, source, loader);
722
553
  }
723
-
724
554
  }
725
- /**
726
- * WebP Texture Extension
727
- *
728
- * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Vendor/EXT_texture_webp
729
- */
730
-
731
-
732
555
  class GLTFTextureWebPExtension {
733
556
  constructor(parser) {
734
557
  this.parser = parser;
735
558
  this.name = EXTENSIONS.EXT_TEXTURE_WEBP;
736
559
  this.isSupported = null;
737
560
  }
738
-
739
561
  loadTexture(textureIndex) {
740
562
  const name = this.name;
741
563
  const parser = this.parser;
742
564
  const json = parser.json;
743
565
  const textureDef = json.textures[textureIndex];
744
-
745
566
  if (!textureDef.extensions || !textureDef.extensions[name]) {
746
567
  return null;
747
568
  }
748
-
749
569
  const extension = textureDef.extensions[name];
750
570
  const source = json.images[extension.source];
751
571
  let loader = parser.textureLoader;
752
-
753
572
  if (source.uri) {
754
573
  const handler = parser.options.manager.getHandler(source.uri);
755
- if (handler !== null) loader = handler;
574
+ if (handler !== null)
575
+ loader = handler;
756
576
  }
757
-
758
- return this.detectSupport().then(function (isSupported) {
759
- if (isSupported) return parser.loadTextureImage(textureIndex, source, loader);
760
-
577
+ return this.detectSupport().then(function(isSupported) {
578
+ if (isSupported)
579
+ return parser.loadTextureImage(textureIndex, source, loader);
761
580
  if (json.extensionsRequired && json.extensionsRequired.indexOf(name) >= 0) {
762
- throw new Error('THREE.GLTFLoader: WebP required by asset but unsupported.');
763
- } // Fall back to PNG or JPEG.
764
-
765
-
581
+ throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");
582
+ }
766
583
  return parser.loadTexture(textureIndex);
767
584
  });
768
585
  }
769
-
770
586
  detectSupport() {
771
587
  if (!this.isSupported) {
772
- this.isSupported = new Promise(function (resolve) {
773
- const image = new Image(); // Lossy test image. Support for lossy images doesn't guarantee support for all
774
- // WebP images, unfortunately.
775
-
776
- image.src = 'data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA';
777
-
778
- image.onload = image.onerror = function () {
588
+ this.isSupported = new Promise(function(resolve) {
589
+ const image = new Image();
590
+ image.src = "data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA";
591
+ image.onload = image.onerror = function() {
779
592
  resolve(image.height === 1);
780
593
  };
781
594
  });
782
595
  }
783
-
784
596
  return this.isSupported;
785
597
  }
786
-
787
598
  }
788
- /**
789
- * meshopt BufferView Compression Extension
790
- *
791
- * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Vendor/EXT_meshopt_compression
792
- */
793
-
794
-
795
599
  class GLTFMeshoptCompression {
796
600
  constructor(parser) {
797
601
  this.name = EXTENSIONS.EXT_MESHOPT_COMPRESSION;
798
602
  this.parser = parser;
799
603
  }
800
-
801
604
  loadBufferView(index) {
802
605
  const json = this.parser.json;
803
606
  const bufferView = json.bufferViews[index];
804
-
805
607
  if (bufferView.extensions && bufferView.extensions[this.name]) {
806
608
  const extensionDef = bufferView.extensions[this.name];
807
- const buffer = this.parser.getDependency('buffer', extensionDef.buffer);
609
+ const buffer = this.parser.getDependency("buffer", extensionDef.buffer);
808
610
  const decoder = this.parser.options.meshoptDecoder;
809
-
810
611
  if (!decoder || !decoder.supported) {
811
612
  if (json.extensionsRequired && json.extensionsRequired.indexOf(this.name) >= 0) {
812
- throw new Error('THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files');
613
+ throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");
813
614
  } else {
814
- // Assumes that the extension is optional and that fallback buffer data is present
815
615
  return null;
816
616
  }
817
617
  }
818
-
819
- return Promise.all([buffer, decoder.ready]).then(function (res) {
618
+ return Promise.all([buffer, decoder.ready]).then(function(res) {
820
619
  const byteOffset = extensionDef.byteOffset || 0;
821
620
  const byteLength = extensionDef.byteLength || 0;
822
621
  const count = extensionDef.count;
@@ -830,18 +629,10 @@ class GLTFMeshoptCompression {
830
629
  return null;
831
630
  }
832
631
  }
833
-
834
632
  }
835
- /* BINARY EXTENSION */
836
-
837
-
838
- const BINARY_EXTENSION_HEADER_MAGIC = 'glTF';
633
+ const BINARY_EXTENSION_HEADER_MAGIC = "glTF";
839
634
  const BINARY_EXTENSION_HEADER_LENGTH = 12;
840
- const BINARY_EXTENSION_CHUNK_TYPES = {
841
- JSON: 0x4e4f534a,
842
- BIN: 0x004e4942
843
- };
844
-
635
+ const BINARY_EXTENSION_CHUNK_TYPES = { JSON: 1313821514, BIN: 5130562 };
845
636
  class GLTFBinaryExtension {
846
637
  constructor(data) {
847
638
  this.name = EXTENSIONS.KHR_BINARY_GLTF;
@@ -849,64 +640,47 @@ class GLTFBinaryExtension {
849
640
  this.body = null;
850
641
  const headerView = new DataView(data, 0, BINARY_EXTENSION_HEADER_LENGTH);
851
642
  this.header = {
852
- magic: LoaderUtils.decodeText(new Uint8Array(data.slice(0, 4))),
643
+ magic: THREE.LoaderUtils.decodeText(new Uint8Array(data.slice(0, 4))),
853
644
  version: headerView.getUint32(4, true),
854
645
  length: headerView.getUint32(8, true)
855
646
  };
856
-
857
647
  if (this.header.magic !== BINARY_EXTENSION_HEADER_MAGIC) {
858
- throw new Error('THREE.GLTFLoader: Unsupported glTF-Binary header.');
859
- } else if (this.header.version < 2.0) {
860
- throw new Error('THREE.GLTFLoader: Legacy binary file detected.');
648
+ throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");
649
+ } else if (this.header.version < 2) {
650
+ throw new Error("THREE.GLTFLoader: Legacy binary file detected.");
861
651
  }
862
-
863
652
  const chunkContentsLength = this.header.length - BINARY_EXTENSION_HEADER_LENGTH;
864
653
  const chunkView = new DataView(data, BINARY_EXTENSION_HEADER_LENGTH);
865
654
  let chunkIndex = 0;
866
-
867
655
  while (chunkIndex < chunkContentsLength) {
868
656
  const chunkLength = chunkView.getUint32(chunkIndex, true);
869
657
  chunkIndex += 4;
870
658
  const chunkType = chunkView.getUint32(chunkIndex, true);
871
659
  chunkIndex += 4;
872
-
873
660
  if (chunkType === BINARY_EXTENSION_CHUNK_TYPES.JSON) {
874
661
  const contentArray = new Uint8Array(data, BINARY_EXTENSION_HEADER_LENGTH + chunkIndex, chunkLength);
875
- this.content = LoaderUtils.decodeText(contentArray);
662
+ this.content = THREE.LoaderUtils.decodeText(contentArray);
876
663
  } else if (chunkType === BINARY_EXTENSION_CHUNK_TYPES.BIN) {
877
664
  const byteOffset = BINARY_EXTENSION_HEADER_LENGTH + chunkIndex;
878
665
  this.body = data.slice(byteOffset, byteOffset + chunkLength);
879
- } // Clients must ignore chunks with unknown types.
880
-
881
-
666
+ }
882
667
  chunkIndex += chunkLength;
883
668
  }
884
-
885
669
  if (this.content === null) {
886
- throw new Error('THREE.GLTFLoader: JSON content not found.');
670
+ throw new Error("THREE.GLTFLoader: JSON content not found.");
887
671
  }
888
672
  }
889
-
890
673
  }
891
- /**
892
- * DRACO Mesh Compression Extension
893
- *
894
- * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_draco_mesh_compression
895
- */
896
-
897
-
898
674
  class GLTFDracoMeshCompressionExtension {
899
675
  constructor(json, dracoLoader) {
900
676
  if (!dracoLoader) {
901
- throw new Error('THREE.GLTFLoader: No DRACOLoader instance provided.');
677
+ throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");
902
678
  }
903
-
904
679
  this.name = EXTENSIONS.KHR_DRACO_MESH_COMPRESSION;
905
680
  this.json = json;
906
681
  this.dracoLoader = dracoLoader;
907
682
  this.dracoLoader.preload();
908
683
  }
909
-
910
684
  decodePrimitive(primitive, parser) {
911
685
  const json = this.json;
912
686
  const dracoLoader = this.dracoLoader;
@@ -915,168 +689,154 @@ class GLTFDracoMeshCompressionExtension {
915
689
  const threeAttributeMap = {};
916
690
  const attributeNormalizedMap = {};
917
691
  const attributeTypeMap = {};
918
-
919
692
  for (const attributeName in gltfAttributeMap) {
920
693
  const threeAttributeName = ATTRIBUTES[attributeName] || attributeName.toLowerCase();
921
694
  threeAttributeMap[threeAttributeName] = gltfAttributeMap[attributeName];
922
695
  }
923
-
924
696
  for (const attributeName in primitive.attributes) {
925
697
  const threeAttributeName = ATTRIBUTES[attributeName] || attributeName.toLowerCase();
926
-
927
- if (gltfAttributeMap[attributeName] !== undefined) {
698
+ if (gltfAttributeMap[attributeName] !== void 0) {
928
699
  const accessorDef = json.accessors[primitive.attributes[attributeName]];
929
700
  const componentType = WEBGL_COMPONENT_TYPES[accessorDef.componentType];
930
701
  attributeTypeMap[threeAttributeName] = componentType;
931
702
  attributeNormalizedMap[threeAttributeName] = accessorDef.normalized === true;
932
703
  }
933
704
  }
934
-
935
- return parser.getDependency('bufferView', bufferViewIndex).then(function (bufferView) {
936
- return new Promise(function (resolve) {
937
- dracoLoader.decodeDracoFile(bufferView, function (geometry) {
938
- for (const attributeName in geometry.attributes) {
939
- const attribute = geometry.attributes[attributeName];
940
- const normalized = attributeNormalizedMap[attributeName];
941
- if (normalized !== undefined) attribute.normalized = normalized;
942
- }
943
-
944
- resolve(geometry);
945
- }, threeAttributeMap, attributeTypeMap);
705
+ return parser.getDependency("bufferView", bufferViewIndex).then(function(bufferView) {
706
+ return new Promise(function(resolve) {
707
+ dracoLoader.decodeDracoFile(
708
+ bufferView,
709
+ function(geometry) {
710
+ for (const attributeName in geometry.attributes) {
711
+ const attribute = geometry.attributes[attributeName];
712
+ const normalized = attributeNormalizedMap[attributeName];
713
+ if (normalized !== void 0)
714
+ attribute.normalized = normalized;
715
+ }
716
+ resolve(geometry);
717
+ },
718
+ threeAttributeMap,
719
+ attributeTypeMap
720
+ );
946
721
  });
947
722
  });
948
723
  }
949
-
950
724
  }
951
- /**
952
- * Texture Transform Extension
953
- *
954
- * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_texture_transform
955
- */
956
-
957
-
958
725
  class GLTFTextureTransformExtension {
959
726
  constructor() {
960
727
  this.name = EXTENSIONS.KHR_TEXTURE_TRANSFORM;
961
728
  }
962
-
963
729
  extendTexture(texture, transform) {
964
- if (transform.texCoord !== undefined) {
730
+ if (transform.texCoord !== void 0) {
965
731
  console.warn('THREE.GLTFLoader: Custom UV sets in "' + this.name + '" extension not yet supported.');
966
732
  }
967
-
968
- if (transform.offset === undefined && transform.rotation === undefined && transform.scale === undefined) {
969
- // See https://github.com/mrdoob/three.js/issues/21819.
733
+ if (transform.offset === void 0 && transform.rotation === void 0 && transform.scale === void 0) {
970
734
  return texture;
971
735
  }
972
-
973
736
  texture = texture.clone();
974
-
975
- if (transform.offset !== undefined) {
737
+ if (transform.offset !== void 0) {
976
738
  texture.offset.fromArray(transform.offset);
977
739
  }
978
-
979
- if (transform.rotation !== undefined) {
740
+ if (transform.rotation !== void 0) {
980
741
  texture.rotation = transform.rotation;
981
742
  }
982
-
983
- if (transform.scale !== undefined) {
743
+ if (transform.scale !== void 0) {
984
744
  texture.repeat.fromArray(transform.scale);
985
745
  }
986
-
987
746
  texture.needsUpdate = true;
988
747
  return texture;
989
748
  }
990
-
991
749
  }
992
- /**
993
- * Specular-Glossiness Extension
994
- *
995
- * Specification: https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Archived/KHR_materials_pbrSpecularGlossiness
996
- */
997
-
998
- /**
999
- * A sub class of StandardMaterial with some of the functionality
1000
- * changed via the `onBeforeCompile` callback
1001
- * @pailhead
1002
- */
1003
-
1004
-
1005
- class GLTFMeshStandardSGMaterial extends MeshStandardMaterial {
750
+ class GLTFMeshStandardSGMaterial extends THREE.MeshStandardMaterial {
1006
751
  constructor(params) {
1007
752
  super();
1008
- this.isGLTFSpecularGlossinessMaterial = true; //various chunks that need replacing
1009
-
1010
- const specularMapParsFragmentChunk = ['#ifdef USE_SPECULARMAP', ' uniform sampler2D specularMap;', '#endif'].join('\n');
1011
- const glossinessMapParsFragmentChunk = ['#ifdef USE_GLOSSINESSMAP', ' uniform sampler2D glossinessMap;', '#endif'].join('\n');
1012
- const specularMapFragmentChunk = ['vec3 specularFactor = specular;', '#ifdef USE_SPECULARMAP', ' vec4 texelSpecular = texture2D( specularMap, vUv );', ' // reads channel RGB, compatible with a glTF Specular-Glossiness (RGBA) texture', ' specularFactor *= texelSpecular.rgb;', '#endif'].join('\n');
1013
- const glossinessMapFragmentChunk = ['float glossinessFactor = glossiness;', '#ifdef USE_GLOSSINESSMAP', ' vec4 texelGlossiness = texture2D( glossinessMap, vUv );', ' // reads channel A, compatible with a glTF Specular-Glossiness (RGBA) texture', ' glossinessFactor *= texelGlossiness.a;', '#endif'].join('\n');
1014
- const lightPhysicalFragmentChunk = ['PhysicalMaterial material;', 'material.diffuseColor = diffuseColor.rgb * ( 1. - max( specularFactor.r, max( specularFactor.g, specularFactor.b ) ) );', 'vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );', 'float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );', 'material.roughness = max( 1.0 - glossinessFactor, 0.0525 ); // 0.0525 corresponds to the base mip of a 256 cubemap.', 'material.roughness += geometryRoughness;', 'material.roughness = min( material.roughness, 1.0 );', 'material.specularColor = specularFactor;'].join('\n');
753
+ this.isGLTFSpecularGlossinessMaterial = true;
754
+ const specularMapParsFragmentChunk = ["#ifdef USE_SPECULARMAP", " uniform sampler2D specularMap;", "#endif"].join(
755
+ "\n"
756
+ );
757
+ const glossinessMapParsFragmentChunk = [
758
+ "#ifdef USE_GLOSSINESSMAP",
759
+ " uniform sampler2D glossinessMap;",
760
+ "#endif"
761
+ ].join("\n");
762
+ const specularMapFragmentChunk = [
763
+ "vec3 specularFactor = specular;",
764
+ "#ifdef USE_SPECULARMAP",
765
+ " vec4 texelSpecular = texture2D( specularMap, vUv );",
766
+ " // reads channel RGB, compatible with a glTF Specular-Glossiness (RGBA) texture",
767
+ " specularFactor *= texelSpecular.rgb;",
768
+ "#endif"
769
+ ].join("\n");
770
+ const glossinessMapFragmentChunk = [
771
+ "float glossinessFactor = glossiness;",
772
+ "#ifdef USE_GLOSSINESSMAP",
773
+ " vec4 texelGlossiness = texture2D( glossinessMap, vUv );",
774
+ " // reads channel A, compatible with a glTF Specular-Glossiness (RGBA) texture",
775
+ " glossinessFactor *= texelGlossiness.a;",
776
+ "#endif"
777
+ ].join("\n");
778
+ const lightPhysicalFragmentChunk = [
779
+ "PhysicalMaterial material;",
780
+ "material.diffuseColor = diffuseColor.rgb * ( 1. - max( specularFactor.r, max( specularFactor.g, specularFactor.b ) ) );",
781
+ "vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );",
782
+ "float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );",
783
+ "material.roughness = max( 1.0 - glossinessFactor, 0.0525 ); // 0.0525 corresponds to the base mip of a 256 cubemap.",
784
+ "material.roughness += geometryRoughness;",
785
+ "material.roughness = min( material.roughness, 1.0 );",
786
+ "material.specularColor = specularFactor;"
787
+ ].join("\n");
1015
788
  const uniforms = {
1016
- specular: {
1017
- value: new Color().setHex(0xffffff)
1018
- },
1019
- glossiness: {
1020
- value: 1
1021
- },
1022
- specularMap: {
1023
- value: null
1024
- },
1025
- glossinessMap: {
1026
- value: null
1027
- }
789
+ specular: { value: new THREE.Color().setHex(16777215) },
790
+ glossiness: { value: 1 },
791
+ specularMap: { value: null },
792
+ glossinessMap: { value: null }
1028
793
  };
1029
794
  this._extraUniforms = uniforms;
1030
-
1031
- this.onBeforeCompile = function (shader) {
795
+ this.onBeforeCompile = function(shader) {
1032
796
  for (const uniformName in uniforms) {
1033
797
  shader.uniforms[uniformName] = uniforms[uniformName];
1034
798
  }
1035
-
1036
- shader.fragmentShader = shader.fragmentShader.replace('uniform float roughness;', 'uniform vec3 specular;').replace('uniform float metalness;', 'uniform float glossiness;').replace('#include <roughnessmap_pars_fragment>', specularMapParsFragmentChunk).replace('#include <metalnessmap_pars_fragment>', glossinessMapParsFragmentChunk).replace('#include <roughnessmap_fragment>', specularMapFragmentChunk).replace('#include <metalnessmap_fragment>', glossinessMapFragmentChunk).replace('#include <lights_physical_fragment>', lightPhysicalFragmentChunk);
799
+ shader.fragmentShader = shader.fragmentShader.replace("uniform float roughness;", "uniform vec3 specular;").replace("uniform float metalness;", "uniform float glossiness;").replace("#include <roughnessmap_pars_fragment>", specularMapParsFragmentChunk).replace("#include <metalnessmap_pars_fragment>", glossinessMapParsFragmentChunk).replace("#include <roughnessmap_fragment>", specularMapFragmentChunk).replace("#include <metalnessmap_fragment>", glossinessMapFragmentChunk).replace("#include <lights_physical_fragment>", lightPhysicalFragmentChunk);
1037
800
  };
1038
-
1039
801
  Object.defineProperties(this, {
1040
802
  specular: {
1041
- get: function () {
803
+ get: function() {
1042
804
  return uniforms.specular.value;
1043
805
  },
1044
- set: function (v) {
806
+ set: function(v) {
1045
807
  uniforms.specular.value = v;
1046
808
  }
1047
809
  },
1048
810
  specularMap: {
1049
- get: function () {
811
+ get: function() {
1050
812
  return uniforms.specularMap.value;
1051
813
  },
1052
- set: function (v) {
814
+ set: function(v) {
1053
815
  uniforms.specularMap.value = v;
1054
-
1055
816
  if (v) {
1056
- this.defines.USE_SPECULARMAP = ''; // USE_UV is set by the renderer for specular maps
817
+ this.defines.USE_SPECULARMAP = "";
1057
818
  } else {
1058
819
  delete this.defines.USE_SPECULARMAP;
1059
820
  }
1060
821
  }
1061
822
  },
1062
823
  glossiness: {
1063
- get: function () {
824
+ get: function() {
1064
825
  return uniforms.glossiness.value;
1065
826
  },
1066
- set: function (v) {
827
+ set: function(v) {
1067
828
  uniforms.glossiness.value = v;
1068
829
  }
1069
830
  },
1070
831
  glossinessMap: {
1071
- get: function () {
832
+ get: function() {
1072
833
  return uniforms.glossinessMap.value;
1073
834
  },
1074
- set: function (v) {
835
+ set: function(v) {
1075
836
  uniforms.glossinessMap.value = v;
1076
-
1077
837
  if (v) {
1078
- this.defines.USE_GLOSSINESSMAP = '';
1079
- this.defines.USE_UV = '';
838
+ this.defines.USE_GLOSSINESSMAP = "";
839
+ this.defines.USE_UV = "";
1080
840
  } else {
1081
841
  delete this.defines.USE_GLOSSINESSMAP;
1082
842
  delete this.defines.USE_UV;
@@ -1090,7 +850,6 @@ class GLTFMeshStandardSGMaterial extends MeshStandardMaterial {
1090
850
  delete this.roughnessMap;
1091
851
  this.setValues(params);
1092
852
  }
1093
-
1094
853
  copy(source) {
1095
854
  super.copy(source);
1096
855
  this.specularMap = source.specularMap;
@@ -1103,132 +862,118 @@ class GLTFMeshStandardSGMaterial extends MeshStandardMaterial {
1103
862
  delete this.roughnessMap;
1104
863
  return this;
1105
864
  }
1106
-
1107
865
  }
1108
-
1109
866
  class GLTFMaterialsPbrSpecularGlossinessExtension {
1110
867
  constructor() {
1111
868
  this.name = EXTENSIONS.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS;
1112
- this.specularGlossinessParams = ['color', 'map', 'lightMap', 'lightMapIntensity', 'aoMap', 'aoMapIntensity', 'emissive', 'emissiveIntensity', 'emissiveMap', 'bumpMap', 'bumpScale', 'normalMap', 'normalMapType', 'displacementMap', 'displacementScale', 'displacementBias', 'specularMap', 'specular', 'glossinessMap', 'glossiness', 'alphaMap', 'envMap', 'envMapIntensity', 'refractionRatio'];
869
+ this.specularGlossinessParams = [
870
+ "color",
871
+ "map",
872
+ "lightMap",
873
+ "lightMapIntensity",
874
+ "aoMap",
875
+ "aoMapIntensity",
876
+ "emissive",
877
+ "emissiveIntensity",
878
+ "emissiveMap",
879
+ "bumpMap",
880
+ "bumpScale",
881
+ "normalMap",
882
+ "normalMapType",
883
+ "displacementMap",
884
+ "displacementScale",
885
+ "displacementBias",
886
+ "specularMap",
887
+ "specular",
888
+ "glossinessMap",
889
+ "glossiness",
890
+ "alphaMap",
891
+ "envMap",
892
+ "envMapIntensity",
893
+ "refractionRatio"
894
+ ];
1113
895
  }
1114
-
1115
896
  getMaterialType() {
1116
897
  return GLTFMeshStandardSGMaterial;
1117
898
  }
1118
-
1119
899
  extendParams(materialParams, materialDef, parser) {
1120
900
  const pbrSpecularGlossiness = materialDef.extensions[this.name];
1121
- materialParams.color = new Color(1.0, 1.0, 1.0);
1122
- materialParams.opacity = 1.0;
901
+ materialParams.color = new THREE.Color(1, 1, 1);
902
+ materialParams.opacity = 1;
1123
903
  const pending = [];
1124
-
1125
904
  if (Array.isArray(pbrSpecularGlossiness.diffuseFactor)) {
1126
905
  const array = pbrSpecularGlossiness.diffuseFactor;
1127
906
  materialParams.color.fromArray(array);
1128
907
  materialParams.opacity = array[3];
1129
908
  }
1130
-
1131
- if (pbrSpecularGlossiness.diffuseTexture !== undefined) {
1132
- pending.push(parser.assignTexture(materialParams, 'map', pbrSpecularGlossiness.diffuseTexture));
909
+ if (pbrSpecularGlossiness.diffuseTexture !== void 0) {
910
+ pending.push(parser.assignTexture(materialParams, "map", pbrSpecularGlossiness.diffuseTexture));
1133
911
  }
1134
-
1135
- materialParams.emissive = new Color(0.0, 0.0, 0.0);
1136
- materialParams.glossiness = pbrSpecularGlossiness.glossinessFactor !== undefined ? pbrSpecularGlossiness.glossinessFactor : 1.0;
1137
- materialParams.specular = new Color(1.0, 1.0, 1.0);
1138
-
912
+ materialParams.emissive = new THREE.Color(0, 0, 0);
913
+ materialParams.glossiness = pbrSpecularGlossiness.glossinessFactor !== void 0 ? pbrSpecularGlossiness.glossinessFactor : 1;
914
+ materialParams.specular = new THREE.Color(1, 1, 1);
1139
915
  if (Array.isArray(pbrSpecularGlossiness.specularFactor)) {
1140
916
  materialParams.specular.fromArray(pbrSpecularGlossiness.specularFactor);
1141
917
  }
1142
-
1143
- if (pbrSpecularGlossiness.specularGlossinessTexture !== undefined) {
918
+ if (pbrSpecularGlossiness.specularGlossinessTexture !== void 0) {
1144
919
  const specGlossMapDef = pbrSpecularGlossiness.specularGlossinessTexture;
1145
- pending.push(parser.assignTexture(materialParams, 'glossinessMap', specGlossMapDef));
1146
- pending.push(parser.assignTexture(materialParams, 'specularMap', specGlossMapDef));
920
+ pending.push(parser.assignTexture(materialParams, "glossinessMap", specGlossMapDef));
921
+ pending.push(parser.assignTexture(materialParams, "specularMap", specGlossMapDef));
1147
922
  }
1148
-
1149
923
  return Promise.all(pending);
1150
924
  }
1151
-
1152
925
  createMaterial(materialParams) {
1153
926
  const material = new GLTFMeshStandardSGMaterial(materialParams);
1154
927
  material.fog = true;
1155
928
  material.color = materialParams.color;
1156
- material.map = materialParams.map === undefined ? null : materialParams.map;
929
+ material.map = materialParams.map === void 0 ? null : materialParams.map;
1157
930
  material.lightMap = null;
1158
- material.lightMapIntensity = 1.0;
1159
- material.aoMap = materialParams.aoMap === undefined ? null : materialParams.aoMap;
1160
- material.aoMapIntensity = 1.0;
931
+ material.lightMapIntensity = 1;
932
+ material.aoMap = materialParams.aoMap === void 0 ? null : materialParams.aoMap;
933
+ material.aoMapIntensity = 1;
1161
934
  material.emissive = materialParams.emissive;
1162
- material.emissiveIntensity = 1.0;
1163
- material.emissiveMap = materialParams.emissiveMap === undefined ? null : materialParams.emissiveMap;
1164
- material.bumpMap = materialParams.bumpMap === undefined ? null : materialParams.bumpMap;
935
+ material.emissiveIntensity = 1;
936
+ material.emissiveMap = materialParams.emissiveMap === void 0 ? null : materialParams.emissiveMap;
937
+ material.bumpMap = materialParams.bumpMap === void 0 ? null : materialParams.bumpMap;
1165
938
  material.bumpScale = 1;
1166
- material.normalMap = materialParams.normalMap === undefined ? null : materialParams.normalMap;
1167
- material.normalMapType = TangentSpaceNormalMap;
1168
- if (materialParams.normalScale) material.normalScale = materialParams.normalScale;
939
+ material.normalMap = materialParams.normalMap === void 0 ? null : materialParams.normalMap;
940
+ material.normalMapType = THREE.TangentSpaceNormalMap;
941
+ if (materialParams.normalScale)
942
+ material.normalScale = materialParams.normalScale;
1169
943
  material.displacementMap = null;
1170
944
  material.displacementScale = 1;
1171
945
  material.displacementBias = 0;
1172
- material.specularMap = materialParams.specularMap === undefined ? null : materialParams.specularMap;
946
+ material.specularMap = materialParams.specularMap === void 0 ? null : materialParams.specularMap;
1173
947
  material.specular = materialParams.specular;
1174
- material.glossinessMap = materialParams.glossinessMap === undefined ? null : materialParams.glossinessMap;
948
+ material.glossinessMap = materialParams.glossinessMap === void 0 ? null : materialParams.glossinessMap;
1175
949
  material.glossiness = materialParams.glossiness;
1176
950
  material.alphaMap = null;
1177
- material.envMap = materialParams.envMap === undefined ? null : materialParams.envMap;
1178
- material.envMapIntensity = 1.0;
951
+ material.envMap = materialParams.envMap === void 0 ? null : materialParams.envMap;
952
+ material.envMapIntensity = 1;
1179
953
  material.refractionRatio = 0.98;
1180
954
  return material;
1181
955
  }
1182
-
1183
956
  }
1184
- /**
1185
- * Mesh Quantization Extension
1186
- *
1187
- * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_mesh_quantization
1188
- */
1189
-
1190
-
1191
957
  class GLTFMeshQuantizationExtension {
1192
958
  constructor() {
1193
959
  this.name = EXTENSIONS.KHR_MESH_QUANTIZATION;
1194
960
  }
1195
-
1196
961
  }
1197
- /*********************************/
1198
-
1199
- /********** INTERPOLATION ********/
1200
-
1201
- /*********************************/
1202
- // Spline Interpolation
1203
- // Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#appendix-c-spline-interpolation
1204
-
1205
-
1206
- class GLTFCubicSplineInterpolant extends Interpolant {
962
+ class GLTFCubicSplineInterpolant extends THREE.Interpolant {
1207
963
  constructor(parameterPositions, sampleValues, sampleSize, resultBuffer) {
1208
964
  super(parameterPositions, sampleValues, sampleSize, resultBuffer);
1209
965
  }
1210
-
1211
966
  copySampleValue_(index) {
1212
- // Copies a sample value to the result buffer. See description of glTF
1213
- // CUBICSPLINE values layout in interpolate_() function below.
1214
- const result = this.resultBuffer,
1215
- values = this.sampleValues,
1216
- valueSize = this.valueSize,
1217
- offset = index * valueSize * 3 + valueSize;
1218
-
967
+ const result = this.resultBuffer, values = this.sampleValues, valueSize = this.valueSize, offset = index * valueSize * 3 + valueSize;
1219
968
  for (let i = 0; i !== valueSize; i++) {
1220
969
  result[i] = values[offset + i];
1221
970
  }
1222
-
1223
971
  return result;
1224
972
  }
1225
-
1226
973
  }
1227
-
1228
974
  GLTFCubicSplineInterpolant.prototype.beforeStart_ = GLTFCubicSplineInterpolant.prototype.copySampleValue_;
1229
975
  GLTFCubicSplineInterpolant.prototype.afterEnd_ = GLTFCubicSplineInterpolant.prototype.copySampleValue_;
1230
-
1231
- GLTFCubicSplineInterpolant.prototype.interpolate_ = function (i1, t0, t, t1) {
976
+ GLTFCubicSplineInterpolant.prototype.interpolate_ = function(i1, t0, t, t1) {
1232
977
  const result = this.resultBuffer;
1233
978
  const values = this.sampleValues;
1234
979
  const stride = this.valueSize;
@@ -1243,48 +988,26 @@ GLTFCubicSplineInterpolant.prototype.interpolate_ = function (i1, t0, t, t1) {
1243
988
  const s2 = -2 * ppp + 3 * pp;
1244
989
  const s3 = ppp - pp;
1245
990
  const s0 = 1 - s2;
1246
- const s1 = s3 - pp + p; // Layout of keyframe output values for CUBICSPLINE animations:
1247
- // [ inTangent_1, splineVertex_1, outTangent_1, inTangent_2, splineVertex_2, ... ]
1248
-
991
+ const s1 = s3 - pp + p;
1249
992
  for (let i = 0; i !== stride; i++) {
1250
- const p0 = values[offset0 + i + stride]; // splineVertex_k
1251
-
1252
- const m0 = values[offset0 + i + stride2] * td; // outTangent_k * (t_k+1 - t_k)
1253
-
1254
- const p1 = values[offset1 + i + stride]; // splineVertex_k+1
1255
-
1256
- const m1 = values[offset1 + i] * td; // inTangent_k+1 * (t_k+1 - t_k)
1257
-
993
+ const p0 = values[offset0 + i + stride];
994
+ const m0 = values[offset0 + i + stride2] * td;
995
+ const p1 = values[offset1 + i + stride];
996
+ const m1 = values[offset1 + i] * td;
1258
997
  result[i] = s0 * p0 + s1 * m0 + s2 * p1 + s3 * m1;
1259
998
  }
1260
-
1261
999
  return result;
1262
1000
  };
1263
-
1264
- const _q = new Quaternion();
1265
-
1001
+ const _q = new THREE.Quaternion();
1266
1002
  class GLTFCubicSplineQuaternionInterpolant extends GLTFCubicSplineInterpolant {
1267
1003
  interpolate_(i1, t0, t, t1) {
1268
1004
  const result = super.interpolate_(i1, t0, t, t1);
1269
-
1270
1005
  _q.fromArray(result).normalize().toArray(result);
1271
-
1272
1006
  return result;
1273
1007
  }
1274
-
1275
1008
  }
1276
- /*********************************/
1277
-
1278
- /********** INTERNALS ************/
1279
-
1280
- /*********************************/
1281
-
1282
- /* CONSTANTS */
1283
-
1284
-
1285
1009
  const WEBGL_CONSTANTS = {
1286
1010
  FLOAT: 5126,
1287
- //FLOAT_MAT2: 35674,
1288
1011
  FLOAT_MAT3: 35675,
1289
1012
  FLOAT_MAT4: 35676,
1290
1013
  FLOAT_VEC2: 35664,
@@ -1312,17 +1035,17 @@ const WEBGL_COMPONENT_TYPES = {
1312
1035
  5126: Float32Array
1313
1036
  };
1314
1037
  const WEBGL_FILTERS = {
1315
- 9728: NearestFilter,
1316
- 9729: LinearFilter,
1317
- 9984: NearestMipmapNearestFilter,
1318
- 9985: LinearMipmapNearestFilter,
1319
- 9986: NearestMipmapLinearFilter,
1320
- 9987: LinearMipmapLinearFilter
1038
+ 9728: THREE.NearestFilter,
1039
+ 9729: THREE.LinearFilter,
1040
+ 9984: THREE.NearestMipmapNearestFilter,
1041
+ 9985: THREE.LinearMipmapNearestFilter,
1042
+ 9986: THREE.NearestMipmapLinearFilter,
1043
+ 9987: THREE.LinearMipmapLinearFilter
1321
1044
  };
1322
1045
  const WEBGL_WRAPPINGS = {
1323
- 33071: ClampToEdgeWrapping,
1324
- 33648: MirroredRepeatWrapping,
1325
- 10497: RepeatWrapping
1046
+ 33071: THREE.ClampToEdgeWrapping,
1047
+ 33648: THREE.MirroredRepeatWrapping,
1048
+ 10497: THREE.RepeatWrapping
1326
1049
  };
1327
1050
  const WEBGL_TYPE_SIZES = {
1328
1051
  SCALAR: 1,
@@ -1334,848 +1057,621 @@ const WEBGL_TYPE_SIZES = {
1334
1057
  MAT4: 16
1335
1058
  };
1336
1059
  const ATTRIBUTES = {
1337
- POSITION: 'position',
1338
- NORMAL: 'normal',
1339
- TANGENT: 'tangent',
1340
- TEXCOORD_0: 'uv',
1341
- TEXCOORD_1: 'uv2',
1342
- COLOR_0: 'color',
1343
- WEIGHTS_0: 'skinWeight',
1344
- JOINTS_0: 'skinIndex'
1060
+ POSITION: "position",
1061
+ NORMAL: "normal",
1062
+ TANGENT: "tangent",
1063
+ TEXCOORD_0: "uv",
1064
+ TEXCOORD_1: "uv2",
1065
+ COLOR_0: "color",
1066
+ WEIGHTS_0: "skinWeight",
1067
+ JOINTS_0: "skinIndex"
1345
1068
  };
1346
1069
  const PATH_PROPERTIES = {
1347
- scale: 'scale',
1348
- translation: 'position',
1349
- rotation: 'quaternion',
1350
- weights: 'morphTargetInfluences'
1070
+ scale: "scale",
1071
+ translation: "position",
1072
+ rotation: "quaternion",
1073
+ weights: "morphTargetInfluences"
1351
1074
  };
1352
1075
  const INTERPOLATION = {
1353
- CUBICSPLINE: undefined,
1354
- // We use a custom interpolant (GLTFCubicSplineInterpolation) for CUBICSPLINE tracks. Each
1355
- // keyframe track will be initialized with a default interpolation type, then modified.
1356
- LINEAR: InterpolateLinear,
1357
- STEP: InterpolateDiscrete
1076
+ CUBICSPLINE: void 0,
1077
+ LINEAR: THREE.InterpolateLinear,
1078
+ STEP: THREE.InterpolateDiscrete
1358
1079
  };
1359
1080
  const ALPHA_MODES = {
1360
- OPAQUE: 'OPAQUE',
1361
- MASK: 'MASK',
1362
- BLEND: 'BLEND'
1081
+ OPAQUE: "OPAQUE",
1082
+ MASK: "MASK",
1083
+ BLEND: "BLEND"
1363
1084
  };
1364
- /**
1365
- * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#default-material
1366
- */
1367
-
1368
1085
  function createDefaultMaterial(cache) {
1369
- if (cache['DefaultMaterial'] === undefined) {
1370
- cache['DefaultMaterial'] = new MeshStandardMaterial({
1371
- color: 0xffffff,
1372
- emissive: 0x000000,
1086
+ if (cache["DefaultMaterial"] === void 0) {
1087
+ cache["DefaultMaterial"] = new THREE.MeshStandardMaterial({
1088
+ color: 16777215,
1089
+ emissive: 0,
1373
1090
  metalness: 1,
1374
1091
  roughness: 1,
1375
1092
  transparent: false,
1376
1093
  depthTest: true,
1377
- side: FrontSide
1094
+ side: THREE.FrontSide
1378
1095
  });
1379
1096
  }
1380
-
1381
- return cache['DefaultMaterial'];
1097
+ return cache["DefaultMaterial"];
1382
1098
  }
1383
-
1384
1099
  function addUnknownExtensionsToUserData(knownExtensions, object, objectDef) {
1385
- // Add unknown glTF extensions to an object's userData.
1386
1100
  for (const name in objectDef.extensions) {
1387
- if (knownExtensions[name] === undefined) {
1101
+ if (knownExtensions[name] === void 0) {
1388
1102
  object.userData.gltfExtensions = object.userData.gltfExtensions || {};
1389
1103
  object.userData.gltfExtensions[name] = objectDef.extensions[name];
1390
1104
  }
1391
1105
  }
1392
1106
  }
1393
- /**
1394
- * @param {Object3D|Material|BufferGeometry} object
1395
- * @param {GLTF.definition} gltfDef
1396
- */
1397
-
1398
-
1399
1107
  function assignExtrasToUserData(object, gltfDef) {
1400
- if (gltfDef.extras !== undefined) {
1401
- if (typeof gltfDef.extras === 'object') {
1108
+ if (gltfDef.extras !== void 0) {
1109
+ if (typeof gltfDef.extras === "object") {
1402
1110
  Object.assign(object.userData, gltfDef.extras);
1403
1111
  } else {
1404
- console.warn('THREE.GLTFLoader: Ignoring primitive type .extras, ' + gltfDef.extras);
1112
+ console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, " + gltfDef.extras);
1405
1113
  }
1406
1114
  }
1407
1115
  }
1408
- /**
1409
- * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#morph-targets
1410
- *
1411
- * @param {BufferGeometry} geometry
1412
- * @param {Array<GLTF.Target>} targets
1413
- * @param {GLTFParser} parser
1414
- * @return {Promise<BufferGeometry>}
1415
- */
1416
-
1417
-
1418
1116
  function addMorphTargets(geometry, targets, parser) {
1419
1117
  let hasMorphPosition = false;
1420
1118
  let hasMorphNormal = false;
1421
-
1422
1119
  for (let i = 0, il = targets.length; i < il; i++) {
1423
1120
  const target = targets[i];
1424
- if (target.POSITION !== undefined) hasMorphPosition = true;
1425
- if (target.NORMAL !== undefined) hasMorphNormal = true;
1426
- if (hasMorphPosition && hasMorphNormal) break;
1427
- }
1428
-
1429
- if (!hasMorphPosition && !hasMorphNormal) return Promise.resolve(geometry);
1121
+ if (target.POSITION !== void 0)
1122
+ hasMorphPosition = true;
1123
+ if (target.NORMAL !== void 0)
1124
+ hasMorphNormal = true;
1125
+ if (hasMorphPosition && hasMorphNormal)
1126
+ break;
1127
+ }
1128
+ if (!hasMorphPosition && !hasMorphNormal)
1129
+ return Promise.resolve(geometry);
1430
1130
  const pendingPositionAccessors = [];
1431
1131
  const pendingNormalAccessors = [];
1432
-
1433
1132
  for (let i = 0, il = targets.length; i < il; i++) {
1434
1133
  const target = targets[i];
1435
-
1436
1134
  if (hasMorphPosition) {
1437
- const pendingAccessor = target.POSITION !== undefined ? parser.getDependency('accessor', target.POSITION) : geometry.attributes.position;
1135
+ const pendingAccessor = target.POSITION !== void 0 ? parser.getDependency("accessor", target.POSITION) : geometry.attributes.position;
1438
1136
  pendingPositionAccessors.push(pendingAccessor);
1439
1137
  }
1440
-
1441
1138
  if (hasMorphNormal) {
1442
- const pendingAccessor = target.NORMAL !== undefined ? parser.getDependency('accessor', target.NORMAL) : geometry.attributes.normal;
1139
+ const pendingAccessor = target.NORMAL !== void 0 ? parser.getDependency("accessor", target.NORMAL) : geometry.attributes.normal;
1443
1140
  pendingNormalAccessors.push(pendingAccessor);
1444
1141
  }
1445
1142
  }
1446
-
1447
- return Promise.all([Promise.all(pendingPositionAccessors), Promise.all(pendingNormalAccessors)]).then(function (accessors) {
1143
+ return Promise.all([Promise.all(pendingPositionAccessors), Promise.all(pendingNormalAccessors)]).then(function(accessors) {
1448
1144
  const morphPositions = accessors[0];
1449
1145
  const morphNormals = accessors[1];
1450
- if (hasMorphPosition) geometry.morphAttributes.position = morphPositions;
1451
- if (hasMorphNormal) geometry.morphAttributes.normal = morphNormals;
1146
+ if (hasMorphPosition)
1147
+ geometry.morphAttributes.position = morphPositions;
1148
+ if (hasMorphNormal)
1149
+ geometry.morphAttributes.normal = morphNormals;
1452
1150
  geometry.morphTargetsRelative = true;
1453
1151
  return geometry;
1454
1152
  });
1455
1153
  }
1456
- /**
1457
- * @param {Mesh} mesh
1458
- * @param {GLTF.Mesh} meshDef
1459
- */
1460
-
1461
-
1462
1154
  function updateMorphTargets(mesh, meshDef) {
1463
1155
  mesh.updateMorphTargets();
1464
-
1465
- if (meshDef.weights !== undefined) {
1156
+ if (meshDef.weights !== void 0) {
1466
1157
  for (let i = 0, il = meshDef.weights.length; i < il; i++) {
1467
1158
  mesh.morphTargetInfluences[i] = meshDef.weights[i];
1468
1159
  }
1469
- } // .extras has user-defined data, so check that .extras.targetNames is an array.
1470
-
1471
-
1160
+ }
1472
1161
  if (meshDef.extras && Array.isArray(meshDef.extras.targetNames)) {
1473
1162
  const targetNames = meshDef.extras.targetNames;
1474
-
1475
1163
  if (mesh.morphTargetInfluences.length === targetNames.length) {
1476
1164
  mesh.morphTargetDictionary = {};
1477
-
1478
1165
  for (let i = 0, il = targetNames.length; i < il; i++) {
1479
1166
  mesh.morphTargetDictionary[targetNames[i]] = i;
1480
1167
  }
1481
1168
  } else {
1482
- console.warn('THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.');
1169
+ console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.");
1483
1170
  }
1484
1171
  }
1485
1172
  }
1486
-
1487
1173
  function createPrimitiveKey(primitiveDef) {
1488
1174
  const dracoExtension = primitiveDef.extensions && primitiveDef.extensions[EXTENSIONS.KHR_DRACO_MESH_COMPRESSION];
1489
1175
  let geometryKey;
1490
-
1491
1176
  if (dracoExtension) {
1492
- geometryKey = 'draco:' + dracoExtension.bufferView + ':' + dracoExtension.indices + ':' + createAttributesKey(dracoExtension.attributes);
1177
+ geometryKey = "draco:" + dracoExtension.bufferView + ":" + dracoExtension.indices + ":" + createAttributesKey(dracoExtension.attributes);
1493
1178
  } else {
1494
- geometryKey = primitiveDef.indices + ':' + createAttributesKey(primitiveDef.attributes) + ':' + primitiveDef.mode;
1179
+ geometryKey = primitiveDef.indices + ":" + createAttributesKey(primitiveDef.attributes) + ":" + primitiveDef.mode;
1495
1180
  }
1496
-
1497
1181
  return geometryKey;
1498
1182
  }
1499
-
1500
1183
  function createAttributesKey(attributes) {
1501
- let attributesKey = '';
1184
+ let attributesKey = "";
1502
1185
  const keys = Object.keys(attributes).sort();
1503
-
1504
1186
  for (let i = 0, il = keys.length; i < il; i++) {
1505
- attributesKey += keys[i] + ':' + attributes[keys[i]] + ';';
1187
+ attributesKey += keys[i] + ":" + attributes[keys[i]] + ";";
1506
1188
  }
1507
-
1508
1189
  return attributesKey;
1509
1190
  }
1510
-
1511
1191
  function getNormalizedComponentScale(constructor) {
1512
- // Reference:
1513
- // https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_mesh_quantization#encoding-quantized-data
1514
1192
  switch (constructor) {
1515
1193
  case Int8Array:
1516
1194
  return 1 / 127;
1517
-
1518
1195
  case Uint8Array:
1519
1196
  return 1 / 255;
1520
-
1521
1197
  case Int16Array:
1522
1198
  return 1 / 32767;
1523
-
1524
1199
  case Uint16Array:
1525
1200
  return 1 / 65535;
1526
-
1527
1201
  default:
1528
- throw new Error('THREE.GLTFLoader: Unsupported normalized accessor component type.');
1202
+ throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.");
1529
1203
  }
1530
1204
  }
1531
- /* GLTF PARSER */
1532
-
1533
-
1534
1205
  class GLTFParser {
1535
1206
  constructor(json = {}, options = {}) {
1536
1207
  this.json = json;
1537
1208
  this.extensions = {};
1538
1209
  this.plugins = {};
1539
- this.options = options; // loader object cache
1540
-
1541
- this.cache = new GLTFRegistry(); // associations between Three.js objects and glTF elements
1542
-
1543
- this.associations = new Map(); // BufferGeometry caching
1544
-
1545
- this.primitiveCache = {}; // Object3D instance caches
1546
-
1547
- this.meshCache = {
1548
- refs: {},
1549
- uses: {}
1550
- };
1551
- this.cameraCache = {
1552
- refs: {},
1553
- uses: {}
1554
- };
1555
- this.lightCache = {
1556
- refs: {},
1557
- uses: {}
1558
- };
1559
- this.textureCache = {}; // Track node names, to ensure no duplicates
1560
-
1561
- this.nodeNamesUsed = {}; // Use an ImageBitmapLoader if imageBitmaps are supported. Moves much of the
1562
- // expensive work of uploading a texture to the GPU off the main thread.
1563
-
1564
- if (typeof createImageBitmap !== 'undefined' && /Firefox|^((?!chrome|android).)*safari/i.test(navigator.userAgent) === false) {
1565
- this.textureLoader = new ImageBitmapLoader(this.options.manager);
1210
+ this.options = options;
1211
+ this.cache = new GLTFRegistry();
1212
+ this.associations = /* @__PURE__ */ new Map();
1213
+ this.primitiveCache = {};
1214
+ this.meshCache = { refs: {}, uses: {} };
1215
+ this.cameraCache = { refs: {}, uses: {} };
1216
+ this.lightCache = { refs: {}, uses: {} };
1217
+ this.textureCache = {};
1218
+ this.nodeNamesUsed = {};
1219
+ if (typeof createImageBitmap !== "undefined" && /Firefox|^((?!chrome|android).)*safari/i.test(navigator.userAgent) === false) {
1220
+ this.textureLoader = new THREE.ImageBitmapLoader(this.options.manager);
1566
1221
  } else {
1567
- this.textureLoader = new TextureLoader(this.options.manager);
1222
+ this.textureLoader = new THREE.TextureLoader(this.options.manager);
1568
1223
  }
1569
-
1570
1224
  this.textureLoader.setCrossOrigin(this.options.crossOrigin);
1571
1225
  this.textureLoader.setRequestHeader(this.options.requestHeader);
1572
- this.fileLoader = new FileLoader(this.options.manager);
1573
- this.fileLoader.setResponseType('arraybuffer');
1574
-
1575
- if (this.options.crossOrigin === 'use-credentials') {
1226
+ this.fileLoader = new THREE.FileLoader(this.options.manager);
1227
+ this.fileLoader.setResponseType("arraybuffer");
1228
+ if (this.options.crossOrigin === "use-credentials") {
1576
1229
  this.fileLoader.setWithCredentials(true);
1577
1230
  }
1578
1231
  }
1579
-
1580
1232
  setExtensions(extensions) {
1581
1233
  this.extensions = extensions;
1582
1234
  }
1583
-
1584
1235
  setPlugins(plugins) {
1585
1236
  this.plugins = plugins;
1586
1237
  }
1587
-
1588
1238
  parse(onLoad, onError) {
1589
1239
  const parser = this;
1590
1240
  const json = this.json;
1591
- const extensions = this.extensions; // Clear the loader cache
1592
-
1593
- this.cache.removeAll(); // Mark the special nodes/meshes in json for efficient parse
1594
-
1595
- this._invokeAll(function (ext) {
1241
+ const extensions = this.extensions;
1242
+ this.cache.removeAll();
1243
+ this._invokeAll(function(ext) {
1596
1244
  return ext._markDefs && ext._markDefs();
1597
1245
  });
1598
-
1599
- Promise.all(this._invokeAll(function (ext) {
1600
- return ext.beforeRoot && ext.beforeRoot();
1601
- })).then(function () {
1602
- return Promise.all([parser.getDependencies('scene'), parser.getDependencies('animation'), parser.getDependencies('camera')]);
1603
- }).then(function (dependencies) {
1246
+ Promise.all(
1247
+ this._invokeAll(function(ext) {
1248
+ return ext.beforeRoot && ext.beforeRoot();
1249
+ })
1250
+ ).then(function() {
1251
+ return Promise.all([
1252
+ parser.getDependencies("scene"),
1253
+ parser.getDependencies("animation"),
1254
+ parser.getDependencies("camera")
1255
+ ]);
1256
+ }).then(function(dependencies) {
1604
1257
  const result = {
1605
1258
  scene: dependencies[0][json.scene || 0],
1606
1259
  scenes: dependencies[0],
1607
1260
  animations: dependencies[1],
1608
1261
  cameras: dependencies[2],
1609
1262
  asset: json.asset,
1610
- parser: parser,
1263
+ parser,
1611
1264
  userData: {}
1612
1265
  };
1613
1266
  addUnknownExtensionsToUserData(extensions, result, json);
1614
1267
  assignExtrasToUserData(result, json);
1615
- Promise.all(parser._invokeAll(function (ext) {
1616
- return ext.afterRoot && ext.afterRoot(result);
1617
- })).then(function () {
1268
+ Promise.all(
1269
+ parser._invokeAll(function(ext) {
1270
+ return ext.afterRoot && ext.afterRoot(result);
1271
+ })
1272
+ ).then(function() {
1618
1273
  onLoad(result);
1619
1274
  });
1620
1275
  }).catch(onError);
1621
1276
  }
1622
- /**
1623
- * Marks the special nodes/meshes in json for efficient parse.
1624
- */
1625
-
1626
-
1627
1277
  _markDefs() {
1628
1278
  const nodeDefs = this.json.nodes || [];
1629
1279
  const skinDefs = this.json.skins || [];
1630
- const meshDefs = this.json.meshes || []; // Nothing in the node definition indicates whether it is a Bone or an
1631
- // Object3D. Use the skins' joint references to mark bones.
1632
-
1280
+ const meshDefs = this.json.meshes || [];
1633
1281
  for (let skinIndex = 0, skinLength = skinDefs.length; skinIndex < skinLength; skinIndex++) {
1634
1282
  const joints = skinDefs[skinIndex].joints;
1635
-
1636
1283
  for (let i = 0, il = joints.length; i < il; i++) {
1637
1284
  nodeDefs[joints[i]].isBone = true;
1638
1285
  }
1639
- } // Iterate over all nodes, marking references to shared resources,
1640
- // as well as skeleton joints.
1641
-
1642
-
1286
+ }
1643
1287
  for (let nodeIndex = 0, nodeLength = nodeDefs.length; nodeIndex < nodeLength; nodeIndex++) {
1644
1288
  const nodeDef = nodeDefs[nodeIndex];
1645
-
1646
- if (nodeDef.mesh !== undefined) {
1647
- this._addNodeRef(this.meshCache, nodeDef.mesh); // Nothing in the mesh definition indicates whether it is
1648
- // a SkinnedMesh or Mesh. Use the node's mesh reference
1649
- // to mark SkinnedMesh if node has skin.
1650
-
1651
-
1652
- if (nodeDef.skin !== undefined) {
1289
+ if (nodeDef.mesh !== void 0) {
1290
+ this._addNodeRef(this.meshCache, nodeDef.mesh);
1291
+ if (nodeDef.skin !== void 0) {
1653
1292
  meshDefs[nodeDef.mesh].isSkinnedMesh = true;
1654
1293
  }
1655
1294
  }
1656
-
1657
- if (nodeDef.camera !== undefined) {
1295
+ if (nodeDef.camera !== void 0) {
1658
1296
  this._addNodeRef(this.cameraCache, nodeDef.camera);
1659
1297
  }
1660
1298
  }
1661
1299
  }
1662
- /**
1663
- * Counts references to shared node / Object3D resources. These resources
1664
- * can be reused, or "instantiated", at multiple nodes in the scene
1665
- * hierarchy. Mesh, Camera, and Light instances are instantiated and must
1666
- * be marked. Non-scenegraph resources (like Materials, Geometries, and
1667
- * Textures) can be reused directly and are not marked here.
1668
- *
1669
- * Example: CesiumMilkTruck sample model reuses "Wheel" meshes.
1670
- */
1671
-
1672
-
1673
1300
  _addNodeRef(cache, index) {
1674
- if (index === undefined) return;
1675
-
1676
- if (cache.refs[index] === undefined) {
1301
+ if (index === void 0)
1302
+ return;
1303
+ if (cache.refs[index] === void 0) {
1677
1304
  cache.refs[index] = cache.uses[index] = 0;
1678
1305
  }
1679
-
1680
1306
  cache.refs[index]++;
1681
1307
  }
1682
- /** Returns a reference to a shared resource, cloning it if necessary. */
1683
-
1684
-
1685
1308
  _getNodeRef(cache, index, object) {
1686
- if (cache.refs[index] <= 1) return object;
1687
- const ref = object.clone(); // Propagates mappings to the cloned object, prevents mappings on the
1688
- // original object from being lost.
1689
-
1309
+ if (cache.refs[index] <= 1)
1310
+ return object;
1311
+ const ref = object.clone();
1690
1312
  const updateMappings = (original, clone) => {
1691
1313
  const mappings = this.associations.get(original);
1692
-
1693
1314
  if (mappings != null) {
1694
1315
  this.associations.set(clone, mappings);
1695
1316
  }
1696
-
1697
1317
  for (const [i, child] of original.children.entries()) {
1698
1318
  updateMappings(child, clone.children[i]);
1699
1319
  }
1700
1320
  };
1701
-
1702
1321
  updateMappings(object, ref);
1703
- ref.name += '_instance_' + cache.uses[index]++;
1322
+ ref.name += "_instance_" + cache.uses[index]++;
1704
1323
  return ref;
1705
1324
  }
1706
-
1707
1325
  _invokeOne(func) {
1708
1326
  const extensions = Object.values(this.plugins);
1709
1327
  extensions.push(this);
1710
-
1711
1328
  for (let i = 0; i < extensions.length; i++) {
1712
1329
  const result = func(extensions[i]);
1713
- if (result) return result;
1330
+ if (result)
1331
+ return result;
1714
1332
  }
1715
-
1716
1333
  return null;
1717
1334
  }
1718
-
1719
1335
  _invokeAll(func) {
1720
1336
  const extensions = Object.values(this.plugins);
1721
1337
  extensions.unshift(this);
1722
1338
  const pending = [];
1723
-
1724
1339
  for (let i = 0; i < extensions.length; i++) {
1725
1340
  const result = func(extensions[i]);
1726
- if (result) pending.push(result);
1341
+ if (result)
1342
+ pending.push(result);
1727
1343
  }
1728
-
1729
1344
  return pending;
1730
1345
  }
1731
- /**
1732
- * Requests the specified dependency asynchronously, with caching.
1733
- * @param {string} type
1734
- * @param {number} index
1735
- * @return {Promise<Object3D|Material|THREE.Texture|AnimationClip|ArrayBuffer|Object>}
1736
- */
1737
-
1738
-
1739
1346
  getDependency(type, index) {
1740
- const cacheKey = type + ':' + index;
1347
+ const cacheKey = type + ":" + index;
1741
1348
  let dependency = this.cache.get(cacheKey);
1742
-
1743
1349
  if (!dependency) {
1744
1350
  switch (type) {
1745
- case 'scene':
1351
+ case "scene":
1746
1352
  dependency = this.loadScene(index);
1747
1353
  break;
1748
-
1749
- case 'node':
1354
+ case "node":
1750
1355
  dependency = this.loadNode(index);
1751
1356
  break;
1752
-
1753
- case 'mesh':
1754
- dependency = this._invokeOne(function (ext) {
1357
+ case "mesh":
1358
+ dependency = this._invokeOne(function(ext) {
1755
1359
  return ext.loadMesh && ext.loadMesh(index);
1756
1360
  });
1757
1361
  break;
1758
-
1759
- case 'accessor':
1362
+ case "accessor":
1760
1363
  dependency = this.loadAccessor(index);
1761
1364
  break;
1762
-
1763
- case 'bufferView':
1764
- dependency = this._invokeOne(function (ext) {
1365
+ case "bufferView":
1366
+ dependency = this._invokeOne(function(ext) {
1765
1367
  return ext.loadBufferView && ext.loadBufferView(index);
1766
1368
  });
1767
1369
  break;
1768
-
1769
- case 'buffer':
1370
+ case "buffer":
1770
1371
  dependency = this.loadBuffer(index);
1771
1372
  break;
1772
-
1773
- case 'material':
1774
- dependency = this._invokeOne(function (ext) {
1373
+ case "material":
1374
+ dependency = this._invokeOne(function(ext) {
1775
1375
  return ext.loadMaterial && ext.loadMaterial(index);
1776
1376
  });
1777
1377
  break;
1778
-
1779
- case 'texture':
1780
- dependency = this._invokeOne(function (ext) {
1378
+ case "texture":
1379
+ dependency = this._invokeOne(function(ext) {
1781
1380
  return ext.loadTexture && ext.loadTexture(index);
1782
1381
  });
1783
1382
  break;
1784
-
1785
- case 'skin':
1383
+ case "skin":
1786
1384
  dependency = this.loadSkin(index);
1787
1385
  break;
1788
-
1789
- case 'animation':
1386
+ case "animation":
1790
1387
  dependency = this.loadAnimation(index);
1791
1388
  break;
1792
-
1793
- case 'camera':
1389
+ case "camera":
1794
1390
  dependency = this.loadCamera(index);
1795
1391
  break;
1796
-
1797
1392
  default:
1798
- throw new Error('Unknown type: ' + type);
1393
+ throw new Error("Unknown type: " + type);
1799
1394
  }
1800
-
1801
1395
  this.cache.add(cacheKey, dependency);
1802
1396
  }
1803
-
1804
1397
  return dependency;
1805
1398
  }
1806
- /**
1807
- * Requests all dependencies of the specified type asynchronously, with caching.
1808
- * @param {string} type
1809
- * @return {Promise<Array<Object>>}
1810
- */
1811
-
1812
-
1813
1399
  getDependencies(type) {
1814
1400
  let dependencies = this.cache.get(type);
1815
-
1816
1401
  if (!dependencies) {
1817
1402
  const parser = this;
1818
- const defs = this.json[type + (type === 'mesh' ? 'es' : 's')] || [];
1819
- dependencies = Promise.all(defs.map(function (def, index) {
1820
- return parser.getDependency(type, index);
1821
- }));
1403
+ const defs = this.json[type + (type === "mesh" ? "es" : "s")] || [];
1404
+ dependencies = Promise.all(
1405
+ defs.map(function(def, index) {
1406
+ return parser.getDependency(type, index);
1407
+ })
1408
+ );
1822
1409
  this.cache.add(type, dependencies);
1823
1410
  }
1824
-
1825
1411
  return dependencies;
1826
1412
  }
1827
- /**
1828
- * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#buffers-and-buffer-views
1829
- * @param {number} bufferIndex
1830
- * @return {Promise<ArrayBuffer>}
1831
- */
1832
-
1833
-
1834
1413
  loadBuffer(bufferIndex) {
1835
1414
  const bufferDef = this.json.buffers[bufferIndex];
1836
1415
  const loader = this.fileLoader;
1837
-
1838
- if (bufferDef.type && bufferDef.type !== 'arraybuffer') {
1839
- throw new Error('THREE.GLTFLoader: ' + bufferDef.type + ' buffer type is not supported.');
1840
- } // If present, GLB container is required to be the first buffer.
1841
-
1842
-
1843
- if (bufferDef.uri === undefined && bufferIndex === 0) {
1416
+ if (bufferDef.type && bufferDef.type !== "arraybuffer") {
1417
+ throw new Error("THREE.GLTFLoader: " + bufferDef.type + " buffer type is not supported.");
1418
+ }
1419
+ if (bufferDef.uri === void 0 && bufferIndex === 0) {
1844
1420
  return Promise.resolve(this.extensions[EXTENSIONS.KHR_BINARY_GLTF].body);
1845
1421
  }
1846
-
1847
1422
  const options = this.options;
1848
- return new Promise(function (resolve, reject) {
1849
- loader.load(LoaderUtils.resolveURL(bufferDef.uri, options.path), resolve, undefined, function () {
1423
+ return new Promise(function(resolve, reject) {
1424
+ loader.load(THREE.LoaderUtils.resolveURL(bufferDef.uri, options.path), resolve, void 0, function() {
1850
1425
  reject(new Error('THREE.GLTFLoader: Failed to load buffer "' + bufferDef.uri + '".'));
1851
1426
  });
1852
1427
  });
1853
1428
  }
1854
- /**
1855
- * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#buffers-and-buffer-views
1856
- * @param {number} bufferViewIndex
1857
- * @return {Promise<ArrayBuffer>}
1858
- */
1859
-
1860
-
1861
1429
  loadBufferView(bufferViewIndex) {
1862
1430
  const bufferViewDef = this.json.bufferViews[bufferViewIndex];
1863
- return this.getDependency('buffer', bufferViewDef.buffer).then(function (buffer) {
1431
+ return this.getDependency("buffer", bufferViewDef.buffer).then(function(buffer) {
1864
1432
  const byteLength = bufferViewDef.byteLength || 0;
1865
1433
  const byteOffset = bufferViewDef.byteOffset || 0;
1866
1434
  return buffer.slice(byteOffset, byteOffset + byteLength);
1867
1435
  });
1868
1436
  }
1869
- /**
1870
- * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#accessors
1871
- * @param {number} accessorIndex
1872
- * @return {Promise<BufferAttribute|InterleavedBufferAttribute>}
1873
- */
1874
-
1875
-
1876
1437
  loadAccessor(accessorIndex) {
1877
1438
  const parser = this;
1878
1439
  const json = this.json;
1879
1440
  const accessorDef = this.json.accessors[accessorIndex];
1880
-
1881
- if (accessorDef.bufferView === undefined && accessorDef.sparse === undefined) {
1882
- // Ignore empty accessors, which may be used to declare runtime
1883
- // information about attributes coming from another source (e.g. Draco
1884
- // compression extension).
1441
+ if (accessorDef.bufferView === void 0 && accessorDef.sparse === void 0) {
1885
1442
  return Promise.resolve(null);
1886
1443
  }
1887
-
1888
1444
  const pendingBufferViews = [];
1889
-
1890
- if (accessorDef.bufferView !== undefined) {
1891
- pendingBufferViews.push(this.getDependency('bufferView', accessorDef.bufferView));
1445
+ if (accessorDef.bufferView !== void 0) {
1446
+ pendingBufferViews.push(this.getDependency("bufferView", accessorDef.bufferView));
1892
1447
  } else {
1893
1448
  pendingBufferViews.push(null);
1894
1449
  }
1895
-
1896
- if (accessorDef.sparse !== undefined) {
1897
- pendingBufferViews.push(this.getDependency('bufferView', accessorDef.sparse.indices.bufferView));
1898
- pendingBufferViews.push(this.getDependency('bufferView', accessorDef.sparse.values.bufferView));
1450
+ if (accessorDef.sparse !== void 0) {
1451
+ pendingBufferViews.push(this.getDependency("bufferView", accessorDef.sparse.indices.bufferView));
1452
+ pendingBufferViews.push(this.getDependency("bufferView", accessorDef.sparse.values.bufferView));
1899
1453
  }
1900
-
1901
- return Promise.all(pendingBufferViews).then(function (bufferViews) {
1454
+ return Promise.all(pendingBufferViews).then(function(bufferViews) {
1902
1455
  const bufferView = bufferViews[0];
1903
1456
  const itemSize = WEBGL_TYPE_SIZES[accessorDef.type];
1904
- const TypedArray = WEBGL_COMPONENT_TYPES[accessorDef.componentType]; // For VEC3: itemSize is 3, elementBytes is 4, itemBytes is 12.
1905
-
1457
+ const TypedArray = WEBGL_COMPONENT_TYPES[accessorDef.componentType];
1906
1458
  const elementBytes = TypedArray.BYTES_PER_ELEMENT;
1907
1459
  const itemBytes = elementBytes * itemSize;
1908
1460
  const byteOffset = accessorDef.byteOffset || 0;
1909
- const byteStride = accessorDef.bufferView !== undefined ? json.bufferViews[accessorDef.bufferView].byteStride : undefined;
1461
+ const byteStride = accessorDef.bufferView !== void 0 ? json.bufferViews[accessorDef.bufferView].byteStride : void 0;
1910
1462
  const normalized = accessorDef.normalized === true;
1911
- let array, bufferAttribute; // The buffer is not interleaved if the stride is the item size in bytes.
1912
-
1463
+ let array, bufferAttribute;
1913
1464
  if (byteStride && byteStride !== itemBytes) {
1914
- // Each "slice" of the buffer, as defined by 'count' elements of 'byteStride' bytes, gets its own InterleavedBuffer
1915
- // This makes sure that IBA.count reflects accessor.count properly
1916
1465
  const ibSlice = Math.floor(byteOffset / byteStride);
1917
- const ibCacheKey = 'InterleavedBuffer:' + accessorDef.bufferView + ':' + accessorDef.componentType + ':' + ibSlice + ':' + accessorDef.count;
1466
+ const ibCacheKey = "InterleavedBuffer:" + accessorDef.bufferView + ":" + accessorDef.componentType + ":" + ibSlice + ":" + accessorDef.count;
1918
1467
  let ib = parser.cache.get(ibCacheKey);
1919
-
1920
1468
  if (!ib) {
1921
- array = new TypedArray(bufferView, ibSlice * byteStride, accessorDef.count * byteStride / elementBytes); // Integer parameters to IB/IBA are in array elements, not bytes.
1922
-
1923
- ib = new InterleavedBuffer(array, byteStride / elementBytes);
1469
+ array = new TypedArray(bufferView, ibSlice * byteStride, accessorDef.count * byteStride / elementBytes);
1470
+ ib = new THREE.InterleavedBuffer(array, byteStride / elementBytes);
1924
1471
  parser.cache.add(ibCacheKey, ib);
1925
1472
  }
1926
-
1927
- bufferAttribute = new InterleavedBufferAttribute(ib, itemSize, byteOffset % byteStride / elementBytes, normalized);
1473
+ bufferAttribute = new THREE.InterleavedBufferAttribute(
1474
+ ib,
1475
+ itemSize,
1476
+ byteOffset % byteStride / elementBytes,
1477
+ normalized
1478
+ );
1928
1479
  } else {
1929
1480
  if (bufferView === null) {
1930
1481
  array = new TypedArray(accessorDef.count * itemSize);
1931
1482
  } else {
1932
1483
  array = new TypedArray(bufferView, byteOffset, accessorDef.count * itemSize);
1933
1484
  }
1934
-
1935
- bufferAttribute = new BufferAttribute(array, itemSize, normalized);
1936
- } // https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#sparse-accessors
1937
-
1938
-
1939
- if (accessorDef.sparse !== undefined) {
1485
+ bufferAttribute = new THREE.BufferAttribute(array, itemSize, normalized);
1486
+ }
1487
+ if (accessorDef.sparse !== void 0) {
1940
1488
  const itemSizeIndices = WEBGL_TYPE_SIZES.SCALAR;
1941
1489
  const TypedArrayIndices = WEBGL_COMPONENT_TYPES[accessorDef.sparse.indices.componentType];
1942
1490
  const byteOffsetIndices = accessorDef.sparse.indices.byteOffset || 0;
1943
1491
  const byteOffsetValues = accessorDef.sparse.values.byteOffset || 0;
1944
- const sparseIndices = new TypedArrayIndices(bufferViews[1], byteOffsetIndices, accessorDef.sparse.count * itemSizeIndices);
1492
+ const sparseIndices = new TypedArrayIndices(
1493
+ bufferViews[1],
1494
+ byteOffsetIndices,
1495
+ accessorDef.sparse.count * itemSizeIndices
1496
+ );
1945
1497
  const sparseValues = new TypedArray(bufferViews[2], byteOffsetValues, accessorDef.sparse.count * itemSize);
1946
-
1947
1498
  if (bufferView !== null) {
1948
- // Avoid modifying the original ArrayBuffer, if the bufferView wasn't initialized with zeroes.
1949
- bufferAttribute = new BufferAttribute(bufferAttribute.array.slice(), bufferAttribute.itemSize, bufferAttribute.normalized);
1499
+ bufferAttribute = new THREE.BufferAttribute(
1500
+ bufferAttribute.array.slice(),
1501
+ bufferAttribute.itemSize,
1502
+ bufferAttribute.normalized
1503
+ );
1950
1504
  }
1951
-
1952
1505
  for (let i = 0, il = sparseIndices.length; i < il; i++) {
1953
1506
  const index = sparseIndices[i];
1954
1507
  bufferAttribute.setX(index, sparseValues[i * itemSize]);
1955
- if (itemSize >= 2) bufferAttribute.setY(index, sparseValues[i * itemSize + 1]);
1956
- if (itemSize >= 3) bufferAttribute.setZ(index, sparseValues[i * itemSize + 2]);
1957
- if (itemSize >= 4) bufferAttribute.setW(index, sparseValues[i * itemSize + 3]);
1958
- if (itemSize >= 5) throw new Error('THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.');
1508
+ if (itemSize >= 2)
1509
+ bufferAttribute.setY(index, sparseValues[i * itemSize + 1]);
1510
+ if (itemSize >= 3)
1511
+ bufferAttribute.setZ(index, sparseValues[i * itemSize + 2]);
1512
+ if (itemSize >= 4)
1513
+ bufferAttribute.setW(index, sparseValues[i * itemSize + 3]);
1514
+ if (itemSize >= 5)
1515
+ throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.");
1959
1516
  }
1960
1517
  }
1961
-
1962
1518
  return bufferAttribute;
1963
1519
  });
1964
1520
  }
1965
- /**
1966
- * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#textures
1967
- * @param {number} textureIndex
1968
- * @return {Promise<THREE.Texture>}
1969
- */
1970
-
1971
-
1972
1521
  loadTexture(textureIndex) {
1973
1522
  const json = this.json;
1974
1523
  const options = this.options;
1975
1524
  const textureDef = json.textures[textureIndex];
1976
1525
  const source = json.images[textureDef.source];
1977
1526
  let loader = this.textureLoader;
1978
-
1979
1527
  if (source.uri) {
1980
1528
  const handler = options.manager.getHandler(source.uri);
1981
- if (handler !== null) loader = handler;
1529
+ if (handler !== null)
1530
+ loader = handler;
1982
1531
  }
1983
-
1984
1532
  return this.loadTextureImage(textureIndex, source, loader);
1985
1533
  }
1986
-
1987
1534
  loadTextureImage(textureIndex, source, loader) {
1988
1535
  const parser = this;
1989
1536
  const json = this.json;
1990
1537
  const options = this.options;
1991
1538
  const textureDef = json.textures[textureIndex];
1992
- const cacheKey = (source.uri || source.bufferView) + ':' + textureDef.sampler;
1993
-
1539
+ const cacheKey = (source.uri || source.bufferView) + ":" + textureDef.sampler;
1994
1540
  if (this.textureCache[cacheKey]) {
1995
- // See https://github.com/mrdoob/three.js/issues/21559.
1996
1541
  return this.textureCache[cacheKey];
1997
1542
  }
1998
-
1999
1543
  const URL = self.URL || self.webkitURL;
2000
- let sourceURI = source.uri || '';
1544
+ let sourceURI = source.uri || "";
2001
1545
  let isObjectURL = false;
2002
-
2003
- if (source.bufferView !== undefined) {
2004
- // Load binary image data from bufferView, if provided.
2005
- sourceURI = parser.getDependency('bufferView', source.bufferView).then(function (bufferView) {
1546
+ if (source.bufferView !== void 0) {
1547
+ sourceURI = parser.getDependency("bufferView", source.bufferView).then(function(bufferView) {
2006
1548
  isObjectURL = true;
2007
- const blob = new Blob([bufferView], {
2008
- type: source.mimeType
2009
- });
1549
+ const blob = new Blob([bufferView], { type: source.mimeType });
2010
1550
  sourceURI = URL.createObjectURL(blob);
2011
1551
  return sourceURI;
2012
1552
  });
2013
- } else if (source.uri === undefined) {
2014
- throw new Error('THREE.GLTFLoader: Image ' + textureIndex + ' is missing URI and bufferView');
1553
+ } else if (source.uri === void 0) {
1554
+ throw new Error("THREE.GLTFLoader: Image " + textureIndex + " is missing URI and bufferView");
2015
1555
  }
2016
-
2017
- const promise = Promise.resolve(sourceURI).then(function (sourceURI) {
2018
- return new Promise(function (resolve, reject) {
1556
+ const promise = Promise.resolve(sourceURI).then(function(sourceURI2) {
1557
+ return new Promise(function(resolve, reject) {
2019
1558
  let onLoad = resolve;
2020
-
2021
1559
  if (loader.isImageBitmapLoader === true) {
2022
- onLoad = function (imageBitmap) {
2023
- const texture = new Texture(imageBitmap);
1560
+ onLoad = function(imageBitmap) {
1561
+ const texture = new THREE.Texture(imageBitmap);
2024
1562
  texture.needsUpdate = true;
2025
1563
  resolve(texture);
2026
1564
  };
2027
1565
  }
2028
-
2029
- loader.load(LoaderUtils.resolveURL(sourceURI, options.path), onLoad, undefined, reject);
1566
+ loader.load(THREE.LoaderUtils.resolveURL(sourceURI2, options.path), onLoad, void 0, reject);
2030
1567
  });
2031
- }).then(function (texture) {
2032
- // Clean up resources and configure Texture.
1568
+ }).then(function(texture) {
2033
1569
  if (isObjectURL === true) {
2034
1570
  URL.revokeObjectURL(sourceURI);
2035
1571
  }
2036
-
2037
1572
  texture.flipY = false;
2038
- if (textureDef.name) texture.name = textureDef.name;
1573
+ if (textureDef.name)
1574
+ texture.name = textureDef.name;
2039
1575
  const samplers = json.samplers || {};
2040
1576
  const sampler = samplers[textureDef.sampler] || {};
2041
- texture.magFilter = WEBGL_FILTERS[sampler.magFilter] || LinearFilter;
2042
- texture.minFilter = WEBGL_FILTERS[sampler.minFilter] || LinearMipmapLinearFilter;
2043
- texture.wrapS = WEBGL_WRAPPINGS[sampler.wrapS] || RepeatWrapping;
2044
- texture.wrapT = WEBGL_WRAPPINGS[sampler.wrapT] || RepeatWrapping;
2045
- parser.associations.set(texture, {
2046
- textures: textureIndex
2047
- });
1577
+ texture.magFilter = WEBGL_FILTERS[sampler.magFilter] || THREE.LinearFilter;
1578
+ texture.minFilter = WEBGL_FILTERS[sampler.minFilter] || THREE.LinearMipmapLinearFilter;
1579
+ texture.wrapS = WEBGL_WRAPPINGS[sampler.wrapS] || THREE.RepeatWrapping;
1580
+ texture.wrapT = WEBGL_WRAPPINGS[sampler.wrapT] || THREE.RepeatWrapping;
1581
+ parser.associations.set(texture, { textures: textureIndex });
2048
1582
  return texture;
2049
- }).catch(function () {
1583
+ }).catch(function() {
2050
1584
  console.error("THREE.GLTFLoader: Couldn't load texture", sourceURI);
2051
1585
  return null;
2052
1586
  });
2053
1587
  this.textureCache[cacheKey] = promise;
2054
1588
  return promise;
2055
1589
  }
2056
- /**
2057
- * Asynchronously assigns a texture to the given material parameters.
2058
- * @param {Object} materialParams
2059
- * @param {string} mapName
2060
- * @param {Object} mapDef
2061
- * @return {Promise<Texture>}
2062
- */
2063
-
2064
-
2065
1590
  assignTexture(materialParams, mapName, mapDef) {
2066
1591
  const parser = this;
2067
- return this.getDependency('texture', mapDef.index).then(function (texture) {
2068
- // Materials sample aoMap from UV set 1 and other maps from UV set 0 - this can't be configured
2069
- // However, we will copy UV set 0 to UV set 1 on demand for aoMap
2070
- if (mapDef.texCoord !== undefined && mapDef.texCoord != 0 && !(mapName === 'aoMap' && mapDef.texCoord == 1)) {
2071
- console.warn('THREE.GLTFLoader: Custom UV set ' + mapDef.texCoord + ' for texture ' + mapName + ' not yet supported.');
1592
+ return this.getDependency("texture", mapDef.index).then(function(texture) {
1593
+ if (mapDef.texCoord !== void 0 && mapDef.texCoord != 0 && !(mapName === "aoMap" && mapDef.texCoord == 1)) {
1594
+ console.warn(
1595
+ "THREE.GLTFLoader: Custom UV set " + mapDef.texCoord + " for texture " + mapName + " not yet supported."
1596
+ );
2072
1597
  }
2073
-
2074
1598
  if (parser.extensions[EXTENSIONS.KHR_TEXTURE_TRANSFORM]) {
2075
- const transform = mapDef.extensions !== undefined ? mapDef.extensions[EXTENSIONS.KHR_TEXTURE_TRANSFORM] : undefined;
2076
-
1599
+ const transform = mapDef.extensions !== void 0 ? mapDef.extensions[EXTENSIONS.KHR_TEXTURE_TRANSFORM] : void 0;
2077
1600
  if (transform) {
2078
1601
  const gltfReference = parser.associations.get(texture);
2079
1602
  texture = parser.extensions[EXTENSIONS.KHR_TEXTURE_TRANSFORM].extendTexture(texture, transform);
2080
1603
  parser.associations.set(texture, gltfReference);
2081
1604
  }
2082
1605
  }
2083
-
2084
1606
  materialParams[mapName] = texture;
2085
1607
  return texture;
2086
1608
  });
2087
1609
  }
2088
- /**
2089
- * Assigns final material to a Mesh, Line, or Points instance. The instance
2090
- * already has a material (generated from the glTF material options alone)
2091
- * but reuse of the same glTF material may require multiple threejs materials
2092
- * to accommodate different primitive types, defines, etc. New materials will
2093
- * be created if necessary, and reused from a cache.
2094
- * @param {Object3D} mesh Mesh, Line, or Points instance.
2095
- */
2096
-
2097
-
2098
1610
  assignFinalMaterial(mesh) {
2099
1611
  const geometry = mesh.geometry;
2100
1612
  let material = mesh.material;
2101
- const useDerivativeTangents = geometry.attributes.tangent === undefined;
2102
- const useVertexColors = geometry.attributes.color !== undefined;
2103
- const useFlatShading = geometry.attributes.normal === undefined;
2104
-
1613
+ const useDerivativeTangents = geometry.attributes.tangent === void 0;
1614
+ const useVertexColors = geometry.attributes.color !== void 0;
1615
+ const useFlatShading = geometry.attributes.normal === void 0;
2105
1616
  if (mesh.isPoints) {
2106
- const cacheKey = 'PointsMaterial:' + material.uuid;
1617
+ const cacheKey = "PointsMaterial:" + material.uuid;
2107
1618
  let pointsMaterial = this.cache.get(cacheKey);
2108
-
2109
1619
  if (!pointsMaterial) {
2110
- pointsMaterial = new PointsMaterial();
2111
- Material.prototype.copy.call(pointsMaterial, material);
1620
+ pointsMaterial = new THREE.PointsMaterial();
1621
+ THREE.Material.prototype.copy.call(pointsMaterial, material);
2112
1622
  pointsMaterial.color.copy(material.color);
2113
1623
  pointsMaterial.map = material.map;
2114
- pointsMaterial.sizeAttenuation = false; // glTF spec says points should be 1px
2115
-
1624
+ pointsMaterial.sizeAttenuation = false;
2116
1625
  this.cache.add(cacheKey, pointsMaterial);
2117
1626
  }
2118
-
2119
1627
  material = pointsMaterial;
2120
1628
  } else if (mesh.isLine) {
2121
- const cacheKey = 'LineBasicMaterial:' + material.uuid;
1629
+ const cacheKey = "LineBasicMaterial:" + material.uuid;
2122
1630
  let lineMaterial = this.cache.get(cacheKey);
2123
-
2124
1631
  if (!lineMaterial) {
2125
- lineMaterial = new LineBasicMaterial();
2126
- Material.prototype.copy.call(lineMaterial, material);
1632
+ lineMaterial = new THREE.LineBasicMaterial();
1633
+ THREE.Material.prototype.copy.call(lineMaterial, material);
2127
1634
  lineMaterial.color.copy(material.color);
2128
1635
  this.cache.add(cacheKey, lineMaterial);
2129
1636
  }
2130
-
2131
1637
  material = lineMaterial;
2132
- } // Clone the material if it will be modified
2133
-
2134
-
1638
+ }
2135
1639
  if (useDerivativeTangents || useVertexColors || useFlatShading) {
2136
- let cacheKey = 'ClonedMaterial:' + material.uuid + ':';
2137
- if (material.isGLTFSpecularGlossinessMaterial) cacheKey += 'specular-glossiness:';
2138
- if (useDerivativeTangents) cacheKey += 'derivative-tangents:';
2139
- if (useVertexColors) cacheKey += 'vertex-colors:';
2140
- if (useFlatShading) cacheKey += 'flat-shading:';
1640
+ let cacheKey = "ClonedMaterial:" + material.uuid + ":";
1641
+ if (material.isGLTFSpecularGlossinessMaterial)
1642
+ cacheKey += "specular-glossiness:";
1643
+ if (useDerivativeTangents)
1644
+ cacheKey += "derivative-tangents:";
1645
+ if (useVertexColors)
1646
+ cacheKey += "vertex-colors:";
1647
+ if (useFlatShading)
1648
+ cacheKey += "flat-shading:";
2141
1649
  let cachedMaterial = this.cache.get(cacheKey);
2142
-
2143
1650
  if (!cachedMaterial) {
2144
1651
  cachedMaterial = material.clone();
2145
- if (useVertexColors) cachedMaterial.vertexColors = true;
2146
- if (useFlatShading) cachedMaterial.flatShading = true;
2147
-
1652
+ if (useVertexColors)
1653
+ cachedMaterial.vertexColors = true;
1654
+ if (useFlatShading)
1655
+ cachedMaterial.flatShading = true;
2148
1656
  if (useDerivativeTangents) {
2149
- // https://github.com/mrdoob/three.js/issues/11438#issuecomment-507003995
2150
- if (cachedMaterial.normalScale) cachedMaterial.normalScale.y *= -1;
2151
- if (cachedMaterial.clearcoatNormalScale) cachedMaterial.clearcoatNormalScale.y *= -1;
1657
+ if (cachedMaterial.normalScale)
1658
+ cachedMaterial.normalScale.y *= -1;
1659
+ if (cachedMaterial.clearcoatNormalScale)
1660
+ cachedMaterial.clearcoatNormalScale.y *= -1;
2152
1661
  }
2153
-
2154
1662
  this.cache.add(cacheKey, cachedMaterial);
2155
1663
  this.associations.set(cachedMaterial, this.associations.get(material));
2156
1664
  }
2157
-
2158
1665
  material = cachedMaterial;
2159
- } // workarounds for mesh and geometry
2160
-
2161
-
2162
- if (material.aoMap && geometry.attributes.uv2 === undefined && geometry.attributes.uv !== undefined) {
2163
- geometry.setAttribute('uv2', geometry.attributes.uv);
2164
1666
  }
2165
-
1667
+ if (material.aoMap && geometry.attributes.uv2 === void 0 && geometry.attributes.uv !== void 0) {
1668
+ geometry.setAttribute("uv2", geometry.attributes.uv);
1669
+ }
2166
1670
  mesh.material = material;
2167
1671
  }
2168
-
2169
1672
  getMaterialType() {
2170
- return MeshStandardMaterial;
2171
- }
2172
- /**
2173
- * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#materials
2174
- * @param {number} materialIndex
2175
- * @return {Promise<Material>}
2176
- */
2177
-
2178
-
1673
+ return THREE.MeshStandardMaterial;
1674
+ }
2179
1675
  loadMaterial(materialIndex) {
2180
1676
  const parser = this;
2181
1677
  const json = this.json;
@@ -2185,7 +1681,6 @@ class GLTFParser {
2185
1681
  const materialParams = {};
2186
1682
  const materialExtensions = materialDef.extensions || {};
2187
1683
  const pending = [];
2188
-
2189
1684
  if (materialExtensions[EXTENSIONS.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS]) {
2190
1685
  const sgExtension = extensions[EXTENSIONS.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS];
2191
1686
  materialType = sgExtension.getMaterialType();
@@ -2195,178 +1690,125 @@ class GLTFParser {
2195
1690
  materialType = kmuExtension.getMaterialType();
2196
1691
  pending.push(kmuExtension.extendParams(materialParams, materialDef, parser));
2197
1692
  } else {
2198
- // Specification:
2199
- // https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#metallic-roughness-material
2200
1693
  const metallicRoughness = materialDef.pbrMetallicRoughness || {};
2201
- materialParams.color = new Color(1.0, 1.0, 1.0);
2202
- materialParams.opacity = 1.0;
2203
-
1694
+ materialParams.color = new THREE.Color(1, 1, 1);
1695
+ materialParams.opacity = 1;
2204
1696
  if (Array.isArray(metallicRoughness.baseColorFactor)) {
2205
1697
  const array = metallicRoughness.baseColorFactor;
2206
1698
  materialParams.color.fromArray(array);
2207
1699
  materialParams.opacity = array[3];
2208
1700
  }
2209
-
2210
- if (metallicRoughness.baseColorTexture !== undefined) {
2211
- pending.push(parser.assignTexture(materialParams, 'map', metallicRoughness.baseColorTexture));
1701
+ if (metallicRoughness.baseColorTexture !== void 0) {
1702
+ pending.push(parser.assignTexture(materialParams, "map", metallicRoughness.baseColorTexture));
2212
1703
  }
2213
-
2214
- materialParams.metalness = metallicRoughness.metallicFactor !== undefined ? metallicRoughness.metallicFactor : 1.0;
2215
- materialParams.roughness = metallicRoughness.roughnessFactor !== undefined ? metallicRoughness.roughnessFactor : 1.0;
2216
-
2217
- if (metallicRoughness.metallicRoughnessTexture !== undefined) {
2218
- pending.push(parser.assignTexture(materialParams, 'metalnessMap', metallicRoughness.metallicRoughnessTexture));
2219
- pending.push(parser.assignTexture(materialParams, 'roughnessMap', metallicRoughness.metallicRoughnessTexture));
1704
+ materialParams.metalness = metallicRoughness.metallicFactor !== void 0 ? metallicRoughness.metallicFactor : 1;
1705
+ materialParams.roughness = metallicRoughness.roughnessFactor !== void 0 ? metallicRoughness.roughnessFactor : 1;
1706
+ if (metallicRoughness.metallicRoughnessTexture !== void 0) {
1707
+ pending.push(parser.assignTexture(materialParams, "metalnessMap", metallicRoughness.metallicRoughnessTexture));
1708
+ pending.push(parser.assignTexture(materialParams, "roughnessMap", metallicRoughness.metallicRoughnessTexture));
2220
1709
  }
2221
-
2222
- materialType = this._invokeOne(function (ext) {
1710
+ materialType = this._invokeOne(function(ext) {
2223
1711
  return ext.getMaterialType && ext.getMaterialType(materialIndex);
2224
1712
  });
2225
- pending.push(Promise.all(this._invokeAll(function (ext) {
2226
- return ext.extendMaterialParams && ext.extendMaterialParams(materialIndex, materialParams);
2227
- })));
1713
+ pending.push(
1714
+ Promise.all(
1715
+ this._invokeAll(function(ext) {
1716
+ return ext.extendMaterialParams && ext.extendMaterialParams(materialIndex, materialParams);
1717
+ })
1718
+ )
1719
+ );
2228
1720
  }
2229
-
2230
1721
  if (materialDef.doubleSided === true) {
2231
- materialParams.side = DoubleSide;
1722
+ materialParams.side = THREE.DoubleSide;
2232
1723
  }
2233
-
2234
1724
  const alphaMode = materialDef.alphaMode || ALPHA_MODES.OPAQUE;
2235
-
2236
1725
  if (alphaMode === ALPHA_MODES.BLEND) {
2237
- materialParams.transparent = true; // See: https://github.com/mrdoob/three.js/issues/17706
2238
-
1726
+ materialParams.transparent = true;
2239
1727
  materialParams.depthWrite = false;
2240
1728
  } else {
2241
1729
  materialParams.transparent = false;
2242
-
2243
1730
  if (alphaMode === ALPHA_MODES.MASK) {
2244
- materialParams.alphaTest = materialDef.alphaCutoff !== undefined ? materialDef.alphaCutoff : 0.5;
1731
+ materialParams.alphaTest = materialDef.alphaCutoff !== void 0 ? materialDef.alphaCutoff : 0.5;
2245
1732
  }
2246
1733
  }
2247
-
2248
- if (materialDef.normalTexture !== undefined && materialType !== MeshBasicMaterial) {
2249
- pending.push(parser.assignTexture(materialParams, 'normalMap', materialDef.normalTexture));
2250
- materialParams.normalScale = new Vector2(1, 1);
2251
-
2252
- if (materialDef.normalTexture.scale !== undefined) {
1734
+ if (materialDef.normalTexture !== void 0 && materialType !== THREE.MeshBasicMaterial) {
1735
+ pending.push(parser.assignTexture(materialParams, "normalMap", materialDef.normalTexture));
1736
+ materialParams.normalScale = new THREE.Vector2(1, 1);
1737
+ if (materialDef.normalTexture.scale !== void 0) {
2253
1738
  const scale = materialDef.normalTexture.scale;
2254
1739
  materialParams.normalScale.set(scale, scale);
2255
1740
  }
2256
1741
  }
2257
-
2258
- if (materialDef.occlusionTexture !== undefined && materialType !== MeshBasicMaterial) {
2259
- pending.push(parser.assignTexture(materialParams, 'aoMap', materialDef.occlusionTexture));
2260
-
2261
- if (materialDef.occlusionTexture.strength !== undefined) {
1742
+ if (materialDef.occlusionTexture !== void 0 && materialType !== THREE.MeshBasicMaterial) {
1743
+ pending.push(parser.assignTexture(materialParams, "aoMap", materialDef.occlusionTexture));
1744
+ if (materialDef.occlusionTexture.strength !== void 0) {
2262
1745
  materialParams.aoMapIntensity = materialDef.occlusionTexture.strength;
2263
1746
  }
2264
1747
  }
2265
-
2266
- if (materialDef.emissiveFactor !== undefined && materialType !== MeshBasicMaterial) {
2267
- materialParams.emissive = new Color().fromArray(materialDef.emissiveFactor);
1748
+ if (materialDef.emissiveFactor !== void 0 && materialType !== THREE.MeshBasicMaterial) {
1749
+ materialParams.emissive = new THREE.Color().fromArray(materialDef.emissiveFactor);
2268
1750
  }
2269
-
2270
- if (materialDef.emissiveTexture !== undefined && materialType !== MeshBasicMaterial) {
2271
- pending.push(parser.assignTexture(materialParams, 'emissiveMap', materialDef.emissiveTexture));
1751
+ if (materialDef.emissiveTexture !== void 0 && materialType !== THREE.MeshBasicMaterial) {
1752
+ pending.push(parser.assignTexture(materialParams, "emissiveMap", materialDef.emissiveTexture));
2272
1753
  }
2273
-
2274
- return Promise.all(pending).then(function () {
1754
+ return Promise.all(pending).then(function() {
2275
1755
  let material;
2276
-
2277
1756
  if (materialType === GLTFMeshStandardSGMaterial) {
2278
1757
  material = extensions[EXTENSIONS.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS].createMaterial(materialParams);
2279
1758
  } else {
2280
1759
  material = new materialType(materialParams);
2281
1760
  }
2282
-
2283
- if (materialDef.name) material.name = materialDef.name; // baseColorTexture, emissiveTexture, and specularGlossinessTexture use sRGB encoding.
2284
-
2285
- if (material.map) material.map.encoding = sRGBEncoding;
2286
- if (material.emissiveMap) material.emissiveMap.encoding = sRGBEncoding;
1761
+ if (materialDef.name)
1762
+ material.name = materialDef.name;
1763
+ if (material.map)
1764
+ material.map.encoding = THREE.sRGBEncoding;
1765
+ if (material.emissiveMap)
1766
+ material.emissiveMap.encoding = THREE.sRGBEncoding;
2287
1767
  assignExtrasToUserData(material, materialDef);
2288
- parser.associations.set(material, {
2289
- materials: materialIndex
2290
- });
2291
- if (materialDef.extensions) addUnknownExtensionsToUserData(extensions, material, materialDef);
1768
+ parser.associations.set(material, { materials: materialIndex });
1769
+ if (materialDef.extensions)
1770
+ addUnknownExtensionsToUserData(extensions, material, materialDef);
2292
1771
  return material;
2293
1772
  });
2294
1773
  }
2295
- /** When Object3D instances are targeted by animation, they need unique names. */
2296
-
2297
-
2298
1774
  createUniqueName(originalName) {
2299
- const sanitizedName = PropertyBinding.sanitizeNodeName(originalName || '');
1775
+ const sanitizedName = THREE.PropertyBinding.sanitizeNodeName(originalName || "");
2300
1776
  let name = sanitizedName;
2301
-
2302
1777
  for (let i = 1; this.nodeNamesUsed[name]; ++i) {
2303
- name = sanitizedName + '_' + i;
1778
+ name = sanitizedName + "_" + i;
2304
1779
  }
2305
-
2306
1780
  this.nodeNamesUsed[name] = true;
2307
1781
  return name;
2308
1782
  }
2309
- /**
2310
- * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#geometry
2311
- *
2312
- * Creates BufferGeometries from primitives.
2313
- *
2314
- * @param {Array<GLTF.Primitive>} primitives
2315
- * @return {Promise<Array<BufferGeometry>>}
2316
- */
2317
-
2318
-
2319
1783
  loadGeometries(primitives) {
2320
1784
  const parser = this;
2321
1785
  const extensions = this.extensions;
2322
1786
  const cache = this.primitiveCache;
2323
-
2324
1787
  function createDracoPrimitive(primitive) {
2325
- return extensions[EXTENSIONS.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(primitive, parser).then(function (geometry) {
1788
+ return extensions[EXTENSIONS.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(primitive, parser).then(function(geometry) {
2326
1789
  return addPrimitiveAttributes(geometry, primitive, parser);
2327
1790
  });
2328
1791
  }
2329
-
2330
1792
  const pending = [];
2331
-
2332
1793
  for (let i = 0, il = primitives.length; i < il; i++) {
2333
1794
  const primitive = primitives[i];
2334
- const cacheKey = createPrimitiveKey(primitive); // See if we've already created this geometry
2335
-
1795
+ const cacheKey = createPrimitiveKey(primitive);
2336
1796
  const cached = cache[cacheKey];
2337
-
2338
1797
  if (cached) {
2339
- // Use the cached geometry if it exists
2340
1798
  pending.push(cached.promise);
2341
1799
  } else {
2342
1800
  let geometryPromise;
2343
-
2344
1801
  if (primitive.extensions && primitive.extensions[EXTENSIONS.KHR_DRACO_MESH_COMPRESSION]) {
2345
- // Use DRACO geometry if available
2346
1802
  geometryPromise = createDracoPrimitive(primitive);
2347
1803
  } else {
2348
- // Otherwise create a new geometry
2349
- geometryPromise = addPrimitiveAttributes(new BufferGeometry(), primitive, parser);
2350
- } // Cache this geometry
2351
-
2352
-
2353
- cache[cacheKey] = {
2354
- primitive: primitive,
2355
- promise: geometryPromise
2356
- };
1804
+ geometryPromise = addPrimitiveAttributes(new THREE.BufferGeometry(), primitive, parser);
1805
+ }
1806
+ cache[cacheKey] = { primitive, promise: geometryPromise };
2357
1807
  pending.push(geometryPromise);
2358
1808
  }
2359
1809
  }
2360
-
2361
1810
  return Promise.all(pending);
2362
1811
  }
2363
- /**
2364
- * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#meshes
2365
- * @param {number} meshIndex
2366
- * @return {Promise<Group|Mesh|SkinnedMesh>}
2367
- */
2368
-
2369
-
2370
1812
  loadMesh(meshIndex) {
2371
1813
  const parser = this;
2372
1814
  const json = this.json;
@@ -2374,142 +1816,102 @@ class GLTFParser {
2374
1816
  const meshDef = json.meshes[meshIndex];
2375
1817
  const primitives = meshDef.primitives;
2376
1818
  const pending = [];
2377
-
2378
1819
  for (let i = 0, il = primitives.length; i < il; i++) {
2379
- const material = primitives[i].material === undefined ? createDefaultMaterial(this.cache) : this.getDependency('material', primitives[i].material);
1820
+ const material = primitives[i].material === void 0 ? createDefaultMaterial(this.cache) : this.getDependency("material", primitives[i].material);
2380
1821
  pending.push(material);
2381
1822
  }
2382
-
2383
1823
  pending.push(parser.loadGeometries(primitives));
2384
- return Promise.all(pending).then(function (results) {
1824
+ return Promise.all(pending).then(function(results) {
2385
1825
  const materials = results.slice(0, results.length - 1);
2386
1826
  const geometries = results[results.length - 1];
2387
1827
  const meshes = [];
2388
-
2389
1828
  for (let i = 0, il = geometries.length; i < il; i++) {
2390
1829
  const geometry = geometries[i];
2391
- const primitive = primitives[i]; // 1. create Mesh
2392
-
1830
+ const primitive = primitives[i];
2393
1831
  let mesh;
2394
1832
  const material = materials[i];
2395
-
2396
- if (primitive.mode === WEBGL_CONSTANTS.TRIANGLES || primitive.mode === WEBGL_CONSTANTS.TRIANGLE_STRIP || primitive.mode === WEBGL_CONSTANTS.TRIANGLE_FAN || primitive.mode === undefined) {
2397
- // .isSkinnedMesh isn't in glTF spec. See ._markDefs()
2398
- mesh = meshDef.isSkinnedMesh === true ? new SkinnedMesh(geometry, material) : new Mesh(geometry, material);
2399
-
1833
+ if (primitive.mode === WEBGL_CONSTANTS.TRIANGLES || primitive.mode === WEBGL_CONSTANTS.TRIANGLE_STRIP || primitive.mode === WEBGL_CONSTANTS.TRIANGLE_FAN || primitive.mode === void 0) {
1834
+ mesh = meshDef.isSkinnedMesh === true ? new THREE.SkinnedMesh(geometry, material) : new THREE.Mesh(geometry, material);
2400
1835
  if (mesh.isSkinnedMesh === true && !mesh.geometry.attributes.skinWeight.normalized) {
2401
- // we normalize floating point skin weight array to fix malformed assets (see #15319)
2402
- // it's important to skip this for non-float32 data since normalizeSkinWeights assumes non-normalized inputs
2403
1836
  mesh.normalizeSkinWeights();
2404
1837
  }
2405
-
2406
1838
  if (primitive.mode === WEBGL_CONSTANTS.TRIANGLE_STRIP) {
2407
- mesh.geometry = toTrianglesDrawMode(mesh.geometry, TriangleStripDrawMode);
1839
+ mesh.geometry = toTrianglesDrawMode(mesh.geometry, THREE.TriangleStripDrawMode);
2408
1840
  } else if (primitive.mode === WEBGL_CONSTANTS.TRIANGLE_FAN) {
2409
- mesh.geometry = toTrianglesDrawMode(mesh.geometry, TriangleFanDrawMode);
1841
+ mesh.geometry = toTrianglesDrawMode(mesh.geometry, THREE.TriangleFanDrawMode);
2410
1842
  }
2411
1843
  } else if (primitive.mode === WEBGL_CONSTANTS.LINES) {
2412
- mesh = new LineSegments(geometry, material);
1844
+ mesh = new THREE.LineSegments(geometry, material);
2413
1845
  } else if (primitive.mode === WEBGL_CONSTANTS.LINE_STRIP) {
2414
- mesh = new Line(geometry, material);
1846
+ mesh = new THREE.Line(geometry, material);
2415
1847
  } else if (primitive.mode === WEBGL_CONSTANTS.LINE_LOOP) {
2416
- mesh = new LineLoop(geometry, material);
1848
+ mesh = new THREE.LineLoop(geometry, material);
2417
1849
  } else if (primitive.mode === WEBGL_CONSTANTS.POINTS) {
2418
- mesh = new Points(geometry, material);
1850
+ mesh = new THREE.Points(geometry, material);
2419
1851
  } else {
2420
- throw new Error('THREE.GLTFLoader: Primitive mode unsupported: ' + primitive.mode);
1852
+ throw new Error("THREE.GLTFLoader: Primitive mode unsupported: " + primitive.mode);
2421
1853
  }
2422
-
2423
1854
  if (Object.keys(mesh.geometry.morphAttributes).length > 0) {
2424
1855
  updateMorphTargets(mesh, meshDef);
2425
1856
  }
2426
-
2427
- mesh.name = parser.createUniqueName(meshDef.name || 'mesh_' + meshIndex);
1857
+ mesh.name = parser.createUniqueName(meshDef.name || "mesh_" + meshIndex);
2428
1858
  assignExtrasToUserData(mesh, meshDef);
2429
- if (primitive.extensions) addUnknownExtensionsToUserData(extensions, mesh, primitive);
1859
+ if (primitive.extensions)
1860
+ addUnknownExtensionsToUserData(extensions, mesh, primitive);
2430
1861
  parser.assignFinalMaterial(mesh);
2431
1862
  meshes.push(mesh);
2432
1863
  }
2433
-
2434
1864
  for (let i = 0, il = meshes.length; i < il; i++) {
2435
1865
  parser.associations.set(meshes[i], {
2436
1866
  meshes: meshIndex,
2437
1867
  primitives: i
2438
1868
  });
2439
1869
  }
2440
-
2441
1870
  if (meshes.length === 1) {
2442
1871
  return meshes[0];
2443
1872
  }
2444
-
2445
- const group = new Group();
2446
- parser.associations.set(group, {
2447
- meshes: meshIndex
2448
- });
2449
-
1873
+ const group = new THREE.Group();
1874
+ parser.associations.set(group, { meshes: meshIndex });
2450
1875
  for (let i = 0, il = meshes.length; i < il; i++) {
2451
1876
  group.add(meshes[i]);
2452
1877
  }
2453
-
2454
1878
  return group;
2455
1879
  });
2456
1880
  }
2457
- /**
2458
- * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#cameras
2459
- * @param {number} cameraIndex
2460
- * @return {Promise<THREE.Camera>}
2461
- */
2462
-
2463
-
2464
1881
  loadCamera(cameraIndex) {
2465
1882
  let camera;
2466
1883
  const cameraDef = this.json.cameras[cameraIndex];
2467
1884
  const params = cameraDef[cameraDef.type];
2468
-
2469
1885
  if (!params) {
2470
- console.warn('THREE.GLTFLoader: Missing camera parameters.');
1886
+ console.warn("THREE.GLTFLoader: Missing camera parameters.");
2471
1887
  return;
2472
1888
  }
2473
-
2474
- if (cameraDef.type === 'perspective') {
2475
- camera = new PerspectiveCamera(MathUtils.radToDeg(params.yfov), params.aspectRatio || 1, params.znear || 1, params.zfar || 2e6);
2476
- } else if (cameraDef.type === 'orthographic') {
2477
- camera = new OrthographicCamera(-params.xmag, params.xmag, params.ymag, -params.ymag, params.znear, params.zfar);
2478
- }
2479
-
2480
- if (cameraDef.name) camera.name = this.createUniqueName(cameraDef.name);
1889
+ if (cameraDef.type === "perspective") {
1890
+ camera = new THREE.PerspectiveCamera(
1891
+ THREE.MathUtils.radToDeg(params.yfov),
1892
+ params.aspectRatio || 1,
1893
+ params.znear || 1,
1894
+ params.zfar || 2e6
1895
+ );
1896
+ } else if (cameraDef.type === "orthographic") {
1897
+ camera = new THREE.OrthographicCamera(-params.xmag, params.xmag, params.ymag, -params.ymag, params.znear, params.zfar);
1898
+ }
1899
+ if (cameraDef.name)
1900
+ camera.name = this.createUniqueName(cameraDef.name);
2481
1901
  assignExtrasToUserData(camera, cameraDef);
2482
1902
  return Promise.resolve(camera);
2483
1903
  }
2484
- /**
2485
- * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#skins
2486
- * @param {number} skinIndex
2487
- * @return {Promise<Object>}
2488
- */
2489
-
2490
-
2491
1904
  loadSkin(skinIndex) {
2492
1905
  const skinDef = this.json.skins[skinIndex];
2493
- const skinEntry = {
2494
- joints: skinDef.joints
2495
- };
2496
-
2497
- if (skinDef.inverseBindMatrices === undefined) {
1906
+ const skinEntry = { joints: skinDef.joints };
1907
+ if (skinDef.inverseBindMatrices === void 0) {
2498
1908
  return Promise.resolve(skinEntry);
2499
1909
  }
2500
-
2501
- return this.getDependency('accessor', skinDef.inverseBindMatrices).then(function (accessor) {
1910
+ return this.getDependency("accessor", skinDef.inverseBindMatrices).then(function(accessor) {
2502
1911
  skinEntry.inverseBindMatrices = accessor;
2503
1912
  return skinEntry;
2504
1913
  });
2505
1914
  }
2506
- /**
2507
- * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#animations
2508
- * @param {number} animationIndex
2509
- * @return {Promise<AnimationClip>}
2510
- */
2511
-
2512
-
2513
1915
  loadAnimation(animationIndex) {
2514
1916
  const json = this.json;
2515
1917
  const animationDef = json.animations[animationIndex];
@@ -2518,63 +1920,61 @@ class GLTFParser {
2518
1920
  const pendingOutputAccessors = [];
2519
1921
  const pendingSamplers = [];
2520
1922
  const pendingTargets = [];
2521
-
2522
1923
  for (let i = 0, il = animationDef.channels.length; i < il; i++) {
2523
1924
  const channel = animationDef.channels[i];
2524
1925
  const sampler = animationDef.samplers[channel.sampler];
2525
1926
  const target = channel.target;
2526
- const name = target.node !== undefined ? target.node : target.id; // NOTE: target.id is deprecated.
2527
-
2528
- const input = animationDef.parameters !== undefined ? animationDef.parameters[sampler.input] : sampler.input;
2529
- const output = animationDef.parameters !== undefined ? animationDef.parameters[sampler.output] : sampler.output;
2530
- pendingNodes.push(this.getDependency('node', name));
2531
- pendingInputAccessors.push(this.getDependency('accessor', input));
2532
- pendingOutputAccessors.push(this.getDependency('accessor', output));
1927
+ const name = target.node !== void 0 ? target.node : target.id;
1928
+ const input = animationDef.parameters !== void 0 ? animationDef.parameters[sampler.input] : sampler.input;
1929
+ const output = animationDef.parameters !== void 0 ? animationDef.parameters[sampler.output] : sampler.output;
1930
+ pendingNodes.push(this.getDependency("node", name));
1931
+ pendingInputAccessors.push(this.getDependency("accessor", input));
1932
+ pendingOutputAccessors.push(this.getDependency("accessor", output));
2533
1933
  pendingSamplers.push(sampler);
2534
1934
  pendingTargets.push(target);
2535
1935
  }
2536
-
2537
- return Promise.all([Promise.all(pendingNodes), Promise.all(pendingInputAccessors), Promise.all(pendingOutputAccessors), Promise.all(pendingSamplers), Promise.all(pendingTargets)]).then(function (dependencies) {
1936
+ return Promise.all([
1937
+ Promise.all(pendingNodes),
1938
+ Promise.all(pendingInputAccessors),
1939
+ Promise.all(pendingOutputAccessors),
1940
+ Promise.all(pendingSamplers),
1941
+ Promise.all(pendingTargets)
1942
+ ]).then(function(dependencies) {
2538
1943
  const nodes = dependencies[0];
2539
1944
  const inputAccessors = dependencies[1];
2540
1945
  const outputAccessors = dependencies[2];
2541
1946
  const samplers = dependencies[3];
2542
1947
  const targets = dependencies[4];
2543
1948
  const tracks = [];
2544
-
2545
1949
  for (let i = 0, il = nodes.length; i < il; i++) {
2546
1950
  const node = nodes[i];
2547
1951
  const inputAccessor = inputAccessors[i];
2548
1952
  const outputAccessor = outputAccessors[i];
2549
1953
  const sampler = samplers[i];
2550
1954
  const target = targets[i];
2551
- if (node === undefined) continue;
1955
+ if (node === void 0)
1956
+ continue;
2552
1957
  node.updateMatrix();
2553
1958
  node.matrixAutoUpdate = true;
2554
1959
  let TypedKeyframeTrack;
2555
-
2556
1960
  switch (PATH_PROPERTIES[target.path]) {
2557
1961
  case PATH_PROPERTIES.weights:
2558
- TypedKeyframeTrack = NumberKeyframeTrack;
1962
+ TypedKeyframeTrack = THREE.NumberKeyframeTrack;
2559
1963
  break;
2560
-
2561
1964
  case PATH_PROPERTIES.rotation:
2562
- TypedKeyframeTrack = QuaternionKeyframeTrack;
1965
+ TypedKeyframeTrack = THREE.QuaternionKeyframeTrack;
2563
1966
  break;
2564
-
2565
1967
  case PATH_PROPERTIES.position:
2566
1968
  case PATH_PROPERTIES.scale:
2567
1969
  default:
2568
- TypedKeyframeTrack = VectorKeyframeTrack;
1970
+ TypedKeyframeTrack = THREE.VectorKeyframeTrack;
2569
1971
  break;
2570
1972
  }
2571
-
2572
1973
  const targetName = node.name ? node.name : node.uuid;
2573
- const interpolation = sampler.interpolation !== undefined ? INTERPOLATION[sampler.interpolation] : InterpolateLinear;
1974
+ const interpolation = sampler.interpolation !== void 0 ? INTERPOLATION[sampler.interpolation] : THREE.InterpolateLinear;
2574
1975
  const targetNames = [];
2575
-
2576
1976
  if (PATH_PROPERTIES[target.path] === PATH_PROPERTIES.weights) {
2577
- node.traverse(function (object) {
1977
+ node.traverse(function(object) {
2578
1978
  if (object.morphTargetInfluences) {
2579
1979
  targetNames.push(object.name ? object.name : object.uuid);
2580
1980
  }
@@ -2582,427 +1982,318 @@ class GLTFParser {
2582
1982
  } else {
2583
1983
  targetNames.push(targetName);
2584
1984
  }
2585
-
2586
1985
  let outputArray = outputAccessor.array;
2587
-
2588
1986
  if (outputAccessor.normalized) {
2589
1987
  const scale = getNormalizedComponentScale(outputArray.constructor);
2590
1988
  const scaled = new Float32Array(outputArray.length);
2591
-
2592
1989
  for (let j = 0, jl = outputArray.length; j < jl; j++) {
2593
1990
  scaled[j] = outputArray[j] * scale;
2594
1991
  }
2595
-
2596
1992
  outputArray = scaled;
2597
1993
  }
2598
-
2599
1994
  for (let j = 0, jl = targetNames.length; j < jl; j++) {
2600
- const track = new TypedKeyframeTrack(targetNames[j] + '.' + PATH_PROPERTIES[target.path], inputAccessor.array, outputArray, interpolation); // Override interpolation with custom factory method.
2601
-
2602
- if (sampler.interpolation === 'CUBICSPLINE') {
1995
+ const track = new TypedKeyframeTrack(
1996
+ targetNames[j] + "." + PATH_PROPERTIES[target.path],
1997
+ inputAccessor.array,
1998
+ outputArray,
1999
+ interpolation
2000
+ );
2001
+ if (sampler.interpolation === "CUBICSPLINE") {
2603
2002
  track.createInterpolant = function InterpolantFactoryMethodGLTFCubicSpline(result) {
2604
- // A CUBICSPLINE keyframe in glTF has three output values for each input value,
2605
- // representing inTangent, splineVertex, and outTangent. As a result, track.getValueSize()
2606
- // must be divided by three to get the interpolant's sampleSize argument.
2607
- const interpolantType = this instanceof QuaternionKeyframeTrack ? GLTFCubicSplineQuaternionInterpolant : GLTFCubicSplineInterpolant;
2003
+ const interpolantType = this instanceof THREE.QuaternionKeyframeTrack ? GLTFCubicSplineQuaternionInterpolant : GLTFCubicSplineInterpolant;
2608
2004
  return new interpolantType(this.times, this.values, this.getValueSize() / 3, result);
2609
- }; // Mark as CUBICSPLINE. `track.getInterpolation()` doesn't support custom interpolants.
2610
-
2611
-
2005
+ };
2612
2006
  track.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline = true;
2613
2007
  }
2614
-
2615
2008
  tracks.push(track);
2616
2009
  }
2617
2010
  }
2618
-
2619
- const name = animationDef.name ? animationDef.name : 'animation_' + animationIndex;
2620
- return new AnimationClip(name, undefined, tracks);
2011
+ const name = animationDef.name ? animationDef.name : "animation_" + animationIndex;
2012
+ return new THREE.AnimationClip(name, void 0, tracks);
2621
2013
  });
2622
2014
  }
2623
-
2624
2015
  createNodeMesh(nodeIndex) {
2625
2016
  const json = this.json;
2626
2017
  const parser = this;
2627
2018
  const nodeDef = json.nodes[nodeIndex];
2628
- if (nodeDef.mesh === undefined) return null;
2629
- return parser.getDependency('mesh', nodeDef.mesh).then(function (mesh) {
2630
- const node = parser._getNodeRef(parser.meshCache, nodeDef.mesh, mesh); // if weights are provided on the node, override weights on the mesh.
2631
-
2632
-
2633
- if (nodeDef.weights !== undefined) {
2634
- node.traverse(function (o) {
2635
- if (!o.isMesh) return;
2636
-
2019
+ if (nodeDef.mesh === void 0)
2020
+ return null;
2021
+ return parser.getDependency("mesh", nodeDef.mesh).then(function(mesh) {
2022
+ const node = parser._getNodeRef(parser.meshCache, nodeDef.mesh, mesh);
2023
+ if (nodeDef.weights !== void 0) {
2024
+ node.traverse(function(o) {
2025
+ if (!o.isMesh)
2026
+ return;
2637
2027
  for (let i = 0, il = nodeDef.weights.length; i < il; i++) {
2638
2028
  o.morphTargetInfluences[i] = nodeDef.weights[i];
2639
2029
  }
2640
2030
  });
2641
2031
  }
2642
-
2643
2032
  return node;
2644
2033
  });
2645
2034
  }
2646
- /**
2647
- * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#nodes-and-hierarchy
2648
- * @param {number} nodeIndex
2649
- * @return {Promise<Object3D>}
2650
- */
2651
-
2652
-
2653
2035
  loadNode(nodeIndex) {
2654
2036
  const json = this.json;
2655
2037
  const extensions = this.extensions;
2656
2038
  const parser = this;
2657
- const nodeDef = json.nodes[nodeIndex]; // reserve node's name before its dependencies, so the root has the intended name.
2658
-
2659
- const nodeName = nodeDef.name ? parser.createUniqueName(nodeDef.name) : '';
2660
- return function () {
2039
+ const nodeDef = json.nodes[nodeIndex];
2040
+ const nodeName = nodeDef.name ? parser.createUniqueName(nodeDef.name) : "";
2041
+ return function() {
2661
2042
  const pending = [];
2662
-
2663
- const meshPromise = parser._invokeOne(function (ext) {
2043
+ const meshPromise = parser._invokeOne(function(ext) {
2664
2044
  return ext.createNodeMesh && ext.createNodeMesh(nodeIndex);
2665
2045
  });
2666
-
2667
2046
  if (meshPromise) {
2668
2047
  pending.push(meshPromise);
2669
2048
  }
2670
-
2671
- if (nodeDef.camera !== undefined) {
2672
- pending.push(parser.getDependency('camera', nodeDef.camera).then(function (camera) {
2673
- return parser._getNodeRef(parser.cameraCache, nodeDef.camera, camera);
2674
- }));
2049
+ if (nodeDef.camera !== void 0) {
2050
+ pending.push(
2051
+ parser.getDependency("camera", nodeDef.camera).then(function(camera) {
2052
+ return parser._getNodeRef(parser.cameraCache, nodeDef.camera, camera);
2053
+ })
2054
+ );
2675
2055
  }
2676
-
2677
- parser._invokeAll(function (ext) {
2056
+ parser._invokeAll(function(ext) {
2678
2057
  return ext.createNodeAttachment && ext.createNodeAttachment(nodeIndex);
2679
- }).forEach(function (promise) {
2058
+ }).forEach(function(promise) {
2680
2059
  pending.push(promise);
2681
2060
  });
2682
-
2683
2061
  return Promise.all(pending);
2684
- }().then(function (objects) {
2685
- let node; // .isBone isn't in glTF spec. See ._markDefs
2686
-
2062
+ }().then(function(objects) {
2063
+ let node;
2687
2064
  if (nodeDef.isBone === true) {
2688
- node = new Bone();
2065
+ node = new THREE.Bone();
2689
2066
  } else if (objects.length > 1) {
2690
- node = new Group();
2067
+ node = new THREE.Group();
2691
2068
  } else if (objects.length === 1) {
2692
2069
  node = objects[0];
2693
2070
  } else {
2694
- node = new Object3D();
2071
+ node = new THREE.Object3D();
2695
2072
  }
2696
-
2697
2073
  if (node !== objects[0]) {
2698
2074
  for (let i = 0, il = objects.length; i < il; i++) {
2699
2075
  node.add(objects[i]);
2700
2076
  }
2701
2077
  }
2702
-
2703
2078
  if (nodeDef.name) {
2704
2079
  node.userData.name = nodeDef.name;
2705
2080
  node.name = nodeName;
2706
2081
  }
2707
-
2708
2082
  assignExtrasToUserData(node, nodeDef);
2709
- if (nodeDef.extensions) addUnknownExtensionsToUserData(extensions, node, nodeDef);
2710
-
2711
- if (nodeDef.matrix !== undefined) {
2712
- const matrix = new Matrix4();
2083
+ if (nodeDef.extensions)
2084
+ addUnknownExtensionsToUserData(extensions, node, nodeDef);
2085
+ if (nodeDef.matrix !== void 0) {
2086
+ const matrix = new THREE.Matrix4();
2713
2087
  matrix.fromArray(nodeDef.matrix);
2714
2088
  node.applyMatrix4(matrix);
2715
2089
  } else {
2716
- if (nodeDef.translation !== undefined) {
2090
+ if (nodeDef.translation !== void 0) {
2717
2091
  node.position.fromArray(nodeDef.translation);
2718
2092
  }
2719
-
2720
- if (nodeDef.rotation !== undefined) {
2093
+ if (nodeDef.rotation !== void 0) {
2721
2094
  node.quaternion.fromArray(nodeDef.rotation);
2722
2095
  }
2723
-
2724
- if (nodeDef.scale !== undefined) {
2096
+ if (nodeDef.scale !== void 0) {
2725
2097
  node.scale.fromArray(nodeDef.scale);
2726
2098
  }
2727
2099
  }
2728
-
2729
2100
  if (!parser.associations.has(node)) {
2730
2101
  parser.associations.set(node, {});
2731
2102
  }
2732
-
2733
2103
  parser.associations.get(node).nodes = nodeIndex;
2734
2104
  return node;
2735
2105
  });
2736
2106
  }
2737
- /**
2738
- * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#scenes
2739
- * @param {number} sceneIndex
2740
- * @return {Promise<Group>}
2741
- */
2742
-
2743
-
2744
2107
  loadScene(sceneIndex) {
2745
2108
  const json = this.json;
2746
2109
  const extensions = this.extensions;
2747
2110
  const sceneDef = this.json.scenes[sceneIndex];
2748
- const parser = this; // Loader returns Group, not Scene.
2749
- // See: https://github.com/mrdoob/three.js/issues/18342#issuecomment-578981172
2750
-
2751
- const scene = new Group();
2752
- if (sceneDef.name) scene.name = parser.createUniqueName(sceneDef.name);
2111
+ const parser = this;
2112
+ const scene = new THREE.Group();
2113
+ if (sceneDef.name)
2114
+ scene.name = parser.createUniqueName(sceneDef.name);
2753
2115
  assignExtrasToUserData(scene, sceneDef);
2754
- if (sceneDef.extensions) addUnknownExtensionsToUserData(extensions, scene, sceneDef);
2116
+ if (sceneDef.extensions)
2117
+ addUnknownExtensionsToUserData(extensions, scene, sceneDef);
2755
2118
  const nodeIds = sceneDef.nodes || [];
2756
2119
  const pending = [];
2757
-
2758
2120
  for (let i = 0, il = nodeIds.length; i < il; i++) {
2759
2121
  pending.push(buildNodeHierarchy(nodeIds[i], scene, json, parser));
2760
2122
  }
2761
-
2762
- return Promise.all(pending).then(function () {
2763
- // Removes dangling associations, associations that reference a node that
2764
- // didn't make it into the scene.
2765
- const reduceAssociations = node => {
2766
- const reducedAssociations = new Map();
2767
-
2123
+ return Promise.all(pending).then(function() {
2124
+ const reduceAssociations = (node) => {
2125
+ const reducedAssociations = /* @__PURE__ */ new Map();
2768
2126
  for (const [key, value] of parser.associations) {
2769
- if (key instanceof Material || key instanceof Texture) {
2127
+ if (key instanceof THREE.Material || key instanceof THREE.Texture) {
2770
2128
  reducedAssociations.set(key, value);
2771
2129
  }
2772
2130
  }
2773
-
2774
- node.traverse(node => {
2775
- const mappings = parser.associations.get(node);
2776
-
2131
+ node.traverse((node2) => {
2132
+ const mappings = parser.associations.get(node2);
2777
2133
  if (mappings != null) {
2778
- reducedAssociations.set(node, mappings);
2134
+ reducedAssociations.set(node2, mappings);
2779
2135
  }
2780
2136
  });
2781
2137
  return reducedAssociations;
2782
2138
  };
2783
-
2784
2139
  parser.associations = reduceAssociations(scene);
2785
2140
  return scene;
2786
2141
  });
2787
2142
  }
2788
-
2789
2143
  }
2790
-
2791
2144
  function buildNodeHierarchy(nodeId, parentObject, json, parser) {
2792
2145
  const nodeDef = json.nodes[nodeId];
2793
- return parser.getDependency('node', nodeId).then(function (node) {
2794
- if (nodeDef.skin === undefined) return node; // build skeleton here as well
2795
-
2146
+ return parser.getDependency("node", nodeId).then(function(node) {
2147
+ if (nodeDef.skin === void 0)
2148
+ return node;
2796
2149
  let skinEntry;
2797
- return parser.getDependency('skin', nodeDef.skin).then(function (skin) {
2150
+ return parser.getDependency("skin", nodeDef.skin).then(function(skin) {
2798
2151
  skinEntry = skin;
2799
2152
  const pendingJoints = [];
2800
-
2801
2153
  for (let i = 0, il = skinEntry.joints.length; i < il; i++) {
2802
- pendingJoints.push(parser.getDependency('node', skinEntry.joints[i]));
2154
+ pendingJoints.push(parser.getDependency("node", skinEntry.joints[i]));
2803
2155
  }
2804
-
2805
2156
  return Promise.all(pendingJoints);
2806
- }).then(function (jointNodes) {
2807
- node.traverse(function (mesh) {
2808
- if (!mesh.isMesh) return;
2157
+ }).then(function(jointNodes) {
2158
+ node.traverse(function(mesh) {
2159
+ if (!mesh.isMesh)
2160
+ return;
2809
2161
  const bones = [];
2810
2162
  const boneInverses = [];
2811
-
2812
2163
  for (let j = 0, jl = jointNodes.length; j < jl; j++) {
2813
2164
  const jointNode = jointNodes[j];
2814
-
2815
2165
  if (jointNode) {
2816
2166
  bones.push(jointNode);
2817
- const mat = new Matrix4();
2818
-
2819
- if (skinEntry.inverseBindMatrices !== undefined) {
2167
+ const mat = new THREE.Matrix4();
2168
+ if (skinEntry.inverseBindMatrices !== void 0) {
2820
2169
  mat.fromArray(skinEntry.inverseBindMatrices.array, j * 16);
2821
2170
  }
2822
-
2823
2171
  boneInverses.push(mat);
2824
2172
  } else {
2825
2173
  console.warn('THREE.GLTFLoader: Joint "%s" could not be found.', skinEntry.joints[j]);
2826
2174
  }
2827
2175
  }
2828
-
2829
- mesh.bind(new Skeleton(bones, boneInverses), mesh.matrixWorld);
2176
+ mesh.bind(new THREE.Skeleton(bones, boneInverses), mesh.matrixWorld);
2830
2177
  });
2831
2178
  return node;
2832
2179
  });
2833
- }).then(function (node) {
2834
- // build node hierachy
2180
+ }).then(function(node) {
2835
2181
  parentObject.add(node);
2836
2182
  const pending = [];
2837
-
2838
2183
  if (nodeDef.children) {
2839
2184
  const children = nodeDef.children;
2840
-
2841
2185
  for (let i = 0, il = children.length; i < il; i++) {
2842
2186
  const child = children[i];
2843
2187
  pending.push(buildNodeHierarchy(child, node, json, parser));
2844
2188
  }
2845
2189
  }
2846
-
2847
2190
  return Promise.all(pending);
2848
2191
  });
2849
2192
  }
2850
- /**
2851
- * @param {BufferGeometry} geometry
2852
- * @param {GLTF.Primitive} primitiveDef
2853
- * @param {GLTFParser} parser
2854
- */
2855
-
2856
-
2857
2193
  function computeBounds(geometry, primitiveDef, parser) {
2858
2194
  const attributes = primitiveDef.attributes;
2859
- const box = new Box3();
2860
-
2861
- if (attributes.POSITION !== undefined) {
2195
+ const box = new THREE.Box3();
2196
+ if (attributes.POSITION !== void 0) {
2862
2197
  const accessor = parser.json.accessors[attributes.POSITION];
2863
2198
  const min = accessor.min;
2864
- const max = accessor.max; // glTF requires 'min' and 'max', but VRM (which extends glTF) currently ignores that requirement.
2865
-
2866
- if (min !== undefined && max !== undefined) {
2867
- box.set(new Vector3(min[0], min[1], min[2]), new Vector3(max[0], max[1], max[2]));
2868
-
2199
+ const max = accessor.max;
2200
+ if (min !== void 0 && max !== void 0) {
2201
+ box.set(new THREE.Vector3(min[0], min[1], min[2]), new THREE.Vector3(max[0], max[1], max[2]));
2869
2202
  if (accessor.normalized) {
2870
2203
  const boxScale = getNormalizedComponentScale(WEBGL_COMPONENT_TYPES[accessor.componentType]);
2871
2204
  box.min.multiplyScalar(boxScale);
2872
2205
  box.max.multiplyScalar(boxScale);
2873
2206
  }
2874
2207
  } else {
2875
- console.warn('THREE.GLTFLoader: Missing min/max properties for accessor POSITION.');
2208
+ console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");
2876
2209
  return;
2877
2210
  }
2878
2211
  } else {
2879
2212
  return;
2880
2213
  }
2881
-
2882
2214
  const targets = primitiveDef.targets;
2883
-
2884
- if (targets !== undefined) {
2885
- const maxDisplacement = new Vector3();
2886
- const vector = new Vector3();
2887
-
2215
+ if (targets !== void 0) {
2216
+ const maxDisplacement = new THREE.Vector3();
2217
+ const vector = new THREE.Vector3();
2888
2218
  for (let i = 0, il = targets.length; i < il; i++) {
2889
2219
  const target = targets[i];
2890
-
2891
- if (target.POSITION !== undefined) {
2220
+ if (target.POSITION !== void 0) {
2892
2221
  const accessor = parser.json.accessors[target.POSITION];
2893
2222
  const min = accessor.min;
2894
- const max = accessor.max; // glTF requires 'min' and 'max', but VRM (which extends glTF) currently ignores that requirement.
2895
-
2896
- if (min !== undefined && max !== undefined) {
2897
- // we need to get max of absolute components because target weight is [-1,1]
2223
+ const max = accessor.max;
2224
+ if (min !== void 0 && max !== void 0) {
2898
2225
  vector.setX(Math.max(Math.abs(min[0]), Math.abs(max[0])));
2899
2226
  vector.setY(Math.max(Math.abs(min[1]), Math.abs(max[1])));
2900
2227
  vector.setZ(Math.max(Math.abs(min[2]), Math.abs(max[2])));
2901
-
2902
2228
  if (accessor.normalized) {
2903
2229
  const boxScale = getNormalizedComponentScale(WEBGL_COMPONENT_TYPES[accessor.componentType]);
2904
2230
  vector.multiplyScalar(boxScale);
2905
- } // Note: this assumes that the sum of all weights is at most 1. This isn't quite correct - it's more conservative
2906
- // to assume that each target can have a max weight of 1. However, for some use cases - notably, when morph targets
2907
- // are used to implement key-frame animations and as such only two are active at a time - this results in very large
2908
- // boxes. So for now we make a box that's sometimes a touch too small but is hopefully mostly of reasonable size.
2909
-
2910
-
2231
+ }
2911
2232
  maxDisplacement.max(vector);
2912
2233
  } else {
2913
- console.warn('THREE.GLTFLoader: Missing min/max properties for accessor POSITION.');
2234
+ console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");
2914
2235
  }
2915
2236
  }
2916
- } // As per comment above this box isn't conservative, but has a reasonable size for a very large number of morph targets.
2917
-
2918
-
2237
+ }
2919
2238
  box.expandByVector(maxDisplacement);
2920
2239
  }
2921
-
2922
2240
  geometry.boundingBox = box;
2923
- const sphere = new Sphere();
2241
+ const sphere = new THREE.Sphere();
2924
2242
  box.getCenter(sphere.center);
2925
2243
  sphere.radius = box.min.distanceTo(box.max) / 2;
2926
2244
  geometry.boundingSphere = sphere;
2927
2245
  }
2928
- /**
2929
- * @param {BufferGeometry} geometry
2930
- * @param {GLTF.Primitive} primitiveDef
2931
- * @param {GLTFParser} parser
2932
- * @return {Promise<BufferGeometry>}
2933
- */
2934
-
2935
-
2936
2246
  function addPrimitiveAttributes(geometry, primitiveDef, parser) {
2937
2247
  const attributes = primitiveDef.attributes;
2938
2248
  const pending = [];
2939
-
2940
2249
  function assignAttributeAccessor(accessorIndex, attributeName) {
2941
- return parser.getDependency('accessor', accessorIndex).then(function (accessor) {
2250
+ return parser.getDependency("accessor", accessorIndex).then(function(accessor) {
2942
2251
  geometry.setAttribute(attributeName, accessor);
2943
2252
  });
2944
2253
  }
2945
-
2946
2254
  for (const gltfAttributeName in attributes) {
2947
- const threeAttributeName = ATTRIBUTES[gltfAttributeName] || gltfAttributeName.toLowerCase(); // Skip attributes already provided by e.g. Draco extension.
2948
-
2949
- if (threeAttributeName in geometry.attributes) continue;
2255
+ const threeAttributeName = ATTRIBUTES[gltfAttributeName] || gltfAttributeName.toLowerCase();
2256
+ if (threeAttributeName in geometry.attributes)
2257
+ continue;
2950
2258
  pending.push(assignAttributeAccessor(attributes[gltfAttributeName], threeAttributeName));
2951
2259
  }
2952
-
2953
- if (primitiveDef.indices !== undefined && !geometry.index) {
2954
- const accessor = parser.getDependency('accessor', primitiveDef.indices).then(function (accessor) {
2955
- geometry.setIndex(accessor);
2260
+ if (primitiveDef.indices !== void 0 && !geometry.index) {
2261
+ const accessor = parser.getDependency("accessor", primitiveDef.indices).then(function(accessor2) {
2262
+ geometry.setIndex(accessor2);
2956
2263
  });
2957
2264
  pending.push(accessor);
2958
2265
  }
2959
-
2960
2266
  assignExtrasToUserData(geometry, primitiveDef);
2961
2267
  computeBounds(geometry, primitiveDef, parser);
2962
- return Promise.all(pending).then(function () {
2963
- return primitiveDef.targets !== undefined ? addMorphTargets(geometry, primitiveDef.targets, parser) : geometry;
2268
+ return Promise.all(pending).then(function() {
2269
+ return primitiveDef.targets !== void 0 ? addMorphTargets(geometry, primitiveDef.targets, parser) : geometry;
2964
2270
  });
2965
2271
  }
2966
- /**
2967
- * @param {BufferGeometry} geometry
2968
- * @param {Number} drawMode
2969
- * @return {BufferGeometry}
2970
- */
2971
-
2972
-
2973
2272
  function toTrianglesDrawMode(geometry, drawMode) {
2974
- let index = geometry.getIndex(); // generate index if not present
2975
-
2273
+ let index = geometry.getIndex();
2976
2274
  if (index === null) {
2977
2275
  const indices = [];
2978
- const position = geometry.getAttribute('position');
2979
-
2980
- if (position !== undefined) {
2276
+ const position = geometry.getAttribute("position");
2277
+ if (position !== void 0) {
2981
2278
  for (let i = 0; i < position.count; i++) {
2982
2279
  indices.push(i);
2983
2280
  }
2984
-
2985
2281
  geometry.setIndex(indices);
2986
2282
  index = geometry.getIndex();
2987
2283
  } else {
2988
- console.error('THREE.GLTFLoader.toTrianglesDrawMode(): Undefined position attribute. Processing not possible.');
2284
+ console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Undefined position attribute. Processing not possible.");
2989
2285
  return geometry;
2990
2286
  }
2991
- } //
2992
-
2993
-
2287
+ }
2994
2288
  const numberOfTriangles = index.count - 2;
2995
2289
  const newIndices = [];
2996
-
2997
- if (drawMode === TriangleFanDrawMode) {
2998
- // gl.TRIANGLE_FAN
2290
+ if (drawMode === THREE.TriangleFanDrawMode) {
2999
2291
  for (let i = 1; i <= numberOfTriangles; i++) {
3000
2292
  newIndices.push(index.getX(0));
3001
2293
  newIndices.push(index.getX(i));
3002
2294
  newIndices.push(index.getX(i + 1));
3003
2295
  }
3004
2296
  } else {
3005
- // gl.TRIANGLE_STRIP
3006
2297
  for (let i = 0; i < numberOfTriangles; i++) {
3007
2298
  if (i % 2 === 0) {
3008
2299
  newIndices.push(index.getX(i));
@@ -3015,15 +2306,11 @@ function toTrianglesDrawMode(geometry, drawMode) {
3015
2306
  }
3016
2307
  }
3017
2308
  }
3018
-
3019
2309
  if (newIndices.length / 3 !== numberOfTriangles) {
3020
- console.error('THREE.GLTFLoader.toTrianglesDrawMode(): Unable to generate correct amount of triangles.');
3021
- } // build final geometry
3022
-
3023
-
2310
+ console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");
2311
+ }
3024
2312
  const newGeometry = geometry.clone();
3025
2313
  newGeometry.setIndex(newIndices);
3026
2314
  return newGeometry;
3027
2315
  }
3028
-
3029
- export { GLTFLoader };
2316
+ exports.GLTFLoader = GLTFLoader;