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