three-stdlib 2.25.0 → 2.25.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (539) hide show
  1. package/index.cjs +116401 -611
  2. package/index.js +116037 -263
  3. package/package.json +17 -4
  4. package/_polyfill/CapsuleGeometry.cjs +0 -22
  5. package/_polyfill/CapsuleGeometry.js +0 -22
  6. package/_polyfill/CompressedArrayTexture.cjs +0 -12
  7. package/_polyfill/CompressedArrayTexture.js +0 -12
  8. package/_polyfill/Data3DTexture.cjs +0 -17
  9. package/_polyfill/Data3DTexture.js +0 -17
  10. package/animation/AnimationClipCreator.cjs +0 -56
  11. package/animation/AnimationClipCreator.js +0 -56
  12. package/animation/CCDIKSolver.cjs +0 -269
  13. package/animation/CCDIKSolver.js +0 -269
  14. package/animation/MMDAnimationHelper.cjs +0 -688
  15. package/animation/MMDAnimationHelper.js +0 -688
  16. package/animation/MMDPhysics.cjs +0 -830
  17. package/animation/MMDPhysics.js +0 -830
  18. package/cameras/CinematicCamera.cjs +0 -131
  19. package/cameras/CinematicCamera.js +0 -131
  20. package/controls/ArcballControls.cjs +0 -2033
  21. package/controls/ArcballControls.js +0 -2033
  22. package/controls/DeviceOrientationControls.cjs +0 -85
  23. package/controls/DeviceOrientationControls.js +0 -85
  24. package/controls/DragControls.cjs +0 -182
  25. package/controls/DragControls.js +0 -182
  26. package/controls/FirstPersonControls.cjs +0 -229
  27. package/controls/FirstPersonControls.js +0 -229
  28. package/controls/FlyControls.cjs +0 -248
  29. package/controls/FlyControls.js +0 -248
  30. package/controls/OrbitControls.cjs +0 -791
  31. package/controls/OrbitControls.js +0 -791
  32. package/controls/PointerLockControls.cjs +0 -103
  33. package/controls/PointerLockControls.js +0 -103
  34. package/controls/TrackballControls.cjs +0 -502
  35. package/controls/TrackballControls.js +0 -502
  36. package/controls/TransformControls.cjs +0 -1089
  37. package/controls/TransformControls.js +0 -1089
  38. package/controls/experimental/CameraControls.cjs +0 -736
  39. package/controls/experimental/CameraControls.js +0 -736
  40. package/csm/CSM.cjs +0 -244
  41. package/csm/CSM.js +0 -244
  42. package/csm/CSMFrustum.cjs +0 -75
  43. package/csm/CSMFrustum.js +0 -75
  44. package/csm/CSMHelper.cjs +0 -114
  45. package/csm/CSMHelper.js +0 -114
  46. package/csm/CSMShader.cjs +0 -261
  47. package/csm/CSMShader.js +0 -261
  48. package/curves/CurveExtras.cjs +0 -214
  49. package/curves/CurveExtras.js +0 -214
  50. package/curves/NURBSCurve.cjs +0 -35
  51. package/curves/NURBSCurve.js +0 -35
  52. package/curves/NURBSSurface.cjs +0 -28
  53. package/curves/NURBSSurface.js +0 -28
  54. package/curves/NURBSUtils.cjs +0 -226
  55. package/curves/NURBSUtils.js +0 -226
  56. package/deprecated/Geometry.cjs +0 -971
  57. package/deprecated/Geometry.js +0 -971
  58. package/effects/AnaglyphEffect.cjs +0 -102
  59. package/effects/AnaglyphEffect.js +0 -102
  60. package/effects/AsciiEffect.cjs +0 -155
  61. package/effects/AsciiEffect.js +0 -155
  62. package/effects/OutlineEffect.cjs +0 -275
  63. package/effects/OutlineEffect.js +0 -275
  64. package/effects/ParallaxBarrierEffect.cjs +0 -65
  65. package/effects/ParallaxBarrierEffect.js +0 -65
  66. package/effects/PeppersGhostEffect.cjs +0 -88
  67. package/effects/PeppersGhostEffect.js +0 -88
  68. package/effects/StereoEffect.cjs +0 -35
  69. package/effects/StereoEffect.js +0 -35
  70. package/environments/RoomEnvironment.cjs +0 -95
  71. package/environments/RoomEnvironment.js +0 -78
  72. package/exporters/ColladaExporter.cjs +0 -331
  73. package/exporters/ColladaExporter.js +0 -331
  74. package/exporters/DRACOExporter.cjs +0 -141
  75. package/exporters/DRACOExporter.js +0 -141
  76. package/exporters/GLTFExporter.cjs +0 -1909
  77. package/exporters/GLTFExporter.js +0 -1909
  78. package/exporters/MMDExporter.cjs +0 -131
  79. package/exporters/MMDExporter.js +0 -131
  80. package/exporters/OBJExporter.cjs +0 -181
  81. package/exporters/OBJExporter.js +0 -181
  82. package/exporters/PLYExporter.cjs +0 -280
  83. package/exporters/PLYExporter.js +0 -280
  84. package/exporters/STLExporter.cjs +0 -146
  85. package/exporters/STLExporter.js +0 -146
  86. package/exporters/USDZExporter.cjs +0 -340
  87. package/exporters/USDZExporter.js +0 -340
  88. package/geometries/BoxLineGeometry.cjs +0 -45
  89. package/geometries/BoxLineGeometry.js +0 -45
  90. package/geometries/ConvexGeometry.cjs +0 -26
  91. package/geometries/ConvexGeometry.js +0 -26
  92. package/geometries/DecalGeometry.cjs +0 -184
  93. package/geometries/DecalGeometry.js +0 -184
  94. package/geometries/LightningStrike.cjs +0 -553
  95. package/geometries/LightningStrike.js +0 -553
  96. package/geometries/ParametricGeometries.cjs +0 -130
  97. package/geometries/ParametricGeometries.js +0 -130
  98. package/geometries/ParametricGeometry.cjs +0 -63
  99. package/geometries/ParametricGeometry.js +0 -63
  100. package/geometries/RoundedBoxGeometry.cjs +0 -91
  101. package/geometries/RoundedBoxGeometry.js +0 -91
  102. package/geometries/TeapotGeometry.cjs +0 -1563
  103. package/geometries/TeapotGeometry.js +0 -1563
  104. package/geometries/TextGeometry.cjs +0 -27
  105. package/geometries/TextGeometry.js +0 -27
  106. package/helpers/LightProbeHelper.cjs +0 -73
  107. package/helpers/LightProbeHelper.js +0 -73
  108. package/helpers/PositionalAudioHelper.cjs +0 -68
  109. package/helpers/PositionalAudioHelper.js +0 -68
  110. package/helpers/RectAreaLightHelper.cjs +0 -44
  111. package/helpers/RectAreaLightHelper.js +0 -44
  112. package/helpers/VertexNormalsHelper.cjs +0 -47
  113. package/helpers/VertexNormalsHelper.js +0 -47
  114. package/helpers/VertexTangentsHelper.cjs +0 -43
  115. package/helpers/VertexTangentsHelper.js +0 -43
  116. package/interactive/HTMLMesh.cjs +0 -325
  117. package/interactive/HTMLMesh.js +0 -325
  118. package/interactive/InteractiveGroup.cjs +0 -68
  119. package/interactive/InteractiveGroup.js +0 -68
  120. package/interactive/SelectionBox.cjs +0 -134
  121. package/interactive/SelectionBox.js +0 -134
  122. package/interactive/SelectionHelper.cjs +0 -51
  123. package/interactive/SelectionHelper.js +0 -51
  124. package/libs/MeshoptDecoder.cjs +0 -221
  125. package/libs/MeshoptDecoder.js +0 -221
  126. package/libs/MotionControllers.cjs +0 -325
  127. package/libs/MotionControllers.js +0 -325
  128. package/lights/LightProbeGenerator.cjs +0 -145
  129. package/lights/LightProbeGenerator.js +0 -145
  130. package/lights/RectAreaLightUniformsLib.cjs +0 -32846
  131. package/lights/RectAreaLightUniformsLib.js +0 -32846
  132. package/lines/Line2.cjs +0 -13
  133. package/lines/Line2.js +0 -13
  134. package/lines/LineGeometry.cjs +0 -44
  135. package/lines/LineGeometry.js +0 -44
  136. package/lines/LineMaterial.cjs +0 -547
  137. package/lines/LineMaterial.js +0 -547
  138. package/lines/LineSegments2.cjs +0 -203
  139. package/lines/LineSegments2.js +0 -203
  140. package/lines/LineSegmentsGeometry.cjs +0 -124
  141. package/lines/LineSegmentsGeometry.js +0 -124
  142. package/lines/Wireframe.cjs +0 -32
  143. package/lines/Wireframe.js +0 -32
  144. package/lines/WireframeGeometry2.cjs +0 -13
  145. package/lines/WireframeGeometry2.js +0 -13
  146. package/loaders/3DMLoader.cjs +0 -803
  147. package/loaders/3DMLoader.js +0 -803
  148. package/loaders/3MFLoader.cjs +0 -854
  149. package/loaders/3MFLoader.js +0 -854
  150. package/loaders/AMFLoader.cjs +0 -284
  151. package/loaders/AMFLoader.js +0 -284
  152. package/loaders/AssimpLoader.cjs +0 -1434
  153. package/loaders/AssimpLoader.js +0 -1434
  154. package/loaders/BVHLoader.cjs +0 -207
  155. package/loaders/BVHLoader.js +0 -207
  156. package/loaders/BasisTextureLoader.cjs +0 -489
  157. package/loaders/BasisTextureLoader.js +0 -489
  158. package/loaders/ColladaLoader.cjs +0 -2405
  159. package/loaders/ColladaLoader.js +0 -2405
  160. package/loaders/DDSLoader.cjs +0 -148
  161. package/loaders/DDSLoader.js +0 -148
  162. package/loaders/DRACOLoader.cjs +0 -341
  163. package/loaders/DRACOLoader.js +0 -341
  164. package/loaders/EXRLoader.cjs +0 -1356
  165. package/loaders/EXRLoader.js +0 -1356
  166. package/loaders/FBXLoader.cjs +0 -2457
  167. package/loaders/FBXLoader.js +0 -2457
  168. package/loaders/FontLoader.cjs +0 -123
  169. package/loaders/FontLoader.js +0 -123
  170. package/loaders/GCodeLoader.cjs +0 -141
  171. package/loaders/GCodeLoader.js +0 -141
  172. package/loaders/GLTFLoader.cjs +0 -2504
  173. package/loaders/GLTFLoader.js +0 -2504
  174. package/loaders/HDRCubeTextureLoader.cjs +0 -75
  175. package/loaders/HDRCubeTextureLoader.js +0 -75
  176. package/loaders/KMZLoader.cjs +0 -75
  177. package/loaders/KMZLoader.js +0 -75
  178. package/loaders/KTX2Loader.cjs +0 -480
  179. package/loaders/KTX2Loader.js +0 -480
  180. package/loaders/KTXLoader.cjs +0 -93
  181. package/loaders/KTXLoader.js +0 -93
  182. package/loaders/LDrawLoader.cjs +0 -1424
  183. package/loaders/LDrawLoader.js +0 -1424
  184. package/loaders/LUT3dlLoader.cjs +0 -103
  185. package/loaders/LUT3dlLoader.js +0 -103
  186. package/loaders/LUTCubeLoader.cjs +0 -107
  187. package/loaders/LUTCubeLoader.js +0 -107
  188. package/loaders/LWOLoader.cjs +0 -645
  189. package/loaders/LWOLoader.js +0 -645
  190. package/loaders/LottieLoader.cjs +0 -47
  191. package/loaders/LottieLoader.js +0 -47
  192. package/loaders/MD2Loader.cjs +0 -359
  193. package/loaders/MD2Loader.js +0 -359
  194. package/loaders/MDDLoader.cjs +0 -58
  195. package/loaders/MDDLoader.js +0 -58
  196. package/loaders/MMDLoader.cjs +0 -1121
  197. package/loaders/MMDLoader.js +0 -1121
  198. package/loaders/MTLLoader.cjs +0 -304
  199. package/loaders/MTLLoader.js +0 -304
  200. package/loaders/NRRDLoader.cjs +0 -401
  201. package/loaders/NRRDLoader.js +0 -401
  202. package/loaders/OBJLoader.cjs +0 -487
  203. package/loaders/OBJLoader.js +0 -487
  204. package/loaders/PCDLoader.cjs +0 -248
  205. package/loaders/PCDLoader.js +0 -248
  206. package/loaders/PDBLoader.cjs +0 -247
  207. package/loaders/PDBLoader.js +0 -247
  208. package/loaders/PLYLoader.cjs +0 -317
  209. package/loaders/PLYLoader.js +0 -317
  210. package/loaders/PRWMLoader.cjs +0 -160
  211. package/loaders/PRWMLoader.js +0 -160
  212. package/loaders/PVRLoader.cjs +0 -131
  213. package/loaders/PVRLoader.js +0 -131
  214. package/loaders/RGBELoader.cjs +0 -252
  215. package/loaders/RGBELoader.js +0 -252
  216. package/loaders/RGBMLoader.cjs +0 -1004
  217. package/loaders/RGBMLoader.js +0 -1004
  218. package/loaders/STLLoader.cjs +0 -190
  219. package/loaders/STLLoader.js +0 -190
  220. package/loaders/SVGLoader.cjs +0 -1712
  221. package/loaders/SVGLoader.js +0 -1712
  222. package/loaders/TDSLoader.cjs +0 -650
  223. package/loaders/TDSLoader.js +0 -650
  224. package/loaders/TGALoader.cjs +0 -285
  225. package/loaders/TGALoader.js +0 -285
  226. package/loaders/TTFLoader.cjs +0 -131
  227. package/loaders/TTFLoader.js +0 -131
  228. package/loaders/TiltLoader.cjs +0 -375
  229. package/loaders/TiltLoader.js +0 -375
  230. package/loaders/VOXLoader.cjs +0 -432
  231. package/loaders/VOXLoader.js +0 -432
  232. package/loaders/VRMLLoader.cjs +0 -2105
  233. package/loaders/VRMLLoader.js +0 -2105
  234. package/loaders/VRMLoader.cjs +0 -38
  235. package/loaders/VRMLoader.js +0 -38
  236. package/loaders/VTKLoader.cjs +0 -648
  237. package/loaders/VTKLoader.js +0 -648
  238. package/loaders/XLoader.cjs +0 -1258
  239. package/loaders/XLoader.js +0 -1258
  240. package/loaders/XYZLoader.cjs +0 -60
  241. package/loaders/XYZLoader.js +0 -60
  242. package/loaders/lwo/IFFParser.cjs +0 -743
  243. package/loaders/lwo/IFFParser.js +0 -743
  244. package/loaders/lwo/LWO2Parser.cjs +0 -312
  245. package/loaders/lwo/LWO2Parser.js +0 -312
  246. package/loaders/lwo/LWO3Parser.cjs +0 -282
  247. package/loaders/lwo/LWO3Parser.js +0 -282
  248. package/math/Capsule.cjs +0 -98
  249. package/math/Capsule.js +0 -98
  250. package/math/ColorConverter.cjs +0 -42
  251. package/math/ColorConverter.js +0 -42
  252. package/math/ConvexHull.cjs +0 -596
  253. package/math/ConvexHull.js +0 -596
  254. package/math/ImprovedNoise.cjs +0 -304
  255. package/math/ImprovedNoise.js +0 -304
  256. package/math/Lut.cjs +0 -137
  257. package/math/Lut.js +0 -137
  258. package/math/MeshSurfaceSampler.cjs +0 -103
  259. package/math/MeshSurfaceSampler.js +0 -103
  260. package/math/OBB.cjs +0 -242
  261. package/math/OBB.js +0 -242
  262. package/math/Octree.cjs +0 -273
  263. package/math/Octree.js +0 -273
  264. package/math/SimplexNoise.cjs +0 -440
  265. package/math/SimplexNoise.js +0 -440
  266. package/misc/ConvexObjectBreaker.cjs +0 -292
  267. package/misc/ConvexObjectBreaker.js +0 -292
  268. package/misc/GPUComputationRenderer.cjs +0 -205
  269. package/misc/GPUComputationRenderer.js +0 -205
  270. package/misc/Gyroscope.cjs +0 -33
  271. package/misc/Gyroscope.js +0 -33
  272. package/misc/MD2Character.cjs +0 -167
  273. package/misc/MD2Character.js +0 -167
  274. package/misc/MD2CharacterComplex.cjs +0 -332
  275. package/misc/MD2CharacterComplex.js +0 -332
  276. package/misc/MorphAnimMesh.cjs +0 -40
  277. package/misc/MorphAnimMesh.js +0 -40
  278. package/misc/MorphBlendMesh.cjs +0 -179
  279. package/misc/MorphBlendMesh.js +0 -179
  280. package/misc/ProgressiveLightmap.cjs +0 -186
  281. package/misc/ProgressiveLightmap.js +0 -186
  282. package/misc/RollerCoaster.cjs +0 -353
  283. package/misc/RollerCoaster.js +0 -353
  284. package/misc/Timer.cjs +0 -101
  285. package/misc/Timer.js +0 -101
  286. package/misc/TubePainter.cjs +0 -123
  287. package/misc/TubePainter.js +0 -123
  288. package/misc/Volume.cjs +0 -305
  289. package/misc/Volume.js +0 -305
  290. package/misc/VolumeSlice.cjs +0 -114
  291. package/misc/VolumeSlice.js +0 -114
  292. package/misc/WebGL.cjs +0 -74
  293. package/misc/WebGL.js +0 -74
  294. package/modifiers/CurveModifier.cjs +0 -232
  295. package/modifiers/CurveModifier.js +0 -232
  296. package/modifiers/EdgeSplitModifier.cjs +0 -167
  297. package/modifiers/EdgeSplitModifier.js +0 -168
  298. package/modifiers/SimplifyModifier.cjs +0 -301
  299. package/modifiers/SimplifyModifier.js +0 -301
  300. package/modifiers/TessellateModifier.cjs +0 -214
  301. package/modifiers/TessellateModifier.js +0 -214
  302. package/objects/GroundProjectedEnv.cjs +0 -134
  303. package/objects/GroundProjectedEnv.js +0 -134
  304. package/objects/Lensflare.cjs +0 -291
  305. package/objects/Lensflare.js +0 -291
  306. package/objects/LightningStorm.cjs +0 -110
  307. package/objects/LightningStorm.js +0 -110
  308. package/objects/MarchingCubes.cjs +0 -4809
  309. package/objects/MarchingCubes.js +0 -4809
  310. package/objects/Reflector.cjs +0 -202
  311. package/objects/Reflector.js +0 -202
  312. package/objects/ReflectorForSSRPass.cjs +0 -260
  313. package/objects/ReflectorForSSRPass.js +0 -260
  314. package/objects/ReflectorRTT.cjs +0 -10
  315. package/objects/ReflectorRTT.js +0 -10
  316. package/objects/Refractor.cjs +0 -215
  317. package/objects/Refractor.js +0 -215
  318. package/objects/ShadowMesh.cjs +0 -45
  319. package/objects/ShadowMesh.js +0 -45
  320. package/objects/Sky.cjs +0 -200
  321. package/objects/Sky.js +0 -200
  322. package/objects/Water.cjs +0 -242
  323. package/objects/Water.js +0 -242
  324. package/objects/Water2.cjs +0 -256
  325. package/objects/Water2.js +0 -256
  326. package/physics/AmmoPhysics.cjs +0 -166
  327. package/physics/AmmoPhysics.js +0 -166
  328. package/postprocessing/AdaptiveToneMappingPass.cjs +0 -218
  329. package/postprocessing/AdaptiveToneMappingPass.js +0 -218
  330. package/postprocessing/AfterimagePass.cjs +0 -68
  331. package/postprocessing/AfterimagePass.js +0 -68
  332. package/postprocessing/BloomPass.cjs +0 -109
  333. package/postprocessing/BloomPass.js +0 -109
  334. package/postprocessing/BokehPass.cjs +0 -90
  335. package/postprocessing/BokehPass.js +0 -90
  336. package/postprocessing/ClearPass.cjs +0 -36
  337. package/postprocessing/ClearPass.js +0 -36
  338. package/postprocessing/CubeTexturePass.cjs +0 -53
  339. package/postprocessing/CubeTexturePass.js +0 -53
  340. package/postprocessing/DotScreenPass.cjs +0 -49
  341. package/postprocessing/DotScreenPass.js +0 -49
  342. package/postprocessing/EffectComposer.cjs +0 -157
  343. package/postprocessing/EffectComposer.js +0 -157
  344. package/postprocessing/FilmPass.cjs +0 -51
  345. package/postprocessing/FilmPass.js +0 -51
  346. package/postprocessing/GlitchPass.cjs +0 -84
  347. package/postprocessing/GlitchPass.js +0 -84
  348. package/postprocessing/HalftonePass.cjs +0 -53
  349. package/postprocessing/HalftonePass.js +0 -53
  350. package/postprocessing/LUTPass.cjs +0 -142
  351. package/postprocessing/LUTPass.js +0 -142
  352. package/postprocessing/MaskPass.cjs +0 -69
  353. package/postprocessing/MaskPass.js +0 -69
  354. package/postprocessing/OutlinePass.cjs +0 -479
  355. package/postprocessing/OutlinePass.js +0 -479
  356. package/postprocessing/Pass.cjs +0 -48
  357. package/postprocessing/Pass.js +0 -48
  358. package/postprocessing/RenderPass.cjs +0 -59
  359. package/postprocessing/RenderPass.js +0 -59
  360. package/postprocessing/RenderPixelatedPass.cjs +0 -199
  361. package/postprocessing/RenderPixelatedPass.js +0 -199
  362. package/postprocessing/SAOPass.cjs +0 -288
  363. package/postprocessing/SAOPass.js +0 -288
  364. package/postprocessing/SMAAPass.cjs +0 -112
  365. package/postprocessing/SMAAPass.js +0 -112
  366. package/postprocessing/SSAARenderPass.cjs +0 -189
  367. package/postprocessing/SSAARenderPass.js +0 -189
  368. package/postprocessing/SSAOPass.cjs +0 -272
  369. package/postprocessing/SSAOPass.js +0 -272
  370. package/postprocessing/SSRPass.cjs +0 -411
  371. package/postprocessing/SSRPass.js +0 -411
  372. package/postprocessing/SavePass.cjs +0 -38
  373. package/postprocessing/SavePass.js +0 -38
  374. package/postprocessing/ShaderPass.cjs +0 -49
  375. package/postprocessing/ShaderPass.js +0 -49
  376. package/postprocessing/TAARenderPass.cjs +0 -174
  377. package/postprocessing/TAARenderPass.js +0 -174
  378. package/postprocessing/TexturePass.cjs +0 -42
  379. package/postprocessing/TexturePass.js +0 -42
  380. package/postprocessing/UnrealBloomPass.cjs +0 -277
  381. package/postprocessing/UnrealBloomPass.js +0 -277
  382. package/postprocessing/WaterPass.cjs +0 -72
  383. package/postprocessing/WaterPass.js +0 -72
  384. package/renderers/CSS2DRenderer.cjs +0 -122
  385. package/renderers/CSS2DRenderer.js +0 -122
  386. package/renderers/CSS3DRenderer.cjs +0 -167
  387. package/renderers/CSS3DRenderer.js +0 -167
  388. package/renderers/Projector.cjs +0 -499
  389. package/renderers/Projector.js +0 -499
  390. package/renderers/SVGRenderer.cjs +0 -311
  391. package/renderers/SVGRenderer.js +0 -311
  392. package/shaders/ACESFilmicToneMappingShader.cjs +0 -55
  393. package/shaders/ACESFilmicToneMappingShader.js +0 -55
  394. package/shaders/AfterimageShader.cjs +0 -32
  395. package/shaders/AfterimageShader.js +0 -32
  396. package/shaders/BasicShader.cjs +0 -12
  397. package/shaders/BasicShader.js +0 -12
  398. package/shaders/BleachBypassShader.cjs +0 -35
  399. package/shaders/BleachBypassShader.js +0 -35
  400. package/shaders/BlendShader.cjs +0 -30
  401. package/shaders/BlendShader.js +0 -30
  402. package/shaders/BokehShader.cjs +0 -109
  403. package/shaders/BokehShader.js +0 -109
  404. package/shaders/BokehShader2.cjs +0 -269
  405. package/shaders/BokehShader2.js +0 -269
  406. package/shaders/BrightnessContrastShader.cjs +0 -32
  407. package/shaders/BrightnessContrastShader.js +0 -32
  408. package/shaders/ColorCorrectionShader.cjs +0 -30
  409. package/shaders/ColorCorrectionShader.js +0 -30
  410. package/shaders/ColorifyShader.cjs +0 -28
  411. package/shaders/ColorifyShader.js +0 -28
  412. package/shaders/ConvolutionShader.cjs +0 -55
  413. package/shaders/ConvolutionShader.js +0 -55
  414. package/shaders/CopyShader.cjs +0 -25
  415. package/shaders/CopyShader.js +0 -25
  416. package/shaders/DOFMipMapShader.cjs +0 -32
  417. package/shaders/DOFMipMapShader.js +0 -32
  418. package/shaders/DepthLimitedBlurShader.cjs +0 -114
  419. package/shaders/DepthLimitedBlurShader.js +0 -114
  420. package/shaders/DigitalGlitch.cjs +0 -85
  421. package/shaders/DigitalGlitch.js +0 -85
  422. package/shaders/DotScreenShader.cjs +0 -39
  423. package/shaders/DotScreenShader.js +0 -39
  424. package/shaders/FXAAShader.cjs +0 -1098
  425. package/shaders/FXAAShader.js +0 -1098
  426. package/shaders/FilmShader.cjs +0 -53
  427. package/shaders/FilmShader.js +0 -53
  428. package/shaders/FocusShader.cjs +0 -55
  429. package/shaders/FocusShader.js +0 -55
  430. package/shaders/FreiChenShader.cjs +0 -64
  431. package/shaders/FreiChenShader.js +0 -64
  432. package/shaders/FresnelShader.cjs +0 -47
  433. package/shaders/FresnelShader.js +0 -47
  434. package/shaders/GammaCorrectionShader.cjs +0 -23
  435. package/shaders/GammaCorrectionShader.js +0 -23
  436. package/shaders/GodRaysShader.cjs +0 -183
  437. package/shaders/GodRaysShader.js +0 -183
  438. package/shaders/HalftoneShader.cjs +0 -228
  439. package/shaders/HalftoneShader.js +0 -228
  440. package/shaders/HorizontalBlurShader.cjs +0 -49
  441. package/shaders/HorizontalBlurShader.js +0 -49
  442. package/shaders/HorizontalTiltShiftShader.cjs +0 -37
  443. package/shaders/HorizontalTiltShiftShader.js +0 -37
  444. package/shaders/HueSaturationShader.cjs +0 -43
  445. package/shaders/HueSaturationShader.js +0 -43
  446. package/shaders/KaleidoShader.cjs +0 -34
  447. package/shaders/KaleidoShader.js +0 -34
  448. package/shaders/LuminosityHighPassShader.cjs +0 -37
  449. package/shaders/LuminosityHighPassShader.js +0 -37
  450. package/shaders/LuminosityShader.cjs +0 -25
  451. package/shaders/LuminosityShader.js +0 -25
  452. package/shaders/MirrorShader.cjs +0 -35
  453. package/shaders/MirrorShader.js +0 -35
  454. package/shaders/NormalMapShader.cjs +0 -31
  455. package/shaders/NormalMapShader.js +0 -31
  456. package/shaders/ParallaxShader.cjs +0 -133
  457. package/shaders/ParallaxShader.js +0 -133
  458. package/shaders/PixelShader.cjs +0 -28
  459. package/shaders/PixelShader.js +0 -28
  460. package/shaders/RGBShiftShader.cjs +0 -30
  461. package/shaders/RGBShiftShader.js +0 -30
  462. package/shaders/SAOShader.cjs +0 -144
  463. package/shaders/SAOShader.js +0 -144
  464. package/shaders/SMAAShader.cjs +0 -358
  465. package/shaders/SMAAShader.js +0 -358
  466. package/shaders/SSAOShader.cjs +0 -182
  467. package/shaders/SSAOShader.js +0 -182
  468. package/shaders/SSRShader.cjs +0 -342
  469. package/shaders/SSRShader.js +0 -342
  470. package/shaders/SepiaShader.cjs +0 -29
  471. package/shaders/SepiaShader.js +0 -29
  472. package/shaders/SobelOperatorShader.cjs +0 -54
  473. package/shaders/SobelOperatorShader.js +0 -54
  474. package/shaders/SubsurfaceScatteringShader.cjs +0 -98
  475. package/shaders/SubsurfaceScatteringShader.js +0 -98
  476. package/shaders/TechnicolorShader.cjs +0 -24
  477. package/shaders/TechnicolorShader.js +0 -24
  478. package/shaders/ToneMapShader.cjs +0 -51
  479. package/shaders/ToneMapShader.js +0 -51
  480. package/shaders/ToonShader.cjs +0 -188
  481. package/shaders/ToonShader.js +0 -188
  482. package/shaders/TriangleBlurShader.cjs +0 -37
  483. package/shaders/TriangleBlurShader.js +0 -37
  484. package/shaders/UnpackDepthRGBAShader.cjs +0 -26
  485. package/shaders/UnpackDepthRGBAShader.js +0 -26
  486. package/shaders/VerticalBlurShader.cjs +0 -50
  487. package/shaders/VerticalBlurShader.js +0 -50
  488. package/shaders/VerticalTiltShiftShader.cjs +0 -37
  489. package/shaders/VerticalTiltShiftShader.js +0 -37
  490. package/shaders/VignetteShader.cjs +0 -38
  491. package/shaders/VignetteShader.js +0 -38
  492. package/shaders/VolumeShader.cjs +0 -225
  493. package/shaders/VolumeShader.js +0 -225
  494. package/shaders/WaterRefractionShader.cjs +0 -59
  495. package/shaders/WaterRefractionShader.js +0 -59
  496. package/shaders/types.cjs +0 -1
  497. package/shaders/types.js +0 -1
  498. package/textures/FlakesTexture.cjs +0 -30
  499. package/textures/FlakesTexture.js +0 -30
  500. package/types/helpers.cjs +0 -4
  501. package/types/helpers.js +0 -4
  502. package/utils/BufferGeometryUtils.cjs +0 -636
  503. package/utils/BufferGeometryUtils.js +0 -636
  504. package/utils/GeometryCompressionUtils.cjs +0 -573
  505. package/utils/GeometryCompressionUtils.js +0 -573
  506. package/utils/GeometryUtils.cjs +0 -109
  507. package/utils/GeometryUtils.js +0 -109
  508. package/utils/RoughnessMipmapper.cjs +0 -223
  509. package/utils/RoughnessMipmapper.js +0 -223
  510. package/utils/SceneUtils.cjs +0 -36
  511. package/utils/SceneUtils.js +0 -36
  512. package/utils/ShadowMapViewer.cjs +0 -111
  513. package/utils/ShadowMapViewer.js +0 -111
  514. package/utils/SkeletonUtils.cjs +0 -211
  515. package/utils/SkeletonUtils.js +0 -211
  516. package/utils/UVsDebug.cjs +0 -80
  517. package/utils/UVsDebug.js +0 -80
  518. package/utils/WorkerPool.cjs +0 -62
  519. package/utils/WorkerPool.js +0 -62
  520. package/webxr/ARButton.cjs +0 -119
  521. package/webxr/ARButton.js +0 -119
  522. package/webxr/OculusHandModel.cjs +0 -82
  523. package/webxr/OculusHandModel.js +0 -82
  524. package/webxr/OculusHandPointerModel.cjs +0 -241
  525. package/webxr/OculusHandPointerModel.js +0 -224
  526. package/webxr/Text2D.cjs +0 -48
  527. package/webxr/Text2D.js +0 -31
  528. package/webxr/VRButton.cjs +0 -111
  529. package/webxr/VRButton.js +0 -111
  530. package/webxr/XRControllerModelFactory.cjs +0 -174
  531. package/webxr/XRControllerModelFactory.js +0 -174
  532. package/webxr/XREstimatedLight.cjs +0 -126
  533. package/webxr/XREstimatedLight.js +0 -126
  534. package/webxr/XRHandMeshModel.cjs +0 -82
  535. package/webxr/XRHandMeshModel.js +0 -82
  536. package/webxr/XRHandModelFactory.cjs +0 -61
  537. package/webxr/XRHandModelFactory.js +0 -61
  538. package/webxr/XRHandPrimitiveModel.cjs +0 -68
  539. package/webxr/XRHandPrimitiveModel.js +0 -68
@@ -1,292 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const THREE = require("three");
4
- const ConvexGeometry = require("../geometries/ConvexGeometry.cjs");
5
- const _v1 = /* @__PURE__ */ new THREE.Vector3();
6
- class ConvexObjectBreaker {
7
- constructor(minSizeForBreak = 1.4, smallDelta = 1e-4) {
8
- this.minSizeForBreak = minSizeForBreak;
9
- this.smallDelta = smallDelta;
10
- this.tempLine1 = new THREE.Line3();
11
- this.tempPlane1 = new THREE.Plane();
12
- this.tempPlane2 = new THREE.Plane();
13
- this.tempPlane_Cut = new THREE.Plane();
14
- this.tempCM1 = new THREE.Vector3();
15
- this.tempCM2 = new THREE.Vector3();
16
- this.tempVector3 = new THREE.Vector3();
17
- this.tempVector3_2 = new THREE.Vector3();
18
- this.tempVector3_3 = new THREE.Vector3();
19
- this.tempVector3_P0 = new THREE.Vector3();
20
- this.tempVector3_P1 = new THREE.Vector3();
21
- this.tempVector3_P2 = new THREE.Vector3();
22
- this.tempVector3_N0 = new THREE.Vector3();
23
- this.tempVector3_N1 = new THREE.Vector3();
24
- this.tempVector3_AB = new THREE.Vector3();
25
- this.tempVector3_CB = new THREE.Vector3();
26
- this.tempResultObjects = { object1: null, object2: null };
27
- this.segments = [];
28
- const n = 30 * 30;
29
- for (let i = 0; i < n; i++)
30
- this.segments[i] = false;
31
- }
32
- prepareBreakableObject(object, mass, velocity, angularVelocity, breakable) {
33
- const userData = object.userData;
34
- userData.mass = mass;
35
- userData.velocity = velocity.clone();
36
- userData.angularVelocity = angularVelocity.clone();
37
- userData.breakable = breakable;
38
- }
39
- /*
40
- * @param {int} maxRadialIterations Iterations for radial cuts.
41
- * @param {int} maxRandomIterations Max random iterations for not-radial cuts
42
- *
43
- * Returns the array of pieces
44
- */
45
- subdivideByImpact(object, pointOfImpact, normal, maxRadialIterations, maxRandomIterations) {
46
- const debris = [];
47
- const tempPlane1 = this.tempPlane1;
48
- const tempPlane2 = this.tempPlane2;
49
- this.tempVector3.addVectors(pointOfImpact, normal);
50
- tempPlane1.setFromCoplanarPoints(pointOfImpact, object.position, this.tempVector3);
51
- const maxTotalIterations = maxRandomIterations + maxRadialIterations;
52
- const scope = this;
53
- function subdivideRadial(subObject, startAngle, endAngle, numIterations) {
54
- if (Math.random() < numIterations * 0.05 || numIterations > maxTotalIterations) {
55
- debris.push(subObject);
56
- return;
57
- }
58
- let angle = Math.PI;
59
- if (numIterations === 0) {
60
- tempPlane2.normal.copy(tempPlane1.normal);
61
- tempPlane2.constant = tempPlane1.constant;
62
- } else {
63
- if (numIterations <= maxRadialIterations) {
64
- angle = (endAngle - startAngle) * (0.2 + 0.6 * Math.random()) + startAngle;
65
- scope.tempVector3_2.copy(object.position).sub(pointOfImpact).applyAxisAngle(normal, angle).add(pointOfImpact);
66
- tempPlane2.setFromCoplanarPoints(pointOfImpact, scope.tempVector3, scope.tempVector3_2);
67
- } else {
68
- angle = (0.5 * (numIterations & 1) + 0.2 * (2 - Math.random())) * Math.PI;
69
- scope.tempVector3_2.copy(pointOfImpact).sub(subObject.position).applyAxisAngle(normal, angle).add(subObject.position);
70
- scope.tempVector3_3.copy(normal).add(subObject.position);
71
- tempPlane2.setFromCoplanarPoints(subObject.position, scope.tempVector3_3, scope.tempVector3_2);
72
- }
73
- }
74
- scope.cutByPlane(subObject, tempPlane2, scope.tempResultObjects);
75
- const obj1 = scope.tempResultObjects.object1;
76
- const obj2 = scope.tempResultObjects.object2;
77
- if (obj1) {
78
- subdivideRadial(obj1, startAngle, angle, numIterations + 1);
79
- }
80
- if (obj2) {
81
- subdivideRadial(obj2, angle, endAngle, numIterations + 1);
82
- }
83
- }
84
- subdivideRadial(object, 0, 2 * Math.PI, 0);
85
- return debris;
86
- }
87
- cutByPlane(object, plane, output) {
88
- const geometry = object.geometry;
89
- const coords = geometry.attributes.position.array;
90
- const normals = geometry.attributes.normal.array;
91
- const numPoints = coords.length / 3;
92
- let numFaces = numPoints / 3;
93
- let indices = geometry.getIndex();
94
- if (indices) {
95
- indices = indices.array;
96
- numFaces = indices.length / 3;
97
- }
98
- function getVertexIndex(faceIdx, vert) {
99
- const idx = faceIdx * 3 + vert;
100
- return indices ? indices[idx] : idx;
101
- }
102
- const points1 = [];
103
- const points2 = [];
104
- const delta = this.smallDelta;
105
- const numPointPairs = numPoints * numPoints;
106
- for (let i = 0; i < numPointPairs; i++)
107
- this.segments[i] = false;
108
- const p0 = this.tempVector3_P0;
109
- const p1 = this.tempVector3_P1;
110
- const n0 = this.tempVector3_N0;
111
- const n1 = this.tempVector3_N1;
112
- for (let i = 0; i < numFaces - 1; i++) {
113
- const a1 = getVertexIndex(i, 0);
114
- const b1 = getVertexIndex(i, 1);
115
- const c1 = getVertexIndex(i, 2);
116
- n0.set(normals[a1], normals[a1] + 1, normals[a1] + 2);
117
- for (let j = i + 1; j < numFaces; j++) {
118
- const a2 = getVertexIndex(j, 0);
119
- const b2 = getVertexIndex(j, 1);
120
- const c2 = getVertexIndex(j, 2);
121
- n1.set(normals[a2], normals[a2] + 1, normals[a2] + 2);
122
- const coplanar = 1 - n0.dot(n1) < delta;
123
- if (coplanar) {
124
- if (a1 === a2 || a1 === b2 || a1 === c2) {
125
- if (b1 === a2 || b1 === b2 || b1 === c2) {
126
- this.segments[a1 * numPoints + b1] = true;
127
- this.segments[b1 * numPoints + a1] = true;
128
- } else {
129
- this.segments[c1 * numPoints + a1] = true;
130
- this.segments[a1 * numPoints + c1] = true;
131
- }
132
- } else if (b1 === a2 || b1 === b2 || b1 === c2) {
133
- this.segments[c1 * numPoints + b1] = true;
134
- this.segments[b1 * numPoints + c1] = true;
135
- }
136
- }
137
- }
138
- }
139
- const localPlane = this.tempPlane_Cut;
140
- object.updateMatrix();
141
- ConvexObjectBreaker.transformPlaneToLocalSpace(plane, object.matrix, localPlane);
142
- for (let i = 0; i < numFaces; i++) {
143
- const va = getVertexIndex(i, 0);
144
- const vb = getVertexIndex(i, 1);
145
- const vc = getVertexIndex(i, 2);
146
- for (let segment = 0; segment < 3; segment++) {
147
- const i0 = segment === 0 ? va : segment === 1 ? vb : vc;
148
- const i1 = segment === 0 ? vb : segment === 1 ? vc : va;
149
- const segmentState = this.segments[i0 * numPoints + i1];
150
- if (segmentState)
151
- continue;
152
- this.segments[i0 * numPoints + i1] = true;
153
- this.segments[i1 * numPoints + i0] = true;
154
- p0.set(coords[3 * i0], coords[3 * i0 + 1], coords[3 * i0 + 2]);
155
- p1.set(coords[3 * i1], coords[3 * i1 + 1], coords[3 * i1 + 2]);
156
- let mark0 = 0;
157
- let d = localPlane.distanceToPoint(p0);
158
- if (d > delta) {
159
- mark0 = 2;
160
- points2.push(p0.clone());
161
- } else if (d < -delta) {
162
- mark0 = 1;
163
- points1.push(p0.clone());
164
- } else {
165
- mark0 = 3;
166
- points1.push(p0.clone());
167
- points2.push(p0.clone());
168
- }
169
- let mark1 = 0;
170
- d = localPlane.distanceToPoint(p1);
171
- if (d > delta) {
172
- mark1 = 2;
173
- points2.push(p1.clone());
174
- } else if (d < -delta) {
175
- mark1 = 1;
176
- points1.push(p1.clone());
177
- } else {
178
- mark1 = 3;
179
- points1.push(p1.clone());
180
- points2.push(p1.clone());
181
- }
182
- if (mark0 === 1 && mark1 === 2 || mark0 === 2 && mark1 === 1) {
183
- this.tempLine1.start.copy(p0);
184
- this.tempLine1.end.copy(p1);
185
- let intersection = new THREE.Vector3();
186
- intersection = localPlane.intersectLine(this.tempLine1, intersection);
187
- if (intersection === null) {
188
- console.error("Internal error: segment does not intersect plane.");
189
- output.segmentedObject1 = null;
190
- output.segmentedObject2 = null;
191
- return 0;
192
- }
193
- points1.push(intersection);
194
- points2.push(intersection.clone());
195
- }
196
- }
197
- }
198
- const newMass = object.userData.mass * 0.5;
199
- this.tempCM1.set(0, 0, 0);
200
- let radius1 = 0;
201
- const numPoints1 = points1.length;
202
- if (numPoints1 > 0) {
203
- for (let i = 0; i < numPoints1; i++)
204
- this.tempCM1.add(points1[i]);
205
- this.tempCM1.divideScalar(numPoints1);
206
- for (let i = 0; i < numPoints1; i++) {
207
- const p = points1[i];
208
- p.sub(this.tempCM1);
209
- radius1 = Math.max(radius1, p.x, p.y, p.z);
210
- }
211
- this.tempCM1.add(object.position);
212
- }
213
- this.tempCM2.set(0, 0, 0);
214
- let radius2 = 0;
215
- const numPoints2 = points2.length;
216
- if (numPoints2 > 0) {
217
- for (let i = 0; i < numPoints2; i++)
218
- this.tempCM2.add(points2[i]);
219
- this.tempCM2.divideScalar(numPoints2);
220
- for (let i = 0; i < numPoints2; i++) {
221
- const p = points2[i];
222
- p.sub(this.tempCM2);
223
- radius2 = Math.max(radius2, p.x, p.y, p.z);
224
- }
225
- this.tempCM2.add(object.position);
226
- }
227
- let object1 = null;
228
- let object2 = null;
229
- let numObjects = 0;
230
- if (numPoints1 > 4) {
231
- object1 = new THREE.Mesh(new ConvexGeometry.ConvexGeometry(points1), object.material);
232
- object1.position.copy(this.tempCM1);
233
- object1.quaternion.copy(object.quaternion);
234
- this.prepareBreakableObject(
235
- object1,
236
- newMass,
237
- object.userData.velocity,
238
- object.userData.angularVelocity,
239
- 2 * radius1 > this.minSizeForBreak
240
- );
241
- numObjects++;
242
- }
243
- if (numPoints2 > 4) {
244
- object2 = new THREE.Mesh(new ConvexGeometry.ConvexGeometry(points2), object.material);
245
- object2.position.copy(this.tempCM2);
246
- object2.quaternion.copy(object.quaternion);
247
- this.prepareBreakableObject(
248
- object2,
249
- newMass,
250
- object.userData.velocity,
251
- object.userData.angularVelocity,
252
- 2 * radius2 > this.minSizeForBreak
253
- );
254
- numObjects++;
255
- }
256
- output.object1 = object1;
257
- output.object2 = object2;
258
- return numObjects;
259
- }
260
- static transformFreeVector(v, m) {
261
- const x = v.x, y = v.y, z = v.z;
262
- const e = m.elements;
263
- v.x = e[0] * x + e[4] * y + e[8] * z;
264
- v.y = e[1] * x + e[5] * y + e[9] * z;
265
- v.z = e[2] * x + e[6] * y + e[10] * z;
266
- return v;
267
- }
268
- static transformFreeVectorInverse(v, m) {
269
- const x = v.x, y = v.y, z = v.z;
270
- const e = m.elements;
271
- v.x = e[0] * x + e[1] * y + e[2] * z;
272
- v.y = e[4] * x + e[5] * y + e[6] * z;
273
- v.z = e[8] * x + e[9] * y + e[10] * z;
274
- return v;
275
- }
276
- static transformTiedVectorInverse(v, m) {
277
- const x = v.x, y = v.y, z = v.z;
278
- const e = m.elements;
279
- v.x = e[0] * x + e[1] * y + e[2] * z - e[12];
280
- v.y = e[4] * x + e[5] * y + e[6] * z - e[13];
281
- v.z = e[8] * x + e[9] * y + e[10] * z - e[14];
282
- return v;
283
- }
284
- static transformPlaneToLocalSpace(plane, m, resultPlane) {
285
- resultPlane.normal.copy(plane.normal);
286
- resultPlane.constant = plane.constant;
287
- const referencePoint = ConvexObjectBreaker.transformTiedVectorInverse(plane.coplanarPoint(_v1), m);
288
- ConvexObjectBreaker.transformFreeVectorInverse(resultPlane.normal, m);
289
- resultPlane.constant = -referencePoint.dot(resultPlane.normal);
290
- }
291
- }
292
- exports.ConvexObjectBreaker = ConvexObjectBreaker;
@@ -1,292 +0,0 @@
1
- import { Vector3, Line3, Plane, Mesh } from "three";
2
- import { ConvexGeometry } from "../geometries/ConvexGeometry.js";
3
- const _v1 = /* @__PURE__ */ new Vector3();
4
- class ConvexObjectBreaker {
5
- constructor(minSizeForBreak = 1.4, smallDelta = 1e-4) {
6
- this.minSizeForBreak = minSizeForBreak;
7
- this.smallDelta = smallDelta;
8
- this.tempLine1 = new Line3();
9
- this.tempPlane1 = new Plane();
10
- this.tempPlane2 = new Plane();
11
- this.tempPlane_Cut = new Plane();
12
- this.tempCM1 = new Vector3();
13
- this.tempCM2 = new Vector3();
14
- this.tempVector3 = new Vector3();
15
- this.tempVector3_2 = new Vector3();
16
- this.tempVector3_3 = new Vector3();
17
- this.tempVector3_P0 = new Vector3();
18
- this.tempVector3_P1 = new Vector3();
19
- this.tempVector3_P2 = new Vector3();
20
- this.tempVector3_N0 = new Vector3();
21
- this.tempVector3_N1 = new Vector3();
22
- this.tempVector3_AB = new Vector3();
23
- this.tempVector3_CB = new Vector3();
24
- this.tempResultObjects = { object1: null, object2: null };
25
- this.segments = [];
26
- const n = 30 * 30;
27
- for (let i = 0; i < n; i++)
28
- this.segments[i] = false;
29
- }
30
- prepareBreakableObject(object, mass, velocity, angularVelocity, breakable) {
31
- const userData = object.userData;
32
- userData.mass = mass;
33
- userData.velocity = velocity.clone();
34
- userData.angularVelocity = angularVelocity.clone();
35
- userData.breakable = breakable;
36
- }
37
- /*
38
- * @param {int} maxRadialIterations Iterations for radial cuts.
39
- * @param {int} maxRandomIterations Max random iterations for not-radial cuts
40
- *
41
- * Returns the array of pieces
42
- */
43
- subdivideByImpact(object, pointOfImpact, normal, maxRadialIterations, maxRandomIterations) {
44
- const debris = [];
45
- const tempPlane1 = this.tempPlane1;
46
- const tempPlane2 = this.tempPlane2;
47
- this.tempVector3.addVectors(pointOfImpact, normal);
48
- tempPlane1.setFromCoplanarPoints(pointOfImpact, object.position, this.tempVector3);
49
- const maxTotalIterations = maxRandomIterations + maxRadialIterations;
50
- const scope = this;
51
- function subdivideRadial(subObject, startAngle, endAngle, numIterations) {
52
- if (Math.random() < numIterations * 0.05 || numIterations > maxTotalIterations) {
53
- debris.push(subObject);
54
- return;
55
- }
56
- let angle = Math.PI;
57
- if (numIterations === 0) {
58
- tempPlane2.normal.copy(tempPlane1.normal);
59
- tempPlane2.constant = tempPlane1.constant;
60
- } else {
61
- if (numIterations <= maxRadialIterations) {
62
- angle = (endAngle - startAngle) * (0.2 + 0.6 * Math.random()) + startAngle;
63
- scope.tempVector3_2.copy(object.position).sub(pointOfImpact).applyAxisAngle(normal, angle).add(pointOfImpact);
64
- tempPlane2.setFromCoplanarPoints(pointOfImpact, scope.tempVector3, scope.tempVector3_2);
65
- } else {
66
- angle = (0.5 * (numIterations & 1) + 0.2 * (2 - Math.random())) * Math.PI;
67
- scope.tempVector3_2.copy(pointOfImpact).sub(subObject.position).applyAxisAngle(normal, angle).add(subObject.position);
68
- scope.tempVector3_3.copy(normal).add(subObject.position);
69
- tempPlane2.setFromCoplanarPoints(subObject.position, scope.tempVector3_3, scope.tempVector3_2);
70
- }
71
- }
72
- scope.cutByPlane(subObject, tempPlane2, scope.tempResultObjects);
73
- const obj1 = scope.tempResultObjects.object1;
74
- const obj2 = scope.tempResultObjects.object2;
75
- if (obj1) {
76
- subdivideRadial(obj1, startAngle, angle, numIterations + 1);
77
- }
78
- if (obj2) {
79
- subdivideRadial(obj2, angle, endAngle, numIterations + 1);
80
- }
81
- }
82
- subdivideRadial(object, 0, 2 * Math.PI, 0);
83
- return debris;
84
- }
85
- cutByPlane(object, plane, output) {
86
- const geometry = object.geometry;
87
- const coords = geometry.attributes.position.array;
88
- const normals = geometry.attributes.normal.array;
89
- const numPoints = coords.length / 3;
90
- let numFaces = numPoints / 3;
91
- let indices = geometry.getIndex();
92
- if (indices) {
93
- indices = indices.array;
94
- numFaces = indices.length / 3;
95
- }
96
- function getVertexIndex(faceIdx, vert) {
97
- const idx = faceIdx * 3 + vert;
98
- return indices ? indices[idx] : idx;
99
- }
100
- const points1 = [];
101
- const points2 = [];
102
- const delta = this.smallDelta;
103
- const numPointPairs = numPoints * numPoints;
104
- for (let i = 0; i < numPointPairs; i++)
105
- this.segments[i] = false;
106
- const p0 = this.tempVector3_P0;
107
- const p1 = this.tempVector3_P1;
108
- const n0 = this.tempVector3_N0;
109
- const n1 = this.tempVector3_N1;
110
- for (let i = 0; i < numFaces - 1; i++) {
111
- const a1 = getVertexIndex(i, 0);
112
- const b1 = getVertexIndex(i, 1);
113
- const c1 = getVertexIndex(i, 2);
114
- n0.set(normals[a1], normals[a1] + 1, normals[a1] + 2);
115
- for (let j = i + 1; j < numFaces; j++) {
116
- const a2 = getVertexIndex(j, 0);
117
- const b2 = getVertexIndex(j, 1);
118
- const c2 = getVertexIndex(j, 2);
119
- n1.set(normals[a2], normals[a2] + 1, normals[a2] + 2);
120
- const coplanar = 1 - n0.dot(n1) < delta;
121
- if (coplanar) {
122
- if (a1 === a2 || a1 === b2 || a1 === c2) {
123
- if (b1 === a2 || b1 === b2 || b1 === c2) {
124
- this.segments[a1 * numPoints + b1] = true;
125
- this.segments[b1 * numPoints + a1] = true;
126
- } else {
127
- this.segments[c1 * numPoints + a1] = true;
128
- this.segments[a1 * numPoints + c1] = true;
129
- }
130
- } else if (b1 === a2 || b1 === b2 || b1 === c2) {
131
- this.segments[c1 * numPoints + b1] = true;
132
- this.segments[b1 * numPoints + c1] = true;
133
- }
134
- }
135
- }
136
- }
137
- const localPlane = this.tempPlane_Cut;
138
- object.updateMatrix();
139
- ConvexObjectBreaker.transformPlaneToLocalSpace(plane, object.matrix, localPlane);
140
- for (let i = 0; i < numFaces; i++) {
141
- const va = getVertexIndex(i, 0);
142
- const vb = getVertexIndex(i, 1);
143
- const vc = getVertexIndex(i, 2);
144
- for (let segment = 0; segment < 3; segment++) {
145
- const i0 = segment === 0 ? va : segment === 1 ? vb : vc;
146
- const i1 = segment === 0 ? vb : segment === 1 ? vc : va;
147
- const segmentState = this.segments[i0 * numPoints + i1];
148
- if (segmentState)
149
- continue;
150
- this.segments[i0 * numPoints + i1] = true;
151
- this.segments[i1 * numPoints + i0] = true;
152
- p0.set(coords[3 * i0], coords[3 * i0 + 1], coords[3 * i0 + 2]);
153
- p1.set(coords[3 * i1], coords[3 * i1 + 1], coords[3 * i1 + 2]);
154
- let mark0 = 0;
155
- let d = localPlane.distanceToPoint(p0);
156
- if (d > delta) {
157
- mark0 = 2;
158
- points2.push(p0.clone());
159
- } else if (d < -delta) {
160
- mark0 = 1;
161
- points1.push(p0.clone());
162
- } else {
163
- mark0 = 3;
164
- points1.push(p0.clone());
165
- points2.push(p0.clone());
166
- }
167
- let mark1 = 0;
168
- d = localPlane.distanceToPoint(p1);
169
- if (d > delta) {
170
- mark1 = 2;
171
- points2.push(p1.clone());
172
- } else if (d < -delta) {
173
- mark1 = 1;
174
- points1.push(p1.clone());
175
- } else {
176
- mark1 = 3;
177
- points1.push(p1.clone());
178
- points2.push(p1.clone());
179
- }
180
- if (mark0 === 1 && mark1 === 2 || mark0 === 2 && mark1 === 1) {
181
- this.tempLine1.start.copy(p0);
182
- this.tempLine1.end.copy(p1);
183
- let intersection = new Vector3();
184
- intersection = localPlane.intersectLine(this.tempLine1, intersection);
185
- if (intersection === null) {
186
- console.error("Internal error: segment does not intersect plane.");
187
- output.segmentedObject1 = null;
188
- output.segmentedObject2 = null;
189
- return 0;
190
- }
191
- points1.push(intersection);
192
- points2.push(intersection.clone());
193
- }
194
- }
195
- }
196
- const newMass = object.userData.mass * 0.5;
197
- this.tempCM1.set(0, 0, 0);
198
- let radius1 = 0;
199
- const numPoints1 = points1.length;
200
- if (numPoints1 > 0) {
201
- for (let i = 0; i < numPoints1; i++)
202
- this.tempCM1.add(points1[i]);
203
- this.tempCM1.divideScalar(numPoints1);
204
- for (let i = 0; i < numPoints1; i++) {
205
- const p = points1[i];
206
- p.sub(this.tempCM1);
207
- radius1 = Math.max(radius1, p.x, p.y, p.z);
208
- }
209
- this.tempCM1.add(object.position);
210
- }
211
- this.tempCM2.set(0, 0, 0);
212
- let radius2 = 0;
213
- const numPoints2 = points2.length;
214
- if (numPoints2 > 0) {
215
- for (let i = 0; i < numPoints2; i++)
216
- this.tempCM2.add(points2[i]);
217
- this.tempCM2.divideScalar(numPoints2);
218
- for (let i = 0; i < numPoints2; i++) {
219
- const p = points2[i];
220
- p.sub(this.tempCM2);
221
- radius2 = Math.max(radius2, p.x, p.y, p.z);
222
- }
223
- this.tempCM2.add(object.position);
224
- }
225
- let object1 = null;
226
- let object2 = null;
227
- let numObjects = 0;
228
- if (numPoints1 > 4) {
229
- object1 = new Mesh(new ConvexGeometry(points1), object.material);
230
- object1.position.copy(this.tempCM1);
231
- object1.quaternion.copy(object.quaternion);
232
- this.prepareBreakableObject(
233
- object1,
234
- newMass,
235
- object.userData.velocity,
236
- object.userData.angularVelocity,
237
- 2 * radius1 > this.minSizeForBreak
238
- );
239
- numObjects++;
240
- }
241
- if (numPoints2 > 4) {
242
- object2 = new Mesh(new ConvexGeometry(points2), object.material);
243
- object2.position.copy(this.tempCM2);
244
- object2.quaternion.copy(object.quaternion);
245
- this.prepareBreakableObject(
246
- object2,
247
- newMass,
248
- object.userData.velocity,
249
- object.userData.angularVelocity,
250
- 2 * radius2 > this.minSizeForBreak
251
- );
252
- numObjects++;
253
- }
254
- output.object1 = object1;
255
- output.object2 = object2;
256
- return numObjects;
257
- }
258
- static transformFreeVector(v, m) {
259
- const x = v.x, y = v.y, z = v.z;
260
- const e = m.elements;
261
- v.x = e[0] * x + e[4] * y + e[8] * z;
262
- v.y = e[1] * x + e[5] * y + e[9] * z;
263
- v.z = e[2] * x + e[6] * y + e[10] * z;
264
- return v;
265
- }
266
- static transformFreeVectorInverse(v, m) {
267
- const x = v.x, y = v.y, z = v.z;
268
- const e = m.elements;
269
- v.x = e[0] * x + e[1] * y + e[2] * z;
270
- v.y = e[4] * x + e[5] * y + e[6] * z;
271
- v.z = e[8] * x + e[9] * y + e[10] * z;
272
- return v;
273
- }
274
- static transformTiedVectorInverse(v, m) {
275
- const x = v.x, y = v.y, z = v.z;
276
- const e = m.elements;
277
- v.x = e[0] * x + e[1] * y + e[2] * z - e[12];
278
- v.y = e[4] * x + e[5] * y + e[6] * z - e[13];
279
- v.z = e[8] * x + e[9] * y + e[10] * z - e[14];
280
- return v;
281
- }
282
- static transformPlaneToLocalSpace(plane, m, resultPlane) {
283
- resultPlane.normal.copy(plane.normal);
284
- resultPlane.constant = plane.constant;
285
- const referencePoint = ConvexObjectBreaker.transformTiedVectorInverse(plane.coplanarPoint(_v1), m);
286
- ConvexObjectBreaker.transformFreeVectorInverse(resultPlane.normal, m);
287
- resultPlane.constant = -referencePoint.dot(resultPlane.normal);
288
- }
289
- }
290
- export {
291
- ConvexObjectBreaker
292
- };