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