three-stdlib 2.35.3 → 2.35.4
Sign up to get free protection for your applications and to get access to all the features.
- package/_polyfill/CapsuleGeometry.cjs +20 -17
- package/_polyfill/CapsuleGeometry.cjs.map +1 -1
- package/_polyfill/CapsuleGeometry.js +20 -17
- package/_polyfill/CapsuleGeometry.js.map +1 -1
- package/_polyfill/constants.cjs +1 -1
- package/_polyfill/constants.cjs.map +1 -1
- package/_polyfill/constants.js +1 -1
- package/_polyfill/constants.js.map +1 -1
- package/animation/AnimationClipCreator.cjs +13 -13
- package/animation/AnimationClipCreator.cjs.map +1 -1
- package/animation/AnimationClipCreator.js +13 -13
- package/animation/AnimationClipCreator.js.map +1 -1
- package/animation/CCDIKSolver.cjs +11 -11
- package/animation/CCDIKSolver.cjs.map +1 -1
- package/animation/CCDIKSolver.js +12 -12
- package/animation/CCDIKSolver.js.map +1 -1
- package/animation/MMDAnimationHelper.cjs +1 -1
- package/animation/MMDAnimationHelper.cjs.map +1 -1
- package/animation/MMDAnimationHelper.js +1 -1
- package/animation/MMDAnimationHelper.js.map +1 -1
- package/animation/MMDPhysics.cjs +4 -4
- package/animation/MMDPhysics.cjs.map +1 -1
- package/animation/MMDPhysics.js +4 -4
- package/animation/MMDPhysics.js.map +1 -1
- package/controls/ArcballControls.cjs +2 -2
- package/controls/ArcballControls.cjs.map +1 -1
- package/controls/ArcballControls.js +3 -3
- package/controls/ArcballControls.js.map +1 -1
- package/controls/FirstPersonControls.cjs +1 -1
- package/controls/FirstPersonControls.cjs.map +1 -1
- package/controls/FirstPersonControls.js +1 -1
- package/controls/FirstPersonControls.js.map +1 -1
- package/controls/OrbitControls.cjs +2 -2
- package/controls/OrbitControls.cjs.map +1 -1
- package/controls/OrbitControls.js +3 -3
- package/controls/OrbitControls.js.map +1 -1
- package/controls/PointerLockControls.cjs +2 -2
- package/controls/PointerLockControls.cjs.map +1 -1
- package/controls/PointerLockControls.js +3 -3
- package/controls/PointerLockControls.js.map +1 -1
- package/csm/CSM.cjs +4 -4
- package/csm/CSM.cjs.map +1 -1
- package/csm/CSM.js +5 -5
- package/csm/CSM.js.map +1 -1
- package/csm/CSMFrustum.cjs +1 -1
- package/csm/CSMFrustum.cjs.map +1 -1
- package/csm/CSMFrustum.js +2 -2
- package/csm/CSMFrustum.js.map +1 -1
- package/deprecated/Geometry.cjs +722 -715
- package/deprecated/Geometry.cjs.map +1 -1
- package/deprecated/Geometry.js +723 -716
- package/deprecated/Geometry.js.map +1 -1
- package/effects/AnaglyphEffect.cjs +2 -1
- package/effects/AnaglyphEffect.cjs.map +1 -1
- package/effects/AnaglyphEffect.js +3 -2
- package/effects/AnaglyphEffect.js.map +1 -1
- package/effects/OutlineEffect.cjs +2 -1
- package/effects/OutlineEffect.cjs.map +1 -1
- package/effects/OutlineEffect.js +3 -2
- package/effects/OutlineEffect.js.map +1 -1
- package/effects/ParallaxBarrierEffect.cjs +2 -1
- package/effects/ParallaxBarrierEffect.cjs.map +1 -1
- package/effects/ParallaxBarrierEffect.js +3 -2
- package/effects/ParallaxBarrierEffect.js.map +1 -1
- package/exporters/DRACOExporter.cjs +133 -122
- package/exporters/DRACOExporter.cjs.map +1 -1
- package/exporters/DRACOExporter.d.ts +23 -21
- package/exporters/DRACOExporter.js +133 -122
- package/exporters/DRACOExporter.js.map +1 -1
- package/exporters/GLTFExporter.cjs +170 -167
- package/exporters/GLTFExporter.cjs.map +1 -1
- package/exporters/GLTFExporter.js +170 -167
- package/exporters/GLTFExporter.js.map +1 -1
- package/geometries/LightningStrike.cjs +524 -515
- package/geometries/LightningStrike.cjs.map +1 -1
- package/geometries/LightningStrike.js +524 -515
- package/geometries/LightningStrike.js.map +1 -1
- package/geometries/RoundedBoxGeometry.cjs +1 -1
- package/geometries/RoundedBoxGeometry.cjs.map +1 -1
- package/geometries/RoundedBoxGeometry.js +2 -2
- package/geometries/RoundedBoxGeometry.js.map +1 -1
- package/helpers/RaycasterHelper.cjs +2 -2
- package/helpers/RaycasterHelper.cjs.map +1 -1
- package/helpers/RaycasterHelper.js +3 -3
- package/helpers/RaycasterHelper.js.map +1 -1
- package/helpers/VertexNormalsHelper.cjs +3 -3
- package/helpers/VertexNormalsHelper.cjs.map +1 -1
- package/helpers/VertexNormalsHelper.js +4 -4
- package/helpers/VertexNormalsHelper.js.map +1 -1
- package/helpers/VertexTangentsHelper.cjs +2 -2
- package/helpers/VertexTangentsHelper.cjs.map +1 -1
- package/helpers/VertexTangentsHelper.js +3 -3
- package/helpers/VertexTangentsHelper.js.map +1 -1
- package/interactive/InteractiveGroup.cjs +1 -1
- package/interactive/InteractiveGroup.cjs.map +1 -1
- package/interactive/InteractiveGroup.js +2 -2
- package/interactive/InteractiveGroup.js.map +1 -1
- package/interactive/SelectionBox.cjs +15 -15
- package/interactive/SelectionBox.cjs.map +1 -1
- package/interactive/SelectionBox.js +16 -16
- package/interactive/SelectionBox.js.map +1 -1
- package/libs/chevrotain.cjs +1 -1
- package/libs/chevrotain.cjs.map +1 -1
- package/libs/chevrotain.js +1 -1
- package/libs/chevrotain.js.map +1 -1
- package/libs/lottie.cjs +1 -1
- package/libs/lottie.cjs.map +1 -1
- package/libs/lottie.js +1 -1
- package/libs/lottie.js.map +1 -1
- package/libs/opentype.cjs +1 -1
- package/libs/opentype.cjs.map +1 -1
- package/libs/opentype.js +1 -1
- package/libs/opentype.js.map +1 -1
- package/lights/LightProbeGenerator.cjs +5 -5
- package/lights/LightProbeGenerator.cjs.map +1 -1
- package/lights/LightProbeGenerator.js +5 -5
- package/lights/LightProbeGenerator.js.map +1 -1
- package/lights/RectAreaLightUniformsLib.cjs +3 -3
- package/lights/RectAreaLightUniformsLib.cjs.map +1 -1
- package/lights/RectAreaLightUniformsLib.js +3 -3
- package/lights/RectAreaLightUniformsLib.js.map +1 -1
- package/lines/LineMaterial.cjs +2 -1
- package/lines/LineMaterial.cjs.map +1 -1
- package/lines/LineMaterial.js +3 -2
- package/lines/LineMaterial.js.map +1 -1
- package/lines/LineSegments2.cjs +13 -13
- package/lines/LineSegments2.cjs.map +1 -1
- package/lines/LineSegments2.js +14 -14
- package/lines/LineSegments2.js.map +1 -1
- package/lines/LineSegmentsGeometry.cjs +2 -2
- package/lines/LineSegmentsGeometry.cjs.map +1 -1
- package/lines/LineSegmentsGeometry.js +3 -3
- package/lines/LineSegmentsGeometry.js.map +1 -1
- package/lines/Wireframe.cjs +3 -3
- package/lines/Wireframe.cjs.map +1 -1
- package/lines/Wireframe.js +4 -4
- package/lines/Wireframe.js.map +1 -1
- package/loaders/BasisTextureLoader.cjs +441 -435
- package/loaders/BasisTextureLoader.cjs.map +1 -1
- package/loaders/BasisTextureLoader.js +441 -435
- package/loaders/BasisTextureLoader.js.map +1 -1
- package/loaders/EXRLoader.cjs +2 -1
- package/loaders/EXRLoader.cjs.map +1 -1
- package/loaders/EXRLoader.js +3 -2
- package/loaders/EXRLoader.js.map +1 -1
- package/loaders/FBXLoader.cjs +2 -2
- package/loaders/FBXLoader.cjs.map +1 -1
- package/loaders/FBXLoader.js +2 -2
- package/loaders/FBXLoader.js.map +1 -1
- package/loaders/FontLoader.cjs +2 -2
- package/loaders/FontLoader.cjs.map +1 -1
- package/loaders/FontLoader.d.ts +2 -2
- package/loaders/FontLoader.js +2 -2
- package/loaders/FontLoader.js.map +1 -1
- package/loaders/GLTFLoader.cjs +2 -2
- package/loaders/GLTFLoader.cjs.map +1 -1
- package/loaders/GLTFLoader.js +2 -2
- package/loaders/GLTFLoader.js.map +1 -1
- package/loaders/KTX2Loader.cjs +377 -374
- package/loaders/KTX2Loader.cjs.map +1 -1
- package/loaders/KTX2Loader.js +377 -374
- package/loaders/KTX2Loader.js.map +1 -1
- package/loaders/LDrawLoader.cjs +5 -4
- package/loaders/LDrawLoader.cjs.map +1 -1
- package/loaders/LDrawLoader.js +6 -5
- package/loaders/LDrawLoader.js.map +1 -1
- package/loaders/OBJLoader.cjs +5 -5
- package/loaders/OBJLoader.cjs.map +1 -1
- package/loaders/OBJLoader.js +6 -6
- package/loaders/OBJLoader.js.map +1 -1
- package/loaders/PRWMLoader.cjs +46 -43
- package/loaders/PRWMLoader.cjs.map +1 -1
- package/loaders/PRWMLoader.js +46 -43
- package/loaders/PRWMLoader.js.map +1 -1
- package/loaders/SVGLoader.cjs +1694 -1688
- package/loaders/SVGLoader.cjs.map +1 -1
- package/loaders/SVGLoader.js +1694 -1688
- package/loaders/SVGLoader.js.map +1 -1
- package/loaders/XLoader.cjs +1 -1
- package/loaders/XLoader.cjs.map +1 -1
- package/loaders/XLoader.js +1 -1
- package/loaders/XLoader.js.map +1 -1
- package/math/Capsule.cjs +3 -3
- package/math/Capsule.cjs.map +1 -1
- package/math/Capsule.js +3 -3
- package/math/Capsule.js.map +1 -1
- package/math/ColorConverter.cjs +9 -9
- package/math/ColorConverter.cjs.map +1 -1
- package/math/ColorConverter.js +9 -9
- package/math/ColorConverter.js.map +1 -1
- package/math/ConvexHull.cjs +53 -50
- package/math/ConvexHull.cjs.map +1 -1
- package/math/ConvexHull.js +53 -50
- package/math/ConvexHull.js.map +1 -1
- package/math/ImprovedNoise.cjs +1 -1
- package/math/ImprovedNoise.cjs.map +1 -1
- package/math/ImprovedNoise.js +1 -1
- package/math/ImprovedNoise.js.map +1 -1
- package/math/MeshSurfaceSampler.cjs +2 -2
- package/math/MeshSurfaceSampler.cjs.map +1 -1
- package/math/MeshSurfaceSampler.js +2 -2
- package/math/MeshSurfaceSampler.js.map +1 -1
- package/math/OBB.cjs +14 -14
- package/math/OBB.cjs.map +1 -1
- package/math/OBB.js +15 -15
- package/math/OBB.js.map +1 -1
- package/math/Octree.cjs +7 -7
- package/math/Octree.cjs.map +1 -1
- package/math/Octree.js +8 -8
- package/math/Octree.js.map +1 -1
- package/misc/ConvexObjectBreaker.cjs +271 -268
- package/misc/ConvexObjectBreaker.cjs.map +1 -1
- package/misc/ConvexObjectBreaker.js +272 -269
- package/misc/ConvexObjectBreaker.js.map +1 -1
- package/misc/Gyroscope.cjs +6 -6
- package/misc/Gyroscope.cjs.map +1 -1
- package/misc/Gyroscope.js +7 -7
- package/misc/Gyroscope.js.map +1 -1
- package/modifiers/CurveModifier.cjs +1 -1
- package/modifiers/CurveModifier.cjs.map +1 -1
- package/modifiers/CurveModifier.js +2 -2
- package/modifiers/CurveModifier.js.map +1 -1
- package/modifiers/SimplifyModifier.cjs +2 -2
- package/modifiers/SimplifyModifier.cjs.map +1 -1
- package/modifiers/SimplifyModifier.js +2 -2
- package/modifiers/SimplifyModifier.js.map +1 -1
- package/objects/BatchedMesh.cjs +2 -2
- package/objects/BatchedMesh.cjs.map +1 -1
- package/objects/BatchedMesh.js +3 -3
- package/objects/BatchedMesh.js.map +1 -1
- package/objects/GroundProjectedEnv.cjs +2 -1
- package/objects/GroundProjectedEnv.cjs.map +1 -1
- package/objects/GroundProjectedEnv.js +3 -2
- package/objects/GroundProjectedEnv.js.map +1 -1
- package/objects/Lensflare.cjs +209 -206
- package/objects/Lensflare.cjs.map +1 -1
- package/objects/Lensflare.js +209 -206
- package/objects/Lensflare.js.map +1 -1
- package/objects/Reflector.cjs +154 -146
- package/objects/Reflector.cjs.map +1 -1
- package/objects/Reflector.js +154 -146
- package/objects/Reflector.js.map +1 -1
- package/objects/ReflectorForSSRPass.cjs +183 -180
- package/objects/ReflectorForSSRPass.cjs.map +1 -1
- package/objects/ReflectorForSSRPass.js +183 -180
- package/objects/ReflectorForSSRPass.js.map +1 -1
- package/objects/Refractor.cjs +164 -161
- package/objects/Refractor.cjs.map +1 -1
- package/objects/Refractor.js +164 -161
- package/objects/Refractor.js.map +1 -1
- package/objects/ShadowMesh.cjs +1 -1
- package/objects/ShadowMesh.cjs.map +1 -1
- package/objects/ShadowMesh.js +2 -2
- package/objects/ShadowMesh.js.map +1 -1
- package/objects/Sky.cjs +35 -32
- package/objects/Sky.cjs.map +1 -1
- package/objects/Sky.d.ts +100 -6
- package/objects/Sky.js +35 -32
- package/objects/Sky.js.map +1 -1
- package/objects/Water.cjs +2 -1
- package/objects/Water.cjs.map +1 -1
- package/objects/Water.js +3 -2
- package/objects/Water.js.map +1 -1
- package/objects/Water2.cjs +143 -140
- package/objects/Water2.cjs.map +1 -1
- package/objects/Water2.js +143 -140
- package/objects/Water2.js.map +1 -1
- package/package.json +1 -1
- package/postprocessing/SAOPass.cjs +267 -264
- package/postprocessing/SAOPass.cjs.map +1 -1
- package/postprocessing/SAOPass.js +267 -264
- package/postprocessing/SAOPass.js.map +1 -1
- package/postprocessing/SSAOPass.cjs +253 -250
- package/postprocessing/SSAOPass.cjs.map +1 -1
- package/postprocessing/SSAOPass.js +253 -250
- package/postprocessing/SSAOPass.js.map +1 -1
- package/postprocessing/SSRPass.cjs +379 -376
- package/postprocessing/SSRPass.cjs.map +1 -1
- package/postprocessing/SSRPass.js +379 -376
- package/postprocessing/SSRPass.js.map +1 -1
- package/postprocessing/UnrealBloomPass.cjs +205 -202
- package/postprocessing/UnrealBloomPass.cjs.map +1 -1
- package/postprocessing/UnrealBloomPass.js +205 -202
- package/postprocessing/UnrealBloomPass.js.map +1 -1
- package/renderers/CSS2DRenderer.cjs +5 -5
- package/renderers/CSS2DRenderer.cjs.map +1 -1
- package/renderers/CSS2DRenderer.js +5 -5
- package/renderers/CSS2DRenderer.js.map +1 -1
- package/renderers/CSS3DRenderer.cjs +5 -5
- package/renderers/CSS3DRenderer.cjs.map +1 -1
- package/renderers/CSS3DRenderer.js +6 -6
- package/renderers/CSS3DRenderer.js.map +1 -1
- package/shaders/ACESFilmicToneMappingShader.cjs +71 -46
- package/shaders/ACESFilmicToneMappingShader.cjs.map +1 -1
- package/shaders/ACESFilmicToneMappingShader.js +71 -46
- package/shaders/ACESFilmicToneMappingShader.js.map +1 -1
- package/shaders/AfterimageShader.cjs +41 -22
- package/shaders/AfterimageShader.cjs.map +1 -1
- package/shaders/AfterimageShader.js +41 -22
- package/shaders/AfterimageShader.js.map +1 -1
- package/shaders/BasicShader.cjs +20 -6
- package/shaders/BasicShader.cjs.map +1 -1
- package/shaders/BasicShader.js +20 -6
- package/shaders/BasicShader.js.map +1 -1
- package/shaders/BleachBypassShader.cjs +46 -26
- package/shaders/BleachBypassShader.cjs.map +1 -1
- package/shaders/BleachBypassShader.js +46 -26
- package/shaders/BleachBypassShader.js.map +1 -1
- package/shaders/BlendShader.cjs +33 -19
- package/shaders/BlendShader.cjs.map +1 -1
- package/shaders/BlendShader.js +33 -19
- package/shaders/BlendShader.js.map +1 -1
- package/shaders/BokehShader.cjs +117 -90
- package/shaders/BokehShader.cjs.map +1 -1
- package/shaders/BokehShader.js +117 -90
- package/shaders/BokehShader.js.map +1 -1
- package/shaders/BokehShader2.cjs +333 -232
- package/shaders/BokehShader2.cjs.map +1 -1
- package/shaders/BokehShader2.js +333 -232
- package/shaders/BokehShader2.js.map +1 -1
- package/shaders/BrightnessContrastShader.cjs +38 -22
- package/shaders/BrightnessContrastShader.cjs.map +1 -1
- package/shaders/BrightnessContrastShader.js +38 -22
- package/shaders/BrightnessContrastShader.js.map +1 -1
- package/shaders/ColorCorrectionShader.cjs +35 -21
- package/shaders/ColorCorrectionShader.cjs.map +1 -1
- package/shaders/ColorCorrectionShader.js +35 -21
- package/shaders/ColorCorrectionShader.js.map +1 -1
- package/shaders/ColorifyShader.cjs +34 -19
- package/shaders/ColorifyShader.cjs.map +1 -1
- package/shaders/ColorifyShader.js +34 -19
- package/shaders/ColorifyShader.js.map +1 -1
- package/shaders/ConvolutionShader.cjs +43 -24
- package/shaders/ConvolutionShader.cjs.map +1 -1
- package/shaders/ConvolutionShader.js +43 -24
- package/shaders/ConvolutionShader.js.map +1 -1
- package/shaders/CopyShader.cjs +30 -16
- package/shaders/CopyShader.cjs.map +1 -1
- package/shaders/CopyShader.js +30 -16
- package/shaders/CopyShader.js.map +1 -1
- package/shaders/DOFMipMapShader.cjs +38 -21
- package/shaders/DOFMipMapShader.cjs.map +1 -1
- package/shaders/DOFMipMapShader.js +38 -21
- package/shaders/DOFMipMapShader.js.map +1 -1
- package/shaders/DepthLimitedBlurShader.cjs +98 -69
- package/shaders/DepthLimitedBlurShader.cjs.map +1 -1
- package/shaders/DepthLimitedBlurShader.js +98 -69
- package/shaders/DepthLimitedBlurShader.js.map +1 -1
- package/shaders/DigitalGlitch.cjs +70 -59
- package/shaders/DigitalGlitch.cjs.map +1 -1
- package/shaders/DigitalGlitch.js +70 -59
- package/shaders/DigitalGlitch.js.map +1 -1
- package/shaders/DotScreenShader.cjs +49 -28
- package/shaders/DotScreenShader.cjs.map +1 -1
- package/shaders/DotScreenShader.js +49 -28
- package/shaders/DotScreenShader.js.map +1 -1
- package/shaders/FXAAShader.cjs +1098 -1089
- package/shaders/FXAAShader.cjs.map +1 -1
- package/shaders/FXAAShader.js +1098 -1089
- package/shaders/FXAAShader.js.map +1 -1
- package/shaders/FilmShader.cjs +57 -29
- package/shaders/FilmShader.cjs.map +1 -1
- package/shaders/FilmShader.js +57 -29
- package/shaders/FilmShader.js.map +1 -1
- package/shaders/FocusShader.cjs +70 -43
- package/shaders/FocusShader.cjs.map +1 -1
- package/shaders/FocusShader.js +70 -43
- package/shaders/FocusShader.js.map +1 -1
- package/shaders/FreiChenShader.cjs +74 -53
- package/shaders/FreiChenShader.cjs.map +1 -1
- package/shaders/FreiChenShader.js +74 -53
- package/shaders/FreiChenShader.js.map +1 -1
- package/shaders/FresnelShader.cjs +55 -35
- package/shaders/FresnelShader.cjs.map +1 -1
- package/shaders/FresnelShader.js +55 -35
- package/shaders/FresnelShader.js.map +1 -1
- package/shaders/GammaCorrectionShader.cjs +33 -19
- package/shaders/GammaCorrectionShader.cjs.map +1 -1
- package/shaders/GammaCorrectionShader.js +33 -19
- package/shaders/GammaCorrectionShader.js.map +1 -1
- package/shaders/GodRaysShader.cjs +193 -116
- package/shaders/GodRaysShader.cjs.map +1 -1
- package/shaders/GodRaysShader.js +193 -116
- package/shaders/GodRaysShader.js.map +1 -1
- package/shaders/HalftoneShader.cjs +270 -192
- package/shaders/HalftoneShader.cjs.map +1 -1
- package/shaders/HalftoneShader.js +270 -192
- package/shaders/HalftoneShader.js.map +1 -1
- package/shaders/HorizontalTiltShiftShader.cjs +43 -27
- package/shaders/HorizontalTiltShiftShader.cjs.map +1 -1
- package/shaders/HorizontalTiltShiftShader.js +43 -27
- package/shaders/HorizontalTiltShiftShader.js.map +1 -1
- package/shaders/HueSaturationShader.cjs +47 -31
- package/shaders/HueSaturationShader.cjs.map +1 -1
- package/shaders/HueSaturationShader.js +47 -31
- package/shaders/HueSaturationShader.js.map +1 -1
- package/shaders/KaleidoShader.cjs +37 -24
- package/shaders/KaleidoShader.cjs.map +1 -1
- package/shaders/KaleidoShader.js +37 -24
- package/shaders/KaleidoShader.js.map +1 -1
- package/shaders/LuminosityHighPassShader.cjs +43 -24
- package/shaders/LuminosityHighPassShader.cjs.map +1 -1
- package/shaders/LuminosityHighPassShader.js +43 -24
- package/shaders/LuminosityHighPassShader.js.map +1 -1
- package/shaders/LuminosityShader.cjs +34 -17
- package/shaders/LuminosityShader.cjs.map +1 -1
- package/shaders/LuminosityShader.js +34 -17
- package/shaders/LuminosityShader.js.map +1 -1
- package/shaders/MirrorShader.cjs +39 -26
- package/shaders/MirrorShader.cjs.map +1 -1
- package/shaders/MirrorShader.js +39 -26
- package/shaders/MirrorShader.js.map +1 -1
- package/shaders/NormalMapShader.cjs +36 -21
- package/shaders/NormalMapShader.cjs.map +1 -1
- package/shaders/NormalMapShader.js +36 -21
- package/shaders/NormalMapShader.js.map +1 -1
- package/shaders/ParallaxShader.cjs +147 -97
- package/shaders/ParallaxShader.cjs.map +1 -1
- package/shaders/ParallaxShader.js +147 -97
- package/shaders/ParallaxShader.js.map +1 -1
- package/shaders/PixelShader.cjs +31 -18
- package/shaders/PixelShader.cjs.map +1 -1
- package/shaders/PixelShader.js +31 -18
- package/shaders/PixelShader.js.map +1 -1
- package/shaders/RGBShiftShader.cjs +33 -20
- package/shaders/RGBShiftShader.cjs.map +1 -1
- package/shaders/RGBShiftShader.js +33 -20
- package/shaders/RGBShiftShader.js.map +1 -1
- package/shaders/SAOShader.cjs +154 -117
- package/shaders/SAOShader.cjs.map +1 -1
- package/shaders/SAOShader.js +154 -117
- package/shaders/SAOShader.js.map +1 -1
- package/shaders/SMAAShader.cjs +358 -270
- package/shaders/SMAAShader.cjs.map +1 -1
- package/shaders/SMAAShader.js +358 -270
- package/shaders/SMAAShader.js.map +1 -1
- package/shaders/SSAOShader.cjs +236 -142
- package/shaders/SSAOShader.cjs.map +1 -1
- package/shaders/SSAOShader.js +236 -142
- package/shaders/SSAOShader.js.map +1 -1
- package/shaders/SSRShader.cjs +4 -4
- package/shaders/SSRShader.cjs.map +1 -1
- package/shaders/SSRShader.js +4 -4
- package/shaders/SSRShader.js.map +1 -1
- package/shaders/SepiaShader.cjs +36 -20
- package/shaders/SepiaShader.cjs.map +1 -1
- package/shaders/SepiaShader.js +36 -20
- package/shaders/SepiaShader.js.map +1 -1
- package/shaders/SobelOperatorShader.cjs +64 -37
- package/shaders/SobelOperatorShader.cjs.map +1 -1
- package/shaders/SobelOperatorShader.js +64 -37
- package/shaders/SobelOperatorShader.js.map +1 -1
- package/shaders/TechnicolorShader.cjs +29 -16
- package/shaders/TechnicolorShader.cjs.map +1 -1
- package/shaders/TechnicolorShader.js +29 -16
- package/shaders/TechnicolorShader.js.map +1 -1
- package/shaders/ToneMapShader.cjs +55 -35
- package/shaders/ToneMapShader.cjs.map +1 -1
- package/shaders/ToneMapShader.js +55 -35
- package/shaders/ToneMapShader.js.map +1 -1
- package/shaders/ToonShader.cjs +275 -165
- package/shaders/ToonShader.cjs.map +1 -1
- package/shaders/ToonShader.js +275 -165
- package/shaders/ToonShader.js.map +1 -1
- package/shaders/TriangleBlurShader.cjs +50 -27
- package/shaders/TriangleBlurShader.cjs.map +1 -1
- package/shaders/TriangleBlurShader.js +50 -27
- package/shaders/TriangleBlurShader.js.map +1 -1
- package/shaders/UnpackDepthRGBAShader.cjs +32 -17
- package/shaders/UnpackDepthRGBAShader.cjs.map +1 -1
- package/shaders/UnpackDepthRGBAShader.js +32 -17
- package/shaders/UnpackDepthRGBAShader.js.map +1 -1
- package/shaders/VerticalTiltShiftShader.cjs +43 -27
- package/shaders/VerticalTiltShiftShader.cjs.map +1 -1
- package/shaders/VerticalTiltShiftShader.js +43 -27
- package/shaders/VerticalTiltShiftShader.js.map +1 -1
- package/shaders/VignetteShader.cjs +43 -27
- package/shaders/VignetteShader.cjs.map +1 -1
- package/shaders/VignetteShader.js +43 -27
- package/shaders/VignetteShader.js.map +1 -1
- package/shaders/VolumeShader.cjs +264 -213
- package/shaders/VolumeShader.cjs.map +1 -1
- package/shaders/VolumeShader.js +264 -213
- package/shaders/VolumeShader.js.map +1 -1
- package/shaders/WaterRefractionShader.cjs +63 -35
- package/shaders/WaterRefractionShader.cjs.map +1 -1
- package/shaders/WaterRefractionShader.js +63 -35
- package/shaders/WaterRefractionShader.js.map +1 -1
- package/utils/GeometryCompressionUtils.cjs +2 -1
- package/utils/GeometryCompressionUtils.cjs.map +1 -1
- package/utils/GeometryCompressionUtils.js +3 -2
- package/utils/GeometryCompressionUtils.js.map +1 -1
- package/utils/RoughnessMipmapper.cjs +3 -3
- package/utils/RoughnessMipmapper.cjs.map +1 -1
- package/utils/RoughnessMipmapper.js +4 -4
- package/utils/RoughnessMipmapper.js.map +1 -1
- package/webxr/ARButton.cjs +109 -106
- package/webxr/ARButton.cjs.map +1 -1
- package/webxr/ARButton.d.ts +4 -3
- package/webxr/ARButton.js +109 -106
- package/webxr/ARButton.js.map +1 -1
- package/webxr/OculusHandPointerModel.cjs +2 -2
- package/webxr/OculusHandPointerModel.cjs.map +1 -1
- package/webxr/OculusHandPointerModel.js +2 -2
- package/webxr/OculusHandPointerModel.js.map +1 -1
- package/webxr/VRButton.cjs +98 -95
- package/webxr/VRButton.cjs.map +1 -1
- package/webxr/VRButton.d.ts +6 -5
- package/webxr/VRButton.js +98 -95
- package/webxr/VRButton.js.map +1 -1
- package/webxr/XRHandPrimitiveModel.cjs +2 -2
- package/webxr/XRHandPrimitiveModel.cjs.map +1 -1
- package/webxr/XRHandPrimitiveModel.js +3 -3
- package/webxr/XRHandPrimitiveModel.js.map +1 -1
package/loaders/KTX2Loader.cjs
CHANGED
@@ -23,402 +23,405 @@ const SRGBColorSpace = "srgb";
|
|
23
23
|
const _taskCache = /* @__PURE__ */ new WeakMap();
|
24
24
|
let _activeLoaders = 0;
|
25
25
|
let _zstd;
|
26
|
-
const
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
'THREE.KTX2Loader: Please update to latest "basis_transcoder". "msc_basis_transcoder" is no longer supported in three.js r125+.'
|
38
|
-
);
|
39
|
-
}
|
40
|
-
}
|
41
|
-
setTranscoderPath(path) {
|
42
|
-
this.transcoderPath = path;
|
43
|
-
return this;
|
44
|
-
}
|
45
|
-
setWorkerLimit(num) {
|
46
|
-
this.workerPool.setWorkerLimit(num);
|
47
|
-
return this;
|
48
|
-
}
|
49
|
-
detectSupport(renderer) {
|
50
|
-
this.workerConfig = {
|
51
|
-
astcSupported: renderer.extensions.has("WEBGL_compressed_texture_astc"),
|
52
|
-
etc1Supported: renderer.extensions.has("WEBGL_compressed_texture_etc1"),
|
53
|
-
etc2Supported: renderer.extensions.has("WEBGL_compressed_texture_etc"),
|
54
|
-
dxtSupported: renderer.extensions.has("WEBGL_compressed_texture_s3tc"),
|
55
|
-
bptcSupported: renderer.extensions.has("EXT_texture_compression_bptc"),
|
56
|
-
pvrtcSupported: renderer.extensions.has("WEBGL_compressed_texture_pvrtc") || renderer.extensions.has("WEBKIT_WEBGL_compressed_texture_pvrtc")
|
57
|
-
};
|
58
|
-
if (renderer.capabilities.isWebGL2) {
|
59
|
-
this.workerConfig.etc1Supported = false;
|
60
|
-
}
|
61
|
-
return this;
|
62
|
-
}
|
63
|
-
init() {
|
64
|
-
if (!this.transcoderPending) {
|
65
|
-
const jsLoader = new THREE.FileLoader(this.manager);
|
66
|
-
jsLoader.setPath(this.transcoderPath);
|
67
|
-
jsLoader.setWithCredentials(this.withCredentials);
|
68
|
-
const jsContent = jsLoader.loadAsync("basis_transcoder.js");
|
69
|
-
const binaryLoader = new THREE.FileLoader(this.manager);
|
70
|
-
binaryLoader.setPath(this.transcoderPath);
|
71
|
-
binaryLoader.setResponseType("arraybuffer");
|
72
|
-
binaryLoader.setWithCredentials(this.withCredentials);
|
73
|
-
const binaryContent = binaryLoader.loadAsync("basis_transcoder.wasm");
|
74
|
-
this.transcoderPending = Promise.all([jsContent, binaryContent]).then(([jsContent2, binaryContent2]) => {
|
75
|
-
const fn = _KTX2Loader.BasisWorker.toString();
|
76
|
-
const body = [
|
77
|
-
"/* constants */",
|
78
|
-
"let _EngineFormat = " + JSON.stringify(_KTX2Loader.EngineFormat),
|
79
|
-
"let _TranscoderFormat = " + JSON.stringify(_KTX2Loader.TranscoderFormat),
|
80
|
-
"let _BasisFormat = " + JSON.stringify(_KTX2Loader.BasisFormat),
|
81
|
-
"/* basis_transcoder.js */",
|
82
|
-
jsContent2,
|
83
|
-
"/* worker */",
|
84
|
-
fn.substring(fn.indexOf("{") + 1, fn.lastIndexOf("}"))
|
85
|
-
].join("\n");
|
86
|
-
this.workerSourceURL = URL.createObjectURL(new Blob([body]));
|
87
|
-
this.transcoderBinary = binaryContent2;
|
88
|
-
this.workerPool.setWorkerCreator(() => {
|
89
|
-
const worker = new Worker(this.workerSourceURL);
|
90
|
-
const transcoderBinary = this.transcoderBinary.slice(0);
|
91
|
-
worker.postMessage({ type: "init", config: this.workerConfig, transcoderBinary }, [transcoderBinary]);
|
92
|
-
return worker;
|
93
|
-
});
|
94
|
-
});
|
95
|
-
if (_activeLoaders > 0) {
|
26
|
+
const KTX2Loader = /* @__PURE__ */ (() => {
|
27
|
+
const _KTX2Loader = class extends THREE.Loader {
|
28
|
+
constructor(manager) {
|
29
|
+
super(manager);
|
30
|
+
this.transcoderPath = "";
|
31
|
+
this.transcoderBinary = null;
|
32
|
+
this.transcoderPending = null;
|
33
|
+
this.workerPool = new WorkerPool.WorkerPool();
|
34
|
+
this.workerSourceURL = "";
|
35
|
+
this.workerConfig = null;
|
36
|
+
if (typeof MSC_TRANSCODER !== "undefined") {
|
96
37
|
console.warn(
|
97
|
-
|
38
|
+
'THREE.KTX2Loader: Please update to latest "basis_transcoder". "msc_basis_transcoder" is no longer supported in three.js r125+.'
|
98
39
|
);
|
99
40
|
}
|
100
|
-
_activeLoaders++;
|
101
41
|
}
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
if (this.workerConfig === null) {
|
106
|
-
throw new Error("THREE.KTX2Loader: Missing initialization with `.detectSupport( renderer )`.");
|
42
|
+
setTranscoderPath(path) {
|
43
|
+
this.transcoderPath = path;
|
44
|
+
return this;
|
107
45
|
}
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
loader.load(
|
112
|
-
url,
|
113
|
-
(buffer) => {
|
114
|
-
if (_taskCache.has(buffer)) {
|
115
|
-
const cachedTask = _taskCache.get(buffer);
|
116
|
-
return cachedTask.promise.then(onLoad).catch(onError);
|
117
|
-
}
|
118
|
-
this._createTexture(buffer).then((texture) => onLoad ? onLoad(texture) : null).catch(onError);
|
119
|
-
},
|
120
|
-
onProgress,
|
121
|
-
onError
|
122
|
-
);
|
123
|
-
}
|
124
|
-
_createTextureFrom(transcodeResult, container) {
|
125
|
-
const { faces, width, height, format, type, error, dfdFlags } = transcodeResult;
|
126
|
-
if (type === "error")
|
127
|
-
return Promise.reject(error);
|
128
|
-
let texture;
|
129
|
-
if (container.faceCount === 6) {
|
130
|
-
texture = new CompressedCubeTexture.CompressedCubeTexture(faces, format, THREE.UnsignedByteType);
|
131
|
-
} else {
|
132
|
-
const mipmaps = faces[0].mipmaps;
|
133
|
-
texture = container.layerCount > 1 ? new CompressedArrayTexture.CompressedArrayTexture(mipmaps, width, height, container.layerCount, format, THREE.UnsignedByteType) : new THREE.CompressedTexture(mipmaps, width, height, format, THREE.UnsignedByteType);
|
46
|
+
setWorkerLimit(num) {
|
47
|
+
this.workerPool.setWorkerLimit(num);
|
48
|
+
return this;
|
134
49
|
}
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
* @param {ArrayBuffer} buffer
|
149
|
-
* @param {object?} config
|
150
|
-
* @return {Promise<CompressedTexture|CompressedArrayTexture|DataTexture|Data3DTexture>}
|
151
|
-
*/
|
152
|
-
async _createTexture(buffer, config = {}) {
|
153
|
-
const container = ktxParse.read(new Uint8Array(buffer));
|
154
|
-
if (container.vkFormat !== ktxParse.VK_FORMAT_UNDEFINED) {
|
155
|
-
return createRawTexture(container);
|
50
|
+
detectSupport(renderer) {
|
51
|
+
this.workerConfig = {
|
52
|
+
astcSupported: renderer.extensions.has("WEBGL_compressed_texture_astc"),
|
53
|
+
etc1Supported: renderer.extensions.has("WEBGL_compressed_texture_etc1"),
|
54
|
+
etc2Supported: renderer.extensions.has("WEBGL_compressed_texture_etc"),
|
55
|
+
dxtSupported: renderer.extensions.has("WEBGL_compressed_texture_s3tc"),
|
56
|
+
bptcSupported: renderer.extensions.has("EXT_texture_compression_bptc"),
|
57
|
+
pvrtcSupported: renderer.extensions.has("WEBGL_compressed_texture_pvrtc") || renderer.extensions.has("WEBKIT_WEBGL_compressed_texture_pvrtc")
|
58
|
+
};
|
59
|
+
if (renderer.capabilities.isWebGL2) {
|
60
|
+
this.workerConfig.etc1Supported = false;
|
61
|
+
}
|
62
|
+
return this;
|
156
63
|
}
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
let
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
PVRTC1_4_RGBA: 9,
|
189
|
-
ASTC_4x4: 10,
|
190
|
-
ATC_RGB: 11,
|
191
|
-
ATC_RGBA_INTERPOLATED_ALPHA: 12,
|
192
|
-
RGBA32: 13,
|
193
|
-
RGB565: 14,
|
194
|
-
BGR565: 15,
|
195
|
-
RGBA4444: 16
|
196
|
-
});
|
197
|
-
__publicField(KTX2Loader, "EngineFormat", {
|
198
|
-
RGBAFormat: THREE.RGBAFormat,
|
199
|
-
RGBA_ASTC_4x4_Format: THREE.RGBA_ASTC_4x4_Format,
|
200
|
-
RGBA_BPTC_Format: THREE.RGBA_BPTC_Format,
|
201
|
-
RGBA_ETC2_EAC_Format: THREE.RGBA_ETC2_EAC_Format,
|
202
|
-
RGBA_PVRTC_4BPPV1_Format: THREE.RGBA_PVRTC_4BPPV1_Format,
|
203
|
-
RGBA_S3TC_DXT5_Format: THREE.RGBA_S3TC_DXT5_Format,
|
204
|
-
RGB_ETC1_Format: THREE.RGB_ETC1_Format,
|
205
|
-
RGB_ETC2_Format: THREE.RGB_ETC2_Format,
|
206
|
-
RGB_PVRTC_4BPPV1_Format: THREE.RGB_PVRTC_4BPPV1_Format,
|
207
|
-
RGB_S3TC_DXT1_Format: THREE.RGB_S3TC_DXT1_Format
|
208
|
-
});
|
209
|
-
/* WEB WORKER */
|
210
|
-
__publicField(KTX2Loader, "BasisWorker", function() {
|
211
|
-
let config;
|
212
|
-
let transcoderPending;
|
213
|
-
let BasisModule;
|
214
|
-
const EngineFormat = _EngineFormat;
|
215
|
-
const TranscoderFormat = _TranscoderFormat;
|
216
|
-
const BasisFormat = _BasisFormat;
|
217
|
-
self.addEventListener("message", function(e) {
|
218
|
-
const message = e.data;
|
219
|
-
switch (message.type) {
|
220
|
-
case "init":
|
221
|
-
config = message.config;
|
222
|
-
init(message.transcoderBinary);
|
223
|
-
break;
|
224
|
-
case "transcode":
|
225
|
-
transcoderPending.then(() => {
|
226
|
-
try {
|
227
|
-
const { faces, buffers, width, height, hasAlpha, format, dfdFlags } = transcode(message.buffer);
|
228
|
-
self.postMessage(
|
229
|
-
{ type: "transcode", id: message.id, faces, width, height, hasAlpha, format, dfdFlags },
|
230
|
-
buffers
|
231
|
-
);
|
232
|
-
} catch (error) {
|
233
|
-
console.error(error);
|
234
|
-
self.postMessage({ type: "error", id: message.id, error: error.message });
|
235
|
-
}
|
64
|
+
init() {
|
65
|
+
if (!this.transcoderPending) {
|
66
|
+
const jsLoader = new THREE.FileLoader(this.manager);
|
67
|
+
jsLoader.setPath(this.transcoderPath);
|
68
|
+
jsLoader.setWithCredentials(this.withCredentials);
|
69
|
+
const jsContent = jsLoader.loadAsync("basis_transcoder.js");
|
70
|
+
const binaryLoader = new THREE.FileLoader(this.manager);
|
71
|
+
binaryLoader.setPath(this.transcoderPath);
|
72
|
+
binaryLoader.setResponseType("arraybuffer");
|
73
|
+
binaryLoader.setWithCredentials(this.withCredentials);
|
74
|
+
const binaryContent = binaryLoader.loadAsync("basis_transcoder.wasm");
|
75
|
+
this.transcoderPending = Promise.all([jsContent, binaryContent]).then(([jsContent2, binaryContent2]) => {
|
76
|
+
const fn = _KTX2Loader.BasisWorker.toString();
|
77
|
+
const body = [
|
78
|
+
"/* constants */",
|
79
|
+
"let _EngineFormat = " + JSON.stringify(_KTX2Loader.EngineFormat),
|
80
|
+
"let _TranscoderFormat = " + JSON.stringify(_KTX2Loader.TranscoderFormat),
|
81
|
+
"let _BasisFormat = " + JSON.stringify(_KTX2Loader.BasisFormat),
|
82
|
+
"/* basis_transcoder.js */",
|
83
|
+
jsContent2,
|
84
|
+
"/* worker */",
|
85
|
+
fn.substring(fn.indexOf("{") + 1, fn.lastIndexOf("}"))
|
86
|
+
].join("\n");
|
87
|
+
this.workerSourceURL = URL.createObjectURL(new Blob([body]));
|
88
|
+
this.transcoderBinary = binaryContent2;
|
89
|
+
this.workerPool.setWorkerCreator(() => {
|
90
|
+
const worker = new Worker(this.workerSourceURL);
|
91
|
+
const transcoderBinary = this.transcoderBinary.slice(0);
|
92
|
+
worker.postMessage({ type: "init", config: this.workerConfig, transcoderBinary }, [transcoderBinary]);
|
93
|
+
return worker;
|
94
|
+
});
|
236
95
|
});
|
237
|
-
|
96
|
+
if (_activeLoaders > 0) {
|
97
|
+
console.warn(
|
98
|
+
"THREE.KTX2Loader: Multiple active KTX2 loaders may cause performance issues. Use a single KTX2Loader instance, or call .dispose() on old instances."
|
99
|
+
);
|
100
|
+
}
|
101
|
+
_activeLoaders++;
|
102
|
+
}
|
103
|
+
return this.transcoderPending;
|
238
104
|
}
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
BasisModule = { wasmBinary, onRuntimeInitialized: resolve };
|
243
|
-
BASIS(BasisModule);
|
244
|
-
}).then(() => {
|
245
|
-
BasisModule.initializeBasis();
|
246
|
-
if (BasisModule.KTX2File === void 0) {
|
247
|
-
console.warn("THREE.KTX2Loader: Please update Basis Universal transcoder.");
|
105
|
+
load(url, onLoad, onProgress, onError) {
|
106
|
+
if (this.workerConfig === null) {
|
107
|
+
throw new Error("THREE.KTX2Loader: Missing initialization with `.detectSupport( renderer )`.");
|
248
108
|
}
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
109
|
+
const loader = new THREE.FileLoader(this.manager);
|
110
|
+
loader.setResponseType("arraybuffer");
|
111
|
+
loader.setWithCredentials(this.withCredentials);
|
112
|
+
loader.load(
|
113
|
+
url,
|
114
|
+
(buffer) => {
|
115
|
+
if (_taskCache.has(buffer)) {
|
116
|
+
const cachedTask = _taskCache.get(buffer);
|
117
|
+
return cachedTask.promise.then(onLoad).catch(onError);
|
118
|
+
}
|
119
|
+
this._createTexture(buffer).then((texture) => onLoad ? onLoad(texture) : null).catch(onError);
|
120
|
+
},
|
121
|
+
onProgress,
|
122
|
+
onError
|
123
|
+
);
|
256
124
|
}
|
257
|
-
|
258
|
-
|
259
|
-
|
125
|
+
_createTextureFrom(transcodeResult, container) {
|
126
|
+
const { faces, width, height, format, type, error, dfdFlags } = transcodeResult;
|
127
|
+
if (type === "error")
|
128
|
+
return Promise.reject(error);
|
129
|
+
let texture;
|
130
|
+
if (container.faceCount === 6) {
|
131
|
+
texture = new CompressedCubeTexture.CompressedCubeTexture(faces, format, THREE.UnsignedByteType);
|
132
|
+
} else {
|
133
|
+
const mipmaps = faces[0].mipmaps;
|
134
|
+
texture = container.layerCount > 1 ? new CompressedArrayTexture.CompressedArrayTexture(mipmaps, width, height, container.layerCount, format, THREE.UnsignedByteType) : new THREE.CompressedTexture(mipmaps, width, height, format, THREE.UnsignedByteType);
|
135
|
+
}
|
136
|
+
texture.minFilter = faces[0].mipmaps.length === 1 ? THREE.LinearFilter : THREE.LinearMipmapLinearFilter;
|
137
|
+
texture.magFilter = THREE.LinearFilter;
|
138
|
+
texture.generateMipmaps = false;
|
139
|
+
texture.needsUpdate = true;
|
140
|
+
const colorSpace = parseColorSpace(container);
|
141
|
+
if ("colorSpace" in texture)
|
142
|
+
texture.colorSpace = colorSpace;
|
143
|
+
else
|
144
|
+
texture.encoding = colorSpace === SRGBColorSpace ? sRGBEncoding : LinearEncoding;
|
145
|
+
texture.premultiplyAlpha = !!(dfdFlags & ktxParse.KHR_DF_FLAG_ALPHA_PREMULTIPLIED);
|
146
|
+
return texture;
|
260
147
|
}
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
148
|
+
/**
|
149
|
+
* @param {ArrayBuffer} buffer
|
150
|
+
* @param {object?} config
|
151
|
+
* @return {Promise<CompressedTexture|CompressedArrayTexture|DataTexture|Data3DTexture>}
|
152
|
+
*/
|
153
|
+
async _createTexture(buffer, config = {}) {
|
154
|
+
const container = ktxParse.read(new Uint8Array(buffer));
|
155
|
+
if (container.vkFormat !== ktxParse.VK_FORMAT_UNDEFINED) {
|
156
|
+
return createRawTexture(container);
|
157
|
+
}
|
158
|
+
const taskConfig = config;
|
159
|
+
const texturePending = this.init().then(() => {
|
160
|
+
return this.workerPool.postMessage({ type: "transcode", buffer, taskConfig }, [buffer]);
|
161
|
+
}).then((e) => this._createTextureFrom(e.data, container));
|
162
|
+
_taskCache.set(buffer, { promise: texturePending });
|
163
|
+
return texturePending;
|
273
164
|
}
|
274
|
-
|
275
|
-
|
276
|
-
|
165
|
+
dispose() {
|
166
|
+
this.workerPool.dispose();
|
167
|
+
if (this.workerSourceURL)
|
168
|
+
URL.revokeObjectURL(this.workerSourceURL);
|
169
|
+
_activeLoaders--;
|
170
|
+
return this;
|
277
171
|
}
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
172
|
+
};
|
173
|
+
let KTX2Loader2 = _KTX2Loader;
|
174
|
+
/* CONSTANTS */
|
175
|
+
__publicField(KTX2Loader2, "BasisFormat", {
|
176
|
+
ETC1S: 0,
|
177
|
+
UASTC_4x4: 1
|
178
|
+
});
|
179
|
+
__publicField(KTX2Loader2, "TranscoderFormat", {
|
180
|
+
ETC1: 0,
|
181
|
+
ETC2: 1,
|
182
|
+
BC1: 2,
|
183
|
+
BC3: 3,
|
184
|
+
BC4: 4,
|
185
|
+
BC5: 5,
|
186
|
+
BC7_M6_OPAQUE_ONLY: 6,
|
187
|
+
BC7_M5: 7,
|
188
|
+
PVRTC1_4_RGB: 8,
|
189
|
+
PVRTC1_4_RGBA: 9,
|
190
|
+
ASTC_4x4: 10,
|
191
|
+
ATC_RGB: 11,
|
192
|
+
ATC_RGBA_INTERPOLATED_ALPHA: 12,
|
193
|
+
RGBA32: 13,
|
194
|
+
RGB565: 14,
|
195
|
+
BGR565: 15,
|
196
|
+
RGBA4444: 16
|
197
|
+
});
|
198
|
+
__publicField(KTX2Loader2, "EngineFormat", {
|
199
|
+
RGBAFormat: THREE.RGBAFormat,
|
200
|
+
RGBA_ASTC_4x4_Format: THREE.RGBA_ASTC_4x4_Format,
|
201
|
+
RGBA_BPTC_Format: THREE.RGBA_BPTC_Format,
|
202
|
+
RGBA_ETC2_EAC_Format: THREE.RGBA_ETC2_EAC_Format,
|
203
|
+
RGBA_PVRTC_4BPPV1_Format: THREE.RGBA_PVRTC_4BPPV1_Format,
|
204
|
+
RGBA_S3TC_DXT5_Format: THREE.RGBA_S3TC_DXT5_Format,
|
205
|
+
RGB_ETC1_Format: THREE.RGB_ETC1_Format,
|
206
|
+
RGB_ETC2_Format: THREE.RGB_ETC2_Format,
|
207
|
+
RGB_PVRTC_4BPPV1_Format: THREE.RGB_PVRTC_4BPPV1_Format,
|
208
|
+
RGB_S3TC_DXT1_Format: THREE.RGB_S3TC_DXT1_Format
|
209
|
+
});
|
210
|
+
/* WEB WORKER */
|
211
|
+
__publicField(KTX2Loader2, "BasisWorker", function() {
|
212
|
+
let config;
|
213
|
+
let transcoderPending;
|
214
|
+
let BasisModule;
|
215
|
+
const EngineFormat = _EngineFormat;
|
216
|
+
const TranscoderFormat = _TranscoderFormat;
|
217
|
+
const BasisFormat = _BasisFormat;
|
218
|
+
self.addEventListener("message", function(e) {
|
219
|
+
const message = e.data;
|
220
|
+
switch (message.type) {
|
221
|
+
case "init":
|
222
|
+
config = message.config;
|
223
|
+
init(message.transcoderBinary);
|
224
|
+
break;
|
225
|
+
case "transcode":
|
226
|
+
transcoderPending.then(() => {
|
227
|
+
try {
|
228
|
+
const { faces, buffers, width, height, hasAlpha, format, dfdFlags } = transcode(message.buffer);
|
229
|
+
self.postMessage(
|
230
|
+
{ type: "transcode", id: message.id, faces, width, height, hasAlpha, format, dfdFlags },
|
231
|
+
buffers
|
232
|
+
);
|
233
|
+
} catch (error) {
|
234
|
+
console.error(error);
|
235
|
+
self.postMessage({ type: "error", id: message.id, error: error.message });
|
236
|
+
}
|
237
|
+
});
|
238
|
+
break;
|
239
|
+
}
|
240
|
+
});
|
241
|
+
function init(wasmBinary) {
|
242
|
+
transcoderPending = new Promise((resolve) => {
|
243
|
+
BasisModule = { wasmBinary, onRuntimeInitialized: resolve };
|
244
|
+
BASIS(BasisModule);
|
245
|
+
}).then(() => {
|
246
|
+
BasisModule.initializeBasis();
|
247
|
+
if (BasisModule.KTX2File === void 0) {
|
248
|
+
console.warn("THREE.KTX2Loader: Please update Basis Universal transcoder.");
|
249
|
+
}
|
250
|
+
});
|
251
|
+
}
|
252
|
+
function transcode(buffer) {
|
253
|
+
const ktx2File = new BasisModule.KTX2File(new Uint8Array(buffer));
|
254
|
+
function cleanup() {
|
255
|
+
ktx2File.close();
|
256
|
+
ktx2File.delete();
|
257
|
+
}
|
258
|
+
if (!ktx2File.isValid()) {
|
259
|
+
cleanup();
|
260
|
+
throw new Error("THREE.KTX2Loader: Invalid or unsupported .ktx2 file");
|
261
|
+
}
|
262
|
+
const basisFormat = ktx2File.isUASTC() ? BasisFormat.UASTC_4x4 : BasisFormat.ETC1S;
|
263
|
+
const width = ktx2File.getWidth();
|
264
|
+
const height = ktx2File.getHeight();
|
265
|
+
const layerCount = ktx2File.getLayers() || 1;
|
266
|
+
const levelCount = ktx2File.getLevels();
|
267
|
+
const faceCount = ktx2File.getFaces();
|
268
|
+
const hasAlpha = ktx2File.getHasAlpha();
|
269
|
+
const dfdFlags = ktx2File.getDFDFlags();
|
270
|
+
const { transcoderFormat, engineFormat } = getTranscoderFormat(basisFormat, width, height, hasAlpha);
|
271
|
+
if (!width || !height || !levelCount) {
|
272
|
+
cleanup();
|
273
|
+
throw new Error("THREE.KTX2Loader: Invalid texture");
|
274
|
+
}
|
275
|
+
if (!ktx2File.startTranscoding()) {
|
276
|
+
cleanup();
|
277
|
+
throw new Error("THREE.KTX2Loader: .startTranscoding failed");
|
278
|
+
}
|
279
|
+
const faces = [];
|
280
|
+
const buffers = [];
|
281
|
+
for (let face = 0; face < faceCount; face++) {
|
282
|
+
const mipmaps = [];
|
283
|
+
for (let mip = 0; mip < levelCount; mip++) {
|
284
|
+
const layerMips = [];
|
285
|
+
let mipWidth, mipHeight;
|
286
|
+
for (let layer = 0; layer < layerCount; layer++) {
|
287
|
+
const levelInfo = ktx2File.getImageLevelInfo(mip, layer, face);
|
288
|
+
if (face === 0 && mip === 0 && layer === 0 && (levelInfo.origWidth % 4 !== 0 || levelInfo.origHeight % 4 !== 0)) {
|
289
|
+
console.warn("THREE.KTX2Loader: ETC1S and UASTC textures should use multiple-of-four dimensions.");
|
290
|
+
}
|
291
|
+
if (levelCount > 1) {
|
292
|
+
mipWidth = levelInfo.origWidth;
|
293
|
+
mipHeight = levelInfo.origHeight;
|
294
|
+
} else {
|
295
|
+
mipWidth = levelInfo.width;
|
296
|
+
mipHeight = levelInfo.height;
|
297
|
+
}
|
298
|
+
const dst = new Uint8Array(ktx2File.getImageTranscodedSizeInBytes(mip, layer, 0, transcoderFormat));
|
299
|
+
const status = ktx2File.transcodeImage(dst, mip, layer, face, transcoderFormat, 0, -1, -1);
|
300
|
+
if (!status) {
|
301
|
+
cleanup();
|
302
|
+
throw new Error("THREE.KTX2Loader: .transcodeImage failed.");
|
303
|
+
}
|
304
|
+
layerMips.push(dst);
|
302
305
|
}
|
303
|
-
layerMips
|
306
|
+
const mipData = concat(layerMips);
|
307
|
+
mipmaps.push({ data: mipData, width: mipWidth, height: mipHeight });
|
308
|
+
buffers.push(mipData.buffer);
|
304
309
|
}
|
305
|
-
|
306
|
-
mipmaps.push({ data: mipData, width: mipWidth, height: mipHeight });
|
307
|
-
buffers.push(mipData.buffer);
|
310
|
+
faces.push({ mipmaps, width, height, format: engineFormat });
|
308
311
|
}
|
309
|
-
|
310
|
-
|
311
|
-
cleanup();
|
312
|
-
return { faces, buffers, width, height, hasAlpha, format: engineFormat, dfdFlags };
|
313
|
-
}
|
314
|
-
const FORMAT_OPTIONS = [
|
315
|
-
{
|
316
|
-
if: "astcSupported",
|
317
|
-
basisFormat: [BasisFormat.UASTC_4x4],
|
318
|
-
transcoderFormat: [TranscoderFormat.ASTC_4x4, TranscoderFormat.ASTC_4x4],
|
319
|
-
engineFormat: [EngineFormat.RGBA_ASTC_4x4_Format, EngineFormat.RGBA_ASTC_4x4_Format],
|
320
|
-
priorityETC1S: Infinity,
|
321
|
-
priorityUASTC: 1,
|
322
|
-
needsPowerOfTwo: false
|
323
|
-
},
|
324
|
-
{
|
325
|
-
if: "bptcSupported",
|
326
|
-
basisFormat: [BasisFormat.ETC1S, BasisFormat.UASTC_4x4],
|
327
|
-
transcoderFormat: [TranscoderFormat.BC7_M5, TranscoderFormat.BC7_M5],
|
328
|
-
engineFormat: [EngineFormat.RGBA_BPTC_Format, EngineFormat.RGBA_BPTC_Format],
|
329
|
-
priorityETC1S: 3,
|
330
|
-
priorityUASTC: 2,
|
331
|
-
needsPowerOfTwo: false
|
332
|
-
},
|
333
|
-
{
|
334
|
-
if: "dxtSupported",
|
335
|
-
basisFormat: [BasisFormat.ETC1S, BasisFormat.UASTC_4x4],
|
336
|
-
transcoderFormat: [TranscoderFormat.BC1, TranscoderFormat.BC3],
|
337
|
-
engineFormat: [EngineFormat.RGB_S3TC_DXT1_Format, EngineFormat.RGBA_S3TC_DXT5_Format],
|
338
|
-
priorityETC1S: 4,
|
339
|
-
priorityUASTC: 5,
|
340
|
-
needsPowerOfTwo: false
|
341
|
-
},
|
342
|
-
{
|
343
|
-
if: "etc2Supported",
|
344
|
-
basisFormat: [BasisFormat.ETC1S, BasisFormat.UASTC_4x4],
|
345
|
-
transcoderFormat: [TranscoderFormat.ETC1, TranscoderFormat.ETC2],
|
346
|
-
engineFormat: [EngineFormat.RGB_ETC2_Format, EngineFormat.RGBA_ETC2_EAC_Format],
|
347
|
-
priorityETC1S: 1,
|
348
|
-
priorityUASTC: 3,
|
349
|
-
needsPowerOfTwo: false
|
350
|
-
},
|
351
|
-
{
|
352
|
-
if: "etc1Supported",
|
353
|
-
basisFormat: [BasisFormat.ETC1S, BasisFormat.UASTC_4x4],
|
354
|
-
transcoderFormat: [TranscoderFormat.ETC1],
|
355
|
-
engineFormat: [EngineFormat.RGB_ETC1_Format],
|
356
|
-
priorityETC1S: 2,
|
357
|
-
priorityUASTC: 4,
|
358
|
-
needsPowerOfTwo: false
|
359
|
-
},
|
360
|
-
{
|
361
|
-
if: "pvrtcSupported",
|
362
|
-
basisFormat: [BasisFormat.ETC1S, BasisFormat.UASTC_4x4],
|
363
|
-
transcoderFormat: [TranscoderFormat.PVRTC1_4_RGB, TranscoderFormat.PVRTC1_4_RGBA],
|
364
|
-
engineFormat: [EngineFormat.RGB_PVRTC_4BPPV1_Format, EngineFormat.RGBA_PVRTC_4BPPV1_Format],
|
365
|
-
priorityETC1S: 5,
|
366
|
-
priorityUASTC: 6,
|
367
|
-
needsPowerOfTwo: true
|
312
|
+
cleanup();
|
313
|
+
return { faces, buffers, width, height, hasAlpha, format: engineFormat, dfdFlags };
|
368
314
|
}
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
315
|
+
const FORMAT_OPTIONS = [
|
316
|
+
{
|
317
|
+
if: "astcSupported",
|
318
|
+
basisFormat: [BasisFormat.UASTC_4x4],
|
319
|
+
transcoderFormat: [TranscoderFormat.ASTC_4x4, TranscoderFormat.ASTC_4x4],
|
320
|
+
engineFormat: [EngineFormat.RGBA_ASTC_4x4_Format, EngineFormat.RGBA_ASTC_4x4_Format],
|
321
|
+
priorityETC1S: Infinity,
|
322
|
+
priorityUASTC: 1,
|
323
|
+
needsPowerOfTwo: false
|
324
|
+
},
|
325
|
+
{
|
326
|
+
if: "bptcSupported",
|
327
|
+
basisFormat: [BasisFormat.ETC1S, BasisFormat.UASTC_4x4],
|
328
|
+
transcoderFormat: [TranscoderFormat.BC7_M5, TranscoderFormat.BC7_M5],
|
329
|
+
engineFormat: [EngineFormat.RGBA_BPTC_Format, EngineFormat.RGBA_BPTC_Format],
|
330
|
+
priorityETC1S: 3,
|
331
|
+
priorityUASTC: 2,
|
332
|
+
needsPowerOfTwo: false
|
333
|
+
},
|
334
|
+
{
|
335
|
+
if: "dxtSupported",
|
336
|
+
basisFormat: [BasisFormat.ETC1S, BasisFormat.UASTC_4x4],
|
337
|
+
transcoderFormat: [TranscoderFormat.BC1, TranscoderFormat.BC3],
|
338
|
+
engineFormat: [EngineFormat.RGB_S3TC_DXT1_Format, EngineFormat.RGBA_S3TC_DXT5_Format],
|
339
|
+
priorityETC1S: 4,
|
340
|
+
priorityUASTC: 5,
|
341
|
+
needsPowerOfTwo: false
|
342
|
+
},
|
343
|
+
{
|
344
|
+
if: "etc2Supported",
|
345
|
+
basisFormat: [BasisFormat.ETC1S, BasisFormat.UASTC_4x4],
|
346
|
+
transcoderFormat: [TranscoderFormat.ETC1, TranscoderFormat.ETC2],
|
347
|
+
engineFormat: [EngineFormat.RGB_ETC2_Format, EngineFormat.RGBA_ETC2_EAC_Format],
|
348
|
+
priorityETC1S: 1,
|
349
|
+
priorityUASTC: 3,
|
350
|
+
needsPowerOfTwo: false
|
351
|
+
},
|
352
|
+
{
|
353
|
+
if: "etc1Supported",
|
354
|
+
basisFormat: [BasisFormat.ETC1S, BasisFormat.UASTC_4x4],
|
355
|
+
transcoderFormat: [TranscoderFormat.ETC1],
|
356
|
+
engineFormat: [EngineFormat.RGB_ETC1_Format],
|
357
|
+
priorityETC1S: 2,
|
358
|
+
priorityUASTC: 4,
|
359
|
+
needsPowerOfTwo: false
|
360
|
+
},
|
361
|
+
{
|
362
|
+
if: "pvrtcSupported",
|
363
|
+
basisFormat: [BasisFormat.ETC1S, BasisFormat.UASTC_4x4],
|
364
|
+
transcoderFormat: [TranscoderFormat.PVRTC1_4_RGB, TranscoderFormat.PVRTC1_4_RGBA],
|
365
|
+
engineFormat: [EngineFormat.RGB_PVRTC_4BPPV1_Format, EngineFormat.RGBA_PVRTC_4BPPV1_Format],
|
366
|
+
priorityETC1S: 5,
|
367
|
+
priorityUASTC: 6,
|
368
|
+
needsPowerOfTwo: true
|
369
|
+
}
|
370
|
+
];
|
371
|
+
const ETC1S_OPTIONS = FORMAT_OPTIONS.sort(function(a, b) {
|
372
|
+
return a.priorityETC1S - b.priorityETC1S;
|
373
|
+
});
|
374
|
+
const UASTC_OPTIONS = FORMAT_OPTIONS.sort(function(a, b) {
|
375
|
+
return a.priorityUASTC - b.priorityUASTC;
|
376
|
+
});
|
377
|
+
function getTranscoderFormat(basisFormat, width, height, hasAlpha) {
|
378
|
+
let transcoderFormat;
|
379
|
+
let engineFormat;
|
380
|
+
const options = basisFormat === BasisFormat.ETC1S ? ETC1S_OPTIONS : UASTC_OPTIONS;
|
381
|
+
for (let i = 0; i < options.length; i++) {
|
382
|
+
const opt = options[i];
|
383
|
+
if (!config[opt.if])
|
384
|
+
continue;
|
385
|
+
if (!opt.basisFormat.includes(basisFormat))
|
386
|
+
continue;
|
387
|
+
if (hasAlpha && opt.transcoderFormat.length < 2)
|
388
|
+
continue;
|
389
|
+
if (opt.needsPowerOfTwo && !(isPowerOfTwo(width) && isPowerOfTwo(height)))
|
390
|
+
continue;
|
391
|
+
transcoderFormat = opt.transcoderFormat[hasAlpha ? 1 : 0];
|
392
|
+
engineFormat = opt.engineFormat[hasAlpha ? 1 : 0];
|
393
|
+
return { transcoderFormat, engineFormat };
|
394
|
+
}
|
395
|
+
console.warn("THREE.KTX2Loader: No suitable compressed texture format found. Decoding to RGBA32.");
|
396
|
+
transcoderFormat = TranscoderFormat.RGBA32;
|
397
|
+
engineFormat = EngineFormat.RGBAFormat;
|
392
398
|
return { transcoderFormat, engineFormat };
|
393
399
|
}
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
}
|
399
|
-
function isPowerOfTwo(value) {
|
400
|
-
if (value <= 2)
|
401
|
-
return true;
|
402
|
-
return (value & value - 1) === 0 && value !== 0;
|
403
|
-
}
|
404
|
-
function concat(arrays) {
|
405
|
-
if (arrays.length === 1)
|
406
|
-
return arrays[0];
|
407
|
-
let totalByteLength = 0;
|
408
|
-
for (let i = 0; i < arrays.length; i++) {
|
409
|
-
const array = arrays[i];
|
410
|
-
totalByteLength += array.byteLength;
|
400
|
+
function isPowerOfTwo(value) {
|
401
|
+
if (value <= 2)
|
402
|
+
return true;
|
403
|
+
return (value & value - 1) === 0 && value !== 0;
|
411
404
|
}
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
405
|
+
function concat(arrays) {
|
406
|
+
if (arrays.length === 1)
|
407
|
+
return arrays[0];
|
408
|
+
let totalByteLength = 0;
|
409
|
+
for (let i = 0; i < arrays.length; i++) {
|
410
|
+
const array = arrays[i];
|
411
|
+
totalByteLength += array.byteLength;
|
412
|
+
}
|
413
|
+
const result = new Uint8Array(totalByteLength);
|
414
|
+
let byteOffset = 0;
|
415
|
+
for (let i = 0; i < arrays.length; i++) {
|
416
|
+
const array = arrays[i];
|
417
|
+
result.set(array, byteOffset);
|
418
|
+
byteOffset += array.byteLength;
|
419
|
+
}
|
420
|
+
return result;
|
418
421
|
}
|
419
|
-
|
420
|
-
|
421
|
-
});
|
422
|
+
});
|
423
|
+
return KTX2Loader2;
|
424
|
+
})();
|
422
425
|
const UNCOMPRESSED_FORMATS = /* @__PURE__ */ new Set([THREE.RGBAFormat, THREE.RGFormat, THREE.RedFormat]);
|
423
426
|
const FORMAT_MAP = {
|
424
427
|
[ktxParse.VK_FORMAT_R32G32B32A32_SFLOAT]: THREE.RGBAFormat,
|