three-stdlib 2.22.10 → 2.23.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_polyfill/CompressedArrayTexture.cjs +12 -0
- package/dist/_polyfill/CompressedArrayTexture.js +6 -6
- package/dist/_polyfill/Data3DTexture.cjs +17 -0
- package/dist/_polyfill/Data3DTexture.js +8 -8
- package/dist/animation/{AnimationClipCreator.mjs → AnimationClipCreator.cjs} +18 -18
- package/dist/animation/AnimationClipCreator.js +18 -18
- package/dist/animation/{CCDIKSolver.mjs → CCDIKSolver.cjs} +32 -32
- package/dist/animation/CCDIKSolver.js +32 -32
- package/dist/animation/{MMDAnimationHelper.mjs → MMDAnimationHelper.cjs} +17 -17
- package/dist/animation/MMDAnimationHelper.js +17 -17
- package/dist/animation/{MMDPhysics.mjs → MMDPhysics.cjs} +25 -25
- package/dist/animation/MMDPhysics.js +25 -25
- package/dist/cameras/{CinematicCamera.mjs → CinematicCamera.cjs} +17 -17
- package/dist/cameras/CinematicCamera.js +17 -17
- package/dist/controls/{ArcballControls.mjs → ArcballControls.cjs} +102 -102
- package/dist/controls/ArcballControls.js +102 -102
- package/dist/controls/{DeviceOrientationControls.mjs → DeviceOrientationControls.cjs} +14 -14
- package/dist/controls/DeviceOrientationControls.js +14 -14
- package/dist/controls/{DragControls.mjs → DragControls.cjs} +12 -12
- package/dist/controls/DragControls.js +12 -12
- package/dist/controls/{FirstPersonControls.mjs → FirstPersonControls.cjs} +16 -16
- package/dist/controls/FirstPersonControls.js +16 -16
- package/dist/controls/{FlyControls.mjs → FlyControls.cjs} +10 -10
- package/dist/controls/FlyControls.js +10 -10
- package/dist/controls/{OrbitControls.mjs → OrbitControls.cjs} +52 -54
- package/dist/controls/OrbitControls.d.ts +4 -4
- package/dist/controls/OrbitControls.js +52 -54
- package/dist/controls/{PointerLockControls.mjs → PointerLockControls.cjs} +8 -8
- package/dist/controls/PointerLockControls.js +8 -8
- package/dist/controls/{TrackballControls.mjs → TrackballControls.cjs} +32 -32
- package/dist/controls/TrackballControls.d.ts +2 -2
- package/dist/controls/TrackballControls.js +32 -32
- package/dist/controls/{TransformControls.mjs → TransformControls.cjs} +169 -169
- package/dist/controls/TransformControls.js +169 -169
- package/dist/controls/experimental/{CameraControls.mjs → CameraControls.cjs} +59 -59
- package/dist/controls/experimental/CameraControls.js +59 -59
- package/dist/csm/{CSM.mjs → CSM.cjs} +17 -17
- package/dist/csm/CSM.js +17 -17
- package/dist/csm/{CSMFrustum.mjs → CSMFrustum.cjs} +7 -7
- package/dist/csm/CSMFrustum.js +7 -7
- package/dist/csm/{CSMHelper.mjs → CSMHelper.cjs} +14 -14
- package/dist/csm/CSMHelper.js +14 -14
- package/dist/csm/{CSMShader.mjs → CSMShader.cjs} +5 -5
- package/dist/csm/CSMShader.js +5 -5
- package/dist/curves/{CurveExtras.mjs → CurveExtras.cjs} +45 -45
- package/dist/curves/CurveExtras.js +45 -45
- package/dist/curves/{NURBSCurve.mjs → NURBSCurve.cjs} +11 -11
- package/dist/curves/NURBSCurve.js +11 -11
- package/dist/curves/{NURBSSurface.mjs → NURBSSurface.cjs} +7 -7
- package/dist/curves/NURBSSurface.js +7 -7
- package/dist/curves/{NURBSUtils.mjs → NURBSUtils.cjs} +17 -17
- package/dist/curves/NURBSUtils.js +17 -17
- package/dist/deprecated/{Geometry.mjs → Geometry.cjs} +51 -51
- package/dist/deprecated/Geometry.js +51 -51
- package/dist/effects/{AnaglyphEffect.mjs → AnaglyphEffect.cjs} +14 -14
- package/dist/effects/AnaglyphEffect.js +14 -14
- package/dist/effects/{AsciiEffect.mjs → AsciiEffect.cjs} +3 -3
- package/dist/effects/AsciiEffect.js +3 -3
- package/dist/effects/{OutlineEffect.mjs → OutlineEffect.cjs} +8 -8
- package/dist/effects/OutlineEffect.js +8 -8
- package/dist/effects/{ParallaxBarrierEffect.mjs → ParallaxBarrierEffect.cjs} +12 -12
- package/dist/effects/ParallaxBarrierEffect.js +12 -12
- package/dist/effects/{PeppersGhostEffect.mjs → PeppersGhostEffect.cjs} +11 -11
- package/dist/effects/PeppersGhostEffect.js +11 -11
- package/dist/effects/{StereoEffect.mjs → StereoEffect.cjs} +6 -6
- package/dist/effects/StereoEffect.js +6 -6
- package/dist/environments/RoomEnvironment.cjs +95 -0
- package/dist/environments/RoomEnvironment.js +23 -40
- package/dist/exporters/{ColladaExporter.mjs → ColladaExporter.cjs} +16 -16
- package/dist/exporters/ColladaExporter.js +16 -16
- package/dist/exporters/{DRACOExporter.mjs → DRACOExporter.cjs} +8 -8
- package/dist/exporters/DRACOExporter.js +8 -8
- package/dist/exporters/{GLTFExporter.mjs → GLTFExporter.cjs} +52 -49
- package/dist/exporters/GLTFExporter.js +52 -49
- package/dist/exporters/{MMDExporter.mjs → MMDExporter.cjs} +10 -10
- package/dist/exporters/MMDExporter.js +10 -10
- package/dist/exporters/{OBJExporter.mjs → OBJExporter.cjs} +13 -13
- package/dist/exporters/OBJExporter.js +13 -13
- package/dist/exporters/{PLYExporter.mjs → PLYExporter.cjs} +8 -8
- package/dist/exporters/PLYExporter.js +8 -8
- package/dist/exporters/{STLExporter.mjs → STLExporter.cjs} +12 -12
- package/dist/exporters/STLExporter.js +12 -12
- package/dist/exporters/{USDZExporter.mjs → USDZExporter.cjs} +10 -10
- package/dist/exporters/USDZExporter.js +10 -10
- package/dist/geometries/{BoxLineGeometry.mjs → BoxLineGeometry.cjs} +6 -6
- package/dist/geometries/BoxLineGeometry.js +6 -6
- package/dist/geometries/ConvexGeometry.cjs +26 -0
- package/dist/geometries/ConvexGeometry.js +9 -9
- package/dist/geometries/{DecalGeometry.mjs → DecalGeometry.cjs} +16 -16
- package/dist/geometries/DecalGeometry.js +16 -16
- package/dist/geometries/{LightningStrike.mjs → LightningStrike.cjs} +45 -45
- package/dist/geometries/LightningStrike.js +45 -45
- package/dist/geometries/{ParametricGeometries.mjs → ParametricGeometries.cjs} +11 -11
- package/dist/geometries/ParametricGeometries.js +11 -11
- package/dist/geometries/{ParametricGeometry.mjs → ParametricGeometry.cjs} +11 -11
- package/dist/geometries/ParametricGeometry.js +11 -11
- package/dist/geometries/{RoundedBoxGeometry.mjs → RoundedBoxGeometry.cjs} +10 -10
- package/dist/geometries/RoundedBoxGeometry.js +10 -10
- package/dist/geometries/{TeapotGeometry.mjs → TeapotGeometry.cjs} +21 -21
- package/dist/geometries/TeapotGeometry.js +21 -21
- package/dist/geometries/{TextGeometry.mjs → TextGeometry.cjs} +6 -6
- package/dist/geometries/TextGeometry.js +6 -6
- package/dist/helpers/{LightProbeHelper.mjs → LightProbeHelper.cjs} +7 -7
- package/dist/helpers/LightProbeHelper.js +7 -7
- package/dist/helpers/{PositionalAudioHelper.mjs → PositionalAudioHelper.cjs} +11 -11
- package/dist/helpers/PositionalAudioHelper.js +11 -11
- package/dist/helpers/{RectAreaLightHelper.mjs → RectAreaLightHelper.cjs} +11 -11
- package/dist/helpers/RectAreaLightHelper.js +11 -11
- package/dist/helpers/{VertexNormalsHelper.mjs → VertexNormalsHelper.cjs} +11 -11
- package/dist/helpers/VertexNormalsHelper.js +11 -11
- package/dist/helpers/{VertexTangentsHelper.mjs → VertexTangentsHelper.cjs} +10 -10
- package/dist/helpers/VertexTangentsHelper.js +10 -10
- package/dist/index.cjs +613 -0
- package/dist/index.js +613 -613
- package/dist/interactive/{HTMLMesh.mjs → HTMLMesh.cjs} +11 -11
- package/dist/interactive/HTMLMesh.js +11 -11
- package/dist/interactive/{InteractiveGroup.mjs → InteractiveGroup.cjs} +8 -8
- package/dist/interactive/InteractiveGroup.js +8 -8
- package/dist/interactive/{SelectionBox.mjs → SelectionBox.cjs} +21 -21
- package/dist/interactive/SelectionBox.js +21 -21
- package/dist/interactive/{SelectionHelper.mjs → SelectionHelper.cjs} +7 -7
- package/dist/interactive/SelectionHelper.js +7 -7
- package/dist/libs/{MeshoptDecoder.mjs → MeshoptDecoder.cjs} +3 -3
- package/dist/libs/MeshoptDecoder.js +3 -3
- package/dist/libs/{MotionControllers.mjs → MotionControllers.cjs} +6 -6
- package/dist/libs/MotionControllers.js +6 -6
- package/dist/lights/{LightProbeGenerator.mjs → LightProbeGenerator.cjs} +16 -16
- package/dist/lights/LightProbeGenerator.js +16 -16
- package/dist/lights/{RectAreaLightUniformsLib.mjs → RectAreaLightUniformsLib.cjs} +42 -42
- package/dist/lights/RectAreaLightUniformsLib.js +42 -42
- package/dist/lines/Line2.cjs +13 -0
- package/dist/lines/Line2.js +8 -8
- package/dist/lines/{LineGeometry.mjs → LineGeometry.cjs} +5 -5
- package/dist/lines/LineGeometry.js +5 -5
- package/dist/lines/{LineMaterial.mjs → LineMaterial.cjs} +10 -10
- package/dist/lines/LineMaterial.js +10 -10
- package/dist/lines/{LineSegments2.mjs → LineSegments2.cjs} +28 -28
- package/dist/lines/LineSegments2.js +28 -28
- package/dist/lines/{LineSegmentsGeometry.mjs → LineSegmentsGeometry.cjs} +18 -18
- package/dist/lines/LineSegmentsGeometry.js +18 -18
- package/dist/lines/Wireframe.cjs +32 -0
- package/dist/lines/Wireframe.js +13 -13
- package/dist/lines/WireframeGeometry2.cjs +13 -0
- package/dist/lines/WireframeGeometry2.js +7 -7
- package/dist/loaders/{3DMLoader.mjs → 3DMLoader.cjs} +37 -37
- package/dist/loaders/3DMLoader.js +37 -37
- package/dist/loaders/{3MFLoader.mjs → 3MFLoader.cjs} +53 -53
- package/dist/loaders/3MFLoader.js +53 -53
- package/dist/loaders/{AMFLoader.mjs → AMFLoader.cjs} +19 -19
- package/dist/loaders/AMFLoader.js +19 -19
- package/dist/loaders/{AssimpLoader.mjs → AssimpLoader.cjs} +41 -41
- package/dist/loaders/AssimpLoader.js +41 -41
- package/dist/loaders/{BVHLoader.mjs → BVHLoader.cjs} +18 -18
- package/dist/loaders/BVHLoader.js +18 -18
- package/dist/loaders/{BasisTextureLoader.mjs → BasisTextureLoader.cjs} +22 -22
- package/dist/loaders/BasisTextureLoader.js +22 -22
- package/dist/loaders/{ColladaLoader.mjs → ColladaLoader.cjs} +76 -76
- package/dist/loaders/ColladaLoader.js +76 -76
- package/dist/loaders/{DDSLoader.mjs → DDSLoader.cjs} +10 -10
- package/dist/loaders/DDSLoader.js +10 -10
- package/dist/loaders/{DRACOLoader.mjs → DRACOLoader.cjs} +12 -12
- package/dist/loaders/DRACOLoader.js +12 -12
- package/dist/loaders/{EXRLoader.mjs → EXRLoader.cjs} +23 -23
- package/dist/loaders/EXRLoader.js +23 -23
- package/dist/loaders/{FBXLoader.mjs → FBXLoader.cjs} +116 -116
- package/dist/loaders/FBXLoader.js +116 -116
- package/dist/loaders/{FontLoader.mjs → FontLoader.cjs} +9 -9
- package/dist/loaders/FontLoader.js +9 -9
- package/dist/loaders/{GCodeLoader.mjs → GCodeLoader.cjs} +13 -13
- package/dist/loaders/GCodeLoader.js +13 -13
- package/dist/loaders/{GLTFLoader.mjs → GLTFLoader.cjs} +112 -112
- package/dist/loaders/GLTFLoader.js +112 -112
- package/dist/loaders/{HDRCubeTextureLoader.mjs → HDRCubeTextureLoader.cjs} +15 -15
- package/dist/loaders/HDRCubeTextureLoader.js +15 -15
- package/dist/loaders/{KMZLoader.mjs → KMZLoader.cjs} +13 -13
- package/dist/loaders/KMZLoader.js +13 -13
- package/dist/loaders/{KTX2Loader.mjs → KTX2Loader.cjs} +65 -65
- package/dist/loaders/KTX2Loader.js +65 -65
- package/dist/loaders/{KTXLoader.mjs → KTXLoader.cjs} +5 -5
- package/dist/loaders/KTXLoader.js +5 -5
- package/dist/loaders/{LDrawLoader.mjs → LDrawLoader.cjs} +39 -39
- package/dist/loaders/LDrawLoader.js +39 -39
- package/dist/loaders/{LUT3dlLoader.mjs → LUT3dlLoader.cjs} +22 -22
- package/dist/loaders/LUT3dlLoader.js +22 -22
- package/dist/loaders/{LUTCubeLoader.mjs → LUTCubeLoader.cjs} +22 -22
- package/dist/loaders/LUTCubeLoader.js +22 -22
- package/dist/loaders/{LWOLoader.mjs → LWOLoader.cjs} +42 -42
- package/dist/loaders/LWOLoader.js +42 -42
- package/dist/loaders/{LottieLoader.mjs → LottieLoader.cjs} +8 -8
- package/dist/loaders/LottieLoader.js +8 -8
- package/dist/loaders/{MD2Loader.mjs → MD2Loader.cjs} +15 -15
- package/dist/loaders/MD2Loader.js +15 -15
- package/dist/loaders/{MDDLoader.mjs → MDDLoader.cjs} +9 -9
- package/dist/loaders/MDDLoader.js +9 -9
- package/dist/loaders/{MMDLoader.mjs → MMDLoader.cjs} +59 -59
- package/dist/loaders/MMDLoader.js +59 -59
- package/dist/loaders/{MTLLoader.mjs → MTLLoader.cjs} +17 -17
- package/dist/loaders/MTLLoader.js +17 -17
- package/dist/loaders/{NRRDLoader.mjs → NRRDLoader.cjs} +17 -17
- package/dist/loaders/NRRDLoader.js +17 -17
- package/dist/loaders/{OBJLoader.mjs → OBJLoader.cjs} +37 -37
- package/dist/loaders/OBJLoader.js +37 -37
- package/dist/loaders/{PCDLoader.mjs → PCDLoader.cjs} +13 -13
- package/dist/loaders/PCDLoader.js +13 -13
- package/dist/loaders/{PDBLoader.mjs → PDBLoader.cjs} +11 -11
- package/dist/loaders/PDBLoader.js +11 -11
- package/dist/loaders/{PLYLoader.mjs → PLYLoader.cjs} +13 -13
- package/dist/loaders/PLYLoader.js +13 -13
- package/dist/loaders/{PRWMLoader.mjs → PRWMLoader.cjs} +9 -9
- package/dist/loaders/PRWMLoader.js +9 -9
- package/dist/loaders/{PVRLoader.mjs → PVRLoader.cjs} +11 -11
- package/dist/loaders/PVRLoader.js +11 -11
- package/dist/loaders/{RGBELoader.mjs → RGBELoader.cjs} +18 -18
- package/dist/loaders/RGBELoader.js +18 -18
- package/dist/loaders/{RGBMLoader.mjs → RGBMLoader.cjs} +16 -16
- package/dist/loaders/RGBMLoader.js +16 -16
- package/dist/loaders/{STLLoader.mjs → STLLoader.cjs} +15 -15
- package/dist/loaders/STLLoader.js +15 -15
- package/dist/loaders/{SVGLoader.mjs → SVGLoader.cjs} +55 -55
- package/dist/loaders/SVGLoader.js +55 -55
- package/dist/loaders/{TDSLoader.mjs → TDSLoader.cjs} +20 -20
- package/dist/loaders/TDSLoader.js +20 -20
- package/dist/loaders/{TGALoader.mjs → TGALoader.cjs} +6 -6
- package/dist/loaders/TGALoader.js +6 -6
- package/dist/loaders/{TTFLoader.mjs → TTFLoader.cjs} +9 -9
- package/dist/loaders/TTFLoader.js +9 -9
- package/dist/loaders/{TiltLoader.mjs → TiltLoader.cjs} +26 -26
- package/dist/loaders/TiltLoader.js +26 -26
- package/dist/loaders/{VOXLoader.mjs → VOXLoader.cjs} +18 -18
- package/dist/loaders/VOXLoader.js +18 -18
- package/dist/loaders/{VRMLLoader.mjs → VRMLLoader.cjs} +125 -125
- package/dist/loaders/VRMLLoader.js +125 -125
- package/dist/loaders/{VRMLoader.mjs → VRMLoader.cjs} +7 -7
- package/dist/loaders/VRMLoader.js +7 -7
- package/dist/loaders/{VTKLoader.mjs → VTKLoader.cjs} +24 -24
- package/dist/loaders/VTKLoader.js +24 -24
- package/dist/loaders/{XLoader.mjs → XLoader.cjs} +42 -42
- package/dist/loaders/XLoader.js +42 -42
- package/dist/loaders/{XYZLoader.mjs → XYZLoader.cjs} +9 -9
- package/dist/loaders/XYZLoader.js +9 -9
- package/dist/loaders/lwo/{IFFParser.mjs → IFFParser.cjs} +7 -7
- package/dist/loaders/lwo/IFFParser.js +7 -7
- package/dist/loaders/lwo/{LWO2Parser.mjs → LWO2Parser.cjs} +3 -3
- package/dist/loaders/lwo/LWO2Parser.js +3 -3
- package/dist/loaders/lwo/{LWO3Parser.mjs → LWO3Parser.cjs} +3 -3
- package/dist/loaders/lwo/LWO3Parser.js +3 -3
- package/dist/math/{Capsule.mjs → Capsule.cjs} +8 -8
- package/dist/math/Capsule.js +8 -8
- package/dist/math/{ColorConverter.mjs → ColorConverter.cjs} +7 -7
- package/dist/math/ColorConverter.js +7 -7
- package/dist/math/{ConvexHull.mjs → ConvexHull.cjs} +18 -18
- package/dist/math/ConvexHull.js +18 -18
- package/dist/math/{ImprovedNoise.mjs → ImprovedNoise.cjs} +3 -3
- package/dist/math/ImprovedNoise.js +3 -3
- package/dist/math/{Lut.mjs → Lut.cjs} +14 -14
- package/dist/math/Lut.js +14 -14
- package/dist/math/{MeshSurfaceSampler.mjs → MeshSurfaceSampler.cjs} +6 -6
- package/dist/math/MeshSurfaceSampler.js +6 -6
- package/dist/math/{OBB.mjs → OBB.cjs} +21 -21
- package/dist/math/OBB.js +21 -21
- package/dist/math/{Octree.mjs → Octree.cjs} +19 -19
- package/dist/math/Octree.js +19 -19
- package/dist/math/{SimplexNoise.mjs → SimplexNoise.cjs} +3 -3
- package/dist/math/SimplexNoise.js +3 -3
- package/dist/misc/{ConvexObjectBreaker.mjs → ConvexObjectBreaker.cjs} +25 -25
- package/dist/misc/ConvexObjectBreaker.js +25 -25
- package/dist/misc/{GPUComputationRenderer.mjs → GPUComputationRenderer.cjs} +19 -19
- package/dist/misc/GPUComputationRenderer.js +19 -19
- package/dist/misc/{Gyroscope.mjs → Gyroscope.cjs} +11 -11
- package/dist/misc/Gyroscope.js +11 -11
- package/dist/misc/{MD2Character.mjs → MD2Character.cjs} +14 -14
- package/dist/misc/MD2Character.js +14 -14
- package/dist/misc/{MD2CharacterComplex.mjs → MD2CharacterComplex.cjs} +20 -20
- package/dist/misc/MD2CharacterComplex.js +20 -20
- package/dist/misc/{MorphAnimMesh.mjs → MorphAnimMesh.cjs} +8 -8
- package/dist/misc/MorphAnimMesh.js +8 -8
- package/dist/misc/{MorphBlendMesh.mjs → MorphBlendMesh.cjs} +6 -6
- package/dist/misc/MorphBlendMesh.js +6 -6
- package/dist/misc/{ProgressiveLightmap.mjs → ProgressiveLightmap.cjs} +17 -17
- package/dist/misc/ProgressiveLightmap.js +17 -17
- package/dist/misc/{RollerCoaster.mjs → RollerCoaster.cjs} +77 -77
- package/dist/misc/RollerCoaster.js +77 -77
- package/dist/misc/{Timer.mjs → Timer.cjs} +3 -3
- package/dist/misc/Timer.js +3 -3
- package/dist/misc/{TubePainter.mjs → TubePainter.cjs} +24 -24
- package/dist/misc/TubePainter.js +24 -24
- package/dist/misc/{Volume.mjs → Volume.cjs} +18 -18
- package/dist/misc/Volume.js +18 -18
- package/dist/misc/{VolumeSlice.mjs → VolumeSlice.cjs} +10 -10
- package/dist/misc/VolumeSlice.js +10 -10
- package/dist/misc/{WebGL.mjs → WebGL.cjs} +7 -7
- package/dist/misc/WebGL.js +7 -7
- package/dist/modifiers/{CurveModifier.mjs → CurveModifier.cjs} +17 -17
- package/dist/modifiers/CurveModifier.js +17 -17
- package/dist/modifiers/{EdgeSplitModifier.mjs → EdgeSplitModifier.cjs} +12 -13
- package/dist/modifiers/EdgeSplitModifier.js +13 -12
- package/dist/modifiers/{SimplifyModifier.mjs → SimplifyModifier.cjs} +12 -12
- package/dist/modifiers/SimplifyModifier.js +12 -12
- package/dist/modifiers/{TessellateModifier.mjs → TessellateModifier.cjs} +30 -30
- package/dist/modifiers/TessellateModifier.js +30 -30
- package/dist/objects/{GroundProjectedEnv.mjs → GroundProjectedEnv.cjs} +8 -8
- package/dist/objects/GroundProjectedEnv.js +8 -8
- package/dist/objects/{Lensflare.mjs → Lensflare.cjs} +37 -37
- package/dist/objects/Lensflare.js +37 -37
- package/dist/objects/{LightningStorm.mjs → LightningStorm.cjs} +17 -17
- package/dist/objects/LightningStorm.js +17 -17
- package/dist/objects/{MarchingCubes.mjs → MarchingCubes.cjs} +21 -21
- package/dist/objects/MarchingCubes.js +21 -21
- package/dist/objects/{Reflector.mjs → Reflector.cjs} +23 -23
- package/dist/objects/Reflector.js +23 -23
- package/dist/objects/{ReflectorForSSRPass.mjs → ReflectorForSSRPass.cjs} +33 -33
- package/dist/objects/ReflectorForSSRPass.js +33 -33
- package/dist/objects/ReflectorRTT.cjs +10 -0
- package/dist/objects/ReflectorRTT.js +5 -5
- package/dist/objects/{Refractor.mjs → Refractor.cjs} +26 -26
- package/dist/objects/Refractor.js +26 -26
- package/dist/objects/{ShadowMesh.mjs → ShadowMesh.cjs} +9 -9
- package/dist/objects/ShadowMesh.js +9 -9
- package/dist/objects/{Sky.mjs → Sky.cjs} +11 -11
- package/dist/objects/Sky.js +11 -11
- package/dist/objects/{Water.mjs → Water.cjs} +33 -33
- package/dist/objects/Water.js +33 -33
- package/dist/objects/{Water2.mjs → Water2.cjs} +20 -20
- package/dist/objects/Water2.js +20 -20
- package/dist/physics/{AmmoPhysics.mjs → AmmoPhysics.cjs} +3 -3
- package/dist/physics/AmmoPhysics.js +3 -3
- package/dist/postprocessing/{AdaptiveToneMappingPass.mjs → AdaptiveToneMappingPass.cjs} +32 -32
- package/dist/postprocessing/AdaptiveToneMappingPass.js +32 -32
- package/dist/postprocessing/{AfterimagePass.mjs → AfterimagePass.cjs} +21 -21
- package/dist/postprocessing/AfterimagePass.js +21 -21
- package/dist/postprocessing/{BloomPass.mjs → BloomPass.cjs} +20 -20
- package/dist/postprocessing/BloomPass.js +20 -20
- package/dist/postprocessing/{BokehPass.mjs → BokehPass.cjs} +19 -19
- package/dist/postprocessing/BokehPass.js +19 -19
- package/dist/postprocessing/{ClearPass.mjs → ClearPass.cjs} +7 -7
- package/dist/postprocessing/ClearPass.js +7 -7
- package/dist/postprocessing/{CubeTexturePass.mjs → CubeTexturePass.cjs} +14 -14
- package/dist/postprocessing/CubeTexturePass.js +14 -14
- package/dist/postprocessing/{DotScreenPass.mjs → DotScreenPass.cjs} +12 -12
- package/dist/postprocessing/DotScreenPass.js +12 -12
- package/dist/postprocessing/{EffectComposer.mjs → EffectComposer.cjs} +20 -20
- package/dist/postprocessing/EffectComposer.js +20 -20
- package/dist/postprocessing/{FilmPass.mjs → FilmPass.cjs} +12 -12
- package/dist/postprocessing/FilmPass.js +12 -12
- package/dist/postprocessing/{GlitchPass.mjs → GlitchPass.cjs} +26 -26
- package/dist/postprocessing/GlitchPass.js +26 -26
- package/dist/postprocessing/{HalftonePass.mjs → HalftonePass.cjs} +13 -13
- package/dist/postprocessing/HalftonePass.js +13 -13
- package/dist/postprocessing/{LUTPass.mjs → LUTPass.cjs} +5 -5
- package/dist/postprocessing/LUTPass.js +5 -5
- package/dist/postprocessing/{MaskPass.mjs → MaskPass.cjs} +7 -7
- package/dist/postprocessing/MaskPass.js +7 -7
- package/dist/postprocessing/{OutlinePass.mjs → OutlinePass.cjs} +45 -45
- package/dist/postprocessing/OutlinePass.js +45 -45
- package/dist/postprocessing/{Pass.mjs → Pass.cjs} +8 -8
- package/dist/postprocessing/Pass.js +8 -8
- package/dist/postprocessing/{RenderPass.mjs → RenderPass.cjs} +7 -7
- package/dist/postprocessing/RenderPass.js +7 -7
- package/dist/postprocessing/{RenderPixelatedPass.mjs → RenderPixelatedPass.cjs} +18 -18
- package/dist/postprocessing/RenderPixelatedPass.js +18 -18
- package/dist/postprocessing/{SAOPass.mjs → SAOPass.cjs} +69 -69
- package/dist/postprocessing/SAOPass.js +69 -69
- package/dist/postprocessing/{SMAAPass.mjs → SMAAPass.cjs} +30 -30
- package/dist/postprocessing/SMAAPass.js +30 -30
- package/dist/postprocessing/{SSAARenderPass.mjs → SSAARenderPass.cjs} +19 -19
- package/dist/postprocessing/SSAARenderPass.js +19 -19
- package/dist/postprocessing/{SSAOPass.mjs → SSAOPass.cjs} +63 -63
- package/dist/postprocessing/SSAOPass.js +63 -63
- package/dist/postprocessing/{SSRPass.mjs → SSRPass.cjs} +86 -86
- package/dist/postprocessing/SSRPass.js +86 -86
- package/dist/postprocessing/{SavePass.mjs → SavePass.cjs} +13 -13
- package/dist/postprocessing/SavePass.js +13 -13
- package/dist/postprocessing/{ShaderPass.mjs → ShaderPass.cjs} +10 -10
- package/dist/postprocessing/ShaderPass.js +10 -10
- package/dist/postprocessing/{TAARenderPass.mjs → TAARenderPass.cjs} +8 -8
- package/dist/postprocessing/TAARenderPass.js +8 -8
- package/dist/postprocessing/{TexturePass.mjs → TexturePass.cjs} +11 -11
- package/dist/postprocessing/TexturePass.js +11 -11
- package/dist/postprocessing/{UnrealBloomPass.mjs → UnrealBloomPass.cjs} +36 -36
- package/dist/postprocessing/UnrealBloomPass.js +36 -36
- package/dist/postprocessing/{WaterPass.mjs → WaterPass.cjs} +10 -10
- package/dist/postprocessing/WaterPass.js +10 -10
- package/dist/renderers/{CSS2DRenderer.mjs → CSS2DRenderer.cjs} +12 -12
- package/dist/renderers/CSS2DRenderer.js +12 -12
- package/dist/renderers/{CSS3DRenderer.mjs → CSS3DRenderer.cjs} +12 -12
- package/dist/renderers/CSS3DRenderer.js +12 -12
- package/dist/renderers/{Projector.mjs → Projector.cjs} +21 -21
- package/dist/renderers/Projector.js +21 -21
- package/dist/renderers/{SVGRenderer.mjs → SVGRenderer.cjs} +12 -12
- package/dist/renderers/SVGRenderer.js +12 -12
- package/dist/shaders/{ACESFilmicToneMappingShader.mjs → ACESFilmicToneMappingShader.cjs} +3 -3
- package/dist/shaders/ACESFilmicToneMappingShader.js +3 -3
- package/dist/shaders/{AfterimageShader.mjs → AfterimageShader.cjs} +3 -3
- package/dist/shaders/AfterimageShader.js +3 -3
- package/dist/shaders/{BasicShader.mjs → BasicShader.cjs} +3 -3
- package/dist/shaders/BasicShader.js +3 -3
- package/dist/shaders/{BleachBypassShader.mjs → BleachBypassShader.cjs} +3 -3
- package/dist/shaders/BleachBypassShader.js +3 -3
- package/dist/shaders/{BlendShader.mjs → BlendShader.cjs} +3 -3
- package/dist/shaders/BlendShader.js +3 -3
- package/dist/shaders/{BokehShader.mjs → BokehShader.cjs} +3 -3
- package/dist/shaders/BokehShader.js +3 -3
- package/dist/shaders/{BokehShader2.mjs → BokehShader2.cjs} +6 -6
- package/dist/shaders/BokehShader2.js +6 -6
- package/dist/shaders/{BrightnessContrastShader.mjs → BrightnessContrastShader.cjs} +3 -3
- package/dist/shaders/BrightnessContrastShader.js +3 -3
- package/dist/shaders/{ColorCorrectionShader.mjs → ColorCorrectionShader.cjs} +7 -7
- package/dist/shaders/ColorCorrectionShader.js +7 -7
- package/dist/shaders/{ColorifyShader.mjs → ColorifyShader.cjs} +5 -5
- package/dist/shaders/ColorifyShader.js +5 -5
- package/dist/shaders/{ConvolutionShader.mjs → ConvolutionShader.cjs} +5 -5
- package/dist/shaders/ConvolutionShader.js +5 -5
- package/dist/shaders/{CopyShader.mjs → CopyShader.cjs} +3 -3
- package/dist/shaders/CopyShader.js +3 -3
- package/dist/shaders/{DOFMipMapShader.mjs → DOFMipMapShader.cjs} +3 -3
- package/dist/shaders/DOFMipMapShader.js +3 -3
- package/dist/shaders/{DepthLimitedBlurShader.mjs → DepthLimitedBlurShader.cjs} +7 -7
- package/dist/shaders/DepthLimitedBlurShader.js +7 -7
- package/dist/shaders/{DigitalGlitch.mjs → DigitalGlitch.cjs} +3 -3
- package/dist/shaders/DigitalGlitch.js +3 -3
- package/dist/shaders/{DotScreenShader.mjs → DotScreenShader.cjs} +6 -6
- package/dist/shaders/DotScreenShader.js +6 -6
- package/dist/shaders/{FXAAShader.mjs → FXAAShader.cjs} +5 -5
- package/dist/shaders/FXAAShader.js +5 -5
- package/dist/shaders/{FilmShader.mjs → FilmShader.cjs} +3 -3
- package/dist/shaders/FilmShader.js +3 -3
- package/dist/shaders/{FocusShader.mjs → FocusShader.cjs} +3 -3
- package/dist/shaders/FocusShader.js +3 -3
- package/dist/shaders/{FreiChenShader.mjs → FreiChenShader.cjs} +5 -5
- package/dist/shaders/FreiChenShader.js +5 -5
- package/dist/shaders/{FresnelShader.mjs → FresnelShader.cjs} +3 -3
- package/dist/shaders/FresnelShader.js +3 -3
- package/dist/shaders/{GammaCorrectionShader.mjs → GammaCorrectionShader.cjs} +3 -3
- package/dist/shaders/GammaCorrectionShader.js +3 -3
- package/dist/shaders/{GodRaysShader.mjs → GodRaysShader.cjs} +11 -11
- package/dist/shaders/GodRaysShader.js +11 -11
- package/dist/shaders/{HalftoneShader.mjs → HalftoneShader.cjs} +3 -3
- package/dist/shaders/HalftoneShader.js +3 -3
- package/dist/shaders/{HorizontalBlurShader.mjs → HorizontalBlurShader.cjs} +3 -3
- package/dist/shaders/HorizontalBlurShader.js +3 -3
- package/dist/shaders/{HorizontalTiltShiftShader.mjs → HorizontalTiltShiftShader.cjs} +3 -3
- package/dist/shaders/HorizontalTiltShiftShader.js +3 -3
- package/dist/shaders/{HueSaturationShader.mjs → HueSaturationShader.cjs} +3 -3
- package/dist/shaders/HueSaturationShader.js +3 -3
- package/dist/shaders/{KaleidoShader.mjs → KaleidoShader.cjs} +3 -3
- package/dist/shaders/KaleidoShader.js +3 -3
- package/dist/shaders/{LuminosityHighPassShader.mjs → LuminosityHighPassShader.cjs} +5 -5
- package/dist/shaders/LuminosityHighPassShader.js +5 -5
- package/dist/shaders/{LuminosityShader.mjs → LuminosityShader.cjs} +3 -3
- package/dist/shaders/LuminosityShader.js +3 -3
- package/dist/shaders/{MirrorShader.mjs → MirrorShader.cjs} +3 -3
- package/dist/shaders/MirrorShader.js +3 -3
- package/dist/shaders/{NormalMapShader.mjs → NormalMapShader.cjs} +6 -6
- package/dist/shaders/NormalMapShader.js +6 -6
- package/dist/shaders/{ParallaxShader.mjs → ParallaxShader.cjs} +3 -3
- package/dist/shaders/ParallaxShader.js +3 -3
- package/dist/shaders/{PixelShader.mjs → PixelShader.cjs} +3 -3
- package/dist/shaders/PixelShader.js +3 -3
- package/dist/shaders/{RGBShiftShader.mjs → RGBShiftShader.cjs} +3 -3
- package/dist/shaders/RGBShiftShader.js +3 -3
- package/dist/shaders/{SAOShader.mjs → SAOShader.cjs} +7 -7
- package/dist/shaders/SAOShader.js +7 -7
- package/dist/shaders/{SMAAShader.mjs → SMAAShader.cjs} +9 -9
- package/dist/shaders/SMAAShader.js +9 -9
- package/dist/shaders/{SSAOShader.mjs → SSAOShader.cjs} +10 -10
- package/dist/shaders/SSAOShader.js +10 -10
- package/dist/shaders/{SSRShader.mjs → SSRShader.cjs} +10 -10
- package/dist/shaders/SSRShader.js +10 -10
- package/dist/shaders/{SepiaShader.mjs → SepiaShader.cjs} +3 -3
- package/dist/shaders/SepiaShader.js +3 -3
- package/dist/shaders/{SobelOperatorShader.mjs → SobelOperatorShader.cjs} +5 -5
- package/dist/shaders/SobelOperatorShader.js +5 -5
- package/dist/shaders/{SubsurfaceScatteringShader.mjs → SubsurfaceScatteringShader.cjs} +13 -13
- package/dist/shaders/SubsurfaceScatteringShader.js +13 -13
- package/dist/shaders/{TechnicolorShader.mjs → TechnicolorShader.cjs} +3 -3
- package/dist/shaders/TechnicolorShader.js +3 -3
- package/dist/shaders/{ToneMapShader.mjs → ToneMapShader.cjs} +3 -3
- package/dist/shaders/ToneMapShader.js +3 -3
- package/dist/shaders/{ToonShader.mjs → ToonShader.cjs} +32 -32
- package/dist/shaders/ToonShader.js +32 -32
- package/dist/shaders/{TriangleBlurShader.mjs → TriangleBlurShader.cjs} +5 -5
- package/dist/shaders/TriangleBlurShader.js +5 -5
- package/dist/shaders/{UnpackDepthRGBAShader.mjs → UnpackDepthRGBAShader.cjs} +3 -3
- package/dist/shaders/UnpackDepthRGBAShader.js +3 -3
- package/dist/shaders/{VerticalBlurShader.mjs → VerticalBlurShader.cjs} +3 -3
- package/dist/shaders/VerticalBlurShader.js +3 -3
- package/dist/shaders/{VerticalTiltShiftShader.mjs → VerticalTiltShiftShader.cjs} +3 -3
- package/dist/shaders/VerticalTiltShiftShader.js +3 -3
- package/dist/shaders/{VignetteShader.mjs → VignetteShader.cjs} +3 -3
- package/dist/shaders/VignetteShader.js +3 -3
- package/dist/shaders/{VolumeShader.mjs → VolumeShader.cjs} +6 -6
- package/dist/shaders/VolumeShader.js +6 -6
- package/dist/shaders/{WaterRefractionShader.mjs → WaterRefractionShader.cjs} +3 -3
- package/dist/shaders/WaterRefractionShader.js +3 -3
- package/dist/shaders/types.cjs +1 -0
- package/dist/shaders/types.js +1 -1
- package/dist/textures/{FlakesTexture.mjs → FlakesTexture.cjs} +3 -3
- package/dist/textures/FlakesTexture.js +3 -3
- package/dist/types/Loader.cjs +26 -0
- package/dist/types/Loader.js +5 -22
- package/dist/types/helpers.cjs +4 -0
- package/dist/types/helpers.js +3 -3
- package/dist/utils/{BufferGeometryUtils.mjs → BufferGeometryUtils.cjs} +41 -41
- package/dist/utils/BufferGeometryUtils.js +41 -41
- package/dist/utils/{GeometryCompressionUtils.mjs → GeometryCompressionUtils.cjs} +94 -94
- package/dist/utils/GeometryCompressionUtils.js +94 -94
- package/dist/utils/{GeometryUtils.mjs → GeometryUtils.cjs} +18 -18
- package/dist/utils/GeometryUtils.js +18 -18
- package/dist/utils/{RoughnessMipmapper.mjs → RoughnessMipmapper.cjs} +13 -13
- package/dist/utils/RoughnessMipmapper.js +13 -13
- package/dist/utils/{SceneUtils.mjs → SceneUtils.cjs} +8 -8
- package/dist/utils/SceneUtils.js +8 -8
- package/dist/utils/{ShadowMapViewer.mjs → ShadowMapViewer.cjs} +18 -18
- package/dist/utils/ShadowMapViewer.js +18 -18
- package/dist/utils/{SkeletonUtils.mjs → SkeletonUtils.cjs} +10 -10
- package/dist/utils/SkeletonUtils.js +10 -10
- package/dist/utils/{UVsDebug.mjs → UVsDebug.cjs} +7 -7
- package/dist/utils/UVsDebug.js +7 -7
- package/dist/utils/{WorkerPool.mjs → WorkerPool.cjs} +3 -3
- package/dist/utils/WorkerPool.js +3 -3
- package/dist/webxr/{ARButton.mjs → ARButton.cjs} +3 -3
- package/dist/webxr/ARButton.js +3 -3
- package/dist/webxr/{OculusHandModel.mjs → OculusHandModel.cjs} +9 -9
- package/dist/webxr/OculusHandModel.js +9 -9
- package/dist/webxr/{OculusHandPointerModel.mjs → OculusHandPointerModel.cjs} +41 -24
- package/dist/webxr/OculusHandPointerModel.js +24 -41
- package/dist/webxr/Text2D.cjs +48 -0
- package/dist/webxr/Text2D.js +9 -26
- package/dist/webxr/{VRButton.mjs → VRButton.cjs} +3 -3
- package/dist/webxr/VRButton.js +3 -3
- package/dist/webxr/{XRControllerModelFactory.mjs → XRControllerModelFactory.cjs} +18 -18
- package/dist/webxr/XRControllerModelFactory.js +18 -18
- package/dist/webxr/{XREstimatedLight.mjs → XREstimatedLight.cjs} +8 -8
- package/dist/webxr/XREstimatedLight.js +8 -8
- package/dist/webxr/{XRHandMeshModel.mjs → XRHandMeshModel.cjs} +5 -5
- package/dist/webxr/XRHandMeshModel.js +5 -5
- package/dist/webxr/{XRHandModelFactory.mjs → XRHandModelFactory.cjs} +10 -10
- package/dist/webxr/XRHandModelFactory.js +10 -10
- package/dist/webxr/{XRHandPrimitiveModel.mjs → XRHandPrimitiveModel.cjs} +11 -11
- package/dist/webxr/XRHandPrimitiveModel.js +11 -11
- package/package.json +3 -3
- package/dist/_polyfill/CompressedArrayTexture.mjs +0 -12
- package/dist/_polyfill/Data3DTexture.mjs +0 -17
- package/dist/environments/RoomEnvironment.mjs +0 -78
- package/dist/geometries/ConvexGeometry.mjs +0 -26
- package/dist/index.mjs +0 -613
- package/dist/lines/Line2.mjs +0 -13
- package/dist/lines/Wireframe.mjs +0 -32
- package/dist/lines/WireframeGeometry2.mjs +0 -13
- package/dist/objects/ReflectorRTT.mjs +0 -10
- package/dist/shaders/types.mjs +0 -1
- package/dist/types/Loader.mjs +0 -9
- package/dist/types/helpers.mjs +0 -4
- package/dist/webxr/Text2D.mjs +0 -31
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const THREE = require("three");
|
|
4
|
+
class STLLoader extends THREE.Loader {
|
|
3
5
|
constructor(manager) {
|
|
4
6
|
super(manager);
|
|
5
7
|
}
|
|
6
8
|
load(url, onLoad, onProgress, onError) {
|
|
7
9
|
const scope = this;
|
|
8
|
-
const loader = new FileLoader(this.manager);
|
|
10
|
+
const loader = new THREE.FileLoader(this.manager);
|
|
9
11
|
loader.setPath(this.path);
|
|
10
12
|
loader.setResponseType("arraybuffer");
|
|
11
13
|
loader.setRequestHeader(this.requestHeader);
|
|
@@ -68,7 +70,7 @@ class STLLoader extends Loader {
|
|
|
68
70
|
}
|
|
69
71
|
const dataOffset = 84;
|
|
70
72
|
const faceLength = 12 * 4 + 2;
|
|
71
|
-
const geometry = new BufferGeometry();
|
|
73
|
+
const geometry = new THREE.BufferGeometry();
|
|
72
74
|
const vertices = new Float32Array(faces * 3 * 3);
|
|
73
75
|
const normals = new Float32Array(faces * 3 * 3);
|
|
74
76
|
for (let face = 0; face < faces; face++) {
|
|
@@ -104,17 +106,17 @@ class STLLoader extends Loader {
|
|
|
104
106
|
}
|
|
105
107
|
}
|
|
106
108
|
}
|
|
107
|
-
geometry.setAttribute("position", new BufferAttribute(vertices, 3));
|
|
108
|
-
geometry.setAttribute("normal", new BufferAttribute(normals, 3));
|
|
109
|
+
geometry.setAttribute("position", new THREE.BufferAttribute(vertices, 3));
|
|
110
|
+
geometry.setAttribute("normal", new THREE.BufferAttribute(normals, 3));
|
|
109
111
|
if (hasColors) {
|
|
110
|
-
geometry.setAttribute("color", new BufferAttribute(colors, 3));
|
|
112
|
+
geometry.setAttribute("color", new THREE.BufferAttribute(colors, 3));
|
|
111
113
|
geometry.hasColors = true;
|
|
112
114
|
geometry.alpha = alpha;
|
|
113
115
|
}
|
|
114
116
|
return geometry;
|
|
115
117
|
}
|
|
116
118
|
function parseASCII(data2) {
|
|
117
|
-
const geometry = new BufferGeometry();
|
|
119
|
+
const geometry = new THREE.BufferGeometry();
|
|
118
120
|
const patternSolid = /solid([\s\S]*?)endsolid/g;
|
|
119
121
|
const patternFace = /facet([\s\S]*?)endfacet/g;
|
|
120
122
|
let faceCounter = 0;
|
|
@@ -123,7 +125,7 @@ class STLLoader extends Loader {
|
|
|
123
125
|
const patternNormal = new RegExp("normal" + patternFloat + patternFloat + patternFloat, "g");
|
|
124
126
|
const vertices = [];
|
|
125
127
|
const normals = [];
|
|
126
|
-
const normal = new Vector3();
|
|
128
|
+
const normal = new THREE.Vector3();
|
|
127
129
|
let result;
|
|
128
130
|
let groupCount = 0;
|
|
129
131
|
let startVertex = 0;
|
|
@@ -160,13 +162,13 @@ class STLLoader extends Loader {
|
|
|
160
162
|
geometry.addGroup(start, count, groupCount);
|
|
161
163
|
groupCount++;
|
|
162
164
|
}
|
|
163
|
-
geometry.setAttribute("position", new Float32BufferAttribute(vertices, 3));
|
|
164
|
-
geometry.setAttribute("normal", new Float32BufferAttribute(normals, 3));
|
|
165
|
+
geometry.setAttribute("position", new THREE.Float32BufferAttribute(vertices, 3));
|
|
166
|
+
geometry.setAttribute("normal", new THREE.Float32BufferAttribute(normals, 3));
|
|
165
167
|
return geometry;
|
|
166
168
|
}
|
|
167
169
|
function ensureString(buffer) {
|
|
168
170
|
if (typeof buffer !== "string") {
|
|
169
|
-
return LoaderUtils.decodeText(new Uint8Array(buffer));
|
|
171
|
+
return THREE.LoaderUtils.decodeText(new Uint8Array(buffer));
|
|
170
172
|
}
|
|
171
173
|
return buffer;
|
|
172
174
|
}
|
|
@@ -185,6 +187,4 @@ class STLLoader extends Loader {
|
|
|
185
187
|
return isBinary(binData) ? parseBinary(binData) : parseASCII(ensureString(data));
|
|
186
188
|
}
|
|
187
189
|
}
|
|
188
|
-
|
|
189
|
-
STLLoader
|
|
190
|
-
};
|
|
190
|
+
exports.STLLoader = STLLoader;
|
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const THREE = require("three");
|
|
4
|
-
class STLLoader extends THREE.Loader {
|
|
1
|
+
import { Loader, FileLoader, BufferGeometry, BufferAttribute, Vector3, Float32BufferAttribute, LoaderUtils } from "three";
|
|
2
|
+
class STLLoader extends Loader {
|
|
5
3
|
constructor(manager) {
|
|
6
4
|
super(manager);
|
|
7
5
|
}
|
|
8
6
|
load(url, onLoad, onProgress, onError) {
|
|
9
7
|
const scope = this;
|
|
10
|
-
const loader = new
|
|
8
|
+
const loader = new FileLoader(this.manager);
|
|
11
9
|
loader.setPath(this.path);
|
|
12
10
|
loader.setResponseType("arraybuffer");
|
|
13
11
|
loader.setRequestHeader(this.requestHeader);
|
|
@@ -70,7 +68,7 @@ class STLLoader extends THREE.Loader {
|
|
|
70
68
|
}
|
|
71
69
|
const dataOffset = 84;
|
|
72
70
|
const faceLength = 12 * 4 + 2;
|
|
73
|
-
const geometry = new
|
|
71
|
+
const geometry = new BufferGeometry();
|
|
74
72
|
const vertices = new Float32Array(faces * 3 * 3);
|
|
75
73
|
const normals = new Float32Array(faces * 3 * 3);
|
|
76
74
|
for (let face = 0; face < faces; face++) {
|
|
@@ -106,17 +104,17 @@ class STLLoader extends THREE.Loader {
|
|
|
106
104
|
}
|
|
107
105
|
}
|
|
108
106
|
}
|
|
109
|
-
geometry.setAttribute("position", new
|
|
110
|
-
geometry.setAttribute("normal", new
|
|
107
|
+
geometry.setAttribute("position", new BufferAttribute(vertices, 3));
|
|
108
|
+
geometry.setAttribute("normal", new BufferAttribute(normals, 3));
|
|
111
109
|
if (hasColors) {
|
|
112
|
-
geometry.setAttribute("color", new
|
|
110
|
+
geometry.setAttribute("color", new BufferAttribute(colors, 3));
|
|
113
111
|
geometry.hasColors = true;
|
|
114
112
|
geometry.alpha = alpha;
|
|
115
113
|
}
|
|
116
114
|
return geometry;
|
|
117
115
|
}
|
|
118
116
|
function parseASCII(data2) {
|
|
119
|
-
const geometry = new
|
|
117
|
+
const geometry = new BufferGeometry();
|
|
120
118
|
const patternSolid = /solid([\s\S]*?)endsolid/g;
|
|
121
119
|
const patternFace = /facet([\s\S]*?)endfacet/g;
|
|
122
120
|
let faceCounter = 0;
|
|
@@ -125,7 +123,7 @@ class STLLoader extends THREE.Loader {
|
|
|
125
123
|
const patternNormal = new RegExp("normal" + patternFloat + patternFloat + patternFloat, "g");
|
|
126
124
|
const vertices = [];
|
|
127
125
|
const normals = [];
|
|
128
|
-
const normal = new
|
|
126
|
+
const normal = new Vector3();
|
|
129
127
|
let result;
|
|
130
128
|
let groupCount = 0;
|
|
131
129
|
let startVertex = 0;
|
|
@@ -162,13 +160,13 @@ class STLLoader extends THREE.Loader {
|
|
|
162
160
|
geometry.addGroup(start, count, groupCount);
|
|
163
161
|
groupCount++;
|
|
164
162
|
}
|
|
165
|
-
geometry.setAttribute("position", new
|
|
166
|
-
geometry.setAttribute("normal", new
|
|
163
|
+
geometry.setAttribute("position", new Float32BufferAttribute(vertices, 3));
|
|
164
|
+
geometry.setAttribute("normal", new Float32BufferAttribute(normals, 3));
|
|
167
165
|
return geometry;
|
|
168
166
|
}
|
|
169
167
|
function ensureString(buffer) {
|
|
170
168
|
if (typeof buffer !== "string") {
|
|
171
|
-
return
|
|
169
|
+
return LoaderUtils.decodeText(new Uint8Array(buffer));
|
|
172
170
|
}
|
|
173
171
|
return buffer;
|
|
174
172
|
}
|
|
@@ -187,4 +185,6 @@ class STLLoader extends THREE.Loader {
|
|
|
187
185
|
return isBinary(binData) ? parseBinary(binData) : parseASCII(ensureString(data));
|
|
188
186
|
}
|
|
189
187
|
}
|
|
190
|
-
|
|
188
|
+
export {
|
|
189
|
+
STLLoader
|
|
190
|
+
};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const THREE = require("three");
|
|
4
|
+
class SVGLoader extends THREE.Loader {
|
|
3
5
|
constructor(manager) {
|
|
4
6
|
super(manager);
|
|
5
7
|
this.defaultDPI = 90;
|
|
@@ -7,7 +9,7 @@ class SVGLoader extends Loader {
|
|
|
7
9
|
}
|
|
8
10
|
load(url, onLoad, onProgress, onError) {
|
|
9
11
|
const scope = this;
|
|
10
|
-
const loader = new FileLoader(scope.manager);
|
|
12
|
+
const loader = new THREE.FileLoader(scope.manager);
|
|
11
13
|
loader.setPath(scope.path);
|
|
12
14
|
loader.setRequestHeader(scope.requestHeader);
|
|
13
15
|
loader.setWithCredentials(scope.withCredentials);
|
|
@@ -117,10 +119,10 @@ class SVGLoader extends Loader {
|
|
|
117
119
|
}
|
|
118
120
|
}
|
|
119
121
|
function parsePathNode(node) {
|
|
120
|
-
const path = new ShapePath();
|
|
121
|
-
const point = new Vector2();
|
|
122
|
-
const control = new Vector2();
|
|
123
|
-
const firstPoint = new Vector2();
|
|
122
|
+
const path = new THREE.ShapePath();
|
|
123
|
+
const point = new THREE.Vector2();
|
|
124
|
+
const control = new THREE.Vector2();
|
|
125
|
+
const firstPoint = new THREE.Vector2();
|
|
124
126
|
let isFirstPoint = true;
|
|
125
127
|
let doSetFirstPoint = false;
|
|
126
128
|
const d = node.getAttribute("d");
|
|
@@ -498,7 +500,7 @@ class SVGLoader extends Loader {
|
|
|
498
500
|
const w = parseFloatWithUnits(node.getAttribute("width"));
|
|
499
501
|
const h = parseFloatWithUnits(node.getAttribute("height"));
|
|
500
502
|
const bci = 1 - 0.551915024494;
|
|
501
|
-
const path = new ShapePath();
|
|
503
|
+
const path = new THREE.ShapePath();
|
|
502
504
|
path.moveTo(x + rx, y);
|
|
503
505
|
path.lineTo(x + w - rx, y);
|
|
504
506
|
if (rx !== 0 || ry !== 0) {
|
|
@@ -530,7 +532,7 @@ class SVGLoader extends Loader {
|
|
|
530
532
|
index++;
|
|
531
533
|
}
|
|
532
534
|
const regex = /(-?[\d\.?]+)[,|\s](-?[\d\.?]+)/g;
|
|
533
|
-
const path = new ShapePath();
|
|
535
|
+
const path = new THREE.ShapePath();
|
|
534
536
|
let index = 0;
|
|
535
537
|
node.getAttribute("points").replace(regex, iterator);
|
|
536
538
|
path.currentPath.autoClose = true;
|
|
@@ -548,7 +550,7 @@ class SVGLoader extends Loader {
|
|
|
548
550
|
index++;
|
|
549
551
|
}
|
|
550
552
|
const regex = /(-?[\d\.?]+)[,|\s](-?[\d\.?]+)/g;
|
|
551
|
-
const path = new ShapePath();
|
|
553
|
+
const path = new THREE.ShapePath();
|
|
552
554
|
let index = 0;
|
|
553
555
|
node.getAttribute("points").replace(regex, iterator);
|
|
554
556
|
path.currentPath.autoClose = false;
|
|
@@ -558,9 +560,9 @@ class SVGLoader extends Loader {
|
|
|
558
560
|
const x = parseFloatWithUnits(node.getAttribute("cx") || 0);
|
|
559
561
|
const y = parseFloatWithUnits(node.getAttribute("cy") || 0);
|
|
560
562
|
const r = parseFloatWithUnits(node.getAttribute("r") || 0);
|
|
561
|
-
const subpath = new Path();
|
|
563
|
+
const subpath = new THREE.Path();
|
|
562
564
|
subpath.absarc(x, y, r, 0, Math.PI * 2);
|
|
563
|
-
const path = new ShapePath();
|
|
565
|
+
const path = new THREE.ShapePath();
|
|
564
566
|
path.subPaths.push(subpath);
|
|
565
567
|
return path;
|
|
566
568
|
}
|
|
@@ -569,9 +571,9 @@ class SVGLoader extends Loader {
|
|
|
569
571
|
const y = parseFloatWithUnits(node.getAttribute("cy") || 0);
|
|
570
572
|
const rx = parseFloatWithUnits(node.getAttribute("rx") || 0);
|
|
571
573
|
const ry = parseFloatWithUnits(node.getAttribute("ry") || 0);
|
|
572
|
-
const subpath = new Path();
|
|
574
|
+
const subpath = new THREE.Path();
|
|
573
575
|
subpath.absellipse(x, y, rx, ry, 0, Math.PI * 2);
|
|
574
|
-
const path = new ShapePath();
|
|
576
|
+
const path = new THREE.ShapePath();
|
|
575
577
|
path.subPaths.push(subpath);
|
|
576
578
|
return path;
|
|
577
579
|
}
|
|
@@ -580,7 +582,7 @@ class SVGLoader extends Loader {
|
|
|
580
582
|
const y1 = parseFloatWithUnits(node.getAttribute("y1") || 0);
|
|
581
583
|
const x2 = parseFloatWithUnits(node.getAttribute("x2") || 0);
|
|
582
584
|
const y2 = parseFloatWithUnits(node.getAttribute("y2") || 0);
|
|
583
|
-
const path = new ShapePath();
|
|
585
|
+
const path = new THREE.ShapePath();
|
|
584
586
|
path.moveTo(x1, y1);
|
|
585
587
|
path.lineTo(x2, y2);
|
|
586
588
|
path.currentPath.autoClose = false;
|
|
@@ -854,7 +856,7 @@ class SVGLoader extends Loader {
|
|
|
854
856
|
return transform;
|
|
855
857
|
}
|
|
856
858
|
function parseNodeTransform(node) {
|
|
857
|
-
const transform = new Matrix3();
|
|
859
|
+
const transform = new THREE.Matrix3();
|
|
858
860
|
const currentTransform2 = tempTransform0;
|
|
859
861
|
if (node.nodeName === "use" && (node.hasAttribute("x") || node.hasAttribute("y"))) {
|
|
860
862
|
const tx = parseFloatWithUnits(node.getAttribute("x"));
|
|
@@ -985,13 +987,13 @@ class SVGLoader extends Loader {
|
|
|
985
987
|
const paths = [];
|
|
986
988
|
const stylesheets = {};
|
|
987
989
|
const transformStack = [];
|
|
988
|
-
const tempTransform0 = new Matrix3();
|
|
989
|
-
const tempTransform1 = new Matrix3();
|
|
990
|
-
const tempTransform2 = new Matrix3();
|
|
991
|
-
const tempTransform3 = new Matrix3();
|
|
992
|
-
const tempV2 = new Vector2();
|
|
993
|
-
const tempV3 = new Vector3();
|
|
994
|
-
const currentTransform = new Matrix3();
|
|
990
|
+
const tempTransform0 = new THREE.Matrix3();
|
|
991
|
+
const tempTransform1 = new THREE.Matrix3();
|
|
992
|
+
const tempTransform2 = new THREE.Matrix3();
|
|
993
|
+
const tempTransform3 = new THREE.Matrix3();
|
|
994
|
+
const tempV2 = new THREE.Vector2();
|
|
995
|
+
const tempV3 = new THREE.Vector3();
|
|
996
|
+
const currentTransform = new THREE.Matrix3();
|
|
995
997
|
const xml = new DOMParser().parseFromString(text, "image/svg+xml");
|
|
996
998
|
parseNode(xml.documentElement, {
|
|
997
999
|
fill: "#000",
|
|
@@ -1117,14 +1119,14 @@ class SVGLoader extends Loader {
|
|
|
1117
1119
|
(i) => i.t <= intersection.t + Number.EPSILON && i.t >= intersection.t - Number.EPSILON
|
|
1118
1120
|
) === void 0) {
|
|
1119
1121
|
intersectionsRaw.push(intersection);
|
|
1120
|
-
intersections.push(new Vector2(intersection.x, intersection.y));
|
|
1122
|
+
intersections.push(new THREE.Vector2(intersection.x, intersection.y));
|
|
1121
1123
|
}
|
|
1122
1124
|
}
|
|
1123
1125
|
}
|
|
1124
1126
|
return intersections;
|
|
1125
1127
|
}
|
|
1126
1128
|
function getScanlineIntersections(scanline, boundingBox, paths) {
|
|
1127
|
-
const center = new Vector2();
|
|
1129
|
+
const center = new THREE.Vector2();
|
|
1128
1130
|
boundingBox.getCenter(center);
|
|
1129
1131
|
const allIntersections = [];
|
|
1130
1132
|
paths.forEach((path) => {
|
|
@@ -1144,9 +1146,9 @@ class SVGLoader extends Loader {
|
|
|
1144
1146
|
if (_fillRule === null || _fillRule === void 0 || _fillRule === "") {
|
|
1145
1147
|
_fillRule = "nonzero";
|
|
1146
1148
|
}
|
|
1147
|
-
const centerBoundingBox = new Vector2();
|
|
1149
|
+
const centerBoundingBox = new THREE.Vector2();
|
|
1148
1150
|
simplePath.boundingBox.getCenter(centerBoundingBox);
|
|
1149
|
-
const scanline = [new Vector2(scanlineMinX2, centerBoundingBox.y), new Vector2(scanlineMaxX2, centerBoundingBox.y)];
|
|
1151
|
+
const scanline = [new THREE.Vector2(scanlineMinX2, centerBoundingBox.y), new THREE.Vector2(scanlineMaxX2, centerBoundingBox.y)];
|
|
1150
1152
|
const scanlineIntersections = getScanlineIntersections(scanline, simplePath.boundingBox, allPaths);
|
|
1151
1153
|
scanlineIntersections.sort((i1, i2) => {
|
|
1152
1154
|
return i1.point.x - i2.point.x;
|
|
@@ -1229,9 +1231,9 @@ class SVGLoader extends Loader {
|
|
|
1229
1231
|
return {
|
|
1230
1232
|
curves: p.curves,
|
|
1231
1233
|
points,
|
|
1232
|
-
isCW: ShapeUtils.isClockWise(points),
|
|
1234
|
+
isCW: THREE.ShapeUtils.isClockWise(points),
|
|
1233
1235
|
identifier: identifier++,
|
|
1234
|
-
boundingBox: new Box2(new Vector2(minX, minY), new Vector2(maxX, maxY))
|
|
1236
|
+
boundingBox: new THREE.Box2(new THREE.Vector2(minX, minY), new THREE.Vector2(maxX, maxY))
|
|
1235
1237
|
};
|
|
1236
1238
|
});
|
|
1237
1239
|
simplePaths = simplePaths.filter((sp) => sp.points.length > 1);
|
|
@@ -1242,12 +1244,12 @@ class SVGLoader extends Loader {
|
|
|
1242
1244
|
simplePaths.forEach((p) => {
|
|
1243
1245
|
const amIAHole = isAHole[p.identifier];
|
|
1244
1246
|
if (!amIAHole.isHole) {
|
|
1245
|
-
const shape = new Shape();
|
|
1247
|
+
const shape = new THREE.Shape();
|
|
1246
1248
|
shape.curves = p.curves;
|
|
1247
1249
|
const holes = isAHole.filter((h) => h.isHole && h.for === p.identifier);
|
|
1248
1250
|
holes.forEach((h) => {
|
|
1249
1251
|
const hole = simplePaths[h.identifier];
|
|
1250
|
-
const path = new Path();
|
|
1252
|
+
const path = new THREE.Path();
|
|
1251
1253
|
path.curves = hole.curves;
|
|
1252
1254
|
shape.holes.push(path);
|
|
1253
1255
|
});
|
|
@@ -1277,30 +1279,30 @@ class SVGLoader extends Loader {
|
|
|
1277
1279
|
if (SVGLoader.pointsToStrokeWithBuffers(points, style, arcDivisions, minDistance, vertices, normals, uvs) === 0) {
|
|
1278
1280
|
return null;
|
|
1279
1281
|
}
|
|
1280
|
-
const geometry = new BufferGeometry();
|
|
1281
|
-
geometry.setAttribute("position", new Float32BufferAttribute(vertices, 3));
|
|
1282
|
-
geometry.setAttribute("normal", new Float32BufferAttribute(normals, 3));
|
|
1283
|
-
geometry.setAttribute("uv", new Float32BufferAttribute(uvs, 2));
|
|
1282
|
+
const geometry = new THREE.BufferGeometry();
|
|
1283
|
+
geometry.setAttribute("position", new THREE.Float32BufferAttribute(vertices, 3));
|
|
1284
|
+
geometry.setAttribute("normal", new THREE.Float32BufferAttribute(normals, 3));
|
|
1285
|
+
geometry.setAttribute("uv", new THREE.Float32BufferAttribute(uvs, 2));
|
|
1284
1286
|
return geometry;
|
|
1285
1287
|
}
|
|
1286
1288
|
static pointsToStrokeWithBuffers(points, style, arcDivisions, minDistance, vertices, normals, uvs, vertexOffset) {
|
|
1287
|
-
const tempV2_1 = new Vector2();
|
|
1288
|
-
const tempV2_2 = new Vector2();
|
|
1289
|
-
const tempV2_3 = new Vector2();
|
|
1290
|
-
const tempV2_4 = new Vector2();
|
|
1291
|
-
const tempV2_5 = new Vector2();
|
|
1292
|
-
const tempV2_6 = new Vector2();
|
|
1293
|
-
const tempV2_7 = new Vector2();
|
|
1294
|
-
const lastPointL = new Vector2();
|
|
1295
|
-
const lastPointR = new Vector2();
|
|
1296
|
-
const point0L = new Vector2();
|
|
1297
|
-
const point0R = new Vector2();
|
|
1298
|
-
const currentPointL = new Vector2();
|
|
1299
|
-
const currentPointR = new Vector2();
|
|
1300
|
-
const nextPointL = new Vector2();
|
|
1301
|
-
const nextPointR = new Vector2();
|
|
1302
|
-
const innerPoint = new Vector2();
|
|
1303
|
-
const outerPoint = new Vector2();
|
|
1289
|
+
const tempV2_1 = new THREE.Vector2();
|
|
1290
|
+
const tempV2_2 = new THREE.Vector2();
|
|
1291
|
+
const tempV2_3 = new THREE.Vector2();
|
|
1292
|
+
const tempV2_4 = new THREE.Vector2();
|
|
1293
|
+
const tempV2_5 = new THREE.Vector2();
|
|
1294
|
+
const tempV2_6 = new THREE.Vector2();
|
|
1295
|
+
const tempV2_7 = new THREE.Vector2();
|
|
1296
|
+
const lastPointL = new THREE.Vector2();
|
|
1297
|
+
const lastPointR = new THREE.Vector2();
|
|
1298
|
+
const point0L = new THREE.Vector2();
|
|
1299
|
+
const point0R = new THREE.Vector2();
|
|
1300
|
+
const currentPointL = new THREE.Vector2();
|
|
1301
|
+
const currentPointR = new THREE.Vector2();
|
|
1302
|
+
const nextPointL = new THREE.Vector2();
|
|
1303
|
+
const nextPointR = new THREE.Vector2();
|
|
1304
|
+
const innerPoint = new THREE.Vector2();
|
|
1305
|
+
const outerPoint = new THREE.Vector2();
|
|
1304
1306
|
arcDivisions = arcDivisions !== void 0 ? arcDivisions : 12;
|
|
1305
1307
|
minDistance = minDistance !== void 0 ? minDistance : 1e-3;
|
|
1306
1308
|
vertexOffset = vertexOffset !== void 0 ? vertexOffset : 0;
|
|
@@ -1707,6 +1709,4 @@ class SVGLoader extends Loader {
|
|
|
1707
1709
|
}
|
|
1708
1710
|
}
|
|
1709
1711
|
}
|
|
1710
|
-
|
|
1711
|
-
SVGLoader
|
|
1712
|
-
};
|
|
1712
|
+
exports.SVGLoader = SVGLoader;
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const THREE = require("three");
|
|
4
|
-
class SVGLoader extends THREE.Loader {
|
|
1
|
+
import { Loader, FileLoader, ShapePath, Vector2, Path, Matrix3, Vector3, ShapeUtils, Box2, Shape, BufferGeometry, Float32BufferAttribute } from "three";
|
|
2
|
+
class SVGLoader extends Loader {
|
|
5
3
|
constructor(manager) {
|
|
6
4
|
super(manager);
|
|
7
5
|
this.defaultDPI = 90;
|
|
@@ -9,7 +7,7 @@ class SVGLoader extends THREE.Loader {
|
|
|
9
7
|
}
|
|
10
8
|
load(url, onLoad, onProgress, onError) {
|
|
11
9
|
const scope = this;
|
|
12
|
-
const loader = new
|
|
10
|
+
const loader = new FileLoader(scope.manager);
|
|
13
11
|
loader.setPath(scope.path);
|
|
14
12
|
loader.setRequestHeader(scope.requestHeader);
|
|
15
13
|
loader.setWithCredentials(scope.withCredentials);
|
|
@@ -119,10 +117,10 @@ class SVGLoader extends THREE.Loader {
|
|
|
119
117
|
}
|
|
120
118
|
}
|
|
121
119
|
function parsePathNode(node) {
|
|
122
|
-
const path = new
|
|
123
|
-
const point = new
|
|
124
|
-
const control = new
|
|
125
|
-
const firstPoint = new
|
|
120
|
+
const path = new ShapePath();
|
|
121
|
+
const point = new Vector2();
|
|
122
|
+
const control = new Vector2();
|
|
123
|
+
const firstPoint = new Vector2();
|
|
126
124
|
let isFirstPoint = true;
|
|
127
125
|
let doSetFirstPoint = false;
|
|
128
126
|
const d = node.getAttribute("d");
|
|
@@ -500,7 +498,7 @@ class SVGLoader extends THREE.Loader {
|
|
|
500
498
|
const w = parseFloatWithUnits(node.getAttribute("width"));
|
|
501
499
|
const h = parseFloatWithUnits(node.getAttribute("height"));
|
|
502
500
|
const bci = 1 - 0.551915024494;
|
|
503
|
-
const path = new
|
|
501
|
+
const path = new ShapePath();
|
|
504
502
|
path.moveTo(x + rx, y);
|
|
505
503
|
path.lineTo(x + w - rx, y);
|
|
506
504
|
if (rx !== 0 || ry !== 0) {
|
|
@@ -532,7 +530,7 @@ class SVGLoader extends THREE.Loader {
|
|
|
532
530
|
index++;
|
|
533
531
|
}
|
|
534
532
|
const regex = /(-?[\d\.?]+)[,|\s](-?[\d\.?]+)/g;
|
|
535
|
-
const path = new
|
|
533
|
+
const path = new ShapePath();
|
|
536
534
|
let index = 0;
|
|
537
535
|
node.getAttribute("points").replace(regex, iterator);
|
|
538
536
|
path.currentPath.autoClose = true;
|
|
@@ -550,7 +548,7 @@ class SVGLoader extends THREE.Loader {
|
|
|
550
548
|
index++;
|
|
551
549
|
}
|
|
552
550
|
const regex = /(-?[\d\.?]+)[,|\s](-?[\d\.?]+)/g;
|
|
553
|
-
const path = new
|
|
551
|
+
const path = new ShapePath();
|
|
554
552
|
let index = 0;
|
|
555
553
|
node.getAttribute("points").replace(regex, iterator);
|
|
556
554
|
path.currentPath.autoClose = false;
|
|
@@ -560,9 +558,9 @@ class SVGLoader extends THREE.Loader {
|
|
|
560
558
|
const x = parseFloatWithUnits(node.getAttribute("cx") || 0);
|
|
561
559
|
const y = parseFloatWithUnits(node.getAttribute("cy") || 0);
|
|
562
560
|
const r = parseFloatWithUnits(node.getAttribute("r") || 0);
|
|
563
|
-
const subpath = new
|
|
561
|
+
const subpath = new Path();
|
|
564
562
|
subpath.absarc(x, y, r, 0, Math.PI * 2);
|
|
565
|
-
const path = new
|
|
563
|
+
const path = new ShapePath();
|
|
566
564
|
path.subPaths.push(subpath);
|
|
567
565
|
return path;
|
|
568
566
|
}
|
|
@@ -571,9 +569,9 @@ class SVGLoader extends THREE.Loader {
|
|
|
571
569
|
const y = parseFloatWithUnits(node.getAttribute("cy") || 0);
|
|
572
570
|
const rx = parseFloatWithUnits(node.getAttribute("rx") || 0);
|
|
573
571
|
const ry = parseFloatWithUnits(node.getAttribute("ry") || 0);
|
|
574
|
-
const subpath = new
|
|
572
|
+
const subpath = new Path();
|
|
575
573
|
subpath.absellipse(x, y, rx, ry, 0, Math.PI * 2);
|
|
576
|
-
const path = new
|
|
574
|
+
const path = new ShapePath();
|
|
577
575
|
path.subPaths.push(subpath);
|
|
578
576
|
return path;
|
|
579
577
|
}
|
|
@@ -582,7 +580,7 @@ class SVGLoader extends THREE.Loader {
|
|
|
582
580
|
const y1 = parseFloatWithUnits(node.getAttribute("y1") || 0);
|
|
583
581
|
const x2 = parseFloatWithUnits(node.getAttribute("x2") || 0);
|
|
584
582
|
const y2 = parseFloatWithUnits(node.getAttribute("y2") || 0);
|
|
585
|
-
const path = new
|
|
583
|
+
const path = new ShapePath();
|
|
586
584
|
path.moveTo(x1, y1);
|
|
587
585
|
path.lineTo(x2, y2);
|
|
588
586
|
path.currentPath.autoClose = false;
|
|
@@ -856,7 +854,7 @@ class SVGLoader extends THREE.Loader {
|
|
|
856
854
|
return transform;
|
|
857
855
|
}
|
|
858
856
|
function parseNodeTransform(node) {
|
|
859
|
-
const transform = new
|
|
857
|
+
const transform = new Matrix3();
|
|
860
858
|
const currentTransform2 = tempTransform0;
|
|
861
859
|
if (node.nodeName === "use" && (node.hasAttribute("x") || node.hasAttribute("y"))) {
|
|
862
860
|
const tx = parseFloatWithUnits(node.getAttribute("x"));
|
|
@@ -987,13 +985,13 @@ class SVGLoader extends THREE.Loader {
|
|
|
987
985
|
const paths = [];
|
|
988
986
|
const stylesheets = {};
|
|
989
987
|
const transformStack = [];
|
|
990
|
-
const tempTransform0 = new
|
|
991
|
-
const tempTransform1 = new
|
|
992
|
-
const tempTransform2 = new
|
|
993
|
-
const tempTransform3 = new
|
|
994
|
-
const tempV2 = new
|
|
995
|
-
const tempV3 = new
|
|
996
|
-
const currentTransform = new
|
|
988
|
+
const tempTransform0 = new Matrix3();
|
|
989
|
+
const tempTransform1 = new Matrix3();
|
|
990
|
+
const tempTransform2 = new Matrix3();
|
|
991
|
+
const tempTransform3 = new Matrix3();
|
|
992
|
+
const tempV2 = new Vector2();
|
|
993
|
+
const tempV3 = new Vector3();
|
|
994
|
+
const currentTransform = new Matrix3();
|
|
997
995
|
const xml = new DOMParser().parseFromString(text, "image/svg+xml");
|
|
998
996
|
parseNode(xml.documentElement, {
|
|
999
997
|
fill: "#000",
|
|
@@ -1119,14 +1117,14 @@ class SVGLoader extends THREE.Loader {
|
|
|
1119
1117
|
(i) => i.t <= intersection.t + Number.EPSILON && i.t >= intersection.t - Number.EPSILON
|
|
1120
1118
|
) === void 0) {
|
|
1121
1119
|
intersectionsRaw.push(intersection);
|
|
1122
|
-
intersections.push(new
|
|
1120
|
+
intersections.push(new Vector2(intersection.x, intersection.y));
|
|
1123
1121
|
}
|
|
1124
1122
|
}
|
|
1125
1123
|
}
|
|
1126
1124
|
return intersections;
|
|
1127
1125
|
}
|
|
1128
1126
|
function getScanlineIntersections(scanline, boundingBox, paths) {
|
|
1129
|
-
const center = new
|
|
1127
|
+
const center = new Vector2();
|
|
1130
1128
|
boundingBox.getCenter(center);
|
|
1131
1129
|
const allIntersections = [];
|
|
1132
1130
|
paths.forEach((path) => {
|
|
@@ -1146,9 +1144,9 @@ class SVGLoader extends THREE.Loader {
|
|
|
1146
1144
|
if (_fillRule === null || _fillRule === void 0 || _fillRule === "") {
|
|
1147
1145
|
_fillRule = "nonzero";
|
|
1148
1146
|
}
|
|
1149
|
-
const centerBoundingBox = new
|
|
1147
|
+
const centerBoundingBox = new Vector2();
|
|
1150
1148
|
simplePath.boundingBox.getCenter(centerBoundingBox);
|
|
1151
|
-
const scanline = [new
|
|
1149
|
+
const scanline = [new Vector2(scanlineMinX2, centerBoundingBox.y), new Vector2(scanlineMaxX2, centerBoundingBox.y)];
|
|
1152
1150
|
const scanlineIntersections = getScanlineIntersections(scanline, simplePath.boundingBox, allPaths);
|
|
1153
1151
|
scanlineIntersections.sort((i1, i2) => {
|
|
1154
1152
|
return i1.point.x - i2.point.x;
|
|
@@ -1231,9 +1229,9 @@ class SVGLoader extends THREE.Loader {
|
|
|
1231
1229
|
return {
|
|
1232
1230
|
curves: p.curves,
|
|
1233
1231
|
points,
|
|
1234
|
-
isCW:
|
|
1232
|
+
isCW: ShapeUtils.isClockWise(points),
|
|
1235
1233
|
identifier: identifier++,
|
|
1236
|
-
boundingBox: new
|
|
1234
|
+
boundingBox: new Box2(new Vector2(minX, minY), new Vector2(maxX, maxY))
|
|
1237
1235
|
};
|
|
1238
1236
|
});
|
|
1239
1237
|
simplePaths = simplePaths.filter((sp) => sp.points.length > 1);
|
|
@@ -1244,12 +1242,12 @@ class SVGLoader extends THREE.Loader {
|
|
|
1244
1242
|
simplePaths.forEach((p) => {
|
|
1245
1243
|
const amIAHole = isAHole[p.identifier];
|
|
1246
1244
|
if (!amIAHole.isHole) {
|
|
1247
|
-
const shape = new
|
|
1245
|
+
const shape = new Shape();
|
|
1248
1246
|
shape.curves = p.curves;
|
|
1249
1247
|
const holes = isAHole.filter((h) => h.isHole && h.for === p.identifier);
|
|
1250
1248
|
holes.forEach((h) => {
|
|
1251
1249
|
const hole = simplePaths[h.identifier];
|
|
1252
|
-
const path = new
|
|
1250
|
+
const path = new Path();
|
|
1253
1251
|
path.curves = hole.curves;
|
|
1254
1252
|
shape.holes.push(path);
|
|
1255
1253
|
});
|
|
@@ -1279,30 +1277,30 @@ class SVGLoader extends THREE.Loader {
|
|
|
1279
1277
|
if (SVGLoader.pointsToStrokeWithBuffers(points, style, arcDivisions, minDistance, vertices, normals, uvs) === 0) {
|
|
1280
1278
|
return null;
|
|
1281
1279
|
}
|
|
1282
|
-
const geometry = new
|
|
1283
|
-
geometry.setAttribute("position", new
|
|
1284
|
-
geometry.setAttribute("normal", new
|
|
1285
|
-
geometry.setAttribute("uv", new
|
|
1280
|
+
const geometry = new BufferGeometry();
|
|
1281
|
+
geometry.setAttribute("position", new Float32BufferAttribute(vertices, 3));
|
|
1282
|
+
geometry.setAttribute("normal", new Float32BufferAttribute(normals, 3));
|
|
1283
|
+
geometry.setAttribute("uv", new Float32BufferAttribute(uvs, 2));
|
|
1286
1284
|
return geometry;
|
|
1287
1285
|
}
|
|
1288
1286
|
static pointsToStrokeWithBuffers(points, style, arcDivisions, minDistance, vertices, normals, uvs, vertexOffset) {
|
|
1289
|
-
const tempV2_1 = new
|
|
1290
|
-
const tempV2_2 = new
|
|
1291
|
-
const tempV2_3 = new
|
|
1292
|
-
const tempV2_4 = new
|
|
1293
|
-
const tempV2_5 = new
|
|
1294
|
-
const tempV2_6 = new
|
|
1295
|
-
const tempV2_7 = new
|
|
1296
|
-
const lastPointL = new
|
|
1297
|
-
const lastPointR = new
|
|
1298
|
-
const point0L = new
|
|
1299
|
-
const point0R = new
|
|
1300
|
-
const currentPointL = new
|
|
1301
|
-
const currentPointR = new
|
|
1302
|
-
const nextPointL = new
|
|
1303
|
-
const nextPointR = new
|
|
1304
|
-
const innerPoint = new
|
|
1305
|
-
const outerPoint = new
|
|
1287
|
+
const tempV2_1 = new Vector2();
|
|
1288
|
+
const tempV2_2 = new Vector2();
|
|
1289
|
+
const tempV2_3 = new Vector2();
|
|
1290
|
+
const tempV2_4 = new Vector2();
|
|
1291
|
+
const tempV2_5 = new Vector2();
|
|
1292
|
+
const tempV2_6 = new Vector2();
|
|
1293
|
+
const tempV2_7 = new Vector2();
|
|
1294
|
+
const lastPointL = new Vector2();
|
|
1295
|
+
const lastPointR = new Vector2();
|
|
1296
|
+
const point0L = new Vector2();
|
|
1297
|
+
const point0R = new Vector2();
|
|
1298
|
+
const currentPointL = new Vector2();
|
|
1299
|
+
const currentPointR = new Vector2();
|
|
1300
|
+
const nextPointL = new Vector2();
|
|
1301
|
+
const nextPointR = new Vector2();
|
|
1302
|
+
const innerPoint = new Vector2();
|
|
1303
|
+
const outerPoint = new Vector2();
|
|
1306
1304
|
arcDivisions = arcDivisions !== void 0 ? arcDivisions : 12;
|
|
1307
1305
|
minDistance = minDistance !== void 0 ? minDistance : 1e-3;
|
|
1308
1306
|
vertexOffset = vertexOffset !== void 0 ? vertexOffset : 0;
|
|
@@ -1709,4 +1707,6 @@ class SVGLoader extends THREE.Loader {
|
|
|
1709
1707
|
}
|
|
1710
1708
|
}
|
|
1711
1709
|
}
|
|
1712
|
-
|
|
1710
|
+
export {
|
|
1711
|
+
SVGLoader
|
|
1712
|
+
};
|