super-three 0.175.0 → 0.177.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/build/three.cjs +7631 -6743
- package/build/three.core.js +7496 -6758
- package/build/three.core.min.js +1 -1
- package/build/three.module.js +172 -22
- package/build/three.module.min.js +1 -1
- package/build/three.tsl.js +14 -6
- package/build/three.tsl.min.js +1 -1
- package/build/three.webgpu.js +3948 -1678
- package/build/three.webgpu.min.js +1 -1
- package/build/three.webgpu.nodes.js +3941 -1678
- package/build/three.webgpu.nodes.min.js +1 -1
- package/examples/jsm/Addons.js +0 -1
- package/examples/jsm/animation/AnimationClipCreator.js +1 -0
- package/examples/jsm/animation/CCDIKSolver.js +6 -3
- package/examples/jsm/capabilities/WebGL.js +1 -0
- package/examples/jsm/capabilities/WebGPU.js +1 -0
- package/examples/jsm/controls/ArcballControls.js +14 -3
- package/examples/jsm/controls/DragControls.js +1 -0
- package/examples/jsm/controls/FirstPersonControls.js +1 -0
- package/examples/jsm/controls/FlyControls.js +1 -0
- package/examples/jsm/controls/MapControls.js +1 -0
- package/examples/jsm/controls/OrbitControls.js +1 -0
- package/examples/jsm/controls/PointerLockControls.js +5 -3
- package/examples/jsm/controls/TrackballControls.js +1 -0
- package/examples/jsm/controls/TransformControls.js +1 -0
- package/examples/jsm/csm/CSM.js +2 -0
- package/examples/jsm/csm/CSMFrustum.js +2 -0
- package/examples/jsm/csm/CSMHelper.js +1 -0
- package/examples/jsm/csm/CSMShader.js +4 -1
- package/examples/jsm/csm/CSMShadowNode.js +18 -4
- package/examples/jsm/curves/CurveExtras.js +14 -0
- package/examples/jsm/curves/NURBSCurve.js +1 -0
- package/examples/jsm/curves/NURBSSurface.js +2 -0
- package/examples/jsm/curves/NURBSUtils.js +4 -1
- package/examples/jsm/curves/NURBSVolume.js +2 -0
- package/examples/jsm/effects/AnaglyphEffect.js +2 -0
- package/examples/jsm/effects/AsciiEffect.js +2 -0
- package/examples/jsm/effects/OutlineEffect.js +2 -0
- package/examples/jsm/effects/ParallaxBarrierEffect.js +2 -0
- package/examples/jsm/effects/StereoEffect.js +2 -0
- package/examples/jsm/environments/DebugEnvironment.js +1 -0
- package/examples/jsm/environments/RoomEnvironment.js +49 -35
- package/examples/jsm/exporters/DRACOExporter.js +4 -2
- package/examples/jsm/exporters/EXRExporter.js +2 -0
- package/examples/jsm/exporters/GLTFExporter.js +7 -4
- package/examples/jsm/exporters/KTX2Exporter.js +2 -0
- package/examples/jsm/exporters/OBJExporter.js +3 -1
- package/examples/jsm/exporters/PLYExporter.js +4 -2
- package/examples/jsm/exporters/STLExporter.js +2 -0
- package/examples/jsm/exporters/USDZExporter.js +12 -10
- package/examples/jsm/geometries/BoxLineGeometry.js +1 -0
- package/examples/jsm/geometries/ConvexGeometry.js +1 -0
- package/examples/jsm/geometries/DecalGeometry.js +1 -0
- package/examples/jsm/geometries/ParametricFunctions.js +4 -1
- package/examples/jsm/geometries/ParametricGeometry.js +1 -0
- package/examples/jsm/geometries/RoundedBoxGeometry.js +1 -0
- package/examples/jsm/geometries/TeapotGeometry.js +1 -0
- package/examples/jsm/geometries/TextGeometry.js +1 -0
- package/examples/jsm/helpers/LightProbeHelper.js +1 -0
- package/examples/jsm/helpers/LightProbeHelperGPU.js +1 -0
- package/examples/jsm/helpers/OctreeHelper.js +1 -0
- package/examples/jsm/helpers/PositionalAudioHelper.js +1 -0
- package/examples/jsm/helpers/RapierHelper.js +59 -0
- package/examples/jsm/helpers/RectAreaLightHelper.js +1 -0
- package/examples/jsm/helpers/TextureHelper.js +1 -0
- package/examples/jsm/helpers/TextureHelperGPU.js +5 -4
- package/examples/jsm/helpers/VertexNormalsHelper.js +1 -0
- package/examples/jsm/helpers/VertexTangentsHelper.js +1 -0
- package/examples/jsm/helpers/ViewHelper.js +1 -0
- package/examples/jsm/interactive/HTMLMesh.js +7 -0
- package/examples/jsm/interactive/InteractiveGroup.js +1 -0
- package/examples/jsm/interactive/SelectionBox.js +2 -0
- package/examples/jsm/interactive/SelectionHelper.js +2 -0
- package/examples/jsm/lighting/TiledLighting.js +1 -0
- package/examples/jsm/lights/LightProbeGenerator.js +1 -0
- package/examples/jsm/lights/RectAreaLightTexturesLib.js +1 -0
- package/examples/jsm/lights/RectAreaLightUniformsLib.js +1 -0
- package/examples/jsm/lines/Line2.js +1 -0
- package/examples/jsm/lines/LineGeometry.js +1 -0
- package/examples/jsm/lines/LineMaterial.js +4 -4
- package/examples/jsm/lines/LineSegments2.js +1 -0
- package/examples/jsm/lines/LineSegmentsGeometry.js +1 -0
- package/examples/jsm/lines/Wireframe.js +1 -0
- package/examples/jsm/lines/WireframeGeometry2.js +1 -0
- package/examples/jsm/lines/webgpu/Line2.js +1 -0
- package/examples/jsm/lines/webgpu/LineSegments2.js +3 -1
- package/examples/jsm/lines/webgpu/Wireframe.js +1 -0
- package/examples/jsm/loaders/3DMLoader.js +1 -0
- package/examples/jsm/loaders/3MFLoader.js +1 -0
- package/examples/jsm/loaders/AMFLoader.js +1 -0
- package/examples/jsm/loaders/BVHLoader.js +1 -0
- package/examples/jsm/loaders/ColladaLoader.js +5 -4
- package/examples/jsm/loaders/DDSLoader.js +1 -0
- package/examples/jsm/loaders/DRACOLoader.js +2 -1
- package/examples/jsm/loaders/EXRLoader.js +1 -0
- package/examples/jsm/loaders/FBXLoader.js +24 -22
- package/examples/jsm/loaders/FontLoader.js +1 -0
- package/examples/jsm/loaders/GCodeLoader.js +1 -0
- package/examples/jsm/loaders/GLTFLoader.js +10 -82
- package/examples/jsm/loaders/HDRCubeTextureLoader.js +1 -0
- package/examples/jsm/loaders/IESLoader.js +1 -0
- package/examples/jsm/loaders/KMZLoader.js +1 -0
- package/examples/jsm/loaders/KTX2Loader.js +67 -26
- package/examples/jsm/loaders/KTXLoader.js +1 -0
- package/examples/jsm/loaders/LDrawLoader.js +55 -3
- package/examples/jsm/loaders/LUT3dlLoader.js +1 -0
- package/examples/jsm/loaders/LUTCubeLoader.js +1 -0
- package/examples/jsm/loaders/LUTImageLoader.js +1 -0
- package/examples/jsm/loaders/LWOLoader.js +1 -13
- package/examples/jsm/loaders/LottieLoader.js +15 -0
- package/examples/jsm/loaders/MD2Loader.js +1 -0
- package/examples/jsm/loaders/MDDLoader.js +1 -0
- package/examples/jsm/loaders/MTLLoader.js +4 -3
- package/examples/jsm/loaders/MaterialXLoader.js +1 -0
- package/examples/jsm/loaders/NRRDLoader.js +1 -0
- package/examples/jsm/loaders/OBJLoader.js +1 -0
- package/examples/jsm/loaders/PCDLoader.js +122 -19
- package/examples/jsm/loaders/PDBLoader.js +1 -0
- package/examples/jsm/loaders/PLYLoader.js +1 -0
- package/examples/jsm/loaders/PVRLoader.js +1 -0
- package/examples/jsm/loaders/RGBELoader.js +1 -0
- package/examples/jsm/loaders/RGBMLoader.js +1 -0
- package/examples/jsm/loaders/STLLoader.js +1 -0
- package/examples/jsm/loaders/SVGLoader.js +1 -0
- package/examples/jsm/loaders/TDSLoader.js +1 -0
- package/examples/jsm/loaders/TGALoader.js +1 -0
- package/examples/jsm/loaders/TIFFLoader.js +1 -0
- package/examples/jsm/loaders/TTFLoader.js +1 -0
- package/examples/jsm/loaders/USDZLoader.js +1 -0
- package/examples/jsm/loaders/UltraHDRLoader.js +1 -0
- package/examples/jsm/loaders/VOXLoader.js +1 -0
- package/examples/jsm/loaders/VRMLLoader.js +3 -2
- package/examples/jsm/loaders/VTKLoader.js +1 -0
- package/examples/jsm/loaders/XYZLoader.js +1 -0
- package/examples/jsm/loaders/lwo/IFFParser.js +74 -74
- package/examples/jsm/materials/LDrawConditionalLineMaterial.js +1 -0
- package/examples/jsm/materials/LDrawConditionalLineNodeMaterial.js +1 -0
- package/examples/jsm/materials/MeshPostProcessingMaterial.js +1 -0
- package/examples/jsm/math/Capsule.js +2 -0
- package/examples/jsm/math/ColorConverter.js +1 -0
- package/examples/jsm/math/ConvexHull.js +2 -0
- package/examples/jsm/math/ImprovedNoise.js +19 -14
- package/examples/jsm/math/Lut.js +2 -0
- package/examples/jsm/math/MeshSurfaceSampler.js +2 -0
- package/examples/jsm/math/OBB.js +2 -0
- package/examples/jsm/math/Octree.js +20 -1
- package/examples/jsm/math/SimplexNoise.js +2 -0
- package/examples/jsm/misc/ConvexObjectBreaker.js +3 -1
- package/examples/jsm/misc/GPUComputationRenderer.js +2 -0
- package/examples/jsm/misc/Gyroscope.js +1 -0
- package/examples/jsm/misc/MD2Character.js +2 -0
- package/examples/jsm/misc/MD2CharacterComplex.js +5 -3
- package/examples/jsm/misc/MorphAnimMesh.js +1 -0
- package/examples/jsm/misc/MorphBlendMesh.js +1 -0
- package/examples/jsm/misc/ProgressiveLightMap.js +2 -0
- package/examples/jsm/misc/ProgressiveLightMapGPU.js +2 -0
- package/examples/jsm/misc/RollerCoaster.js +5 -0
- package/examples/jsm/misc/Timer.js +2 -0
- package/examples/jsm/misc/TubePainter.js +1 -0
- package/examples/jsm/misc/Volume.js +2 -0
- package/examples/jsm/misc/VolumeSlice.js +1 -0
- package/examples/jsm/modifiers/CurveModifier.js +3 -0
- package/examples/jsm/modifiers/CurveModifierGPU.js +2 -0
- package/examples/jsm/modifiers/EdgeSplitModifier.js +2 -0
- package/examples/jsm/modifiers/SimplifyModifier.js +2 -0
- package/examples/jsm/modifiers/TessellateModifier.js +2 -0
- package/examples/jsm/objects/GroundedSkybox.js +1 -0
- package/examples/jsm/objects/Lensflare.js +3 -0
- package/examples/jsm/objects/LensflareMesh.js +1 -0
- package/examples/jsm/objects/MarchingCubes.js +2 -0
- package/examples/jsm/objects/Reflector.js +1 -0
- package/examples/jsm/objects/ReflectorForSSRPass.js +1 -0
- package/examples/jsm/objects/Refractor.js +1 -0
- package/examples/jsm/objects/ShadowMesh.js +1 -0
- package/examples/jsm/objects/Sky.js +2 -1
- package/examples/jsm/objects/SkyMesh.js +20 -17
- package/examples/jsm/objects/Water.js +1 -0
- package/examples/jsm/objects/Water2.js +1 -0
- package/examples/jsm/objects/Water2Mesh.js +3 -1
- package/examples/jsm/objects/WaterMesh.js +2 -1
- package/examples/jsm/physics/AmmoPhysics.js +1 -0
- package/examples/jsm/physics/JoltPhysics.js +1 -0
- package/examples/jsm/physics/RapierPhysics.js +58 -1
- package/examples/jsm/postprocessing/AfterimagePass.js +20 -2
- package/examples/jsm/postprocessing/BloomPass.js +2 -1
- package/examples/jsm/postprocessing/BokehPass.js +2 -1
- package/examples/jsm/postprocessing/ClearPass.js +1 -0
- package/examples/jsm/postprocessing/CubeTexturePass.js +1 -0
- package/examples/jsm/postprocessing/DotScreenPass.js +1 -0
- package/examples/jsm/postprocessing/EffectComposer.js +5 -6
- package/examples/jsm/postprocessing/FXAAPass.js +40 -0
- package/examples/jsm/postprocessing/FilmPass.js +1 -0
- package/examples/jsm/postprocessing/GTAOPass.js +4 -3
- package/examples/jsm/postprocessing/GlitchPass.js +2 -1
- package/examples/jsm/postprocessing/HalftonePass.js +2 -1
- package/examples/jsm/postprocessing/LUTPass.js +1 -0
- package/examples/jsm/postprocessing/MaskPass.js +1 -0
- package/examples/jsm/postprocessing/OutlinePass.js +5 -2
- package/examples/jsm/postprocessing/OutputPass.js +1 -0
- package/examples/jsm/postprocessing/Pass.js +3 -1
- package/examples/jsm/postprocessing/RenderPass.js +1 -0
- package/examples/jsm/postprocessing/RenderPixelatedPass.js +2 -1
- package/examples/jsm/postprocessing/RenderTransitionPass.js +4 -3
- package/examples/jsm/postprocessing/SAOPass.js +3 -2
- package/examples/jsm/postprocessing/SMAAPass.js +3 -2
- package/examples/jsm/postprocessing/SSAARenderPass.js +2 -1
- package/examples/jsm/postprocessing/SSAOPass.js +2 -1
- package/examples/jsm/postprocessing/SSRPass.js +4 -3
- package/examples/jsm/postprocessing/SavePass.js +2 -1
- package/examples/jsm/postprocessing/ShaderPass.js +1 -0
- package/examples/jsm/postprocessing/TAARenderPass.js +1 -0
- package/examples/jsm/postprocessing/TexturePass.js +1 -0
- package/examples/jsm/postprocessing/UnrealBloomPass.js +2 -1
- package/examples/jsm/renderers/CSS2DRenderer.js +3 -0
- package/examples/jsm/renderers/CSS3DRenderer.js +4 -0
- package/examples/jsm/renderers/Projector.js +2 -0
- package/examples/jsm/renderers/SVGRenderer.js +3 -0
- package/examples/jsm/shaders/ACESFilmicToneMappingShader.js +4 -1
- package/examples/jsm/shaders/AfterimageShader.js +4 -1
- package/examples/jsm/shaders/BasicShader.js +4 -1
- package/examples/jsm/shaders/BleachBypassShader.js +4 -1
- package/examples/jsm/shaders/BlendShader.js +4 -1
- package/examples/jsm/shaders/BokehShader.js +4 -1
- package/examples/jsm/shaders/BokehShader2.js +4 -1
- package/examples/jsm/shaders/BrightnessContrastShader.js +4 -1
- package/examples/jsm/shaders/ColorCorrectionShader.js +4 -1
- package/examples/jsm/shaders/ColorifyShader.js +4 -1
- package/examples/jsm/shaders/ConvolutionShader.js +4 -1
- package/examples/jsm/shaders/CopyShader.js +4 -1
- package/examples/jsm/shaders/DOFMipMapShader.js +4 -1
- package/examples/jsm/shaders/DepthLimitedBlurShader.js +4 -1
- package/examples/jsm/shaders/DigitalGlitch.js +4 -1
- package/examples/jsm/shaders/DotScreenShader.js +4 -1
- package/examples/jsm/shaders/ExposureShader.js +4 -1
- package/examples/jsm/shaders/FXAAShader.js +4 -1
- package/examples/jsm/shaders/FilmShader.js +4 -1
- package/examples/jsm/shaders/FocusShader.js +4 -1
- package/examples/jsm/shaders/FreiChenShader.js +4 -1
- package/examples/jsm/shaders/GTAOShader.js +4 -1
- package/examples/jsm/shaders/GammaCorrectionShader.js +4 -1
- package/examples/jsm/shaders/GodRaysShader.js +4 -1
- package/examples/jsm/shaders/HalftoneShader.js +4 -1
- package/examples/jsm/shaders/HorizontalBlurShader.js +4 -1
- package/examples/jsm/shaders/HorizontalTiltShiftShader.js +4 -1
- package/examples/jsm/shaders/HueSaturationShader.js +4 -1
- package/examples/jsm/shaders/KaleidoShader.js +4 -1
- package/examples/jsm/shaders/LuminosityHighPassShader.js +4 -1
- package/examples/jsm/shaders/LuminosityShader.js +4 -1
- package/examples/jsm/shaders/MirrorShader.js +4 -1
- package/examples/jsm/shaders/NormalMapShader.js +4 -1
- package/examples/jsm/shaders/OutputShader.js +4 -1
- package/examples/jsm/shaders/PoissonDenoiseShader.js +4 -1
- package/examples/jsm/shaders/RGBShiftShader.js +4 -1
- package/examples/jsm/shaders/SAOShader.js +4 -1
- package/examples/jsm/shaders/SMAAShader.js +1 -0
- package/examples/jsm/shaders/SSAOShader.js +4 -1
- package/examples/jsm/shaders/SSRShader.js +1 -0
- package/examples/jsm/shaders/SepiaShader.js +4 -1
- package/examples/jsm/shaders/SobelOperatorShader.js +4 -1
- package/examples/jsm/shaders/SubsurfaceScatteringShader.js +4 -1
- package/examples/jsm/shaders/TechnicolorShader.js +4 -1
- package/examples/jsm/shaders/ToonShader.js +2 -1
- package/examples/jsm/shaders/TriangleBlurShader.js +4 -1
- package/examples/jsm/shaders/UnpackDepthRGBAShader.js +4 -1
- package/examples/jsm/shaders/VelocityShader.js +4 -1
- package/examples/jsm/shaders/VerticalBlurShader.js +4 -1
- package/examples/jsm/shaders/VerticalTiltShiftShader.js +4 -1
- package/examples/jsm/shaders/VignetteShader.js +4 -1
- package/examples/jsm/shaders/VolumeShader.js +5 -2
- package/examples/jsm/shaders/WaterRefractionShader.js +4 -1
- package/examples/jsm/textures/FlakesTexture.js +2 -0
- package/examples/jsm/transpiler/GLSLDecoder.js +1 -2
- package/examples/jsm/transpiler/TSLEncoder.js +52 -8
- package/examples/jsm/transpiler/Transpiler.js +2 -0
- package/examples/jsm/tsl/display/AfterImageNode.js +2 -3
- package/examples/jsm/tsl/display/AnaglyphPassNode.js +1 -0
- package/examples/jsm/tsl/display/AnamorphicNode.js +5 -4
- package/examples/jsm/tsl/display/BloomNode.js +1 -0
- package/examples/jsm/tsl/display/DenoiseNode.js +33 -33
- package/examples/jsm/tsl/display/DepthOfFieldNode.js +1 -0
- package/examples/jsm/tsl/display/DotScreenNode.js +1 -0
- package/examples/jsm/tsl/display/FXAANode.js +3 -2
- package/examples/jsm/tsl/display/FilmNode.js +1 -0
- package/examples/jsm/tsl/display/GTAONode.js +1 -0
- package/examples/jsm/tsl/display/GaussianBlurNode.js +2 -27
- package/examples/jsm/tsl/display/LensflareNode.js +1 -0
- package/examples/jsm/tsl/display/Lut3DNode.js +1 -0
- package/examples/jsm/tsl/display/OutlineNode.js +1 -0
- package/examples/jsm/tsl/display/ParallaxBarrierPassNode.js +1 -0
- package/examples/jsm/tsl/display/PixelationPassNode.js +1 -0
- package/examples/jsm/tsl/display/RGBShiftNode.js +1 -0
- package/examples/jsm/tsl/display/SMAANode.js +9 -8
- package/examples/jsm/tsl/display/SSAAPassNode.js +3 -2
- package/examples/jsm/tsl/display/SSRNode.js +1 -0
- package/examples/jsm/tsl/display/SobelOperatorNode.js +1 -0
- package/examples/jsm/tsl/display/StereoCompositePassNode.js +1 -0
- package/examples/jsm/tsl/display/StereoPassNode.js +1 -0
- package/examples/jsm/tsl/display/TRAAPassNode.js +5 -4
- package/examples/jsm/tsl/display/TransitionNode.js +1 -0
- package/examples/jsm/tsl/display/hashBlur.js +28 -6
- package/examples/jsm/tsl/lighting/TiledLightsNode.js +4 -3
- package/examples/jsm/tsl/math/Bayer.js +4 -1
- package/examples/jsm/tsl/shadows/TileShadowNode.js +456 -0
- package/examples/jsm/tsl/shadows/TileShadowNodeHelper.js +212 -0
- package/examples/jsm/tsl/utils/Raymarching.js +6 -3
- package/examples/jsm/utils/BufferGeometryUtils.js +4 -1
- package/examples/jsm/utils/CameraUtils.js +4 -1
- package/examples/jsm/utils/GeometryCompressionUtils.js +4 -1
- package/examples/jsm/utils/GeometryUtils.js +4 -1
- package/examples/jsm/utils/LDrawUtils.js +2 -0
- package/examples/jsm/utils/SceneOptimizer.js +2 -0
- package/examples/jsm/utils/SceneUtils.js +4 -1
- package/examples/jsm/utils/ShadowMapViewer.js +2 -0
- package/examples/jsm/utils/ShadowMapViewerGPU.js +2 -0
- package/examples/jsm/utils/SkeletonUtils.js +4 -1
- package/examples/jsm/utils/SortUtils.js +4 -1
- package/examples/jsm/utils/UVsDebug.js +4 -1
- package/examples/jsm/utils/WebGLTextureUtils.js +4 -1
- package/examples/jsm/utils/WebGPUTextureUtils.js +4 -1
- package/examples/jsm/utils/WorkerPool.js +2 -0
- package/examples/jsm/webxr/ARButton.js +1 -0
- package/examples/jsm/webxr/OculusHandModel.js +1 -0
- package/examples/jsm/webxr/OculusHandPointerModel.js +1 -0
- package/examples/jsm/webxr/Text2D.js +4 -1
- package/examples/jsm/webxr/VRButton.js +1 -0
- package/examples/jsm/webxr/XRButton.js +1 -0
- package/examples/jsm/webxr/XRControllerModelFactory.js +2 -0
- package/examples/jsm/webxr/XREstimatedLight.js +1 -0
- package/examples/jsm/webxr/XRHandMeshModel.js +2 -0
- package/examples/jsm/webxr/XRHandModelFactory.js +2 -0
- package/examples/jsm/webxr/XRHandPrimitiveModel.js +2 -0
- package/examples/jsm/webxr/XRPlanes.js +1 -0
- package/package.json +6 -4
- package/src/Three.Core.js +1 -1
- package/src/Three.TSL.js +13 -5
- package/src/Three.WebGPU.Nodes.js +1 -0
- package/src/Three.WebGPU.js +1 -0
- package/src/audio/AudioListener.js +13 -10
- package/src/cameras/ArrayCamera.js +9 -1
- package/src/constants.js +47 -20
- package/src/core/BufferAttribute.js +1 -1
- package/src/core/BufferGeometry.js +2 -5
- package/src/core/Object3D.js +22 -21
- package/src/core/RenderTarget.js +65 -21
- package/src/core/RenderTarget3D.js +1 -0
- package/src/extras/TextureUtils.js +1 -5
- package/src/extras/core/Curve.js +1 -1
- package/src/geometries/CapsuleGeometry.js +167 -17
- package/src/geometries/ExtrudeGeometry.js +39 -29
- package/src/helpers/ArrowHelper.js +2 -2
- package/src/helpers/SkeletonHelper.js +1 -1
- package/src/lights/LightShadow.js +14 -0
- package/src/lights/SpotLightShadow.js +9 -1
- package/src/lights/webgpu/ProjectorLight.js +46 -0
- package/src/loaders/BufferGeometryLoader.js +1 -10
- package/src/loaders/ImageBitmapLoader.js +21 -5
- package/src/loaders/ObjectLoader.js +44 -16
- package/src/loaders/nodes/NodeObjectLoader.js +2 -2
- package/src/materials/Material.js +1 -7
- package/src/materials/nodes/NodeMaterial.js +81 -18
- package/src/materials/nodes/manager/NodeMaterialObserver.js +20 -2
- package/src/math/Box3.js +28 -0
- package/src/math/Color.js +7 -7
- package/src/math/ColorManagement.js +22 -3
- package/src/math/FrustumArray.js +253 -0
- package/src/math/Ray.js +2 -0
- package/src/math/Sphere.js +28 -0
- package/src/nodes/Nodes.js +1 -0
- package/src/nodes/TSL.js +1 -0
- package/src/nodes/accessors/Bitangent.js +31 -9
- package/src/nodes/accessors/Camera.js +31 -4
- package/src/nodes/accessors/CubeTextureNode.js +50 -2
- package/src/nodes/accessors/InstanceNode.js +5 -4
- package/src/nodes/accessors/Lights.js +2 -2
- package/src/nodes/accessors/MaterialNode.js +4 -0
- package/src/nodes/accessors/ModelNode.js +1 -1
- package/src/nodes/accessors/Normal.js +26 -6
- package/src/nodes/accessors/Object3DNode.js +6 -7
- package/src/nodes/accessors/Position.js +14 -4
- package/src/nodes/accessors/ReferenceBaseNode.js +1 -1
- package/src/nodes/accessors/ReferenceNode.js +1 -1
- package/src/nodes/accessors/SkinningNode.js +3 -2
- package/src/nodes/accessors/StorageBufferNode.js +25 -0
- package/src/nodes/accessors/StorageTextureNode.js +14 -3
- package/src/nodes/accessors/TextureNode.js +59 -8
- package/src/nodes/accessors/VelocityNode.js +1 -0
- package/src/nodes/accessors/VertexColorNode.js +4 -4
- package/src/nodes/code/CodeNode.js +8 -11
- package/src/nodes/core/AssignNode.js +27 -5
- package/src/nodes/core/AttributeNode.js +2 -2
- package/src/nodes/core/CacheNode.js +14 -0
- package/src/nodes/core/ContextNode.js +7 -3
- package/src/nodes/core/Node.js +68 -19
- package/src/nodes/core/NodeBuilder.js +100 -12
- package/src/nodes/core/NodeUtils.js +42 -0
- package/src/nodes/core/NodeVarying.js +19 -1
- package/src/nodes/core/PropertyNode.js +8 -12
- package/src/nodes/core/StackNode.js +127 -2
- package/src/nodes/core/StructTypeNode.js +26 -4
- package/src/nodes/core/VarNode.js +11 -2
- package/src/nodes/core/VaryingNode.js +40 -21
- package/src/nodes/display/BlendModes.js +42 -1
- package/src/nodes/display/ColorSpaceNode.js +4 -27
- package/src/nodes/display/PassNode.js +8 -11
- package/src/nodes/functions/ShadowMaskModel.js +5 -1
- package/src/nodes/functions/material/getParallaxCorrectNormal.js +1 -1
- package/src/nodes/gpgpu/AtomicFunctionNode.js +28 -10
- package/src/nodes/gpgpu/BarrierNode.js +3 -3
- package/src/nodes/gpgpu/ComputeNode.js +1 -1
- package/src/nodes/lighting/AnalyticLightNode.js +7 -13
- package/src/nodes/lighting/HemisphereLightNode.js +2 -2
- package/src/nodes/lighting/IESSpotLightNode.js +2 -1
- package/src/nodes/lighting/LightsNode.js +25 -7
- package/src/nodes/lighting/ProjectorLightNode.js +78 -0
- package/src/nodes/lighting/ShadowBaseNode.js +1 -12
- package/src/nodes/lighting/ShadowFilterNode.js +274 -0
- package/src/nodes/lighting/ShadowNode.js +172 -240
- package/src/nodes/lighting/SpotLightNode.js +44 -7
- package/src/nodes/materialx/lib/mx_noise.js +1 -1
- package/src/nodes/math/MathNode.js +56 -20
- package/src/nodes/math/OperatorNode.js +109 -82
- package/src/nodes/shapes/Shapes.js +5 -4
- package/src/nodes/tsl/TSLCore.js +140 -49
- package/src/nodes/utils/DebugNode.js +15 -3
- package/src/nodes/utils/Discard.js +2 -2
- package/src/nodes/utils/LoopNode.js +64 -17
- package/src/nodes/utils/ReflectorNode.js +67 -4
- package/src/objects/BatchedMesh.js +16 -4
- package/src/objects/Mesh.js +9 -0
- package/src/objects/Skeleton.js +1 -1
- package/src/objects/Sprite.js +9 -0
- package/src/renderers/WebGL3DRenderTarget.js +1 -0
- package/src/renderers/WebGLArrayRenderTarget.js +1 -0
- package/src/renderers/WebGLCubeRenderTarget.js +2 -4
- package/src/renderers/WebGLRenderer.js +21 -10
- package/src/renderers/common/Animation.js +2 -2
- package/src/renderers/common/Background.js +11 -0
- package/src/renderers/common/RenderList.js +0 -4
- package/src/renderers/common/RenderObject.js +12 -1
- package/src/renderers/common/Renderer.js +116 -8
- package/src/renderers/common/Textures.js +15 -21
- package/src/renderers/common/TimestampQueryPool.js +1 -0
- package/src/renderers/common/Uniform.js +1 -1
- package/src/renderers/common/UniformsGroup.js +14 -18
- package/src/renderers/common/XRManager.js +154 -25
- package/src/renderers/common/extras/PMREMGenerator.js +29 -22
- package/src/renderers/common/nodes/Nodes.js +13 -3
- package/src/renderers/shaders/ShaderChunk/premultiplied_alpha_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderLib/background.glsl.js +1 -1
- package/src/renderers/webgl/WebGLShadowMap.js +3 -2
- package/src/renderers/webgl/WebGLTextures.js +143 -4
- package/src/renderers/webgl/WebGLUtils.js +1 -3
- package/src/renderers/webgl-fallback/WebGLBackend.js +170 -34
- package/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js +75 -7
- package/src/renderers/webgl-fallback/utils/WebGLConstants.js +1 -0
- package/src/renderers/webgl-fallback/utils/WebGLTextureUtils.js +42 -29
- package/src/renderers/webgl-fallback/utils/WebGLUtils.js +22 -21
- package/src/renderers/webgpu/WebGPUBackend.js +442 -127
- package/src/renderers/webgpu/WebGPURenderer.js +7 -0
- package/src/renderers/webgpu/nodes/BasicNodeLibrary.js +4 -1
- package/src/renderers/webgpu/nodes/StandardNodeLibrary.js +4 -1
- package/src/renderers/webgpu/nodes/WGSLNodeBuilder.js +75 -27
- package/src/renderers/webgpu/nodes/WGSLNodeFunction.js +3 -0
- package/src/renderers/webgpu/utils/WebGPUAttributeUtils.js +3 -1
- package/src/renderers/webgpu/utils/WebGPUBindingUtils.js +18 -5
- package/src/renderers/webgpu/utils/WebGPUConstants.js +1 -1
- package/src/renderers/webgpu/utils/WebGPUPipelineUtils.js +34 -4
- package/src/renderers/webgpu/utils/WebGPUTextureUtils.js +44 -49
- package/src/renderers/webxr/WebXRController.js +1 -1
- package/src/renderers/webxr/WebXRManager.js +2 -1
- package/src/textures/DepthTexture.js +6 -10
- package/src/textures/Source.js +22 -0
- package/src/textures/Texture.js +118 -1
- package/src/textures/VideoTexture.js +1 -1
- package/examples/jsm/effects/PeppersGhostEffect.js +0 -172
- package/src/core/RenderTargetArray.js +0 -40
|
@@ -37,6 +37,7 @@ class WebGPURenderer extends Renderer {
|
|
|
37
37
|
* @property {boolean} [antialias=false] - Whether MSAA as the default anti-aliasing should be enabled or not.
|
|
38
38
|
* @property {number} [samples=0] - When `antialias` is `true`, `4` samples are used by default. Set this parameter to any other integer value than 0 to overwrite the default.
|
|
39
39
|
* @property {boolean} [forceWebGL=false] - If set to `true`, the renderer uses a WebGL 2 backend no matter if WebGPU is supported or not.
|
|
40
|
+
* @property {boolean} [multiview=false] - If set to `true`, the renderer will use multiview during WebXR rendering if supported.
|
|
40
41
|
* @property {number} [outputType=undefined] - Texture type for output to canvas. By default, device's preferred format is used; other formats may incur overhead.
|
|
41
42
|
* @property {number} [colorBufferType=HalfFloatType] - Defines the type of color buffers. The default `HalfFloatType` is recommend for best
|
|
42
43
|
* quality. To save memory and bandwidth, `UnsignedByteType` might be used. This will reduce rendering quality though.
|
|
@@ -91,6 +92,12 @@ class WebGPURenderer extends Renderer {
|
|
|
91
92
|
*/
|
|
92
93
|
this.isWebGPURenderer = true;
|
|
93
94
|
|
|
95
|
+
if ( typeof __THREE_DEVTOOLS__ !== 'undefined' ) {
|
|
96
|
+
|
|
97
|
+
__THREE_DEVTOOLS__.dispatchEvent( new CustomEvent( 'observe', { detail: this } ) );
|
|
98
|
+
|
|
99
|
+
}
|
|
100
|
+
|
|
94
101
|
}
|
|
95
102
|
|
|
96
103
|
}
|
|
@@ -9,6 +9,7 @@ import { AmbientLight } from '../../../lights/AmbientLight.js';
|
|
|
9
9
|
import { HemisphereLight } from '../../../lights/HemisphereLight.js';
|
|
10
10
|
import { LightProbe } from '../../../lights/LightProbe.js';
|
|
11
11
|
import IESSpotLight from '../../../lights/webgpu/IESSpotLight.js';
|
|
12
|
+
import ProjectorLight from '../../../lights/webgpu/ProjectorLight.js';
|
|
12
13
|
import {
|
|
13
14
|
PointLightNode,
|
|
14
15
|
DirectionalLightNode,
|
|
@@ -17,7 +18,8 @@ import {
|
|
|
17
18
|
AmbientLightNode,
|
|
18
19
|
HemisphereLightNode,
|
|
19
20
|
LightProbeNode,
|
|
20
|
-
IESSpotLightNode
|
|
21
|
+
IESSpotLightNode,
|
|
22
|
+
ProjectorLightNode
|
|
21
23
|
} from '../../../nodes/Nodes.js';
|
|
22
24
|
|
|
23
25
|
// Tone Mapping
|
|
@@ -48,6 +50,7 @@ class BasicNodeLibrary extends NodeLibrary {
|
|
|
48
50
|
this.addLight( HemisphereLightNode, HemisphereLight );
|
|
49
51
|
this.addLight( LightProbeNode, LightProbe );
|
|
50
52
|
this.addLight( IESSpotLightNode, IESSpotLight );
|
|
53
|
+
this.addLight( ProjectorLightNode, ProjectorLight );
|
|
51
54
|
|
|
52
55
|
this.addToneMapping( linearToneMapping, LinearToneMapping );
|
|
53
56
|
this.addToneMapping( reinhardToneMapping, ReinhardToneMapping );
|
|
@@ -28,6 +28,7 @@ import { AmbientLight } from '../../../lights/AmbientLight.js';
|
|
|
28
28
|
import { HemisphereLight } from '../../../lights/HemisphereLight.js';
|
|
29
29
|
import { LightProbe } from '../../../lights/LightProbe.js';
|
|
30
30
|
import IESSpotLight from '../../../lights/webgpu/IESSpotLight.js';
|
|
31
|
+
import ProjectorLight from '../../../lights/webgpu/ProjectorLight.js';
|
|
31
32
|
import {
|
|
32
33
|
PointLightNode,
|
|
33
34
|
DirectionalLightNode,
|
|
@@ -36,7 +37,8 @@ import {
|
|
|
36
37
|
AmbientLightNode,
|
|
37
38
|
HemisphereLightNode,
|
|
38
39
|
LightProbeNode,
|
|
39
|
-
IESSpotLightNode
|
|
40
|
+
IESSpotLightNode,
|
|
41
|
+
ProjectorLightNode
|
|
40
42
|
} from '../../../nodes/Nodes.js';
|
|
41
43
|
|
|
42
44
|
// Tone Mapping
|
|
@@ -82,6 +84,7 @@ class StandardNodeLibrary extends NodeLibrary {
|
|
|
82
84
|
this.addLight( HemisphereLightNode, HemisphereLight );
|
|
83
85
|
this.addLight( LightProbeNode, LightProbe );
|
|
84
86
|
this.addLight( IESSpotLightNode, IESSpotLight );
|
|
87
|
+
this.addLight( ProjectorLightNode, ProjectorLight );
|
|
85
88
|
|
|
86
89
|
this.addToneMapping( linearToneMapping, LinearToneMapping );
|
|
87
90
|
this.addToneMapping( reinhardToneMapping, ReinhardToneMapping );
|
|
@@ -248,13 +248,9 @@ class WGSLNodeBuilder extends NodeBuilder {
|
|
|
248
248
|
|
|
249
249
|
}
|
|
250
250
|
|
|
251
|
-
} else if ( this.isFilteredTexture( texture ) ) {
|
|
252
|
-
|
|
253
|
-
return this.generateFilteredTexture( texture, textureProperty, uvSnippet );
|
|
254
|
-
|
|
255
251
|
} else {
|
|
256
252
|
|
|
257
|
-
return this.
|
|
253
|
+
return this._generateTextureSampleLevel( texture, textureProperty, uvSnippet, '0', depthSnippet );
|
|
258
254
|
|
|
259
255
|
}
|
|
260
256
|
|
|
@@ -291,13 +287,12 @@ class WGSLNodeBuilder extends NodeBuilder {
|
|
|
291
287
|
* @param {string} textureProperty - The name of the texture uniform in the shader.
|
|
292
288
|
* @param {string} uvSnippet - A WGSL snippet that represents texture coordinates used for sampling.
|
|
293
289
|
* @param {string} levelSnippet - A WGSL snippet that represents the mip level, with level 0 containing a full size version of the texture.
|
|
294
|
-
* @param {
|
|
295
|
-
* @param {string} [shaderStage=this.shaderStage] - The shader stage this code snippet is generated for.
|
|
290
|
+
* @param {string} depthSnippet - A WGSL snippet that represents 0-based texture array index to sample.
|
|
296
291
|
* @return {string} The WGSL snippet.
|
|
297
292
|
*/
|
|
298
|
-
_generateTextureSampleLevel( texture, textureProperty, uvSnippet, levelSnippet, depthSnippet
|
|
293
|
+
_generateTextureSampleLevel( texture, textureProperty, uvSnippet, levelSnippet, depthSnippet ) {
|
|
299
294
|
|
|
300
|
-
if (
|
|
295
|
+
if ( this.isUnfilterable( texture ) === false ) {
|
|
301
296
|
|
|
302
297
|
return `textureSampleLevel( ${ textureProperty }, ${ textureProperty }_sampler, ${ uvSnippet }, ${ levelSnippet } )`;
|
|
303
298
|
|
|
@@ -453,7 +448,7 @@ class WGSLNodeBuilder extends NodeBuilder {
|
|
|
453
448
|
|
|
454
449
|
textureData.dimensionsSnippet[ levelSnippet ] = textureDimensionNode;
|
|
455
450
|
|
|
456
|
-
if ( texture.isDataArrayTexture || texture.isData3DTexture ) {
|
|
451
|
+
if ( texture.isArrayTexture || texture.isDataArrayTexture || texture.isData3DTexture ) {
|
|
457
452
|
|
|
458
453
|
textureData.arrayLayerCount = new VarNode(
|
|
459
454
|
new ExpressionNode(
|
|
@@ -516,7 +511,7 @@ class WGSLNodeBuilder extends NodeBuilder {
|
|
|
516
511
|
const textureDimension = this.generateTextureDimension( texture, textureProperty, levelSnippet );
|
|
517
512
|
|
|
518
513
|
const vecType = texture.isData3DTexture ? 'vec3' : 'vec2';
|
|
519
|
-
const coordSnippet = `${ vecType }<u32>(${ wrapFunction }(${ uvSnippet }) * ${ vecType }<f32>(${ textureDimension }))`;
|
|
514
|
+
const coordSnippet = `${ vecType }<u32>( ${ wrapFunction }( ${ uvSnippet } ) * ${ vecType }<f32>( ${ textureDimension } ) )`;
|
|
520
515
|
|
|
521
516
|
return this.generateTextureLoad( texture, textureProperty, coordSnippet, depthSnippet, levelSnippet );
|
|
522
517
|
|
|
@@ -534,20 +529,30 @@ class WGSLNodeBuilder extends NodeBuilder {
|
|
|
534
529
|
*/
|
|
535
530
|
generateTextureLoad( texture, textureProperty, uvIndexSnippet, depthSnippet, levelSnippet = '0u' ) {
|
|
536
531
|
|
|
537
|
-
|
|
532
|
+
let snippet;
|
|
538
533
|
|
|
539
|
-
|
|
534
|
+
if ( texture.isVideoTexture === true ) {
|
|
535
|
+
|
|
536
|
+
snippet = `textureLoad( ${ textureProperty }, ${ uvIndexSnippet } )`;
|
|
540
537
|
|
|
541
538
|
} else if ( depthSnippet ) {
|
|
542
539
|
|
|
543
|
-
|
|
540
|
+
snippet = `textureLoad( ${ textureProperty }, ${ uvIndexSnippet }, ${ depthSnippet }, u32( ${ levelSnippet } ) )`;
|
|
544
541
|
|
|
545
542
|
} else {
|
|
546
543
|
|
|
547
|
-
|
|
544
|
+
snippet = `textureLoad( ${ textureProperty }, ${ uvIndexSnippet }, u32( ${ levelSnippet } ) )`;
|
|
545
|
+
|
|
546
|
+
if ( this.renderer.backend.compatibilityMode && texture.isDepthTexture ) {
|
|
547
|
+
|
|
548
|
+
snippet += '.x';
|
|
549
|
+
|
|
550
|
+
}
|
|
548
551
|
|
|
549
552
|
}
|
|
550
553
|
|
|
554
|
+
return snippet;
|
|
555
|
+
|
|
551
556
|
}
|
|
552
557
|
|
|
553
558
|
/**
|
|
@@ -556,12 +561,25 @@ class WGSLNodeBuilder extends NodeBuilder {
|
|
|
556
561
|
* @param {Texture} texture - The texture.
|
|
557
562
|
* @param {string} textureProperty - The name of the texture uniform in the shader.
|
|
558
563
|
* @param {string} uvIndexSnippet - A WGSL snippet that represents texture coordinates used for sampling.
|
|
564
|
+
* @param {?string} depthSnippet - A WGSL snippet that represents 0-based texture array index to sample.
|
|
559
565
|
* @param {string} valueSnippet - A WGSL snippet that represent the new texel value.
|
|
560
566
|
* @return {string} The WGSL snippet.
|
|
561
567
|
*/
|
|
562
|
-
generateTextureStore( texture, textureProperty, uvIndexSnippet, valueSnippet ) {
|
|
568
|
+
generateTextureStore( texture, textureProperty, uvIndexSnippet, depthSnippet, valueSnippet ) {
|
|
563
569
|
|
|
564
|
-
|
|
570
|
+
let snippet;
|
|
571
|
+
|
|
572
|
+
if ( depthSnippet ) {
|
|
573
|
+
|
|
574
|
+
snippet = `textureStore( ${ textureProperty }, ${ uvIndexSnippet }, ${ depthSnippet }, ${ valueSnippet } )`;
|
|
575
|
+
|
|
576
|
+
} else {
|
|
577
|
+
|
|
578
|
+
snippet = `textureStore( ${ textureProperty }, ${ uvIndexSnippet }, ${ valueSnippet } )`;
|
|
579
|
+
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
return snippet;
|
|
565
583
|
|
|
566
584
|
}
|
|
567
585
|
|
|
@@ -666,6 +684,12 @@ class WGSLNodeBuilder extends NodeBuilder {
|
|
|
666
684
|
|
|
667
685
|
if ( shaderStage === 'fragment' ) {
|
|
668
686
|
|
|
687
|
+
if ( texture.isDepthTexture === true && texture.isArrayTexture === true ) {
|
|
688
|
+
|
|
689
|
+
return `textureSampleCompare( ${ textureProperty }, ${ textureProperty }_sampler, ${ uvSnippet }, ${ depthSnippet }, ${ compareSnippet } )`;
|
|
690
|
+
|
|
691
|
+
}
|
|
692
|
+
|
|
669
693
|
return `textureSampleCompare( ${ textureProperty }, ${ textureProperty }_sampler, ${ uvSnippet }, ${ compareSnippet } )`;
|
|
670
694
|
|
|
671
695
|
} else {
|
|
@@ -697,7 +721,7 @@ class WGSLNodeBuilder extends NodeBuilder {
|
|
|
697
721
|
|
|
698
722
|
} else {
|
|
699
723
|
|
|
700
|
-
snippet = this._generateTextureSampleLevel( texture, textureProperty, uvSnippet, levelSnippet, depthSnippet
|
|
724
|
+
snippet = this._generateTextureSampleLevel( texture, textureProperty, uvSnippet, levelSnippet, depthSnippet );
|
|
701
725
|
|
|
702
726
|
}
|
|
703
727
|
|
|
@@ -890,7 +914,7 @@ class WGSLNodeBuilder extends NodeBuilder {
|
|
|
890
914
|
texture.store = node.isStorageTextureNode === true;
|
|
891
915
|
texture.setVisibility( gpuShaderStageLib[ shaderStage ] );
|
|
892
916
|
|
|
893
|
-
if (
|
|
917
|
+
if ( this.isUnfilterable( node.value ) === false && texture.store === false ) {
|
|
894
918
|
|
|
895
919
|
const sampler = new NodeSampler( `${ uniformNode.name }_sampler`, uniformNode.node, group );
|
|
896
920
|
sampler.setVisibility( gpuShaderStageLib[ shaderStage ] );
|
|
@@ -1560,10 +1584,17 @@ ${ flowData.code }
|
|
|
1560
1584
|
|
|
1561
1585
|
let attributesSnippet = `@location( ${index} )`;
|
|
1562
1586
|
|
|
1563
|
-
if (
|
|
1587
|
+
if ( varying.interpolationType ) {
|
|
1588
|
+
|
|
1589
|
+
const samplingSnippet = varying.interpolationSampling !== null ? `, ${ varying.interpolationSampling } )` : ' )';
|
|
1564
1590
|
|
|
1565
|
-
attributesSnippet +=
|
|
1591
|
+
attributesSnippet += ` @interpolate( ${ varying.interpolationType }${ samplingSnippet }`;
|
|
1566
1592
|
|
|
1593
|
+
// Otherwise, optimize interpolation when sensible
|
|
1594
|
+
|
|
1595
|
+
} else if ( /^(int|uint|ivec|uvec)/.test( varying.type ) ) {
|
|
1596
|
+
|
|
1597
|
+
attributesSnippet += ` @interpolate( ${ this.renderer.backend.compatibilityMode ? 'flat, either' : 'flat' } )`;
|
|
1567
1598
|
|
|
1568
1599
|
}
|
|
1569
1600
|
|
|
@@ -1591,7 +1622,16 @@ ${ flowData.code }
|
|
|
1591
1622
|
|
|
1592
1623
|
isCustomStruct( nodeUniform ) {
|
|
1593
1624
|
|
|
1594
|
-
|
|
1625
|
+
const attribute = nodeUniform.value;
|
|
1626
|
+
const bufferNode = nodeUniform.node;
|
|
1627
|
+
|
|
1628
|
+
const isAttributeStructType = ( attribute.isBufferAttribute || attribute.isInstancedBufferAttribute ) && bufferNode.structTypeNode !== null;
|
|
1629
|
+
|
|
1630
|
+
const isStructArray =
|
|
1631
|
+
( bufferNode.value && bufferNode.value.array ) &&
|
|
1632
|
+
( typeof bufferNode.value.itemSize === 'number' && bufferNode.value.array.length > bufferNode.value.itemSize );
|
|
1633
|
+
|
|
1634
|
+
return isAttributeStructType && ! isStructArray;
|
|
1595
1635
|
|
|
1596
1636
|
}
|
|
1597
1637
|
|
|
@@ -1619,7 +1659,7 @@ ${ flowData.code }
|
|
|
1619
1659
|
|
|
1620
1660
|
const texture = uniform.node.value;
|
|
1621
1661
|
|
|
1622
|
-
if (
|
|
1662
|
+
if ( this.isUnfilterable( texture ) === false && uniform.node.isStorageTextureNode !== true ) {
|
|
1623
1663
|
|
|
1624
1664
|
if ( this.isSampleCompare( texture ) ) {
|
|
1625
1665
|
|
|
@@ -1649,13 +1689,21 @@ ${ flowData.code }
|
|
|
1649
1689
|
|
|
1650
1690
|
textureType = 'texture_cube<f32>';
|
|
1651
1691
|
|
|
1652
|
-
} else if ( texture.
|
|
1692
|
+
} else if ( texture.isDepthTexture === true ) {
|
|
1653
1693
|
|
|
1654
|
-
|
|
1694
|
+
if ( this.renderer.backend.compatibilityMode && texture.compareFunction === null ) {
|
|
1655
1695
|
|
|
1656
|
-
|
|
1696
|
+
textureType = `texture${ multisampled }_2d<f32>`;
|
|
1697
|
+
|
|
1698
|
+
} else {
|
|
1657
1699
|
|
|
1658
|
-
|
|
1700
|
+
textureType = `texture_depth${ multisampled }_2d${ texture.isArrayTexture === true ? '_array' : '' }`;
|
|
1701
|
+
|
|
1702
|
+
}
|
|
1703
|
+
|
|
1704
|
+
} else if ( texture.isArrayTexture === true || texture.isDataArrayTexture === true || texture.isCompressedArrayTexture === true ) {
|
|
1705
|
+
|
|
1706
|
+
textureType = 'texture_2d_array<f32>';
|
|
1659
1707
|
|
|
1660
1708
|
} else if ( texture.isVideoTexture === true ) {
|
|
1661
1709
|
|
|
@@ -58,7 +58,10 @@ const wgslTypeLib = {
|
|
|
58
58
|
'texture_multisampled_2d': 'cubeTexture',
|
|
59
59
|
|
|
60
60
|
'texture_depth_2d': 'depthTexture',
|
|
61
|
+
'texture_depth_2d_array': 'depthTexture',
|
|
61
62
|
'texture_depth_multisampled_2d': 'depthTexture',
|
|
63
|
+
'texture_depth_cube': 'depthTexture',
|
|
64
|
+
'texture_depth_cube_array': 'depthTexture',
|
|
62
65
|
|
|
63
66
|
'texture_3d': 'texture3D',
|
|
64
67
|
|
|
@@ -113,7 +113,9 @@ class WebGPUAttributeUtils {
|
|
|
113
113
|
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
-
|
|
116
|
+
// ensure 4 byte alignment
|
|
117
|
+
const byteLength = array.byteLength;
|
|
118
|
+
const size = byteLength + ( ( 4 - ( byteLength % 4 ) ) % 4 );
|
|
117
119
|
|
|
118
120
|
buffer = device.createBuffer( {
|
|
119
121
|
label: bufferAttribute.name,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
|
-
GPUTextureAspect, GPUTextureViewDimension, GPUTextureSampleType, GPUBufferBindingType, GPUStorageTextureAccess
|
|
2
|
+
GPUTextureAspect, GPUTextureViewDimension, GPUTextureSampleType, GPUBufferBindingType, GPUStorageTextureAccess,
|
|
3
|
+
GPUSamplerBindingType
|
|
3
4
|
} from './WebGPUConstants.js';
|
|
4
5
|
|
|
5
6
|
import { FloatType, IntType, UnsignedIntType } from '../../../constants.js';
|
|
@@ -100,7 +101,11 @@ class WebGPUBindingUtils {
|
|
|
100
101
|
|
|
101
102
|
if ( binding.texture.compareFunction !== null ) {
|
|
102
103
|
|
|
103
|
-
sampler.type =
|
|
104
|
+
sampler.type = GPUSamplerBindingType.Comparison;
|
|
105
|
+
|
|
106
|
+
} else if ( backend.compatibilityMode ) {
|
|
107
|
+
|
|
108
|
+
sampler.type = GPUSamplerBindingType.NonFiltering;
|
|
104
109
|
|
|
105
110
|
}
|
|
106
111
|
|
|
@@ -155,7 +160,15 @@ class WebGPUBindingUtils {
|
|
|
155
160
|
|
|
156
161
|
if ( binding.texture.isDepthTexture ) {
|
|
157
162
|
|
|
158
|
-
texture.
|
|
163
|
+
if ( backend.compatibilityMode && binding.texture.compareFunction === null ) {
|
|
164
|
+
|
|
165
|
+
texture.sampleType = GPUTextureSampleType.UnfilterableFloat;
|
|
166
|
+
|
|
167
|
+
} else {
|
|
168
|
+
|
|
169
|
+
texture.sampleType = GPUTextureSampleType.Depth;
|
|
170
|
+
|
|
171
|
+
}
|
|
159
172
|
|
|
160
173
|
} else if ( binding.texture.isDataTexture || binding.texture.isDataArrayTexture || binding.texture.isData3DTexture ) {
|
|
161
174
|
|
|
@@ -189,7 +202,7 @@ class WebGPUBindingUtils {
|
|
|
189
202
|
|
|
190
203
|
texture.viewDimension = GPUTextureViewDimension.Cube;
|
|
191
204
|
|
|
192
|
-
} else if ( binding.texture.isDataArrayTexture || binding.texture.isCompressedArrayTexture ) {
|
|
205
|
+
} else if ( binding.texture.isArrayTexture || binding.texture.isDataArrayTexture || binding.texture.isCompressedArrayTexture ) {
|
|
193
206
|
|
|
194
207
|
texture.viewDimension = GPUTextureViewDimension.TwoDArray;
|
|
195
208
|
|
|
@@ -419,7 +432,7 @@ class WebGPUBindingUtils {
|
|
|
419
432
|
|
|
420
433
|
dimensionViewGPU = GPUTextureViewDimension.ThreeD;
|
|
421
434
|
|
|
422
|
-
} else if ( binding.texture.isDataArrayTexture || binding.texture.isCompressedArrayTexture ) {
|
|
435
|
+
} else if ( binding.texture.isArrayTexture || binding.texture.isDataArrayTexture || binding.texture.isCompressedArrayTexture ) {
|
|
423
436
|
|
|
424
437
|
dimensionViewGPU = GPUTextureViewDimension.TwoDArray;
|
|
425
438
|
|
|
@@ -227,7 +227,7 @@ export const GPUBlendFactor = {
|
|
|
227
227
|
SrcAlpha: 'src-alpha',
|
|
228
228
|
OneMinusSrcAlpha: 'one-minus-src-alpha',
|
|
229
229
|
Dst: 'dst',
|
|
230
|
-
|
|
230
|
+
OneMinusDst: 'one-minus-dst',
|
|
231
231
|
DstAlpha: 'dst-alpha',
|
|
232
232
|
OneMinusDstAlpha: 'one-minus-dst-alpha',
|
|
233
233
|
SrcAlphaSaturated: 'src-alpha-saturated',
|
|
@@ -36,6 +36,35 @@ class WebGPUPipelineUtils {
|
|
|
36
36
|
*/
|
|
37
37
|
this.backend = backend;
|
|
38
38
|
|
|
39
|
+
/**
|
|
40
|
+
* A Weak Map that tracks the active pipeline for render or compute passes.
|
|
41
|
+
*
|
|
42
|
+
* @private
|
|
43
|
+
* @type {WeakMap<(GPURenderPassEncoder|GPUComputePassEncoder),(GPURenderPipeline|GPUComputePipeline)>}
|
|
44
|
+
*/
|
|
45
|
+
this._activePipelines = new WeakMap();
|
|
46
|
+
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Sets the given pipeline for the given pass. The method makes sure to only set the
|
|
51
|
+
* pipeline when necessary.
|
|
52
|
+
*
|
|
53
|
+
* @param {(GPURenderPassEncoder|GPUComputePassEncoder)} pass - The pass encoder.
|
|
54
|
+
* @param {(GPURenderPipeline|GPUComputePipeline)} pipeline - The pipeline.
|
|
55
|
+
*/
|
|
56
|
+
setPipeline( pass, pipeline ) {
|
|
57
|
+
|
|
58
|
+
const currentPipeline = this._activePipelines.get( pass );
|
|
59
|
+
|
|
60
|
+
if ( currentPipeline !== pipeline ) {
|
|
61
|
+
|
|
62
|
+
pass.setPipeline( pipeline );
|
|
63
|
+
|
|
64
|
+
this._activePipelines.set( pass, pipeline );
|
|
65
|
+
|
|
66
|
+
}
|
|
67
|
+
|
|
39
68
|
}
|
|
40
69
|
|
|
41
70
|
/**
|
|
@@ -88,7 +117,7 @@ class WebGPUPipelineUtils {
|
|
|
88
117
|
|
|
89
118
|
let blending;
|
|
90
119
|
|
|
91
|
-
if ( material.
|
|
120
|
+
if ( material.blending !== NoBlending && ( material.blending !== NormalBlending || material.transparent !== false ) ) {
|
|
92
121
|
|
|
93
122
|
blending = this._getBlending( material );
|
|
94
123
|
|
|
@@ -228,9 +257,10 @@ class WebGPUPipelineUtils {
|
|
|
228
257
|
* Creates GPU render bundle encoder for the given render context.
|
|
229
258
|
*
|
|
230
259
|
* @param {RenderContext} renderContext - The render context.
|
|
260
|
+
* @param {?string} [label='renderBundleEncoder'] - The label.
|
|
231
261
|
* @return {GPURenderBundleEncoder} The GPU render bundle encoder.
|
|
232
262
|
*/
|
|
233
|
-
createBundleEncoder( renderContext ) {
|
|
263
|
+
createBundleEncoder( renderContext, label = 'renderBundleEncoder' ) {
|
|
234
264
|
|
|
235
265
|
const backend = this.backend;
|
|
236
266
|
const { utils, device } = backend;
|
|
@@ -240,7 +270,7 @@ class WebGPUPipelineUtils {
|
|
|
240
270
|
const sampleCount = this._getSampleCount( renderContext );
|
|
241
271
|
|
|
242
272
|
const descriptor = {
|
|
243
|
-
label:
|
|
273
|
+
label: label,
|
|
244
274
|
colorFormats: [ colorFormat ],
|
|
245
275
|
depthStencilFormat,
|
|
246
276
|
sampleCount
|
|
@@ -443,7 +473,7 @@ class WebGPUPipelineUtils {
|
|
|
443
473
|
break;
|
|
444
474
|
|
|
445
475
|
case OneMinusDstColorFactor:
|
|
446
|
-
blendFactor = GPUBlendFactor.
|
|
476
|
+
blendFactor = GPUBlendFactor.OneMinusDst;
|
|
447
477
|
break;
|
|
448
478
|
|
|
449
479
|
case DstAlphaFactor:
|