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
package/build/three.module.js
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
* Copyright 2010-2025 Three.js Authors
|
|
4
4
|
* SPDX-License-Identifier: MIT
|
|
5
5
|
*/
|
|
6
|
-
import { Color, Matrix3, Vector2, mergeUniforms, Vector3, CubeUVReflectionMapping, Mesh, BoxGeometry, ShaderMaterial, cloneUniforms, BackSide, ColorManagement, SRGBTransfer, PlaneGeometry, FrontSide, getUnlitUniformColorSpace, Euler, Matrix4, IntType, RGBAFormat, HalfFloatType, UnsignedByteType, FloatType, Plane, EquirectangularReflectionMapping, EquirectangularRefractionMapping, WebGLCubeRenderTarget, CubeReflectionMapping, CubeRefractionMapping, PerspectiveCamera, NoToneMapping, MeshBasicMaterial, BufferGeometry, BufferAttribute, WebGLRenderTarget, NoBlending, OrthographicCamera, LinearFilter, LinearSRGBColorSpace, warnOnce, arrayNeedsUint32, Uint32BufferAttribute, Uint16BufferAttribute, Vector4, DataArrayTexture, LessEqualCompare, Texture, DepthTexture, Data3DTexture, CubeTexture, GLSL3, CustomToneMapping, NeutralToneMapping, AgXToneMapping, ACESFilmicToneMapping, CineonToneMapping, ReinhardToneMapping, LinearToneMapping, PCFShadowMap, PCFSoftShadowMap, VSMShadowMap, LinearTransfer, AddOperation, MixOperation, MultiplyOperation, ObjectSpaceNormalMap, TangentSpaceNormalMap, NormalBlending, DoubleSide, UniformsUtils, Layers, Frustum, MeshDepthMaterial, RGBADepthPacking, MeshDistanceMaterial, NearestFilter, LessEqualDepth, AddEquation, SubtractEquation, ReverseSubtractEquation, ZeroFactor, OneFactor, SrcColorFactor, SrcAlphaFactor, SrcAlphaSaturateFactor, DstColorFactor, DstAlphaFactor, OneMinusSrcColorFactor, OneMinusSrcAlphaFactor, OneMinusDstColorFactor, OneMinusDstAlphaFactor, ConstantColorFactor, OneMinusConstantColorFactor, ConstantAlphaFactor, OneMinusConstantAlphaFactor, CustomBlending, MultiplyBlending, SubtractiveBlending, AdditiveBlending, CullFaceNone, CullFaceBack, CullFaceFront, NotEqualDepth, GreaterDepth, GreaterEqualDepth, EqualDepth, LessDepth, AlwaysDepth, NeverDepth, MinEquation, MaxEquation, RepeatWrapping, ClampToEdgeWrapping, MirroredRepeatWrapping, NearestMipmapNearestFilter, NearestMipmapLinearFilter, LinearMipmapNearestFilter, LinearMipmapLinearFilter, NeverCompare, AlwaysCompare, LessCompare, EqualCompare, GreaterEqualCompare, GreaterCompare, NotEqualCompare, NoColorSpace, DepthStencilFormat, getByteLength, DepthFormat, UnsignedIntType, UnsignedInt248Type, UnsignedShortType, createElementNS, UnsignedShort4444Type, UnsignedShort5551Type, UnsignedInt5999Type, ByteType, ShortType, AlphaFormat, RGBFormat,
|
|
7
|
-
export { AdditiveAnimationBlendMode, AlwaysStencilFunc, AmbientLight, AnimationAction, AnimationClip, AnimationLoader, AnimationMixer, AnimationObjectGroup, AnimationUtils, ArcCurve, ArrowHelper, AttachedBindMode, Audio, AudioAnalyser, AudioContext, AudioListener, AudioLoader, AxesHelper, BasicDepthPacking, BasicShadowMap, BatchedMesh, Bone, BooleanKeyframeTrack, Box2, Box3, Box3Helper, BoxHelper, BufferGeometryLoader, Cache, Camera, CameraHelper, CanvasTexture, CapsuleGeometry, CatmullRomCurve3, CircleGeometry, Clock, ColorKeyframeTrack, CompressedArrayTexture, CompressedCubeTexture, CompressedTexture, CompressedTextureLoader, ConeGeometry, Controls, CubeCamera, CubeTextureLoader, CubicBezierCurve, CubicBezierCurve3, CubicInterpolant, CullFaceFrontBack, Curve, CurvePath, CylinderGeometry, Cylindrical, DataTexture, DataTextureLoader, DataUtils, DecrementStencilOp, DecrementWrapStencilOp, DefaultLoadingManager, DetachedBindMode, DirectionalLight, DirectionalLightHelper, DiscreteInterpolant, DodecahedronGeometry, DynamicCopyUsage, DynamicDrawUsage, DynamicReadUsage, EdgesGeometry, EllipseCurve, EqualStencilFunc, ExtrudeGeometry, FileLoader, Float16BufferAttribute, Float32BufferAttribute, Fog, FogExp2, FramebufferTexture, GLBufferAttribute, GLSL1, GreaterEqualStencilFunc, GreaterStencilFunc, GridHelper, Group, HemisphereLight, HemisphereLightHelper, IcosahedronGeometry, ImageBitmapLoader, ImageLoader, ImageUtils, IncrementStencilOp, IncrementWrapStencilOp, InstancedBufferAttribute, InstancedBufferGeometry, InstancedInterleavedBuffer, InstancedMesh, Int16BufferAttribute, Int32BufferAttribute, Int8BufferAttribute, InterleavedBuffer, InterleavedBufferAttribute, Interpolant, InterpolateDiscrete, InterpolateLinear, InterpolateSmooth, InvertStencilOp, KeepStencilOp, KeyframeTrack, LOD, LatheGeometry, LessEqualStencilFunc, LessStencilFunc, Light, LightProbe, Line, Line3, LineBasicMaterial, LineCurve, LineCurve3, LineDashedMaterial, LineLoop, LineSegments, LinearInterpolant, LinearMipMapLinearFilter, LinearMipMapNearestFilter, Loader, LoaderUtils, LoadingManager, LoopOnce, LoopPingPong, LoopRepeat, MOUSE, Material, MaterialLoader, MathUtils, Matrix2, MeshLambertMaterial, MeshMatcapMaterial, MeshNormalMaterial, MeshPhongMaterial, MeshPhysicalMaterial, MeshStandardMaterial, MeshToonMaterial, NearestMipMapLinearFilter, NearestMipMapNearestFilter, NeverStencilFunc, NormalAnimationBlendMode, NotEqualStencilFunc, NumberKeyframeTrack, Object3D, ObjectLoader, OctahedronGeometry, Path, PlaneHelper, PointLight, PointLightHelper, Points, PointsMaterial, PolarGridHelper, PolyhedronGeometry, PositionalAudio, PropertyBinding, PropertyMixer, QuadraticBezierCurve, QuadraticBezierCurve3, Quaternion, QuaternionKeyframeTrack, QuaternionLinearInterpolant, RGBDepthPacking, RGBIntegerFormat, RGDepthPacking, RawShaderMaterial, Ray, Raycaster, RectAreaLight, RenderTarget, RenderTarget3D,
|
|
6
|
+
import { Color, Matrix3, Vector2, mergeUniforms, Vector3, CubeUVReflectionMapping, Mesh, BoxGeometry, ShaderMaterial, cloneUniforms, BackSide, ColorManagement, SRGBTransfer, PlaneGeometry, FrontSide, getUnlitUniformColorSpace, Euler, Matrix4, IntType, RGBAFormat, HalfFloatType, UnsignedByteType, FloatType, Plane, EquirectangularReflectionMapping, EquirectangularRefractionMapping, WebGLCubeRenderTarget, CubeReflectionMapping, CubeRefractionMapping, PerspectiveCamera, NoToneMapping, MeshBasicMaterial, BufferGeometry, BufferAttribute, WebGLRenderTarget, NoBlending, OrthographicCamera, LinearFilter, LinearSRGBColorSpace, warnOnce, arrayNeedsUint32, Uint32BufferAttribute, Uint16BufferAttribute, Vector4, DataArrayTexture, LessEqualCompare, Texture, DepthTexture, Data3DTexture, CubeTexture, GLSL3, CustomToneMapping, NeutralToneMapping, AgXToneMapping, ACESFilmicToneMapping, CineonToneMapping, ReinhardToneMapping, LinearToneMapping, PCFShadowMap, PCFSoftShadowMap, VSMShadowMap, LinearTransfer, AddOperation, MixOperation, MultiplyOperation, ObjectSpaceNormalMap, TangentSpaceNormalMap, NormalBlending, DoubleSide, UniformsUtils, Layers, Frustum, MeshDepthMaterial, RGBADepthPacking, MeshDistanceMaterial, NearestFilter, LessEqualDepth, AddEquation, SubtractEquation, ReverseSubtractEquation, ZeroFactor, OneFactor, SrcColorFactor, SrcAlphaFactor, SrcAlphaSaturateFactor, DstColorFactor, DstAlphaFactor, OneMinusSrcColorFactor, OneMinusSrcAlphaFactor, OneMinusDstColorFactor, OneMinusDstAlphaFactor, ConstantColorFactor, OneMinusConstantColorFactor, ConstantAlphaFactor, OneMinusConstantAlphaFactor, CustomBlending, MultiplyBlending, SubtractiveBlending, AdditiveBlending, CullFaceNone, CullFaceBack, CullFaceFront, NotEqualDepth, GreaterDepth, GreaterEqualDepth, EqualDepth, LessDepth, AlwaysDepth, NeverDepth, MinEquation, MaxEquation, RepeatWrapping, ClampToEdgeWrapping, MirroredRepeatWrapping, NearestMipmapNearestFilter, NearestMipmapLinearFilter, LinearMipmapNearestFilter, LinearMipmapLinearFilter, NeverCompare, AlwaysCompare, LessCompare, EqualCompare, GreaterEqualCompare, GreaterCompare, NotEqualCompare, NoColorSpace, DepthStencilFormat, getByteLength, DepthFormat, UnsignedIntType, UnsignedInt248Type, UnsignedShortType, createElementNS, UnsignedShort4444Type, UnsignedShort5551Type, UnsignedInt5999Type, ByteType, ShortType, AlphaFormat, RGBFormat, RedFormat, RedIntegerFormat, RGFormat, RGIntegerFormat, RGBAIntegerFormat, RGB_S3TC_DXT1_Format, RGBA_S3TC_DXT1_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT5_Format, RGB_PVRTC_4BPPV1_Format, RGB_PVRTC_2BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGBA_PVRTC_2BPPV1_Format, RGB_ETC1_Format, RGB_ETC2_Format, RGBA_ETC2_EAC_Format, 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, 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, EventDispatcher, ArrayCamera, WebXRController, RAD2DEG, createCanvasElement, SRGBColorSpace, REVISION, WebGLCoordinateSystem, probeAsync } from './three.core.js';
|
|
7
|
+
export { AdditiveAnimationBlendMode, AlwaysStencilFunc, AmbientLight, AnimationAction, AnimationClip, AnimationLoader, AnimationMixer, AnimationObjectGroup, AnimationUtils, ArcCurve, ArrowHelper, AttachedBindMode, Audio, AudioAnalyser, AudioContext, AudioListener, AudioLoader, AxesHelper, BasicDepthPacking, BasicShadowMap, BatchedMesh, Bone, BooleanKeyframeTrack, Box2, Box3, Box3Helper, BoxHelper, BufferGeometryLoader, Cache, Camera, CameraHelper, CanvasTexture, CapsuleGeometry, CatmullRomCurve3, CircleGeometry, Clock, ColorKeyframeTrack, CompressedArrayTexture, CompressedCubeTexture, CompressedTexture, CompressedTextureLoader, ConeGeometry, Controls, CubeCamera, CubeTextureLoader, CubicBezierCurve, CubicBezierCurve3, CubicInterpolant, CullFaceFrontBack, Curve, CurvePath, CylinderGeometry, Cylindrical, DataTexture, DataTextureLoader, DataUtils, DecrementStencilOp, DecrementWrapStencilOp, DefaultLoadingManager, DetachedBindMode, DirectionalLight, DirectionalLightHelper, DiscreteInterpolant, DodecahedronGeometry, DynamicCopyUsage, DynamicDrawUsage, DynamicReadUsage, EdgesGeometry, EllipseCurve, EqualStencilFunc, ExtrudeGeometry, FileLoader, Float16BufferAttribute, Float32BufferAttribute, Fog, FogExp2, FramebufferTexture, FrustumArray, GLBufferAttribute, GLSL1, GreaterEqualStencilFunc, GreaterStencilFunc, GridHelper, Group, HemisphereLight, HemisphereLightHelper, IcosahedronGeometry, ImageBitmapLoader, ImageLoader, ImageUtils, IncrementStencilOp, IncrementWrapStencilOp, InstancedBufferAttribute, InstancedBufferGeometry, InstancedInterleavedBuffer, InstancedMesh, Int16BufferAttribute, Int32BufferAttribute, Int8BufferAttribute, InterleavedBuffer, InterleavedBufferAttribute, Interpolant, InterpolateDiscrete, InterpolateLinear, InterpolateSmooth, InterpolationSamplingMode, InterpolationSamplingType, InvertStencilOp, KeepStencilOp, KeyframeTrack, LOD, LatheGeometry, LessEqualStencilFunc, LessStencilFunc, Light, LightProbe, Line, Line3, LineBasicMaterial, LineCurve, LineCurve3, LineDashedMaterial, LineLoop, LineSegments, LinearInterpolant, LinearMipMapLinearFilter, LinearMipMapNearestFilter, Loader, LoaderUtils, LoadingManager, LoopOnce, LoopPingPong, LoopRepeat, MOUSE, Material, MaterialLoader, MathUtils, Matrix2, MeshLambertMaterial, MeshMatcapMaterial, MeshNormalMaterial, MeshPhongMaterial, MeshPhysicalMaterial, MeshStandardMaterial, MeshToonMaterial, NearestMipMapLinearFilter, NearestMipMapNearestFilter, NeverStencilFunc, NormalAnimationBlendMode, NotEqualStencilFunc, NumberKeyframeTrack, Object3D, ObjectLoader, OctahedronGeometry, Path, PlaneHelper, PointLight, PointLightHelper, Points, PointsMaterial, PolarGridHelper, PolyhedronGeometry, PositionalAudio, PropertyBinding, PropertyMixer, QuadraticBezierCurve, QuadraticBezierCurve3, Quaternion, QuaternionKeyframeTrack, QuaternionLinearInterpolant, RGBDepthPacking, RGBIntegerFormat, RGDepthPacking, RawShaderMaterial, Ray, Raycaster, RectAreaLight, RenderTarget, RenderTarget3D, ReplaceStencilOp, RingGeometry, Scene, ShadowMaterial, Shape, ShapeGeometry, ShapePath, ShapeUtils, Skeleton, SkeletonHelper, SkinnedMesh, Source, Sphere, SphereGeometry, Spherical, SphericalHarmonics3, SplineCurve, SpotLight, SpotLightHelper, Sprite, SpriteMaterial, StaticCopyUsage, StaticDrawUsage, StaticReadUsage, StereoCamera, StreamCopyUsage, StreamDrawUsage, StreamReadUsage, StringKeyframeTrack, TOUCH, TetrahedronGeometry, TextureLoader, TextureUtils, Timer, TimestampQuery, TorusGeometry, TorusKnotGeometry, Triangle, TriangleFanDrawMode, TriangleStripDrawMode, TrianglesDrawMode, TubeGeometry, UVMapping, Uint8BufferAttribute, Uint8ClampedBufferAttribute, Uniform, UniformsGroup, VectorKeyframeTrack, VideoFrameTexture, VideoTexture, WebGL3DRenderTarget, WebGLArrayRenderTarget, WebGPUCoordinateSystem, WireframeGeometry, WrapAroundEnding, ZeroCurvatureEnding, ZeroSlopeEnding, ZeroStencilOp } from './three.core.js';
|
|
8
8
|
|
|
9
9
|
function WebGLAnimation() {
|
|
10
10
|
|
|
@@ -81,6 +81,10 @@ function WebGLAttributes( gl ) {
|
|
|
81
81
|
|
|
82
82
|
type = gl.FLOAT;
|
|
83
83
|
|
|
84
|
+
} else if ( typeof Float16Array !== 'undefined' && array instanceof Float16Array ) {
|
|
85
|
+
|
|
86
|
+
type = gl.HALF_FLOAT;
|
|
87
|
+
|
|
84
88
|
} else if ( array instanceof Uint16Array ) {
|
|
85
89
|
|
|
86
90
|
if ( attribute.isFloat16BufferAttribute ) {
|
|
@@ -467,7 +471,7 @@ var roughnessmap_fragment = "float roughnessFactor = roughness;\n#ifdef USE_ROUG
|
|
|
467
471
|
|
|
468
472
|
var roughnessmap_pars_fragment = "#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif";
|
|
469
473
|
|
|
470
|
-
var shadowmap_pars_fragment = "#if NUM_SPOT_LIGHT_COORDS > 0\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n\tuniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\
|
|
474
|
+
var shadowmap_pars_fragment = "#if NUM_SPOT_LIGHT_COORDS > 0\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n\tuniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\tfloat depth = unpackRGBAToDepth( texture2D( depths, uv ) );\n\t\t#ifdef USE_REVERSEDEPTHBUF\n\t\t\treturn step( depth, compare );\n\t\t#else\n\t\t\treturn step( compare, depth );\n\t\t#endif\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\t#ifdef USE_REVERSEDEPTHBUF\n\t\t\tfloat hard_shadow = step( distribution.x, compare );\n\t\t#else\n\t\t\tfloat hard_shadow = step( compare , distribution.x );\n\t\t#endif\n\t\tif (hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n\t\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn mix( 1.0, shadow, shadowIntensity );\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tfloat shadow = 1.0;\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\t\n\t\tfloat lightToPositionLength = length( lightToPosition );\n\t\tif ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) {\n\t\t\tfloat dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\t\tdp += shadowBias;\n\t\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\t\tshadow = (\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t\t) * ( 1.0 / 9.0 );\n\t\t\t#else\n\t\t\t\tshadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t\t#endif\n\t\t}\n\t\treturn mix( 1.0, shadow, shadowIntensity );\n\t}\n#endif";
|
|
471
475
|
|
|
472
476
|
var shadowmap_pars_vertex = "#if NUM_SPOT_LIGHT_COORDS > 0\n\tuniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif";
|
|
473
477
|
|
|
@@ -517,7 +521,7 @@ const fragment$f = "uniform samplerCube tCube;\nuniform float tFlip;\nuniform fl
|
|
|
517
521
|
|
|
518
522
|
const vertex$e = "#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <skinbase_vertex>\n\t#include <morphinstance_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvHighPrecisionZW = gl_Position.zw;\n}";
|
|
519
523
|
|
|
520
|
-
const fragment$e = "#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <clipping_planes_fragment>\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <logdepthbuf_fragment>\n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#elif DEPTH_PACKING == 3202\n\t\tgl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );\n\t#elif DEPTH_PACKING == 3203\n\t\tgl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );\n\t#endif\n}";
|
|
524
|
+
const fragment$e = "#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <clipping_planes_fragment>\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <logdepthbuf_fragment>\n\t#ifdef USE_REVERSEDEPTHBUF\n\t\tfloat fragCoordZ = vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ];\n\t#else\n\t\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ] + 0.5;\n\t#endif\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#elif DEPTH_PACKING == 3202\n\t\tgl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );\n\t#elif DEPTH_PACKING == 3203\n\t\tgl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );\n\t#endif\n}";
|
|
521
525
|
|
|
522
526
|
const vertex$d = "#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <skinbase_vertex>\n\t#include <morphinstance_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition.xyz;\n}";
|
|
523
527
|
|
|
@@ -2351,7 +2355,7 @@ function WebGLCapabilities( gl, extensions, parameters, utils ) {
|
|
|
2351
2355
|
}
|
|
2352
2356
|
|
|
2353
2357
|
const logarithmicDepthBuffer = parameters.logarithmicDepthBuffer === true;
|
|
2354
|
-
const
|
|
2358
|
+
const reversedDepthBuffer = parameters.reversedDepthBuffer === true && extensions.has( 'EXT_clip_control' );
|
|
2355
2359
|
|
|
2356
2360
|
const maxTextures = gl.getParameter( gl.MAX_TEXTURE_IMAGE_UNITS );
|
|
2357
2361
|
const maxVertexTextures = gl.getParameter( gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS );
|
|
@@ -2379,7 +2383,7 @@ function WebGLCapabilities( gl, extensions, parameters, utils ) {
|
|
|
2379
2383
|
|
|
2380
2384
|
precision: precision,
|
|
2381
2385
|
logarithmicDepthBuffer: logarithmicDepthBuffer,
|
|
2382
|
-
|
|
2386
|
+
reversedDepthBuffer: reversedDepthBuffer,
|
|
2383
2387
|
|
|
2384
2388
|
maxTextures: maxTextures,
|
|
2385
2389
|
maxVertexTextures: maxVertexTextures,
|
|
@@ -2984,6 +2988,17 @@ class PMREMGenerator {
|
|
|
2984
2988
|
renderer.toneMapping = NoToneMapping;
|
|
2985
2989
|
renderer.autoClear = false;
|
|
2986
2990
|
|
|
2991
|
+
// https://github.com/mrdoob/three.js/issues/31413#issuecomment-3095966812
|
|
2992
|
+
const reversedDepthBuffer = renderer.state.buffers.depth.getReversed();
|
|
2993
|
+
|
|
2994
|
+
if ( reversedDepthBuffer ) {
|
|
2995
|
+
|
|
2996
|
+
renderer.setRenderTarget( cubeUVRenderTarget );
|
|
2997
|
+
renderer.clearDepth();
|
|
2998
|
+
renderer.setRenderTarget( null );
|
|
2999
|
+
|
|
3000
|
+
}
|
|
3001
|
+
|
|
2987
3002
|
const backgroundMaterial = new MeshBasicMaterial( {
|
|
2988
3003
|
name: 'PMREM.Background',
|
|
2989
3004
|
side: BackSide,
|
|
@@ -5712,7 +5727,9 @@ function getEncodingComponents( colorSpace ) {
|
|
|
5712
5727
|
function getShaderErrors( gl, shader, type ) {
|
|
5713
5728
|
|
|
5714
5729
|
const status = gl.getShaderParameter( shader, gl.COMPILE_STATUS );
|
|
5715
|
-
|
|
5730
|
+
|
|
5731
|
+
const shaderInfoLog = gl.getShaderInfoLog( shader ) || '';
|
|
5732
|
+
const errors = shaderInfoLog.trim();
|
|
5716
5733
|
|
|
5717
5734
|
if ( status && errors === '' ) return '';
|
|
5718
5735
|
|
|
@@ -6309,7 +6326,7 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
|
|
|
6309
6326
|
parameters.numLightProbes > 0 ? '#define USE_LIGHT_PROBES' : '',
|
|
6310
6327
|
|
|
6311
6328
|
parameters.logarithmicDepthBuffer ? '#define USE_LOGDEPTHBUF' : '',
|
|
6312
|
-
parameters.
|
|
6329
|
+
parameters.reversedDepthBuffer ? '#define USE_REVERSEDEPTHBUF' : '',
|
|
6313
6330
|
|
|
6314
6331
|
'uniform mat4 modelMatrix;',
|
|
6315
6332
|
'uniform mat4 modelViewMatrix;',
|
|
@@ -6476,7 +6493,7 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
|
|
|
6476
6493
|
parameters.decodeVideoTextureEmissive ? '#define DECODE_VIDEO_TEXTURE_EMISSIVE' : '',
|
|
6477
6494
|
|
|
6478
6495
|
parameters.logarithmicDepthBuffer ? '#define USE_LOGDEPTHBUF' : '',
|
|
6479
|
-
parameters.
|
|
6496
|
+
parameters.reversedDepthBuffer ? '#define USE_REVERSEDEPTHBUF' : '',
|
|
6480
6497
|
|
|
6481
6498
|
'uniform mat4 viewMatrix;',
|
|
6482
6499
|
'uniform vec3 cameraPosition;',
|
|
@@ -6622,9 +6639,13 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
|
|
|
6622
6639
|
// check for link errors
|
|
6623
6640
|
if ( renderer.debug.checkShaderErrors ) {
|
|
6624
6641
|
|
|
6625
|
-
const
|
|
6626
|
-
const
|
|
6627
|
-
const
|
|
6642
|
+
const programInfoLog = gl.getProgramInfoLog( program ) || '';
|
|
6643
|
+
const vertexShaderInfoLog = gl.getShaderInfoLog( glVertexShader ) || '';
|
|
6644
|
+
const fragmentShaderInfoLog = gl.getShaderInfoLog( glFragmentShader ) || '';
|
|
6645
|
+
|
|
6646
|
+
const programLog = programInfoLog.trim();
|
|
6647
|
+
const vertexLog = vertexShaderInfoLog.trim();
|
|
6648
|
+
const fragmentLog = fragmentShaderInfoLog.trim();
|
|
6628
6649
|
|
|
6629
6650
|
let runnable = true;
|
|
6630
6651
|
let haveDiagnostics = true;
|
|
@@ -7011,7 +7032,7 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
|
|
|
7011
7032
|
}
|
|
7012
7033
|
|
|
7013
7034
|
const currentRenderTarget = renderer.getRenderTarget();
|
|
7014
|
-
const
|
|
7035
|
+
const reversedDepthBuffer = renderer.state.buffers.depth.getReversed();
|
|
7015
7036
|
|
|
7016
7037
|
const numMultiviewViews = currentRenderTarget && currentRenderTarget.isWebGLMultiviewRenderTarget ? currentRenderTarget.numViews : 0;
|
|
7017
7038
|
|
|
@@ -7208,11 +7229,11 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
|
|
|
7208
7229
|
useFog: material.fog === true,
|
|
7209
7230
|
fogExp2: ( !! fog && fog.isFogExp2 ),
|
|
7210
7231
|
|
|
7211
|
-
flatShading: material.flatShading === true,
|
|
7232
|
+
flatShading: ( material.flatShading === true && material.wireframe === false ),
|
|
7212
7233
|
|
|
7213
7234
|
sizeAttenuation: material.sizeAttenuation === true,
|
|
7214
7235
|
logarithmicDepthBuffer: logarithmicDepthBuffer,
|
|
7215
|
-
|
|
7236
|
+
reversedDepthBuffer: reversedDepthBuffer,
|
|
7216
7237
|
|
|
7217
7238
|
skinning: object.isSkinnedMesh === true,
|
|
7218
7239
|
|
|
@@ -7421,6 +7442,8 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
|
|
|
7421
7442
|
_programLayers.enable( 20 );
|
|
7422
7443
|
if ( parameters.batchingColor )
|
|
7423
7444
|
_programLayers.enable( 21 );
|
|
7445
|
+
if ( parameters.gradientMap )
|
|
7446
|
+
_programLayers.enable( 22 );
|
|
7424
7447
|
|
|
7425
7448
|
array.push( _programLayers.mask );
|
|
7426
7449
|
_programLayers.disableAll();
|
|
@@ -7433,7 +7456,7 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
|
|
|
7433
7456
|
_programLayers.enable( 2 );
|
|
7434
7457
|
if ( parameters.logarithmicDepthBuffer )
|
|
7435
7458
|
_programLayers.enable( 3 );
|
|
7436
|
-
if ( parameters.
|
|
7459
|
+
if ( parameters.reversedDepthBuffer )
|
|
7437
7460
|
_programLayers.enable( 4 );
|
|
7438
7461
|
if ( parameters.skinning )
|
|
7439
7462
|
_programLayers.enable( 5 );
|
|
@@ -8602,7 +8625,17 @@ function WebGLShadowMap( renderer, objects, capabilities ) {
|
|
|
8602
8625
|
|
|
8603
8626
|
// Set GL state for depth map.
|
|
8604
8627
|
_state.setBlending( NoBlending );
|
|
8605
|
-
|
|
8628
|
+
|
|
8629
|
+
if ( _state.buffers.depth.getReversed() ) {
|
|
8630
|
+
|
|
8631
|
+
_state.buffers.color.setClear( 0, 0, 0, 0 );
|
|
8632
|
+
|
|
8633
|
+
} else {
|
|
8634
|
+
|
|
8635
|
+
_state.buffers.color.setClear( 1, 1, 1, 1 );
|
|
8636
|
+
|
|
8637
|
+
}
|
|
8638
|
+
|
|
8606
8639
|
_state.buffers.depth.setTest( true );
|
|
8607
8640
|
_state.setScissorTest( false );
|
|
8608
8641
|
|
|
@@ -8775,7 +8808,8 @@ function WebGLShadowMap( renderer, objects, capabilities ) {
|
|
|
8775
8808
|
if ( ( renderer.localClippingEnabled && material.clipShadows === true && Array.isArray( material.clippingPlanes ) && material.clippingPlanes.length !== 0 ) ||
|
|
8776
8809
|
( material.displacementMap && material.displacementScale !== 0 ) ||
|
|
8777
8810
|
( material.alphaMap && material.alphaTest > 0 ) ||
|
|
8778
|
-
( material.map && material.alphaTest > 0 )
|
|
8811
|
+
( material.map && material.alphaTest > 0 ) ||
|
|
8812
|
+
( material.alphaToCoverage === true ) ) {
|
|
8779
8813
|
|
|
8780
8814
|
// in this case we need a unique material instance reflecting the
|
|
8781
8815
|
// appropriate state
|
|
@@ -8821,7 +8855,7 @@ function WebGLShadowMap( renderer, objects, capabilities ) {
|
|
|
8821
8855
|
}
|
|
8822
8856
|
|
|
8823
8857
|
result.alphaMap = material.alphaMap;
|
|
8824
|
-
result.alphaTest = material.alphaTest;
|
|
8858
|
+
result.alphaTest = ( material.alphaToCoverage === true ) ? 0.5 : material.alphaTest; // approximate alphaToCoverage by using a fixed alphaTest value
|
|
8825
8859
|
result.map = material.map;
|
|
8826
8860
|
|
|
8827
8861
|
result.clipShadows = material.clipShadows;
|
|
@@ -9603,7 +9637,7 @@ function WebGLState( gl, extensions ) {
|
|
|
9603
9637
|
break;
|
|
9604
9638
|
|
|
9605
9639
|
case MultiplyBlending:
|
|
9606
|
-
gl.blendFuncSeparate( gl.
|
|
9640
|
+
gl.blendFuncSeparate( gl.DST_COLOR, gl.ONE_MINUS_SRC_ALPHA, gl.ZERO, gl.ONE );
|
|
9607
9641
|
break;
|
|
9608
9642
|
|
|
9609
9643
|
default:
|
|
@@ -9621,15 +9655,15 @@ function WebGLState( gl, extensions ) {
|
|
|
9621
9655
|
break;
|
|
9622
9656
|
|
|
9623
9657
|
case AdditiveBlending:
|
|
9624
|
-
gl.
|
|
9658
|
+
gl.blendFuncSeparate( gl.SRC_ALPHA, gl.ONE, gl.ONE, gl.ONE );
|
|
9625
9659
|
break;
|
|
9626
9660
|
|
|
9627
9661
|
case SubtractiveBlending:
|
|
9628
|
-
|
|
9662
|
+
console.error( 'THREE.WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true' );
|
|
9629
9663
|
break;
|
|
9630
9664
|
|
|
9631
9665
|
case MultiplyBlending:
|
|
9632
|
-
|
|
9666
|
+
console.error( 'THREE.WebGLState: MultiplyBlending requires material.premultipliedAlpha = true' );
|
|
9633
9667
|
break;
|
|
9634
9668
|
|
|
9635
9669
|
default:
|
|
@@ -10779,7 +10813,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
10779
10813
|
|
|
10780
10814
|
if ( texture.isVideoTexture ) updateVideoTexture( texture );
|
|
10781
10815
|
|
|
10782
|
-
if ( texture.isRenderTargetTexture === false && texture.version > 0 && textureProperties.__version !== texture.version ) {
|
|
10816
|
+
if ( texture.isRenderTargetTexture === false && texture.isExternalTexture !== true && texture.version > 0 && textureProperties.__version !== texture.version ) {
|
|
10783
10817
|
|
|
10784
10818
|
const image = texture.image;
|
|
10785
10819
|
|
|
@@ -10801,6 +10835,10 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
10801
10835
|
|
|
10802
10836
|
}
|
|
10803
10837
|
|
|
10838
|
+
} else if ( texture.isExternalTexture ) {
|
|
10839
|
+
|
|
10840
|
+
textureProperties.__webglTexture = texture.sourceTexture ? texture.sourceTexture : null;
|
|
10841
|
+
|
|
10804
10842
|
}
|
|
10805
10843
|
|
|
10806
10844
|
state.bindTexture( _gl.TEXTURE_2D, textureProperties.__webglTexture, _gl.TEXTURE0 + slot );
|
|
@@ -10811,7 +10849,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
10811
10849
|
|
|
10812
10850
|
const textureProperties = properties.get( texture );
|
|
10813
10851
|
|
|
10814
|
-
if ( texture.version > 0 && textureProperties.__version !== texture.version ) {
|
|
10852
|
+
if ( texture.isRenderTargetTexture === false && texture.version > 0 && textureProperties.__version !== texture.version ) {
|
|
10815
10853
|
|
|
10816
10854
|
uploadTexture( textureProperties, texture, slot );
|
|
10817
10855
|
return;
|
|
@@ -10826,7 +10864,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
10826
10864
|
|
|
10827
10865
|
const textureProperties = properties.get( texture );
|
|
10828
10866
|
|
|
10829
|
-
if ( texture.version > 0 && textureProperties.__version !== texture.version ) {
|
|
10867
|
+
if ( texture.isRenderTargetTexture === false && texture.version > 0 && textureProperties.__version !== texture.version ) {
|
|
10830
10868
|
|
|
10831
10869
|
uploadTexture( textureProperties, texture, slot );
|
|
10832
10870
|
return;
|
|
@@ -11006,6 +11044,114 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
11006
11044
|
|
|
11007
11045
|
}
|
|
11008
11046
|
|
|
11047
|
+
function getRow( index, rowLength, componentStride ) {
|
|
11048
|
+
|
|
11049
|
+
return Math.floor( Math.floor( index / componentStride ) / rowLength );
|
|
11050
|
+
|
|
11051
|
+
}
|
|
11052
|
+
|
|
11053
|
+
function updateTexture( texture, image, glFormat, glType ) {
|
|
11054
|
+
|
|
11055
|
+
const componentStride = 4; // only RGBA supported
|
|
11056
|
+
|
|
11057
|
+
const updateRanges = texture.updateRanges;
|
|
11058
|
+
|
|
11059
|
+
if ( updateRanges.length === 0 ) {
|
|
11060
|
+
|
|
11061
|
+
state.texSubImage2D( _gl.TEXTURE_2D, 0, 0, 0, image.width, image.height, glFormat, glType, image.data );
|
|
11062
|
+
|
|
11063
|
+
} else {
|
|
11064
|
+
|
|
11065
|
+
// Before applying update ranges, we merge any adjacent / overlapping
|
|
11066
|
+
// ranges to reduce load on `gl.texSubImage2D`. Empirically, this has led
|
|
11067
|
+
// to performance improvements for applications which make heavy use of
|
|
11068
|
+
// update ranges. Likely due to GPU command overhead.
|
|
11069
|
+
//
|
|
11070
|
+
// Note that to reduce garbage collection between frames, we merge the
|
|
11071
|
+
// update ranges in-place. This is safe because this method will clear the
|
|
11072
|
+
// update ranges once updated.
|
|
11073
|
+
|
|
11074
|
+
updateRanges.sort( ( a, b ) => a.start - b.start );
|
|
11075
|
+
|
|
11076
|
+
// To merge the update ranges in-place, we work from left to right in the
|
|
11077
|
+
// existing updateRanges array, merging ranges. This may result in a final
|
|
11078
|
+
// array which is smaller than the original. This index tracks the last
|
|
11079
|
+
// index representing a merged range, any data after this index can be
|
|
11080
|
+
// trimmed once the merge algorithm is completed.
|
|
11081
|
+
let mergeIndex = 0;
|
|
11082
|
+
|
|
11083
|
+
for ( let i = 1; i < updateRanges.length; i ++ ) {
|
|
11084
|
+
|
|
11085
|
+
const previousRange = updateRanges[ mergeIndex ];
|
|
11086
|
+
const range = updateRanges[ i ];
|
|
11087
|
+
|
|
11088
|
+
// Only merge if in the same row and overlapping/adjacent
|
|
11089
|
+
const previousEnd = previousRange.start + previousRange.count;
|
|
11090
|
+
const currentRow = getRow( range.start, image.width, componentStride );
|
|
11091
|
+
const previousRow = getRow( previousRange.start, image.width, componentStride );
|
|
11092
|
+
|
|
11093
|
+
// We add one here to merge adjacent ranges. This is safe because ranges
|
|
11094
|
+
// operate over positive integers.
|
|
11095
|
+
if (
|
|
11096
|
+
range.start <= previousEnd + 1 &&
|
|
11097
|
+
currentRow === previousRow &&
|
|
11098
|
+
getRow( range.start + range.count - 1, image.width, componentStride ) === currentRow // ensure range doesn't spill
|
|
11099
|
+
) {
|
|
11100
|
+
|
|
11101
|
+
previousRange.count = Math.max(
|
|
11102
|
+
previousRange.count,
|
|
11103
|
+
range.start + range.count - previousRange.start
|
|
11104
|
+
);
|
|
11105
|
+
|
|
11106
|
+
} else {
|
|
11107
|
+
|
|
11108
|
+
++ mergeIndex;
|
|
11109
|
+
updateRanges[ mergeIndex ] = range;
|
|
11110
|
+
|
|
11111
|
+
}
|
|
11112
|
+
|
|
11113
|
+
|
|
11114
|
+
}
|
|
11115
|
+
|
|
11116
|
+
// Trim the array to only contain the merged ranges.
|
|
11117
|
+
updateRanges.length = mergeIndex + 1;
|
|
11118
|
+
|
|
11119
|
+
const currentUnpackRowLen = _gl.getParameter( _gl.UNPACK_ROW_LENGTH );
|
|
11120
|
+
const currentUnpackSkipPixels = _gl.getParameter( _gl.UNPACK_SKIP_PIXELS );
|
|
11121
|
+
const currentUnpackSkipRows = _gl.getParameter( _gl.UNPACK_SKIP_ROWS );
|
|
11122
|
+
|
|
11123
|
+
_gl.pixelStorei( _gl.UNPACK_ROW_LENGTH, image.width );
|
|
11124
|
+
|
|
11125
|
+
for ( let i = 0, l = updateRanges.length; i < l; i ++ ) {
|
|
11126
|
+
|
|
11127
|
+
const range = updateRanges[ i ];
|
|
11128
|
+
|
|
11129
|
+
const pixelStart = Math.floor( range.start / componentStride );
|
|
11130
|
+
const pixelCount = Math.ceil( range.count / componentStride );
|
|
11131
|
+
|
|
11132
|
+
const x = pixelStart % image.width;
|
|
11133
|
+
const y = Math.floor( pixelStart / image.width );
|
|
11134
|
+
|
|
11135
|
+
// Assumes update ranges refer to contiguous memory
|
|
11136
|
+
const width = pixelCount;
|
|
11137
|
+
const height = 1;
|
|
11138
|
+
|
|
11139
|
+
_gl.pixelStorei( _gl.UNPACK_SKIP_PIXELS, x );
|
|
11140
|
+
_gl.pixelStorei( _gl.UNPACK_SKIP_ROWS, y );
|
|
11141
|
+
|
|
11142
|
+
state.texSubImage2D( _gl.TEXTURE_2D, 0, x, y, width, height, glFormat, glType, image.data );
|
|
11143
|
+
|
|
11144
|
+
}
|
|
11145
|
+
|
|
11146
|
+
texture.clearUpdateRanges();
|
|
11147
|
+
|
|
11148
|
+
_gl.pixelStorei( _gl.UNPACK_ROW_LENGTH, currentUnpackRowLen );
|
|
11149
|
+
_gl.pixelStorei( _gl.UNPACK_SKIP_PIXELS, currentUnpackSkipPixels );
|
|
11150
|
+
_gl.pixelStorei( _gl.UNPACK_SKIP_ROWS, currentUnpackSkipRows );
|
|
11151
|
+
|
|
11152
|
+
}
|
|
11153
|
+
}
|
|
11154
|
+
|
|
11009
11155
|
function setDeferTextureUploads( deferFlag ) {
|
|
11010
11156
|
|
|
11011
11157
|
_deferTextureUploads = deferFlag;
|
|
@@ -11156,7 +11302,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
11156
11302
|
|
|
11157
11303
|
if ( dataReady ) {
|
|
11158
11304
|
|
|
11159
|
-
|
|
11305
|
+
updateTexture( texture, image, glFormat, glType );
|
|
11160
11306
|
|
|
11161
11307
|
}
|
|
11162
11308
|
|
|
@@ -12055,7 +12201,17 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
12055
12201
|
|
|
12056
12202
|
if ( isCube ) throw new Error( 'target.depthTexture not supported in Cube render targets' );
|
|
12057
12203
|
|
|
12058
|
-
|
|
12204
|
+
const mipmaps = renderTarget.texture.mipmaps;
|
|
12205
|
+
|
|
12206
|
+
if ( mipmaps && mipmaps.length > 0 ) {
|
|
12207
|
+
|
|
12208
|
+
setupDepthTexture( renderTargetProperties.__webglFramebuffer[ 0 ], renderTarget );
|
|
12209
|
+
|
|
12210
|
+
} else {
|
|
12211
|
+
|
|
12212
|
+
setupDepthTexture( renderTargetProperties.__webglFramebuffer, renderTarget );
|
|
12213
|
+
|
|
12214
|
+
}
|
|
12059
12215
|
|
|
12060
12216
|
} else {
|
|
12061
12217
|
|
|
@@ -12086,7 +12242,17 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
12086
12242
|
|
|
12087
12243
|
} else {
|
|
12088
12244
|
|
|
12089
|
-
|
|
12245
|
+
const mipmaps = renderTarget.texture.mipmaps;
|
|
12246
|
+
|
|
12247
|
+
if ( mipmaps && mipmaps.length > 0 ) {
|
|
12248
|
+
|
|
12249
|
+
state.bindFramebuffer( _gl.FRAMEBUFFER, renderTargetProperties.__webglFramebuffer[ 0 ] );
|
|
12250
|
+
|
|
12251
|
+
} else {
|
|
12252
|
+
|
|
12253
|
+
state.bindFramebuffer( _gl.FRAMEBUFFER, renderTargetProperties.__webglFramebuffer );
|
|
12254
|
+
|
|
12255
|
+
}
|
|
12090
12256
|
|
|
12091
12257
|
if ( renderTargetProperties.__webglDepthbuffer === undefined ) {
|
|
12092
12258
|
|
|
@@ -12299,13 +12465,21 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
12299
12465
|
const attachment = textures[ i ];
|
|
12300
12466
|
const attachmentProperties = properties.get( attachment );
|
|
12301
12467
|
|
|
12302
|
-
|
|
12303
|
-
|
|
12304
|
-
|
|
12468
|
+
let glTextureType = _gl.TEXTURE_2D;
|
|
12469
|
+
|
|
12470
|
+
if ( renderTarget.isWebGL3DRenderTarget || renderTarget.isWebGLArrayRenderTarget ) {
|
|
12471
|
+
|
|
12472
|
+
glTextureType = renderTarget.isWebGL3DRenderTarget ? _gl.TEXTURE_3D : _gl.TEXTURE_2D_ARRAY;
|
|
12473
|
+
|
|
12474
|
+
}
|
|
12475
|
+
|
|
12476
|
+
state.bindTexture( glTextureType, attachmentProperties.__webglTexture );
|
|
12477
|
+
setTextureParameters( glTextureType, attachment );
|
|
12478
|
+
setupFrameBufferTexture( renderTargetProperties.__webglFramebuffer, renderTarget, attachment, _gl.COLOR_ATTACHMENT0 + i, glTextureType, 0 );
|
|
12305
12479
|
|
|
12306
12480
|
if ( textureNeedsGenerateMipmaps( attachment ) ) {
|
|
12307
12481
|
|
|
12308
|
-
generateMipmap(
|
|
12482
|
+
generateMipmap( glTextureType );
|
|
12309
12483
|
|
|
12310
12484
|
}
|
|
12311
12485
|
|
|
@@ -12422,7 +12596,18 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
12422
12596
|
}
|
|
12423
12597
|
|
|
12424
12598
|
state.bindFramebuffer( _gl.READ_FRAMEBUFFER, renderTargetProperties.__webglMultisampledFramebuffer );
|
|
12425
|
-
|
|
12599
|
+
|
|
12600
|
+
const mipmaps = renderTarget.texture.mipmaps;
|
|
12601
|
+
|
|
12602
|
+
if ( mipmaps && mipmaps.length > 0 ) {
|
|
12603
|
+
|
|
12604
|
+
state.bindFramebuffer( _gl.DRAW_FRAMEBUFFER, renderTargetProperties.__webglFramebuffer[ 0 ] );
|
|
12605
|
+
|
|
12606
|
+
} else {
|
|
12607
|
+
|
|
12608
|
+
state.bindFramebuffer( _gl.DRAW_FRAMEBUFFER, renderTargetProperties.__webglFramebuffer );
|
|
12609
|
+
|
|
12610
|
+
}
|
|
12426
12611
|
|
|
12427
12612
|
for ( let i = 0; i < textures.length; i ++ ) {
|
|
12428
12613
|
|
|
@@ -12642,8 +12827,6 @@ function WebGLUtils( gl, extensions ) {
|
|
|
12642
12827
|
if ( p === AlphaFormat ) return gl.ALPHA;
|
|
12643
12828
|
if ( p === RGBFormat ) return gl.RGB;
|
|
12644
12829
|
if ( p === RGBAFormat ) return gl.RGBA;
|
|
12645
|
-
if ( p === LuminanceFormat ) return gl.LUMINANCE;
|
|
12646
|
-
if ( p === LuminanceAlphaFormat ) return gl.LUMINANCE_ALPHA;
|
|
12647
12830
|
if ( p === DepthFormat ) return gl.DEPTH_COMPONENT;
|
|
12648
12831
|
if ( p === DepthStencilFormat ) return gl.DEPTH_STENCIL;
|
|
12649
12832
|
|
|
@@ -12860,6 +13043,48 @@ class WebGLMultiviewRenderTarget extends WebGLRenderTarget {
|
|
|
12860
13043
|
|
|
12861
13044
|
WebGLMultiviewRenderTarget.prototype.isWebGLMultiviewRenderTarget = true;
|
|
12862
13045
|
|
|
13046
|
+
/**
|
|
13047
|
+
* Represents a texture created externally from the renderer context.
|
|
13048
|
+
*
|
|
13049
|
+
* This may be a texture from a protected media stream, device camera feed,
|
|
13050
|
+
* or other data feeds like a depth sensor.
|
|
13051
|
+
*
|
|
13052
|
+
* Note that this class is only supported in {@link WebGLRenderer} right now.
|
|
13053
|
+
*
|
|
13054
|
+
* @augments Texture
|
|
13055
|
+
*/
|
|
13056
|
+
class ExternalTexture extends Texture {
|
|
13057
|
+
|
|
13058
|
+
/**
|
|
13059
|
+
* Creates a new raw texture.
|
|
13060
|
+
*
|
|
13061
|
+
* @param {?WebGLTexture} [sourceTexture=null] - The external texture.
|
|
13062
|
+
*/
|
|
13063
|
+
constructor( sourceTexture = null ) {
|
|
13064
|
+
|
|
13065
|
+
super();
|
|
13066
|
+
|
|
13067
|
+
/**
|
|
13068
|
+
* The external source texture.
|
|
13069
|
+
*
|
|
13070
|
+
* @type {?WebGLTexture}
|
|
13071
|
+
* @default null
|
|
13072
|
+
*/
|
|
13073
|
+
this.sourceTexture = sourceTexture;
|
|
13074
|
+
|
|
13075
|
+
/**
|
|
13076
|
+
* This flag can be used for type testing.
|
|
13077
|
+
*
|
|
13078
|
+
* @type {boolean}
|
|
13079
|
+
* @readonly
|
|
13080
|
+
* @default true
|
|
13081
|
+
*/
|
|
13082
|
+
this.isExternalTexture = true;
|
|
13083
|
+
|
|
13084
|
+
}
|
|
13085
|
+
|
|
13086
|
+
}
|
|
13087
|
+
|
|
12863
13088
|
const _occlusion_vertex = `
|
|
12864
13089
|
void main() {
|
|
12865
13090
|
|
|
@@ -12899,9 +13124,9 @@ class WebXRDepthSensing {
|
|
|
12899
13124
|
constructor() {
|
|
12900
13125
|
|
|
12901
13126
|
/**
|
|
12902
|
-
*
|
|
13127
|
+
* An opaque texture representing the depth of the user's environment.
|
|
12903
13128
|
*
|
|
12904
|
-
* @type {?
|
|
13129
|
+
* @type {?ExternalTexture}
|
|
12905
13130
|
*/
|
|
12906
13131
|
this.texture = null;
|
|
12907
13132
|
|
|
@@ -12931,18 +13156,14 @@ class WebXRDepthSensing {
|
|
|
12931
13156
|
/**
|
|
12932
13157
|
* Inits the depth sensing module
|
|
12933
13158
|
*
|
|
12934
|
-
* @param {WebGLRenderer} renderer - The renderer.
|
|
12935
13159
|
* @param {XRWebGLDepthInformation} depthData - The XR depth data.
|
|
12936
13160
|
* @param {XRRenderState} renderState - The XR render state.
|
|
12937
13161
|
*/
|
|
12938
|
-
init(
|
|
13162
|
+
init( depthData, renderState ) {
|
|
12939
13163
|
|
|
12940
13164
|
if ( this.texture === null ) {
|
|
12941
13165
|
|
|
12942
|
-
const texture = new
|
|
12943
|
-
|
|
12944
|
-
const texProps = renderer.properties.get( texture );
|
|
12945
|
-
texProps.__webglTexture = depthData.texture;
|
|
13166
|
+
const texture = new ExternalTexture( depthData.texture );
|
|
12946
13167
|
|
|
12947
13168
|
if ( ( depthData.depthNear !== renderState.depthNear ) || ( depthData.depthFar !== renderState.depthFar ) ) {
|
|
12948
13169
|
|
|
@@ -13003,7 +13224,7 @@ class WebXRDepthSensing {
|
|
|
13003
13224
|
/**
|
|
13004
13225
|
* Returns a texture representing the depth of the user's environment.
|
|
13005
13226
|
*
|
|
13006
|
-
* @return {?
|
|
13227
|
+
* @return {?ExternalTexture} The depth texture.
|
|
13007
13228
|
*/
|
|
13008
13229
|
getDepthTexture() {
|
|
13009
13230
|
|
|
@@ -13056,6 +13277,7 @@ class WebXRManager extends EventDispatcher {
|
|
|
13056
13277
|
let xrFrame = null;
|
|
13057
13278
|
|
|
13058
13279
|
const depthSensing = new WebXRDepthSensing();
|
|
13280
|
+
const cameraAccessTextures = {};
|
|
13059
13281
|
const attributes = gl.getContextAttributes();
|
|
13060
13282
|
|
|
13061
13283
|
let initialRenderTarget = null;
|
|
@@ -13243,6 +13465,11 @@ class WebXRManager extends EventDispatcher {
|
|
|
13243
13465
|
_currentDepthFar = null;
|
|
13244
13466
|
|
|
13245
13467
|
depthSensing.reset();
|
|
13468
|
+
for ( const key in cameraAccessTextures ) {
|
|
13469
|
+
|
|
13470
|
+
delete cameraAccessTextures[ key ];
|
|
13471
|
+
|
|
13472
|
+
}
|
|
13246
13473
|
|
|
13247
13474
|
// restore framebuffer/rendering state
|
|
13248
13475
|
|
|
@@ -13289,7 +13516,8 @@ class WebXRManager extends EventDispatcher {
|
|
|
13289
13516
|
/**
|
|
13290
13517
|
* Sets the reference space type. Can be used to configure a spatial relationship with the user's physical
|
|
13291
13518
|
* environment. Depending on how the user moves in 3D space, setting an appropriate reference space can
|
|
13292
|
-
* improve tracking. Default is `local-floor`.
|
|
13519
|
+
* improve tracking. Default is `local-floor`. Valid values can be found here
|
|
13520
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/XRReferenceSpace#reference_space_types.
|
|
13293
13521
|
*
|
|
13294
13522
|
* This method can not be used during a XR session.
|
|
13295
13523
|
*
|
|
@@ -13414,9 +13642,15 @@ class WebXRManager extends EventDispatcher {
|
|
|
13414
13642
|
currentPixelRatio = renderer.getPixelRatio();
|
|
13415
13643
|
renderer.getSize( currentSize );
|
|
13416
13644
|
|
|
13645
|
+
if ( typeof XRWebGLBinding !== 'undefined' ) {
|
|
13646
|
+
|
|
13647
|
+
glBinding = new XRWebGLBinding( session, gl );
|
|
13648
|
+
|
|
13649
|
+
}
|
|
13650
|
+
|
|
13417
13651
|
// Check that the browser implements the necessary APIs to use an
|
|
13418
13652
|
// XRProjectionLayer rather than an XRWebGLLayer
|
|
13419
|
-
const useLayers =
|
|
13653
|
+
const useLayers = glBinding !== null && 'createProjectionLayer' in XRWebGLBinding.prototype;
|
|
13420
13654
|
|
|
13421
13655
|
if ( ! useLayers ) {
|
|
13422
13656
|
|
|
@@ -13787,9 +14021,10 @@ class WebXRManager extends EventDispatcher {
|
|
|
13787
14021
|
|
|
13788
14022
|
}
|
|
13789
14023
|
|
|
13790
|
-
|
|
13791
|
-
|
|
13792
|
-
|
|
14024
|
+
// inherit camera layers and enable eye layers (1 = left, 2 = right)
|
|
14025
|
+
cameraXR.layers.mask = camera.layers.mask | 0b110;
|
|
14026
|
+
cameraL.layers.mask = cameraXR.layers.mask & 0b011;
|
|
14027
|
+
cameraR.layers.mask = cameraXR.layers.mask & 0b101;
|
|
13793
14028
|
|
|
13794
14029
|
const cameras = cameraXR.cameras;
|
|
13795
14030
|
var object = poseTarget || camera;
|
|
@@ -13871,7 +14106,7 @@ class WebXRManager extends EventDispatcher {
|
|
|
13871
14106
|
/**
|
|
13872
14107
|
* Returns the amount of foveation used by the XR compositor for the projection layer.
|
|
13873
14108
|
*
|
|
13874
|
-
* @return {number} The amount of foveation.
|
|
14109
|
+
* @return {number|undefined} The amount of foveation.
|
|
13875
14110
|
*/
|
|
13876
14111
|
this.getFoveation = function () {
|
|
13877
14112
|
|
|
@@ -13934,6 +14169,19 @@ class WebXRManager extends EventDispatcher {
|
|
|
13934
14169
|
|
|
13935
14170
|
};
|
|
13936
14171
|
|
|
14172
|
+
/**
|
|
14173
|
+
* Retrieves an opaque texture from the view-aligned {@link XRCamera}.
|
|
14174
|
+
* Only available during the current animation loop.
|
|
14175
|
+
*
|
|
14176
|
+
* @param {XRCamera} xrCamera - The camera to query.
|
|
14177
|
+
* @return {?Texture} An opaque texture representing the current raw camera frame.
|
|
14178
|
+
*/
|
|
14179
|
+
this.getCameraTexture = function ( xrCamera ) {
|
|
14180
|
+
|
|
14181
|
+
return cameraAccessTextures[ xrCamera ];
|
|
14182
|
+
|
|
14183
|
+
};
|
|
14184
|
+
|
|
13937
14185
|
// Animation Loop
|
|
13938
14186
|
|
|
13939
14187
|
let onAnimationFrameCallback = null;
|
|
@@ -14039,7 +14287,42 @@ class WebXRManager extends EventDispatcher {
|
|
|
14039
14287
|
|
|
14040
14288
|
if ( depthData && depthData.isValid && depthData.texture ) {
|
|
14041
14289
|
|
|
14042
|
-
depthSensing.init(
|
|
14290
|
+
depthSensing.init( depthData, session.renderState );
|
|
14291
|
+
|
|
14292
|
+
}
|
|
14293
|
+
|
|
14294
|
+
}
|
|
14295
|
+
|
|
14296
|
+
const cameraAccessEnabled = enabledFeatures &&
|
|
14297
|
+
enabledFeatures.includes( 'camera-access' );
|
|
14298
|
+
|
|
14299
|
+
if ( cameraAccessEnabled ) {
|
|
14300
|
+
|
|
14301
|
+
renderer.state.unbindTexture();
|
|
14302
|
+
|
|
14303
|
+
if ( glBinding ) {
|
|
14304
|
+
|
|
14305
|
+
for ( let i = 0; i < views.length; i ++ ) {
|
|
14306
|
+
|
|
14307
|
+
const camera = views[ i ].camera;
|
|
14308
|
+
|
|
14309
|
+
if ( camera ) {
|
|
14310
|
+
|
|
14311
|
+
let cameraTex = cameraAccessTextures[ camera ];
|
|
14312
|
+
|
|
14313
|
+
if ( ! cameraTex ) {
|
|
14314
|
+
|
|
14315
|
+
cameraTex = new ExternalTexture();
|
|
14316
|
+
cameraAccessTextures[ camera ] = cameraTex;
|
|
14317
|
+
|
|
14318
|
+
}
|
|
14319
|
+
|
|
14320
|
+
const glTexture = glBinding.getCameraImage( camera );
|
|
14321
|
+
cameraTex.sourceTexture = glTexture;
|
|
14322
|
+
|
|
14323
|
+
}
|
|
14324
|
+
|
|
14325
|
+
}
|
|
14043
14326
|
|
|
14044
14327
|
}
|
|
14045
14328
|
|
|
@@ -15090,7 +15373,7 @@ class WebGLRenderer {
|
|
|
15090
15373
|
preserveDrawingBuffer = false,
|
|
15091
15374
|
powerPreference = 'default',
|
|
15092
15375
|
failIfMajorPerformanceCaveat = false,
|
|
15093
|
-
|
|
15376
|
+
reversedDepthBuffer = false,
|
|
15094
15377
|
multiviewStereo = false,
|
|
15095
15378
|
} = parameters;
|
|
15096
15379
|
|
|
@@ -15324,7 +15607,6 @@ class WebGLRenderer {
|
|
|
15324
15607
|
|
|
15325
15608
|
// camera matrices cache
|
|
15326
15609
|
|
|
15327
|
-
const _currentProjectionMatrix = new Matrix4();
|
|
15328
15610
|
const _projScreenMatrix = new Matrix4();
|
|
15329
15611
|
|
|
15330
15612
|
const _vector3 = new Vector3();
|
|
@@ -15421,7 +15703,7 @@ class WebGLRenderer {
|
|
|
15421
15703
|
|
|
15422
15704
|
state = new WebGLState( _gl, extensions );
|
|
15423
15705
|
|
|
15424
|
-
if ( capabilities.
|
|
15706
|
+
if ( capabilities.reversedDepthBuffer && reversedDepthBuffer ) {
|
|
15425
15707
|
|
|
15426
15708
|
state.buffers.depth.setReversed( true );
|
|
15427
15709
|
|
|
@@ -16310,7 +16592,7 @@ class WebGLRenderer {
|
|
|
16310
16592
|
* @param {Object3D} scene - The scene or another type of 3D object to precompile.
|
|
16311
16593
|
* @param {Camera} camera - The camera.
|
|
16312
16594
|
* @param {?Scene} [targetScene=null] - The target scene.
|
|
16313
|
-
* @return {
|
|
16595
|
+
* @return {Set<Material>} The precompiled materials.
|
|
16314
16596
|
*/
|
|
16315
16597
|
this.compile = function ( scene, camera, targetScene = null ) {
|
|
16316
16598
|
|
|
@@ -16570,7 +16852,7 @@ class WebGLRenderer {
|
|
|
16570
16852
|
renderStateStack.push( currentRenderState );
|
|
16571
16853
|
|
|
16572
16854
|
_projScreenMatrix.multiplyMatrices( camera.projectionMatrix, camera.matrixWorldInverse );
|
|
16573
|
-
_frustum.setFromProjectionMatrix( _projScreenMatrix );
|
|
16855
|
+
_frustum.setFromProjectionMatrix( _projScreenMatrix, WebGLCoordinateSystem, camera.reversedDepth );
|
|
16574
16856
|
|
|
16575
16857
|
_localClippingEnabled = this.localClippingEnabled;
|
|
16576
16858
|
_clippingEnabled = clipping.init( this.clippingPlanes, _localClippingEnabled );
|
|
@@ -16913,6 +17195,9 @@ class WebGLRenderer {
|
|
|
16913
17195
|
//
|
|
16914
17196
|
|
|
16915
17197
|
const currentRenderTarget = _this.getRenderTarget();
|
|
17198
|
+
const currentActiveCubeFace = _this.getActiveCubeFace();
|
|
17199
|
+
const currentActiveMipmapLevel = _this.getActiveMipmapLevel();
|
|
17200
|
+
|
|
16916
17201
|
_this.setRenderTarget( transmissionRenderTarget );
|
|
16917
17202
|
|
|
16918
17203
|
_this.getClearColor( _currentClearColor );
|
|
@@ -16982,7 +17267,7 @@ class WebGLRenderer {
|
|
|
16982
17267
|
|
|
16983
17268
|
}
|
|
16984
17269
|
|
|
16985
|
-
_this.setRenderTarget( currentRenderTarget );
|
|
17270
|
+
_this.setRenderTarget( currentRenderTarget, currentActiveCubeFace, currentActiveMipmapLevel );
|
|
16986
17271
|
|
|
16987
17272
|
_this.setClearColor( _currentClearColor, _currentClearAlpha );
|
|
16988
17273
|
|
|
@@ -17414,23 +17699,17 @@ class WebGLRenderer {
|
|
|
17414
17699
|
|
|
17415
17700
|
} else {
|
|
17416
17701
|
|
|
17417
|
-
const
|
|
17418
|
-
|
|
17419
|
-
if ( reverseDepthBuffer ) {
|
|
17702
|
+
const reversedDepthBuffer = state.buffers.depth.getReversed();
|
|
17420
17703
|
|
|
17421
|
-
|
|
17704
|
+
if ( reversedDepthBuffer && camera.reversedDepth !== true ) {
|
|
17422
17705
|
|
|
17423
|
-
|
|
17424
|
-
|
|
17425
|
-
|
|
17426
|
-
p_uniforms.setValue( _gl, 'projectionMatrix', _currentProjectionMatrix );
|
|
17427
|
-
|
|
17428
|
-
} else {
|
|
17429
|
-
|
|
17430
|
-
p_uniforms.setValue( _gl, 'projectionMatrix', camera.projectionMatrix );
|
|
17706
|
+
camera._reversedDepth = true;
|
|
17707
|
+
camera.updateProjectionMatrix();
|
|
17431
17708
|
|
|
17432
17709
|
}
|
|
17433
17710
|
|
|
17711
|
+
p_uniforms.setValue( _gl, 'projectionMatrix', camera.projectionMatrix );
|
|
17712
|
+
|
|
17434
17713
|
p_uniforms.setValue( _gl, 'viewMatrix', camera.matrixWorldInverse );
|
|
17435
17714
|
|
|
17436
17715
|
}
|
|
@@ -17896,9 +18175,15 @@ class WebGLRenderer {
|
|
|
17896
18175
|
|
|
17897
18176
|
} else if ( isRenderTarget3D ) {
|
|
17898
18177
|
|
|
17899
|
-
const textureProperties = properties.get( renderTarget.texture );
|
|
17900
18178
|
const layer = activeCubeFace;
|
|
17901
|
-
|
|
18179
|
+
|
|
18180
|
+
for ( let i = 0; i < renderTarget.textures.length; i ++ ) {
|
|
18181
|
+
|
|
18182
|
+
const textureProperties = properties.get( renderTarget.textures[ i ] );
|
|
18183
|
+
|
|
18184
|
+
_gl.framebufferTextureLayer( _gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0 + i, textureProperties.__webglTexture, activeMipmapLevel, layer );
|
|
18185
|
+
|
|
18186
|
+
}
|
|
17902
18187
|
|
|
17903
18188
|
} else if ( renderTarget !== null && activeMipmapLevel !== 0 ) {
|
|
17904
18189
|
|
|
@@ -17923,8 +18208,9 @@ class WebGLRenderer {
|
|
|
17923
18208
|
* @param {number} height - The height of the copy region.
|
|
17924
18209
|
* @param {TypedArray} buffer - The result buffer.
|
|
17925
18210
|
* @param {number} [activeCubeFaceIndex] - The active cube face index.
|
|
18211
|
+
* @param {number} [textureIndex=0] - The texture index of an MRT render target.
|
|
17926
18212
|
*/
|
|
17927
|
-
this.readRenderTargetPixels = function ( renderTarget, x, y, width, height, buffer, activeCubeFaceIndex ) {
|
|
18213
|
+
this.readRenderTargetPixels = function ( renderTarget, x, y, width, height, buffer, activeCubeFaceIndex, textureIndex = 0 ) {
|
|
17928
18214
|
|
|
17929
18215
|
if ( ! ( renderTarget && renderTarget.isWebGLRenderTarget ) ) {
|
|
17930
18216
|
|
|
@@ -17947,7 +18233,7 @@ class WebGLRenderer {
|
|
|
17947
18233
|
|
|
17948
18234
|
try {
|
|
17949
18235
|
|
|
17950
|
-
const texture = renderTarget.
|
|
18236
|
+
const texture = renderTarget.textures[ textureIndex ];
|
|
17951
18237
|
const textureFormat = texture.format;
|
|
17952
18238
|
const textureType = texture.type;
|
|
17953
18239
|
|
|
@@ -17969,6 +18255,10 @@ class WebGLRenderer {
|
|
|
17969
18255
|
|
|
17970
18256
|
if ( ( x >= 0 && x <= ( renderTarget.width - width ) ) && ( y >= 0 && y <= ( renderTarget.height - height ) ) ) {
|
|
17971
18257
|
|
|
18258
|
+
// when using MRT, select the correct color buffer for the subsequent read command
|
|
18259
|
+
|
|
18260
|
+
if ( renderTarget.textures.length > 1 ) _gl.readBuffer( _gl.COLOR_ATTACHMENT0 + textureIndex );
|
|
18261
|
+
|
|
17972
18262
|
_gl.readPixels( x, y, width, height, utils.convert( textureFormat ), utils.convert( textureType ), buffer );
|
|
17973
18263
|
|
|
17974
18264
|
}
|
|
@@ -17999,9 +18289,10 @@ class WebGLRenderer {
|
|
|
17999
18289
|
* @param {number} height - The height of the copy region.
|
|
18000
18290
|
* @param {TypedArray} buffer - The result buffer.
|
|
18001
18291
|
* @param {number} [activeCubeFaceIndex] - The active cube face index.
|
|
18292
|
+
* @param {number} [textureIndex=0] - The texture index of an MRT render target.
|
|
18002
18293
|
* @return {Promise<TypedArray>} A Promise that resolves when the read has been finished. The resolve provides the read data as a typed array.
|
|
18003
18294
|
*/
|
|
18004
|
-
this.readRenderTargetPixelsAsync = async function ( renderTarget, x, y, width, height, buffer, activeCubeFaceIndex ) {
|
|
18295
|
+
this.readRenderTargetPixelsAsync = async function ( renderTarget, x, y, width, height, buffer, activeCubeFaceIndex, textureIndex = 0 ) {
|
|
18005
18296
|
|
|
18006
18297
|
if ( ! ( renderTarget && renderTarget.isWebGLRenderTarget ) ) {
|
|
18007
18298
|
|
|
@@ -18024,7 +18315,7 @@ class WebGLRenderer {
|
|
|
18024
18315
|
// set the active frame buffer to the one we want to read
|
|
18025
18316
|
state.bindFramebuffer( _gl.FRAMEBUFFER, framebuffer );
|
|
18026
18317
|
|
|
18027
|
-
const texture = renderTarget.
|
|
18318
|
+
const texture = renderTarget.textures[ textureIndex ];
|
|
18028
18319
|
const textureFormat = texture.format;
|
|
18029
18320
|
const textureType = texture.type;
|
|
18030
18321
|
|
|
@@ -18043,6 +18334,11 @@ class WebGLRenderer {
|
|
|
18043
18334
|
const glBuffer = _gl.createBuffer();
|
|
18044
18335
|
_gl.bindBuffer( _gl.PIXEL_PACK_BUFFER, glBuffer );
|
|
18045
18336
|
_gl.bufferData( _gl.PIXEL_PACK_BUFFER, buffer.byteLength, _gl.STREAM_READ );
|
|
18337
|
+
|
|
18338
|
+
// when using MRT, select the correct color buffer for the subsequent read command
|
|
18339
|
+
|
|
18340
|
+
if ( renderTarget.textures.length > 1 ) _gl.readBuffer( _gl.COLOR_ATTACHMENT0 + textureIndex );
|
|
18341
|
+
|
|
18046
18342
|
_gl.readPixels( x, y, width, height, utils.convert( textureFormat ), utils.convert( textureType ), 0 );
|
|
18047
18343
|
|
|
18048
18344
|
// reset the frame buffer to the currently set buffer before waiting
|
|
@@ -18078,7 +18374,7 @@ class WebGLRenderer {
|
|
|
18078
18374
|
* Copies pixels from the current bound framebuffer into the given texture.
|
|
18079
18375
|
*
|
|
18080
18376
|
* @param {FramebufferTexture} texture - The texture.
|
|
18081
|
-
* @param {Vector2} position - The start position of the copy operation.
|
|
18377
|
+
* @param {?Vector2} [position=null] - The start position of the copy operation.
|
|
18082
18378
|
* @param {number} [level=0] - The mip level. The default represents the base mip.
|
|
18083
18379
|
*/
|
|
18084
18380
|
this.copyFramebufferToTexture = function ( texture, position = null, level = 0 ) {
|
|
@@ -18109,10 +18405,10 @@ class WebGLRenderer {
|
|
|
18109
18405
|
*
|
|
18110
18406
|
* @param {Texture} srcTexture - The source texture.
|
|
18111
18407
|
* @param {Texture} dstTexture - The destination texture.
|
|
18112
|
-
* @param {Box2|Box3} [srcRegion=null] - A bounding box which describes the source region. Can be two or three-dimensional.
|
|
18113
|
-
* @param {Vector2|Vector3} [dstPosition=null] - A vector that represents the origin of the destination region. Can be two or three-dimensional.
|
|
18114
|
-
* @param {number} srcLevel - The source mipmap level to copy.
|
|
18115
|
-
* @param {number} dstLevel - The destination mipmap level.
|
|
18408
|
+
* @param {?(Box2|Box3)} [srcRegion=null] - A bounding box which describes the source region. Can be two or three-dimensional.
|
|
18409
|
+
* @param {?(Vector2|Vector3)} [dstPosition=null] - A vector that represents the origin of the destination region. Can be two or three-dimensional.
|
|
18410
|
+
* @param {number} [srcLevel=0] - The source mipmap level to copy.
|
|
18411
|
+
* @param {?number} [dstLevel=null] - The destination mipmap level.
|
|
18116
18412
|
*/
|
|
18117
18413
|
this.copyTextureToTexture = function ( srcTexture, dstTexture, srcRegion = null, dstPosition = null, srcLevel = 0, dstLevel = null ) {
|
|
18118
18414
|
|
|
@@ -18485,4 +18781,4 @@ class WebGLRenderer {
|
|
|
18485
18781
|
|
|
18486
18782
|
}
|
|
18487
18783
|
|
|
18488
|
-
export { ACESFilmicToneMapping, AddEquation, AddOperation, AdditiveBlending, AgXToneMapping, AlphaFormat, AlwaysCompare, AlwaysDepth, ArrayCamera, BackSide, BoxGeometry, BufferAttribute, BufferGeometry, ByteType, CineonToneMapping, ClampToEdgeWrapping, Color, ColorManagement, ConstantAlphaFactor, ConstantColorFactor, CubeReflectionMapping, CubeRefractionMapping, CubeTexture, CubeUVReflectionMapping, CullFaceBack, CullFaceFront, CullFaceNone, CustomBlending, CustomToneMapping, Data3DTexture, DataArrayTexture, DepthFormat, DepthStencilFormat, DepthTexture, DoubleSide, DstAlphaFactor, DstColorFactor, EqualCompare, EqualDepth, EquirectangularReflectionMapping, EquirectangularRefractionMapping, Euler, EventDispatcher, FloatType, FrontSide, Frustum, GLSL3, GreaterCompare, GreaterDepth, GreaterEqualCompare, GreaterEqualDepth, HalfFloatType, IntType, Layers, LessCompare, LessDepth, LessEqualCompare, LessEqualDepth, LinearFilter, LinearMipmapLinearFilter, LinearMipmapNearestFilter, LinearSRGBColorSpace, LinearToneMapping, LinearTransfer,
|
|
18784
|
+
export { ACESFilmicToneMapping, AddEquation, AddOperation, AdditiveBlending, AgXToneMapping, AlphaFormat, AlwaysCompare, AlwaysDepth, ArrayCamera, BackSide, BoxGeometry, BufferAttribute, BufferGeometry, ByteType, CineonToneMapping, ClampToEdgeWrapping, Color, ColorManagement, ConstantAlphaFactor, ConstantColorFactor, CubeReflectionMapping, CubeRefractionMapping, CubeTexture, CubeUVReflectionMapping, CullFaceBack, CullFaceFront, CullFaceNone, CustomBlending, CustomToneMapping, Data3DTexture, DataArrayTexture, DepthFormat, DepthStencilFormat, DepthTexture, DoubleSide, DstAlphaFactor, DstColorFactor, EqualCompare, EqualDepth, EquirectangularReflectionMapping, EquirectangularRefractionMapping, Euler, EventDispatcher, FloatType, FrontSide, Frustum, GLSL3, GreaterCompare, GreaterDepth, GreaterEqualCompare, GreaterEqualDepth, HalfFloatType, IntType, Layers, LessCompare, LessDepth, LessEqualCompare, LessEqualDepth, LinearFilter, LinearMipmapLinearFilter, LinearMipmapNearestFilter, LinearSRGBColorSpace, LinearToneMapping, LinearTransfer, Matrix3, Matrix4, MaxEquation, Mesh, MeshBasicMaterial, MeshDepthMaterial, MeshDistanceMaterial, MinEquation, MirroredRepeatWrapping, MixOperation, MultiplyBlending, MultiplyOperation, NearestFilter, NearestMipmapLinearFilter, NearestMipmapNearestFilter, NeutralToneMapping, NeverCompare, NeverDepth, NoBlending, NoColorSpace, NoToneMapping, NormalBlending, NotEqualCompare, NotEqualDepth, ObjectSpaceNormalMap, OneFactor, OneMinusConstantAlphaFactor, OneMinusConstantColorFactor, OneMinusDstAlphaFactor, OneMinusDstColorFactor, OneMinusSrcAlphaFactor, OneMinusSrcColorFactor, OrthographicCamera, PCFShadowMap, PCFSoftShadowMap, PMREMGenerator, PerspectiveCamera, Plane, PlaneGeometry, RED_GREEN_RGTC2_Format, RED_RGTC1_Format, REVISION, RGBADepthPacking, RGBAFormat, RGBAIntegerFormat, RGBA_ASTC_10x10_Format, RGBA_ASTC_10x5_Format, RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, 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_BPTC_Format, RGBA_ETC2_EAC_Format, RGBA_PVRTC_2BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGBA_S3TC_DXT1_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT5_Format, RGBFormat, RGB_BPTC_SIGNED_Format, RGB_BPTC_UNSIGNED_Format, RGB_ETC1_Format, RGB_ETC2_Format, RGB_PVRTC_2BPPV1_Format, RGB_PVRTC_4BPPV1_Format, RGB_S3TC_DXT1_Format, RGFormat, RGIntegerFormat, RedFormat, RedIntegerFormat, ReinhardToneMapping, RepeatWrapping, ReverseSubtractEquation, SIGNED_RED_GREEN_RGTC2_Format, SIGNED_RED_RGTC1_Format, SRGBColorSpace, SRGBTransfer, ShaderChunk, ShaderLib, ShaderMaterial, ShortType, SrcAlphaFactor, SrcAlphaSaturateFactor, SrcColorFactor, SubtractEquation, SubtractiveBlending, TangentSpaceNormalMap, Texture, Uint16BufferAttribute, Uint32BufferAttribute, UniformsLib, UniformsUtils, UnsignedByteType, UnsignedInt248Type, UnsignedInt5999Type, UnsignedIntType, UnsignedShort4444Type, UnsignedShort5551Type, UnsignedShortType, VSMShadowMap, Vector2, Vector3, Vector4, WebGLCoordinateSystem, WebGLCubeRenderTarget, WebGLRenderTarget, WebGLRenderer, WebGLUtils, WebXRController, ZeroFactor, createCanvasElement };
|