three-stdlib 2.35.4 → 2.35.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (514) hide show
  1. package/_polyfill/CapsuleGeometry.cjs +17 -20
  2. package/_polyfill/CapsuleGeometry.cjs.map +1 -1
  3. package/_polyfill/CapsuleGeometry.js +17 -20
  4. package/_polyfill/CapsuleGeometry.js.map +1 -1
  5. package/_polyfill/constants.cjs +1 -1
  6. package/_polyfill/constants.cjs.map +1 -1
  7. package/_polyfill/constants.js +1 -1
  8. package/_polyfill/constants.js.map +1 -1
  9. package/animation/AnimationClipCreator.cjs +13 -13
  10. package/animation/AnimationClipCreator.cjs.map +1 -1
  11. package/animation/AnimationClipCreator.js +13 -13
  12. package/animation/AnimationClipCreator.js.map +1 -1
  13. package/animation/CCDIKSolver.cjs +11 -11
  14. package/animation/CCDIKSolver.cjs.map +1 -1
  15. package/animation/CCDIKSolver.js +12 -12
  16. package/animation/CCDIKSolver.js.map +1 -1
  17. package/animation/MMDAnimationHelper.cjs +1 -1
  18. package/animation/MMDAnimationHelper.cjs.map +1 -1
  19. package/animation/MMDAnimationHelper.js +1 -1
  20. package/animation/MMDAnimationHelper.js.map +1 -1
  21. package/animation/MMDPhysics.cjs +4 -4
  22. package/animation/MMDPhysics.cjs.map +1 -1
  23. package/animation/MMDPhysics.js +4 -4
  24. package/animation/MMDPhysics.js.map +1 -1
  25. package/controls/ArcballControls.cjs +2 -2
  26. package/controls/ArcballControls.cjs.map +1 -1
  27. package/controls/ArcballControls.js +3 -3
  28. package/controls/ArcballControls.js.map +1 -1
  29. package/controls/FirstPersonControls.cjs +1 -1
  30. package/controls/FirstPersonControls.cjs.map +1 -1
  31. package/controls/FirstPersonControls.js +1 -1
  32. package/controls/FirstPersonControls.js.map +1 -1
  33. package/controls/OrbitControls.cjs +2 -2
  34. package/controls/OrbitControls.cjs.map +1 -1
  35. package/controls/OrbitControls.js +3 -3
  36. package/controls/OrbitControls.js.map +1 -1
  37. package/controls/PointerLockControls.cjs +2 -2
  38. package/controls/PointerLockControls.cjs.map +1 -1
  39. package/controls/PointerLockControls.js +3 -3
  40. package/controls/PointerLockControls.js.map +1 -1
  41. package/csm/CSM.cjs +4 -4
  42. package/csm/CSM.cjs.map +1 -1
  43. package/csm/CSM.js +5 -5
  44. package/csm/CSM.js.map +1 -1
  45. package/csm/CSMFrustum.cjs +1 -1
  46. package/csm/CSMFrustum.cjs.map +1 -1
  47. package/csm/CSMFrustum.js +2 -2
  48. package/csm/CSMFrustum.js.map +1 -1
  49. package/deprecated/Geometry.cjs +715 -722
  50. package/deprecated/Geometry.cjs.map +1 -1
  51. package/deprecated/Geometry.js +716 -723
  52. package/deprecated/Geometry.js.map +1 -1
  53. package/effects/AnaglyphEffect.cjs +1 -2
  54. package/effects/AnaglyphEffect.cjs.map +1 -1
  55. package/effects/AnaglyphEffect.js +2 -3
  56. package/effects/AnaglyphEffect.js.map +1 -1
  57. package/effects/OutlineEffect.cjs +1 -2
  58. package/effects/OutlineEffect.cjs.map +1 -1
  59. package/effects/OutlineEffect.js +2 -3
  60. package/effects/OutlineEffect.js.map +1 -1
  61. package/effects/ParallaxBarrierEffect.cjs +1 -2
  62. package/effects/ParallaxBarrierEffect.cjs.map +1 -1
  63. package/effects/ParallaxBarrierEffect.js +2 -3
  64. package/effects/ParallaxBarrierEffect.js.map +1 -1
  65. package/exporters/DRACOExporter.cjs +122 -133
  66. package/exporters/DRACOExporter.cjs.map +1 -1
  67. package/exporters/DRACOExporter.d.ts +21 -23
  68. package/exporters/DRACOExporter.js +122 -133
  69. package/exporters/DRACOExporter.js.map +1 -1
  70. package/exporters/GLTFExporter.cjs +167 -170
  71. package/exporters/GLTFExporter.cjs.map +1 -1
  72. package/exporters/GLTFExporter.js +167 -170
  73. package/exporters/GLTFExporter.js.map +1 -1
  74. package/geometries/LightningStrike.cjs +515 -524
  75. package/geometries/LightningStrike.cjs.map +1 -1
  76. package/geometries/LightningStrike.js +515 -524
  77. package/geometries/LightningStrike.js.map +1 -1
  78. package/geometries/RoundedBoxGeometry.cjs +1 -1
  79. package/geometries/RoundedBoxGeometry.cjs.map +1 -1
  80. package/geometries/RoundedBoxGeometry.js +2 -2
  81. package/geometries/RoundedBoxGeometry.js.map +1 -1
  82. package/helpers/RaycasterHelper.cjs +2 -2
  83. package/helpers/RaycasterHelper.cjs.map +1 -1
  84. package/helpers/RaycasterHelper.js +3 -3
  85. package/helpers/RaycasterHelper.js.map +1 -1
  86. package/helpers/VertexNormalsHelper.cjs +3 -3
  87. package/helpers/VertexNormalsHelper.cjs.map +1 -1
  88. package/helpers/VertexNormalsHelper.js +4 -4
  89. package/helpers/VertexNormalsHelper.js.map +1 -1
  90. package/helpers/VertexTangentsHelper.cjs +2 -2
  91. package/helpers/VertexTangentsHelper.cjs.map +1 -1
  92. package/helpers/VertexTangentsHelper.js +3 -3
  93. package/helpers/VertexTangentsHelper.js.map +1 -1
  94. package/interactive/InteractiveGroup.cjs +1 -1
  95. package/interactive/InteractiveGroup.cjs.map +1 -1
  96. package/interactive/InteractiveGroup.js +2 -2
  97. package/interactive/InteractiveGroup.js.map +1 -1
  98. package/interactive/SelectionBox.cjs +15 -15
  99. package/interactive/SelectionBox.cjs.map +1 -1
  100. package/interactive/SelectionBox.js +16 -16
  101. package/interactive/SelectionBox.js.map +1 -1
  102. package/libs/chevrotain.cjs +1 -1
  103. package/libs/chevrotain.cjs.map +1 -1
  104. package/libs/chevrotain.js +1 -1
  105. package/libs/chevrotain.js.map +1 -1
  106. package/libs/lottie.cjs +1 -1
  107. package/libs/lottie.cjs.map +1 -1
  108. package/libs/lottie.js +1 -1
  109. package/libs/lottie.js.map +1 -1
  110. package/libs/opentype.cjs +1 -1
  111. package/libs/opentype.cjs.map +1 -1
  112. package/libs/opentype.js +1 -1
  113. package/libs/opentype.js.map +1 -1
  114. package/lights/LightProbeGenerator.cjs +5 -5
  115. package/lights/LightProbeGenerator.cjs.map +1 -1
  116. package/lights/LightProbeGenerator.js +5 -5
  117. package/lights/LightProbeGenerator.js.map +1 -1
  118. package/lights/RectAreaLightUniformsLib.cjs +3 -3
  119. package/lights/RectAreaLightUniformsLib.cjs.map +1 -1
  120. package/lights/RectAreaLightUniformsLib.js +3 -3
  121. package/lights/RectAreaLightUniformsLib.js.map +1 -1
  122. package/lines/LineMaterial.cjs +1 -2
  123. package/lines/LineMaterial.cjs.map +1 -1
  124. package/lines/LineMaterial.js +2 -3
  125. package/lines/LineMaterial.js.map +1 -1
  126. package/lines/LineSegments2.cjs +13 -13
  127. package/lines/LineSegments2.cjs.map +1 -1
  128. package/lines/LineSegments2.js +14 -14
  129. package/lines/LineSegments2.js.map +1 -1
  130. package/lines/LineSegmentsGeometry.cjs +2 -2
  131. package/lines/LineSegmentsGeometry.cjs.map +1 -1
  132. package/lines/LineSegmentsGeometry.js +3 -3
  133. package/lines/LineSegmentsGeometry.js.map +1 -1
  134. package/lines/Wireframe.cjs +3 -3
  135. package/lines/Wireframe.cjs.map +1 -1
  136. package/lines/Wireframe.js +4 -4
  137. package/lines/Wireframe.js.map +1 -1
  138. package/loaders/BasisTextureLoader.cjs +435 -441
  139. package/loaders/BasisTextureLoader.cjs.map +1 -1
  140. package/loaders/BasisTextureLoader.js +435 -441
  141. package/loaders/BasisTextureLoader.js.map +1 -1
  142. package/loaders/EXRLoader.cjs +1 -2
  143. package/loaders/EXRLoader.cjs.map +1 -1
  144. package/loaders/EXRLoader.js +2 -3
  145. package/loaders/EXRLoader.js.map +1 -1
  146. package/loaders/FBXLoader.cjs +2 -2
  147. package/loaders/FBXLoader.cjs.map +1 -1
  148. package/loaders/FBXLoader.js +2 -2
  149. package/loaders/FBXLoader.js.map +1 -1
  150. package/loaders/FontLoader.cjs +2 -2
  151. package/loaders/FontLoader.cjs.map +1 -1
  152. package/loaders/FontLoader.d.ts +2 -2
  153. package/loaders/FontLoader.js +2 -2
  154. package/loaders/FontLoader.js.map +1 -1
  155. package/loaders/GLTFLoader.cjs +2 -2
  156. package/loaders/GLTFLoader.cjs.map +1 -1
  157. package/loaders/GLTFLoader.js +2 -2
  158. package/loaders/GLTFLoader.js.map +1 -1
  159. package/loaders/KTX2Loader.cjs +374 -377
  160. package/loaders/KTX2Loader.cjs.map +1 -1
  161. package/loaders/KTX2Loader.js +374 -377
  162. package/loaders/KTX2Loader.js.map +1 -1
  163. package/loaders/LDrawLoader.cjs +4 -5
  164. package/loaders/LDrawLoader.cjs.map +1 -1
  165. package/loaders/LDrawLoader.js +5 -6
  166. package/loaders/LDrawLoader.js.map +1 -1
  167. package/loaders/OBJLoader.cjs +5 -5
  168. package/loaders/OBJLoader.cjs.map +1 -1
  169. package/loaders/OBJLoader.js +6 -6
  170. package/loaders/OBJLoader.js.map +1 -1
  171. package/loaders/PRWMLoader.cjs +43 -46
  172. package/loaders/PRWMLoader.cjs.map +1 -1
  173. package/loaders/PRWMLoader.js +43 -46
  174. package/loaders/PRWMLoader.js.map +1 -1
  175. package/loaders/SVGLoader.cjs +1688 -1694
  176. package/loaders/SVGLoader.cjs.map +1 -1
  177. package/loaders/SVGLoader.js +1688 -1694
  178. package/loaders/SVGLoader.js.map +1 -1
  179. package/loaders/XLoader.cjs +1 -1
  180. package/loaders/XLoader.cjs.map +1 -1
  181. package/loaders/XLoader.js +1 -1
  182. package/loaders/XLoader.js.map +1 -1
  183. package/math/Capsule.cjs +3 -3
  184. package/math/Capsule.cjs.map +1 -1
  185. package/math/Capsule.js +3 -3
  186. package/math/Capsule.js.map +1 -1
  187. package/math/ColorConverter.cjs +9 -9
  188. package/math/ColorConverter.cjs.map +1 -1
  189. package/math/ColorConverter.js +9 -9
  190. package/math/ColorConverter.js.map +1 -1
  191. package/math/ConvexHull.cjs +50 -53
  192. package/math/ConvexHull.cjs.map +1 -1
  193. package/math/ConvexHull.js +50 -53
  194. package/math/ConvexHull.js.map +1 -1
  195. package/math/ImprovedNoise.cjs +1 -1
  196. package/math/ImprovedNoise.cjs.map +1 -1
  197. package/math/ImprovedNoise.js +1 -1
  198. package/math/ImprovedNoise.js.map +1 -1
  199. package/math/MeshSurfaceSampler.cjs +2 -2
  200. package/math/MeshSurfaceSampler.cjs.map +1 -1
  201. package/math/MeshSurfaceSampler.js +2 -2
  202. package/math/MeshSurfaceSampler.js.map +1 -1
  203. package/math/OBB.cjs +14 -14
  204. package/math/OBB.cjs.map +1 -1
  205. package/math/OBB.js +15 -15
  206. package/math/OBB.js.map +1 -1
  207. package/math/Octree.cjs +7 -7
  208. package/math/Octree.cjs.map +1 -1
  209. package/math/Octree.js +8 -8
  210. package/math/Octree.js.map +1 -1
  211. package/misc/ConvexObjectBreaker.cjs +268 -271
  212. package/misc/ConvexObjectBreaker.cjs.map +1 -1
  213. package/misc/ConvexObjectBreaker.js +269 -272
  214. package/misc/ConvexObjectBreaker.js.map +1 -1
  215. package/misc/Gyroscope.cjs +6 -6
  216. package/misc/Gyroscope.cjs.map +1 -1
  217. package/misc/Gyroscope.js +7 -7
  218. package/misc/Gyroscope.js.map +1 -1
  219. package/modifiers/CurveModifier.cjs +1 -1
  220. package/modifiers/CurveModifier.cjs.map +1 -1
  221. package/modifiers/CurveModifier.js +2 -2
  222. package/modifiers/CurveModifier.js.map +1 -1
  223. package/modifiers/SimplifyModifier.cjs +2 -2
  224. package/modifiers/SimplifyModifier.cjs.map +1 -1
  225. package/modifiers/SimplifyModifier.js +2 -2
  226. package/modifiers/SimplifyModifier.js.map +1 -1
  227. package/objects/BatchedMesh.cjs +2 -2
  228. package/objects/BatchedMesh.cjs.map +1 -1
  229. package/objects/BatchedMesh.js +3 -3
  230. package/objects/BatchedMesh.js.map +1 -1
  231. package/objects/GroundProjectedEnv.cjs +1 -2
  232. package/objects/GroundProjectedEnv.cjs.map +1 -1
  233. package/objects/GroundProjectedEnv.js +2 -3
  234. package/objects/GroundProjectedEnv.js.map +1 -1
  235. package/objects/Lensflare.cjs +206 -209
  236. package/objects/Lensflare.cjs.map +1 -1
  237. package/objects/Lensflare.js +206 -209
  238. package/objects/Lensflare.js.map +1 -1
  239. package/objects/Reflector.cjs +146 -154
  240. package/objects/Reflector.cjs.map +1 -1
  241. package/objects/Reflector.js +146 -154
  242. package/objects/Reflector.js.map +1 -1
  243. package/objects/ReflectorForSSRPass.cjs +180 -183
  244. package/objects/ReflectorForSSRPass.cjs.map +1 -1
  245. package/objects/ReflectorForSSRPass.js +180 -183
  246. package/objects/ReflectorForSSRPass.js.map +1 -1
  247. package/objects/Refractor.cjs +161 -164
  248. package/objects/Refractor.cjs.map +1 -1
  249. package/objects/Refractor.js +161 -164
  250. package/objects/Refractor.js.map +1 -1
  251. package/objects/ShadowMesh.cjs +1 -1
  252. package/objects/ShadowMesh.cjs.map +1 -1
  253. package/objects/ShadowMesh.js +2 -2
  254. package/objects/ShadowMesh.js.map +1 -1
  255. package/objects/Sky.cjs +32 -35
  256. package/objects/Sky.cjs.map +1 -1
  257. package/objects/Sky.d.ts +6 -100
  258. package/objects/Sky.js +32 -35
  259. package/objects/Sky.js.map +1 -1
  260. package/objects/Water.cjs +1 -2
  261. package/objects/Water.cjs.map +1 -1
  262. package/objects/Water.js +2 -3
  263. package/objects/Water.js.map +1 -1
  264. package/objects/Water2.cjs +140 -143
  265. package/objects/Water2.cjs.map +1 -1
  266. package/objects/Water2.js +140 -143
  267. package/objects/Water2.js.map +1 -1
  268. package/package.json +1 -1
  269. package/postprocessing/SAOPass.cjs +264 -267
  270. package/postprocessing/SAOPass.cjs.map +1 -1
  271. package/postprocessing/SAOPass.js +264 -267
  272. package/postprocessing/SAOPass.js.map +1 -1
  273. package/postprocessing/SSAOPass.cjs +250 -253
  274. package/postprocessing/SSAOPass.cjs.map +1 -1
  275. package/postprocessing/SSAOPass.js +250 -253
  276. package/postprocessing/SSAOPass.js.map +1 -1
  277. package/postprocessing/SSRPass.cjs +376 -379
  278. package/postprocessing/SSRPass.cjs.map +1 -1
  279. package/postprocessing/SSRPass.js +376 -379
  280. package/postprocessing/SSRPass.js.map +1 -1
  281. package/postprocessing/UnrealBloomPass.cjs +202 -205
  282. package/postprocessing/UnrealBloomPass.cjs.map +1 -1
  283. package/postprocessing/UnrealBloomPass.js +202 -205
  284. package/postprocessing/UnrealBloomPass.js.map +1 -1
  285. package/renderers/CSS2DRenderer.cjs +5 -5
  286. package/renderers/CSS2DRenderer.cjs.map +1 -1
  287. package/renderers/CSS2DRenderer.js +5 -5
  288. package/renderers/CSS2DRenderer.js.map +1 -1
  289. package/renderers/CSS3DRenderer.cjs +5 -5
  290. package/renderers/CSS3DRenderer.cjs.map +1 -1
  291. package/renderers/CSS3DRenderer.js +6 -6
  292. package/renderers/CSS3DRenderer.js.map +1 -1
  293. package/shaders/ACESFilmicToneMappingShader.cjs +46 -71
  294. package/shaders/ACESFilmicToneMappingShader.cjs.map +1 -1
  295. package/shaders/ACESFilmicToneMappingShader.js +46 -71
  296. package/shaders/ACESFilmicToneMappingShader.js.map +1 -1
  297. package/shaders/AfterimageShader.cjs +22 -41
  298. package/shaders/AfterimageShader.cjs.map +1 -1
  299. package/shaders/AfterimageShader.js +22 -41
  300. package/shaders/AfterimageShader.js.map +1 -1
  301. package/shaders/BasicShader.cjs +6 -20
  302. package/shaders/BasicShader.cjs.map +1 -1
  303. package/shaders/BasicShader.js +6 -20
  304. package/shaders/BasicShader.js.map +1 -1
  305. package/shaders/BleachBypassShader.cjs +26 -46
  306. package/shaders/BleachBypassShader.cjs.map +1 -1
  307. package/shaders/BleachBypassShader.js +26 -46
  308. package/shaders/BleachBypassShader.js.map +1 -1
  309. package/shaders/BlendShader.cjs +19 -33
  310. package/shaders/BlendShader.cjs.map +1 -1
  311. package/shaders/BlendShader.js +19 -33
  312. package/shaders/BlendShader.js.map +1 -1
  313. package/shaders/BokehShader.cjs +90 -117
  314. package/shaders/BokehShader.cjs.map +1 -1
  315. package/shaders/BokehShader.js +90 -117
  316. package/shaders/BokehShader.js.map +1 -1
  317. package/shaders/BokehShader2.cjs +232 -333
  318. package/shaders/BokehShader2.cjs.map +1 -1
  319. package/shaders/BokehShader2.js +232 -333
  320. package/shaders/BokehShader2.js.map +1 -1
  321. package/shaders/BrightnessContrastShader.cjs +22 -38
  322. package/shaders/BrightnessContrastShader.cjs.map +1 -1
  323. package/shaders/BrightnessContrastShader.js +22 -38
  324. package/shaders/BrightnessContrastShader.js.map +1 -1
  325. package/shaders/ColorCorrectionShader.cjs +21 -35
  326. package/shaders/ColorCorrectionShader.cjs.map +1 -1
  327. package/shaders/ColorCorrectionShader.js +21 -35
  328. package/shaders/ColorCorrectionShader.js.map +1 -1
  329. package/shaders/ColorifyShader.cjs +19 -34
  330. package/shaders/ColorifyShader.cjs.map +1 -1
  331. package/shaders/ColorifyShader.js +19 -34
  332. package/shaders/ColorifyShader.js.map +1 -1
  333. package/shaders/ConvolutionShader.cjs +24 -43
  334. package/shaders/ConvolutionShader.cjs.map +1 -1
  335. package/shaders/ConvolutionShader.js +24 -43
  336. package/shaders/ConvolutionShader.js.map +1 -1
  337. package/shaders/CopyShader.cjs +16 -30
  338. package/shaders/CopyShader.cjs.map +1 -1
  339. package/shaders/CopyShader.js +16 -30
  340. package/shaders/CopyShader.js.map +1 -1
  341. package/shaders/DOFMipMapShader.cjs +21 -38
  342. package/shaders/DOFMipMapShader.cjs.map +1 -1
  343. package/shaders/DOFMipMapShader.js +21 -38
  344. package/shaders/DOFMipMapShader.js.map +1 -1
  345. package/shaders/DepthLimitedBlurShader.cjs +69 -98
  346. package/shaders/DepthLimitedBlurShader.cjs.map +1 -1
  347. package/shaders/DepthLimitedBlurShader.js +69 -98
  348. package/shaders/DepthLimitedBlurShader.js.map +1 -1
  349. package/shaders/DigitalGlitch.cjs +59 -70
  350. package/shaders/DigitalGlitch.cjs.map +1 -1
  351. package/shaders/DigitalGlitch.js +59 -70
  352. package/shaders/DigitalGlitch.js.map +1 -1
  353. package/shaders/DotScreenShader.cjs +28 -49
  354. package/shaders/DotScreenShader.cjs.map +1 -1
  355. package/shaders/DotScreenShader.js +28 -49
  356. package/shaders/DotScreenShader.js.map +1 -1
  357. package/shaders/FXAAShader.cjs +1089 -1098
  358. package/shaders/FXAAShader.cjs.map +1 -1
  359. package/shaders/FXAAShader.js +1089 -1098
  360. package/shaders/FXAAShader.js.map +1 -1
  361. package/shaders/FilmShader.cjs +29 -57
  362. package/shaders/FilmShader.cjs.map +1 -1
  363. package/shaders/FilmShader.js +29 -57
  364. package/shaders/FilmShader.js.map +1 -1
  365. package/shaders/FocusShader.cjs +43 -70
  366. package/shaders/FocusShader.cjs.map +1 -1
  367. package/shaders/FocusShader.js +43 -70
  368. package/shaders/FocusShader.js.map +1 -1
  369. package/shaders/FreiChenShader.cjs +53 -74
  370. package/shaders/FreiChenShader.cjs.map +1 -1
  371. package/shaders/FreiChenShader.js +53 -74
  372. package/shaders/FreiChenShader.js.map +1 -1
  373. package/shaders/FresnelShader.cjs +35 -55
  374. package/shaders/FresnelShader.cjs.map +1 -1
  375. package/shaders/FresnelShader.js +35 -55
  376. package/shaders/FresnelShader.js.map +1 -1
  377. package/shaders/GammaCorrectionShader.cjs +19 -33
  378. package/shaders/GammaCorrectionShader.cjs.map +1 -1
  379. package/shaders/GammaCorrectionShader.js +19 -33
  380. package/shaders/GammaCorrectionShader.js.map +1 -1
  381. package/shaders/GodRaysShader.cjs +116 -193
  382. package/shaders/GodRaysShader.cjs.map +1 -1
  383. package/shaders/GodRaysShader.js +116 -193
  384. package/shaders/GodRaysShader.js.map +1 -1
  385. package/shaders/HalftoneShader.cjs +192 -270
  386. package/shaders/HalftoneShader.cjs.map +1 -1
  387. package/shaders/HalftoneShader.js +192 -270
  388. package/shaders/HalftoneShader.js.map +1 -1
  389. package/shaders/HorizontalTiltShiftShader.cjs +27 -43
  390. package/shaders/HorizontalTiltShiftShader.cjs.map +1 -1
  391. package/shaders/HorizontalTiltShiftShader.js +27 -43
  392. package/shaders/HorizontalTiltShiftShader.js.map +1 -1
  393. package/shaders/HueSaturationShader.cjs +31 -47
  394. package/shaders/HueSaturationShader.cjs.map +1 -1
  395. package/shaders/HueSaturationShader.js +31 -47
  396. package/shaders/HueSaturationShader.js.map +1 -1
  397. package/shaders/KaleidoShader.cjs +24 -37
  398. package/shaders/KaleidoShader.cjs.map +1 -1
  399. package/shaders/KaleidoShader.js +24 -37
  400. package/shaders/KaleidoShader.js.map +1 -1
  401. package/shaders/LuminosityHighPassShader.cjs +24 -43
  402. package/shaders/LuminosityHighPassShader.cjs.map +1 -1
  403. package/shaders/LuminosityHighPassShader.js +24 -43
  404. package/shaders/LuminosityHighPassShader.js.map +1 -1
  405. package/shaders/LuminosityShader.cjs +17 -34
  406. package/shaders/LuminosityShader.cjs.map +1 -1
  407. package/shaders/LuminosityShader.js +17 -34
  408. package/shaders/LuminosityShader.js.map +1 -1
  409. package/shaders/MirrorShader.cjs +26 -39
  410. package/shaders/MirrorShader.cjs.map +1 -1
  411. package/shaders/MirrorShader.js +26 -39
  412. package/shaders/MirrorShader.js.map +1 -1
  413. package/shaders/NormalMapShader.cjs +21 -36
  414. package/shaders/NormalMapShader.cjs.map +1 -1
  415. package/shaders/NormalMapShader.js +21 -36
  416. package/shaders/NormalMapShader.js.map +1 -1
  417. package/shaders/ParallaxShader.cjs +97 -147
  418. package/shaders/ParallaxShader.cjs.map +1 -1
  419. package/shaders/ParallaxShader.js +97 -147
  420. package/shaders/ParallaxShader.js.map +1 -1
  421. package/shaders/PixelShader.cjs +18 -31
  422. package/shaders/PixelShader.cjs.map +1 -1
  423. package/shaders/PixelShader.js +18 -31
  424. package/shaders/PixelShader.js.map +1 -1
  425. package/shaders/RGBShiftShader.cjs +20 -33
  426. package/shaders/RGBShiftShader.cjs.map +1 -1
  427. package/shaders/RGBShiftShader.js +20 -33
  428. package/shaders/RGBShiftShader.js.map +1 -1
  429. package/shaders/SAOShader.cjs +117 -154
  430. package/shaders/SAOShader.cjs.map +1 -1
  431. package/shaders/SAOShader.js +117 -154
  432. package/shaders/SAOShader.js.map +1 -1
  433. package/shaders/SMAAShader.cjs +270 -358
  434. package/shaders/SMAAShader.cjs.map +1 -1
  435. package/shaders/SMAAShader.js +270 -358
  436. package/shaders/SMAAShader.js.map +1 -1
  437. package/shaders/SSAOShader.cjs +142 -236
  438. package/shaders/SSAOShader.cjs.map +1 -1
  439. package/shaders/SSAOShader.js +142 -236
  440. package/shaders/SSAOShader.js.map +1 -1
  441. package/shaders/SSRShader.cjs +4 -4
  442. package/shaders/SSRShader.cjs.map +1 -1
  443. package/shaders/SSRShader.js +4 -4
  444. package/shaders/SSRShader.js.map +1 -1
  445. package/shaders/SepiaShader.cjs +20 -36
  446. package/shaders/SepiaShader.cjs.map +1 -1
  447. package/shaders/SepiaShader.js +20 -36
  448. package/shaders/SepiaShader.js.map +1 -1
  449. package/shaders/SobelOperatorShader.cjs +37 -64
  450. package/shaders/SobelOperatorShader.cjs.map +1 -1
  451. package/shaders/SobelOperatorShader.js +37 -64
  452. package/shaders/SobelOperatorShader.js.map +1 -1
  453. package/shaders/TechnicolorShader.cjs +16 -29
  454. package/shaders/TechnicolorShader.cjs.map +1 -1
  455. package/shaders/TechnicolorShader.js +16 -29
  456. package/shaders/TechnicolorShader.js.map +1 -1
  457. package/shaders/ToneMapShader.cjs +35 -55
  458. package/shaders/ToneMapShader.cjs.map +1 -1
  459. package/shaders/ToneMapShader.js +35 -55
  460. package/shaders/ToneMapShader.js.map +1 -1
  461. package/shaders/ToonShader.cjs +165 -275
  462. package/shaders/ToonShader.cjs.map +1 -1
  463. package/shaders/ToonShader.js +165 -275
  464. package/shaders/ToonShader.js.map +1 -1
  465. package/shaders/TriangleBlurShader.cjs +27 -50
  466. package/shaders/TriangleBlurShader.cjs.map +1 -1
  467. package/shaders/TriangleBlurShader.js +27 -50
  468. package/shaders/TriangleBlurShader.js.map +1 -1
  469. package/shaders/UnpackDepthRGBAShader.cjs +17 -32
  470. package/shaders/UnpackDepthRGBAShader.cjs.map +1 -1
  471. package/shaders/UnpackDepthRGBAShader.js +17 -32
  472. package/shaders/UnpackDepthRGBAShader.js.map +1 -1
  473. package/shaders/VerticalTiltShiftShader.cjs +27 -43
  474. package/shaders/VerticalTiltShiftShader.cjs.map +1 -1
  475. package/shaders/VerticalTiltShiftShader.js +27 -43
  476. package/shaders/VerticalTiltShiftShader.js.map +1 -1
  477. package/shaders/VignetteShader.cjs +27 -43
  478. package/shaders/VignetteShader.cjs.map +1 -1
  479. package/shaders/VignetteShader.js +27 -43
  480. package/shaders/VignetteShader.js.map +1 -1
  481. package/shaders/VolumeShader.cjs +213 -264
  482. package/shaders/VolumeShader.cjs.map +1 -1
  483. package/shaders/VolumeShader.js +213 -264
  484. package/shaders/VolumeShader.js.map +1 -1
  485. package/shaders/WaterRefractionShader.cjs +35 -63
  486. package/shaders/WaterRefractionShader.cjs.map +1 -1
  487. package/shaders/WaterRefractionShader.js +35 -63
  488. package/shaders/WaterRefractionShader.js.map +1 -1
  489. package/utils/GeometryCompressionUtils.cjs +1 -2
  490. package/utils/GeometryCompressionUtils.cjs.map +1 -1
  491. package/utils/GeometryCompressionUtils.js +2 -3
  492. package/utils/GeometryCompressionUtils.js.map +1 -1
  493. package/utils/RoughnessMipmapper.cjs +3 -3
  494. package/utils/RoughnessMipmapper.cjs.map +1 -1
  495. package/utils/RoughnessMipmapper.js +4 -4
  496. package/utils/RoughnessMipmapper.js.map +1 -1
  497. package/webxr/ARButton.cjs +106 -109
  498. package/webxr/ARButton.cjs.map +1 -1
  499. package/webxr/ARButton.d.ts +3 -4
  500. package/webxr/ARButton.js +106 -109
  501. package/webxr/ARButton.js.map +1 -1
  502. package/webxr/OculusHandPointerModel.cjs +2 -2
  503. package/webxr/OculusHandPointerModel.cjs.map +1 -1
  504. package/webxr/OculusHandPointerModel.js +2 -2
  505. package/webxr/OculusHandPointerModel.js.map +1 -1
  506. package/webxr/VRButton.cjs +95 -98
  507. package/webxr/VRButton.cjs.map +1 -1
  508. package/webxr/VRButton.d.ts +5 -6
  509. package/webxr/VRButton.js +95 -98
  510. package/webxr/VRButton.js.map +1 -1
  511. package/webxr/XRHandPrimitiveModel.cjs +2 -2
  512. package/webxr/XRHandPrimitiveModel.cjs.map +1 -1
  513. package/webxr/XRHandPrimitiveModel.js +3 -3
  514. package/webxr/XRHandPrimitiveModel.js.map +1 -1
@@ -1,207 +1,225 @@
1
- import { Vector3, Color, EventDispatcher, BufferGeometry, Float32BufferAttribute, MathUtils, Matrix3, Matrix4, Box3, Sphere, BufferAttribute, Vector2, Object3D } from "three";
2
- const _m1 = /* @__PURE__ */ new Matrix4();
3
- const _obj = /* @__PURE__ */ new Object3D();
4
- const _offset = /* @__PURE__ */ new Vector3();
5
- const Geometry = /* @__PURE__ */ (() => {
6
- class Geometry2 extends EventDispatcher {
7
- static createBufferGeometryFromObject(object) {
8
- let buffergeometry = new BufferGeometry();
9
- const geometry = object.geometry;
10
- if (object.isPoints || object.isLine) {
11
- const positions = new Float32BufferAttribute(geometry.vertices.length * 3, 3);
12
- const colors = new Float32BufferAttribute(geometry.colors.length * 3, 3);
13
- buffergeometry.setAttribute("position", positions.copyVector3sArray(geometry.vertices));
14
- buffergeometry.setAttribute("color", colors.copyColorsArray(geometry.colors));
15
- if (geometry.lineDistances && geometry.lineDistances.length === geometry.vertices.length) {
16
- const lineDistances = new Float32BufferAttribute(geometry.lineDistances.length, 1);
17
- buffergeometry.setAttribute("lineDistance", lineDistances.copyArray(geometry.lineDistances));
18
- }
19
- if (geometry.boundingSphere !== null) {
20
- buffergeometry.boundingSphere = geometry.boundingSphere.clone();
21
- }
22
- if (geometry.boundingBox !== null) {
23
- buffergeometry.boundingBox = geometry.boundingBox.clone();
24
- }
25
- } else if (object.isMesh) {
26
- buffergeometry = geometry.toBufferGeometry();
27
- }
28
- return buffergeometry;
29
- }
30
- constructor() {
31
- super();
32
- this.isGeometry = true;
33
- this.uuid = MathUtils.generateUUID();
34
- this.name = "";
35
- this.type = "Geometry";
36
- this.vertices = [];
37
- this.colors = [];
38
- this.faces = [];
39
- this.faceVertexUvs = [[]];
40
- this.morphTargets = [];
41
- this.morphNormals = [];
42
- this.skinWeights = [];
43
- this.skinIndices = [];
44
- this.lineDistances = [];
45
- this.boundingBox = null;
46
- this.boundingSphere = null;
47
- this.elementsNeedUpdate = false;
48
- this.verticesNeedUpdate = false;
49
- this.uvsNeedUpdate = false;
50
- this.normalsNeedUpdate = false;
51
- this.colorsNeedUpdate = false;
52
- this.lineDistancesNeedUpdate = false;
53
- this.groupsNeedUpdate = false;
54
- }
55
- applyMatrix4(matrix) {
56
- const normalMatrix = new Matrix3().getNormalMatrix(matrix);
57
- for (let i = 0, il = this.vertices.length; i < il; i++) {
58
- const vertex = this.vertices[i];
59
- vertex.applyMatrix4(matrix);
60
- }
61
- for (let i = 0, il = this.faces.length; i < il; i++) {
62
- const face = this.faces[i];
63
- face.normal.applyMatrix3(normalMatrix).normalize();
64
- for (let j = 0, jl = face.vertexNormals.length; j < jl; j++) {
65
- face.vertexNormals[j].applyMatrix3(normalMatrix).normalize();
66
- }
1
+ import { Matrix4, Object3D, Vector3, EventDispatcher, BufferGeometry, Float32BufferAttribute, MathUtils, Matrix3, Color, Box3, Sphere, BufferAttribute, Vector2 } from "three";
2
+ const _m1 = new Matrix4();
3
+ const _obj = new Object3D();
4
+ const _offset = new Vector3();
5
+ class Geometry extends EventDispatcher {
6
+ static createBufferGeometryFromObject(object) {
7
+ let buffergeometry = new BufferGeometry();
8
+ const geometry = object.geometry;
9
+ if (object.isPoints || object.isLine) {
10
+ const positions = new Float32BufferAttribute(geometry.vertices.length * 3, 3);
11
+ const colors = new Float32BufferAttribute(geometry.colors.length * 3, 3);
12
+ buffergeometry.setAttribute("position", positions.copyVector3sArray(geometry.vertices));
13
+ buffergeometry.setAttribute("color", colors.copyColorsArray(geometry.colors));
14
+ if (geometry.lineDistances && geometry.lineDistances.length === geometry.vertices.length) {
15
+ const lineDistances = new Float32BufferAttribute(geometry.lineDistances.length, 1);
16
+ buffergeometry.setAttribute("lineDistance", lineDistances.copyArray(geometry.lineDistances));
67
17
  }
68
- if (this.boundingBox !== null) {
69
- this.computeBoundingBox();
18
+ if (geometry.boundingSphere !== null) {
19
+ buffergeometry.boundingSphere = geometry.boundingSphere.clone();
70
20
  }
71
- if (this.boundingSphere !== null) {
72
- this.computeBoundingSphere();
21
+ if (geometry.boundingBox !== null) {
22
+ buffergeometry.boundingBox = geometry.boundingBox.clone();
73
23
  }
74
- this.verticesNeedUpdate = true;
75
- this.normalsNeedUpdate = true;
76
- return this;
24
+ } else if (object.isMesh) {
25
+ buffergeometry = geometry.toBufferGeometry();
77
26
  }
78
- rotateX(angle) {
79
- _m1.makeRotationX(angle);
80
- this.applyMatrix4(_m1);
81
- return this;
82
- }
83
- rotateY(angle) {
84
- _m1.makeRotationY(angle);
85
- this.applyMatrix4(_m1);
86
- return this;
27
+ return buffergeometry;
28
+ }
29
+ constructor() {
30
+ super();
31
+ this.isGeometry = true;
32
+ this.uuid = MathUtils.generateUUID();
33
+ this.name = "";
34
+ this.type = "Geometry";
35
+ this.vertices = [];
36
+ this.colors = [];
37
+ this.faces = [];
38
+ this.faceVertexUvs = [[]];
39
+ this.morphTargets = [];
40
+ this.morphNormals = [];
41
+ this.skinWeights = [];
42
+ this.skinIndices = [];
43
+ this.lineDistances = [];
44
+ this.boundingBox = null;
45
+ this.boundingSphere = null;
46
+ this.elementsNeedUpdate = false;
47
+ this.verticesNeedUpdate = false;
48
+ this.uvsNeedUpdate = false;
49
+ this.normalsNeedUpdate = false;
50
+ this.colorsNeedUpdate = false;
51
+ this.lineDistancesNeedUpdate = false;
52
+ this.groupsNeedUpdate = false;
53
+ }
54
+ applyMatrix4(matrix) {
55
+ const normalMatrix = new Matrix3().getNormalMatrix(matrix);
56
+ for (let i = 0, il = this.vertices.length; i < il; i++) {
57
+ const vertex = this.vertices[i];
58
+ vertex.applyMatrix4(matrix);
87
59
  }
88
- rotateZ(angle) {
89
- _m1.makeRotationZ(angle);
90
- this.applyMatrix4(_m1);
91
- return this;
60
+ for (let i = 0, il = this.faces.length; i < il; i++) {
61
+ const face = this.faces[i];
62
+ face.normal.applyMatrix3(normalMatrix).normalize();
63
+ for (let j = 0, jl = face.vertexNormals.length; j < jl; j++) {
64
+ face.vertexNormals[j].applyMatrix3(normalMatrix).normalize();
65
+ }
92
66
  }
93
- translate(x, y, z) {
94
- _m1.makeTranslation(x, y, z);
95
- this.applyMatrix4(_m1);
96
- return this;
67
+ if (this.boundingBox !== null) {
68
+ this.computeBoundingBox();
97
69
  }
98
- scale(x, y, z) {
99
- _m1.makeScale(x, y, z);
100
- this.applyMatrix4(_m1);
101
- return this;
70
+ if (this.boundingSphere !== null) {
71
+ this.computeBoundingSphere();
102
72
  }
103
- lookAt(vector) {
104
- _obj.lookAt(vector);
105
- _obj.updateMatrix();
106
- this.applyMatrix4(_obj.matrix);
73
+ this.verticesNeedUpdate = true;
74
+ this.normalsNeedUpdate = true;
75
+ return this;
76
+ }
77
+ rotateX(angle) {
78
+ _m1.makeRotationX(angle);
79
+ this.applyMatrix4(_m1);
80
+ return this;
81
+ }
82
+ rotateY(angle) {
83
+ _m1.makeRotationY(angle);
84
+ this.applyMatrix4(_m1);
85
+ return this;
86
+ }
87
+ rotateZ(angle) {
88
+ _m1.makeRotationZ(angle);
89
+ this.applyMatrix4(_m1);
90
+ return this;
91
+ }
92
+ translate(x, y, z) {
93
+ _m1.makeTranslation(x, y, z);
94
+ this.applyMatrix4(_m1);
95
+ return this;
96
+ }
97
+ scale(x, y, z) {
98
+ _m1.makeScale(x, y, z);
99
+ this.applyMatrix4(_m1);
100
+ return this;
101
+ }
102
+ lookAt(vector) {
103
+ _obj.lookAt(vector);
104
+ _obj.updateMatrix();
105
+ this.applyMatrix4(_obj.matrix);
106
+ return this;
107
+ }
108
+ fromBufferGeometry(geometry) {
109
+ const scope = this;
110
+ const index = geometry.index !== null ? geometry.index : void 0;
111
+ const attributes = geometry.attributes;
112
+ if (attributes.position === void 0) {
113
+ console.error("THREE.Geometry.fromBufferGeometry(): Position attribute required for conversion.");
107
114
  return this;
108
115
  }
109
- fromBufferGeometry(geometry) {
110
- const scope = this;
111
- const index = geometry.index !== null ? geometry.index : void 0;
112
- const attributes = geometry.attributes;
113
- if (attributes.position === void 0) {
114
- console.error("THREE.Geometry.fromBufferGeometry(): Position attribute required for conversion.");
115
- return this;
116
- }
117
- const position = attributes.position;
118
- const normal = attributes.normal;
119
- const color = attributes.color;
120
- const uv = attributes.uv;
121
- const uv2 = attributes.uv2;
122
- if (uv2 !== void 0)
123
- this.faceVertexUvs[1] = [];
124
- for (let i = 0; i < position.count; i++) {
125
- scope.vertices.push(new Vector3().fromBufferAttribute(position, i));
126
- if (color !== void 0) {
127
- scope.colors.push(new Color().fromBufferAttribute(color, i));
128
- }
129
- }
130
- function addFace(a, b, c, materialIndex) {
131
- const vertexColors = color === void 0 ? [] : [scope.colors[a].clone(), scope.colors[b].clone(), scope.colors[c].clone()];
132
- const vertexNormals = normal === void 0 ? [] : [
133
- new Vector3().fromBufferAttribute(normal, a),
134
- new Vector3().fromBufferAttribute(normal, b),
135
- new Vector3().fromBufferAttribute(normal, c)
136
- ];
137
- const face = new Face3(a, b, c, vertexNormals, vertexColors, materialIndex);
138
- scope.faces.push(face);
139
- if (uv !== void 0) {
140
- scope.faceVertexUvs[0].push([
141
- new Vector2().fromBufferAttribute(uv, a),
142
- new Vector2().fromBufferAttribute(uv, b),
143
- new Vector2().fromBufferAttribute(uv, c)
144
- ]);
145
- }
146
- if (uv2 !== void 0) {
147
- scope.faceVertexUvs[1].push([
148
- new Vector2().fromBufferAttribute(uv2, a),
149
- new Vector2().fromBufferAttribute(uv2, b),
150
- new Vector2().fromBufferAttribute(uv2, c)
151
- ]);
116
+ const position = attributes.position;
117
+ const normal = attributes.normal;
118
+ const color = attributes.color;
119
+ const uv = attributes.uv;
120
+ const uv2 = attributes.uv2;
121
+ if (uv2 !== void 0)
122
+ this.faceVertexUvs[1] = [];
123
+ for (let i = 0; i < position.count; i++) {
124
+ scope.vertices.push(new Vector3().fromBufferAttribute(position, i));
125
+ if (color !== void 0) {
126
+ scope.colors.push(new Color().fromBufferAttribute(color, i));
127
+ }
128
+ }
129
+ function addFace(a, b, c, materialIndex) {
130
+ const vertexColors = color === void 0 ? [] : [scope.colors[a].clone(), scope.colors[b].clone(), scope.colors[c].clone()];
131
+ const vertexNormals = normal === void 0 ? [] : [
132
+ new Vector3().fromBufferAttribute(normal, a),
133
+ new Vector3().fromBufferAttribute(normal, b),
134
+ new Vector3().fromBufferAttribute(normal, c)
135
+ ];
136
+ const face = new Face3(a, b, c, vertexNormals, vertexColors, materialIndex);
137
+ scope.faces.push(face);
138
+ if (uv !== void 0) {
139
+ scope.faceVertexUvs[0].push([
140
+ new Vector2().fromBufferAttribute(uv, a),
141
+ new Vector2().fromBufferAttribute(uv, b),
142
+ new Vector2().fromBufferAttribute(uv, c)
143
+ ]);
144
+ }
145
+ if (uv2 !== void 0) {
146
+ scope.faceVertexUvs[1].push([
147
+ new Vector2().fromBufferAttribute(uv2, a),
148
+ new Vector2().fromBufferAttribute(uv2, b),
149
+ new Vector2().fromBufferAttribute(uv2, c)
150
+ ]);
151
+ }
152
+ }
153
+ const groups = geometry.groups;
154
+ if (groups.length > 0) {
155
+ for (let i = 0; i < groups.length; i++) {
156
+ const group = groups[i];
157
+ const start = group.start;
158
+ const count = group.count;
159
+ for (let j = start, jl = start + count; j < jl; j += 3) {
160
+ if (index !== void 0) {
161
+ addFace(index.getX(j), index.getX(j + 1), index.getX(j + 2), group.materialIndex);
162
+ } else {
163
+ addFace(j, j + 1, j + 2, group.materialIndex);
164
+ }
152
165
  }
153
166
  }
154
- const groups = geometry.groups;
155
- if (groups.length > 0) {
156
- for (let i = 0; i < groups.length; i++) {
157
- const group = groups[i];
158
- const start = group.start;
159
- const count = group.count;
160
- for (let j = start, jl = start + count; j < jl; j += 3) {
161
- if (index !== void 0) {
162
- addFace(index.getX(j), index.getX(j + 1), index.getX(j + 2), group.materialIndex);
163
- } else {
164
- addFace(j, j + 1, j + 2, group.materialIndex);
165
- }
166
- }
167
+ } else {
168
+ if (index !== void 0) {
169
+ for (let i = 0; i < index.count; i += 3) {
170
+ addFace(index.getX(i), index.getX(i + 1), index.getX(i + 2));
167
171
  }
168
172
  } else {
169
- if (index !== void 0) {
170
- for (let i = 0; i < index.count; i += 3) {
171
- addFace(index.getX(i), index.getX(i + 1), index.getX(i + 2));
172
- }
173
- } else {
174
- for (let i = 0; i < position.count; i += 3) {
175
- addFace(i, i + 1, i + 2);
176
- }
173
+ for (let i = 0; i < position.count; i += 3) {
174
+ addFace(i, i + 1, i + 2);
177
175
  }
178
176
  }
179
- this.computeFaceNormals();
180
- if (geometry.boundingBox !== null) {
181
- this.boundingBox = geometry.boundingBox.clone();
182
- }
183
- if (geometry.boundingSphere !== null) {
184
- this.boundingSphere = geometry.boundingSphere.clone();
185
- }
186
- return this;
187
177
  }
188
- center() {
189
- this.computeBoundingBox();
190
- this.boundingBox.getCenter(_offset).negate();
191
- this.translate(_offset.x, _offset.y, _offset.z);
192
- return this;
178
+ this.computeFaceNormals();
179
+ if (geometry.boundingBox !== null) {
180
+ this.boundingBox = geometry.boundingBox.clone();
193
181
  }
194
- normalize() {
195
- this.computeBoundingSphere();
196
- const center = this.boundingSphere.center;
197
- const radius = this.boundingSphere.radius;
198
- const s = radius === 0 ? 1 : 1 / radius;
199
- const matrix = new Matrix4();
200
- matrix.set(s, 0, 0, -s * center.x, 0, s, 0, -s * center.y, 0, 0, s, -s * center.z, 0, 0, 0, 1);
201
- this.applyMatrix4(matrix);
202
- return this;
182
+ if (geometry.boundingSphere !== null) {
183
+ this.boundingSphere = geometry.boundingSphere.clone();
203
184
  }
204
- computeFaceNormals() {
185
+ return this;
186
+ }
187
+ center() {
188
+ this.computeBoundingBox();
189
+ this.boundingBox.getCenter(_offset).negate();
190
+ this.translate(_offset.x, _offset.y, _offset.z);
191
+ return this;
192
+ }
193
+ normalize() {
194
+ this.computeBoundingSphere();
195
+ const center = this.boundingSphere.center;
196
+ const radius = this.boundingSphere.radius;
197
+ const s = radius === 0 ? 1 : 1 / radius;
198
+ const matrix = new Matrix4();
199
+ matrix.set(s, 0, 0, -s * center.x, 0, s, 0, -s * center.y, 0, 0, s, -s * center.z, 0, 0, 0, 1);
200
+ this.applyMatrix4(matrix);
201
+ return this;
202
+ }
203
+ computeFaceNormals() {
204
+ const cb = new Vector3(), ab = new Vector3();
205
+ for (let f = 0, fl = this.faces.length; f < fl; f++) {
206
+ const face = this.faces[f];
207
+ const vA = this.vertices[face.a];
208
+ const vB = this.vertices[face.b];
209
+ const vC = this.vertices[face.c];
210
+ cb.subVectors(vC, vB);
211
+ ab.subVectors(vA, vB);
212
+ cb.cross(ab);
213
+ cb.normalize();
214
+ face.normal.copy(cb);
215
+ }
216
+ }
217
+ computeVertexNormals(areaWeighted = true) {
218
+ const vertices = new Array(this.vertices.length);
219
+ for (let v = 0, vl = this.vertices.length; v < vl; v++) {
220
+ vertices[v] = new Vector3();
221
+ }
222
+ if (areaWeighted) {
205
223
  const cb = new Vector3(), ab = new Vector3();
206
224
  for (let f = 0, fl = this.faces.length; f < fl; f++) {
207
225
  const face = this.faces[f];
@@ -211,589 +229,564 @@ const Geometry = /* @__PURE__ */ (() => {
211
229
  cb.subVectors(vC, vB);
212
230
  ab.subVectors(vA, vB);
213
231
  cb.cross(ab);
214
- cb.normalize();
215
- face.normal.copy(cb);
216
- }
217
- }
218
- computeVertexNormals(areaWeighted = true) {
219
- const vertices = new Array(this.vertices.length);
220
- for (let v = 0, vl = this.vertices.length; v < vl; v++) {
221
- vertices[v] = new Vector3();
222
- }
223
- if (areaWeighted) {
224
- const cb = new Vector3(), ab = new Vector3();
225
- for (let f = 0, fl = this.faces.length; f < fl; f++) {
226
- const face = this.faces[f];
227
- const vA = this.vertices[face.a];
228
- const vB = this.vertices[face.b];
229
- const vC = this.vertices[face.c];
230
- cb.subVectors(vC, vB);
231
- ab.subVectors(vA, vB);
232
- cb.cross(ab);
233
- vertices[face.a].add(cb);
234
- vertices[face.b].add(cb);
235
- vertices[face.c].add(cb);
236
- }
237
- } else {
238
- this.computeFaceNormals();
239
- for (let f = 0, fl = this.faces.length; f < fl; f++) {
240
- const face = this.faces[f];
241
- vertices[face.a].add(face.normal);
242
- vertices[face.b].add(face.normal);
243
- vertices[face.c].add(face.normal);
244
- }
245
- }
246
- for (let v = 0, vl = this.vertices.length; v < vl; v++) {
247
- vertices[v].normalize();
232
+ vertices[face.a].add(cb);
233
+ vertices[face.b].add(cb);
234
+ vertices[face.c].add(cb);
248
235
  }
236
+ } else {
237
+ this.computeFaceNormals();
249
238
  for (let f = 0, fl = this.faces.length; f < fl; f++) {
250
239
  const face = this.faces[f];
251
- const vertexNormals = face.vertexNormals;
252
- if (vertexNormals.length === 3) {
253
- vertexNormals[0].copy(vertices[face.a]);
254
- vertexNormals[1].copy(vertices[face.b]);
255
- vertexNormals[2].copy(vertices[face.c]);
256
- } else {
257
- vertexNormals[0] = vertices[face.a].clone();
258
- vertexNormals[1] = vertices[face.b].clone();
259
- vertexNormals[2] = vertices[face.c].clone();
260
- }
261
- }
262
- if (this.faces.length > 0) {
263
- this.normalsNeedUpdate = true;
240
+ vertices[face.a].add(face.normal);
241
+ vertices[face.b].add(face.normal);
242
+ vertices[face.c].add(face.normal);
264
243
  }
265
244
  }
266
- computeFlatVertexNormals() {
267
- this.computeFaceNormals();
268
- for (let f = 0, fl = this.faces.length; f < fl; f++) {
269
- const face = this.faces[f];
270
- const vertexNormals = face.vertexNormals;
271
- if (vertexNormals.length === 3) {
272
- vertexNormals[0].copy(face.normal);
273
- vertexNormals[1].copy(face.normal);
274
- vertexNormals[2].copy(face.normal);
275
- } else {
276
- vertexNormals[0] = face.normal.clone();
277
- vertexNormals[1] = face.normal.clone();
278
- vertexNormals[2] = face.normal.clone();
279
- }
245
+ for (let v = 0, vl = this.vertices.length; v < vl; v++) {
246
+ vertices[v].normalize();
247
+ }
248
+ for (let f = 0, fl = this.faces.length; f < fl; f++) {
249
+ const face = this.faces[f];
250
+ const vertexNormals = face.vertexNormals;
251
+ if (vertexNormals.length === 3) {
252
+ vertexNormals[0].copy(vertices[face.a]);
253
+ vertexNormals[1].copy(vertices[face.b]);
254
+ vertexNormals[2].copy(vertices[face.c]);
255
+ } else {
256
+ vertexNormals[0] = vertices[face.a].clone();
257
+ vertexNormals[1] = vertices[face.b].clone();
258
+ vertexNormals[2] = vertices[face.c].clone();
280
259
  }
281
- if (this.faces.length > 0) {
282
- this.normalsNeedUpdate = true;
260
+ }
261
+ if (this.faces.length > 0) {
262
+ this.normalsNeedUpdate = true;
263
+ }
264
+ }
265
+ computeFlatVertexNormals() {
266
+ this.computeFaceNormals();
267
+ for (let f = 0, fl = this.faces.length; f < fl; f++) {
268
+ const face = this.faces[f];
269
+ const vertexNormals = face.vertexNormals;
270
+ if (vertexNormals.length === 3) {
271
+ vertexNormals[0].copy(face.normal);
272
+ vertexNormals[1].copy(face.normal);
273
+ vertexNormals[2].copy(face.normal);
274
+ } else {
275
+ vertexNormals[0] = face.normal.clone();
276
+ vertexNormals[1] = face.normal.clone();
277
+ vertexNormals[2] = face.normal.clone();
283
278
  }
284
279
  }
285
- computeMorphNormals() {
286
- for (let f = 0, fl = this.faces.length; f < fl; f++) {
287
- const face = this.faces[f];
288
- if (!face.__originalFaceNormal) {
289
- face.__originalFaceNormal = face.normal.clone();
280
+ if (this.faces.length > 0) {
281
+ this.normalsNeedUpdate = true;
282
+ }
283
+ }
284
+ computeMorphNormals() {
285
+ for (let f = 0, fl = this.faces.length; f < fl; f++) {
286
+ const face = this.faces[f];
287
+ if (!face.__originalFaceNormal) {
288
+ face.__originalFaceNormal = face.normal.clone();
289
+ } else {
290
+ face.__originalFaceNormal.copy(face.normal);
291
+ }
292
+ if (!face.__originalVertexNormals)
293
+ face.__originalVertexNormals = [];
294
+ for (let i = 0, il = face.vertexNormals.length; i < il; i++) {
295
+ if (!face.__originalVertexNormals[i]) {
296
+ face.__originalVertexNormals[i] = face.vertexNormals[i].clone();
290
297
  } else {
291
- face.__originalFaceNormal.copy(face.normal);
292
- }
293
- if (!face.__originalVertexNormals)
294
- face.__originalVertexNormals = [];
295
- for (let i = 0, il = face.vertexNormals.length; i < il; i++) {
296
- if (!face.__originalVertexNormals[i]) {
297
- face.__originalVertexNormals[i] = face.vertexNormals[i].clone();
298
- } else {
299
- face.__originalVertexNormals[i].copy(face.vertexNormals[i]);
300
- }
298
+ face.__originalVertexNormals[i].copy(face.vertexNormals[i]);
301
299
  }
302
300
  }
303
- const tmpGeo = new Geometry2();
304
- tmpGeo.faces = this.faces;
305
- for (let i = 0, il = this.morphTargets.length; i < il; i++) {
306
- if (!this.morphNormals[i]) {
307
- this.morphNormals[i] = {};
308
- this.morphNormals[i].faceNormals = [];
309
- this.morphNormals[i].vertexNormals = [];
310
- const dstNormalsFace = this.morphNormals[i].faceNormals;
311
- const dstNormalsVertex = this.morphNormals[i].vertexNormals;
312
- for (let f = 0, fl = this.faces.length; f < fl; f++) {
313
- const faceNormal = new Vector3();
314
- const vertexNormals = {
315
- a: new Vector3(),
316
- b: new Vector3(),
317
- c: new Vector3()
318
- };
319
- dstNormalsFace.push(faceNormal);
320
- dstNormalsVertex.push(vertexNormals);
321
- }
322
- }
323
- const morphNormals = this.morphNormals[i];
324
- tmpGeo.vertices = this.morphTargets[i].vertices;
325
- tmpGeo.computeFaceNormals();
326
- tmpGeo.computeVertexNormals();
301
+ }
302
+ const tmpGeo = new Geometry();
303
+ tmpGeo.faces = this.faces;
304
+ for (let i = 0, il = this.morphTargets.length; i < il; i++) {
305
+ if (!this.morphNormals[i]) {
306
+ this.morphNormals[i] = {};
307
+ this.morphNormals[i].faceNormals = [];
308
+ this.morphNormals[i].vertexNormals = [];
309
+ const dstNormalsFace = this.morphNormals[i].faceNormals;
310
+ const dstNormalsVertex = this.morphNormals[i].vertexNormals;
327
311
  for (let f = 0, fl = this.faces.length; f < fl; f++) {
328
- const face = this.faces[f];
329
- const faceNormal = morphNormals.faceNormals[f];
330
- const vertexNormals = morphNormals.vertexNormals[f];
331
- faceNormal.copy(face.normal);
332
- vertexNormals.a.copy(face.vertexNormals[0]);
333
- vertexNormals.b.copy(face.vertexNormals[1]);
334
- vertexNormals.c.copy(face.vertexNormals[2]);
335
- }
336
- }
312
+ const faceNormal = new Vector3();
313
+ const vertexNormals = {
314
+ a: new Vector3(),
315
+ b: new Vector3(),
316
+ c: new Vector3()
317
+ };
318
+ dstNormalsFace.push(faceNormal);
319
+ dstNormalsVertex.push(vertexNormals);
320
+ }
321
+ }
322
+ const morphNormals = this.morphNormals[i];
323
+ tmpGeo.vertices = this.morphTargets[i].vertices;
324
+ tmpGeo.computeFaceNormals();
325
+ tmpGeo.computeVertexNormals();
337
326
  for (let f = 0, fl = this.faces.length; f < fl; f++) {
338
327
  const face = this.faces[f];
339
- face.normal = face.__originalFaceNormal;
340
- face.vertexNormals = face.__originalVertexNormals;
328
+ const faceNormal = morphNormals.faceNormals[f];
329
+ const vertexNormals = morphNormals.vertexNormals[f];
330
+ faceNormal.copy(face.normal);
331
+ vertexNormals.a.copy(face.vertexNormals[0]);
332
+ vertexNormals.b.copy(face.vertexNormals[1]);
333
+ vertexNormals.c.copy(face.vertexNormals[2]);
341
334
  }
342
335
  }
343
- computeBoundingBox() {
344
- if (this.boundingBox === null) {
345
- this.boundingBox = new Box3();
346
- }
347
- this.boundingBox.setFromPoints(this.vertices);
336
+ for (let f = 0, fl = this.faces.length; f < fl; f++) {
337
+ const face = this.faces[f];
338
+ face.normal = face.__originalFaceNormal;
339
+ face.vertexNormals = face.__originalVertexNormals;
348
340
  }
349
- computeBoundingSphere() {
350
- if (this.boundingSphere === null) {
351
- this.boundingSphere = new Sphere();
352
- }
353
- this.boundingSphere.setFromPoints(this.vertices);
341
+ }
342
+ computeBoundingBox() {
343
+ if (this.boundingBox === null) {
344
+ this.boundingBox = new Box3();
354
345
  }
355
- merge(geometry, matrix, materialIndexOffset = 0) {
356
- if (!(geometry && geometry.isGeometry)) {
357
- console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.", geometry);
358
- return;
359
- }
360
- let normalMatrix;
361
- const vertexOffset = this.vertices.length, vertices1 = this.vertices, vertices2 = geometry.vertices, faces1 = this.faces, faces2 = geometry.faces, colors1 = this.colors, colors2 = geometry.colors;
362
- if (matrix !== void 0) {
363
- normalMatrix = new Matrix3().getNormalMatrix(matrix);
364
- }
365
- for (let i = 0, il = vertices2.length; i < il; i++) {
366
- const vertex = vertices2[i];
367
- const vertexCopy = vertex.clone();
368
- if (matrix !== void 0)
369
- vertexCopy.applyMatrix4(matrix);
370
- vertices1.push(vertexCopy);
371
- }
372
- for (let i = 0, il = colors2.length; i < il; i++) {
373
- colors1.push(colors2[i].clone());
374
- }
375
- for (let i = 0, il = faces2.length; i < il; i++) {
376
- const face = faces2[i];
377
- let normal, color;
378
- const faceVertexNormals = face.vertexNormals, faceVertexColors = face.vertexColors;
379
- const faceCopy = new Face3(face.a + vertexOffset, face.b + vertexOffset, face.c + vertexOffset);
380
- faceCopy.normal.copy(face.normal);
346
+ this.boundingBox.setFromPoints(this.vertices);
347
+ }
348
+ computeBoundingSphere() {
349
+ if (this.boundingSphere === null) {
350
+ this.boundingSphere = new Sphere();
351
+ }
352
+ this.boundingSphere.setFromPoints(this.vertices);
353
+ }
354
+ merge(geometry, matrix, materialIndexOffset = 0) {
355
+ if (!(geometry && geometry.isGeometry)) {
356
+ console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.", geometry);
357
+ return;
358
+ }
359
+ let normalMatrix;
360
+ const vertexOffset = this.vertices.length, vertices1 = this.vertices, vertices2 = geometry.vertices, faces1 = this.faces, faces2 = geometry.faces, colors1 = this.colors, colors2 = geometry.colors;
361
+ if (matrix !== void 0) {
362
+ normalMatrix = new Matrix3().getNormalMatrix(matrix);
363
+ }
364
+ for (let i = 0, il = vertices2.length; i < il; i++) {
365
+ const vertex = vertices2[i];
366
+ const vertexCopy = vertex.clone();
367
+ if (matrix !== void 0)
368
+ vertexCopy.applyMatrix4(matrix);
369
+ vertices1.push(vertexCopy);
370
+ }
371
+ for (let i = 0, il = colors2.length; i < il; i++) {
372
+ colors1.push(colors2[i].clone());
373
+ }
374
+ for (let i = 0, il = faces2.length; i < il; i++) {
375
+ const face = faces2[i];
376
+ let normal, color;
377
+ const faceVertexNormals = face.vertexNormals, faceVertexColors = face.vertexColors;
378
+ const faceCopy = new Face3(face.a + vertexOffset, face.b + vertexOffset, face.c + vertexOffset);
379
+ faceCopy.normal.copy(face.normal);
380
+ if (normalMatrix !== void 0) {
381
+ faceCopy.normal.applyMatrix3(normalMatrix).normalize();
382
+ }
383
+ for (let j = 0, jl = faceVertexNormals.length; j < jl; j++) {
384
+ normal = faceVertexNormals[j].clone();
381
385
  if (normalMatrix !== void 0) {
382
- faceCopy.normal.applyMatrix3(normalMatrix).normalize();
383
- }
384
- for (let j = 0, jl = faceVertexNormals.length; j < jl; j++) {
385
- normal = faceVertexNormals[j].clone();
386
- if (normalMatrix !== void 0) {
387
- normal.applyMatrix3(normalMatrix).normalize();
388
- }
389
- faceCopy.vertexNormals.push(normal);
390
- }
391
- faceCopy.color.copy(face.color);
392
- for (let j = 0, jl = faceVertexColors.length; j < jl; j++) {
393
- color = faceVertexColors[j];
394
- faceCopy.vertexColors.push(color.clone());
395
- }
396
- faceCopy.materialIndex = face.materialIndex + materialIndexOffset;
397
- faces1.push(faceCopy);
398
- }
399
- for (let i = 0, il = geometry.faceVertexUvs.length; i < il; i++) {
400
- const faceVertexUvs2 = geometry.faceVertexUvs[i];
401
- if (this.faceVertexUvs[i] === void 0)
402
- this.faceVertexUvs[i] = [];
403
- for (let j = 0, jl = faceVertexUvs2.length; j < jl; j++) {
404
- const uvs2 = faceVertexUvs2[j], uvsCopy = [];
405
- for (let k = 0, kl = uvs2.length; k < kl; k++) {
406
- uvsCopy.push(uvs2[k].clone());
407
- }
408
- this.faceVertexUvs[i].push(uvsCopy);
386
+ normal.applyMatrix3(normalMatrix).normalize();
409
387
  }
388
+ faceCopy.vertexNormals.push(normal);
389
+ }
390
+ faceCopy.color.copy(face.color);
391
+ for (let j = 0, jl = faceVertexColors.length; j < jl; j++) {
392
+ color = faceVertexColors[j];
393
+ faceCopy.vertexColors.push(color.clone());
410
394
  }
395
+ faceCopy.materialIndex = face.materialIndex + materialIndexOffset;
396
+ faces1.push(faceCopy);
411
397
  }
412
- mergeMesh(mesh) {
413
- if (!(mesh && mesh.isMesh)) {
414
- console.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.", mesh);
415
- return;
416
- }
417
- if (mesh.matrixAutoUpdate)
418
- mesh.updateMatrix();
419
- this.merge(mesh.geometry, mesh.matrix);
420
- }
421
- /*
422
- * Checks for duplicate vertices with hashmap.
423
- * Duplicated vertices are removed
424
- * and faces' vertices are updated.
425
- */
426
- mergeVertices(precisionPoints = 4) {
427
- const verticesMap = {};
428
- const unique = [], changes = [];
429
- const precision = Math.pow(10, precisionPoints);
430
- for (let i = 0, il = this.vertices.length; i < il; i++) {
431
- const v = this.vertices[i];
432
- const key = `${Math.round(v.x * precision)}_${Math.round(v.y * precision)}_${Math.round(v.z * precision)}`;
433
- if (verticesMap[key] === void 0) {
434
- verticesMap[key] = i;
435
- unique.push(this.vertices[i]);
436
- changes[i] = unique.length - 1;
437
- } else {
438
- changes[i] = changes[verticesMap[key]];
398
+ for (let i = 0, il = geometry.faceVertexUvs.length; i < il; i++) {
399
+ const faceVertexUvs2 = geometry.faceVertexUvs[i];
400
+ if (this.faceVertexUvs[i] === void 0)
401
+ this.faceVertexUvs[i] = [];
402
+ for (let j = 0, jl = faceVertexUvs2.length; j < jl; j++) {
403
+ const uvs2 = faceVertexUvs2[j], uvsCopy = [];
404
+ for (let k = 0, kl = uvs2.length; k < kl; k++) {
405
+ uvsCopy.push(uvs2[k].clone());
439
406
  }
407
+ this.faceVertexUvs[i].push(uvsCopy);
440
408
  }
441
- const faceIndicesToRemove = [];
442
- for (let i = 0, il = this.faces.length; i < il; i++) {
443
- const face = this.faces[i];
444
- face.a = changes[face.a];
445
- face.b = changes[face.b];
446
- face.c = changes[face.c];
447
- const indices = [face.a, face.b, face.c];
448
- for (let n = 0; n < 3; n++) {
449
- if (indices[n] === indices[(n + 1) % 3]) {
450
- faceIndicesToRemove.push(i);
451
- break;
452
- }
453
- }
409
+ }
410
+ }
411
+ mergeMesh(mesh) {
412
+ if (!(mesh && mesh.isMesh)) {
413
+ console.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.", mesh);
414
+ return;
415
+ }
416
+ if (mesh.matrixAutoUpdate)
417
+ mesh.updateMatrix();
418
+ this.merge(mesh.geometry, mesh.matrix);
419
+ }
420
+ /*
421
+ * Checks for duplicate vertices with hashmap.
422
+ * Duplicated vertices are removed
423
+ * and faces' vertices are updated.
424
+ */
425
+ mergeVertices(precisionPoints = 4) {
426
+ const verticesMap = {};
427
+ const unique = [], changes = [];
428
+ const precision = Math.pow(10, precisionPoints);
429
+ for (let i = 0, il = this.vertices.length; i < il; i++) {
430
+ const v = this.vertices[i];
431
+ const key = `${Math.round(v.x * precision)}_${Math.round(v.y * precision)}_${Math.round(v.z * precision)}`;
432
+ if (verticesMap[key] === void 0) {
433
+ verticesMap[key] = i;
434
+ unique.push(this.vertices[i]);
435
+ changes[i] = unique.length - 1;
436
+ } else {
437
+ changes[i] = changes[verticesMap[key]];
454
438
  }
455
- for (let i = faceIndicesToRemove.length - 1; i >= 0; i--) {
456
- const idx = faceIndicesToRemove[i];
457
- this.faces.splice(idx, 1);
458
- for (let j = 0, jl = this.faceVertexUvs.length; j < jl; j++) {
459
- this.faceVertexUvs[j].splice(idx, 1);
439
+ }
440
+ const faceIndicesToRemove = [];
441
+ for (let i = 0, il = this.faces.length; i < il; i++) {
442
+ const face = this.faces[i];
443
+ face.a = changes[face.a];
444
+ face.b = changes[face.b];
445
+ face.c = changes[face.c];
446
+ const indices = [face.a, face.b, face.c];
447
+ for (let n = 0; n < 3; n++) {
448
+ if (indices[n] === indices[(n + 1) % 3]) {
449
+ faceIndicesToRemove.push(i);
450
+ break;
460
451
  }
461
452
  }
462
- const diff = this.vertices.length - unique.length;
463
- this.vertices = unique;
464
- return diff;
465
453
  }
466
- setFromPoints(points) {
467
- this.vertices = [];
468
- for (let i = 0, l = points.length; i < l; i++) {
469
- const point = points[i];
470
- this.vertices.push(new Vector3(point.x, point.y, point.z || 0));
454
+ for (let i = faceIndicesToRemove.length - 1; i >= 0; i--) {
455
+ const idx = faceIndicesToRemove[i];
456
+ this.faces.splice(idx, 1);
457
+ for (let j = 0, jl = this.faceVertexUvs.length; j < jl; j++) {
458
+ this.faceVertexUvs[j].splice(idx, 1);
471
459
  }
472
- return this;
473
460
  }
474
- sortFacesByMaterialIndex() {
475
- const faces = this.faces;
476
- const length = faces.length;
477
- for (let i = 0; i < length; i++) {
478
- faces[i]._id = i;
479
- }
480
- function materialIndexSort(a, b) {
481
- return a.materialIndex - b.materialIndex;
482
- }
483
- faces.sort(materialIndexSort);
484
- const uvs1 = this.faceVertexUvs[0];
485
- const uvs2 = this.faceVertexUvs[1];
486
- let newUvs1, newUvs2;
487
- if (uvs1 && uvs1.length === length)
488
- newUvs1 = [];
489
- if (uvs2 && uvs2.length === length)
490
- newUvs2 = [];
491
- for (let i = 0; i < length; i++) {
492
- const id = faces[i]._id;
493
- if (newUvs1)
494
- newUvs1.push(uvs1[id]);
495
- if (newUvs2)
496
- newUvs2.push(uvs2[id]);
497
- }
461
+ const diff = this.vertices.length - unique.length;
462
+ this.vertices = unique;
463
+ return diff;
464
+ }
465
+ setFromPoints(points) {
466
+ this.vertices = [];
467
+ for (let i = 0, l = points.length; i < l; i++) {
468
+ const point = points[i];
469
+ this.vertices.push(new Vector3(point.x, point.y, point.z || 0));
470
+ }
471
+ return this;
472
+ }
473
+ sortFacesByMaterialIndex() {
474
+ const faces = this.faces;
475
+ const length = faces.length;
476
+ for (let i = 0; i < length; i++) {
477
+ faces[i]._id = i;
478
+ }
479
+ function materialIndexSort(a, b) {
480
+ return a.materialIndex - b.materialIndex;
481
+ }
482
+ faces.sort(materialIndexSort);
483
+ const uvs1 = this.faceVertexUvs[0];
484
+ const uvs2 = this.faceVertexUvs[1];
485
+ let newUvs1, newUvs2;
486
+ if (uvs1 && uvs1.length === length)
487
+ newUvs1 = [];
488
+ if (uvs2 && uvs2.length === length)
489
+ newUvs2 = [];
490
+ for (let i = 0; i < length; i++) {
491
+ const id = faces[i]._id;
498
492
  if (newUvs1)
499
- this.faceVertexUvs[0] = newUvs1;
493
+ newUvs1.push(uvs1[id]);
500
494
  if (newUvs2)
501
- this.faceVertexUvs[1] = newUvs2;
502
- }
503
- toJSON() {
504
- const data = {
505
- metadata: {
506
- version: 4.5,
507
- type: "Geometry",
508
- generator: "Geometry.toJSON"
509
- }
510
- };
511
- data.uuid = this.uuid;
512
- data.type = this.type;
513
- if (this.name !== "")
514
- data.name = this.name;
515
- if (this.parameters !== void 0) {
516
- const parameters = this.parameters;
517
- for (let key in parameters) {
518
- if (parameters[key] !== void 0)
519
- data[key] = parameters[key];
520
- }
521
- return data;
522
- }
523
- const vertices = [];
524
- for (let i = 0; i < this.vertices.length; i++) {
525
- const vertex = this.vertices[i];
526
- vertices.push(vertex.x, vertex.y, vertex.z);
527
- }
528
- const faces = [];
529
- const normals = [];
530
- const normalsHash = {};
531
- const colors = [];
532
- const colorsHash = {};
533
- const uvs = [];
534
- const uvsHash = {};
535
- for (let i = 0; i < this.faces.length; i++) {
536
- const face = this.faces[i];
537
- const hasMaterial = true;
538
- const hasFaceUv = false;
539
- const hasFaceVertexUv = this.faceVertexUvs[0][i] !== void 0;
540
- const hasFaceNormal = face.normal.length() > 0;
541
- const hasFaceVertexNormal = face.vertexNormals.length > 0;
542
- const hasFaceColor = face.color.r !== 1 || face.color.g !== 1 || face.color.b !== 1;
543
- const hasFaceVertexColor = face.vertexColors.length > 0;
544
- let faceType = 0;
545
- faceType = setBit(faceType, 0, 0);
546
- faceType = setBit(faceType, 1, hasMaterial);
547
- faceType = setBit(faceType, 2, hasFaceUv);
548
- faceType = setBit(faceType, 3, hasFaceVertexUv);
549
- faceType = setBit(faceType, 4, hasFaceNormal);
550
- faceType = setBit(faceType, 5, hasFaceVertexNormal);
551
- faceType = setBit(faceType, 6, hasFaceColor);
552
- faceType = setBit(faceType, 7, hasFaceVertexColor);
553
- faces.push(faceType);
554
- faces.push(face.a, face.b, face.c);
555
- faces.push(face.materialIndex);
556
- if (hasFaceVertexUv) {
557
- const faceVertexUvs = this.faceVertexUvs[0][i];
558
- faces.push(getUvIndex(faceVertexUvs[0]), getUvIndex(faceVertexUvs[1]), getUvIndex(faceVertexUvs[2]));
559
- }
560
- if (hasFaceNormal) {
561
- faces.push(getNormalIndex(face.normal));
562
- }
563
- if (hasFaceVertexNormal) {
564
- const vertexNormals = face.vertexNormals;
565
- faces.push(
566
- getNormalIndex(vertexNormals[0]),
567
- getNormalIndex(vertexNormals[1]),
568
- getNormalIndex(vertexNormals[2])
569
- );
570
- }
571
- if (hasFaceColor) {
572
- faces.push(getColorIndex(face.color));
573
- }
574
- if (hasFaceVertexColor) {
575
- const vertexColors = face.vertexColors;
576
- faces.push(getColorIndex(vertexColors[0]), getColorIndex(vertexColors[1]), getColorIndex(vertexColors[2]));
577
- }
578
- }
579
- function setBit(value, position, enabled) {
580
- return enabled ? value | 1 << position : value & ~(1 << position);
581
- }
582
- function getNormalIndex(normal) {
583
- const hash = normal.x.toString() + normal.y.toString() + normal.z.toString();
584
- if (normalsHash[hash] !== void 0) {
585
- return normalsHash[hash];
586
- }
587
- normalsHash[hash] = normals.length / 3;
588
- normals.push(normal.x, normal.y, normal.z);
589
- return normalsHash[hash];
590
- }
591
- function getColorIndex(color) {
592
- const hash = color.r.toString() + color.g.toString() + color.b.toString();
593
- if (colorsHash[hash] !== void 0) {
594
- return colorsHash[hash];
595
- }
596
- colorsHash[hash] = colors.length;
597
- colors.push(color.getHex());
598
- return colorsHash[hash];
599
- }
600
- function getUvIndex(uv) {
601
- const hash = uv.x.toString() + uv.y.toString();
602
- if (uvsHash[hash] !== void 0) {
603
- return uvsHash[hash];
604
- }
605
- uvsHash[hash] = uvs.length / 2;
606
- uvs.push(uv.x, uv.y);
607
- return uvsHash[hash];
608
- }
609
- data.data = {};
610
- data.data.vertices = vertices;
611
- data.data.normals = normals;
612
- if (colors.length > 0)
613
- data.data.colors = colors;
614
- if (uvs.length > 0)
615
- data.data.uvs = [uvs];
616
- data.data.faces = faces;
617
- return data;
495
+ newUvs2.push(uvs2[id]);
618
496
  }
619
- clone() {
620
- return new Geometry2().copy(this);
621
- }
622
- copy(source) {
623
- this.vertices = [];
624
- this.colors = [];
625
- this.faces = [];
626
- this.faceVertexUvs = [[]];
627
- this.morphTargets = [];
628
- this.morphNormals = [];
629
- this.skinWeights = [];
630
- this.skinIndices = [];
631
- this.lineDistances = [];
632
- this.boundingBox = null;
633
- this.boundingSphere = null;
634
- this.name = source.name;
635
- const vertices = source.vertices;
636
- for (let i = 0, il = vertices.length; i < il; i++) {
637
- this.vertices.push(vertices[i].clone());
638
- }
639
- const colors = source.colors;
640
- for (let i = 0, il = colors.length; i < il; i++) {
641
- this.colors.push(colors[i].clone());
642
- }
643
- const faces = source.faces;
644
- for (let i = 0, il = faces.length; i < il; i++) {
645
- this.faces.push(faces[i].clone());
646
- }
647
- for (let i = 0, il = source.faceVertexUvs.length; i < il; i++) {
648
- const faceVertexUvs = source.faceVertexUvs[i];
649
- if (this.faceVertexUvs[i] === void 0) {
650
- this.faceVertexUvs[i] = [];
651
- }
652
- for (let j = 0, jl = faceVertexUvs.length; j < jl; j++) {
653
- const uvs = faceVertexUvs[j], uvsCopy = [];
654
- for (let k = 0, kl = uvs.length; k < kl; k++) {
655
- const uv = uvs[k];
656
- uvsCopy.push(uv.clone());
657
- }
658
- this.faceVertexUvs[i].push(uvsCopy);
659
- }
497
+ if (newUvs1)
498
+ this.faceVertexUvs[0] = newUvs1;
499
+ if (newUvs2)
500
+ this.faceVertexUvs[1] = newUvs2;
501
+ }
502
+ toJSON() {
503
+ const data = {
504
+ metadata: {
505
+ version: 4.5,
506
+ type: "Geometry",
507
+ generator: "Geometry.toJSON"
508
+ }
509
+ };
510
+ data.uuid = this.uuid;
511
+ data.type = this.type;
512
+ if (this.name !== "")
513
+ data.name = this.name;
514
+ if (this.parameters !== void 0) {
515
+ const parameters = this.parameters;
516
+ for (let key in parameters) {
517
+ if (parameters[key] !== void 0)
518
+ data[key] = parameters[key];
660
519
  }
661
- const morphTargets = source.morphTargets;
662
- for (let i = 0, il = morphTargets.length; i < il; i++) {
663
- const morphTarget = {};
664
- morphTarget.name = morphTargets[i].name;
665
- if (morphTargets[i].vertices !== void 0) {
666
- morphTarget.vertices = [];
667
- for (let j = 0, jl = morphTargets[i].vertices.length; j < jl; j++) {
668
- morphTarget.vertices.push(morphTargets[i].vertices[j].clone());
669
- }
670
- }
671
- if (morphTargets[i].normals !== void 0) {
672
- morphTarget.normals = [];
673
- for (let j = 0, jl = morphTargets[i].normals.length; j < jl; j++) {
674
- morphTarget.normals.push(morphTargets[i].normals[j].clone());
675
- }
676
- }
677
- this.morphTargets.push(morphTarget);
678
- }
679
- const morphNormals = source.morphNormals;
680
- for (let i = 0, il = morphNormals.length; i < il; i++) {
681
- const morphNormal = {};
682
- if (morphNormals[i].vertexNormals !== void 0) {
683
- morphNormal.vertexNormals = [];
684
- for (let j = 0, jl = morphNormals[i].vertexNormals.length; j < jl; j++) {
685
- const srcVertexNormal = morphNormals[i].vertexNormals[j];
686
- const destVertexNormal = {};
687
- destVertexNormal.a = srcVertexNormal.a.clone();
688
- destVertexNormal.b = srcVertexNormal.b.clone();
689
- destVertexNormal.c = srcVertexNormal.c.clone();
690
- morphNormal.vertexNormals.push(destVertexNormal);
691
- }
692
- }
693
- if (morphNormals[i].faceNormals !== void 0) {
694
- morphNormal.faceNormals = [];
695
- for (let j = 0, jl = morphNormals[i].faceNormals.length; j < jl; j++) {
696
- morphNormal.faceNormals.push(morphNormals[i].faceNormals[j].clone());
697
- }
698
- }
699
- this.morphNormals.push(morphNormal);
700
- }
701
- const skinWeights = source.skinWeights;
702
- for (let i = 0, il = skinWeights.length; i < il; i++) {
703
- this.skinWeights.push(skinWeights[i].clone());
704
- }
705
- const skinIndices = source.skinIndices;
706
- for (let i = 0, il = skinIndices.length; i < il; i++) {
707
- this.skinIndices.push(skinIndices[i].clone());
708
- }
709
- const lineDistances = source.lineDistances;
710
- for (let i = 0, il = lineDistances.length; i < il; i++) {
711
- this.lineDistances.push(lineDistances[i]);
712
- }
713
- const boundingBox = source.boundingBox;
714
- if (boundingBox !== null) {
715
- this.boundingBox = boundingBox.clone();
716
- }
717
- const boundingSphere = source.boundingSphere;
718
- if (boundingSphere !== null) {
719
- this.boundingSphere = boundingSphere.clone();
720
- }
721
- this.elementsNeedUpdate = source.elementsNeedUpdate;
722
- this.verticesNeedUpdate = source.verticesNeedUpdate;
723
- this.uvsNeedUpdate = source.uvsNeedUpdate;
724
- this.normalsNeedUpdate = source.normalsNeedUpdate;
725
- this.colorsNeedUpdate = source.colorsNeedUpdate;
726
- this.lineDistancesNeedUpdate = source.lineDistancesNeedUpdate;
727
- this.groupsNeedUpdate = source.groupsNeedUpdate;
728
- return this;
520
+ return data;
729
521
  }
730
- toBufferGeometry() {
731
- const geometry = new DirectGeometry().fromGeometry(this);
732
- const buffergeometry = new BufferGeometry();
733
- const positions = new Float32Array(geometry.vertices.length * 3);
734
- buffergeometry.setAttribute("position", new BufferAttribute(positions, 3).copyVector3sArray(geometry.vertices));
735
- if (geometry.normals.length > 0) {
736
- const normals = new Float32Array(geometry.normals.length * 3);
737
- buffergeometry.setAttribute("normal", new BufferAttribute(normals, 3).copyVector3sArray(geometry.normals));
738
- }
739
- if (geometry.colors.length > 0) {
740
- const colors = new Float32Array(geometry.colors.length * 3);
741
- buffergeometry.setAttribute("color", new BufferAttribute(colors, 3).copyColorsArray(geometry.colors));
742
- }
743
- if (geometry.uvs.length > 0) {
744
- const uvs = new Float32Array(geometry.uvs.length * 2);
745
- buffergeometry.setAttribute("uv", new BufferAttribute(uvs, 2).copyVector2sArray(geometry.uvs));
746
- }
747
- if (geometry.uvs2.length > 0) {
748
- const uvs2 = new Float32Array(geometry.uvs2.length * 2);
749
- buffergeometry.setAttribute("uv2", new BufferAttribute(uvs2, 2).copyVector2sArray(geometry.uvs2));
750
- }
751
- buffergeometry.groups = geometry.groups;
752
- for (let name in geometry.morphTargets) {
753
- const array = [];
754
- const morphTargets = geometry.morphTargets[name];
755
- for (let i = 0, l = morphTargets.length; i < l; i++) {
756
- const morphTarget = morphTargets[i];
757
- const attribute = new Float32BufferAttribute(morphTarget.data.length * 3, 3);
758
- attribute.name = morphTarget.name;
759
- array.push(attribute.copyVector3sArray(morphTarget.data));
760
- }
761
- buffergeometry.morphAttributes[name] = array;
522
+ const vertices = [];
523
+ for (let i = 0; i < this.vertices.length; i++) {
524
+ const vertex = this.vertices[i];
525
+ vertices.push(vertex.x, vertex.y, vertex.z);
526
+ }
527
+ const faces = [];
528
+ const normals = [];
529
+ const normalsHash = {};
530
+ const colors = [];
531
+ const colorsHash = {};
532
+ const uvs = [];
533
+ const uvsHash = {};
534
+ for (let i = 0; i < this.faces.length; i++) {
535
+ const face = this.faces[i];
536
+ const hasMaterial = true;
537
+ const hasFaceUv = false;
538
+ const hasFaceVertexUv = this.faceVertexUvs[0][i] !== void 0;
539
+ const hasFaceNormal = face.normal.length() > 0;
540
+ const hasFaceVertexNormal = face.vertexNormals.length > 0;
541
+ const hasFaceColor = face.color.r !== 1 || face.color.g !== 1 || face.color.b !== 1;
542
+ const hasFaceVertexColor = face.vertexColors.length > 0;
543
+ let faceType = 0;
544
+ faceType = setBit(faceType, 0, 0);
545
+ faceType = setBit(faceType, 1, hasMaterial);
546
+ faceType = setBit(faceType, 2, hasFaceUv);
547
+ faceType = setBit(faceType, 3, hasFaceVertexUv);
548
+ faceType = setBit(faceType, 4, hasFaceNormal);
549
+ faceType = setBit(faceType, 5, hasFaceVertexNormal);
550
+ faceType = setBit(faceType, 6, hasFaceColor);
551
+ faceType = setBit(faceType, 7, hasFaceVertexColor);
552
+ faces.push(faceType);
553
+ faces.push(face.a, face.b, face.c);
554
+ faces.push(face.materialIndex);
555
+ if (hasFaceVertexUv) {
556
+ const faceVertexUvs = this.faceVertexUvs[0][i];
557
+ faces.push(getUvIndex(faceVertexUvs[0]), getUvIndex(faceVertexUvs[1]), getUvIndex(faceVertexUvs[2]));
558
+ }
559
+ if (hasFaceNormal) {
560
+ faces.push(getNormalIndex(face.normal));
561
+ }
562
+ if (hasFaceVertexNormal) {
563
+ const vertexNormals = face.vertexNormals;
564
+ faces.push(getNormalIndex(vertexNormals[0]), getNormalIndex(vertexNormals[1]), getNormalIndex(vertexNormals[2]));
762
565
  }
763
- if (geometry.skinIndices.length > 0) {
764
- const skinIndices = new Float32BufferAttribute(geometry.skinIndices.length * 4, 4);
765
- buffergeometry.setAttribute("skinIndex", skinIndices.copyVector4sArray(geometry.skinIndices));
566
+ if (hasFaceColor) {
567
+ faces.push(getColorIndex(face.color));
766
568
  }
767
- if (geometry.skinWeights.length > 0) {
768
- const skinWeights = new Float32BufferAttribute(geometry.skinWeights.length * 4, 4);
769
- buffergeometry.setAttribute("skinWeight", skinWeights.copyVector4sArray(geometry.skinWeights));
569
+ if (hasFaceVertexColor) {
570
+ const vertexColors = face.vertexColors;
571
+ faces.push(getColorIndex(vertexColors[0]), getColorIndex(vertexColors[1]), getColorIndex(vertexColors[2]));
770
572
  }
771
- if (geometry.boundingSphere !== null) {
772
- buffergeometry.boundingSphere = geometry.boundingSphere.clone();
773
- }
774
- if (geometry.boundingBox !== null) {
775
- buffergeometry.boundingBox = geometry.boundingBox.clone();
573
+ }
574
+ function setBit(value, position, enabled) {
575
+ return enabled ? value | 1 << position : value & ~(1 << position);
576
+ }
577
+ function getNormalIndex(normal) {
578
+ const hash = normal.x.toString() + normal.y.toString() + normal.z.toString();
579
+ if (normalsHash[hash] !== void 0) {
580
+ return normalsHash[hash];
776
581
  }
777
- return buffergeometry;
582
+ normalsHash[hash] = normals.length / 3;
583
+ normals.push(normal.x, normal.y, normal.z);
584
+ return normalsHash[hash];
778
585
  }
779
- computeTangents() {
780
- console.error("THREE.Geometry: .computeTangents() has been removed.");
586
+ function getColorIndex(color) {
587
+ const hash = color.r.toString() + color.g.toString() + color.b.toString();
588
+ if (colorsHash[hash] !== void 0) {
589
+ return colorsHash[hash];
590
+ }
591
+ colorsHash[hash] = colors.length;
592
+ colors.push(color.getHex());
593
+ return colorsHash[hash];
781
594
  }
782
- computeLineDistances() {
783
- console.error(
784
- "THREE.Geometry: .computeLineDistances() has been removed. Use THREE.Line.computeLineDistances() instead."
785
- );
595
+ function getUvIndex(uv) {
596
+ const hash = uv.x.toString() + uv.y.toString();
597
+ if (uvsHash[hash] !== void 0) {
598
+ return uvsHash[hash];
599
+ }
600
+ uvsHash[hash] = uvs.length / 2;
601
+ uvs.push(uv.x, uv.y);
602
+ return uvsHash[hash];
603
+ }
604
+ data.data = {};
605
+ data.data.vertices = vertices;
606
+ data.data.normals = normals;
607
+ if (colors.length > 0)
608
+ data.data.colors = colors;
609
+ if (uvs.length > 0)
610
+ data.data.uvs = [uvs];
611
+ data.data.faces = faces;
612
+ return data;
613
+ }
614
+ clone() {
615
+ return new Geometry().copy(this);
616
+ }
617
+ copy(source) {
618
+ this.vertices = [];
619
+ this.colors = [];
620
+ this.faces = [];
621
+ this.faceVertexUvs = [[]];
622
+ this.morphTargets = [];
623
+ this.morphNormals = [];
624
+ this.skinWeights = [];
625
+ this.skinIndices = [];
626
+ this.lineDistances = [];
627
+ this.boundingBox = null;
628
+ this.boundingSphere = null;
629
+ this.name = source.name;
630
+ const vertices = source.vertices;
631
+ for (let i = 0, il = vertices.length; i < il; i++) {
632
+ this.vertices.push(vertices[i].clone());
633
+ }
634
+ const colors = source.colors;
635
+ for (let i = 0, il = colors.length; i < il; i++) {
636
+ this.colors.push(colors[i].clone());
637
+ }
638
+ const faces = source.faces;
639
+ for (let i = 0, il = faces.length; i < il; i++) {
640
+ this.faces.push(faces[i].clone());
641
+ }
642
+ for (let i = 0, il = source.faceVertexUvs.length; i < il; i++) {
643
+ const faceVertexUvs = source.faceVertexUvs[i];
644
+ if (this.faceVertexUvs[i] === void 0) {
645
+ this.faceVertexUvs[i] = [];
646
+ }
647
+ for (let j = 0, jl = faceVertexUvs.length; j < jl; j++) {
648
+ const uvs = faceVertexUvs[j], uvsCopy = [];
649
+ for (let k = 0, kl = uvs.length; k < kl; k++) {
650
+ const uv = uvs[k];
651
+ uvsCopy.push(uv.clone());
652
+ }
653
+ this.faceVertexUvs[i].push(uvsCopy);
654
+ }
655
+ }
656
+ const morphTargets = source.morphTargets;
657
+ for (let i = 0, il = morphTargets.length; i < il; i++) {
658
+ const morphTarget = {};
659
+ morphTarget.name = morphTargets[i].name;
660
+ if (morphTargets[i].vertices !== void 0) {
661
+ morphTarget.vertices = [];
662
+ for (let j = 0, jl = morphTargets[i].vertices.length; j < jl; j++) {
663
+ morphTarget.vertices.push(morphTargets[i].vertices[j].clone());
664
+ }
665
+ }
666
+ if (morphTargets[i].normals !== void 0) {
667
+ morphTarget.normals = [];
668
+ for (let j = 0, jl = morphTargets[i].normals.length; j < jl; j++) {
669
+ morphTarget.normals.push(morphTargets[i].normals[j].clone());
670
+ }
671
+ }
672
+ this.morphTargets.push(morphTarget);
673
+ }
674
+ const morphNormals = source.morphNormals;
675
+ for (let i = 0, il = morphNormals.length; i < il; i++) {
676
+ const morphNormal = {};
677
+ if (morphNormals[i].vertexNormals !== void 0) {
678
+ morphNormal.vertexNormals = [];
679
+ for (let j = 0, jl = morphNormals[i].vertexNormals.length; j < jl; j++) {
680
+ const srcVertexNormal = morphNormals[i].vertexNormals[j];
681
+ const destVertexNormal = {};
682
+ destVertexNormal.a = srcVertexNormal.a.clone();
683
+ destVertexNormal.b = srcVertexNormal.b.clone();
684
+ destVertexNormal.c = srcVertexNormal.c.clone();
685
+ morphNormal.vertexNormals.push(destVertexNormal);
686
+ }
687
+ }
688
+ if (morphNormals[i].faceNormals !== void 0) {
689
+ morphNormal.faceNormals = [];
690
+ for (let j = 0, jl = morphNormals[i].faceNormals.length; j < jl; j++) {
691
+ morphNormal.faceNormals.push(morphNormals[i].faceNormals[j].clone());
692
+ }
693
+ }
694
+ this.morphNormals.push(morphNormal);
695
+ }
696
+ const skinWeights = source.skinWeights;
697
+ for (let i = 0, il = skinWeights.length; i < il; i++) {
698
+ this.skinWeights.push(skinWeights[i].clone());
699
+ }
700
+ const skinIndices = source.skinIndices;
701
+ for (let i = 0, il = skinIndices.length; i < il; i++) {
702
+ this.skinIndices.push(skinIndices[i].clone());
703
+ }
704
+ const lineDistances = source.lineDistances;
705
+ for (let i = 0, il = lineDistances.length; i < il; i++) {
706
+ this.lineDistances.push(lineDistances[i]);
707
+ }
708
+ const boundingBox = source.boundingBox;
709
+ if (boundingBox !== null) {
710
+ this.boundingBox = boundingBox.clone();
711
+ }
712
+ const boundingSphere = source.boundingSphere;
713
+ if (boundingSphere !== null) {
714
+ this.boundingSphere = boundingSphere.clone();
715
+ }
716
+ this.elementsNeedUpdate = source.elementsNeedUpdate;
717
+ this.verticesNeedUpdate = source.verticesNeedUpdate;
718
+ this.uvsNeedUpdate = source.uvsNeedUpdate;
719
+ this.normalsNeedUpdate = source.normalsNeedUpdate;
720
+ this.colorsNeedUpdate = source.colorsNeedUpdate;
721
+ this.lineDistancesNeedUpdate = source.lineDistancesNeedUpdate;
722
+ this.groupsNeedUpdate = source.groupsNeedUpdate;
723
+ return this;
724
+ }
725
+ toBufferGeometry() {
726
+ const geometry = new DirectGeometry().fromGeometry(this);
727
+ const buffergeometry = new BufferGeometry();
728
+ const positions = new Float32Array(geometry.vertices.length * 3);
729
+ buffergeometry.setAttribute("position", new BufferAttribute(positions, 3).copyVector3sArray(geometry.vertices));
730
+ if (geometry.normals.length > 0) {
731
+ const normals = new Float32Array(geometry.normals.length * 3);
732
+ buffergeometry.setAttribute("normal", new BufferAttribute(normals, 3).copyVector3sArray(geometry.normals));
733
+ }
734
+ if (geometry.colors.length > 0) {
735
+ const colors = new Float32Array(geometry.colors.length * 3);
736
+ buffergeometry.setAttribute("color", new BufferAttribute(colors, 3).copyColorsArray(geometry.colors));
737
+ }
738
+ if (geometry.uvs.length > 0) {
739
+ const uvs = new Float32Array(geometry.uvs.length * 2);
740
+ buffergeometry.setAttribute("uv", new BufferAttribute(uvs, 2).copyVector2sArray(geometry.uvs));
741
+ }
742
+ if (geometry.uvs2.length > 0) {
743
+ const uvs2 = new Float32Array(geometry.uvs2.length * 2);
744
+ buffergeometry.setAttribute("uv2", new BufferAttribute(uvs2, 2).copyVector2sArray(geometry.uvs2));
745
+ }
746
+ buffergeometry.groups = geometry.groups;
747
+ for (let name in geometry.morphTargets) {
748
+ const array = [];
749
+ const morphTargets = geometry.morphTargets[name];
750
+ for (let i = 0, l = morphTargets.length; i < l; i++) {
751
+ const morphTarget = morphTargets[i];
752
+ const attribute = new Float32BufferAttribute(morphTarget.data.length * 3, 3);
753
+ attribute.name = morphTarget.name;
754
+ array.push(attribute.copyVector3sArray(morphTarget.data));
755
+ }
756
+ buffergeometry.morphAttributes[name] = array;
757
+ }
758
+ if (geometry.skinIndices.length > 0) {
759
+ const skinIndices = new Float32BufferAttribute(geometry.skinIndices.length * 4, 4);
760
+ buffergeometry.setAttribute("skinIndex", skinIndices.copyVector4sArray(geometry.skinIndices));
761
+ }
762
+ if (geometry.skinWeights.length > 0) {
763
+ const skinWeights = new Float32BufferAttribute(geometry.skinWeights.length * 4, 4);
764
+ buffergeometry.setAttribute("skinWeight", skinWeights.copyVector4sArray(geometry.skinWeights));
786
765
  }
787
- applyMatrix(matrix) {
788
- console.warn("THREE.Geometry: .applyMatrix() has been renamed to .applyMatrix4().");
789
- return this.applyMatrix4(matrix);
766
+ if (geometry.boundingSphere !== null) {
767
+ buffergeometry.boundingSphere = geometry.boundingSphere.clone();
790
768
  }
791
- dispose() {
792
- this.dispatchEvent({ type: "dispose" });
769
+ if (geometry.boundingBox !== null) {
770
+ buffergeometry.boundingBox = geometry.boundingBox.clone();
793
771
  }
772
+ return buffergeometry;
773
+ }
774
+ computeTangents() {
775
+ console.error("THREE.Geometry: .computeTangents() has been removed.");
776
+ }
777
+ computeLineDistances() {
778
+ console.error(
779
+ "THREE.Geometry: .computeLineDistances() has been removed. Use THREE.Line.computeLineDistances() instead."
780
+ );
794
781
  }
795
- return Geometry2;
796
- })();
782
+ applyMatrix(matrix) {
783
+ console.warn("THREE.Geometry: .applyMatrix() has been renamed to .applyMatrix4().");
784
+ return this.applyMatrix4(matrix);
785
+ }
786
+ dispose() {
787
+ this.dispatchEvent({ type: "dispose" });
788
+ }
789
+ }
797
790
  class DirectGeometry {
798
791
  constructor() {
799
792
  this.vertices = [];