super-three 0.176.0 → 0.179.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 +4 -4
- package/build/three.cjs +8377 -6761
- package/build/three.core.js +8001 -6682
- package/build/three.core.min.js +1 -1
- package/build/three.module.js +378 -82
- package/build/three.module.min.js +1 -1
- package/build/three.tsl.js +84 -27
- package/build/three.tsl.min.js +1 -1
- package/build/three.webgpu.js +6829 -2835
- package/build/three.webgpu.min.js +1 -1
- package/build/three.webgpu.nodes.js +6646 -2835
- package/build/three.webgpu.nodes.min.js +1 -1
- package/examples/jsm/Addons.js +1 -3
- package/examples/jsm/animation/AnimationClipCreator.js +1 -0
- package/examples/jsm/animation/CCDIKSolver.js +6 -3
- package/examples/jsm/capabilities/WebGL.js +1 -27
- package/examples/jsm/capabilities/WebGPU.js +2 -1
- package/examples/jsm/controls/ArcballControls.js +15 -4
- 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 +62 -14
- 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 +22 -8
- 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 +57 -38
- 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 +679 -300
- 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 +48 -8
- 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 +11 -2
- 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/libs/meshopt_decoder.module.js +75 -58
- package/examples/jsm/lighting/TiledLighting.js +1 -0
- package/examples/jsm/lights/LightProbeGenerator.js +15 -3
- 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 +6 -5
- package/examples/jsm/loaders/DDSLoader.js +1 -0
- package/examples/jsm/loaders/DRACOLoader.js +2 -1
- package/examples/jsm/loaders/EXRLoader.js +211 -22
- package/examples/jsm/loaders/FBXLoader.js +25 -23
- 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 +213 -30
- 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 +14 -1
- package/examples/jsm/loaders/USDLoader.js +219 -0
- package/examples/jsm/loaders/USDZLoader.js +4 -891
- 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/loaders/usd/USDAParser.js +741 -0
- package/examples/jsm/loaders/usd/USDCParser.js +17 -0
- 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/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 +4 -3
- 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 +22 -19
- 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 +149 -13
- 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 +14 -12
- 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 +22 -19
- 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 +12 -10
- 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 +15 -3
- 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/AST.js +381 -30
- package/examples/jsm/transpiler/GLSLDecoder.js +227 -88
- package/examples/jsm/transpiler/Linker.js +327 -0
- package/examples/jsm/transpiler/TSLEncoder.js +234 -85
- package/examples/jsm/transpiler/Transpiler.js +19 -1
- package/examples/jsm/transpiler/TranspilerUtils.js +29 -0
- package/examples/jsm/transpiler/WGSLEncoder.js +788 -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 +9 -7
- package/examples/jsm/tsl/display/ChromaticAberrationNode.js +206 -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 +9 -36
- 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 +5 -4
- 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 → TRAANode.js} +184 -174
- 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 +5 -4
- 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 +2 -1
- package/src/Three.TSL.js +83 -26
- package/src/Three.WebGPU.Nodes.js +1 -0
- package/src/Three.WebGPU.js +3 -0
- package/src/animation/KeyframeTrack.js +1 -1
- package/src/animation/tracks/BooleanKeyframeTrack.js +1 -1
- package/src/animation/tracks/StringKeyframeTrack.js +1 -1
- package/src/audio/AudioListener.js +13 -10
- package/src/cameras/ArrayCamera.js +9 -1
- package/src/cameras/Camera.js +14 -0
- package/src/cameras/OrthographicCamera.js +1 -1
- package/src/cameras/PerspectiveCamera.js +1 -1
- package/src/constants.js +47 -20
- package/src/core/BufferAttribute.js +3 -3
- package/src/core/BufferGeometry.js +2 -5
- package/src/core/Clock.js +2 -8
- package/src/core/GLBufferAttribute.js +13 -1
- package/src/core/Object3D.js +23 -22
- package/src/core/RenderTarget.js +65 -21
- package/src/core/RenderTarget3D.js +1 -0
- package/{examples/jsm/misc → src/core}/Timer.js +4 -40
- package/src/extras/PMREMGenerator.js +11 -0
- package/src/extras/TextureUtils.js +1 -5
- package/src/extras/core/Curve.js +1 -1
- package/src/extras/core/Path.js +22 -22
- package/src/geometries/CapsuleGeometry.js +167 -17
- package/src/geometries/ExtrudeGeometry.js +39 -29
- package/src/helpers/ArrowHelper.js +2 -2
- package/src/helpers/CameraHelper.js +41 -11
- package/src/helpers/SkeletonHelper.js +36 -7
- package/src/lights/LightShadow.js +34 -7
- package/src/lights/PointLightShadow.js +1 -1
- 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/FileLoader.js +27 -4
- package/src/loaders/ImageBitmapLoader.js +48 -9
- package/src/loaders/ImageLoader.js +55 -8
- package/src/loaders/Loader.js +14 -0
- package/src/loaders/LoadingManager.js +23 -0
- 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/MeshBasicMaterial.js +1 -1
- package/src/materials/nodes/Line2NodeMaterial.js +0 -8
- package/src/materials/nodes/MeshBasicNodeMaterial.js +4 -3
- package/src/materials/nodes/MeshMatcapNodeMaterial.js +1 -1
- package/src/materials/nodes/MeshNormalNodeMaterial.js +2 -2
- package/src/materials/nodes/MeshPhysicalNodeMaterial.js +2 -1
- package/src/materials/nodes/MeshSSSNodeMaterial.js +2 -2
- package/src/materials/nodes/NodeMaterial.js +106 -20
- package/src/materials/nodes/PointsNodeMaterial.js +5 -0
- package/src/materials/nodes/manager/NodeMaterialObserver.js +107 -4
- package/src/math/Box3.js +28 -0
- package/src/math/Color.js +7 -7
- package/src/math/ColorManagement.js +22 -3
- package/src/math/Frustum.js +25 -9
- package/src/math/FrustumArray.js +258 -0
- package/src/math/Line3.js +129 -2
- package/src/math/Matrix4.js +48 -27
- package/src/math/Quaternion.js +1 -1
- package/src/math/Ray.js +2 -0
- package/src/math/Sphere.js +28 -0
- package/src/math/Spherical.js +2 -2
- package/src/nodes/Nodes.js +3 -3
- package/src/nodes/TSL.js +6 -3
- package/src/nodes/accessors/AccessorsUtils.js +7 -8
- package/src/nodes/accessors/Bitangent.js +54 -26
- package/src/nodes/accessors/Camera.js +40 -13
- 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 +110 -24
- package/src/nodes/accessors/Object3DNode.js +7 -8
- package/src/nodes/accessors/Position.js +14 -4
- package/src/nodes/accessors/ReferenceBaseNode.js +1 -1
- package/src/nodes/accessors/ReferenceNode.js +19 -4
- package/src/nodes/accessors/ReflectVector.js +3 -3
- package/src/nodes/accessors/SceneNode.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 +15 -4
- package/src/nodes/accessors/Tangent.js +25 -17
- package/src/nodes/accessors/TangentUtils.js +46 -0
- package/src/nodes/accessors/TextureBicubic.js +21 -3
- package/src/nodes/accessors/TextureNode.js +71 -8
- package/src/nodes/accessors/UniformArrayNode.js +0 -16
- 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/ArrayNode.js +12 -0
- package/src/nodes/core/AssignNode.js +30 -5
- package/src/nodes/core/AttributeNode.js +2 -2
- package/src/nodes/core/ContextNode.js +27 -4
- package/src/nodes/core/Node.js +83 -22
- package/src/nodes/core/NodeBuilder.js +273 -49
- package/src/nodes/core/NodeUtils.js +46 -1
- package/src/nodes/core/NodeVarying.js +19 -1
- package/src/nodes/core/PropertyNode.js +8 -12
- package/src/nodes/core/StackNode.js +171 -26
- package/src/nodes/core/StructTypeNode.js +26 -4
- package/src/nodes/core/SubBuildNode.js +89 -0
- package/src/nodes/core/UniformNode.js +63 -5
- package/src/nodes/core/VarNode.js +102 -4
- package/src/nodes/core/VaryingNode.js +45 -24
- package/src/nodes/display/BlendModes.js +42 -1
- package/src/nodes/display/ColorSpaceNode.js +4 -27
- package/src/nodes/display/FrontFacingNode.js +34 -2
- package/src/nodes/display/NormalMapNode.js +19 -50
- package/src/nodes/display/PassNode.js +165 -20
- package/src/nodes/display/ScreenNode.js +0 -26
- package/src/nodes/display/ViewportTextureNode.js +67 -7
- package/src/nodes/functions/BSDF/BRDF_GGX.js +2 -6
- package/src/nodes/functions/BSDF/BRDF_Sheen.js +4 -4
- package/src/nodes/functions/PhongLightingModel.js +3 -3
- package/src/nodes/functions/PhysicalLightingModel.js +16 -16
- package/src/nodes/functions/ShadowMaskModel.js +5 -1
- package/src/nodes/functions/material/getGeometryRoughness.js +2 -2
- 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 +68 -24
- package/src/nodes/gpgpu/WorkgroupInfoNode.js +28 -3
- package/src/nodes/lighting/AnalyticLightNode.js +7 -13
- package/src/nodes/lighting/EnvironmentNode.js +5 -5
- package/src/nodes/lighting/HemisphereLightNode.js +2 -2
- package/src/nodes/lighting/IESSpotLightNode.js +2 -1
- package/src/nodes/lighting/LightsNode.js +29 -11
- package/src/nodes/lighting/ProjectorLightNode.js +91 -0
- package/src/nodes/lighting/ShadowBaseNode.js +1 -12
- package/src/nodes/lighting/ShadowFilterNode.js +274 -0
- package/src/nodes/lighting/ShadowNode.js +174 -242
- package/src/nodes/lighting/SpotLightNode.js +44 -7
- package/src/nodes/materialx/MaterialXNodes.js +131 -2
- package/src/nodes/materialx/lib/mx_noise.js +166 -2
- package/src/nodes/math/ConditionalNode.js +1 -20
- package/src/nodes/math/MathNode.js +146 -75
- package/src/nodes/math/OperatorNode.js +129 -119
- package/src/nodes/shapes/Shapes.js +5 -4
- package/src/nodes/tsl/TSLBase.js +1 -0
- package/src/nodes/tsl/TSLCore.js +222 -72
- package/src/nodes/utils/DebugNode.js +16 -4
- package/src/nodes/utils/Discard.js +2 -2
- package/src/nodes/utils/EquirectUV.js +27 -0
- package/src/nodes/utils/EventNode.js +83 -0
- package/src/nodes/utils/LoopNode.js +64 -34
- package/src/nodes/utils/MatcapUV.js +22 -0
- package/src/nodes/utils/RTTNode.js +22 -5
- package/src/nodes/utils/ReflectorNode.js +77 -7
- package/src/nodes/utils/SampleNode.js +81 -0
- package/src/nodes/utils/TriplanarTextures.js +65 -0
- package/src/objects/BatchedMesh.js +20 -6
- 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 +45 -32
- package/src/renderers/common/Animation.js +2 -2
- package/src/renderers/common/Background.js +13 -2
- package/src/renderers/common/Bindings.js +19 -18
- package/src/renderers/common/Color4.js +2 -2
- package/src/renderers/common/CubeRenderTarget.js +1 -1
- package/src/renderers/common/PostProcessing.js +60 -5
- package/src/renderers/common/RenderList.js +0 -4
- package/src/renderers/common/RenderObject.js +80 -4
- package/src/renderers/common/Renderer.js +133 -22
- package/src/renderers/common/SampledTexture.js +3 -71
- package/src/renderers/common/Sampler.js +79 -0
- package/src/renderers/common/Storage3DTexture.js +100 -0
- package/src/renderers/common/StorageArrayTexture.js +84 -0
- package/src/renderers/common/StorageTexture.js +19 -0
- package/src/renderers/common/Textures.js +34 -24
- 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 +183 -35
- package/src/renderers/common/XRRenderTarget.js +21 -4
- package/src/renderers/common/extras/PMREMGenerator.js +30 -23
- package/src/renderers/common/nodes/NodeSampledTexture.js +0 -12
- 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/ShaderChunk/shadowmap_pars_fragment.glsl.js +20 -2
- package/src/renderers/shaders/ShaderLib/background.glsl.js +1 -1
- package/src/renderers/shaders/ShaderLib/depth.glsl.js +11 -2
- package/src/renderers/webgl/WebGLAttributes.js +4 -0
- package/src/renderers/webgl/WebGLCapabilities.js +2 -2
- package/src/renderers/webgl/WebGLProgram.js +12 -6
- package/src/renderers/webgl/WebGLPrograms.js +6 -4
- package/src/renderers/webgl/WebGLShadowMap.js +14 -3
- package/src/renderers/webgl/WebGLState.js +4 -4
- package/src/renderers/webgl/WebGLTextures.js +162 -11
- package/src/renderers/webgl/WebGLUtils.js +1 -3
- package/src/renderers/webgl-fallback/WebGLBackend.js +261 -94
- package/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js +75 -9
- package/src/renderers/webgl-fallback/utils/WebGLAttributeUtils.js +4 -0
- package/src/renderers/webgl-fallback/utils/WebGLConstants.js +1 -0
- package/src/renderers/webgl-fallback/utils/WebGLState.js +4 -4
- package/src/renderers/webgl-fallback/utils/WebGLTextureUtils.js +44 -29
- package/src/renderers/webgl-fallback/utils/WebGLUtils.js +22 -21
- package/src/renderers/webgpu/WebGPUBackend.js +505 -143
- 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 +129 -96
- package/src/renderers/webgpu/nodes/WGSLNodeFunction.js +3 -0
- package/src/renderers/webgpu/utils/WebGPUAttributeUtils.js +9 -1
- package/src/renderers/webgpu/utils/WebGPUBindingUtils.js +58 -31
- package/src/renderers/webgpu/utils/WebGPUConstants.js +8 -2
- package/src/renderers/webgpu/utils/WebGPUPipelineUtils.js +39 -9
- package/src/renderers/webgpu/utils/WebGPUTextureUtils.js +50 -108
- package/src/renderers/webgpu/utils/WebGPUUtils.js +2 -17
- package/src/renderers/webxr/WebXRController.js +1 -1
- package/src/renderers/webxr/WebXRDepthSensing.js +6 -10
- package/src/renderers/webxr/WebXRManager.js +70 -7
- package/src/textures/DepthTexture.js +6 -10
- package/src/textures/ExternalTexture.js +45 -0
- package/src/textures/FramebufferTexture.js +2 -2
- package/src/textures/Source.js +32 -0
- package/src/textures/Texture.js +118 -1
- package/src/textures/VideoTexture.js +31 -3
- package/examples/jsm/effects/PeppersGhostEffect.js +0 -172
- package/src/core/RenderTargetArray.js +0 -40
- package/src/nodes/utils/EquirectUVNode.js +0 -65
- package/src/nodes/utils/MatcapUVNode.js +0 -49
- package/src/nodes/utils/TriplanarTexturesNode.js +0 -148
|
@@ -75,7 +75,17 @@ export default /* glsl */`
|
|
|
75
75
|
|
|
76
76
|
float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {
|
|
77
77
|
|
|
78
|
-
|
|
78
|
+
float depth = unpackRGBAToDepth( texture2D( depths, uv ) );
|
|
79
|
+
|
|
80
|
+
#ifdef USE_REVERSEDEPTHBUF
|
|
81
|
+
|
|
82
|
+
return step( depth, compare );
|
|
83
|
+
|
|
84
|
+
#else
|
|
85
|
+
|
|
86
|
+
return step( compare, depth );
|
|
87
|
+
|
|
88
|
+
#endif
|
|
79
89
|
|
|
80
90
|
}
|
|
81
91
|
|
|
@@ -91,7 +101,15 @@ export default /* glsl */`
|
|
|
91
101
|
|
|
92
102
|
vec2 distribution = texture2DDistribution( shadow, uv );
|
|
93
103
|
|
|
94
|
-
|
|
104
|
+
#ifdef USE_REVERSEDEPTHBUF
|
|
105
|
+
|
|
106
|
+
float hard_shadow = step( distribution.x, compare ); // Hard Shadow
|
|
107
|
+
|
|
108
|
+
#else
|
|
109
|
+
|
|
110
|
+
float hard_shadow = step( compare , distribution.x ); // Hard Shadow
|
|
111
|
+
|
|
112
|
+
#endif
|
|
95
113
|
|
|
96
114
|
if (hard_shadow != 1.0 ) {
|
|
97
115
|
|
|
@@ -23,7 +23,7 @@ void main() {
|
|
|
23
23
|
|
|
24
24
|
#ifdef DECODE_VIDEO_TEXTURE
|
|
25
25
|
|
|
26
|
-
// use inline sRGB decode until browsers properly support
|
|
26
|
+
// use inline sRGB decode until browsers properly support SRGB8_ALPHA8 with video textures
|
|
27
27
|
|
|
28
28
|
texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );
|
|
29
29
|
|
|
@@ -80,8 +80,17 @@ void main() {
|
|
|
80
80
|
|
|
81
81
|
#include <logdepthbuf_fragment>
|
|
82
82
|
|
|
83
|
-
// Higher precision equivalent of gl_FragCoord.z
|
|
84
|
-
|
|
83
|
+
// Higher precision equivalent of gl_FragCoord.z
|
|
84
|
+
|
|
85
|
+
#ifdef USE_REVERSEDEPTHBUF
|
|
86
|
+
|
|
87
|
+
float fragCoordZ = vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ];
|
|
88
|
+
|
|
89
|
+
#else
|
|
90
|
+
|
|
91
|
+
float fragCoordZ = 0.5 * vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ] + 0.5;
|
|
92
|
+
|
|
93
|
+
#endif
|
|
85
94
|
|
|
86
95
|
#if DEPTH_PACKING == 3200
|
|
87
96
|
|
|
@@ -21,6 +21,10 @@ function WebGLAttributes( gl ) {
|
|
|
21
21
|
|
|
22
22
|
type = gl.FLOAT;
|
|
23
23
|
|
|
24
|
+
} else if ( typeof Float16Array !== 'undefined' && array instanceof Float16Array ) {
|
|
25
|
+
|
|
26
|
+
type = gl.HALF_FLOAT;
|
|
27
|
+
|
|
24
28
|
} else if ( array instanceof Uint16Array ) {
|
|
25
29
|
|
|
26
30
|
if ( attribute.isFloat16BufferAttribute ) {
|
|
@@ -92,7 +92,7 @@ function WebGLCapabilities( gl, extensions, parameters, utils ) {
|
|
|
92
92
|
}
|
|
93
93
|
|
|
94
94
|
const logarithmicDepthBuffer = parameters.logarithmicDepthBuffer === true;
|
|
95
|
-
const
|
|
95
|
+
const reversedDepthBuffer = parameters.reversedDepthBuffer === true && extensions.has( 'EXT_clip_control' );
|
|
96
96
|
|
|
97
97
|
const maxTextures = gl.getParameter( gl.MAX_TEXTURE_IMAGE_UNITS );
|
|
98
98
|
const maxVertexTextures = gl.getParameter( gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS );
|
|
@@ -120,7 +120,7 @@ function WebGLCapabilities( gl, extensions, parameters, utils ) {
|
|
|
120
120
|
|
|
121
121
|
precision: precision,
|
|
122
122
|
logarithmicDepthBuffer: logarithmicDepthBuffer,
|
|
123
|
-
|
|
123
|
+
reversedDepthBuffer: reversedDepthBuffer,
|
|
124
124
|
|
|
125
125
|
maxTextures: maxTextures,
|
|
126
126
|
maxVertexTextures: maxVertexTextures,
|
|
@@ -57,7 +57,9 @@ function getEncodingComponents( colorSpace ) {
|
|
|
57
57
|
function getShaderErrors( gl, shader, type ) {
|
|
58
58
|
|
|
59
59
|
const status = gl.getShaderParameter( shader, gl.COMPILE_STATUS );
|
|
60
|
-
|
|
60
|
+
|
|
61
|
+
const shaderInfoLog = gl.getShaderInfoLog( shader ) || '';
|
|
62
|
+
const errors = shaderInfoLog.trim();
|
|
61
63
|
|
|
62
64
|
if ( status && errors === '' ) return '';
|
|
63
65
|
|
|
@@ -654,7 +656,7 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
|
|
|
654
656
|
parameters.numLightProbes > 0 ? '#define USE_LIGHT_PROBES' : '',
|
|
655
657
|
|
|
656
658
|
parameters.logarithmicDepthBuffer ? '#define USE_LOGDEPTHBUF' : '',
|
|
657
|
-
parameters.
|
|
659
|
+
parameters.reversedDepthBuffer ? '#define USE_REVERSEDEPTHBUF' : '',
|
|
658
660
|
|
|
659
661
|
'uniform mat4 modelMatrix;',
|
|
660
662
|
'uniform mat4 modelViewMatrix;',
|
|
@@ -821,7 +823,7 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
|
|
|
821
823
|
parameters.decodeVideoTextureEmissive ? '#define DECODE_VIDEO_TEXTURE_EMISSIVE' : '',
|
|
822
824
|
|
|
823
825
|
parameters.logarithmicDepthBuffer ? '#define USE_LOGDEPTHBUF' : '',
|
|
824
|
-
parameters.
|
|
826
|
+
parameters.reversedDepthBuffer ? '#define USE_REVERSEDEPTHBUF' : '',
|
|
825
827
|
|
|
826
828
|
'uniform mat4 viewMatrix;',
|
|
827
829
|
'uniform vec3 cameraPosition;',
|
|
@@ -967,9 +969,13 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
|
|
|
967
969
|
// check for link errors
|
|
968
970
|
if ( renderer.debug.checkShaderErrors ) {
|
|
969
971
|
|
|
970
|
-
const
|
|
971
|
-
const
|
|
972
|
-
const
|
|
972
|
+
const programInfoLog = gl.getProgramInfoLog( program ) || '';
|
|
973
|
+
const vertexShaderInfoLog = gl.getShaderInfoLog( glVertexShader ) || '';
|
|
974
|
+
const fragmentShaderInfoLog = gl.getShaderInfoLog( glFragmentShader ) || '';
|
|
975
|
+
|
|
976
|
+
const programLog = programInfoLog.trim();
|
|
977
|
+
const vertexLog = vertexShaderInfoLog.trim();
|
|
978
|
+
const fragmentLog = fragmentShaderInfoLog.trim();
|
|
973
979
|
|
|
974
980
|
let runnable = true;
|
|
975
981
|
let haveDiagnostics = true;
|
|
@@ -108,7 +108,7 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
|
|
|
108
108
|
}
|
|
109
109
|
|
|
110
110
|
const currentRenderTarget = renderer.getRenderTarget();
|
|
111
|
-
const
|
|
111
|
+
const reversedDepthBuffer = renderer.state.buffers.depth.getReversed();
|
|
112
112
|
|
|
113
113
|
const numMultiviewViews = currentRenderTarget && currentRenderTarget.isWebGLMultiviewRenderTarget ? currentRenderTarget.numViews : 0;
|
|
114
114
|
|
|
@@ -305,11 +305,11 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
|
|
|
305
305
|
useFog: material.fog === true,
|
|
306
306
|
fogExp2: ( !! fog && fog.isFogExp2 ),
|
|
307
307
|
|
|
308
|
-
flatShading: material.flatShading === true,
|
|
308
|
+
flatShading: ( material.flatShading === true && material.wireframe === false ),
|
|
309
309
|
|
|
310
310
|
sizeAttenuation: material.sizeAttenuation === true,
|
|
311
311
|
logarithmicDepthBuffer: logarithmicDepthBuffer,
|
|
312
|
-
|
|
312
|
+
reversedDepthBuffer: reversedDepthBuffer,
|
|
313
313
|
|
|
314
314
|
skinning: object.isSkinnedMesh === true,
|
|
315
315
|
|
|
@@ -518,6 +518,8 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
|
|
|
518
518
|
_programLayers.enable( 20 );
|
|
519
519
|
if ( parameters.batchingColor )
|
|
520
520
|
_programLayers.enable( 21 );
|
|
521
|
+
if ( parameters.gradientMap )
|
|
522
|
+
_programLayers.enable( 22 );
|
|
521
523
|
|
|
522
524
|
array.push( _programLayers.mask );
|
|
523
525
|
_programLayers.disableAll();
|
|
@@ -530,7 +532,7 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
|
|
|
530
532
|
_programLayers.enable( 2 );
|
|
531
533
|
if ( parameters.logarithmicDepthBuffer )
|
|
532
534
|
_programLayers.enable( 3 );
|
|
533
|
-
if ( parameters.
|
|
535
|
+
if ( parameters.reversedDepthBuffer )
|
|
534
536
|
_programLayers.enable( 4 );
|
|
535
537
|
if ( parameters.skinning )
|
|
536
538
|
_programLayers.enable( 5 );
|
|
@@ -84,7 +84,17 @@ function WebGLShadowMap( renderer, objects, capabilities ) {
|
|
|
84
84
|
|
|
85
85
|
// Set GL state for depth map.
|
|
86
86
|
_state.setBlending( NoBlending );
|
|
87
|
-
|
|
87
|
+
|
|
88
|
+
if ( _state.buffers.depth.getReversed() ) {
|
|
89
|
+
|
|
90
|
+
_state.buffers.color.setClear( 0, 0, 0, 0 );
|
|
91
|
+
|
|
92
|
+
} else {
|
|
93
|
+
|
|
94
|
+
_state.buffers.color.setClear( 1, 1, 1, 1 );
|
|
95
|
+
|
|
96
|
+
}
|
|
97
|
+
|
|
88
98
|
_state.buffers.depth.setTest( true );
|
|
89
99
|
_state.setScissorTest( false );
|
|
90
100
|
|
|
@@ -257,7 +267,8 @@ function WebGLShadowMap( renderer, objects, capabilities ) {
|
|
|
257
267
|
if ( ( renderer.localClippingEnabled && material.clipShadows === true && Array.isArray( material.clippingPlanes ) && material.clippingPlanes.length !== 0 ) ||
|
|
258
268
|
( material.displacementMap && material.displacementScale !== 0 ) ||
|
|
259
269
|
( material.alphaMap && material.alphaTest > 0 ) ||
|
|
260
|
-
( material.map && material.alphaTest > 0 )
|
|
270
|
+
( material.map && material.alphaTest > 0 ) ||
|
|
271
|
+
( material.alphaToCoverage === true ) ) {
|
|
261
272
|
|
|
262
273
|
// in this case we need a unique material instance reflecting the
|
|
263
274
|
// appropriate state
|
|
@@ -303,7 +314,7 @@ function WebGLShadowMap( renderer, objects, capabilities ) {
|
|
|
303
314
|
}
|
|
304
315
|
|
|
305
316
|
result.alphaMap = material.alphaMap;
|
|
306
|
-
result.alphaTest = material.alphaTest;
|
|
317
|
+
result.alphaTest = ( material.alphaToCoverage === true ) ? 0.5 : material.alphaTest; // approximate alphaToCoverage by using a fixed alphaTest value
|
|
307
318
|
result.map = material.map;
|
|
308
319
|
|
|
309
320
|
result.clipShadows = material.clipShadows;
|
|
@@ -667,7 +667,7 @@ function WebGLState( gl, extensions ) {
|
|
|
667
667
|
break;
|
|
668
668
|
|
|
669
669
|
case MultiplyBlending:
|
|
670
|
-
gl.blendFuncSeparate( gl.
|
|
670
|
+
gl.blendFuncSeparate( gl.DST_COLOR, gl.ONE_MINUS_SRC_ALPHA, gl.ZERO, gl.ONE );
|
|
671
671
|
break;
|
|
672
672
|
|
|
673
673
|
default:
|
|
@@ -685,15 +685,15 @@ function WebGLState( gl, extensions ) {
|
|
|
685
685
|
break;
|
|
686
686
|
|
|
687
687
|
case AdditiveBlending:
|
|
688
|
-
gl.
|
|
688
|
+
gl.blendFuncSeparate( gl.SRC_ALPHA, gl.ONE, gl.ONE, gl.ONE );
|
|
689
689
|
break;
|
|
690
690
|
|
|
691
691
|
case SubtractiveBlending:
|
|
692
|
-
|
|
692
|
+
console.error( 'THREE.WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true' );
|
|
693
693
|
break;
|
|
694
694
|
|
|
695
695
|
case MultiplyBlending:
|
|
696
|
-
|
|
696
|
+
console.error( 'THREE.WebGLState: MultiplyBlending requires material.premultipliedAlpha = true' );
|
|
697
697
|
break;
|
|
698
698
|
|
|
699
699
|
default:
|
|
@@ -519,7 +519,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
519
519
|
|
|
520
520
|
if ( texture.isVideoTexture ) updateVideoTexture( texture );
|
|
521
521
|
|
|
522
|
-
if ( texture.isRenderTargetTexture === false && texture.version > 0 && textureProperties.__version !== texture.version ) {
|
|
522
|
+
if ( texture.isRenderTargetTexture === false && texture.isExternalTexture !== true && texture.version > 0 && textureProperties.__version !== texture.version ) {
|
|
523
523
|
|
|
524
524
|
const image = texture.image;
|
|
525
525
|
|
|
@@ -541,6 +541,10 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
541
541
|
|
|
542
542
|
}
|
|
543
543
|
|
|
544
|
+
} else if ( texture.isExternalTexture ) {
|
|
545
|
+
|
|
546
|
+
textureProperties.__webglTexture = texture.sourceTexture ? texture.sourceTexture : null;
|
|
547
|
+
|
|
544
548
|
}
|
|
545
549
|
|
|
546
550
|
state.bindTexture( _gl.TEXTURE_2D, textureProperties.__webglTexture, _gl.TEXTURE0 + slot );
|
|
@@ -551,7 +555,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
551
555
|
|
|
552
556
|
const textureProperties = properties.get( texture );
|
|
553
557
|
|
|
554
|
-
if ( texture.version > 0 && textureProperties.__version !== texture.version ) {
|
|
558
|
+
if ( texture.isRenderTargetTexture === false && texture.version > 0 && textureProperties.__version !== texture.version ) {
|
|
555
559
|
|
|
556
560
|
uploadTexture( textureProperties, texture, slot );
|
|
557
561
|
return;
|
|
@@ -566,7 +570,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
566
570
|
|
|
567
571
|
const textureProperties = properties.get( texture );
|
|
568
572
|
|
|
569
|
-
if ( texture.version > 0 && textureProperties.__version !== texture.version ) {
|
|
573
|
+
if ( texture.isRenderTargetTexture === false && texture.version > 0 && textureProperties.__version !== texture.version ) {
|
|
570
574
|
|
|
571
575
|
uploadTexture( textureProperties, texture, slot );
|
|
572
576
|
return;
|
|
@@ -746,6 +750,114 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
746
750
|
|
|
747
751
|
}
|
|
748
752
|
|
|
753
|
+
function getRow( index, rowLength, componentStride ) {
|
|
754
|
+
|
|
755
|
+
return Math.floor( Math.floor( index / componentStride ) / rowLength );
|
|
756
|
+
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
function updateTexture( texture, image, glFormat, glType ) {
|
|
760
|
+
|
|
761
|
+
const componentStride = 4; // only RGBA supported
|
|
762
|
+
|
|
763
|
+
const updateRanges = texture.updateRanges;
|
|
764
|
+
|
|
765
|
+
if ( updateRanges.length === 0 ) {
|
|
766
|
+
|
|
767
|
+
state.texSubImage2D( _gl.TEXTURE_2D, 0, 0, 0, image.width, image.height, glFormat, glType, image.data );
|
|
768
|
+
|
|
769
|
+
} else {
|
|
770
|
+
|
|
771
|
+
// Before applying update ranges, we merge any adjacent / overlapping
|
|
772
|
+
// ranges to reduce load on `gl.texSubImage2D`. Empirically, this has led
|
|
773
|
+
// to performance improvements for applications which make heavy use of
|
|
774
|
+
// update ranges. Likely due to GPU command overhead.
|
|
775
|
+
//
|
|
776
|
+
// Note that to reduce garbage collection between frames, we merge the
|
|
777
|
+
// update ranges in-place. This is safe because this method will clear the
|
|
778
|
+
// update ranges once updated.
|
|
779
|
+
|
|
780
|
+
updateRanges.sort( ( a, b ) => a.start - b.start );
|
|
781
|
+
|
|
782
|
+
// To merge the update ranges in-place, we work from left to right in the
|
|
783
|
+
// existing updateRanges array, merging ranges. This may result in a final
|
|
784
|
+
// array which is smaller than the original. This index tracks the last
|
|
785
|
+
// index representing a merged range, any data after this index can be
|
|
786
|
+
// trimmed once the merge algorithm is completed.
|
|
787
|
+
let mergeIndex = 0;
|
|
788
|
+
|
|
789
|
+
for ( let i = 1; i < updateRanges.length; i ++ ) {
|
|
790
|
+
|
|
791
|
+
const previousRange = updateRanges[ mergeIndex ];
|
|
792
|
+
const range = updateRanges[ i ];
|
|
793
|
+
|
|
794
|
+
// Only merge if in the same row and overlapping/adjacent
|
|
795
|
+
const previousEnd = previousRange.start + previousRange.count;
|
|
796
|
+
const currentRow = getRow( range.start, image.width, componentStride );
|
|
797
|
+
const previousRow = getRow( previousRange.start, image.width, componentStride );
|
|
798
|
+
|
|
799
|
+
// We add one here to merge adjacent ranges. This is safe because ranges
|
|
800
|
+
// operate over positive integers.
|
|
801
|
+
if (
|
|
802
|
+
range.start <= previousEnd + 1 &&
|
|
803
|
+
currentRow === previousRow &&
|
|
804
|
+
getRow( range.start + range.count - 1, image.width, componentStride ) === currentRow // ensure range doesn't spill
|
|
805
|
+
) {
|
|
806
|
+
|
|
807
|
+
previousRange.count = Math.max(
|
|
808
|
+
previousRange.count,
|
|
809
|
+
range.start + range.count - previousRange.start
|
|
810
|
+
);
|
|
811
|
+
|
|
812
|
+
} else {
|
|
813
|
+
|
|
814
|
+
++ mergeIndex;
|
|
815
|
+
updateRanges[ mergeIndex ] = range;
|
|
816
|
+
|
|
817
|
+
}
|
|
818
|
+
|
|
819
|
+
|
|
820
|
+
}
|
|
821
|
+
|
|
822
|
+
// Trim the array to only contain the merged ranges.
|
|
823
|
+
updateRanges.length = mergeIndex + 1;
|
|
824
|
+
|
|
825
|
+
const currentUnpackRowLen = _gl.getParameter( _gl.UNPACK_ROW_LENGTH );
|
|
826
|
+
const currentUnpackSkipPixels = _gl.getParameter( _gl.UNPACK_SKIP_PIXELS );
|
|
827
|
+
const currentUnpackSkipRows = _gl.getParameter( _gl.UNPACK_SKIP_ROWS );
|
|
828
|
+
|
|
829
|
+
_gl.pixelStorei( _gl.UNPACK_ROW_LENGTH, image.width );
|
|
830
|
+
|
|
831
|
+
for ( let i = 0, l = updateRanges.length; i < l; i ++ ) {
|
|
832
|
+
|
|
833
|
+
const range = updateRanges[ i ];
|
|
834
|
+
|
|
835
|
+
const pixelStart = Math.floor( range.start / componentStride );
|
|
836
|
+
const pixelCount = Math.ceil( range.count / componentStride );
|
|
837
|
+
|
|
838
|
+
const x = pixelStart % image.width;
|
|
839
|
+
const y = Math.floor( pixelStart / image.width );
|
|
840
|
+
|
|
841
|
+
// Assumes update ranges refer to contiguous memory
|
|
842
|
+
const width = pixelCount;
|
|
843
|
+
const height = 1;
|
|
844
|
+
|
|
845
|
+
_gl.pixelStorei( _gl.UNPACK_SKIP_PIXELS, x );
|
|
846
|
+
_gl.pixelStorei( _gl.UNPACK_SKIP_ROWS, y );
|
|
847
|
+
|
|
848
|
+
state.texSubImage2D( _gl.TEXTURE_2D, 0, x, y, width, height, glFormat, glType, image.data );
|
|
849
|
+
|
|
850
|
+
}
|
|
851
|
+
|
|
852
|
+
texture.clearUpdateRanges();
|
|
853
|
+
|
|
854
|
+
_gl.pixelStorei( _gl.UNPACK_ROW_LENGTH, currentUnpackRowLen );
|
|
855
|
+
_gl.pixelStorei( _gl.UNPACK_SKIP_PIXELS, currentUnpackSkipPixels );
|
|
856
|
+
_gl.pixelStorei( _gl.UNPACK_SKIP_ROWS, currentUnpackSkipRows );
|
|
857
|
+
|
|
858
|
+
}
|
|
859
|
+
}
|
|
860
|
+
|
|
749
861
|
function setDeferTextureUploads( deferFlag ) {
|
|
750
862
|
|
|
751
863
|
_deferTextureUploads = deferFlag;
|
|
@@ -896,7 +1008,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
896
1008
|
|
|
897
1009
|
if ( dataReady ) {
|
|
898
1010
|
|
|
899
|
-
|
|
1011
|
+
updateTexture( texture, image, glFormat, glType );
|
|
900
1012
|
|
|
901
1013
|
}
|
|
902
1014
|
|
|
@@ -1795,7 +1907,17 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
1795
1907
|
|
|
1796
1908
|
if ( isCube ) throw new Error( 'target.depthTexture not supported in Cube render targets' );
|
|
1797
1909
|
|
|
1798
|
-
|
|
1910
|
+
const mipmaps = renderTarget.texture.mipmaps;
|
|
1911
|
+
|
|
1912
|
+
if ( mipmaps && mipmaps.length > 0 ) {
|
|
1913
|
+
|
|
1914
|
+
setupDepthTexture( renderTargetProperties.__webglFramebuffer[ 0 ], renderTarget );
|
|
1915
|
+
|
|
1916
|
+
} else {
|
|
1917
|
+
|
|
1918
|
+
setupDepthTexture( renderTargetProperties.__webglFramebuffer, renderTarget );
|
|
1919
|
+
|
|
1920
|
+
}
|
|
1799
1921
|
|
|
1800
1922
|
} else {
|
|
1801
1923
|
|
|
@@ -1826,7 +1948,17 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
1826
1948
|
|
|
1827
1949
|
} else {
|
|
1828
1950
|
|
|
1829
|
-
|
|
1951
|
+
const mipmaps = renderTarget.texture.mipmaps;
|
|
1952
|
+
|
|
1953
|
+
if ( mipmaps && mipmaps.length > 0 ) {
|
|
1954
|
+
|
|
1955
|
+
state.bindFramebuffer( _gl.FRAMEBUFFER, renderTargetProperties.__webglFramebuffer[ 0 ] );
|
|
1956
|
+
|
|
1957
|
+
} else {
|
|
1958
|
+
|
|
1959
|
+
state.bindFramebuffer( _gl.FRAMEBUFFER, renderTargetProperties.__webglFramebuffer );
|
|
1960
|
+
|
|
1961
|
+
}
|
|
1830
1962
|
|
|
1831
1963
|
if ( renderTargetProperties.__webglDepthbuffer === undefined ) {
|
|
1832
1964
|
|
|
@@ -2039,13 +2171,21 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
2039
2171
|
const attachment = textures[ i ];
|
|
2040
2172
|
const attachmentProperties = properties.get( attachment );
|
|
2041
2173
|
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2174
|
+
let glTextureType = _gl.TEXTURE_2D;
|
|
2175
|
+
|
|
2176
|
+
if ( renderTarget.isWebGL3DRenderTarget || renderTarget.isWebGLArrayRenderTarget ) {
|
|
2177
|
+
|
|
2178
|
+
glTextureType = renderTarget.isWebGL3DRenderTarget ? _gl.TEXTURE_3D : _gl.TEXTURE_2D_ARRAY;
|
|
2179
|
+
|
|
2180
|
+
}
|
|
2181
|
+
|
|
2182
|
+
state.bindTexture( glTextureType, attachmentProperties.__webglTexture );
|
|
2183
|
+
setTextureParameters( glTextureType, attachment );
|
|
2184
|
+
setupFrameBufferTexture( renderTargetProperties.__webglFramebuffer, renderTarget, attachment, _gl.COLOR_ATTACHMENT0 + i, glTextureType, 0 );
|
|
2045
2185
|
|
|
2046
2186
|
if ( textureNeedsGenerateMipmaps( attachment ) ) {
|
|
2047
2187
|
|
|
2048
|
-
generateMipmap(
|
|
2188
|
+
generateMipmap( glTextureType );
|
|
2049
2189
|
|
|
2050
2190
|
}
|
|
2051
2191
|
|
|
@@ -2162,7 +2302,18 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
2162
2302
|
}
|
|
2163
2303
|
|
|
2164
2304
|
state.bindFramebuffer( _gl.READ_FRAMEBUFFER, renderTargetProperties.__webglMultisampledFramebuffer );
|
|
2165
|
-
|
|
2305
|
+
|
|
2306
|
+
const mipmaps = renderTarget.texture.mipmaps;
|
|
2307
|
+
|
|
2308
|
+
if ( mipmaps && mipmaps.length > 0 ) {
|
|
2309
|
+
|
|
2310
|
+
state.bindFramebuffer( _gl.DRAW_FRAMEBUFFER, renderTargetProperties.__webglFramebuffer[ 0 ] );
|
|
2311
|
+
|
|
2312
|
+
} else {
|
|
2313
|
+
|
|
2314
|
+
state.bindFramebuffer( _gl.DRAW_FRAMEBUFFER, renderTargetProperties.__webglFramebuffer );
|
|
2315
|
+
|
|
2316
|
+
}
|
|
2166
2317
|
|
|
2167
2318
|
for ( let i = 0; i < textures.length; i ++ ) {
|
|
2168
2319
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RGBA_ASTC_4x4_Format, RGBA_ASTC_5x4_Format, RGBA_ASTC_5x5_Format, RGBA_ASTC_6x5_Format, RGBA_ASTC_6x6_Format, RGBA_ASTC_8x5_Format, RGBA_ASTC_8x6_Format, RGBA_ASTC_8x8_Format, RGBA_ASTC_10x5_Format, RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_10x10_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, RGB_ETC1_Format, RGB_ETC2_Format, RGBA_ETC2_EAC_Format, RGBA_PVRTC_2BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGB_PVRTC_2BPPV1_Format, RGB_PVRTC_4BPPV1_Format, RGBA_S3TC_DXT5_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT1_Format, RGB_S3TC_DXT1_Format, DepthFormat, DepthStencilFormat,
|
|
1
|
+
import { RGBA_ASTC_4x4_Format, RGBA_ASTC_5x4_Format, RGBA_ASTC_5x5_Format, RGBA_ASTC_6x5_Format, RGBA_ASTC_6x6_Format, RGBA_ASTC_8x5_Format, RGBA_ASTC_8x6_Format, RGBA_ASTC_8x8_Format, RGBA_ASTC_10x5_Format, RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_10x10_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, RGB_ETC1_Format, RGB_ETC2_Format, RGBA_ETC2_EAC_Format, RGBA_PVRTC_2BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGB_PVRTC_2BPPV1_Format, RGB_PVRTC_4BPPV1_Format, RGBA_S3TC_DXT5_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT1_Format, RGB_S3TC_DXT1_Format, DepthFormat, DepthStencilFormat, RedFormat, RGBAFormat, AlphaFormat, RedIntegerFormat, RGFormat, RGIntegerFormat, RGBAIntegerFormat, HalfFloatType, FloatType, UnsignedIntType, IntType, UnsignedShortType, ShortType, ByteType, UnsignedInt248Type, UnsignedShort5551Type, UnsignedShort4444Type, UnsignedByteType, RGBA_BPTC_Format, RGB_BPTC_SIGNED_Format, RGB_BPTC_UNSIGNED_Format, RED_RGTC1_Format, SIGNED_RED_RGTC1_Format, RED_GREEN_RGTC2_Format, SIGNED_RED_GREEN_RGTC2_Format, NoColorSpace, SRGBTransfer, UnsignedInt5999Type, RGBFormat } from '../../constants.js';
|
|
2
2
|
import { ColorManagement } from '../../math/ColorManagement.js';
|
|
3
3
|
|
|
4
4
|
function WebGLUtils( gl, extensions ) {
|
|
@@ -25,8 +25,6 @@ function WebGLUtils( gl, extensions ) {
|
|
|
25
25
|
if ( p === AlphaFormat ) return gl.ALPHA;
|
|
26
26
|
if ( p === RGBFormat ) return gl.RGB;
|
|
27
27
|
if ( p === RGBAFormat ) return gl.RGBA;
|
|
28
|
-
if ( p === LuminanceFormat ) return gl.LUMINANCE;
|
|
29
|
-
if ( p === LuminanceAlphaFormat ) return gl.LUMINANCE_ALPHA;
|
|
30
28
|
if ( p === DepthFormat ) return gl.DEPTH_COMPONENT;
|
|
31
29
|
if ( p === DepthStencilFormat ) return gl.DEPTH_STENCIL;
|
|
32
30
|
|