@unikia/upe-renderer 0.0.0-stage → 0.186.110

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2234) hide show
  1. package/LICENSE +21 -0
  2. package/LICENSE.types +21 -0
  3. package/README.md +37 -2
  4. package/README.three.md +85 -0
  5. package/UPSTREAM.md +11 -0
  6. package/build/three.cjs +17 -0
  7. package/build/three.core.d.ts +1 -0
  8. package/build/three.core.js +60602 -0
  9. package/build/three.d.cts +1 -0
  10. package/build/three.module.d.ts +1 -0
  11. package/build/three.module.js +19719 -0
  12. package/build/three.tsl.d.ts +1 -0
  13. package/build/three.tsl.js +691 -0
  14. package/build/three.webgpu.d.ts +1 -0
  15. package/build/three.webgpu.js +93270 -0
  16. package/build/three.webgpu.nodes.d.ts +1 -0
  17. package/build/three.webgpu.nodes.js +92988 -0
  18. package/examples/jsm/Addons.d.ts +300 -0
  19. package/examples/jsm/Addons.js +301 -0
  20. package/examples/jsm/animation/AnimationClipCreator.d.ts +12 -0
  21. package/examples/jsm/animation/AnimationClipCreator.js +168 -0
  22. package/examples/jsm/animation/CCDIKSolver.d.ts +44 -0
  23. package/examples/jsm/animation/CCDIKSolver.js +595 -0
  24. package/examples/jsm/capabilities/WebGL.d.ts +6 -0
  25. package/examples/jsm/capabilities/WebGL.js +113 -0
  26. package/examples/jsm/capabilities/WebGPU.d.ts +7 -0
  27. package/examples/jsm/capabilities/WebGPU.js +59 -0
  28. package/examples/jsm/controls/ArcballControls.d.ts +208 -0
  29. package/examples/jsm/controls/ArcballControls.js +3543 -0
  30. package/examples/jsm/controls/DragControls.d.ts +81 -0
  31. package/examples/jsm/controls/DragControls.js +452 -0
  32. package/examples/jsm/controls/FirstPersonControls.d.ts +105 -0
  33. package/examples/jsm/controls/FirstPersonControls.js +512 -0
  34. package/examples/jsm/controls/FlyControls.d.ts +44 -0
  35. package/examples/jsm/controls/FlyControls.js +384 -0
  36. package/examples/jsm/controls/MapControls.d.ts +21 -0
  37. package/examples/jsm/controls/MapControls.js +116 -0
  38. package/examples/jsm/controls/OrbitControls.d.ts +295 -0
  39. package/examples/jsm/controls/OrbitControls.js +1972 -0
  40. package/examples/jsm/controls/PointerLockControls.d.ts +84 -0
  41. package/examples/jsm/controls/PointerLockControls.js +264 -0
  42. package/examples/jsm/controls/TrackballControls.d.ts +152 -0
  43. package/examples/jsm/controls/TrackballControls.js +1106 -0
  44. package/examples/jsm/controls/TransformControls.d.ts +363 -0
  45. package/examples/jsm/controls/TransformControls.js +2003 -0
  46. package/examples/jsm/csm/CSM.d.ts +55 -0
  47. package/examples/jsm/csm/CSM.js +598 -0
  48. package/examples/jsm/csm/CSMFrustum.d.ts +85 -0
  49. package/examples/jsm/csm/CSMFrustum.js +234 -0
  50. package/examples/jsm/csm/CSMHelper.d.ts +28 -0
  51. package/examples/jsm/csm/CSMHelper.js +243 -0
  52. package/examples/jsm/csm/CSMShader.d.ts +4 -0
  53. package/examples/jsm/csm/CSMShader.js +307 -0
  54. package/examples/jsm/csm/CSMShadowNode.d.ts +44 -0
  55. package/examples/jsm/csm/CSMShadowNode.js +619 -0
  56. package/examples/jsm/curves/CurveExtras.d.ts +68 -0
  57. package/examples/jsm/curves/CurveExtras.js +694 -0
  58. package/examples/jsm/curves/NURBSCurve.d.ts +28 -0
  59. package/examples/jsm/curves/NURBSCurve.js +155 -0
  60. package/examples/jsm/curves/NURBSSurface.d.ts +13 -0
  61. package/examples/jsm/curves/NURBSSurface.js +98 -0
  62. package/examples/jsm/curves/NURBSUtils.d.ts +146 -0
  63. package/examples/jsm/curves/NURBSUtils.js +532 -0
  64. package/examples/jsm/curves/NURBSVolume.d.ts +23 -0
  65. package/examples/jsm/curves/NURBSVolume.js +82 -0
  66. package/examples/jsm/effects/AnaglyphEffect.d.ts +21 -0
  67. package/examples/jsm/effects/AnaglyphEffect.js +274 -0
  68. package/examples/jsm/effects/AsciiEffect.d.ts +18 -0
  69. package/examples/jsm/effects/AsciiEffect.js +323 -0
  70. package/examples/jsm/effects/OutlineEffect.d.ts +28 -0
  71. package/examples/jsm/effects/OutlineEffect.js +489 -0
  72. package/examples/jsm/effects/ParallaxBarrierEffect.d.ts +11 -0
  73. package/examples/jsm/effects/ParallaxBarrierEffect.js +155 -0
  74. package/examples/jsm/effects/StereoEffect.d.ts +9 -0
  75. package/examples/jsm/effects/StereoEffect.js +91 -0
  76. package/examples/jsm/environments/ColorEnvironment.d.ts +9 -0
  77. package/examples/jsm/environments/ColorEnvironment.js +59 -0
  78. package/examples/jsm/environments/DebugEnvironment.d.ts +5 -0
  79. package/examples/jsm/environments/DebugEnvironment.js +102 -0
  80. package/examples/jsm/environments/RoomEnvironment.d.ts +6 -0
  81. package/examples/jsm/environments/RoomEnvironment.js +185 -0
  82. package/examples/jsm/exporters/DRACOExporter.d.ts +17 -0
  83. package/examples/jsm/exporters/DRACOExporter.js +332 -0
  84. package/examples/jsm/exporters/EXRExporter.d.ts +27 -0
  85. package/examples/jsm/exporters/EXRExporter.js +618 -0
  86. package/examples/jsm/exporters/GLTFExporter.d.ts +161 -0
  87. package/examples/jsm/exporters/GLTFExporter.js +3856 -0
  88. package/examples/jsm/exporters/KTX2Exporter.d.ts +7 -0
  89. package/examples/jsm/exporters/KTX2Exporter.js +347 -0
  90. package/examples/jsm/exporters/OBJExporter.d.ts +7 -0
  91. package/examples/jsm/exporters/OBJExporter.js +308 -0
  92. package/examples/jsm/exporters/PLYExporter.d.ts +31 -0
  93. package/examples/jsm/exporters/PLYExporter.js +775 -0
  94. package/examples/jsm/exporters/STLExporter.d.ts +21 -0
  95. package/examples/jsm/exporters/STLExporter.js +221 -0
  96. package/examples/jsm/exporters/USDZExporter.d.ts +30 -0
  97. package/examples/jsm/exporters/USDZExporter.js +1489 -0
  98. package/examples/jsm/generators/CityGenerator.d.ts +131 -0
  99. package/examples/jsm/generators/CityGenerator.js +678 -0
  100. package/examples/jsm/generators/ForestGenerator.d.ts +73 -0
  101. package/examples/jsm/generators/ForestGenerator.js +347 -0
  102. package/examples/jsm/generators/TerrainGenerator.d.ts +57 -0
  103. package/examples/jsm/generators/TerrainGenerator.js +516 -0
  104. package/examples/jsm/generators/TreeGenerator.d.ts +102 -0
  105. package/examples/jsm/generators/TreeGenerator.js +371 -0
  106. package/examples/jsm/generators/city/BenchGenerator.d.ts +29 -0
  107. package/examples/jsm/generators/city/BenchGenerator.js +127 -0
  108. package/examples/jsm/generators/city/CarGenerator.d.ts +43 -0
  109. package/examples/jsm/generators/city/CarGenerator.js +479 -0
  110. package/examples/jsm/generators/city/CityGeneratorUtils.js +31 -0
  111. package/examples/jsm/generators/city/HydrantGenerator.d.ts +27 -0
  112. package/examples/jsm/generators/city/HydrantGenerator.js +106 -0
  113. package/examples/jsm/generators/city/InstancedMeshGenerator.d.ts +29 -0
  114. package/examples/jsm/generators/city/InstancedMeshGenerator.js +86 -0
  115. package/examples/jsm/generators/city/PersonGenerator.d.ts +44 -0
  116. package/examples/jsm/generators/city/PersonGenerator.js +447 -0
  117. package/examples/jsm/generators/city/SidewalkGenerator.d.ts +40 -0
  118. package/examples/jsm/generators/city/SidewalkGenerator.js +248 -0
  119. package/examples/jsm/generators/city/SkyscraperGenerator.d.ts +83 -0
  120. package/examples/jsm/generators/city/SkyscraperGenerator.js +1757 -0
  121. package/examples/jsm/generators/city/StreetTreeGenerator.d.ts +30 -0
  122. package/examples/jsm/generators/city/StreetTreeGenerator.js +231 -0
  123. package/examples/jsm/generators/city/StreetlightGenerator.d.ts +28 -0
  124. package/examples/jsm/generators/city/StreetlightGenerator.js +100 -0
  125. package/examples/jsm/generators/city/TrafficlightGenerator.d.ts +29 -0
  126. package/examples/jsm/generators/city/TrafficlightGenerator.js +106 -0
  127. package/examples/jsm/generators/city/TrashcanGenerator.d.ts +24 -0
  128. package/examples/jsm/generators/city/TrashcanGenerator.js +100 -0
  129. package/examples/jsm/geometries/BoxLineGeometry.d.ts +12 -0
  130. package/examples/jsm/geometries/BoxLineGeometry.js +92 -0
  131. package/examples/jsm/geometries/ConvexGeometry.d.ts +5 -0
  132. package/examples/jsm/geometries/ConvexGeometry.js +72 -0
  133. package/examples/jsm/geometries/DecalGeometry.d.ts +16 -0
  134. package/examples/jsm/geometries/DecalGeometry.js +420 -0
  135. package/examples/jsm/geometries/LoftGeometry.d.ts +83 -0
  136. package/examples/jsm/geometries/LoftGeometry.js +355 -0
  137. package/examples/jsm/geometries/ParametricFunctions.d.ts +8 -0
  138. package/examples/jsm/geometries/ParametricFunctions.js +100 -0
  139. package/examples/jsm/geometries/ParametricGeometry.d.ts +18 -0
  140. package/examples/jsm/geometries/ParametricGeometry.js +172 -0
  141. package/examples/jsm/geometries/RoundedBoxGeometry.d.ts +5 -0
  142. package/examples/jsm/geometries/RoundedBoxGeometry.js +216 -0
  143. package/examples/jsm/geometries/TeapotGeometry.d.ts +37 -0
  144. package/examples/jsm/geometries/TeapotGeometry.js +689 -0
  145. package/examples/jsm/geometries/TextGeometry.d.ts +89 -0
  146. package/examples/jsm/geometries/TextGeometry.js +102 -0
  147. package/examples/jsm/gpgpu/BitonicSort.d.ts +21 -0
  148. package/examples/jsm/gpgpu/BitonicSort.js +715 -0
  149. package/examples/jsm/gpgpu/CountingSort.d.ts +31 -0
  150. package/examples/jsm/gpgpu/CountingSort.js +271 -0
  151. package/examples/jsm/helpers/AnimationPathHelper.d.ts +38 -0
  152. package/examples/jsm/helpers/AnimationPathHelper.js +302 -0
  153. package/examples/jsm/helpers/LightProbeGridHelper.d.ts +12 -0
  154. package/examples/jsm/helpers/LightProbeGridHelper.js +166 -0
  155. package/examples/jsm/helpers/LightProbeGridHelperWebGL.d.ts +12 -0
  156. package/examples/jsm/helpers/LightProbeGridHelperWebGL.js +221 -0
  157. package/examples/jsm/helpers/LightProbeHelper.d.ts +12 -0
  158. package/examples/jsm/helpers/LightProbeHelper.js +166 -0
  159. package/examples/jsm/helpers/LightProbeHelperGPU.d.ts +12 -0
  160. package/examples/jsm/helpers/LightProbeHelperGPU.js +102 -0
  161. package/examples/jsm/helpers/OctreeHelper.d.ts +17 -0
  162. package/examples/jsm/helpers/OctreeHelper.js +109 -0
  163. package/examples/jsm/helpers/PositionalAudioHelper.d.ts +13 -0
  164. package/examples/jsm/helpers/PositionalAudioHelper.js +169 -0
  165. package/examples/jsm/helpers/RapierHelper.d.ts +13 -0
  166. package/examples/jsm/helpers/RapierHelper.js +59 -0
  167. package/examples/jsm/helpers/RectAreaLightHelper.d.ts +10 -0
  168. package/examples/jsm/helpers/RectAreaLightHelper.js +118 -0
  169. package/examples/jsm/helpers/TextureHelper.d.ts +10 -0
  170. package/examples/jsm/helpers/TextureHelper.js +265 -0
  171. package/examples/jsm/helpers/TextureHelperGPU.d.ts +10 -0
  172. package/examples/jsm/helpers/TextureHelperGPU.js +214 -0
  173. package/examples/jsm/helpers/VertexNormalsHelper.d.ts +14 -0
  174. package/examples/jsm/helpers/VertexNormalsHelper.js +155 -0
  175. package/examples/jsm/helpers/VertexTangentsHelper.d.ts +12 -0
  176. package/examples/jsm/helpers/VertexTangentsHelper.js +133 -0
  177. package/examples/jsm/helpers/ViewHelper.d.ts +20 -0
  178. package/examples/jsm/helpers/ViewHelper.js +529 -0
  179. package/examples/jsm/inspector/Extension.d.ts +22 -0
  180. package/examples/jsm/inspector/Extension.js +107 -0
  181. package/examples/jsm/inspector/Inspector.d.ts +54 -0
  182. package/examples/jsm/inspector/Inspector.js +684 -0
  183. package/examples/jsm/inspector/RendererInspector.d.ts +9 -0
  184. package/examples/jsm/inspector/RendererInspector.js +589 -0
  185. package/examples/jsm/inspector/extensions/color-grading/ColorGrading.d.ts +34 -0
  186. package/examples/jsm/inspector/extensions/color-grading/ColorGrading.js +2609 -0
  187. package/examples/jsm/inspector/extensions/color-grading/ColorWheel.js +352 -0
  188. package/examples/jsm/inspector/extensions/color-grading/CurveEditor.js +599 -0
  189. package/examples/jsm/inspector/extensions/color-grading/LUT3DStyle.js +1201 -0
  190. package/examples/jsm/inspector/extensions/color-grading/LUTMath.js +788 -0
  191. package/examples/jsm/inspector/extensions/color-grading/modules/BrightnessModule.js +72 -0
  192. package/examples/jsm/inspector/extensions/color-grading/modules/ColorWheelModule.js +112 -0
  193. package/examples/jsm/inspector/extensions/color-grading/modules/ContrastModule.js +82 -0
  194. package/examples/jsm/inspector/extensions/color-grading/modules/CurvesModule.js +109 -0
  195. package/examples/jsm/inspector/extensions/color-grading/modules/ExposureHueModule.js +110 -0
  196. package/examples/jsm/inspector/extensions/color-grading/modules/ExposureModule.js +73 -0
  197. package/examples/jsm/inspector/extensions/color-grading/modules/HueModule.js +78 -0
  198. package/examples/jsm/inspector/extensions/color-grading/modules/ImportedCubeModule.js +89 -0
  199. package/examples/jsm/inspector/extensions/color-grading/modules/Module.js +285 -0
  200. package/examples/jsm/inspector/extensions/color-grading/modules/OutputModule.js +101 -0
  201. package/examples/jsm/inspector/extensions/color-grading/modules/RendererModule.js +225 -0
  202. package/examples/jsm/inspector/extensions/color-grading/modules/SatVibranceModule.js +102 -0
  203. package/examples/jsm/inspector/extensions/color-grading/modules/SaturationModule.js +76 -0
  204. package/examples/jsm/inspector/extensions/color-grading/modules/VibranceModule.js +76 -0
  205. package/examples/jsm/inspector/extensions/color-grading/modules/WhiteBalanceModule.js +86 -0
  206. package/examples/jsm/inspector/extensions/tsl-graph/TSLGraphEditor.d.ts +20 -0
  207. package/examples/jsm/inspector/extensions/tsl-graph/TSLGraphEditor.js +911 -0
  208. package/examples/jsm/inspector/extensions/tsl-graph/TSLGraphLoader.d.ts +11 -0
  209. package/examples/jsm/inspector/extensions/tsl-graph/TSLGraphLoader.js +282 -0
  210. package/examples/jsm/inspector/tabs/Console.js +420 -0
  211. package/examples/jsm/inspector/tabs/Memory.js +134 -0
  212. package/examples/jsm/inspector/tabs/Parameters.d.ts +122 -0
  213. package/examples/jsm/inspector/tabs/Parameters.js +440 -0
  214. package/examples/jsm/inspector/tabs/Performance.js +283 -0
  215. package/examples/jsm/inspector/tabs/Settings.js +310 -0
  216. package/examples/jsm/inspector/tabs/Timeline.js +1748 -0
  217. package/examples/jsm/inspector/tabs/Viewer.js +1374 -0
  218. package/examples/jsm/inspector/ui/Graph.js +232 -0
  219. package/examples/jsm/inspector/ui/Item.d.ts +5 -0
  220. package/examples/jsm/inspector/ui/Item.js +249 -0
  221. package/examples/jsm/inspector/ui/List.js +81 -0
  222. package/examples/jsm/inspector/ui/Profiler.js +2273 -0
  223. package/examples/jsm/inspector/ui/Style.js +2300 -0
  224. package/examples/jsm/inspector/ui/Tab.d.ts +9 -0
  225. package/examples/jsm/inspector/ui/Tab.js +269 -0
  226. package/examples/jsm/inspector/ui/Values.d.ts +103 -0
  227. package/examples/jsm/inspector/ui/Values.js +553 -0
  228. package/examples/jsm/inspector/ui/utils.js +189 -0
  229. package/examples/jsm/interaction/InteractionManager.d.ts +18 -0
  230. package/examples/jsm/interaction/InteractionManager.js +226 -0
  231. package/examples/jsm/interactive/HTMLMesh.d.ts +13 -0
  232. package/examples/jsm/interactive/HTMLMesh.js +617 -0
  233. package/examples/jsm/interactive/InteractiveGroup.d.ts +28 -0
  234. package/examples/jsm/interactive/InteractiveGroup.js +224 -0
  235. package/examples/jsm/interactive/SelectionBox.d.ts +16 -0
  236. package/examples/jsm/interactive/SelectionBox.js +324 -0
  237. package/examples/jsm/interactive/SelectionHelper.d.ts +17 -0
  238. package/examples/jsm/interactive/SelectionHelper.js +150 -0
  239. package/examples/jsm/libs/basis/README.md +45 -0
  240. package/examples/jsm/libs/basis/basis_transcoder.js +19 -0
  241. package/examples/jsm/libs/basis/basis_transcoder.wasm +0 -0
  242. package/examples/jsm/libs/chevrotain.module.min.js +141 -0
  243. package/examples/jsm/libs/demuxer_mp4.js +109 -0
  244. package/examples/jsm/libs/draco/README.md +31 -0
  245. package/examples/jsm/libs/draco/draco_decoder.js +34 -0
  246. package/examples/jsm/libs/draco/draco_decoder.wasm +0 -0
  247. package/examples/jsm/libs/draco/draco_wasm_wrapper.js +117 -0
  248. package/examples/jsm/libs/draco/gltf/draco_decoder.js +33 -0
  249. package/examples/jsm/libs/draco/gltf/draco_decoder.wasm +0 -0
  250. package/examples/jsm/libs/draco/gltf/draco_wasm_wrapper.js +116 -0
  251. package/examples/jsm/libs/fflate.module.d.ts +1 -0
  252. package/examples/jsm/libs/fflate.module.js +2672 -0
  253. package/examples/jsm/libs/ktx-parse.module.js +1 -0
  254. package/examples/jsm/libs/lil-gui.module.min.d.ts +608 -0
  255. package/examples/jsm/libs/lil-gui.module.min.js +8 -0
  256. package/examples/jsm/libs/meshopt_clusterizer.module.js +421 -0
  257. package/examples/jsm/libs/meshopt_decoder.module.d.ts +1 -0
  258. package/examples/jsm/libs/meshopt_decoder.module.js +196 -0
  259. package/examples/jsm/libs/meshopt_simplifier.module.js +627 -0
  260. package/examples/jsm/libs/mikktspace.module.d.ts +19 -0
  261. package/examples/jsm/libs/mikktspace.module.js +153 -0
  262. package/examples/jsm/libs/motion-controllers.module.js +397 -0
  263. package/examples/jsm/libs/potpack.module.js +125 -0
  264. package/examples/jsm/libs/stats.module.d.ts +3 -0
  265. package/examples/jsm/libs/stats.module.js +167 -0
  266. package/examples/jsm/libs/surfaceNet.js +201 -0
  267. package/examples/jsm/libs/tween.module.d.ts +2 -0
  268. package/examples/jsm/libs/tween.module.js +876 -0
  269. package/examples/jsm/libs/utif.module.js +1665 -0
  270. package/examples/jsm/libs/zstddec.module.d.ts +5 -0
  271. package/examples/jsm/libs/zstddec.module.js +1 -0
  272. package/examples/jsm/lighting/ClusteredLighting.d.ts +45 -0
  273. package/examples/jsm/lighting/ClusteredLighting.js +55 -0
  274. package/examples/jsm/lighting/DynamicLighting.d.ts +16 -0
  275. package/examples/jsm/lighting/DynamicLighting.js +82 -0
  276. package/examples/jsm/lighting/LightProbeGrid.d.ts +177 -0
  277. package/examples/jsm/lighting/LightProbeGrid.js +820 -0
  278. package/examples/jsm/lighting/LightProbeGridUtils.js +107 -0
  279. package/examples/jsm/lighting/LightProbeGridWebGL.d.ts +178 -0
  280. package/examples/jsm/lighting/LightProbeGridWebGL.js +830 -0
  281. package/examples/jsm/lighting/vxgi/VXGIConeTracer.js +194 -0
  282. package/examples/jsm/lighting/vxgi/VXGINode.d.ts +100 -0
  283. package/examples/jsm/lighting/vxgi/VXGINode.js +660 -0
  284. package/examples/jsm/lighting/vxgi/VXGISceneCollector.js +478 -0
  285. package/examples/jsm/lighting/vxgi/VXGIVolume.d.ts +245 -0
  286. package/examples/jsm/lighting/vxgi/VXGIVolume.js +1430 -0
  287. package/examples/jsm/lights/LightProbeGenerator.d.ts +16 -0
  288. package/examples/jsm/lights/LightProbeGenerator.js +337 -0
  289. package/examples/jsm/lights/RectAreaLightTexturesLib.d.ts +7 -0
  290. package/examples/jsm/lights/RectAreaLightTexturesLib.js +127 -0
  291. package/examples/jsm/lights/RectAreaLightUniformsLib.d.ts +5 -0
  292. package/examples/jsm/lights/RectAreaLightUniformsLib.js +40 -0
  293. package/examples/jsm/lights/SunLight.d.ts +53 -0
  294. package/examples/jsm/lights/SunLight.js +95 -0
  295. package/examples/jsm/lights/SunLightNode.d.ts +25 -0
  296. package/examples/jsm/lights/SunLightNode.js +56 -0
  297. package/examples/jsm/lights/SunLightShadow.d.ts +57 -0
  298. package/examples/jsm/lights/SunLightShadow.js +319 -0
  299. package/examples/jsm/lights/SunShadowNode.d.ts +53 -0
  300. package/examples/jsm/lights/SunShadowNode.js +312 -0
  301. package/examples/jsm/lines/Line2.d.ts +25 -0
  302. package/examples/jsm/lines/Line2.js +56 -0
  303. package/examples/jsm/lines/LineGeometry.d.ts +27 -0
  304. package/examples/jsm/lines/LineGeometry.js +157 -0
  305. package/examples/jsm/lines/LineMaterial.d.ts +82 -0
  306. package/examples/jsm/lines/LineMaterial.js +726 -0
  307. package/examples/jsm/lines/LineSegments2.d.ts +39 -0
  308. package/examples/jsm/lines/LineSegments2.js +434 -0
  309. package/examples/jsm/lines/LineSegmentsGeometry.d.ts +53 -0
  310. package/examples/jsm/lines/LineSegmentsGeometry.js +298 -0
  311. package/examples/jsm/lines/Wireframe.d.ts +14 -0
  312. package/examples/jsm/lines/Wireframe.js +108 -0
  313. package/examples/jsm/lines/WireframeGeometry2.d.ts +8 -0
  314. package/examples/jsm/lines/WireframeGeometry2.js +49 -0
  315. package/examples/jsm/lines/webgpu/Line2.d.ts +14 -0
  316. package/examples/jsm/lines/webgpu/Line2.js +46 -0
  317. package/examples/jsm/lines/webgpu/LineSegments2.d.ts +15 -0
  318. package/examples/jsm/lines/webgpu/LineSegments2.js +419 -0
  319. package/examples/jsm/lines/webgpu/Wireframe.d.ts +13 -0
  320. package/examples/jsm/lines/webgpu/Wireframe.js +86 -0
  321. package/examples/jsm/loaders/3DMLoader.d.ts +12 -0
  322. package/examples/jsm/loaders/3DMLoader.js +1937 -0
  323. package/examples/jsm/loaders/3MFLoader.d.ts +9 -0
  324. package/examples/jsm/loaders/3MFLoader.js +1822 -0
  325. package/examples/jsm/loaders/AMFLoader.d.ts +7 -0
  326. package/examples/jsm/loaders/AMFLoader.js +541 -0
  327. package/examples/jsm/loaders/BVHLoader.d.ts +14 -0
  328. package/examples/jsm/loaders/BVHLoader.js +484 -0
  329. package/examples/jsm/loaders/ColladaLoader.d.ts +35 -0
  330. package/examples/jsm/loaders/ColladaLoader.js +153 -0
  331. package/examples/jsm/loaders/DDSLoader.d.ts +22 -0
  332. package/examples/jsm/loaders/DDSLoader.js +385 -0
  333. package/examples/jsm/loaders/DRACOLoader.d.ts +39 -0
  334. package/examples/jsm/loaders/DRACOLoader.js +772 -0
  335. package/examples/jsm/loaders/EXRLoader.d.ts +24 -0
  336. package/examples/jsm/loaders/EXRLoader.js +3395 -0
  337. package/examples/jsm/loaders/FBXLoader.d.ts +8 -0
  338. package/examples/jsm/loaders/FBXLoader.js +4656 -0
  339. package/examples/jsm/loaders/FontLoader.d.ts +41 -0
  340. package/examples/jsm/loaders/FontLoader.js +260 -0
  341. package/examples/jsm/loaders/GCodeLoader.d.ts +8 -0
  342. package/examples/jsm/loaders/GCodeLoader.js +318 -0
  343. package/examples/jsm/loaders/GLTFGaussianSplatLoaderExtension.d.ts +14 -0
  344. package/examples/jsm/loaders/GLTFGaussianSplatLoaderExtension.js +330 -0
  345. package/examples/jsm/loaders/GLTFLoader.d.ts +153 -0
  346. package/examples/jsm/loaders/GLTFLoader.js +4925 -0
  347. package/examples/jsm/loaders/GaussianSplatPLYLoader.d.ts +9 -0
  348. package/examples/jsm/loaders/GaussianSplatPLYLoader.js +386 -0
  349. package/examples/jsm/loaders/HDRCubeTextureLoader.d.ts +18 -0
  350. package/examples/jsm/loaders/HDRCubeTextureLoader.js +164 -0
  351. package/examples/jsm/loaders/HDRLoader.d.ts +12 -0
  352. package/examples/jsm/loaders/HDRLoader.js +463 -0
  353. package/examples/jsm/loaders/IESLoader.d.ts +5 -0
  354. package/examples/jsm/loaders/IESLoader.js +379 -0
  355. package/examples/jsm/loaders/KMZLoader.d.ts +9 -0
  356. package/examples/jsm/loaders/KMZLoader.js +163 -0
  357. package/examples/jsm/loaders/KSPLATLoader.d.ts +9 -0
  358. package/examples/jsm/loaders/KSPLATLoader.js +463 -0
  359. package/examples/jsm/loaders/KTX2Loader.d.ts +58 -0
  360. package/examples/jsm/loaders/KTX2Loader.js +1276 -0
  361. package/examples/jsm/loaders/KTXLoader.d.ts +22 -0
  362. package/examples/jsm/loaders/KTXLoader.js +197 -0
  363. package/examples/jsm/loaders/LDrawLoader.d.ts +38 -0
  364. package/examples/jsm/loaders/LDrawLoader.js +2510 -0
  365. package/examples/jsm/loaders/LUT3dlLoader.d.ts +39 -0
  366. package/examples/jsm/loaders/LUT3dlLoader.js +205 -0
  367. package/examples/jsm/loaders/LUTCubeLoader.d.ts +42 -0
  368. package/examples/jsm/loaders/LUTCubeLoader.js +190 -0
  369. package/examples/jsm/loaders/LUTImageLoader.d.ts +18 -0
  370. package/examples/jsm/loaders/LUTImageLoader.js +190 -0
  371. package/examples/jsm/loaders/LWOLoader.d.ts +25 -0
  372. package/examples/jsm/loaders/LWOLoader.js +1051 -0
  373. package/examples/jsm/loaders/MD2Loader.d.ts +7 -0
  374. package/examples/jsm/loaders/MD2Loader.js +435 -0
  375. package/examples/jsm/loaders/MDDLoader.d.ts +12 -0
  376. package/examples/jsm/loaders/MDDLoader.js +147 -0
  377. package/examples/jsm/loaders/MTLLoader.d.ts +95 -0
  378. package/examples/jsm/loaders/MTLLoader.js +593 -0
  379. package/examples/jsm/loaders/MaterialXLoader.d.ts +70 -0
  380. package/examples/jsm/loaders/MaterialXLoader.js +227 -0
  381. package/examples/jsm/loaders/NRRDLoader.d.ts +15 -0
  382. package/examples/jsm/loaders/NRRDLoader.js +718 -0
  383. package/examples/jsm/loaders/OBJLoader.d.ts +10 -0
  384. package/examples/jsm/loaders/OBJLoader.js +955 -0
  385. package/examples/jsm/loaders/PCDLoader.d.ts +8 -0
  386. package/examples/jsm/loaders/PCDLoader.js +620 -0
  387. package/examples/jsm/loaders/PDBLoader.d.ts +15 -0
  388. package/examples/jsm/loaders/PDBLoader.js +272 -0
  389. package/examples/jsm/loaders/PLYLoader.d.ts +11 -0
  390. package/examples/jsm/loaders/PLYLoader.js +968 -0
  391. package/examples/jsm/loaders/PVRLoader.d.ts +16 -0
  392. package/examples/jsm/loaders/PVRLoader.js +270 -0
  393. package/examples/jsm/loaders/RGBELoader.d.ts +7 -0
  394. package/examples/jsm/loaders/RGBELoader.js +18 -0
  395. package/examples/jsm/loaders/SPLATLoader.d.ts +9 -0
  396. package/examples/jsm/loaders/SPLATLoader.js +139 -0
  397. package/examples/jsm/loaders/SPZLoader.d.ts +18 -0
  398. package/examples/jsm/loaders/SPZLoader.js +561 -0
  399. package/examples/jsm/loaders/STLLoader.d.ts +7 -0
  400. package/examples/jsm/loaders/STLLoader.js +421 -0
  401. package/examples/jsm/loaders/SVGLoader.d.ts +67 -0
  402. package/examples/jsm/loaders/SVGLoader.js +3319 -0
  403. package/examples/jsm/loaders/TDSLoader.d.ts +35 -0
  404. package/examples/jsm/loaders/TDSLoader.js +1142 -0
  405. package/examples/jsm/loaders/TGALoader.d.ts +7 -0
  406. package/examples/jsm/loaders/TGALoader.js +538 -0
  407. package/examples/jsm/loaders/TIFFLoader.d.ts +7 -0
  408. package/examples/jsm/loaders/TIFFLoader.js +59 -0
  409. package/examples/jsm/loaders/TTFLoader.d.ts +10 -0
  410. package/examples/jsm/loaders/TTFLoader.js +261 -0
  411. package/examples/jsm/loaders/USDLoader.d.ts +14 -0
  412. package/examples/jsm/loaders/USDLoader.js +303 -0
  413. package/examples/jsm/loaders/USDZLoader.d.ts +14 -0
  414. package/examples/jsm/loaders/USDZLoader.js +16 -0
  415. package/examples/jsm/loaders/UltraHDRLoader.d.ts +28 -0
  416. package/examples/jsm/loaders/UltraHDRLoader.js +755 -0
  417. package/examples/jsm/loaders/VOXLoader.d.ts +38 -0
  418. package/examples/jsm/loaders/VOXLoader.js +919 -0
  419. package/examples/jsm/loaders/VRMLLoader.d.ts +7 -0
  420. package/examples/jsm/loaders/VRMLLoader.js +3646 -0
  421. package/examples/jsm/loaders/VTKLoader.d.ts +13 -0
  422. package/examples/jsm/loaders/VTKLoader.js +1293 -0
  423. package/examples/jsm/loaders/XYZLoader.d.ts +7 -0
  424. package/examples/jsm/loaders/XYZLoader.js +143 -0
  425. package/examples/jsm/loaders/collada/ColladaComposer.js +3044 -0
  426. package/examples/jsm/loaders/collada/ColladaParser.js +1977 -0
  427. package/examples/jsm/loaders/lwo/IFFParser.js +1217 -0
  428. package/examples/jsm/loaders/lwo/LWO2Parser.js +414 -0
  429. package/examples/jsm/loaders/lwo/LWO3Parser.js +373 -0
  430. package/examples/jsm/loaders/materialx/MaterialXArchive.js +108 -0
  431. package/examples/jsm/loaders/materialx/MaterialXDocument.js +878 -0
  432. package/examples/jsm/loaders/materialx/MaterialXHextile.d.ts +24 -0
  433. package/examples/jsm/loaders/materialx/MaterialXHextile.js +183 -0
  434. package/examples/jsm/loaders/materialx/MaterialXInterfaceValidation.d.ts +8 -0
  435. package/examples/jsm/loaders/materialx/MaterialXInterfaceValidation.js +376 -0
  436. package/examples/jsm/loaders/materialx/MaterialXLog.d.ts +33 -0
  437. package/examples/jsm/loaders/materialx/MaterialXLog.js +75 -0
  438. package/examples/jsm/loaders/materialx/MaterialXNodeInterfaceRegistry.js +4 -0
  439. package/examples/jsm/loaders/materialx/MaterialXNodeLibrary.js +1021 -0
  440. package/examples/jsm/loaders/materialx/MaterialXSurfaceMappings.js +661 -0
  441. package/examples/jsm/loaders/materialx/MaterialXUtils.js +57 -0
  442. package/examples/jsm/loaders/materialx/compile/MaterialXCompileRegistry.js +997 -0
  443. package/examples/jsm/loaders/materialx/parse/MaterialXParser.js +28 -0
  444. package/examples/jsm/loaders/usd/USDAParser.js +914 -0
  445. package/examples/jsm/loaders/usd/USDCParser.js +1875 -0
  446. package/examples/jsm/loaders/usd/USDComposer.js +4665 -0
  447. package/examples/jsm/materials/LDrawConditionalLineMaterial.d.ts +9 -0
  448. package/examples/jsm/materials/LDrawConditionalLineMaterial.js +183 -0
  449. package/examples/jsm/materials/LDrawConditionalLineNodeMaterial.d.ts +9 -0
  450. package/examples/jsm/materials/LDrawConditionalLineNodeMaterial.js +154 -0
  451. package/examples/jsm/materials/WoodNodeMaterial.d.ts +75 -0
  452. package/examples/jsm/materials/WoodNodeMaterial.js +431 -0
  453. package/examples/jsm/math/Capsule.d.ts +26 -0
  454. package/examples/jsm/math/Capsule.js +159 -0
  455. package/examples/jsm/math/ColorConverter.d.ts +19 -0
  456. package/examples/jsm/math/ColorConverter.js +58 -0
  457. package/examples/jsm/math/ColorSpaces.d.ts +15 -0
  458. package/examples/jsm/math/ColorSpaces.js +147 -0
  459. package/examples/jsm/math/ConvexHull.d.ts +89 -0
  460. package/examples/jsm/math/ConvexHull.js +1695 -0
  461. package/examples/jsm/math/ImprovedNoise.d.ts +4 -0
  462. package/examples/jsm/math/ImprovedNoise.js +88 -0
  463. package/examples/jsm/math/Lut.d.ts +27 -0
  464. package/examples/jsm/math/Lut.js +317 -0
  465. package/examples/jsm/math/MeshSurfaceSampler.d.ts +21 -0
  466. package/examples/jsm/math/MeshSurfaceSampler.js +315 -0
  467. package/examples/jsm/math/OBB.d.ts +24 -0
  468. package/examples/jsm/math/OBB.js +535 -0
  469. package/examples/jsm/math/Octree.d.ts +54 -0
  470. package/examples/jsm/math/Octree.js +822 -0
  471. package/examples/jsm/math/SimplexNoise.d.ts +9 -0
  472. package/examples/jsm/math/SimplexNoise.js +470 -0
  473. package/examples/jsm/misc/ConvexObjectBreaker.d.ts +25 -0
  474. package/examples/jsm/misc/ConvexObjectBreaker.js +539 -0
  475. package/examples/jsm/misc/GPUComputationRenderer.d.ts +55 -0
  476. package/examples/jsm/misc/GPUComputationRenderer.js +508 -0
  477. package/examples/jsm/misc/Gyroscope.d.ts +5 -0
  478. package/examples/jsm/misc/Gyroscope.js +78 -0
  479. package/examples/jsm/misc/MD2Character.d.ts +33 -0
  480. package/examples/jsm/misc/MD2Character.js +391 -0
  481. package/examples/jsm/misc/MD2CharacterComplex.d.ts +55 -0
  482. package/examples/jsm/misc/MD2CharacterComplex.js +740 -0
  483. package/examples/jsm/misc/MorphAnimMesh.d.ts +13 -0
  484. package/examples/jsm/misc/MorphAnimMesh.js +119 -0
  485. package/examples/jsm/misc/MorphBlendMesh.d.ts +21 -0
  486. package/examples/jsm/misc/MorphBlendMesh.js +425 -0
  487. package/examples/jsm/misc/ProgressiveLightMap.d.ts +58 -0
  488. package/examples/jsm/misc/ProgressiveLightMap.js +370 -0
  489. package/examples/jsm/misc/ProgressiveLightMapGPU.d.ts +27 -0
  490. package/examples/jsm/misc/ProgressiveLightMapGPU.js +322 -0
  491. package/examples/jsm/misc/RollerCoaster.d.ts +26 -0
  492. package/examples/jsm/misc/RollerCoaster.js +661 -0
  493. package/examples/jsm/misc/SculptGL.LICENSE.txt +21 -0
  494. package/examples/jsm/misc/Sculptor.d.ts +259 -0
  495. package/examples/jsm/misc/Sculptor.js +1679 -0
  496. package/examples/jsm/misc/SculptorMesh.js +1504 -0
  497. package/examples/jsm/misc/SculptorTools.js +1180 -0
  498. package/examples/jsm/misc/SculptorUtils.js +345 -0
  499. package/examples/jsm/misc/TileCreasedNormalsPlugin.d.ts +49 -0
  500. package/examples/jsm/misc/TileCreasedNormalsPlugin.js +270 -0
  501. package/examples/jsm/misc/TubePainter.d.ts +10 -0
  502. package/examples/jsm/misc/TubePainter.js +611 -0
  503. package/examples/jsm/misc/Volume.d.ts +37 -0
  504. package/examples/jsm/misc/Volume.js +520 -0
  505. package/examples/jsm/misc/VolumeSlice.d.ts +28 -0
  506. package/examples/jsm/misc/VolumeSlice.js +275 -0
  507. package/examples/jsm/modifiers/CurveModifier.d.ts +41 -0
  508. package/examples/jsm/modifiers/CurveModifier.js +374 -0
  509. package/examples/jsm/modifiers/CurveModifierGPU.d.ts +31 -0
  510. package/examples/jsm/modifiers/CurveModifierGPU.js +256 -0
  511. package/examples/jsm/modifiers/EdgeSplitModifier.d.ts +26 -0
  512. package/examples/jsm/modifiers/EdgeSplitModifier.js +299 -0
  513. package/examples/jsm/modifiers/SimplifyModifier.d.ts +6 -0
  514. package/examples/jsm/modifiers/SimplifyModifier.js +139 -0
  515. package/examples/jsm/modifiers/TessellateModifier.d.ts +9 -0
  516. package/examples/jsm/modifiers/TessellateModifier.js +340 -0
  517. package/examples/jsm/objects/GaussianSplat.d.ts +35 -0
  518. package/examples/jsm/objects/GaussianSplat.js +1039 -0
  519. package/examples/jsm/objects/GroundedSkybox.d.ts +5 -0
  520. package/examples/jsm/objects/GroundedSkybox.js +69 -0
  521. package/examples/jsm/objects/Lensflare.d.ts +21 -0
  522. package/examples/jsm/objects/Lensflare.js +489 -0
  523. package/examples/jsm/objects/LensflareMesh.d.ts +21 -0
  524. package/examples/jsm/objects/LensflareMesh.js +376 -0
  525. package/examples/jsm/objects/MarchingCubes.d.ts +76 -0
  526. package/examples/jsm/objects/MarchingCubes.js +1261 -0
  527. package/examples/jsm/objects/Reflector.d.ts +54 -0
  528. package/examples/jsm/objects/Reflector.js +385 -0
  529. package/examples/jsm/objects/ReflectorForSSRPass.d.ts +62 -0
  530. package/examples/jsm/objects/ReflectorForSSRPass.js +393 -0
  531. package/examples/jsm/objects/Refractor.d.ts +21 -0
  532. package/examples/jsm/objects/Refractor.js +389 -0
  533. package/examples/jsm/objects/ShadowMesh.d.ts +10 -0
  534. package/examples/jsm/objects/ShadowMesh.js +130 -0
  535. package/examples/jsm/objects/Sky.d.ts +28 -0
  536. package/examples/jsm/objects/Sky.js +342 -0
  537. package/examples/jsm/objects/SkyMesh.d.ts +26 -0
  538. package/examples/jsm/objects/SkyMesh.js +396 -0
  539. package/examples/jsm/objects/Water.d.ts +22 -0
  540. package/examples/jsm/objects/Water.js +374 -0
  541. package/examples/jsm/objects/Water2.d.ts +21 -0
  542. package/examples/jsm/objects/Water2.js +403 -0
  543. package/examples/jsm/objects/Water2Mesh.d.ts +53 -0
  544. package/examples/jsm/objects/Water2Mesh.js +199 -0
  545. package/examples/jsm/objects/WaterMesh.d.ts +40 -0
  546. package/examples/jsm/objects/WaterMesh.js +194 -0
  547. package/examples/jsm/offscreen/jank.js +45 -0
  548. package/examples/jsm/offscreen/offscreen.js +8 -0
  549. package/examples/jsm/offscreen/scene.js +86 -0
  550. package/examples/jsm/physics/AmmoPhysics.d.ts +9 -0
  551. package/examples/jsm/physics/AmmoPhysics.js +366 -0
  552. package/examples/jsm/physics/JoltPhysics.d.ts +10 -0
  553. package/examples/jsm/physics/JoltPhysics.js +334 -0
  554. package/examples/jsm/physics/RapierPhysics.d.ts +26 -0
  555. package/examples/jsm/physics/RapierPhysics.js +461 -0
  556. package/examples/jsm/postprocessing/AfterimagePass.d.ts +17 -0
  557. package/examples/jsm/postprocessing/AfterimagePass.js +187 -0
  558. package/examples/jsm/postprocessing/BloomPass.d.ts +14 -0
  559. package/examples/jsm/postprocessing/BloomPass.js +274 -0
  560. package/examples/jsm/postprocessing/BokehPass.d.ts +23 -0
  561. package/examples/jsm/postprocessing/BokehPass.js +218 -0
  562. package/examples/jsm/postprocessing/ClearPass.d.ts +9 -0
  563. package/examples/jsm/postprocessing/ClearPass.js +97 -0
  564. package/examples/jsm/postprocessing/CubeTexturePass.d.ts +14 -0
  565. package/examples/jsm/postprocessing/CubeTexturePass.js +146 -0
  566. package/examples/jsm/postprocessing/DotScreenPass.d.ts +10 -0
  567. package/examples/jsm/postprocessing/DotScreenPass.js +114 -0
  568. package/examples/jsm/postprocessing/EffectComposer.d.ts +30 -0
  569. package/examples/jsm/postprocessing/EffectComposer.js +365 -0
  570. package/examples/jsm/postprocessing/FXAAPass.d.ts +7 -0
  571. package/examples/jsm/postprocessing/FXAAPass.js +40 -0
  572. package/examples/jsm/postprocessing/FilmPass.d.ts +10 -0
  573. package/examples/jsm/postprocessing/FilmPass.js +113 -0
  574. package/examples/jsm/postprocessing/GTAOPass.d.ts +121 -0
  575. package/examples/jsm/postprocessing/GTAOPass.js +727 -0
  576. package/examples/jsm/postprocessing/GlitchPass.d.ts +16 -0
  577. package/examples/jsm/postprocessing/GlitchPass.js +177 -0
  578. package/examples/jsm/postprocessing/HalftonePass.d.ts +37 -0
  579. package/examples/jsm/postprocessing/HalftonePass.js +134 -0
  580. package/examples/jsm/postprocessing/LUTPass.d.ts +13 -0
  581. package/examples/jsm/postprocessing/LUTPass.js +138 -0
  582. package/examples/jsm/postprocessing/MaskPass.d.ts +14 -0
  583. package/examples/jsm/postprocessing/MaskPass.js +195 -0
  584. package/examples/jsm/postprocessing/OutlinePass.d.ts +64 -0
  585. package/examples/jsm/postprocessing/OutlinePass.js +776 -0
  586. package/examples/jsm/postprocessing/OutputPass.d.ts +14 -0
  587. package/examples/jsm/postprocessing/OutputPass.js +148 -0
  588. package/examples/jsm/postprocessing/Pass.d.ts +31 -0
  589. package/examples/jsm/postprocessing/Pass.js +191 -0
  590. package/examples/jsm/postprocessing/RenderPass.d.ts +28 -0
  591. package/examples/jsm/postprocessing/RenderPass.js +193 -0
  592. package/examples/jsm/postprocessing/RenderPixelatedPass.d.ts +30 -0
  593. package/examples/jsm/postprocessing/RenderPixelatedPass.js +314 -0
  594. package/examples/jsm/postprocessing/RenderTransitionPass.d.ts +33 -0
  595. package/examples/jsm/postprocessing/RenderTransitionPass.js +267 -0
  596. package/examples/jsm/postprocessing/SAOPass.d.ts +70 -0
  597. package/examples/jsm/postprocessing/SAOPass.js +407 -0
  598. package/examples/jsm/postprocessing/SMAAPass.d.ts +21 -0
  599. package/examples/jsm/postprocessing/SMAAPass.js +230 -0
  600. package/examples/jsm/postprocessing/SSAARenderPass.d.ts +26 -0
  601. package/examples/jsm/postprocessing/SSAARenderPass.js +313 -0
  602. package/examples/jsm/postprocessing/SSAOPass.d.ts +68 -0
  603. package/examples/jsm/postprocessing/SSAOPass.js +527 -0
  604. package/examples/jsm/postprocessing/SSRPass.d.ts +99 -0
  605. package/examples/jsm/postprocessing/SSRPass.js +858 -0
  606. package/examples/jsm/postprocessing/SavePass.d.ts +12 -0
  607. package/examples/jsm/postprocessing/SavePass.js +132 -0
  608. package/examples/jsm/postprocessing/ShaderPass.d.ts +11 -0
  609. package/examples/jsm/postprocessing/ShaderPass.js +135 -0
  610. package/examples/jsm/postprocessing/TAARenderPass.d.ts +8 -0
  611. package/examples/jsm/postprocessing/TAARenderPass.js +243 -0
  612. package/examples/jsm/postprocessing/TexturePass.d.ts +12 -0
  613. package/examples/jsm/postprocessing/TexturePass.js +131 -0
  614. package/examples/jsm/postprocessing/UnrealBloomPass.d.ts +26 -0
  615. package/examples/jsm/postprocessing/UnrealBloomPass.js +541 -0
  616. package/examples/jsm/renderers/CSS2DRenderer.d.ts +29 -0
  617. package/examples/jsm/renderers/CSS2DRenderer.js +352 -0
  618. package/examples/jsm/renderers/CSS3DRenderer.d.ts +26 -0
  619. package/examples/jsm/renderers/CSS3DRenderer.js +454 -0
  620. package/examples/jsm/renderers/Projector.d.ts +60 -0
  621. package/examples/jsm/renderers/Projector.js +1154 -0
  622. package/examples/jsm/renderers/SVGRenderer.d.ts +26 -0
  623. package/examples/jsm/renderers/SVGRenderer.js +799 -0
  624. package/examples/jsm/shaders/ACESFilmicToneMappingShader.d.ts +11 -0
  625. package/examples/jsm/shaders/ACESFilmicToneMappingShader.js +96 -0
  626. package/examples/jsm/shaders/AfterimageShader.d.ts +12 -0
  627. package/examples/jsm/shaders/AfterimageShader.js +63 -0
  628. package/examples/jsm/shaders/BasicShader.d.ts +6 -0
  629. package/examples/jsm/shaders/BasicShader.js +36 -0
  630. package/examples/jsm/shaders/BleachBypassShader.d.ts +10 -0
  631. package/examples/jsm/shaders/BleachBypassShader.js +68 -0
  632. package/examples/jsm/shaders/BlendShader.d.ts +13 -0
  633. package/examples/jsm/shaders/BlendShader.js +56 -0
  634. package/examples/jsm/shaders/BokehShader.d.ts +21 -0
  635. package/examples/jsm/shaders/BokehShader.js +151 -0
  636. package/examples/jsm/shaders/BokehShader2.d.ts +44 -0
  637. package/examples/jsm/shaders/BokehShader2.js +404 -0
  638. package/examples/jsm/shaders/BrightnessContrastShader.d.ts +12 -0
  639. package/examples/jsm/shaders/BrightnessContrastShader.js +62 -0
  640. package/examples/jsm/shaders/ColorCorrectionShader.d.ts +13 -0
  641. package/examples/jsm/shaders/ColorCorrectionShader.js +59 -0
  642. package/examples/jsm/shaders/ColorifyShader.d.ts +10 -0
  643. package/examples/jsm/shaders/ColorifyShader.js +57 -0
  644. package/examples/jsm/shaders/ConvolutionShader.d.ts +17 -0
  645. package/examples/jsm/shaders/ConvolutionShader.js +74 -0
  646. package/examples/jsm/shaders/CopyShader.d.ts +10 -0
  647. package/examples/jsm/shaders/CopyShader.js +52 -0
  648. package/examples/jsm/shaders/DOFMipMapShader.d.ts +13 -0
  649. package/examples/jsm/shaders/DOFMipMapShader.js +63 -0
  650. package/examples/jsm/shaders/DepthLimitedBlurShader.d.ts +28 -0
  651. package/examples/jsm/shaders/DepthLimitedBlurShader.js +183 -0
  652. package/examples/jsm/shaders/DigitalGlitch.d.ts +19 -0
  653. package/examples/jsm/shaders/DigitalGlitch.js +104 -0
  654. package/examples/jsm/shaders/DotScreenShader.d.ts +13 -0
  655. package/examples/jsm/shaders/DotScreenShader.js +75 -0
  656. package/examples/jsm/shaders/ExposureShader.d.ts +11 -0
  657. package/examples/jsm/shaders/ExposureShader.js +51 -0
  658. package/examples/jsm/shaders/FXAAShader.d.ts +11 -0
  659. package/examples/jsm/shaders/FXAAShader.js +298 -0
  660. package/examples/jsm/shaders/FilmShader.d.ts +12 -0
  661. package/examples/jsm/shaders/FilmShader.js +73 -0
  662. package/examples/jsm/shaders/FocusShader.d.ts +14 -0
  663. package/examples/jsm/shaders/FocusShader.js +94 -0
  664. package/examples/jsm/shaders/FreiChenShader.d.ts +11 -0
  665. package/examples/jsm/shaders/FreiChenShader.js +103 -0
  666. package/examples/jsm/shaders/GTAOShader.d.ts +59 -0
  667. package/examples/jsm/shaders/GTAOShader.js +434 -0
  668. package/examples/jsm/shaders/GammaCorrectionShader.d.ts +9 -0
  669. package/examples/jsm/shaders/GammaCorrectionShader.js +52 -0
  670. package/examples/jsm/shaders/HalftoneShader.d.ts +22 -0
  671. package/examples/jsm/shaders/HalftoneShader.js +332 -0
  672. package/examples/jsm/shaders/HorizontalBlurShader.d.ts +10 -0
  673. package/examples/jsm/shaders/HorizontalBlurShader.js +68 -0
  674. package/examples/jsm/shaders/HorizontalTiltShiftShader.d.ts +12 -0
  675. package/examples/jsm/shaders/HorizontalTiltShiftShader.js +70 -0
  676. package/examples/jsm/shaders/HueSaturationShader.d.ts +12 -0
  677. package/examples/jsm/shaders/HueSaturationShader.js +74 -0
  678. package/examples/jsm/shaders/KaleidoShader.d.ts +12 -0
  679. package/examples/jsm/shaders/KaleidoShader.js +65 -0
  680. package/examples/jsm/shaders/LuminosityHighPassShader.d.ts +15 -0
  681. package/examples/jsm/shaders/LuminosityHighPassShader.js +68 -0
  682. package/examples/jsm/shaders/LuminosityShader.d.ts +10 -0
  683. package/examples/jsm/shaders/LuminosityShader.js +54 -0
  684. package/examples/jsm/shaders/MirrorShader.d.ts +11 -0
  685. package/examples/jsm/shaders/MirrorShader.js +62 -0
  686. package/examples/jsm/shaders/NormalMapShader.d.ts +13 -0
  687. package/examples/jsm/shaders/NormalMapShader.js +60 -0
  688. package/examples/jsm/shaders/OutputShader.d.ts +11 -0
  689. package/examples/jsm/shaders/OutputShader.js +103 -0
  690. package/examples/jsm/shaders/PoissonDenoiseShader.d.ts +28 -0
  691. package/examples/jsm/shaders/PoissonDenoiseShader.js +239 -0
  692. package/examples/jsm/shaders/RGBShiftShader.d.ts +11 -0
  693. package/examples/jsm/shaders/RGBShiftShader.js +61 -0
  694. package/examples/jsm/shaders/SAOShader.d.ts +29 -0
  695. package/examples/jsm/shaders/SAOShader.js +201 -0
  696. package/examples/jsm/shaders/SMAAShader.d.ts +43 -0
  697. package/examples/jsm/shaders/SMAAShader.js +489 -0
  698. package/examples/jsm/shaders/SSAOShader.d.ts +49 -0
  699. package/examples/jsm/shaders/SSAOShader.js +331 -0
  700. package/examples/jsm/shaders/SSRShader.d.ts +62 -0
  701. package/examples/jsm/shaders/SSRShader.js +396 -0
  702. package/examples/jsm/shaders/SepiaShader.d.ts +10 -0
  703. package/examples/jsm/shaders/SepiaShader.js +57 -0
  704. package/examples/jsm/shaders/SobelOperatorShader.d.ts +11 -0
  705. package/examples/jsm/shaders/SobelOperatorShader.js +98 -0
  706. package/examples/jsm/shaders/SubsurfaceScatteringShader.d.ts +38 -0
  707. package/examples/jsm/shaders/SubsurfaceScatteringShader.js +95 -0
  708. package/examples/jsm/shaders/TechnicolorShader.d.ts +10 -0
  709. package/examples/jsm/shaders/TechnicolorShader.js +51 -0
  710. package/examples/jsm/shaders/ToonShader.d.ts +54 -0
  711. package/examples/jsm/shaders/ToonShader.js +349 -0
  712. package/examples/jsm/shaders/TriangleBlurShader.d.ts +11 -0
  713. package/examples/jsm/shaders/TriangleBlurShader.js +79 -0
  714. package/examples/jsm/shaders/UnpackDepthRGBAShader.d.ts +11 -0
  715. package/examples/jsm/shaders/UnpackDepthRGBAShader.js +60 -0
  716. package/examples/jsm/shaders/VelocityShader.d.ts +16 -0
  717. package/examples/jsm/shaders/VelocityShader.js +137 -0
  718. package/examples/jsm/shaders/VerticalBlurShader.d.ts +10 -0
  719. package/examples/jsm/shaders/VerticalBlurShader.js +66 -0
  720. package/examples/jsm/shaders/VerticalTiltShiftShader.d.ts +12 -0
  721. package/examples/jsm/shaders/VerticalTiltShiftShader.js +70 -0
  722. package/examples/jsm/shaders/VignetteShader.d.ts +11 -0
  723. package/examples/jsm/shaders/VignetteShader.js +56 -0
  724. package/examples/jsm/shaders/VolumeShader.d.ts +14 -0
  725. package/examples/jsm/shaders/VolumeShader.js +285 -0
  726. package/examples/jsm/shaders/WaterRefractionShader.d.ts +14 -0
  727. package/examples/jsm/shaders/WaterRefractionShader.js +106 -0
  728. package/examples/jsm/textures/FlakesTexture.d.ts +3 -0
  729. package/examples/jsm/textures/FlakesTexture.js +54 -0
  730. package/examples/jsm/transpiler/AST.d.ts +293 -0
  731. package/examples/jsm/transpiler/AST.js +694 -0
  732. package/examples/jsm/transpiler/GLSLDecoder.d.ts +7 -0
  733. package/examples/jsm/transpiler/GLSLDecoder.js +1718 -0
  734. package/examples/jsm/transpiler/Linker.js +327 -0
  735. package/examples/jsm/transpiler/ShaderToyDecoder.d.ts +3 -0
  736. package/examples/jsm/transpiler/ShaderToyDecoder.js +51 -0
  737. package/examples/jsm/transpiler/TSLEncoder.d.ts +51 -0
  738. package/examples/jsm/transpiler/TSLEncoder.js +1055 -0
  739. package/examples/jsm/transpiler/Transpiler.d.ts +5 -0
  740. package/examples/jsm/transpiler/Transpiler.js +67 -0
  741. package/examples/jsm/transpiler/TranspilerUtils.js +29 -0
  742. package/examples/jsm/transpiler/WGSLEncoder.js +868 -0
  743. package/examples/jsm/tsl/WebGLNodesHandler.d.ts +17 -0
  744. package/examples/jsm/tsl/WebGLNodesHandler.js +595 -0
  745. package/examples/jsm/tsl/display/AfterImageNode.d.ts +15 -0
  746. package/examples/jsm/tsl/display/AfterImageNode.js +256 -0
  747. package/examples/jsm/tsl/display/AnaglyphPassNode.d.ts +42 -0
  748. package/examples/jsm/tsl/display/AnaglyphPassNode.js +550 -0
  749. package/examples/jsm/tsl/display/BilateralBlurNode.d.ts +27 -0
  750. package/examples/jsm/tsl/display/BilateralBlurNode.js +377 -0
  751. package/examples/jsm/tsl/display/BleachBypass.d.ts +3 -0
  752. package/examples/jsm/tsl/display/BleachBypass.js +33 -0
  753. package/examples/jsm/tsl/display/BloomNode.d.ts +44 -0
  754. package/examples/jsm/tsl/display/BloomNode.js +599 -0
  755. package/examples/jsm/tsl/display/CRT.d.ts +22 -0
  756. package/examples/jsm/tsl/display/CRT.js +150 -0
  757. package/examples/jsm/tsl/display/ChromaticAberrationNode.d.ts +19 -0
  758. package/examples/jsm/tsl/display/ChromaticAberrationNode.js +174 -0
  759. package/examples/jsm/tsl/display/DenoiseNode.d.ts +26 -0
  760. package/examples/jsm/tsl/display/DenoiseNode.js +354 -0
  761. package/examples/jsm/tsl/display/DepthOfFieldNode.d.ts +28 -0
  762. package/examples/jsm/tsl/display/DepthOfFieldNode.js +572 -0
  763. package/examples/jsm/tsl/display/DotScreenNode.d.ts +17 -0
  764. package/examples/jsm/tsl/display/DotScreenNode.js +104 -0
  765. package/examples/jsm/tsl/display/FSR1Node.d.ts +17 -0
  766. package/examples/jsm/tsl/display/FSR1Node.js +481 -0
  767. package/examples/jsm/tsl/display/FXAANode.d.ts +11 -0
  768. package/examples/jsm/tsl/display/FXAANode.js +364 -0
  769. package/examples/jsm/tsl/display/FilmNode.d.ts +17 -0
  770. package/examples/jsm/tsl/display/FilmNode.js +101 -0
  771. package/examples/jsm/tsl/display/GTAONode.d.ts +37 -0
  772. package/examples/jsm/tsl/display/GTAONode.js +719 -0
  773. package/examples/jsm/tsl/display/GaussianBlurNode.d.ts +56 -0
  774. package/examples/jsm/tsl/display/GaussianBlurNode.js +412 -0
  775. package/examples/jsm/tsl/display/GodraysNode.d.ts +20 -0
  776. package/examples/jsm/tsl/display/GodraysNode.js +618 -0
  777. package/examples/jsm/tsl/display/ImportanceSampledEnvironment.d.ts +84 -0
  778. package/examples/jsm/tsl/display/ImportanceSampledEnvironment.js +560 -0
  779. package/examples/jsm/tsl/display/LensflareNode.d.ts +34 -0
  780. package/examples/jsm/tsl/display/LensflareNode.js +282 -0
  781. package/examples/jsm/tsl/display/Lut3DNode.d.ts +19 -0
  782. package/examples/jsm/tsl/display/Lut3DNode.js +109 -0
  783. package/examples/jsm/tsl/display/MotionBlur.d.ts +7 -0
  784. package/examples/jsm/tsl/display/MotionBlur.js +33 -0
  785. package/examples/jsm/tsl/display/OITPassNode.d.ts +64 -0
  786. package/examples/jsm/tsl/display/OITPassNode.js +352 -0
  787. package/examples/jsm/tsl/display/OutlineNode.d.ts +31 -0
  788. package/examples/jsm/tsl/display/OutlineNode.js +814 -0
  789. package/examples/jsm/tsl/display/ParallaxBarrierPassNode.d.ts +12 -0
  790. package/examples/jsm/tsl/display/ParallaxBarrierPassNode.js +90 -0
  791. package/examples/jsm/tsl/display/PixelationPassNode.d.ts +27 -0
  792. package/examples/jsm/tsl/display/PixelationPassNode.js +335 -0
  793. package/examples/jsm/tsl/display/RGBShiftNode.d.ts +15 -0
  794. package/examples/jsm/tsl/display/RGBShiftNode.js +96 -0
  795. package/examples/jsm/tsl/display/RecurrentDenoiseNode.d.ts +89 -0
  796. package/examples/jsm/tsl/display/RecurrentDenoiseNode.js +915 -0
  797. package/examples/jsm/tsl/display/RetroPassNode.d.ts +17 -0
  798. package/examples/jsm/tsl/display/RetroPassNode.js +263 -0
  799. package/examples/jsm/tsl/display/SMAANode.d.ts +17 -0
  800. package/examples/jsm/tsl/display/SMAANode.js +729 -0
  801. package/examples/jsm/tsl/display/SSAAPassNode.d.ts +18 -0
  802. package/examples/jsm/tsl/display/SSAAPassNode.js +344 -0
  803. package/examples/jsm/tsl/display/SSAONode.d.ts +116 -0
  804. package/examples/jsm/tsl/display/SSAONode.js +436 -0
  805. package/examples/jsm/tsl/display/SSGINode.d.ts +33 -0
  806. package/examples/jsm/tsl/display/SSGINode.js +691 -0
  807. package/examples/jsm/tsl/display/SSRNode.d.ts +315 -0
  808. package/examples/jsm/tsl/display/SSRNode.js +1358 -0
  809. package/examples/jsm/tsl/display/SSSNode.d.ts +20 -0
  810. package/examples/jsm/tsl/display/SSSNode.js +493 -0
  811. package/examples/jsm/tsl/display/Sepia.d.ts +3 -0
  812. package/examples/jsm/tsl/display/Sepia.js +24 -0
  813. package/examples/jsm/tsl/display/Shape.d.ts +3 -0
  814. package/examples/jsm/tsl/display/Shape.js +29 -0
  815. package/examples/jsm/tsl/display/SharpenNode.d.ts +22 -0
  816. package/examples/jsm/tsl/display/SharpenNode.js +284 -0
  817. package/examples/jsm/tsl/display/SobelOperatorNode.d.ts +11 -0
  818. package/examples/jsm/tsl/display/SobelOperatorNode.js +168 -0
  819. package/examples/jsm/tsl/display/StereoCompositePassNode.d.ts +13 -0
  820. package/examples/jsm/tsl/display/StereoCompositePassNode.js +190 -0
  821. package/examples/jsm/tsl/display/StereoPassNode.d.ts +13 -0
  822. package/examples/jsm/tsl/display/StereoPassNode.js +117 -0
  823. package/examples/jsm/tsl/display/TAAUNode.d.ts +31 -0
  824. package/examples/jsm/tsl/display/TAAUNode.js +732 -0
  825. package/examples/jsm/tsl/display/TRAANode.d.ts +26 -0
  826. package/examples/jsm/tsl/display/TRAANode.js +641 -0
  827. package/examples/jsm/tsl/display/TemporalReprojectNode.d.ts +64 -0
  828. package/examples/jsm/tsl/display/TemporalReprojectNode.js +1029 -0
  829. package/examples/jsm/tsl/display/TransitionNode.d.ts +31 -0
  830. package/examples/jsm/tsl/display/TransitionNode.js +141 -0
  831. package/examples/jsm/tsl/display/boxBlur.d.ts +10 -0
  832. package/examples/jsm/tsl/display/boxBlur.js +65 -0
  833. package/examples/jsm/tsl/display/depthAwareBlend.d.ts +15 -0
  834. package/examples/jsm/tsl/display/depthAwareBlend.js +80 -0
  835. package/examples/jsm/tsl/display/depthAwareBlur.d.ts +10 -0
  836. package/examples/jsm/tsl/display/depthAwareBlur.js +63 -0
  837. package/examples/jsm/tsl/display/hashBlur.d.ts +12 -0
  838. package/examples/jsm/tsl/display/hashBlur.js +55 -0
  839. package/examples/jsm/tsl/display/radialBlur.d.ts +12 -0
  840. package/examples/jsm/tsl/display/radialBlur.js +68 -0
  841. package/examples/jsm/tsl/lighting/ClusteredLightsNode.d.ts +54 -0
  842. package/examples/jsm/tsl/lighting/ClusteredLightsNode.js +633 -0
  843. package/examples/jsm/tsl/lighting/DynamicLightsNode.d.ts +21 -0
  844. package/examples/jsm/tsl/lighting/DynamicLightsNode.js +300 -0
  845. package/examples/jsm/tsl/lighting/LightProbeGridNode.js +136 -0
  846. package/examples/jsm/tsl/lighting/data/AmbientLightDataNode.d.ts +9 -0
  847. package/examples/jsm/tsl/lighting/data/AmbientLightDataNode.js +61 -0
  848. package/examples/jsm/tsl/lighting/data/DirectionalLightDataNode.d.ts +9 -0
  849. package/examples/jsm/tsl/lighting/data/DirectionalLightDataNode.js +111 -0
  850. package/examples/jsm/tsl/lighting/data/HemisphereLightDataNode.d.ts +9 -0
  851. package/examples/jsm/tsl/lighting/data/HemisphereLightDataNode.js +99 -0
  852. package/examples/jsm/tsl/lighting/data/PointLightDataNode.d.ts +9 -0
  853. package/examples/jsm/tsl/lighting/data/PointLightDataNode.js +134 -0
  854. package/examples/jsm/tsl/lighting/data/SpotLightDataNode.d.ts +9 -0
  855. package/examples/jsm/tsl/lighting/data/SpotLightDataNode.js +161 -0
  856. package/examples/jsm/tsl/math/Bayer.d.ts +5 -0
  857. package/examples/jsm/tsl/math/Bayer.js +84 -0
  858. package/examples/jsm/tsl/math/curlNoise.d.ts +38 -0
  859. package/examples/jsm/tsl/math/curlNoise.js +107 -0
  860. package/examples/jsm/tsl/math/voronoiNoise.d.ts +52 -0
  861. package/examples/jsm/tsl/math/voronoiNoise.js +112 -0
  862. package/examples/jsm/tsl/shadows/TileShadowNode.d.ts +14 -0
  863. package/examples/jsm/tsl/shadows/TileShadowNode.js +454 -0
  864. package/examples/jsm/tsl/shadows/TileShadowNodeHelper.d.ts +14 -0
  865. package/examples/jsm/tsl/shadows/TileShadowNodeHelper.js +212 -0
  866. package/examples/jsm/tsl/utils/GroundedSkybox.d.ts +17 -0
  867. package/examples/jsm/tsl/utils/GroundedSkybox.js +62 -0
  868. package/examples/jsm/tsl/utils/RNoise.d.ts +12 -0
  869. package/examples/jsm/tsl/utils/RNoise.js +51 -0
  870. package/examples/jsm/tsl/utils/Raymarching.d.ts +8 -0
  871. package/examples/jsm/tsl/utils/Raymarching.js +70 -0
  872. package/examples/jsm/tsl/utils/SoftParticles.d.ts +21 -0
  873. package/examples/jsm/tsl/utils/SoftParticles.js +60 -0
  874. package/examples/jsm/tsl/utils/SpecularHelpers.d.ts +20 -0
  875. package/examples/jsm/tsl/utils/SpecularHelpers.js +325 -0
  876. package/examples/jsm/tsl/utils/TAAUtils.js +195 -0
  877. package/examples/jsm/utils/BufferGeometryUtils.d.ts +37 -0
  878. package/examples/jsm/utils/BufferGeometryUtils.js +1501 -0
  879. package/examples/jsm/utils/CameraUtils.d.ts +9 -0
  880. package/examples/jsm/utils/CameraUtils.js +82 -0
  881. package/examples/jsm/utils/ColorUtils.d.ts +5 -0
  882. package/examples/jsm/utils/ColorUtils.js +76 -0
  883. package/examples/jsm/utils/GaussianSplatUtils.d.ts +68 -0
  884. package/examples/jsm/utils/GaussianSplatUtils.js +229 -0
  885. package/examples/jsm/utils/GeometryCompressionUtils.d.ts +21 -0
  886. package/examples/jsm/utils/GeometryCompressionUtils.js +547 -0
  887. package/examples/jsm/utils/GeometryUtils.d.ts +25 -0
  888. package/examples/jsm/utils/GeometryUtils.js +226 -0
  889. package/examples/jsm/utils/LDrawUtils.d.ts +5 -0
  890. package/examples/jsm/utils/LDrawUtils.js +211 -0
  891. package/examples/jsm/utils/SceneOptimizer.d.ts +18 -0
  892. package/examples/jsm/utils/SceneOptimizer.js +458 -0
  893. package/examples/jsm/utils/SceneUtils.d.ts +57 -0
  894. package/examples/jsm/utils/SceneUtils.js +363 -0
  895. package/examples/jsm/utils/ShadowMapViewer.d.ts +26 -0
  896. package/examples/jsm/utils/ShadowMapViewer.js +244 -0
  897. package/examples/jsm/utils/ShadowMapViewerGPU.d.ts +26 -0
  898. package/examples/jsm/utils/ShadowMapViewerGPU.js +233 -0
  899. package/examples/jsm/utils/SkeletonUtils.d.ts +32 -0
  900. package/examples/jsm/utils/SkeletonUtils.js +496 -0
  901. package/examples/jsm/utils/SortUtils.d.ts +7 -0
  902. package/examples/jsm/utils/SortUtils.js +175 -0
  903. package/examples/jsm/utils/UVsDebug.d.ts +3 -0
  904. package/examples/jsm/utils/UVsDebug.js +173 -0
  905. package/examples/jsm/utils/WebGLTextureUtils.d.ts +3 -0
  906. package/examples/jsm/utils/WebGLTextureUtils.js +115 -0
  907. package/examples/jsm/utils/WebGPUTextureUtils.d.ts +3 -0
  908. package/examples/jsm/utils/WebGPUTextureUtils.js +81 -0
  909. package/examples/jsm/utils/WorkerPool.d.ts +26 -0
  910. package/examples/jsm/utils/WorkerPool.js +167 -0
  911. package/examples/jsm/webxr/ARButton.d.ts +9 -0
  912. package/examples/jsm/webxr/ARButton.js +251 -0
  913. package/examples/jsm/webxr/OculusHandModel.d.ts +23 -0
  914. package/examples/jsm/webxr/OculusHandModel.js +194 -0
  915. package/examples/jsm/webxr/OculusHandPointerModel.d.ts +67 -0
  916. package/examples/jsm/webxr/OculusHandPointerModel.js +539 -0
  917. package/examples/jsm/webxr/Text2D.d.ts +3 -0
  918. package/examples/jsm/webxr/Text2D.js +52 -0
  919. package/examples/jsm/webxr/VRButton.d.ts +7 -0
  920. package/examples/jsm/webxr/VRButton.js +264 -0
  921. package/examples/jsm/webxr/WebGLXRFallback.d.ts +14 -0
  922. package/examples/jsm/webxr/WebGLXRFallback.js +75 -0
  923. package/examples/jsm/webxr/XRButton.d.ts +7 -0
  924. package/examples/jsm/webxr/XRButton.js +246 -0
  925. package/examples/jsm/webxr/XRControllerModelFactory.d.ts +23 -0
  926. package/examples/jsm/webxr/XRControllerModelFactory.js +415 -0
  927. package/examples/jsm/webxr/XREstimatedLight.d.ts +69 -0
  928. package/examples/jsm/webxr/XREstimatedLight.js +254 -0
  929. package/examples/jsm/webxr/XRHandMeshModel.d.ts +20 -0
  930. package/examples/jsm/webxr/XRHandMeshModel.js +177 -0
  931. package/examples/jsm/webxr/XRHandModelFactory.d.ts +32 -0
  932. package/examples/jsm/webxr/XRHandModelFactory.js +198 -0
  933. package/examples/jsm/webxr/XRHandPrimitiveModel.d.ts +24 -0
  934. package/examples/jsm/webxr/XRHandPrimitiveModel.js +147 -0
  935. package/examples/jsm/webxr/XRPlanes.d.ts +5 -0
  936. package/examples/jsm/webxr/XRPlanes.js +118 -0
  937. package/index.d.ts +6 -0
  938. package/package.json +68 -4
  939. package/src/Three.Core.d.ts +176 -0
  940. package/src/Three.Core.js +189 -0
  941. package/src/Three.Legacy.js +0 -0
  942. package/src/Three.TSL.d.ts +686 -0
  943. package/src/Three.TSL.js +684 -0
  944. package/src/Three.WebGPU.Nodes.d.ts +36 -0
  945. package/src/Three.WebGPU.Nodes.js +33 -0
  946. package/src/Three.WebGPU.d.ts +44 -0
  947. package/src/Three.WebGPU.js +43 -0
  948. package/src/Three.d.ts +47 -0
  949. package/src/Three.js +10 -0
  950. package/src/animation/AnimationAction.d.ts +286 -0
  951. package/src/animation/AnimationAction.js +946 -0
  952. package/src/animation/AnimationClip.d.ts +168 -0
  953. package/src/animation/AnimationClip.js +502 -0
  954. package/src/animation/AnimationMixer.d.ts +175 -0
  955. package/src/animation/AnimationMixer.js +860 -0
  956. package/src/animation/AnimationObjectGroup.d.ts +58 -0
  957. package/src/animation/AnimationObjectGroup.js +423 -0
  958. package/src/animation/AnimationUtils.d.ts +182 -0
  959. package/src/animation/AnimationUtils.js +521 -0
  960. package/src/animation/KeyframeTrack.d.ts +197 -0
  961. package/src/animation/KeyframeTrack.js +673 -0
  962. package/src/animation/PropertyBinding.d.ts +101 -0
  963. package/src/animation/PropertyBinding.js +794 -0
  964. package/src/animation/PropertyMixer.d.ts +75 -0
  965. package/src/animation/PropertyMixer.js +385 -0
  966. package/src/animation/tracks/BooleanKeyframeTrack.d.ts +18 -0
  967. package/src/animation/tracks/BooleanKeyframeTrack.js +55 -0
  968. package/src/animation/tracks/ColorKeyframeTrack.d.ts +17 -0
  969. package/src/animation/tracks/ColorKeyframeTrack.js +36 -0
  970. package/src/animation/tracks/NumberKeyframeTrack.d.ts +17 -0
  971. package/src/animation/tracks/NumberKeyframeTrack.js +36 -0
  972. package/src/animation/tracks/QuaternionKeyframeTrack.d.ts +17 -0
  973. package/src/animation/tracks/QuaternionKeyframeTrack.js +51 -0
  974. package/src/animation/tracks/StringKeyframeTrack.d.ts +18 -0
  975. package/src/animation/tracks/StringKeyframeTrack.js +55 -0
  976. package/src/animation/tracks/VectorKeyframeTrack.d.ts +17 -0
  977. package/src/animation/tracks/VectorKeyframeTrack.js +36 -0
  978. package/src/audio/Audio.d.ts +340 -0
  979. package/src/audio/Audio.js +778 -0
  980. package/src/audio/AudioAnalyser.d.ts +63 -0
  981. package/src/audio/AudioAnalyser.js +97 -0
  982. package/src/audio/AudioContext.d.ts +19 -0
  983. package/src/audio/AudioContext.js +40 -0
  984. package/src/audio/AudioListener.d.ts +75 -0
  985. package/src/audio/AudioListener.js +218 -0
  986. package/src/audio/PositionalAudio.d.ts +108 -0
  987. package/src/audio/PositionalAudio.js +253 -0
  988. package/src/cameras/ArrayCamera.d.ts +35 -0
  989. package/src/cameras/ArrayCamera.js +54 -0
  990. package/src/cameras/Camera.d.ts +42 -0
  991. package/src/cameras/Camera.js +160 -0
  992. package/src/cameras/CubeCamera.d.ts +89 -0
  993. package/src/cameras/CubeCamera.js +259 -0
  994. package/src/cameras/OrthographicCamera.d.ts +144 -0
  995. package/src/cameras/OrthographicCamera.js +245 -0
  996. package/src/cameras/PerspectiveCamera.d.ts +241 -0
  997. package/src/cameras/PerspectiveCamera.js +407 -0
  998. package/src/cameras/StereoCamera.d.ts +44 -0
  999. package/src/cameras/StereoCamera.js +149 -0
  1000. package/src/constants.d.ts +976 -0
  1001. package/src/constants.js +1782 -0
  1002. package/src/core/BufferAttribute.d.ts +650 -0
  1003. package/src/core/BufferAttribute.js +1057 -0
  1004. package/src/core/BufferGeometry.d.ts +442 -0
  1005. package/src/core/BufferGeometry.js +1480 -0
  1006. package/src/core/Clock.d.ts +73 -0
  1007. package/src/core/Clock.js +135 -0
  1008. package/src/core/EventDispatcher.d.ts +82 -0
  1009. package/src/core/EventDispatcher.js +131 -0
  1010. package/src/core/GLBufferAttribute.d.ts +138 -0
  1011. package/src/core/GLBufferAttribute.js +171 -0
  1012. package/src/core/InstancedBufferAttribute.d.ts +32 -0
  1013. package/src/core/InstancedBufferAttribute.js +68 -0
  1014. package/src/core/InstancedBufferGeometry.d.ts +37 -0
  1015. package/src/core/InstancedBufferGeometry.js +60 -0
  1016. package/src/core/InstancedInterleavedBuffer.d.ts +22 -0
  1017. package/src/core/InstancedInterleavedBuffer.js +74 -0
  1018. package/src/core/InterleavedBuffer.d.ts +162 -0
  1019. package/src/core/InterleavedBuffer.js +295 -0
  1020. package/src/core/InterleavedBufferAttribute.d.ts +201 -0
  1021. package/src/core/InterleavedBufferAttribute.js +549 -0
  1022. package/src/core/Layers.d.ts +72 -0
  1023. package/src/core/Layers.js +121 -0
  1024. package/src/core/Object3D.d.ts +725 -0
  1025. package/src/core/Object3D.js +1709 -0
  1026. package/src/core/Raycaster.d.ts +212 -0
  1027. package/src/core/Raycaster.js +266 -0
  1028. package/src/core/RenderTarget.d.ts +153 -0
  1029. package/src/core/RenderTarget.js +495 -0
  1030. package/src/core/RenderTarget3D.d.ts +9 -0
  1031. package/src/core/RenderTarget3D.js +52 -0
  1032. package/src/core/Timer.d.ts +77 -0
  1033. package/src/core/Timer.js +184 -0
  1034. package/src/core/Uniform.d.ts +38 -0
  1035. package/src/core/Uniform.js +46 -0
  1036. package/src/core/UniformsGroup.d.ts +39 -0
  1037. package/src/core/UniformsGroup.js +180 -0
  1038. package/src/extras/Controls.d.ts +59 -0
  1039. package/src/extras/Controls.js +112 -0
  1040. package/src/extras/DataUtils.d.ts +22 -0
  1041. package/src/extras/DataUtils.js +217 -0
  1042. package/src/extras/Earcut.d.ts +17 -0
  1043. package/src/extras/Earcut.js +28 -0
  1044. package/src/extras/ImageUtils.d.ts +33 -0
  1045. package/src/extras/ImageUtils.js +137 -0
  1046. package/src/extras/PMREMGenerator.d.ts +95 -0
  1047. package/src/extras/PMREMGenerator.js +1063 -0
  1048. package/src/extras/ShapeUtils.d.ts +25 -0
  1049. package/src/extras/ShapeUtils.js +114 -0
  1050. package/src/extras/TextureUtils.d.ts +42 -0
  1051. package/src/extras/TextureUtils.js +297 -0
  1052. package/src/extras/core/Curve.d.ts +162 -0
  1053. package/src/extras/core/Curve.js +517 -0
  1054. package/src/extras/core/CurvePath.d.ts +77 -0
  1055. package/src/extras/core/CurvePath.js +296 -0
  1056. package/src/extras/core/Interpolations.d.ts +36 -0
  1057. package/src/extras/core/Interpolations.js +111 -0
  1058. package/src/extras/core/Path.d.ts +166 -0
  1059. package/src/extras/core/Path.js +329 -0
  1060. package/src/extras/core/Shape.d.ts +86 -0
  1061. package/src/extras/core/Shape.js +165 -0
  1062. package/src/extras/core/ShapePath.d.ts +94 -0
  1063. package/src/extras/core/ShapePath.js +356 -0
  1064. package/src/extras/curves/ArcCurve.d.ts +41 -0
  1065. package/src/extras/curves/ArcCurve.js +39 -0
  1066. package/src/extras/curves/CatmullRomCurve3.d.ts +77 -0
  1067. package/src/extras/curves/CatmullRomCurve3.js +327 -0
  1068. package/src/extras/curves/CubicBezierCurve.d.ts +72 -0
  1069. package/src/extras/curves/CubicBezierCurve.js +145 -0
  1070. package/src/extras/curves/CubicBezierCurve3.d.ts +72 -0
  1071. package/src/extras/curves/CubicBezierCurve3.js +129 -0
  1072. package/src/extras/curves/Curves.d.ts +10 -0
  1073. package/src/extras/curves/Curves.js +10 -0
  1074. package/src/extras/curves/EllipseCurve.d.ts +115 -0
  1075. package/src/extras/curves/EllipseCurve.js +258 -0
  1076. package/src/extras/curves/LineCurve.d.ts +42 -0
  1077. package/src/extras/curves/LineCurve.js +128 -0
  1078. package/src/extras/curves/LineCurve3.d.ts +42 -0
  1079. package/src/extras/curves/LineCurve3.js +128 -0
  1080. package/src/extras/curves/QuadraticBezierCurve.d.ts +64 -0
  1081. package/src/extras/curves/QuadraticBezierCurve.js +133 -0
  1082. package/src/extras/curves/QuadraticBezierCurve3.d.ts +64 -0
  1083. package/src/extras/curves/QuadraticBezierCurve3.js +118 -0
  1084. package/src/extras/curves/SplineCurve.d.ts +52 -0
  1085. package/src/extras/curves/SplineCurve.js +145 -0
  1086. package/src/extras/lib/earcut.js +685 -0
  1087. package/src/geometries/BoxGeometry.d.ts +59 -0
  1088. package/src/geometries/BoxGeometry.js +219 -0
  1089. package/src/geometries/CapsuleGeometry.d.ts +56 -0
  1090. package/src/geometries/CapsuleGeometry.js +218 -0
  1091. package/src/geometries/CircleGeometry.d.ts +51 -0
  1092. package/src/geometries/CircleGeometry.js +142 -0
  1093. package/src/geometries/ConeGeometry.d.ts +64 -0
  1094. package/src/geometries/ConeGeometry.js +70 -0
  1095. package/src/geometries/CylinderGeometry.d.ts +64 -0
  1096. package/src/geometries/CylinderGeometry.js +333 -0
  1097. package/src/geometries/DodecahedronGeometry.d.ts +25 -0
  1098. package/src/geometries/DodecahedronGeometry.js +99 -0
  1099. package/src/geometries/EdgesGeometry.d.ts +41 -0
  1100. package/src/geometries/EdgesGeometry.js +180 -0
  1101. package/src/geometries/ExtrudeGeometry.d.ts +138 -0
  1102. package/src/geometries/ExtrudeGeometry.js +910 -0
  1103. package/src/geometries/Geometries.d.ts +21 -0
  1104. package/src/geometries/Geometries.js +21 -0
  1105. package/src/geometries/IcosahedronGeometry.d.ts +26 -0
  1106. package/src/geometries/IcosahedronGeometry.js +75 -0
  1107. package/src/geometries/LatheGeometry.d.ts +55 -0
  1108. package/src/geometries/LatheGeometry.js +230 -0
  1109. package/src/geometries/OctahedronGeometry.d.ts +25 -0
  1110. package/src/geometries/OctahedronGeometry.js +70 -0
  1111. package/src/geometries/PlaneGeometry.d.ts +48 -0
  1112. package/src/geometries/PlaneGeometry.js +133 -0
  1113. package/src/geometries/PolyhedronGeometry.d.ts +54 -0
  1114. package/src/geometries/PolyhedronGeometry.js +348 -0
  1115. package/src/geometries/RingGeometry.d.ts +59 -0
  1116. package/src/geometries/RingGeometry.js +165 -0
  1117. package/src/geometries/ShapeGeometry.d.ts +53 -0
  1118. package/src/geometries/ShapeGeometry.js +233 -0
  1119. package/src/geometries/SphereGeometry.d.ts +67 -0
  1120. package/src/geometries/SphereGeometry.js +180 -0
  1121. package/src/geometries/TetrahedronGeometry.d.ts +25 -0
  1122. package/src/geometries/TetrahedronGeometry.js +67 -0
  1123. package/src/geometries/TorusGeometry.d.ts +69 -0
  1124. package/src/geometries/TorusGeometry.js +161 -0
  1125. package/src/geometries/TorusKnotGeometry.d.ts +59 -0
  1126. package/src/geometries/TorusKnotGeometry.js +206 -0
  1127. package/src/geometries/TubeGeometry.d.ts +86 -0
  1128. package/src/geometries/TubeGeometry.js +253 -0
  1129. package/src/geometries/WireframeGeometry.d.ts +40 -0
  1130. package/src/geometries/WireframeGeometry.js +179 -0
  1131. package/src/helpers/ArrowHelper.d.ts +72 -0
  1132. package/src/helpers/ArrowHelper.js +173 -0
  1133. package/src/helpers/AxesHelper.d.ts +33 -0
  1134. package/src/helpers/AxesHelper.js +98 -0
  1135. package/src/helpers/Box3Helper.d.ts +28 -0
  1136. package/src/helpers/Box3Helper.js +85 -0
  1137. package/src/helpers/BoxHelper.d.ts +48 -0
  1138. package/src/helpers/BoxHelper.js +151 -0
  1139. package/src/helpers/CameraHelper.d.ts +54 -0
  1140. package/src/helpers/CameraHelper.js +347 -0
  1141. package/src/helpers/DirectionalLightHelper.d.ts +55 -0
  1142. package/src/helpers/DirectionalLightHelper.js +152 -0
  1143. package/src/helpers/GridHelper.d.ts +28 -0
  1144. package/src/helpers/GridHelper.js +84 -0
  1145. package/src/helpers/HemisphereLightHelper.d.ts +44 -0
  1146. package/src/helpers/HemisphereLightHelper.js +134 -0
  1147. package/src/helpers/PlaneHelper.d.ts +33 -0
  1148. package/src/helpers/PlaneHelper.js +98 -0
  1149. package/src/helpers/PointLightHelper.d.ts +43 -0
  1150. package/src/helpers/PointLightHelper.js +115 -0
  1151. package/src/helpers/PolarGridHelper.d.ts +37 -0
  1152. package/src/helpers/PolarGridHelper.js +128 -0
  1153. package/src/helpers/SkeletonHelper.d.ts +44 -0
  1154. package/src/helpers/SkeletonHelper.js +196 -0
  1155. package/src/helpers/SpotLightHelper.d.ts +45 -0
  1156. package/src/helpers/SpotLightHelper.js +156 -0
  1157. package/src/lights/AmbientLight.d.ts +28 -0
  1158. package/src/lights/AmbientLight.js +42 -0
  1159. package/src/lights/DirectionalLight.d.ts +68 -0
  1160. package/src/lights/DirectionalLight.js +113 -0
  1161. package/src/lights/DirectionalLightShadow.d.ts +18 -0
  1162. package/src/lights/DirectionalLightShadow.js +31 -0
  1163. package/src/lights/HemisphereLight.d.ts +41 -0
  1164. package/src/lights/HemisphereLight.js +76 -0
  1165. package/src/lights/Light.d.ts +39 -0
  1166. package/src/lights/Light.js +75 -0
  1167. package/src/lights/LightProbe.d.ts +46 -0
  1168. package/src/lights/LightProbe.js +75 -0
  1169. package/src/lights/LightShadow.d.ts +201 -0
  1170. package/src/lights/LightShadow.js +378 -0
  1171. package/src/lights/PointLight.d.ts +72 -0
  1172. package/src/lights/PointLight.js +131 -0
  1173. package/src/lights/PointLightShadow.d.ts +18 -0
  1174. package/src/lights/PointLightShadow.js +31 -0
  1175. package/src/lights/RectAreaLight.d.ts +62 -0
  1176. package/src/lights/RectAreaLight.js +115 -0
  1177. package/src/lights/SpotLight.d.ts +124 -0
  1178. package/src/lights/SpotLight.js +194 -0
  1179. package/src/lights/SpotLightShadow.d.ts +44 -0
  1180. package/src/lights/SpotLightShadow.js +98 -0
  1181. package/src/lights/webgpu/IESSpotLight.d.ts +18 -0
  1182. package/src/lights/webgpu/IESSpotLight.js +47 -0
  1183. package/src/lights/webgpu/ProjectorLight.d.ts +16 -0
  1184. package/src/lights/webgpu/ProjectorLight.js +46 -0
  1185. package/src/loaders/AnimationLoader.d.ts +9 -0
  1186. package/src/loaders/AnimationLoader.js +98 -0
  1187. package/src/loaders/AudioLoader.d.ts +6 -0
  1188. package/src/loaders/AudioLoader.js +108 -0
  1189. package/src/loaders/BufferGeometryLoader.d.ts +10 -0
  1190. package/src/loaders/BufferGeometryLoader.js +247 -0
  1191. package/src/loaders/Cache.d.ts +21 -0
  1192. package/src/loaders/Cache.js +115 -0
  1193. package/src/loaders/CompressedTextureLoader.d.ts +14 -0
  1194. package/src/loaders/CompressedTextureLoader.js +167 -0
  1195. package/src/loaders/CubeTextureLoader.d.ts +14 -0
  1196. package/src/loaders/CubeTextureLoader.js +103 -0
  1197. package/src/loaders/DataTextureLoader.d.ts +48 -0
  1198. package/src/loaders/DataTextureLoader.js +205 -0
  1199. package/src/loaders/FileLoader.d.ts +19 -0
  1200. package/src/loaders/FileLoader.js +367 -0
  1201. package/src/loaders/ImageBitmapLoader.d.ts +22 -0
  1202. package/src/loaders/ImageBitmapLoader.js +225 -0
  1203. package/src/loaders/ImageLoader.d.ts +17 -0
  1204. package/src/loaders/ImageLoader.js +168 -0
  1205. package/src/loaders/Loader.d.ts +51 -0
  1206. package/src/loaders/Loader.js +222 -0
  1207. package/src/loaders/LoaderUtils.d.ts +5 -0
  1208. package/src/loaders/LoaderUtils.js +59 -0
  1209. package/src/loaders/LoadingManager.d.ts +73 -0
  1210. package/src/loaders/LoadingManager.js +334 -0
  1211. package/src/loaders/MaterialLoader.d.ts +29 -0
  1212. package/src/loaders/MaterialLoader.js +209 -0
  1213. package/src/loaders/ObjectLoader.d.ts +35 -0
  1214. package/src/loaders/ObjectLoader.js +1309 -0
  1215. package/src/loaders/TextureLoader.d.ts +18 -0
  1216. package/src/loaders/TextureLoader.js +74 -0
  1217. package/src/loaders/nodes/NodeLoader.d.ts +21 -0
  1218. package/src/loaders/nodes/NodeLoader.js +194 -0
  1219. package/src/loaders/nodes/NodeMaterialLoader.d.ts +11 -0
  1220. package/src/loaders/nodes/NodeMaterialLoader.js +108 -0
  1221. package/src/loaders/nodes/NodeObjectLoader.d.ts +22 -0
  1222. package/src/loaders/nodes/NodeObjectLoader.js +169 -0
  1223. package/src/materials/LineBasicMaterial.d.ts +93 -0
  1224. package/src/materials/LineBasicMaterial.js +126 -0
  1225. package/src/materials/LineDashedMaterial.d.ts +56 -0
  1226. package/src/materials/LineDashedMaterial.js +86 -0
  1227. package/src/materials/Material.d.ts +663 -0
  1228. package/src/materials/Material.js +1235 -0
  1229. package/src/materials/Materials.d.ts +18 -0
  1230. package/src/materials/Materials.js +39 -0
  1231. package/src/materials/MeshBasicMaterial.d.ts +204 -0
  1232. package/src/materials/MeshBasicMaterial.js +274 -0
  1233. package/src/materials/MeshDepthMaterial.d.ts +119 -0
  1234. package/src/materials/MeshDepthMaterial.js +158 -0
  1235. package/src/materials/MeshDistanceMaterial.d.ts +102 -0
  1236. package/src/materials/MeshDistanceMaterial.js +129 -0
  1237. package/src/materials/MeshLambertMaterial.d.ts +331 -0
  1238. package/src/materials/MeshLambertMaterial.js +441 -0
  1239. package/src/materials/MeshMatcapMaterial.d.ts +199 -0
  1240. package/src/materials/MeshMatcapMaterial.js +269 -0
  1241. package/src/materials/MeshNormalMaterial.d.ts +134 -0
  1242. package/src/materials/MeshNormalMaterial.js +183 -0
  1243. package/src/materials/MeshPhongMaterial.d.ts +343 -0
  1244. package/src/materials/MeshPhongMaterial.js +460 -0
  1245. package/src/materials/MeshPhysicalMaterial.d.ts +353 -0
  1246. package/src/materials/MeshPhysicalMaterial.js +606 -0
  1247. package/src/materials/MeshStandardMaterial.d.ts +352 -0
  1248. package/src/materials/MeshStandardMaterial.js +466 -0
  1249. package/src/materials/MeshToonMaterial.d.ts +265 -0
  1250. package/src/materials/MeshToonMaterial.js +354 -0
  1251. package/src/materials/PointsMaterial.d.ts +113 -0
  1252. package/src/materials/PointsMaterial.js +146 -0
  1253. package/src/materials/RawShaderMaterial.d.ts +17 -0
  1254. package/src/materials/RawShaderMaterial.js +42 -0
  1255. package/src/materials/ShaderMaterial.d.ts +268 -0
  1256. package/src/materials/ShaderMaterial.js +499 -0
  1257. package/src/materials/ShadowMaterial.d.ts +61 -0
  1258. package/src/materials/ShadowMaterial.js +91 -0
  1259. package/src/materials/SpriteMaterial.d.ts +100 -0
  1260. package/src/materials/SpriteMaterial.js +143 -0
  1261. package/src/materials/nodes/Line2NodeMaterial.d.ts +102 -0
  1262. package/src/materials/nodes/Line2NodeMaterial.js +634 -0
  1263. package/src/materials/nodes/LineBasicNodeMaterial.d.ts +38 -0
  1264. package/src/materials/nodes/LineBasicNodeMaterial.js +46 -0
  1265. package/src/materials/nodes/LineDashedNodeMaterial.d.ts +88 -0
  1266. package/src/materials/nodes/LineDashedNodeMaterial.js +132 -0
  1267. package/src/materials/nodes/MeshBasicNodeMaterial.d.ts +55 -0
  1268. package/src/materials/nodes/MeshBasicNodeMaterial.js +134 -0
  1269. package/src/materials/nodes/MeshLambertNodeMaterial.d.ts +55 -0
  1270. package/src/materials/nodes/MeshLambertNodeMaterial.js +82 -0
  1271. package/src/materials/nodes/MeshMatcapNodeMaterial.d.ts +45 -0
  1272. package/src/materials/nodes/MeshMatcapNodeMaterial.js +77 -0
  1273. package/src/materials/nodes/MeshNormalNodeMaterial.d.ts +41 -0
  1274. package/src/materials/nodes/MeshNormalNodeMaterial.js +67 -0
  1275. package/src/materials/nodes/MeshPhongNodeMaterial.d.ts +77 -0
  1276. package/src/materials/nodes/MeshPhongNodeMaterial.js +132 -0
  1277. package/src/materials/nodes/MeshPhysicalNodeMaterial.d.ts +286 -0
  1278. package/src/materials/nodes/MeshPhysicalNodeMaterial.js +528 -0
  1279. package/src/materials/nodes/MeshSSSNodeMaterial.d.ts +110 -0
  1280. package/src/materials/nodes/MeshSSSNodeMaterial.js +162 -0
  1281. package/src/materials/nodes/MeshStandardNodeMaterial.d.ts +93 -0
  1282. package/src/materials/nodes/MeshStandardNodeMaterial.js +176 -0
  1283. package/src/materials/nodes/MeshToonNodeMaterial.d.ts +45 -0
  1284. package/src/materials/nodes/MeshToonNodeMaterial.js +66 -0
  1285. package/src/materials/nodes/NodeMaterial.d.ts +503 -0
  1286. package/src/materials/nodes/NodeMaterial.js +1380 -0
  1287. package/src/materials/nodes/NodeMaterials.d.ts +18 -0
  1288. package/src/materials/nodes/NodeMaterials.js +21 -0
  1289. package/src/materials/nodes/PointsNodeMaterial.d.ts +60 -0
  1290. package/src/materials/nodes/PointsNodeMaterial.js +212 -0
  1291. package/src/materials/nodes/ShadowNodeMaterial.d.ts +45 -0
  1292. package/src/materials/nodes/ShadowNodeMaterial.js +76 -0
  1293. package/src/materials/nodes/SpriteNodeMaterial.d.ts +74 -0
  1294. package/src/materials/nodes/SpriteNodeMaterial.js +176 -0
  1295. package/src/materials/nodes/VolumeNodeMaterial.d.ts +56 -0
  1296. package/src/materials/nodes/VolumeNodeMaterial.js +81 -0
  1297. package/src/materials/nodes/manager/NodeMaterialObserver.d.ts +58 -0
  1298. package/src/materials/nodes/manager/NodeMaterialObserver.js +973 -0
  1299. package/src/math/Box2.d.ts +48 -0
  1300. package/src/math/Box2.js +381 -0
  1301. package/src/math/Box3.d.ts +310 -0
  1302. package/src/math/Box3.js +810 -0
  1303. package/src/math/Color.d.ts +376 -0
  1304. package/src/math/Color.js +967 -0
  1305. package/src/math/ColorManagement.d.ts +59 -0
  1306. package/src/math/ColorManagement.js +215 -0
  1307. package/src/math/Cylindrical.d.ts +26 -0
  1308. package/src/math/Cylindrical.js +120 -0
  1309. package/src/math/Euler.d.ts +50 -0
  1310. package/src/math/Euler.js +449 -0
  1311. package/src/math/Frustum.d.ts +30 -0
  1312. package/src/math/Frustum.js +294 -0
  1313. package/src/math/FrustumArray.d.ts +86 -0
  1314. package/src/math/FrustumArray.js +228 -0
  1315. package/src/math/Interpolant.d.ts +113 -0
  1316. package/src/math/Interpolant.js +320 -0
  1317. package/src/math/Line3.d.ts +30 -0
  1318. package/src/math/Line3.js +337 -0
  1319. package/src/math/MathUtils.d.ts +153 -0
  1320. package/src/math/MathUtils.js +753 -0
  1321. package/src/math/Matrix2.d.ts +53 -0
  1322. package/src/math/Matrix2.js +128 -0
  1323. package/src/math/Matrix3.d.ts +193 -0
  1324. package/src/math/Matrix3.js +628 -0
  1325. package/src/math/Matrix4.d.ts +506 -0
  1326. package/src/math/Matrix4.js +1332 -0
  1327. package/src/math/Plane.d.ts +55 -0
  1328. package/src/math/Plane.js +397 -0
  1329. package/src/math/Quaternion.d.ts +189 -0
  1330. package/src/math/Quaternion.js +908 -0
  1331. package/src/math/Ray.d.ts +60 -0
  1332. package/src/math/Ray.js +705 -0
  1333. package/src/math/Sphere.d.ts +55 -0
  1334. package/src/math/Sphere.js +420 -0
  1335. package/src/math/Spherical.d.ts +27 -0
  1336. package/src/math/Spherical.js +147 -0
  1337. package/src/math/SphericalHarmonics3.d.ts +50 -0
  1338. package/src/math/SphericalHarmonics3.js +341 -0
  1339. package/src/math/Triangle.d.ts +110 -0
  1340. package/src/math/Triangle.js +537 -0
  1341. package/src/math/Vector2.d.ts +321 -0
  1342. package/src/math/Vector2.js +870 -0
  1343. package/src/math/Vector3.d.ts +301 -0
  1344. package/src/math/Vector3.js +1263 -0
  1345. package/src/math/Vector4.d.ts +241 -0
  1346. package/src/math/Vector4.js +1063 -0
  1347. package/src/math/interpolants/BezierInterpolant.d.ts +23 -0
  1348. package/src/math/interpolants/BezierInterpolant.js +119 -0
  1349. package/src/math/interpolants/CubicInterpolant.d.ts +22 -0
  1350. package/src/math/interpolants/CubicInterpolant.js +159 -0
  1351. package/src/math/interpolants/DiscreteInterpolant.d.ts +12 -0
  1352. package/src/math/interpolants/DiscreteInterpolant.js +34 -0
  1353. package/src/math/interpolants/LinearInterpolant.d.ts +11 -0
  1354. package/src/math/interpolants/LinearInterpolant.js +51 -0
  1355. package/src/math/interpolants/QuaternionLinearInterpolant.d.ts +11 -0
  1356. package/src/math/interpolants/QuaternionLinearInterpolant.js +48 -0
  1357. package/src/nodes/Nodes.d.ts +170 -0
  1358. package/src/nodes/Nodes.js +165 -0
  1359. package/src/nodes/TSL.d.ts +183 -0
  1360. package/src/nodes/TSL.js +183 -0
  1361. package/src/nodes/accessors/AccessorsUtils.d.ts +8 -0
  1362. package/src/nodes/accessors/AccessorsUtils.js +53 -0
  1363. package/src/nodes/accessors/Arrays.d.ts +22 -0
  1364. package/src/nodes/accessors/Arrays.js +68 -0
  1365. package/src/nodes/accessors/Batch.d.ts +25 -0
  1366. package/src/nodes/accessors/Batch.js +180 -0
  1367. package/src/nodes/accessors/Bitangent.d.ts +6 -0
  1368. package/src/nodes/accessors/Bitangent.js +82 -0
  1369. package/src/nodes/accessors/BufferAttributeNode.d.ts +247 -0
  1370. package/src/nodes/accessors/BufferAttributeNode.js +452 -0
  1371. package/src/nodes/accessors/BufferNode.d.ts +33 -0
  1372. package/src/nodes/accessors/BufferNode.js +138 -0
  1373. package/src/nodes/accessors/BuiltinNode.d.ts +13 -0
  1374. package/src/nodes/accessors/BuiltinNode.js +63 -0
  1375. package/src/nodes/accessors/Camera.d.ts +16 -0
  1376. package/src/nodes/accessors/Camera.js +403 -0
  1377. package/src/nodes/accessors/ClippingNode.d.ts +19 -0
  1378. package/src/nodes/accessors/ClippingNode.js +255 -0
  1379. package/src/nodes/accessors/CubeTextureNode.d.ts +38 -0
  1380. package/src/nodes/accessors/CubeTextureNode.js +215 -0
  1381. package/src/nodes/accessors/Instance.d.ts +32 -0
  1382. package/src/nodes/accessors/Instance.js +349 -0
  1383. package/src/nodes/accessors/Lights.d.ts +17 -0
  1384. package/src/nodes/accessors/Lights.js +139 -0
  1385. package/src/nodes/accessors/MaterialNode.d.ts +134 -0
  1386. package/src/nodes/accessors/MaterialNode.js +808 -0
  1387. package/src/nodes/accessors/MaterialProperties.d.ts +8 -0
  1388. package/src/nodes/accessors/MaterialProperties.js +57 -0
  1389. package/src/nodes/accessors/MaterialReferenceNode.d.ts +15 -0
  1390. package/src/nodes/accessors/MaterialReferenceNode.js +84 -0
  1391. package/src/nodes/accessors/ModelNode.d.ts +49 -0
  1392. package/src/nodes/accessors/ModelNode.js +260 -0
  1393. package/src/nodes/accessors/ModelViewProjectionNode.d.ts +3 -0
  1394. package/src/nodes/accessors/ModelViewProjectionNode.js +13 -0
  1395. package/src/nodes/accessors/Morph.d.ts +11 -0
  1396. package/src/nodes/accessors/Morph.js +297 -0
  1397. package/src/nodes/accessors/Normal.d.ts +36 -0
  1398. package/src/nodes/accessors/Normal.js +243 -0
  1399. package/src/nodes/accessors/Object3DNode.d.ts +42 -0
  1400. package/src/nodes/accessors/Object3DNode.js +268 -0
  1401. package/src/nodes/accessors/PointUVNode.d.ts +9 -0
  1402. package/src/nodes/accessors/PointUVNode.js +55 -0
  1403. package/src/nodes/accessors/Position.d.ts +11 -0
  1404. package/src/nodes/accessors/Position.js +126 -0
  1405. package/src/nodes/accessors/ReferenceBaseNode.d.ts +26 -0
  1406. package/src/nodes/accessors/ReferenceBaseNode.js +288 -0
  1407. package/src/nodes/accessors/ReferenceElementNode.d.ts +15 -0
  1408. package/src/nodes/accessors/ReferenceElementNode.js +72 -0
  1409. package/src/nodes/accessors/ReferenceNode.d.ts +37 -0
  1410. package/src/nodes/accessors/ReferenceNode.js +356 -0
  1411. package/src/nodes/accessors/ReflectVector.d.ts +7 -0
  1412. package/src/nodes/accessors/ReflectVector.js +36 -0
  1413. package/src/nodes/accessors/RendererReferenceNode.d.ts +14 -0
  1414. package/src/nodes/accessors/RendererReferenceNode.js +78 -0
  1415. package/src/nodes/accessors/SceneProperties.d.ts +5 -0
  1416. package/src/nodes/accessors/SceneProperties.js +47 -0
  1417. package/src/nodes/accessors/Skinning.d.ts +23 -0
  1418. package/src/nodes/accessors/Skinning.js +375 -0
  1419. package/src/nodes/accessors/StorageBufferNode.d.ts +82 -0
  1420. package/src/nodes/accessors/StorageBufferNode.js +405 -0
  1421. package/src/nodes/accessors/StorageTexture3DNode.d.ts +17 -0
  1422. package/src/nodes/accessors/StorageTexture3DNode.js +100 -0
  1423. package/src/nodes/accessors/StorageTextureNode.d.ts +47 -0
  1424. package/src/nodes/accessors/StorageTextureNode.js +331 -0
  1425. package/src/nodes/accessors/Tangent.d.ts +6 -0
  1426. package/src/nodes/accessors/Tangent.js +60 -0
  1427. package/src/nodes/accessors/TangentUtils.d.ts +21 -0
  1428. package/src/nodes/accessors/TangentUtils.js +46 -0
  1429. package/src/nodes/accessors/Texture3DNode.d.ts +29 -0
  1430. package/src/nodes/accessors/Texture3DNode.js +196 -0
  1431. package/src/nodes/accessors/TextureBicubic.d.ts +6 -0
  1432. package/src/nodes/accessors/TextureBicubic.js +92 -0
  1433. package/src/nodes/accessors/TextureNode.d.ts +104 -0
  1434. package/src/nodes/accessors/TextureNode.js +1056 -0
  1435. package/src/nodes/accessors/TextureSizeNode.d.ts +17 -0
  1436. package/src/nodes/accessors/TextureSizeNode.js +79 -0
  1437. package/src/nodes/accessors/UV.d.ts +3 -0
  1438. package/src/nodes/accessors/UV.js +11 -0
  1439. package/src/nodes/accessors/UniformArrayNode.d.ts +29 -0
  1440. package/src/nodes/accessors/UniformArrayNode.js +375 -0
  1441. package/src/nodes/accessors/UserDataNode.d.ts +14 -0
  1442. package/src/nodes/accessors/UserDataNode.js +76 -0
  1443. package/src/nodes/accessors/VelocityNode.d.ts +19 -0
  1444. package/src/nodes/accessors/VelocityNode.js +224 -0
  1445. package/src/nodes/accessors/VertexColorNode.d.ts +11 -0
  1446. package/src/nodes/accessors/VertexColorNode.js +109 -0
  1447. package/src/nodes/code/CodeNode.d.ts +22 -0
  1448. package/src/nodes/code/CodeNode.js +181 -0
  1449. package/src/nodes/code/ExpressionNode.d.ts +9 -0
  1450. package/src/nodes/code/ExpressionNode.js +68 -0
  1451. package/src/nodes/code/FunctionCallNode.d.ts +27 -0
  1452. package/src/nodes/code/FunctionCallNode.js +187 -0
  1453. package/src/nodes/code/FunctionNode.d.ts +40 -0
  1454. package/src/nodes/code/FunctionNode.js +178 -0
  1455. package/src/nodes/core/ArrayNode.d.ts +33 -0
  1456. package/src/nodes/core/ArrayNode.js +174 -0
  1457. package/src/nodes/core/AssignNode.d.ts +15 -0
  1458. package/src/nodes/core/AssignNode.js +202 -0
  1459. package/src/nodes/core/AttributeNode.d.ts +21 -0
  1460. package/src/nodes/core/AttributeNode.js +168 -0
  1461. package/src/nodes/core/BypassNode.d.ts +17 -0
  1462. package/src/nodes/core/BypassNode.js +93 -0
  1463. package/src/nodes/core/ConstNode.d.ts +16 -0
  1464. package/src/nodes/core/ConstNode.js +67 -0
  1465. package/src/nodes/core/ContextNode.d.ts +65 -0
  1466. package/src/nodes/core/ContextNode.js +336 -0
  1467. package/src/nodes/core/IndexNode.d.ts +33 -0
  1468. package/src/nodes/core/IndexNode.js +230 -0
  1469. package/src/nodes/core/InputNode.d.ts +23 -0
  1470. package/src/nodes/core/InputNode.js +136 -0
  1471. package/src/nodes/core/InspectorNode.d.ts +15 -0
  1472. package/src/nodes/core/InspectorNode.js +128 -0
  1473. package/src/nodes/core/IsolateNode.d.ts +31 -0
  1474. package/src/nodes/core/IsolateNode.js +133 -0
  1475. package/src/nodes/core/LightingModel.d.ts +33 -0
  1476. package/src/nodes/core/LightingModel.js +77 -0
  1477. package/src/nodes/core/MRTNode.d.ts +38 -0
  1478. package/src/nodes/core/MRTNode.js +243 -0
  1479. package/src/nodes/core/Node.d.ts +622 -0
  1480. package/src/nodes/core/Node.js +1220 -0
  1481. package/src/nodes/core/NodeAttribute.d.ts +47 -0
  1482. package/src/nodes/core/NodeAttribute.js +53 -0
  1483. package/src/nodes/core/NodeBuilder.d.ts +25 -0
  1484. package/src/nodes/core/NodeBuilder.js +3476 -0
  1485. package/src/nodes/core/NodeCache.d.ts +50 -0
  1486. package/src/nodes/core/NodeCache.js +75 -0
  1487. package/src/nodes/core/NodeCode.d.ts +4 -0
  1488. package/src/nodes/core/NodeCode.js +46 -0
  1489. package/src/nodes/core/NodeError.d.ts +9 -0
  1490. package/src/nodes/core/NodeError.js +28 -0
  1491. package/src/nodes/core/NodeFrame.d.ts +36 -0
  1492. package/src/nodes/core/NodeFrame.js +322 -0
  1493. package/src/nodes/core/NodeFunction.d.ts +13 -0
  1494. package/src/nodes/core/NodeFunction.js +69 -0
  1495. package/src/nodes/core/NodeFunctionInput.d.ts +7 -0
  1496. package/src/nodes/core/NodeFunctionInput.js +61 -0
  1497. package/src/nodes/core/NodeParser.d.ts +18 -0
  1498. package/src/nodes/core/NodeParser.js +23 -0
  1499. package/src/nodes/core/NodeUniform.d.ts +66 -0
  1500. package/src/nodes/core/NodeUniform.js +91 -0
  1501. package/src/nodes/core/NodeUtils.d.ts +26 -0
  1502. package/src/nodes/core/NodeUtils.js +496 -0
  1503. package/src/nodes/core/NodeVar.d.ts +51 -0
  1504. package/src/nodes/core/NodeVar.js +60 -0
  1505. package/src/nodes/core/NodeVarying.d.ts +59 -0
  1506. package/src/nodes/core/NodeVarying.js +63 -0
  1507. package/src/nodes/core/OutputStructNode.d.ts +11 -0
  1508. package/src/nodes/core/OutputStructNode.js +105 -0
  1509. package/src/nodes/core/OverrideContextNode.d.ts +92 -0
  1510. package/src/nodes/core/OverrideContextNode.js +153 -0
  1511. package/src/nodes/core/ParameterNode.d.ts +18 -0
  1512. package/src/nodes/core/ParameterNode.js +94 -0
  1513. package/src/nodes/core/PropertyNode.d.ts +66 -0
  1514. package/src/nodes/core/PropertyNode.js +421 -0
  1515. package/src/nodes/core/StackNode.d.ts +25 -0
  1516. package/src/nodes/core/StackNode.js +447 -0
  1517. package/src/nodes/core/StackTrace.d.ts +9 -0
  1518. package/src/nodes/core/StackTrace.js +139 -0
  1519. package/src/nodes/core/StructNode.d.ts +37 -0
  1520. package/src/nodes/core/StructNode.js +133 -0
  1521. package/src/nodes/core/StructType.d.ts +10 -0
  1522. package/src/nodes/core/StructType.js +13 -0
  1523. package/src/nodes/core/StructTypeNode.d.ts +57 -0
  1524. package/src/nodes/core/StructTypeNode.js +148 -0
  1525. package/src/nodes/core/SubBuildNode.d.ts +14 -0
  1526. package/src/nodes/core/SubBuildNode.js +89 -0
  1527. package/src/nodes/core/TempNode.d.ts +16 -0
  1528. package/src/nodes/core/TempNode.js +88 -0
  1529. package/src/nodes/core/UniformGroupNode.d.ts +22 -0
  1530. package/src/nodes/core/UniformGroupNode.js +168 -0
  1531. package/src/nodes/core/UniformNode.d.ts +162 -0
  1532. package/src/nodes/core/UniformNode.js +273 -0
  1533. package/src/nodes/core/VarNode.d.ts +45 -0
  1534. package/src/nodes/core/VarNode.js +374 -0
  1535. package/src/nodes/core/VaryingNode.d.ts +36 -0
  1536. package/src/nodes/core/VaryingNode.js +220 -0
  1537. package/src/nodes/core/constants.d.ts +72 -0
  1538. package/src/nodes/core/constants.js +68 -0
  1539. package/src/nodes/display/BlendModes.d.ts +76 -0
  1540. package/src/nodes/display/BlendModes.js +131 -0
  1541. package/src/nodes/display/BumpMapNode.d.ts +16 -0
  1542. package/src/nodes/display/BumpMapNode.js +122 -0
  1543. package/src/nodes/display/ColorAdjustment.d.ts +54 -0
  1544. package/src/nodes/display/ColorAdjustment.js +159 -0
  1545. package/src/nodes/display/ColorSpaceFunctions.d.ts +5 -0
  1546. package/src/nodes/display/ColorSpaceFunctions.js +54 -0
  1547. package/src/nodes/display/ColorSpaceNode.d.ts +54 -0
  1548. package/src/nodes/display/ColorSpaceNode.js +164 -0
  1549. package/src/nodes/display/FrontFacingNode.d.ts +71 -0
  1550. package/src/nodes/display/FrontFacingNode.js +131 -0
  1551. package/src/nodes/display/NormalMapNode.d.ts +18 -0
  1552. package/src/nodes/display/NormalMapNode.js +153 -0
  1553. package/src/nodes/display/PassNode.d.ts +124 -0
  1554. package/src/nodes/display/PassNode.js +1108 -0
  1555. package/src/nodes/display/PremultiplyAlphaFunctions.d.ts +37 -0
  1556. package/src/nodes/display/PremultiplyAlphaFunctions.js +39 -0
  1557. package/src/nodes/display/RenderOutputNode.d.ts +29 -0
  1558. package/src/nodes/display/RenderOutputNode.js +159 -0
  1559. package/src/nodes/display/ScreenNode.d.ts +44 -0
  1560. package/src/nodes/display/ScreenNode.js +249 -0
  1561. package/src/nodes/display/ToneMappingFunctions.d.ts +13 -0
  1562. package/src/nodes/display/ToneMappingFunctions.js +242 -0
  1563. package/src/nodes/display/ToneMappingNode.d.ts +29 -0
  1564. package/src/nodes/display/ToneMappingNode.js +147 -0
  1565. package/src/nodes/display/ToonOutlinePassNode.d.ts +23 -0
  1566. package/src/nodes/display/ToonOutlinePassNode.js +191 -0
  1567. package/src/nodes/display/ViewportDepthNode.d.ts +41 -0
  1568. package/src/nodes/display/ViewportDepthNode.js +342 -0
  1569. package/src/nodes/display/ViewportDepthTextureNode.d.ts +14 -0
  1570. package/src/nodes/display/ViewportDepthTextureNode.js +63 -0
  1571. package/src/nodes/display/ViewportSharedTextureNode.d.ts +16 -0
  1572. package/src/nodes/display/ViewportSharedTextureNode.js +73 -0
  1573. package/src/nodes/display/ViewportTextureNode.d.ts +33 -0
  1574. package/src/nodes/display/ViewportTextureNode.js +256 -0
  1575. package/src/nodes/fog/Fog.d.ts +27 -0
  1576. package/src/nodes/fog/Fog.js +97 -0
  1577. package/src/nodes/functions/BSDF/BRDF_GGX.d.ts +15 -0
  1578. package/src/nodes/functions/BSDF/BRDF_GGX.js +55 -0
  1579. package/src/nodes/functions/BSDF/BRDF_Lambert.d.ts +6 -0
  1580. package/src/nodes/functions/BSDF/BRDF_Lambert.js +9 -0
  1581. package/src/nodes/functions/BSDF/BRDF_Sheen.d.ts +6 -0
  1582. package/src/nodes/functions/BSDF/BRDF_Sheen.js +57 -0
  1583. package/src/nodes/functions/BSDF/DFGLUT.d.ts +13 -0
  1584. package/src/nodes/functions/BSDF/DFGLUT.js +57 -0
  1585. package/src/nodes/functions/BSDF/D_GGX.d.ts +9 -0
  1586. package/src/nodes/functions/BSDF/D_GGX.js +23 -0
  1587. package/src/nodes/functions/BSDF/D_GGX_Anisotropic.d.ts +9 -0
  1588. package/src/nodes/functions/BSDF/D_GGX_Anisotropic.js +28 -0
  1589. package/src/nodes/functions/BSDF/EnvironmentBRDF.d.ts +8 -0
  1590. package/src/nodes/functions/BSDF/EnvironmentBRDF.js +13 -0
  1591. package/src/nodes/functions/BSDF/F_Schlick.d.ts +6 -0
  1592. package/src/nodes/functions/BSDF/F_Schlick.js +16 -0
  1593. package/src/nodes/functions/BSDF/LTC.d.ts +13 -0
  1594. package/src/nodes/functions/BSDF/LTC.js +175 -0
  1595. package/src/nodes/functions/BSDF/Schlick_to_F0.d.ts +9 -0
  1596. package/src/nodes/functions/BSDF/Schlick_to_F0.js +21 -0
  1597. package/src/nodes/functions/BSDF/V_GGX_SmithCorrelated.d.ts +10 -0
  1598. package/src/nodes/functions/BSDF/V_GGX_SmithCorrelated.js +26 -0
  1599. package/src/nodes/functions/BSDF/V_GGX_SmithCorrelated_Anisotropic.d.ts +15 -0
  1600. package/src/nodes/functions/BSDF/V_GGX_SmithCorrelated_Anisotropic.js +29 -0
  1601. package/src/nodes/functions/BasicLightingModel.d.ts +7 -0
  1602. package/src/nodes/functions/BasicLightingModel.js +100 -0
  1603. package/src/nodes/functions/PhongLightingModel.d.ts +7 -0
  1604. package/src/nodes/functions/PhongLightingModel.js +99 -0
  1605. package/src/nodes/functions/PhysicalLightingModel.d.ts +40 -0
  1606. package/src/nodes/functions/PhysicalLightingModel.js +936 -0
  1607. package/src/nodes/functions/ShadowMaskModel.d.ts +8 -0
  1608. package/src/nodes/functions/ShadowMaskModel.js +58 -0
  1609. package/src/nodes/functions/ToonLightingModel.d.ts +4 -0
  1610. package/src/nodes/functions/ToonLightingModel.js +70 -0
  1611. package/src/nodes/functions/VolumetricLightingModel.d.ts +6 -0
  1612. package/src/nodes/functions/VolumetricLightingModel.js +216 -0
  1613. package/src/nodes/functions/material/getAlphaHashThreshold.d.ts +5 -0
  1614. package/src/nodes/functions/material/getAlphaHashThreshold.js +68 -0
  1615. package/src/nodes/functions/material/getGeometryRoughness.d.ts +5 -0
  1616. package/src/nodes/functions/material/getGeometryRoughness.js +19 -0
  1617. package/src/nodes/functions/material/getParallaxCorrectNormal.d.ts +9 -0
  1618. package/src/nodes/functions/material/getParallaxCorrectNormal.js +37 -0
  1619. package/src/nodes/functions/material/getRoughness.d.ts +6 -0
  1620. package/src/nodes/functions/material/getRoughness.js +18 -0
  1621. package/src/nodes/functions/material/getShIrradianceAt.d.ts +5 -0
  1622. package/src/nodes/functions/material/getShIrradianceAt.js +28 -0
  1623. package/src/nodes/geometry/RangeNode.d.ts +62 -0
  1624. package/src/nodes/geometry/RangeNode.js +210 -0
  1625. package/src/nodes/gpgpu/AtomicFunctionNode.d.ts +91 -0
  1626. package/src/nodes/gpgpu/AtomicFunctionNode.js +325 -0
  1627. package/src/nodes/gpgpu/BarrierNode.d.ts +15 -0
  1628. package/src/nodes/gpgpu/BarrierNode.js +107 -0
  1629. package/src/nodes/gpgpu/ComputeBuiltinNode.d.ts +22 -0
  1630. package/src/nodes/gpgpu/ComputeBuiltinNode.js +227 -0
  1631. package/src/nodes/gpgpu/ComputeNode.d.ts +50 -0
  1632. package/src/nodes/gpgpu/ComputeNode.js +313 -0
  1633. package/src/nodes/gpgpu/SubgroupFunctionNode.d.ts +99 -0
  1634. package/src/nodes/gpgpu/SubgroupFunctionNode.js +583 -0
  1635. package/src/nodes/gpgpu/WorkgroupInfoNode.d.ts +24 -0
  1636. package/src/nodes/gpgpu/WorkgroupInfoNode.js +272 -0
  1637. package/src/nodes/lighting/AONode.d.ts +8 -0
  1638. package/src/nodes/lighting/AONode.js +45 -0
  1639. package/src/nodes/lighting/AmbientLightNode.d.ts +8 -0
  1640. package/src/nodes/lighting/AmbientLightNode.js +35 -0
  1641. package/src/nodes/lighting/AnalyticLightNode.d.ts +32 -0
  1642. package/src/nodes/lighting/AnalyticLightNode.js +309 -0
  1643. package/src/nodes/lighting/BasicEnvironmentNode.d.ts +10 -0
  1644. package/src/nodes/lighting/BasicEnvironmentNode.js +49 -0
  1645. package/src/nodes/lighting/BasicLightMapNode.d.ts +8 -0
  1646. package/src/nodes/lighting/BasicLightMapNode.js +49 -0
  1647. package/src/nodes/lighting/DirectionalLightNode.d.ts +8 -0
  1648. package/src/nodes/lighting/DirectionalLightNode.js +39 -0
  1649. package/src/nodes/lighting/EnvironmentNode.d.ts +8 -0
  1650. package/src/nodes/lighting/EnvironmentNode.js +214 -0
  1651. package/src/nodes/lighting/HemisphereLightNode.d.ts +14 -0
  1652. package/src/nodes/lighting/HemisphereLightNode.js +87 -0
  1653. package/src/nodes/lighting/IESSpotLightNode.d.ts +5 -0
  1654. package/src/nodes/lighting/IESSpotLightNode.js +87 -0
  1655. package/src/nodes/lighting/IrradianceNode.d.ts +8 -0
  1656. package/src/nodes/lighting/IrradianceNode.js +44 -0
  1657. package/src/nodes/lighting/LightProbeNode.d.ts +11 -0
  1658. package/src/nodes/lighting/LightProbeNode.js +73 -0
  1659. package/src/nodes/lighting/LightUtils.d.ts +8 -0
  1660. package/src/nodes/lighting/LightUtils.js +25 -0
  1661. package/src/nodes/lighting/LightingContextNode.d.ts +41 -0
  1662. package/src/nodes/lighting/LightingContextNode.js +123 -0
  1663. package/src/nodes/lighting/LightingNode.d.ts +7 -0
  1664. package/src/nodes/lighting/LightingNode.js +36 -0
  1665. package/src/nodes/lighting/LightsNode.d.ts +48 -0
  1666. package/src/nodes/lighting/LightsNode.js +501 -0
  1667. package/src/nodes/lighting/PointLightNode.d.ts +23 -0
  1668. package/src/nodes/lighting/PointLightNode.js +102 -0
  1669. package/src/nodes/lighting/PointShadowNode.d.ts +25 -0
  1670. package/src/nodes/lighting/PointShadowNode.js +330 -0
  1671. package/src/nodes/lighting/ProjectorLightNode.d.ts +5 -0
  1672. package/src/nodes/lighting/ProjectorLightNode.js +91 -0
  1673. package/src/nodes/lighting/RectAreaLightNode.d.ts +21 -0
  1674. package/src/nodes/lighting/RectAreaLightNode.js +133 -0
  1675. package/src/nodes/lighting/ShadowBaseNode.d.ts +47 -0
  1676. package/src/nodes/lighting/ShadowBaseNode.js +238 -0
  1677. package/src/nodes/lighting/ShadowFilterNode.d.ts +17 -0
  1678. package/src/nodes/lighting/ShadowFilterNode.js +129 -0
  1679. package/src/nodes/lighting/ShadowNode.d.ts +11 -0
  1680. package/src/nodes/lighting/ShadowNode.js +841 -0
  1681. package/src/nodes/lighting/SpotLightNode.d.ts +22 -0
  1682. package/src/nodes/lighting/SpotLightNode.js +168 -0
  1683. package/src/nodes/materialx/DISCLAIMER.md +199 -0
  1684. package/src/nodes/materialx/MaterialXColor.d.ts +5 -0
  1685. package/src/nodes/materialx/MaterialXColor.js +124 -0
  1686. package/src/nodes/materialx/MaterialXColorTransform.d.ts +3 -0
  1687. package/src/nodes/materialx/MaterialXColorTransform.js +20 -0
  1688. package/src/nodes/materialx/MaterialXCore.d.ts +5 -0
  1689. package/src/nodes/materialx/MaterialXCore.js +37 -0
  1690. package/src/nodes/materialx/MaterialXNodes.d.ts +206 -0
  1691. package/src/nodes/materialx/MaterialXNodes.js +189 -0
  1692. package/src/nodes/materialx/MaterialXNoise.d.ts +415 -0
  1693. package/src/nodes/materialx/MaterialXNoise.js +1720 -0
  1694. package/src/nodes/math/BitcastNode.d.ts +24 -0
  1695. package/src/nodes/math/BitcastNode.js +156 -0
  1696. package/src/nodes/math/BitcountNode.d.ts +23 -0
  1697. package/src/nodes/math/BitcountNode.js +453 -0
  1698. package/src/nodes/math/ConditionalNode.d.ts +51 -0
  1699. package/src/nodes/math/ConditionalNode.js +245 -0
  1700. package/src/nodes/math/Hash.d.ts +3 -0
  1701. package/src/nodes/math/Hash.js +21 -0
  1702. package/src/nodes/math/MathNode.d.ts +895 -0
  1703. package/src/nodes/math/MathNode.js +1230 -0
  1704. package/src/nodes/math/MathUtils.d.ts +10 -0
  1705. package/src/nodes/math/MathUtils.js +65 -0
  1706. package/src/nodes/math/OperatorNode.d.ts +709 -0
  1707. package/src/nodes/math/OperatorNode.js +752 -0
  1708. package/src/nodes/math/PackFloatNode.d.ts +24 -0
  1709. package/src/nodes/math/PackFloatNode.js +126 -0
  1710. package/src/nodes/math/Packed4x8IntegerNode.d.ts +49 -0
  1711. package/src/nodes/math/Packed4x8IntegerNode.js +433 -0
  1712. package/src/nodes/math/TriNoise3D.d.ts +11 -0
  1713. package/src/nodes/math/TriNoise3D.js +71 -0
  1714. package/src/nodes/math/UnpackFloatNode.d.ts +21 -0
  1715. package/src/nodes/math/UnpackFloatNode.js +124 -0
  1716. package/src/nodes/parsers/GLSLNodeFunction.d.ts +9 -0
  1717. package/src/nodes/parsers/GLSLNodeFunction.js +168 -0
  1718. package/src/nodes/parsers/GLSLNodeParser.d.ts +8 -0
  1719. package/src/nodes/parsers/GLSLNodeParser.js +25 -0
  1720. package/src/nodes/pmrem/PMREMNode.d.ts +21 -0
  1721. package/src/nodes/pmrem/PMREMNode.js +428 -0
  1722. package/src/nodes/pmrem/PMREMUtils.d.ts +21 -0
  1723. package/src/nodes/pmrem/PMREMUtils.js +354 -0
  1724. package/src/nodes/procedural/Checker.d.ts +3 -0
  1725. package/src/nodes/procedural/Checker.js +22 -0
  1726. package/src/nodes/shapes/Shapes.d.ts +3 -0
  1727. package/src/nodes/shapes/Shapes.js +33 -0
  1728. package/src/nodes/tsl/TSLBase.d.ts +30 -0
  1729. package/src/nodes/tsl/TSLBase.js +36 -0
  1730. package/src/nodes/tsl/TSLCore.d.ts +2420 -0
  1731. package/src/nodes/tsl/TSLCore.js +1265 -0
  1732. package/src/nodes/utils/ArrayElementNode.d.ts +15 -0
  1733. package/src/nodes/utils/ArrayElementNode.js +90 -0
  1734. package/src/nodes/utils/ConvertNode.d.ts +14 -0
  1735. package/src/nodes/utils/ConvertNode.js +100 -0
  1736. package/src/nodes/utils/CubeMapNode.d.ts +12 -0
  1737. package/src/nodes/utils/CubeMapNode.js +237 -0
  1738. package/src/nodes/utils/DebugNode.d.ts +22 -0
  1739. package/src/nodes/utils/DebugNode.js +83 -0
  1740. package/src/nodes/utils/Discard.d.ts +10 -0
  1741. package/src/nodes/utils/Discard.js +24 -0
  1742. package/src/nodes/utils/EquirectUV.d.ts +33 -0
  1743. package/src/nodes/utils/EquirectUV.js +52 -0
  1744. package/src/nodes/utils/EventNode.d.ts +41 -0
  1745. package/src/nodes/utils/EventNode.js +223 -0
  1746. package/src/nodes/utils/FlipNode.d.ts +11 -0
  1747. package/src/nodes/utils/FlipNode.js +106 -0
  1748. package/src/nodes/utils/FunctionOverloadingNode.d.ts +12 -0
  1749. package/src/nodes/utils/FunctionOverloadingNode.js +170 -0
  1750. package/src/nodes/utils/JoinNode.d.ts +14 -0
  1751. package/src/nodes/utils/JoinNode.js +117 -0
  1752. package/src/nodes/utils/LoopNode.d.ts +43 -0
  1753. package/src/nodes/utils/LoopNode.js +390 -0
  1754. package/src/nodes/utils/MatcapUV.d.ts +3 -0
  1755. package/src/nodes/utils/MatcapUV.js +22 -0
  1756. package/src/nodes/utils/MaxMipLevelNode.d.ts +13 -0
  1757. package/src/nodes/utils/MaxMipLevelNode.js +103 -0
  1758. package/src/nodes/utils/MemberNode.d.ts +11 -0
  1759. package/src/nodes/utils/MemberNode.js +120 -0
  1760. package/src/nodes/utils/Oscillators.d.ts +6 -0
  1761. package/src/nodes/utils/Oscillators.js +41 -0
  1762. package/src/nodes/utils/Packing.d.ts +52 -0
  1763. package/src/nodes/utils/Packing.js +64 -0
  1764. package/src/nodes/utils/PostProcessingUtils.d.ts +56 -0
  1765. package/src/nodes/utils/PostProcessingUtils.js +175 -0
  1766. package/src/nodes/utils/RTTNode.d.ts +46 -0
  1767. package/src/nodes/utils/RTTNode.js +370 -0
  1768. package/src/nodes/utils/ReflectorNode.d.ts +61 -0
  1769. package/src/nodes/utils/ReflectorNode.js +634 -0
  1770. package/src/nodes/utils/Remap.d.ts +223 -0
  1771. package/src/nodes/utils/Remap.js +48 -0
  1772. package/src/nodes/utils/RotateNode.d.ts +26 -0
  1773. package/src/nodes/utils/RotateNode.js +180 -0
  1774. package/src/nodes/utils/SampleNode.d.ts +26 -0
  1775. package/src/nodes/utils/SampleNode.js +91 -0
  1776. package/src/nodes/utils/SetNode.d.ts +11 -0
  1777. package/src/nodes/utils/SetNode.js +108 -0
  1778. package/src/nodes/utils/SplitNode.d.ts +14 -0
  1779. package/src/nodes/utils/SplitNode.js +179 -0
  1780. package/src/nodes/utils/SpriteSheetUV.d.ts +7 -0
  1781. package/src/nodes/utils/SpriteSheetUV.js +35 -0
  1782. package/src/nodes/utils/SpriteUtils.d.ts +5 -0
  1783. package/src/nodes/utils/SpriteUtils.js +98 -0
  1784. package/src/nodes/utils/StorageArrayElementNode.d.ts +28 -0
  1785. package/src/nodes/utils/StorageArrayElementNode.js +143 -0
  1786. package/src/nodes/utils/Timer.d.ts +5 -0
  1787. package/src/nodes/utils/Timer.js +26 -0
  1788. package/src/nodes/utils/TriplanarTextures.d.ts +19 -0
  1789. package/src/nodes/utils/TriplanarTextures.js +65 -0
  1790. package/src/nodes/utils/UVUtils.d.ts +19 -0
  1791. package/src/nodes/utils/UVUtils.js +67 -0
  1792. package/src/nodes/utils/ViewportUtils.d.ts +3 -0
  1793. package/src/nodes/utils/ViewportUtils.js +26 -0
  1794. package/src/objects/BatchedMesh.d.ts +280 -0
  1795. package/src/objects/BatchedMesh.js +1696 -0
  1796. package/src/objects/Bone.d.ts +36 -0
  1797. package/src/objects/Bone.js +41 -0
  1798. package/src/objects/ClippingGroup.d.ts +41 -0
  1799. package/src/objects/ClippingGroup.js +68 -0
  1800. package/src/objects/Group.d.ts +37 -0
  1801. package/src/objects/Group.js +41 -0
  1802. package/src/objects/InstancedMesh.d.ts +175 -0
  1803. package/src/objects/InstancedMesh.js +411 -0
  1804. package/src/objects/LOD.d.ts +112 -0
  1805. package/src/objects/LOD.js +329 -0
  1806. package/src/objects/Line.d.ts +96 -0
  1807. package/src/objects/Line.js +341 -0
  1808. package/src/objects/LineLoop.d.ts +40 -0
  1809. package/src/objects/LineLoop.js +37 -0
  1810. package/src/objects/LineSegments.d.ts +41 -0
  1811. package/src/objects/LineSegments.js +74 -0
  1812. package/src/objects/Mesh.d.ts +111 -0
  1813. package/src/objects/Mesh.js +508 -0
  1814. package/src/objects/Points.d.ts +75 -0
  1815. package/src/objects/Points.js +240 -0
  1816. package/src/objects/Skeleton.d.ts +120 -0
  1817. package/src/objects/Skeleton.js +383 -0
  1818. package/src/objects/SkinnedMesh.d.ts +163 -0
  1819. package/src/objects/SkinnedMesh.js +370 -0
  1820. package/src/objects/Sprite.d.ts +82 -0
  1821. package/src/objects/Sprite.js +257 -0
  1822. package/src/renderers/WebGL3DRenderTarget.d.ts +29 -0
  1823. package/src/renderers/WebGL3DRenderTarget.js +48 -0
  1824. package/src/renderers/WebGLArrayRenderTarget.d.ts +29 -0
  1825. package/src/renderers/WebGLArrayRenderTarget.js +48 -0
  1826. package/src/renderers/WebGLCubeRenderTarget.d.ts +18 -0
  1827. package/src/renderers/WebGLCubeRenderTarget.js +182 -0
  1828. package/src/renderers/WebGLRenderTarget.d.ts +8 -0
  1829. package/src/renderers/WebGLRenderTarget.js +34 -0
  1830. package/src/renderers/WebGLRenderer.d.ts +489 -0
  1831. package/src/renderers/WebGLRenderer.js +3769 -0
  1832. package/src/renderers/common/Animation.js +169 -0
  1833. package/src/renderers/common/Attributes.js +187 -0
  1834. package/src/renderers/common/Backend.d.ts +29 -0
  1835. package/src/renderers/common/Backend.js +841 -0
  1836. package/src/renderers/common/Background.js +225 -0
  1837. package/src/renderers/common/BindGroup.js +45 -0
  1838. package/src/renderers/common/Binding.js +71 -0
  1839. package/src/renderers/common/Bindings.js +535 -0
  1840. package/src/renderers/common/BlendMode.d.ts +22 -0
  1841. package/src/renderers/common/BlendMode.js +143 -0
  1842. package/src/renderers/common/Buffer.js +136 -0
  1843. package/src/renderers/common/BufferUtils.d.ts +28 -0
  1844. package/src/renderers/common/BufferUtils.js +58 -0
  1845. package/src/renderers/common/BundleGroup.d.ts +46 -0
  1846. package/src/renderers/common/BundleGroup.js +87 -0
  1847. package/src/renderers/common/CanvasTarget.d.ts +158 -0
  1848. package/src/renderers/common/CanvasTarget.js +341 -0
  1849. package/src/renderers/common/CapabilityTier.js +18 -0
  1850. package/src/renderers/common/ChainMap.js +122 -0
  1851. package/src/renderers/common/ClippingContext.d.ts +134 -0
  1852. package/src/renderers/common/ClippingContext.js +280 -0
  1853. package/src/renderers/common/Color4.d.ts +53 -0
  1854. package/src/renderers/common/Color4.js +86 -0
  1855. package/src/renderers/common/ComputePipeline.js +41 -0
  1856. package/src/renderers/common/Constants.d.ts +9 -0
  1857. package/src/renderers/common/Constants.js +10 -0
  1858. package/src/renderers/common/CubeRenderTarget.d.ts +47 -0
  1859. package/src/renderers/common/CubeRenderTarget.js +147 -0
  1860. package/src/renderers/common/DataMap.js +90 -0
  1861. package/src/renderers/common/DirectRenderPipeline.d.ts +20 -0
  1862. package/src/renderers/common/DirectRenderPipeline.js +233 -0
  1863. package/src/renderers/common/GPUInstanceCuller.d.ts +43 -0
  1864. package/src/renderers/common/GPUInstanceCuller.js +372 -0
  1865. package/src/renderers/common/GPUTimings.js +66 -0
  1866. package/src/renderers/common/Geometries.js +485 -0
  1867. package/src/renderers/common/IndirectStorageBufferAttribute.d.ts +10 -0
  1868. package/src/renderers/common/IndirectStorageBufferAttribute.js +38 -0
  1869. package/src/renderers/common/Info.d.ts +194 -0
  1870. package/src/renderers/common/Info.js +542 -0
  1871. package/src/renderers/common/InspectorBase.d.ts +129 -0
  1872. package/src/renderers/common/InspectorBase.js +180 -0
  1873. package/src/renderers/common/Lighting.d.ts +55 -0
  1874. package/src/renderers/common/Lighting.js +112 -0
  1875. package/src/renderers/common/Pipeline.js +35 -0
  1876. package/src/renderers/common/Pipelines.js +500 -0
  1877. package/src/renderers/common/PostProcessing.d.ts +21 -0
  1878. package/src/renderers/common/PostProcessing.js +28 -0
  1879. package/src/renderers/common/ProgrammableStage.js +78 -0
  1880. package/src/renderers/common/QuadMesh.d.ts +19 -0
  1881. package/src/renderers/common/QuadMesh.js +126 -0
  1882. package/src/renderers/common/ReadbackBuffer.d.ts +63 -0
  1883. package/src/renderers/common/ReadbackBuffer.js +78 -0
  1884. package/src/renderers/common/RenderBundle.js +26 -0
  1885. package/src/renderers/common/RenderBundles.js +71 -0
  1886. package/src/renderers/common/RenderContext.js +289 -0
  1887. package/src/renderers/common/RenderContexts.js +100 -0
  1888. package/src/renderers/common/RenderList.js +475 -0
  1889. package/src/renderers/common/RenderLists.js +125 -0
  1890. package/src/renderers/common/RenderObject.js +989 -0
  1891. package/src/renderers/common/RenderObjectPipeline.js +40 -0
  1892. package/src/renderers/common/RenderObjects.js +245 -0
  1893. package/src/renderers/common/RenderPipeline.d.ts +26 -0
  1894. package/src/renderers/common/RenderPipeline.js +263 -0
  1895. package/src/renderers/common/Renderer.d.ts +1209 -0
  1896. package/src/renderers/common/Renderer.js +4115 -0
  1897. package/src/renderers/common/RendererUtils.d.ts +77 -0
  1898. package/src/renderers/common/RendererUtils.js +200 -0
  1899. package/src/renderers/common/SampledTexture.js +152 -0
  1900. package/src/renderers/common/Sampler.js +133 -0
  1901. package/src/renderers/common/Storage3DTexture.d.ts +42 -0
  1902. package/src/renderers/common/Storage3DTexture.js +116 -0
  1903. package/src/renderers/common/StorageArrayTexture.d.ts +31 -0
  1904. package/src/renderers/common/StorageArrayTexture.js +84 -0
  1905. package/src/renderers/common/StorageBuffer.js +53 -0
  1906. package/src/renderers/common/StorageBufferAttribute.d.ts +7 -0
  1907. package/src/renderers/common/StorageBufferAttribute.js +46 -0
  1908. package/src/renderers/common/StorageInstancedBufferAttribute.d.ts +8 -0
  1909. package/src/renderers/common/StorageInstancedBufferAttribute.js +46 -0
  1910. package/src/renderers/common/StorageTexture.d.ts +7 -0
  1911. package/src/renderers/common/StorageTexture.js +86 -0
  1912. package/src/renderers/common/Textures.js +656 -0
  1913. package/src/renderers/common/TimestampQueryPool.d.ts +120 -0
  1914. package/src/renderers/common/TimestampQueryPool.js +173 -0
  1915. package/src/renderers/common/Uniform.js +375 -0
  1916. package/src/renderers/common/UniformBuffer.js +34 -0
  1917. package/src/renderers/common/UniformsGroup.js +570 -0
  1918. package/src/renderers/common/XRManager.d.ts +293 -0
  1919. package/src/renderers/common/XRManager.js +2009 -0
  1920. package/src/renderers/common/XRRenderTarget.js +91 -0
  1921. package/src/renderers/common/extras/PMREMGenerator.d.ts +52 -0
  1922. package/src/renderers/common/extras/PMREMGenerator.js +951 -0
  1923. package/src/renderers/common/nodes/NodeBuilderState.js +160 -0
  1924. package/src/renderers/common/nodes/NodeLibrary.d.ts +129 -0
  1925. package/src/renderers/common/nodes/NodeLibrary.js +196 -0
  1926. package/src/renderers/common/nodes/NodeManager.js +1170 -0
  1927. package/src/renderers/common/nodes/NodeSampledTexture.js +140 -0
  1928. package/src/renderers/common/nodes/NodeSampler.js +62 -0
  1929. package/src/renderers/common/nodes/NodeStorageBuffer.js +74 -0
  1930. package/src/renderers/common/nodes/NodeUniform.js +418 -0
  1931. package/src/renderers/common/nodes/NodeUniformBuffer.js +120 -0
  1932. package/src/renderers/common/nodes/NodeUniformsGroup.js +51 -0
  1933. package/src/renderers/shaders/DFGLUTData.js +50 -0
  1934. package/src/renderers/shaders/ShaderChunk/alphahash_fragment.glsl.js +7 -0
  1935. package/src/renderers/shaders/ShaderChunk/alphahash_pars_fragment.glsl.js +68 -0
  1936. package/src/renderers/shaders/ShaderChunk/alphamap_fragment.glsl.js +7 -0
  1937. package/src/renderers/shaders/ShaderChunk/alphamap_pars_fragment.glsl.js +7 -0
  1938. package/src/renderers/shaders/ShaderChunk/alphatest_fragment.glsl.js +16 -0
  1939. package/src/renderers/shaders/ShaderChunk/alphatest_pars_fragment.glsl.js +5 -0
  1940. package/src/renderers/shaders/ShaderChunk/aomap_fragment.glsl.js +26 -0
  1941. package/src/renderers/shaders/ShaderChunk/aomap_pars_fragment.glsl.js +8 -0
  1942. package/src/renderers/shaders/ShaderChunk/batching_pars_vertex.glsl.js +49 -0
  1943. package/src/renderers/shaders/ShaderChunk/batching_vertex.glsl.js +5 -0
  1944. package/src/renderers/shaders/ShaderChunk/begin_vertex.glsl.js +9 -0
  1945. package/src/renderers/shaders/ShaderChunk/beginnormal_vertex.glsl.js +9 -0
  1946. package/src/renderers/shaders/ShaderChunk/bsdfs.glsl.js +33 -0
  1947. package/src/renderers/shaders/ShaderChunk/bumpmap_pars_fragment.glsl.js +43 -0
  1948. package/src/renderers/shaders/ShaderChunk/clearcoat_normal_fragment_begin.glsl.js +7 -0
  1949. package/src/renderers/shaders/ShaderChunk/clearcoat_normal_fragment_maps.glsl.js +10 -0
  1950. package/src/renderers/shaders/ShaderChunk/clearcoat_pars_fragment.glsl.js +21 -0
  1951. package/src/renderers/shaders/ShaderChunk/clipping_planes_fragment.glsl.js +78 -0
  1952. package/src/renderers/shaders/ShaderChunk/clipping_planes_pars_fragment.glsl.js +9 -0
  1953. package/src/renderers/shaders/ShaderChunk/clipping_planes_pars_vertex.glsl.js +7 -0
  1954. package/src/renderers/shaders/ShaderChunk/clipping_planes_vertex.glsl.js +7 -0
  1955. package/src/renderers/shaders/ShaderChunk/color_fragment.glsl.js +7 -0
  1956. package/src/renderers/shaders/ShaderChunk/color_pars_fragment.glsl.js +7 -0
  1957. package/src/renderers/shaders/ShaderChunk/color_pars_vertex.glsl.js +7 -0
  1958. package/src/renderers/shaders/ShaderChunk/color_vertex.glsl.js +29 -0
  1959. package/src/renderers/shaders/ShaderChunk/colorspace_fragment.glsl.js +3 -0
  1960. package/src/renderers/shaders/ShaderChunk/colorspace_pars_fragment.glsl.js +15 -0
  1961. package/src/renderers/shaders/ShaderChunk/common.glsl.js +134 -0
  1962. package/src/renderers/shaders/ShaderChunk/cube_uv_reflection_fragment.glsl.js +186 -0
  1963. package/src/renderers/shaders/ShaderChunk/default_fragment.glsl.js +5 -0
  1964. package/src/renderers/shaders/ShaderChunk/default_vertex.glsl.js +5 -0
  1965. package/src/renderers/shaders/ShaderChunk/defaultnormal_vertex.glsl.js +59 -0
  1966. package/src/renderers/shaders/ShaderChunk/displacementmap_pars_vertex.glsl.js +9 -0
  1967. package/src/renderers/shaders/ShaderChunk/displacementmap_vertex.glsl.js +7 -0
  1968. package/src/renderers/shaders/ShaderChunk/dithering_fragment.glsl.js +7 -0
  1969. package/src/renderers/shaders/ShaderChunk/dithering_pars_fragment.glsl.js +20 -0
  1970. package/src/renderers/shaders/ShaderChunk/emissivemap_fragment.glsl.js +17 -0
  1971. package/src/renderers/shaders/ShaderChunk/emissivemap_pars_fragment.glsl.js +7 -0
  1972. package/src/renderers/shaders/ShaderChunk/envmap_common_pars_fragment.glsl.js +14 -0
  1973. package/src/renderers/shaders/ShaderChunk/envmap_fragment.glsl.js +58 -0
  1974. package/src/renderers/shaders/ShaderChunk/envmap_pars_fragment.glsl.js +21 -0
  1975. package/src/renderers/shaders/ShaderChunk/envmap_pars_vertex.glsl.js +22 -0
  1976. package/src/renderers/shaders/ShaderChunk/envmap_physical_pars_fragment.glsl.js +117 -0
  1977. package/src/renderers/shaders/ShaderChunk/envmap_vertex.glsl.js +37 -0
  1978. package/src/renderers/shaders/ShaderChunk/fog_fragment.glsl.js +17 -0
  1979. package/src/renderers/shaders/ShaderChunk/fog_pars_fragment.glsl.js +19 -0
  1980. package/src/renderers/shaders/ShaderChunk/fog_pars_vertex.glsl.js +7 -0
  1981. package/src/renderers/shaders/ShaderChunk/fog_vertex.glsl.js +7 -0
  1982. package/src/renderers/shaders/ShaderChunk/gradientmap_pars_fragment.glsl.js +27 -0
  1983. package/src/renderers/shaders/ShaderChunk/iridescence_fragment.glsl.js +120 -0
  1984. package/src/renderers/shaders/ShaderChunk/iridescence_pars_fragment.glsl.js +14 -0
  1985. package/src/renderers/shaders/ShaderChunk/lightmap_pars_fragment.glsl.js +8 -0
  1986. package/src/renderers/shaders/ShaderChunk/lightprobes_pars_fragment.glsl.js +80 -0
  1987. package/src/renderers/shaders/ShaderChunk/lights_fragment_begin.glsl.js +262 -0
  1988. package/src/renderers/shaders/ShaderChunk/lights_fragment_end.glsl.js +19 -0
  1989. package/src/renderers/shaders/ShaderChunk/lights_fragment_maps.glsl.js +62 -0
  1990. package/src/renderers/shaders/ShaderChunk/lights_lambert_fragment.glsl.js +5 -0
  1991. package/src/renderers/shaders/ShaderChunk/lights_lambert_pars_fragment.glsl.js +28 -0
  1992. package/src/renderers/shaders/ShaderChunk/lights_pars_begin.glsl.js +236 -0
  1993. package/src/renderers/shaders/ShaderChunk/lights_phong_fragment.glsl.js +7 -0
  1994. package/src/renderers/shaders/ShaderChunk/lights_phong_pars_fragment.glsl.js +32 -0
  1995. package/src/renderers/shaders/ShaderChunk/lights_physical_fragment.glsl.js +167 -0
  1996. package/src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl.js +660 -0
  1997. package/src/renderers/shaders/ShaderChunk/lights_toon_fragment.glsl.js +4 -0
  1998. package/src/renderers/shaders/ShaderChunk/lights_toon_pars_fragment.glsl.js +26 -0
  1999. package/src/renderers/shaders/ShaderChunk/logdepthbuf_fragment.glsl.js +9 -0
  2000. package/src/renderers/shaders/ShaderChunk/logdepthbuf_pars_fragment.glsl.js +9 -0
  2001. package/src/renderers/shaders/ShaderChunk/logdepthbuf_pars_vertex.glsl.js +8 -0
  2002. package/src/renderers/shaders/ShaderChunk/logdepthbuf_vertex.glsl.js +8 -0
  2003. package/src/renderers/shaders/ShaderChunk/map_fragment.glsl.js +17 -0
  2004. package/src/renderers/shaders/ShaderChunk/map_pars_fragment.glsl.js +7 -0
  2005. package/src/renderers/shaders/ShaderChunk/map_particle_fragment.glsl.js +27 -0
  2006. package/src/renderers/shaders/ShaderChunk/map_particle_pars_fragment.glsl.js +27 -0
  2007. package/src/renderers/shaders/ShaderChunk/metalnessmap_fragment.glsl.js +12 -0
  2008. package/src/renderers/shaders/ShaderChunk/metalnessmap_pars_fragment.glsl.js +7 -0
  2009. package/src/renderers/shaders/ShaderChunk/morphcolor_vertex.glsl.js +24 -0
  2010. package/src/renderers/shaders/ShaderChunk/morphinstance_vertex.glsl.js +14 -0
  2011. package/src/renderers/shaders/ShaderChunk/morphnormal_vertex.glsl.js +16 -0
  2012. package/src/renderers/shaders/ShaderChunk/morphtarget_pars_vertex.glsl.js +26 -0
  2013. package/src/renderers/shaders/ShaderChunk/morphtarget_vertex.glsl.js +16 -0
  2014. package/src/renderers/shaders/ShaderChunk/normal_fragment_begin.glsl.js +76 -0
  2015. package/src/renderers/shaders/ShaderChunk/normal_fragment_maps.glsl.js +40 -0
  2016. package/src/renderers/shaders/ShaderChunk/normal_pars_fragment.glsl.js +14 -0
  2017. package/src/renderers/shaders/ShaderChunk/normal_pars_vertex.glsl.js +14 -0
  2018. package/src/renderers/shaders/ShaderChunk/normal_vertex.glsl.js +20 -0
  2019. package/src/renderers/shaders/ShaderChunk/normalmap_pars_fragment.glsl.js +43 -0
  2020. package/src/renderers/shaders/ShaderChunk/opaque_fragment.glsl.js +11 -0
  2021. package/src/renderers/shaders/ShaderChunk/packing.glsl.js +116 -0
  2022. package/src/renderers/shaders/ShaderChunk/premultiplied_alpha_fragment.glsl.js +7 -0
  2023. package/src/renderers/shaders/ShaderChunk/project_vertex.glsl.js +19 -0
  2024. package/src/renderers/shaders/ShaderChunk/roughnessmap_fragment.glsl.js +12 -0
  2025. package/src/renderers/shaders/ShaderChunk/roughnessmap_pars_fragment.glsl.js +7 -0
  2026. package/src/renderers/shaders/ShaderChunk/shadowmap_pars_fragment.glsl.js +458 -0
  2027. package/src/renderers/shaders/ShaderChunk/shadowmap_pars_vertex.glsl.js +80 -0
  2028. package/src/renderers/shaders/ShaderChunk/shadowmap_vertex.glsl.js +85 -0
  2029. package/src/renderers/shaders/ShaderChunk/shadowmask_pars_fragment.glsl.js +81 -0
  2030. package/src/renderers/shaders/ShaderChunk/skinbase_vertex.glsl.js +10 -0
  2031. package/src/renderers/shaders/ShaderChunk/skinning_pars_vertex.glsl.js +25 -0
  2032. package/src/renderers/shaders/ShaderChunk/skinning_vertex.glsl.js +15 -0
  2033. package/src/renderers/shaders/ShaderChunk/skinnormal_vertex.glsl.js +20 -0
  2034. package/src/renderers/shaders/ShaderChunk/specularmap_fragment.glsl.js +14 -0
  2035. package/src/renderers/shaders/ShaderChunk/specularmap_pars_fragment.glsl.js +7 -0
  2036. package/src/renderers/shaders/ShaderChunk/tonemapping_fragment.glsl.js +7 -0
  2037. package/src/renderers/shaders/ShaderChunk/tonemapping_pars_fragment.glsl.js +200 -0
  2038. package/src/renderers/shaders/ShaderChunk/transmission_fragment.glsl.js +36 -0
  2039. package/src/renderers/shaders/ShaderChunk/transmission_pars_fragment.glsl.js +235 -0
  2040. package/src/renderers/shaders/ShaderChunk/uv_pars_fragment.glsl.js +119 -0
  2041. package/src/renderers/shaders/ShaderChunk/uv_pars_vertex.glsl.js +145 -0
  2042. package/src/renderers/shaders/ShaderChunk/uv_vertex.glsl.js +122 -0
  2043. package/src/renderers/shaders/ShaderChunk/worldpos_vertex.glsl.js +21 -0
  2044. package/src/renderers/shaders/ShaderChunk.d.ts +144 -0
  2045. package/src/renderers/shaders/ShaderChunk.js +272 -0
  2046. package/src/renderers/shaders/ShaderLib/background.glsl.js +40 -0
  2047. package/src/renderers/shaders/ShaderLib/backgroundCube.glsl.js +62 -0
  2048. package/src/renderers/shaders/ShaderLib/cube.glsl.js +36 -0
  2049. package/src/renderers/shaders/ShaderLib/depth.glsl.js +117 -0
  2050. package/src/renderers/shaders/ShaderLib/distance.glsl.js +77 -0
  2051. package/src/renderers/shaders/ShaderLib/equirect.glsl.js +35 -0
  2052. package/src/renderers/shaders/ShaderLib/linedashed.glsl.js +76 -0
  2053. package/src/renderers/shaders/ShaderLib/meshbasic.glsl.js +116 -0
  2054. package/src/renderers/shaders/ShaderLib/meshlambert.glsl.js +126 -0
  2055. package/src/renderers/shaders/ShaderLib/meshmatcap.glsl.js +112 -0
  2056. package/src/renderers/shaders/ShaderLib/meshnormal.glsl.js +86 -0
  2057. package/src/renderers/shaders/ShaderLib/meshphong.glsl.js +128 -0
  2058. package/src/renderers/shaders/ShaderLib/meshphysical.glsl.js +228 -0
  2059. package/src/renderers/shaders/ShaderLib/meshtoon.glsl.js +118 -0
  2060. package/src/renderers/shaders/ShaderLib/points.glsl.js +87 -0
  2061. package/src/renderers/shaders/ShaderLib/shadow.glsl.js +58 -0
  2062. package/src/renderers/shaders/ShaderLib/sprite.glsl.js +79 -0
  2063. package/src/renderers/shaders/ShaderLib/vsm.glsl.js +51 -0
  2064. package/src/renderers/shaders/ShaderLib.d.ts +29 -0
  2065. package/src/renderers/shaders/ShaderLib.js +363 -0
  2066. package/src/renderers/shaders/UniformsLib.d.ts +209 -0
  2067. package/src/renderers/shaders/UniformsLib.js +250 -0
  2068. package/src/renderers/shaders/UniformsUtils.d.ts +14 -0
  2069. package/src/renderers/shaders/UniformsUtils.js +154 -0
  2070. package/src/renderers/webgl/WebGLAnimation.js +54 -0
  2071. package/src/renderers/webgl/WebGLAttributes.d.ts +23 -0
  2072. package/src/renderers/webgl/WebGLAttributes.js +237 -0
  2073. package/src/renderers/webgl/WebGLBackground.js +303 -0
  2074. package/src/renderers/webgl/WebGLBindingStates.d.ts +26 -0
  2075. package/src/renderers/webgl/WebGLBindingStates.js +666 -0
  2076. package/src/renderers/webgl/WebGLBufferRenderer.d.ts +15 -0
  2077. package/src/renderers/webgl/WebGLBufferRenderer.js +57 -0
  2078. package/src/renderers/webgl/WebGLCapabilities.d.ts +48 -0
  2079. package/src/renderers/webgl/WebGLCapabilities.js +150 -0
  2080. package/src/renderers/webgl/WebGLClipping.d.ts +26 -0
  2081. package/src/renderers/webgl/WebGLClipping.js +171 -0
  2082. package/src/renderers/webgl/WebGLEnvironments.d.ts +8 -0
  2083. package/src/renderers/webgl/WebGLEnvironments.js +228 -0
  2084. package/src/renderers/webgl/WebGLExtensions.d.ts +7 -0
  2085. package/src/renderers/webgl/WebGLExtensions.js +61 -0
  2086. package/src/renderers/webgl/WebGLGeometries.d.ts +13 -0
  2087. package/src/renderers/webgl/WebGLGeometries.js +186 -0
  2088. package/src/renderers/webgl/WebGLIndexedBufferRenderer.d.ts +13 -0
  2089. package/src/renderers/webgl/WebGLIndexedBufferRenderer.js +68 -0
  2090. package/src/renderers/webgl/WebGLInfo.d.ts +39 -0
  2091. package/src/renderers/webgl/WebGLInfo.js +73 -0
  2092. package/src/renderers/webgl/WebGLLights.d.ts +57 -0
  2093. package/src/renderers/webgl/WebGLLights.js +654 -0
  2094. package/src/renderers/webgl/WebGLMaterials.js +608 -0
  2095. package/src/renderers/webgl/WebGLMorphtargets.js +168 -0
  2096. package/src/renderers/webgl/WebGLObjects.d.ts +19 -0
  2097. package/src/renderers/webgl/WebGLObjects.js +94 -0
  2098. package/src/renderers/webgl/WebGLOutput.js +283 -0
  2099. package/src/renderers/webgl/WebGLProgram.d.ts +22 -0
  2100. package/src/renderers/webgl/WebGLProgram.js +1035 -0
  2101. package/src/renderers/webgl/WebGLPrograms.d.ts +242 -0
  2102. package/src/renderers/webgl/WebGLPrograms.js +694 -0
  2103. package/src/renderers/webgl/WebGLProperties.d.ts +9 -0
  2104. package/src/renderers/webgl/WebGLProperties.js +55 -0
  2105. package/src/renderers/webgl/WebGLRenderLists.d.ts +68 -0
  2106. package/src/renderers/webgl/WebGLRenderLists.js +257 -0
  2107. package/src/renderers/webgl/WebGLRenderStates.js +124 -0
  2108. package/src/renderers/webgl/WebGLShader.d.ts +1 -0
  2109. package/src/renderers/webgl/WebGLShader.js +12 -0
  2110. package/src/renderers/webgl/WebGLShaderCache.js +118 -0
  2111. package/src/renderers/webgl/WebGLShadowMap.d.ts +33 -0
  2112. package/src/renderers/webgl/WebGLShadowMap.js +611 -0
  2113. package/src/renderers/webgl/WebGLState.d.ts +399 -0
  2114. package/src/renderers/webgl/WebGLState.js +1370 -0
  2115. package/src/renderers/webgl/WebGLTextures.d.ts +31 -0
  2116. package/src/renderers/webgl/WebGLTextures.js +2519 -0
  2117. package/src/renderers/webgl/WebGLUniforms.d.ts +5 -0
  2118. package/src/renderers/webgl/WebGLUniforms.js +1203 -0
  2119. package/src/renderers/webgl/WebGLUniformsGroups.d.ts +17 -0
  2120. package/src/renderers/webgl/WebGLUniformsGroups.js +441 -0
  2121. package/src/renderers/webgl/WebGLUtils.d.ts +11 -0
  2122. package/src/renderers/webgl/WebGLUtils.js +217 -0
  2123. package/src/renderers/webgl-fallback/WebGLBackend.d.ts +16 -0
  2124. package/src/renderers/webgl-fallback/WebGLBackend.js +2950 -0
  2125. package/src/renderers/webgl-fallback/WebGLBufferRenderer.js +99 -0
  2126. package/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.d.ts +9 -0
  2127. package/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js +1860 -0
  2128. package/src/renderers/webgl-fallback/utils/WebGLAttributeUtils.js +359 -0
  2129. package/src/renderers/webgl-fallback/utils/WebGLCapabilities.d.ts +51 -0
  2130. package/src/renderers/webgl-fallback/utils/WebGLCapabilities.js +105 -0
  2131. package/src/renderers/webgl-fallback/utils/WebGLConstants.js +13 -0
  2132. package/src/renderers/webgl-fallback/utils/WebGLExtensions.js +83 -0
  2133. package/src/renderers/webgl-fallback/utils/WebGLState.js +1507 -0
  2134. package/src/renderers/webgl-fallback/utils/WebGLTextureUtils.js +1381 -0
  2135. package/src/renderers/webgl-fallback/utils/WebGLTimestampQueryPool.js +406 -0
  2136. package/src/renderers/webgl-fallback/utils/WebGLUtils.js +319 -0
  2137. package/src/renderers/webgpu/WebGPUBackend.d.ts +32 -0
  2138. package/src/renderers/webgpu/WebGPUBackend.js +3321 -0
  2139. package/src/renderers/webgpu/WebGPURenderer.Nodes.d.ts +12 -0
  2140. package/src/renderers/webgpu/WebGPURenderer.Nodes.js +69 -0
  2141. package/src/renderers/webgpu/WebGPURenderer.d.ts +17 -0
  2142. package/src/renderers/webgpu/WebGPURenderer.js +107 -0
  2143. package/src/renderers/webgpu/descriptors/GPUBindGroupDescriptor.js +48 -0
  2144. package/src/renderers/webgpu/descriptors/GPUBufferDescriptor.js +57 -0
  2145. package/src/renderers/webgpu/descriptors/GPUCommandEncoderDescriptor.js +30 -0
  2146. package/src/renderers/webgpu/descriptors/GPUComputePassDescriptor.js +38 -0
  2147. package/src/renderers/webgpu/descriptors/GPUComputePipelineDescriptor.js +48 -0
  2148. package/src/renderers/webgpu/descriptors/GPUCopyExternalImageDestInfo.js +47 -0
  2149. package/src/renderers/webgpu/descriptors/GPUCopyExternalImageSourceInfo.js +50 -0
  2150. package/src/renderers/webgpu/descriptors/GPUExtent3D.js +51 -0
  2151. package/src/renderers/webgpu/descriptors/GPUPipelineLayoutDescriptor.js +39 -0
  2152. package/src/renderers/webgpu/descriptors/GPUQuerySetDescriptor.js +47 -0
  2153. package/src/renderers/webgpu/descriptors/GPURenderBundleEncoderDescriptor.js +74 -0
  2154. package/src/renderers/webgpu/descriptors/GPURenderPassColorAttachment.js +72 -0
  2155. package/src/renderers/webgpu/descriptors/GPURenderPassDepthStencilAttachment.js +99 -0
  2156. package/src/renderers/webgpu/descriptors/GPURenderPassDescriptor.js +72 -0
  2157. package/src/renderers/webgpu/descriptors/GPURenderPassTimestampWrites.js +49 -0
  2158. package/src/renderers/webgpu/descriptors/GPURenderPipelineDescriptor.js +130 -0
  2159. package/src/renderers/webgpu/descriptors/GPUSamplerDescriptor.js +119 -0
  2160. package/src/renderers/webgpu/descriptors/GPUShaderModuleDescriptor.js +46 -0
  2161. package/src/renderers/webgpu/descriptors/GPUTexelCopyBufferInfo.js +57 -0
  2162. package/src/renderers/webgpu/descriptors/GPUTexelCopyBufferLayout.js +48 -0
  2163. package/src/renderers/webgpu/descriptors/GPUTexelCopyTextureInfo.js +61 -0
  2164. package/src/renderers/webgpu/descriptors/GPUTextureDescriptor.js +99 -0
  2165. package/src/renderers/webgpu/descriptors/GPUTextureViewDescriptor.js +108 -0
  2166. package/src/renderers/webgpu/nodes/BasicNodeLibrary.d.ts +13 -0
  2167. package/src/renderers/webgpu/nodes/BasicNodeLibrary.js +66 -0
  2168. package/src/renderers/webgpu/nodes/StandardNodeLibrary.d.ts +91 -0
  2169. package/src/renderers/webgpu/nodes/StandardNodeLibrary.js +99 -0
  2170. package/src/renderers/webgpu/nodes/WGSLNodeBuilder.d.ts +9 -0
  2171. package/src/renderers/webgpu/nodes/WGSLNodeBuilder.js +2759 -0
  2172. package/src/renderers/webgpu/nodes/WGSLNodeFunction.js +188 -0
  2173. package/src/renderers/webgpu/nodes/WGSLNodeParser.js +25 -0
  2174. package/src/renderers/webgpu/utils/WebGPUAttributeUtils.js +573 -0
  2175. package/src/renderers/webgpu/utils/WebGPUBindingUtils.js +683 -0
  2176. package/src/renderers/webgpu/utils/WebGPUCapabilities.js +149 -0
  2177. package/src/renderers/webgpu/utils/WebGPUConstants.d.ts +348 -0
  2178. package/src/renderers/webgpu/utils/WebGPUConstants.js +354 -0
  2179. package/src/renderers/webgpu/utils/WebGPUPipelineUtils.js +1007 -0
  2180. package/src/renderers/webgpu/utils/WebGPUTexturePassUtils.js +452 -0
  2181. package/src/renderers/webgpu/utils/WebGPUTextureUtils.js +1884 -0
  2182. package/src/renderers/webgpu/utils/WebGPUTimestampQueryPool.js +337 -0
  2183. package/src/renderers/webgpu/utils/WebGPUUniformArena.js +240 -0
  2184. package/src/renderers/webgpu/utils/WebGPUUtils.js +342 -0
  2185. package/src/renderers/webxr/WebXRController.d.ts +67 -0
  2186. package/src/renderers/webxr/WebXRController.js +440 -0
  2187. package/src/renderers/webxr/WebXRDepthSensing.d.ts +21 -0
  2188. package/src/renderers/webxr/WebXRDepthSensing.js +155 -0
  2189. package/src/renderers/webxr/WebXRManager.d.ts +89 -0
  2190. package/src/renderers/webxr/WebXRManager.js +1126 -0
  2191. package/src/scenes/Fog.d.ts +71 -0
  2192. package/src/scenes/Fog.js +98 -0
  2193. package/src/scenes/FogExp2.d.ts +61 -0
  2194. package/src/scenes/FogExp2.js +86 -0
  2195. package/src/scenes/Scene.d.ts +104 -0
  2196. package/src/scenes/Scene.js +165 -0
  2197. package/src/textures/CanvasTexture.d.ts +51 -0
  2198. package/src/textures/CanvasTexture.js +45 -0
  2199. package/src/textures/CompressedArrayTexture.d.ts +65 -0
  2200. package/src/textures/CompressedArrayTexture.js +105 -0
  2201. package/src/textures/CompressedCubeTexture.d.ts +13 -0
  2202. package/src/textures/CompressedCubeTexture.js +48 -0
  2203. package/src/textures/CompressedTexture.d.ts +92 -0
  2204. package/src/textures/CompressedTexture.js +86 -0
  2205. package/src/textures/CubeDepthTexture.d.ts +40 -0
  2206. package/src/textures/CubeDepthTexture.js +76 -0
  2207. package/src/textures/CubeTexture.d.ts +82 -0
  2208. package/src/textures/CubeTexture.js +81 -0
  2209. package/src/textures/Data3DTexture.d.ts +94 -0
  2210. package/src/textures/Data3DTexture.js +128 -0
  2211. package/src/textures/DataArrayTexture.d.ts +123 -0
  2212. package/src/textures/DataArrayTexture.js +150 -0
  2213. package/src/textures/DataTexture.d.ts +112 -0
  2214. package/src/textures/DataTexture.js +87 -0
  2215. package/src/textures/DepthTexture.d.ts +105 -0
  2216. package/src/textures/DepthTexture.js +104 -0
  2217. package/src/textures/ExternalTexture.d.ts +14 -0
  2218. package/src/textures/ExternalTexture.js +53 -0
  2219. package/src/textures/FramebufferTexture.d.ts +67 -0
  2220. package/src/textures/FramebufferTexture.js +85 -0
  2221. package/src/textures/HTMLTexture.d.ts +27 -0
  2222. package/src/textures/HTMLTexture.js +74 -0
  2223. package/src/textures/Texture.d.ts +565 -0
  2224. package/src/textures/Texture.js +812 -0
  2225. package/src/textures/TextureSource.d.ts +99 -0
  2226. package/src/textures/TextureSource.js +261 -0
  2227. package/src/textures/VideoFrameTexture.d.ts +27 -0
  2228. package/src/textures/VideoFrameTexture.js +72 -0
  2229. package/src/textures/VideoTexture.d.ts +90 -0
  2230. package/src/textures/VideoTexture.js +127 -0
  2231. package/src/upe.d.ts +5 -0
  2232. package/src/upe.js +17 -0
  2233. package/src/utils.d.ts +36 -0
  2234. package/src/utils.js +493 -0
@@ -0,0 +1,4656 @@
1
+ import {
2
+ AmbientLight,
3
+ AnimationClip,
4
+ Bone,
5
+ BufferGeometry,
6
+ ClampToEdgeWrapping,
7
+ Color,
8
+ ColorManagement,
9
+ DirectionalLight,
10
+ EquirectangularReflectionMapping,
11
+ Euler,
12
+ FileLoader,
13
+ Float32BufferAttribute,
14
+ Group,
15
+ Line,
16
+ LineBasicMaterial,
17
+ Loader,
18
+ LoaderUtils,
19
+ MathUtils,
20
+ Matrix3,
21
+ Matrix4,
22
+ Mesh,
23
+ MeshLambertMaterial,
24
+ MeshPhongMaterial,
25
+ NumberKeyframeTrack,
26
+ Object3D,
27
+ PerspectiveCamera,
28
+ PointLight,
29
+ PropertyBinding,
30
+ Quaternion,
31
+ QuaternionKeyframeTrack,
32
+ RepeatWrapping,
33
+ SRGBColorSpace,
34
+ ShapeUtils,
35
+ Skeleton,
36
+ SkinnedMesh,
37
+ SpotLight,
38
+ Texture,
39
+ TextureLoader,
40
+ Uint16BufferAttribute,
41
+ Vector2,
42
+ Vector3,
43
+ Vector4,
44
+ VectorKeyframeTrack
45
+ } from 'three';
46
+
47
+ import { unzlibSync } from '../libs/fflate.module.js';
48
+ import { NURBSCurve } from '../curves/NURBSCurve.js';
49
+
50
+ let fbxTree;
51
+ let connections;
52
+ let sceneGraph;
53
+
54
+ /**
55
+ * A loader for the FBX format.
56
+ *
57
+ * Requires FBX file to be >= 7.0 and in ASCII or >= 6400 in Binary format.
58
+ * Versions lower than this may load but will probably have errors.
59
+ *
60
+ * Needs Support:
61
+ * - Morph normals / blend shape normals
62
+ *
63
+ * FBX format references:
64
+ * - [C++ SDK reference](https://help.autodesk.com/view/FBX/2017/ENU/?guid=__cpp_ref_index_html)
65
+ *
66
+ * Binary format specification:
67
+ * - [FBX binary file format specification](https://code.blender.org/2013/08/fbx-binary-file-format-specification/)
68
+ *
69
+ * ```js
70
+ * const loader = new FBXLoader();
71
+ * const object = await loader.loadAsync( 'models/fbx/stanford-bunny.fbx' );
72
+ * scene.add( object );
73
+ * ```
74
+ *
75
+ * @augments Loader
76
+ * @three_import import { FBXLoader } from 'three/addons/loaders/FBXLoader.js';
77
+ */
78
+ class FBXLoader extends Loader {
79
+
80
+ /**
81
+ * Constructs a new FBX loader.
82
+ *
83
+ * @param {LoadingManager} [manager] - The loading manager.
84
+ */
85
+ constructor( manager ) {
86
+
87
+ super( manager );
88
+
89
+ /**
90
+ * Whether to trim animation clips to the time range of their
91
+ * animation stacks and shift them to start at time zero. Useful
92
+ * for assets that define multiple clips on a single timeline.
93
+ *
94
+ * @type {boolean}
95
+ * @default false
96
+ */
97
+ this.trimAnimationClips = false;
98
+
99
+ }
100
+
101
+ /**
102
+ * Starts loading from the given URL and passes the loaded FBX asset
103
+ * to the `onLoad()` callback.
104
+ *
105
+ * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI.
106
+ * @param {function(Group)} onLoad - Executed when the loading process has been finished.
107
+ * @param {onProgressCallback} onProgress - Executed while the loading is in progress.
108
+ * @param {onErrorCallback} onError - Executed when errors occur.
109
+ */
110
+ load( url, onLoad, onProgress, onError ) {
111
+
112
+ const scope = this;
113
+
114
+ const path = ( scope.path === '' ) ? LoaderUtils.extractUrlBase( url ) : scope.path;
115
+
116
+ const loader = new FileLoader( this.manager );
117
+ loader.setPath( scope.path );
118
+ loader.setResponseType( 'arraybuffer' );
119
+ loader.setRequestHeader( scope.requestHeader );
120
+ loader.setWithCredentials( scope.withCredentials );
121
+
122
+ loader.load( url, function ( buffer ) {
123
+
124
+ try {
125
+
126
+ onLoad( scope.parse( buffer, path ) );
127
+
128
+ } catch ( e ) {
129
+
130
+ if ( onError ) {
131
+
132
+ onError( e );
133
+
134
+ } else {
135
+
136
+ console.error( e );
137
+
138
+ }
139
+
140
+ scope.manager.itemError( url );
141
+
142
+ }
143
+
144
+ }, onProgress, onError );
145
+
146
+ }
147
+
148
+ /**
149
+ * Parses the given FBX data and returns the resulting group.
150
+ *
151
+ * @param {ArrayBuffer} FBXBuffer - The raw FBX data as an array buffer.
152
+ * @param {string} path - The URL base path.
153
+ * @return {Group} An object representing the parsed asset.
154
+ */
155
+ parse( FBXBuffer, path ) {
156
+
157
+ if ( isFbxFormatBinary( FBXBuffer ) ) {
158
+
159
+ fbxTree = new BinaryParser().parse( FBXBuffer );
160
+
161
+ } else {
162
+
163
+ const FBXText = convertArrayBufferToString( FBXBuffer );
164
+
165
+ if ( ! isFbxFormatASCII( FBXText ) ) {
166
+
167
+ throw new Error( 'THREE.FBXLoader: Unknown format.' );
168
+
169
+ }
170
+
171
+ if ( getFbxVersion( FBXText ) < 7000 ) {
172
+
173
+ throw new Error( 'THREE.FBXLoader: FBX version not supported, FileVersion: ' + getFbxVersion( FBXText ) );
174
+
175
+ }
176
+
177
+ fbxTree = new TextParser().parse( FBXText );
178
+
179
+ }
180
+
181
+ // console.log( fbxTree );
182
+
183
+ const textureLoader = new TextureLoader( this.manager ).setPath( this.resourcePath || path ).setCrossOrigin( this.crossOrigin );
184
+
185
+ return new FBXTreeParser( textureLoader, this.manager, this.trimAnimationClips ).parse( fbxTree );
186
+
187
+ }
188
+
189
+ }
190
+
191
+ // Parse the FBXTree object returned by the BinaryParser or TextParser and return a Group
192
+ class FBXTreeParser {
193
+
194
+ constructor( textureLoader, manager, trimAnimationClips ) {
195
+
196
+ this.textureLoader = textureLoader;
197
+ this.manager = manager;
198
+ this.trimAnimationClips = trimAnimationClips;
199
+
200
+ }
201
+
202
+ parse() {
203
+
204
+ connections = this.parseConnections();
205
+
206
+ const images = this.parseImages();
207
+ const textures = this.parseTextures( images );
208
+ const materials = this.parseMaterials( textures );
209
+ const deformers = this.parseDeformers();
210
+ const geometryMap = new GeometryParser().parse( deformers );
211
+
212
+ this.parseScene( deformers, geometryMap, materials );
213
+
214
+ return sceneGraph;
215
+
216
+ }
217
+
218
+ // Parses FBXTree.Connections which holds parent-child connections between objects (e.g. material -> texture, model->geometry )
219
+ // and details the connection type
220
+ parseConnections() {
221
+
222
+ const connectionMap = new Map();
223
+
224
+ if ( 'Connections' in fbxTree ) {
225
+
226
+ const rawConnections = fbxTree.Connections.connections;
227
+
228
+ rawConnections.forEach( function ( rawConnection ) {
229
+
230
+ const fromID = rawConnection[ 0 ];
231
+ const toID = rawConnection[ 1 ];
232
+ const relationship = rawConnection[ 2 ];
233
+
234
+ if ( ! connectionMap.has( fromID ) ) {
235
+
236
+ connectionMap.set( fromID, {
237
+ parents: [],
238
+ children: []
239
+ } );
240
+
241
+ }
242
+
243
+ const parentRelationship = { ID: toID, relationship: relationship };
244
+ connectionMap.get( fromID ).parents.push( parentRelationship );
245
+
246
+ if ( ! connectionMap.has( toID ) ) {
247
+
248
+ connectionMap.set( toID, {
249
+ parents: [],
250
+ children: []
251
+ } );
252
+
253
+ }
254
+
255
+ const childRelationship = { ID: fromID, relationship: relationship };
256
+ connectionMap.get( toID ).children.push( childRelationship );
257
+
258
+ } );
259
+
260
+ }
261
+
262
+ return connectionMap;
263
+
264
+ }
265
+
266
+ // Parse FBXTree.Objects.Video for embedded image data
267
+ // These images are connected to textures in FBXTree.Objects.Textures
268
+ // via FBXTree.Connections.
269
+ parseImages() {
270
+
271
+ const images = {};
272
+ const blobs = {};
273
+
274
+ if ( 'Video' in fbxTree.Objects ) {
275
+
276
+ const videoNodes = fbxTree.Objects.Video;
277
+
278
+ for ( const nodeID in videoNodes ) {
279
+
280
+ const videoNode = videoNodes[ nodeID ];
281
+
282
+ const id = parseInt( nodeID );
283
+
284
+ images[ id ] = videoNode.RelativeFilename || videoNode.Filename;
285
+
286
+ // raw image data is in videoNode.Content
287
+ if ( 'Content' in videoNode ) {
288
+
289
+ const arrayBufferContent = ( videoNode.Content instanceof ArrayBuffer ) && ( videoNode.Content.byteLength > 0 );
290
+ const base64Content = ( typeof videoNode.Content === 'string' ) && ( videoNode.Content !== '' );
291
+
292
+ if ( arrayBufferContent || base64Content ) {
293
+
294
+ const image = this.parseImage( videoNodes[ nodeID ] );
295
+
296
+ blobs[ videoNode.RelativeFilename || videoNode.Filename ] = image;
297
+
298
+ }
299
+
300
+ }
301
+
302
+ }
303
+
304
+ }
305
+
306
+ for ( const id in images ) {
307
+
308
+ const filename = images[ id ];
309
+
310
+ if ( blobs[ filename ] !== undefined ) images[ id ] = blobs[ filename ];
311
+ else images[ id ] = images[ id ].split( '\\' ).pop();
312
+
313
+ }
314
+
315
+ return images;
316
+
317
+ }
318
+
319
+ // Parse embedded image data in FBXTree.Video.Content
320
+ parseImage( videoNode ) {
321
+
322
+ const content = videoNode.Content;
323
+ const fileName = videoNode.RelativeFilename || videoNode.Filename;
324
+ const extension = fileName.slice( fileName.lastIndexOf( '.' ) + 1 ).toLowerCase();
325
+
326
+ let type;
327
+
328
+ switch ( extension ) {
329
+
330
+ case 'bmp':
331
+
332
+ type = 'image/bmp';
333
+ break;
334
+
335
+ case 'jpg':
336
+ case 'jpeg':
337
+
338
+ type = 'image/jpeg';
339
+ break;
340
+
341
+ case 'png':
342
+
343
+ type = 'image/png';
344
+ break;
345
+
346
+ case 'tif':
347
+
348
+ type = 'image/tiff';
349
+ break;
350
+
351
+ case 'tga':
352
+
353
+ if ( this.manager.getHandler( '.tga' ) === null ) {
354
+
355
+ console.warn( 'FBXLoader: TGA loader not found, skipping ', fileName );
356
+
357
+ }
358
+
359
+ type = 'image/tga';
360
+ break;
361
+
362
+ case 'webp':
363
+
364
+ type = 'image/webp';
365
+ break;
366
+
367
+ default:
368
+
369
+ console.warn( 'FBXLoader: Image type "' + extension + '" is not supported.' );
370
+ return;
371
+
372
+ }
373
+
374
+ if ( typeof content === 'string' ) { // ASCII format
375
+
376
+ return 'data:' + type + ';base64,' + content;
377
+
378
+ } else { // Binary Format
379
+
380
+ const array = new Uint8Array( content );
381
+ return URL.createObjectURL( new Blob( [ array ], { type: type } ) );
382
+
383
+ }
384
+
385
+ }
386
+
387
+ // Parse nodes in FBXTree.Objects.Texture
388
+ // These contain details such as UV scaling, cropping, rotation etc and are connected
389
+ // to images in FBXTree.Objects.Video
390
+ parseTextures( images ) {
391
+
392
+ const textureMap = new Map();
393
+
394
+ if ( 'Texture' in fbxTree.Objects ) {
395
+
396
+ const textureNodes = fbxTree.Objects.Texture;
397
+ for ( const nodeID in textureNodes ) {
398
+
399
+ const texture = this.parseTexture( textureNodes[ nodeID ], images );
400
+ textureMap.set( parseInt( nodeID ), texture );
401
+
402
+ }
403
+
404
+ }
405
+
406
+ return textureMap;
407
+
408
+ }
409
+
410
+ // Parse individual node in FBXTree.Objects.Texture
411
+ parseTexture( textureNode, images ) {
412
+
413
+ const texture = this.loadTexture( textureNode, images );
414
+
415
+ texture.ID = textureNode.id;
416
+
417
+ texture.name = textureNode.attrName;
418
+
419
+ const wrapModeU = textureNode.WrapModeU;
420
+ const wrapModeV = textureNode.WrapModeV;
421
+
422
+ const valueU = wrapModeU !== undefined ? wrapModeU.value : 0;
423
+ const valueV = wrapModeV !== undefined ? wrapModeV.value : 0;
424
+
425
+ // http://download.autodesk.com/us/fbx/SDKdocs/FBX_SDK_Help/files/fbxsdkref/class_k_fbx_texture.html#889640e63e2e681259ea81061b85143a
426
+ // 0: repeat(default), 1: clamp
427
+
428
+ texture.wrapS = valueU === 0 ? RepeatWrapping : ClampToEdgeWrapping;
429
+ texture.wrapT = valueV === 0 ? RepeatWrapping : ClampToEdgeWrapping;
430
+
431
+ if ( 'Scaling' in textureNode ) {
432
+
433
+ const values = textureNode.Scaling.value;
434
+
435
+ texture.repeat.x = values[ 0 ];
436
+ texture.repeat.y = values[ 1 ];
437
+
438
+ }
439
+
440
+ if ( 'Translation' in textureNode ) {
441
+
442
+ const values = textureNode.Translation.value;
443
+
444
+ texture.offset.x = values[ 0 ];
445
+ texture.offset.y = values[ 1 ];
446
+
447
+ }
448
+
449
+ return texture;
450
+
451
+ }
452
+
453
+ // load a texture specified as a blob or data URI, or via an external URL using TextureLoader
454
+ loadTexture( textureNode, images ) {
455
+
456
+ const extension = textureNode.FileName.split( '.' ).pop().toLowerCase();
457
+
458
+ let loader = this.manager.getHandler( `.${extension}` );
459
+ if ( loader === null ) loader = this.textureLoader;
460
+
461
+ const loaderPath = loader.path;
462
+
463
+ if ( ! loaderPath ) {
464
+
465
+ loader.setPath( this.textureLoader.path );
466
+
467
+ }
468
+
469
+ const children = connections.get( textureNode.id ).children;
470
+
471
+ let fileName;
472
+
473
+ if ( children !== undefined && children.length > 0 && images[ children[ 0 ].ID ] !== undefined ) {
474
+
475
+ fileName = images[ children[ 0 ].ID ];
476
+
477
+ if ( fileName.indexOf( 'blob:' ) === 0 || fileName.indexOf( 'data:' ) === 0 ) {
478
+
479
+ loader.setPath( undefined );
480
+
481
+ }
482
+
483
+ }
484
+
485
+ if ( fileName === undefined ) {
486
+
487
+ console.warn( 'FBXLoader: Undefined filename, creating placeholder texture.' );
488
+ return new Texture();
489
+
490
+ }
491
+
492
+ const texture = loader.load( fileName );
493
+
494
+ // revert to initial path
495
+ loader.setPath( loaderPath );
496
+
497
+ return texture;
498
+
499
+ }
500
+
501
+ // Parse nodes in FBXTree.Objects.Material
502
+ parseMaterials( textureMap ) {
503
+
504
+ const materialMap = new Map();
505
+
506
+ if ( 'Material' in fbxTree.Objects ) {
507
+
508
+ const materialNodes = fbxTree.Objects.Material;
509
+
510
+ for ( const nodeID in materialNodes ) {
511
+
512
+ const material = this.parseMaterial( materialNodes[ nodeID ], textureMap );
513
+
514
+ if ( material !== null ) materialMap.set( parseInt( nodeID ), material );
515
+
516
+ }
517
+
518
+ }
519
+
520
+ return materialMap;
521
+
522
+ }
523
+
524
+ // Parse single node in FBXTree.Objects.Material
525
+ // Materials are connected to texture maps in FBXTree.Objects.Textures
526
+ // FBX format currently only supports Lambert and Phong shading models
527
+ parseMaterial( materialNode, textureMap ) {
528
+
529
+ const ID = materialNode.id;
530
+ const name = materialNode.attrName;
531
+ let type = materialNode.ShadingModel;
532
+
533
+ // Case where FBX wraps shading model in property object.
534
+ if ( typeof type === 'object' ) {
535
+
536
+ type = type.value;
537
+
538
+ }
539
+
540
+ // Ignore unused materials which don't have any connections.
541
+ if ( ! connections.has( ID ) ) return null;
542
+
543
+ const parameters = this.parseParameters( materialNode, textureMap, ID );
544
+
545
+ let material;
546
+
547
+ switch ( type.toLowerCase() ) {
548
+
549
+ case 'phong':
550
+ material = new MeshPhongMaterial();
551
+ break;
552
+ case 'lambert':
553
+ material = new MeshLambertMaterial();
554
+ break;
555
+ default:
556
+ console.warn( 'THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.', type );
557
+ material = new MeshPhongMaterial();
558
+ break;
559
+
560
+ }
561
+
562
+ material.setValues( parameters );
563
+ material.name = name;
564
+
565
+ return material;
566
+
567
+ }
568
+
569
+ // Parse FBX material and return parameters suitable for a three.js material
570
+ // Also parse the texture map and return any textures associated with the material
571
+ parseParameters( materialNode, textureMap, ID ) {
572
+
573
+ const parameters = {};
574
+
575
+ if ( materialNode.BumpFactor ) {
576
+
577
+ parameters.bumpScale = materialNode.BumpFactor.value;
578
+
579
+ }
580
+
581
+ if ( materialNode.Diffuse ) {
582
+
583
+ parameters.color = ColorManagement.colorSpaceToWorking( new Color().fromArray( materialNode.Diffuse.value ), SRGBColorSpace );
584
+
585
+ } else if ( materialNode.DiffuseColor && ( materialNode.DiffuseColor.type === 'Color' || materialNode.DiffuseColor.type === 'ColorRGB' ) ) {
586
+
587
+ // The blender exporter exports diffuse here instead of in materialNode.Diffuse
588
+ parameters.color = ColorManagement.colorSpaceToWorking( new Color().fromArray( materialNode.DiffuseColor.value ), SRGBColorSpace );
589
+
590
+ }
591
+
592
+ if ( materialNode.DisplacementFactor ) {
593
+
594
+ parameters.displacementScale = materialNode.DisplacementFactor.value;
595
+
596
+ }
597
+
598
+ if ( materialNode.Emissive ) {
599
+
600
+ parameters.emissive = ColorManagement.colorSpaceToWorking( new Color().fromArray( materialNode.Emissive.value ), SRGBColorSpace );
601
+
602
+ } else if ( materialNode.EmissiveColor && ( materialNode.EmissiveColor.type === 'Color' || materialNode.EmissiveColor.type === 'ColorRGB' ) ) {
603
+
604
+ // The blender exporter exports emissive color here instead of in materialNode.Emissive
605
+ parameters.emissive = ColorManagement.colorSpaceToWorking( new Color().fromArray( materialNode.EmissiveColor.value ), SRGBColorSpace );
606
+
607
+ }
608
+
609
+ if ( materialNode.EmissiveFactor ) {
610
+
611
+ parameters.emissiveIntensity = parseFloat( materialNode.EmissiveFactor.value );
612
+
613
+ }
614
+
615
+ // the transparency handling is implemented based on Blender's approach:
616
+ // https://github.com/blender/blender/blob/main/scripts/addons_core/io_scene_fbx/import_fbx.py
617
+
618
+ parameters.opacity = 1 - ( materialNode.TransparencyFactor ? parseFloat( materialNode.TransparencyFactor.value ) : 0 );
619
+
620
+ if ( parameters.opacity === 1 || parameters.opacity === 0 ) {
621
+
622
+ parameters.opacity = ( materialNode.Opacity ? parseFloat( materialNode.Opacity.value ) : null );
623
+
624
+ if ( parameters.opacity === null ) {
625
+
626
+ // Default to opaque. Some exporters (e.g. 3ds Max) define TransparentColor
627
+ // as white (1,1,1) without intending transparency, which makes the Unity-style
628
+ // fallback of `1 - TransparentColor.r` produce incorrect zero opacity.
629
+ parameters.opacity = 1;
630
+
631
+ }
632
+
633
+ }
634
+
635
+ if ( parameters.opacity < 1.0 ) {
636
+
637
+ parameters.transparent = true;
638
+
639
+ }
640
+
641
+ if ( materialNode.ReflectionFactor ) {
642
+
643
+ parameters.reflectivity = materialNode.ReflectionFactor.value;
644
+
645
+ }
646
+
647
+ if ( materialNode.Shininess ) {
648
+
649
+ parameters.shininess = materialNode.Shininess.value;
650
+
651
+ }
652
+
653
+ if ( materialNode.Specular ) {
654
+
655
+ parameters.specular = ColorManagement.colorSpaceToWorking( new Color().fromArray( materialNode.Specular.value ), SRGBColorSpace );
656
+
657
+ } else if ( materialNode.SpecularColor && materialNode.SpecularColor.type === 'Color' ) {
658
+
659
+ // The blender exporter exports specular color here instead of in materialNode.Specular
660
+ parameters.specular = ColorManagement.colorSpaceToWorking( new Color().fromArray( materialNode.SpecularColor.value ), SRGBColorSpace );
661
+
662
+ }
663
+
664
+ const scope = this;
665
+ connections.get( ID ).children.forEach( function ( child ) {
666
+
667
+ const type = child.relationship;
668
+
669
+ switch ( type ) {
670
+
671
+ case 'Bump':
672
+ parameters.bumpMap = scope.getTexture( textureMap, child.ID );
673
+ break;
674
+
675
+ case 'Maya|TEX_ao_map':
676
+ parameters.aoMap = scope.getTexture( textureMap, child.ID );
677
+ break;
678
+
679
+ case 'DiffuseColor':
680
+ case 'Maya|TEX_color_map':
681
+ parameters.map = scope.getTexture( textureMap, child.ID );
682
+ if ( parameters.map !== undefined ) {
683
+
684
+ parameters.map.colorSpace = SRGBColorSpace;
685
+
686
+ }
687
+
688
+ break;
689
+
690
+ case 'DisplacementColor':
691
+ parameters.displacementMap = scope.getTexture( textureMap, child.ID );
692
+ break;
693
+
694
+ case 'EmissiveColor':
695
+ parameters.emissiveMap = scope.getTexture( textureMap, child.ID );
696
+ if ( parameters.emissiveMap !== undefined ) {
697
+
698
+ parameters.emissiveMap.colorSpace = SRGBColorSpace;
699
+
700
+ }
701
+
702
+ break;
703
+
704
+ case 'NormalMap':
705
+ case 'Maya|TEX_normal_map':
706
+ parameters.normalMap = scope.getTexture( textureMap, child.ID );
707
+ break;
708
+
709
+ case 'ReflectionColor':
710
+ parameters.envMap = scope.getTexture( textureMap, child.ID );
711
+ if ( parameters.envMap !== undefined ) {
712
+
713
+ parameters.envMap.mapping = EquirectangularReflectionMapping;
714
+ parameters.envMap.colorSpace = SRGBColorSpace;
715
+
716
+ }
717
+
718
+ break;
719
+
720
+ case 'SpecularColor':
721
+ parameters.specularMap = scope.getTexture( textureMap, child.ID );
722
+ if ( parameters.specularMap !== undefined ) {
723
+
724
+ parameters.specularMap.colorSpace = SRGBColorSpace;
725
+
726
+ }
727
+
728
+ break;
729
+
730
+ case 'TransparentColor':
731
+ case 'TransparencyFactor':
732
+ parameters.alphaMap = scope.getTexture( textureMap, child.ID );
733
+ parameters.transparent = true;
734
+ break;
735
+
736
+ case 'AmbientColor':
737
+ case 'ShininessExponent': // AKA glossiness map
738
+ case 'SpecularFactor': // AKA specularLevel
739
+ case 'VectorDisplacementColor': // NOTE: Seems to be a copy of DisplacementColor
740
+ default:
741
+ console.warn( 'THREE.FBXLoader: %s map is not supported in three.js, skipping texture.', type );
742
+ break;
743
+
744
+ }
745
+
746
+ } );
747
+
748
+ return parameters;
749
+
750
+ }
751
+
752
+ // get a texture from the textureMap for use by a material.
753
+ getTexture( textureMap, id ) {
754
+
755
+ // if the texture is a layered texture, just use the first layer and issue a warning
756
+ if ( 'LayeredTexture' in fbxTree.Objects && id in fbxTree.Objects.LayeredTexture ) {
757
+
758
+ console.warn( 'THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer.' );
759
+ id = connections.get( id ).children[ 0 ].ID;
760
+
761
+ }
762
+
763
+ return textureMap.get( id );
764
+
765
+ }
766
+
767
+ // Parse nodes in FBXTree.Objects.Deformer
768
+ // Deformer node can contain skinning or Vertex Cache animation data, however only skinning is supported here
769
+ // Generates map of Skeleton-like objects for use later when generating and binding skeletons.
770
+ parseDeformers() {
771
+
772
+ const skeletons = {};
773
+ const morphTargets = {};
774
+
775
+ if ( 'Deformer' in fbxTree.Objects ) {
776
+
777
+ const DeformerNodes = fbxTree.Objects.Deformer;
778
+
779
+ for ( const nodeID in DeformerNodes ) {
780
+
781
+ const deformerNode = DeformerNodes[ nodeID ];
782
+
783
+ const relationships = connections.get( parseInt( nodeID ) );
784
+
785
+ if ( deformerNode.attrType === 'Skin' ) {
786
+
787
+ const skeleton = this.parseSkeleton( relationships, DeformerNodes );
788
+ skeleton.ID = nodeID;
789
+
790
+ if ( relationships.parents.length > 1 ) console.warn( 'THREE.FBXLoader: skeleton attached to more than one geometry is not supported.' );
791
+ skeleton.geometryID = relationships.parents[ 0 ].ID;
792
+
793
+ skeletons[ nodeID ] = skeleton;
794
+
795
+ } else if ( deformerNode.attrType === 'BlendShape' ) {
796
+
797
+ const morphTarget = {
798
+ id: nodeID,
799
+ };
800
+
801
+ morphTarget.rawTargets = this.parseMorphTargets( relationships, DeformerNodes );
802
+ morphTarget.id = nodeID;
803
+
804
+ if ( relationships.parents.length > 1 ) console.warn( 'THREE.FBXLoader: morph target attached to more than one geometry is not supported.' );
805
+
806
+ morphTargets[ nodeID ] = morphTarget;
807
+
808
+ }
809
+
810
+ }
811
+
812
+ }
813
+
814
+ return {
815
+
816
+ skeletons: skeletons,
817
+ morphTargets: morphTargets,
818
+
819
+ };
820
+
821
+ }
822
+
823
+ // Parse single nodes in FBXTree.Objects.Deformer
824
+ // The top level skeleton node has type 'Skin' and sub nodes have type 'Cluster'
825
+ // Each skin node represents a skeleton and each cluster node represents a bone
826
+ parseSkeleton( relationships, deformerNodes ) {
827
+
828
+ const rawBones = [];
829
+
830
+ relationships.children.forEach( function ( child ) {
831
+
832
+ const boneNode = deformerNodes[ child.ID ];
833
+
834
+ if ( boneNode.attrType !== 'Cluster' ) return;
835
+
836
+ const rawBone = {
837
+
838
+ ID: child.ID,
839
+ indices: [],
840
+ weights: [],
841
+ transformLink: new Matrix4().fromArray( boneNode.TransformLink.a ),
842
+
843
+ };
844
+
845
+ if ( 'Indexes' in boneNode ) {
846
+
847
+ rawBone.indices = boneNode.Indexes.a;
848
+ rawBone.weights = boneNode.Weights.a;
849
+
850
+ }
851
+
852
+ rawBones.push( rawBone );
853
+
854
+ } );
855
+
856
+ return {
857
+
858
+ rawBones: rawBones,
859
+ bones: []
860
+
861
+ };
862
+
863
+ }
864
+
865
+ // The top level morph deformer node has type "BlendShape" and sub nodes have type "BlendShapeChannel"
866
+ parseMorphTargets( relationships, deformerNodes ) {
867
+
868
+ const rawMorphTargets = [];
869
+
870
+ for ( let i = 0; i < relationships.children.length; i ++ ) {
871
+
872
+ const child = relationships.children[ i ];
873
+
874
+ const morphTargetNode = deformerNodes[ child.ID ];
875
+
876
+ const rawMorphTarget = {
877
+
878
+ name: morphTargetNode.attrName,
879
+ initialWeight: morphTargetNode.DeformPercent,
880
+ id: morphTargetNode.id,
881
+ fullWeights: morphTargetNode.FullWeights.a
882
+
883
+ };
884
+
885
+ if ( morphTargetNode.attrType !== 'BlendShapeChannel' ) return;
886
+
887
+ rawMorphTarget.geoID = connections.get( parseInt( child.ID ) ).children.filter( function ( child ) {
888
+
889
+ return child.relationship === undefined;
890
+
891
+ } )[ 0 ].ID;
892
+
893
+ rawMorphTargets.push( rawMorphTarget );
894
+
895
+ }
896
+
897
+ return rawMorphTargets;
898
+
899
+ }
900
+
901
+ // create the main Group() to be returned by the loader
902
+ parseScene( deformers, geometryMap, materialMap ) {
903
+
904
+ sceneGraph = new Group();
905
+
906
+ const modelMap = this.parseModels( deformers.skeletons, geometryMap, materialMap );
907
+
908
+ const modelNodes = fbxTree.Objects.Model;
909
+
910
+ const scope = this;
911
+ modelMap.forEach( function ( model ) {
912
+
913
+ const modelNode = modelNodes[ model.ID ];
914
+ scope.setLookAtProperties( model, modelNode );
915
+
916
+ const parentConnections = connections.get( model.ID ).parents;
917
+
918
+ parentConnections.forEach( function ( connection ) {
919
+
920
+ const parent = modelMap.get( connection.ID );
921
+ if ( parent !== undefined ) parent.add( model );
922
+
923
+ } );
924
+
925
+ if ( model.parent === null ) {
926
+
927
+ sceneGraph.add( model );
928
+
929
+ }
930
+
931
+
932
+ } );
933
+
934
+ this.addGlobalSceneSettings();
935
+
936
+ sceneGraph.traverse( function ( node ) {
937
+
938
+ if ( node.userData.transformData ) {
939
+
940
+ if ( node.parent ) {
941
+
942
+ node.userData.transformData.parentMatrix = node.parent.matrix;
943
+ node.userData.transformData.parentMatrixWorld = node.parent.matrixWorld;
944
+
945
+ }
946
+
947
+ const transform = generateTransform( node.userData.transformData );
948
+
949
+ node.applyMatrix4( transform );
950
+ node.updateWorldMatrix();
951
+
952
+ }
953
+
954
+ } );
955
+
956
+ // Like Blender's FBX importer, use the BindPose section to set the
957
+ // rest pose for bones that are not part of a skin cluster. The BindPose
958
+ // provides a more authoritative rest pose than the Lcl properties which
959
+ // may represent an animation frame rather than the true rest state.
960
+ // Bones WITH clusters will get their bind pose from TransformLink
961
+ // (set via bindSkeleton below), which takes priority.
962
+ const bindPoseMatrices = this.parsePoseNodes();
963
+ const clusterBoneIDs = new Set();
964
+
965
+ for ( const ID in deformers.skeletons ) {
966
+
967
+ deformers.skeletons[ ID ].rawBones.forEach( function ( _, i ) {
968
+
969
+ const bone = deformers.skeletons[ ID ].bones[ i ];
970
+ if ( bone ) clusterBoneIDs.add( bone.ID );
971
+
972
+ } );
973
+
974
+ }
975
+
976
+ const tempMatrix = new Matrix4();
977
+
978
+ sceneGraph.traverse( function ( node ) {
979
+
980
+ if ( node.isBone && node.ID !== undefined && ! clusterBoneIDs.has( node.ID ) ) {
981
+
982
+ const bindPose = bindPoseMatrices[ node.ID ];
983
+
984
+ if ( bindPose !== undefined ) {
985
+
986
+ if ( node.parent ) {
987
+
988
+ tempMatrix.copy( node.parent.matrixWorld ).invert();
989
+ tempMatrix.multiply( bindPose );
990
+
991
+ } else {
992
+
993
+ tempMatrix.copy( bindPose );
994
+
995
+ }
996
+
997
+ tempMatrix.decompose( node.position, node.quaternion, node.scale );
998
+ node.updateMatrix();
999
+ node.matrixWorld.copy( bindPose );
1000
+
1001
+ }
1002
+
1003
+ }
1004
+
1005
+ } );
1006
+
1007
+ // Bind skeletons after transforms are applied so that bind matrices
1008
+ // are computed from the final scene state. This ensures the rest pose
1009
+ // is correct even when the FBX file's Cluster TransformLink matrices
1010
+ // differ from the reconstructed bone transforms (common in files
1011
+ // without a BindPose section).
1012
+ this.bindSkeleton( deformers.skeletons, geometryMap, modelMap );
1013
+
1014
+ const animations = new AnimationParser( this.trimAnimationClips ).parse();
1015
+
1016
+ // if all the models where already combined in a single group, just return that
1017
+ if ( sceneGraph.children.length === 1 && sceneGraph.children[ 0 ].isGroup ) {
1018
+
1019
+ sceneGraph.children[ 0 ].animations = animations;
1020
+ Object.assign( sceneGraph.children[ 0 ].userData, sceneGraph.userData );
1021
+ sceneGraph = sceneGraph.children[ 0 ];
1022
+
1023
+ }
1024
+
1025
+ sceneGraph.animations = animations;
1026
+
1027
+ // Apply coordinate system correction. FBX files can use different
1028
+ // up-axis conventions (Y-up or Z-up). Three.js uses Y-up, so rotate
1029
+ // the scene when the file uses Z-up (UpAxis === 2).
1030
+
1031
+ if ( 'GlobalSettings' in fbxTree && 'UpAxis' in fbxTree.GlobalSettings ) {
1032
+
1033
+ const upAxis = fbxTree.GlobalSettings.UpAxis.value;
1034
+
1035
+ if ( upAxis === 2 ) {
1036
+
1037
+ console.warn( 'THREE.FBXLoader: You are loading an asset with a Z-UP coordinate system. The loader just rotates the asset to transform it into Y-UP. The vertex data are not converted.' );
1038
+
1039
+ sceneGraph.rotation.set( - Math.PI / 2, 0, 0 );
1040
+
1041
+ }
1042
+
1043
+ }
1044
+
1045
+ }
1046
+
1047
+ // parse nodes in FBXTree.Objects.Model
1048
+ parseModels( skeletons, geometryMap, materialMap ) {
1049
+
1050
+ const modelMap = new Map();
1051
+ const modelNodes = fbxTree.Objects.Model;
1052
+
1053
+ for ( const nodeID in modelNodes ) {
1054
+
1055
+ const id = parseInt( nodeID );
1056
+ const node = modelNodes[ nodeID ];
1057
+ const relationships = connections.get( id );
1058
+
1059
+ let model = this.buildSkeleton( relationships, skeletons, id, node.attrName );
1060
+
1061
+ if ( ! model ) {
1062
+
1063
+ switch ( node.attrType ) {
1064
+
1065
+ case 'Camera':
1066
+ model = this.createCamera( relationships );
1067
+ break;
1068
+ case 'Light':
1069
+ model = this.createLight( relationships );
1070
+ break;
1071
+ case 'Mesh':
1072
+ model = this.createMesh( relationships, geometryMap, materialMap );
1073
+ break;
1074
+ case 'NurbsCurve':
1075
+ model = this.createCurve( relationships, geometryMap );
1076
+ break;
1077
+ case 'LimbNode':
1078
+ case 'Root':
1079
+ model = new Bone();
1080
+ break;
1081
+ case 'Null':
1082
+ default:
1083
+ model = new Group();
1084
+ break;
1085
+
1086
+ }
1087
+
1088
+ model.name = node.attrName ? PropertyBinding.sanitizeNodeName( node.attrName ) : '';
1089
+ model.userData.originalName = node.attrName;
1090
+
1091
+ model.ID = id;
1092
+
1093
+ }
1094
+
1095
+ this.getTransformData( model, node );
1096
+ modelMap.set( id, model );
1097
+
1098
+ }
1099
+
1100
+ return modelMap;
1101
+
1102
+ }
1103
+
1104
+ buildSkeleton( relationships, skeletons, id, name ) {
1105
+
1106
+ let bone = null;
1107
+
1108
+ relationships.parents.forEach( function ( parent ) {
1109
+
1110
+ for ( const ID in skeletons ) {
1111
+
1112
+ const skeleton = skeletons[ ID ];
1113
+
1114
+ skeleton.rawBones.forEach( function ( rawBone, i ) {
1115
+
1116
+ if ( rawBone.ID === parent.ID ) {
1117
+
1118
+ const subBone = bone;
1119
+ bone = new Bone();
1120
+
1121
+ bone.matrixWorld.copy( rawBone.transformLink );
1122
+
1123
+ // set name and id here - otherwise in cases where "subBone" is created it will not have a name / id
1124
+
1125
+ bone.name = name ? PropertyBinding.sanitizeNodeName( name ) : '';
1126
+ bone.userData.originalName = name;
1127
+ bone.ID = id;
1128
+
1129
+ skeleton.bones[ i ] = bone;
1130
+
1131
+ // In cases where a bone is shared between multiple meshes
1132
+ // duplicate the bone here and add it as a child of the first bone
1133
+ if ( subBone !== null ) {
1134
+
1135
+ bone.add( subBone );
1136
+
1137
+ }
1138
+
1139
+ }
1140
+
1141
+ } );
1142
+
1143
+ }
1144
+
1145
+ } );
1146
+
1147
+ return bone;
1148
+
1149
+ }
1150
+
1151
+ // create a PerspectiveCamera or OrthographicCamera
1152
+ createCamera( relationships ) {
1153
+
1154
+ let model;
1155
+ let cameraAttribute;
1156
+
1157
+ relationships.children.forEach( function ( child ) {
1158
+
1159
+ const attr = fbxTree.Objects.NodeAttribute[ child.ID ];
1160
+
1161
+ if ( attr !== undefined ) {
1162
+
1163
+ cameraAttribute = attr;
1164
+
1165
+ }
1166
+
1167
+ } );
1168
+
1169
+ if ( cameraAttribute === undefined ) {
1170
+
1171
+ model = new Object3D();
1172
+
1173
+ } else {
1174
+
1175
+ let type = 0;
1176
+ if ( cameraAttribute.CameraProjectionType !== undefined && cameraAttribute.CameraProjectionType.value === 1 ) {
1177
+
1178
+ type = 1;
1179
+
1180
+ }
1181
+
1182
+ let nearClippingPlane = 1;
1183
+ if ( cameraAttribute.NearPlane !== undefined ) {
1184
+
1185
+ nearClippingPlane = cameraAttribute.NearPlane.value / 1000;
1186
+
1187
+ }
1188
+
1189
+ let farClippingPlane = 1000;
1190
+ if ( cameraAttribute.FarPlane !== undefined ) {
1191
+
1192
+ farClippingPlane = cameraAttribute.FarPlane.value / 1000;
1193
+
1194
+ }
1195
+
1196
+
1197
+ let width = window.innerWidth;
1198
+ let height = window.innerHeight;
1199
+
1200
+ if ( cameraAttribute.AspectWidth !== undefined && cameraAttribute.AspectHeight !== undefined ) {
1201
+
1202
+ width = cameraAttribute.AspectWidth.value;
1203
+ height = cameraAttribute.AspectHeight.value;
1204
+
1205
+ }
1206
+
1207
+ const aspect = width / height;
1208
+
1209
+ let fov = 45;
1210
+ if ( cameraAttribute.FieldOfView !== undefined ) {
1211
+
1212
+ fov = cameraAttribute.FieldOfView.value;
1213
+
1214
+ }
1215
+
1216
+ const focalLength = cameraAttribute.FocalLength ? cameraAttribute.FocalLength.value : null;
1217
+
1218
+ switch ( type ) {
1219
+
1220
+ case 0: // Perspective
1221
+ model = new PerspectiveCamera( fov, aspect, nearClippingPlane, farClippingPlane );
1222
+ if ( focalLength !== null ) model.setFocalLength( focalLength );
1223
+ break;
1224
+
1225
+ case 1: // Orthographic
1226
+ console.warn( 'THREE.FBXLoader: Orthographic cameras not supported yet.' );
1227
+ model = new Object3D();
1228
+ break;
1229
+
1230
+ default:
1231
+ console.warn( 'THREE.FBXLoader: Unknown camera type ' + type + '.' );
1232
+ model = new Object3D();
1233
+ break;
1234
+
1235
+ }
1236
+
1237
+ }
1238
+
1239
+ return model;
1240
+
1241
+ }
1242
+
1243
+ // Create a DirectionalLight, PointLight or SpotLight
1244
+ createLight( relationships ) {
1245
+
1246
+ let model;
1247
+ let lightAttribute;
1248
+
1249
+ relationships.children.forEach( function ( child ) {
1250
+
1251
+ const attr = fbxTree.Objects.NodeAttribute[ child.ID ];
1252
+
1253
+ if ( attr !== undefined ) {
1254
+
1255
+ lightAttribute = attr;
1256
+
1257
+ }
1258
+
1259
+ } );
1260
+
1261
+ if ( lightAttribute === undefined ) {
1262
+
1263
+ model = new Object3D();
1264
+
1265
+ } else {
1266
+
1267
+ let type;
1268
+
1269
+ // LightType can be undefined for Point lights
1270
+ if ( lightAttribute.LightType === undefined ) {
1271
+
1272
+ type = 0;
1273
+
1274
+ } else {
1275
+
1276
+ type = lightAttribute.LightType.value;
1277
+
1278
+ }
1279
+
1280
+ let color = 0xffffff;
1281
+
1282
+ if ( lightAttribute.Color !== undefined ) {
1283
+
1284
+ color = ColorManagement.colorSpaceToWorking( new Color().fromArray( lightAttribute.Color.value ), SRGBColorSpace );
1285
+
1286
+ }
1287
+
1288
+ let intensity = ( lightAttribute.Intensity === undefined ) ? 1 : lightAttribute.Intensity.value / 100;
1289
+
1290
+ // light disabled
1291
+ if ( lightAttribute.CastLightOnObject !== undefined && lightAttribute.CastLightOnObject.value === 0 ) {
1292
+
1293
+ intensity = 0;
1294
+
1295
+ }
1296
+
1297
+ let distance = 0;
1298
+ if ( lightAttribute.FarAttenuationEnd !== undefined ) {
1299
+
1300
+ if ( lightAttribute.EnableFarAttenuation !== undefined && lightAttribute.EnableFarAttenuation.value === 0 ) {
1301
+
1302
+ distance = 0;
1303
+
1304
+ } else {
1305
+
1306
+ distance = lightAttribute.FarAttenuationEnd.value;
1307
+
1308
+ }
1309
+
1310
+ }
1311
+
1312
+ // TODO: could this be calculated linearly from FarAttenuationStart to FarAttenuationEnd?
1313
+ const decay = 1;
1314
+
1315
+ switch ( type ) {
1316
+
1317
+ case 0: // Point
1318
+ model = new PointLight( color, intensity, distance, decay );
1319
+ break;
1320
+
1321
+ case 1: // Directional
1322
+ model = new DirectionalLight( color, intensity );
1323
+ break;
1324
+
1325
+ case 2: // Spot
1326
+ let angle = Math.PI / 3;
1327
+ let penumbra = 0;
1328
+
1329
+ if ( lightAttribute.OuterAngle !== undefined ) {
1330
+
1331
+ angle = MathUtils.degToRad( lightAttribute.OuterAngle.value );
1332
+
1333
+ if ( lightAttribute.InnerAngle !== undefined ) {
1334
+
1335
+ penumbra = 1 - ( lightAttribute.InnerAngle.value / lightAttribute.OuterAngle.value );
1336
+ penumbra = Math.max( 0, penumbra ); // penumbra must be in the range [0,1]
1337
+
1338
+ }
1339
+
1340
+ } else if ( lightAttribute.InnerAngle !== undefined ) {
1341
+
1342
+ // fallback if only InnerAngle is defined
1343
+
1344
+ angle = MathUtils.degToRad( lightAttribute.InnerAngle.value );
1345
+
1346
+ }
1347
+
1348
+ model = new SpotLight( color, intensity, distance, angle, penumbra, decay );
1349
+ break;
1350
+
1351
+ default:
1352
+ console.warn( 'THREE.FBXLoader: Unknown light type ' + lightAttribute.LightType.value + ', defaulting to a PointLight.' );
1353
+ model = new PointLight( color, intensity );
1354
+ break;
1355
+
1356
+ }
1357
+
1358
+ if ( lightAttribute.CastShadows !== undefined && lightAttribute.CastShadows.value === 1 ) {
1359
+
1360
+ model.castShadow = true;
1361
+
1362
+ }
1363
+
1364
+ }
1365
+
1366
+ return model;
1367
+
1368
+ }
1369
+
1370
+ createMesh( relationships, geometryMap, materialMap ) {
1371
+
1372
+ let model;
1373
+ let geometry = null;
1374
+ let material = null;
1375
+ const materials = [];
1376
+
1377
+ // get geometry and materials(s) from connections
1378
+ relationships.children.forEach( function ( child ) {
1379
+
1380
+ if ( geometryMap.has( child.ID ) ) {
1381
+
1382
+ geometry = geometryMap.get( child.ID );
1383
+
1384
+ }
1385
+
1386
+ if ( materialMap.has( child.ID ) ) {
1387
+
1388
+ materials.push( materialMap.get( child.ID ) );
1389
+
1390
+ }
1391
+
1392
+ } );
1393
+
1394
+ if ( materials.length > 1 ) {
1395
+
1396
+ material = materials;
1397
+
1398
+ } else if ( materials.length > 0 ) {
1399
+
1400
+ material = materials[ 0 ];
1401
+
1402
+ } else {
1403
+
1404
+ material = new MeshPhongMaterial( {
1405
+ name: Loader.DEFAULT_MATERIAL_NAME,
1406
+ color: 0xcccccc
1407
+ } );
1408
+ materials.push( material );
1409
+
1410
+ }
1411
+
1412
+ if ( 'color' in geometry.attributes ) {
1413
+
1414
+ materials.forEach( function ( material ) {
1415
+
1416
+ material.vertexColors = true;
1417
+
1418
+ } );
1419
+
1420
+ }
1421
+
1422
+ // Sanitization: If geometry has groups, then it must match the provided material array.
1423
+ // If not, we need to clean up the `group.materialIndex` properties inside the groups and point at a (new) default material.
1424
+ // This isn't well defined; Unity creates default material, while Blender implicitly uses the previous material in the list.
1425
+ if ( geometry.groups.length > 0 ) {
1426
+
1427
+ let needsDefaultMaterial = false;
1428
+
1429
+ for ( let i = 0, il = geometry.groups.length; i < il; i ++ ) {
1430
+
1431
+ const group = geometry.groups[ i ];
1432
+
1433
+ if ( group.materialIndex < 0 || group.materialIndex >= materials.length ) {
1434
+
1435
+ group.materialIndex = materials.length;
1436
+ needsDefaultMaterial = true;
1437
+
1438
+ }
1439
+
1440
+ }
1441
+
1442
+ if ( needsDefaultMaterial ) {
1443
+
1444
+ const defaultMaterial = new MeshPhongMaterial();
1445
+ materials.push( defaultMaterial );
1446
+
1447
+ }
1448
+
1449
+ }
1450
+
1451
+ if ( geometry.FBX_Deformer ) {
1452
+
1453
+ model = new SkinnedMesh( geometry, material );
1454
+ model.normalizeSkinWeights();
1455
+
1456
+ } else {
1457
+
1458
+ model = new Mesh( geometry, material );
1459
+
1460
+ }
1461
+
1462
+ return model;
1463
+
1464
+ }
1465
+
1466
+ createCurve( relationships, geometryMap ) {
1467
+
1468
+ const geometry = relationships.children.reduce( function ( geo, child ) {
1469
+
1470
+ if ( geometryMap.has( child.ID ) ) geo = geometryMap.get( child.ID );
1471
+
1472
+ return geo;
1473
+
1474
+ }, null );
1475
+
1476
+ // FBX does not list materials for Nurbs lines, so we'll just put our own in here.
1477
+ const material = new LineBasicMaterial( {
1478
+ name: Loader.DEFAULT_MATERIAL_NAME,
1479
+ color: 0x3300ff,
1480
+ linewidth: 1
1481
+ } );
1482
+ return new Line( geometry, material );
1483
+
1484
+ }
1485
+
1486
+ // parse the model node for transform data
1487
+ getTransformData( model, modelNode ) {
1488
+
1489
+ const transformData = {};
1490
+
1491
+ if ( 'InheritType' in modelNode ) transformData.inheritType = parseInt( modelNode.InheritType.value );
1492
+
1493
+ if ( 'RotationOrder' in modelNode ) transformData.eulerOrder = getEulerOrder( modelNode.RotationOrder.value );
1494
+ else transformData.eulerOrder = getEulerOrder( 0 );
1495
+
1496
+ if ( 'Lcl_Translation' in modelNode ) transformData.translation = modelNode.Lcl_Translation.value;
1497
+
1498
+ if ( 'PreRotation' in modelNode ) transformData.preRotation = modelNode.PreRotation.value;
1499
+ if ( 'Lcl_Rotation' in modelNode ) transformData.rotation = modelNode.Lcl_Rotation.value;
1500
+ if ( 'PostRotation' in modelNode ) transformData.postRotation = modelNode.PostRotation.value;
1501
+
1502
+ if ( 'Lcl_Scaling' in modelNode ) transformData.scale = modelNode.Lcl_Scaling.value;
1503
+
1504
+ if ( 'ScalingOffset' in modelNode ) transformData.scalingOffset = modelNode.ScalingOffset.value;
1505
+ if ( 'ScalingPivot' in modelNode ) transformData.scalingPivot = modelNode.ScalingPivot.value;
1506
+
1507
+ if ( 'RotationOffset' in modelNode ) transformData.rotationOffset = modelNode.RotationOffset.value;
1508
+ if ( 'RotationPivot' in modelNode ) transformData.rotationPivot = modelNode.RotationPivot.value;
1509
+
1510
+ model.userData.transformData = transformData;
1511
+
1512
+ }
1513
+
1514
+ setLookAtProperties( model, modelNode ) {
1515
+
1516
+ if ( 'LookAtProperty' in modelNode ) {
1517
+
1518
+ const children = connections.get( model.ID ).children;
1519
+
1520
+ children.forEach( function ( child ) {
1521
+
1522
+ if ( child.relationship === 'LookAtProperty' ) {
1523
+
1524
+ const lookAtTarget = fbxTree.Objects.Model[ child.ID ];
1525
+
1526
+ if ( 'Lcl_Translation' in lookAtTarget ) {
1527
+
1528
+ const pos = lookAtTarget.Lcl_Translation.value;
1529
+
1530
+ // DirectionalLight, SpotLight
1531
+ if ( model.target !== undefined ) {
1532
+
1533
+ model.target.position.fromArray( pos );
1534
+ sceneGraph.add( model.target );
1535
+
1536
+ } else { // Cameras and other Object3Ds
1537
+
1538
+ model.lookAt( new Vector3().fromArray( pos ) );
1539
+
1540
+ }
1541
+
1542
+ }
1543
+
1544
+ }
1545
+
1546
+ } );
1547
+
1548
+ }
1549
+
1550
+ }
1551
+
1552
+ bindSkeleton( skeletons, geometryMap, modelMap ) {
1553
+
1554
+ for ( const ID in skeletons ) {
1555
+
1556
+ const skeleton = skeletons[ ID ];
1557
+
1558
+ // Compute bone inverses from TransformLink rather than from the
1559
+ // bones' current matrixWorld. The TransformLink matrices represent
1560
+ // each bone's global transform at the time the skin weights were
1561
+ // painted, which may differ from the scene-reconstructed transforms.
1562
+ const boneInverses = [];
1563
+
1564
+ for ( let i = 0, l = skeleton.bones.length; i < l; i ++ ) {
1565
+
1566
+ const inverse = new Matrix4();
1567
+
1568
+ if ( skeleton.bones[ i ] && skeleton.rawBones[ i ] ) {
1569
+
1570
+ inverse.copy( skeleton.rawBones[ i ].transformLink ).invert();
1571
+
1572
+ }
1573
+
1574
+ boneInverses.push( inverse );
1575
+
1576
+ }
1577
+
1578
+ const parents = connections.get( parseInt( skeleton.ID ) ).parents;
1579
+
1580
+ parents.forEach( function ( parent ) {
1581
+
1582
+ if ( geometryMap.has( parent.ID ) ) {
1583
+
1584
+ const geoID = parent.ID;
1585
+ const geoRelationships = connections.get( geoID );
1586
+
1587
+ geoRelationships.parents.forEach( function ( geoConnParent ) {
1588
+
1589
+ if ( modelMap.has( geoConnParent.ID ) ) {
1590
+
1591
+ const model = modelMap.get( geoConnParent.ID );
1592
+
1593
+ // Use the mesh's current matrixWorld as bind matrix.
1594
+ // The BindPose section is intentionally not used here
1595
+ // since it may contain scale/rotation from the model
1596
+ // hierarchy that is inconsistent with the TransformLink-
1597
+ // based bone inverses. Always provide a bind matrix to
1598
+ // prevent bind() from calling calculateInverses() which
1599
+ // would overwrite the bone inverses computed above.
1600
+ model.updateMatrixWorld( true );
1601
+
1602
+ model.bind( new Skeleton( skeleton.bones, boneInverses ), model.matrixWorld );
1603
+
1604
+ }
1605
+
1606
+ } );
1607
+
1608
+ }
1609
+
1610
+ } );
1611
+
1612
+ }
1613
+
1614
+ }
1615
+
1616
+ // Parse BindPose nodes and return a map of node ID to bind matrix.
1617
+ parsePoseNodes() {
1618
+
1619
+ const bindMatrices = {};
1620
+
1621
+ if ( 'Pose' in fbxTree.Objects ) {
1622
+
1623
+ const BindPoseNode = fbxTree.Objects.Pose;
1624
+
1625
+ for ( const nodeID in BindPoseNode ) {
1626
+
1627
+ if ( BindPoseNode[ nodeID ].attrType === 'BindPose' && BindPoseNode[ nodeID ].NbPoseNodes > 0 ) {
1628
+
1629
+ const poseNodes = BindPoseNode[ nodeID ].PoseNode;
1630
+
1631
+ if ( Array.isArray( poseNodes ) ) {
1632
+
1633
+ poseNodes.forEach( function ( poseNode ) {
1634
+
1635
+ bindMatrices[ poseNode.Node ] = new Matrix4().fromArray( poseNode.Matrix.a );
1636
+
1637
+ } );
1638
+
1639
+ } else {
1640
+
1641
+ bindMatrices[ poseNodes.Node ] = new Matrix4().fromArray( poseNodes.Matrix.a );
1642
+
1643
+ }
1644
+
1645
+ }
1646
+
1647
+ }
1648
+
1649
+ }
1650
+
1651
+ return bindMatrices;
1652
+
1653
+ }
1654
+
1655
+ addGlobalSceneSettings() {
1656
+
1657
+ if ( 'GlobalSettings' in fbxTree ) {
1658
+
1659
+ if ( 'AmbientColor' in fbxTree.GlobalSettings ) {
1660
+
1661
+ // Parse ambient color - if it's not set to black (default), create an ambient light
1662
+
1663
+ const ambientColor = fbxTree.GlobalSettings.AmbientColor.value;
1664
+ const r = ambientColor[ 0 ];
1665
+ const g = ambientColor[ 1 ];
1666
+ const b = ambientColor[ 2 ];
1667
+
1668
+ if ( r !== 0 || g !== 0 || b !== 0 ) {
1669
+
1670
+ const color = new Color().setRGB( r, g, b, SRGBColorSpace );
1671
+ sceneGraph.add( new AmbientLight( color, 1 ) );
1672
+
1673
+ }
1674
+
1675
+ }
1676
+
1677
+ if ( 'UnitScaleFactor' in fbxTree.GlobalSettings ) {
1678
+
1679
+ sceneGraph.userData.unitScaleFactor = fbxTree.GlobalSettings.UnitScaleFactor.value;
1680
+
1681
+ }
1682
+
1683
+ }
1684
+
1685
+ }
1686
+
1687
+ }
1688
+
1689
+ // parse Geometry data from FBXTree and return map of BufferGeometries
1690
+ class GeometryParser {
1691
+
1692
+ constructor() {
1693
+
1694
+ this.negativeMaterialIndices = false;
1695
+
1696
+ }
1697
+
1698
+ // Parse nodes in FBXTree.Objects.Geometry
1699
+ parse( deformers ) {
1700
+
1701
+ const geometryMap = new Map();
1702
+
1703
+ if ( 'Geometry' in fbxTree.Objects ) {
1704
+
1705
+ const geoNodes = fbxTree.Objects.Geometry;
1706
+
1707
+ for ( const nodeID in geoNodes ) {
1708
+
1709
+ const relationships = connections.get( parseInt( nodeID ) );
1710
+ const geo = this.parseGeometry( relationships, geoNodes[ nodeID ], deformers );
1711
+
1712
+ geometryMap.set( parseInt( nodeID ), geo );
1713
+
1714
+ }
1715
+
1716
+ }
1717
+
1718
+ // report warnings
1719
+
1720
+ if ( this.negativeMaterialIndices === true ) {
1721
+
1722
+ console.warn( 'THREE.FBXLoader: The FBX file contains invalid (negative) material indices. The asset might not render as expected.' );
1723
+
1724
+ }
1725
+
1726
+ return geometryMap;
1727
+
1728
+ }
1729
+
1730
+ // Parse single node in FBXTree.Objects.Geometry
1731
+ parseGeometry( relationships, geoNode, deformers ) {
1732
+
1733
+ switch ( geoNode.attrType ) {
1734
+
1735
+ case 'Mesh':
1736
+ return this.parseMeshGeometry( relationships, geoNode, deformers );
1737
+
1738
+ case 'NurbsCurve':
1739
+ return this.parseNurbsGeometry( geoNode );
1740
+
1741
+ }
1742
+
1743
+ }
1744
+
1745
+ // Parse single node mesh geometry in FBXTree.Objects.Geometry
1746
+ parseMeshGeometry( relationships, geoNode, deformers ) {
1747
+
1748
+ const skeletons = deformers.skeletons;
1749
+ const morphTargets = [];
1750
+
1751
+ const modelNodes = relationships.parents.map( function ( parent ) {
1752
+
1753
+ return fbxTree.Objects.Model[ parent.ID ];
1754
+
1755
+ } );
1756
+
1757
+ // don't create geometry if it is not associated with any models
1758
+ if ( modelNodes.length === 0 ) return;
1759
+
1760
+ const skeleton = relationships.children.reduce( function ( skeleton, child ) {
1761
+
1762
+ if ( skeletons[ child.ID ] !== undefined ) skeleton = skeletons[ child.ID ];
1763
+
1764
+ return skeleton;
1765
+
1766
+ }, null );
1767
+
1768
+ relationships.children.forEach( function ( child ) {
1769
+
1770
+ if ( deformers.morphTargets[ child.ID ] !== undefined ) {
1771
+
1772
+ morphTargets.push( deformers.morphTargets[ child.ID ] );
1773
+
1774
+ }
1775
+
1776
+ } );
1777
+
1778
+ // Assume one model and get the preRotation from that
1779
+ // if there is more than one model associated with the geometry this may cause problems
1780
+ const modelNode = modelNodes[ 0 ];
1781
+
1782
+ const transformData = {};
1783
+
1784
+ if ( 'RotationOrder' in modelNode ) transformData.eulerOrder = getEulerOrder( modelNode.RotationOrder.value );
1785
+ if ( 'InheritType' in modelNode ) transformData.inheritType = parseInt( modelNode.InheritType.value );
1786
+
1787
+ if ( 'GeometricTranslation' in modelNode ) transformData.translation = modelNode.GeometricTranslation.value;
1788
+ if ( 'GeometricRotation' in modelNode ) transformData.rotation = modelNode.GeometricRotation.value;
1789
+ if ( 'GeometricScaling' in modelNode ) transformData.scale = modelNode.GeometricScaling.value;
1790
+
1791
+ const transform = generateTransform( transformData );
1792
+
1793
+ return this.genGeometry( geoNode, skeleton, morphTargets, transform );
1794
+
1795
+ }
1796
+
1797
+ // Generate a BufferGeometry from a node in FBXTree.Objects.Geometry
1798
+ genGeometry( geoNode, skeleton, morphTargets, preTransform ) {
1799
+
1800
+ const geo = new BufferGeometry();
1801
+ if ( geoNode.attrName ) geo.name = geoNode.attrName;
1802
+
1803
+ const geoInfo = this.parseGeoNode( geoNode, skeleton );
1804
+ const buffers = this.genBuffers( geoInfo );
1805
+
1806
+ const positionAttribute = new Float32BufferAttribute( buffers.vertex, 3 );
1807
+
1808
+ positionAttribute.applyMatrix4( preTransform );
1809
+
1810
+ geo.setAttribute( 'position', positionAttribute );
1811
+
1812
+ if ( buffers.colors.length > 0 ) {
1813
+
1814
+ geo.setAttribute( 'color', new Float32BufferAttribute( buffers.colors, 3 ) );
1815
+
1816
+ }
1817
+
1818
+ if ( skeleton ) {
1819
+
1820
+ geo.setAttribute( 'skinIndex', new Uint16BufferAttribute( buffers.weightsIndices, 4 ) );
1821
+
1822
+ geo.setAttribute( 'skinWeight', new Float32BufferAttribute( buffers.vertexWeights, 4 ) );
1823
+
1824
+ // used later to bind the skeleton to the model
1825
+ geo.FBX_Deformer = skeleton;
1826
+
1827
+ }
1828
+
1829
+ if ( buffers.normal.length > 0 ) {
1830
+
1831
+ const normalMatrix = new Matrix3().getNormalMatrix( preTransform );
1832
+
1833
+ const normalAttribute = new Float32BufferAttribute( buffers.normal, 3 );
1834
+ normalAttribute.applyNormalMatrix( normalMatrix );
1835
+
1836
+ geo.setAttribute( 'normal', normalAttribute );
1837
+
1838
+ }
1839
+
1840
+ buffers.uvs.forEach( function ( uvBuffer, i ) {
1841
+
1842
+ const name = i === 0 ? 'uv' : `uv${ i }`;
1843
+
1844
+ geo.setAttribute( name, new Float32BufferAttribute( buffers.uvs[ i ], 2 ) );
1845
+
1846
+ } );
1847
+
1848
+ if ( geoInfo.material && geoInfo.material.mappingType !== 'AllSame' ) {
1849
+
1850
+ // Convert the material indices of each vertex into rendering groups on the geometry.
1851
+ let prevMaterialIndex = buffers.materialIndex[ 0 ];
1852
+ let startIndex = 0;
1853
+
1854
+ buffers.materialIndex.forEach( function ( currentIndex, i ) {
1855
+
1856
+ if ( currentIndex !== prevMaterialIndex ) {
1857
+
1858
+ geo.addGroup( startIndex, i - startIndex, prevMaterialIndex );
1859
+
1860
+ prevMaterialIndex = currentIndex;
1861
+ startIndex = i;
1862
+
1863
+ }
1864
+
1865
+ } );
1866
+
1867
+ // the loop above doesn't add the last group, do that here.
1868
+ if ( geo.groups.length > 0 ) {
1869
+
1870
+ const lastGroup = geo.groups[ geo.groups.length - 1 ];
1871
+ const lastIndex = lastGroup.start + lastGroup.count;
1872
+
1873
+ if ( lastIndex !== buffers.materialIndex.length ) {
1874
+
1875
+ geo.addGroup( lastIndex, buffers.materialIndex.length - lastIndex, prevMaterialIndex );
1876
+
1877
+ }
1878
+
1879
+ }
1880
+
1881
+ // case where there are multiple materials but the whole geometry is only
1882
+ // using one of them
1883
+ if ( geo.groups.length === 0 ) {
1884
+
1885
+ geo.addGroup( 0, buffers.materialIndex.length, buffers.materialIndex[ 0 ] );
1886
+
1887
+ }
1888
+
1889
+ }
1890
+
1891
+ this.addMorphTargets( geo, geoNode, morphTargets, preTransform );
1892
+
1893
+ return geo;
1894
+
1895
+ }
1896
+
1897
+ parseGeoNode( geoNode, skeleton ) {
1898
+
1899
+ const geoInfo = {};
1900
+
1901
+ geoInfo.vertexPositions = ( geoNode.Vertices !== undefined ) ? geoNode.Vertices.a : [];
1902
+ geoInfo.vertexIndices = ( geoNode.PolygonVertexIndex !== undefined ) ? geoNode.PolygonVertexIndex.a : [];
1903
+
1904
+ if ( geoNode.LayerElementColor && geoNode.LayerElementColor[ 0 ].Colors ) {
1905
+
1906
+ geoInfo.color = this.parseVertexColors( geoNode.LayerElementColor[ 0 ] );
1907
+
1908
+ }
1909
+
1910
+ if ( geoNode.LayerElementMaterial ) {
1911
+
1912
+ geoInfo.material = this.parseMaterialIndices( geoNode.LayerElementMaterial[ 0 ] );
1913
+
1914
+ }
1915
+
1916
+ if ( geoNode.LayerElementNormal ) {
1917
+
1918
+ geoInfo.normal = this.parseNormals( geoNode.LayerElementNormal[ 0 ] );
1919
+
1920
+ }
1921
+
1922
+ if ( geoNode.LayerElementUV ) {
1923
+
1924
+ geoInfo.uv = [];
1925
+
1926
+ let i = 0;
1927
+ while ( geoNode.LayerElementUV[ i ] ) {
1928
+
1929
+ if ( geoNode.LayerElementUV[ i ].UV ) {
1930
+
1931
+ geoInfo.uv.push( this.parseUVs( geoNode.LayerElementUV[ i ] ) );
1932
+
1933
+ }
1934
+
1935
+ i ++;
1936
+
1937
+ }
1938
+
1939
+ }
1940
+
1941
+ geoInfo.weightTable = {};
1942
+
1943
+ if ( skeleton !== null ) {
1944
+
1945
+ geoInfo.skeleton = skeleton;
1946
+
1947
+ skeleton.rawBones.forEach( function ( rawBone, i ) {
1948
+
1949
+ // loop over the bone's vertex indices and weights
1950
+ rawBone.indices.forEach( function ( index, j ) {
1951
+
1952
+ if ( geoInfo.weightTable[ index ] === undefined ) geoInfo.weightTable[ index ] = [];
1953
+
1954
+ geoInfo.weightTable[ index ].push( {
1955
+
1956
+ id: i,
1957
+ weight: rawBone.weights[ j ],
1958
+
1959
+ } );
1960
+
1961
+ } );
1962
+
1963
+ } );
1964
+
1965
+ }
1966
+
1967
+ return geoInfo;
1968
+
1969
+ }
1970
+
1971
+ genBuffers( geoInfo ) {
1972
+
1973
+ const buffers = {
1974
+ vertex: [],
1975
+ normal: [],
1976
+ colors: [],
1977
+ uvs: [],
1978
+ materialIndex: [],
1979
+ vertexWeights: [],
1980
+ weightsIndices: [],
1981
+ };
1982
+
1983
+ let polygonIndex = 0;
1984
+ let faceLength = 0;
1985
+ let displayedWeightsWarning = false;
1986
+
1987
+ // these will hold data for a single face
1988
+ let facePositionIndexes = [];
1989
+ let faceNormals = [];
1990
+ let faceColors = [];
1991
+ let faceUVs = [];
1992
+ let faceWeights = [];
1993
+ let faceWeightIndices = [];
1994
+
1995
+ const scope = this;
1996
+ geoInfo.vertexIndices.forEach( function ( vertexIndex, polygonVertexIndex ) {
1997
+
1998
+ let materialIndex;
1999
+ let endOfFace = false;
2000
+
2001
+ // Face index and vertex index arrays are combined in a single array
2002
+ // A cube with quad faces looks like this:
2003
+ // PolygonVertexIndex: *24 {
2004
+ // a: 0, 1, 3, -3, 2, 3, 5, -5, 4, 5, 7, -7, 6, 7, 1, -1, 1, 7, 5, -4, 6, 0, 2, -5
2005
+ // }
2006
+ // Negative numbers mark the end of a face - first face here is 0, 1, 3, -3
2007
+ // to find index of last vertex bit shift the index: ^ - 1
2008
+ if ( vertexIndex < 0 ) {
2009
+
2010
+ vertexIndex = vertexIndex ^ - 1; // equivalent to ( x * -1 ) - 1
2011
+ endOfFace = true;
2012
+
2013
+ }
2014
+
2015
+ let weightIndices = [];
2016
+ let weights = [];
2017
+
2018
+ facePositionIndexes.push( vertexIndex * 3, vertexIndex * 3 + 1, vertexIndex * 3 + 2 );
2019
+
2020
+ if ( geoInfo.color ) {
2021
+
2022
+ const data = getData( polygonVertexIndex, polygonIndex, vertexIndex, geoInfo.color );
2023
+
2024
+ faceColors.push( data[ 0 ], data[ 1 ], data[ 2 ] );
2025
+
2026
+ }
2027
+
2028
+ if ( geoInfo.skeleton ) {
2029
+
2030
+ if ( geoInfo.weightTable[ vertexIndex ] !== undefined ) {
2031
+
2032
+ geoInfo.weightTable[ vertexIndex ].forEach( function ( wt ) {
2033
+
2034
+ weights.push( wt.weight );
2035
+ weightIndices.push( wt.id );
2036
+
2037
+ } );
2038
+
2039
+
2040
+ }
2041
+
2042
+ if ( weights.length > 4 ) {
2043
+
2044
+ if ( ! displayedWeightsWarning ) {
2045
+
2046
+ console.warn( 'THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights.' );
2047
+ displayedWeightsWarning = true;
2048
+
2049
+ }
2050
+
2051
+ const wIndex = [ 0, 0, 0, 0 ];
2052
+ const Weight = [ 0, 0, 0, 0 ];
2053
+
2054
+ weights.forEach( function ( weight, weightIndex ) {
2055
+
2056
+ let currentWeight = weight;
2057
+ let currentIndex = weightIndices[ weightIndex ];
2058
+
2059
+ Weight.forEach( function ( comparedWeight, comparedWeightIndex, comparedWeightArray ) {
2060
+
2061
+ if ( currentWeight > comparedWeight ) {
2062
+
2063
+ comparedWeightArray[ comparedWeightIndex ] = currentWeight;
2064
+ currentWeight = comparedWeight;
2065
+
2066
+ const tmp = wIndex[ comparedWeightIndex ];
2067
+ wIndex[ comparedWeightIndex ] = currentIndex;
2068
+ currentIndex = tmp;
2069
+
2070
+ }
2071
+
2072
+ } );
2073
+
2074
+ } );
2075
+
2076
+ weightIndices = wIndex;
2077
+ weights = Weight;
2078
+
2079
+ }
2080
+
2081
+ // if the weight array is shorter than 4 pad with 0s
2082
+ while ( weights.length < 4 ) {
2083
+
2084
+ weights.push( 0 );
2085
+ weightIndices.push( 0 );
2086
+
2087
+ }
2088
+
2089
+ for ( let i = 0; i < 4; ++ i ) {
2090
+
2091
+ faceWeights.push( weights[ i ] );
2092
+ faceWeightIndices.push( weightIndices[ i ] );
2093
+
2094
+ }
2095
+
2096
+ }
2097
+
2098
+ if ( geoInfo.normal ) {
2099
+
2100
+ const data = getData( polygonVertexIndex, polygonIndex, vertexIndex, geoInfo.normal );
2101
+
2102
+ faceNormals.push( data[ 0 ], data[ 1 ], data[ 2 ] );
2103
+
2104
+ }
2105
+
2106
+ if ( geoInfo.material && geoInfo.material.mappingType !== 'AllSame' ) {
2107
+
2108
+ materialIndex = getData( polygonVertexIndex, polygonIndex, vertexIndex, geoInfo.material )[ 0 ];
2109
+
2110
+ if ( materialIndex < 0 ) {
2111
+
2112
+ scope.negativeMaterialIndices = true;
2113
+ materialIndex = 0; // fallback
2114
+
2115
+ }
2116
+
2117
+ }
2118
+
2119
+ if ( geoInfo.uv ) {
2120
+
2121
+ geoInfo.uv.forEach( function ( uv, i ) {
2122
+
2123
+ const data = getData( polygonVertexIndex, polygonIndex, vertexIndex, uv );
2124
+
2125
+ if ( faceUVs[ i ] === undefined ) {
2126
+
2127
+ faceUVs[ i ] = [];
2128
+
2129
+ }
2130
+
2131
+ faceUVs[ i ].push( data[ 0 ] );
2132
+ faceUVs[ i ].push( data[ 1 ] );
2133
+
2134
+ } );
2135
+
2136
+ }
2137
+
2138
+ faceLength ++;
2139
+
2140
+ if ( endOfFace ) {
2141
+
2142
+ scope.genFace( buffers, geoInfo, facePositionIndexes, materialIndex, faceNormals, faceColors, faceUVs, faceWeights, faceWeightIndices, faceLength );
2143
+
2144
+ polygonIndex ++;
2145
+ faceLength = 0;
2146
+
2147
+ // reset arrays for the next face
2148
+ facePositionIndexes = [];
2149
+ faceNormals = [];
2150
+ faceColors = [];
2151
+ faceUVs = [];
2152
+ faceWeights = [];
2153
+ faceWeightIndices = [];
2154
+
2155
+ }
2156
+
2157
+ } );
2158
+
2159
+ return buffers;
2160
+
2161
+ }
2162
+
2163
+ // See https://www.khronos.org/opengl/wiki/Calculating_a_Surface_Normal
2164
+ getNormalNewell( vertices ) {
2165
+
2166
+ const normal = new Vector3( 0.0, 0.0, 0.0 );
2167
+
2168
+ for ( let i = 0; i < vertices.length; i ++ ) {
2169
+
2170
+ const current = vertices[ i ];
2171
+ const next = vertices[ ( i + 1 ) % vertices.length ];
2172
+
2173
+ normal.x += ( current.y - next.y ) * ( current.z + next.z );
2174
+ normal.y += ( current.z - next.z ) * ( current.x + next.x );
2175
+ normal.z += ( current.x - next.x ) * ( current.y + next.y );
2176
+
2177
+ }
2178
+
2179
+ normal.normalize();
2180
+
2181
+ return normal;
2182
+
2183
+ }
2184
+
2185
+ getNormalTangentAndBitangent( vertices ) {
2186
+
2187
+ const normalVector = this.getNormalNewell( vertices );
2188
+ // Avoid up being equal or almost equal to normalVector
2189
+ const up = Math.abs( normalVector.z ) > 0.5 ? new Vector3( 0.0, 1.0, 0.0 ) : new Vector3( 0.0, 0.0, 1.0 );
2190
+ const tangent = up.cross( normalVector ).normalize();
2191
+ const bitangent = normalVector.clone().cross( tangent ).normalize();
2192
+
2193
+ return {
2194
+ normal: normalVector,
2195
+ tangent: tangent,
2196
+ bitangent: bitangent
2197
+ };
2198
+
2199
+ }
2200
+
2201
+ flattenVertex( vertex, normalTangent, normalBitangent ) {
2202
+
2203
+ return new Vector2(
2204
+ vertex.dot( normalTangent ),
2205
+ vertex.dot( normalBitangent )
2206
+ );
2207
+
2208
+ }
2209
+
2210
+ // Generate data for a single face in a geometry. If the face is a quad then split it into 2 tris
2211
+ genFace( buffers, geoInfo, facePositionIndexes, materialIndex, faceNormals, faceColors, faceUVs, faceWeights, faceWeightIndices, faceLength ) {
2212
+
2213
+ let triangles;
2214
+
2215
+ if ( faceLength > 3 ) {
2216
+
2217
+ // Triangulate n-gon using earcut
2218
+
2219
+ const vertices = [];
2220
+ // in morphing scenario vertexPositions represent morphPositions
2221
+ // while baseVertexPositions represent the original geometry's positions
2222
+ const positions = geoInfo.baseVertexPositions || geoInfo.vertexPositions;
2223
+ for ( let i = 0; i < facePositionIndexes.length; i += 3 ) {
2224
+
2225
+ vertices.push(
2226
+ new Vector3(
2227
+ positions[ facePositionIndexes[ i ] ],
2228
+ positions[ facePositionIndexes[ i + 1 ] ],
2229
+ positions[ facePositionIndexes[ i + 2 ] ]
2230
+ )
2231
+ );
2232
+
2233
+ }
2234
+
2235
+ const { tangent, bitangent } = this.getNormalTangentAndBitangent( vertices );
2236
+ const triangulationInput = [];
2237
+
2238
+ for ( const vertex of vertices ) {
2239
+
2240
+ triangulationInput.push( this.flattenVertex( vertex, tangent, bitangent ) );
2241
+
2242
+ }
2243
+
2244
+ // When vertices is an array of [0,0,0] elements (which is the case for vertices not participating in morph)
2245
+ // the triangulationInput will be an array of [0,0] elements
2246
+ // resulting in an array of 0 triangles being returned from ShapeUtils.triangulateShape
2247
+ // leading to not pushing into buffers.vertex the redundant vertices (the vertices that are not morphed).
2248
+ // That's why, in order to support morphing scenario, "positions" is looking first for baseVertexPositions,
2249
+ // so that we don't end up with an array of 0 triangles for the faces not participating in morph.
2250
+ triangles = ShapeUtils.triangulateShape( triangulationInput, [] );
2251
+
2252
+ } else {
2253
+
2254
+ // Regular triangle, skip earcut triangulation step
2255
+ triangles = [[ 0, 1, 2 ]];
2256
+
2257
+ }
2258
+
2259
+ for ( const [ i0, i1, i2 ] of triangles ) {
2260
+
2261
+ buffers.vertex.push( geoInfo.vertexPositions[ facePositionIndexes[ i0 * 3 ] ] );
2262
+ buffers.vertex.push( geoInfo.vertexPositions[ facePositionIndexes[ i0 * 3 + 1 ] ] );
2263
+ buffers.vertex.push( geoInfo.vertexPositions[ facePositionIndexes[ i0 * 3 + 2 ] ] );
2264
+
2265
+ buffers.vertex.push( geoInfo.vertexPositions[ facePositionIndexes[ i1 * 3 ] ] );
2266
+ buffers.vertex.push( geoInfo.vertexPositions[ facePositionIndexes[ i1 * 3 + 1 ] ] );
2267
+ buffers.vertex.push( geoInfo.vertexPositions[ facePositionIndexes[ i1 * 3 + 2 ] ] );
2268
+
2269
+ buffers.vertex.push( geoInfo.vertexPositions[ facePositionIndexes[ i2 * 3 ] ] );
2270
+ buffers.vertex.push( geoInfo.vertexPositions[ facePositionIndexes[ i2 * 3 + 1 ] ] );
2271
+ buffers.vertex.push( geoInfo.vertexPositions[ facePositionIndexes[ i2 * 3 + 2 ] ] );
2272
+
2273
+ if ( geoInfo.skeleton ) {
2274
+
2275
+ buffers.vertexWeights.push( faceWeights[ i0 * 4 ] );
2276
+ buffers.vertexWeights.push( faceWeights[ i0 * 4 + 1 ] );
2277
+ buffers.vertexWeights.push( faceWeights[ i0 * 4 + 2 ] );
2278
+ buffers.vertexWeights.push( faceWeights[ i0 * 4 + 3 ] );
2279
+
2280
+ buffers.vertexWeights.push( faceWeights[ i1 * 4 ] );
2281
+ buffers.vertexWeights.push( faceWeights[ i1 * 4 + 1 ] );
2282
+ buffers.vertexWeights.push( faceWeights[ i1 * 4 + 2 ] );
2283
+ buffers.vertexWeights.push( faceWeights[ i1 * 4 + 3 ] );
2284
+
2285
+ buffers.vertexWeights.push( faceWeights[ i2 * 4 ] );
2286
+ buffers.vertexWeights.push( faceWeights[ i2 * 4 + 1 ] );
2287
+ buffers.vertexWeights.push( faceWeights[ i2 * 4 + 2 ] );
2288
+ buffers.vertexWeights.push( faceWeights[ i2 * 4 + 3 ] );
2289
+
2290
+ buffers.weightsIndices.push( faceWeightIndices[ i0 * 4 ] );
2291
+ buffers.weightsIndices.push( faceWeightIndices[ i0 * 4 + 1 ] );
2292
+ buffers.weightsIndices.push( faceWeightIndices[ i0 * 4 + 2 ] );
2293
+ buffers.weightsIndices.push( faceWeightIndices[ i0 * 4 + 3 ] );
2294
+
2295
+ buffers.weightsIndices.push( faceWeightIndices[ i1 * 4 ] );
2296
+ buffers.weightsIndices.push( faceWeightIndices[ i1 * 4 + 1 ] );
2297
+ buffers.weightsIndices.push( faceWeightIndices[ i1 * 4 + 2 ] );
2298
+ buffers.weightsIndices.push( faceWeightIndices[ i1 * 4 + 3 ] );
2299
+
2300
+ buffers.weightsIndices.push( faceWeightIndices[ i2 * 4 ] );
2301
+ buffers.weightsIndices.push( faceWeightIndices[ i2 * 4 + 1 ] );
2302
+ buffers.weightsIndices.push( faceWeightIndices[ i2 * 4 + 2 ] );
2303
+ buffers.weightsIndices.push( faceWeightIndices[ i2 * 4 + 3 ] );
2304
+
2305
+ }
2306
+
2307
+ if ( geoInfo.color ) {
2308
+
2309
+ buffers.colors.push( faceColors[ i0 * 3 ] );
2310
+ buffers.colors.push( faceColors[ i0 * 3 + 1 ] );
2311
+ buffers.colors.push( faceColors[ i0 * 3 + 2 ] );
2312
+
2313
+ buffers.colors.push( faceColors[ i1 * 3 ] );
2314
+ buffers.colors.push( faceColors[ i1 * 3 + 1 ] );
2315
+ buffers.colors.push( faceColors[ i1 * 3 + 2 ] );
2316
+
2317
+ buffers.colors.push( faceColors[ i2 * 3 ] );
2318
+ buffers.colors.push( faceColors[ i2 * 3 + 1 ] );
2319
+ buffers.colors.push( faceColors[ i2 * 3 + 2 ] );
2320
+
2321
+ }
2322
+
2323
+ if ( geoInfo.material && geoInfo.material.mappingType !== 'AllSame' ) {
2324
+
2325
+ buffers.materialIndex.push( materialIndex );
2326
+ buffers.materialIndex.push( materialIndex );
2327
+ buffers.materialIndex.push( materialIndex );
2328
+
2329
+ }
2330
+
2331
+ if ( geoInfo.normal ) {
2332
+
2333
+ buffers.normal.push( faceNormals[ i0 * 3 ] );
2334
+ buffers.normal.push( faceNormals[ i0 * 3 + 1 ] );
2335
+ buffers.normal.push( faceNormals[ i0 * 3 + 2 ] );
2336
+
2337
+ buffers.normal.push( faceNormals[ i1 * 3 ] );
2338
+ buffers.normal.push( faceNormals[ i1 * 3 + 1 ] );
2339
+ buffers.normal.push( faceNormals[ i1 * 3 + 2 ] );
2340
+
2341
+ buffers.normal.push( faceNormals[ i2 * 3 ] );
2342
+ buffers.normal.push( faceNormals[ i2 * 3 + 1 ] );
2343
+ buffers.normal.push( faceNormals[ i2 * 3 + 2 ] );
2344
+
2345
+ }
2346
+
2347
+ if ( geoInfo.uv ) {
2348
+
2349
+ geoInfo.uv.forEach( function ( uv, j ) {
2350
+
2351
+ if ( buffers.uvs[ j ] === undefined ) buffers.uvs[ j ] = [];
2352
+
2353
+ buffers.uvs[ j ].push( faceUVs[ j ][ i0 * 2 ] );
2354
+ buffers.uvs[ j ].push( faceUVs[ j ][ i0 * 2 + 1 ] );
2355
+
2356
+ buffers.uvs[ j ].push( faceUVs[ j ][ i1 * 2 ] );
2357
+ buffers.uvs[ j ].push( faceUVs[ j ][ i1 * 2 + 1 ] );
2358
+
2359
+ buffers.uvs[ j ].push( faceUVs[ j ][ i2 * 2 ] );
2360
+ buffers.uvs[ j ].push( faceUVs[ j ][ i2 * 2 + 1 ] );
2361
+
2362
+ } );
2363
+
2364
+ }
2365
+
2366
+ }
2367
+
2368
+ }
2369
+
2370
+ addMorphTargets( parentGeo, parentGeoNode, morphTargets, preTransform ) {
2371
+
2372
+ if ( morphTargets.length === 0 ) return;
2373
+
2374
+ parentGeo.morphTargetsRelative = true;
2375
+
2376
+ parentGeo.morphAttributes.position = [];
2377
+ // parentGeo.morphAttributes.normal = []; // not implemented
2378
+
2379
+ // Morph attribute positions are stored as deltas (morphTargetsRelative = true), so the
2380
+ // translation component of the geometric transform must not be applied to them — only the
2381
+ // rotation/scale part. Otherwise every delta gets the geometric translation added, which
2382
+ // shifts morphed vertices away from their intended position by `weight * translation` as
2383
+ // the influence increases.
2384
+ const morphPreTransform = preTransform.clone().setPosition( 0, 0, 0 );
2385
+
2386
+ const scope = this;
2387
+ morphTargets.forEach( function ( morphTarget ) {
2388
+
2389
+ morphTarget.rawTargets.forEach( function ( rawTarget ) {
2390
+
2391
+ const morphGeoNode = fbxTree.Objects.Geometry[ rawTarget.geoID ];
2392
+
2393
+ if ( morphGeoNode !== undefined ) {
2394
+
2395
+ scope.genMorphGeometry( parentGeo, parentGeoNode, morphGeoNode, morphPreTransform, rawTarget.name );
2396
+
2397
+ }
2398
+
2399
+ } );
2400
+
2401
+ } );
2402
+
2403
+ }
2404
+
2405
+ // a morph geometry node is similar to a standard node, and the node is also contained
2406
+ // in FBXTree.Objects.Geometry, however it can only have attributes for position, normal
2407
+ // and a special attribute Index defining which vertices of the original geometry are affected
2408
+ // Normal and position attributes only have data for the vertices that are affected by the morph
2409
+ genMorphGeometry( parentGeo, parentGeoNode, morphGeoNode, preTransform, name ) {
2410
+
2411
+ const basePositions = parentGeoNode.Vertices !== undefined ? parentGeoNode.Vertices.a : [];
2412
+ const baseIndices = parentGeoNode.PolygonVertexIndex !== undefined ? parentGeoNode.PolygonVertexIndex.a : [];
2413
+
2414
+ const morphPositionsSparse = morphGeoNode.Vertices !== undefined ? morphGeoNode.Vertices.a : [];
2415
+ const morphIndices = morphGeoNode.Indexes !== undefined ? morphGeoNode.Indexes.a : [];
2416
+
2417
+ const length = parentGeo.attributes.position.count * 3;
2418
+ const morphPositions = new Float32Array( length );
2419
+
2420
+ for ( let i = 0; i < morphIndices.length; i ++ ) {
2421
+
2422
+ const morphIndex = morphIndices[ i ] * 3;
2423
+
2424
+ morphPositions[ morphIndex ] = morphPositionsSparse[ i * 3 ];
2425
+ morphPositions[ morphIndex + 1 ] = morphPositionsSparse[ i * 3 + 1 ];
2426
+ morphPositions[ morphIndex + 2 ] = morphPositionsSparse[ i * 3 + 2 ];
2427
+
2428
+ }
2429
+
2430
+ // TODO: add morph normal support
2431
+ const morphGeoInfo = {
2432
+ vertexIndices: baseIndices,
2433
+ vertexPositions: morphPositions,
2434
+ baseVertexPositions: basePositions
2435
+ };
2436
+
2437
+ const morphBuffers = this.genBuffers( morphGeoInfo );
2438
+
2439
+ const positionAttribute = new Float32BufferAttribute( morphBuffers.vertex, 3 );
2440
+ positionAttribute.name = name || morphGeoNode.attrName;
2441
+
2442
+ positionAttribute.applyMatrix4( preTransform );
2443
+
2444
+ parentGeo.morphAttributes.position.push( positionAttribute );
2445
+
2446
+ }
2447
+
2448
+ // Parse normal from FBXTree.Objects.Geometry.LayerElementNormal if it exists
2449
+ parseNormals( NormalNode ) {
2450
+
2451
+ const mappingType = NormalNode.MappingInformationType;
2452
+ const referenceType = NormalNode.ReferenceInformationType;
2453
+ const buffer = NormalNode.Normals.a;
2454
+ let indexBuffer = [];
2455
+ if ( referenceType === 'IndexToDirect' ) {
2456
+
2457
+ if ( 'NormalIndex' in NormalNode ) {
2458
+
2459
+ indexBuffer = NormalNode.NormalIndex.a;
2460
+
2461
+ } else if ( 'NormalsIndex' in NormalNode ) {
2462
+
2463
+ indexBuffer = NormalNode.NormalsIndex.a;
2464
+
2465
+ }
2466
+
2467
+ }
2468
+
2469
+ return {
2470
+ dataSize: 3,
2471
+ buffer: buffer,
2472
+ indices: indexBuffer,
2473
+ mappingType: mappingType,
2474
+ referenceType: referenceType
2475
+ };
2476
+
2477
+ }
2478
+
2479
+ // Parse UVs from FBXTree.Objects.Geometry.LayerElementUV if it exists
2480
+ parseUVs( UVNode ) {
2481
+
2482
+ const mappingType = UVNode.MappingInformationType;
2483
+ const referenceType = UVNode.ReferenceInformationType;
2484
+ const buffer = UVNode.UV.a;
2485
+ let indexBuffer = [];
2486
+ if ( referenceType === 'IndexToDirect' ) {
2487
+
2488
+ indexBuffer = UVNode.UVIndex.a;
2489
+
2490
+ }
2491
+
2492
+ return {
2493
+ dataSize: 2,
2494
+ buffer: buffer,
2495
+ indices: indexBuffer,
2496
+ mappingType: mappingType,
2497
+ referenceType: referenceType
2498
+ };
2499
+
2500
+ }
2501
+
2502
+ // Parse Vertex Colors from FBXTree.Objects.Geometry.LayerElementColor if it exists
2503
+ parseVertexColors( ColorNode ) {
2504
+
2505
+ const mappingType = ColorNode.MappingInformationType;
2506
+ const referenceType = ColorNode.ReferenceInformationType;
2507
+ const buffer = ColorNode.Colors.a;
2508
+ let indexBuffer = [];
2509
+ if ( referenceType === 'IndexToDirect' ) {
2510
+
2511
+ indexBuffer = ColorNode.ColorIndex.a;
2512
+
2513
+ }
2514
+
2515
+ for ( let i = 0, c = new Color(); i < buffer.length; i += 4 ) {
2516
+
2517
+ c.fromArray( buffer, i );
2518
+ ColorManagement.colorSpaceToWorking( c, SRGBColorSpace );
2519
+ c.toArray( buffer, i );
2520
+
2521
+ }
2522
+
2523
+ return {
2524
+ dataSize: 4,
2525
+ buffer: buffer,
2526
+ indices: indexBuffer,
2527
+ mappingType: mappingType,
2528
+ referenceType: referenceType
2529
+ };
2530
+
2531
+ }
2532
+
2533
+ // Parse mapping and material data in FBXTree.Objects.Geometry.LayerElementMaterial if it exists
2534
+ parseMaterialIndices( MaterialNode ) {
2535
+
2536
+ const mappingType = MaterialNode.MappingInformationType;
2537
+ const referenceType = MaterialNode.ReferenceInformationType;
2538
+
2539
+ if ( mappingType === 'NoMappingInformation' ) {
2540
+
2541
+ return {
2542
+ dataSize: 1,
2543
+ buffer: [ 0 ],
2544
+ indices: [ 0 ],
2545
+ mappingType: 'AllSame',
2546
+ referenceType: referenceType
2547
+ };
2548
+
2549
+ }
2550
+
2551
+ const materialIndexBuffer = MaterialNode.Materials.a;
2552
+
2553
+ // Since materials are stored as indices, there's a bit of a mismatch between FBX and what
2554
+ // we expect.So we create an intermediate buffer that points to the index in the buffer,
2555
+ // for conforming with the other functions we've written for other data.
2556
+ const materialIndices = [];
2557
+
2558
+ for ( let i = 0; i < materialIndexBuffer.length; ++ i ) {
2559
+
2560
+ materialIndices.push( i );
2561
+
2562
+ }
2563
+
2564
+ return {
2565
+ dataSize: 1,
2566
+ buffer: materialIndexBuffer,
2567
+ indices: materialIndices,
2568
+ mappingType: mappingType,
2569
+ referenceType: referenceType
2570
+ };
2571
+
2572
+ }
2573
+
2574
+ // Generate a NurbGeometry from a node in FBXTree.Objects.Geometry
2575
+ parseNurbsGeometry( geoNode ) {
2576
+
2577
+ const order = parseInt( geoNode.Order );
2578
+
2579
+ if ( isNaN( order ) ) {
2580
+
2581
+ console.error( 'THREE.FBXLoader: Invalid Order %s given for geometry ID: %s', geoNode.Order, geoNode.id );
2582
+ return new BufferGeometry();
2583
+
2584
+ }
2585
+
2586
+ const degree = order - 1;
2587
+
2588
+ const knots = geoNode.KnotVector.a;
2589
+ const controlPoints = [];
2590
+ const pointsValues = geoNode.Points.a;
2591
+
2592
+ for ( let i = 0, l = pointsValues.length; i < l; i += 4 ) {
2593
+
2594
+ controlPoints.push( new Vector4().fromArray( pointsValues, i ) );
2595
+
2596
+ }
2597
+
2598
+ let startKnot, endKnot;
2599
+
2600
+ if ( geoNode.Form === 'Closed' ) {
2601
+
2602
+ controlPoints.push( controlPoints[ 0 ] );
2603
+
2604
+ } else if ( geoNode.Form === 'Periodic' ) {
2605
+
2606
+ startKnot = degree;
2607
+ endKnot = knots.length - 1 - startKnot;
2608
+
2609
+ for ( let i = 0; i < degree; ++ i ) {
2610
+
2611
+ controlPoints.push( controlPoints[ i ] );
2612
+
2613
+ }
2614
+
2615
+ }
2616
+
2617
+ const curve = new NURBSCurve( degree, knots, controlPoints, startKnot, endKnot );
2618
+ const points = curve.getPoints( controlPoints.length * 12 );
2619
+
2620
+ return new BufferGeometry().setFromPoints( points );
2621
+
2622
+ }
2623
+
2624
+ }
2625
+
2626
+ // parse animation data from FBXTree
2627
+ class AnimationParser {
2628
+
2629
+ constructor( trimAnimationClips ) {
2630
+
2631
+ this.trimAnimationClips = trimAnimationClips;
2632
+
2633
+ }
2634
+
2635
+ // take raw animation clips and turn them into three.js animation clips
2636
+ parse() {
2637
+
2638
+ const animationClips = [];
2639
+
2640
+ const rawClips = this.parseClips();
2641
+
2642
+ if ( rawClips !== undefined ) {
2643
+
2644
+ for ( const key in rawClips ) {
2645
+
2646
+ const rawClip = rawClips[ key ];
2647
+
2648
+ const clip = this.addClip( rawClip );
2649
+
2650
+ animationClips.push( clip );
2651
+
2652
+ }
2653
+
2654
+ }
2655
+
2656
+ return animationClips;
2657
+
2658
+ }
2659
+
2660
+ parseClips() {
2661
+
2662
+ // since the actual transformation data is stored in FBXTree.Objects.AnimationCurve,
2663
+ // if this is undefined we can safely assume there are no animations
2664
+ if ( fbxTree.Objects.AnimationCurve === undefined ) return undefined;
2665
+
2666
+ const curveNodesMap = this.parseAnimationCurveNodes();
2667
+
2668
+ this.parseAnimationCurves( curveNodesMap );
2669
+
2670
+ const layersMap = this.parseAnimationLayers( curveNodesMap );
2671
+ const rawClips = this.parseAnimStacks( layersMap );
2672
+
2673
+ return rawClips;
2674
+
2675
+ }
2676
+
2677
+ // parse nodes in FBXTree.Objects.AnimationCurveNode
2678
+ // each AnimationCurveNode holds data for an animation transform for a model (e.g. left arm rotation )
2679
+ // and is referenced by an AnimationLayer
2680
+ parseAnimationCurveNodes() {
2681
+
2682
+ const rawCurveNodes = fbxTree.Objects.AnimationCurveNode;
2683
+
2684
+ const curveNodesMap = new Map();
2685
+
2686
+ for ( const nodeID in rawCurveNodes ) {
2687
+
2688
+ const rawCurveNode = rawCurveNodes[ nodeID ];
2689
+
2690
+ if ( rawCurveNode.attrName.match( /S|R|T|DeformPercent/ ) !== null ) {
2691
+
2692
+ const curveNode = {
2693
+
2694
+ id: rawCurveNode.id,
2695
+ attr: rawCurveNode.attrName,
2696
+ curves: {},
2697
+
2698
+ };
2699
+
2700
+ curveNodesMap.set( curveNode.id, curveNode );
2701
+
2702
+ }
2703
+
2704
+ }
2705
+
2706
+ return curveNodesMap;
2707
+
2708
+ }
2709
+
2710
+ // parse nodes in FBXTree.Objects.AnimationCurve and connect them up to
2711
+ // previously parsed AnimationCurveNodes. Each AnimationCurve holds data for a single animated
2712
+ // axis ( e.g. times and values of x rotation)
2713
+ parseAnimationCurves( curveNodesMap ) {
2714
+
2715
+ const rawCurves = fbxTree.Objects.AnimationCurve;
2716
+
2717
+ // TODO: Many values are identical up to roundoff error, but won't be optimised
2718
+ // e.g. position times: [0, 0.4, 0. 8]
2719
+ // position values: [7.23538335023477e-7, 93.67518615722656, -0.9982695579528809, 7.23538335023477e-7, 93.67518615722656, -0.9982695579528809, 7.235384487103147e-7, 93.67520904541016, -0.9982695579528809]
2720
+ // clearly, this should be optimised to
2721
+ // times: [0], positions [7.23538335023477e-7, 93.67518615722656, -0.9982695579528809]
2722
+ // this shows up in nearly every FBX file, and generally time array is length > 100
2723
+
2724
+ for ( const nodeID in rawCurves ) {
2725
+
2726
+ const animationCurve = {
2727
+
2728
+ id: rawCurves[ nodeID ].id,
2729
+ times: rawCurves[ nodeID ].KeyTime.a.map( convertFBXTimeToSeconds ),
2730
+ values: rawCurves[ nodeID ].KeyValueFloat.a,
2731
+
2732
+ };
2733
+
2734
+ const relationships = connections.get( animationCurve.id );
2735
+
2736
+ if ( relationships !== undefined ) {
2737
+
2738
+ const animationCurveID = relationships.parents[ 0 ].ID;
2739
+ const animationCurveRelationship = relationships.parents[ 0 ].relationship;
2740
+
2741
+ if ( animationCurveRelationship.match( /X/ ) ) {
2742
+
2743
+ curveNodesMap.get( animationCurveID ).curves[ 'x' ] = animationCurve;
2744
+
2745
+ } else if ( animationCurveRelationship.match( /Y/ ) ) {
2746
+
2747
+ curveNodesMap.get( animationCurveID ).curves[ 'y' ] = animationCurve;
2748
+
2749
+ } else if ( animationCurveRelationship.match( /Z/ ) ) {
2750
+
2751
+ curveNodesMap.get( animationCurveID ).curves[ 'z' ] = animationCurve;
2752
+
2753
+ } else if ( animationCurveRelationship.match( /DeformPercent/ ) && curveNodesMap.has( animationCurveID ) ) {
2754
+
2755
+ curveNodesMap.get( animationCurveID ).curves[ 'morph' ] = animationCurve;
2756
+
2757
+ }
2758
+
2759
+ }
2760
+
2761
+ }
2762
+
2763
+ }
2764
+
2765
+ // parse nodes in FBXTree.Objects.AnimationLayer. Each layers holds references
2766
+ // to various AnimationCurveNodes and is referenced by an AnimationStack node
2767
+ // note: theoretically a stack can have multiple layers, however in practice there always seems to be one per stack
2768
+ parseAnimationLayers( curveNodesMap ) {
2769
+
2770
+ const rawLayers = fbxTree.Objects.AnimationLayer;
2771
+
2772
+ const layersMap = new Map();
2773
+
2774
+ for ( const nodeID in rawLayers ) {
2775
+
2776
+ const layerCurveNodes = [];
2777
+
2778
+ const connection = connections.get( parseInt( nodeID ) );
2779
+
2780
+ if ( connection !== undefined ) {
2781
+
2782
+ // all the animationCurveNodes used in the layer
2783
+ const children = connection.children;
2784
+
2785
+ children.forEach( function ( child, i ) {
2786
+
2787
+ if ( curveNodesMap.has( child.ID ) ) {
2788
+
2789
+ const curveNode = curveNodesMap.get( child.ID );
2790
+
2791
+ // check that the curves are defined for at least one axis, otherwise ignore the curveNode
2792
+ if ( curveNode.curves.x !== undefined || curveNode.curves.y !== undefined || curveNode.curves.z !== undefined ) {
2793
+
2794
+ if ( layerCurveNodes[ i ] === undefined ) {
2795
+
2796
+ const filteredParents = connections.get( child.ID ).parents.filter( function ( parent ) {
2797
+
2798
+ return parent.relationship !== undefined;
2799
+
2800
+ } );
2801
+
2802
+ if ( filteredParents.length === 0 ) return;
2803
+
2804
+ const modelID = filteredParents[ 0 ].ID;
2805
+
2806
+ if ( modelID !== undefined ) {
2807
+
2808
+ const rawModel = fbxTree.Objects.Model[ modelID.toString() ];
2809
+
2810
+ if ( rawModel === undefined ) {
2811
+
2812
+ console.warn( 'THREE.FBXLoader: Encountered a unused curve.', child );
2813
+ return;
2814
+
2815
+ }
2816
+
2817
+ const node = {
2818
+
2819
+ modelName: rawModel.attrName ? PropertyBinding.sanitizeNodeName( rawModel.attrName ) : '',
2820
+ ID: rawModel.id,
2821
+ initialPosition: [ 0, 0, 0 ],
2822
+ initialRotation: [ 0, 0, 0 ],
2823
+ initialScale: [ 1, 1, 1 ],
2824
+
2825
+ };
2826
+
2827
+ sceneGraph.traverse( function ( child ) {
2828
+
2829
+ if ( child.ID === rawModel.id ) {
2830
+
2831
+ node.transform = child.matrix;
2832
+
2833
+ if ( child.userData.transformData ) {
2834
+
2835
+ node.eulerOrder = child.userData.transformData.eulerOrder;
2836
+
2837
+ if ( child.userData.transformData.rotation ) node.initialRotation = child.userData.transformData.rotation;
2838
+
2839
+ }
2840
+
2841
+ }
2842
+
2843
+ } );
2844
+
2845
+ if ( ! node.transform ) node.transform = new Matrix4();
2846
+
2847
+ // if the animated model is pre rotated, we'll have to apply the pre rotations to every
2848
+ // animation value as well
2849
+ if ( 'PreRotation' in rawModel ) node.preRotation = rawModel.PreRotation.value;
2850
+ if ( 'PostRotation' in rawModel ) node.postRotation = rawModel.PostRotation.value;
2851
+
2852
+ layerCurveNodes[ i ] = node;
2853
+
2854
+ }
2855
+
2856
+ }
2857
+
2858
+ if ( layerCurveNodes[ i ] ) layerCurveNodes[ i ][ curveNode.attr ] = curveNode;
2859
+
2860
+ } else if ( curveNode.curves.morph !== undefined ) {
2861
+
2862
+ if ( layerCurveNodes[ i ] === undefined ) {
2863
+
2864
+ const filteredParents = connections.get( child.ID ).parents.filter( function ( parent ) {
2865
+
2866
+ return parent.relationship !== undefined;
2867
+
2868
+ } );
2869
+
2870
+ if ( filteredParents.length === 0 ) return;
2871
+
2872
+ const deformerID = filteredParents[ 0 ].ID;
2873
+
2874
+ const morpherID = connections.get( deformerID ).parents[ 0 ].ID;
2875
+ const geoID = connections.get( morpherID ).parents[ 0 ].ID;
2876
+
2877
+ // assuming geometry is not used in more than one model
2878
+ const modelID = connections.get( geoID ).parents[ 0 ].ID;
2879
+
2880
+ const rawModel = fbxTree.Objects.Model[ modelID ];
2881
+
2882
+ const node = {
2883
+
2884
+ modelName: rawModel.attrName ? PropertyBinding.sanitizeNodeName( rawModel.attrName ) : '',
2885
+ morphName: fbxTree.Objects.Deformer[ deformerID ].attrName,
2886
+
2887
+ };
2888
+
2889
+ layerCurveNodes[ i ] = node;
2890
+
2891
+ }
2892
+
2893
+ layerCurveNodes[ i ][ curveNode.attr ] = curveNode;
2894
+
2895
+ }
2896
+
2897
+ }
2898
+
2899
+ } );
2900
+
2901
+ layersMap.set( parseInt( nodeID ), layerCurveNodes );
2902
+
2903
+ }
2904
+
2905
+ }
2906
+
2907
+ return layersMap;
2908
+
2909
+ }
2910
+
2911
+ // parse nodes in FBXTree.Objects.AnimationStack. These are the top level node in the animation
2912
+ // hierarchy. Each Stack node will be used to create an AnimationClip
2913
+ parseAnimStacks( layersMap ) {
2914
+
2915
+ const rawStacks = fbxTree.Objects.AnimationStack;
2916
+
2917
+ // connect the stacks (clips) up to the layers
2918
+ const rawClips = {};
2919
+
2920
+ for ( const nodeID in rawStacks ) {
2921
+
2922
+ const children = connections.get( parseInt( nodeID ) ).children;
2923
+
2924
+ if ( children.length > 1 ) {
2925
+
2926
+ // it seems like stacks will always be associated with a single layer. But just in case there are files
2927
+ // where there are multiple layers per stack, we'll display a warning
2928
+ console.warn( 'THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers.' );
2929
+
2930
+ }
2931
+
2932
+ const layer = layersMap.get( children[ 0 ].ID );
2933
+ const rawStack = rawStacks[ nodeID ];
2934
+
2935
+ rawClips[ nodeID ] = {
2936
+
2937
+ name: rawStack.attrName,
2938
+ layer: layer,
2939
+ localStart: rawStack.LocalStart !== undefined ? convertFBXTimeToSeconds( Number( rawStack.LocalStart.value ) ) : 0,
2940
+ localStop: rawStack.LocalStop !== undefined ? convertFBXTimeToSeconds( Number( rawStack.LocalStop.value ) ) : 0,
2941
+
2942
+ };
2943
+
2944
+ }
2945
+
2946
+ return rawClips;
2947
+
2948
+ }
2949
+
2950
+ addClip( rawClip ) {
2951
+
2952
+ let tracks = [];
2953
+
2954
+ const scope = this;
2955
+ rawClip.layer.forEach( function ( rawTracks ) {
2956
+
2957
+ tracks = tracks.concat( scope.generateTracks( rawTracks ) );
2958
+
2959
+ } );
2960
+
2961
+ if ( this.trimAnimationClips === true && rawClip.localStop > rawClip.localStart ) {
2962
+
2963
+ tracks = this.trimTracks( tracks, rawClip.localStart, rawClip.localStop );
2964
+
2965
+ }
2966
+
2967
+ return new AnimationClip( rawClip.name, - 1, tracks );
2968
+
2969
+ }
2970
+
2971
+ // trims the given tracks to the time range [ startTime, endTime ] and shifts
2972
+ // them so they start at time zero. tracks without keyframes in the range are discarded
2973
+ trimTracks( tracks, startTime, endTime ) {
2974
+
2975
+ // track times are stored as float32 so compare against float32 boundaries
2976
+ // to keep keyframes lying exactly on the range limits
2977
+
2978
+ const start = Math.fround( startTime );
2979
+ const end = Math.fround( endTime );
2980
+
2981
+ const trimmedTracks = [];
2982
+
2983
+ for ( let i = 0; i < tracks.length; i ++ ) {
2984
+
2985
+ const track = tracks[ i ];
2986
+ const stride = track.getValueSize();
2987
+
2988
+ const times = [];
2989
+ const values = [];
2990
+
2991
+ for ( let j = 0; j < track.times.length; j ++ ) {
2992
+
2993
+ const time = track.times[ j ];
2994
+
2995
+ if ( time < start || time > end ) continue;
2996
+
2997
+ times.push( time - start );
2998
+
2999
+ for ( let k = 0; k < stride; k ++ ) {
3000
+
3001
+ values.push( track.values[ j * stride + k ] );
3002
+
3003
+ }
3004
+
3005
+ }
3006
+
3007
+ if ( times.length === 0 ) continue;
3008
+
3009
+ track.times = new Float32Array( times );
3010
+ track.values = new Float32Array( values );
3011
+
3012
+ trimmedTracks.push( track );
3013
+
3014
+ }
3015
+
3016
+ return trimmedTracks;
3017
+
3018
+ }
3019
+
3020
+ generateTracks( rawTracks ) {
3021
+
3022
+ const tracks = [];
3023
+
3024
+ let initialPosition = new Vector3();
3025
+ let initialScale = new Vector3();
3026
+
3027
+ if ( rawTracks.transform ) rawTracks.transform.decompose( initialPosition, new Quaternion(), initialScale );
3028
+
3029
+ initialPosition = initialPosition.toArray();
3030
+ initialScale = initialScale.toArray();
3031
+
3032
+ if ( rawTracks.T !== undefined && Object.keys( rawTracks.T.curves ).length > 0 ) {
3033
+
3034
+ const positionTrack = this.generateVectorTrack( rawTracks.modelName, rawTracks.T.curves, initialPosition, 'position' );
3035
+ if ( positionTrack !== undefined ) tracks.push( positionTrack );
3036
+
3037
+ }
3038
+
3039
+ if ( rawTracks.R !== undefined && Object.keys( rawTracks.R.curves ).length > 0 ) {
3040
+
3041
+ const rotationTrack = this.generateRotationTrack( rawTracks.modelName, rawTracks.R.curves, rawTracks.preRotation, rawTracks.postRotation, rawTracks.eulerOrder, rawTracks.initialRotation );
3042
+ if ( rotationTrack !== undefined ) tracks.push( rotationTrack );
3043
+
3044
+ }
3045
+
3046
+ if ( rawTracks.S !== undefined && Object.keys( rawTracks.S.curves ).length > 0 ) {
3047
+
3048
+ const scaleTrack = this.generateVectorTrack( rawTracks.modelName, rawTracks.S.curves, initialScale, 'scale' );
3049
+ if ( scaleTrack !== undefined ) tracks.push( scaleTrack );
3050
+
3051
+ }
3052
+
3053
+ if ( rawTracks.DeformPercent !== undefined ) {
3054
+
3055
+ const morphTrack = this.generateMorphTrack( rawTracks );
3056
+ if ( morphTrack !== undefined ) tracks.push( morphTrack );
3057
+
3058
+ }
3059
+
3060
+ return tracks;
3061
+
3062
+ }
3063
+
3064
+ generateVectorTrack( modelName, curves, initialValue, type ) {
3065
+
3066
+ const times = this.getTimesForAllAxes( curves );
3067
+ const values = this.getKeyframeTrackValues( times, curves, initialValue );
3068
+
3069
+ return new VectorKeyframeTrack( modelName + '.' + type, times, values );
3070
+
3071
+ }
3072
+
3073
+ generateRotationTrack( modelName, curves, preRotation, postRotation, eulerOrder, initialRotation ) {
3074
+
3075
+ let times;
3076
+ let values;
3077
+
3078
+ if ( curves.x !== undefined || curves.y !== undefined || curves.z !== undefined ) {
3079
+
3080
+ // Get merged, sorted, unique times from all available curves
3081
+ const mergedTimes = this.getTimesForAllAxes( curves );
3082
+
3083
+ if ( mergedTimes.length > 0 ) {
3084
+
3085
+ const initialRot = initialRotation || [ 0, 0, 0 ];
3086
+
3087
+ // Synchronize all curves to the merged time array.
3088
+ // Missing axes are filled with constant values from the initial rotation (Lcl Rotation).
3089
+ // Existing curves at different times are linearly interpolated.
3090
+ const syncX = this.synchronizeCurve( curves.x, mergedTimes, initialRot[ 0 ] );
3091
+ const syncY = this.synchronizeCurve( curves.y, mergedTimes, initialRot[ 1 ] );
3092
+ const syncZ = this.synchronizeCurve( curves.z, mergedTimes, initialRot[ 2 ] );
3093
+
3094
+ const result = this.interpolateRotations( syncX, syncY, syncZ, eulerOrder );
3095
+
3096
+ times = result[ 0 ];
3097
+ values = result[ 1 ];
3098
+
3099
+ }
3100
+
3101
+ }
3102
+
3103
+ // For Maya models using "Joint Orient", Euler order only applies to rotation, not pre/post-rotations
3104
+ const defaultEulerOrder = getEulerOrder( 0 );
3105
+
3106
+ if ( preRotation !== undefined ) {
3107
+
3108
+ preRotation = preRotation.map( MathUtils.degToRad );
3109
+ preRotation.push( defaultEulerOrder );
3110
+
3111
+ preRotation = new Euler().fromArray( preRotation );
3112
+ preRotation = new Quaternion().setFromEuler( preRotation );
3113
+
3114
+ }
3115
+
3116
+ if ( postRotation !== undefined ) {
3117
+
3118
+ postRotation = postRotation.map( MathUtils.degToRad );
3119
+ postRotation.push( defaultEulerOrder );
3120
+
3121
+ postRotation = new Euler().fromArray( postRotation );
3122
+ postRotation = new Quaternion().setFromEuler( postRotation ).invert();
3123
+
3124
+ }
3125
+
3126
+ const quaternion = new Quaternion();
3127
+ const euler = new Euler();
3128
+
3129
+ const quaternionValues = [];
3130
+
3131
+ if ( ! values || ! times ) return undefined;
3132
+
3133
+ for ( let i = 0; i < values.length; i += 3 ) {
3134
+
3135
+ euler.set( values[ i ], values[ i + 1 ], values[ i + 2 ], eulerOrder );
3136
+ quaternion.setFromEuler( euler );
3137
+
3138
+ if ( preRotation !== undefined ) quaternion.premultiply( preRotation );
3139
+ if ( postRotation !== undefined ) quaternion.multiply( postRotation );
3140
+
3141
+ // Check unroll
3142
+ if ( i > 2 ) {
3143
+
3144
+ const prevQuat = new Quaternion().fromArray(
3145
+ quaternionValues,
3146
+ ( ( i - 3 ) / 3 ) * 4
3147
+ );
3148
+
3149
+ if ( prevQuat.dot( quaternion ) < 0 ) {
3150
+
3151
+ quaternion.set( - quaternion.x, - quaternion.y, - quaternion.z, - quaternion.w );
3152
+
3153
+ }
3154
+
3155
+ }
3156
+
3157
+ quaternion.toArray( quaternionValues, ( i / 3 ) * 4 );
3158
+
3159
+ }
3160
+
3161
+ return new QuaternionKeyframeTrack( modelName + '.quaternion', times, quaternionValues );
3162
+
3163
+ }
3164
+
3165
+ generateMorphTrack( rawTracks ) {
3166
+
3167
+ const curves = rawTracks.DeformPercent.curves.morph;
3168
+ const values = curves.values.map( function ( val ) {
3169
+
3170
+ return val / 100;
3171
+
3172
+ } );
3173
+
3174
+ const morphNum = sceneGraph.getObjectByName( rawTracks.modelName ).morphTargetDictionary[ rawTracks.morphName ];
3175
+
3176
+ return new NumberKeyframeTrack( rawTracks.modelName + '.morphTargetInfluences[' + morphNum + ']', curves.times, values );
3177
+
3178
+ }
3179
+
3180
+ // For all animated objects, times are defined separately for each axis
3181
+ // Here we'll combine the times into one sorted array without duplicates
3182
+ getTimesForAllAxes( curves ) {
3183
+
3184
+ let times = [];
3185
+
3186
+ // first join together the times for each axis, if defined
3187
+ if ( curves.x !== undefined ) times = times.concat( curves.x.times );
3188
+ if ( curves.y !== undefined ) times = times.concat( curves.y.times );
3189
+ if ( curves.z !== undefined ) times = times.concat( curves.z.times );
3190
+
3191
+ // then sort them
3192
+ times = times.sort( function ( a, b ) {
3193
+
3194
+ return a - b;
3195
+
3196
+ } );
3197
+
3198
+ // and remove duplicates
3199
+ if ( times.length > 1 ) {
3200
+
3201
+ let targetIndex = 1;
3202
+ let lastValue = times[ 0 ];
3203
+ for ( let i = 1; i < times.length; i ++ ) {
3204
+
3205
+ const currentValue = times[ i ];
3206
+ if ( currentValue !== lastValue ) {
3207
+
3208
+ times[ targetIndex ] = currentValue;
3209
+ lastValue = currentValue;
3210
+ targetIndex ++;
3211
+
3212
+ }
3213
+
3214
+ }
3215
+
3216
+ times = times.slice( 0, targetIndex );
3217
+
3218
+ }
3219
+
3220
+ return times;
3221
+
3222
+ }
3223
+
3224
+ getKeyframeTrackValues( times, curves, initialValue ) {
3225
+
3226
+ const prevValue = initialValue;
3227
+
3228
+ const values = [];
3229
+
3230
+ let xIndex = - 1;
3231
+ let yIndex = - 1;
3232
+ let zIndex = - 1;
3233
+
3234
+ times.forEach( function ( time ) {
3235
+
3236
+ if ( curves.x ) xIndex = curves.x.times.indexOf( time );
3237
+ if ( curves.y ) yIndex = curves.y.times.indexOf( time );
3238
+ if ( curves.z ) zIndex = curves.z.times.indexOf( time );
3239
+
3240
+ // if there is an x value defined for this frame, use that
3241
+ if ( xIndex !== - 1 ) {
3242
+
3243
+ const xValue = curves.x.values[ xIndex ];
3244
+ values.push( xValue );
3245
+ prevValue[ 0 ] = xValue;
3246
+
3247
+ } else {
3248
+
3249
+ // otherwise use the x value from the previous frame
3250
+ values.push( prevValue[ 0 ] );
3251
+
3252
+ }
3253
+
3254
+ if ( yIndex !== - 1 ) {
3255
+
3256
+ const yValue = curves.y.values[ yIndex ];
3257
+ values.push( yValue );
3258
+ prevValue[ 1 ] = yValue;
3259
+
3260
+ } else {
3261
+
3262
+ values.push( prevValue[ 1 ] );
3263
+
3264
+ }
3265
+
3266
+ if ( zIndex !== - 1 ) {
3267
+
3268
+ const zValue = curves.z.values[ zIndex ];
3269
+ values.push( zValue );
3270
+ prevValue[ 2 ] = zValue;
3271
+
3272
+ } else {
3273
+
3274
+ values.push( prevValue[ 2 ] );
3275
+
3276
+ }
3277
+
3278
+ } );
3279
+
3280
+ return values;
3281
+
3282
+ }
3283
+
3284
+ // Synchronize a curve to a target time array using linear interpolation.
3285
+ // If the curve is undefined (axis not animated), returns constant values from initialValue.
3286
+ synchronizeCurve( curve, targetTimes, initialValue ) {
3287
+
3288
+ if ( curve === undefined ) {
3289
+
3290
+ return { times: targetTimes, values: targetTimes.map( () => initialValue ) };
3291
+
3292
+ }
3293
+
3294
+ // If the curve already has the same number of keyframes as the target, assume times match
3295
+ if ( curve.times.length === targetTimes.length ) return curve;
3296
+
3297
+ // Linearly interpolate curve values at each target time
3298
+ const values = [];
3299
+
3300
+ for ( let i = 0; i < targetTimes.length; i ++ ) {
3301
+
3302
+ values.push( this.sampleCurveValue( curve, targetTimes[ i ], initialValue ) );
3303
+
3304
+ }
3305
+
3306
+ return { times: targetTimes, values: values };
3307
+
3308
+ }
3309
+
3310
+ // Sample a single value from a curve at a given time using linear interpolation
3311
+ sampleCurveValue( curve, time, initialValue ) {
3312
+
3313
+ const times = curve.times;
3314
+ const values = curve.values;
3315
+
3316
+ // Before first keyframe
3317
+ if ( time <= times[ 0 ] ) return values[ 0 ];
3318
+
3319
+ // After last keyframe
3320
+ if ( time >= times[ times.length - 1 ] ) return values[ values.length - 1 ];
3321
+
3322
+ // Find surrounding keyframes and linearly interpolate
3323
+ for ( let i = 0; i < times.length - 1; i ++ ) {
3324
+
3325
+ if ( time >= times[ i ] && time <= times[ i + 1 ] ) {
3326
+
3327
+ if ( times[ i ] === time ) return values[ i ];
3328
+
3329
+ const alpha = ( time - times[ i ] ) / ( times[ i + 1 ] - times[ i ] );
3330
+ return values[ i ] * ( 1 - alpha ) + values[ i + 1 ] * alpha;
3331
+
3332
+ }
3333
+
3334
+ }
3335
+
3336
+ return initialValue;
3337
+
3338
+ }
3339
+
3340
+ // Rotations are defined as Euler angles which can have values of any size
3341
+ // These will be converted to quaternions which don't support values greater than
3342
+ // PI, so we'll interpolate large rotations
3343
+ interpolateRotations( curvex, curvey, curvez, eulerOrder ) {
3344
+
3345
+ const times = [];
3346
+ const values = [];
3347
+
3348
+ // Add first frame
3349
+ times.push( curvex.times[ 0 ] );
3350
+ values.push( MathUtils.degToRad( curvex.values[ 0 ] ) );
3351
+ values.push( MathUtils.degToRad( curvey.values[ 0 ] ) );
3352
+ values.push( MathUtils.degToRad( curvez.values[ 0 ] ) );
3353
+
3354
+ for ( let i = 1; i < curvex.values.length; i ++ ) {
3355
+
3356
+ const initialValue = [
3357
+ curvex.values[ i - 1 ],
3358
+ curvey.values[ i - 1 ],
3359
+ curvez.values[ i - 1 ],
3360
+ ];
3361
+
3362
+ if ( isNaN( initialValue[ 0 ] ) || isNaN( initialValue[ 1 ] ) || isNaN( initialValue[ 2 ] ) ) {
3363
+
3364
+ continue;
3365
+
3366
+ }
3367
+
3368
+ const initialValueRad = initialValue.map( MathUtils.degToRad );
3369
+
3370
+ const currentValue = [
3371
+ curvex.values[ i ],
3372
+ curvey.values[ i ],
3373
+ curvez.values[ i ],
3374
+ ];
3375
+
3376
+ if ( isNaN( currentValue[ 0 ] ) || isNaN( currentValue[ 1 ] ) || isNaN( currentValue[ 2 ] ) ) {
3377
+
3378
+ continue;
3379
+
3380
+ }
3381
+
3382
+ const currentValueRad = currentValue.map( MathUtils.degToRad );
3383
+
3384
+ const valuesSpan = [
3385
+ currentValue[ 0 ] - initialValue[ 0 ],
3386
+ currentValue[ 1 ] - initialValue[ 1 ],
3387
+ currentValue[ 2 ] - initialValue[ 2 ],
3388
+ ];
3389
+
3390
+ const absoluteSpan = [
3391
+ Math.abs( valuesSpan[ 0 ] ),
3392
+ Math.abs( valuesSpan[ 1 ] ),
3393
+ Math.abs( valuesSpan[ 2 ] ),
3394
+ ];
3395
+
3396
+ if ( absoluteSpan[ 0 ] >= 180 || absoluteSpan[ 1 ] >= 180 || absoluteSpan[ 2 ] >= 180 ) {
3397
+
3398
+ const maxAbsSpan = Math.max( ...absoluteSpan );
3399
+
3400
+ const numSubIntervals = maxAbsSpan / 180;
3401
+
3402
+ const E1 = new Euler( ...initialValueRad, eulerOrder );
3403
+ const E2 = new Euler( ...currentValueRad, eulerOrder );
3404
+
3405
+ const Q1 = new Quaternion().setFromEuler( E1 );
3406
+ const Q2 = new Quaternion().setFromEuler( E2 );
3407
+
3408
+ // Check unroll
3409
+ if ( Q1.dot( Q2 ) < 0 ) {
3410
+
3411
+ Q2.set( - Q2.x, - Q2.y, - Q2.z, - Q2.w );
3412
+
3413
+ }
3414
+
3415
+ // Interpolate
3416
+ const initialTime = curvex.times[ i - 1 ];
3417
+ const timeSpan = curvex.times[ i ] - initialTime;
3418
+
3419
+ const Q = new Quaternion();
3420
+ const E = new Euler();
3421
+ for ( let t = 0; t < 1; t += 1 / numSubIntervals ) {
3422
+
3423
+ Q.copy( Q1.clone().slerp( Q2.clone(), t ) );
3424
+
3425
+ times.push( initialTime + t * timeSpan );
3426
+ E.setFromQuaternion( Q, eulerOrder );
3427
+
3428
+ values.push( E.x );
3429
+ values.push( E.y );
3430
+ values.push( E.z );
3431
+
3432
+ }
3433
+
3434
+ } else {
3435
+
3436
+ times.push( curvex.times[ i ] );
3437
+ values.push( MathUtils.degToRad( curvex.values[ i ] ) );
3438
+ values.push( MathUtils.degToRad( curvey.values[ i ] ) );
3439
+ values.push( MathUtils.degToRad( curvez.values[ i ] ) );
3440
+
3441
+ }
3442
+
3443
+ }
3444
+
3445
+ return [ times, values ];
3446
+
3447
+ }
3448
+
3449
+ }
3450
+
3451
+ // parse an FBX file in ASCII format
3452
+ class TextParser {
3453
+
3454
+ getPrevNode() {
3455
+
3456
+ return this.nodeStack[ this.currentIndent - 2 ];
3457
+
3458
+ }
3459
+
3460
+ getCurrentNode() {
3461
+
3462
+ return this.nodeStack[ this.currentIndent - 1 ];
3463
+
3464
+ }
3465
+
3466
+ getCurrentProp() {
3467
+
3468
+ return this.currentProp;
3469
+
3470
+ }
3471
+
3472
+ pushStack( node ) {
3473
+
3474
+ this.nodeStack.push( node );
3475
+ this.currentIndent += 1;
3476
+
3477
+ }
3478
+
3479
+ popStack() {
3480
+
3481
+ this.nodeStack.pop();
3482
+ this.currentIndent -= 1;
3483
+
3484
+ }
3485
+
3486
+ setCurrentProp( val, name ) {
3487
+
3488
+ this.currentProp = val;
3489
+ this.currentPropName = name;
3490
+
3491
+ }
3492
+
3493
+ parse( text ) {
3494
+
3495
+ this.currentIndent = 0;
3496
+
3497
+ this.allNodes = new FBXTree();
3498
+ this.nodeStack = [];
3499
+ this.currentProp = [];
3500
+ this.currentPropName = '';
3501
+
3502
+ const scope = this;
3503
+
3504
+ const split = text.split( /[\r\n]+/ );
3505
+
3506
+ split.forEach( function ( line, i ) {
3507
+
3508
+ const matchComment = line.match( /^[\s\t]*;/ );
3509
+ const matchEmpty = line.match( /^[\s\t]*$/ );
3510
+
3511
+ if ( matchComment || matchEmpty ) return;
3512
+
3513
+ const matchBeginning = line.match( '^\\t{' + scope.currentIndent + '}(\\w+):(.*){', '' );
3514
+ const matchProperty = line.match( '^\\t{' + ( scope.currentIndent ) + '}(\\w+):[\\s\\t\\r\\n](.*)' );
3515
+ const matchEnd = line.match( '^\\t{' + ( scope.currentIndent - 1 ) + '}}' );
3516
+
3517
+ if ( matchBeginning ) {
3518
+
3519
+ scope.parseNodeBegin( line, matchBeginning );
3520
+
3521
+ } else if ( matchProperty ) {
3522
+
3523
+ scope.parseNodeProperty( line, matchProperty, split[ ++ i ] );
3524
+
3525
+ } else if ( matchEnd ) {
3526
+
3527
+ scope.popStack();
3528
+
3529
+ } else if ( line.match( /^[^\s\t}]/ ) ) {
3530
+
3531
+ // large arrays are split over multiple lines terminated with a ',' character
3532
+ // if this is encountered the line needs to be joined to the previous line
3533
+ scope.parseNodePropertyContinued( line );
3534
+
3535
+ }
3536
+
3537
+ } );
3538
+
3539
+ return this.allNodes;
3540
+
3541
+ }
3542
+
3543
+ parseNodeBegin( line, property ) {
3544
+
3545
+ const nodeName = property[ 1 ].trim().replace( /^"/, '' ).replace( /"$/, '' );
3546
+
3547
+ const nodeAttrs = property[ 2 ].split( ',' ).map( function ( attr ) {
3548
+
3549
+ return attr.trim().replace( /^"/, '' ).replace( /"$/, '' );
3550
+
3551
+ } );
3552
+
3553
+ const node = { name: nodeName };
3554
+ const attrs = this.parseNodeAttr( nodeAttrs );
3555
+
3556
+ const currentNode = this.getCurrentNode();
3557
+
3558
+ // a top node
3559
+ if ( this.currentIndent === 0 ) {
3560
+
3561
+ this.allNodes.add( nodeName, node );
3562
+
3563
+ } else { // a subnode
3564
+
3565
+ // if the subnode already exists, append it
3566
+ if ( nodeName in currentNode ) {
3567
+
3568
+ // special case Pose needs PoseNodes as an array
3569
+ if ( nodeName === 'PoseNode' ) {
3570
+
3571
+ currentNode.PoseNode.push( node );
3572
+
3573
+ } else if ( currentNode[ nodeName ].id !== undefined ) {
3574
+
3575
+ currentNode[ nodeName ] = {};
3576
+ currentNode[ nodeName ][ currentNode[ nodeName ].id ] = currentNode[ nodeName ];
3577
+
3578
+ }
3579
+
3580
+ if ( attrs.id !== '' ) currentNode[ nodeName ][ attrs.id ] = node;
3581
+
3582
+ } else if ( typeof attrs.id === 'number' ) {
3583
+
3584
+ currentNode[ nodeName ] = {};
3585
+ currentNode[ nodeName ][ attrs.id ] = node;
3586
+
3587
+ } else if ( nodeName !== 'Properties70' ) {
3588
+
3589
+ if ( nodeName === 'PoseNode' ) currentNode[ nodeName ] = [ node ];
3590
+ else currentNode[ nodeName ] = node;
3591
+
3592
+ }
3593
+
3594
+ }
3595
+
3596
+ if ( typeof attrs.id === 'number' ) node.id = attrs.id;
3597
+ if ( attrs.name !== '' ) node.attrName = attrs.name;
3598
+ if ( attrs.type !== '' ) node.attrType = attrs.type;
3599
+
3600
+ this.pushStack( node );
3601
+
3602
+ }
3603
+
3604
+ parseNodeAttr( attrs ) {
3605
+
3606
+ let id = attrs[ 0 ];
3607
+
3608
+ if ( attrs[ 0 ] !== '' ) {
3609
+
3610
+ id = parseInt( attrs[ 0 ] );
3611
+
3612
+ if ( isNaN( id ) ) {
3613
+
3614
+ id = attrs[ 0 ];
3615
+
3616
+ }
3617
+
3618
+ }
3619
+
3620
+ let name = '', type = '';
3621
+
3622
+ if ( attrs.length > 1 ) {
3623
+
3624
+ name = attrs[ 1 ].replace( /^(\w+)::/, '' );
3625
+ type = attrs[ 2 ];
3626
+
3627
+ }
3628
+
3629
+ return { id: id, name: name, type: type };
3630
+
3631
+ }
3632
+
3633
+ parseNodeProperty( line, property, contentLine ) {
3634
+
3635
+ let propName = property[ 1 ].replace( /^"/, '' ).replace( /"$/, '' ).trim();
3636
+ let propValue = property[ 2 ].replace( /^"/, '' ).replace( /"$/, '' ).trim();
3637
+
3638
+ // for special case: base64 image data follows "Content: ," line
3639
+ // Content: ,
3640
+ // "/9j/4RDaRXhpZgAATU0A..."
3641
+ if ( propName === 'Content' && propValue === ',' ) {
3642
+
3643
+ propValue = contentLine.replace( /"/g, '' ).replace( /,$/, '' ).trim();
3644
+
3645
+ }
3646
+
3647
+ const currentNode = this.getCurrentNode();
3648
+ const parentName = currentNode.name;
3649
+
3650
+ if ( parentName === 'Properties70' ) {
3651
+
3652
+ this.parseNodeSpecialProperty( line, propName, propValue );
3653
+ return;
3654
+
3655
+ }
3656
+
3657
+ // Connections
3658
+ if ( propName === 'C' ) {
3659
+
3660
+ const connProps = propValue.split( ',' ).slice( 1 );
3661
+ const from = parseInt( connProps[ 0 ] );
3662
+ const to = parseInt( connProps[ 1 ] );
3663
+
3664
+ let rest = propValue.split( ',' ).slice( 3 );
3665
+
3666
+ rest = rest.map( function ( elem ) {
3667
+
3668
+ return elem.trim().replace( /^"/, '' );
3669
+
3670
+ } );
3671
+
3672
+ propName = 'connections';
3673
+ propValue = [ from, to ];
3674
+ append( propValue, rest );
3675
+
3676
+ if ( currentNode[ propName ] === undefined ) {
3677
+
3678
+ currentNode[ propName ] = [];
3679
+
3680
+ }
3681
+
3682
+ }
3683
+
3684
+ // Node
3685
+ if ( propName === 'Node' ) currentNode.id = propValue;
3686
+
3687
+ // connections
3688
+ if ( propName in currentNode && Array.isArray( currentNode[ propName ] ) ) {
3689
+
3690
+ currentNode[ propName ].push( propValue );
3691
+
3692
+ } else {
3693
+
3694
+ if ( propName !== 'a' ) currentNode[ propName ] = propValue;
3695
+ else currentNode.a = propValue;
3696
+
3697
+ }
3698
+
3699
+ this.setCurrentProp( currentNode, propName );
3700
+
3701
+ // convert string to array, unless it ends in ',' in which case more will be added to it
3702
+ if ( propName === 'a' && propValue.slice( - 1 ) !== ',' ) {
3703
+
3704
+ currentNode.a = parseNumberArray( propValue );
3705
+
3706
+ }
3707
+
3708
+ }
3709
+
3710
+ parseNodePropertyContinued( line ) {
3711
+
3712
+ const currentNode = this.getCurrentNode();
3713
+
3714
+ currentNode.a += line;
3715
+
3716
+ // if the line doesn't end in ',' we have reached the end of the property value
3717
+ // so convert the string to an array
3718
+ if ( line.slice( - 1 ) !== ',' ) {
3719
+
3720
+ currentNode.a = parseNumberArray( currentNode.a );
3721
+
3722
+ }
3723
+
3724
+ }
3725
+
3726
+ // parse "Property70"
3727
+ parseNodeSpecialProperty( line, propName, propValue ) {
3728
+
3729
+ // split this
3730
+ // P: "Lcl Scaling", "Lcl Scaling", "", "A",1,1,1
3731
+ // into array like below
3732
+ // ["Lcl Scaling", "Lcl Scaling", "", "A", "1,1,1" ]
3733
+ const props = propValue.split( '",' ).map( function ( prop ) {
3734
+
3735
+ return prop.trim().replace( /^\"/, '' ).replace( /\s/, '_' );
3736
+
3737
+ } );
3738
+
3739
+ const innerPropName = props[ 0 ];
3740
+ const innerPropType1 = props[ 1 ];
3741
+ const innerPropType2 = props[ 2 ];
3742
+ const innerPropFlag = props[ 3 ];
3743
+ let innerPropValue = props[ 4 ];
3744
+
3745
+ // cast values where needed, otherwise leave as strings
3746
+ switch ( innerPropType1 ) {
3747
+
3748
+ case 'int':
3749
+ case 'enum':
3750
+ case 'bool':
3751
+ case 'ULongLong':
3752
+ case 'double':
3753
+ case 'Number':
3754
+ case 'FieldOfView':
3755
+ innerPropValue = parseFloat( innerPropValue );
3756
+ break;
3757
+
3758
+ case 'Color':
3759
+ case 'ColorRGB':
3760
+ case 'Vector3D':
3761
+ case 'Lcl_Translation':
3762
+ case 'Lcl_Rotation':
3763
+ case 'Lcl_Scaling':
3764
+ innerPropValue = parseNumberArray( innerPropValue );
3765
+ break;
3766
+
3767
+ }
3768
+
3769
+ // CAUTION: these props must append to parent's parent
3770
+ this.getPrevNode()[ innerPropName ] = {
3771
+
3772
+ 'type': innerPropType1,
3773
+ 'type2': innerPropType2,
3774
+ 'flag': innerPropFlag,
3775
+ 'value': innerPropValue
3776
+
3777
+ };
3778
+
3779
+ this.setCurrentProp( this.getPrevNode(), innerPropName );
3780
+
3781
+ }
3782
+
3783
+ }
3784
+
3785
+ // Parse an FBX file in Binary format
3786
+ class BinaryParser {
3787
+
3788
+ parse( buffer ) {
3789
+
3790
+ const reader = new BinaryReader( buffer );
3791
+ reader.skip( 23 ); // skip magic 23 bytes
3792
+
3793
+ const version = reader.getUint32();
3794
+
3795
+ if ( version < 6400 ) {
3796
+
3797
+ throw new Error( 'THREE.FBXLoader: FBX version not supported, FileVersion: ' + version );
3798
+
3799
+ }
3800
+
3801
+ const allNodes = new FBXTree();
3802
+
3803
+ while ( ! this.endOfContent( reader ) ) {
3804
+
3805
+ const node = this.parseNode( reader, version );
3806
+ if ( node !== null ) allNodes.add( node.name, node );
3807
+
3808
+ }
3809
+
3810
+ return allNodes;
3811
+
3812
+ }
3813
+
3814
+ // Check if reader has reached the end of content.
3815
+ endOfContent( reader ) {
3816
+
3817
+ // footer size: 160bytes + 16-byte alignment padding
3818
+ // - 16bytes: magic
3819
+ // - padding til 16-byte alignment (at least 1byte?)
3820
+ // (seems like some exporters embed fixed 15 or 16bytes?)
3821
+ // - 4bytes: magic
3822
+ // - 4bytes: version
3823
+ // - 120bytes: zero
3824
+ // - 16bytes: magic
3825
+ if ( reader.size() % 16 === 0 ) {
3826
+
3827
+ return ( ( reader.getOffset() + 160 + 16 ) & ~ 0xf ) >= reader.size();
3828
+
3829
+ } else {
3830
+
3831
+ return reader.getOffset() + 160 + 16 >= reader.size();
3832
+
3833
+ }
3834
+
3835
+ }
3836
+
3837
+ // recursively parse nodes until the end of the file is reached
3838
+ parseNode( reader, version ) {
3839
+
3840
+ const node = {};
3841
+
3842
+ // The first three data sizes depends on version.
3843
+ const endOffset = ( version >= 7500 ) ? reader.getUint64() : reader.getUint32();
3844
+ const numProperties = ( version >= 7500 ) ? reader.getUint64() : reader.getUint32();
3845
+
3846
+ ( version >= 7500 ) ? reader.getUint64() : reader.getUint32(); // the returned propertyListLen is not used
3847
+
3848
+ const nameLen = reader.getUint8();
3849
+ const name = reader.getString( nameLen );
3850
+
3851
+ // Regards this node as NULL-record if endOffset is zero
3852
+ if ( endOffset === 0 ) return null;
3853
+
3854
+ const propertyList = [];
3855
+
3856
+ for ( let i = 0; i < numProperties; i ++ ) {
3857
+
3858
+ propertyList.push( this.parseProperty( reader ) );
3859
+
3860
+ }
3861
+
3862
+ // Regards the first three elements in propertyList as id, attrName, and attrType
3863
+ const id = propertyList.length > 0 ? propertyList[ 0 ] : '';
3864
+ const attrName = propertyList.length > 1 ? propertyList[ 1 ] : '';
3865
+ const attrType = propertyList.length > 2 ? propertyList[ 2 ] : '';
3866
+
3867
+ // check if this node represents just a single property
3868
+ // like (name, 0) set or (name2, [0, 1, 2]) set of {name: 0, name2: [0, 1, 2]}
3869
+ node.singleProperty = ( numProperties === 1 && reader.getOffset() === endOffset ) ? true : false;
3870
+
3871
+ while ( endOffset > reader.getOffset() ) {
3872
+
3873
+ const subNode = this.parseNode( reader, version );
3874
+
3875
+ if ( subNode !== null ) this.parseSubNode( name, node, subNode );
3876
+
3877
+ }
3878
+
3879
+ node.propertyList = propertyList; // raw property list used by parent
3880
+
3881
+ if ( typeof id === 'number' ) node.id = id;
3882
+ if ( attrName !== '' ) node.attrName = attrName;
3883
+ if ( attrType !== '' ) node.attrType = attrType;
3884
+ if ( name !== '' ) node.name = name;
3885
+
3886
+ return node;
3887
+
3888
+ }
3889
+
3890
+ parseSubNode( name, node, subNode ) {
3891
+
3892
+ // special case: child node is single property
3893
+ if ( subNode.singleProperty === true ) {
3894
+
3895
+ const value = subNode.propertyList[ 0 ];
3896
+
3897
+ if ( Array.isArray( value ) ) {
3898
+
3899
+ node[ subNode.name ] = subNode;
3900
+
3901
+ subNode.a = value;
3902
+
3903
+ } else {
3904
+
3905
+ node[ subNode.name ] = value;
3906
+
3907
+ }
3908
+
3909
+ } else if ( name === 'Connections' && subNode.name === 'C' ) {
3910
+
3911
+ const array = [];
3912
+
3913
+ subNode.propertyList.forEach( function ( property, i ) {
3914
+
3915
+ // first Connection is FBX type (OO, OP, etc.). We'll discard these
3916
+ if ( i !== 0 ) array.push( property );
3917
+
3918
+ } );
3919
+
3920
+ if ( node.connections === undefined ) {
3921
+
3922
+ node.connections = [];
3923
+
3924
+ }
3925
+
3926
+ node.connections.push( array );
3927
+
3928
+ } else if ( subNode.name === 'Properties70' ) {
3929
+
3930
+ const keys = Object.keys( subNode );
3931
+
3932
+ keys.forEach( function ( key ) {
3933
+
3934
+ node[ key ] = subNode[ key ];
3935
+
3936
+ } );
3937
+
3938
+ } else if ( name === 'Properties70' && subNode.name === 'P' ) {
3939
+
3940
+ let innerPropName = subNode.propertyList[ 0 ];
3941
+ let innerPropType1 = subNode.propertyList[ 1 ];
3942
+ const innerPropType2 = subNode.propertyList[ 2 ];
3943
+ const innerPropFlag = subNode.propertyList[ 3 ];
3944
+ let innerPropValue;
3945
+
3946
+ if ( innerPropName.indexOf( 'Lcl ' ) === 0 ) innerPropName = innerPropName.replace( 'Lcl ', 'Lcl_' );
3947
+ if ( innerPropType1.indexOf( 'Lcl ' ) === 0 ) innerPropType1 = innerPropType1.replace( 'Lcl ', 'Lcl_' );
3948
+
3949
+ if ( innerPropType1 === 'Color' || innerPropType1 === 'ColorRGB' || innerPropType1 === 'Vector' || innerPropType1 === 'Vector3D' || innerPropType1.indexOf( 'Lcl_' ) === 0 ) {
3950
+
3951
+ innerPropValue = [
3952
+ subNode.propertyList[ 4 ],
3953
+ subNode.propertyList[ 5 ],
3954
+ subNode.propertyList[ 6 ]
3955
+ ];
3956
+
3957
+ } else {
3958
+
3959
+ innerPropValue = subNode.propertyList[ 4 ];
3960
+
3961
+ }
3962
+
3963
+ // this will be copied to parent, see above
3964
+ node[ innerPropName ] = {
3965
+
3966
+ 'type': innerPropType1,
3967
+ 'type2': innerPropType2,
3968
+ 'flag': innerPropFlag,
3969
+ 'value': innerPropValue
3970
+
3971
+ };
3972
+
3973
+ } else if ( node[ subNode.name ] === undefined ) {
3974
+
3975
+ if ( typeof subNode.id === 'number' ) {
3976
+
3977
+ node[ subNode.name ] = {};
3978
+ node[ subNode.name ][ subNode.id ] = subNode;
3979
+
3980
+ } else {
3981
+
3982
+ node[ subNode.name ] = subNode;
3983
+
3984
+ }
3985
+
3986
+ } else {
3987
+
3988
+ if ( subNode.name === 'PoseNode' ) {
3989
+
3990
+ if ( ! Array.isArray( node[ subNode.name ] ) ) {
3991
+
3992
+ node[ subNode.name ] = [ node[ subNode.name ] ];
3993
+
3994
+ }
3995
+
3996
+ node[ subNode.name ].push( subNode );
3997
+
3998
+ } else if ( node[ subNode.name ][ subNode.id ] === undefined ) {
3999
+
4000
+ node[ subNode.name ][ subNode.id ] = subNode;
4001
+
4002
+ }
4003
+
4004
+ }
4005
+
4006
+ }
4007
+
4008
+ parseProperty( reader ) {
4009
+
4010
+ const type = reader.getString( 1 );
4011
+ let length;
4012
+
4013
+ switch ( type ) {
4014
+
4015
+ case 'C':
4016
+ return reader.getBoolean();
4017
+
4018
+ case 'D':
4019
+ return reader.getFloat64();
4020
+
4021
+ case 'F':
4022
+ return reader.getFloat32();
4023
+
4024
+ case 'I':
4025
+ return reader.getInt32();
4026
+
4027
+ case 'L':
4028
+ return reader.getInt64();
4029
+
4030
+ case 'R':
4031
+ length = reader.getUint32();
4032
+ return reader.getArrayBuffer( length );
4033
+
4034
+ case 'S':
4035
+ length = reader.getUint32();
4036
+ return reader.getString( length );
4037
+
4038
+ case 'Y':
4039
+ return reader.getInt16();
4040
+
4041
+ case 'b':
4042
+ case 'c':
4043
+ case 'd':
4044
+ case 'f':
4045
+ case 'i':
4046
+ case 'l':
4047
+
4048
+ const arrayLength = reader.getUint32();
4049
+ const encoding = reader.getUint32(); // 0: non-compressed, 1: compressed
4050
+ const compressedLength = reader.getUint32();
4051
+
4052
+ if ( encoding === 0 ) {
4053
+
4054
+ switch ( type ) {
4055
+
4056
+ case 'b':
4057
+ case 'c':
4058
+ return reader.getBooleanArray( arrayLength );
4059
+
4060
+ case 'd':
4061
+ return reader.getFloat64Array( arrayLength );
4062
+
4063
+ case 'f':
4064
+ return reader.getFloat32Array( arrayLength );
4065
+
4066
+ case 'i':
4067
+ return reader.getInt32Array( arrayLength );
4068
+
4069
+ case 'l':
4070
+ return reader.getInt64Array( arrayLength );
4071
+
4072
+ }
4073
+
4074
+ }
4075
+
4076
+ const data = unzlibSync( new Uint8Array( reader.getArrayBuffer( compressedLength ) ) );
4077
+ const reader2 = new BinaryReader( data.buffer );
4078
+
4079
+ switch ( type ) {
4080
+
4081
+ case 'b':
4082
+ case 'c':
4083
+ return reader2.getBooleanArray( arrayLength );
4084
+
4085
+ case 'd':
4086
+ return reader2.getFloat64Array( arrayLength );
4087
+
4088
+ case 'f':
4089
+ return reader2.getFloat32Array( arrayLength );
4090
+
4091
+ case 'i':
4092
+ return reader2.getInt32Array( arrayLength );
4093
+
4094
+ case 'l':
4095
+ return reader2.getInt64Array( arrayLength );
4096
+
4097
+ }
4098
+
4099
+ break; // cannot happen but is required by the DeepScan
4100
+
4101
+ default:
4102
+ throw new Error( 'THREE.FBXLoader: Unknown property type ' + type );
4103
+
4104
+ }
4105
+
4106
+ }
4107
+
4108
+ }
4109
+
4110
+ class BinaryReader {
4111
+
4112
+ constructor( buffer, littleEndian ) {
4113
+
4114
+ this.dv = new DataView( buffer );
4115
+ this.offset = 0;
4116
+ this.littleEndian = ( littleEndian !== undefined ) ? littleEndian : true;
4117
+ this._textDecoder = new TextDecoder();
4118
+
4119
+ }
4120
+
4121
+ getOffset() {
4122
+
4123
+ return this.offset;
4124
+
4125
+ }
4126
+
4127
+ size() {
4128
+
4129
+ return this.dv.buffer.byteLength;
4130
+
4131
+ }
4132
+
4133
+ skip( length ) {
4134
+
4135
+ this.offset += length;
4136
+
4137
+ }
4138
+
4139
+ // seems like true/false representation depends on exporter.
4140
+ // true: 1 or 'Y'(=0x59), false: 0 or 'T'(=0x54)
4141
+ // then sees LSB.
4142
+ getBoolean() {
4143
+
4144
+ return ( this.getUint8() & 1 ) === 1;
4145
+
4146
+ }
4147
+
4148
+ getBooleanArray( size ) {
4149
+
4150
+ const a = [];
4151
+
4152
+ for ( let i = 0; i < size; i ++ ) {
4153
+
4154
+ a.push( this.getBoolean() );
4155
+
4156
+ }
4157
+
4158
+ return a;
4159
+
4160
+ }
4161
+
4162
+ getUint8() {
4163
+
4164
+ const value = this.dv.getUint8( this.offset );
4165
+ this.offset += 1;
4166
+ return value;
4167
+
4168
+ }
4169
+
4170
+ getInt16() {
4171
+
4172
+ const value = this.dv.getInt16( this.offset, this.littleEndian );
4173
+ this.offset += 2;
4174
+ return value;
4175
+
4176
+ }
4177
+
4178
+ getInt32() {
4179
+
4180
+ const value = this.dv.getInt32( this.offset, this.littleEndian );
4181
+ this.offset += 4;
4182
+ return value;
4183
+
4184
+ }
4185
+
4186
+ getInt32Array( size ) {
4187
+
4188
+ const a = [];
4189
+
4190
+ for ( let i = 0; i < size; i ++ ) {
4191
+
4192
+ a.push( this.getInt32() );
4193
+
4194
+ }
4195
+
4196
+ return a;
4197
+
4198
+ }
4199
+
4200
+ getUint32() {
4201
+
4202
+ const value = this.dv.getUint32( this.offset, this.littleEndian );
4203
+ this.offset += 4;
4204
+ return value;
4205
+
4206
+ }
4207
+
4208
+ // JavaScript doesn't support 64-bit integer so calculate this here
4209
+ // 1 << 32 will return 1 so using multiply operation instead here.
4210
+ // There's a possibility that this method returns wrong value if the value
4211
+ // is out of the range between Number.MAX_SAFE_INTEGER and Number.MIN_SAFE_INTEGER.
4212
+ // TODO: safely handle 64-bit integer
4213
+ getInt64() {
4214
+
4215
+ let low, high;
4216
+
4217
+ if ( this.littleEndian ) {
4218
+
4219
+ low = this.getUint32();
4220
+ high = this.getUint32();
4221
+
4222
+ } else {
4223
+
4224
+ high = this.getUint32();
4225
+ low = this.getUint32();
4226
+
4227
+ }
4228
+
4229
+ // calculate negative value
4230
+ if ( high & 0x80000000 ) {
4231
+
4232
+ high = ~ high & 0xFFFFFFFF;
4233
+ low = ~ low & 0xFFFFFFFF;
4234
+
4235
+ if ( low === 0xFFFFFFFF ) high = ( high + 1 ) & 0xFFFFFFFF;
4236
+
4237
+ low = ( low + 1 ) & 0xFFFFFFFF;
4238
+
4239
+ return - ( high * 0x100000000 + low );
4240
+
4241
+ }
4242
+
4243
+ return high * 0x100000000 + low;
4244
+
4245
+ }
4246
+
4247
+ getInt64Array( size ) {
4248
+
4249
+ const a = [];
4250
+
4251
+ for ( let i = 0; i < size; i ++ ) {
4252
+
4253
+ a.push( this.getInt64() );
4254
+
4255
+ }
4256
+
4257
+ return a;
4258
+
4259
+ }
4260
+
4261
+ // Note: see getInt64() comment
4262
+ getUint64() {
4263
+
4264
+ let low, high;
4265
+
4266
+ if ( this.littleEndian ) {
4267
+
4268
+ low = this.getUint32();
4269
+ high = this.getUint32();
4270
+
4271
+ } else {
4272
+
4273
+ high = this.getUint32();
4274
+ low = this.getUint32();
4275
+
4276
+ }
4277
+
4278
+ return high * 0x100000000 + low;
4279
+
4280
+ }
4281
+
4282
+ getFloat32() {
4283
+
4284
+ const value = this.dv.getFloat32( this.offset, this.littleEndian );
4285
+ this.offset += 4;
4286
+ return value;
4287
+
4288
+ }
4289
+
4290
+ getFloat32Array( size ) {
4291
+
4292
+ const a = [];
4293
+
4294
+ for ( let i = 0; i < size; i ++ ) {
4295
+
4296
+ a.push( this.getFloat32() );
4297
+
4298
+ }
4299
+
4300
+ return a;
4301
+
4302
+ }
4303
+
4304
+ getFloat64() {
4305
+
4306
+ const value = this.dv.getFloat64( this.offset, this.littleEndian );
4307
+ this.offset += 8;
4308
+ return value;
4309
+
4310
+ }
4311
+
4312
+ getFloat64Array( size ) {
4313
+
4314
+ const a = [];
4315
+
4316
+ for ( let i = 0; i < size; i ++ ) {
4317
+
4318
+ a.push( this.getFloat64() );
4319
+
4320
+ }
4321
+
4322
+ return a;
4323
+
4324
+ }
4325
+
4326
+ getArrayBuffer( size ) {
4327
+
4328
+ const value = this.dv.buffer.slice( this.offset, this.offset + size );
4329
+ this.offset += size;
4330
+ return value;
4331
+
4332
+ }
4333
+
4334
+ getString( size ) {
4335
+
4336
+ const start = this.offset;
4337
+ let a = new Uint8Array( this.dv.buffer, start, size );
4338
+
4339
+ this.skip( size );
4340
+
4341
+ const nullByte = a.indexOf( 0 );
4342
+ if ( nullByte >= 0 ) a = new Uint8Array( this.dv.buffer, start, nullByte );
4343
+
4344
+ return this._textDecoder.decode( a );
4345
+
4346
+ }
4347
+
4348
+ }
4349
+
4350
+ // FBXTree holds a representation of the FBX data, returned by the TextParser ( FBX ASCII format)
4351
+ // and BinaryParser( FBX Binary format)
4352
+ class FBXTree {
4353
+
4354
+ add( key, val ) {
4355
+
4356
+ this[ key ] = val;
4357
+
4358
+ }
4359
+
4360
+ }
4361
+
4362
+ // ************** UTILITY FUNCTIONS **************
4363
+
4364
+ function isFbxFormatBinary( buffer ) {
4365
+
4366
+ const CORRECT = 'Kaydara\u0020FBX\u0020Binary\u0020\u0020\0';
4367
+
4368
+ return buffer.byteLength >= CORRECT.length && CORRECT === convertArrayBufferToString( buffer, 0, CORRECT.length );
4369
+
4370
+ }
4371
+
4372
+ function isFbxFormatASCII( text ) {
4373
+
4374
+ const CORRECT = [ 'K', 'a', 'y', 'd', 'a', 'r', 'a', '\\', 'F', 'B', 'X', '\\', 'B', 'i', 'n', 'a', 'r', 'y', '\\', '\\' ];
4375
+
4376
+ let cursor = 0;
4377
+
4378
+ function read( offset ) {
4379
+
4380
+ const result = text[ offset - 1 ];
4381
+ text = text.slice( cursor + offset );
4382
+ cursor ++;
4383
+ return result;
4384
+
4385
+ }
4386
+
4387
+ for ( let i = 0; i < CORRECT.length; ++ i ) {
4388
+
4389
+ const num = read( 1 );
4390
+ if ( num === CORRECT[ i ] ) {
4391
+
4392
+ return false;
4393
+
4394
+ }
4395
+
4396
+ }
4397
+
4398
+ return true;
4399
+
4400
+ }
4401
+
4402
+ function getFbxVersion( text ) {
4403
+
4404
+ const versionRegExp = /FBXVersion: (\d+)/;
4405
+ const match = text.match( versionRegExp );
4406
+
4407
+ if ( match ) {
4408
+
4409
+ const version = parseInt( match[ 1 ] );
4410
+ return version;
4411
+
4412
+ }
4413
+
4414
+ throw new Error( 'THREE.FBXLoader: Cannot find the version number for the file given.' );
4415
+
4416
+ }
4417
+
4418
+ // Converts FBX ticks into real time seconds.
4419
+ function convertFBXTimeToSeconds( time ) {
4420
+
4421
+ return time / 46186158000;
4422
+
4423
+ }
4424
+
4425
+ const dataArray = [];
4426
+
4427
+ // extracts the data from the correct position in the FBX array based on indexing type
4428
+ function getData( polygonVertexIndex, polygonIndex, vertexIndex, infoObject ) {
4429
+
4430
+ let index;
4431
+
4432
+ switch ( infoObject.mappingType ) {
4433
+
4434
+ case 'ByPolygonVertex' :
4435
+ index = polygonVertexIndex;
4436
+ break;
4437
+ case 'ByPolygon' :
4438
+ index = polygonIndex;
4439
+ break;
4440
+ case 'ByVertice' :
4441
+ index = vertexIndex;
4442
+ break;
4443
+ case 'AllSame' :
4444
+ index = infoObject.indices[ 0 ];
4445
+ break;
4446
+ default :
4447
+ console.warn( 'THREE.FBXLoader: unknown attribute mapping type ' + infoObject.mappingType );
4448
+
4449
+ }
4450
+
4451
+ if ( infoObject.referenceType === 'IndexToDirect' ) index = infoObject.indices[ index ];
4452
+
4453
+ const from = index * infoObject.dataSize;
4454
+ const to = from + infoObject.dataSize;
4455
+
4456
+ return slice( dataArray, infoObject.buffer, from, to );
4457
+
4458
+ }
4459
+
4460
+ const tempEuler = new Euler();
4461
+ const tempVec = new Vector3();
4462
+
4463
+ // generate transformation from FBX transform data
4464
+ // ref: https://help.autodesk.com/view/FBX/2017/ENU/?guid=__files_GUID_10CDD63C_79C1_4F2D_BB28_AD2BE65A02ED_htm
4465
+ // ref: http://docs.autodesk.com/FBX/2014/ENU/FBX-SDK-Documentation/index.html?url=cpp_ref/_transformations_2main_8cxx-example.html,topicNumber=cpp_ref__transformations_2main_8cxx_example_htmlfc10a1e1-b18d-4e72-9dc0-70d0f1959f5e
4466
+ function generateTransform( transformData ) {
4467
+
4468
+ const lTranslationM = new Matrix4();
4469
+ const lPreRotationM = new Matrix4();
4470
+ const lRotationM = new Matrix4();
4471
+ const lPostRotationM = new Matrix4();
4472
+
4473
+ const lScalingM = new Matrix4();
4474
+ const lScalingPivotM = new Matrix4();
4475
+ const lScalingOffsetM = new Matrix4();
4476
+ const lRotationOffsetM = new Matrix4();
4477
+ const lRotationPivotM = new Matrix4();
4478
+
4479
+ const lParentGX = new Matrix4();
4480
+ const lParentLX = new Matrix4();
4481
+ const lGlobalT = new Matrix4();
4482
+
4483
+ const inheritType = ( transformData.inheritType ) ? transformData.inheritType : 0;
4484
+
4485
+ if ( transformData.translation ) lTranslationM.setPosition( tempVec.fromArray( transformData.translation ) );
4486
+
4487
+ // For Maya models using "Joint Orient", Euler order only applies to rotation, not pre/post-rotations
4488
+ const defaultEulerOrder = getEulerOrder( 0 );
4489
+
4490
+ if ( transformData.preRotation ) {
4491
+
4492
+ const array = transformData.preRotation.map( MathUtils.degToRad );
4493
+ array.push( defaultEulerOrder );
4494
+ lPreRotationM.makeRotationFromEuler( tempEuler.fromArray( array ) );
4495
+
4496
+ }
4497
+
4498
+ if ( transformData.rotation ) {
4499
+
4500
+ const array = transformData.rotation.map( MathUtils.degToRad );
4501
+ array.push( transformData.eulerOrder || defaultEulerOrder );
4502
+ lRotationM.makeRotationFromEuler( tempEuler.fromArray( array ) );
4503
+
4504
+ }
4505
+
4506
+ if ( transformData.postRotation ) {
4507
+
4508
+ const array = transformData.postRotation.map( MathUtils.degToRad );
4509
+ array.push( defaultEulerOrder );
4510
+ lPostRotationM.makeRotationFromEuler( tempEuler.fromArray( array ) );
4511
+ lPostRotationM.invert();
4512
+
4513
+ }
4514
+
4515
+ if ( transformData.scale ) lScalingM.scale( tempVec.fromArray( transformData.scale ) );
4516
+
4517
+ // Pivots and offsets
4518
+ if ( transformData.scalingOffset ) lScalingOffsetM.setPosition( tempVec.fromArray( transformData.scalingOffset ) );
4519
+ if ( transformData.scalingPivot ) lScalingPivotM.setPosition( tempVec.fromArray( transformData.scalingPivot ) );
4520
+ if ( transformData.rotationOffset ) lRotationOffsetM.setPosition( tempVec.fromArray( transformData.rotationOffset ) );
4521
+ if ( transformData.rotationPivot ) lRotationPivotM.setPosition( tempVec.fromArray( transformData.rotationPivot ) );
4522
+
4523
+ // parent transform
4524
+ if ( transformData.parentMatrixWorld ) {
4525
+
4526
+ lParentLX.copy( transformData.parentMatrix );
4527
+ lParentGX.copy( transformData.parentMatrixWorld );
4528
+
4529
+ }
4530
+
4531
+ const lLRM = lPreRotationM.clone().multiply( lRotationM ).multiply( lPostRotationM );
4532
+ // Global Rotation
4533
+ const lParentGRM = new Matrix4();
4534
+ lParentGRM.extractRotation( lParentGX );
4535
+
4536
+ // Global Shear*Scaling
4537
+ const lParentTM = new Matrix4();
4538
+ lParentTM.copyPosition( lParentGX );
4539
+
4540
+ const lParentGRSM = lParentTM.clone().invert().multiply( lParentGX );
4541
+ const lParentGSM = lParentGRM.clone().invert().multiply( lParentGRSM );
4542
+ const lLSM = lScalingM;
4543
+
4544
+ const lGlobalRS = new Matrix4();
4545
+
4546
+ if ( inheritType === 0 ) {
4547
+
4548
+ lGlobalRS.copy( lParentGRM ).multiply( lLRM ).multiply( lParentGSM ).multiply( lLSM );
4549
+
4550
+ } else if ( inheritType === 1 ) {
4551
+
4552
+ lGlobalRS.copy( lParentGRM ).multiply( lParentGSM ).multiply( lLRM ).multiply( lLSM );
4553
+
4554
+ } else {
4555
+
4556
+ const lParentLSM = new Matrix4().scale( new Vector3().setFromMatrixScale( lParentLX ) );
4557
+ const lParentLSM_inv = lParentLSM.clone().invert();
4558
+ const lParentGSM_noLocal = lParentGSM.clone().multiply( lParentLSM_inv );
4559
+
4560
+ lGlobalRS.copy( lParentGRM ).multiply( lLRM ).multiply( lParentGSM_noLocal ).multiply( lLSM );
4561
+
4562
+ }
4563
+
4564
+ const lRotationPivotM_inv = lRotationPivotM.clone().invert();
4565
+ const lScalingPivotM_inv = lScalingPivotM.clone().invert();
4566
+ // Calculate the local transform matrix
4567
+ 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 );
4568
+
4569
+ const lLocalTWithAllPivotAndOffsetInfo = new Matrix4().copyPosition( lTransform );
4570
+
4571
+ const lGlobalTranslation = lParentGX.clone().multiply( lLocalTWithAllPivotAndOffsetInfo );
4572
+ lGlobalT.copyPosition( lGlobalTranslation );
4573
+
4574
+ lTransform = lGlobalT.clone().multiply( lGlobalRS );
4575
+
4576
+ // from global to local
4577
+ lTransform.premultiply( lParentGX.invert() );
4578
+
4579
+ return lTransform;
4580
+
4581
+ }
4582
+
4583
+ // Returns the three.js intrinsic Euler order corresponding to FBX extrinsic Euler order
4584
+ // ref: http://help.autodesk.com/view/FBX/2017/ENU/?guid=__cpp_ref_class_fbx_euler_html
4585
+ function getEulerOrder( order ) {
4586
+
4587
+ order = order || 0;
4588
+
4589
+ const enums = [
4590
+ 'ZYX', // -> XYZ extrinsic
4591
+ 'YZX', // -> XZY extrinsic
4592
+ 'XZY', // -> YZX extrinsic
4593
+ 'ZXY', // -> YXZ extrinsic
4594
+ 'YXZ', // -> ZXY extrinsic
4595
+ 'XYZ', // -> ZYX extrinsic
4596
+ //'SphericXYZ', // not possible to support
4597
+ ];
4598
+
4599
+ if ( order === 6 ) {
4600
+
4601
+ console.warn( 'THREE.FBXLoader: unsupported Euler Order: Spherical XYZ. Animations and rotations may be incorrect.' );
4602
+ return enums[ 0 ];
4603
+
4604
+ }
4605
+
4606
+ return enums[ order ];
4607
+
4608
+ }
4609
+
4610
+ // Parses comma separated list of numbers and returns them an array.
4611
+ // Used internally by the TextParser
4612
+ function parseNumberArray( value ) {
4613
+
4614
+ const array = value.split( ',' ).map( function ( val ) {
4615
+
4616
+ return parseFloat( val );
4617
+
4618
+ } );
4619
+
4620
+ return array;
4621
+
4622
+ }
4623
+
4624
+ function convertArrayBufferToString( buffer, from, to ) {
4625
+
4626
+ if ( from === undefined ) from = 0;
4627
+ if ( to === undefined ) to = buffer.byteLength;
4628
+
4629
+ return new TextDecoder().decode( new Uint8Array( buffer, from, to ) );
4630
+
4631
+ }
4632
+
4633
+ function append( a, b ) {
4634
+
4635
+ for ( let i = 0, j = a.length, l = b.length; i < l; i ++, j ++ ) {
4636
+
4637
+ a[ j ] = b[ i ];
4638
+
4639
+ }
4640
+
4641
+ }
4642
+
4643
+ function slice( a, b, from, to ) {
4644
+
4645
+ for ( let i = from, j = 0; i < to; i ++, j ++ ) {
4646
+
4647
+ a[ j ] = b[ i ];
4648
+
4649
+ }
4650
+
4651
+ return a;
4652
+
4653
+ }
4654
+
4655
+
4656
+ export { FBXLoader };