three-stdlib 2.25.0 → 2.26.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (540) hide show
  1. package/controls/OrbitControls.d.ts +1 -0
  2. package/index.cjs +116465 -611
  3. package/index.js +116101 -263
  4. package/package.json +17 -4
  5. package/_polyfill/CapsuleGeometry.cjs +0 -22
  6. package/_polyfill/CapsuleGeometry.js +0 -22
  7. package/_polyfill/CompressedArrayTexture.cjs +0 -12
  8. package/_polyfill/CompressedArrayTexture.js +0 -12
  9. package/_polyfill/Data3DTexture.cjs +0 -17
  10. package/_polyfill/Data3DTexture.js +0 -17
  11. package/animation/AnimationClipCreator.cjs +0 -56
  12. package/animation/AnimationClipCreator.js +0 -56
  13. package/animation/CCDIKSolver.cjs +0 -269
  14. package/animation/CCDIKSolver.js +0 -269
  15. package/animation/MMDAnimationHelper.cjs +0 -688
  16. package/animation/MMDAnimationHelper.js +0 -688
  17. package/animation/MMDPhysics.cjs +0 -830
  18. package/animation/MMDPhysics.js +0 -830
  19. package/cameras/CinematicCamera.cjs +0 -131
  20. package/cameras/CinematicCamera.js +0 -131
  21. package/controls/ArcballControls.cjs +0 -2033
  22. package/controls/ArcballControls.js +0 -2033
  23. package/controls/DeviceOrientationControls.cjs +0 -85
  24. package/controls/DeviceOrientationControls.js +0 -85
  25. package/controls/DragControls.cjs +0 -182
  26. package/controls/DragControls.js +0 -182
  27. package/controls/FirstPersonControls.cjs +0 -229
  28. package/controls/FirstPersonControls.js +0 -229
  29. package/controls/FlyControls.cjs +0 -248
  30. package/controls/FlyControls.js +0 -248
  31. package/controls/OrbitControls.cjs +0 -791
  32. package/controls/OrbitControls.js +0 -791
  33. package/controls/PointerLockControls.cjs +0 -103
  34. package/controls/PointerLockControls.js +0 -103
  35. package/controls/TrackballControls.cjs +0 -502
  36. package/controls/TrackballControls.js +0 -502
  37. package/controls/TransformControls.cjs +0 -1089
  38. package/controls/TransformControls.js +0 -1089
  39. package/controls/experimental/CameraControls.cjs +0 -736
  40. package/controls/experimental/CameraControls.js +0 -736
  41. package/csm/CSM.cjs +0 -244
  42. package/csm/CSM.js +0 -244
  43. package/csm/CSMFrustum.cjs +0 -75
  44. package/csm/CSMFrustum.js +0 -75
  45. package/csm/CSMHelper.cjs +0 -114
  46. package/csm/CSMHelper.js +0 -114
  47. package/csm/CSMShader.cjs +0 -261
  48. package/csm/CSMShader.js +0 -261
  49. package/curves/CurveExtras.cjs +0 -214
  50. package/curves/CurveExtras.js +0 -214
  51. package/curves/NURBSCurve.cjs +0 -35
  52. package/curves/NURBSCurve.js +0 -35
  53. package/curves/NURBSSurface.cjs +0 -28
  54. package/curves/NURBSSurface.js +0 -28
  55. package/curves/NURBSUtils.cjs +0 -226
  56. package/curves/NURBSUtils.js +0 -226
  57. package/deprecated/Geometry.cjs +0 -971
  58. package/deprecated/Geometry.js +0 -971
  59. package/effects/AnaglyphEffect.cjs +0 -102
  60. package/effects/AnaglyphEffect.js +0 -102
  61. package/effects/AsciiEffect.cjs +0 -155
  62. package/effects/AsciiEffect.js +0 -155
  63. package/effects/OutlineEffect.cjs +0 -275
  64. package/effects/OutlineEffect.js +0 -275
  65. package/effects/ParallaxBarrierEffect.cjs +0 -65
  66. package/effects/ParallaxBarrierEffect.js +0 -65
  67. package/effects/PeppersGhostEffect.cjs +0 -88
  68. package/effects/PeppersGhostEffect.js +0 -88
  69. package/effects/StereoEffect.cjs +0 -35
  70. package/effects/StereoEffect.js +0 -35
  71. package/environments/RoomEnvironment.cjs +0 -95
  72. package/environments/RoomEnvironment.js +0 -78
  73. package/exporters/ColladaExporter.cjs +0 -331
  74. package/exporters/ColladaExporter.js +0 -331
  75. package/exporters/DRACOExporter.cjs +0 -141
  76. package/exporters/DRACOExporter.js +0 -141
  77. package/exporters/GLTFExporter.cjs +0 -1909
  78. package/exporters/GLTFExporter.js +0 -1909
  79. package/exporters/MMDExporter.cjs +0 -131
  80. package/exporters/MMDExporter.js +0 -131
  81. package/exporters/OBJExporter.cjs +0 -181
  82. package/exporters/OBJExporter.js +0 -181
  83. package/exporters/PLYExporter.cjs +0 -280
  84. package/exporters/PLYExporter.js +0 -280
  85. package/exporters/STLExporter.cjs +0 -146
  86. package/exporters/STLExporter.js +0 -146
  87. package/exporters/USDZExporter.cjs +0 -340
  88. package/exporters/USDZExporter.js +0 -340
  89. package/geometries/BoxLineGeometry.cjs +0 -45
  90. package/geometries/BoxLineGeometry.js +0 -45
  91. package/geometries/ConvexGeometry.cjs +0 -26
  92. package/geometries/ConvexGeometry.js +0 -26
  93. package/geometries/DecalGeometry.cjs +0 -184
  94. package/geometries/DecalGeometry.js +0 -184
  95. package/geometries/LightningStrike.cjs +0 -553
  96. package/geometries/LightningStrike.js +0 -553
  97. package/geometries/ParametricGeometries.cjs +0 -130
  98. package/geometries/ParametricGeometries.js +0 -130
  99. package/geometries/ParametricGeometry.cjs +0 -63
  100. package/geometries/ParametricGeometry.js +0 -63
  101. package/geometries/RoundedBoxGeometry.cjs +0 -91
  102. package/geometries/RoundedBoxGeometry.js +0 -91
  103. package/geometries/TeapotGeometry.cjs +0 -1563
  104. package/geometries/TeapotGeometry.js +0 -1563
  105. package/geometries/TextGeometry.cjs +0 -27
  106. package/geometries/TextGeometry.js +0 -27
  107. package/helpers/LightProbeHelper.cjs +0 -73
  108. package/helpers/LightProbeHelper.js +0 -73
  109. package/helpers/PositionalAudioHelper.cjs +0 -68
  110. package/helpers/PositionalAudioHelper.js +0 -68
  111. package/helpers/RectAreaLightHelper.cjs +0 -44
  112. package/helpers/RectAreaLightHelper.js +0 -44
  113. package/helpers/VertexNormalsHelper.cjs +0 -47
  114. package/helpers/VertexNormalsHelper.js +0 -47
  115. package/helpers/VertexTangentsHelper.cjs +0 -43
  116. package/helpers/VertexTangentsHelper.js +0 -43
  117. package/interactive/HTMLMesh.cjs +0 -325
  118. package/interactive/HTMLMesh.js +0 -325
  119. package/interactive/InteractiveGroup.cjs +0 -68
  120. package/interactive/InteractiveGroup.js +0 -68
  121. package/interactive/SelectionBox.cjs +0 -134
  122. package/interactive/SelectionBox.js +0 -134
  123. package/interactive/SelectionHelper.cjs +0 -51
  124. package/interactive/SelectionHelper.js +0 -51
  125. package/libs/MeshoptDecoder.cjs +0 -221
  126. package/libs/MeshoptDecoder.js +0 -221
  127. package/libs/MotionControllers.cjs +0 -325
  128. package/libs/MotionControllers.js +0 -325
  129. package/lights/LightProbeGenerator.cjs +0 -145
  130. package/lights/LightProbeGenerator.js +0 -145
  131. package/lights/RectAreaLightUniformsLib.cjs +0 -32846
  132. package/lights/RectAreaLightUniformsLib.js +0 -32846
  133. package/lines/Line2.cjs +0 -13
  134. package/lines/Line2.js +0 -13
  135. package/lines/LineGeometry.cjs +0 -44
  136. package/lines/LineGeometry.js +0 -44
  137. package/lines/LineMaterial.cjs +0 -547
  138. package/lines/LineMaterial.js +0 -547
  139. package/lines/LineSegments2.cjs +0 -203
  140. package/lines/LineSegments2.js +0 -203
  141. package/lines/LineSegmentsGeometry.cjs +0 -124
  142. package/lines/LineSegmentsGeometry.js +0 -124
  143. package/lines/Wireframe.cjs +0 -32
  144. package/lines/Wireframe.js +0 -32
  145. package/lines/WireframeGeometry2.cjs +0 -13
  146. package/lines/WireframeGeometry2.js +0 -13
  147. package/loaders/3DMLoader.cjs +0 -803
  148. package/loaders/3DMLoader.js +0 -803
  149. package/loaders/3MFLoader.cjs +0 -854
  150. package/loaders/3MFLoader.js +0 -854
  151. package/loaders/AMFLoader.cjs +0 -284
  152. package/loaders/AMFLoader.js +0 -284
  153. package/loaders/AssimpLoader.cjs +0 -1434
  154. package/loaders/AssimpLoader.js +0 -1434
  155. package/loaders/BVHLoader.cjs +0 -207
  156. package/loaders/BVHLoader.js +0 -207
  157. package/loaders/BasisTextureLoader.cjs +0 -489
  158. package/loaders/BasisTextureLoader.js +0 -489
  159. package/loaders/ColladaLoader.cjs +0 -2405
  160. package/loaders/ColladaLoader.js +0 -2405
  161. package/loaders/DDSLoader.cjs +0 -148
  162. package/loaders/DDSLoader.js +0 -148
  163. package/loaders/DRACOLoader.cjs +0 -341
  164. package/loaders/DRACOLoader.js +0 -341
  165. package/loaders/EXRLoader.cjs +0 -1356
  166. package/loaders/EXRLoader.js +0 -1356
  167. package/loaders/FBXLoader.cjs +0 -2457
  168. package/loaders/FBXLoader.js +0 -2457
  169. package/loaders/FontLoader.cjs +0 -123
  170. package/loaders/FontLoader.js +0 -123
  171. package/loaders/GCodeLoader.cjs +0 -141
  172. package/loaders/GCodeLoader.js +0 -141
  173. package/loaders/GLTFLoader.cjs +0 -2504
  174. package/loaders/GLTFLoader.js +0 -2504
  175. package/loaders/HDRCubeTextureLoader.cjs +0 -75
  176. package/loaders/HDRCubeTextureLoader.js +0 -75
  177. package/loaders/KMZLoader.cjs +0 -75
  178. package/loaders/KMZLoader.js +0 -75
  179. package/loaders/KTX2Loader.cjs +0 -480
  180. package/loaders/KTX2Loader.js +0 -480
  181. package/loaders/KTXLoader.cjs +0 -93
  182. package/loaders/KTXLoader.js +0 -93
  183. package/loaders/LDrawLoader.cjs +0 -1424
  184. package/loaders/LDrawLoader.js +0 -1424
  185. package/loaders/LUT3dlLoader.cjs +0 -103
  186. package/loaders/LUT3dlLoader.js +0 -103
  187. package/loaders/LUTCubeLoader.cjs +0 -107
  188. package/loaders/LUTCubeLoader.js +0 -107
  189. package/loaders/LWOLoader.cjs +0 -645
  190. package/loaders/LWOLoader.js +0 -645
  191. package/loaders/LottieLoader.cjs +0 -47
  192. package/loaders/LottieLoader.js +0 -47
  193. package/loaders/MD2Loader.cjs +0 -359
  194. package/loaders/MD2Loader.js +0 -359
  195. package/loaders/MDDLoader.cjs +0 -58
  196. package/loaders/MDDLoader.js +0 -58
  197. package/loaders/MMDLoader.cjs +0 -1121
  198. package/loaders/MMDLoader.js +0 -1121
  199. package/loaders/MTLLoader.cjs +0 -304
  200. package/loaders/MTLLoader.js +0 -304
  201. package/loaders/NRRDLoader.cjs +0 -401
  202. package/loaders/NRRDLoader.js +0 -401
  203. package/loaders/OBJLoader.cjs +0 -487
  204. package/loaders/OBJLoader.js +0 -487
  205. package/loaders/PCDLoader.cjs +0 -248
  206. package/loaders/PCDLoader.js +0 -248
  207. package/loaders/PDBLoader.cjs +0 -247
  208. package/loaders/PDBLoader.js +0 -247
  209. package/loaders/PLYLoader.cjs +0 -317
  210. package/loaders/PLYLoader.js +0 -317
  211. package/loaders/PRWMLoader.cjs +0 -160
  212. package/loaders/PRWMLoader.js +0 -160
  213. package/loaders/PVRLoader.cjs +0 -131
  214. package/loaders/PVRLoader.js +0 -131
  215. package/loaders/RGBELoader.cjs +0 -252
  216. package/loaders/RGBELoader.js +0 -252
  217. package/loaders/RGBMLoader.cjs +0 -1004
  218. package/loaders/RGBMLoader.js +0 -1004
  219. package/loaders/STLLoader.cjs +0 -190
  220. package/loaders/STLLoader.js +0 -190
  221. package/loaders/SVGLoader.cjs +0 -1712
  222. package/loaders/SVGLoader.js +0 -1712
  223. package/loaders/TDSLoader.cjs +0 -650
  224. package/loaders/TDSLoader.js +0 -650
  225. package/loaders/TGALoader.cjs +0 -285
  226. package/loaders/TGALoader.js +0 -285
  227. package/loaders/TTFLoader.cjs +0 -131
  228. package/loaders/TTFLoader.js +0 -131
  229. package/loaders/TiltLoader.cjs +0 -375
  230. package/loaders/TiltLoader.js +0 -375
  231. package/loaders/VOXLoader.cjs +0 -432
  232. package/loaders/VOXLoader.js +0 -432
  233. package/loaders/VRMLLoader.cjs +0 -2105
  234. package/loaders/VRMLLoader.js +0 -2105
  235. package/loaders/VRMLoader.cjs +0 -38
  236. package/loaders/VRMLoader.js +0 -38
  237. package/loaders/VTKLoader.cjs +0 -648
  238. package/loaders/VTKLoader.js +0 -648
  239. package/loaders/XLoader.cjs +0 -1258
  240. package/loaders/XLoader.js +0 -1258
  241. package/loaders/XYZLoader.cjs +0 -60
  242. package/loaders/XYZLoader.js +0 -60
  243. package/loaders/lwo/IFFParser.cjs +0 -743
  244. package/loaders/lwo/IFFParser.js +0 -743
  245. package/loaders/lwo/LWO2Parser.cjs +0 -312
  246. package/loaders/lwo/LWO2Parser.js +0 -312
  247. package/loaders/lwo/LWO3Parser.cjs +0 -282
  248. package/loaders/lwo/LWO3Parser.js +0 -282
  249. package/math/Capsule.cjs +0 -98
  250. package/math/Capsule.js +0 -98
  251. package/math/ColorConverter.cjs +0 -42
  252. package/math/ColorConverter.js +0 -42
  253. package/math/ConvexHull.cjs +0 -596
  254. package/math/ConvexHull.js +0 -596
  255. package/math/ImprovedNoise.cjs +0 -304
  256. package/math/ImprovedNoise.js +0 -304
  257. package/math/Lut.cjs +0 -137
  258. package/math/Lut.js +0 -137
  259. package/math/MeshSurfaceSampler.cjs +0 -103
  260. package/math/MeshSurfaceSampler.js +0 -103
  261. package/math/OBB.cjs +0 -242
  262. package/math/OBB.js +0 -242
  263. package/math/Octree.cjs +0 -273
  264. package/math/Octree.js +0 -273
  265. package/math/SimplexNoise.cjs +0 -440
  266. package/math/SimplexNoise.js +0 -440
  267. package/misc/ConvexObjectBreaker.cjs +0 -292
  268. package/misc/ConvexObjectBreaker.js +0 -292
  269. package/misc/GPUComputationRenderer.cjs +0 -205
  270. package/misc/GPUComputationRenderer.js +0 -205
  271. package/misc/Gyroscope.cjs +0 -33
  272. package/misc/Gyroscope.js +0 -33
  273. package/misc/MD2Character.cjs +0 -167
  274. package/misc/MD2Character.js +0 -167
  275. package/misc/MD2CharacterComplex.cjs +0 -332
  276. package/misc/MD2CharacterComplex.js +0 -332
  277. package/misc/MorphAnimMesh.cjs +0 -40
  278. package/misc/MorphAnimMesh.js +0 -40
  279. package/misc/MorphBlendMesh.cjs +0 -179
  280. package/misc/MorphBlendMesh.js +0 -179
  281. package/misc/ProgressiveLightmap.cjs +0 -186
  282. package/misc/ProgressiveLightmap.js +0 -186
  283. package/misc/RollerCoaster.cjs +0 -353
  284. package/misc/RollerCoaster.js +0 -353
  285. package/misc/Timer.cjs +0 -101
  286. package/misc/Timer.js +0 -101
  287. package/misc/TubePainter.cjs +0 -123
  288. package/misc/TubePainter.js +0 -123
  289. package/misc/Volume.cjs +0 -305
  290. package/misc/Volume.js +0 -305
  291. package/misc/VolumeSlice.cjs +0 -114
  292. package/misc/VolumeSlice.js +0 -114
  293. package/misc/WebGL.cjs +0 -74
  294. package/misc/WebGL.js +0 -74
  295. package/modifiers/CurveModifier.cjs +0 -232
  296. package/modifiers/CurveModifier.js +0 -232
  297. package/modifiers/EdgeSplitModifier.cjs +0 -167
  298. package/modifiers/EdgeSplitModifier.js +0 -168
  299. package/modifiers/SimplifyModifier.cjs +0 -301
  300. package/modifiers/SimplifyModifier.js +0 -301
  301. package/modifiers/TessellateModifier.cjs +0 -214
  302. package/modifiers/TessellateModifier.js +0 -214
  303. package/objects/GroundProjectedEnv.cjs +0 -134
  304. package/objects/GroundProjectedEnv.js +0 -134
  305. package/objects/Lensflare.cjs +0 -291
  306. package/objects/Lensflare.js +0 -291
  307. package/objects/LightningStorm.cjs +0 -110
  308. package/objects/LightningStorm.js +0 -110
  309. package/objects/MarchingCubes.cjs +0 -4809
  310. package/objects/MarchingCubes.js +0 -4809
  311. package/objects/Reflector.cjs +0 -202
  312. package/objects/Reflector.js +0 -202
  313. package/objects/ReflectorForSSRPass.cjs +0 -260
  314. package/objects/ReflectorForSSRPass.js +0 -260
  315. package/objects/ReflectorRTT.cjs +0 -10
  316. package/objects/ReflectorRTT.js +0 -10
  317. package/objects/Refractor.cjs +0 -215
  318. package/objects/Refractor.js +0 -215
  319. package/objects/ShadowMesh.cjs +0 -45
  320. package/objects/ShadowMesh.js +0 -45
  321. package/objects/Sky.cjs +0 -200
  322. package/objects/Sky.js +0 -200
  323. package/objects/Water.cjs +0 -242
  324. package/objects/Water.js +0 -242
  325. package/objects/Water2.cjs +0 -256
  326. package/objects/Water2.js +0 -256
  327. package/physics/AmmoPhysics.cjs +0 -166
  328. package/physics/AmmoPhysics.js +0 -166
  329. package/postprocessing/AdaptiveToneMappingPass.cjs +0 -218
  330. package/postprocessing/AdaptiveToneMappingPass.js +0 -218
  331. package/postprocessing/AfterimagePass.cjs +0 -68
  332. package/postprocessing/AfterimagePass.js +0 -68
  333. package/postprocessing/BloomPass.cjs +0 -109
  334. package/postprocessing/BloomPass.js +0 -109
  335. package/postprocessing/BokehPass.cjs +0 -90
  336. package/postprocessing/BokehPass.js +0 -90
  337. package/postprocessing/ClearPass.cjs +0 -36
  338. package/postprocessing/ClearPass.js +0 -36
  339. package/postprocessing/CubeTexturePass.cjs +0 -53
  340. package/postprocessing/CubeTexturePass.js +0 -53
  341. package/postprocessing/DotScreenPass.cjs +0 -49
  342. package/postprocessing/DotScreenPass.js +0 -49
  343. package/postprocessing/EffectComposer.cjs +0 -157
  344. package/postprocessing/EffectComposer.js +0 -157
  345. package/postprocessing/FilmPass.cjs +0 -51
  346. package/postprocessing/FilmPass.js +0 -51
  347. package/postprocessing/GlitchPass.cjs +0 -84
  348. package/postprocessing/GlitchPass.js +0 -84
  349. package/postprocessing/HalftonePass.cjs +0 -53
  350. package/postprocessing/HalftonePass.js +0 -53
  351. package/postprocessing/LUTPass.cjs +0 -142
  352. package/postprocessing/LUTPass.js +0 -142
  353. package/postprocessing/MaskPass.cjs +0 -69
  354. package/postprocessing/MaskPass.js +0 -69
  355. package/postprocessing/OutlinePass.cjs +0 -479
  356. package/postprocessing/OutlinePass.js +0 -479
  357. package/postprocessing/Pass.cjs +0 -48
  358. package/postprocessing/Pass.js +0 -48
  359. package/postprocessing/RenderPass.cjs +0 -59
  360. package/postprocessing/RenderPass.js +0 -59
  361. package/postprocessing/RenderPixelatedPass.cjs +0 -199
  362. package/postprocessing/RenderPixelatedPass.js +0 -199
  363. package/postprocessing/SAOPass.cjs +0 -288
  364. package/postprocessing/SAOPass.js +0 -288
  365. package/postprocessing/SMAAPass.cjs +0 -112
  366. package/postprocessing/SMAAPass.js +0 -112
  367. package/postprocessing/SSAARenderPass.cjs +0 -189
  368. package/postprocessing/SSAARenderPass.js +0 -189
  369. package/postprocessing/SSAOPass.cjs +0 -272
  370. package/postprocessing/SSAOPass.js +0 -272
  371. package/postprocessing/SSRPass.cjs +0 -411
  372. package/postprocessing/SSRPass.js +0 -411
  373. package/postprocessing/SavePass.cjs +0 -38
  374. package/postprocessing/SavePass.js +0 -38
  375. package/postprocessing/ShaderPass.cjs +0 -49
  376. package/postprocessing/ShaderPass.js +0 -49
  377. package/postprocessing/TAARenderPass.cjs +0 -174
  378. package/postprocessing/TAARenderPass.js +0 -174
  379. package/postprocessing/TexturePass.cjs +0 -42
  380. package/postprocessing/TexturePass.js +0 -42
  381. package/postprocessing/UnrealBloomPass.cjs +0 -277
  382. package/postprocessing/UnrealBloomPass.js +0 -277
  383. package/postprocessing/WaterPass.cjs +0 -72
  384. package/postprocessing/WaterPass.js +0 -72
  385. package/renderers/CSS2DRenderer.cjs +0 -122
  386. package/renderers/CSS2DRenderer.js +0 -122
  387. package/renderers/CSS3DRenderer.cjs +0 -167
  388. package/renderers/CSS3DRenderer.js +0 -167
  389. package/renderers/Projector.cjs +0 -499
  390. package/renderers/Projector.js +0 -499
  391. package/renderers/SVGRenderer.cjs +0 -311
  392. package/renderers/SVGRenderer.js +0 -311
  393. package/shaders/ACESFilmicToneMappingShader.cjs +0 -55
  394. package/shaders/ACESFilmicToneMappingShader.js +0 -55
  395. package/shaders/AfterimageShader.cjs +0 -32
  396. package/shaders/AfterimageShader.js +0 -32
  397. package/shaders/BasicShader.cjs +0 -12
  398. package/shaders/BasicShader.js +0 -12
  399. package/shaders/BleachBypassShader.cjs +0 -35
  400. package/shaders/BleachBypassShader.js +0 -35
  401. package/shaders/BlendShader.cjs +0 -30
  402. package/shaders/BlendShader.js +0 -30
  403. package/shaders/BokehShader.cjs +0 -109
  404. package/shaders/BokehShader.js +0 -109
  405. package/shaders/BokehShader2.cjs +0 -269
  406. package/shaders/BokehShader2.js +0 -269
  407. package/shaders/BrightnessContrastShader.cjs +0 -32
  408. package/shaders/BrightnessContrastShader.js +0 -32
  409. package/shaders/ColorCorrectionShader.cjs +0 -30
  410. package/shaders/ColorCorrectionShader.js +0 -30
  411. package/shaders/ColorifyShader.cjs +0 -28
  412. package/shaders/ColorifyShader.js +0 -28
  413. package/shaders/ConvolutionShader.cjs +0 -55
  414. package/shaders/ConvolutionShader.js +0 -55
  415. package/shaders/CopyShader.cjs +0 -25
  416. package/shaders/CopyShader.js +0 -25
  417. package/shaders/DOFMipMapShader.cjs +0 -32
  418. package/shaders/DOFMipMapShader.js +0 -32
  419. package/shaders/DepthLimitedBlurShader.cjs +0 -114
  420. package/shaders/DepthLimitedBlurShader.js +0 -114
  421. package/shaders/DigitalGlitch.cjs +0 -85
  422. package/shaders/DigitalGlitch.js +0 -85
  423. package/shaders/DotScreenShader.cjs +0 -39
  424. package/shaders/DotScreenShader.js +0 -39
  425. package/shaders/FXAAShader.cjs +0 -1098
  426. package/shaders/FXAAShader.js +0 -1098
  427. package/shaders/FilmShader.cjs +0 -53
  428. package/shaders/FilmShader.js +0 -53
  429. package/shaders/FocusShader.cjs +0 -55
  430. package/shaders/FocusShader.js +0 -55
  431. package/shaders/FreiChenShader.cjs +0 -64
  432. package/shaders/FreiChenShader.js +0 -64
  433. package/shaders/FresnelShader.cjs +0 -47
  434. package/shaders/FresnelShader.js +0 -47
  435. package/shaders/GammaCorrectionShader.cjs +0 -23
  436. package/shaders/GammaCorrectionShader.js +0 -23
  437. package/shaders/GodRaysShader.cjs +0 -183
  438. package/shaders/GodRaysShader.js +0 -183
  439. package/shaders/HalftoneShader.cjs +0 -228
  440. package/shaders/HalftoneShader.js +0 -228
  441. package/shaders/HorizontalBlurShader.cjs +0 -49
  442. package/shaders/HorizontalBlurShader.js +0 -49
  443. package/shaders/HorizontalTiltShiftShader.cjs +0 -37
  444. package/shaders/HorizontalTiltShiftShader.js +0 -37
  445. package/shaders/HueSaturationShader.cjs +0 -43
  446. package/shaders/HueSaturationShader.js +0 -43
  447. package/shaders/KaleidoShader.cjs +0 -34
  448. package/shaders/KaleidoShader.js +0 -34
  449. package/shaders/LuminosityHighPassShader.cjs +0 -37
  450. package/shaders/LuminosityHighPassShader.js +0 -37
  451. package/shaders/LuminosityShader.cjs +0 -25
  452. package/shaders/LuminosityShader.js +0 -25
  453. package/shaders/MirrorShader.cjs +0 -35
  454. package/shaders/MirrorShader.js +0 -35
  455. package/shaders/NormalMapShader.cjs +0 -31
  456. package/shaders/NormalMapShader.js +0 -31
  457. package/shaders/ParallaxShader.cjs +0 -133
  458. package/shaders/ParallaxShader.js +0 -133
  459. package/shaders/PixelShader.cjs +0 -28
  460. package/shaders/PixelShader.js +0 -28
  461. package/shaders/RGBShiftShader.cjs +0 -30
  462. package/shaders/RGBShiftShader.js +0 -30
  463. package/shaders/SAOShader.cjs +0 -144
  464. package/shaders/SAOShader.js +0 -144
  465. package/shaders/SMAAShader.cjs +0 -358
  466. package/shaders/SMAAShader.js +0 -358
  467. package/shaders/SSAOShader.cjs +0 -182
  468. package/shaders/SSAOShader.js +0 -182
  469. package/shaders/SSRShader.cjs +0 -342
  470. package/shaders/SSRShader.js +0 -342
  471. package/shaders/SepiaShader.cjs +0 -29
  472. package/shaders/SepiaShader.js +0 -29
  473. package/shaders/SobelOperatorShader.cjs +0 -54
  474. package/shaders/SobelOperatorShader.js +0 -54
  475. package/shaders/SubsurfaceScatteringShader.cjs +0 -98
  476. package/shaders/SubsurfaceScatteringShader.js +0 -98
  477. package/shaders/TechnicolorShader.cjs +0 -24
  478. package/shaders/TechnicolorShader.js +0 -24
  479. package/shaders/ToneMapShader.cjs +0 -51
  480. package/shaders/ToneMapShader.js +0 -51
  481. package/shaders/ToonShader.cjs +0 -188
  482. package/shaders/ToonShader.js +0 -188
  483. package/shaders/TriangleBlurShader.cjs +0 -37
  484. package/shaders/TriangleBlurShader.js +0 -37
  485. package/shaders/UnpackDepthRGBAShader.cjs +0 -26
  486. package/shaders/UnpackDepthRGBAShader.js +0 -26
  487. package/shaders/VerticalBlurShader.cjs +0 -50
  488. package/shaders/VerticalBlurShader.js +0 -50
  489. package/shaders/VerticalTiltShiftShader.cjs +0 -37
  490. package/shaders/VerticalTiltShiftShader.js +0 -37
  491. package/shaders/VignetteShader.cjs +0 -38
  492. package/shaders/VignetteShader.js +0 -38
  493. package/shaders/VolumeShader.cjs +0 -225
  494. package/shaders/VolumeShader.js +0 -225
  495. package/shaders/WaterRefractionShader.cjs +0 -59
  496. package/shaders/WaterRefractionShader.js +0 -59
  497. package/shaders/types.cjs +0 -1
  498. package/shaders/types.js +0 -1
  499. package/textures/FlakesTexture.cjs +0 -30
  500. package/textures/FlakesTexture.js +0 -30
  501. package/types/helpers.cjs +0 -4
  502. package/types/helpers.js +0 -4
  503. package/utils/BufferGeometryUtils.cjs +0 -636
  504. package/utils/BufferGeometryUtils.js +0 -636
  505. package/utils/GeometryCompressionUtils.cjs +0 -573
  506. package/utils/GeometryCompressionUtils.js +0 -573
  507. package/utils/GeometryUtils.cjs +0 -109
  508. package/utils/GeometryUtils.js +0 -109
  509. package/utils/RoughnessMipmapper.cjs +0 -223
  510. package/utils/RoughnessMipmapper.js +0 -223
  511. package/utils/SceneUtils.cjs +0 -36
  512. package/utils/SceneUtils.js +0 -36
  513. package/utils/ShadowMapViewer.cjs +0 -111
  514. package/utils/ShadowMapViewer.js +0 -111
  515. package/utils/SkeletonUtils.cjs +0 -211
  516. package/utils/SkeletonUtils.js +0 -211
  517. package/utils/UVsDebug.cjs +0 -80
  518. package/utils/UVsDebug.js +0 -80
  519. package/utils/WorkerPool.cjs +0 -62
  520. package/utils/WorkerPool.js +0 -62
  521. package/webxr/ARButton.cjs +0 -119
  522. package/webxr/ARButton.js +0 -119
  523. package/webxr/OculusHandModel.cjs +0 -82
  524. package/webxr/OculusHandModel.js +0 -82
  525. package/webxr/OculusHandPointerModel.cjs +0 -241
  526. package/webxr/OculusHandPointerModel.js +0 -224
  527. package/webxr/Text2D.cjs +0 -48
  528. package/webxr/Text2D.js +0 -31
  529. package/webxr/VRButton.cjs +0 -111
  530. package/webxr/VRButton.js +0 -111
  531. package/webxr/XRControllerModelFactory.cjs +0 -174
  532. package/webxr/XRControllerModelFactory.js +0 -174
  533. package/webxr/XREstimatedLight.cjs +0 -126
  534. package/webxr/XREstimatedLight.js +0 -126
  535. package/webxr/XRHandMeshModel.cjs +0 -82
  536. package/webxr/XRHandMeshModel.js +0 -82
  537. package/webxr/XRHandModelFactory.cjs +0 -61
  538. package/webxr/XRHandModelFactory.js +0 -61
  539. package/webxr/XRHandPrimitiveModel.cjs +0 -68
  540. package/webxr/XRHandPrimitiveModel.js +0 -68
@@ -1,331 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4
- var __publicField = (obj, key, value) => {
5
- __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
6
- return value;
7
- };
8
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
9
- const THREE = require("three");
10
- class ColladaExporter {
11
- constructor() {
12
- __publicField(this, "options");
13
- __publicField(this, "geometryInfo");
14
- __publicField(this, "materialMap");
15
- __publicField(this, "imageMap");
16
- __publicField(this, "textures");
17
- __publicField(this, "libraryImages");
18
- __publicField(this, "libraryGeometries");
19
- __publicField(this, "libraryEffects");
20
- __publicField(this, "libraryMaterials");
21
- __publicField(this, "canvas");
22
- __publicField(this, "ctx");
23
- __publicField(this, "transMat");
24
- __publicField(this, "getFuncs", ["getX", "getY", "getZ", "getW"]);
25
- this.options = {
26
- version: "1.4.1",
27
- author: null,
28
- textureDirectory: "",
29
- upAxis: "Y_UP",
30
- unitName: null,
31
- unitMeter: null
32
- };
33
- this.geometryInfo = /* @__PURE__ */ new WeakMap();
34
- this.materialMap = /* @__PURE__ */ new WeakMap();
35
- this.imageMap = /* @__PURE__ */ new WeakMap();
36
- this.textures = [];
37
- this.libraryImages = [];
38
- this.libraryGeometries = [];
39
- this.libraryEffects = [];
40
- this.libraryMaterials = [];
41
- this.canvas = null;
42
- this.ctx = null;
43
- this.transMat = null;
44
- }
45
- parse(object, onDone, options = {}) {
46
- this.options = { ...this.options, ...options };
47
- if (this.options.upAxis.match(/^[XYZ]_UP$/) === null) {
48
- console.error("ColladaExporter: Invalid upAxis: valid values are X_UP, Y_UP or Z_UP.");
49
- return null;
50
- }
51
- if (this.options.unitName !== null && this.options.unitMeter === null) {
52
- console.error("ColladaExporter: unitMeter needs to be specified if unitName is specified.");
53
- return null;
54
- }
55
- if (this.options.unitMeter !== null && this.options.unitName === null) {
56
- console.error("ColladaExporter: unitName needs to be specified if unitMeter is specified.");
57
- return null;
58
- }
59
- if (this.options.textureDirectory !== "") {
60
- this.options.textureDirectory = `${this.options.textureDirectory}/`.replace(/\\/g, "/").replace(/\/+/g, "/");
61
- }
62
- if (this.options.version !== "1.4.1" && this.options.version !== "1.5.0") {
63
- console.warn(`ColladaExporter : Version ${this.options.version} not supported for export. Only 1.4.1 and 1.5.0.`);
64
- return null;
65
- }
66
- const libraryVisualScenes = this.processObject(object);
67
- const specLink = this.options.version === "1.4.1" ? "http://www.collada.org/2005/11/COLLADASchema" : "https://www.khronos.org/collada/";
68
- let dae = `<?xml version="1.0" encoding="UTF-8" standalone="no" ?>${`<COLLADA xmlns="${specLink}" version="${this.options.version}">`}<asset><contributor><authoring_tool>three.js Collada Exporter</authoring_tool>${this.options.author !== null ? `<author>${this.options.author}</author>` : ""}</contributor>${`<created>${(/* @__PURE__ */ new Date()).toISOString()}</created>`}${`<modified>${(/* @__PURE__ */ new Date()).toISOString()}</modified>`}<up_axis>Y_UP</up_axis></asset>`;
69
- dae += `<library_images>${this.libraryImages.join("")}</library_images>`;
70
- dae += `<library_effects>${this.libraryEffects.join("")}</library_effects>`;
71
- dae += `<library_materials>${this.libraryMaterials.join("")}</library_materials>`;
72
- dae += `<library_geometries>${this.libraryGeometries.join("")}</library_geometries>`;
73
- dae += `<library_visual_scenes><visual_scene id="Scene" name="scene">${libraryVisualScenes}</visual_scene></library_visual_scenes>`;
74
- dae += '<scene><instance_visual_scene url="#Scene"/></scene>';
75
- dae += "</COLLADA>";
76
- const res = {
77
- data: this.format(dae),
78
- textures: this.textures
79
- };
80
- if (typeof onDone === "function") {
81
- requestAnimationFrame(() => onDone(res));
82
- }
83
- return res;
84
- }
85
- // Convert the urdf xml into a well-formatted, indented format
86
- format(urdf) {
87
- var _a, _b;
88
- const IS_END_TAG = /^<\//;
89
- const IS_SELF_CLOSING = /(\?>$)|(\/>$)/;
90
- const HAS_TEXT = /<[^>]+>[^<]*<\/[^<]+>/;
91
- const pad = (ch, num) => num > 0 ? ch + pad(ch, num - 1) : "";
92
- let tagnum = 0;
93
- return (_b = (_a = urdf.match(/(<[^>]+>[^<]+<\/[^<]+>)|(<[^>]+>)/g)) == null ? void 0 : _a.map((tag) => {
94
- if (!HAS_TEXT.test(tag) && !IS_SELF_CLOSING.test(tag) && IS_END_TAG.test(tag)) {
95
- tagnum--;
96
- }
97
- const res = `${pad(" ", tagnum)}${tag}`;
98
- if (!HAS_TEXT.test(tag) && !IS_SELF_CLOSING.test(tag) && !IS_END_TAG.test(tag)) {
99
- tagnum++;
100
- }
101
- return res;
102
- }).join("\n")) != null ? _b : "";
103
- }
104
- // Convert an image into a png format for saving
105
- base64ToBuffer(str) {
106
- const b = atob(str);
107
- const buf = new Uint8Array(b.length);
108
- for (let i = 0, l = buf.length; i < l; i++) {
109
- buf[i] = b.charCodeAt(i);
110
- }
111
- return buf;
112
- }
113
- imageToData(image, ext) {
114
- var _a;
115
- this.canvas = this.canvas || document.createElement("canvas");
116
- this.ctx = this.ctx || this.canvas.getContext("2d");
117
- this.canvas.width = image.width instanceof SVGAnimatedLength ? 0 : image.width;
118
- this.canvas.height = image.height instanceof SVGAnimatedLength ? 0 : image.height;
119
- (_a = this.ctx) == null ? void 0 : _a.drawImage(image, 0, 0);
120
- const base64data = this.canvas.toDataURL(`image/${ext}`, 1).replace(/^data:image\/(png|jpg);base64,/, "");
121
- return this.base64ToBuffer(base64data);
122
- }
123
- // gets the attribute array. Generate a new array if the attribute is interleaved
124
- attrBufferToArray(attr) {
125
- if (attr instanceof THREE.InterleavedBufferAttribute && attr.isInterleavedBufferAttribute) {
126
- const TypedArrayConstructor = attr.array.constructor;
127
- const arr = new TypedArrayConstructor(attr.count * attr.itemSize);
128
- const size = attr.itemSize;
129
- for (let i = 0, l = attr.count; i < l; i++) {
130
- for (let j = 0; j < size; j++) {
131
- arr[i * size + j] = attr[this.getFuncs[j]](i);
132
- }
133
- }
134
- return arr;
135
- } else {
136
- return attr.array;
137
- }
138
- }
139
- // Returns an array of the same type starting at the `st` index,
140
- // and `ct` length
141
- subArray(arr, st, ct) {
142
- if (Array.isArray(arr)) {
143
- return arr.slice(st, st + ct);
144
- } else {
145
- const TypedArrayConstructor = arr.constructor;
146
- return new TypedArrayConstructor(arr.buffer, st * arr.BYTES_PER_ELEMENT, ct);
147
- }
148
- }
149
- // Returns the string for a geometry's attribute
150
- getAttribute(attr, name, params, type) {
151
- const array = this.attrBufferToArray(attr);
152
- const res = Array.isArray(array) ? `${`<source id="${name}"><float_array id="${name}-array" count="${array.length}">` + array.join(" ")}</float_array><technique_common>${`<accessor source="#${name}-array" count="${Math.floor(
153
- array.length / attr.itemSize
154
- )}" stride="${attr.itemSize}">`}${params.map((n) => `<param name="${n}" type="${type}" />`).join("")}</accessor></technique_common></source>` : "";
155
- return res;
156
- }
157
- // Returns the string for a node's transform information
158
- getTransform(o) {
159
- o.updateMatrix();
160
- this.transMat = this.transMat || new THREE.Matrix4();
161
- this.transMat.copy(o.matrix);
162
- this.transMat.transpose();
163
- return `<matrix>${this.transMat.toArray().join(" ")}</matrix>`;
164
- }
165
- // Process the given piece of geometry into the geometry library
166
- // Returns the mesh id
167
- processGeometry(g) {
168
- let info = this.geometryInfo.get(g);
169
- if (!info) {
170
- const bufferGeometry = g;
171
- if (!bufferGeometry.isBufferGeometry) {
172
- throw new Error("THREE.ColladaExporter: Geometry is not of type THREE.BufferGeometry.");
173
- }
174
- const meshid = `Mesh${this.libraryGeometries.length + 1}`;
175
- const indexCount = bufferGeometry.index ? bufferGeometry.index.count * bufferGeometry.index.itemSize : bufferGeometry.attributes.position.count;
176
- const groups = bufferGeometry.groups != null && bufferGeometry.groups.length !== 0 ? bufferGeometry.groups : [{ start: 0, count: indexCount, materialIndex: 0 }];
177
- const gname = g.name ? ` name="${g.name}"` : "";
178
- let gnode = `<geometry id="${meshid}"${gname}><mesh>`;
179
- const posName = `${meshid}-position`;
180
- const vertName = `${meshid}-vertices`;
181
- gnode += this.getAttribute(bufferGeometry.attributes.position, posName, ["X", "Y", "Z"], "float");
182
- gnode += `<vertices id="${vertName}"><input semantic="POSITION" source="#${posName}" /></vertices>`;
183
- let triangleInputs = `<input semantic="VERTEX" source="#${vertName}" offset="0" />`;
184
- if ("normal" in bufferGeometry.attributes) {
185
- const normName = `${meshid}-normal`;
186
- gnode += this.getAttribute(bufferGeometry.attributes.normal, normName, ["X", "Y", "Z"], "float");
187
- triangleInputs += `<input semantic="NORMAL" source="#${normName}" offset="0" />`;
188
- }
189
- if ("uv" in bufferGeometry.attributes) {
190
- const uvName = `${meshid}-texcoord`;
191
- gnode += this.getAttribute(bufferGeometry.attributes.uv, uvName, ["S", "T"], "float");
192
- triangleInputs += `<input semantic="TEXCOORD" source="#${uvName}" offset="0" set="0" />`;
193
- }
194
- if ("uv2" in bufferGeometry.attributes) {
195
- const uvName = `${meshid}-texcoord2`;
196
- gnode += this.getAttribute(bufferGeometry.attributes.uv2, uvName, ["S", "T"], "float");
197
- triangleInputs += `<input semantic="TEXCOORD" source="#${uvName}" offset="0" set="1" />`;
198
- }
199
- if ("color" in bufferGeometry.attributes) {
200
- const colName = `${meshid}-color`;
201
- gnode += this.getAttribute(bufferGeometry.attributes.color, colName, ["X", "Y", "Z"], "uint8");
202
- triangleInputs += `<input semantic="COLOR" source="#${colName}" offset="0" />`;
203
- }
204
- let indexArray = null;
205
- if (bufferGeometry.index) {
206
- indexArray = this.attrBufferToArray(bufferGeometry.index);
207
- } else {
208
- indexArray = new Array(indexCount);
209
- for (let i = 0, l = indexArray.length; i < l && Array.isArray(indexArray); i++)
210
- indexArray[i] = i;
211
- }
212
- for (let i = 0, l = groups.length; i < l; i++) {
213
- const group = groups[i];
214
- const subarr = this.subArray(indexArray, group.start, group.count);
215
- const polycount = subarr.length / 3;
216
- gnode += `<triangles material="MESH_MATERIAL_${group.materialIndex}" count="${polycount}">`;
217
- gnode += triangleInputs;
218
- gnode += `<p>${subarr.join(" ")}</p>`;
219
- gnode += "</triangles>";
220
- }
221
- gnode += "</mesh></geometry>";
222
- this.libraryGeometries.push(gnode);
223
- info = { meshid, bufferGeometry };
224
- this.geometryInfo.set(g, info);
225
- }
226
- return info;
227
- }
228
- // Process the given texture into the image library
229
- // Returns the image library
230
- processTexture(tex) {
231
- let texid = this.imageMap.get(tex);
232
- if (texid == null) {
233
- texid = `image-${this.libraryImages.length + 1}`;
234
- const ext = "png";
235
- const name = tex.name || texid;
236
- let imageNode = `<image id="${texid}" name="${name}">`;
237
- if (this.options.version === "1.5.0") {
238
- imageNode += `<init_from><ref>${this.options.textureDirectory}${name}.${ext}</ref></init_from>`;
239
- } else {
240
- imageNode += `<init_from>${this.options.textureDirectory}${name}.${ext}</init_from>`;
241
- }
242
- imageNode += "</image>";
243
- this.libraryImages.push(imageNode);
244
- this.imageMap.set(tex, texid);
245
- this.textures.push({
246
- directory: this.options.textureDirectory,
247
- name,
248
- ext,
249
- data: this.imageToData(tex.image, ext),
250
- original: tex
251
- });
252
- }
253
- return texid;
254
- }
255
- // Process the given material into the material and effect libraries
256
- // Returns the material id
257
- processMaterial(m) {
258
- let matid = this.materialMap.get(m);
259
- if (matid == null) {
260
- matid = `Mat${this.libraryEffects.length + 1}`;
261
- let type = "phong";
262
- if (m instanceof THREE.MeshLambertMaterial) {
263
- type = "lambert";
264
- } else if (m instanceof THREE.MeshBasicMaterial) {
265
- type = "constant";
266
- if (m.map !== null) {
267
- console.warn("ColladaExporter: Texture maps not supported with MeshBasicMaterial.");
268
- }
269
- }
270
- if (m instanceof THREE.MeshPhongMaterial) {
271
- const emissive = m.emissive ? m.emissive : new THREE.Color(0, 0, 0);
272
- const diffuse = m.color ? m.color : new THREE.Color(0, 0, 0);
273
- const specular = m.specular ? m.specular : new THREE.Color(1, 1, 1);
274
- const shininess = m.shininess || 0;
275
- const reflectivity = m.reflectivity || 0;
276
- let transparencyNode = "";
277
- if (m.transparent) {
278
- transparencyNode += `<transparent>${m.map ? '<texture texture="diffuse-sampler"></texture>' : "<float>1</float>"}</transparent>`;
279
- if (m.opacity < 1) {
280
- transparencyNode += `<transparency><float>${m.opacity}</float></transparency>`;
281
- }
282
- }
283
- const techniqueNode = `${`<technique sid="common"><${type}>`}<emission>${m.emissiveMap ? '<texture texture="emissive-sampler" texcoord="TEXCOORD" />' : `<color sid="emission">${emissive.r} ${emissive.g} ${emissive.b} 1</color>`}</emission>${type !== "constant" ? `<diffuse>${m.map ? '<texture texture="diffuse-sampler" texcoord="TEXCOORD" />' : `<color sid="diffuse">${diffuse.r} ${diffuse.g} ${diffuse.b} 1</color>`}</diffuse>` : ""}${type !== "constant" ? `<bump>${m.normalMap ? '<texture texture="bump-sampler" texcoord="TEXCOORD" />' : ""}</bump>` : ""}${type === "phong" ? `${`<specular><color sid="specular">${specular.r} ${specular.g} ${specular.b} 1</color></specular>`}<shininess>${m.specularMap ? '<texture texture="specular-sampler" texcoord="TEXCOORD" />' : `<float sid="shininess">${shininess}</float>`}</shininess>` : ""}${`<reflective><color>${diffuse.r} ${diffuse.g} ${diffuse.b} 1</color></reflective>`}${`<reflectivity><float>${reflectivity}</float></reflectivity>`}${transparencyNode}${`</${type}></technique>`}`;
284
- const effectnode = `${`<effect id="${matid}-effect">`}<profile_COMMON>${m.map ? `<newparam sid="diffuse-surface"><surface type="2D">${`<init_from>${this.processTexture(
285
- m.map
286
- )}</init_from>`}</surface></newparam><newparam sid="diffuse-sampler"><sampler2D><source>diffuse-surface</source></sampler2D></newparam>` : ""}${m.specularMap ? `<newparam sid="specular-surface"><surface type="2D">${`<init_from>${this.processTexture(
287
- m.specularMap
288
- )}</init_from>`}</surface></newparam><newparam sid="specular-sampler"><sampler2D><source>specular-surface</source></sampler2D></newparam>` : ""}${m.emissiveMap ? `<newparam sid="emissive-surface"><surface type="2D">${`<init_from>${this.processTexture(
289
- m.emissiveMap
290
- )}</init_from>`}</surface></newparam><newparam sid="emissive-sampler"><sampler2D><source>emissive-surface</source></sampler2D></newparam>` : ""}${m.normalMap ? `<newparam sid="bump-surface"><surface type="2D">${`<init_from>${this.processTexture(
291
- m.normalMap
292
- )}</init_from>`}</surface></newparam><newparam sid="bump-sampler"><sampler2D><source>bump-surface</source></sampler2D></newparam>` : ""}${techniqueNode}${m.side === THREE.DoubleSide ? '<extra><technique profile="THREEJS"><double_sided sid="double_sided" type="int">1</double_sided></technique></extra>' : ""}</profile_COMMON></effect>`;
293
- const materialName = m.name ? ` name="${m.name}"` : "";
294
- const materialNode = `<material id="${matid}"${materialName}><instance_effect url="#${matid}-effect" /></material>`;
295
- this.libraryMaterials.push(materialNode);
296
- this.libraryEffects.push(effectnode);
297
- this.materialMap.set(m, matid);
298
- }
299
- }
300
- return matid;
301
- }
302
- // Recursively process the object into a scene
303
- processObject(o) {
304
- let node = `<node name="${o.name}">`;
305
- node += this.getTransform(o);
306
- const a = new THREE.Mesh();
307
- a.geometry;
308
- if (o instanceof THREE.Mesh && o.isMesh && o.geometry !== null) {
309
- const geomInfo = this.processGeometry(o.geometry);
310
- const meshid = geomInfo.meshid;
311
- const geometry = geomInfo.bufferGeometry;
312
- let matids = null;
313
- let matidsArray;
314
- const mat = o.material || new THREE.MeshBasicMaterial();
315
- const materials = Array.isArray(mat) ? mat : [mat];
316
- if (geometry.groups.length > materials.length) {
317
- matidsArray = new Array(geometry.groups.length);
318
- } else {
319
- matidsArray = new Array(materials.length);
320
- }
321
- matids = matidsArray.fill(null).map((_, i) => this.processMaterial(materials[i % materials.length]));
322
- node += `${`<instance_geometry url="#${meshid}">` + (matids != null ? `<bind_material><technique_common>${matids.map(
323
- (id, i) => `${`<instance_material symbol="MESH_MATERIAL_${i}" target="#${id}" >`}<bind_vertex_input semantic="TEXCOORD" input_semantic="TEXCOORD" input_set="0" /></instance_material>`
324
- ).join("")}</technique_common></bind_material>` : "")}</instance_geometry>`;
325
- }
326
- o.children.forEach((c) => node += this.processObject(c));
327
- node += "</node>";
328
- return node;
329
- }
330
- }
331
- exports.ColladaExporter = ColladaExporter;
@@ -1,331 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
- var __publicField = (obj, key, value) => {
4
- __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
- return value;
6
- };
7
- import { InterleavedBufferAttribute, Matrix4, MeshLambertMaterial, MeshBasicMaterial, MeshPhongMaterial, Color, DoubleSide, Mesh } from "three";
8
- class ColladaExporter {
9
- constructor() {
10
- __publicField(this, "options");
11
- __publicField(this, "geometryInfo");
12
- __publicField(this, "materialMap");
13
- __publicField(this, "imageMap");
14
- __publicField(this, "textures");
15
- __publicField(this, "libraryImages");
16
- __publicField(this, "libraryGeometries");
17
- __publicField(this, "libraryEffects");
18
- __publicField(this, "libraryMaterials");
19
- __publicField(this, "canvas");
20
- __publicField(this, "ctx");
21
- __publicField(this, "transMat");
22
- __publicField(this, "getFuncs", ["getX", "getY", "getZ", "getW"]);
23
- this.options = {
24
- version: "1.4.1",
25
- author: null,
26
- textureDirectory: "",
27
- upAxis: "Y_UP",
28
- unitName: null,
29
- unitMeter: null
30
- };
31
- this.geometryInfo = /* @__PURE__ */ new WeakMap();
32
- this.materialMap = /* @__PURE__ */ new WeakMap();
33
- this.imageMap = /* @__PURE__ */ new WeakMap();
34
- this.textures = [];
35
- this.libraryImages = [];
36
- this.libraryGeometries = [];
37
- this.libraryEffects = [];
38
- this.libraryMaterials = [];
39
- this.canvas = null;
40
- this.ctx = null;
41
- this.transMat = null;
42
- }
43
- parse(object, onDone, options = {}) {
44
- this.options = { ...this.options, ...options };
45
- if (this.options.upAxis.match(/^[XYZ]_UP$/) === null) {
46
- console.error("ColladaExporter: Invalid upAxis: valid values are X_UP, Y_UP or Z_UP.");
47
- return null;
48
- }
49
- if (this.options.unitName !== null && this.options.unitMeter === null) {
50
- console.error("ColladaExporter: unitMeter needs to be specified if unitName is specified.");
51
- return null;
52
- }
53
- if (this.options.unitMeter !== null && this.options.unitName === null) {
54
- console.error("ColladaExporter: unitName needs to be specified if unitMeter is specified.");
55
- return null;
56
- }
57
- if (this.options.textureDirectory !== "") {
58
- this.options.textureDirectory = `${this.options.textureDirectory}/`.replace(/\\/g, "/").replace(/\/+/g, "/");
59
- }
60
- if (this.options.version !== "1.4.1" && this.options.version !== "1.5.0") {
61
- console.warn(`ColladaExporter : Version ${this.options.version} not supported for export. Only 1.4.1 and 1.5.0.`);
62
- return null;
63
- }
64
- const libraryVisualScenes = this.processObject(object);
65
- const specLink = this.options.version === "1.4.1" ? "http://www.collada.org/2005/11/COLLADASchema" : "https://www.khronos.org/collada/";
66
- let dae = `<?xml version="1.0" encoding="UTF-8" standalone="no" ?>${`<COLLADA xmlns="${specLink}" version="${this.options.version}">`}<asset><contributor><authoring_tool>three.js Collada Exporter</authoring_tool>${this.options.author !== null ? `<author>${this.options.author}</author>` : ""}</contributor>${`<created>${(/* @__PURE__ */ new Date()).toISOString()}</created>`}${`<modified>${(/* @__PURE__ */ new Date()).toISOString()}</modified>`}<up_axis>Y_UP</up_axis></asset>`;
67
- dae += `<library_images>${this.libraryImages.join("")}</library_images>`;
68
- dae += `<library_effects>${this.libraryEffects.join("")}</library_effects>`;
69
- dae += `<library_materials>${this.libraryMaterials.join("")}</library_materials>`;
70
- dae += `<library_geometries>${this.libraryGeometries.join("")}</library_geometries>`;
71
- dae += `<library_visual_scenes><visual_scene id="Scene" name="scene">${libraryVisualScenes}</visual_scene></library_visual_scenes>`;
72
- dae += '<scene><instance_visual_scene url="#Scene"/></scene>';
73
- dae += "</COLLADA>";
74
- const res = {
75
- data: this.format(dae),
76
- textures: this.textures
77
- };
78
- if (typeof onDone === "function") {
79
- requestAnimationFrame(() => onDone(res));
80
- }
81
- return res;
82
- }
83
- // Convert the urdf xml into a well-formatted, indented format
84
- format(urdf) {
85
- var _a, _b;
86
- const IS_END_TAG = /^<\//;
87
- const IS_SELF_CLOSING = /(\?>$)|(\/>$)/;
88
- const HAS_TEXT = /<[^>]+>[^<]*<\/[^<]+>/;
89
- const pad = (ch, num) => num > 0 ? ch + pad(ch, num - 1) : "";
90
- let tagnum = 0;
91
- return (_b = (_a = urdf.match(/(<[^>]+>[^<]+<\/[^<]+>)|(<[^>]+>)/g)) == null ? void 0 : _a.map((tag) => {
92
- if (!HAS_TEXT.test(tag) && !IS_SELF_CLOSING.test(tag) && IS_END_TAG.test(tag)) {
93
- tagnum--;
94
- }
95
- const res = `${pad(" ", tagnum)}${tag}`;
96
- if (!HAS_TEXT.test(tag) && !IS_SELF_CLOSING.test(tag) && !IS_END_TAG.test(tag)) {
97
- tagnum++;
98
- }
99
- return res;
100
- }).join("\n")) != null ? _b : "";
101
- }
102
- // Convert an image into a png format for saving
103
- base64ToBuffer(str) {
104
- const b = atob(str);
105
- const buf = new Uint8Array(b.length);
106
- for (let i = 0, l = buf.length; i < l; i++) {
107
- buf[i] = b.charCodeAt(i);
108
- }
109
- return buf;
110
- }
111
- imageToData(image, ext) {
112
- var _a;
113
- this.canvas = this.canvas || document.createElement("canvas");
114
- this.ctx = this.ctx || this.canvas.getContext("2d");
115
- this.canvas.width = image.width instanceof SVGAnimatedLength ? 0 : image.width;
116
- this.canvas.height = image.height instanceof SVGAnimatedLength ? 0 : image.height;
117
- (_a = this.ctx) == null ? void 0 : _a.drawImage(image, 0, 0);
118
- const base64data = this.canvas.toDataURL(`image/${ext}`, 1).replace(/^data:image\/(png|jpg);base64,/, "");
119
- return this.base64ToBuffer(base64data);
120
- }
121
- // gets the attribute array. Generate a new array if the attribute is interleaved
122
- attrBufferToArray(attr) {
123
- if (attr instanceof InterleavedBufferAttribute && attr.isInterleavedBufferAttribute) {
124
- const TypedArrayConstructor = attr.array.constructor;
125
- const arr = new TypedArrayConstructor(attr.count * attr.itemSize);
126
- const size = attr.itemSize;
127
- for (let i = 0, l = attr.count; i < l; i++) {
128
- for (let j = 0; j < size; j++) {
129
- arr[i * size + j] = attr[this.getFuncs[j]](i);
130
- }
131
- }
132
- return arr;
133
- } else {
134
- return attr.array;
135
- }
136
- }
137
- // Returns an array of the same type starting at the `st` index,
138
- // and `ct` length
139
- subArray(arr, st, ct) {
140
- if (Array.isArray(arr)) {
141
- return arr.slice(st, st + ct);
142
- } else {
143
- const TypedArrayConstructor = arr.constructor;
144
- return new TypedArrayConstructor(arr.buffer, st * arr.BYTES_PER_ELEMENT, ct);
145
- }
146
- }
147
- // Returns the string for a geometry's attribute
148
- getAttribute(attr, name, params, type) {
149
- const array = this.attrBufferToArray(attr);
150
- const res = Array.isArray(array) ? `${`<source id="${name}"><float_array id="${name}-array" count="${array.length}">` + array.join(" ")}</float_array><technique_common>${`<accessor source="#${name}-array" count="${Math.floor(
151
- array.length / attr.itemSize
152
- )}" stride="${attr.itemSize}">`}${params.map((n) => `<param name="${n}" type="${type}" />`).join("")}</accessor></technique_common></source>` : "";
153
- return res;
154
- }
155
- // Returns the string for a node's transform information
156
- getTransform(o) {
157
- o.updateMatrix();
158
- this.transMat = this.transMat || new Matrix4();
159
- this.transMat.copy(o.matrix);
160
- this.transMat.transpose();
161
- return `<matrix>${this.transMat.toArray().join(" ")}</matrix>`;
162
- }
163
- // Process the given piece of geometry into the geometry library
164
- // Returns the mesh id
165
- processGeometry(g) {
166
- let info = this.geometryInfo.get(g);
167
- if (!info) {
168
- const bufferGeometry = g;
169
- if (!bufferGeometry.isBufferGeometry) {
170
- throw new Error("THREE.ColladaExporter: Geometry is not of type THREE.BufferGeometry.");
171
- }
172
- const meshid = `Mesh${this.libraryGeometries.length + 1}`;
173
- const indexCount = bufferGeometry.index ? bufferGeometry.index.count * bufferGeometry.index.itemSize : bufferGeometry.attributes.position.count;
174
- const groups = bufferGeometry.groups != null && bufferGeometry.groups.length !== 0 ? bufferGeometry.groups : [{ start: 0, count: indexCount, materialIndex: 0 }];
175
- const gname = g.name ? ` name="${g.name}"` : "";
176
- let gnode = `<geometry id="${meshid}"${gname}><mesh>`;
177
- const posName = `${meshid}-position`;
178
- const vertName = `${meshid}-vertices`;
179
- gnode += this.getAttribute(bufferGeometry.attributes.position, posName, ["X", "Y", "Z"], "float");
180
- gnode += `<vertices id="${vertName}"><input semantic="POSITION" source="#${posName}" /></vertices>`;
181
- let triangleInputs = `<input semantic="VERTEX" source="#${vertName}" offset="0" />`;
182
- if ("normal" in bufferGeometry.attributes) {
183
- const normName = `${meshid}-normal`;
184
- gnode += this.getAttribute(bufferGeometry.attributes.normal, normName, ["X", "Y", "Z"], "float");
185
- triangleInputs += `<input semantic="NORMAL" source="#${normName}" offset="0" />`;
186
- }
187
- if ("uv" in bufferGeometry.attributes) {
188
- const uvName = `${meshid}-texcoord`;
189
- gnode += this.getAttribute(bufferGeometry.attributes.uv, uvName, ["S", "T"], "float");
190
- triangleInputs += `<input semantic="TEXCOORD" source="#${uvName}" offset="0" set="0" />`;
191
- }
192
- if ("uv2" in bufferGeometry.attributes) {
193
- const uvName = `${meshid}-texcoord2`;
194
- gnode += this.getAttribute(bufferGeometry.attributes.uv2, uvName, ["S", "T"], "float");
195
- triangleInputs += `<input semantic="TEXCOORD" source="#${uvName}" offset="0" set="1" />`;
196
- }
197
- if ("color" in bufferGeometry.attributes) {
198
- const colName = `${meshid}-color`;
199
- gnode += this.getAttribute(bufferGeometry.attributes.color, colName, ["X", "Y", "Z"], "uint8");
200
- triangleInputs += `<input semantic="COLOR" source="#${colName}" offset="0" />`;
201
- }
202
- let indexArray = null;
203
- if (bufferGeometry.index) {
204
- indexArray = this.attrBufferToArray(bufferGeometry.index);
205
- } else {
206
- indexArray = new Array(indexCount);
207
- for (let i = 0, l = indexArray.length; i < l && Array.isArray(indexArray); i++)
208
- indexArray[i] = i;
209
- }
210
- for (let i = 0, l = groups.length; i < l; i++) {
211
- const group = groups[i];
212
- const subarr = this.subArray(indexArray, group.start, group.count);
213
- const polycount = subarr.length / 3;
214
- gnode += `<triangles material="MESH_MATERIAL_${group.materialIndex}" count="${polycount}">`;
215
- gnode += triangleInputs;
216
- gnode += `<p>${subarr.join(" ")}</p>`;
217
- gnode += "</triangles>";
218
- }
219
- gnode += "</mesh></geometry>";
220
- this.libraryGeometries.push(gnode);
221
- info = { meshid, bufferGeometry };
222
- this.geometryInfo.set(g, info);
223
- }
224
- return info;
225
- }
226
- // Process the given texture into the image library
227
- // Returns the image library
228
- processTexture(tex) {
229
- let texid = this.imageMap.get(tex);
230
- if (texid == null) {
231
- texid = `image-${this.libraryImages.length + 1}`;
232
- const ext = "png";
233
- const name = tex.name || texid;
234
- let imageNode = `<image id="${texid}" name="${name}">`;
235
- if (this.options.version === "1.5.0") {
236
- imageNode += `<init_from><ref>${this.options.textureDirectory}${name}.${ext}</ref></init_from>`;
237
- } else {
238
- imageNode += `<init_from>${this.options.textureDirectory}${name}.${ext}</init_from>`;
239
- }
240
- imageNode += "</image>";
241
- this.libraryImages.push(imageNode);
242
- this.imageMap.set(tex, texid);
243
- this.textures.push({
244
- directory: this.options.textureDirectory,
245
- name,
246
- ext,
247
- data: this.imageToData(tex.image, ext),
248
- original: tex
249
- });
250
- }
251
- return texid;
252
- }
253
- // Process the given material into the material and effect libraries
254
- // Returns the material id
255
- processMaterial(m) {
256
- let matid = this.materialMap.get(m);
257
- if (matid == null) {
258
- matid = `Mat${this.libraryEffects.length + 1}`;
259
- let type = "phong";
260
- if (m instanceof MeshLambertMaterial) {
261
- type = "lambert";
262
- } else if (m instanceof MeshBasicMaterial) {
263
- type = "constant";
264
- if (m.map !== null) {
265
- console.warn("ColladaExporter: Texture maps not supported with MeshBasicMaterial.");
266
- }
267
- }
268
- if (m instanceof MeshPhongMaterial) {
269
- const emissive = m.emissive ? m.emissive : new Color(0, 0, 0);
270
- const diffuse = m.color ? m.color : new Color(0, 0, 0);
271
- const specular = m.specular ? m.specular : new Color(1, 1, 1);
272
- const shininess = m.shininess || 0;
273
- const reflectivity = m.reflectivity || 0;
274
- let transparencyNode = "";
275
- if (m.transparent) {
276
- transparencyNode += `<transparent>${m.map ? '<texture texture="diffuse-sampler"></texture>' : "<float>1</float>"}</transparent>`;
277
- if (m.opacity < 1) {
278
- transparencyNode += `<transparency><float>${m.opacity}</float></transparency>`;
279
- }
280
- }
281
- const techniqueNode = `${`<technique sid="common"><${type}>`}<emission>${m.emissiveMap ? '<texture texture="emissive-sampler" texcoord="TEXCOORD" />' : `<color sid="emission">${emissive.r} ${emissive.g} ${emissive.b} 1</color>`}</emission>${type !== "constant" ? `<diffuse>${m.map ? '<texture texture="diffuse-sampler" texcoord="TEXCOORD" />' : `<color sid="diffuse">${diffuse.r} ${diffuse.g} ${diffuse.b} 1</color>`}</diffuse>` : ""}${type !== "constant" ? `<bump>${m.normalMap ? '<texture texture="bump-sampler" texcoord="TEXCOORD" />' : ""}</bump>` : ""}${type === "phong" ? `${`<specular><color sid="specular">${specular.r} ${specular.g} ${specular.b} 1</color></specular>`}<shininess>${m.specularMap ? '<texture texture="specular-sampler" texcoord="TEXCOORD" />' : `<float sid="shininess">${shininess}</float>`}</shininess>` : ""}${`<reflective><color>${diffuse.r} ${diffuse.g} ${diffuse.b} 1</color></reflective>`}${`<reflectivity><float>${reflectivity}</float></reflectivity>`}${transparencyNode}${`</${type}></technique>`}`;
282
- const effectnode = `${`<effect id="${matid}-effect">`}<profile_COMMON>${m.map ? `<newparam sid="diffuse-surface"><surface type="2D">${`<init_from>${this.processTexture(
283
- m.map
284
- )}</init_from>`}</surface></newparam><newparam sid="diffuse-sampler"><sampler2D><source>diffuse-surface</source></sampler2D></newparam>` : ""}${m.specularMap ? `<newparam sid="specular-surface"><surface type="2D">${`<init_from>${this.processTexture(
285
- m.specularMap
286
- )}</init_from>`}</surface></newparam><newparam sid="specular-sampler"><sampler2D><source>specular-surface</source></sampler2D></newparam>` : ""}${m.emissiveMap ? `<newparam sid="emissive-surface"><surface type="2D">${`<init_from>${this.processTexture(
287
- m.emissiveMap
288
- )}</init_from>`}</surface></newparam><newparam sid="emissive-sampler"><sampler2D><source>emissive-surface</source></sampler2D></newparam>` : ""}${m.normalMap ? `<newparam sid="bump-surface"><surface type="2D">${`<init_from>${this.processTexture(
289
- m.normalMap
290
- )}</init_from>`}</surface></newparam><newparam sid="bump-sampler"><sampler2D><source>bump-surface</source></sampler2D></newparam>` : ""}${techniqueNode}${m.side === DoubleSide ? '<extra><technique profile="THREEJS"><double_sided sid="double_sided" type="int">1</double_sided></technique></extra>' : ""}</profile_COMMON></effect>`;
291
- const materialName = m.name ? ` name="${m.name}"` : "";
292
- const materialNode = `<material id="${matid}"${materialName}><instance_effect url="#${matid}-effect" /></material>`;
293
- this.libraryMaterials.push(materialNode);
294
- this.libraryEffects.push(effectnode);
295
- this.materialMap.set(m, matid);
296
- }
297
- }
298
- return matid;
299
- }
300
- // Recursively process the object into a scene
301
- processObject(o) {
302
- let node = `<node name="${o.name}">`;
303
- node += this.getTransform(o);
304
- const a = new Mesh();
305
- a.geometry;
306
- if (o instanceof Mesh && o.isMesh && o.geometry !== null) {
307
- const geomInfo = this.processGeometry(o.geometry);
308
- const meshid = geomInfo.meshid;
309
- const geometry = geomInfo.bufferGeometry;
310
- let matids = null;
311
- let matidsArray;
312
- const mat = o.material || new MeshBasicMaterial();
313
- const materials = Array.isArray(mat) ? mat : [mat];
314
- if (geometry.groups.length > materials.length) {
315
- matidsArray = new Array(geometry.groups.length);
316
- } else {
317
- matidsArray = new Array(materials.length);
318
- }
319
- matids = matidsArray.fill(null).map((_, i) => this.processMaterial(materials[i % materials.length]));
320
- node += `${`<instance_geometry url="#${meshid}">` + (matids != null ? `<bind_material><technique_common>${matids.map(
321
- (id, i) => `${`<instance_material symbol="MESH_MATERIAL_${i}" target="#${id}" >`}<bind_vertex_input semantic="TEXCOORD" input_semantic="TEXCOORD" input_set="0" /></instance_material>`
322
- ).join("")}</technique_common></bind_material>` : "")}</instance_geometry>`;
323
- }
324
- o.children.forEach((c) => node += this.processObject(c));
325
- node += "</node>";
326
- return node;
327
- }
328
- }
329
- export {
330
- ColladaExporter
331
- };