three-stdlib 2.24.2 → 2.25.1
Sign up to get free protection for your applications and to get access to all the features.
- package/controls/OrbitControls.d.ts +2 -0
- package/index.cjs +116401 -611
- package/index.js +116037 -263
- package/package.json +17 -4
- package/_polyfill/CapsuleGeometry.cjs +0 -22
- package/_polyfill/CapsuleGeometry.js +0 -22
- package/_polyfill/CompressedArrayTexture.cjs +0 -12
- package/_polyfill/CompressedArrayTexture.js +0 -12
- package/_polyfill/Data3DTexture.cjs +0 -17
- package/_polyfill/Data3DTexture.js +0 -17
- package/animation/AnimationClipCreator.cjs +0 -56
- package/animation/AnimationClipCreator.js +0 -56
- package/animation/CCDIKSolver.cjs +0 -269
- package/animation/CCDIKSolver.js +0 -269
- package/animation/MMDAnimationHelper.cjs +0 -688
- package/animation/MMDAnimationHelper.js +0 -688
- package/animation/MMDPhysics.cjs +0 -830
- package/animation/MMDPhysics.js +0 -830
- package/cameras/CinematicCamera.cjs +0 -131
- package/cameras/CinematicCamera.js +0 -131
- package/controls/ArcballControls.cjs +0 -2033
- package/controls/ArcballControls.js +0 -2033
- package/controls/DeviceOrientationControls.cjs +0 -85
- package/controls/DeviceOrientationControls.js +0 -85
- package/controls/DragControls.cjs +0 -182
- package/controls/DragControls.js +0 -182
- package/controls/FirstPersonControls.cjs +0 -229
- package/controls/FirstPersonControls.js +0 -229
- package/controls/FlyControls.cjs +0 -248
- package/controls/FlyControls.js +0 -248
- package/controls/OrbitControls.cjs +0 -787
- package/controls/OrbitControls.js +0 -787
- package/controls/PointerLockControls.cjs +0 -103
- package/controls/PointerLockControls.js +0 -103
- package/controls/TrackballControls.cjs +0 -502
- package/controls/TrackballControls.js +0 -502
- package/controls/TransformControls.cjs +0 -1089
- package/controls/TransformControls.js +0 -1089
- package/controls/experimental/CameraControls.cjs +0 -736
- package/controls/experimental/CameraControls.js +0 -736
- package/csm/CSM.cjs +0 -244
- package/csm/CSM.js +0 -244
- package/csm/CSMFrustum.cjs +0 -75
- package/csm/CSMFrustum.js +0 -75
- package/csm/CSMHelper.cjs +0 -114
- package/csm/CSMHelper.js +0 -114
- package/csm/CSMShader.cjs +0 -261
- package/csm/CSMShader.js +0 -261
- package/curves/CurveExtras.cjs +0 -214
- package/curves/CurveExtras.js +0 -214
- package/curves/NURBSCurve.cjs +0 -35
- package/curves/NURBSCurve.js +0 -35
- package/curves/NURBSSurface.cjs +0 -28
- package/curves/NURBSSurface.js +0 -28
- package/curves/NURBSUtils.cjs +0 -226
- package/curves/NURBSUtils.js +0 -226
- package/deprecated/Geometry.cjs +0 -971
- package/deprecated/Geometry.js +0 -971
- package/effects/AnaglyphEffect.cjs +0 -102
- package/effects/AnaglyphEffect.js +0 -102
- package/effects/AsciiEffect.cjs +0 -155
- package/effects/AsciiEffect.js +0 -155
- package/effects/OutlineEffect.cjs +0 -275
- package/effects/OutlineEffect.js +0 -275
- package/effects/ParallaxBarrierEffect.cjs +0 -65
- package/effects/ParallaxBarrierEffect.js +0 -65
- package/effects/PeppersGhostEffect.cjs +0 -88
- package/effects/PeppersGhostEffect.js +0 -88
- package/effects/StereoEffect.cjs +0 -35
- package/effects/StereoEffect.js +0 -35
- package/environments/RoomEnvironment.cjs +0 -95
- package/environments/RoomEnvironment.js +0 -78
- package/exporters/ColladaExporter.cjs +0 -331
- package/exporters/ColladaExporter.js +0 -331
- package/exporters/DRACOExporter.cjs +0 -141
- package/exporters/DRACOExporter.js +0 -141
- package/exporters/GLTFExporter.cjs +0 -1909
- package/exporters/GLTFExporter.js +0 -1909
- package/exporters/MMDExporter.cjs +0 -131
- package/exporters/MMDExporter.js +0 -131
- package/exporters/OBJExporter.cjs +0 -181
- package/exporters/OBJExporter.js +0 -181
- package/exporters/PLYExporter.cjs +0 -280
- package/exporters/PLYExporter.js +0 -280
- package/exporters/STLExporter.cjs +0 -146
- package/exporters/STLExporter.js +0 -146
- package/exporters/USDZExporter.cjs +0 -340
- package/exporters/USDZExporter.js +0 -340
- package/geometries/BoxLineGeometry.cjs +0 -45
- package/geometries/BoxLineGeometry.js +0 -45
- package/geometries/ConvexGeometry.cjs +0 -26
- package/geometries/ConvexGeometry.js +0 -26
- package/geometries/DecalGeometry.cjs +0 -184
- package/geometries/DecalGeometry.js +0 -184
- package/geometries/LightningStrike.cjs +0 -553
- package/geometries/LightningStrike.js +0 -553
- package/geometries/ParametricGeometries.cjs +0 -130
- package/geometries/ParametricGeometries.js +0 -130
- package/geometries/ParametricGeometry.cjs +0 -63
- package/geometries/ParametricGeometry.js +0 -63
- package/geometries/RoundedBoxGeometry.cjs +0 -91
- package/geometries/RoundedBoxGeometry.js +0 -91
- package/geometries/TeapotGeometry.cjs +0 -1563
- package/geometries/TeapotGeometry.js +0 -1563
- package/geometries/TextGeometry.cjs +0 -27
- package/geometries/TextGeometry.js +0 -27
- package/helpers/LightProbeHelper.cjs +0 -73
- package/helpers/LightProbeHelper.js +0 -73
- package/helpers/PositionalAudioHelper.cjs +0 -68
- package/helpers/PositionalAudioHelper.js +0 -68
- package/helpers/RectAreaLightHelper.cjs +0 -44
- package/helpers/RectAreaLightHelper.js +0 -44
- package/helpers/VertexNormalsHelper.cjs +0 -47
- package/helpers/VertexNormalsHelper.js +0 -47
- package/helpers/VertexTangentsHelper.cjs +0 -43
- package/helpers/VertexTangentsHelper.js +0 -43
- package/interactive/HTMLMesh.cjs +0 -325
- package/interactive/HTMLMesh.js +0 -325
- package/interactive/InteractiveGroup.cjs +0 -68
- package/interactive/InteractiveGroup.js +0 -68
- package/interactive/SelectionBox.cjs +0 -134
- package/interactive/SelectionBox.js +0 -134
- package/interactive/SelectionHelper.cjs +0 -51
- package/interactive/SelectionHelper.js +0 -51
- package/libs/MeshoptDecoder.cjs +0 -221
- package/libs/MeshoptDecoder.js +0 -221
- package/libs/MotionControllers.cjs +0 -325
- package/libs/MotionControllers.js +0 -325
- package/lights/LightProbeGenerator.cjs +0 -145
- package/lights/LightProbeGenerator.js +0 -145
- package/lights/RectAreaLightUniformsLib.cjs +0 -32846
- package/lights/RectAreaLightUniformsLib.js +0 -32846
- package/lines/Line2.cjs +0 -13
- package/lines/Line2.js +0 -13
- package/lines/LineGeometry.cjs +0 -44
- package/lines/LineGeometry.js +0 -44
- package/lines/LineMaterial.cjs +0 -547
- package/lines/LineMaterial.js +0 -547
- package/lines/LineSegments2.cjs +0 -203
- package/lines/LineSegments2.js +0 -203
- package/lines/LineSegmentsGeometry.cjs +0 -124
- package/lines/LineSegmentsGeometry.js +0 -124
- package/lines/Wireframe.cjs +0 -32
- package/lines/Wireframe.js +0 -32
- package/lines/WireframeGeometry2.cjs +0 -13
- package/lines/WireframeGeometry2.js +0 -13
- package/loaders/3DMLoader.cjs +0 -803
- package/loaders/3DMLoader.js +0 -803
- package/loaders/3MFLoader.cjs +0 -854
- package/loaders/3MFLoader.js +0 -854
- package/loaders/AMFLoader.cjs +0 -284
- package/loaders/AMFLoader.js +0 -284
- package/loaders/AssimpLoader.cjs +0 -1434
- package/loaders/AssimpLoader.js +0 -1434
- package/loaders/BVHLoader.cjs +0 -207
- package/loaders/BVHLoader.js +0 -207
- package/loaders/BasisTextureLoader.cjs +0 -489
- package/loaders/BasisTextureLoader.js +0 -489
- package/loaders/ColladaLoader.cjs +0 -2405
- package/loaders/ColladaLoader.js +0 -2405
- package/loaders/DDSLoader.cjs +0 -148
- package/loaders/DDSLoader.js +0 -148
- package/loaders/DRACOLoader.cjs +0 -341
- package/loaders/DRACOLoader.js +0 -341
- package/loaders/EXRLoader.cjs +0 -1356
- package/loaders/EXRLoader.js +0 -1356
- package/loaders/FBXLoader.cjs +0 -2457
- package/loaders/FBXLoader.js +0 -2457
- package/loaders/FontLoader.cjs +0 -123
- package/loaders/FontLoader.js +0 -123
- package/loaders/GCodeLoader.cjs +0 -141
- package/loaders/GCodeLoader.js +0 -141
- package/loaders/GLTFLoader.cjs +0 -2504
- package/loaders/GLTFLoader.js +0 -2504
- package/loaders/HDRCubeTextureLoader.cjs +0 -75
- package/loaders/HDRCubeTextureLoader.js +0 -75
- package/loaders/KMZLoader.cjs +0 -75
- package/loaders/KMZLoader.js +0 -75
- package/loaders/KTX2Loader.cjs +0 -480
- package/loaders/KTX2Loader.js +0 -480
- package/loaders/KTXLoader.cjs +0 -93
- package/loaders/KTXLoader.js +0 -93
- package/loaders/LDrawLoader.cjs +0 -1424
- package/loaders/LDrawLoader.js +0 -1424
- package/loaders/LUT3dlLoader.cjs +0 -103
- package/loaders/LUT3dlLoader.js +0 -103
- package/loaders/LUTCubeLoader.cjs +0 -107
- package/loaders/LUTCubeLoader.js +0 -107
- package/loaders/LWOLoader.cjs +0 -645
- package/loaders/LWOLoader.js +0 -645
- package/loaders/LottieLoader.cjs +0 -47
- package/loaders/LottieLoader.js +0 -47
- package/loaders/MD2Loader.cjs +0 -359
- package/loaders/MD2Loader.js +0 -359
- package/loaders/MDDLoader.cjs +0 -58
- package/loaders/MDDLoader.js +0 -58
- package/loaders/MMDLoader.cjs +0 -1121
- package/loaders/MMDLoader.js +0 -1121
- package/loaders/MTLLoader.cjs +0 -304
- package/loaders/MTLLoader.js +0 -304
- package/loaders/NRRDLoader.cjs +0 -401
- package/loaders/NRRDLoader.js +0 -401
- package/loaders/OBJLoader.cjs +0 -487
- package/loaders/OBJLoader.js +0 -487
- package/loaders/PCDLoader.cjs +0 -248
- package/loaders/PCDLoader.js +0 -248
- package/loaders/PDBLoader.cjs +0 -247
- package/loaders/PDBLoader.js +0 -247
- package/loaders/PLYLoader.cjs +0 -317
- package/loaders/PLYLoader.js +0 -317
- package/loaders/PRWMLoader.cjs +0 -160
- package/loaders/PRWMLoader.js +0 -160
- package/loaders/PVRLoader.cjs +0 -131
- package/loaders/PVRLoader.js +0 -131
- package/loaders/RGBELoader.cjs +0 -252
- package/loaders/RGBELoader.js +0 -252
- package/loaders/RGBMLoader.cjs +0 -1004
- package/loaders/RGBMLoader.js +0 -1004
- package/loaders/STLLoader.cjs +0 -190
- package/loaders/STLLoader.js +0 -190
- package/loaders/SVGLoader.cjs +0 -1712
- package/loaders/SVGLoader.js +0 -1712
- package/loaders/TDSLoader.cjs +0 -650
- package/loaders/TDSLoader.js +0 -650
- package/loaders/TGALoader.cjs +0 -285
- package/loaders/TGALoader.js +0 -285
- package/loaders/TTFLoader.cjs +0 -131
- package/loaders/TTFLoader.js +0 -131
- package/loaders/TiltLoader.cjs +0 -375
- package/loaders/TiltLoader.js +0 -375
- package/loaders/VOXLoader.cjs +0 -432
- package/loaders/VOXLoader.js +0 -432
- package/loaders/VRMLLoader.cjs +0 -2105
- package/loaders/VRMLLoader.js +0 -2105
- package/loaders/VRMLoader.cjs +0 -38
- package/loaders/VRMLoader.js +0 -38
- package/loaders/VTKLoader.cjs +0 -648
- package/loaders/VTKLoader.js +0 -648
- package/loaders/XLoader.cjs +0 -1258
- package/loaders/XLoader.js +0 -1258
- package/loaders/XYZLoader.cjs +0 -60
- package/loaders/XYZLoader.js +0 -60
- package/loaders/lwo/IFFParser.cjs +0 -743
- package/loaders/lwo/IFFParser.js +0 -743
- package/loaders/lwo/LWO2Parser.cjs +0 -312
- package/loaders/lwo/LWO2Parser.js +0 -312
- package/loaders/lwo/LWO3Parser.cjs +0 -282
- package/loaders/lwo/LWO3Parser.js +0 -282
- package/math/Capsule.cjs +0 -98
- package/math/Capsule.js +0 -98
- package/math/ColorConverter.cjs +0 -42
- package/math/ColorConverter.js +0 -42
- package/math/ConvexHull.cjs +0 -596
- package/math/ConvexHull.js +0 -596
- package/math/ImprovedNoise.cjs +0 -304
- package/math/ImprovedNoise.js +0 -304
- package/math/Lut.cjs +0 -137
- package/math/Lut.js +0 -137
- package/math/MeshSurfaceSampler.cjs +0 -103
- package/math/MeshSurfaceSampler.js +0 -103
- package/math/OBB.cjs +0 -242
- package/math/OBB.js +0 -242
- package/math/Octree.cjs +0 -273
- package/math/Octree.js +0 -273
- package/math/SimplexNoise.cjs +0 -440
- package/math/SimplexNoise.js +0 -440
- package/misc/ConvexObjectBreaker.cjs +0 -292
- package/misc/ConvexObjectBreaker.js +0 -292
- package/misc/GPUComputationRenderer.cjs +0 -205
- package/misc/GPUComputationRenderer.js +0 -205
- package/misc/Gyroscope.cjs +0 -33
- package/misc/Gyroscope.js +0 -33
- package/misc/MD2Character.cjs +0 -167
- package/misc/MD2Character.js +0 -167
- package/misc/MD2CharacterComplex.cjs +0 -332
- package/misc/MD2CharacterComplex.js +0 -332
- package/misc/MorphAnimMesh.cjs +0 -40
- package/misc/MorphAnimMesh.js +0 -40
- package/misc/MorphBlendMesh.cjs +0 -179
- package/misc/MorphBlendMesh.js +0 -179
- package/misc/ProgressiveLightmap.cjs +0 -186
- package/misc/ProgressiveLightmap.js +0 -186
- package/misc/RollerCoaster.cjs +0 -353
- package/misc/RollerCoaster.js +0 -353
- package/misc/Timer.cjs +0 -101
- package/misc/Timer.js +0 -101
- package/misc/TubePainter.cjs +0 -123
- package/misc/TubePainter.js +0 -123
- package/misc/Volume.cjs +0 -305
- package/misc/Volume.js +0 -305
- package/misc/VolumeSlice.cjs +0 -114
- package/misc/VolumeSlice.js +0 -114
- package/misc/WebGL.cjs +0 -74
- package/misc/WebGL.js +0 -74
- package/modifiers/CurveModifier.cjs +0 -232
- package/modifiers/CurveModifier.js +0 -232
- package/modifiers/EdgeSplitModifier.cjs +0 -167
- package/modifiers/EdgeSplitModifier.js +0 -168
- package/modifiers/SimplifyModifier.cjs +0 -301
- package/modifiers/SimplifyModifier.js +0 -301
- package/modifiers/TessellateModifier.cjs +0 -214
- package/modifiers/TessellateModifier.js +0 -214
- package/objects/GroundProjectedEnv.cjs +0 -134
- package/objects/GroundProjectedEnv.js +0 -134
- package/objects/Lensflare.cjs +0 -291
- package/objects/Lensflare.js +0 -291
- package/objects/LightningStorm.cjs +0 -110
- package/objects/LightningStorm.js +0 -110
- package/objects/MarchingCubes.cjs +0 -4809
- package/objects/MarchingCubes.js +0 -4809
- package/objects/Reflector.cjs +0 -202
- package/objects/Reflector.js +0 -202
- package/objects/ReflectorForSSRPass.cjs +0 -260
- package/objects/ReflectorForSSRPass.js +0 -260
- package/objects/ReflectorRTT.cjs +0 -10
- package/objects/ReflectorRTT.js +0 -10
- package/objects/Refractor.cjs +0 -215
- package/objects/Refractor.js +0 -215
- package/objects/ShadowMesh.cjs +0 -45
- package/objects/ShadowMesh.js +0 -45
- package/objects/Sky.cjs +0 -200
- package/objects/Sky.js +0 -200
- package/objects/Water.cjs +0 -242
- package/objects/Water.js +0 -242
- package/objects/Water2.cjs +0 -256
- package/objects/Water2.js +0 -256
- package/physics/AmmoPhysics.cjs +0 -166
- package/physics/AmmoPhysics.js +0 -166
- package/postprocessing/AdaptiveToneMappingPass.cjs +0 -218
- package/postprocessing/AdaptiveToneMappingPass.js +0 -218
- package/postprocessing/AfterimagePass.cjs +0 -68
- package/postprocessing/AfterimagePass.js +0 -68
- package/postprocessing/BloomPass.cjs +0 -109
- package/postprocessing/BloomPass.js +0 -109
- package/postprocessing/BokehPass.cjs +0 -90
- package/postprocessing/BokehPass.js +0 -90
- package/postprocessing/ClearPass.cjs +0 -36
- package/postprocessing/ClearPass.js +0 -36
- package/postprocessing/CubeTexturePass.cjs +0 -53
- package/postprocessing/CubeTexturePass.js +0 -53
- package/postprocessing/DotScreenPass.cjs +0 -49
- package/postprocessing/DotScreenPass.js +0 -49
- package/postprocessing/EffectComposer.cjs +0 -157
- package/postprocessing/EffectComposer.js +0 -157
- package/postprocessing/FilmPass.cjs +0 -51
- package/postprocessing/FilmPass.js +0 -51
- package/postprocessing/GlitchPass.cjs +0 -84
- package/postprocessing/GlitchPass.js +0 -84
- package/postprocessing/HalftonePass.cjs +0 -53
- package/postprocessing/HalftonePass.js +0 -53
- package/postprocessing/LUTPass.cjs +0 -142
- package/postprocessing/LUTPass.js +0 -142
- package/postprocessing/MaskPass.cjs +0 -69
- package/postprocessing/MaskPass.js +0 -69
- package/postprocessing/OutlinePass.cjs +0 -479
- package/postprocessing/OutlinePass.js +0 -479
- package/postprocessing/Pass.cjs +0 -48
- package/postprocessing/Pass.js +0 -48
- package/postprocessing/RenderPass.cjs +0 -59
- package/postprocessing/RenderPass.js +0 -59
- package/postprocessing/RenderPixelatedPass.cjs +0 -199
- package/postprocessing/RenderPixelatedPass.js +0 -199
- package/postprocessing/SAOPass.cjs +0 -288
- package/postprocessing/SAOPass.js +0 -288
- package/postprocessing/SMAAPass.cjs +0 -112
- package/postprocessing/SMAAPass.js +0 -112
- package/postprocessing/SSAARenderPass.cjs +0 -189
- package/postprocessing/SSAARenderPass.js +0 -189
- package/postprocessing/SSAOPass.cjs +0 -272
- package/postprocessing/SSAOPass.js +0 -272
- package/postprocessing/SSRPass.cjs +0 -411
- package/postprocessing/SSRPass.js +0 -411
- package/postprocessing/SavePass.cjs +0 -38
- package/postprocessing/SavePass.js +0 -38
- package/postprocessing/ShaderPass.cjs +0 -49
- package/postprocessing/ShaderPass.js +0 -49
- package/postprocessing/TAARenderPass.cjs +0 -174
- package/postprocessing/TAARenderPass.js +0 -174
- package/postprocessing/TexturePass.cjs +0 -42
- package/postprocessing/TexturePass.js +0 -42
- package/postprocessing/UnrealBloomPass.cjs +0 -277
- package/postprocessing/UnrealBloomPass.js +0 -277
- package/postprocessing/WaterPass.cjs +0 -72
- package/postprocessing/WaterPass.js +0 -72
- package/renderers/CSS2DRenderer.cjs +0 -122
- package/renderers/CSS2DRenderer.js +0 -122
- package/renderers/CSS3DRenderer.cjs +0 -167
- package/renderers/CSS3DRenderer.js +0 -167
- package/renderers/Projector.cjs +0 -499
- package/renderers/Projector.js +0 -499
- package/renderers/SVGRenderer.cjs +0 -311
- package/renderers/SVGRenderer.js +0 -311
- package/shaders/ACESFilmicToneMappingShader.cjs +0 -55
- package/shaders/ACESFilmicToneMappingShader.js +0 -55
- package/shaders/AfterimageShader.cjs +0 -32
- package/shaders/AfterimageShader.js +0 -32
- package/shaders/BasicShader.cjs +0 -12
- package/shaders/BasicShader.js +0 -12
- package/shaders/BleachBypassShader.cjs +0 -35
- package/shaders/BleachBypassShader.js +0 -35
- package/shaders/BlendShader.cjs +0 -30
- package/shaders/BlendShader.js +0 -30
- package/shaders/BokehShader.cjs +0 -109
- package/shaders/BokehShader.js +0 -109
- package/shaders/BokehShader2.cjs +0 -269
- package/shaders/BokehShader2.js +0 -269
- package/shaders/BrightnessContrastShader.cjs +0 -32
- package/shaders/BrightnessContrastShader.js +0 -32
- package/shaders/ColorCorrectionShader.cjs +0 -30
- package/shaders/ColorCorrectionShader.js +0 -30
- package/shaders/ColorifyShader.cjs +0 -28
- package/shaders/ColorifyShader.js +0 -28
- package/shaders/ConvolutionShader.cjs +0 -55
- package/shaders/ConvolutionShader.js +0 -55
- package/shaders/CopyShader.cjs +0 -25
- package/shaders/CopyShader.js +0 -25
- package/shaders/DOFMipMapShader.cjs +0 -32
- package/shaders/DOFMipMapShader.js +0 -32
- package/shaders/DepthLimitedBlurShader.cjs +0 -114
- package/shaders/DepthLimitedBlurShader.js +0 -114
- package/shaders/DigitalGlitch.cjs +0 -85
- package/shaders/DigitalGlitch.js +0 -85
- package/shaders/DotScreenShader.cjs +0 -39
- package/shaders/DotScreenShader.js +0 -39
- package/shaders/FXAAShader.cjs +0 -1098
- package/shaders/FXAAShader.js +0 -1098
- package/shaders/FilmShader.cjs +0 -53
- package/shaders/FilmShader.js +0 -53
- package/shaders/FocusShader.cjs +0 -55
- package/shaders/FocusShader.js +0 -55
- package/shaders/FreiChenShader.cjs +0 -64
- package/shaders/FreiChenShader.js +0 -64
- package/shaders/FresnelShader.cjs +0 -47
- package/shaders/FresnelShader.js +0 -47
- package/shaders/GammaCorrectionShader.cjs +0 -23
- package/shaders/GammaCorrectionShader.js +0 -23
- package/shaders/GodRaysShader.cjs +0 -183
- package/shaders/GodRaysShader.js +0 -183
- package/shaders/HalftoneShader.cjs +0 -228
- package/shaders/HalftoneShader.js +0 -228
- package/shaders/HorizontalBlurShader.cjs +0 -49
- package/shaders/HorizontalBlurShader.js +0 -49
- package/shaders/HorizontalTiltShiftShader.cjs +0 -37
- package/shaders/HorizontalTiltShiftShader.js +0 -37
- package/shaders/HueSaturationShader.cjs +0 -43
- package/shaders/HueSaturationShader.js +0 -43
- package/shaders/KaleidoShader.cjs +0 -34
- package/shaders/KaleidoShader.js +0 -34
- package/shaders/LuminosityHighPassShader.cjs +0 -37
- package/shaders/LuminosityHighPassShader.js +0 -37
- package/shaders/LuminosityShader.cjs +0 -25
- package/shaders/LuminosityShader.js +0 -25
- package/shaders/MirrorShader.cjs +0 -35
- package/shaders/MirrorShader.js +0 -35
- package/shaders/NormalMapShader.cjs +0 -31
- package/shaders/NormalMapShader.js +0 -31
- package/shaders/ParallaxShader.cjs +0 -133
- package/shaders/ParallaxShader.js +0 -133
- package/shaders/PixelShader.cjs +0 -28
- package/shaders/PixelShader.js +0 -28
- package/shaders/RGBShiftShader.cjs +0 -30
- package/shaders/RGBShiftShader.js +0 -30
- package/shaders/SAOShader.cjs +0 -144
- package/shaders/SAOShader.js +0 -144
- package/shaders/SMAAShader.cjs +0 -358
- package/shaders/SMAAShader.js +0 -358
- package/shaders/SSAOShader.cjs +0 -182
- package/shaders/SSAOShader.js +0 -182
- package/shaders/SSRShader.cjs +0 -342
- package/shaders/SSRShader.js +0 -342
- package/shaders/SepiaShader.cjs +0 -29
- package/shaders/SepiaShader.js +0 -29
- package/shaders/SobelOperatorShader.cjs +0 -54
- package/shaders/SobelOperatorShader.js +0 -54
- package/shaders/SubsurfaceScatteringShader.cjs +0 -98
- package/shaders/SubsurfaceScatteringShader.js +0 -98
- package/shaders/TechnicolorShader.cjs +0 -24
- package/shaders/TechnicolorShader.js +0 -24
- package/shaders/ToneMapShader.cjs +0 -51
- package/shaders/ToneMapShader.js +0 -51
- package/shaders/ToonShader.cjs +0 -188
- package/shaders/ToonShader.js +0 -188
- package/shaders/TriangleBlurShader.cjs +0 -37
- package/shaders/TriangleBlurShader.js +0 -37
- package/shaders/UnpackDepthRGBAShader.cjs +0 -26
- package/shaders/UnpackDepthRGBAShader.js +0 -26
- package/shaders/VerticalBlurShader.cjs +0 -50
- package/shaders/VerticalBlurShader.js +0 -50
- package/shaders/VerticalTiltShiftShader.cjs +0 -37
- package/shaders/VerticalTiltShiftShader.js +0 -37
- package/shaders/VignetteShader.cjs +0 -38
- package/shaders/VignetteShader.js +0 -38
- package/shaders/VolumeShader.cjs +0 -225
- package/shaders/VolumeShader.js +0 -225
- package/shaders/WaterRefractionShader.cjs +0 -59
- package/shaders/WaterRefractionShader.js +0 -59
- package/shaders/types.cjs +0 -1
- package/shaders/types.js +0 -1
- package/textures/FlakesTexture.cjs +0 -30
- package/textures/FlakesTexture.js +0 -30
- package/types/helpers.cjs +0 -4
- package/types/helpers.js +0 -4
- package/utils/BufferGeometryUtils.cjs +0 -636
- package/utils/BufferGeometryUtils.js +0 -636
- package/utils/GeometryCompressionUtils.cjs +0 -573
- package/utils/GeometryCompressionUtils.js +0 -573
- package/utils/GeometryUtils.cjs +0 -109
- package/utils/GeometryUtils.js +0 -109
- package/utils/RoughnessMipmapper.cjs +0 -223
- package/utils/RoughnessMipmapper.js +0 -223
- package/utils/SceneUtils.cjs +0 -36
- package/utils/SceneUtils.js +0 -36
- package/utils/ShadowMapViewer.cjs +0 -111
- package/utils/ShadowMapViewer.js +0 -111
- package/utils/SkeletonUtils.cjs +0 -211
- package/utils/SkeletonUtils.js +0 -211
- package/utils/UVsDebug.cjs +0 -80
- package/utils/UVsDebug.js +0 -80
- package/utils/WorkerPool.cjs +0 -62
- package/utils/WorkerPool.js +0 -62
- package/webxr/ARButton.cjs +0 -119
- package/webxr/ARButton.js +0 -119
- package/webxr/OculusHandModel.cjs +0 -82
- package/webxr/OculusHandModel.js +0 -82
- package/webxr/OculusHandPointerModel.cjs +0 -241
- package/webxr/OculusHandPointerModel.js +0 -224
- package/webxr/Text2D.cjs +0 -48
- package/webxr/Text2D.js +0 -31
- package/webxr/VRButton.cjs +0 -111
- package/webxr/VRButton.js +0 -111
- package/webxr/XRControllerModelFactory.cjs +0 -174
- package/webxr/XRControllerModelFactory.js +0 -174
- package/webxr/XREstimatedLight.cjs +0 -126
- package/webxr/XREstimatedLight.js +0 -126
- package/webxr/XRHandMeshModel.cjs +0 -82
- package/webxr/XRHandMeshModel.js +0 -82
- package/webxr/XRHandModelFactory.cjs +0 -61
- package/webxr/XRHandModelFactory.js +0 -61
- package/webxr/XRHandPrimitiveModel.cjs +0 -68
- package/webxr/XRHandPrimitiveModel.js +0 -68
package/deprecated/Geometry.cjs
DELETED
@@ -1,971 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
3
|
-
const THREE = require("three");
|
4
|
-
const _m1 = /* @__PURE__ */ new THREE.Matrix4();
|
5
|
-
const _obj = /* @__PURE__ */ new THREE.Object3D();
|
6
|
-
const _offset = /* @__PURE__ */ new THREE.Vector3();
|
7
|
-
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));
|
19
|
-
}
|
20
|
-
if (geometry.boundingSphere !== null) {
|
21
|
-
buffergeometry.boundingSphere = geometry.boundingSphere.clone();
|
22
|
-
}
|
23
|
-
if (geometry.boundingBox !== null) {
|
24
|
-
buffergeometry.boundingBox = geometry.boundingBox.clone();
|
25
|
-
}
|
26
|
-
} else if (object.isMesh) {
|
27
|
-
buffergeometry = geometry.toBufferGeometry();
|
28
|
-
}
|
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);
|
61
|
-
}
|
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
|
-
}
|
68
|
-
}
|
69
|
-
if (this.boundingBox !== null) {
|
70
|
-
this.computeBoundingBox();
|
71
|
-
}
|
72
|
-
if (this.boundingSphere !== null) {
|
73
|
-
this.computeBoundingSphere();
|
74
|
-
}
|
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.");
|
116
|
-
return this;
|
117
|
-
}
|
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
|
-
}
|
167
|
-
}
|
168
|
-
}
|
169
|
-
} else {
|
170
|
-
if (index !== void 0) {
|
171
|
-
for (let i = 0; i < index.count; i += 3) {
|
172
|
-
addFace(index.getX(i), index.getX(i + 1), index.getX(i + 2));
|
173
|
-
}
|
174
|
-
} else {
|
175
|
-
for (let i = 0; i < position.count; i += 3) {
|
176
|
-
addFace(i, i + 1, i + 2);
|
177
|
-
}
|
178
|
-
}
|
179
|
-
}
|
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);
|
217
|
-
}
|
218
|
-
}
|
219
|
-
computeVertexNormals(areaWeighted = true) {
|
220
|
-
const vertices = new Array(this.vertices.length);
|
221
|
-
for (let v = 0, vl = this.vertices.length; v < vl; v++) {
|
222
|
-
vertices[v] = new THREE.Vector3();
|
223
|
-
}
|
224
|
-
if (areaWeighted) {
|
225
|
-
const cb = new THREE.Vector3(), ab = new THREE.Vector3();
|
226
|
-
for (let f = 0, fl = this.faces.length; f < fl; f++) {
|
227
|
-
const face = this.faces[f];
|
228
|
-
const vA = this.vertices[face.a];
|
229
|
-
const vB = this.vertices[face.b];
|
230
|
-
const vC = this.vertices[face.c];
|
231
|
-
cb.subVectors(vC, vB);
|
232
|
-
ab.subVectors(vA, vB);
|
233
|
-
cb.cross(ab);
|
234
|
-
vertices[face.a].add(cb);
|
235
|
-
vertices[face.b].add(cb);
|
236
|
-
vertices[face.c].add(cb);
|
237
|
-
}
|
238
|
-
} else {
|
239
|
-
this.computeFaceNormals();
|
240
|
-
for (let f = 0, fl = this.faces.length; f < fl; f++) {
|
241
|
-
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);
|
245
|
-
}
|
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();
|
261
|
-
}
|
262
|
-
}
|
263
|
-
if (this.faces.length > 0) {
|
264
|
-
this.normalsNeedUpdate = true;
|
265
|
-
}
|
266
|
-
}
|
267
|
-
computeFlatVertexNormals() {
|
268
|
-
this.computeFaceNormals();
|
269
|
-
for (let f = 0, fl = this.faces.length; f < fl; f++) {
|
270
|
-
const face = this.faces[f];
|
271
|
-
const vertexNormals = face.vertexNormals;
|
272
|
-
if (vertexNormals.length === 3) {
|
273
|
-
vertexNormals[0].copy(face.normal);
|
274
|
-
vertexNormals[1].copy(face.normal);
|
275
|
-
vertexNormals[2].copy(face.normal);
|
276
|
-
} else {
|
277
|
-
vertexNormals[0] = face.normal.clone();
|
278
|
-
vertexNormals[1] = face.normal.clone();
|
279
|
-
vertexNormals[2] = face.normal.clone();
|
280
|
-
}
|
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);
|
293
|
-
}
|
294
|
-
if (!face.__originalVertexNormals)
|
295
|
-
face.__originalVertexNormals = [];
|
296
|
-
for (let i = 0, il = face.vertexNormals.length; i < il; i++) {
|
297
|
-
if (!face.__originalVertexNormals[i]) {
|
298
|
-
face.__originalVertexNormals[i] = face.vertexNormals[i].clone();
|
299
|
-
} else {
|
300
|
-
face.__originalVertexNormals[i].copy(face.vertexNormals[i]);
|
301
|
-
}
|
302
|
-
}
|
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;
|
313
|
-
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();
|
328
|
-
for (let f = 0, fl = this.faces.length; f < fl; f++) {
|
329
|
-
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]);
|
336
|
-
}
|
337
|
-
}
|
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();
|
347
|
-
}
|
348
|
-
this.boundingBox.setFromPoints(this.vertices);
|
349
|
-
}
|
350
|
-
computeBoundingSphere() {
|
351
|
-
if (this.boundingSphere === null) {
|
352
|
-
this.boundingSphere = new THREE.Sphere();
|
353
|
-
}
|
354
|
-
this.boundingSphere.setFromPoints(this.vertices);
|
355
|
-
}
|
356
|
-
merge(geometry, matrix, materialIndexOffset = 0) {
|
357
|
-
if (!(geometry && geometry.isGeometry)) {
|
358
|
-
console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.", geometry);
|
359
|
-
return;
|
360
|
-
}
|
361
|
-
let normalMatrix;
|
362
|
-
const vertexOffset = this.vertices.length, vertices1 = this.vertices, vertices2 = geometry.vertices, faces1 = this.faces, faces2 = geometry.faces, colors1 = this.colors, colors2 = geometry.colors;
|
363
|
-
if (matrix !== void 0) {
|
364
|
-
normalMatrix = new THREE.Matrix3().getNormalMatrix(matrix);
|
365
|
-
}
|
366
|
-
for (let i = 0, il = vertices2.length; i < il; i++) {
|
367
|
-
const vertex = vertices2[i];
|
368
|
-
const vertexCopy = vertex.clone();
|
369
|
-
if (matrix !== void 0)
|
370
|
-
vertexCopy.applyMatrix4(matrix);
|
371
|
-
vertices1.push(vertexCopy);
|
372
|
-
}
|
373
|
-
for (let i = 0, il = colors2.length; i < il; i++) {
|
374
|
-
colors1.push(colors2[i].clone());
|
375
|
-
}
|
376
|
-
for (let i = 0, il = faces2.length; i < il; i++) {
|
377
|
-
const face = faces2[i];
|
378
|
-
let normal, color;
|
379
|
-
const faceVertexNormals = face.vertexNormals, faceVertexColors = face.vertexColors;
|
380
|
-
const faceCopy = new Face3(face.a + vertexOffset, face.b + vertexOffset, face.c + vertexOffset);
|
381
|
-
faceCopy.normal.copy(face.normal);
|
382
|
-
if (normalMatrix !== void 0) {
|
383
|
-
faceCopy.normal.applyMatrix3(normalMatrix).normalize();
|
384
|
-
}
|
385
|
-
for (let j = 0, jl = faceVertexNormals.length; j < jl; j++) {
|
386
|
-
normal = faceVertexNormals[j].clone();
|
387
|
-
if (normalMatrix !== void 0) {
|
388
|
-
normal.applyMatrix3(normalMatrix).normalize();
|
389
|
-
}
|
390
|
-
faceCopy.vertexNormals.push(normal);
|
391
|
-
}
|
392
|
-
faceCopy.color.copy(face.color);
|
393
|
-
for (let j = 0, jl = faceVertexColors.length; j < jl; j++) {
|
394
|
-
color = faceVertexColors[j];
|
395
|
-
faceCopy.vertexColors.push(color.clone());
|
396
|
-
}
|
397
|
-
faceCopy.materialIndex = face.materialIndex + materialIndexOffset;
|
398
|
-
faces1.push(faceCopy);
|
399
|
-
}
|
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());
|
408
|
-
}
|
409
|
-
this.faceVertexUvs[i].push(uvsCopy);
|
410
|
-
}
|
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]];
|
440
|
-
}
|
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;
|
453
|
-
}
|
454
|
-
}
|
455
|
-
}
|
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);
|
461
|
-
}
|
462
|
-
}
|
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;
|
494
|
-
if (newUvs1)
|
495
|
-
newUvs1.push(uvs1[id]);
|
496
|
-
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];
|
521
|
-
}
|
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]));
|
567
|
-
}
|
568
|
-
if (hasFaceColor) {
|
569
|
-
faces.push(getColorIndex(face.color));
|
570
|
-
}
|
571
|
-
if (hasFaceVertexColor) {
|
572
|
-
const vertexColors = face.vertexColors;
|
573
|
-
faces.push(getColorIndex(vertexColors[0]), getColorIndex(vertexColors[1]), getColorIndex(vertexColors[2]));
|
574
|
-
}
|
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];
|
583
|
-
}
|
584
|
-
normalsHash[hash] = normals.length / 3;
|
585
|
-
normals.push(normal.x, normal.y, normal.z);
|
586
|
-
return normalsHash[hash];
|
587
|
-
}
|
588
|
-
function getColorIndex(color) {
|
589
|
-
const hash = color.r.toString() + color.g.toString() + color.b.toString();
|
590
|
-
if (colorsHash[hash] !== void 0) {
|
591
|
-
return colorsHash[hash];
|
592
|
-
}
|
593
|
-
colorsHash[hash] = colors.length;
|
594
|
-
colors.push(color.getHex());
|
595
|
-
return colorsHash[hash];
|
596
|
-
}
|
597
|
-
function getUvIndex(uv) {
|
598
|
-
const hash = uv.x.toString() + uv.y.toString();
|
599
|
-
if (uvsHash[hash] !== void 0) {
|
600
|
-
return uvsHash[hash];
|
601
|
-
}
|
602
|
-
uvsHash[hash] = uvs.length / 2;
|
603
|
-
uvs.push(uv.x, uv.y);
|
604
|
-
return uvsHash[hash];
|
605
|
-
}
|
606
|
-
data.data = {};
|
607
|
-
data.data.vertices = vertices;
|
608
|
-
data.data.normals = normals;
|
609
|
-
if (colors.length > 0)
|
610
|
-
data.data.colors = colors;
|
611
|
-
if (uvs.length > 0)
|
612
|
-
data.data.uvs = [uvs];
|
613
|
-
data.data.faces = faces;
|
614
|
-
return data;
|
615
|
-
}
|
616
|
-
clone() {
|
617
|
-
return new Geometry().copy(this);
|
618
|
-
}
|
619
|
-
copy(source) {
|
620
|
-
this.vertices = [];
|
621
|
-
this.colors = [];
|
622
|
-
this.faces = [];
|
623
|
-
this.faceVertexUvs = [[]];
|
624
|
-
this.morphTargets = [];
|
625
|
-
this.morphNormals = [];
|
626
|
-
this.skinWeights = [];
|
627
|
-
this.skinIndices = [];
|
628
|
-
this.lineDistances = [];
|
629
|
-
this.boundingBox = null;
|
630
|
-
this.boundingSphere = null;
|
631
|
-
this.name = source.name;
|
632
|
-
const vertices = source.vertices;
|
633
|
-
for (let i = 0, il = vertices.length; i < il; i++) {
|
634
|
-
this.vertices.push(vertices[i].clone());
|
635
|
-
}
|
636
|
-
const colors = source.colors;
|
637
|
-
for (let i = 0, il = colors.length; i < il; i++) {
|
638
|
-
this.colors.push(colors[i].clone());
|
639
|
-
}
|
640
|
-
const faces = source.faces;
|
641
|
-
for (let i = 0, il = faces.length; i < il; i++) {
|
642
|
-
this.faces.push(faces[i].clone());
|
643
|
-
}
|
644
|
-
for (let i = 0, il = source.faceVertexUvs.length; i < il; i++) {
|
645
|
-
const faceVertexUvs = source.faceVertexUvs[i];
|
646
|
-
if (this.faceVertexUvs[i] === void 0) {
|
647
|
-
this.faceVertexUvs[i] = [];
|
648
|
-
}
|
649
|
-
for (let j = 0, jl = faceVertexUvs.length; j < jl; j++) {
|
650
|
-
const uvs = faceVertexUvs[j], uvsCopy = [];
|
651
|
-
for (let k = 0, kl = uvs.length; k < kl; k++) {
|
652
|
-
const uv = uvs[k];
|
653
|
-
uvsCopy.push(uv.clone());
|
654
|
-
}
|
655
|
-
this.faceVertexUvs[i].push(uvsCopy);
|
656
|
-
}
|
657
|
-
}
|
658
|
-
const morphTargets = source.morphTargets;
|
659
|
-
for (let i = 0, il = morphTargets.length; i < il; i++) {
|
660
|
-
const morphTarget = {};
|
661
|
-
morphTarget.name = morphTargets[i].name;
|
662
|
-
if (morphTargets[i].vertices !== void 0) {
|
663
|
-
morphTarget.vertices = [];
|
664
|
-
for (let j = 0, jl = morphTargets[i].vertices.length; j < jl; j++) {
|
665
|
-
morphTarget.vertices.push(morphTargets[i].vertices[j].clone());
|
666
|
-
}
|
667
|
-
}
|
668
|
-
if (morphTargets[i].normals !== void 0) {
|
669
|
-
morphTarget.normals = [];
|
670
|
-
for (let j = 0, jl = morphTargets[i].normals.length; j < jl; j++) {
|
671
|
-
morphTarget.normals.push(morphTargets[i].normals[j].clone());
|
672
|
-
}
|
673
|
-
}
|
674
|
-
this.morphTargets.push(morphTarget);
|
675
|
-
}
|
676
|
-
const morphNormals = source.morphNormals;
|
677
|
-
for (let i = 0, il = morphNormals.length; i < il; i++) {
|
678
|
-
const morphNormal = {};
|
679
|
-
if (morphNormals[i].vertexNormals !== void 0) {
|
680
|
-
morphNormal.vertexNormals = [];
|
681
|
-
for (let j = 0, jl = morphNormals[i].vertexNormals.length; j < jl; j++) {
|
682
|
-
const srcVertexNormal = morphNormals[i].vertexNormals[j];
|
683
|
-
const destVertexNormal = {};
|
684
|
-
destVertexNormal.a = srcVertexNormal.a.clone();
|
685
|
-
destVertexNormal.b = srcVertexNormal.b.clone();
|
686
|
-
destVertexNormal.c = srcVertexNormal.c.clone();
|
687
|
-
morphNormal.vertexNormals.push(destVertexNormal);
|
688
|
-
}
|
689
|
-
}
|
690
|
-
if (morphNormals[i].faceNormals !== void 0) {
|
691
|
-
morphNormal.faceNormals = [];
|
692
|
-
for (let j = 0, jl = morphNormals[i].faceNormals.length; j < jl; j++) {
|
693
|
-
morphNormal.faceNormals.push(morphNormals[i].faceNormals[j].clone());
|
694
|
-
}
|
695
|
-
}
|
696
|
-
this.morphNormals.push(morphNormal);
|
697
|
-
}
|
698
|
-
const skinWeights = source.skinWeights;
|
699
|
-
for (let i = 0, il = skinWeights.length; i < il; i++) {
|
700
|
-
this.skinWeights.push(skinWeights[i].clone());
|
701
|
-
}
|
702
|
-
const skinIndices = source.skinIndices;
|
703
|
-
for (let i = 0, il = skinIndices.length; i < il; i++) {
|
704
|
-
this.skinIndices.push(skinIndices[i].clone());
|
705
|
-
}
|
706
|
-
const lineDistances = source.lineDistances;
|
707
|
-
for (let i = 0, il = lineDistances.length; i < il; i++) {
|
708
|
-
this.lineDistances.push(lineDistances[i]);
|
709
|
-
}
|
710
|
-
const boundingBox = source.boundingBox;
|
711
|
-
if (boundingBox !== null) {
|
712
|
-
this.boundingBox = boundingBox.clone();
|
713
|
-
}
|
714
|
-
const boundingSphere = source.boundingSphere;
|
715
|
-
if (boundingSphere !== null) {
|
716
|
-
this.boundingSphere = boundingSphere.clone();
|
717
|
-
}
|
718
|
-
this.elementsNeedUpdate = source.elementsNeedUpdate;
|
719
|
-
this.verticesNeedUpdate = source.verticesNeedUpdate;
|
720
|
-
this.uvsNeedUpdate = source.uvsNeedUpdate;
|
721
|
-
this.normalsNeedUpdate = source.normalsNeedUpdate;
|
722
|
-
this.colorsNeedUpdate = source.colorsNeedUpdate;
|
723
|
-
this.lineDistancesNeedUpdate = source.lineDistancesNeedUpdate;
|
724
|
-
this.groupsNeedUpdate = source.groupsNeedUpdate;
|
725
|
-
return this;
|
726
|
-
}
|
727
|
-
toBufferGeometry() {
|
728
|
-
const geometry = new DirectGeometry().fromGeometry(this);
|
729
|
-
const buffergeometry = new THREE.BufferGeometry();
|
730
|
-
const positions = new Float32Array(geometry.vertices.length * 3);
|
731
|
-
buffergeometry.setAttribute("position", new THREE.BufferAttribute(positions, 3).copyVector3sArray(geometry.vertices));
|
732
|
-
if (geometry.normals.length > 0) {
|
733
|
-
const normals = new Float32Array(geometry.normals.length * 3);
|
734
|
-
buffergeometry.setAttribute("normal", new THREE.BufferAttribute(normals, 3).copyVector3sArray(geometry.normals));
|
735
|
-
}
|
736
|
-
if (geometry.colors.length > 0) {
|
737
|
-
const colors = new Float32Array(geometry.colors.length * 3);
|
738
|
-
buffergeometry.setAttribute("color", new THREE.BufferAttribute(colors, 3).copyColorsArray(geometry.colors));
|
739
|
-
}
|
740
|
-
if (geometry.uvs.length > 0) {
|
741
|
-
const uvs = new Float32Array(geometry.uvs.length * 2);
|
742
|
-
buffergeometry.setAttribute("uv", new THREE.BufferAttribute(uvs, 2).copyVector2sArray(geometry.uvs));
|
743
|
-
}
|
744
|
-
if (geometry.uvs2.length > 0) {
|
745
|
-
const uvs2 = new Float32Array(geometry.uvs2.length * 2);
|
746
|
-
buffergeometry.setAttribute("uv2", new THREE.BufferAttribute(uvs2, 2).copyVector2sArray(geometry.uvs2));
|
747
|
-
}
|
748
|
-
buffergeometry.groups = geometry.groups;
|
749
|
-
for (let name in geometry.morphTargets) {
|
750
|
-
const array = [];
|
751
|
-
const morphTargets = geometry.morphTargets[name];
|
752
|
-
for (let i = 0, l = morphTargets.length; i < l; i++) {
|
753
|
-
const morphTarget = morphTargets[i];
|
754
|
-
const attribute = new THREE.Float32BufferAttribute(morphTarget.data.length * 3, 3);
|
755
|
-
attribute.name = morphTarget.name;
|
756
|
-
array.push(attribute.copyVector3sArray(morphTarget.data));
|
757
|
-
}
|
758
|
-
buffergeometry.morphAttributes[name] = array;
|
759
|
-
}
|
760
|
-
if (geometry.skinIndices.length > 0) {
|
761
|
-
const skinIndices = new THREE.Float32BufferAttribute(geometry.skinIndices.length * 4, 4);
|
762
|
-
buffergeometry.setAttribute("skinIndex", skinIndices.copyVector4sArray(geometry.skinIndices));
|
763
|
-
}
|
764
|
-
if (geometry.skinWeights.length > 0) {
|
765
|
-
const skinWeights = new THREE.Float32BufferAttribute(geometry.skinWeights.length * 4, 4);
|
766
|
-
buffergeometry.setAttribute("skinWeight", skinWeights.copyVector4sArray(geometry.skinWeights));
|
767
|
-
}
|
768
|
-
if (geometry.boundingSphere !== null) {
|
769
|
-
buffergeometry.boundingSphere = geometry.boundingSphere.clone();
|
770
|
-
}
|
771
|
-
if (geometry.boundingBox !== null) {
|
772
|
-
buffergeometry.boundingBox = geometry.boundingBox.clone();
|
773
|
-
}
|
774
|
-
return buffergeometry;
|
775
|
-
}
|
776
|
-
computeTangents() {
|
777
|
-
console.error("THREE.Geometry: .computeTangents() has been removed.");
|
778
|
-
}
|
779
|
-
computeLineDistances() {
|
780
|
-
console.error(
|
781
|
-
"THREE.Geometry: .computeLineDistances() has been removed. Use THREE.Line.computeLineDistances() instead."
|
782
|
-
);
|
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
|
-
}
|
791
|
-
}
|
792
|
-
class DirectGeometry {
|
793
|
-
constructor() {
|
794
|
-
this.vertices = [];
|
795
|
-
this.normals = [];
|
796
|
-
this.colors = [];
|
797
|
-
this.uvs = [];
|
798
|
-
this.uvs2 = [];
|
799
|
-
this.groups = [];
|
800
|
-
this.morphTargets = {};
|
801
|
-
this.skinWeights = [];
|
802
|
-
this.skinIndices = [];
|
803
|
-
this.boundingBox = null;
|
804
|
-
this.boundingSphere = null;
|
805
|
-
this.verticesNeedUpdate = false;
|
806
|
-
this.normalsNeedUpdate = false;
|
807
|
-
this.colorsNeedUpdate = false;
|
808
|
-
this.uvsNeedUpdate = false;
|
809
|
-
this.groupsNeedUpdate = false;
|
810
|
-
}
|
811
|
-
computeGroups(geometry) {
|
812
|
-
const groups = [];
|
813
|
-
let group, i;
|
814
|
-
let materialIndex = void 0;
|
815
|
-
const faces = geometry.faces;
|
816
|
-
for (i = 0; i < faces.length; i++) {
|
817
|
-
const face = faces[i];
|
818
|
-
if (face.materialIndex !== materialIndex) {
|
819
|
-
materialIndex = face.materialIndex;
|
820
|
-
if (group !== void 0) {
|
821
|
-
group.count = i * 3 - group.start;
|
822
|
-
groups.push(group);
|
823
|
-
}
|
824
|
-
group = {
|
825
|
-
start: i * 3,
|
826
|
-
materialIndex
|
827
|
-
};
|
828
|
-
}
|
829
|
-
}
|
830
|
-
if (group !== void 0) {
|
831
|
-
group.count = i * 3 - group.start;
|
832
|
-
groups.push(group);
|
833
|
-
}
|
834
|
-
this.groups = groups;
|
835
|
-
}
|
836
|
-
fromGeometry(geometry) {
|
837
|
-
const faces = geometry.faces;
|
838
|
-
const vertices = geometry.vertices;
|
839
|
-
const faceVertexUvs = geometry.faceVertexUvs;
|
840
|
-
const hasFaceVertexUv = faceVertexUvs[0] && faceVertexUvs[0].length > 0;
|
841
|
-
const hasFaceVertexUv2 = faceVertexUvs[1] && faceVertexUvs[1].length > 0;
|
842
|
-
const morphTargets = geometry.morphTargets;
|
843
|
-
const morphTargetsLength = morphTargets.length;
|
844
|
-
let morphTargetsPosition;
|
845
|
-
if (morphTargetsLength > 0) {
|
846
|
-
morphTargetsPosition = [];
|
847
|
-
for (let i = 0; i < morphTargetsLength; i++) {
|
848
|
-
morphTargetsPosition[i] = {
|
849
|
-
name: morphTargets[i].name,
|
850
|
-
data: []
|
851
|
-
};
|
852
|
-
}
|
853
|
-
this.morphTargets.position = morphTargetsPosition;
|
854
|
-
}
|
855
|
-
const morphNormals = geometry.morphNormals;
|
856
|
-
const morphNormalsLength = morphNormals.length;
|
857
|
-
let morphTargetsNormal;
|
858
|
-
if (morphNormalsLength > 0) {
|
859
|
-
morphTargetsNormal = [];
|
860
|
-
for (let i = 0; i < morphNormalsLength; i++) {
|
861
|
-
morphTargetsNormal[i] = {
|
862
|
-
name: morphNormals[i].name,
|
863
|
-
data: []
|
864
|
-
};
|
865
|
-
}
|
866
|
-
this.morphTargets.normal = morphTargetsNormal;
|
867
|
-
}
|
868
|
-
const skinIndices = geometry.skinIndices;
|
869
|
-
const skinWeights = geometry.skinWeights;
|
870
|
-
const hasSkinIndices = skinIndices.length === vertices.length;
|
871
|
-
const hasSkinWeights = skinWeights.length === vertices.length;
|
872
|
-
if (vertices.length > 0 && faces.length === 0) {
|
873
|
-
console.error("THREE.DirectGeometry: Faceless geometries are not supported.");
|
874
|
-
}
|
875
|
-
for (let i = 0; i < faces.length; i++) {
|
876
|
-
const face = faces[i];
|
877
|
-
this.vertices.push(vertices[face.a], vertices[face.b], vertices[face.c]);
|
878
|
-
const vertexNormals = face.vertexNormals;
|
879
|
-
if (vertexNormals.length === 3) {
|
880
|
-
this.normals.push(vertexNormals[0], vertexNormals[1], vertexNormals[2]);
|
881
|
-
} else {
|
882
|
-
const normal = face.normal;
|
883
|
-
this.normals.push(normal, normal, normal);
|
884
|
-
}
|
885
|
-
const vertexColors = face.vertexColors;
|
886
|
-
if (vertexColors.length === 3) {
|
887
|
-
this.colors.push(vertexColors[0], vertexColors[1], vertexColors[2]);
|
888
|
-
} else {
|
889
|
-
const color = face.color;
|
890
|
-
this.colors.push(color, color, color);
|
891
|
-
}
|
892
|
-
if (hasFaceVertexUv === true) {
|
893
|
-
const vertexUvs = faceVertexUvs[0][i];
|
894
|
-
if (vertexUvs !== void 0) {
|
895
|
-
this.uvs.push(vertexUvs[0], vertexUvs[1], vertexUvs[2]);
|
896
|
-
} else {
|
897
|
-
console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ", i);
|
898
|
-
this.uvs.push(new THREE.Vector2(), new THREE.Vector2(), new THREE.Vector2());
|
899
|
-
}
|
900
|
-
}
|
901
|
-
if (hasFaceVertexUv2 === true) {
|
902
|
-
const vertexUvs = faceVertexUvs[1][i];
|
903
|
-
if (vertexUvs !== void 0) {
|
904
|
-
this.uvs2.push(vertexUvs[0], vertexUvs[1], vertexUvs[2]);
|
905
|
-
} else {
|
906
|
-
console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ", i);
|
907
|
-
this.uvs2.push(new THREE.Vector2(), new THREE.Vector2(), new THREE.Vector2());
|
908
|
-
}
|
909
|
-
}
|
910
|
-
for (let j = 0; j < morphTargetsLength; j++) {
|
911
|
-
const morphTarget = morphTargets[j].vertices;
|
912
|
-
morphTargetsPosition[j].data.push(morphTarget[face.a], morphTarget[face.b], morphTarget[face.c]);
|
913
|
-
}
|
914
|
-
for (let j = 0; j < morphNormalsLength; j++) {
|
915
|
-
const morphNormal = morphNormals[j].vertexNormals[i];
|
916
|
-
morphTargetsNormal[j].data.push(morphNormal.a, morphNormal.b, morphNormal.c);
|
917
|
-
}
|
918
|
-
if (hasSkinIndices) {
|
919
|
-
this.skinIndices.push(skinIndices[face.a], skinIndices[face.b], skinIndices[face.c]);
|
920
|
-
}
|
921
|
-
if (hasSkinWeights) {
|
922
|
-
this.skinWeights.push(skinWeights[face.a], skinWeights[face.b], skinWeights[face.c]);
|
923
|
-
}
|
924
|
-
}
|
925
|
-
this.computeGroups(geometry);
|
926
|
-
this.verticesNeedUpdate = geometry.verticesNeedUpdate;
|
927
|
-
this.normalsNeedUpdate = geometry.normalsNeedUpdate;
|
928
|
-
this.colorsNeedUpdate = geometry.colorsNeedUpdate;
|
929
|
-
this.uvsNeedUpdate = geometry.uvsNeedUpdate;
|
930
|
-
this.groupsNeedUpdate = geometry.groupsNeedUpdate;
|
931
|
-
if (geometry.boundingSphere !== null) {
|
932
|
-
this.boundingSphere = geometry.boundingSphere.clone();
|
933
|
-
}
|
934
|
-
if (geometry.boundingBox !== null) {
|
935
|
-
this.boundingBox = geometry.boundingBox.clone();
|
936
|
-
}
|
937
|
-
return this;
|
938
|
-
}
|
939
|
-
}
|
940
|
-
class Face3 {
|
941
|
-
constructor(a, b, c, normal, color, materialIndex = 0) {
|
942
|
-
this.a = a;
|
943
|
-
this.b = b;
|
944
|
-
this.c = c;
|
945
|
-
this.normal = normal && normal.isVector3 ? normal : new THREE.Vector3();
|
946
|
-
this.vertexNormals = Array.isArray(normal) ? normal : [];
|
947
|
-
this.color = color && color.isColor ? color : new THREE.Color();
|
948
|
-
this.vertexColors = Array.isArray(color) ? color : [];
|
949
|
-
this.materialIndex = materialIndex;
|
950
|
-
}
|
951
|
-
clone() {
|
952
|
-
return new this.constructor().copy(this);
|
953
|
-
}
|
954
|
-
copy(source) {
|
955
|
-
this.a = source.a;
|
956
|
-
this.b = source.b;
|
957
|
-
this.c = source.c;
|
958
|
-
this.normal.copy(source.normal);
|
959
|
-
this.color.copy(source.color);
|
960
|
-
this.materialIndex = source.materialIndex;
|
961
|
-
for (let i = 0, il = source.vertexNormals.length; i < il; i++) {
|
962
|
-
this.vertexNormals[i] = source.vertexNormals[i].clone();
|
963
|
-
}
|
964
|
-
for (let i = 0, il = source.vertexColors.length; i < il; i++) {
|
965
|
-
this.vertexColors[i] = source.vertexColors[i].clone();
|
966
|
-
}
|
967
|
-
return this;
|
968
|
-
}
|
969
|
-
}
|
970
|
-
exports.Face3 = Face3;
|
971
|
-
exports.Geometry = Geometry;
|