three-stdlib 2.22.7 → 2.22.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 (1065) hide show
  1. package/dist/_polyfill/CompressedArrayTexture.js +12 -0
  2. package/dist/_polyfill/CompressedArrayTexture.mjs +12 -0
  3. package/dist/_polyfill/Data3DTexture.js +17 -0
  4. package/dist/_polyfill/Data3DTexture.mjs +17 -0
  5. package/dist/animation/AnimationClipCreator.d.ts +12 -0
  6. package/dist/animation/AnimationClipCreator.js +57 -0
  7. package/dist/animation/AnimationClipCreator.mjs +57 -0
  8. package/dist/animation/CCDIKSolver.d.ts +25 -0
  9. package/dist/animation/CCDIKSolver.js +224 -0
  10. package/dist/animation/CCDIKSolver.mjs +224 -0
  11. package/dist/animation/MMDAnimationHelper.d.ts +93 -0
  12. package/dist/animation/MMDAnimationHelper.js +590 -0
  13. package/dist/animation/MMDAnimationHelper.mjs +590 -0
  14. package/dist/animation/MMDPhysics.d.ts +114 -0
  15. package/dist/animation/MMDPhysics.js +819 -0
  16. package/dist/animation/MMDPhysics.mjs +819 -0
  17. package/dist/cameras/CinematicCamera.d.ts +34 -0
  18. package/dist/cameras/CinematicCamera.js +131 -0
  19. package/dist/cameras/CinematicCamera.mjs +131 -0
  20. package/dist/controls/ArcballControls.d.ts +374 -0
  21. package/dist/controls/ArcballControls.js +2039 -0
  22. package/dist/controls/ArcballControls.mjs +2039 -0
  23. package/dist/controls/DeviceOrientationControls.d.ts +27 -0
  24. package/dist/controls/DeviceOrientationControls.js +84 -0
  25. package/dist/controls/DeviceOrientationControls.mjs +84 -0
  26. package/dist/controls/DragControls.d.ts +34 -0
  27. package/dist/controls/DragControls.js +182 -0
  28. package/dist/controls/DragControls.mjs +182 -0
  29. package/dist/controls/FirstPersonControls.d.ts +48 -0
  30. package/dist/controls/FirstPersonControls.js +229 -0
  31. package/dist/controls/FirstPersonControls.mjs +229 -0
  32. package/dist/controls/FlyControls.d.ts +32 -0
  33. package/dist/controls/FlyControls.js +248 -0
  34. package/dist/controls/FlyControls.mjs +248 -0
  35. package/dist/controls/OrbitControls.d.ts +63 -0
  36. package/dist/controls/OrbitControls.js +781 -0
  37. package/dist/controls/OrbitControls.mjs +781 -0
  38. package/dist/controls/PointerLockControls.d.ts +24 -0
  39. package/dist/controls/PointerLockControls.js +103 -0
  40. package/dist/controls/PointerLockControls.mjs +103 -0
  41. package/dist/controls/TrackballControls.d.ts +95 -0
  42. package/dist/controls/TrackballControls.js +502 -0
  43. package/dist/controls/TrackballControls.mjs +502 -0
  44. package/dist/controls/TransformControls.d.ts +151 -0
  45. package/dist/controls/TransformControls.js +1089 -0
  46. package/dist/controls/TransformControls.mjs +1089 -0
  47. package/dist/controls/experimental/CameraControls.d.ts +212 -0
  48. package/dist/controls/experimental/CameraControls.js +736 -0
  49. package/dist/controls/experimental/CameraControls.mjs +736 -0
  50. package/dist/csm/CSM.d.ts +61 -0
  51. package/dist/csm/CSM.js +244 -0
  52. package/dist/csm/CSM.mjs +244 -0
  53. package/dist/csm/CSMFrustum.d.ts +19 -0
  54. package/dist/csm/CSMFrustum.js +75 -0
  55. package/dist/csm/CSMFrustum.mjs +75 -0
  56. package/dist/csm/CSMHelper.d.ts +26 -0
  57. package/dist/csm/CSMHelper.js +114 -0
  58. package/dist/csm/CSMHelper.mjs +114 -0
  59. package/dist/csm/CSMShader.d.ts +4 -0
  60. package/dist/csm/CSMShader.js +257 -0
  61. package/dist/csm/CSMShader.mjs +257 -0
  62. package/dist/curves/CurveExtras.d.ts +68 -0
  63. package/dist/curves/CurveExtras.js +224 -0
  64. package/dist/curves/CurveExtras.mjs +224 -0
  65. package/dist/curves/NURBSCurve.d.ts +11 -0
  66. package/dist/curves/NURBSCurve.js +35 -0
  67. package/dist/curves/NURBSCurve.mjs +35 -0
  68. package/dist/curves/NURBSSurface.d.ts +13 -0
  69. package/dist/curves/NURBSSurface.js +28 -0
  70. package/dist/curves/NURBSSurface.mjs +28 -0
  71. package/dist/curves/NURBSUtils.d.ts +22 -0
  72. package/dist/curves/NURBSUtils.js +226 -0
  73. package/dist/curves/NURBSUtils.mjs +226 -0
  74. package/dist/custom.d.ts +5 -0
  75. package/dist/deprecated/Geometry.d.ts +342 -0
  76. package/dist/deprecated/Geometry.js +971 -0
  77. package/dist/deprecated/Geometry.mjs +971 -0
  78. package/dist/effects/AnaglyphEffect.d.ts +11 -0
  79. package/dist/effects/AnaglyphEffect.js +121 -0
  80. package/dist/effects/AnaglyphEffect.mjs +121 -0
  81. package/dist/effects/AsciiEffect.d.ts +18 -0
  82. package/dist/effects/AsciiEffect.js +173 -0
  83. package/dist/effects/AsciiEffect.mjs +173 -0
  84. package/dist/effects/OutlineEffect.d.ts +28 -0
  85. package/dist/effects/OutlineEffect.js +298 -0
  86. package/dist/effects/OutlineEffect.mjs +298 -0
  87. package/dist/effects/ParallaxBarrierEffect.d.ts +8 -0
  88. package/dist/effects/ParallaxBarrierEffect.js +64 -0
  89. package/dist/effects/ParallaxBarrierEffect.mjs +64 -0
  90. package/dist/effects/PeppersGhostEffect.d.ts +10 -0
  91. package/dist/effects/PeppersGhostEffect.js +85 -0
  92. package/dist/effects/PeppersGhostEffect.mjs +85 -0
  93. package/dist/effects/StereoEffect.d.ts +9 -0
  94. package/dist/effects/StereoEffect.js +32 -0
  95. package/dist/effects/StereoEffect.mjs +32 -0
  96. package/dist/environments/RoomEnvironment.d.ts +5 -0
  97. package/dist/environments/RoomEnvironment.js +95 -0
  98. package/dist/environments/RoomEnvironment.mjs +78 -0
  99. package/dist/exporters/ColladaExporter.d.ts +50 -0
  100. package/dist/exporters/ColladaExporter.js +331 -0
  101. package/dist/exporters/ColladaExporter.mjs +331 -0
  102. package/dist/exporters/DRACOExporter.d.ts +23 -0
  103. package/dist/exporters/DRACOExporter.js +141 -0
  104. package/dist/exporters/DRACOExporter.mjs +141 -0
  105. package/dist/exporters/GLTFExporter.d.ts +446 -0
  106. package/dist/exporters/GLTFExporter.js +1575 -0
  107. package/dist/exporters/GLTFExporter.mjs +1575 -0
  108. package/dist/exporters/MMDExporter.d.ts +12 -0
  109. package/dist/exporters/MMDExporter.js +131 -0
  110. package/dist/exporters/MMDExporter.mjs +131 -0
  111. package/dist/exporters/OBJExporter.d.ts +18 -0
  112. package/dist/exporters/OBJExporter.js +181 -0
  113. package/dist/exporters/OBJExporter.mjs +181 -0
  114. package/dist/exporters/PLYExporter.d.ts +23 -0
  115. package/dist/exporters/PLYExporter.js +280 -0
  116. package/dist/exporters/PLYExporter.mjs +280 -0
  117. package/dist/exporters/STLExporter.d.ts +31 -0
  118. package/dist/exporters/STLExporter.js +146 -0
  119. package/dist/exporters/STLExporter.mjs +146 -0
  120. package/dist/exporters/USDZExporter.d.ts +27 -0
  121. package/dist/exporters/USDZExporter.js +340 -0
  122. package/dist/exporters/USDZExporter.mjs +340 -0
  123. package/dist/geometries/BoxLineGeometry.d.ts +12 -0
  124. package/dist/geometries/BoxLineGeometry.js +45 -0
  125. package/dist/geometries/BoxLineGeometry.mjs +45 -0
  126. package/dist/geometries/ConvexGeometry.d.ts +5 -0
  127. package/dist/geometries/ConvexGeometry.js +29 -0
  128. package/dist/geometries/ConvexGeometry.mjs +29 -0
  129. package/dist/geometries/DecalGeometry.d.ts +10 -0
  130. package/dist/geometries/DecalGeometry.js +184 -0
  131. package/dist/geometries/DecalGeometry.mjs +184 -0
  132. package/dist/geometries/LightningStrike.d.ts +108 -0
  133. package/dist/geometries/LightningStrike.js +548 -0
  134. package/dist/geometries/LightningStrike.mjs +548 -0
  135. package/dist/geometries/ParametricGeometries.d.ts +26 -0
  136. package/dist/geometries/ParametricGeometries.js +129 -0
  137. package/dist/geometries/ParametricGeometries.mjs +129 -0
  138. package/dist/geometries/ParametricGeometry.d.ts +18 -0
  139. package/dist/geometries/ParametricGeometry.js +63 -0
  140. package/dist/geometries/ParametricGeometry.mjs +63 -0
  141. package/dist/geometries/RoundedBoxGeometry.d.ts +5 -0
  142. package/dist/geometries/RoundedBoxGeometry.js +91 -0
  143. package/dist/geometries/RoundedBoxGeometry.mjs +91 -0
  144. package/dist/geometries/TeapotGeometry.d.ts +13 -0
  145. package/dist/geometries/TeapotGeometry.js +1563 -0
  146. package/dist/geometries/TeapotGeometry.mjs +1563 -0
  147. package/dist/geometries/TextGeometry.d.ts +18 -0
  148. package/dist/geometries/TextGeometry.js +27 -0
  149. package/dist/geometries/TextGeometry.mjs +27 -0
  150. package/dist/helpers/LightProbeHelper.d.ts +10 -0
  151. package/dist/helpers/LightProbeHelper.js +73 -0
  152. package/dist/helpers/LightProbeHelper.mjs +73 -0
  153. package/dist/helpers/PositionalAudioHelper.d.ts +13 -0
  154. package/dist/helpers/PositionalAudioHelper.js +68 -0
  155. package/dist/helpers/PositionalAudioHelper.mjs +68 -0
  156. package/dist/helpers/RectAreaLightHelper.d.ts +10 -0
  157. package/dist/helpers/RectAreaLightHelper.js +44 -0
  158. package/dist/helpers/RectAreaLightHelper.mjs +44 -0
  159. package/dist/helpers/VertexNormalsHelper.d.ts +10 -0
  160. package/dist/helpers/VertexNormalsHelper.js +54 -0
  161. package/dist/helpers/VertexNormalsHelper.mjs +54 -0
  162. package/dist/helpers/VertexTangentsHelper.d.ts +10 -0
  163. package/dist/helpers/VertexTangentsHelper.js +45 -0
  164. package/dist/helpers/VertexTangentsHelper.mjs +45 -0
  165. package/dist/index.d.ts +325 -0
  166. package/dist/index.js +978 -0
  167. package/dist/index.mjs +978 -0
  168. package/dist/interactive/HTMLMesh.d.ts +6 -0
  169. package/dist/interactive/HTMLMesh.js +325 -0
  170. package/dist/interactive/HTMLMesh.mjs +325 -0
  171. package/dist/interactive/InteractiveGroup.d.ts +5 -0
  172. package/dist/interactive/InteractiveGroup.js +68 -0
  173. package/dist/interactive/InteractiveGroup.mjs +68 -0
  174. package/dist/interactive/SelectionBox.d.ts +15 -0
  175. package/dist/interactive/SelectionBox.js +137 -0
  176. package/dist/interactive/SelectionBox.mjs +137 -0
  177. package/dist/interactive/SelectionHelper.d.ts +17 -0
  178. package/dist/interactive/SelectionHelper.js +54 -0
  179. package/dist/interactive/SelectionHelper.mjs +54 -0
  180. package/dist/libs/MeshoptDecoder.d.ts +12 -0
  181. package/dist/libs/MeshoptDecoder.js +221 -0
  182. package/dist/libs/MeshoptDecoder.mjs +221 -0
  183. package/dist/libs/MotionControllers.d.ts +175 -0
  184. package/dist/libs/MotionControllers.js +325 -0
  185. package/dist/libs/MotionControllers.mjs +325 -0
  186. package/dist/lights/LightProbeGenerator.d.ts +6 -0
  187. package/dist/lights/LightProbeGenerator.js +145 -0
  188. package/dist/lights/LightProbeGenerator.mjs +145 -0
  189. package/dist/lights/RectAreaLightUniformsLib.d.ts +3 -0
  190. package/dist/lights/RectAreaLightUniformsLib.js +32842 -0
  191. package/dist/lights/RectAreaLightUniformsLib.mjs +32842 -0
  192. package/dist/lines/Line2.d.ts +11 -0
  193. package/dist/lines/Line2.js +13 -0
  194. package/dist/lines/Line2.mjs +13 -0
  195. package/dist/lines/LineGeometry.d.ts +10 -0
  196. package/dist/lines/LineGeometry.js +44 -0
  197. package/dist/lines/LineGeometry.mjs +44 -0
  198. package/dist/lines/LineMaterial.d.ts +31 -0
  199. package/dist/lines/LineMaterial.js +547 -0
  200. package/dist/lines/LineMaterial.mjs +547 -0
  201. package/dist/lines/LineSegments2.d.ts +14 -0
  202. package/dist/lines/LineSegments2.js +203 -0
  203. package/dist/lines/LineSegments2.mjs +203 -0
  204. package/dist/lines/LineSegmentsGeometry.d.ts +16 -0
  205. package/dist/lines/LineSegmentsGeometry.js +124 -0
  206. package/dist/lines/LineSegmentsGeometry.mjs +124 -0
  207. package/dist/lines/Wireframe.d.ts +11 -0
  208. package/dist/lines/Wireframe.js +32 -0
  209. package/dist/lines/Wireframe.mjs +32 -0
  210. package/dist/lines/WireframeGeometry2.d.ts +8 -0
  211. package/dist/lines/WireframeGeometry2.js +13 -0
  212. package/dist/lines/WireframeGeometry2.mjs +13 -0
  213. package/dist/loaders/3DMLoader.d.ts +17 -0
  214. package/dist/loaders/3DMLoader.js +803 -0
  215. package/dist/loaders/3DMLoader.mjs +803 -0
  216. package/dist/loaders/3MFLoader.d.ts +16 -0
  217. package/dist/loaders/3MFLoader.js +854 -0
  218. package/dist/loaders/3MFLoader.mjs +854 -0
  219. package/dist/loaders/AMFLoader.d.ts +14 -0
  220. package/dist/loaders/AMFLoader.js +284 -0
  221. package/dist/loaders/AMFLoader.mjs +284 -0
  222. package/dist/loaders/AssimpLoader.js +1396 -0
  223. package/dist/loaders/AssimpLoader.mjs +1396 -0
  224. package/dist/loaders/BVHLoader.d.ts +21 -0
  225. package/dist/loaders/BVHLoader.js +207 -0
  226. package/dist/loaders/BVHLoader.mjs +207 -0
  227. package/dist/loaders/BasisTextureLoader.d.ts +32 -0
  228. package/dist/loaders/BasisTextureLoader.js +480 -0
  229. package/dist/loaders/BasisTextureLoader.mjs +480 -0
  230. package/dist/loaders/ColladaLoader.d.ts +20 -0
  231. package/dist/loaders/ColladaLoader.js +2405 -0
  232. package/dist/loaders/ColladaLoader.mjs +2405 -0
  233. package/dist/loaders/DDSLoader.d.ts +16 -0
  234. package/dist/loaders/DDSLoader.js +148 -0
  235. package/dist/loaders/DDSLoader.mjs +148 -0
  236. package/dist/loaders/DRACOLoader.d.ts +18 -0
  237. package/dist/loaders/DRACOLoader.js +341 -0
  238. package/dist/loaders/DRACOLoader.mjs +341 -0
  239. package/dist/loaders/EXRLoader.d.ts +18 -0
  240. package/dist/loaders/EXRLoader.js +1354 -0
  241. package/dist/loaders/EXRLoader.mjs +1354 -0
  242. package/dist/loaders/FBXLoader.d.ts +14 -0
  243. package/dist/loaders/FBXLoader.js +2457 -0
  244. package/dist/loaders/FBXLoader.mjs +2457 -0
  245. package/dist/loaders/FontLoader.d.ts +36 -0
  246. package/dist/loaders/FontLoader.js +120 -0
  247. package/dist/loaders/FontLoader.mjs +120 -0
  248. package/dist/loaders/GCodeLoader.d.ts +15 -0
  249. package/dist/loaders/GCodeLoader.js +141 -0
  250. package/dist/loaders/GCodeLoader.mjs +141 -0
  251. package/dist/loaders/GLTFLoader.d.ts +153 -0
  252. package/dist/loaders/GLTFLoader.js +2459 -0
  253. package/dist/loaders/GLTFLoader.mjs +2459 -0
  254. package/dist/loaders/HDRCubeTextureLoader.d.ts +18 -0
  255. package/dist/loaders/HDRCubeTextureLoader.js +75 -0
  256. package/dist/loaders/HDRCubeTextureLoader.mjs +75 -0
  257. package/dist/loaders/KMZLoader.d.ts +16 -0
  258. package/dist/loaders/KMZLoader.js +75 -0
  259. package/dist/loaders/KMZLoader.mjs +75 -0
  260. package/dist/loaders/KTX2Loader.d.ts +16 -0
  261. package/dist/loaders/KTX2Loader.js +461 -0
  262. package/dist/loaders/KTX2Loader.mjs +461 -0
  263. package/dist/loaders/KTXLoader.d.ts +16 -0
  264. package/dist/loaders/KTXLoader.js +93 -0
  265. package/dist/loaders/KTXLoader.mjs +93 -0
  266. package/dist/loaders/LDrawLoader.d.ts +26 -0
  267. package/dist/loaders/LDrawLoader.js +1424 -0
  268. package/dist/loaders/LDrawLoader.mjs +1424 -0
  269. package/dist/loaders/LUT3dlLoader.d.ts +20 -0
  270. package/dist/loaders/LUT3dlLoader.js +103 -0
  271. package/dist/loaders/LUT3dlLoader.mjs +103 -0
  272. package/dist/loaders/LUTCubeLoader.d.ts +23 -0
  273. package/dist/loaders/LUTCubeLoader.js +107 -0
  274. package/dist/loaders/LUTCubeLoader.mjs +107 -0
  275. package/dist/loaders/LWOLoader.d.ts +26 -0
  276. package/dist/loaders/LWOLoader.js +645 -0
  277. package/dist/loaders/LWOLoader.mjs +645 -0
  278. package/dist/loaders/LottieLoader.d.ts +15 -0
  279. package/dist/loaders/LottieLoader.js +47 -0
  280. package/dist/loaders/LottieLoader.mjs +47 -0
  281. package/dist/loaders/MD2Loader.d.ts +14 -0
  282. package/dist/loaders/MD2Loader.js +359 -0
  283. package/dist/loaders/MD2Loader.mjs +359 -0
  284. package/dist/loaders/MDDLoader.d.ts +19 -0
  285. package/dist/loaders/MDDLoader.js +58 -0
  286. package/dist/loaders/MDDLoader.mjs +58 -0
  287. package/dist/loaders/MMDLoader.d.ts +63 -0
  288. package/dist/loaders/MMDLoader.js +1121 -0
  289. package/dist/loaders/MMDLoader.mjs +1121 -0
  290. package/dist/loaders/MTLLoader.d.ts +100 -0
  291. package/dist/loaders/MTLLoader.js +304 -0
  292. package/dist/loaders/MTLLoader.mjs +304 -0
  293. package/dist/loaders/NRRDLoader.d.ts +21 -0
  294. package/dist/loaders/NRRDLoader.js +401 -0
  295. package/dist/loaders/NRRDLoader.mjs +401 -0
  296. package/dist/loaders/NodeMaterialLoader.js +146 -0
  297. package/dist/loaders/NodeMaterialLoader.mjs +146 -0
  298. package/dist/loaders/OBJLoader.d.ts +17 -0
  299. package/dist/loaders/OBJLoader.js +487 -0
  300. package/dist/loaders/OBJLoader.mjs +487 -0
  301. package/dist/loaders/PCDLoader.d.ts +15 -0
  302. package/dist/loaders/PCDLoader.js +248 -0
  303. package/dist/loaders/PCDLoader.mjs +248 -0
  304. package/dist/loaders/PDBLoader.d.ts +22 -0
  305. package/dist/loaders/PDBLoader.js +247 -0
  306. package/dist/loaders/PDBLoader.mjs +247 -0
  307. package/dist/loaders/PLYLoader.d.ts +16 -0
  308. package/dist/loaders/PLYLoader.js +317 -0
  309. package/dist/loaders/PLYLoader.mjs +317 -0
  310. package/dist/loaders/PRWMLoader.d.ts +16 -0
  311. package/dist/loaders/PRWMLoader.js +160 -0
  312. package/dist/loaders/PRWMLoader.mjs +160 -0
  313. package/dist/loaders/PVRLoader.d.ts +16 -0
  314. package/dist/loaders/PVRLoader.js +131 -0
  315. package/dist/loaders/PVRLoader.mjs +131 -0
  316. package/dist/loaders/RGBELoader.d.ts +20 -0
  317. package/dist/loaders/RGBELoader.js +252 -0
  318. package/dist/loaders/RGBELoader.mjs +252 -0
  319. package/dist/loaders/RGBMLoader.d.ts +32 -0
  320. package/dist/loaders/RGBMLoader.js +998 -0
  321. package/dist/loaders/RGBMLoader.mjs +998 -0
  322. package/dist/loaders/STLLoader.d.ts +14 -0
  323. package/dist/loaders/STLLoader.js +190 -0
  324. package/dist/loaders/STLLoader.mjs +190 -0
  325. package/dist/loaders/SVGLoader.d.ts +63 -0
  326. package/dist/loaders/SVGLoader.js +1712 -0
  327. package/dist/loaders/SVGLoader.mjs +1712 -0
  328. package/dist/loaders/TDSLoader.d.ts +42 -0
  329. package/dist/loaders/TDSLoader.js +650 -0
  330. package/dist/loaders/TDSLoader.mjs +650 -0
  331. package/dist/loaders/TGALoader.d.ts +14 -0
  332. package/dist/loaders/TGALoader.js +285 -0
  333. package/dist/loaders/TGALoader.mjs +285 -0
  334. package/dist/loaders/TTFLoader.d.ts +15 -0
  335. package/dist/loaders/TTFLoader.js +131 -0
  336. package/dist/loaders/TTFLoader.mjs +131 -0
  337. package/dist/loaders/TiltLoader.d.ts +14 -0
  338. package/dist/loaders/TiltLoader.js +373 -0
  339. package/dist/loaders/TiltLoader.mjs +373 -0
  340. package/dist/loaders/VOXLoader.d.ts +28 -0
  341. package/dist/loaders/VOXLoader.js +432 -0
  342. package/dist/loaders/VOXLoader.mjs +432 -0
  343. package/dist/loaders/VRMLLoader.d.ts +14 -0
  344. package/dist/loaders/VRMLLoader.js +2105 -0
  345. package/dist/loaders/VRMLLoader.mjs +2105 -0
  346. package/dist/loaders/VRMLoader.js +38 -0
  347. package/dist/loaders/VRMLoader.mjs +38 -0
  348. package/dist/loaders/VTKLoader.d.ts +14 -0
  349. package/dist/loaders/VTKLoader.js +648 -0
  350. package/dist/loaders/VTKLoader.mjs +648 -0
  351. package/dist/loaders/XLoader.js +1258 -0
  352. package/dist/loaders/XLoader.mjs +1258 -0
  353. package/dist/loaders/XYZLoader.d.ts +14 -0
  354. package/dist/loaders/XYZLoader.js +60 -0
  355. package/dist/loaders/XYZLoader.mjs +60 -0
  356. package/dist/loaders/lwo/IFFParser.js +749 -0
  357. package/dist/loaders/lwo/IFFParser.mjs +749 -0
  358. package/dist/loaders/lwo/LWO2Parser.js +327 -0
  359. package/dist/loaders/lwo/LWO2Parser.mjs +327 -0
  360. package/dist/loaders/lwo/LWO3Parser.js +298 -0
  361. package/dist/loaders/lwo/LWO3Parser.mjs +298 -0
  362. package/dist/math/Capsule.d.ts +27 -0
  363. package/dist/math/Capsule.js +100 -0
  364. package/dist/math/Capsule.mjs +100 -0
  365. package/dist/math/ColorConverter.d.ts +21 -0
  366. package/dist/math/ColorConverter.js +52 -0
  367. package/dist/math/ColorConverter.mjs +52 -0
  368. package/dist/math/ConvexHull.d.ts +89 -0
  369. package/dist/math/ConvexHull.js +597 -0
  370. package/dist/math/ConvexHull.mjs +597 -0
  371. package/dist/math/ImprovedNoise.d.ts +4 -0
  372. package/dist/math/ImprovedNoise.js +302 -0
  373. package/dist/math/ImprovedNoise.mjs +302 -0
  374. package/dist/math/Lut.d.ts +27 -0
  375. package/dist/math/Lut.js +135 -0
  376. package/dist/math/Lut.mjs +135 -0
  377. package/dist/math/MeshSurfaceSampler.d.ts +15 -0
  378. package/dist/math/MeshSurfaceSampler.js +107 -0
  379. package/dist/math/MeshSurfaceSampler.mjs +107 -0
  380. package/dist/math/OBB.d.ts +24 -0
  381. package/dist/math/OBB.js +262 -0
  382. package/dist/math/OBB.mjs +262 -0
  383. package/dist/math/Octree.d.ts +24 -0
  384. package/dist/math/Octree.js +278 -0
  385. package/dist/math/Octree.mjs +278 -0
  386. package/dist/math/SimplexNoise.d.ts +21 -0
  387. package/dist/math/SimplexNoise.js +440 -0
  388. package/dist/math/SimplexNoise.mjs +440 -0
  389. package/dist/misc/ConvexObjectBreaker.d.ts +25 -0
  390. package/dist/misc/ConvexObjectBreaker.js +298 -0
  391. package/dist/misc/ConvexObjectBreaker.mjs +298 -0
  392. package/dist/misc/GPUComputationRenderer.d.ts +52 -0
  393. package/dist/misc/GPUComputationRenderer.js +171 -0
  394. package/dist/misc/GPUComputationRenderer.mjs +171 -0
  395. package/dist/misc/Gyroscope.d.ts +5 -0
  396. package/dist/misc/Gyroscope.js +35 -0
  397. package/dist/misc/Gyroscope.mjs +35 -0
  398. package/dist/misc/MD2Character.d.ts +33 -0
  399. package/dist/misc/MD2Character.js +165 -0
  400. package/dist/misc/MD2Character.mjs +165 -0
  401. package/dist/misc/MD2CharacterComplex.d.ts +47 -0
  402. package/dist/misc/MD2CharacterComplex.js +331 -0
  403. package/dist/misc/MD2CharacterComplex.mjs +331 -0
  404. package/dist/misc/MorphAnimMesh.d.ts +13 -0
  405. package/dist/misc/MorphAnimMesh.js +40 -0
  406. package/dist/misc/MorphAnimMesh.mjs +40 -0
  407. package/dist/misc/MorphBlendMesh.d.ts +21 -0
  408. package/dist/misc/MorphBlendMesh.js +179 -0
  409. package/dist/misc/MorphBlendMesh.mjs +179 -0
  410. package/dist/misc/ProgressiveLightmap.d.ts +61 -0
  411. package/dist/misc/ProgressiveLightmap.js +186 -0
  412. package/dist/misc/ProgressiveLightmap.mjs +186 -0
  413. package/dist/misc/RollerCoaster.d.ts +21 -0
  414. package/dist/misc/RollerCoaster.js +346 -0
  415. package/dist/misc/RollerCoaster.mjs +346 -0
  416. package/dist/misc/Timer.d.ts +27 -0
  417. package/dist/misc/Timer.js +101 -0
  418. package/dist/misc/Timer.mjs +101 -0
  419. package/dist/misc/TubePainter.d.ts +10 -0
  420. package/dist/misc/TubePainter.js +123 -0
  421. package/dist/misc/TubePainter.mjs +123 -0
  422. package/dist/misc/Volume.d.ts +37 -0
  423. package/dist/misc/Volume.js +302 -0
  424. package/dist/misc/Volume.mjs +302 -0
  425. package/dist/misc/VolumeSlice.d.ts +28 -0
  426. package/dist/misc/VolumeSlice.js +115 -0
  427. package/dist/misc/VolumeSlice.mjs +115 -0
  428. package/dist/misc/WebGL.d.ts +5 -0
  429. package/dist/misc/WebGL.js +74 -0
  430. package/dist/misc/WebGL.mjs +74 -0
  431. package/dist/modifiers/CurveModifier.d.ts +91 -0
  432. package/dist/modifiers/CurveModifier.js +232 -0
  433. package/dist/modifiers/CurveModifier.mjs +232 -0
  434. package/dist/modifiers/EdgeSplitModifier.d.ts +19 -0
  435. package/dist/modifiers/EdgeSplitModifier.js +167 -0
  436. package/dist/modifiers/EdgeSplitModifier.mjs +168 -0
  437. package/dist/modifiers/SimplifyModifier.d.ts +19 -0
  438. package/dist/modifiers/SimplifyModifier.js +300 -0
  439. package/dist/modifiers/SimplifyModifier.mjs +300 -0
  440. package/dist/modifiers/TessellateModifier.d.ts +11 -0
  441. package/dist/modifiers/TessellateModifier.js +214 -0
  442. package/dist/modifiers/TessellateModifier.mjs +214 -0
  443. package/dist/nodes/Nodes.js +347 -0
  444. package/dist/nodes/Nodes.mjs +347 -0
  445. package/dist/nodes/ShaderNode.js +408 -0
  446. package/dist/nodes/ShaderNode.mjs +408 -0
  447. package/dist/nodes/accessors/BufferNode.js +14 -0
  448. package/dist/nodes/accessors/BufferNode.mjs +15 -0
  449. package/dist/nodes/accessors/CameraNode.js +43 -0
  450. package/dist/nodes/accessors/CameraNode.mjs +44 -0
  451. package/dist/nodes/accessors/CubeTextureNode.js +41 -0
  452. package/dist/nodes/accessors/CubeTextureNode.mjs +42 -0
  453. package/dist/nodes/accessors/MaterialNode.js +70 -0
  454. package/dist/nodes/accessors/MaterialNode.mjs +71 -0
  455. package/dist/nodes/accessors/MaterialReferenceNode.js +13 -0
  456. package/dist/nodes/accessors/MaterialReferenceNode.mjs +14 -0
  457. package/dist/nodes/accessors/ModelNode.js +8 -0
  458. package/dist/nodes/accessors/ModelNode.mjs +9 -0
  459. package/dist/nodes/accessors/ModelViewProjectionNode.js +23 -0
  460. package/dist/nodes/accessors/ModelViewProjectionNode.mjs +24 -0
  461. package/dist/nodes/accessors/NormalNode.js +61 -0
  462. package/dist/nodes/accessors/NormalNode.mjs +62 -0
  463. package/dist/nodes/accessors/Object3DNode.js +75 -0
  464. package/dist/nodes/accessors/Object3DNode.mjs +76 -0
  465. package/dist/nodes/accessors/PointUVNode.js +12 -0
  466. package/dist/nodes/accessors/PointUVNode.mjs +13 -0
  467. package/dist/nodes/accessors/PositionNode.js +64 -0
  468. package/dist/nodes/accessors/PositionNode.mjs +65 -0
  469. package/dist/nodes/accessors/ReferenceNode.js +36 -0
  470. package/dist/nodes/accessors/ReferenceNode.mjs +37 -0
  471. package/dist/nodes/accessors/ReflectNode.js +42 -0
  472. package/dist/nodes/accessors/ReflectNode.mjs +43 -0
  473. package/dist/nodes/accessors/SkinningNode.js +57 -0
  474. package/dist/nodes/accessors/SkinningNode.mjs +58 -0
  475. package/dist/nodes/accessors/TextureNode.js +53 -0
  476. package/dist/nodes/accessors/TextureNode.mjs +54 -0
  477. package/dist/nodes/accessors/UVNode.js +22 -0
  478. package/dist/nodes/accessors/UVNode.mjs +23 -0
  479. package/dist/nodes/core/ArrayUniformNode.js +13 -0
  480. package/dist/nodes/core/ArrayUniformNode.mjs +14 -0
  481. package/dist/nodes/core/AttributeNode.js +29 -0
  482. package/dist/nodes/core/AttributeNode.mjs +30 -0
  483. package/dist/nodes/core/BypassNode.js +21 -0
  484. package/dist/nodes/core/BypassNode.mjs +22 -0
  485. package/dist/nodes/core/CodeNode.js +27 -0
  486. package/dist/nodes/core/CodeNode.mjs +28 -0
  487. package/dist/nodes/core/ConstNode.js +13 -0
  488. package/dist/nodes/core/ConstNode.mjs +14 -0
  489. package/dist/nodes/core/ContextNode.js +21 -0
  490. package/dist/nodes/core/ContextNode.mjs +22 -0
  491. package/dist/nodes/core/ExpressionNode.js +18 -0
  492. package/dist/nodes/core/ExpressionNode.mjs +19 -0
  493. package/dist/nodes/core/FunctionCallNode.js +36 -0
  494. package/dist/nodes/core/FunctionCallNode.mjs +37 -0
  495. package/dist/nodes/core/FunctionNode.js +55 -0
  496. package/dist/nodes/core/FunctionNode.mjs +56 -0
  497. package/dist/nodes/core/InputNode.js +37 -0
  498. package/dist/nodes/core/InputNode.mjs +38 -0
  499. package/dist/nodes/core/Node.js +138 -0
  500. package/dist/nodes/core/Node.mjs +139 -0
  501. package/dist/nodes/core/NodeAttribute.js +9 -0
  502. package/dist/nodes/core/NodeAttribute.mjs +10 -0
  503. package/dist/nodes/core/NodeBuilder.js +402 -0
  504. package/dist/nodes/core/NodeBuilder.mjs +402 -0
  505. package/dist/nodes/core/NodeCode.js +10 -0
  506. package/dist/nodes/core/NodeCode.mjs +11 -0
  507. package/dist/nodes/core/NodeFrame.js +34 -0
  508. package/dist/nodes/core/NodeFrame.mjs +35 -0
  509. package/dist/nodes/core/NodeFunctionInput.js +12 -0
  510. package/dist/nodes/core/NodeFunctionInput.mjs +13 -0
  511. package/dist/nodes/core/NodeKeywords.js +43 -0
  512. package/dist/nodes/core/NodeKeywords.mjs +44 -0
  513. package/dist/nodes/core/NodeUniform.js +17 -0
  514. package/dist/nodes/core/NodeUniform.mjs +18 -0
  515. package/dist/nodes/core/NodeUtils.js +57 -0
  516. package/dist/nodes/core/NodeUtils.mjs +57 -0
  517. package/dist/nodes/core/NodeVar.js +9 -0
  518. package/dist/nodes/core/NodeVar.mjs +10 -0
  519. package/dist/nodes/core/NodeVary.js +9 -0
  520. package/dist/nodes/core/NodeVary.mjs +10 -0
  521. package/dist/nodes/core/PropertyNode.js +20 -0
  522. package/dist/nodes/core/PropertyNode.mjs +21 -0
  523. package/dist/nodes/core/TempNode.js +24 -0
  524. package/dist/nodes/core/TempNode.mjs +25 -0
  525. package/dist/nodes/core/UniformNode.js +22 -0
  526. package/dist/nodes/core/UniformNode.mjs +23 -0
  527. package/dist/nodes/core/VarNode.js +30 -0
  528. package/dist/nodes/core/VarNode.mjs +31 -0
  529. package/dist/nodes/core/VaryNode.js +29 -0
  530. package/dist/nodes/core/VaryNode.mjs +30 -0
  531. package/dist/nodes/core/constants.js +24 -0
  532. package/dist/nodes/core/constants.mjs +24 -0
  533. package/dist/nodes/display/ColorSpaceNode.js +62 -0
  534. package/dist/nodes/display/ColorSpaceNode.mjs +62 -0
  535. package/dist/nodes/display/NormalMapNode.js +53 -0
  536. package/dist/nodes/display/NormalMapNode.mjs +54 -0
  537. package/dist/nodes/fog/FogNode.js +14 -0
  538. package/dist/nodes/fog/FogNode.mjs +15 -0
  539. package/dist/nodes/fog/FogRangeNode.js +16 -0
  540. package/dist/nodes/fog/FogRangeNode.mjs +17 -0
  541. package/dist/nodes/functions/BSDFs.js +64 -0
  542. package/dist/nodes/functions/BSDFs.mjs +64 -0
  543. package/dist/nodes/lights/LightContextNode.js +34 -0
  544. package/dist/nodes/lights/LightContextNode.mjs +35 -0
  545. package/dist/nodes/lights/LightNode.js +57 -0
  546. package/dist/nodes/lights/LightNode.mjs +58 -0
  547. package/dist/nodes/lights/LightsNode.js +58 -0
  548. package/dist/nodes/lights/LightsNode.mjs +59 -0
  549. package/dist/nodes/loaders/NodeLoader.js +195 -0
  550. package/dist/nodes/loaders/NodeLoader.mjs +196 -0
  551. package/dist/nodes/loaders/NodeMaterialLoader.js +23 -0
  552. package/dist/nodes/loaders/NodeMaterialLoader.mjs +24 -0
  553. package/dist/nodes/loaders/NodeObjectLoader.js +39 -0
  554. package/dist/nodes/loaders/NodeObjectLoader.mjs +40 -0
  555. package/dist/nodes/materials/LineBasicNodeMaterial.js +26 -0
  556. package/dist/nodes/materials/LineBasicNodeMaterial.mjs +27 -0
  557. package/dist/nodes/materials/Materials.js +24 -0
  558. package/dist/nodes/materials/Materials.mjs +24 -0
  559. package/dist/nodes/materials/MeshBasicNodeMaterial.js +27 -0
  560. package/dist/nodes/materials/MeshBasicNodeMaterial.mjs +28 -0
  561. package/dist/nodes/materials/MeshStandardNodeMaterial.js +40 -0
  562. package/dist/nodes/materials/MeshStandardNodeMaterial.mjs +41 -0
  563. package/dist/nodes/materials/NodeMaterial.js +63 -0
  564. package/dist/nodes/materials/NodeMaterial.mjs +64 -0
  565. package/dist/nodes/materials/PointsNodeMaterial.js +29 -0
  566. package/dist/nodes/materials/PointsNodeMaterial.mjs +30 -0
  567. package/dist/nodes/math/CondNode.js +40 -0
  568. package/dist/nodes/math/CondNode.mjs +41 -0
  569. package/dist/nodes/math/MathNode.js +165 -0
  570. package/dist/nodes/math/MathNode.mjs +166 -0
  571. package/dist/nodes/math/OperatorNode.js +102 -0
  572. package/dist/nodes/math/OperatorNode.mjs +103 -0
  573. package/dist/nodes/procedural/CheckerNode.js +20 -0
  574. package/dist/nodes/procedural/CheckerNode.mjs +21 -0
  575. package/dist/nodes/utils/ArrayElementNode.js +18 -0
  576. package/dist/nodes/utils/ArrayElementNode.mjs +19 -0
  577. package/dist/nodes/utils/ConvertNode.js +24 -0
  578. package/dist/nodes/utils/ConvertNode.mjs +25 -0
  579. package/dist/nodes/utils/JoinNode.js +25 -0
  580. package/dist/nodes/utils/JoinNode.mjs +26 -0
  581. package/dist/nodes/utils/MatcapUVNode.js +15 -0
  582. package/dist/nodes/utils/MatcapUVNode.mjs +16 -0
  583. package/dist/nodes/utils/OscNode.js +49 -0
  584. package/dist/nodes/utils/OscNode.mjs +50 -0
  585. package/dist/nodes/utils/SplitNode.js +44 -0
  586. package/dist/nodes/utils/SplitNode.mjs +45 -0
  587. package/dist/nodes/utils/SpriteSheetUVNode.js +39 -0
  588. package/dist/nodes/utils/SpriteSheetUVNode.mjs +40 -0
  589. package/dist/nodes/utils/TimerNode.js +43 -0
  590. package/dist/nodes/utils/TimerNode.mjs +44 -0
  591. package/dist/objects/GroundProjectedEnv.d.ts +12 -0
  592. package/dist/objects/GroundProjectedEnv.js +134 -0
  593. package/dist/objects/GroundProjectedEnv.mjs +134 -0
  594. package/dist/objects/Lensflare.d.ts +17 -0
  595. package/dist/objects/Lensflare.js +280 -0
  596. package/dist/objects/Lensflare.mjs +280 -0
  597. package/dist/objects/LightningStorm.d.ts +32 -0
  598. package/dist/objects/LightningStorm.js +110 -0
  599. package/dist/objects/LightningStorm.mjs +110 -0
  600. package/dist/objects/MarchingCubes.d.ts +75 -0
  601. package/dist/objects/MarchingCubes.js +457 -0
  602. package/dist/objects/MarchingCubes.mjs +457 -0
  603. package/dist/objects/Reflector.d.ts +19 -0
  604. package/dist/objects/Reflector.js +175 -0
  605. package/dist/objects/Reflector.mjs +175 -0
  606. package/dist/objects/ReflectorForSSRPass.d.ts +48 -0
  607. package/dist/objects/ReflectorForSSRPass.js +256 -0
  608. package/dist/objects/ReflectorForSSRPass.mjs +256 -0
  609. package/dist/objects/ReflectorRTT.js +10 -0
  610. package/dist/objects/ReflectorRTT.mjs +10 -0
  611. package/dist/objects/Refractor.d.ts +19 -0
  612. package/dist/objects/Refractor.js +188 -0
  613. package/dist/objects/Refractor.mjs +188 -0
  614. package/dist/objects/ShadowMesh.d.ts +7 -0
  615. package/dist/objects/ShadowMesh.js +41 -0
  616. package/dist/objects/ShadowMesh.mjs +41 -0
  617. package/dist/objects/Sky.d.ts +43 -0
  618. package/dist/objects/Sky.js +156 -0
  619. package/dist/objects/Sky.mjs +156 -0
  620. package/dist/objects/Water.d.ts +22 -0
  621. package/dist/objects/Water.js +241 -0
  622. package/dist/objects/Water.mjs +241 -0
  623. package/dist/objects/Water2.d.ts +22 -0
  624. package/dist/objects/Water2.js +258 -0
  625. package/dist/objects/Water2.mjs +258 -0
  626. package/dist/offscreen/jank.js +26 -0
  627. package/dist/offscreen/jank.mjs +27 -0
  628. package/dist/offscreen/offscreen.js +8 -0
  629. package/dist/offscreen/offscreen.mjs +7 -0
  630. package/dist/offscreen/scene.js +68 -0
  631. package/dist/offscreen/scene.mjs +52 -0
  632. package/dist/physics/AmmoPhysics.d.ts +7 -0
  633. package/dist/physics/AmmoPhysics.js +166 -0
  634. package/dist/physics/AmmoPhysics.mjs +166 -0
  635. package/dist/postprocessing/AdaptiveToneMappingPass.d.ts +29 -0
  636. package/dist/postprocessing/AdaptiveToneMappingPass.js +225 -0
  637. package/dist/postprocessing/AdaptiveToneMappingPass.mjs +225 -0
  638. package/dist/postprocessing/AfterimagePass.d.ts +15 -0
  639. package/dist/postprocessing/AfterimagePass.js +68 -0
  640. package/dist/postprocessing/AfterimagePass.mjs +68 -0
  641. package/dist/postprocessing/BloomPass.d.ts +16 -0
  642. package/dist/postprocessing/BloomPass.js +109 -0
  643. package/dist/postprocessing/BloomPass.mjs +109 -0
  644. package/dist/postprocessing/BokehPass.d.ts +26 -0
  645. package/dist/postprocessing/BokehPass.js +90 -0
  646. package/dist/postprocessing/BokehPass.mjs +90 -0
  647. package/dist/postprocessing/ClearPass.d.ts +10 -0
  648. package/dist/postprocessing/ClearPass.js +36 -0
  649. package/dist/postprocessing/ClearPass.mjs +36 -0
  650. package/dist/postprocessing/CubeTexturePass.d.ts +14 -0
  651. package/dist/postprocessing/CubeTexturePass.js +49 -0
  652. package/dist/postprocessing/CubeTexturePass.mjs +49 -0
  653. package/dist/postprocessing/DotScreenPass.d.ts +10 -0
  654. package/dist/postprocessing/DotScreenPass.js +49 -0
  655. package/dist/postprocessing/DotScreenPass.mjs +49 -0
  656. package/dist/postprocessing/EffectComposer.d.ts +27 -0
  657. package/dist/postprocessing/EffectComposer.js +156 -0
  658. package/dist/postprocessing/EffectComposer.mjs +156 -0
  659. package/dist/postprocessing/FilmPass.d.ts +10 -0
  660. package/dist/postprocessing/FilmPass.js +51 -0
  661. package/dist/postprocessing/FilmPass.mjs +51 -0
  662. package/dist/postprocessing/GlitchPass.d.ts +15 -0
  663. package/dist/postprocessing/GlitchPass.js +84 -0
  664. package/dist/postprocessing/GlitchPass.mjs +84 -0
  665. package/dist/postprocessing/HalftonePass.d.ts +26 -0
  666. package/dist/postprocessing/HalftonePass.js +53 -0
  667. package/dist/postprocessing/HalftonePass.mjs +53 -0
  668. package/dist/postprocessing/LUTPass.d.ts +13 -0
  669. package/dist/postprocessing/LUTPass.js +142 -0
  670. package/dist/postprocessing/LUTPass.mjs +142 -0
  671. package/dist/postprocessing/MaskPass.d.ts +14 -0
  672. package/dist/postprocessing/MaskPass.js +69 -0
  673. package/dist/postprocessing/MaskPass.mjs +69 -0
  674. package/dist/postprocessing/OutlinePass.d.ts +53 -0
  675. package/dist/postprocessing/OutlinePass.js +479 -0
  676. package/dist/postprocessing/OutlinePass.mjs +479 -0
  677. package/dist/postprocessing/Pass.d.ts +20 -0
  678. package/dist/postprocessing/Pass.js +48 -0
  679. package/dist/postprocessing/Pass.mjs +48 -0
  680. package/dist/postprocessing/RenderPass.d.ts +14 -0
  681. package/dist/postprocessing/RenderPass.js +59 -0
  682. package/dist/postprocessing/RenderPass.mjs +59 -0
  683. package/dist/postprocessing/RenderPixelatedPass.js +199 -0
  684. package/dist/postprocessing/RenderPixelatedPass.mjs +199 -0
  685. package/dist/postprocessing/SAOPass.d.ts +79 -0
  686. package/dist/postprocessing/SAOPass.js +282 -0
  687. package/dist/postprocessing/SAOPass.mjs +282 -0
  688. package/dist/postprocessing/SMAAPass.d.ts +21 -0
  689. package/dist/postprocessing/SMAAPass.js +112 -0
  690. package/dist/postprocessing/SMAAPass.mjs +112 -0
  691. package/dist/postprocessing/SSAARenderPass.d.ts +17 -0
  692. package/dist/postprocessing/SSAARenderPass.js +171 -0
  693. package/dist/postprocessing/SSAARenderPass.mjs +171 -0
  694. package/dist/postprocessing/SSAOPass.d.ts +71 -0
  695. package/dist/postprocessing/SSAOPass.js +265 -0
  696. package/dist/postprocessing/SSAOPass.mjs +265 -0
  697. package/dist/postprocessing/SSRPass.d.ts +124 -0
  698. package/dist/postprocessing/SSRPass.js +438 -0
  699. package/dist/postprocessing/SSRPass.mjs +438 -0
  700. package/dist/postprocessing/SavePass.d.ts +12 -0
  701. package/dist/postprocessing/SavePass.js +37 -0
  702. package/dist/postprocessing/SavePass.mjs +37 -0
  703. package/dist/postprocessing/ShaderPass.d.ts +13 -0
  704. package/dist/postprocessing/ShaderPass.js +49 -0
  705. package/dist/postprocessing/ShaderPass.mjs +49 -0
  706. package/dist/postprocessing/TAARenderPass.d.ts +8 -0
  707. package/dist/postprocessing/TAARenderPass.js +89 -0
  708. package/dist/postprocessing/TAARenderPass.mjs +89 -0
  709. package/dist/postprocessing/TexturePass.d.ts +12 -0
  710. package/dist/postprocessing/TexturePass.js +39 -0
  711. package/dist/postprocessing/TexturePass.mjs +39 -0
  712. package/dist/postprocessing/UnrealBloomPass.d.ts +31 -0
  713. package/dist/postprocessing/UnrealBloomPass.js +220 -0
  714. package/dist/postprocessing/UnrealBloomPass.mjs +220 -0
  715. package/dist/postprocessing/WaterPass.d.ts +30 -0
  716. package/dist/postprocessing/WaterPass.js +72 -0
  717. package/dist/postprocessing/WaterPass.mjs +72 -0
  718. package/dist/renderers/CSS2DRenderer.d.ts +22 -0
  719. package/dist/renderers/CSS2DRenderer.js +121 -0
  720. package/dist/renderers/CSS2DRenderer.mjs +121 -0
  721. package/dist/renderers/CSS3DRenderer.d.ts +26 -0
  722. package/dist/renderers/CSS3DRenderer.js +133 -0
  723. package/dist/renderers/CSS3DRenderer.mjs +133 -0
  724. package/dist/renderers/Projector.d.ts +60 -0
  725. package/dist/renderers/Projector.js +511 -0
  726. package/dist/renderers/Projector.mjs +511 -0
  727. package/dist/renderers/SVGRenderer.d.ts +25 -0
  728. package/dist/renderers/SVGRenderer.js +306 -0
  729. package/dist/renderers/SVGRenderer.mjs +306 -0
  730. package/dist/renderers/nodes/accessors/CameraNode.js +62 -0
  731. package/dist/renderers/nodes/accessors/CameraNode.mjs +63 -0
  732. package/dist/renderers/nodes/accessors/ModelNode.js +60 -0
  733. package/dist/renderers/nodes/accessors/ModelNode.mjs +61 -0
  734. package/dist/renderers/nodes/accessors/ModelViewProjectionNode.js +20 -0
  735. package/dist/renderers/nodes/accessors/ModelViewProjectionNode.mjs +21 -0
  736. package/dist/renderers/nodes/accessors/NormalNode.js +60 -0
  737. package/dist/renderers/nodes/accessors/NormalNode.mjs +61 -0
  738. package/dist/renderers/nodes/accessors/PositionNode.js +29 -0
  739. package/dist/renderers/nodes/accessors/PositionNode.mjs +30 -0
  740. package/dist/renderers/nodes/accessors/UVNode.js +12 -0
  741. package/dist/renderers/nodes/accessors/UVNode.mjs +13 -0
  742. package/dist/renderers/nodes/core/AttributeNode.js +34 -0
  743. package/dist/renderers/nodes/core/AttributeNode.mjs +35 -0
  744. package/dist/renderers/nodes/core/InputNode.js +30 -0
  745. package/dist/renderers/nodes/core/InputNode.mjs +31 -0
  746. package/dist/renderers/nodes/core/Node.js +33 -0
  747. package/dist/renderers/nodes/core/Node.mjs +34 -0
  748. package/dist/renderers/nodes/core/NodeAttribute.js +9 -0
  749. package/dist/renderers/nodes/core/NodeAttribute.mjs +10 -0
  750. package/dist/renderers/nodes/core/NodeBuilder.js +248 -0
  751. package/dist/renderers/nodes/core/NodeBuilder.mjs +249 -0
  752. package/dist/renderers/nodes/core/NodeFrame.js +34 -0
  753. package/dist/renderers/nodes/core/NodeFrame.mjs +35 -0
  754. package/dist/renderers/nodes/core/NodeSlot.js +9 -0
  755. package/dist/renderers/nodes/core/NodeSlot.mjs +10 -0
  756. package/dist/renderers/nodes/core/NodeUniform.js +17 -0
  757. package/dist/renderers/nodes/core/NodeUniform.mjs +18 -0
  758. package/dist/renderers/nodes/core/NodeVary.js +10 -0
  759. package/dist/renderers/nodes/core/NodeVary.mjs +11 -0
  760. package/dist/renderers/nodes/core/VaryNode.js +21 -0
  761. package/dist/renderers/nodes/core/VaryNode.mjs +22 -0
  762. package/dist/renderers/nodes/core/constants.js +22 -0
  763. package/dist/renderers/nodes/core/constants.mjs +22 -0
  764. package/dist/renderers/nodes/inputs/ColorNode.js +10 -0
  765. package/dist/renderers/nodes/inputs/ColorNode.mjs +11 -0
  766. package/dist/renderers/nodes/inputs/FloatNode.js +10 -0
  767. package/dist/renderers/nodes/inputs/FloatNode.mjs +11 -0
  768. package/dist/renderers/nodes/inputs/Matrix3Node.js +11 -0
  769. package/dist/renderers/nodes/inputs/Matrix3Node.mjs +12 -0
  770. package/dist/renderers/nodes/inputs/Matrix4Node.js +11 -0
  771. package/dist/renderers/nodes/inputs/Matrix4Node.mjs +12 -0
  772. package/dist/renderers/nodes/inputs/TextureNode.js +19 -0
  773. package/dist/renderers/nodes/inputs/TextureNode.mjs +20 -0
  774. package/dist/renderers/nodes/inputs/Vector2Node.js +10 -0
  775. package/dist/renderers/nodes/inputs/Vector2Node.mjs +11 -0
  776. package/dist/renderers/nodes/inputs/Vector3Node.js +11 -0
  777. package/dist/renderers/nodes/inputs/Vector3Node.mjs +12 -0
  778. package/dist/renderers/nodes/inputs/Vector4Node.js +11 -0
  779. package/dist/renderers/nodes/inputs/Vector4Node.mjs +12 -0
  780. package/dist/renderers/nodes/math/MathNode.js +54 -0
  781. package/dist/renderers/nodes/math/MathNode.mjs +55 -0
  782. package/dist/renderers/nodes/math/OperatorNode.js +41 -0
  783. package/dist/renderers/nodes/math/OperatorNode.mjs +42 -0
  784. package/dist/renderers/nodes/utils/SwitchNode.js +19 -0
  785. package/dist/renderers/nodes/utils/SwitchNode.mjs +20 -0
  786. package/dist/renderers/nodes/utils/TimerNode.js +13 -0
  787. package/dist/renderers/nodes/utils/TimerNode.mjs +14 -0
  788. package/dist/renderers/webgpu/WebGPU.js +23 -0
  789. package/dist/renderers/webgpu/WebGPU.mjs +24 -0
  790. package/dist/renderers/webgpu/WebGPUAttributes.js +68 -0
  791. package/dist/renderers/webgpu/WebGPUAttributes.mjs +69 -0
  792. package/dist/renderers/webgpu/WebGPUBackground.js +60 -0
  793. package/dist/renderers/webgpu/WebGPUBackground.mjs +61 -0
  794. package/dist/renderers/webgpu/WebGPUBinding.js +13 -0
  795. package/dist/renderers/webgpu/WebGPUBinding.mjs +14 -0
  796. package/dist/renderers/webgpu/WebGPUBindings.js +154 -0
  797. package/dist/renderers/webgpu/WebGPUBindings.mjs +155 -0
  798. package/dist/renderers/webgpu/WebGPUComputePipelines.js +43 -0
  799. package/dist/renderers/webgpu/WebGPUComputePipelines.mjs +44 -0
  800. package/dist/renderers/webgpu/WebGPUGeometries.js +40 -0
  801. package/dist/renderers/webgpu/WebGPUGeometries.mjs +41 -0
  802. package/dist/renderers/webgpu/WebGPUInfo.js +45 -0
  803. package/dist/renderers/webgpu/WebGPUInfo.mjs +46 -0
  804. package/dist/renderers/webgpu/WebGPUObjects.js +24 -0
  805. package/dist/renderers/webgpu/WebGPUObjects.mjs +25 -0
  806. package/dist/renderers/webgpu/WebGPUProperties.js +21 -0
  807. package/dist/renderers/webgpu/WebGPUProperties.mjs +22 -0
  808. package/dist/renderers/webgpu/WebGPURenderLists.js +118 -0
  809. package/dist/renderers/webgpu/WebGPURenderLists.mjs +119 -0
  810. package/dist/renderers/webgpu/WebGPURenderPipelines.js +545 -0
  811. package/dist/renderers/webgpu/WebGPURenderPipelines.mjs +546 -0
  812. package/dist/renderers/webgpu/WebGPURenderer.js +596 -0
  813. package/dist/renderers/webgpu/WebGPURenderer.mjs +575 -0
  814. package/dist/renderers/webgpu/WebGPUSampledTexture.js +40 -0
  815. package/dist/renderers/webgpu/WebGPUSampledTexture.mjs +40 -0
  816. package/dist/renderers/webgpu/WebGPUSampler.js +14 -0
  817. package/dist/renderers/webgpu/WebGPUSampler.mjs +15 -0
  818. package/dist/renderers/webgpu/WebGPUStorageBuffer.js +14 -0
  819. package/dist/renderers/webgpu/WebGPUStorageBuffer.mjs +15 -0
  820. package/dist/renderers/webgpu/WebGPUTextureRenderer.js +22 -0
  821. package/dist/renderers/webgpu/WebGPUTextureRenderer.mjs +23 -0
  822. package/dist/renderers/webgpu/WebGPUTextureUtils.js +97 -0
  823. package/dist/renderers/webgpu/WebGPUTextureUtils.mjs +98 -0
  824. package/dist/renderers/webgpu/WebGPUTextures.js +483 -0
  825. package/dist/renderers/webgpu/WebGPUTextures.mjs +484 -0
  826. package/dist/renderers/webgpu/WebGPUUniform.js +81 -0
  827. package/dist/renderers/webgpu/WebGPUUniform.mjs +81 -0
  828. package/dist/renderers/webgpu/WebGPUUniformsGroup.js +175 -0
  829. package/dist/renderers/webgpu/WebGPUUniformsGroup.mjs +176 -0
  830. package/dist/renderers/webgpu/constants.js +241 -0
  831. package/dist/renderers/webgpu/constants.mjs +241 -0
  832. package/dist/renderers/webgpu/nodes/ShaderLib.js +41 -0
  833. package/dist/renderers/webgpu/nodes/ShaderLib.mjs +42 -0
  834. package/dist/renderers/webgpu/nodes/WebGPUNodeBuilder.js +164 -0
  835. package/dist/renderers/webgpu/nodes/WebGPUNodeBuilder.mjs +165 -0
  836. package/dist/renderers/webgpu/nodes/WebGPUNodeUniform.js +73 -0
  837. package/dist/renderers/webgpu/nodes/WebGPUNodeUniform.mjs +73 -0
  838. package/dist/renderers/webgpu/nodes/WebGPUNodeUniformsGroup.js +14 -0
  839. package/dist/renderers/webgpu/nodes/WebGPUNodeUniformsGroup.mjs +15 -0
  840. package/dist/renderers/webgpu/nodes/WebGPUNodes.js +39 -0
  841. package/dist/renderers/webgpu/nodes/WebGPUNodes.mjs +40 -0
  842. package/dist/shaders/ACESFilmicToneMappingShader.d.ts +16 -0
  843. package/dist/shaders/ACESFilmicToneMappingShader.js +55 -0
  844. package/dist/shaders/ACESFilmicToneMappingShader.mjs +55 -0
  845. package/dist/shaders/AfterimageShader.d.ts +15 -0
  846. package/dist/shaders/AfterimageShader.js +32 -0
  847. package/dist/shaders/AfterimageShader.mjs +32 -0
  848. package/dist/shaders/BasicShader.d.ts +8 -0
  849. package/dist/shaders/BasicShader.js +12 -0
  850. package/dist/shaders/BasicShader.mjs +12 -0
  851. package/dist/shaders/BleachBypassShader.d.ts +14 -0
  852. package/dist/shaders/BleachBypassShader.js +35 -0
  853. package/dist/shaders/BleachBypassShader.mjs +35 -0
  854. package/dist/shaders/BlendShader.d.ts +21 -0
  855. package/dist/shaders/BlendShader.js +30 -0
  856. package/dist/shaders/BlendShader.mjs +30 -0
  857. package/dist/shaders/BokehShader.d.ts +24 -0
  858. package/dist/shaders/BokehShader.js +109 -0
  859. package/dist/shaders/BokehShader.mjs +109 -0
  860. package/dist/shaders/BokehShader2.d.ts +50 -0
  861. package/dist/shaders/BokehShader2.js +269 -0
  862. package/dist/shaders/BokehShader2.mjs +269 -0
  863. package/dist/shaders/BrightnessContrastShader.d.ts +21 -0
  864. package/dist/shaders/BrightnessContrastShader.js +32 -0
  865. package/dist/shaders/BrightnessContrastShader.mjs +32 -0
  866. package/dist/shaders/ColorCorrectionShader.d.ts +22 -0
  867. package/dist/shaders/ColorCorrectionShader.js +30 -0
  868. package/dist/shaders/ColorCorrectionShader.mjs +30 -0
  869. package/dist/shaders/ColorifyShader.d.ts +16 -0
  870. package/dist/shaders/ColorifyShader.js +28 -0
  871. package/dist/shaders/ColorifyShader.mjs +28 -0
  872. package/dist/shaders/ConvolutionShader.d.ts +21 -0
  873. package/dist/shaders/ConvolutionShader.js +55 -0
  874. package/dist/shaders/ConvolutionShader.mjs +55 -0
  875. package/dist/shaders/CopyShader.d.ts +12 -0
  876. package/dist/shaders/CopyShader.js +25 -0
  877. package/dist/shaders/CopyShader.mjs +25 -0
  878. package/dist/shaders/DOFMipMapShader.d.ts +23 -0
  879. package/dist/shaders/DOFMipMapShader.js +32 -0
  880. package/dist/shaders/DOFMipMapShader.mjs +32 -0
  881. package/dist/shaders/DepthLimitedBlurShader.d.ts +28 -0
  882. package/dist/shaders/DepthLimitedBlurShader.js +114 -0
  883. package/dist/shaders/DepthLimitedBlurShader.mjs +114 -0
  884. package/dist/shaders/DigitalGlitch.d.ts +39 -0
  885. package/dist/shaders/DigitalGlitch.js +85 -0
  886. package/dist/shaders/DigitalGlitch.mjs +85 -0
  887. package/dist/shaders/DotScreenShader.d.ts +27 -0
  888. package/dist/shaders/DotScreenShader.js +39 -0
  889. package/dist/shaders/DotScreenShader.mjs +39 -0
  890. package/dist/shaders/FXAAShader.d.ts +19 -0
  891. package/dist/shaders/FXAAShader.js +1098 -0
  892. package/dist/shaders/FXAAShader.mjs +1098 -0
  893. package/dist/shaders/FilmShader.d.ts +43 -0
  894. package/dist/shaders/FilmShader.js +53 -0
  895. package/dist/shaders/FilmShader.mjs +53 -0
  896. package/dist/shaders/FocusShader.d.ts +26 -0
  897. package/dist/shaders/FocusShader.js +55 -0
  898. package/dist/shaders/FocusShader.mjs +55 -0
  899. package/dist/shaders/FreiChenShader.d.ts +19 -0
  900. package/dist/shaders/FreiChenShader.js +64 -0
  901. package/dist/shaders/FreiChenShader.mjs +64 -0
  902. package/dist/shaders/FresnelShader.d.ts +24 -0
  903. package/dist/shaders/FresnelShader.js +47 -0
  904. package/dist/shaders/FresnelShader.mjs +47 -0
  905. package/dist/shaders/GammaCorrectionShader.d.ts +12 -0
  906. package/dist/shaders/GammaCorrectionShader.js +23 -0
  907. package/dist/shaders/GammaCorrectionShader.mjs +23 -0
  908. package/dist/shaders/GodRaysShader.d.ts +97 -0
  909. package/dist/shaders/GodRaysShader.js +183 -0
  910. package/dist/shaders/GodRaysShader.mjs +183 -0
  911. package/dist/shaders/HalftoneShader.d.ts +51 -0
  912. package/dist/shaders/HalftoneShader.js +228 -0
  913. package/dist/shaders/HalftoneShader.mjs +228 -0
  914. package/dist/shaders/HorizontalBlurShader.d.ts +18 -0
  915. package/dist/shaders/HorizontalBlurShader.js +49 -0
  916. package/dist/shaders/HorizontalBlurShader.mjs +49 -0
  917. package/dist/shaders/HorizontalTiltShiftShader.d.ts +23 -0
  918. package/dist/shaders/HorizontalTiltShiftShader.js +37 -0
  919. package/dist/shaders/HorizontalTiltShiftShader.mjs +37 -0
  920. package/dist/shaders/HueSaturationShader.d.ts +21 -0
  921. package/dist/shaders/HueSaturationShader.js +43 -0
  922. package/dist/shaders/HueSaturationShader.mjs +43 -0
  923. package/dist/shaders/KaleidoShader.d.ts +24 -0
  924. package/dist/shaders/KaleidoShader.js +34 -0
  925. package/dist/shaders/KaleidoShader.mjs +34 -0
  926. package/dist/shaders/LuminosityHighPassShader.d.ts +27 -0
  927. package/dist/shaders/LuminosityHighPassShader.js +37 -0
  928. package/dist/shaders/LuminosityHighPassShader.mjs +37 -0
  929. package/dist/shaders/LuminosityShader.d.ts +13 -0
  930. package/dist/shaders/LuminosityShader.js +25 -0
  931. package/dist/shaders/LuminosityShader.mjs +25 -0
  932. package/dist/shaders/MirrorShader.d.ts +18 -0
  933. package/dist/shaders/MirrorShader.js +35 -0
  934. package/dist/shaders/MirrorShader.mjs +35 -0
  935. package/dist/shaders/NormalMapShader.d.ts +23 -0
  936. package/dist/shaders/NormalMapShader.js +31 -0
  937. package/dist/shaders/NormalMapShader.mjs +31 -0
  938. package/dist/shaders/ParallaxShader.d.ts +28 -0
  939. package/dist/shaders/ParallaxShader.js +133 -0
  940. package/dist/shaders/ParallaxShader.mjs +133 -0
  941. package/dist/shaders/PixelShader.d.ts +18 -0
  942. package/dist/shaders/PixelShader.js +28 -0
  943. package/dist/shaders/PixelShader.mjs +28 -0
  944. package/dist/shaders/RGBShiftShader.d.ts +24 -0
  945. package/dist/shaders/RGBShiftShader.js +30 -0
  946. package/dist/shaders/RGBShiftShader.mjs +30 -0
  947. package/dist/shaders/SAOShader.d.ts +25 -0
  948. package/dist/shaders/SAOShader.js +144 -0
  949. package/dist/shaders/SAOShader.mjs +144 -0
  950. package/dist/shaders/SMAAShader.d.ts +60 -0
  951. package/dist/shaders/SMAAShader.js +358 -0
  952. package/dist/shaders/SMAAShader.mjs +358 -0
  953. package/dist/shaders/SSAOShader.d.ts +86 -0
  954. package/dist/shaders/SSAOShader.js +182 -0
  955. package/dist/shaders/SSAOShader.mjs +182 -0
  956. package/dist/shaders/SSRShader.d.ts +94 -0
  957. package/dist/shaders/SSRShader.js +342 -0
  958. package/dist/shaders/SSRShader.mjs +342 -0
  959. package/dist/shaders/SepiaShader.d.ts +17 -0
  960. package/dist/shaders/SepiaShader.js +29 -0
  961. package/dist/shaders/SepiaShader.mjs +29 -0
  962. package/dist/shaders/SobelOperatorShader.d.ts +19 -0
  963. package/dist/shaders/SobelOperatorShader.js +54 -0
  964. package/dist/shaders/SobelOperatorShader.mjs +54 -0
  965. package/dist/shaders/SubsurfaceScatteringShader.d.ts +5 -0
  966. package/dist/shaders/SubsurfaceScatteringShader.js +59 -0
  967. package/dist/shaders/SubsurfaceScatteringShader.mjs +59 -0
  968. package/dist/shaders/TechnicolorShader.d.ts +15 -0
  969. package/dist/shaders/TechnicolorShader.js +24 -0
  970. package/dist/shaders/TechnicolorShader.mjs +24 -0
  971. package/dist/shaders/ToneMapShader.d.ts +27 -0
  972. package/dist/shaders/ToneMapShader.js +51 -0
  973. package/dist/shaders/ToneMapShader.mjs +51 -0
  974. package/dist/shaders/ToonShader.d.ts +108 -0
  975. package/dist/shaders/ToonShader.js +188 -0
  976. package/dist/shaders/ToonShader.mjs +188 -0
  977. package/dist/shaders/TriangleBlurShader.d.ts +22 -0
  978. package/dist/shaders/TriangleBlurShader.js +37 -0
  979. package/dist/shaders/TriangleBlurShader.mjs +37 -0
  980. package/dist/shaders/UnpackDepthRGBAShader.d.ts +16 -0
  981. package/dist/shaders/UnpackDepthRGBAShader.js +26 -0
  982. package/dist/shaders/UnpackDepthRGBAShader.mjs +26 -0
  983. package/dist/shaders/VerticalBlurShader.d.ts +18 -0
  984. package/dist/shaders/VerticalBlurShader.js +50 -0
  985. package/dist/shaders/VerticalBlurShader.mjs +50 -0
  986. package/dist/shaders/VerticalTiltShiftShader.d.ts +23 -0
  987. package/dist/shaders/VerticalTiltShiftShader.js +37 -0
  988. package/dist/shaders/VerticalTiltShiftShader.mjs +37 -0
  989. package/dist/shaders/VignetteShader.d.ts +20 -0
  990. package/dist/shaders/VignetteShader.js +38 -0
  991. package/dist/shaders/VignetteShader.mjs +38 -0
  992. package/dist/shaders/VolumeShader.d.ts +30 -0
  993. package/dist/shaders/VolumeShader.js +225 -0
  994. package/dist/shaders/VolumeShader.mjs +225 -0
  995. package/dist/shaders/WaterRefractionShader.d.ts +21 -0
  996. package/dist/shaders/WaterRefractionShader.js +59 -0
  997. package/dist/shaders/WaterRefractionShader.mjs +59 -0
  998. package/dist/shaders/types.d.ts +14 -0
  999. package/dist/shaders/types.js +1 -0
  1000. package/dist/shaders/types.mjs +1 -0
  1001. package/dist/textures/FlakesTexture.d.ts +4 -0
  1002. package/dist/textures/FlakesTexture.js +30 -0
  1003. package/dist/textures/FlakesTexture.mjs +30 -0
  1004. package/dist/types/helpers.d.ts +1 -0
  1005. package/dist/types/helpers.js +4 -0
  1006. package/dist/types/helpers.mjs +4 -0
  1007. package/dist/types/shared.d.ts +2 -0
  1008. package/dist/types/utils.d.ts +3 -0
  1009. package/dist/utils/BufferGeometryUtils.d.ts +48 -0
  1010. package/dist/utils/BufferGeometryUtils.js +636 -0
  1011. package/dist/utils/BufferGeometryUtils.mjs +636 -0
  1012. package/dist/utils/GeometryCompressionUtils.d.ts +7 -0
  1013. package/dist/utils/GeometryCompressionUtils.js +573 -0
  1014. package/dist/utils/GeometryCompressionUtils.mjs +573 -0
  1015. package/dist/utils/GeometryUtils.d.ts +6 -0
  1016. package/dist/utils/GeometryUtils.js +109 -0
  1017. package/dist/utils/GeometryUtils.mjs +109 -0
  1018. package/dist/utils/LDrawUtils.d.ts +5 -0
  1019. package/dist/utils/RoughnessMipmapper.js +219 -0
  1020. package/dist/utils/RoughnessMipmapper.mjs +219 -0
  1021. package/dist/utils/SceneUtils.d.ts +9 -0
  1022. package/dist/utils/SceneUtils.js +36 -0
  1023. package/dist/utils/SceneUtils.mjs +36 -0
  1024. package/dist/utils/ShadowMapViewer.d.ts +24 -0
  1025. package/dist/utils/ShadowMapViewer.js +114 -0
  1026. package/dist/utils/ShadowMapViewer.mjs +114 -0
  1027. package/dist/utils/SkeletonUtils.d.ts +30 -0
  1028. package/dist/utils/SkeletonUtils.js +292 -0
  1029. package/dist/utils/SkeletonUtils.mjs +292 -0
  1030. package/dist/utils/UVsDebug.d.ts +3 -0
  1031. package/dist/utils/UVsDebug.js +85 -0
  1032. package/dist/utils/UVsDebug.mjs +85 -0
  1033. package/dist/utils/WorkerPool.js +62 -0
  1034. package/dist/utils/WorkerPool.mjs +62 -0
  1035. package/dist/webxr/ARButton.d.ts +5 -0
  1036. package/dist/webxr/ARButton.js +119 -0
  1037. package/dist/webxr/ARButton.mjs +119 -0
  1038. package/dist/webxr/OculusHandModel.d.ts +22 -0
  1039. package/dist/webxr/OculusHandModel.js +82 -0
  1040. package/dist/webxr/OculusHandModel.mjs +82 -0
  1041. package/dist/webxr/OculusHandPointerModel.d.ts +63 -0
  1042. package/dist/webxr/OculusHandPointerModel.js +224 -0
  1043. package/dist/webxr/OculusHandPointerModel.mjs +207 -0
  1044. package/dist/webxr/Text2D.d.ts +3 -0
  1045. package/dist/webxr/Text2D.js +48 -0
  1046. package/dist/webxr/Text2D.mjs +31 -0
  1047. package/dist/webxr/VRButton.d.ts +7 -0
  1048. package/dist/webxr/VRButton.js +111 -0
  1049. package/dist/webxr/VRButton.mjs +111 -0
  1050. package/dist/webxr/XRControllerModelFactory.d.ts +23 -0
  1051. package/dist/webxr/XRControllerModelFactory.js +174 -0
  1052. package/dist/webxr/XRControllerModelFactory.mjs +174 -0
  1053. package/dist/webxr/XREstimatedLight.d.ts +33 -0
  1054. package/dist/webxr/XREstimatedLight.js +126 -0
  1055. package/dist/webxr/XREstimatedLight.mjs +126 -0
  1056. package/dist/webxr/XRHandMeshModel.d.ts +9 -0
  1057. package/dist/webxr/XRHandMeshModel.js +82 -0
  1058. package/dist/webxr/XRHandMeshModel.mjs +82 -0
  1059. package/dist/webxr/XRHandModelFactory.d.ts +25 -0
  1060. package/dist/webxr/XRHandModelFactory.js +61 -0
  1061. package/dist/webxr/XRHandModelFactory.mjs +61 -0
  1062. package/dist/webxr/XRHandPrimitiveModel.d.ts +24 -0
  1063. package/dist/webxr/XRHandPrimitiveModel.js +68 -0
  1064. package/dist/webxr/XRHandPrimitiveModel.mjs +68 -0
  1065. package/package.json +1 -1
@@ -0,0 +1,2457 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const THREE = require("three");
4
+ const fflate = require("fflate");
5
+ const NURBSCurve = require("../curves/NURBSCurve.js");
6
+ let fbxTree;
7
+ let connections;
8
+ let sceneGraph;
9
+ class FBXLoader extends THREE.Loader {
10
+ constructor(manager) {
11
+ super(manager);
12
+ }
13
+ load(url, onLoad, onProgress, onError) {
14
+ const scope = this;
15
+ const path = scope.path === "" ? THREE.LoaderUtils.extractUrlBase(url) : scope.path;
16
+ const loader = new THREE.FileLoader(this.manager);
17
+ loader.setPath(scope.path);
18
+ loader.setResponseType("arraybuffer");
19
+ loader.setRequestHeader(scope.requestHeader);
20
+ loader.setWithCredentials(scope.withCredentials);
21
+ loader.load(
22
+ url,
23
+ function(buffer) {
24
+ try {
25
+ onLoad(scope.parse(buffer, path));
26
+ } catch (e) {
27
+ if (onError) {
28
+ onError(e);
29
+ } else {
30
+ console.error(e);
31
+ }
32
+ scope.manager.itemError(url);
33
+ }
34
+ },
35
+ onProgress,
36
+ onError
37
+ );
38
+ }
39
+ parse(FBXBuffer, path) {
40
+ if (isFbxFormatBinary(FBXBuffer)) {
41
+ fbxTree = new BinaryParser().parse(FBXBuffer);
42
+ } else {
43
+ const FBXText = convertArrayBufferToString(FBXBuffer);
44
+ if (!isFbxFormatASCII(FBXText)) {
45
+ throw new Error("THREE.FBXLoader: Unknown format.");
46
+ }
47
+ if (getFbxVersion(FBXText) < 7e3) {
48
+ throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: " + getFbxVersion(FBXText));
49
+ }
50
+ fbxTree = new TextParser().parse(FBXText);
51
+ }
52
+ const textureLoader = new THREE.TextureLoader(this.manager).setPath(this.resourcePath || path).setCrossOrigin(this.crossOrigin);
53
+ return new FBXTreeParser(textureLoader, this.manager).parse(fbxTree);
54
+ }
55
+ }
56
+ class FBXTreeParser {
57
+ constructor(textureLoader, manager) {
58
+ this.textureLoader = textureLoader;
59
+ this.manager = manager;
60
+ }
61
+ parse() {
62
+ connections = this.parseConnections();
63
+ const images = this.parseImages();
64
+ const textures = this.parseTextures(images);
65
+ const materials = this.parseMaterials(textures);
66
+ const deformers = this.parseDeformers();
67
+ const geometryMap = new GeometryParser().parse(deformers);
68
+ this.parseScene(deformers, geometryMap, materials);
69
+ return sceneGraph;
70
+ }
71
+ // Parses FBXTree.Connections which holds parent-child connections between objects (e.g. material -> texture, model->geometry )
72
+ // and details the connection type
73
+ parseConnections() {
74
+ const connectionMap = /* @__PURE__ */ new Map();
75
+ if ("Connections" in fbxTree) {
76
+ const rawConnections = fbxTree.Connections.connections;
77
+ rawConnections.forEach(function(rawConnection) {
78
+ const fromID = rawConnection[0];
79
+ const toID = rawConnection[1];
80
+ const relationship = rawConnection[2];
81
+ if (!connectionMap.has(fromID)) {
82
+ connectionMap.set(fromID, {
83
+ parents: [],
84
+ children: []
85
+ });
86
+ }
87
+ const parentRelationship = { ID: toID, relationship };
88
+ connectionMap.get(fromID).parents.push(parentRelationship);
89
+ if (!connectionMap.has(toID)) {
90
+ connectionMap.set(toID, {
91
+ parents: [],
92
+ children: []
93
+ });
94
+ }
95
+ const childRelationship = { ID: fromID, relationship };
96
+ connectionMap.get(toID).children.push(childRelationship);
97
+ });
98
+ }
99
+ return connectionMap;
100
+ }
101
+ // Parse FBXTree.Objects.Video for embedded image data
102
+ // These images are connected to textures in FBXTree.Objects.Textures
103
+ // via FBXTree.Connections.
104
+ parseImages() {
105
+ const images = {};
106
+ const blobs = {};
107
+ if ("Video" in fbxTree.Objects) {
108
+ const videoNodes = fbxTree.Objects.Video;
109
+ for (const nodeID in videoNodes) {
110
+ const videoNode = videoNodes[nodeID];
111
+ const id = parseInt(nodeID);
112
+ images[id] = videoNode.RelativeFilename || videoNode.Filename;
113
+ if ("Content" in videoNode) {
114
+ const arrayBufferContent = videoNode.Content instanceof ArrayBuffer && videoNode.Content.byteLength > 0;
115
+ const base64Content = typeof videoNode.Content === "string" && videoNode.Content !== "";
116
+ if (arrayBufferContent || base64Content) {
117
+ const image = this.parseImage(videoNodes[nodeID]);
118
+ blobs[videoNode.RelativeFilename || videoNode.Filename] = image;
119
+ }
120
+ }
121
+ }
122
+ }
123
+ for (const id in images) {
124
+ const filename = images[id];
125
+ if (blobs[filename] !== void 0)
126
+ images[id] = blobs[filename];
127
+ else
128
+ images[id] = images[id].split("\\").pop();
129
+ }
130
+ return images;
131
+ }
132
+ // Parse embedded image data in FBXTree.Video.Content
133
+ parseImage(videoNode) {
134
+ const content = videoNode.Content;
135
+ const fileName = videoNode.RelativeFilename || videoNode.Filename;
136
+ const extension = fileName.slice(fileName.lastIndexOf(".") + 1).toLowerCase();
137
+ let type;
138
+ switch (extension) {
139
+ case "bmp":
140
+ type = "image/bmp";
141
+ break;
142
+ case "jpg":
143
+ case "jpeg":
144
+ type = "image/jpeg";
145
+ break;
146
+ case "png":
147
+ type = "image/png";
148
+ break;
149
+ case "tif":
150
+ type = "image/tiff";
151
+ break;
152
+ case "tga":
153
+ if (this.manager.getHandler(".tga") === null) {
154
+ console.warn("FBXLoader: TGA loader not found, skipping ", fileName);
155
+ }
156
+ type = "image/tga";
157
+ break;
158
+ default:
159
+ console.warn('FBXLoader: Image type "' + extension + '" is not supported.');
160
+ return;
161
+ }
162
+ if (typeof content === "string") {
163
+ return "data:" + type + ";base64," + content;
164
+ } else {
165
+ const array = new Uint8Array(content);
166
+ return window.URL.createObjectURL(new Blob([array], { type }));
167
+ }
168
+ }
169
+ // Parse nodes in FBXTree.Objects.Texture
170
+ // These contain details such as UV scaling, cropping, rotation etc and are connected
171
+ // to images in FBXTree.Objects.Video
172
+ parseTextures(images) {
173
+ const textureMap = /* @__PURE__ */ new Map();
174
+ if ("Texture" in fbxTree.Objects) {
175
+ const textureNodes = fbxTree.Objects.Texture;
176
+ for (const nodeID in textureNodes) {
177
+ const texture = this.parseTexture(textureNodes[nodeID], images);
178
+ textureMap.set(parseInt(nodeID), texture);
179
+ }
180
+ }
181
+ return textureMap;
182
+ }
183
+ // Parse individual node in FBXTree.Objects.Texture
184
+ parseTexture(textureNode, images) {
185
+ const texture = this.loadTexture(textureNode, images);
186
+ texture.ID = textureNode.id;
187
+ texture.name = textureNode.attrName;
188
+ const wrapModeU = textureNode.WrapModeU;
189
+ const wrapModeV = textureNode.WrapModeV;
190
+ const valueU = wrapModeU !== void 0 ? wrapModeU.value : 0;
191
+ const valueV = wrapModeV !== void 0 ? wrapModeV.value : 0;
192
+ texture.wrapS = valueU === 0 ? THREE.RepeatWrapping : THREE.ClampToEdgeWrapping;
193
+ texture.wrapT = valueV === 0 ? THREE.RepeatWrapping : THREE.ClampToEdgeWrapping;
194
+ if ("Scaling" in textureNode) {
195
+ const values = textureNode.Scaling.value;
196
+ texture.repeat.x = values[0];
197
+ texture.repeat.y = values[1];
198
+ }
199
+ return texture;
200
+ }
201
+ // load a texture specified as a blob or data URI, or via an external URL using TextureLoader
202
+ loadTexture(textureNode, images) {
203
+ let fileName;
204
+ const currentPath = this.textureLoader.path;
205
+ const children = connections.get(textureNode.id).children;
206
+ if (children !== void 0 && children.length > 0 && images[children[0].ID] !== void 0) {
207
+ fileName = images[children[0].ID];
208
+ if (fileName.indexOf("blob:") === 0 || fileName.indexOf("data:") === 0) {
209
+ this.textureLoader.setPath(void 0);
210
+ }
211
+ }
212
+ let texture;
213
+ const extension = textureNode.FileName.slice(-3).toLowerCase();
214
+ if (extension === "tga") {
215
+ const loader = this.manager.getHandler(".tga");
216
+ if (loader === null) {
217
+ console.warn("FBXLoader: TGA loader not found, creating placeholder texture for", textureNode.RelativeFilename);
218
+ texture = new THREE.Texture();
219
+ } else {
220
+ loader.setPath(this.textureLoader.path);
221
+ texture = loader.load(fileName);
222
+ }
223
+ } else if (extension === "psd") {
224
+ console.warn(
225
+ "FBXLoader: PSD textures are not supported, creating placeholder texture for",
226
+ textureNode.RelativeFilename
227
+ );
228
+ texture = new THREE.Texture();
229
+ } else {
230
+ texture = this.textureLoader.load(fileName);
231
+ }
232
+ this.textureLoader.setPath(currentPath);
233
+ return texture;
234
+ }
235
+ // Parse nodes in FBXTree.Objects.Material
236
+ parseMaterials(textureMap) {
237
+ const materialMap = /* @__PURE__ */ new Map();
238
+ if ("Material" in fbxTree.Objects) {
239
+ const materialNodes = fbxTree.Objects.Material;
240
+ for (const nodeID in materialNodes) {
241
+ const material = this.parseMaterial(materialNodes[nodeID], textureMap);
242
+ if (material !== null)
243
+ materialMap.set(parseInt(nodeID), material);
244
+ }
245
+ }
246
+ return materialMap;
247
+ }
248
+ // Parse single node in FBXTree.Objects.Material
249
+ // Materials are connected to texture maps in FBXTree.Objects.Textures
250
+ // FBX format currently only supports Lambert and Phong shading models
251
+ parseMaterial(materialNode, textureMap) {
252
+ const ID = materialNode.id;
253
+ const name = materialNode.attrName;
254
+ let type = materialNode.ShadingModel;
255
+ if (typeof type === "object") {
256
+ type = type.value;
257
+ }
258
+ if (!connections.has(ID))
259
+ return null;
260
+ const parameters = this.parseParameters(materialNode, textureMap, ID);
261
+ let material;
262
+ switch (type.toLowerCase()) {
263
+ case "phong":
264
+ material = new THREE.MeshPhongMaterial();
265
+ break;
266
+ case "lambert":
267
+ material = new THREE.MeshLambertMaterial();
268
+ break;
269
+ default:
270
+ console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.', type);
271
+ material = new THREE.MeshPhongMaterial();
272
+ break;
273
+ }
274
+ material.setValues(parameters);
275
+ material.name = name;
276
+ return material;
277
+ }
278
+ // Parse FBX material and return parameters suitable for a three.js material
279
+ // Also parse the texture map and return any textures associated with the material
280
+ parseParameters(materialNode, textureMap, ID) {
281
+ const parameters = {};
282
+ if (materialNode.BumpFactor) {
283
+ parameters.bumpScale = materialNode.BumpFactor.value;
284
+ }
285
+ if (materialNode.Diffuse) {
286
+ parameters.color = new THREE.Color().fromArray(materialNode.Diffuse.value);
287
+ } else if (materialNode.DiffuseColor && (materialNode.DiffuseColor.type === "Color" || materialNode.DiffuseColor.type === "ColorRGB")) {
288
+ parameters.color = new THREE.Color().fromArray(materialNode.DiffuseColor.value);
289
+ }
290
+ if (materialNode.DisplacementFactor) {
291
+ parameters.displacementScale = materialNode.DisplacementFactor.value;
292
+ }
293
+ if (materialNode.Emissive) {
294
+ parameters.emissive = new THREE.Color().fromArray(materialNode.Emissive.value);
295
+ } else if (materialNode.EmissiveColor && (materialNode.EmissiveColor.type === "Color" || materialNode.EmissiveColor.type === "ColorRGB")) {
296
+ parameters.emissive = new THREE.Color().fromArray(materialNode.EmissiveColor.value);
297
+ }
298
+ if (materialNode.EmissiveFactor) {
299
+ parameters.emissiveIntensity = parseFloat(materialNode.EmissiveFactor.value);
300
+ }
301
+ if (materialNode.Opacity) {
302
+ parameters.opacity = parseFloat(materialNode.Opacity.value);
303
+ }
304
+ if (parameters.opacity < 1) {
305
+ parameters.transparent = true;
306
+ }
307
+ if (materialNode.ReflectionFactor) {
308
+ parameters.reflectivity = materialNode.ReflectionFactor.value;
309
+ }
310
+ if (materialNode.Shininess) {
311
+ parameters.shininess = materialNode.Shininess.value;
312
+ }
313
+ if (materialNode.Specular) {
314
+ parameters.specular = new THREE.Color().fromArray(materialNode.Specular.value);
315
+ } else if (materialNode.SpecularColor && materialNode.SpecularColor.type === "Color") {
316
+ parameters.specular = new THREE.Color().fromArray(materialNode.SpecularColor.value);
317
+ }
318
+ const scope = this;
319
+ connections.get(ID).children.forEach(function(child) {
320
+ const type = child.relationship;
321
+ switch (type) {
322
+ case "Bump":
323
+ parameters.bumpMap = scope.getTexture(textureMap, child.ID);
324
+ break;
325
+ case "Maya|TEX_ao_map":
326
+ parameters.aoMap = scope.getTexture(textureMap, child.ID);
327
+ break;
328
+ case "DiffuseColor":
329
+ case "Maya|TEX_color_map":
330
+ parameters.map = scope.getTexture(textureMap, child.ID);
331
+ if (parameters.map !== void 0) {
332
+ if ("colorSpace" in parameters.map)
333
+ parameters.map.colorSpace = "srgb";
334
+ else
335
+ parameters.map.encoding = 3001;
336
+ }
337
+ break;
338
+ case "DisplacementColor":
339
+ parameters.displacementMap = scope.getTexture(textureMap, child.ID);
340
+ break;
341
+ case "EmissiveColor":
342
+ parameters.emissiveMap = scope.getTexture(textureMap, child.ID);
343
+ if (parameters.emissiveMap !== void 0) {
344
+ if ("colorSpace" in parameters.emissiveMap)
345
+ parameters.emissiveMap.colorSpace = "srgb";
346
+ else
347
+ parameters.emissiveMap.encoding = 3001;
348
+ }
349
+ break;
350
+ case "NormalMap":
351
+ case "Maya|TEX_normal_map":
352
+ parameters.normalMap = scope.getTexture(textureMap, child.ID);
353
+ break;
354
+ case "ReflectionColor":
355
+ parameters.envMap = scope.getTexture(textureMap, child.ID);
356
+ if (parameters.envMap !== void 0) {
357
+ parameters.envMap.mapping = THREE.EquirectangularReflectionMapping;
358
+ if ("colorSpace" in parameters.envMap)
359
+ parameters.envMap.colorSpace = "srgb";
360
+ else
361
+ parameters.envMap.encoding = 3001;
362
+ }
363
+ break;
364
+ case "SpecularColor":
365
+ parameters.specularMap = scope.getTexture(textureMap, child.ID);
366
+ if (parameters.specularMap !== void 0) {
367
+ if ("colorSpace" in parameters.specularMap)
368
+ parameters.specularMap.colorSpace = "srgb";
369
+ else
370
+ parameters.specularMap.encoding = 3001;
371
+ }
372
+ break;
373
+ case "TransparentColor":
374
+ case "TransparencyFactor":
375
+ parameters.alphaMap = scope.getTexture(textureMap, child.ID);
376
+ parameters.transparent = true;
377
+ break;
378
+ case "AmbientColor":
379
+ case "ShininessExponent":
380
+ case "SpecularFactor":
381
+ case "VectorDisplacementColor":
382
+ default:
383
+ console.warn("THREE.FBXLoader: %s map is not supported in three.js, skipping texture.", type);
384
+ break;
385
+ }
386
+ });
387
+ return parameters;
388
+ }
389
+ // get a texture from the textureMap for use by a material.
390
+ getTexture(textureMap, id) {
391
+ if ("LayeredTexture" in fbxTree.Objects && id in fbxTree.Objects.LayeredTexture) {
392
+ console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer.");
393
+ id = connections.get(id).children[0].ID;
394
+ }
395
+ return textureMap.get(id);
396
+ }
397
+ // Parse nodes in FBXTree.Objects.Deformer
398
+ // Deformer node can contain skinning or Vertex Cache animation data, however only skinning is supported here
399
+ // Generates map of Skeleton-like objects for use later when generating and binding skeletons.
400
+ parseDeformers() {
401
+ const skeletons = {};
402
+ const morphTargets = {};
403
+ if ("Deformer" in fbxTree.Objects) {
404
+ const DeformerNodes = fbxTree.Objects.Deformer;
405
+ for (const nodeID in DeformerNodes) {
406
+ const deformerNode = DeformerNodes[nodeID];
407
+ const relationships = connections.get(parseInt(nodeID));
408
+ if (deformerNode.attrType === "Skin") {
409
+ const skeleton = this.parseSkeleton(relationships, DeformerNodes);
410
+ skeleton.ID = nodeID;
411
+ if (relationships.parents.length > 1) {
412
+ console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported.");
413
+ }
414
+ skeleton.geometryID = relationships.parents[0].ID;
415
+ skeletons[nodeID] = skeleton;
416
+ } else if (deformerNode.attrType === "BlendShape") {
417
+ const morphTarget = {
418
+ id: nodeID
419
+ };
420
+ morphTarget.rawTargets = this.parseMorphTargets(relationships, DeformerNodes);
421
+ morphTarget.id = nodeID;
422
+ if (relationships.parents.length > 1) {
423
+ console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported.");
424
+ }
425
+ morphTargets[nodeID] = morphTarget;
426
+ }
427
+ }
428
+ }
429
+ return {
430
+ skeletons,
431
+ morphTargets
432
+ };
433
+ }
434
+ // Parse single nodes in FBXTree.Objects.Deformer
435
+ // The top level skeleton node has type 'Skin' and sub nodes have type 'Cluster'
436
+ // Each skin node represents a skeleton and each cluster node represents a bone
437
+ parseSkeleton(relationships, deformerNodes) {
438
+ const rawBones = [];
439
+ relationships.children.forEach(function(child) {
440
+ const boneNode = deformerNodes[child.ID];
441
+ if (boneNode.attrType !== "Cluster")
442
+ return;
443
+ const rawBone = {
444
+ ID: child.ID,
445
+ indices: [],
446
+ weights: [],
447
+ transformLink: new THREE.Matrix4().fromArray(boneNode.TransformLink.a)
448
+ // transform: new Matrix4().fromArray( boneNode.Transform.a ),
449
+ // linkMode: boneNode.Mode,
450
+ };
451
+ if ("Indexes" in boneNode) {
452
+ rawBone.indices = boneNode.Indexes.a;
453
+ rawBone.weights = boneNode.Weights.a;
454
+ }
455
+ rawBones.push(rawBone);
456
+ });
457
+ return {
458
+ rawBones,
459
+ bones: []
460
+ };
461
+ }
462
+ // The top level morph deformer node has type "BlendShape" and sub nodes have type "BlendShapeChannel"
463
+ parseMorphTargets(relationships, deformerNodes) {
464
+ const rawMorphTargets = [];
465
+ for (let i = 0; i < relationships.children.length; i++) {
466
+ const child = relationships.children[i];
467
+ const morphTargetNode = deformerNodes[child.ID];
468
+ const rawMorphTarget = {
469
+ name: morphTargetNode.attrName,
470
+ initialWeight: morphTargetNode.DeformPercent,
471
+ id: morphTargetNode.id,
472
+ fullWeights: morphTargetNode.FullWeights.a
473
+ };
474
+ if (morphTargetNode.attrType !== "BlendShapeChannel")
475
+ return;
476
+ rawMorphTarget.geoID = connections.get(parseInt(child.ID)).children.filter(function(child2) {
477
+ return child2.relationship === void 0;
478
+ })[0].ID;
479
+ rawMorphTargets.push(rawMorphTarget);
480
+ }
481
+ return rawMorphTargets;
482
+ }
483
+ // create the main Group() to be returned by the loader
484
+ parseScene(deformers, geometryMap, materialMap) {
485
+ sceneGraph = new THREE.Group();
486
+ const modelMap = this.parseModels(deformers.skeletons, geometryMap, materialMap);
487
+ const modelNodes = fbxTree.Objects.Model;
488
+ const scope = this;
489
+ modelMap.forEach(function(model) {
490
+ const modelNode = modelNodes[model.ID];
491
+ scope.setLookAtProperties(model, modelNode);
492
+ const parentConnections = connections.get(model.ID).parents;
493
+ parentConnections.forEach(function(connection) {
494
+ const parent = modelMap.get(connection.ID);
495
+ if (parent !== void 0)
496
+ parent.add(model);
497
+ });
498
+ if (model.parent === null) {
499
+ sceneGraph.add(model);
500
+ }
501
+ });
502
+ this.bindSkeleton(deformers.skeletons, geometryMap, modelMap);
503
+ this.createAmbientLight();
504
+ sceneGraph.traverse(function(node) {
505
+ if (node.userData.transformData) {
506
+ if (node.parent) {
507
+ node.userData.transformData.parentMatrix = node.parent.matrix;
508
+ node.userData.transformData.parentMatrixWorld = node.parent.matrixWorld;
509
+ }
510
+ const transform = generateTransform(node.userData.transformData);
511
+ node.applyMatrix4(transform);
512
+ node.updateWorldMatrix();
513
+ }
514
+ });
515
+ const animations = new AnimationParser().parse();
516
+ if (sceneGraph.children.length === 1 && sceneGraph.children[0].isGroup) {
517
+ sceneGraph.children[0].animations = animations;
518
+ sceneGraph = sceneGraph.children[0];
519
+ }
520
+ sceneGraph.animations = animations;
521
+ }
522
+ // parse nodes in FBXTree.Objects.Model
523
+ parseModels(skeletons, geometryMap, materialMap) {
524
+ const modelMap = /* @__PURE__ */ new Map();
525
+ const modelNodes = fbxTree.Objects.Model;
526
+ for (const nodeID in modelNodes) {
527
+ const id = parseInt(nodeID);
528
+ const node = modelNodes[nodeID];
529
+ const relationships = connections.get(id);
530
+ let model = this.buildSkeleton(relationships, skeletons, id, node.attrName);
531
+ if (!model) {
532
+ switch (node.attrType) {
533
+ case "Camera":
534
+ model = this.createCamera(relationships);
535
+ break;
536
+ case "Light":
537
+ model = this.createLight(relationships);
538
+ break;
539
+ case "Mesh":
540
+ model = this.createMesh(relationships, geometryMap, materialMap);
541
+ break;
542
+ case "NurbsCurve":
543
+ model = this.createCurve(relationships, geometryMap);
544
+ break;
545
+ case "LimbNode":
546
+ case "Root":
547
+ model = new THREE.Bone();
548
+ break;
549
+ case "Null":
550
+ default:
551
+ model = new THREE.Group();
552
+ break;
553
+ }
554
+ model.name = node.attrName ? THREE.PropertyBinding.sanitizeNodeName(node.attrName) : "";
555
+ model.ID = id;
556
+ }
557
+ this.getTransformData(model, node);
558
+ modelMap.set(id, model);
559
+ }
560
+ return modelMap;
561
+ }
562
+ buildSkeleton(relationships, skeletons, id, name) {
563
+ let bone = null;
564
+ relationships.parents.forEach(function(parent) {
565
+ for (const ID in skeletons) {
566
+ const skeleton = skeletons[ID];
567
+ skeleton.rawBones.forEach(function(rawBone, i) {
568
+ if (rawBone.ID === parent.ID) {
569
+ const subBone = bone;
570
+ bone = new THREE.Bone();
571
+ bone.matrixWorld.copy(rawBone.transformLink);
572
+ bone.name = name ? THREE.PropertyBinding.sanitizeNodeName(name) : "";
573
+ bone.ID = id;
574
+ skeleton.bones[i] = bone;
575
+ if (subBone !== null) {
576
+ bone.add(subBone);
577
+ }
578
+ }
579
+ });
580
+ }
581
+ });
582
+ return bone;
583
+ }
584
+ // create a PerspectiveCamera or OrthographicCamera
585
+ createCamera(relationships) {
586
+ let model;
587
+ let cameraAttribute;
588
+ relationships.children.forEach(function(child) {
589
+ const attr = fbxTree.Objects.NodeAttribute[child.ID];
590
+ if (attr !== void 0) {
591
+ cameraAttribute = attr;
592
+ }
593
+ });
594
+ if (cameraAttribute === void 0) {
595
+ model = new THREE.Object3D();
596
+ } else {
597
+ let type = 0;
598
+ if (cameraAttribute.CameraProjectionType !== void 0 && cameraAttribute.CameraProjectionType.value === 1) {
599
+ type = 1;
600
+ }
601
+ let nearClippingPlane = 1;
602
+ if (cameraAttribute.NearPlane !== void 0) {
603
+ nearClippingPlane = cameraAttribute.NearPlane.value / 1e3;
604
+ }
605
+ let farClippingPlane = 1e3;
606
+ if (cameraAttribute.FarPlane !== void 0) {
607
+ farClippingPlane = cameraAttribute.FarPlane.value / 1e3;
608
+ }
609
+ let width = window.innerWidth;
610
+ let height = window.innerHeight;
611
+ if (cameraAttribute.AspectWidth !== void 0 && cameraAttribute.AspectHeight !== void 0) {
612
+ width = cameraAttribute.AspectWidth.value;
613
+ height = cameraAttribute.AspectHeight.value;
614
+ }
615
+ const aspect = width / height;
616
+ let fov = 45;
617
+ if (cameraAttribute.FieldOfView !== void 0) {
618
+ fov = cameraAttribute.FieldOfView.value;
619
+ }
620
+ const focalLength = cameraAttribute.FocalLength ? cameraAttribute.FocalLength.value : null;
621
+ switch (type) {
622
+ case 0:
623
+ model = new THREE.PerspectiveCamera(fov, aspect, nearClippingPlane, farClippingPlane);
624
+ if (focalLength !== null)
625
+ model.setFocalLength(focalLength);
626
+ break;
627
+ case 1:
628
+ model = new THREE.OrthographicCamera(
629
+ -width / 2,
630
+ width / 2,
631
+ height / 2,
632
+ -height / 2,
633
+ nearClippingPlane,
634
+ farClippingPlane
635
+ );
636
+ break;
637
+ default:
638
+ console.warn("THREE.FBXLoader: Unknown camera type " + type + ".");
639
+ model = new THREE.Object3D();
640
+ break;
641
+ }
642
+ }
643
+ return model;
644
+ }
645
+ // Create a DirectionalLight, PointLight or SpotLight
646
+ createLight(relationships) {
647
+ let model;
648
+ let lightAttribute;
649
+ relationships.children.forEach(function(child) {
650
+ const attr = fbxTree.Objects.NodeAttribute[child.ID];
651
+ if (attr !== void 0) {
652
+ lightAttribute = attr;
653
+ }
654
+ });
655
+ if (lightAttribute === void 0) {
656
+ model = new THREE.Object3D();
657
+ } else {
658
+ let type;
659
+ if (lightAttribute.LightType === void 0) {
660
+ type = 0;
661
+ } else {
662
+ type = lightAttribute.LightType.value;
663
+ }
664
+ let color = 16777215;
665
+ if (lightAttribute.Color !== void 0) {
666
+ color = new THREE.Color().fromArray(lightAttribute.Color.value);
667
+ }
668
+ let intensity = lightAttribute.Intensity === void 0 ? 1 : lightAttribute.Intensity.value / 100;
669
+ if (lightAttribute.CastLightOnObject !== void 0 && lightAttribute.CastLightOnObject.value === 0) {
670
+ intensity = 0;
671
+ }
672
+ let distance = 0;
673
+ if (lightAttribute.FarAttenuationEnd !== void 0) {
674
+ if (lightAttribute.EnableFarAttenuation !== void 0 && lightAttribute.EnableFarAttenuation.value === 0) {
675
+ distance = 0;
676
+ } else {
677
+ distance = lightAttribute.FarAttenuationEnd.value;
678
+ }
679
+ }
680
+ const decay = 1;
681
+ switch (type) {
682
+ case 0:
683
+ model = new THREE.PointLight(color, intensity, distance, decay);
684
+ break;
685
+ case 1:
686
+ model = new THREE.DirectionalLight(color, intensity);
687
+ break;
688
+ case 2:
689
+ let angle = Math.PI / 3;
690
+ if (lightAttribute.InnerAngle !== void 0) {
691
+ angle = THREE.MathUtils.degToRad(lightAttribute.InnerAngle.value);
692
+ }
693
+ let penumbra = 0;
694
+ if (lightAttribute.OuterAngle !== void 0) {
695
+ penumbra = THREE.MathUtils.degToRad(lightAttribute.OuterAngle.value);
696
+ penumbra = Math.max(penumbra, 1);
697
+ }
698
+ model = new THREE.SpotLight(color, intensity, distance, angle, penumbra, decay);
699
+ break;
700
+ default:
701
+ console.warn(
702
+ "THREE.FBXLoader: Unknown light type " + lightAttribute.LightType.value + ", defaulting to a PointLight."
703
+ );
704
+ model = new THREE.PointLight(color, intensity);
705
+ break;
706
+ }
707
+ if (lightAttribute.CastShadows !== void 0 && lightAttribute.CastShadows.value === 1) {
708
+ model.castShadow = true;
709
+ }
710
+ }
711
+ return model;
712
+ }
713
+ createMesh(relationships, geometryMap, materialMap) {
714
+ let model;
715
+ let geometry = null;
716
+ let material = null;
717
+ const materials = [];
718
+ relationships.children.forEach(function(child) {
719
+ if (geometryMap.has(child.ID)) {
720
+ geometry = geometryMap.get(child.ID);
721
+ }
722
+ if (materialMap.has(child.ID)) {
723
+ materials.push(materialMap.get(child.ID));
724
+ }
725
+ });
726
+ if (materials.length > 1) {
727
+ material = materials;
728
+ } else if (materials.length > 0) {
729
+ material = materials[0];
730
+ } else {
731
+ material = new THREE.MeshPhongMaterial({ color: 13421772 });
732
+ materials.push(material);
733
+ }
734
+ if ("color" in geometry.attributes) {
735
+ materials.forEach(function(material2) {
736
+ material2.vertexColors = true;
737
+ });
738
+ }
739
+ if (geometry.FBX_Deformer) {
740
+ model = new THREE.SkinnedMesh(geometry, material);
741
+ model.normalizeSkinWeights();
742
+ } else {
743
+ model = new THREE.Mesh(geometry, material);
744
+ }
745
+ return model;
746
+ }
747
+ createCurve(relationships, geometryMap) {
748
+ const geometry = relationships.children.reduce(function(geo, child) {
749
+ if (geometryMap.has(child.ID))
750
+ geo = geometryMap.get(child.ID);
751
+ return geo;
752
+ }, null);
753
+ const material = new THREE.LineBasicMaterial({ color: 3342591, linewidth: 1 });
754
+ return new THREE.Line(geometry, material);
755
+ }
756
+ // parse the model node for transform data
757
+ getTransformData(model, modelNode) {
758
+ const transformData = {};
759
+ if ("InheritType" in modelNode)
760
+ transformData.inheritType = parseInt(modelNode.InheritType.value);
761
+ if ("RotationOrder" in modelNode)
762
+ transformData.eulerOrder = getEulerOrder(modelNode.RotationOrder.value);
763
+ else
764
+ transformData.eulerOrder = "ZYX";
765
+ if ("Lcl_Translation" in modelNode)
766
+ transformData.translation = modelNode.Lcl_Translation.value;
767
+ if ("PreRotation" in modelNode)
768
+ transformData.preRotation = modelNode.PreRotation.value;
769
+ if ("Lcl_Rotation" in modelNode)
770
+ transformData.rotation = modelNode.Lcl_Rotation.value;
771
+ if ("PostRotation" in modelNode)
772
+ transformData.postRotation = modelNode.PostRotation.value;
773
+ if ("Lcl_Scaling" in modelNode)
774
+ transformData.scale = modelNode.Lcl_Scaling.value;
775
+ if ("ScalingOffset" in modelNode)
776
+ transformData.scalingOffset = modelNode.ScalingOffset.value;
777
+ if ("ScalingPivot" in modelNode)
778
+ transformData.scalingPivot = modelNode.ScalingPivot.value;
779
+ if ("RotationOffset" in modelNode)
780
+ transformData.rotationOffset = modelNode.RotationOffset.value;
781
+ if ("RotationPivot" in modelNode)
782
+ transformData.rotationPivot = modelNode.RotationPivot.value;
783
+ model.userData.transformData = transformData;
784
+ }
785
+ setLookAtProperties(model, modelNode) {
786
+ if ("LookAtProperty" in modelNode) {
787
+ const children = connections.get(model.ID).children;
788
+ children.forEach(function(child) {
789
+ if (child.relationship === "LookAtProperty") {
790
+ const lookAtTarget = fbxTree.Objects.Model[child.ID];
791
+ if ("Lcl_Translation" in lookAtTarget) {
792
+ const pos = lookAtTarget.Lcl_Translation.value;
793
+ if (model.target !== void 0) {
794
+ model.target.position.fromArray(pos);
795
+ sceneGraph.add(model.target);
796
+ } else {
797
+ model.lookAt(new THREE.Vector3().fromArray(pos));
798
+ }
799
+ }
800
+ }
801
+ });
802
+ }
803
+ }
804
+ bindSkeleton(skeletons, geometryMap, modelMap) {
805
+ const bindMatrices = this.parsePoseNodes();
806
+ for (const ID in skeletons) {
807
+ const skeleton = skeletons[ID];
808
+ const parents = connections.get(parseInt(skeleton.ID)).parents;
809
+ parents.forEach(function(parent) {
810
+ if (geometryMap.has(parent.ID)) {
811
+ const geoID = parent.ID;
812
+ const geoRelationships = connections.get(geoID);
813
+ geoRelationships.parents.forEach(function(geoConnParent) {
814
+ if (modelMap.has(geoConnParent.ID)) {
815
+ const model = modelMap.get(geoConnParent.ID);
816
+ model.bind(new THREE.Skeleton(skeleton.bones), bindMatrices[geoConnParent.ID]);
817
+ }
818
+ });
819
+ }
820
+ });
821
+ }
822
+ }
823
+ parsePoseNodes() {
824
+ const bindMatrices = {};
825
+ if ("Pose" in fbxTree.Objects) {
826
+ const BindPoseNode = fbxTree.Objects.Pose;
827
+ for (const nodeID in BindPoseNode) {
828
+ if (BindPoseNode[nodeID].attrType === "BindPose" && BindPoseNode[nodeID].NbPoseNodes > 0) {
829
+ const poseNodes = BindPoseNode[nodeID].PoseNode;
830
+ if (Array.isArray(poseNodes)) {
831
+ poseNodes.forEach(function(poseNode) {
832
+ bindMatrices[poseNode.Node] = new THREE.Matrix4().fromArray(poseNode.Matrix.a);
833
+ });
834
+ } else {
835
+ bindMatrices[poseNodes.Node] = new THREE.Matrix4().fromArray(poseNodes.Matrix.a);
836
+ }
837
+ }
838
+ }
839
+ }
840
+ return bindMatrices;
841
+ }
842
+ // Parse ambient color in FBXTree.GlobalSettings - if it's not set to black (default), create an ambient light
843
+ createAmbientLight() {
844
+ if ("GlobalSettings" in fbxTree && "AmbientColor" in fbxTree.GlobalSettings) {
845
+ const ambientColor = fbxTree.GlobalSettings.AmbientColor.value;
846
+ const r = ambientColor[0];
847
+ const g = ambientColor[1];
848
+ const b = ambientColor[2];
849
+ if (r !== 0 || g !== 0 || b !== 0) {
850
+ const color = new THREE.Color(r, g, b);
851
+ sceneGraph.add(new THREE.AmbientLight(color, 1));
852
+ }
853
+ }
854
+ }
855
+ }
856
+ class GeometryParser {
857
+ // Parse nodes in FBXTree.Objects.Geometry
858
+ parse(deformers) {
859
+ const geometryMap = /* @__PURE__ */ new Map();
860
+ if ("Geometry" in fbxTree.Objects) {
861
+ const geoNodes = fbxTree.Objects.Geometry;
862
+ for (const nodeID in geoNodes) {
863
+ const relationships = connections.get(parseInt(nodeID));
864
+ const geo = this.parseGeometry(relationships, geoNodes[nodeID], deformers);
865
+ geometryMap.set(parseInt(nodeID), geo);
866
+ }
867
+ }
868
+ return geometryMap;
869
+ }
870
+ // Parse single node in FBXTree.Objects.Geometry
871
+ parseGeometry(relationships, geoNode, deformers) {
872
+ switch (geoNode.attrType) {
873
+ case "Mesh":
874
+ return this.parseMeshGeometry(relationships, geoNode, deformers);
875
+ break;
876
+ case "NurbsCurve":
877
+ return this.parseNurbsGeometry(geoNode);
878
+ break;
879
+ }
880
+ }
881
+ // Parse single node mesh geometry in FBXTree.Objects.Geometry
882
+ parseMeshGeometry(relationships, geoNode, deformers) {
883
+ const skeletons = deformers.skeletons;
884
+ const morphTargets = [];
885
+ const modelNodes = relationships.parents.map(function(parent) {
886
+ return fbxTree.Objects.Model[parent.ID];
887
+ });
888
+ if (modelNodes.length === 0)
889
+ return;
890
+ const skeleton = relationships.children.reduce(function(skeleton2, child) {
891
+ if (skeletons[child.ID] !== void 0)
892
+ skeleton2 = skeletons[child.ID];
893
+ return skeleton2;
894
+ }, null);
895
+ relationships.children.forEach(function(child) {
896
+ if (deformers.morphTargets[child.ID] !== void 0) {
897
+ morphTargets.push(deformers.morphTargets[child.ID]);
898
+ }
899
+ });
900
+ const modelNode = modelNodes[0];
901
+ const transformData = {};
902
+ if ("RotationOrder" in modelNode)
903
+ transformData.eulerOrder = getEulerOrder(modelNode.RotationOrder.value);
904
+ if ("InheritType" in modelNode)
905
+ transformData.inheritType = parseInt(modelNode.InheritType.value);
906
+ if ("GeometricTranslation" in modelNode)
907
+ transformData.translation = modelNode.GeometricTranslation.value;
908
+ if ("GeometricRotation" in modelNode)
909
+ transformData.rotation = modelNode.GeometricRotation.value;
910
+ if ("GeometricScaling" in modelNode)
911
+ transformData.scale = modelNode.GeometricScaling.value;
912
+ const transform = generateTransform(transformData);
913
+ return this.genGeometry(geoNode, skeleton, morphTargets, transform);
914
+ }
915
+ // Generate a BufferGeometry from a node in FBXTree.Objects.Geometry
916
+ genGeometry(geoNode, skeleton, morphTargets, preTransform) {
917
+ const geo = new THREE.BufferGeometry();
918
+ if (geoNode.attrName)
919
+ geo.name = geoNode.attrName;
920
+ const geoInfo = this.parseGeoNode(geoNode, skeleton);
921
+ const buffers = this.genBuffers(geoInfo);
922
+ const positionAttribute = new THREE.Float32BufferAttribute(buffers.vertex, 3);
923
+ positionAttribute.applyMatrix4(preTransform);
924
+ geo.setAttribute("position", positionAttribute);
925
+ if (buffers.colors.length > 0) {
926
+ geo.setAttribute("color", new THREE.Float32BufferAttribute(buffers.colors, 3));
927
+ }
928
+ if (skeleton) {
929
+ geo.setAttribute("skinIndex", new THREE.Uint16BufferAttribute(buffers.weightsIndices, 4));
930
+ geo.setAttribute("skinWeight", new THREE.Float32BufferAttribute(buffers.vertexWeights, 4));
931
+ geo.FBX_Deformer = skeleton;
932
+ }
933
+ if (buffers.normal.length > 0) {
934
+ const normalMatrix = new THREE.Matrix3().getNormalMatrix(preTransform);
935
+ const normalAttribute = new THREE.Float32BufferAttribute(buffers.normal, 3);
936
+ normalAttribute.applyNormalMatrix(normalMatrix);
937
+ geo.setAttribute("normal", normalAttribute);
938
+ }
939
+ buffers.uvs.forEach(function(uvBuffer, i) {
940
+ let name = "uv" + (i + 1).toString();
941
+ if (i === 0) {
942
+ name = "uv";
943
+ }
944
+ geo.setAttribute(name, new THREE.Float32BufferAttribute(buffers.uvs[i], 2));
945
+ });
946
+ if (geoInfo.material && geoInfo.material.mappingType !== "AllSame") {
947
+ let prevMaterialIndex = buffers.materialIndex[0];
948
+ let startIndex = 0;
949
+ buffers.materialIndex.forEach(function(currentIndex, i) {
950
+ if (currentIndex !== prevMaterialIndex) {
951
+ geo.addGroup(startIndex, i - startIndex, prevMaterialIndex);
952
+ prevMaterialIndex = currentIndex;
953
+ startIndex = i;
954
+ }
955
+ });
956
+ if (geo.groups.length > 0) {
957
+ const lastGroup = geo.groups[geo.groups.length - 1];
958
+ const lastIndex = lastGroup.start + lastGroup.count;
959
+ if (lastIndex !== buffers.materialIndex.length) {
960
+ geo.addGroup(lastIndex, buffers.materialIndex.length - lastIndex, prevMaterialIndex);
961
+ }
962
+ }
963
+ if (geo.groups.length === 0) {
964
+ geo.addGroup(0, buffers.materialIndex.length, buffers.materialIndex[0]);
965
+ }
966
+ }
967
+ this.addMorphTargets(geo, geoNode, morphTargets, preTransform);
968
+ return geo;
969
+ }
970
+ parseGeoNode(geoNode, skeleton) {
971
+ const geoInfo = {};
972
+ geoInfo.vertexPositions = geoNode.Vertices !== void 0 ? geoNode.Vertices.a : [];
973
+ geoInfo.vertexIndices = geoNode.PolygonVertexIndex !== void 0 ? geoNode.PolygonVertexIndex.a : [];
974
+ if (geoNode.LayerElementColor) {
975
+ geoInfo.color = this.parseVertexColors(geoNode.LayerElementColor[0]);
976
+ }
977
+ if (geoNode.LayerElementMaterial) {
978
+ geoInfo.material = this.parseMaterialIndices(geoNode.LayerElementMaterial[0]);
979
+ }
980
+ if (geoNode.LayerElementNormal) {
981
+ geoInfo.normal = this.parseNormals(geoNode.LayerElementNormal[0]);
982
+ }
983
+ if (geoNode.LayerElementUV) {
984
+ geoInfo.uv = [];
985
+ let i = 0;
986
+ while (geoNode.LayerElementUV[i]) {
987
+ if (geoNode.LayerElementUV[i].UV) {
988
+ geoInfo.uv.push(this.parseUVs(geoNode.LayerElementUV[i]));
989
+ }
990
+ i++;
991
+ }
992
+ }
993
+ geoInfo.weightTable = {};
994
+ if (skeleton !== null) {
995
+ geoInfo.skeleton = skeleton;
996
+ skeleton.rawBones.forEach(function(rawBone, i) {
997
+ rawBone.indices.forEach(function(index, j) {
998
+ if (geoInfo.weightTable[index] === void 0)
999
+ geoInfo.weightTable[index] = [];
1000
+ geoInfo.weightTable[index].push({
1001
+ id: i,
1002
+ weight: rawBone.weights[j]
1003
+ });
1004
+ });
1005
+ });
1006
+ }
1007
+ return geoInfo;
1008
+ }
1009
+ genBuffers(geoInfo) {
1010
+ const buffers = {
1011
+ vertex: [],
1012
+ normal: [],
1013
+ colors: [],
1014
+ uvs: [],
1015
+ materialIndex: [],
1016
+ vertexWeights: [],
1017
+ weightsIndices: []
1018
+ };
1019
+ let polygonIndex = 0;
1020
+ let faceLength = 0;
1021
+ let displayedWeightsWarning = false;
1022
+ let facePositionIndexes = [];
1023
+ let faceNormals = [];
1024
+ let faceColors = [];
1025
+ let faceUVs = [];
1026
+ let faceWeights = [];
1027
+ let faceWeightIndices = [];
1028
+ const scope = this;
1029
+ geoInfo.vertexIndices.forEach(function(vertexIndex, polygonVertexIndex) {
1030
+ let materialIndex;
1031
+ let endOfFace = false;
1032
+ if (vertexIndex < 0) {
1033
+ vertexIndex = vertexIndex ^ -1;
1034
+ endOfFace = true;
1035
+ }
1036
+ let weightIndices = [];
1037
+ let weights = [];
1038
+ facePositionIndexes.push(vertexIndex * 3, vertexIndex * 3 + 1, vertexIndex * 3 + 2);
1039
+ if (geoInfo.color) {
1040
+ const data = getData(polygonVertexIndex, polygonIndex, vertexIndex, geoInfo.color);
1041
+ faceColors.push(data[0], data[1], data[2]);
1042
+ }
1043
+ if (geoInfo.skeleton) {
1044
+ if (geoInfo.weightTable[vertexIndex] !== void 0) {
1045
+ geoInfo.weightTable[vertexIndex].forEach(function(wt) {
1046
+ weights.push(wt.weight);
1047
+ weightIndices.push(wt.id);
1048
+ });
1049
+ }
1050
+ if (weights.length > 4) {
1051
+ if (!displayedWeightsWarning) {
1052
+ console.warn(
1053
+ "THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."
1054
+ );
1055
+ displayedWeightsWarning = true;
1056
+ }
1057
+ const wIndex = [0, 0, 0, 0];
1058
+ const Weight = [0, 0, 0, 0];
1059
+ weights.forEach(function(weight, weightIndex) {
1060
+ let currentWeight = weight;
1061
+ let currentIndex = weightIndices[weightIndex];
1062
+ Weight.forEach(function(comparedWeight, comparedWeightIndex, comparedWeightArray) {
1063
+ if (currentWeight > comparedWeight) {
1064
+ comparedWeightArray[comparedWeightIndex] = currentWeight;
1065
+ currentWeight = comparedWeight;
1066
+ const tmp = wIndex[comparedWeightIndex];
1067
+ wIndex[comparedWeightIndex] = currentIndex;
1068
+ currentIndex = tmp;
1069
+ }
1070
+ });
1071
+ });
1072
+ weightIndices = wIndex;
1073
+ weights = Weight;
1074
+ }
1075
+ while (weights.length < 4) {
1076
+ weights.push(0);
1077
+ weightIndices.push(0);
1078
+ }
1079
+ for (let i = 0; i < 4; ++i) {
1080
+ faceWeights.push(weights[i]);
1081
+ faceWeightIndices.push(weightIndices[i]);
1082
+ }
1083
+ }
1084
+ if (geoInfo.normal) {
1085
+ const data = getData(polygonVertexIndex, polygonIndex, vertexIndex, geoInfo.normal);
1086
+ faceNormals.push(data[0], data[1], data[2]);
1087
+ }
1088
+ if (geoInfo.material && geoInfo.material.mappingType !== "AllSame") {
1089
+ materialIndex = getData(polygonVertexIndex, polygonIndex, vertexIndex, geoInfo.material)[0];
1090
+ }
1091
+ if (geoInfo.uv) {
1092
+ geoInfo.uv.forEach(function(uv, i) {
1093
+ const data = getData(polygonVertexIndex, polygonIndex, vertexIndex, uv);
1094
+ if (faceUVs[i] === void 0) {
1095
+ faceUVs[i] = [];
1096
+ }
1097
+ faceUVs[i].push(data[0]);
1098
+ faceUVs[i].push(data[1]);
1099
+ });
1100
+ }
1101
+ faceLength++;
1102
+ if (endOfFace) {
1103
+ scope.genFace(
1104
+ buffers,
1105
+ geoInfo,
1106
+ facePositionIndexes,
1107
+ materialIndex,
1108
+ faceNormals,
1109
+ faceColors,
1110
+ faceUVs,
1111
+ faceWeights,
1112
+ faceWeightIndices,
1113
+ faceLength
1114
+ );
1115
+ polygonIndex++;
1116
+ faceLength = 0;
1117
+ facePositionIndexes = [];
1118
+ faceNormals = [];
1119
+ faceColors = [];
1120
+ faceUVs = [];
1121
+ faceWeights = [];
1122
+ faceWeightIndices = [];
1123
+ }
1124
+ });
1125
+ return buffers;
1126
+ }
1127
+ // Generate data for a single face in a geometry. If the face is a quad then split it into 2 tris
1128
+ genFace(buffers, geoInfo, facePositionIndexes, materialIndex, faceNormals, faceColors, faceUVs, faceWeights, faceWeightIndices, faceLength) {
1129
+ for (let i = 2; i < faceLength; i++) {
1130
+ buffers.vertex.push(geoInfo.vertexPositions[facePositionIndexes[0]]);
1131
+ buffers.vertex.push(geoInfo.vertexPositions[facePositionIndexes[1]]);
1132
+ buffers.vertex.push(geoInfo.vertexPositions[facePositionIndexes[2]]);
1133
+ buffers.vertex.push(geoInfo.vertexPositions[facePositionIndexes[(i - 1) * 3]]);
1134
+ buffers.vertex.push(geoInfo.vertexPositions[facePositionIndexes[(i - 1) * 3 + 1]]);
1135
+ buffers.vertex.push(geoInfo.vertexPositions[facePositionIndexes[(i - 1) * 3 + 2]]);
1136
+ buffers.vertex.push(geoInfo.vertexPositions[facePositionIndexes[i * 3]]);
1137
+ buffers.vertex.push(geoInfo.vertexPositions[facePositionIndexes[i * 3 + 1]]);
1138
+ buffers.vertex.push(geoInfo.vertexPositions[facePositionIndexes[i * 3 + 2]]);
1139
+ if (geoInfo.skeleton) {
1140
+ buffers.vertexWeights.push(faceWeights[0]);
1141
+ buffers.vertexWeights.push(faceWeights[1]);
1142
+ buffers.vertexWeights.push(faceWeights[2]);
1143
+ buffers.vertexWeights.push(faceWeights[3]);
1144
+ buffers.vertexWeights.push(faceWeights[(i - 1) * 4]);
1145
+ buffers.vertexWeights.push(faceWeights[(i - 1) * 4 + 1]);
1146
+ buffers.vertexWeights.push(faceWeights[(i - 1) * 4 + 2]);
1147
+ buffers.vertexWeights.push(faceWeights[(i - 1) * 4 + 3]);
1148
+ buffers.vertexWeights.push(faceWeights[i * 4]);
1149
+ buffers.vertexWeights.push(faceWeights[i * 4 + 1]);
1150
+ buffers.vertexWeights.push(faceWeights[i * 4 + 2]);
1151
+ buffers.vertexWeights.push(faceWeights[i * 4 + 3]);
1152
+ buffers.weightsIndices.push(faceWeightIndices[0]);
1153
+ buffers.weightsIndices.push(faceWeightIndices[1]);
1154
+ buffers.weightsIndices.push(faceWeightIndices[2]);
1155
+ buffers.weightsIndices.push(faceWeightIndices[3]);
1156
+ buffers.weightsIndices.push(faceWeightIndices[(i - 1) * 4]);
1157
+ buffers.weightsIndices.push(faceWeightIndices[(i - 1) * 4 + 1]);
1158
+ buffers.weightsIndices.push(faceWeightIndices[(i - 1) * 4 + 2]);
1159
+ buffers.weightsIndices.push(faceWeightIndices[(i - 1) * 4 + 3]);
1160
+ buffers.weightsIndices.push(faceWeightIndices[i * 4]);
1161
+ buffers.weightsIndices.push(faceWeightIndices[i * 4 + 1]);
1162
+ buffers.weightsIndices.push(faceWeightIndices[i * 4 + 2]);
1163
+ buffers.weightsIndices.push(faceWeightIndices[i * 4 + 3]);
1164
+ }
1165
+ if (geoInfo.color) {
1166
+ buffers.colors.push(faceColors[0]);
1167
+ buffers.colors.push(faceColors[1]);
1168
+ buffers.colors.push(faceColors[2]);
1169
+ buffers.colors.push(faceColors[(i - 1) * 3]);
1170
+ buffers.colors.push(faceColors[(i - 1) * 3 + 1]);
1171
+ buffers.colors.push(faceColors[(i - 1) * 3 + 2]);
1172
+ buffers.colors.push(faceColors[i * 3]);
1173
+ buffers.colors.push(faceColors[i * 3 + 1]);
1174
+ buffers.colors.push(faceColors[i * 3 + 2]);
1175
+ }
1176
+ if (geoInfo.material && geoInfo.material.mappingType !== "AllSame") {
1177
+ buffers.materialIndex.push(materialIndex);
1178
+ buffers.materialIndex.push(materialIndex);
1179
+ buffers.materialIndex.push(materialIndex);
1180
+ }
1181
+ if (geoInfo.normal) {
1182
+ buffers.normal.push(faceNormals[0]);
1183
+ buffers.normal.push(faceNormals[1]);
1184
+ buffers.normal.push(faceNormals[2]);
1185
+ buffers.normal.push(faceNormals[(i - 1) * 3]);
1186
+ buffers.normal.push(faceNormals[(i - 1) * 3 + 1]);
1187
+ buffers.normal.push(faceNormals[(i - 1) * 3 + 2]);
1188
+ buffers.normal.push(faceNormals[i * 3]);
1189
+ buffers.normal.push(faceNormals[i * 3 + 1]);
1190
+ buffers.normal.push(faceNormals[i * 3 + 2]);
1191
+ }
1192
+ if (geoInfo.uv) {
1193
+ geoInfo.uv.forEach(function(uv, j) {
1194
+ if (buffers.uvs[j] === void 0)
1195
+ buffers.uvs[j] = [];
1196
+ buffers.uvs[j].push(faceUVs[j][0]);
1197
+ buffers.uvs[j].push(faceUVs[j][1]);
1198
+ buffers.uvs[j].push(faceUVs[j][(i - 1) * 2]);
1199
+ buffers.uvs[j].push(faceUVs[j][(i - 1) * 2 + 1]);
1200
+ buffers.uvs[j].push(faceUVs[j][i * 2]);
1201
+ buffers.uvs[j].push(faceUVs[j][i * 2 + 1]);
1202
+ });
1203
+ }
1204
+ }
1205
+ }
1206
+ addMorphTargets(parentGeo, parentGeoNode, morphTargets, preTransform) {
1207
+ if (morphTargets.length === 0)
1208
+ return;
1209
+ parentGeo.morphTargetsRelative = true;
1210
+ parentGeo.morphAttributes.position = [];
1211
+ const scope = this;
1212
+ morphTargets.forEach(function(morphTarget) {
1213
+ morphTarget.rawTargets.forEach(function(rawTarget) {
1214
+ const morphGeoNode = fbxTree.Objects.Geometry[rawTarget.geoID];
1215
+ if (morphGeoNode !== void 0) {
1216
+ scope.genMorphGeometry(parentGeo, parentGeoNode, morphGeoNode, preTransform, rawTarget.name);
1217
+ }
1218
+ });
1219
+ });
1220
+ }
1221
+ // a morph geometry node is similar to a standard node, and the node is also contained
1222
+ // in FBXTree.Objects.Geometry, however it can only have attributes for position, normal
1223
+ // and a special attribute Index defining which vertices of the original geometry are affected
1224
+ // Normal and position attributes only have data for the vertices that are affected by the morph
1225
+ genMorphGeometry(parentGeo, parentGeoNode, morphGeoNode, preTransform, name) {
1226
+ const vertexIndices = parentGeoNode.PolygonVertexIndex !== void 0 ? parentGeoNode.PolygonVertexIndex.a : [];
1227
+ const morphPositionsSparse = morphGeoNode.Vertices !== void 0 ? morphGeoNode.Vertices.a : [];
1228
+ const indices = morphGeoNode.Indexes !== void 0 ? morphGeoNode.Indexes.a : [];
1229
+ const length = parentGeo.attributes.position.count * 3;
1230
+ const morphPositions = new Float32Array(length);
1231
+ for (let i = 0; i < indices.length; i++) {
1232
+ const morphIndex = indices[i] * 3;
1233
+ morphPositions[morphIndex] = morphPositionsSparse[i * 3];
1234
+ morphPositions[morphIndex + 1] = morphPositionsSparse[i * 3 + 1];
1235
+ morphPositions[morphIndex + 2] = morphPositionsSparse[i * 3 + 2];
1236
+ }
1237
+ const morphGeoInfo = {
1238
+ vertexIndices,
1239
+ vertexPositions: morphPositions
1240
+ };
1241
+ const morphBuffers = this.genBuffers(morphGeoInfo);
1242
+ const positionAttribute = new THREE.Float32BufferAttribute(morphBuffers.vertex, 3);
1243
+ positionAttribute.name = name || morphGeoNode.attrName;
1244
+ positionAttribute.applyMatrix4(preTransform);
1245
+ parentGeo.morphAttributes.position.push(positionAttribute);
1246
+ }
1247
+ // Parse normal from FBXTree.Objects.Geometry.LayerElementNormal if it exists
1248
+ parseNormals(NormalNode) {
1249
+ const mappingType = NormalNode.MappingInformationType;
1250
+ const referenceType = NormalNode.ReferenceInformationType;
1251
+ const buffer = NormalNode.Normals.a;
1252
+ let indexBuffer = [];
1253
+ if (referenceType === "IndexToDirect") {
1254
+ if ("NormalIndex" in NormalNode) {
1255
+ indexBuffer = NormalNode.NormalIndex.a;
1256
+ } else if ("NormalsIndex" in NormalNode) {
1257
+ indexBuffer = NormalNode.NormalsIndex.a;
1258
+ }
1259
+ }
1260
+ return {
1261
+ dataSize: 3,
1262
+ buffer,
1263
+ indices: indexBuffer,
1264
+ mappingType,
1265
+ referenceType
1266
+ };
1267
+ }
1268
+ // Parse UVs from FBXTree.Objects.Geometry.LayerElementUV if it exists
1269
+ parseUVs(UVNode) {
1270
+ const mappingType = UVNode.MappingInformationType;
1271
+ const referenceType = UVNode.ReferenceInformationType;
1272
+ const buffer = UVNode.UV.a;
1273
+ let indexBuffer = [];
1274
+ if (referenceType === "IndexToDirect") {
1275
+ indexBuffer = UVNode.UVIndex.a;
1276
+ }
1277
+ return {
1278
+ dataSize: 2,
1279
+ buffer,
1280
+ indices: indexBuffer,
1281
+ mappingType,
1282
+ referenceType
1283
+ };
1284
+ }
1285
+ // Parse Vertex Colors from FBXTree.Objects.Geometry.LayerElementColor if it exists
1286
+ parseVertexColors(ColorNode) {
1287
+ const mappingType = ColorNode.MappingInformationType;
1288
+ const referenceType = ColorNode.ReferenceInformationType;
1289
+ const buffer = ColorNode.Colors.a;
1290
+ let indexBuffer = [];
1291
+ if (referenceType === "IndexToDirect") {
1292
+ indexBuffer = ColorNode.ColorIndex.a;
1293
+ }
1294
+ return {
1295
+ dataSize: 4,
1296
+ buffer,
1297
+ indices: indexBuffer,
1298
+ mappingType,
1299
+ referenceType
1300
+ };
1301
+ }
1302
+ // Parse mapping and material data in FBXTree.Objects.Geometry.LayerElementMaterial if it exists
1303
+ parseMaterialIndices(MaterialNode) {
1304
+ const mappingType = MaterialNode.MappingInformationType;
1305
+ const referenceType = MaterialNode.ReferenceInformationType;
1306
+ if (mappingType === "NoMappingInformation") {
1307
+ return {
1308
+ dataSize: 1,
1309
+ buffer: [0],
1310
+ indices: [0],
1311
+ mappingType: "AllSame",
1312
+ referenceType
1313
+ };
1314
+ }
1315
+ const materialIndexBuffer = MaterialNode.Materials.a;
1316
+ const materialIndices = [];
1317
+ for (let i = 0; i < materialIndexBuffer.length; ++i) {
1318
+ materialIndices.push(i);
1319
+ }
1320
+ return {
1321
+ dataSize: 1,
1322
+ buffer: materialIndexBuffer,
1323
+ indices: materialIndices,
1324
+ mappingType,
1325
+ referenceType
1326
+ };
1327
+ }
1328
+ // Generate a NurbGeometry from a node in FBXTree.Objects.Geometry
1329
+ parseNurbsGeometry(geoNode) {
1330
+ if (NURBSCurve.NURBSCurve === void 0) {
1331
+ console.error(
1332
+ "THREE.FBXLoader: The loader relies on NURBSCurve for any nurbs present in the model. Nurbs will show up as empty geometry."
1333
+ );
1334
+ return new THREE.BufferGeometry();
1335
+ }
1336
+ const order = parseInt(geoNode.Order);
1337
+ if (isNaN(order)) {
1338
+ console.error("THREE.FBXLoader: Invalid Order %s given for geometry ID: %s", geoNode.Order, geoNode.id);
1339
+ return new THREE.BufferGeometry();
1340
+ }
1341
+ const degree = order - 1;
1342
+ const knots = geoNode.KnotVector.a;
1343
+ const controlPoints = [];
1344
+ const pointsValues = geoNode.Points.a;
1345
+ for (let i = 0, l = pointsValues.length; i < l; i += 4) {
1346
+ controlPoints.push(new THREE.Vector4().fromArray(pointsValues, i));
1347
+ }
1348
+ let startKnot, endKnot;
1349
+ if (geoNode.Form === "Closed") {
1350
+ controlPoints.push(controlPoints[0]);
1351
+ } else if (geoNode.Form === "Periodic") {
1352
+ startKnot = degree;
1353
+ endKnot = knots.length - 1 - startKnot;
1354
+ for (let i = 0; i < degree; ++i) {
1355
+ controlPoints.push(controlPoints[i]);
1356
+ }
1357
+ }
1358
+ const curve = new NURBSCurve.NURBSCurve(degree, knots, controlPoints, startKnot, endKnot);
1359
+ const points = curve.getPoints(controlPoints.length * 12);
1360
+ return new THREE.BufferGeometry().setFromPoints(points);
1361
+ }
1362
+ }
1363
+ class AnimationParser {
1364
+ // take raw animation clips and turn them into three.js animation clips
1365
+ parse() {
1366
+ const animationClips = [];
1367
+ const rawClips = this.parseClips();
1368
+ if (rawClips !== void 0) {
1369
+ for (const key in rawClips) {
1370
+ const rawClip = rawClips[key];
1371
+ const clip = this.addClip(rawClip);
1372
+ animationClips.push(clip);
1373
+ }
1374
+ }
1375
+ return animationClips;
1376
+ }
1377
+ parseClips() {
1378
+ if (fbxTree.Objects.AnimationCurve === void 0)
1379
+ return void 0;
1380
+ const curveNodesMap = this.parseAnimationCurveNodes();
1381
+ this.parseAnimationCurves(curveNodesMap);
1382
+ const layersMap = this.parseAnimationLayers(curveNodesMap);
1383
+ const rawClips = this.parseAnimStacks(layersMap);
1384
+ return rawClips;
1385
+ }
1386
+ // parse nodes in FBXTree.Objects.AnimationCurveNode
1387
+ // each AnimationCurveNode holds data for an animation transform for a model (e.g. left arm rotation )
1388
+ // and is referenced by an AnimationLayer
1389
+ parseAnimationCurveNodes() {
1390
+ const rawCurveNodes = fbxTree.Objects.AnimationCurveNode;
1391
+ const curveNodesMap = /* @__PURE__ */ new Map();
1392
+ for (const nodeID in rawCurveNodes) {
1393
+ const rawCurveNode = rawCurveNodes[nodeID];
1394
+ if (rawCurveNode.attrName.match(/S|R|T|DeformPercent/) !== null) {
1395
+ const curveNode = {
1396
+ id: rawCurveNode.id,
1397
+ attr: rawCurveNode.attrName,
1398
+ curves: {}
1399
+ };
1400
+ curveNodesMap.set(curveNode.id, curveNode);
1401
+ }
1402
+ }
1403
+ return curveNodesMap;
1404
+ }
1405
+ // parse nodes in FBXTree.Objects.AnimationCurve and connect them up to
1406
+ // previously parsed AnimationCurveNodes. Each AnimationCurve holds data for a single animated
1407
+ // axis ( e.g. times and values of x rotation)
1408
+ parseAnimationCurves(curveNodesMap) {
1409
+ const rawCurves = fbxTree.Objects.AnimationCurve;
1410
+ for (const nodeID in rawCurves) {
1411
+ const animationCurve = {
1412
+ id: rawCurves[nodeID].id,
1413
+ times: rawCurves[nodeID].KeyTime.a.map(convertFBXTimeToSeconds),
1414
+ values: rawCurves[nodeID].KeyValueFloat.a
1415
+ };
1416
+ const relationships = connections.get(animationCurve.id);
1417
+ if (relationships !== void 0) {
1418
+ const animationCurveID = relationships.parents[0].ID;
1419
+ const animationCurveRelationship = relationships.parents[0].relationship;
1420
+ if (animationCurveRelationship.match(/X/)) {
1421
+ curveNodesMap.get(animationCurveID).curves["x"] = animationCurve;
1422
+ } else if (animationCurveRelationship.match(/Y/)) {
1423
+ curveNodesMap.get(animationCurveID).curves["y"] = animationCurve;
1424
+ } else if (animationCurveRelationship.match(/Z/)) {
1425
+ curveNodesMap.get(animationCurveID).curves["z"] = animationCurve;
1426
+ } else if (animationCurveRelationship.match(/d|DeformPercent/) && curveNodesMap.has(animationCurveID)) {
1427
+ curveNodesMap.get(animationCurveID).curves["morph"] = animationCurve;
1428
+ }
1429
+ }
1430
+ }
1431
+ }
1432
+ // parse nodes in FBXTree.Objects.AnimationLayer. Each layers holds references
1433
+ // to various AnimationCurveNodes and is referenced by an AnimationStack node
1434
+ // note: theoretically a stack can have multiple layers, however in practice there always seems to be one per stack
1435
+ parseAnimationLayers(curveNodesMap) {
1436
+ const rawLayers = fbxTree.Objects.AnimationLayer;
1437
+ const layersMap = /* @__PURE__ */ new Map();
1438
+ for (const nodeID in rawLayers) {
1439
+ const layerCurveNodes = [];
1440
+ const connection = connections.get(parseInt(nodeID));
1441
+ if (connection !== void 0) {
1442
+ const children = connection.children;
1443
+ children.forEach(function(child, i) {
1444
+ if (curveNodesMap.has(child.ID)) {
1445
+ const curveNode = curveNodesMap.get(child.ID);
1446
+ if (curveNode.curves.x !== void 0 || curveNode.curves.y !== void 0 || curveNode.curves.z !== void 0) {
1447
+ if (layerCurveNodes[i] === void 0) {
1448
+ const modelID = connections.get(child.ID).parents.filter(function(parent) {
1449
+ return parent.relationship !== void 0;
1450
+ })[0].ID;
1451
+ if (modelID !== void 0) {
1452
+ const rawModel = fbxTree.Objects.Model[modelID.toString()];
1453
+ if (rawModel === void 0) {
1454
+ console.warn("THREE.FBXLoader: Encountered a unused curve.", child);
1455
+ return;
1456
+ }
1457
+ const node = {
1458
+ modelName: rawModel.attrName ? THREE.PropertyBinding.sanitizeNodeName(rawModel.attrName) : "",
1459
+ ID: rawModel.id,
1460
+ initialPosition: [0, 0, 0],
1461
+ initialRotation: [0, 0, 0],
1462
+ initialScale: [1, 1, 1]
1463
+ };
1464
+ sceneGraph.traverse(function(child2) {
1465
+ if (child2.ID === rawModel.id) {
1466
+ node.transform = child2.matrix;
1467
+ if (child2.userData.transformData)
1468
+ node.eulerOrder = child2.userData.transformData.eulerOrder;
1469
+ }
1470
+ });
1471
+ if (!node.transform)
1472
+ node.transform = new THREE.Matrix4();
1473
+ if ("PreRotation" in rawModel)
1474
+ node.preRotation = rawModel.PreRotation.value;
1475
+ if ("PostRotation" in rawModel)
1476
+ node.postRotation = rawModel.PostRotation.value;
1477
+ layerCurveNodes[i] = node;
1478
+ }
1479
+ }
1480
+ if (layerCurveNodes[i])
1481
+ layerCurveNodes[i][curveNode.attr] = curveNode;
1482
+ } else if (curveNode.curves.morph !== void 0) {
1483
+ if (layerCurveNodes[i] === void 0) {
1484
+ const deformerID = connections.get(child.ID).parents.filter(function(parent) {
1485
+ return parent.relationship !== void 0;
1486
+ })[0].ID;
1487
+ const morpherID = connections.get(deformerID).parents[0].ID;
1488
+ const geoID = connections.get(morpherID).parents[0].ID;
1489
+ const modelID = connections.get(geoID).parents[0].ID;
1490
+ const rawModel = fbxTree.Objects.Model[modelID];
1491
+ const node = {
1492
+ modelName: rawModel.attrName ? THREE.PropertyBinding.sanitizeNodeName(rawModel.attrName) : "",
1493
+ morphName: fbxTree.Objects.Deformer[deformerID].attrName
1494
+ };
1495
+ layerCurveNodes[i] = node;
1496
+ }
1497
+ layerCurveNodes[i][curveNode.attr] = curveNode;
1498
+ }
1499
+ }
1500
+ });
1501
+ layersMap.set(parseInt(nodeID), layerCurveNodes);
1502
+ }
1503
+ }
1504
+ return layersMap;
1505
+ }
1506
+ // parse nodes in FBXTree.Objects.AnimationStack. These are the top level node in the animation
1507
+ // hierarchy. Each Stack node will be used to create a AnimationClip
1508
+ parseAnimStacks(layersMap) {
1509
+ const rawStacks = fbxTree.Objects.AnimationStack;
1510
+ const rawClips = {};
1511
+ for (const nodeID in rawStacks) {
1512
+ const children = connections.get(parseInt(nodeID)).children;
1513
+ if (children.length > 1) {
1514
+ console.warn(
1515
+ "THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers."
1516
+ );
1517
+ }
1518
+ const layer = layersMap.get(children[0].ID);
1519
+ rawClips[nodeID] = {
1520
+ name: rawStacks[nodeID].attrName,
1521
+ layer
1522
+ };
1523
+ }
1524
+ return rawClips;
1525
+ }
1526
+ addClip(rawClip) {
1527
+ let tracks = [];
1528
+ const scope = this;
1529
+ rawClip.layer.forEach(function(rawTracks) {
1530
+ tracks = tracks.concat(scope.generateTracks(rawTracks));
1531
+ });
1532
+ return new THREE.AnimationClip(rawClip.name, -1, tracks);
1533
+ }
1534
+ generateTracks(rawTracks) {
1535
+ const tracks = [];
1536
+ let initialPosition = new THREE.Vector3();
1537
+ let initialRotation = new THREE.Quaternion();
1538
+ let initialScale = new THREE.Vector3();
1539
+ if (rawTracks.transform)
1540
+ rawTracks.transform.decompose(initialPosition, initialRotation, initialScale);
1541
+ initialPosition = initialPosition.toArray();
1542
+ initialRotation = new THREE.Euler().setFromQuaternion(initialRotation, rawTracks.eulerOrder).toArray();
1543
+ initialScale = initialScale.toArray();
1544
+ if (rawTracks.T !== void 0 && Object.keys(rawTracks.T.curves).length > 0) {
1545
+ const positionTrack = this.generateVectorTrack(
1546
+ rawTracks.modelName,
1547
+ rawTracks.T.curves,
1548
+ initialPosition,
1549
+ "position"
1550
+ );
1551
+ if (positionTrack !== void 0)
1552
+ tracks.push(positionTrack);
1553
+ }
1554
+ if (rawTracks.R !== void 0 && Object.keys(rawTracks.R.curves).length > 0) {
1555
+ const rotationTrack = this.generateRotationTrack(
1556
+ rawTracks.modelName,
1557
+ rawTracks.R.curves,
1558
+ initialRotation,
1559
+ rawTracks.preRotation,
1560
+ rawTracks.postRotation,
1561
+ rawTracks.eulerOrder
1562
+ );
1563
+ if (rotationTrack !== void 0)
1564
+ tracks.push(rotationTrack);
1565
+ }
1566
+ if (rawTracks.S !== void 0 && Object.keys(rawTracks.S.curves).length > 0) {
1567
+ const scaleTrack = this.generateVectorTrack(rawTracks.modelName, rawTracks.S.curves, initialScale, "scale");
1568
+ if (scaleTrack !== void 0)
1569
+ tracks.push(scaleTrack);
1570
+ }
1571
+ if (rawTracks.DeformPercent !== void 0) {
1572
+ const morphTrack = this.generateMorphTrack(rawTracks);
1573
+ if (morphTrack !== void 0)
1574
+ tracks.push(morphTrack);
1575
+ }
1576
+ return tracks;
1577
+ }
1578
+ generateVectorTrack(modelName, curves, initialValue, type) {
1579
+ const times = this.getTimesForAllAxes(curves);
1580
+ const values = this.getKeyframeTrackValues(times, curves, initialValue);
1581
+ return new THREE.VectorKeyframeTrack(modelName + "." + type, times, values);
1582
+ }
1583
+ generateRotationTrack(modelName, curves, initialValue, preRotation, postRotation, eulerOrder) {
1584
+ if (curves.x !== void 0) {
1585
+ this.interpolateRotations(curves.x);
1586
+ curves.x.values = curves.x.values.map(THREE.MathUtils.degToRad);
1587
+ }
1588
+ if (curves.y !== void 0) {
1589
+ this.interpolateRotations(curves.y);
1590
+ curves.y.values = curves.y.values.map(THREE.MathUtils.degToRad);
1591
+ }
1592
+ if (curves.z !== void 0) {
1593
+ this.interpolateRotations(curves.z);
1594
+ curves.z.values = curves.z.values.map(THREE.MathUtils.degToRad);
1595
+ }
1596
+ const times = this.getTimesForAllAxes(curves);
1597
+ const values = this.getKeyframeTrackValues(times, curves, initialValue);
1598
+ if (preRotation !== void 0) {
1599
+ preRotation = preRotation.map(THREE.MathUtils.degToRad);
1600
+ preRotation.push(eulerOrder);
1601
+ preRotation = new THREE.Euler().fromArray(preRotation);
1602
+ preRotation = new THREE.Quaternion().setFromEuler(preRotation);
1603
+ }
1604
+ if (postRotation !== void 0) {
1605
+ postRotation = postRotation.map(THREE.MathUtils.degToRad);
1606
+ postRotation.push(eulerOrder);
1607
+ postRotation = new THREE.Euler().fromArray(postRotation);
1608
+ postRotation = new THREE.Quaternion().setFromEuler(postRotation).invert();
1609
+ }
1610
+ const quaternion = new THREE.Quaternion();
1611
+ const euler = new THREE.Euler();
1612
+ const quaternionValues = [];
1613
+ for (let i = 0; i < values.length; i += 3) {
1614
+ euler.set(values[i], values[i + 1], values[i + 2], eulerOrder);
1615
+ quaternion.setFromEuler(euler);
1616
+ if (preRotation !== void 0)
1617
+ quaternion.premultiply(preRotation);
1618
+ if (postRotation !== void 0)
1619
+ quaternion.multiply(postRotation);
1620
+ quaternion.toArray(quaternionValues, i / 3 * 4);
1621
+ }
1622
+ return new THREE.QuaternionKeyframeTrack(modelName + ".quaternion", times, quaternionValues);
1623
+ }
1624
+ generateMorphTrack(rawTracks) {
1625
+ const curves = rawTracks.DeformPercent.curves.morph;
1626
+ const values = curves.values.map(function(val) {
1627
+ return val / 100;
1628
+ });
1629
+ const morphNum = sceneGraph.getObjectByName(rawTracks.modelName).morphTargetDictionary[rawTracks.morphName];
1630
+ return new THREE.NumberKeyframeTrack(
1631
+ rawTracks.modelName + ".morphTargetInfluences[" + morphNum + "]",
1632
+ curves.times,
1633
+ values
1634
+ );
1635
+ }
1636
+ // For all animated objects, times are defined separately for each axis
1637
+ // Here we'll combine the times into one sorted array without duplicates
1638
+ getTimesForAllAxes(curves) {
1639
+ let times = [];
1640
+ if (curves.x !== void 0)
1641
+ times = times.concat(curves.x.times);
1642
+ if (curves.y !== void 0)
1643
+ times = times.concat(curves.y.times);
1644
+ if (curves.z !== void 0)
1645
+ times = times.concat(curves.z.times);
1646
+ times = times.sort(function(a, b) {
1647
+ return a - b;
1648
+ });
1649
+ if (times.length > 1) {
1650
+ let targetIndex = 1;
1651
+ let lastValue = times[0];
1652
+ for (let i = 1; i < times.length; i++) {
1653
+ const currentValue = times[i];
1654
+ if (currentValue !== lastValue) {
1655
+ times[targetIndex] = currentValue;
1656
+ lastValue = currentValue;
1657
+ targetIndex++;
1658
+ }
1659
+ }
1660
+ times = times.slice(0, targetIndex);
1661
+ }
1662
+ return times;
1663
+ }
1664
+ getKeyframeTrackValues(times, curves, initialValue) {
1665
+ const prevValue = initialValue;
1666
+ const values = [];
1667
+ let xIndex = -1;
1668
+ let yIndex = -1;
1669
+ let zIndex = -1;
1670
+ times.forEach(function(time) {
1671
+ if (curves.x)
1672
+ xIndex = curves.x.times.indexOf(time);
1673
+ if (curves.y)
1674
+ yIndex = curves.y.times.indexOf(time);
1675
+ if (curves.z)
1676
+ zIndex = curves.z.times.indexOf(time);
1677
+ if (xIndex !== -1) {
1678
+ const xValue = curves.x.values[xIndex];
1679
+ values.push(xValue);
1680
+ prevValue[0] = xValue;
1681
+ } else {
1682
+ values.push(prevValue[0]);
1683
+ }
1684
+ if (yIndex !== -1) {
1685
+ const yValue = curves.y.values[yIndex];
1686
+ values.push(yValue);
1687
+ prevValue[1] = yValue;
1688
+ } else {
1689
+ values.push(prevValue[1]);
1690
+ }
1691
+ if (zIndex !== -1) {
1692
+ const zValue = curves.z.values[zIndex];
1693
+ values.push(zValue);
1694
+ prevValue[2] = zValue;
1695
+ } else {
1696
+ values.push(prevValue[2]);
1697
+ }
1698
+ });
1699
+ return values;
1700
+ }
1701
+ // Rotations are defined as Euler angles which can have values of any size
1702
+ // These will be converted to quaternions which don't support values greater than
1703
+ // PI, so we'll interpolate large rotations
1704
+ interpolateRotations(curve) {
1705
+ for (let i = 1; i < curve.values.length; i++) {
1706
+ const initialValue = curve.values[i - 1];
1707
+ const valuesSpan = curve.values[i] - initialValue;
1708
+ const absoluteSpan = Math.abs(valuesSpan);
1709
+ if (absoluteSpan >= 180) {
1710
+ const numSubIntervals = absoluteSpan / 180;
1711
+ const step = valuesSpan / numSubIntervals;
1712
+ let nextValue = initialValue + step;
1713
+ const initialTime = curve.times[i - 1];
1714
+ const timeSpan = curve.times[i] - initialTime;
1715
+ const interval = timeSpan / numSubIntervals;
1716
+ let nextTime = initialTime + interval;
1717
+ const interpolatedTimes = [];
1718
+ const interpolatedValues = [];
1719
+ while (nextTime < curve.times[i]) {
1720
+ interpolatedTimes.push(nextTime);
1721
+ nextTime += interval;
1722
+ interpolatedValues.push(nextValue);
1723
+ nextValue += step;
1724
+ }
1725
+ curve.times = inject(curve.times, i, interpolatedTimes);
1726
+ curve.values = inject(curve.values, i, interpolatedValues);
1727
+ }
1728
+ }
1729
+ }
1730
+ }
1731
+ class TextParser {
1732
+ getPrevNode() {
1733
+ return this.nodeStack[this.currentIndent - 2];
1734
+ }
1735
+ getCurrentNode() {
1736
+ return this.nodeStack[this.currentIndent - 1];
1737
+ }
1738
+ getCurrentProp() {
1739
+ return this.currentProp;
1740
+ }
1741
+ pushStack(node) {
1742
+ this.nodeStack.push(node);
1743
+ this.currentIndent += 1;
1744
+ }
1745
+ popStack() {
1746
+ this.nodeStack.pop();
1747
+ this.currentIndent -= 1;
1748
+ }
1749
+ setCurrentProp(val, name) {
1750
+ this.currentProp = val;
1751
+ this.currentPropName = name;
1752
+ }
1753
+ parse(text) {
1754
+ this.currentIndent = 0;
1755
+ this.allNodes = new FBXTree();
1756
+ this.nodeStack = [];
1757
+ this.currentProp = [];
1758
+ this.currentPropName = "";
1759
+ const scope = this;
1760
+ const split = text.split(/[\r\n]+/);
1761
+ split.forEach(function(line, i) {
1762
+ const matchComment = line.match(/^[\s\t]*;/);
1763
+ const matchEmpty = line.match(/^[\s\t]*$/);
1764
+ if (matchComment || matchEmpty)
1765
+ return;
1766
+ const matchBeginning = line.match("^\\t{" + scope.currentIndent + "}(\\w+):(.*){", "");
1767
+ const matchProperty = line.match("^\\t{" + scope.currentIndent + "}(\\w+):[\\s\\t\\r\\n](.*)");
1768
+ const matchEnd = line.match("^\\t{" + (scope.currentIndent - 1) + "}}");
1769
+ if (matchBeginning) {
1770
+ scope.parseNodeBegin(line, matchBeginning);
1771
+ } else if (matchProperty) {
1772
+ scope.parseNodeProperty(line, matchProperty, split[++i]);
1773
+ } else if (matchEnd) {
1774
+ scope.popStack();
1775
+ } else if (line.match(/^[^\s\t}]/)) {
1776
+ scope.parseNodePropertyContinued(line);
1777
+ }
1778
+ });
1779
+ return this.allNodes;
1780
+ }
1781
+ parseNodeBegin(line, property) {
1782
+ const nodeName = property[1].trim().replace(/^"/, "").replace(/"$/, "");
1783
+ const nodeAttrs = property[2].split(",").map(function(attr) {
1784
+ return attr.trim().replace(/^"/, "").replace(/"$/, "");
1785
+ });
1786
+ const node = { name: nodeName };
1787
+ const attrs = this.parseNodeAttr(nodeAttrs);
1788
+ const currentNode = this.getCurrentNode();
1789
+ if (this.currentIndent === 0) {
1790
+ this.allNodes.add(nodeName, node);
1791
+ } else {
1792
+ if (nodeName in currentNode) {
1793
+ if (nodeName === "PoseNode") {
1794
+ currentNode.PoseNode.push(node);
1795
+ } else if (currentNode[nodeName].id !== void 0) {
1796
+ currentNode[nodeName] = {};
1797
+ currentNode[nodeName][currentNode[nodeName].id] = currentNode[nodeName];
1798
+ }
1799
+ if (attrs.id !== "")
1800
+ currentNode[nodeName][attrs.id] = node;
1801
+ } else if (typeof attrs.id === "number") {
1802
+ currentNode[nodeName] = {};
1803
+ currentNode[nodeName][attrs.id] = node;
1804
+ } else if (nodeName !== "Properties70") {
1805
+ if (nodeName === "PoseNode")
1806
+ currentNode[nodeName] = [node];
1807
+ else
1808
+ currentNode[nodeName] = node;
1809
+ }
1810
+ }
1811
+ if (typeof attrs.id === "number")
1812
+ node.id = attrs.id;
1813
+ if (attrs.name !== "")
1814
+ node.attrName = attrs.name;
1815
+ if (attrs.type !== "")
1816
+ node.attrType = attrs.type;
1817
+ this.pushStack(node);
1818
+ }
1819
+ parseNodeAttr(attrs) {
1820
+ let id = attrs[0];
1821
+ if (attrs[0] !== "") {
1822
+ id = parseInt(attrs[0]);
1823
+ if (isNaN(id)) {
1824
+ id = attrs[0];
1825
+ }
1826
+ }
1827
+ let name = "", type = "";
1828
+ if (attrs.length > 1) {
1829
+ name = attrs[1].replace(/^(\w+)::/, "");
1830
+ type = attrs[2];
1831
+ }
1832
+ return { id, name, type };
1833
+ }
1834
+ parseNodeProperty(line, property, contentLine) {
1835
+ let propName = property[1].replace(/^"/, "").replace(/"$/, "").trim();
1836
+ let propValue = property[2].replace(/^"/, "").replace(/"$/, "").trim();
1837
+ if (propName === "Content" && propValue === ",") {
1838
+ propValue = contentLine.replace(/"/g, "").replace(/,$/, "").trim();
1839
+ }
1840
+ const currentNode = this.getCurrentNode();
1841
+ const parentName = currentNode.name;
1842
+ if (parentName === "Properties70") {
1843
+ this.parseNodeSpecialProperty(line, propName, propValue);
1844
+ return;
1845
+ }
1846
+ if (propName === "C") {
1847
+ const connProps = propValue.split(",").slice(1);
1848
+ const from = parseInt(connProps[0]);
1849
+ const to = parseInt(connProps[1]);
1850
+ let rest = propValue.split(",").slice(3);
1851
+ rest = rest.map(function(elem) {
1852
+ return elem.trim().replace(/^"/, "");
1853
+ });
1854
+ propName = "connections";
1855
+ propValue = [from, to];
1856
+ append(propValue, rest);
1857
+ if (currentNode[propName] === void 0) {
1858
+ currentNode[propName] = [];
1859
+ }
1860
+ }
1861
+ if (propName === "Node")
1862
+ currentNode.id = propValue;
1863
+ if (propName in currentNode && Array.isArray(currentNode[propName])) {
1864
+ currentNode[propName].push(propValue);
1865
+ } else {
1866
+ if (propName !== "a")
1867
+ currentNode[propName] = propValue;
1868
+ else
1869
+ currentNode.a = propValue;
1870
+ }
1871
+ this.setCurrentProp(currentNode, propName);
1872
+ if (propName === "a" && propValue.slice(-1) !== ",") {
1873
+ currentNode.a = parseNumberArray(propValue);
1874
+ }
1875
+ }
1876
+ parseNodePropertyContinued(line) {
1877
+ const currentNode = this.getCurrentNode();
1878
+ currentNode.a += line;
1879
+ if (line.slice(-1) !== ",") {
1880
+ currentNode.a = parseNumberArray(currentNode.a);
1881
+ }
1882
+ }
1883
+ // parse "Property70"
1884
+ parseNodeSpecialProperty(line, propName, propValue) {
1885
+ const props = propValue.split('",').map(function(prop) {
1886
+ return prop.trim().replace(/^\"/, "").replace(/\s/, "_");
1887
+ });
1888
+ const innerPropName = props[0];
1889
+ const innerPropType1 = props[1];
1890
+ const innerPropType2 = props[2];
1891
+ const innerPropFlag = props[3];
1892
+ let innerPropValue = props[4];
1893
+ switch (innerPropType1) {
1894
+ case "int":
1895
+ case "enum":
1896
+ case "bool":
1897
+ case "ULongLong":
1898
+ case "double":
1899
+ case "Number":
1900
+ case "FieldOfView":
1901
+ innerPropValue = parseFloat(innerPropValue);
1902
+ break;
1903
+ case "Color":
1904
+ case "ColorRGB":
1905
+ case "Vector3D":
1906
+ case "Lcl_Translation":
1907
+ case "Lcl_Rotation":
1908
+ case "Lcl_Scaling":
1909
+ innerPropValue = parseNumberArray(innerPropValue);
1910
+ break;
1911
+ }
1912
+ this.getPrevNode()[innerPropName] = {
1913
+ type: innerPropType1,
1914
+ type2: innerPropType2,
1915
+ flag: innerPropFlag,
1916
+ value: innerPropValue
1917
+ };
1918
+ this.setCurrentProp(this.getPrevNode(), innerPropName);
1919
+ }
1920
+ }
1921
+ class BinaryParser {
1922
+ parse(buffer) {
1923
+ const reader = new BinaryReader(buffer);
1924
+ reader.skip(23);
1925
+ const version = reader.getUint32();
1926
+ if (version < 6400) {
1927
+ throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: " + version);
1928
+ }
1929
+ const allNodes = new FBXTree();
1930
+ while (!this.endOfContent(reader)) {
1931
+ const node = this.parseNode(reader, version);
1932
+ if (node !== null)
1933
+ allNodes.add(node.name, node);
1934
+ }
1935
+ return allNodes;
1936
+ }
1937
+ // Check if reader has reached the end of content.
1938
+ endOfContent(reader) {
1939
+ if (reader.size() % 16 === 0) {
1940
+ return (reader.getOffset() + 160 + 16 & ~15) >= reader.size();
1941
+ } else {
1942
+ return reader.getOffset() + 160 + 16 >= reader.size();
1943
+ }
1944
+ }
1945
+ // recursively parse nodes until the end of the file is reached
1946
+ parseNode(reader, version) {
1947
+ const node = {};
1948
+ const endOffset = version >= 7500 ? reader.getUint64() : reader.getUint32();
1949
+ const numProperties = version >= 7500 ? reader.getUint64() : reader.getUint32();
1950
+ version >= 7500 ? reader.getUint64() : reader.getUint32();
1951
+ const nameLen = reader.getUint8();
1952
+ const name = reader.getString(nameLen);
1953
+ if (endOffset === 0)
1954
+ return null;
1955
+ const propertyList = [];
1956
+ for (let i = 0; i < numProperties; i++) {
1957
+ propertyList.push(this.parseProperty(reader));
1958
+ }
1959
+ const id = propertyList.length > 0 ? propertyList[0] : "";
1960
+ const attrName = propertyList.length > 1 ? propertyList[1] : "";
1961
+ const attrType = propertyList.length > 2 ? propertyList[2] : "";
1962
+ node.singleProperty = numProperties === 1 && reader.getOffset() === endOffset ? true : false;
1963
+ while (endOffset > reader.getOffset()) {
1964
+ const subNode = this.parseNode(reader, version);
1965
+ if (subNode !== null)
1966
+ this.parseSubNode(name, node, subNode);
1967
+ }
1968
+ node.propertyList = propertyList;
1969
+ if (typeof id === "number")
1970
+ node.id = id;
1971
+ if (attrName !== "")
1972
+ node.attrName = attrName;
1973
+ if (attrType !== "")
1974
+ node.attrType = attrType;
1975
+ if (name !== "")
1976
+ node.name = name;
1977
+ return node;
1978
+ }
1979
+ parseSubNode(name, node, subNode) {
1980
+ if (subNode.singleProperty === true) {
1981
+ const value = subNode.propertyList[0];
1982
+ if (Array.isArray(value)) {
1983
+ node[subNode.name] = subNode;
1984
+ subNode.a = value;
1985
+ } else {
1986
+ node[subNode.name] = value;
1987
+ }
1988
+ } else if (name === "Connections" && subNode.name === "C") {
1989
+ const array = [];
1990
+ subNode.propertyList.forEach(function(property, i) {
1991
+ if (i !== 0)
1992
+ array.push(property);
1993
+ });
1994
+ if (node.connections === void 0) {
1995
+ node.connections = [];
1996
+ }
1997
+ node.connections.push(array);
1998
+ } else if (subNode.name === "Properties70") {
1999
+ const keys = Object.keys(subNode);
2000
+ keys.forEach(function(key) {
2001
+ node[key] = subNode[key];
2002
+ });
2003
+ } else if (name === "Properties70" && subNode.name === "P") {
2004
+ let innerPropName = subNode.propertyList[0];
2005
+ let innerPropType1 = subNode.propertyList[1];
2006
+ const innerPropType2 = subNode.propertyList[2];
2007
+ const innerPropFlag = subNode.propertyList[3];
2008
+ let innerPropValue;
2009
+ if (innerPropName.indexOf("Lcl ") === 0)
2010
+ innerPropName = innerPropName.replace("Lcl ", "Lcl_");
2011
+ if (innerPropType1.indexOf("Lcl ") === 0)
2012
+ innerPropType1 = innerPropType1.replace("Lcl ", "Lcl_");
2013
+ if (innerPropType1 === "Color" || innerPropType1 === "ColorRGB" || innerPropType1 === "Vector" || innerPropType1 === "Vector3D" || innerPropType1.indexOf("Lcl_") === 0) {
2014
+ innerPropValue = [subNode.propertyList[4], subNode.propertyList[5], subNode.propertyList[6]];
2015
+ } else {
2016
+ innerPropValue = subNode.propertyList[4];
2017
+ }
2018
+ node[innerPropName] = {
2019
+ type: innerPropType1,
2020
+ type2: innerPropType2,
2021
+ flag: innerPropFlag,
2022
+ value: innerPropValue
2023
+ };
2024
+ } else if (node[subNode.name] === void 0) {
2025
+ if (typeof subNode.id === "number") {
2026
+ node[subNode.name] = {};
2027
+ node[subNode.name][subNode.id] = subNode;
2028
+ } else {
2029
+ node[subNode.name] = subNode;
2030
+ }
2031
+ } else {
2032
+ if (subNode.name === "PoseNode") {
2033
+ if (!Array.isArray(node[subNode.name])) {
2034
+ node[subNode.name] = [node[subNode.name]];
2035
+ }
2036
+ node[subNode.name].push(subNode);
2037
+ } else if (node[subNode.name][subNode.id] === void 0) {
2038
+ node[subNode.name][subNode.id] = subNode;
2039
+ }
2040
+ }
2041
+ }
2042
+ parseProperty(reader) {
2043
+ const type = reader.getString(1);
2044
+ let length;
2045
+ switch (type) {
2046
+ case "C":
2047
+ return reader.getBoolean();
2048
+ case "D":
2049
+ return reader.getFloat64();
2050
+ case "F":
2051
+ return reader.getFloat32();
2052
+ case "I":
2053
+ return reader.getInt32();
2054
+ case "L":
2055
+ return reader.getInt64();
2056
+ case "R":
2057
+ length = reader.getUint32();
2058
+ return reader.getArrayBuffer(length);
2059
+ case "S":
2060
+ length = reader.getUint32();
2061
+ return reader.getString(length);
2062
+ case "Y":
2063
+ return reader.getInt16();
2064
+ case "b":
2065
+ case "c":
2066
+ case "d":
2067
+ case "f":
2068
+ case "i":
2069
+ case "l":
2070
+ const arrayLength = reader.getUint32();
2071
+ const encoding = reader.getUint32();
2072
+ const compressedLength = reader.getUint32();
2073
+ if (encoding === 0) {
2074
+ switch (type) {
2075
+ case "b":
2076
+ case "c":
2077
+ return reader.getBooleanArray(arrayLength);
2078
+ case "d":
2079
+ return reader.getFloat64Array(arrayLength);
2080
+ case "f":
2081
+ return reader.getFloat32Array(arrayLength);
2082
+ case "i":
2083
+ return reader.getInt32Array(arrayLength);
2084
+ case "l":
2085
+ return reader.getInt64Array(arrayLength);
2086
+ }
2087
+ }
2088
+ const data = fflate.unzlibSync(new Uint8Array(reader.getArrayBuffer(compressedLength)));
2089
+ const reader2 = new BinaryReader(data.buffer);
2090
+ switch (type) {
2091
+ case "b":
2092
+ case "c":
2093
+ return reader2.getBooleanArray(arrayLength);
2094
+ case "d":
2095
+ return reader2.getFloat64Array(arrayLength);
2096
+ case "f":
2097
+ return reader2.getFloat32Array(arrayLength);
2098
+ case "i":
2099
+ return reader2.getInt32Array(arrayLength);
2100
+ case "l":
2101
+ return reader2.getInt64Array(arrayLength);
2102
+ }
2103
+ default:
2104
+ throw new Error("THREE.FBXLoader: Unknown property type " + type);
2105
+ }
2106
+ }
2107
+ }
2108
+ class BinaryReader {
2109
+ constructor(buffer, littleEndian) {
2110
+ this.dv = new DataView(buffer);
2111
+ this.offset = 0;
2112
+ this.littleEndian = littleEndian !== void 0 ? littleEndian : true;
2113
+ }
2114
+ getOffset() {
2115
+ return this.offset;
2116
+ }
2117
+ size() {
2118
+ return this.dv.buffer.byteLength;
2119
+ }
2120
+ skip(length) {
2121
+ this.offset += length;
2122
+ }
2123
+ // seems like true/false representation depends on exporter.
2124
+ // true: 1 or 'Y'(=0x59), false: 0 or 'T'(=0x54)
2125
+ // then sees LSB.
2126
+ getBoolean() {
2127
+ return (this.getUint8() & 1) === 1;
2128
+ }
2129
+ getBooleanArray(size) {
2130
+ const a = [];
2131
+ for (let i = 0; i < size; i++) {
2132
+ a.push(this.getBoolean());
2133
+ }
2134
+ return a;
2135
+ }
2136
+ getUint8() {
2137
+ const value = this.dv.getUint8(this.offset);
2138
+ this.offset += 1;
2139
+ return value;
2140
+ }
2141
+ getInt16() {
2142
+ const value = this.dv.getInt16(this.offset, this.littleEndian);
2143
+ this.offset += 2;
2144
+ return value;
2145
+ }
2146
+ getInt32() {
2147
+ const value = this.dv.getInt32(this.offset, this.littleEndian);
2148
+ this.offset += 4;
2149
+ return value;
2150
+ }
2151
+ getInt32Array(size) {
2152
+ const a = [];
2153
+ for (let i = 0; i < size; i++) {
2154
+ a.push(this.getInt32());
2155
+ }
2156
+ return a;
2157
+ }
2158
+ getUint32() {
2159
+ const value = this.dv.getUint32(this.offset, this.littleEndian);
2160
+ this.offset += 4;
2161
+ return value;
2162
+ }
2163
+ // JavaScript doesn't support 64-bit integer so calculate this here
2164
+ // 1 << 32 will return 1 so using multiply operation instead here.
2165
+ // There's a possibility that this method returns wrong value if the value
2166
+ // is out of the range between Number.MAX_SAFE_INTEGER and Number.MIN_SAFE_INTEGER.
2167
+ // TODO: safely handle 64-bit integer
2168
+ getInt64() {
2169
+ let low, high;
2170
+ if (this.littleEndian) {
2171
+ low = this.getUint32();
2172
+ high = this.getUint32();
2173
+ } else {
2174
+ high = this.getUint32();
2175
+ low = this.getUint32();
2176
+ }
2177
+ if (high & 2147483648) {
2178
+ high = ~high & 4294967295;
2179
+ low = ~low & 4294967295;
2180
+ if (low === 4294967295)
2181
+ high = high + 1 & 4294967295;
2182
+ low = low + 1 & 4294967295;
2183
+ return -(high * 4294967296 + low);
2184
+ }
2185
+ return high * 4294967296 + low;
2186
+ }
2187
+ getInt64Array(size) {
2188
+ const a = [];
2189
+ for (let i = 0; i < size; i++) {
2190
+ a.push(this.getInt64());
2191
+ }
2192
+ return a;
2193
+ }
2194
+ // Note: see getInt64() comment
2195
+ getUint64() {
2196
+ let low, high;
2197
+ if (this.littleEndian) {
2198
+ low = this.getUint32();
2199
+ high = this.getUint32();
2200
+ } else {
2201
+ high = this.getUint32();
2202
+ low = this.getUint32();
2203
+ }
2204
+ return high * 4294967296 + low;
2205
+ }
2206
+ getFloat32() {
2207
+ const value = this.dv.getFloat32(this.offset, this.littleEndian);
2208
+ this.offset += 4;
2209
+ return value;
2210
+ }
2211
+ getFloat32Array(size) {
2212
+ const a = [];
2213
+ for (let i = 0; i < size; i++) {
2214
+ a.push(this.getFloat32());
2215
+ }
2216
+ return a;
2217
+ }
2218
+ getFloat64() {
2219
+ const value = this.dv.getFloat64(this.offset, this.littleEndian);
2220
+ this.offset += 8;
2221
+ return value;
2222
+ }
2223
+ getFloat64Array(size) {
2224
+ const a = [];
2225
+ for (let i = 0; i < size; i++) {
2226
+ a.push(this.getFloat64());
2227
+ }
2228
+ return a;
2229
+ }
2230
+ getArrayBuffer(size) {
2231
+ const value = this.dv.buffer.slice(this.offset, this.offset + size);
2232
+ this.offset += size;
2233
+ return value;
2234
+ }
2235
+ getString(size) {
2236
+ let a = [];
2237
+ for (let i = 0; i < size; i++) {
2238
+ a[i] = this.getUint8();
2239
+ }
2240
+ const nullByte = a.indexOf(0);
2241
+ if (nullByte >= 0)
2242
+ a = a.slice(0, nullByte);
2243
+ return THREE.LoaderUtils.decodeText(new Uint8Array(a));
2244
+ }
2245
+ }
2246
+ class FBXTree {
2247
+ add(key, val) {
2248
+ this[key] = val;
2249
+ }
2250
+ }
2251
+ function isFbxFormatBinary(buffer) {
2252
+ const CORRECT = "Kaydara FBX Binary \0";
2253
+ return buffer.byteLength >= CORRECT.length && CORRECT === convertArrayBufferToString(buffer, 0, CORRECT.length);
2254
+ }
2255
+ function isFbxFormatASCII(text) {
2256
+ const CORRECT = [
2257
+ "K",
2258
+ "a",
2259
+ "y",
2260
+ "d",
2261
+ "a",
2262
+ "r",
2263
+ "a",
2264
+ "\\",
2265
+ "F",
2266
+ "B",
2267
+ "X",
2268
+ "\\",
2269
+ "B",
2270
+ "i",
2271
+ "n",
2272
+ "a",
2273
+ "r",
2274
+ "y",
2275
+ "\\",
2276
+ "\\"
2277
+ ];
2278
+ let cursor = 0;
2279
+ function read(offset) {
2280
+ const result = text[offset - 1];
2281
+ text = text.slice(cursor + offset);
2282
+ cursor++;
2283
+ return result;
2284
+ }
2285
+ for (let i = 0; i < CORRECT.length; ++i) {
2286
+ const num = read(1);
2287
+ if (num === CORRECT[i]) {
2288
+ return false;
2289
+ }
2290
+ }
2291
+ return true;
2292
+ }
2293
+ function getFbxVersion(text) {
2294
+ const versionRegExp = /FBXVersion: (\d+)/;
2295
+ const match = text.match(versionRegExp);
2296
+ if (match) {
2297
+ const version = parseInt(match[1]);
2298
+ return version;
2299
+ }
2300
+ throw new Error("THREE.FBXLoader: Cannot find the version number for the file given.");
2301
+ }
2302
+ function convertFBXTimeToSeconds(time) {
2303
+ return time / 46186158e3;
2304
+ }
2305
+ const dataArray = [];
2306
+ function getData(polygonVertexIndex, polygonIndex, vertexIndex, infoObject) {
2307
+ let index;
2308
+ switch (infoObject.mappingType) {
2309
+ case "ByPolygonVertex":
2310
+ index = polygonVertexIndex;
2311
+ break;
2312
+ case "ByPolygon":
2313
+ index = polygonIndex;
2314
+ break;
2315
+ case "ByVertice":
2316
+ index = vertexIndex;
2317
+ break;
2318
+ case "AllSame":
2319
+ index = infoObject.indices[0];
2320
+ break;
2321
+ default:
2322
+ console.warn("THREE.FBXLoader: unknown attribute mapping type " + infoObject.mappingType);
2323
+ }
2324
+ if (infoObject.referenceType === "IndexToDirect")
2325
+ index = infoObject.indices[index];
2326
+ const from = index * infoObject.dataSize;
2327
+ const to = from + infoObject.dataSize;
2328
+ return slice(dataArray, infoObject.buffer, from, to);
2329
+ }
2330
+ const tempEuler = new THREE.Euler();
2331
+ const tempVec = new THREE.Vector3();
2332
+ function generateTransform(transformData) {
2333
+ const lTranslationM = new THREE.Matrix4();
2334
+ const lPreRotationM = new THREE.Matrix4();
2335
+ const lRotationM = new THREE.Matrix4();
2336
+ const lPostRotationM = new THREE.Matrix4();
2337
+ const lScalingM = new THREE.Matrix4();
2338
+ const lScalingPivotM = new THREE.Matrix4();
2339
+ const lScalingOffsetM = new THREE.Matrix4();
2340
+ const lRotationOffsetM = new THREE.Matrix4();
2341
+ const lRotationPivotM = new THREE.Matrix4();
2342
+ const lParentGX = new THREE.Matrix4();
2343
+ const lParentLX = new THREE.Matrix4();
2344
+ const lGlobalT = new THREE.Matrix4();
2345
+ const inheritType = transformData.inheritType ? transformData.inheritType : 0;
2346
+ if (transformData.translation)
2347
+ lTranslationM.setPosition(tempVec.fromArray(transformData.translation));
2348
+ if (transformData.preRotation) {
2349
+ const array = transformData.preRotation.map(THREE.MathUtils.degToRad);
2350
+ array.push(transformData.eulerOrder);
2351
+ lPreRotationM.makeRotationFromEuler(tempEuler.fromArray(array));
2352
+ }
2353
+ if (transformData.rotation) {
2354
+ const array = transformData.rotation.map(THREE.MathUtils.degToRad);
2355
+ array.push(transformData.eulerOrder);
2356
+ lRotationM.makeRotationFromEuler(tempEuler.fromArray(array));
2357
+ }
2358
+ if (transformData.postRotation) {
2359
+ const array = transformData.postRotation.map(THREE.MathUtils.degToRad);
2360
+ array.push(transformData.eulerOrder);
2361
+ lPostRotationM.makeRotationFromEuler(tempEuler.fromArray(array));
2362
+ lPostRotationM.invert();
2363
+ }
2364
+ if (transformData.scale)
2365
+ lScalingM.scale(tempVec.fromArray(transformData.scale));
2366
+ if (transformData.scalingOffset)
2367
+ lScalingOffsetM.setPosition(tempVec.fromArray(transformData.scalingOffset));
2368
+ if (transformData.scalingPivot)
2369
+ lScalingPivotM.setPosition(tempVec.fromArray(transformData.scalingPivot));
2370
+ if (transformData.rotationOffset)
2371
+ lRotationOffsetM.setPosition(tempVec.fromArray(transformData.rotationOffset));
2372
+ if (transformData.rotationPivot)
2373
+ lRotationPivotM.setPosition(tempVec.fromArray(transformData.rotationPivot));
2374
+ if (transformData.parentMatrixWorld) {
2375
+ lParentLX.copy(transformData.parentMatrix);
2376
+ lParentGX.copy(transformData.parentMatrixWorld);
2377
+ }
2378
+ const lLRM = lPreRotationM.clone().multiply(lRotationM).multiply(lPostRotationM);
2379
+ const lParentGRM = new THREE.Matrix4();
2380
+ lParentGRM.extractRotation(lParentGX);
2381
+ const lParentTM = new THREE.Matrix4();
2382
+ lParentTM.copyPosition(lParentGX);
2383
+ const lParentGRSM = lParentTM.clone().invert().multiply(lParentGX);
2384
+ const lParentGSM = lParentGRM.clone().invert().multiply(lParentGRSM);
2385
+ const lLSM = lScalingM;
2386
+ const lGlobalRS = new THREE.Matrix4();
2387
+ if (inheritType === 0) {
2388
+ lGlobalRS.copy(lParentGRM).multiply(lLRM).multiply(lParentGSM).multiply(lLSM);
2389
+ } else if (inheritType === 1) {
2390
+ lGlobalRS.copy(lParentGRM).multiply(lParentGSM).multiply(lLRM).multiply(lLSM);
2391
+ } else {
2392
+ const lParentLSM = new THREE.Matrix4().scale(new THREE.Vector3().setFromMatrixScale(lParentLX));
2393
+ const lParentLSM_inv = lParentLSM.clone().invert();
2394
+ const lParentGSM_noLocal = lParentGSM.clone().multiply(lParentLSM_inv);
2395
+ lGlobalRS.copy(lParentGRM).multiply(lLRM).multiply(lParentGSM_noLocal).multiply(lLSM);
2396
+ }
2397
+ const lRotationPivotM_inv = lRotationPivotM.clone().invert();
2398
+ const lScalingPivotM_inv = lScalingPivotM.clone().invert();
2399
+ let lTransform = lTranslationM.clone().multiply(lRotationOffsetM).multiply(lRotationPivotM).multiply(lPreRotationM).multiply(lRotationM).multiply(lPostRotationM).multiply(lRotationPivotM_inv).multiply(lScalingOffsetM).multiply(lScalingPivotM).multiply(lScalingM).multiply(lScalingPivotM_inv);
2400
+ const lLocalTWithAllPivotAndOffsetInfo = new THREE.Matrix4().copyPosition(lTransform);
2401
+ const lGlobalTranslation = lParentGX.clone().multiply(lLocalTWithAllPivotAndOffsetInfo);
2402
+ lGlobalT.copyPosition(lGlobalTranslation);
2403
+ lTransform = lGlobalT.clone().multiply(lGlobalRS);
2404
+ lTransform.premultiply(lParentGX.invert());
2405
+ return lTransform;
2406
+ }
2407
+ function getEulerOrder(order) {
2408
+ order = order || 0;
2409
+ const enums = [
2410
+ "ZYX",
2411
+ // -> XYZ extrinsic
2412
+ "YZX",
2413
+ // -> XZY extrinsic
2414
+ "XZY",
2415
+ // -> YZX extrinsic
2416
+ "ZXY",
2417
+ // -> YXZ extrinsic
2418
+ "YXZ",
2419
+ // -> ZXY extrinsic
2420
+ "XYZ"
2421
+ // -> ZYX extrinsic
2422
+ //'SphericXYZ', // not possible to support
2423
+ ];
2424
+ if (order === 6) {
2425
+ console.warn("THREE.FBXLoader: unsupported Euler Order: Spherical XYZ. Animations and rotations may be incorrect.");
2426
+ return enums[0];
2427
+ }
2428
+ return enums[order];
2429
+ }
2430
+ function parseNumberArray(value) {
2431
+ const array = value.split(",").map(function(val) {
2432
+ return parseFloat(val);
2433
+ });
2434
+ return array;
2435
+ }
2436
+ function convertArrayBufferToString(buffer, from, to) {
2437
+ if (from === void 0)
2438
+ from = 0;
2439
+ if (to === void 0)
2440
+ to = buffer.byteLength;
2441
+ return THREE.LoaderUtils.decodeText(new Uint8Array(buffer, from, to));
2442
+ }
2443
+ function append(a, b) {
2444
+ for (let i = 0, j = a.length, l = b.length; i < l; i++, j++) {
2445
+ a[j] = b[i];
2446
+ }
2447
+ }
2448
+ function slice(a, b, from, to) {
2449
+ for (let i = from, j = 0; i < to; i++, j++) {
2450
+ a[j] = b[i];
2451
+ }
2452
+ return a;
2453
+ }
2454
+ function inject(a1, index, a2) {
2455
+ return a1.slice(0, index).concat(a2).concat(a1.slice(index));
2456
+ }
2457
+ exports.FBXLoader = FBXLoader;