three-stdlib 2.35.2 → 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/Pass.cjs.map +1 -1
- package/postprocessing/Pass.d.ts +2 -2
- package/postprocessing/Pass.js.map +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/utils/ShadowMapViewer.d.ts +2 -2
- 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
@@ -8,282 +8,317 @@ var __publicField = (obj, key, value) => {
|
|
8
8
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
9
9
|
const THREE = require("three");
|
10
10
|
const _taskCache = /* @__PURE__ */ new WeakMap();
|
11
|
-
const
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
setTranscoderPath(path) {
|
24
|
-
this.transcoderPath = path;
|
25
|
-
return this;
|
26
|
-
}
|
27
|
-
setWorkerLimit(workerLimit) {
|
28
|
-
this.workerLimit = workerLimit;
|
29
|
-
return this;
|
30
|
-
}
|
31
|
-
detectSupport(renderer) {
|
32
|
-
this.workerConfig = {
|
33
|
-
astcSupported: renderer.extensions.has("WEBGL_compressed_texture_astc"),
|
34
|
-
etc1Supported: renderer.extensions.has("WEBGL_compressed_texture_etc1"),
|
35
|
-
etc2Supported: renderer.extensions.has("WEBGL_compressed_texture_etc"),
|
36
|
-
dxtSupported: renderer.extensions.has("WEBGL_compressed_texture_s3tc"),
|
37
|
-
bptcSupported: renderer.extensions.has("EXT_texture_compression_bptc"),
|
38
|
-
pvrtcSupported: renderer.extensions.has("WEBGL_compressed_texture_pvrtc") || renderer.extensions.has("WEBKIT_WEBGL_compressed_texture_pvrtc")
|
39
|
-
};
|
40
|
-
return this;
|
41
|
-
}
|
42
|
-
load(url, onLoad, onProgress, onError) {
|
43
|
-
const loader = new THREE.FileLoader(this.manager);
|
44
|
-
loader.setResponseType("arraybuffer");
|
45
|
-
loader.setWithCredentials(this.withCredentials);
|
46
|
-
const texture = new THREE.CompressedTexture();
|
47
|
-
loader.load(
|
48
|
-
url,
|
49
|
-
(buffer) => {
|
50
|
-
if (_taskCache.has(buffer)) {
|
51
|
-
const cachedTask = _taskCache.get(buffer);
|
52
|
-
return cachedTask.promise.then(onLoad).catch(onError);
|
53
|
-
}
|
54
|
-
this._createTexture([buffer]).then(function(_texture) {
|
55
|
-
texture.copy(_texture);
|
56
|
-
texture.needsUpdate = true;
|
57
|
-
if (onLoad)
|
58
|
-
onLoad(texture);
|
59
|
-
}).catch(onError);
|
60
|
-
},
|
61
|
-
onProgress,
|
62
|
-
onError
|
63
|
-
);
|
64
|
-
return texture;
|
65
|
-
}
|
66
|
-
/** Low-level transcoding API, exposed for use by KTX2Loader. */
|
67
|
-
parseInternalAsync(options) {
|
68
|
-
const { levels } = options;
|
69
|
-
const buffers = /* @__PURE__ */ new Set();
|
70
|
-
for (let i = 0; i < levels.length; i++) {
|
71
|
-
buffers.add(levels[i].data.buffer);
|
11
|
+
const BasisTextureLoader = /* @__PURE__ */ (() => {
|
12
|
+
const _BasisTextureLoader = class extends THREE.Loader {
|
13
|
+
constructor(manager) {
|
14
|
+
super(manager);
|
15
|
+
this.transcoderPath = "";
|
16
|
+
this.transcoderBinary = null;
|
17
|
+
this.transcoderPending = null;
|
18
|
+
this.workerLimit = 4;
|
19
|
+
this.workerPool = [];
|
20
|
+
this.workerNextTaskID = 1;
|
21
|
+
this.workerSourceURL = "";
|
22
|
+
this.workerConfig = null;
|
72
23
|
}
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
* @param {ArrayBuffer[]} buffers
|
77
|
-
* @param {object?} config
|
78
|
-
* @return {Promise<CompressedTexture>}
|
79
|
-
*/
|
80
|
-
_createTexture(buffers, config = {}) {
|
81
|
-
let worker;
|
82
|
-
let taskID;
|
83
|
-
const taskConfig = config;
|
84
|
-
let taskCost = 0;
|
85
|
-
for (let i = 0; i < buffers.length; i++) {
|
86
|
-
taskCost += buffers[i].byteLength;
|
24
|
+
setTranscoderPath(path) {
|
25
|
+
this.transcoderPath = path;
|
26
|
+
return this;
|
87
27
|
}
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
28
|
+
setWorkerLimit(workerLimit) {
|
29
|
+
this.workerLimit = workerLimit;
|
30
|
+
return this;
|
31
|
+
}
|
32
|
+
detectSupport(renderer) {
|
33
|
+
this.workerConfig = {
|
34
|
+
astcSupported: renderer.extensions.has("WEBGL_compressed_texture_astc"),
|
35
|
+
etc1Supported: renderer.extensions.has("WEBGL_compressed_texture_etc1"),
|
36
|
+
etc2Supported: renderer.extensions.has("WEBGL_compressed_texture_etc"),
|
37
|
+
dxtSupported: renderer.extensions.has("WEBGL_compressed_texture_s3tc"),
|
38
|
+
bptcSupported: renderer.extensions.has("EXT_texture_compression_bptc"),
|
39
|
+
pvrtcSupported: renderer.extensions.has("WEBGL_compressed_texture_pvrtc") || renderer.extensions.has("WEBKIT_WEBGL_compressed_texture_pvrtc")
|
40
|
+
};
|
41
|
+
return this;
|
42
|
+
}
|
43
|
+
load(url, onLoad, onProgress, onError) {
|
44
|
+
const loader = new THREE.FileLoader(this.manager);
|
45
|
+
loader.setResponseType("arraybuffer");
|
46
|
+
loader.setWithCredentials(this.withCredentials);
|
47
|
+
const texture = new THREE.CompressedTexture();
|
48
|
+
loader.load(
|
49
|
+
url,
|
50
|
+
(buffer) => {
|
51
|
+
if (_taskCache.has(buffer)) {
|
52
|
+
const cachedTask = _taskCache.get(buffer);
|
53
|
+
return cachedTask.promise.then(onLoad).catch(onError);
|
54
|
+
}
|
55
|
+
this._createTexture([buffer]).then(function(_texture) {
|
56
|
+
texture.copy(_texture);
|
57
|
+
texture.needsUpdate = true;
|
58
|
+
if (onLoad)
|
59
|
+
onLoad(texture);
|
60
|
+
}).catch(onError);
|
61
|
+
},
|
62
|
+
onProgress,
|
63
|
+
onError
|
64
|
+
);
|
102
65
|
return texture;
|
103
|
-
}
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
66
|
+
}
|
67
|
+
/** Low-level transcoding API, exposed for use by KTX2Loader. */
|
68
|
+
parseInternalAsync(options) {
|
69
|
+
const { levels } = options;
|
70
|
+
const buffers = /* @__PURE__ */ new Set();
|
71
|
+
for (let i = 0; i < levels.length; i++) {
|
72
|
+
buffers.add(levels[i].data.buffer);
|
108
73
|
}
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
74
|
+
return this._createTexture(Array.from(buffers), { ...options, lowLevel: true });
|
75
|
+
}
|
76
|
+
/**
|
77
|
+
* @param {ArrayBuffer[]} buffers
|
78
|
+
* @param {object?} config
|
79
|
+
* @return {Promise<CompressedTexture>}
|
80
|
+
*/
|
81
|
+
_createTexture(buffers, config = {}) {
|
82
|
+
let worker;
|
83
|
+
let taskID;
|
84
|
+
const taskConfig = config;
|
85
|
+
let taskCost = 0;
|
86
|
+
for (let i = 0; i < buffers.length; i++) {
|
87
|
+
taskCost += buffers[i].byteLength;
|
88
|
+
}
|
89
|
+
const texturePending = this._allocateWorker(taskCost).then((_worker) => {
|
90
|
+
worker = _worker;
|
91
|
+
taskID = this.workerNextTaskID++;
|
92
|
+
return new Promise((resolve, reject) => {
|
93
|
+
worker._callbacks[taskID] = { resolve, reject };
|
94
|
+
worker.postMessage({ type: "transcode", id: taskID, buffers, taskConfig }, buffers);
|
95
|
+
});
|
96
|
+
}).then((message) => {
|
97
|
+
const { mipmaps, width, height, format } = message;
|
98
|
+
const texture = new THREE.CompressedTexture(mipmaps, width, height, format, THREE.UnsignedByteType);
|
99
|
+
texture.minFilter = mipmaps.length === 1 ? THREE.LinearFilter : THREE.LinearMipmapLinearFilter;
|
100
|
+
texture.magFilter = THREE.LinearFilter;
|
101
|
+
texture.generateMipmaps = false;
|
102
|
+
texture.needsUpdate = true;
|
103
|
+
return texture;
|
127
104
|
});
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
"let _TranscoderFormat = " + JSON.stringify(_BasisTextureLoader.TranscoderFormat),
|
134
|
-
"let _BasisFormat = " + JSON.stringify(_BasisTextureLoader.BasisFormat),
|
135
|
-
"/* basis_transcoder.js */",
|
136
|
-
jsContent2,
|
137
|
-
"/* worker */",
|
138
|
-
fn.substring(fn.indexOf("{") + 1, fn.lastIndexOf("}"))
|
139
|
-
].join("\n");
|
140
|
-
this.workerSourceURL = URL.createObjectURL(new Blob([body]));
|
141
|
-
this.transcoderBinary = binaryContent2;
|
105
|
+
texturePending.catch(() => true).then(() => {
|
106
|
+
if (worker && taskID) {
|
107
|
+
worker._taskLoad -= taskCost;
|
108
|
+
delete worker._callbacks[taskID];
|
109
|
+
}
|
142
110
|
});
|
111
|
+
_taskCache.set(buffers[0], { promise: texturePending });
|
112
|
+
return texturePending;
|
143
113
|
}
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
const
|
150
|
-
|
151
|
-
worker2._taskLoad = 0;
|
152
|
-
worker2.postMessage({
|
153
|
-
type: "init",
|
154
|
-
config: this.workerConfig,
|
155
|
-
transcoderBinary: this.transcoderBinary
|
114
|
+
_initTranscoder() {
|
115
|
+
if (!this.transcoderPending) {
|
116
|
+
const jsLoader = new THREE.FileLoader(this.manager);
|
117
|
+
jsLoader.setPath(this.transcoderPath);
|
118
|
+
jsLoader.setWithCredentials(this.withCredentials);
|
119
|
+
const jsContent = new Promise((resolve, reject) => {
|
120
|
+
jsLoader.load("basis_transcoder.js", resolve, void 0, reject);
|
156
121
|
});
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
122
|
+
const binaryLoader = new THREE.FileLoader(this.manager);
|
123
|
+
binaryLoader.setPath(this.transcoderPath);
|
124
|
+
binaryLoader.setResponseType("arraybuffer");
|
125
|
+
binaryLoader.setWithCredentials(this.withCredentials);
|
126
|
+
const binaryContent = new Promise((resolve, reject) => {
|
127
|
+
binaryLoader.load("basis_transcoder.wasm", resolve, void 0, reject);
|
128
|
+
});
|
129
|
+
this.transcoderPending = Promise.all([jsContent, binaryContent]).then(([jsContent2, binaryContent2]) => {
|
130
|
+
const fn = _BasisTextureLoader.BasisWorker.toString();
|
131
|
+
const body = [
|
132
|
+
"/* constants */",
|
133
|
+
"let _EngineFormat = " + JSON.stringify(_BasisTextureLoader.EngineFormat),
|
134
|
+
"let _TranscoderFormat = " + JSON.stringify(_BasisTextureLoader.TranscoderFormat),
|
135
|
+
"let _BasisFormat = " + JSON.stringify(_BasisTextureLoader.BasisFormat),
|
136
|
+
"/* basis_transcoder.js */",
|
137
|
+
jsContent2,
|
138
|
+
"/* worker */",
|
139
|
+
fn.substring(fn.indexOf("{") + 1, fn.lastIndexOf("}"))
|
140
|
+
].join("\n");
|
141
|
+
this.workerSourceURL = URL.createObjectURL(new Blob([body]));
|
142
|
+
this.transcoderBinary = binaryContent2;
|
174
143
|
});
|
175
144
|
}
|
176
|
-
|
177
|
-
worker._taskLoad += taskCost;
|
178
|
-
return worker;
|
179
|
-
});
|
180
|
-
}
|
181
|
-
dispose() {
|
182
|
-
for (let i = 0; i < this.workerPool.length; i++) {
|
183
|
-
this.workerPool[i].terminate();
|
145
|
+
return this.transcoderPending;
|
184
146
|
}
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
ATC_RGB: 11,
|
208
|
-
ATC_RGBA_INTERPOLATED_ALPHA: 12,
|
209
|
-
RGBA32: 13,
|
210
|
-
RGB565: 14,
|
211
|
-
BGR565: 15,
|
212
|
-
RGBA4444: 16
|
213
|
-
});
|
214
|
-
__publicField(BasisTextureLoader, "EngineFormat", {
|
215
|
-
RGBAFormat: THREE.RGBAFormat,
|
216
|
-
RGBA_ASTC_4x4_Format: THREE.RGBA_ASTC_4x4_Format,
|
217
|
-
RGBA_BPTC_Format: THREE.RGBA_BPTC_Format,
|
218
|
-
RGBA_ETC2_EAC_Format: THREE.RGBA_ETC2_EAC_Format,
|
219
|
-
RGBA_PVRTC_4BPPV1_Format: THREE.RGBA_PVRTC_4BPPV1_Format,
|
220
|
-
RGBA_S3TC_DXT5_Format: THREE.RGBA_S3TC_DXT5_Format,
|
221
|
-
RGB_ETC1_Format: THREE.RGB_ETC1_Format,
|
222
|
-
RGB_ETC2_Format: THREE.RGB_ETC2_Format,
|
223
|
-
RGB_PVRTC_4BPPV1_Format: THREE.RGB_PVRTC_4BPPV1_Format,
|
224
|
-
RGB_S3TC_DXT1_Format: THREE.RGB_S3TC_DXT1_Format
|
225
|
-
});
|
226
|
-
/* WEB WORKER */
|
227
|
-
__publicField(BasisTextureLoader, "BasisWorker", function() {
|
228
|
-
let config;
|
229
|
-
let transcoderPending;
|
230
|
-
let BasisModule;
|
231
|
-
const EngineFormat = _EngineFormat;
|
232
|
-
const TranscoderFormat = _TranscoderFormat;
|
233
|
-
const BasisFormat = _BasisFormat;
|
234
|
-
onmessage = function(e) {
|
235
|
-
const message = e.data;
|
236
|
-
switch (message.type) {
|
237
|
-
case "init":
|
238
|
-
config = message.config;
|
239
|
-
init(message.transcoderBinary);
|
240
|
-
break;
|
241
|
-
case "transcode":
|
242
|
-
transcoderPending.then(() => {
|
243
|
-
try {
|
244
|
-
const { width, height, hasAlpha, mipmaps, format } = message.taskConfig.lowLevel ? transcodeLowLevel(message.taskConfig) : transcode(message.buffers[0]);
|
245
|
-
const buffers = [];
|
246
|
-
for (let i = 0; i < mipmaps.length; ++i) {
|
247
|
-
buffers.push(mipmaps[i].data.buffer);
|
147
|
+
_allocateWorker(taskCost) {
|
148
|
+
return this._initTranscoder().then(() => {
|
149
|
+
if (this.workerPool.length < this.workerLimit) {
|
150
|
+
const worker2 = new Worker(this.workerSourceURL);
|
151
|
+
worker2._callbacks = {};
|
152
|
+
worker2._taskLoad = 0;
|
153
|
+
worker2.postMessage({
|
154
|
+
type: "init",
|
155
|
+
config: this.workerConfig,
|
156
|
+
transcoderBinary: this.transcoderBinary
|
157
|
+
});
|
158
|
+
worker2.onmessage = function(e) {
|
159
|
+
const message = e.data;
|
160
|
+
switch (message.type) {
|
161
|
+
case "transcode":
|
162
|
+
worker2._callbacks[message.id].resolve(message);
|
163
|
+
break;
|
164
|
+
case "error":
|
165
|
+
worker2._callbacks[message.id].reject(message);
|
166
|
+
break;
|
167
|
+
default:
|
168
|
+
console.error('THREE.BasisTextureLoader: Unexpected message, "' + message.type + '"');
|
248
169
|
}
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
170
|
+
};
|
171
|
+
this.workerPool.push(worker2);
|
172
|
+
} else {
|
173
|
+
this.workerPool.sort(function(a, b) {
|
174
|
+
return a._taskLoad > b._taskLoad ? -1 : 1;
|
175
|
+
});
|
176
|
+
}
|
177
|
+
const worker = this.workerPool[this.workerPool.length - 1];
|
178
|
+
worker._taskLoad += taskCost;
|
179
|
+
return worker;
|
180
|
+
});
|
181
|
+
}
|
182
|
+
dispose() {
|
183
|
+
for (let i = 0; i < this.workerPool.length; i++) {
|
184
|
+
this.workerPool[i].terminate();
|
185
|
+
}
|
186
|
+
this.workerPool.length = 0;
|
187
|
+
return this;
|
256
188
|
}
|
257
189
|
};
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
190
|
+
let BasisTextureLoader2 = _BasisTextureLoader;
|
191
|
+
/* CONSTANTS */
|
192
|
+
__publicField(BasisTextureLoader2, "BasisFormat", {
|
193
|
+
ETC1S: 0,
|
194
|
+
UASTC_4x4: 1
|
195
|
+
});
|
196
|
+
__publicField(BasisTextureLoader2, "TranscoderFormat", {
|
197
|
+
ETC1: 0,
|
198
|
+
ETC2: 1,
|
199
|
+
BC1: 2,
|
200
|
+
BC3: 3,
|
201
|
+
BC4: 4,
|
202
|
+
BC5: 5,
|
203
|
+
BC7_M6_OPAQUE_ONLY: 6,
|
204
|
+
BC7_M5: 7,
|
205
|
+
PVRTC1_4_RGB: 8,
|
206
|
+
PVRTC1_4_RGBA: 9,
|
207
|
+
ASTC_4x4: 10,
|
208
|
+
ATC_RGB: 11,
|
209
|
+
ATC_RGBA_INTERPOLATED_ALPHA: 12,
|
210
|
+
RGBA32: 13,
|
211
|
+
RGB565: 14,
|
212
|
+
BGR565: 15,
|
213
|
+
RGBA4444: 16
|
214
|
+
});
|
215
|
+
__publicField(BasisTextureLoader2, "EngineFormat", {
|
216
|
+
RGBAFormat: THREE.RGBAFormat,
|
217
|
+
RGBA_ASTC_4x4_Format: THREE.RGBA_ASTC_4x4_Format,
|
218
|
+
RGBA_BPTC_Format: THREE.RGBA_BPTC_Format,
|
219
|
+
RGBA_ETC2_EAC_Format: THREE.RGBA_ETC2_EAC_Format,
|
220
|
+
RGBA_PVRTC_4BPPV1_Format: THREE.RGBA_PVRTC_4BPPV1_Format,
|
221
|
+
RGBA_S3TC_DXT5_Format: THREE.RGBA_S3TC_DXT5_Format,
|
222
|
+
RGB_ETC1_Format: THREE.RGB_ETC1_Format,
|
223
|
+
RGB_ETC2_Format: THREE.RGB_ETC2_Format,
|
224
|
+
RGB_PVRTC_4BPPV1_Format: THREE.RGB_PVRTC_4BPPV1_Format,
|
225
|
+
RGB_S3TC_DXT1_Format: THREE.RGB_S3TC_DXT1_Format
|
226
|
+
});
|
227
|
+
/* WEB WORKER */
|
228
|
+
__publicField(BasisTextureLoader2, "BasisWorker", function() {
|
229
|
+
let config;
|
230
|
+
let transcoderPending;
|
231
|
+
let BasisModule;
|
232
|
+
const EngineFormat = _EngineFormat;
|
233
|
+
const TranscoderFormat = _TranscoderFormat;
|
234
|
+
const BasisFormat = _BasisFormat;
|
235
|
+
onmessage = function(e) {
|
236
|
+
const message = e.data;
|
237
|
+
switch (message.type) {
|
238
|
+
case "init":
|
239
|
+
config = message.config;
|
240
|
+
init(message.transcoderBinary);
|
241
|
+
break;
|
242
|
+
case "transcode":
|
243
|
+
transcoderPending.then(() => {
|
244
|
+
try {
|
245
|
+
const { width, height, hasAlpha, mipmaps, format } = message.taskConfig.lowLevel ? transcodeLowLevel(message.taskConfig) : transcode(message.buffers[0]);
|
246
|
+
const buffers = [];
|
247
|
+
for (let i = 0; i < mipmaps.length; ++i) {
|
248
|
+
buffers.push(mipmaps[i].data.buffer);
|
249
|
+
}
|
250
|
+
self.postMessage(
|
251
|
+
{ type: "transcode", id: message.id, width, height, hasAlpha, mipmaps, format },
|
252
|
+
buffers
|
253
|
+
);
|
254
|
+
} catch (error) {
|
255
|
+
console.error(error);
|
256
|
+
self.postMessage({ type: "error", id: message.id, error: error.message });
|
257
|
+
}
|
258
|
+
});
|
259
|
+
break;
|
260
|
+
}
|
261
|
+
};
|
262
|
+
function init(wasmBinary) {
|
263
|
+
transcoderPending = new Promise((resolve) => {
|
264
|
+
BasisModule = { wasmBinary, onRuntimeInitialized: resolve };
|
265
|
+
BASIS(BasisModule);
|
266
|
+
}).then(() => {
|
267
|
+
BasisModule.initializeBasis();
|
268
|
+
});
|
269
|
+
}
|
270
|
+
function transcodeLowLevel(taskConfig) {
|
271
|
+
const { basisFormat, width, height, hasAlpha } = taskConfig;
|
272
|
+
const { transcoderFormat, engineFormat } = getTranscoderFormat(basisFormat, width, height, hasAlpha);
|
273
|
+
const blockByteLength = BasisModule.getBytesPerBlockOrPixel(transcoderFormat);
|
274
|
+
assert(BasisModule.isFormatSupported(transcoderFormat), "THREE.BasisTextureLoader: Unsupported format.");
|
275
|
+
const mipmaps = [];
|
276
|
+
if (basisFormat === BasisFormat.ETC1S) {
|
277
|
+
const transcoder = new BasisModule.LowLevelETC1SImageTranscoder();
|
278
|
+
const { endpointCount, endpointsData, selectorCount, selectorsData, tablesData } = taskConfig.globalData;
|
279
|
+
try {
|
280
|
+
let ok;
|
281
|
+
ok = transcoder.decodePalettes(endpointCount, endpointsData, selectorCount, selectorsData);
|
282
|
+
assert(ok, "THREE.BasisTextureLoader: decodePalettes() failed.");
|
283
|
+
ok = transcoder.decodeTables(tablesData);
|
284
|
+
assert(ok, "THREE.BasisTextureLoader: decodeTables() failed.");
|
285
|
+
for (let i = 0; i < taskConfig.levels.length; i++) {
|
286
|
+
const level = taskConfig.levels[i];
|
287
|
+
const imageDesc = taskConfig.globalData.imageDescs[i];
|
288
|
+
const dstByteLength = getTranscodedImageByteLength(transcoderFormat, level.width, level.height);
|
289
|
+
const dst = new Uint8Array(dstByteLength);
|
290
|
+
ok = transcoder.transcodeImage(
|
291
|
+
transcoderFormat,
|
292
|
+
dst,
|
293
|
+
dstByteLength / blockByteLength,
|
294
|
+
level.data,
|
295
|
+
getWidthInBlocks(transcoderFormat, level.width),
|
296
|
+
getHeightInBlocks(transcoderFormat, level.height),
|
297
|
+
level.width,
|
298
|
+
level.height,
|
299
|
+
level.index,
|
300
|
+
imageDesc.rgbSliceByteOffset,
|
301
|
+
imageDesc.rgbSliceByteLength,
|
302
|
+
imageDesc.alphaSliceByteOffset,
|
303
|
+
imageDesc.alphaSliceByteLength,
|
304
|
+
imageDesc.imageFlags,
|
305
|
+
hasAlpha,
|
306
|
+
false,
|
307
|
+
0,
|
308
|
+
0
|
309
|
+
);
|
310
|
+
assert(ok, "THREE.BasisTextureLoader: transcodeImage() failed for level " + level.index + ".");
|
311
|
+
mipmaps.push({ data: dst, width: level.width, height: level.height });
|
312
|
+
}
|
313
|
+
} finally {
|
314
|
+
transcoder.delete();
|
315
|
+
}
|
316
|
+
} else {
|
281
317
|
for (let i = 0; i < taskConfig.levels.length; i++) {
|
282
318
|
const level = taskConfig.levels[i];
|
283
|
-
const imageDesc = taskConfig.globalData.imageDescs[i];
|
284
319
|
const dstByteLength = getTranscodedImageByteLength(transcoderFormat, level.width, level.height);
|
285
320
|
const dst = new Uint8Array(dstByteLength);
|
286
|
-
ok =
|
321
|
+
const ok = BasisModule.transcodeUASTCImage(
|
287
322
|
transcoderFormat,
|
288
323
|
dst,
|
289
324
|
dstByteLength / blockByteLength,
|
@@ -293,198 +328,169 @@ __publicField(BasisTextureLoader, "BasisWorker", function() {
|
|
293
328
|
level.width,
|
294
329
|
level.height,
|
295
330
|
level.index,
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
imageDesc.alphaSliceByteLength,
|
300
|
-
imageDesc.imageFlags,
|
331
|
+
0,
|
332
|
+
level.data.byteLength,
|
333
|
+
0,
|
301
334
|
hasAlpha,
|
302
335
|
false,
|
303
336
|
0,
|
304
|
-
0
|
337
|
+
0,
|
338
|
+
-1,
|
339
|
+
-1
|
305
340
|
);
|
306
|
-
assert(ok, "THREE.BasisTextureLoader:
|
341
|
+
assert(ok, "THREE.BasisTextureLoader: transcodeUASTCImage() failed for level " + level.index + ".");
|
307
342
|
mipmaps.push({ data: dst, width: level.width, height: level.height });
|
308
343
|
}
|
309
|
-
} finally {
|
310
|
-
transcoder.delete();
|
311
|
-
}
|
312
|
-
} else {
|
313
|
-
for (let i = 0; i < taskConfig.levels.length; i++) {
|
314
|
-
const level = taskConfig.levels[i];
|
315
|
-
const dstByteLength = getTranscodedImageByteLength(transcoderFormat, level.width, level.height);
|
316
|
-
const dst = new Uint8Array(dstByteLength);
|
317
|
-
const ok = BasisModule.transcodeUASTCImage(
|
318
|
-
transcoderFormat,
|
319
|
-
dst,
|
320
|
-
dstByteLength / blockByteLength,
|
321
|
-
level.data,
|
322
|
-
getWidthInBlocks(transcoderFormat, level.width),
|
323
|
-
getHeightInBlocks(transcoderFormat, level.height),
|
324
|
-
level.width,
|
325
|
-
level.height,
|
326
|
-
level.index,
|
327
|
-
0,
|
328
|
-
level.data.byteLength,
|
329
|
-
0,
|
330
|
-
hasAlpha,
|
331
|
-
false,
|
332
|
-
0,
|
333
|
-
0,
|
334
|
-
-1,
|
335
|
-
-1
|
336
|
-
);
|
337
|
-
assert(ok, "THREE.BasisTextureLoader: transcodeUASTCImage() failed for level " + level.index + ".");
|
338
|
-
mipmaps.push({ data: dst, width: level.width, height: level.height });
|
339
344
|
}
|
345
|
+
return { width, height, hasAlpha, mipmaps, format: engineFormat };
|
340
346
|
}
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
347
|
+
function transcode(buffer) {
|
348
|
+
const basisFile = new BasisModule.BasisFile(new Uint8Array(buffer));
|
349
|
+
const basisFormat = basisFile.isUASTC() ? BasisFormat.UASTC_4x4 : BasisFormat.ETC1S;
|
350
|
+
const width = basisFile.getImageWidth(0, 0);
|
351
|
+
const height = basisFile.getImageHeight(0, 0);
|
352
|
+
const levels = basisFile.getNumLevels(0);
|
353
|
+
const hasAlpha = basisFile.getHasAlpha();
|
354
|
+
function cleanup() {
|
355
|
+
basisFile.close();
|
356
|
+
basisFile.delete();
|
357
|
+
}
|
358
|
+
const { transcoderFormat, engineFormat } = getTranscoderFormat(basisFormat, width, height, hasAlpha);
|
359
|
+
if (!width || !height || !levels) {
|
360
|
+
cleanup();
|
361
|
+
throw new Error("THREE.BasisTextureLoader: Invalid texture");
|
362
|
+
}
|
363
|
+
if (!basisFile.startTranscoding()) {
|
364
|
+
cleanup();
|
365
|
+
throw new Error("THREE.BasisTextureLoader: .startTranscoding failed");
|
366
|
+
}
|
367
|
+
const mipmaps = [];
|
368
|
+
for (let mip = 0; mip < levels; mip++) {
|
369
|
+
const mipWidth = basisFile.getImageWidth(0, mip);
|
370
|
+
const mipHeight = basisFile.getImageHeight(0, mip);
|
371
|
+
const dst = new Uint8Array(basisFile.getImageTranscodedSizeInBytes(0, mip, transcoderFormat));
|
372
|
+
const status = basisFile.transcodeImage(dst, 0, mip, transcoderFormat, 0, hasAlpha);
|
373
|
+
if (!status) {
|
374
|
+
cleanup();
|
375
|
+
throw new Error("THREE.BasisTextureLoader: .transcodeImage failed.");
|
376
|
+
}
|
377
|
+
mipmaps.push({ data: dst, width: mipWidth, height: mipHeight });
|
378
|
+
}
|
360
379
|
cleanup();
|
361
|
-
|
380
|
+
return { width, height, hasAlpha, mipmaps, format: engineFormat };
|
362
381
|
}
|
363
|
-
const
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
382
|
+
const FORMAT_OPTIONS = [
|
383
|
+
{
|
384
|
+
if: "astcSupported",
|
385
|
+
basisFormat: [BasisFormat.UASTC_4x4],
|
386
|
+
transcoderFormat: [TranscoderFormat.ASTC_4x4, TranscoderFormat.ASTC_4x4],
|
387
|
+
engineFormat: [EngineFormat.RGBA_ASTC_4x4_Format, EngineFormat.RGBA_ASTC_4x4_Format],
|
388
|
+
priorityETC1S: Infinity,
|
389
|
+
priorityUASTC: 1,
|
390
|
+
needsPowerOfTwo: false
|
391
|
+
},
|
392
|
+
{
|
393
|
+
if: "bptcSupported",
|
394
|
+
basisFormat: [BasisFormat.ETC1S, BasisFormat.UASTC_4x4],
|
395
|
+
transcoderFormat: [TranscoderFormat.BC7_M5, TranscoderFormat.BC7_M5],
|
396
|
+
engineFormat: [EngineFormat.RGBA_BPTC_Format, EngineFormat.RGBA_BPTC_Format],
|
397
|
+
priorityETC1S: 3,
|
398
|
+
priorityUASTC: 2,
|
399
|
+
needsPowerOfTwo: false
|
400
|
+
},
|
401
|
+
{
|
402
|
+
if: "dxtSupported",
|
403
|
+
basisFormat: [BasisFormat.ETC1S, BasisFormat.UASTC_4x4],
|
404
|
+
transcoderFormat: [TranscoderFormat.BC1, TranscoderFormat.BC3],
|
405
|
+
engineFormat: [EngineFormat.RGB_S3TC_DXT1_Format, EngineFormat.RGBA_S3TC_DXT5_Format],
|
406
|
+
priorityETC1S: 4,
|
407
|
+
priorityUASTC: 5,
|
408
|
+
needsPowerOfTwo: false
|
409
|
+
},
|
410
|
+
{
|
411
|
+
if: "etc2Supported",
|
412
|
+
basisFormat: [BasisFormat.ETC1S, BasisFormat.UASTC_4x4],
|
413
|
+
transcoderFormat: [TranscoderFormat.ETC1, TranscoderFormat.ETC2],
|
414
|
+
engineFormat: [EngineFormat.RGB_ETC2_Format, EngineFormat.RGBA_ETC2_EAC_Format],
|
415
|
+
priorityETC1S: 1,
|
416
|
+
priorityUASTC: 3,
|
417
|
+
needsPowerOfTwo: false
|
418
|
+
},
|
419
|
+
{
|
420
|
+
if: "etc1Supported",
|
421
|
+
basisFormat: [BasisFormat.ETC1S, BasisFormat.UASTC_4x4],
|
422
|
+
transcoderFormat: [TranscoderFormat.ETC1, TranscoderFormat.ETC1],
|
423
|
+
engineFormat: [EngineFormat.RGB_ETC1_Format, EngineFormat.RGB_ETC1_Format],
|
424
|
+
priorityETC1S: 2,
|
425
|
+
priorityUASTC: 4,
|
426
|
+
needsPowerOfTwo: false
|
427
|
+
},
|
428
|
+
{
|
429
|
+
if: "pvrtcSupported",
|
430
|
+
basisFormat: [BasisFormat.ETC1S, BasisFormat.UASTC_4x4],
|
431
|
+
transcoderFormat: [TranscoderFormat.PVRTC1_4_RGB, TranscoderFormat.PVRTC1_4_RGBA],
|
432
|
+
engineFormat: [EngineFormat.RGB_PVRTC_4BPPV1_Format, EngineFormat.RGBA_PVRTC_4BPPV1_Format],
|
433
|
+
priorityETC1S: 5,
|
434
|
+
priorityUASTC: 6,
|
435
|
+
needsPowerOfTwo: true
|
436
|
+
}
|
437
|
+
];
|
438
|
+
const ETC1S_OPTIONS = FORMAT_OPTIONS.sort(function(a, b) {
|
439
|
+
return a.priorityETC1S - b.priorityETC1S;
|
440
|
+
});
|
441
|
+
const UASTC_OPTIONS = FORMAT_OPTIONS.sort(function(a, b) {
|
442
|
+
return a.priorityUASTC - b.priorityUASTC;
|
443
|
+
});
|
444
|
+
function getTranscoderFormat(basisFormat, width, height, hasAlpha) {
|
445
|
+
let transcoderFormat;
|
446
|
+
let engineFormat;
|
447
|
+
const options = basisFormat === BasisFormat.ETC1S ? ETC1S_OPTIONS : UASTC_OPTIONS;
|
448
|
+
for (let i = 0; i < options.length; i++) {
|
449
|
+
const opt = options[i];
|
450
|
+
if (!config[opt.if])
|
451
|
+
continue;
|
452
|
+
if (!opt.basisFormat.includes(basisFormat))
|
453
|
+
continue;
|
454
|
+
if (opt.needsPowerOfTwo && !(isPowerOfTwo(width) && isPowerOfTwo(height)))
|
455
|
+
continue;
|
456
|
+
transcoderFormat = opt.transcoderFormat[hasAlpha ? 1 : 0];
|
457
|
+
engineFormat = opt.engineFormat[hasAlpha ? 1 : 0];
|
458
|
+
return { transcoderFormat, engineFormat };
|
372
459
|
}
|
373
|
-
|
460
|
+
console.warn("THREE.BasisTextureLoader: No suitable compressed texture format found. Decoding to RGBA32.");
|
461
|
+
transcoderFormat = TranscoderFormat.RGBA32;
|
462
|
+
engineFormat = EngineFormat.RGBAFormat;
|
463
|
+
return { transcoderFormat, engineFormat };
|
374
464
|
}
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
const FORMAT_OPTIONS = [
|
379
|
-
{
|
380
|
-
if: "astcSupported",
|
381
|
-
basisFormat: [BasisFormat.UASTC_4x4],
|
382
|
-
transcoderFormat: [TranscoderFormat.ASTC_4x4, TranscoderFormat.ASTC_4x4],
|
383
|
-
engineFormat: [EngineFormat.RGBA_ASTC_4x4_Format, EngineFormat.RGBA_ASTC_4x4_Format],
|
384
|
-
priorityETC1S: Infinity,
|
385
|
-
priorityUASTC: 1,
|
386
|
-
needsPowerOfTwo: false
|
387
|
-
},
|
388
|
-
{
|
389
|
-
if: "bptcSupported",
|
390
|
-
basisFormat: [BasisFormat.ETC1S, BasisFormat.UASTC_4x4],
|
391
|
-
transcoderFormat: [TranscoderFormat.BC7_M5, TranscoderFormat.BC7_M5],
|
392
|
-
engineFormat: [EngineFormat.RGBA_BPTC_Format, EngineFormat.RGBA_BPTC_Format],
|
393
|
-
priorityETC1S: 3,
|
394
|
-
priorityUASTC: 2,
|
395
|
-
needsPowerOfTwo: false
|
396
|
-
},
|
397
|
-
{
|
398
|
-
if: "dxtSupported",
|
399
|
-
basisFormat: [BasisFormat.ETC1S, BasisFormat.UASTC_4x4],
|
400
|
-
transcoderFormat: [TranscoderFormat.BC1, TranscoderFormat.BC3],
|
401
|
-
engineFormat: [EngineFormat.RGB_S3TC_DXT1_Format, EngineFormat.RGBA_S3TC_DXT5_Format],
|
402
|
-
priorityETC1S: 4,
|
403
|
-
priorityUASTC: 5,
|
404
|
-
needsPowerOfTwo: false
|
405
|
-
},
|
406
|
-
{
|
407
|
-
if: "etc2Supported",
|
408
|
-
basisFormat: [BasisFormat.ETC1S, BasisFormat.UASTC_4x4],
|
409
|
-
transcoderFormat: [TranscoderFormat.ETC1, TranscoderFormat.ETC2],
|
410
|
-
engineFormat: [EngineFormat.RGB_ETC2_Format, EngineFormat.RGBA_ETC2_EAC_Format],
|
411
|
-
priorityETC1S: 1,
|
412
|
-
priorityUASTC: 3,
|
413
|
-
needsPowerOfTwo: false
|
414
|
-
},
|
415
|
-
{
|
416
|
-
if: "etc1Supported",
|
417
|
-
basisFormat: [BasisFormat.ETC1S, BasisFormat.UASTC_4x4],
|
418
|
-
transcoderFormat: [TranscoderFormat.ETC1, TranscoderFormat.ETC1],
|
419
|
-
engineFormat: [EngineFormat.RGB_ETC1_Format, EngineFormat.RGB_ETC1_Format],
|
420
|
-
priorityETC1S: 2,
|
421
|
-
priorityUASTC: 4,
|
422
|
-
needsPowerOfTwo: false
|
423
|
-
},
|
424
|
-
{
|
425
|
-
if: "pvrtcSupported",
|
426
|
-
basisFormat: [BasisFormat.ETC1S, BasisFormat.UASTC_4x4],
|
427
|
-
transcoderFormat: [TranscoderFormat.PVRTC1_4_RGB, TranscoderFormat.PVRTC1_4_RGBA],
|
428
|
-
engineFormat: [EngineFormat.RGB_PVRTC_4BPPV1_Format, EngineFormat.RGBA_PVRTC_4BPPV1_Format],
|
429
|
-
priorityETC1S: 5,
|
430
|
-
priorityUASTC: 6,
|
431
|
-
needsPowerOfTwo: true
|
465
|
+
function assert(ok, message) {
|
466
|
+
if (!ok)
|
467
|
+
throw new Error(message);
|
432
468
|
}
|
433
|
-
|
434
|
-
|
435
|
-
return a.priorityETC1S - b.priorityETC1S;
|
436
|
-
});
|
437
|
-
const UASTC_OPTIONS = FORMAT_OPTIONS.sort(function(a, b) {
|
438
|
-
return a.priorityUASTC - b.priorityUASTC;
|
439
|
-
});
|
440
|
-
function getTranscoderFormat(basisFormat, width, height, hasAlpha) {
|
441
|
-
let transcoderFormat;
|
442
|
-
let engineFormat;
|
443
|
-
const options = basisFormat === BasisFormat.ETC1S ? ETC1S_OPTIONS : UASTC_OPTIONS;
|
444
|
-
for (let i = 0; i < options.length; i++) {
|
445
|
-
const opt = options[i];
|
446
|
-
if (!config[opt.if])
|
447
|
-
continue;
|
448
|
-
if (!opt.basisFormat.includes(basisFormat))
|
449
|
-
continue;
|
450
|
-
if (opt.needsPowerOfTwo && !(isPowerOfTwo(width) && isPowerOfTwo(height)))
|
451
|
-
continue;
|
452
|
-
transcoderFormat = opt.transcoderFormat[hasAlpha ? 1 : 0];
|
453
|
-
engineFormat = opt.engineFormat[hasAlpha ? 1 : 0];
|
454
|
-
return { transcoderFormat, engineFormat };
|
469
|
+
function getWidthInBlocks(transcoderFormat, width) {
|
470
|
+
return Math.ceil(width / BasisModule.getFormatBlockWidth(transcoderFormat));
|
455
471
|
}
|
456
|
-
|
457
|
-
|
458
|
-
engineFormat = EngineFormat.RGBAFormat;
|
459
|
-
return { transcoderFormat, engineFormat };
|
460
|
-
}
|
461
|
-
function assert(ok, message) {
|
462
|
-
if (!ok)
|
463
|
-
throw new Error(message);
|
464
|
-
}
|
465
|
-
function getWidthInBlocks(transcoderFormat, width) {
|
466
|
-
return Math.ceil(width / BasisModule.getFormatBlockWidth(transcoderFormat));
|
467
|
-
}
|
468
|
-
function getHeightInBlocks(transcoderFormat, height) {
|
469
|
-
return Math.ceil(height / BasisModule.getFormatBlockHeight(transcoderFormat));
|
470
|
-
}
|
471
|
-
function getTranscodedImageByteLength(transcoderFormat, width, height) {
|
472
|
-
const blockByteLength = BasisModule.getBytesPerBlockOrPixel(transcoderFormat);
|
473
|
-
if (BasisModule.formatIsUncompressed(transcoderFormat)) {
|
474
|
-
return width * height * blockByteLength;
|
472
|
+
function getHeightInBlocks(transcoderFormat, height) {
|
473
|
+
return Math.ceil(height / BasisModule.getFormatBlockHeight(transcoderFormat));
|
475
474
|
}
|
476
|
-
|
477
|
-
const
|
478
|
-
|
479
|
-
|
475
|
+
function getTranscodedImageByteLength(transcoderFormat, width, height) {
|
476
|
+
const blockByteLength = BasisModule.getBytesPerBlockOrPixel(transcoderFormat);
|
477
|
+
if (BasisModule.formatIsUncompressed(transcoderFormat)) {
|
478
|
+
return width * height * blockByteLength;
|
479
|
+
}
|
480
|
+
if (transcoderFormat === TranscoderFormat.PVRTC1_4_RGB || transcoderFormat === TranscoderFormat.PVRTC1_4_RGBA) {
|
481
|
+
const paddedWidth = width + 3 & ~3;
|
482
|
+
const paddedHeight = height + 3 & ~3;
|
483
|
+
return (Math.max(8, paddedWidth) * Math.max(8, paddedHeight) * 4 + 7) / 8;
|
484
|
+
}
|
485
|
+
return getWidthInBlocks(transcoderFormat, width) * getHeightInBlocks(transcoderFormat, height) * blockByteLength;
|
480
486
|
}
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
});
|
487
|
+
function isPowerOfTwo(value) {
|
488
|
+
if (value <= 2)
|
489
|
+
return true;
|
490
|
+
return (value & value - 1) === 0 && value !== 0;
|
491
|
+
}
|
492
|
+
});
|
493
|
+
return BasisTextureLoader2;
|
494
|
+
})();
|
489
495
|
exports.BasisTextureLoader = BasisTextureLoader;
|
490
496
|
//# sourceMappingURL=BasisTextureLoader.cjs.map
|