@vincentt-xr/sdk 2.0.0-alpha.8 → 2.0.0-alpha.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (517) hide show
  1. package/GROUNDING.md +4643 -170
  2. package/README.md +1 -0
  3. package/dist/CanonicalHeadFrame-BHcWyaiK.js +1506 -0
  4. package/dist/CanonicalHeadFrame-D-_T1OMU.cjs +1 -0
  5. package/dist/DebuggerUI-7ngnJsBe.js +275 -0
  6. package/dist/DebuggerUI-CoglgKdO.cjs +1 -0
  7. package/dist/FaceRetouch-CLoTfrcs.js +1071 -0
  8. package/dist/FaceRetouch-J1lC1WbS.cjs +134 -0
  9. package/dist/FaceSurface-CHAMEeG1.cjs +1 -0
  10. package/dist/FaceSurface-DmP9AEeC.js +27 -0
  11. package/dist/SegmentationOverlay-D_FWkcyP.cjs +35 -0
  12. package/dist/SegmentationOverlay-vn5x_knv.js +6237 -0
  13. package/dist/SkeletonUtils-C2r90MtN.js +21 -0
  14. package/dist/SkeletonUtils-CddIup1F.cjs +1 -0
  15. package/dist/TextLabel-XE0rQSDn.cjs +2 -0
  16. package/dist/TextLabel-c9BCucOI.js +961 -0
  17. package/dist/assets/gltfLoader.d.ts +16 -0
  18. package/dist/assets/loaders.d.ts +16 -1
  19. package/dist/body-pose/index.d.ts +521 -0
  20. package/dist/body-trigger/__fixtures__/syntheticBody.d.ts +83 -0
  21. package/dist/body-trigger/frame.d.ts +88 -0
  22. package/dist/body-trigger/index.d.ts +6 -0
  23. package/dist/body-trigger/moves.d.ts +235 -0
  24. package/dist/body-trigger/trigger.d.ts +75 -0
  25. package/dist/calibration/calibration.d.ts +11 -6
  26. package/dist/canonicalFace-BHwyCx1c.js +9 -0
  27. package/dist/canonicalFace-C83I225R.cjs +1 -0
  28. package/dist/components/BodyInstruction/BodyPoseHint.d.ts +63 -0
  29. package/dist/components/BodyInstruction/index.d.ts +69 -0
  30. package/dist/components/BodyInstruction/useBodyPose.d.ts +23 -0
  31. package/dist/components/BodyTracker/index.d.ts +10 -2
  32. package/dist/components/BodyTrigger/index.d.ts +49 -0
  33. package/dist/components/Debugger/DebuggerProvider.d.ts +14 -1
  34. package/dist/components/Debugger/DebuggerUI.d.ts +3 -1
  35. package/dist/components/FaceAtlas/FaceAtlasLayer.d.ts +114 -0
  36. package/dist/components/FaceAtlas/MadeUpCamera.d.ts +80 -0
  37. package/dist/components/FaceAtlas/constants.d.ts +8 -0
  38. package/dist/components/FaceAtlas/index.d.ts +7 -0
  39. package/dist/components/FaceAtlas/useFaceAtlasSurface.d.ts +84 -0
  40. package/dist/components/FaceAtlas/useFaceSkin.d.ts +84 -0
  41. package/dist/components/FaceCharacter/ExternalFaceMesh.d.ts +109 -0
  42. package/dist/components/FaceCharacter/FaceExpressionController.d.ts +53 -0
  43. package/dist/components/FaceCharacter/FaceMorph.d.ts +71 -0
  44. package/dist/components/FaceCharacter/FacePiercing.d.ts +65 -0
  45. package/dist/components/FaceCharacter/FaceReprojection.d.ts +85 -0
  46. package/dist/components/FaceCharacter/FaceRig.d.ts +38 -0
  47. package/dist/components/FaceCharacter/FaceSurface.d.ts +49 -0
  48. package/dist/components/FaceCharacter/FaceSurfaceOccluder.d.ts +39 -0
  49. package/dist/components/FaceCharacter/PinToFaceMesh.d.ts +68 -0
  50. package/dist/components/FaceCharacter/index.d.ts +18 -0
  51. package/dist/components/FaceCharacter/useFaceReprojector.d.ts +10 -0
  52. package/dist/components/FaceInset/FaceInset.d.ts +68 -0
  53. package/dist/components/FaceInset/frame.d.ts +94 -0
  54. package/dist/components/FaceInset/index.d.ts +6 -0
  55. package/dist/components/FaceInset/material.d.ts +40 -0
  56. package/dist/components/FaceInset/useFaceInsetTexture.d.ts +37 -0
  57. package/dist/components/FaceInstruction/FaceExpressionHint.d.ts +43 -0
  58. package/dist/components/FaceInstruction/index.d.ts +56 -0
  59. package/dist/components/FaceInstruction/useFaceExpression.d.ts +20 -0
  60. package/dist/components/FaceLiquify/FaceLiquify.d.ts +49 -0
  61. package/dist/components/FaceLiquify/debug.d.ts +37 -0
  62. package/dist/components/FaceLiquify/frame.d.ts +55 -0
  63. package/dist/components/FaceLiquify/index.d.ts +10 -0
  64. package/dist/components/FaceLiquify/material.d.ts +39 -0
  65. package/dist/components/FaceLiquify/pass.d.ts +49 -0
  66. package/dist/components/FaceLiquify/presence.d.ts +25 -0
  67. package/dist/components/FaceLiquify/presets.d.ts +82 -0
  68. package/dist/components/FaceLiquify/selfTest.d.ts +66 -0
  69. package/dist/components/FaceLiquify/target.d.ts +85 -0
  70. package/dist/components/FaceLiquify/warp.d.ts +72 -0
  71. package/dist/components/FaceMesh/canonical/CanonicalFaceMeshRenderer.d.ts +5 -3
  72. package/dist/components/FaceMesh/canonical/geometryGroups.d.ts +21 -0
  73. package/dist/components/FaceMesh/canonical/parseCanonicalFaceModel.d.ts +9 -0
  74. package/dist/components/FaceMesh/index.d.ts +1 -1
  75. package/dist/components/FaceRetouch/Background.d.ts +3 -1
  76. package/dist/components/FaceRetouch/FaceRetouch.d.ts +5 -0
  77. package/dist/components/FaceRetouch/renderState.d.ts +19 -0
  78. package/dist/components/FaceSwap/FaceMirror.d.ts +46 -0
  79. package/dist/components/FaceSwap/FaceSwap.d.ts +58 -0
  80. package/dist/components/FaceSwap/FaceTextureLayer.d.ts +72 -0
  81. package/dist/components/FaceSwap/faceSwapPlan.d.ts +91 -0
  82. package/dist/components/FaceSwap/index.d.ts +13 -0
  83. package/dist/components/FaceSwap/settings.d.ts +300 -0
  84. package/dist/components/FaceSwap/useFaceTexture.d.ts +35 -0
  85. package/dist/components/FaceSwap/useLiveFace.d.ts +38 -0
  86. package/dist/components/FaceSwap/useLiveFaceTexture.d.ts +31 -0
  87. package/dist/components/FaceWarp3D/FaceWarp3D.d.ts +50 -0
  88. package/dist/components/FaceWarp3D/index.d.ts +2 -3
  89. package/dist/components/Faceless/Faceless.d.ts +51 -0
  90. package/dist/components/Faceless/index.d.ts +2 -0
  91. package/dist/components/HairLock/HairLock.d.ts +39 -0
  92. package/dist/components/HairLock/index.d.ts +2 -0
  93. package/dist/components/HairLock/lockGeometry.d.ts +15 -0
  94. package/dist/components/HandCutout/index.d.ts +35 -0
  95. package/dist/components/HandInstruction/HandGestureHint.d.ts +70 -0
  96. package/dist/components/HandInstruction/index.d.ts +74 -0
  97. package/dist/components/HandInstruction/useHandGesture.d.ts +22 -0
  98. package/dist/components/HandRig/ForearmOccluder.d.ts +29 -0
  99. package/dist/components/HandRig/HandAttachment.d.ts +34 -0
  100. package/dist/components/HandRig/HandOccluder.d.ts +55 -0
  101. package/dist/components/HandRig/HandTattoo.d.ts +61 -0
  102. package/dist/components/HandRig/WristAttachment.d.ts +34 -0
  103. package/dist/components/HandRig/index.d.ts +101 -0
  104. package/dist/components/HandRig/useArmMask.d.ts +29 -0
  105. package/dist/components/HandRig/wristSolve.d.ts +69 -0
  106. package/dist/components/HandTouch/HandTouch.d.ts +62 -0
  107. package/dist/components/HandTouch/Touchable.d.ts +36 -0
  108. package/dist/components/HandTouch/index.d.ts +2 -0
  109. package/dist/components/HeadBinding/index.d.ts +14 -0
  110. package/dist/components/HeadOccluder/CanonicalHeadFrame.d.ts +22 -0
  111. package/dist/components/HeadOccluder/Earrings.d.ts +55 -0
  112. package/dist/components/HeadOccluder/HeadAttachment.d.ts +38 -0
  113. package/dist/components/HeadOccluder/NeckOccluder.d.ts +64 -0
  114. package/dist/components/HeadOccluder/earringPlacement.d.ts +31 -0
  115. package/dist/components/HeadOccluder/headAttachmentPoints.d.ts +69 -0
  116. package/dist/components/HeadOccluder/index.d.ts +57 -3
  117. package/dist/components/HeadOccluder/useCanonicalHeadFit.d.ts +36 -0
  118. package/dist/components/HeadOccluder/useLandmarkPoseFit.d.ts +80 -0
  119. package/dist/components/Instruction/HintStage.d.ts +29 -0
  120. package/dist/components/Instruction/InstructionCue.d.ts +126 -0
  121. package/dist/components/Instruction/gestureHold.d.ts +20 -0
  122. package/dist/components/Instruction/ghost.d.ts +129 -0
  123. package/dist/components/Instruction/hintBlend.d.ts +19 -0
  124. package/dist/components/Instruction/hintLook.d.ts +81 -0
  125. package/dist/components/Instruction/hintLoop.d.ts +36 -0
  126. package/dist/components/Instruction/index.d.ts +41 -0
  127. package/dist/components/Instruction/useGhostModel.d.ts +33 -0
  128. package/dist/components/Instruction/useInstructionHold.d.ts +72 -0
  129. package/dist/components/LipEffect/LipEffect.d.ts +22 -2
  130. package/dist/components/LipEffect/LipEffectMaterial.d.ts +62 -10
  131. package/dist/components/LipEffect/LipEffects.d.ts +5 -2
  132. package/dist/components/LipEffect/defaults.d.ts +21 -2
  133. package/dist/components/LipEffect/index.d.ts +1 -1
  134. package/dist/components/LipEffect/lipShading.d.ts +73 -0
  135. package/dist/components/LipEffect/settings.d.ts +117 -13
  136. package/dist/components/LipEffect/shader.d.ts +39 -0
  137. package/dist/components/LipEffect/types.d.ts +82 -10
  138. package/dist/components/LipEffect/useLipDesignTextures.d.ts +6 -0
  139. package/dist/components/LipEffect/uvGuide.d.ts +31 -16
  140. package/dist/components/Makeup/Blush.d.ts +18 -0
  141. package/dist/components/Makeup/Brows.d.ts +20 -0
  142. package/dist/components/Makeup/Contour.d.ts +17 -0
  143. package/dist/components/Makeup/Eyeliner.d.ts +20 -0
  144. package/dist/components/Makeup/Eyeshadow.d.ts +20 -0
  145. package/dist/components/Makeup/Highlighter.d.ts +18 -0
  146. package/dist/components/Makeup/MakeupDesign.d.ts +37 -0
  147. package/dist/components/Makeup/MakeupRegion.d.ts +132 -0
  148. package/dist/components/Makeup/constants.d.ts +44 -0
  149. package/dist/components/Makeup/design.d.ts +106 -0
  150. package/dist/components/Makeup/designSamples.d.ts +42 -0
  151. package/dist/components/Makeup/eyes.d.ts +114 -0
  152. package/dist/components/Makeup/fields.d.ts +10 -0
  153. package/dist/components/Makeup/geometry.d.ts +106 -0
  154. package/dist/components/Makeup/index.d.ts +26 -0
  155. package/dist/components/Makeup/looks.d.ts +28 -0
  156. package/dist/components/Makeup/material.d.ts +239 -0
  157. package/dist/components/Makeup/settings.d.ts +54 -0
  158. package/dist/components/Makeup/shades.d.ts +143 -0
  159. package/dist/components/Makeup/shapes.d.ts +27 -0
  160. package/dist/components/Makeup/skinTone.d.ts +135 -0
  161. package/dist/components/Makeup/types.d.ts +110 -0
  162. package/dist/components/Makeup/useMakeupSkinTone.d.ts +40 -0
  163. package/dist/components/Necklace/Necklace.d.ts +44 -0
  164. package/dist/components/Necklace/index.d.ts +1 -0
  165. package/dist/components/ParticleEmitter/ParticleEmitter.d.ts +69 -0
  166. package/dist/components/ParticleEmitter/index.d.ts +1 -0
  167. package/dist/components/ShoulderOccluder/index.d.ts +43 -0
  168. package/dist/components/ShoulderOccluder/useCanonicalTorsoFit.d.ts +24 -0
  169. package/dist/components/SpringSwing/SpringSwing.d.ts +22 -0
  170. package/dist/components/SpringSwing/index.d.ts +1 -0
  171. package/dist/components/XRScene/renderOutputTarget.d.ts +12 -0
  172. package/dist/components/index.d.ts +8 -0
  173. package/dist/config/index.d.ts +0 -1
  174. package/dist/context-DTxSQvp4.js +13 -0
  175. package/dist/context-hA0Rb2Xa.cjs +1 -0
  176. package/dist/contexts-BH7PdKFS.cjs +1 -0
  177. package/dist/contexts-jak8-tND.js +667 -0
  178. package/dist/coordinates/index.d.ts +2 -0
  179. package/dist/coordinates/side.d.ts +40 -0
  180. package/dist/debug-ui/default-setting.cjs +2 -2
  181. package/dist/debug-ui/face-swap-settings/index.d.ts +22 -0
  182. package/dist/debug-ui/hierarchy-panel/index.d.ts +3 -2
  183. package/dist/debug-ui/index.d.ts +4 -3
  184. package/dist/debug-ui/media-source/index.d.ts +1 -1
  185. package/dist/debug-ui/media-source/session.d.ts +30 -2
  186. package/dist/debug-ui/media-source.cjs +1 -1
  187. package/dist/debug-ui/media-source.js +1 -1
  188. package/dist/debug-ui/object-inspector-panel/index.d.ts +3 -2
  189. package/dist/debug-ui/product-hotspots/index.d.ts +3 -2
  190. package/dist/debug-ui/scene-editor/hierarchy-panel.d.ts +3 -1
  191. package/dist/debug-ui/scene-editor/inspector-panel.d.ts +3 -1
  192. package/dist/debug-ui/screen-image-settings/index.d.ts +3 -1
  193. package/dist/debug-ui/screen-text-settings/ScreenTextSettingsPanel.d.ts +1 -1
  194. package/dist/debug-ui/screen-text-settings/types.d.ts +2 -0
  195. package/dist/debug-ui/settings-panel/index.d.ts +6 -1
  196. package/dist/debug-ui/shared/debugWindow.d.ts +51 -0
  197. package/dist/debug-ui/xr-diagnostics/index.d.ts +3 -2
  198. package/dist/debug-ui.cjs +3 -3
  199. package/dist/debug-ui.js +2250 -2472
  200. package/dist/entries/all.d.ts +3 -1
  201. package/dist/entries/core.d.ts +3 -2
  202. package/dist/entries/face-effects.d.ts +114 -8
  203. package/dist/entries/instructions.d.ts +48 -0
  204. package/dist/entries/internal.d.ts +2 -1
  205. package/dist/entries/low-level.d.ts +28 -1
  206. package/dist/entries/particles.d.ts +11 -0
  207. package/dist/entries/tracking.d.ts +37 -2
  208. package/dist/face-atlas/attributes.d.ts +30 -0
  209. package/dist/face-atlas/eyes.d.ts +272 -0
  210. package/dist/face-atlas/faceAtlas.generated.d.ts +46 -0
  211. package/dist/face-atlas/glsl/atlasVertex.d.ts +46 -0
  212. package/dist/face-atlas/glsl/common.d.ts +55 -0
  213. package/dist/face-atlas/glsl/design.d.ts +49 -0
  214. package/dist/face-atlas/glsl/eyes.d.ts +73 -0
  215. package/dist/face-atlas/glsl/finish.d.ts +24 -0
  216. package/dist/face-atlas/glsl/format.d.ts +4 -0
  217. package/dist/face-atlas/glsl/index.d.ts +59 -0
  218. package/dist/face-atlas/glsl/shading.d.ts +15 -0
  219. package/dist/face-atlas/glsl/shapes.d.ts +66 -0
  220. package/dist/face-atlas/glsl/sparkle.d.ts +19 -0
  221. package/dist/face-atlas/glsl/uniforms.d.ts +106 -0
  222. package/dist/face-atlas/guide.d.ts +51 -0
  223. package/dist/face-atlas/index.d.ts +25 -0
  224. package/dist/face-atlas/lead.d.ts +117 -0
  225. package/dist/face-atlas/madeUpCamera.d.ts +125 -0
  226. package/dist/face-atlas/masks.d.ts +53 -0
  227. package/dist/face-atlas/obj.d.ts +69 -0
  228. package/dist/face-atlas/polylines.d.ts +63 -0
  229. package/dist/face-atlas/probe/FaceSkinProbe.d.ts +208 -0
  230. package/dist/face-atlas/probe/__fixtures__/emulate.d.ts +9 -0
  231. package/dist/face-atlas/probe/__fixtures__/face.d.ts +24 -0
  232. package/dist/face-atlas/probe/constants.d.ts +137 -0
  233. package/dist/face-atlas/probe/glsl.d.ts +43 -0
  234. package/dist/face-atlas/probe/lightFit.d.ts +108 -0
  235. package/dist/face-atlas/probe/schedule.d.ts +44 -0
  236. package/dist/face-atlas/probe/selfTest.d.ts +87 -0
  237. package/dist/face-atlas/probe/stats.d.ts +143 -0
  238. package/dist/face-atlas/probe/targets.d.ts +70 -0
  239. package/dist/face-atlas/probe/unwrap.d.ts +76 -0
  240. package/dist/face-atlas/quality.d.ts +28 -0
  241. package/dist/face-atlas/regions.d.ts +31 -0
  242. package/dist/face-atlas/registry.d.ts +252 -0
  243. package/dist/face-atlas/renderState.d.ts +86 -0
  244. package/dist/face-atlas/selfOcclusion.d.ts +62 -0
  245. package/dist/face-atlas/shading.d.ts +406 -0
  246. package/dist/face-atlas/shapes.d.ts +86 -0
  247. package/dist/face-atlas/sides.d.ts +41 -0
  248. package/dist/face-atlas/skinMask.d.ts +35 -0
  249. package/dist/face-atlas/surface.d.ts +155 -0
  250. package/dist/face-atlas/topology.d.ts +44 -0
  251. package/dist/face-character/__fixtures__/faceImageDetections.d.ts +25 -0
  252. package/dist/face-character/__fixtures__/faceNode.d.ts +22 -0
  253. package/dist/face-character/bindFaceModel.d.ts +106 -0
  254. package/dist/face-character/canonicalFace.d.ts +17 -0
  255. package/dist/face-character/canonicalFaceGeometry.d.ts +11 -0
  256. package/dist/face-character/canonicalFacePositions.d.ts +7 -0
  257. package/dist/face-character/driveFaceModel.d.ts +57 -0
  258. package/dist/face-character/expressionOutputs.d.ts +45 -0
  259. package/dist/face-character/faceExpressions.d.ts +104 -0
  260. package/dist/face-character/faceImageLandmarker.d.ts +93 -0
  261. package/dist/face-character/faceMeshBinding.d.ts +62 -0
  262. package/dist/face-character/faceMorph.d.ts +77 -0
  263. package/dist/face-character/faceMorphs.d.ts +46 -0
  264. package/dist/face-character/facePhoto.d.ts +138 -0
  265. package/dist/face-character/facePiercings.d.ts +116 -0
  266. package/dist/face-character/facePin.d.ts +131 -0
  267. package/dist/face-character/faceReprojection.d.ts +273 -0
  268. package/dist/face-character/faceReprojector.d.ts +171 -0
  269. package/dist/face-character/faceRig.d.ts +176 -0
  270. package/dist/face-character/faceSwapPresence.d.ts +85 -0
  271. package/dist/face-character/faceTexture.d.ts +169 -0
  272. package/dist/face-character/faceTextureBaker.d.ts +86 -0
  273. package/dist/face-character/faceTextureGuide.d.ts +106 -0
  274. package/dist/face-character/faceTextureStats.d.ts +298 -0
  275. package/dist/face-character/faceTransfer.d.ts +396 -0
  276. package/dist/face-character/faceTransferGeometry.d.ts +109 -0
  277. package/dist/face-character/faceTransferSelfTest.d.ts +94 -0
  278. package/dist/face-character/faceWarp3D.d.ts +101 -0
  279. package/dist/face-character/faceless.d.ts +79 -0
  280. package/dist/face-character/featureWarp.d.ts +28 -0
  281. package/dist/face-character/liveFaceRegistry.d.ts +370 -0
  282. package/dist/face-character/liveValue.d.ts +12 -0
  283. package/dist/face-character/memo.d.ts +15 -0
  284. package/dist/face-effects.cjs +2252 -83
  285. package/dist/face-effects.js +14234 -1231
  286. package/dist/face-expression/index.d.ts +182 -0
  287. package/dist/face-info/landmarks.d.ts +17 -3
  288. package/dist/face-info/types.d.ts +20 -3
  289. package/dist/gestures/definitions.d.ts +15 -2
  290. package/dist/gestures/index.d.ts +1 -1
  291. package/dist/gestures/measures.d.ts +21 -8
  292. package/dist/getFaceInfo-B1otSDMX.cjs +1 -0
  293. package/dist/getFaceInfo-Cu4xDWiL.js +62 -0
  294. package/dist/hand/armFit.d.ts +46 -0
  295. package/dist/hand/armMask.d.ts +178 -0
  296. package/dist/hand/handCutout.d.ts +23 -0
  297. package/dist/hand/handCutoutRegistry.d.ts +7 -0
  298. package/dist/hand/handGestures.d.ts +524 -0
  299. package/dist/hand/handPose.d.ts +98 -0
  300. package/dist/hand/handRigSolver.d.ts +159 -0
  301. package/dist/hand/handTattoo.d.ts +81 -0
  302. package/dist/hand/handTouch.d.ts +240 -0
  303. package/dist/hand/wrist.d.ts +44 -0
  304. package/dist/hand/wristFilter.d.ts +44 -0
  305. package/dist/hooks/selectors.d.ts +8 -0
  306. package/dist/hooks/useFaceModelAcquisition.d.ts +38 -0
  307. package/dist/hooks/useTrackerContext.d.ts +6 -0
  308. package/dist/index-B1_TzJaI.js +1104 -0
  309. package/dist/index-BavF06C6.js +190 -0
  310. package/dist/index-BfFmpddl.cjs +21 -0
  311. package/dist/index-BuBzneeW.cjs +46 -0
  312. package/dist/index-CGsQWodV.cjs +1 -0
  313. package/dist/index-CIe7eCMH.js +3200 -0
  314. package/dist/index-CfSF8LXa.cjs +1 -0
  315. package/dist/index-D5GTzOzD.cjs +1 -0
  316. package/dist/index-DBhQzvVa.js +314 -0
  317. package/dist/index-DE17y0ZI.cjs +1 -0
  318. package/dist/index-JII7huPk.js +442 -0
  319. package/dist/index-tpCr9CLj.cjs +1 -0
  320. package/dist/{renderPasses-NnKZVfBy.js → index-w1S7fI2B.js} +219 -247
  321. package/dist/index-zGaqrz_K.js +188 -0
  322. package/dist/instructions.cjs +30 -0
  323. package/dist/instructions.js +1507 -0
  324. package/dist/{internal-vsfNQycj.js → internal-B90P-clC.js} +138 -118
  325. package/dist/internal-Cjinca64.cjs +1 -0
  326. package/dist/internal.cjs +1 -1
  327. package/dist/internal.js +15 -10
  328. package/dist/iris/compute.d.ts +7 -5
  329. package/dist/iris/types.d.ts +6 -4
  330. package/dist/{landmarkMask-CbTFzBYG.js → landmarkMask-BFDyBnKM.js} +6 -6
  331. package/dist/landmarks-BlUqf5MZ.cjs +1 -0
  332. package/dist/landmarks-bftdwq6Z.js +76 -0
  333. package/dist/loaders-BGAUACsd.js +363 -0
  334. package/dist/loaders-BJ1_QCHt.cjs +1 -0
  335. package/dist/low-level.cjs +1 -1
  336. package/dist/low-level.js +666 -602
  337. package/dist/main.cjs +1 -1
  338. package/dist/main.js +866 -1182
  339. package/dist/models/Body/index.d.ts +2 -0
  340. package/dist/models/Face/constants.d.ts +8 -0
  341. package/dist/models/Face/index.d.ts +3 -11
  342. package/dist/models/Face/rotation.d.ts +18 -3
  343. package/dist/models/Hand/HandTracking.d.ts +17 -1
  344. package/dist/models/Segmentation/index.d.ts +2 -0
  345. package/dist/models/nodeSource.d.ts +9 -0
  346. package/dist/particles/emission.d.ts +24 -0
  347. package/dist/particles/eyes.d.ts +24 -0
  348. package/dist/particles/glsl.d.ts +14 -0
  349. package/dist/particles/index.d.ts +10 -0
  350. package/dist/particles/motion.d.ts +42 -0
  351. package/dist/particles/presets.d.ts +12 -0
  352. package/dist/particles/ring.d.ts +58 -0
  353. package/dist/particles/selfTest.d.ts +53 -0
  354. package/dist/particles/settings.d.ts +127 -0
  355. package/dist/particles/shapes.d.ts +29 -0
  356. package/dist/particles/spawner.d.ts +60 -0
  357. package/dist/particles/system.d.ts +64 -0
  358. package/dist/particles.cjs +122 -0
  359. package/dist/particles.js +774 -0
  360. package/dist/product.cjs +1 -1
  361. package/dist/product.js +29 -29
  362. package/dist/{providers-C0Dlhh9Z.js → providers-C8rE26Uf.js} +127 -126
  363. package/dist/providers-DHsrhDI2.cjs +62 -0
  364. package/dist/render/renderPasses.d.ts +8 -0
  365. package/dist/render/sceneBeforeRender.d.ts +12 -0
  366. package/dist/{renderGroups-CN1cGFUo.js → renderGroups-B38pUaX2.js} +1 -1
  367. package/dist/{renderGroups-O4KmaMl9.cjs → renderGroups-Cb_4Ar1Q.cjs} +1 -1
  368. package/dist/renderPasses-B6l8IpJv.js +1290 -0
  369. package/dist/renderPasses-dqmkft4P.cjs +158 -0
  370. package/dist/renderState-CJNmj5jz.js +39 -0
  371. package/dist/renderState-apSfg4eR.cjs +1 -0
  372. package/dist/scene-object.cjs +1 -1
  373. package/dist/scene-object.js +2 -2
  374. package/dist/segmentation-Cb3ouK6Z.js +1758 -0
  375. package/dist/segmentation-D9pYO6aR.cjs +1 -0
  376. package/dist/segmentation2d/types.d.ts +6 -0
  377. package/dist/select-Ck5LGz-J.cjs +1 -0
  378. package/dist/select-pYRo_win.js +233 -0
  379. package/dist/selectors-C4X71aoD.cjs +1 -0
  380. package/dist/selectors-DmNaKIwE.js +196 -0
  381. package/dist/session-BrH8G7iJ.cjs +31 -0
  382. package/dist/session-DgA_z6O1.js +418 -0
  383. package/dist/{settings-aQk845NJ.js → settings-BJ7FMBsO.js} +53 -15
  384. package/dist/settings-C63FMBlF.cjs +1 -0
  385. package/dist/similarityFit-BFqHND2e.cjs +1 -0
  386. package/dist/similarityFit-Bbz-R8AY.js +91 -0
  387. package/dist/spring/index.d.ts +2 -0
  388. package/dist/spring/spring.d.ts +69 -0
  389. package/dist/spring/swing.d.ts +54 -0
  390. package/dist/tracking.cjs +10 -1
  391. package/dist/tracking.js +1002 -855
  392. package/dist/trigger-D0Pm9noT.cjs +49 -0
  393. package/dist/trigger-IQeys0oS.js +2128 -0
  394. package/dist/types/face.d.ts +20 -1
  395. package/dist/types/hand-tracking.d.ts +9 -0
  396. package/dist/types/nodes.d.ts +20 -1
  397. package/dist/types/segmentation.d.ts +5 -0
  398. package/dist/updateThrottle-BseecYag.js +4 -0
  399. package/dist/updateThrottle-Of5Y4SVa.cjs +1 -0
  400. package/dist/useFaceInfo-BHDNCvsJ.cjs +1 -0
  401. package/dist/useFaceInfo-J4x7LsqL.js +76 -0
  402. package/dist/useFaceResultReader-BvEo5REG.js +61 -0
  403. package/dist/useFaceResultReader-DuaL1KJG.cjs +1 -0
  404. package/dist/useInstructionHold-DOu-RpCM.js +53 -0
  405. package/dist/useInstructionHold-DwJY1Alr.cjs +1 -0
  406. package/dist/useLandmarkPoseFit-Bg-h9BPb.cjs +1 -0
  407. package/dist/useLandmarkPoseFit-Bmb3h6Mw.js +87 -0
  408. package/dist/{useXRCapabilities-B1R2ghy-.cjs → useXRCapabilities-Cr3RzuAW.cjs} +1 -1
  409. package/dist/{useXRCapabilities-C68v__wB.js → useXRCapabilities-Cxmlmpbd.js} +1 -1
  410. package/dist/utils/canonicalRigidLandmarks.d.ts +8 -0
  411. package/dist/utils/headOccluderFit.d.ts +42 -0
  412. package/dist/utils/integrity.d.ts +17 -0
  413. package/dist/utils/resolveNumFaces.d.ts +13 -0
  414. package/dist/utils/shoulderOccluderFit.d.ts +38 -0
  415. package/dist/utils/similarityFit.d.ts +23 -0
  416. package/dist/uv-BMFt19bg.cjs +1 -0
  417. package/dist/{index-CsUdQ-pn.js → uv-DJU_XfmN.js} +15 -249
  418. package/docs/SDK_DOCUMENTATION.md +1 -2
  419. package/docs/api/adaptive-quality.mdx +1 -1
  420. package/docs/api/body-instructions.mdx +285 -0
  421. package/docs/api/body-triggers.mdx +234 -0
  422. package/docs/api/camera-permission.mdx +1 -1
  423. package/docs/api/coordinate-spaces.mdx +7 -4
  424. package/docs/api/cross-camera.mdx +3 -2
  425. package/docs/api/debug-ui-scene-editor.mdx +23 -2
  426. package/docs/api/external-face-mesh.mdx +231 -0
  427. package/docs/api/face-actions.mdx +20 -16
  428. package/docs/api/face-attribute-expression.mdx +1 -1
  429. package/docs/api/face-binding-anchors.mdx +4 -2
  430. package/docs/api/face-character.mdx +157 -0
  431. package/docs/api/face-effects.mdx +3 -0
  432. package/docs/api/face-expression-controller.mdx +153 -0
  433. package/docs/api/face-info.mdx +17 -11
  434. package/docs/api/face-inset.mdx +204 -0
  435. package/docs/api/face-instructions.mdx +183 -0
  436. package/docs/api/face-liquify.mdx +196 -0
  437. package/docs/api/face-mesh.mdx +4 -7
  438. package/docs/api/face-morph.mdx +117 -0
  439. package/docs/api/face-painting.mdx +7 -0
  440. package/docs/api/face-reprojection.mdx +154 -0
  441. package/docs/api/face-retouching.mdx +18 -10
  442. package/docs/api/face-swap.mdx +350 -0
  443. package/docs/api/face-warp-3d.mdx +166 -0
  444. package/docs/api/faceless.mdx +143 -0
  445. package/docs/api/gestures.mdx +68 -32
  446. package/docs/api/hair.mdx +97 -0
  447. package/docs/api/hand-instructions.mdx +222 -0
  448. package/docs/api/hand-rig.mdx +535 -0
  449. package/docs/api/hand-touch.mdx +162 -0
  450. package/docs/api/head-occluder.mdx +563 -0
  451. package/docs/api/holistic-tracker.mdx +6 -1
  452. package/docs/api/instructions.mdx +323 -0
  453. package/docs/api/iris-tracking.mdx +24 -19
  454. package/docs/api/made-up-camera.mdx +131 -0
  455. package/docs/api/makeup-skin-tone.mdx +135 -0
  456. package/docs/api/makeup.mdx +353 -0
  457. package/docs/api/multi-subject.mdx +4 -1
  458. package/docs/api/particles.mdx +155 -0
  459. package/docs/api/person-cutout.mdx +1 -1
  460. package/docs/api/pin-to-face-mesh.mdx +274 -0
  461. package/docs/api/product-ar.mdx +5 -2
  462. package/docs/api/segmentation-overlay.mdx +1 -1
  463. package/docs/docs.json +29 -1
  464. package/docs/examples/lip-shaders.mdx +82 -33
  465. package/docs/guides/face-atlas-template.svg +1 -0
  466. package/docs/guides/face-atlas-textures.mdx +186 -0
  467. package/docs/guides/face-texture-template.svg +1 -0
  468. package/docs/guides/harness-debug-ui.mdx +4 -4
  469. package/docs/guides/lip-effect-textures.mdx +178 -102
  470. package/docs/guides/lip-uv-template.png +0 -0
  471. package/docs/guides/lip-uv-template.svg +1 -1
  472. package/docs/guides/makeup-design-textures.mdx +109 -0
  473. package/docs/introduction.mdx +1 -2
  474. package/package.json +11 -1
  475. package/dist/DebuggerUI-C-ldiozL.js +0 -269
  476. package/dist/DebuggerUI-CWX5EtQv.cjs +0 -1
  477. package/dist/FaceMeshRenderer-BEEXZwS6.cjs +0 -158
  478. package/dist/FaceMeshRenderer-UuH5sTXG.js +0 -1322
  479. package/dist/FaceRetouch-C7h7x9kd.js +0 -683
  480. package/dist/FaceRetouch-DqftT26Y.cjs +0 -134
  481. package/dist/GLTFLoader-C5q63sKO.js +0 -1633
  482. package/dist/GLTFLoader-Cb_CRwmG.cjs +0 -1
  483. package/dist/SegmentationOverlay-DQuW3dsc.js +0 -133
  484. package/dist/SegmentationOverlay-aWVod8Kl.cjs +0 -1
  485. package/dist/components/FaceWarp3D/FaceWarp3DHead.d.ts +0 -15
  486. package/dist/components/FaceWarp3D/defaults.d.ts +0 -37
  487. package/dist/components/FaceWarp3D/warp.d.ts +0 -13
  488. package/dist/contexts-CO0sd4JQ.cjs +0 -1
  489. package/dist/contexts-FzlnnMYD.js +0 -669
  490. package/dist/debug-ui/face-warp-3d/index.d.ts +0 -6
  491. package/dist/getFaceInfo-BkZfaQs-.js +0 -118
  492. package/dist/getFaceInfo-ahPxQFGu.cjs +0 -1
  493. package/dist/index--RgGzZ6X.cjs +0 -47
  494. package/dist/index-CHVbH0hz.js +0 -214
  495. package/dist/index-CeVkgsag.cjs +0 -1
  496. package/dist/index-CnGox6Xr.js +0 -3054
  497. package/dist/index-DKBAh6hV.cjs +0 -1
  498. package/dist/index-DsZwTfG0.cjs +0 -1
  499. package/dist/index-Dw6tj2Mi.js +0 -144
  500. package/dist/index-OCPjOaeP.cjs +0 -1
  501. package/dist/index-s9pF4zkG.js +0 -2053
  502. package/dist/internal-BYza1h8_.cjs +0 -1
  503. package/dist/measures-9dQPdw96.js +0 -154
  504. package/dist/measures-KfJzpvod.cjs +0 -1
  505. package/dist/providers-YNwkmNeK.cjs +0 -62
  506. package/dist/renderPasses-Cg-zqmEz.cjs +0 -21
  507. package/dist/screenTransform-BenfCtZt.js +0 -44
  508. package/dist/screenTransform-BiXdpVf0.cjs +0 -1
  509. package/dist/segmentation-9PhSvc-R.cjs +0 -1
  510. package/dist/segmentation-CeOTKemr.js +0 -5
  511. package/dist/selectors-C5G1PMYL.js +0 -195
  512. package/dist/selectors-Du_PsVnW.cjs +0 -1
  513. package/dist/session-BBr0yN8h.cjs +0 -31
  514. package/dist/session-Cy0m7l7-.js +0 -363
  515. package/dist/settings-DRR7-snV.cjs +0 -1
  516. package/dist/useFaceInfo-Blf7FCu3.js +0 -303
  517. package/dist/useFaceInfo-C5mO8NQY.cjs +0 -1
@@ -1,1633 +0,0 @@
1
- import { TrianglesDrawMode as Re, TriangleFanDrawMode as W, TriangleStripDrawMode as ue, Loader as Ee, LoaderUtils as G, FileLoader as le, MeshPhysicalMaterial as M, Vector2 as fe, Color as C, LinearSRGBColorSpace as w, SRGBColorSpace as B, SpotLight as _e, PointLight as Le, DirectionalLight as Se, Matrix4 as U, Vector3 as F, Quaternion as he, InstancedMesh as Me, InstancedBufferAttribute as ye, Object3D as de, TextureLoader as we, ImageBitmapLoader as be, BufferAttribute as j, InterleavedBuffer as Ie, InterleavedBufferAttribute as Ne, LinearMipmapLinearFilter as pe, NearestMipmapLinearFilter as Oe, LinearMipmapNearestFilter as Ce, NearestMipmapNearestFilter as Fe, LinearFilter as Y, NearestFilter as me, RepeatWrapping as Q, MirroredRepeatWrapping as De, ClampToEdgeWrapping as Pe, PointsMaterial as ke, Material as K, LineBasicMaterial as He, MeshStandardMaterial as ge, DoubleSide as Ge, MeshBasicMaterial as H, PropertyBinding as Be, BufferGeometry as Ue, SkinnedMesh as ve, Mesh as je, LineSegments as Ke, Line as Ve, LineLoop as Xe, Points as ze, Group as V, PerspectiveCamera as qe, MathUtils as We, OrthographicCamera as Ye, Skeleton as Qe, AnimationClip as Ze, Bone as Je, InterpolateDiscrete as $e, InterpolateLinear as Ae, Texture as $, VectorKeyframeTrack as ee, NumberKeyframeTrack as ne, QuaternionKeyframeTrack as te, ColorManagement as se, FrontSide as en, Interpolant as nn, Box3 as tn, Sphere as sn } from "three";
2
- function re(f, n) {
3
- if (n === Re)
4
- return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."), f;
5
- if (n === W || n === ue) {
6
- let e = f.getIndex();
7
- if (e === null) {
8
- const s = [], a = f.getAttribute("position");
9
- if (a !== void 0) {
10
- for (let o = 0; o < a.count; o++)
11
- s.push(o);
12
- f.setIndex(s), e = f.getIndex();
13
- } else
14
- return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."), f;
15
- }
16
- const i = e.count - 2, t = [];
17
- if (n === W)
18
- for (let s = 1; s <= i; s++)
19
- t.push(e.getX(0)), t.push(e.getX(s)), t.push(e.getX(s + 1));
20
- else
21
- for (let s = 0; s < i; s++)
22
- s % 2 === 0 ? (t.push(e.getX(s)), t.push(e.getX(s + 1)), t.push(e.getX(s + 2))) : (t.push(e.getX(s + 2)), t.push(e.getX(s + 1)), t.push(e.getX(s)));
23
- t.length / 3 !== i && console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");
24
- const r = f.clone();
25
- return r.setIndex(t), r.clearGroups(), r;
26
- } else
27
- return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:", n), f;
28
- }
29
- class Un extends Ee {
30
- constructor(n) {
31
- super(n), this.dracoLoader = null, this.ktx2Loader = null, this.meshoptDecoder = null, this.pluginCallbacks = [], this.register(function(e) {
32
- return new un(e);
33
- }), this.register(function(e) {
34
- return new ln(e);
35
- }), this.register(function(e) {
36
- return new xn(e);
37
- }), this.register(function(e) {
38
- return new Rn(e);
39
- }), this.register(function(e) {
40
- return new En(e);
41
- }), this.register(function(e) {
42
- return new hn(e);
43
- }), this.register(function(e) {
44
- return new dn(e);
45
- }), this.register(function(e) {
46
- return new pn(e);
47
- }), this.register(function(e) {
48
- return new mn(e);
49
- }), this.register(function(e) {
50
- return new cn(e);
51
- }), this.register(function(e) {
52
- return new gn(e);
53
- }), this.register(function(e) {
54
- return new fn(e);
55
- }), this.register(function(e) {
56
- return new Tn(e);
57
- }), this.register(function(e) {
58
- return new An(e);
59
- }), this.register(function(e) {
60
- return new on(e);
61
- }), this.register(function(e) {
62
- return new _n(e);
63
- }), this.register(function(e) {
64
- return new Ln(e);
65
- });
66
- }
67
- load(n, e, i, t) {
68
- const r = this;
69
- let s;
70
- if (this.resourcePath !== "")
71
- s = this.resourcePath;
72
- else if (this.path !== "") {
73
- const c = G.extractUrlBase(n);
74
- s = G.resolveURL(c, this.path);
75
- } else
76
- s = G.extractUrlBase(n);
77
- this.manager.itemStart(n);
78
- const a = function(c) {
79
- t ? t(c) : console.error(c), r.manager.itemError(n), r.manager.itemEnd(n);
80
- }, o = new le(this.manager);
81
- o.setPath(this.path), o.setResponseType("arraybuffer"), o.setRequestHeader(this.requestHeader), o.setWithCredentials(this.withCredentials), o.load(n, function(c) {
82
- try {
83
- r.parse(c, s, function(l) {
84
- e(l), r.manager.itemEnd(n);
85
- }, a);
86
- } catch (l) {
87
- a(l);
88
- }
89
- }, i, a);
90
- }
91
- setDRACOLoader(n) {
92
- return this.dracoLoader = n, this;
93
- }
94
- setKTX2Loader(n) {
95
- return this.ktx2Loader = n, this;
96
- }
97
- setMeshoptDecoder(n) {
98
- return this.meshoptDecoder = n, this;
99
- }
100
- register(n) {
101
- return this.pluginCallbacks.indexOf(n) === -1 && this.pluginCallbacks.push(n), this;
102
- }
103
- unregister(n) {
104
- return this.pluginCallbacks.indexOf(n) !== -1 && this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(n), 1), this;
105
- }
106
- parse(n, e, i, t) {
107
- let r;
108
- const s = {}, a = {}, o = new TextDecoder();
109
- if (typeof n == "string")
110
- r = JSON.parse(n);
111
- else if (n instanceof ArrayBuffer)
112
- if (o.decode(new Uint8Array(n, 0, 4)) === Te) {
113
- try {
114
- s[g.KHR_BINARY_GLTF] = new Sn(n);
115
- } catch (u) {
116
- t && t(u);
117
- return;
118
- }
119
- r = JSON.parse(s[g.KHR_BINARY_GLTF].content);
120
- } else
121
- r = JSON.parse(o.decode(n));
122
- else
123
- r = n;
124
- if (r.asset === void 0 || r.asset.version[0] < 2) {
125
- t && t(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));
126
- return;
127
- }
128
- const c = new Hn(r, {
129
- path: e || this.resourcePath || "",
130
- crossOrigin: this.crossOrigin,
131
- requestHeader: this.requestHeader,
132
- manager: this.manager,
133
- ktx2Loader: this.ktx2Loader,
134
- meshoptDecoder: this.meshoptDecoder
135
- });
136
- c.fileLoader.setRequestHeader(this.requestHeader);
137
- for (let l = 0; l < this.pluginCallbacks.length; l++) {
138
- const u = this.pluginCallbacks[l](c);
139
- u.name || console.error("THREE.GLTFLoader: Invalid plugin found: missing name"), a[u.name] = u, s[u.name] = !0;
140
- }
141
- if (r.extensionsUsed)
142
- for (let l = 0; l < r.extensionsUsed.length; ++l) {
143
- const u = r.extensionsUsed[l], h = r.extensionsRequired || [];
144
- switch (u) {
145
- case g.KHR_MATERIALS_UNLIT:
146
- s[u] = new an();
147
- break;
148
- case g.KHR_DRACO_MESH_COMPRESSION:
149
- s[u] = new Mn(r, this.dracoLoader);
150
- break;
151
- case g.KHR_TEXTURE_TRANSFORM:
152
- s[u] = new yn();
153
- break;
154
- case g.KHR_MESH_QUANTIZATION:
155
- s[u] = new wn();
156
- break;
157
- default:
158
- h.indexOf(u) >= 0 && a[u] === void 0 && console.warn('THREE.GLTFLoader: Unknown extension "' + u + '".');
159
- }
160
- }
161
- c.setExtensions(s), c.setPlugins(a), c.parse(i, t);
162
- }
163
- parseAsync(n, e) {
164
- const i = this;
165
- return new Promise(function(t, r) {
166
- i.parse(n, e, t, r);
167
- });
168
- }
169
- }
170
- function rn() {
171
- let f = {};
172
- return {
173
- get: function(n) {
174
- return f[n];
175
- },
176
- add: function(n, e) {
177
- f[n] = e;
178
- },
179
- remove: function(n) {
180
- delete f[n];
181
- },
182
- removeAll: function() {
183
- f = {};
184
- }
185
- };
186
- }
187
- const g = {
188
- KHR_BINARY_GLTF: "KHR_binary_glTF",
189
- KHR_DRACO_MESH_COMPRESSION: "KHR_draco_mesh_compression",
190
- KHR_LIGHTS_PUNCTUAL: "KHR_lights_punctual",
191
- KHR_MATERIALS_CLEARCOAT: "KHR_materials_clearcoat",
192
- KHR_MATERIALS_DISPERSION: "KHR_materials_dispersion",
193
- KHR_MATERIALS_IOR: "KHR_materials_ior",
194
- KHR_MATERIALS_SHEEN: "KHR_materials_sheen",
195
- KHR_MATERIALS_SPECULAR: "KHR_materials_specular",
196
- KHR_MATERIALS_TRANSMISSION: "KHR_materials_transmission",
197
- KHR_MATERIALS_IRIDESCENCE: "KHR_materials_iridescence",
198
- KHR_MATERIALS_ANISOTROPY: "KHR_materials_anisotropy",
199
- KHR_MATERIALS_UNLIT: "KHR_materials_unlit",
200
- KHR_MATERIALS_VOLUME: "KHR_materials_volume",
201
- KHR_TEXTURE_BASISU: "KHR_texture_basisu",
202
- KHR_TEXTURE_TRANSFORM: "KHR_texture_transform",
203
- KHR_MESH_QUANTIZATION: "KHR_mesh_quantization",
204
- KHR_MATERIALS_EMISSIVE_STRENGTH: "KHR_materials_emissive_strength",
205
- EXT_MATERIALS_BUMP: "EXT_materials_bump",
206
- EXT_TEXTURE_WEBP: "EXT_texture_webp",
207
- EXT_TEXTURE_AVIF: "EXT_texture_avif",
208
- EXT_MESHOPT_COMPRESSION: "EXT_meshopt_compression",
209
- EXT_MESH_GPU_INSTANCING: "EXT_mesh_gpu_instancing"
210
- };
211
- class on {
212
- constructor(n) {
213
- this.parser = n, this.name = g.KHR_LIGHTS_PUNCTUAL, this.cache = { refs: {}, uses: {} };
214
- }
215
- _markDefs() {
216
- const n = this.parser, e = this.parser.json.nodes || [];
217
- for (let i = 0, t = e.length; i < t; i++) {
218
- const r = e[i];
219
- r.extensions && r.extensions[this.name] && r.extensions[this.name].light !== void 0 && n._addNodeRef(this.cache, r.extensions[this.name].light);
220
- }
221
- }
222
- _loadLight(n) {
223
- const e = this.parser, i = "light:" + n;
224
- let t = e.cache.get(i);
225
- if (t) return t;
226
- const r = e.json, o = ((r.extensions && r.extensions[this.name] || {}).lights || [])[n];
227
- let c;
228
- const l = new C(16777215);
229
- o.color !== void 0 && l.setRGB(o.color[0], o.color[1], o.color[2], w);
230
- const u = o.range !== void 0 ? o.range : 0;
231
- switch (o.type) {
232
- case "directional":
233
- c = new Se(l), c.target.position.set(0, 0, -1), c.add(c.target);
234
- break;
235
- case "point":
236
- c = new Le(l), c.distance = u;
237
- break;
238
- case "spot":
239
- c = new _e(l), c.distance = u, o.spot = o.spot || {}, o.spot.innerConeAngle = o.spot.innerConeAngle !== void 0 ? o.spot.innerConeAngle : 0, o.spot.outerConeAngle = o.spot.outerConeAngle !== void 0 ? o.spot.outerConeAngle : Math.PI / 4, c.angle = o.spot.outerConeAngle, c.penumbra = 1 - o.spot.innerConeAngle / o.spot.outerConeAngle, c.target.position.set(0, 0, -1), c.add(c.target);
240
- break;
241
- default:
242
- throw new Error("THREE.GLTFLoader: Unexpected light type: " + o.type);
243
- }
244
- return c.position.set(0, 0, 0), y(c, o), o.intensity !== void 0 && (c.intensity = o.intensity), c.name = e.createUniqueName(o.name || "light_" + n), t = Promise.resolve(c), e.cache.add(i, t), t;
245
- }
246
- getDependency(n, e) {
247
- if (n === "light")
248
- return this._loadLight(e);
249
- }
250
- createNodeAttachment(n) {
251
- const e = this, i = this.parser, r = i.json.nodes[n], a = (r.extensions && r.extensions[this.name] || {}).light;
252
- return a === void 0 ? null : this._loadLight(a).then(function(o) {
253
- return i._getNodeRef(e.cache, a, o);
254
- });
255
- }
256
- }
257
- class an {
258
- constructor() {
259
- this.name = g.KHR_MATERIALS_UNLIT;
260
- }
261
- getMaterialType() {
262
- return H;
263
- }
264
- extendParams(n, e, i) {
265
- const t = [];
266
- n.color = new C(1, 1, 1), n.opacity = 1;
267
- const r = e.pbrMetallicRoughness;
268
- if (r) {
269
- if (Array.isArray(r.baseColorFactor)) {
270
- const s = r.baseColorFactor;
271
- n.color.setRGB(s[0], s[1], s[2], w), n.opacity = s[3];
272
- }
273
- r.baseColorTexture !== void 0 && t.push(i.assignTexture(n, "map", r.baseColorTexture, B));
274
- }
275
- return Promise.all(t);
276
- }
277
- }
278
- class cn {
279
- constructor(n) {
280
- this.parser = n, this.name = g.KHR_MATERIALS_EMISSIVE_STRENGTH;
281
- }
282
- extendMaterialParams(n, e) {
283
- const t = this.parser.json.materials[n];
284
- if (!t.extensions || !t.extensions[this.name])
285
- return Promise.resolve();
286
- const r = t.extensions[this.name].emissiveStrength;
287
- return r !== void 0 && (e.emissiveIntensity = r), Promise.resolve();
288
- }
289
- }
290
- class un {
291
- constructor(n) {
292
- this.parser = n, this.name = g.KHR_MATERIALS_CLEARCOAT;
293
- }
294
- getMaterialType(n) {
295
- const i = this.parser.json.materials[n];
296
- return !i.extensions || !i.extensions[this.name] ? null : M;
297
- }
298
- extendMaterialParams(n, e) {
299
- const i = this.parser, t = i.json.materials[n];
300
- if (!t.extensions || !t.extensions[this.name])
301
- return Promise.resolve();
302
- const r = [], s = t.extensions[this.name];
303
- if (s.clearcoatFactor !== void 0 && (e.clearcoat = s.clearcoatFactor), s.clearcoatTexture !== void 0 && r.push(i.assignTexture(e, "clearcoatMap", s.clearcoatTexture)), s.clearcoatRoughnessFactor !== void 0 && (e.clearcoatRoughness = s.clearcoatRoughnessFactor), s.clearcoatRoughnessTexture !== void 0 && r.push(i.assignTexture(e, "clearcoatRoughnessMap", s.clearcoatRoughnessTexture)), s.clearcoatNormalTexture !== void 0 && (r.push(i.assignTexture(e, "clearcoatNormalMap", s.clearcoatNormalTexture)), s.clearcoatNormalTexture.scale !== void 0)) {
304
- const a = s.clearcoatNormalTexture.scale;
305
- e.clearcoatNormalScale = new fe(a, a);
306
- }
307
- return Promise.all(r);
308
- }
309
- }
310
- class ln {
311
- constructor(n) {
312
- this.parser = n, this.name = g.KHR_MATERIALS_DISPERSION;
313
- }
314
- getMaterialType(n) {
315
- const i = this.parser.json.materials[n];
316
- return !i.extensions || !i.extensions[this.name] ? null : M;
317
- }
318
- extendMaterialParams(n, e) {
319
- const t = this.parser.json.materials[n];
320
- if (!t.extensions || !t.extensions[this.name])
321
- return Promise.resolve();
322
- const r = t.extensions[this.name];
323
- return e.dispersion = r.dispersion !== void 0 ? r.dispersion : 0, Promise.resolve();
324
- }
325
- }
326
- class fn {
327
- constructor(n) {
328
- this.parser = n, this.name = g.KHR_MATERIALS_IRIDESCENCE;
329
- }
330
- getMaterialType(n) {
331
- const i = this.parser.json.materials[n];
332
- return !i.extensions || !i.extensions[this.name] ? null : M;
333
- }
334
- extendMaterialParams(n, e) {
335
- const i = this.parser, t = i.json.materials[n];
336
- if (!t.extensions || !t.extensions[this.name])
337
- return Promise.resolve();
338
- const r = [], s = t.extensions[this.name];
339
- return s.iridescenceFactor !== void 0 && (e.iridescence = s.iridescenceFactor), s.iridescenceTexture !== void 0 && r.push(i.assignTexture(e, "iridescenceMap", s.iridescenceTexture)), s.iridescenceIor !== void 0 && (e.iridescenceIOR = s.iridescenceIor), e.iridescenceThicknessRange === void 0 && (e.iridescenceThicknessRange = [100, 400]), s.iridescenceThicknessMinimum !== void 0 && (e.iridescenceThicknessRange[0] = s.iridescenceThicknessMinimum), s.iridescenceThicknessMaximum !== void 0 && (e.iridescenceThicknessRange[1] = s.iridescenceThicknessMaximum), s.iridescenceThicknessTexture !== void 0 && r.push(i.assignTexture(e, "iridescenceThicknessMap", s.iridescenceThicknessTexture)), Promise.all(r);
340
- }
341
- }
342
- class hn {
343
- constructor(n) {
344
- this.parser = n, this.name = g.KHR_MATERIALS_SHEEN;
345
- }
346
- getMaterialType(n) {
347
- const i = this.parser.json.materials[n];
348
- return !i.extensions || !i.extensions[this.name] ? null : M;
349
- }
350
- extendMaterialParams(n, e) {
351
- const i = this.parser, t = i.json.materials[n];
352
- if (!t.extensions || !t.extensions[this.name])
353
- return Promise.resolve();
354
- const r = [];
355
- e.sheenColor = new C(0, 0, 0), e.sheenRoughness = 0, e.sheen = 1;
356
- const s = t.extensions[this.name];
357
- if (s.sheenColorFactor !== void 0) {
358
- const a = s.sheenColorFactor;
359
- e.sheenColor.setRGB(a[0], a[1], a[2], w);
360
- }
361
- return s.sheenRoughnessFactor !== void 0 && (e.sheenRoughness = s.sheenRoughnessFactor), s.sheenColorTexture !== void 0 && r.push(i.assignTexture(e, "sheenColorMap", s.sheenColorTexture, B)), s.sheenRoughnessTexture !== void 0 && r.push(i.assignTexture(e, "sheenRoughnessMap", s.sheenRoughnessTexture)), Promise.all(r);
362
- }
363
- }
364
- class dn {
365
- constructor(n) {
366
- this.parser = n, this.name = g.KHR_MATERIALS_TRANSMISSION;
367
- }
368
- getMaterialType(n) {
369
- const i = this.parser.json.materials[n];
370
- return !i.extensions || !i.extensions[this.name] ? null : M;
371
- }
372
- extendMaterialParams(n, e) {
373
- const i = this.parser, t = i.json.materials[n];
374
- if (!t.extensions || !t.extensions[this.name])
375
- return Promise.resolve();
376
- const r = [], s = t.extensions[this.name];
377
- return s.transmissionFactor !== void 0 && (e.transmission = s.transmissionFactor), s.transmissionTexture !== void 0 && r.push(i.assignTexture(e, "transmissionMap", s.transmissionTexture)), Promise.all(r);
378
- }
379
- }
380
- class pn {
381
- constructor(n) {
382
- this.parser = n, this.name = g.KHR_MATERIALS_VOLUME;
383
- }
384
- getMaterialType(n) {
385
- const i = this.parser.json.materials[n];
386
- return !i.extensions || !i.extensions[this.name] ? null : M;
387
- }
388
- extendMaterialParams(n, e) {
389
- const i = this.parser, t = i.json.materials[n];
390
- if (!t.extensions || !t.extensions[this.name])
391
- return Promise.resolve();
392
- const r = [], s = t.extensions[this.name];
393
- e.thickness = s.thicknessFactor !== void 0 ? s.thicknessFactor : 0, s.thicknessTexture !== void 0 && r.push(i.assignTexture(e, "thicknessMap", s.thicknessTexture)), e.attenuationDistance = s.attenuationDistance || 1 / 0;
394
- const a = s.attenuationColor || [1, 1, 1];
395
- return e.attenuationColor = new C().setRGB(a[0], a[1], a[2], w), Promise.all(r);
396
- }
397
- }
398
- class mn {
399
- constructor(n) {
400
- this.parser = n, this.name = g.KHR_MATERIALS_IOR;
401
- }
402
- getMaterialType(n) {
403
- const i = this.parser.json.materials[n];
404
- return !i.extensions || !i.extensions[this.name] ? null : M;
405
- }
406
- extendMaterialParams(n, e) {
407
- const t = this.parser.json.materials[n];
408
- if (!t.extensions || !t.extensions[this.name])
409
- return Promise.resolve();
410
- const r = t.extensions[this.name];
411
- return e.ior = r.ior !== void 0 ? r.ior : 1.5, Promise.resolve();
412
- }
413
- }
414
- class gn {
415
- constructor(n) {
416
- this.parser = n, this.name = g.KHR_MATERIALS_SPECULAR;
417
- }
418
- getMaterialType(n) {
419
- const i = this.parser.json.materials[n];
420
- return !i.extensions || !i.extensions[this.name] ? null : M;
421
- }
422
- extendMaterialParams(n, e) {
423
- const i = this.parser, t = i.json.materials[n];
424
- if (!t.extensions || !t.extensions[this.name])
425
- return Promise.resolve();
426
- const r = [], s = t.extensions[this.name];
427
- e.specularIntensity = s.specularFactor !== void 0 ? s.specularFactor : 1, s.specularTexture !== void 0 && r.push(i.assignTexture(e, "specularIntensityMap", s.specularTexture));
428
- const a = s.specularColorFactor || [1, 1, 1];
429
- return e.specularColor = new C().setRGB(a[0], a[1], a[2], w), s.specularColorTexture !== void 0 && r.push(i.assignTexture(e, "specularColorMap", s.specularColorTexture, B)), Promise.all(r);
430
- }
431
- }
432
- class An {
433
- constructor(n) {
434
- this.parser = n, this.name = g.EXT_MATERIALS_BUMP;
435
- }
436
- getMaterialType(n) {
437
- const i = this.parser.json.materials[n];
438
- return !i.extensions || !i.extensions[this.name] ? null : M;
439
- }
440
- extendMaterialParams(n, e) {
441
- const i = this.parser, t = i.json.materials[n];
442
- if (!t.extensions || !t.extensions[this.name])
443
- return Promise.resolve();
444
- const r = [], s = t.extensions[this.name];
445
- return e.bumpScale = s.bumpFactor !== void 0 ? s.bumpFactor : 1, s.bumpTexture !== void 0 && r.push(i.assignTexture(e, "bumpMap", s.bumpTexture)), Promise.all(r);
446
- }
447
- }
448
- class Tn {
449
- constructor(n) {
450
- this.parser = n, this.name = g.KHR_MATERIALS_ANISOTROPY;
451
- }
452
- getMaterialType(n) {
453
- const i = this.parser.json.materials[n];
454
- return !i.extensions || !i.extensions[this.name] ? null : M;
455
- }
456
- extendMaterialParams(n, e) {
457
- const i = this.parser, t = i.json.materials[n];
458
- if (!t.extensions || !t.extensions[this.name])
459
- return Promise.resolve();
460
- const r = [], s = t.extensions[this.name];
461
- return s.anisotropyStrength !== void 0 && (e.anisotropy = s.anisotropyStrength), s.anisotropyRotation !== void 0 && (e.anisotropyRotation = s.anisotropyRotation), s.anisotropyTexture !== void 0 && r.push(i.assignTexture(e, "anisotropyMap", s.anisotropyTexture)), Promise.all(r);
462
- }
463
- }
464
- class xn {
465
- constructor(n) {
466
- this.parser = n, this.name = g.KHR_TEXTURE_BASISU;
467
- }
468
- loadTexture(n) {
469
- const e = this.parser, i = e.json, t = i.textures[n];
470
- if (!t.extensions || !t.extensions[this.name])
471
- return null;
472
- const r = t.extensions[this.name], s = e.options.ktx2Loader;
473
- if (!s) {
474
- if (i.extensionsRequired && i.extensionsRequired.indexOf(this.name) >= 0)
475
- throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");
476
- return null;
477
- }
478
- return e.loadTextureImage(n, r.source, s);
479
- }
480
- }
481
- class Rn {
482
- constructor(n) {
483
- this.parser = n, this.name = g.EXT_TEXTURE_WEBP, this.isSupported = null;
484
- }
485
- loadTexture(n) {
486
- const e = this.name, i = this.parser, t = i.json, r = t.textures[n];
487
- if (!r.extensions || !r.extensions[e])
488
- return null;
489
- const s = r.extensions[e], a = t.images[s.source];
490
- let o = i.textureLoader;
491
- if (a.uri) {
492
- const c = i.options.manager.getHandler(a.uri);
493
- c !== null && (o = c);
494
- }
495
- return this.detectSupport().then(function(c) {
496
- if (c) return i.loadTextureImage(n, s.source, o);
497
- if (t.extensionsRequired && t.extensionsRequired.indexOf(e) >= 0)
498
- throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");
499
- return i.loadTexture(n);
500
- });
501
- }
502
- detectSupport() {
503
- return this.isSupported || (this.isSupported = new Promise(function(n) {
504
- const e = new Image();
505
- e.src = "data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA", e.onload = e.onerror = function() {
506
- n(e.height === 1);
507
- };
508
- })), this.isSupported;
509
- }
510
- }
511
- class En {
512
- constructor(n) {
513
- this.parser = n, this.name = g.EXT_TEXTURE_AVIF, this.isSupported = null;
514
- }
515
- loadTexture(n) {
516
- const e = this.name, i = this.parser, t = i.json, r = t.textures[n];
517
- if (!r.extensions || !r.extensions[e])
518
- return null;
519
- const s = r.extensions[e], a = t.images[s.source];
520
- let o = i.textureLoader;
521
- if (a.uri) {
522
- const c = i.options.manager.getHandler(a.uri);
523
- c !== null && (o = c);
524
- }
525
- return this.detectSupport().then(function(c) {
526
- if (c) return i.loadTextureImage(n, s.source, o);
527
- if (t.extensionsRequired && t.extensionsRequired.indexOf(e) >= 0)
528
- throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");
529
- return i.loadTexture(n);
530
- });
531
- }
532
- detectSupport() {
533
- return this.isSupported || (this.isSupported = new Promise(function(n) {
534
- const e = new Image();
535
- e.src = "data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=", e.onload = e.onerror = function() {
536
- n(e.height === 1);
537
- };
538
- })), this.isSupported;
539
- }
540
- }
541
- class _n {
542
- constructor(n) {
543
- this.name = g.EXT_MESHOPT_COMPRESSION, this.parser = n;
544
- }
545
- loadBufferView(n) {
546
- const e = this.parser.json, i = e.bufferViews[n];
547
- if (i.extensions && i.extensions[this.name]) {
548
- const t = i.extensions[this.name], r = this.parser.getDependency("buffer", t.buffer), s = this.parser.options.meshoptDecoder;
549
- if (!s || !s.supported) {
550
- if (e.extensionsRequired && e.extensionsRequired.indexOf(this.name) >= 0)
551
- throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");
552
- return null;
553
- }
554
- return r.then(function(a) {
555
- const o = t.byteOffset || 0, c = t.byteLength || 0, l = t.count, u = t.byteStride, h = new Uint8Array(a, o, c);
556
- return s.decodeGltfBufferAsync ? s.decodeGltfBufferAsync(l, u, h, t.mode, t.filter).then(function(d) {
557
- return d.buffer;
558
- }) : s.ready.then(function() {
559
- const d = new ArrayBuffer(l * u);
560
- return s.decodeGltfBuffer(new Uint8Array(d), l, u, h, t.mode, t.filter), d;
561
- });
562
- });
563
- } else
564
- return null;
565
- }
566
- }
567
- class Ln {
568
- constructor(n) {
569
- this.name = g.EXT_MESH_GPU_INSTANCING, this.parser = n;
570
- }
571
- createNodeMesh(n) {
572
- const e = this.parser.json, i = e.nodes[n];
573
- if (!i.extensions || !i.extensions[this.name] || i.mesh === void 0)
574
- return null;
575
- const t = e.meshes[i.mesh];
576
- for (const c of t.primitives)
577
- if (c.mode !== _.TRIANGLES && c.mode !== _.TRIANGLE_STRIP && c.mode !== _.TRIANGLE_FAN && c.mode !== void 0)
578
- return null;
579
- const s = i.extensions[this.name].attributes, a = [], o = {};
580
- for (const c in s)
581
- a.push(this.parser.getDependency("accessor", s[c]).then((l) => (o[c] = l, o[c])));
582
- return a.length < 1 ? null : (a.push(this.parser.createNodeMesh(n)), Promise.all(a).then((c) => {
583
- const l = c.pop(), u = l.isGroup ? l.children : [l], h = c[0].count, d = [];
584
- for (const m of u) {
585
- const T = new U(), p = new F(), A = new he(), R = new F(1, 1, 1), E = new Me(m.geometry, m.material, h);
586
- for (let x = 0; x < h; x++)
587
- o.TRANSLATION && p.fromBufferAttribute(o.TRANSLATION, x), o.ROTATION && A.fromBufferAttribute(o.ROTATION, x), o.SCALE && R.fromBufferAttribute(o.SCALE, x), E.setMatrixAt(x, T.compose(p, A, R));
588
- for (const x in o)
589
- if (x === "_COLOR_0") {
590
- const S = o[x];
591
- E.instanceColor = new ye(S.array, S.itemSize, S.normalized);
592
- } else x !== "TRANSLATION" && x !== "ROTATION" && x !== "SCALE" && m.geometry.setAttribute(x, o[x]);
593
- de.prototype.copy.call(E, m), this.parser.assignFinalMaterial(E), d.push(E);
594
- }
595
- return l.isGroup ? (l.clear(), l.add(...d), l) : d[0];
596
- }));
597
- }
598
- }
599
- const Te = "glTF", k = 12, ie = { JSON: 1313821514, BIN: 5130562 };
600
- class Sn {
601
- constructor(n) {
602
- this.name = g.KHR_BINARY_GLTF, this.content = null, this.body = null;
603
- const e = new DataView(n, 0, k), i = new TextDecoder();
604
- if (this.header = {
605
- magic: i.decode(new Uint8Array(n.slice(0, 4))),
606
- version: e.getUint32(4, !0),
607
- length: e.getUint32(8, !0)
608
- }, this.header.magic !== Te)
609
- throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");
610
- if (this.header.version < 2)
611
- throw new Error("THREE.GLTFLoader: Legacy binary file detected.");
612
- const t = this.header.length - k, r = new DataView(n, k);
613
- let s = 0;
614
- for (; s < t; ) {
615
- const a = r.getUint32(s, !0);
616
- s += 4;
617
- const o = r.getUint32(s, !0);
618
- if (s += 4, o === ie.JSON) {
619
- const c = new Uint8Array(n, k + s, a);
620
- this.content = i.decode(c);
621
- } else if (o === ie.BIN) {
622
- const c = k + s;
623
- this.body = n.slice(c, c + a);
624
- }
625
- s += a;
626
- }
627
- if (this.content === null)
628
- throw new Error("THREE.GLTFLoader: JSON content not found.");
629
- }
630
- }
631
- class Mn {
632
- constructor(n, e) {
633
- if (!e)
634
- throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");
635
- this.name = g.KHR_DRACO_MESH_COMPRESSION, this.json = n, this.dracoLoader = e, this.dracoLoader.preload();
636
- }
637
- decodePrimitive(n, e) {
638
- const i = this.json, t = this.dracoLoader, r = n.extensions[this.name].bufferView, s = n.extensions[this.name].attributes, a = {}, o = {}, c = {};
639
- for (const l in s) {
640
- const u = Z[l] || l.toLowerCase();
641
- a[u] = s[l];
642
- }
643
- for (const l in n.attributes) {
644
- const u = Z[l] || l.toLowerCase();
645
- if (s[l] !== void 0) {
646
- const h = i.accessors[n.attributes[l]], d = D[h.componentType];
647
- c[u] = d.name, o[u] = h.normalized === !0;
648
- }
649
- }
650
- return e.getDependency("bufferView", r).then(function(l) {
651
- return new Promise(function(u, h) {
652
- t.decodeDracoFile(l, function(d) {
653
- for (const m in d.attributes) {
654
- const T = d.attributes[m], p = o[m];
655
- p !== void 0 && (T.normalized = p);
656
- }
657
- u(d);
658
- }, a, c, w, h);
659
- });
660
- });
661
- }
662
- }
663
- class yn {
664
- constructor() {
665
- this.name = g.KHR_TEXTURE_TRANSFORM;
666
- }
667
- extendTexture(n, e) {
668
- return (e.texCoord === void 0 || e.texCoord === n.channel) && e.offset === void 0 && e.rotation === void 0 && e.scale === void 0 || (n = n.clone(), e.texCoord !== void 0 && (n.channel = e.texCoord), e.offset !== void 0 && n.offset.fromArray(e.offset), e.rotation !== void 0 && (n.rotation = e.rotation), e.scale !== void 0 && n.repeat.fromArray(e.scale), n.needsUpdate = !0), n;
669
- }
670
- }
671
- class wn {
672
- constructor() {
673
- this.name = g.KHR_MESH_QUANTIZATION;
674
- }
675
- }
676
- class xe extends nn {
677
- constructor(n, e, i, t) {
678
- super(n, e, i, t);
679
- }
680
- copySampleValue_(n) {
681
- const e = this.resultBuffer, i = this.sampleValues, t = this.valueSize, r = n * t * 3 + t;
682
- for (let s = 0; s !== t; s++)
683
- e[s] = i[r + s];
684
- return e;
685
- }
686
- interpolate_(n, e, i, t) {
687
- const r = this.resultBuffer, s = this.sampleValues, a = this.valueSize, o = a * 2, c = a * 3, l = t - e, u = (i - e) / l, h = u * u, d = h * u, m = n * c, T = m - c, p = -2 * d + 3 * h, A = d - h, R = 1 - p, E = A - h + u;
688
- for (let x = 0; x !== a; x++) {
689
- const S = s[T + x + a], b = s[T + x + o] * l, L = s[m + x + a], P = s[m + x] * l;
690
- r[x] = R * S + E * b + p * L + A * P;
691
- }
692
- return r;
693
- }
694
- }
695
- const bn = new he();
696
- class In extends xe {
697
- interpolate_(n, e, i, t) {
698
- const r = super.interpolate_(n, e, i, t);
699
- return bn.fromArray(r).normalize().toArray(r), r;
700
- }
701
- }
702
- const _ = {
703
- POINTS: 0,
704
- LINES: 1,
705
- LINE_LOOP: 2,
706
- LINE_STRIP: 3,
707
- TRIANGLES: 4,
708
- TRIANGLE_STRIP: 5,
709
- TRIANGLE_FAN: 6
710
- }, D = {
711
- 5120: Int8Array,
712
- 5121: Uint8Array,
713
- 5122: Int16Array,
714
- 5123: Uint16Array,
715
- 5125: Uint32Array,
716
- 5126: Float32Array
717
- }, oe = {
718
- 9728: me,
719
- 9729: Y,
720
- 9984: Fe,
721
- 9985: Ce,
722
- 9986: Oe,
723
- 9987: pe
724
- }, ae = {
725
- 33071: Pe,
726
- 33648: De,
727
- 10497: Q
728
- }, X = {
729
- SCALAR: 1,
730
- VEC2: 2,
731
- VEC3: 3,
732
- VEC4: 4,
733
- MAT2: 4,
734
- MAT3: 9,
735
- MAT4: 16
736
- }, Z = {
737
- POSITION: "position",
738
- NORMAL: "normal",
739
- TANGENT: "tangent",
740
- TEXCOORD_0: "uv",
741
- TEXCOORD_1: "uv1",
742
- TEXCOORD_2: "uv2",
743
- TEXCOORD_3: "uv3",
744
- COLOR_0: "color",
745
- WEIGHTS_0: "skinWeight",
746
- JOINTS_0: "skinIndex"
747
- }, N = {
748
- scale: "scale",
749
- translation: "position",
750
- rotation: "quaternion",
751
- weights: "morphTargetInfluences"
752
- }, Nn = {
753
- CUBICSPLINE: void 0,
754
- // We use a custom interpolant (GLTFCubicSplineInterpolation) for CUBICSPLINE tracks. Each
755
- // keyframe track will be initialized with a default interpolation type, then modified.
756
- LINEAR: Ae,
757
- STEP: $e
758
- }, z = {
759
- OPAQUE: "OPAQUE",
760
- MASK: "MASK",
761
- BLEND: "BLEND"
762
- };
763
- function On(f) {
764
- return f.DefaultMaterial === void 0 && (f.DefaultMaterial = new ge({
765
- color: 16777215,
766
- emissive: 0,
767
- metalness: 1,
768
- roughness: 1,
769
- transparent: !1,
770
- depthTest: !0,
771
- side: en
772
- })), f.DefaultMaterial;
773
- }
774
- function O(f, n, e) {
775
- for (const i in e.extensions)
776
- f[i] === void 0 && (n.userData.gltfExtensions = n.userData.gltfExtensions || {}, n.userData.gltfExtensions[i] = e.extensions[i]);
777
- }
778
- function y(f, n) {
779
- n.extras !== void 0 && (typeof n.extras == "object" ? Object.assign(f.userData, n.extras) : console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, " + n.extras));
780
- }
781
- function Cn(f, n, e) {
782
- let i = !1, t = !1, r = !1;
783
- for (let c = 0, l = n.length; c < l; c++) {
784
- const u = n[c];
785
- if (u.POSITION !== void 0 && (i = !0), u.NORMAL !== void 0 && (t = !0), u.COLOR_0 !== void 0 && (r = !0), i && t && r) break;
786
- }
787
- if (!i && !t && !r) return Promise.resolve(f);
788
- const s = [], a = [], o = [];
789
- for (let c = 0, l = n.length; c < l; c++) {
790
- const u = n[c];
791
- if (i) {
792
- const h = u.POSITION !== void 0 ? e.getDependency("accessor", u.POSITION) : f.attributes.position;
793
- s.push(h);
794
- }
795
- if (t) {
796
- const h = u.NORMAL !== void 0 ? e.getDependency("accessor", u.NORMAL) : f.attributes.normal;
797
- a.push(h);
798
- }
799
- if (r) {
800
- const h = u.COLOR_0 !== void 0 ? e.getDependency("accessor", u.COLOR_0) : f.attributes.color;
801
- o.push(h);
802
- }
803
- }
804
- return Promise.all([
805
- Promise.all(s),
806
- Promise.all(a),
807
- Promise.all(o)
808
- ]).then(function(c) {
809
- const l = c[0], u = c[1], h = c[2];
810
- return i && (f.morphAttributes.position = l), t && (f.morphAttributes.normal = u), r && (f.morphAttributes.color = h), f.morphTargetsRelative = !0, f;
811
- });
812
- }
813
- function Fn(f, n) {
814
- if (f.updateMorphTargets(), n.weights !== void 0)
815
- for (let e = 0, i = n.weights.length; e < i; e++)
816
- f.morphTargetInfluences[e] = n.weights[e];
817
- if (n.extras && Array.isArray(n.extras.targetNames)) {
818
- const e = n.extras.targetNames;
819
- if (f.morphTargetInfluences.length === e.length) {
820
- f.morphTargetDictionary = {};
821
- for (let i = 0, t = e.length; i < t; i++)
822
- f.morphTargetDictionary[e[i]] = i;
823
- } else
824
- console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.");
825
- }
826
- }
827
- function Dn(f) {
828
- let n;
829
- const e = f.extensions && f.extensions[g.KHR_DRACO_MESH_COMPRESSION];
830
- if (e ? n = "draco:" + e.bufferView + ":" + e.indices + ":" + q(e.attributes) : n = f.indices + ":" + q(f.attributes) + ":" + f.mode, f.targets !== void 0)
831
- for (let i = 0, t = f.targets.length; i < t; i++)
832
- n += ":" + q(f.targets[i]);
833
- return n;
834
- }
835
- function q(f) {
836
- let n = "";
837
- const e = Object.keys(f).sort();
838
- for (let i = 0, t = e.length; i < t; i++)
839
- n += e[i] + ":" + f[e[i]] + ";";
840
- return n;
841
- }
842
- function J(f) {
843
- switch (f) {
844
- case Int8Array:
845
- return 1 / 127;
846
- case Uint8Array:
847
- return 1 / 255;
848
- case Int16Array:
849
- return 1 / 32767;
850
- case Uint16Array:
851
- return 1 / 65535;
852
- default:
853
- throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.");
854
- }
855
- }
856
- function Pn(f) {
857
- return f.search(/\.jpe?g($|\?)/i) > 0 || f.search(/^data\:image\/jpeg/) === 0 ? "image/jpeg" : f.search(/\.webp($|\?)/i) > 0 || f.search(/^data\:image\/webp/) === 0 ? "image/webp" : f.search(/\.ktx2($|\?)/i) > 0 || f.search(/^data\:image\/ktx2/) === 0 ? "image/ktx2" : "image/png";
858
- }
859
- const kn = new U();
860
- class Hn {
861
- constructor(n = {}, e = {}) {
862
- this.json = n, this.extensions = {}, this.plugins = {}, this.options = e, this.cache = new rn(), this.associations = /* @__PURE__ */ new Map(), this.primitiveCache = {}, this.nodeCache = {}, this.meshCache = { refs: {}, uses: {} }, this.cameraCache = { refs: {}, uses: {} }, this.lightCache = { refs: {}, uses: {} }, this.sourceCache = {}, this.textureCache = {}, this.nodeNamesUsed = {};
863
- let i = !1, t = -1, r = !1, s = -1;
864
- if (typeof navigator < "u") {
865
- const a = navigator.userAgent;
866
- i = /^((?!chrome|android).)*safari/i.test(a) === !0;
867
- const o = a.match(/Version\/(\d+)/);
868
- t = i && o ? parseInt(o[1], 10) : -1, r = a.indexOf("Firefox") > -1, s = r ? a.match(/Firefox\/([0-9]+)\./)[1] : -1;
869
- }
870
- typeof createImageBitmap > "u" || i && t < 17 || r && s < 98 ? this.textureLoader = new we(this.options.manager) : this.textureLoader = new be(this.options.manager), this.textureLoader.setCrossOrigin(this.options.crossOrigin), this.textureLoader.setRequestHeader(this.options.requestHeader), this.fileLoader = new le(this.options.manager), this.fileLoader.setResponseType("arraybuffer"), this.options.crossOrigin === "use-credentials" && this.fileLoader.setWithCredentials(!0);
871
- }
872
- setExtensions(n) {
873
- this.extensions = n;
874
- }
875
- setPlugins(n) {
876
- this.plugins = n;
877
- }
878
- parse(n, e) {
879
- const i = this, t = this.json, r = this.extensions;
880
- this.cache.removeAll(), this.nodeCache = {}, this._invokeAll(function(s) {
881
- return s._markDefs && s._markDefs();
882
- }), Promise.all(this._invokeAll(function(s) {
883
- return s.beforeRoot && s.beforeRoot();
884
- })).then(function() {
885
- return Promise.all([
886
- i.getDependencies("scene"),
887
- i.getDependencies("animation"),
888
- i.getDependencies("camera")
889
- ]);
890
- }).then(function(s) {
891
- const a = {
892
- scene: s[0][t.scene || 0],
893
- scenes: s[0],
894
- animations: s[1],
895
- cameras: s[2],
896
- asset: t.asset,
897
- parser: i,
898
- userData: {}
899
- };
900
- return O(r, a, t), y(a, t), Promise.all(i._invokeAll(function(o) {
901
- return o.afterRoot && o.afterRoot(a);
902
- })).then(function() {
903
- for (const o of a.scenes)
904
- o.updateMatrixWorld();
905
- n(a);
906
- });
907
- }).catch(e);
908
- }
909
- /**
910
- * Marks the special nodes/meshes in json for efficient parse.
911
- */
912
- _markDefs() {
913
- const n = this.json.nodes || [], e = this.json.skins || [], i = this.json.meshes || [];
914
- for (let t = 0, r = e.length; t < r; t++) {
915
- const s = e[t].joints;
916
- for (let a = 0, o = s.length; a < o; a++)
917
- n[s[a]].isBone = !0;
918
- }
919
- for (let t = 0, r = n.length; t < r; t++) {
920
- const s = n[t];
921
- s.mesh !== void 0 && (this._addNodeRef(this.meshCache, s.mesh), s.skin !== void 0 && (i[s.mesh].isSkinnedMesh = !0)), s.camera !== void 0 && this._addNodeRef(this.cameraCache, s.camera);
922
- }
923
- }
924
- /**
925
- * Counts references to shared node / Object3D resources. These resources
926
- * can be reused, or "instantiated", at multiple nodes in the scene
927
- * hierarchy. Mesh, Camera, and Light instances are instantiated and must
928
- * be marked. Non-scenegraph resources (like Materials, Geometries, and
929
- * Textures) can be reused directly and are not marked here.
930
- *
931
- * Example: CesiumMilkTruck sample model reuses "Wheel" meshes.
932
- *
933
- * @param {Object} cache
934
- * @param {Object3D} index
935
- */
936
- _addNodeRef(n, e) {
937
- e !== void 0 && (n.refs[e] === void 0 && (n.refs[e] = n.uses[e] = 0), n.refs[e]++);
938
- }
939
- /**
940
- * Returns a reference to a shared resource, cloning it if necessary.
941
- *
942
- * @param {Object} cache
943
- * @param {Number} index
944
- * @param {Object} object
945
- * @return {Object}
946
- */
947
- _getNodeRef(n, e, i) {
948
- if (n.refs[e] <= 1) return i;
949
- const t = i.clone(), r = (s, a) => {
950
- const o = this.associations.get(s);
951
- o != null && this.associations.set(a, o);
952
- for (const [c, l] of s.children.entries())
953
- r(l, a.children[c]);
954
- };
955
- return r(i, t), t.name += "_instance_" + n.uses[e]++, t;
956
- }
957
- _invokeOne(n) {
958
- const e = Object.values(this.plugins);
959
- e.push(this);
960
- for (let i = 0; i < e.length; i++) {
961
- const t = n(e[i]);
962
- if (t) return t;
963
- }
964
- return null;
965
- }
966
- _invokeAll(n) {
967
- const e = Object.values(this.plugins);
968
- e.unshift(this);
969
- const i = [];
970
- for (let t = 0; t < e.length; t++) {
971
- const r = n(e[t]);
972
- r && i.push(r);
973
- }
974
- return i;
975
- }
976
- /**
977
- * Requests the specified dependency asynchronously, with caching.
978
- * @param {string} type
979
- * @param {number} index
980
- * @return {Promise<Object3D|Material|THREE.Texture|AnimationClip|ArrayBuffer|Object>}
981
- */
982
- getDependency(n, e) {
983
- const i = n + ":" + e;
984
- let t = this.cache.get(i);
985
- if (!t) {
986
- switch (n) {
987
- case "scene":
988
- t = this.loadScene(e);
989
- break;
990
- case "node":
991
- t = this._invokeOne(function(r) {
992
- return r.loadNode && r.loadNode(e);
993
- });
994
- break;
995
- case "mesh":
996
- t = this._invokeOne(function(r) {
997
- return r.loadMesh && r.loadMesh(e);
998
- });
999
- break;
1000
- case "accessor":
1001
- t = this.loadAccessor(e);
1002
- break;
1003
- case "bufferView":
1004
- t = this._invokeOne(function(r) {
1005
- return r.loadBufferView && r.loadBufferView(e);
1006
- });
1007
- break;
1008
- case "buffer":
1009
- t = this.loadBuffer(e);
1010
- break;
1011
- case "material":
1012
- t = this._invokeOne(function(r) {
1013
- return r.loadMaterial && r.loadMaterial(e);
1014
- });
1015
- break;
1016
- case "texture":
1017
- t = this._invokeOne(function(r) {
1018
- return r.loadTexture && r.loadTexture(e);
1019
- });
1020
- break;
1021
- case "skin":
1022
- t = this.loadSkin(e);
1023
- break;
1024
- case "animation":
1025
- t = this._invokeOne(function(r) {
1026
- return r.loadAnimation && r.loadAnimation(e);
1027
- });
1028
- break;
1029
- case "camera":
1030
- t = this.loadCamera(e);
1031
- break;
1032
- default:
1033
- if (t = this._invokeOne(function(r) {
1034
- return r != this && r.getDependency && r.getDependency(n, e);
1035
- }), !t)
1036
- throw new Error("Unknown type: " + n);
1037
- break;
1038
- }
1039
- this.cache.add(i, t);
1040
- }
1041
- return t;
1042
- }
1043
- /**
1044
- * Requests all dependencies of the specified type asynchronously, with caching.
1045
- * @param {string} type
1046
- * @return {Promise<Array<Object>>}
1047
- */
1048
- getDependencies(n) {
1049
- let e = this.cache.get(n);
1050
- if (!e) {
1051
- const i = this, t = this.json[n + (n === "mesh" ? "es" : "s")] || [];
1052
- e = Promise.all(t.map(function(r, s) {
1053
- return i.getDependency(n, s);
1054
- })), this.cache.add(n, e);
1055
- }
1056
- return e;
1057
- }
1058
- /**
1059
- * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#buffers-and-buffer-views
1060
- * @param {number} bufferIndex
1061
- * @return {Promise<ArrayBuffer>}
1062
- */
1063
- loadBuffer(n) {
1064
- const e = this.json.buffers[n], i = this.fileLoader;
1065
- if (e.type && e.type !== "arraybuffer")
1066
- throw new Error("THREE.GLTFLoader: " + e.type + " buffer type is not supported.");
1067
- if (e.uri === void 0 && n === 0)
1068
- return Promise.resolve(this.extensions[g.KHR_BINARY_GLTF].body);
1069
- const t = this.options;
1070
- return new Promise(function(r, s) {
1071
- i.load(G.resolveURL(e.uri, t.path), r, void 0, function() {
1072
- s(new Error('THREE.GLTFLoader: Failed to load buffer "' + e.uri + '".'));
1073
- });
1074
- });
1075
- }
1076
- /**
1077
- * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#buffers-and-buffer-views
1078
- * @param {number} bufferViewIndex
1079
- * @return {Promise<ArrayBuffer>}
1080
- */
1081
- loadBufferView(n) {
1082
- const e = this.json.bufferViews[n];
1083
- return this.getDependency("buffer", e.buffer).then(function(i) {
1084
- const t = e.byteLength || 0, r = e.byteOffset || 0;
1085
- return i.slice(r, r + t);
1086
- });
1087
- }
1088
- /**
1089
- * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#accessors
1090
- * @param {number} accessorIndex
1091
- * @return {Promise<BufferAttribute|InterleavedBufferAttribute>}
1092
- */
1093
- loadAccessor(n) {
1094
- const e = this, i = this.json, t = this.json.accessors[n];
1095
- if (t.bufferView === void 0 && t.sparse === void 0) {
1096
- const s = X[t.type], a = D[t.componentType], o = t.normalized === !0, c = new a(t.count * s);
1097
- return Promise.resolve(new j(c, s, o));
1098
- }
1099
- const r = [];
1100
- return t.bufferView !== void 0 ? r.push(this.getDependency("bufferView", t.bufferView)) : r.push(null), t.sparse !== void 0 && (r.push(this.getDependency("bufferView", t.sparse.indices.bufferView)), r.push(this.getDependency("bufferView", t.sparse.values.bufferView))), Promise.all(r).then(function(s) {
1101
- const a = s[0], o = X[t.type], c = D[t.componentType], l = c.BYTES_PER_ELEMENT, u = l * o, h = t.byteOffset || 0, d = t.bufferView !== void 0 ? i.bufferViews[t.bufferView].byteStride : void 0, m = t.normalized === !0;
1102
- let T, p;
1103
- if (d && d !== u) {
1104
- const A = Math.floor(h / d), R = "InterleavedBuffer:" + t.bufferView + ":" + t.componentType + ":" + A + ":" + t.count;
1105
- let E = e.cache.get(R);
1106
- E || (T = new c(a, A * d, t.count * d / l), E = new Ie(T, d / l), e.cache.add(R, E)), p = new Ne(E, o, h % d / l, m);
1107
- } else
1108
- a === null ? T = new c(t.count * o) : T = new c(a, h, t.count * o), p = new j(T, o, m);
1109
- if (t.sparse !== void 0) {
1110
- const A = X.SCALAR, R = D[t.sparse.indices.componentType], E = t.sparse.indices.byteOffset || 0, x = t.sparse.values.byteOffset || 0, S = new R(s[1], E, t.sparse.count * A), b = new c(s[2], x, t.sparse.count * o);
1111
- a !== null && (p = new j(p.array.slice(), p.itemSize, p.normalized)), p.normalized = !1;
1112
- for (let L = 0, P = S.length; L < P; L++) {
1113
- const I = S[L];
1114
- if (p.setX(I, b[L * o]), o >= 2 && p.setY(I, b[L * o + 1]), o >= 3 && p.setZ(I, b[L * o + 2]), o >= 4 && p.setW(I, b[L * o + 3]), o >= 5) throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.");
1115
- }
1116
- p.normalized = m;
1117
- }
1118
- return p;
1119
- });
1120
- }
1121
- /**
1122
- * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#textures
1123
- * @param {number} textureIndex
1124
- * @return {Promise<THREE.Texture|null>}
1125
- */
1126
- loadTexture(n) {
1127
- const e = this.json, i = this.options, r = e.textures[n].source, s = e.images[r];
1128
- let a = this.textureLoader;
1129
- if (s.uri) {
1130
- const o = i.manager.getHandler(s.uri);
1131
- o !== null && (a = o);
1132
- }
1133
- return this.loadTextureImage(n, r, a);
1134
- }
1135
- loadTextureImage(n, e, i) {
1136
- const t = this, r = this.json, s = r.textures[n], a = r.images[e], o = (a.uri || a.bufferView) + ":" + s.sampler;
1137
- if (this.textureCache[o])
1138
- return this.textureCache[o];
1139
- const c = this.loadImageSource(e, i).then(function(l) {
1140
- l.flipY = !1, l.name = s.name || a.name || "", l.name === "" && typeof a.uri == "string" && a.uri.startsWith("data:image/") === !1 && (l.name = a.uri);
1141
- const h = (r.samplers || {})[s.sampler] || {};
1142
- return l.magFilter = oe[h.magFilter] || Y, l.minFilter = oe[h.minFilter] || pe, l.wrapS = ae[h.wrapS] || Q, l.wrapT = ae[h.wrapT] || Q, l.generateMipmaps = !l.isCompressedTexture && l.minFilter !== me && l.minFilter !== Y, t.associations.set(l, { textures: n }), l;
1143
- }).catch(function() {
1144
- return null;
1145
- });
1146
- return this.textureCache[o] = c, c;
1147
- }
1148
- loadImageSource(n, e) {
1149
- const i = this, t = this.json, r = this.options;
1150
- if (this.sourceCache[n] !== void 0)
1151
- return this.sourceCache[n].then((u) => u.clone());
1152
- const s = t.images[n], a = self.URL || self.webkitURL;
1153
- let o = s.uri || "", c = !1;
1154
- if (s.bufferView !== void 0)
1155
- o = i.getDependency("bufferView", s.bufferView).then(function(u) {
1156
- c = !0;
1157
- const h = new Blob([u], { type: s.mimeType });
1158
- return o = a.createObjectURL(h), o;
1159
- });
1160
- else if (s.uri === void 0)
1161
- throw new Error("THREE.GLTFLoader: Image " + n + " is missing URI and bufferView");
1162
- const l = Promise.resolve(o).then(function(u) {
1163
- return new Promise(function(h, d) {
1164
- let m = h;
1165
- e.isImageBitmapLoader === !0 && (m = function(T) {
1166
- const p = new $(T);
1167
- p.needsUpdate = !0, h(p);
1168
- }), e.load(G.resolveURL(u, r.path), m, void 0, d);
1169
- });
1170
- }).then(function(u) {
1171
- return c === !0 && a.revokeObjectURL(o), y(u, s), u.userData.mimeType = s.mimeType || Pn(s.uri), u;
1172
- }).catch(function(u) {
1173
- throw console.error("THREE.GLTFLoader: Couldn't load texture", o), u;
1174
- });
1175
- return this.sourceCache[n] = l, l;
1176
- }
1177
- /**
1178
- * Asynchronously assigns a texture to the given material parameters.
1179
- *
1180
- * @param {Object} materialParams
1181
- * @param {string} mapName
1182
- * @param {Object} mapDef
1183
- * @param {string} colorSpace
1184
- * @return {Promise<Texture>}
1185
- */
1186
- assignTexture(n, e, i, t) {
1187
- const r = this;
1188
- return this.getDependency("texture", i.index).then(function(s) {
1189
- if (!s) return null;
1190
- if (i.texCoord !== void 0 && i.texCoord > 0 && (s = s.clone(), s.channel = i.texCoord), r.extensions[g.KHR_TEXTURE_TRANSFORM]) {
1191
- const a = i.extensions !== void 0 ? i.extensions[g.KHR_TEXTURE_TRANSFORM] : void 0;
1192
- if (a) {
1193
- const o = r.associations.get(s);
1194
- s = r.extensions[g.KHR_TEXTURE_TRANSFORM].extendTexture(s, a), r.associations.set(s, o);
1195
- }
1196
- }
1197
- return t !== void 0 && (s.colorSpace = t), n[e] = s, s;
1198
- });
1199
- }
1200
- /**
1201
- * Assigns final material to a Mesh, Line, or Points instance. The instance
1202
- * already has a material (generated from the glTF material options alone)
1203
- * but reuse of the same glTF material may require multiple threejs materials
1204
- * to accommodate different primitive types, defines, etc. New materials will
1205
- * be created if necessary, and reused from a cache.
1206
- * @param {Object3D} mesh Mesh, Line, or Points instance.
1207
- */
1208
- assignFinalMaterial(n) {
1209
- const e = n.geometry;
1210
- let i = n.material;
1211
- const t = e.attributes.tangent === void 0, r = e.attributes.color !== void 0, s = e.attributes.normal === void 0;
1212
- if (n.isPoints) {
1213
- const a = "PointsMaterial:" + i.uuid;
1214
- let o = this.cache.get(a);
1215
- o || (o = new ke(), K.prototype.copy.call(o, i), o.color.copy(i.color), o.map = i.map, o.sizeAttenuation = !1, this.cache.add(a, o)), i = o;
1216
- } else if (n.isLine) {
1217
- const a = "LineBasicMaterial:" + i.uuid;
1218
- let o = this.cache.get(a);
1219
- o || (o = new He(), K.prototype.copy.call(o, i), o.color.copy(i.color), o.map = i.map, this.cache.add(a, o)), i = o;
1220
- }
1221
- if (t || r || s) {
1222
- let a = "ClonedMaterial:" + i.uuid + ":";
1223
- t && (a += "derivative-tangents:"), r && (a += "vertex-colors:"), s && (a += "flat-shading:");
1224
- let o = this.cache.get(a);
1225
- o || (o = i.clone(), r && (o.vertexColors = !0), s && (o.flatShading = !0), t && (o.normalScale && (o.normalScale.y *= -1), o.clearcoatNormalScale && (o.clearcoatNormalScale.y *= -1)), this.cache.add(a, o), this.associations.set(o, this.associations.get(i))), i = o;
1226
- }
1227
- n.material = i;
1228
- }
1229
- getMaterialType() {
1230
- return ge;
1231
- }
1232
- /**
1233
- * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#materials
1234
- * @param {number} materialIndex
1235
- * @return {Promise<Material>}
1236
- */
1237
- loadMaterial(n) {
1238
- const e = this, i = this.json, t = this.extensions, r = i.materials[n];
1239
- let s;
1240
- const a = {}, o = r.extensions || {}, c = [];
1241
- if (o[g.KHR_MATERIALS_UNLIT]) {
1242
- const u = t[g.KHR_MATERIALS_UNLIT];
1243
- s = u.getMaterialType(), c.push(u.extendParams(a, r, e));
1244
- } else {
1245
- const u = r.pbrMetallicRoughness || {};
1246
- if (a.color = new C(1, 1, 1), a.opacity = 1, Array.isArray(u.baseColorFactor)) {
1247
- const h = u.baseColorFactor;
1248
- a.color.setRGB(h[0], h[1], h[2], w), a.opacity = h[3];
1249
- }
1250
- u.baseColorTexture !== void 0 && c.push(e.assignTexture(a, "map", u.baseColorTexture, B)), a.metalness = u.metallicFactor !== void 0 ? u.metallicFactor : 1, a.roughness = u.roughnessFactor !== void 0 ? u.roughnessFactor : 1, u.metallicRoughnessTexture !== void 0 && (c.push(e.assignTexture(a, "metalnessMap", u.metallicRoughnessTexture)), c.push(e.assignTexture(a, "roughnessMap", u.metallicRoughnessTexture))), s = this._invokeOne(function(h) {
1251
- return h.getMaterialType && h.getMaterialType(n);
1252
- }), c.push(Promise.all(this._invokeAll(function(h) {
1253
- return h.extendMaterialParams && h.extendMaterialParams(n, a);
1254
- })));
1255
- }
1256
- r.doubleSided === !0 && (a.side = Ge);
1257
- const l = r.alphaMode || z.OPAQUE;
1258
- if (l === z.BLEND ? (a.transparent = !0, a.depthWrite = !1) : (a.transparent = !1, l === z.MASK && (a.alphaTest = r.alphaCutoff !== void 0 ? r.alphaCutoff : 0.5)), r.normalTexture !== void 0 && s !== H && (c.push(e.assignTexture(a, "normalMap", r.normalTexture)), a.normalScale = new fe(1, 1), r.normalTexture.scale !== void 0)) {
1259
- const u = r.normalTexture.scale;
1260
- a.normalScale.set(u, u);
1261
- }
1262
- if (r.occlusionTexture !== void 0 && s !== H && (c.push(e.assignTexture(a, "aoMap", r.occlusionTexture)), r.occlusionTexture.strength !== void 0 && (a.aoMapIntensity = r.occlusionTexture.strength)), r.emissiveFactor !== void 0 && s !== H) {
1263
- const u = r.emissiveFactor;
1264
- a.emissive = new C().setRGB(u[0], u[1], u[2], w);
1265
- }
1266
- return r.emissiveTexture !== void 0 && s !== H && c.push(e.assignTexture(a, "emissiveMap", r.emissiveTexture, B)), Promise.all(c).then(function() {
1267
- const u = new s(a);
1268
- return r.name && (u.name = r.name), y(u, r), e.associations.set(u, { materials: n }), r.extensions && O(t, u, r), u;
1269
- });
1270
- }
1271
- /**
1272
- * When Object3D instances are targeted by animation, they need unique names.
1273
- *
1274
- * @param {String} originalName
1275
- * @return {String}
1276
- */
1277
- createUniqueName(n) {
1278
- const e = Be.sanitizeNodeName(n || "");
1279
- return e in this.nodeNamesUsed ? e + "_" + ++this.nodeNamesUsed[e] : (this.nodeNamesUsed[e] = 0, e);
1280
- }
1281
- /**
1282
- * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#geometry
1283
- *
1284
- * Creates BufferGeometries from primitives.
1285
- *
1286
- * @param {Array<GLTF.Primitive>} primitives
1287
- * @return {Promise<Array<BufferGeometry>>}
1288
- */
1289
- loadGeometries(n) {
1290
- const e = this, i = this.extensions, t = this.primitiveCache;
1291
- function r(a) {
1292
- return i[g.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a, e).then(function(o) {
1293
- return ce(o, a, e);
1294
- });
1295
- }
1296
- const s = [];
1297
- for (let a = 0, o = n.length; a < o; a++) {
1298
- const c = n[a], l = Dn(c), u = t[l];
1299
- if (u)
1300
- s.push(u.promise);
1301
- else {
1302
- let h;
1303
- c.extensions && c.extensions[g.KHR_DRACO_MESH_COMPRESSION] ? h = r(c) : h = ce(new Ue(), c, e), t[l] = { primitive: c, promise: h }, s.push(h);
1304
- }
1305
- }
1306
- return Promise.all(s);
1307
- }
1308
- /**
1309
- * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#meshes
1310
- * @param {number} meshIndex
1311
- * @return {Promise<Group|Mesh|SkinnedMesh>}
1312
- */
1313
- loadMesh(n) {
1314
- const e = this, i = this.json, t = this.extensions, r = i.meshes[n], s = r.primitives, a = [];
1315
- for (let o = 0, c = s.length; o < c; o++) {
1316
- const l = s[o].material === void 0 ? On(this.cache) : this.getDependency("material", s[o].material);
1317
- a.push(l);
1318
- }
1319
- return a.push(e.loadGeometries(s)), Promise.all(a).then(function(o) {
1320
- const c = o.slice(0, o.length - 1), l = o[o.length - 1], u = [];
1321
- for (let d = 0, m = l.length; d < m; d++) {
1322
- const T = l[d], p = s[d];
1323
- let A;
1324
- const R = c[d];
1325
- if (p.mode === _.TRIANGLES || p.mode === _.TRIANGLE_STRIP || p.mode === _.TRIANGLE_FAN || p.mode === void 0)
1326
- A = r.isSkinnedMesh === !0 ? new ve(T, R) : new je(T, R), A.isSkinnedMesh === !0 && A.normalizeSkinWeights(), p.mode === _.TRIANGLE_STRIP ? A.geometry = re(A.geometry, ue) : p.mode === _.TRIANGLE_FAN && (A.geometry = re(A.geometry, W));
1327
- else if (p.mode === _.LINES)
1328
- A = new Ke(T, R);
1329
- else if (p.mode === _.LINE_STRIP)
1330
- A = new Ve(T, R);
1331
- else if (p.mode === _.LINE_LOOP)
1332
- A = new Xe(T, R);
1333
- else if (p.mode === _.POINTS)
1334
- A = new ze(T, R);
1335
- else
1336
- throw new Error("THREE.GLTFLoader: Primitive mode unsupported: " + p.mode);
1337
- Object.keys(A.geometry.morphAttributes).length > 0 && Fn(A, r), A.name = e.createUniqueName(r.name || "mesh_" + n), y(A, r), p.extensions && O(t, A, p), e.assignFinalMaterial(A), u.push(A);
1338
- }
1339
- for (let d = 0, m = u.length; d < m; d++)
1340
- e.associations.set(u[d], {
1341
- meshes: n,
1342
- primitives: d
1343
- });
1344
- if (u.length === 1)
1345
- return r.extensions && O(t, u[0], r), u[0];
1346
- const h = new V();
1347
- r.extensions && O(t, h, r), e.associations.set(h, { meshes: n });
1348
- for (let d = 0, m = u.length; d < m; d++)
1349
- h.add(u[d]);
1350
- return h;
1351
- });
1352
- }
1353
- /**
1354
- * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#cameras
1355
- * @param {number} cameraIndex
1356
- * @return {Promise<THREE.Camera>}
1357
- */
1358
- loadCamera(n) {
1359
- let e;
1360
- const i = this.json.cameras[n], t = i[i.type];
1361
- if (!t) {
1362
- console.warn("THREE.GLTFLoader: Missing camera parameters.");
1363
- return;
1364
- }
1365
- return i.type === "perspective" ? e = new qe(We.radToDeg(t.yfov), t.aspectRatio || 1, t.znear || 1, t.zfar || 2e6) : i.type === "orthographic" && (e = new Ye(-t.xmag, t.xmag, t.ymag, -t.ymag, t.znear, t.zfar)), i.name && (e.name = this.createUniqueName(i.name)), y(e, i), Promise.resolve(e);
1366
- }
1367
- /**
1368
- * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#skins
1369
- * @param {number} skinIndex
1370
- * @return {Promise<Skeleton>}
1371
- */
1372
- loadSkin(n) {
1373
- const e = this.json.skins[n], i = [];
1374
- for (let t = 0, r = e.joints.length; t < r; t++)
1375
- i.push(this._loadNodeShallow(e.joints[t]));
1376
- return e.inverseBindMatrices !== void 0 ? i.push(this.getDependency("accessor", e.inverseBindMatrices)) : i.push(null), Promise.all(i).then(function(t) {
1377
- const r = t.pop(), s = t, a = [], o = [];
1378
- for (let c = 0, l = s.length; c < l; c++) {
1379
- const u = s[c];
1380
- if (u) {
1381
- a.push(u);
1382
- const h = new U();
1383
- r !== null && h.fromArray(r.array, c * 16), o.push(h);
1384
- } else
1385
- console.warn('THREE.GLTFLoader: Joint "%s" could not be found.', e.joints[c]);
1386
- }
1387
- return new Qe(a, o);
1388
- });
1389
- }
1390
- /**
1391
- * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#animations
1392
- * @param {number} animationIndex
1393
- * @return {Promise<AnimationClip>}
1394
- */
1395
- loadAnimation(n) {
1396
- const e = this.json, i = this, t = e.animations[n], r = t.name ? t.name : "animation_" + n, s = [], a = [], o = [], c = [], l = [];
1397
- for (let u = 0, h = t.channels.length; u < h; u++) {
1398
- const d = t.channels[u], m = t.samplers[d.sampler], T = d.target, p = T.node, A = t.parameters !== void 0 ? t.parameters[m.input] : m.input, R = t.parameters !== void 0 ? t.parameters[m.output] : m.output;
1399
- T.node !== void 0 && (s.push(this.getDependency("node", p)), a.push(this.getDependency("accessor", A)), o.push(this.getDependency("accessor", R)), c.push(m), l.push(T));
1400
- }
1401
- return Promise.all([
1402
- Promise.all(s),
1403
- Promise.all(a),
1404
- Promise.all(o),
1405
- Promise.all(c),
1406
- Promise.all(l)
1407
- ]).then(function(u) {
1408
- const h = u[0], d = u[1], m = u[2], T = u[3], p = u[4], A = [];
1409
- for (let R = 0, E = h.length; R < E; R++) {
1410
- const x = h[R], S = d[R], b = m[R], L = T[R], P = p[R];
1411
- if (x === void 0) continue;
1412
- x.updateMatrix && x.updateMatrix();
1413
- const I = i._createAnimationTracks(x, S, b, L, P);
1414
- if (I)
1415
- for (let v = 0; v < I.length; v++)
1416
- A.push(I[v]);
1417
- }
1418
- return new Ze(r, void 0, A);
1419
- });
1420
- }
1421
- createNodeMesh(n) {
1422
- const e = this.json, i = this, t = e.nodes[n];
1423
- return t.mesh === void 0 ? null : i.getDependency("mesh", t.mesh).then(function(r) {
1424
- const s = i._getNodeRef(i.meshCache, t.mesh, r);
1425
- return t.weights !== void 0 && s.traverse(function(a) {
1426
- if (a.isMesh)
1427
- for (let o = 0, c = t.weights.length; o < c; o++)
1428
- a.morphTargetInfluences[o] = t.weights[o];
1429
- }), s;
1430
- });
1431
- }
1432
- /**
1433
- * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#nodes-and-hierarchy
1434
- * @param {number} nodeIndex
1435
- * @return {Promise<Object3D>}
1436
- */
1437
- loadNode(n) {
1438
- const e = this.json, i = this, t = e.nodes[n], r = i._loadNodeShallow(n), s = [], a = t.children || [];
1439
- for (let c = 0, l = a.length; c < l; c++)
1440
- s.push(i.getDependency("node", a[c]));
1441
- const o = t.skin === void 0 ? Promise.resolve(null) : i.getDependency("skin", t.skin);
1442
- return Promise.all([
1443
- r,
1444
- Promise.all(s),
1445
- o
1446
- ]).then(function(c) {
1447
- const l = c[0], u = c[1], h = c[2];
1448
- h !== null && l.traverse(function(d) {
1449
- d.isSkinnedMesh && d.bind(h, kn);
1450
- });
1451
- for (let d = 0, m = u.length; d < m; d++)
1452
- l.add(u[d]);
1453
- return l;
1454
- });
1455
- }
1456
- // ._loadNodeShallow() parses a single node.
1457
- // skin and child nodes are created and added in .loadNode() (no '_' prefix).
1458
- _loadNodeShallow(n) {
1459
- const e = this.json, i = this.extensions, t = this;
1460
- if (this.nodeCache[n] !== void 0)
1461
- return this.nodeCache[n];
1462
- const r = e.nodes[n], s = r.name ? t.createUniqueName(r.name) : "", a = [], o = t._invokeOne(function(c) {
1463
- return c.createNodeMesh && c.createNodeMesh(n);
1464
- });
1465
- return o && a.push(o), r.camera !== void 0 && a.push(t.getDependency("camera", r.camera).then(function(c) {
1466
- return t._getNodeRef(t.cameraCache, r.camera, c);
1467
- })), t._invokeAll(function(c) {
1468
- return c.createNodeAttachment && c.createNodeAttachment(n);
1469
- }).forEach(function(c) {
1470
- a.push(c);
1471
- }), this.nodeCache[n] = Promise.all(a).then(function(c) {
1472
- let l;
1473
- if (r.isBone === !0 ? l = new Je() : c.length > 1 ? l = new V() : c.length === 1 ? l = c[0] : l = new de(), l !== c[0])
1474
- for (let u = 0, h = c.length; u < h; u++)
1475
- l.add(c[u]);
1476
- if (r.name && (l.userData.name = r.name, l.name = s), y(l, r), r.extensions && O(i, l, r), r.matrix !== void 0) {
1477
- const u = new U();
1478
- u.fromArray(r.matrix), l.applyMatrix4(u);
1479
- } else
1480
- r.translation !== void 0 && l.position.fromArray(r.translation), r.rotation !== void 0 && l.quaternion.fromArray(r.rotation), r.scale !== void 0 && l.scale.fromArray(r.scale);
1481
- return t.associations.has(l) || t.associations.set(l, {}), t.associations.get(l).nodes = n, l;
1482
- }), this.nodeCache[n];
1483
- }
1484
- /**
1485
- * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#scenes
1486
- * @param {number} sceneIndex
1487
- * @return {Promise<Group>}
1488
- */
1489
- loadScene(n) {
1490
- const e = this.extensions, i = this.json.scenes[n], t = this, r = new V();
1491
- i.name && (r.name = t.createUniqueName(i.name)), y(r, i), i.extensions && O(e, r, i);
1492
- const s = i.nodes || [], a = [];
1493
- for (let o = 0, c = s.length; o < c; o++)
1494
- a.push(t.getDependency("node", s[o]));
1495
- return Promise.all(a).then(function(o) {
1496
- for (let l = 0, u = o.length; l < u; l++)
1497
- r.add(o[l]);
1498
- const c = (l) => {
1499
- const u = /* @__PURE__ */ new Map();
1500
- for (const [h, d] of t.associations)
1501
- (h instanceof K || h instanceof $) && u.set(h, d);
1502
- return l.traverse((h) => {
1503
- const d = t.associations.get(h);
1504
- d != null && u.set(h, d);
1505
- }), u;
1506
- };
1507
- return t.associations = c(r), r;
1508
- });
1509
- }
1510
- _createAnimationTracks(n, e, i, t, r) {
1511
- const s = [], a = n.name ? n.name : n.uuid, o = [];
1512
- N[r.path] === N.weights ? n.traverse(function(h) {
1513
- h.morphTargetInfluences && o.push(h.name ? h.name : h.uuid);
1514
- }) : o.push(a);
1515
- let c;
1516
- switch (N[r.path]) {
1517
- case N.weights:
1518
- c = ne;
1519
- break;
1520
- case N.rotation:
1521
- c = te;
1522
- break;
1523
- case N.position:
1524
- case N.scale:
1525
- c = ee;
1526
- break;
1527
- default:
1528
- switch (i.itemSize) {
1529
- case 1:
1530
- c = ne;
1531
- break;
1532
- case 2:
1533
- case 3:
1534
- default:
1535
- c = ee;
1536
- break;
1537
- }
1538
- break;
1539
- }
1540
- const l = t.interpolation !== void 0 ? Nn[t.interpolation] : Ae, u = this._getArrayFromAccessor(i);
1541
- for (let h = 0, d = o.length; h < d; h++) {
1542
- const m = new c(
1543
- o[h] + "." + N[r.path],
1544
- e.array,
1545
- u,
1546
- l
1547
- );
1548
- t.interpolation === "CUBICSPLINE" && this._createCubicSplineTrackInterpolant(m), s.push(m);
1549
- }
1550
- return s;
1551
- }
1552
- _getArrayFromAccessor(n) {
1553
- let e = n.array;
1554
- if (n.normalized) {
1555
- const i = J(e.constructor), t = new Float32Array(e.length);
1556
- for (let r = 0, s = e.length; r < s; r++)
1557
- t[r] = e[r] * i;
1558
- e = t;
1559
- }
1560
- return e;
1561
- }
1562
- _createCubicSplineTrackInterpolant(n) {
1563
- n.createInterpolant = function(i) {
1564
- const t = this instanceof te ? In : xe;
1565
- return new t(this.times, this.values, this.getValueSize() / 3, i);
1566
- }, n.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline = !0;
1567
- }
1568
- }
1569
- function Gn(f, n, e) {
1570
- const i = n.attributes, t = new tn();
1571
- if (i.POSITION !== void 0) {
1572
- const a = e.json.accessors[i.POSITION], o = a.min, c = a.max;
1573
- if (o !== void 0 && c !== void 0) {
1574
- if (t.set(
1575
- new F(o[0], o[1], o[2]),
1576
- new F(c[0], c[1], c[2])
1577
- ), a.normalized) {
1578
- const l = J(D[a.componentType]);
1579
- t.min.multiplyScalar(l), t.max.multiplyScalar(l);
1580
- }
1581
- } else {
1582
- console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");
1583
- return;
1584
- }
1585
- } else
1586
- return;
1587
- const r = n.targets;
1588
- if (r !== void 0) {
1589
- const a = new F(), o = new F();
1590
- for (let c = 0, l = r.length; c < l; c++) {
1591
- const u = r[c];
1592
- if (u.POSITION !== void 0) {
1593
- const h = e.json.accessors[u.POSITION], d = h.min, m = h.max;
1594
- if (d !== void 0 && m !== void 0) {
1595
- if (o.setX(Math.max(Math.abs(d[0]), Math.abs(m[0]))), o.setY(Math.max(Math.abs(d[1]), Math.abs(m[1]))), o.setZ(Math.max(Math.abs(d[2]), Math.abs(m[2]))), h.normalized) {
1596
- const T = J(D[h.componentType]);
1597
- o.multiplyScalar(T);
1598
- }
1599
- a.max(o);
1600
- } else
1601
- console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");
1602
- }
1603
- }
1604
- t.expandByVector(a);
1605
- }
1606
- f.boundingBox = t;
1607
- const s = new sn();
1608
- t.getCenter(s.center), s.radius = t.min.distanceTo(t.max) / 2, f.boundingSphere = s;
1609
- }
1610
- function ce(f, n, e) {
1611
- const i = n.attributes, t = [];
1612
- function r(s, a) {
1613
- return e.getDependency("accessor", s).then(function(o) {
1614
- f.setAttribute(a, o);
1615
- });
1616
- }
1617
- for (const s in i) {
1618
- const a = Z[s] || s.toLowerCase();
1619
- a in f.attributes || t.push(r(i[s], a));
1620
- }
1621
- if (n.indices !== void 0 && !f.index) {
1622
- const s = e.getDependency("accessor", n.indices).then(function(a) {
1623
- f.setIndex(a);
1624
- });
1625
- t.push(s);
1626
- }
1627
- return se.workingColorSpace !== w && "COLOR_0" in i && console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${se.workingColorSpace}" not supported.`), y(f, n), Gn(f, n, e), Promise.all(t).then(function() {
1628
- return n.targets !== void 0 ? Cn(f, n.targets, e) : f;
1629
- });
1630
- }
1631
- export {
1632
- Un as G
1633
- };