three-stdlib 2.22.7 → 2.22.9

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