three-stdlib 2.35.3 → 2.35.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (514) hide show
  1. package/_polyfill/CapsuleGeometry.cjs +20 -17
  2. package/_polyfill/CapsuleGeometry.cjs.map +1 -1
  3. package/_polyfill/CapsuleGeometry.js +20 -17
  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 +722 -715
  50. package/deprecated/Geometry.cjs.map +1 -1
  51. package/deprecated/Geometry.js +723 -716
  52. package/deprecated/Geometry.js.map +1 -1
  53. package/effects/AnaglyphEffect.cjs +2 -1
  54. package/effects/AnaglyphEffect.cjs.map +1 -1
  55. package/effects/AnaglyphEffect.js +3 -2
  56. package/effects/AnaglyphEffect.js.map +1 -1
  57. package/effects/OutlineEffect.cjs +2 -1
  58. package/effects/OutlineEffect.cjs.map +1 -1
  59. package/effects/OutlineEffect.js +3 -2
  60. package/effects/OutlineEffect.js.map +1 -1
  61. package/effects/ParallaxBarrierEffect.cjs +2 -1
  62. package/effects/ParallaxBarrierEffect.cjs.map +1 -1
  63. package/effects/ParallaxBarrierEffect.js +3 -2
  64. package/effects/ParallaxBarrierEffect.js.map +1 -1
  65. package/exporters/DRACOExporter.cjs +133 -122
  66. package/exporters/DRACOExporter.cjs.map +1 -1
  67. package/exporters/DRACOExporter.d.ts +23 -21
  68. package/exporters/DRACOExporter.js +133 -122
  69. package/exporters/DRACOExporter.js.map +1 -1
  70. package/exporters/GLTFExporter.cjs +170 -167
  71. package/exporters/GLTFExporter.cjs.map +1 -1
  72. package/exporters/GLTFExporter.js +170 -167
  73. package/exporters/GLTFExporter.js.map +1 -1
  74. package/geometries/LightningStrike.cjs +524 -515
  75. package/geometries/LightningStrike.cjs.map +1 -1
  76. package/geometries/LightningStrike.js +524 -515
  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 +2 -1
  123. package/lines/LineMaterial.cjs.map +1 -1
  124. package/lines/LineMaterial.js +3 -2
  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 +441 -435
  139. package/loaders/BasisTextureLoader.cjs.map +1 -1
  140. package/loaders/BasisTextureLoader.js +441 -435
  141. package/loaders/BasisTextureLoader.js.map +1 -1
  142. package/loaders/EXRLoader.cjs +2 -1
  143. package/loaders/EXRLoader.cjs.map +1 -1
  144. package/loaders/EXRLoader.js +3 -2
  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 +377 -374
  160. package/loaders/KTX2Loader.cjs.map +1 -1
  161. package/loaders/KTX2Loader.js +377 -374
  162. package/loaders/KTX2Loader.js.map +1 -1
  163. package/loaders/LDrawLoader.cjs +5 -4
  164. package/loaders/LDrawLoader.cjs.map +1 -1
  165. package/loaders/LDrawLoader.js +6 -5
  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 +46 -43
  172. package/loaders/PRWMLoader.cjs.map +1 -1
  173. package/loaders/PRWMLoader.js +46 -43
  174. package/loaders/PRWMLoader.js.map +1 -1
  175. package/loaders/SVGLoader.cjs +1694 -1688
  176. package/loaders/SVGLoader.cjs.map +1 -1
  177. package/loaders/SVGLoader.js +1694 -1688
  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 +53 -50
  192. package/math/ConvexHull.cjs.map +1 -1
  193. package/math/ConvexHull.js +53 -50
  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 +271 -268
  212. package/misc/ConvexObjectBreaker.cjs.map +1 -1
  213. package/misc/ConvexObjectBreaker.js +272 -269
  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 +2 -1
  232. package/objects/GroundProjectedEnv.cjs.map +1 -1
  233. package/objects/GroundProjectedEnv.js +3 -2
  234. package/objects/GroundProjectedEnv.js.map +1 -1
  235. package/objects/Lensflare.cjs +209 -206
  236. package/objects/Lensflare.cjs.map +1 -1
  237. package/objects/Lensflare.js +209 -206
  238. package/objects/Lensflare.js.map +1 -1
  239. package/objects/Reflector.cjs +154 -146
  240. package/objects/Reflector.cjs.map +1 -1
  241. package/objects/Reflector.js +154 -146
  242. package/objects/Reflector.js.map +1 -1
  243. package/objects/ReflectorForSSRPass.cjs +183 -180
  244. package/objects/ReflectorForSSRPass.cjs.map +1 -1
  245. package/objects/ReflectorForSSRPass.js +183 -180
  246. package/objects/ReflectorForSSRPass.js.map +1 -1
  247. package/objects/Refractor.cjs +164 -161
  248. package/objects/Refractor.cjs.map +1 -1
  249. package/objects/Refractor.js +164 -161
  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 +35 -32
  256. package/objects/Sky.cjs.map +1 -1
  257. package/objects/Sky.d.ts +100 -6
  258. package/objects/Sky.js +35 -32
  259. package/objects/Sky.js.map +1 -1
  260. package/objects/Water.cjs +2 -1
  261. package/objects/Water.cjs.map +1 -1
  262. package/objects/Water.js +3 -2
  263. package/objects/Water.js.map +1 -1
  264. package/objects/Water2.cjs +143 -140
  265. package/objects/Water2.cjs.map +1 -1
  266. package/objects/Water2.js +143 -140
  267. package/objects/Water2.js.map +1 -1
  268. package/package.json +1 -1
  269. package/postprocessing/SAOPass.cjs +267 -264
  270. package/postprocessing/SAOPass.cjs.map +1 -1
  271. package/postprocessing/SAOPass.js +267 -264
  272. package/postprocessing/SAOPass.js.map +1 -1
  273. package/postprocessing/SSAOPass.cjs +253 -250
  274. package/postprocessing/SSAOPass.cjs.map +1 -1
  275. package/postprocessing/SSAOPass.js +253 -250
  276. package/postprocessing/SSAOPass.js.map +1 -1
  277. package/postprocessing/SSRPass.cjs +379 -376
  278. package/postprocessing/SSRPass.cjs.map +1 -1
  279. package/postprocessing/SSRPass.js +379 -376
  280. package/postprocessing/SSRPass.js.map +1 -1
  281. package/postprocessing/UnrealBloomPass.cjs +205 -202
  282. package/postprocessing/UnrealBloomPass.cjs.map +1 -1
  283. package/postprocessing/UnrealBloomPass.js +205 -202
  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 +71 -46
  294. package/shaders/ACESFilmicToneMappingShader.cjs.map +1 -1
  295. package/shaders/ACESFilmicToneMappingShader.js +71 -46
  296. package/shaders/ACESFilmicToneMappingShader.js.map +1 -1
  297. package/shaders/AfterimageShader.cjs +41 -22
  298. package/shaders/AfterimageShader.cjs.map +1 -1
  299. package/shaders/AfterimageShader.js +41 -22
  300. package/shaders/AfterimageShader.js.map +1 -1
  301. package/shaders/BasicShader.cjs +20 -6
  302. package/shaders/BasicShader.cjs.map +1 -1
  303. package/shaders/BasicShader.js +20 -6
  304. package/shaders/BasicShader.js.map +1 -1
  305. package/shaders/BleachBypassShader.cjs +46 -26
  306. package/shaders/BleachBypassShader.cjs.map +1 -1
  307. package/shaders/BleachBypassShader.js +46 -26
  308. package/shaders/BleachBypassShader.js.map +1 -1
  309. package/shaders/BlendShader.cjs +33 -19
  310. package/shaders/BlendShader.cjs.map +1 -1
  311. package/shaders/BlendShader.js +33 -19
  312. package/shaders/BlendShader.js.map +1 -1
  313. package/shaders/BokehShader.cjs +117 -90
  314. package/shaders/BokehShader.cjs.map +1 -1
  315. package/shaders/BokehShader.js +117 -90
  316. package/shaders/BokehShader.js.map +1 -1
  317. package/shaders/BokehShader2.cjs +333 -232
  318. package/shaders/BokehShader2.cjs.map +1 -1
  319. package/shaders/BokehShader2.js +333 -232
  320. package/shaders/BokehShader2.js.map +1 -1
  321. package/shaders/BrightnessContrastShader.cjs +38 -22
  322. package/shaders/BrightnessContrastShader.cjs.map +1 -1
  323. package/shaders/BrightnessContrastShader.js +38 -22
  324. package/shaders/BrightnessContrastShader.js.map +1 -1
  325. package/shaders/ColorCorrectionShader.cjs +35 -21
  326. package/shaders/ColorCorrectionShader.cjs.map +1 -1
  327. package/shaders/ColorCorrectionShader.js +35 -21
  328. package/shaders/ColorCorrectionShader.js.map +1 -1
  329. package/shaders/ColorifyShader.cjs +34 -19
  330. package/shaders/ColorifyShader.cjs.map +1 -1
  331. package/shaders/ColorifyShader.js +34 -19
  332. package/shaders/ColorifyShader.js.map +1 -1
  333. package/shaders/ConvolutionShader.cjs +43 -24
  334. package/shaders/ConvolutionShader.cjs.map +1 -1
  335. package/shaders/ConvolutionShader.js +43 -24
  336. package/shaders/ConvolutionShader.js.map +1 -1
  337. package/shaders/CopyShader.cjs +30 -16
  338. package/shaders/CopyShader.cjs.map +1 -1
  339. package/shaders/CopyShader.js +30 -16
  340. package/shaders/CopyShader.js.map +1 -1
  341. package/shaders/DOFMipMapShader.cjs +38 -21
  342. package/shaders/DOFMipMapShader.cjs.map +1 -1
  343. package/shaders/DOFMipMapShader.js +38 -21
  344. package/shaders/DOFMipMapShader.js.map +1 -1
  345. package/shaders/DepthLimitedBlurShader.cjs +98 -69
  346. package/shaders/DepthLimitedBlurShader.cjs.map +1 -1
  347. package/shaders/DepthLimitedBlurShader.js +98 -69
  348. package/shaders/DepthLimitedBlurShader.js.map +1 -1
  349. package/shaders/DigitalGlitch.cjs +70 -59
  350. package/shaders/DigitalGlitch.cjs.map +1 -1
  351. package/shaders/DigitalGlitch.js +70 -59
  352. package/shaders/DigitalGlitch.js.map +1 -1
  353. package/shaders/DotScreenShader.cjs +49 -28
  354. package/shaders/DotScreenShader.cjs.map +1 -1
  355. package/shaders/DotScreenShader.js +49 -28
  356. package/shaders/DotScreenShader.js.map +1 -1
  357. package/shaders/FXAAShader.cjs +1098 -1089
  358. package/shaders/FXAAShader.cjs.map +1 -1
  359. package/shaders/FXAAShader.js +1098 -1089
  360. package/shaders/FXAAShader.js.map +1 -1
  361. package/shaders/FilmShader.cjs +57 -29
  362. package/shaders/FilmShader.cjs.map +1 -1
  363. package/shaders/FilmShader.js +57 -29
  364. package/shaders/FilmShader.js.map +1 -1
  365. package/shaders/FocusShader.cjs +70 -43
  366. package/shaders/FocusShader.cjs.map +1 -1
  367. package/shaders/FocusShader.js +70 -43
  368. package/shaders/FocusShader.js.map +1 -1
  369. package/shaders/FreiChenShader.cjs +74 -53
  370. package/shaders/FreiChenShader.cjs.map +1 -1
  371. package/shaders/FreiChenShader.js +74 -53
  372. package/shaders/FreiChenShader.js.map +1 -1
  373. package/shaders/FresnelShader.cjs +55 -35
  374. package/shaders/FresnelShader.cjs.map +1 -1
  375. package/shaders/FresnelShader.js +55 -35
  376. package/shaders/FresnelShader.js.map +1 -1
  377. package/shaders/GammaCorrectionShader.cjs +33 -19
  378. package/shaders/GammaCorrectionShader.cjs.map +1 -1
  379. package/shaders/GammaCorrectionShader.js +33 -19
  380. package/shaders/GammaCorrectionShader.js.map +1 -1
  381. package/shaders/GodRaysShader.cjs +193 -116
  382. package/shaders/GodRaysShader.cjs.map +1 -1
  383. package/shaders/GodRaysShader.js +193 -116
  384. package/shaders/GodRaysShader.js.map +1 -1
  385. package/shaders/HalftoneShader.cjs +270 -192
  386. package/shaders/HalftoneShader.cjs.map +1 -1
  387. package/shaders/HalftoneShader.js +270 -192
  388. package/shaders/HalftoneShader.js.map +1 -1
  389. package/shaders/HorizontalTiltShiftShader.cjs +43 -27
  390. package/shaders/HorizontalTiltShiftShader.cjs.map +1 -1
  391. package/shaders/HorizontalTiltShiftShader.js +43 -27
  392. package/shaders/HorizontalTiltShiftShader.js.map +1 -1
  393. package/shaders/HueSaturationShader.cjs +47 -31
  394. package/shaders/HueSaturationShader.cjs.map +1 -1
  395. package/shaders/HueSaturationShader.js +47 -31
  396. package/shaders/HueSaturationShader.js.map +1 -1
  397. package/shaders/KaleidoShader.cjs +37 -24
  398. package/shaders/KaleidoShader.cjs.map +1 -1
  399. package/shaders/KaleidoShader.js +37 -24
  400. package/shaders/KaleidoShader.js.map +1 -1
  401. package/shaders/LuminosityHighPassShader.cjs +43 -24
  402. package/shaders/LuminosityHighPassShader.cjs.map +1 -1
  403. package/shaders/LuminosityHighPassShader.js +43 -24
  404. package/shaders/LuminosityHighPassShader.js.map +1 -1
  405. package/shaders/LuminosityShader.cjs +34 -17
  406. package/shaders/LuminosityShader.cjs.map +1 -1
  407. package/shaders/LuminosityShader.js +34 -17
  408. package/shaders/LuminosityShader.js.map +1 -1
  409. package/shaders/MirrorShader.cjs +39 -26
  410. package/shaders/MirrorShader.cjs.map +1 -1
  411. package/shaders/MirrorShader.js +39 -26
  412. package/shaders/MirrorShader.js.map +1 -1
  413. package/shaders/NormalMapShader.cjs +36 -21
  414. package/shaders/NormalMapShader.cjs.map +1 -1
  415. package/shaders/NormalMapShader.js +36 -21
  416. package/shaders/NormalMapShader.js.map +1 -1
  417. package/shaders/ParallaxShader.cjs +147 -97
  418. package/shaders/ParallaxShader.cjs.map +1 -1
  419. package/shaders/ParallaxShader.js +147 -97
  420. package/shaders/ParallaxShader.js.map +1 -1
  421. package/shaders/PixelShader.cjs +31 -18
  422. package/shaders/PixelShader.cjs.map +1 -1
  423. package/shaders/PixelShader.js +31 -18
  424. package/shaders/PixelShader.js.map +1 -1
  425. package/shaders/RGBShiftShader.cjs +33 -20
  426. package/shaders/RGBShiftShader.cjs.map +1 -1
  427. package/shaders/RGBShiftShader.js +33 -20
  428. package/shaders/RGBShiftShader.js.map +1 -1
  429. package/shaders/SAOShader.cjs +154 -117
  430. package/shaders/SAOShader.cjs.map +1 -1
  431. package/shaders/SAOShader.js +154 -117
  432. package/shaders/SAOShader.js.map +1 -1
  433. package/shaders/SMAAShader.cjs +358 -270
  434. package/shaders/SMAAShader.cjs.map +1 -1
  435. package/shaders/SMAAShader.js +358 -270
  436. package/shaders/SMAAShader.js.map +1 -1
  437. package/shaders/SSAOShader.cjs +236 -142
  438. package/shaders/SSAOShader.cjs.map +1 -1
  439. package/shaders/SSAOShader.js +236 -142
  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 +36 -20
  446. package/shaders/SepiaShader.cjs.map +1 -1
  447. package/shaders/SepiaShader.js +36 -20
  448. package/shaders/SepiaShader.js.map +1 -1
  449. package/shaders/SobelOperatorShader.cjs +64 -37
  450. package/shaders/SobelOperatorShader.cjs.map +1 -1
  451. package/shaders/SobelOperatorShader.js +64 -37
  452. package/shaders/SobelOperatorShader.js.map +1 -1
  453. package/shaders/TechnicolorShader.cjs +29 -16
  454. package/shaders/TechnicolorShader.cjs.map +1 -1
  455. package/shaders/TechnicolorShader.js +29 -16
  456. package/shaders/TechnicolorShader.js.map +1 -1
  457. package/shaders/ToneMapShader.cjs +55 -35
  458. package/shaders/ToneMapShader.cjs.map +1 -1
  459. package/shaders/ToneMapShader.js +55 -35
  460. package/shaders/ToneMapShader.js.map +1 -1
  461. package/shaders/ToonShader.cjs +275 -165
  462. package/shaders/ToonShader.cjs.map +1 -1
  463. package/shaders/ToonShader.js +275 -165
  464. package/shaders/ToonShader.js.map +1 -1
  465. package/shaders/TriangleBlurShader.cjs +50 -27
  466. package/shaders/TriangleBlurShader.cjs.map +1 -1
  467. package/shaders/TriangleBlurShader.js +50 -27
  468. package/shaders/TriangleBlurShader.js.map +1 -1
  469. package/shaders/UnpackDepthRGBAShader.cjs +32 -17
  470. package/shaders/UnpackDepthRGBAShader.cjs.map +1 -1
  471. package/shaders/UnpackDepthRGBAShader.js +32 -17
  472. package/shaders/UnpackDepthRGBAShader.js.map +1 -1
  473. package/shaders/VerticalTiltShiftShader.cjs +43 -27
  474. package/shaders/VerticalTiltShiftShader.cjs.map +1 -1
  475. package/shaders/VerticalTiltShiftShader.js +43 -27
  476. package/shaders/VerticalTiltShiftShader.js.map +1 -1
  477. package/shaders/VignetteShader.cjs +43 -27
  478. package/shaders/VignetteShader.cjs.map +1 -1
  479. package/shaders/VignetteShader.js +43 -27
  480. package/shaders/VignetteShader.js.map +1 -1
  481. package/shaders/VolumeShader.cjs +264 -213
  482. package/shaders/VolumeShader.cjs.map +1 -1
  483. package/shaders/VolumeShader.js +264 -213
  484. package/shaders/VolumeShader.js.map +1 -1
  485. package/shaders/WaterRefractionShader.cjs +63 -35
  486. package/shaders/WaterRefractionShader.cjs.map +1 -1
  487. package/shaders/WaterRefractionShader.js +63 -35
  488. package/shaders/WaterRefractionShader.js.map +1 -1
  489. package/utils/GeometryCompressionUtils.cjs +2 -1
  490. package/utils/GeometryCompressionUtils.cjs.map +1 -1
  491. package/utils/GeometryCompressionUtils.js +3 -2
  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 +109 -106
  498. package/webxr/ARButton.cjs.map +1 -1
  499. package/webxr/ARButton.d.ts +4 -3
  500. package/webxr/ARButton.js +109 -106
  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 +98 -95
  507. package/webxr/VRButton.cjs.map +1 -1
  508. package/webxr/VRButton.d.ts +6 -5
  509. package/webxr/VRButton.js +98 -95
  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,227 +1,209 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const THREE = require("three");
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));
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
+ }
19
69
  }
20
- if (geometry.boundingSphere !== null) {
21
- buffergeometry.boundingSphere = geometry.boundingSphere.clone();
70
+ if (this.boundingBox !== null) {
71
+ this.computeBoundingBox();
22
72
  }
23
- if (geometry.boundingBox !== null) {
24
- buffergeometry.boundingBox = geometry.boundingBox.clone();
73
+ if (this.boundingSphere !== null) {
74
+ this.computeBoundingSphere();
25
75
  }
26
- } else if (object.isMesh) {
27
- buffergeometry = geometry.toBufferGeometry();
76
+ this.verticesNeedUpdate = true;
77
+ this.normalsNeedUpdate = true;
78
+ return this;
28
79
  }
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);
80
+ rotateX(angle) {
81
+ _m1.makeRotationX(angle);
82
+ this.applyMatrix4(_m1);
83
+ return this;
61
84
  }
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
- }
85
+ rotateY(angle) {
86
+ _m1.makeRotationY(angle);
87
+ this.applyMatrix4(_m1);
88
+ return this;
68
89
  }
69
- if (this.boundingBox !== null) {
70
- this.computeBoundingBox();
90
+ rotateZ(angle) {
91
+ _m1.makeRotationZ(angle);
92
+ this.applyMatrix4(_m1);
93
+ return this;
71
94
  }
72
- if (this.boundingSphere !== null) {
73
- this.computeBoundingSphere();
95
+ translate(x, y, z) {
96
+ _m1.makeTranslation(x, y, z);
97
+ this.applyMatrix4(_m1);
98
+ return this;
74
99
  }
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.");
100
+ scale(x, y, z) {
101
+ _m1.makeScale(x, y, z);
102
+ this.applyMatrix4(_m1);
116
103
  return this;
117
104
  }
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
- }
105
+ lookAt(vector) {
106
+ _obj.lookAt(vector);
107
+ _obj.updateMatrix();
108
+ this.applyMatrix4(_obj.matrix);
109
+ return this;
110
+ }
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));
167
130
  }
168
131
  }
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));
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
+ ]);
154
+ }
155
+ }
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
+ }
173
169
  }
174
170
  } else {
175
- for (let i = 0; i < position.count; i += 3) {
176
- addFace(i, i + 1, i + 2);
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
+ }
177
179
  }
178
180
  }
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;
179
189
  }
180
- this.computeFaceNormals();
181
- if (geometry.boundingBox !== null) {
182
- this.boundingBox = geometry.boundingBox.clone();
183
- }
184
- if (geometry.boundingSphere !== null) {
185
- this.boundingSphere = geometry.boundingSphere.clone();
186
- }
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);
190
+ center() {
191
+ this.computeBoundingBox();
192
+ this.boundingBox.getCenter(_offset).negate();
193
+ this.translate(_offset.x, _offset.y, _offset.z);
194
+ return this;
217
195
  }
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();
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;
223
205
  }
224
- if (areaWeighted) {
206
+ computeFaceNormals() {
225
207
  const cb = new THREE.Vector3(), ab = new THREE.Vector3();
226
208
  for (let f = 0, fl = this.faces.length; f < fl; f++) {
227
209
  const face = this.faces[f];
@@ -231,564 +213,589 @@ class Geometry extends THREE.EventDispatcher {
231
213
  cb.subVectors(vC, vB);
232
214
  ab.subVectors(vA, vB);
233
215
  cb.cross(ab);
234
- vertices[face.a].add(cb);
235
- vertices[face.b].add(cb);
236
- vertices[face.c].add(cb);
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();
237
250
  }
238
- } else {
239
- this.computeFaceNormals();
240
251
  for (let f = 0, fl = this.faces.length; f < fl; f++) {
241
252
  const face = this.faces[f];
242
- vertices[face.a].add(face.normal);
243
- vertices[face.b].add(face.normal);
244
- vertices[face.c].add(face.normal);
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
+ }
245
263
  }
246
- }
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();
264
+ if (this.faces.length > 0) {
265
+ this.normalsNeedUpdate = true;
261
266
  }
262
267
  }
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();
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
+ }
280
282
  }
281
- }
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);
283
+ if (this.faces.length > 0) {
284
+ this.normalsNeedUpdate = true;
293
285
  }
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();
286
+ }
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();
299
292
  } else {
300
- face.__originalVertexNormals[i].copy(face.vertexNormals[i]);
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
+ }
301
303
  }
302
304
  }
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;
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();
313
329
  for (let f = 0, fl = this.faces.length; f < fl; f++) {
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();
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
+ }
328
339
  for (let f = 0, fl = this.faces.length; f < fl; f++) {
329
340
  const face = this.faces[f];
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]);
341
+ face.normal = face.__originalFaceNormal;
342
+ face.vertexNormals = face.__originalVertexNormals;
336
343
  }
337
344
  }
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;
342
- }
343
- }
344
- computeBoundingBox() {
345
- if (this.boundingBox === null) {
346
- this.boundingBox = new THREE.Box3();
345
+ computeBoundingBox() {
346
+ if (this.boundingBox === null) {
347
+ this.boundingBox = new THREE.Box3();
348
+ }
349
+ this.boundingBox.setFromPoints(this.vertices);
347
350
  }
348
- this.boundingBox.setFromPoints(this.vertices);
349
- }
350
- computeBoundingSphere() {
351
- if (this.boundingSphere === null) {
352
- this.boundingSphere = new THREE.Sphere();
351
+ computeBoundingSphere() {
352
+ if (this.boundingSphere === null) {
353
+ this.boundingSphere = new THREE.Sphere();
354
+ }
355
+ this.boundingSphere.setFromPoints(this.vertices);
353
356
  }
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();
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);
387
383
  if (normalMatrix !== void 0) {
388
- normal.applyMatrix3(normalMatrix).normalize();
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);
389
411
  }
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());
396
412
  }
397
- faceCopy.materialIndex = face.materialIndex + materialIndexOffset;
398
- faces1.push(faceCopy);
399
413
  }
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());
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]];
408
441
  }
409
- this.faceVertexUvs[i].push(uvsCopy);
410
442
  }
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]];
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
+ }
440
456
  }
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;
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);
453
462
  }
454
463
  }
464
+ const diff = this.vertices.length - unique.length;
465
+ this.vertices = unique;
466
+ return diff;
455
467
  }
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);
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));
461
473
  }
474
+ return this;
462
475
  }
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;
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
+ }
494
500
  if (newUvs1)
495
- newUvs1.push(uvs1[id]);
501
+ this.faceVertexUvs[0] = newUvs1;
496
502
  if (newUvs2)
497
- newUvs2.push(uvs2[id]);
498
- }
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];
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
+ }
521
580
  }
522
- return data;
523
- }
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]));
581
+ function setBit(value, position, enabled) {
582
+ return enabled ? value | 1 << position : value & ~(1 << position);
567
583
  }
568
- if (hasFaceColor) {
569
- faces.push(getColorIndex(face.color));
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];
570
592
  }
571
- if (hasFaceVertexColor) {
572
- const vertexColors = face.vertexColors;
573
- faces.push(getColorIndex(vertexColors[0]), getColorIndex(vertexColors[1]), getColorIndex(vertexColors[2]));
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];
574
601
  }
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];
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];
583
610
  }
584
- normalsHash[hash] = normals.length / 3;
585
- normals.push(normal.x, normal.y, normal.z);
586
- return normalsHash[hash];
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;
587
620
  }
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];
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
+ }
592
662
  }
593
- colorsHash[hash] = colors.length;
594
- colors.push(color.getHex());
595
- return colorsHash[hash];
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;
596
731
  }
597
- function getUvIndex(uv) {
598
- const hash = uv.x.toString() + uv.y.toString();
599
- if (uvsHash[hash] !== void 0) {
600
- return uvsHash[hash];
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;
601
764
  }
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));
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));
768
+ }
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));
772
+ }
773
+ if (geometry.boundingSphere !== null) {
774
+ buffergeometry.boundingSphere = geometry.boundingSphere.clone();
775
+ }
776
+ if (geometry.boundingBox !== null) {
777
+ buffergeometry.boundingBox = geometry.boundingBox.clone();
778
+ }
779
+ return buffergeometry;
767
780
  }
768
- if (geometry.boundingSphere !== null) {
769
- buffergeometry.boundingSphere = geometry.boundingSphere.clone();
781
+ computeTangents() {
782
+ console.error("THREE.Geometry: .computeTangents() has been removed.");
770
783
  }
771
- if (geometry.boundingBox !== null) {
772
- buffergeometry.boundingBox = geometry.boundingBox.clone();
784
+ computeLineDistances() {
785
+ console.error(
786
+ "THREE.Geometry: .computeLineDistances() has been removed. Use THREE.Line.computeLineDistances() instead."
787
+ );
788
+ }
789
+ applyMatrix(matrix) {
790
+ console.warn("THREE.Geometry: .applyMatrix() has been renamed to .applyMatrix4().");
791
+ return this.applyMatrix4(matrix);
792
+ }
793
+ dispose() {
794
+ this.dispatchEvent({ type: "dispose" });
773
795
  }
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
- );
783
- }
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
796
  }
791
- }
797
+ return Geometry2;
798
+ })();
792
799
  class DirectGeometry {
793
800
  constructor() {
794
801
  this.vertices = [];