super-three 0.176.0 → 0.177.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/build/three.cjs +7631 -6743
- package/build/three.core.js +7496 -6758
- package/build/three.core.min.js +1 -1
- package/build/three.module.js +172 -22
- package/build/three.module.min.js +1 -1
- package/build/three.tsl.js +14 -6
- package/build/three.tsl.min.js +1 -1
- package/build/three.webgpu.js +3948 -1678
- package/build/three.webgpu.min.js +1 -1
- package/build/three.webgpu.nodes.js +3941 -1678
- package/build/three.webgpu.nodes.min.js +1 -1
- package/examples/jsm/Addons.js +0 -1
- package/examples/jsm/animation/AnimationClipCreator.js +1 -0
- package/examples/jsm/animation/CCDIKSolver.js +6 -3
- package/examples/jsm/capabilities/WebGL.js +1 -0
- package/examples/jsm/capabilities/WebGPU.js +1 -0
- package/examples/jsm/controls/ArcballControls.js +14 -3
- package/examples/jsm/controls/DragControls.js +1 -0
- package/examples/jsm/controls/FirstPersonControls.js +1 -0
- package/examples/jsm/controls/FlyControls.js +1 -0
- package/examples/jsm/controls/MapControls.js +1 -0
- package/examples/jsm/controls/OrbitControls.js +1 -0
- package/examples/jsm/controls/PointerLockControls.js +5 -3
- package/examples/jsm/controls/TrackballControls.js +1 -0
- package/examples/jsm/controls/TransformControls.js +1 -0
- package/examples/jsm/csm/CSM.js +2 -0
- package/examples/jsm/csm/CSMFrustum.js +2 -0
- package/examples/jsm/csm/CSMHelper.js +1 -0
- package/examples/jsm/csm/CSMShader.js +4 -1
- package/examples/jsm/csm/CSMShadowNode.js +18 -4
- package/examples/jsm/curves/CurveExtras.js +14 -0
- package/examples/jsm/curves/NURBSCurve.js +1 -0
- package/examples/jsm/curves/NURBSSurface.js +2 -0
- package/examples/jsm/curves/NURBSUtils.js +4 -1
- package/examples/jsm/curves/NURBSVolume.js +2 -0
- package/examples/jsm/effects/AnaglyphEffect.js +2 -0
- package/examples/jsm/effects/AsciiEffect.js +2 -0
- package/examples/jsm/effects/OutlineEffect.js +2 -0
- package/examples/jsm/effects/ParallaxBarrierEffect.js +2 -0
- package/examples/jsm/effects/StereoEffect.js +2 -0
- package/examples/jsm/environments/DebugEnvironment.js +1 -0
- package/examples/jsm/environments/RoomEnvironment.js +49 -35
- package/examples/jsm/exporters/DRACOExporter.js +4 -2
- package/examples/jsm/exporters/EXRExporter.js +2 -0
- package/examples/jsm/exporters/GLTFExporter.js +7 -4
- package/examples/jsm/exporters/KTX2Exporter.js +2 -0
- package/examples/jsm/exporters/OBJExporter.js +3 -1
- package/examples/jsm/exporters/PLYExporter.js +4 -2
- package/examples/jsm/exporters/STLExporter.js +2 -0
- package/examples/jsm/exporters/USDZExporter.js +12 -10
- package/examples/jsm/geometries/BoxLineGeometry.js +1 -0
- package/examples/jsm/geometries/ConvexGeometry.js +1 -0
- package/examples/jsm/geometries/DecalGeometry.js +1 -0
- package/examples/jsm/geometries/ParametricFunctions.js +4 -1
- package/examples/jsm/geometries/ParametricGeometry.js +1 -0
- package/examples/jsm/geometries/RoundedBoxGeometry.js +1 -0
- package/examples/jsm/geometries/TeapotGeometry.js +1 -0
- package/examples/jsm/geometries/TextGeometry.js +1 -0
- package/examples/jsm/helpers/LightProbeHelper.js +1 -0
- package/examples/jsm/helpers/LightProbeHelperGPU.js +1 -0
- package/examples/jsm/helpers/OctreeHelper.js +1 -0
- package/examples/jsm/helpers/PositionalAudioHelper.js +1 -0
- package/examples/jsm/helpers/RapierHelper.js +59 -0
- package/examples/jsm/helpers/RectAreaLightHelper.js +1 -0
- package/examples/jsm/helpers/TextureHelper.js +1 -0
- package/examples/jsm/helpers/TextureHelperGPU.js +5 -4
- package/examples/jsm/helpers/VertexNormalsHelper.js +1 -0
- package/examples/jsm/helpers/VertexTangentsHelper.js +1 -0
- package/examples/jsm/helpers/ViewHelper.js +1 -0
- package/examples/jsm/interactive/HTMLMesh.js +7 -0
- package/examples/jsm/interactive/InteractiveGroup.js +1 -0
- package/examples/jsm/interactive/SelectionBox.js +2 -0
- package/examples/jsm/interactive/SelectionHelper.js +2 -0
- package/examples/jsm/lighting/TiledLighting.js +1 -0
- package/examples/jsm/lights/LightProbeGenerator.js +1 -0
- package/examples/jsm/lights/RectAreaLightTexturesLib.js +1 -0
- package/examples/jsm/lights/RectAreaLightUniformsLib.js +1 -0
- package/examples/jsm/lines/Line2.js +1 -0
- package/examples/jsm/lines/LineGeometry.js +1 -0
- package/examples/jsm/lines/LineMaterial.js +4 -4
- package/examples/jsm/lines/LineSegments2.js +1 -0
- package/examples/jsm/lines/LineSegmentsGeometry.js +1 -0
- package/examples/jsm/lines/Wireframe.js +1 -0
- package/examples/jsm/lines/WireframeGeometry2.js +1 -0
- package/examples/jsm/lines/webgpu/Line2.js +1 -0
- package/examples/jsm/lines/webgpu/LineSegments2.js +3 -1
- package/examples/jsm/lines/webgpu/Wireframe.js +1 -0
- package/examples/jsm/loaders/3DMLoader.js +1 -0
- package/examples/jsm/loaders/3MFLoader.js +1 -0
- package/examples/jsm/loaders/AMFLoader.js +1 -0
- package/examples/jsm/loaders/BVHLoader.js +1 -0
- package/examples/jsm/loaders/ColladaLoader.js +5 -4
- package/examples/jsm/loaders/DDSLoader.js +1 -0
- package/examples/jsm/loaders/DRACOLoader.js +2 -1
- package/examples/jsm/loaders/EXRLoader.js +1 -0
- package/examples/jsm/loaders/FBXLoader.js +24 -22
- package/examples/jsm/loaders/FontLoader.js +1 -0
- package/examples/jsm/loaders/GCodeLoader.js +1 -0
- package/examples/jsm/loaders/GLTFLoader.js +10 -82
- package/examples/jsm/loaders/HDRCubeTextureLoader.js +1 -0
- package/examples/jsm/loaders/IESLoader.js +1 -0
- package/examples/jsm/loaders/KMZLoader.js +1 -0
- package/examples/jsm/loaders/KTX2Loader.js +67 -26
- package/examples/jsm/loaders/KTXLoader.js +1 -0
- package/examples/jsm/loaders/LDrawLoader.js +55 -3
- package/examples/jsm/loaders/LUT3dlLoader.js +1 -0
- package/examples/jsm/loaders/LUTCubeLoader.js +1 -0
- package/examples/jsm/loaders/LUTImageLoader.js +1 -0
- package/examples/jsm/loaders/LWOLoader.js +1 -13
- package/examples/jsm/loaders/LottieLoader.js +15 -0
- package/examples/jsm/loaders/MD2Loader.js +1 -0
- package/examples/jsm/loaders/MDDLoader.js +1 -0
- package/examples/jsm/loaders/MTLLoader.js +4 -3
- package/examples/jsm/loaders/MaterialXLoader.js +1 -0
- package/examples/jsm/loaders/NRRDLoader.js +1 -0
- package/examples/jsm/loaders/OBJLoader.js +1 -0
- package/examples/jsm/loaders/PCDLoader.js +122 -19
- package/examples/jsm/loaders/PDBLoader.js +1 -0
- package/examples/jsm/loaders/PLYLoader.js +1 -0
- package/examples/jsm/loaders/PVRLoader.js +1 -0
- package/examples/jsm/loaders/RGBELoader.js +1 -0
- package/examples/jsm/loaders/RGBMLoader.js +1 -0
- package/examples/jsm/loaders/STLLoader.js +1 -0
- package/examples/jsm/loaders/SVGLoader.js +1 -0
- package/examples/jsm/loaders/TDSLoader.js +1 -0
- package/examples/jsm/loaders/TGALoader.js +1 -0
- package/examples/jsm/loaders/TIFFLoader.js +1 -0
- package/examples/jsm/loaders/TTFLoader.js +1 -0
- package/examples/jsm/loaders/USDZLoader.js +1 -0
- package/examples/jsm/loaders/UltraHDRLoader.js +1 -0
- package/examples/jsm/loaders/VOXLoader.js +1 -0
- package/examples/jsm/loaders/VRMLLoader.js +3 -2
- package/examples/jsm/loaders/VTKLoader.js +1 -0
- package/examples/jsm/loaders/XYZLoader.js +1 -0
- package/examples/jsm/loaders/lwo/IFFParser.js +74 -74
- package/examples/jsm/materials/LDrawConditionalLineMaterial.js +1 -0
- package/examples/jsm/materials/LDrawConditionalLineNodeMaterial.js +1 -0
- package/examples/jsm/materials/MeshPostProcessingMaterial.js +1 -0
- package/examples/jsm/math/Capsule.js +2 -0
- package/examples/jsm/math/ColorConverter.js +1 -0
- package/examples/jsm/math/ConvexHull.js +2 -0
- package/examples/jsm/math/ImprovedNoise.js +19 -14
- package/examples/jsm/math/Lut.js +2 -0
- package/examples/jsm/math/MeshSurfaceSampler.js +2 -0
- package/examples/jsm/math/OBB.js +2 -0
- package/examples/jsm/math/Octree.js +20 -1
- package/examples/jsm/math/SimplexNoise.js +2 -0
- package/examples/jsm/misc/ConvexObjectBreaker.js +3 -1
- package/examples/jsm/misc/GPUComputationRenderer.js +2 -0
- package/examples/jsm/misc/Gyroscope.js +1 -0
- package/examples/jsm/misc/MD2Character.js +2 -0
- package/examples/jsm/misc/MD2CharacterComplex.js +5 -3
- package/examples/jsm/misc/MorphAnimMesh.js +1 -0
- package/examples/jsm/misc/MorphBlendMesh.js +1 -0
- package/examples/jsm/misc/ProgressiveLightMap.js +2 -0
- package/examples/jsm/misc/ProgressiveLightMapGPU.js +2 -0
- package/examples/jsm/misc/RollerCoaster.js +5 -0
- package/examples/jsm/misc/Timer.js +2 -0
- package/examples/jsm/misc/TubePainter.js +1 -0
- package/examples/jsm/misc/Volume.js +2 -0
- package/examples/jsm/misc/VolumeSlice.js +1 -0
- package/examples/jsm/modifiers/CurveModifier.js +3 -0
- package/examples/jsm/modifiers/CurveModifierGPU.js +2 -0
- package/examples/jsm/modifiers/EdgeSplitModifier.js +2 -0
- package/examples/jsm/modifiers/SimplifyModifier.js +2 -0
- package/examples/jsm/modifiers/TessellateModifier.js +2 -0
- package/examples/jsm/objects/GroundedSkybox.js +1 -0
- package/examples/jsm/objects/Lensflare.js +3 -0
- package/examples/jsm/objects/LensflareMesh.js +1 -0
- package/examples/jsm/objects/MarchingCubes.js +2 -0
- package/examples/jsm/objects/Reflector.js +1 -0
- package/examples/jsm/objects/ReflectorForSSRPass.js +1 -0
- package/examples/jsm/objects/Refractor.js +1 -0
- package/examples/jsm/objects/ShadowMesh.js +1 -0
- package/examples/jsm/objects/Sky.js +2 -1
- package/examples/jsm/objects/SkyMesh.js +20 -17
- package/examples/jsm/objects/Water.js +1 -0
- package/examples/jsm/objects/Water2.js +1 -0
- package/examples/jsm/objects/Water2Mesh.js +3 -1
- package/examples/jsm/objects/WaterMesh.js +2 -1
- package/examples/jsm/physics/AmmoPhysics.js +1 -0
- package/examples/jsm/physics/JoltPhysics.js +1 -0
- package/examples/jsm/physics/RapierPhysics.js +58 -1
- package/examples/jsm/postprocessing/AfterimagePass.js +20 -2
- package/examples/jsm/postprocessing/BloomPass.js +2 -1
- package/examples/jsm/postprocessing/BokehPass.js +2 -1
- package/examples/jsm/postprocessing/ClearPass.js +1 -0
- package/examples/jsm/postprocessing/CubeTexturePass.js +1 -0
- package/examples/jsm/postprocessing/DotScreenPass.js +1 -0
- package/examples/jsm/postprocessing/EffectComposer.js +5 -6
- package/examples/jsm/postprocessing/FXAAPass.js +40 -0
- package/examples/jsm/postprocessing/FilmPass.js +1 -0
- package/examples/jsm/postprocessing/GTAOPass.js +4 -3
- package/examples/jsm/postprocessing/GlitchPass.js +2 -1
- package/examples/jsm/postprocessing/HalftonePass.js +2 -1
- package/examples/jsm/postprocessing/LUTPass.js +1 -0
- package/examples/jsm/postprocessing/MaskPass.js +1 -0
- package/examples/jsm/postprocessing/OutlinePass.js +5 -2
- package/examples/jsm/postprocessing/OutputPass.js +1 -0
- package/examples/jsm/postprocessing/Pass.js +3 -1
- package/examples/jsm/postprocessing/RenderPass.js +1 -0
- package/examples/jsm/postprocessing/RenderPixelatedPass.js +2 -1
- package/examples/jsm/postprocessing/RenderTransitionPass.js +4 -3
- package/examples/jsm/postprocessing/SAOPass.js +3 -2
- package/examples/jsm/postprocessing/SMAAPass.js +3 -2
- package/examples/jsm/postprocessing/SSAARenderPass.js +2 -1
- package/examples/jsm/postprocessing/SSAOPass.js +2 -1
- package/examples/jsm/postprocessing/SSRPass.js +4 -3
- package/examples/jsm/postprocessing/SavePass.js +2 -1
- package/examples/jsm/postprocessing/ShaderPass.js +1 -0
- package/examples/jsm/postprocessing/TAARenderPass.js +1 -0
- package/examples/jsm/postprocessing/TexturePass.js +1 -0
- package/examples/jsm/postprocessing/UnrealBloomPass.js +2 -1
- package/examples/jsm/renderers/CSS2DRenderer.js +3 -0
- package/examples/jsm/renderers/CSS3DRenderer.js +4 -0
- package/examples/jsm/renderers/Projector.js +2 -0
- package/examples/jsm/renderers/SVGRenderer.js +3 -0
- package/examples/jsm/shaders/ACESFilmicToneMappingShader.js +4 -1
- package/examples/jsm/shaders/AfterimageShader.js +4 -1
- package/examples/jsm/shaders/BasicShader.js +4 -1
- package/examples/jsm/shaders/BleachBypassShader.js +4 -1
- package/examples/jsm/shaders/BlendShader.js +4 -1
- package/examples/jsm/shaders/BokehShader.js +4 -1
- package/examples/jsm/shaders/BokehShader2.js +4 -1
- package/examples/jsm/shaders/BrightnessContrastShader.js +4 -1
- package/examples/jsm/shaders/ColorCorrectionShader.js +4 -1
- package/examples/jsm/shaders/ColorifyShader.js +4 -1
- package/examples/jsm/shaders/ConvolutionShader.js +4 -1
- package/examples/jsm/shaders/CopyShader.js +4 -1
- package/examples/jsm/shaders/DOFMipMapShader.js +4 -1
- package/examples/jsm/shaders/DepthLimitedBlurShader.js +4 -1
- package/examples/jsm/shaders/DigitalGlitch.js +4 -1
- package/examples/jsm/shaders/DotScreenShader.js +4 -1
- package/examples/jsm/shaders/ExposureShader.js +4 -1
- package/examples/jsm/shaders/FXAAShader.js +4 -1
- package/examples/jsm/shaders/FilmShader.js +4 -1
- package/examples/jsm/shaders/FocusShader.js +4 -1
- package/examples/jsm/shaders/FreiChenShader.js +4 -1
- package/examples/jsm/shaders/GTAOShader.js +4 -1
- package/examples/jsm/shaders/GammaCorrectionShader.js +4 -1
- package/examples/jsm/shaders/GodRaysShader.js +4 -1
- package/examples/jsm/shaders/HalftoneShader.js +4 -1
- package/examples/jsm/shaders/HorizontalBlurShader.js +4 -1
- package/examples/jsm/shaders/HorizontalTiltShiftShader.js +4 -1
- package/examples/jsm/shaders/HueSaturationShader.js +4 -1
- package/examples/jsm/shaders/KaleidoShader.js +4 -1
- package/examples/jsm/shaders/LuminosityHighPassShader.js +4 -1
- package/examples/jsm/shaders/LuminosityShader.js +4 -1
- package/examples/jsm/shaders/MirrorShader.js +4 -1
- package/examples/jsm/shaders/NormalMapShader.js +4 -1
- package/examples/jsm/shaders/OutputShader.js +4 -1
- package/examples/jsm/shaders/PoissonDenoiseShader.js +4 -1
- package/examples/jsm/shaders/RGBShiftShader.js +4 -1
- package/examples/jsm/shaders/SAOShader.js +4 -1
- package/examples/jsm/shaders/SMAAShader.js +1 -0
- package/examples/jsm/shaders/SSAOShader.js +4 -1
- package/examples/jsm/shaders/SSRShader.js +1 -0
- package/examples/jsm/shaders/SepiaShader.js +4 -1
- package/examples/jsm/shaders/SobelOperatorShader.js +4 -1
- package/examples/jsm/shaders/SubsurfaceScatteringShader.js +4 -1
- package/examples/jsm/shaders/TechnicolorShader.js +4 -1
- package/examples/jsm/shaders/ToonShader.js +2 -1
- package/examples/jsm/shaders/TriangleBlurShader.js +4 -1
- package/examples/jsm/shaders/UnpackDepthRGBAShader.js +4 -1
- package/examples/jsm/shaders/VelocityShader.js +4 -1
- package/examples/jsm/shaders/VerticalBlurShader.js +4 -1
- package/examples/jsm/shaders/VerticalTiltShiftShader.js +4 -1
- package/examples/jsm/shaders/VignetteShader.js +4 -1
- package/examples/jsm/shaders/VolumeShader.js +5 -2
- package/examples/jsm/shaders/WaterRefractionShader.js +4 -1
- package/examples/jsm/textures/FlakesTexture.js +2 -0
- package/examples/jsm/transpiler/GLSLDecoder.js +1 -2
- package/examples/jsm/transpiler/TSLEncoder.js +52 -8
- package/examples/jsm/transpiler/Transpiler.js +2 -0
- package/examples/jsm/tsl/display/AfterImageNode.js +2 -3
- package/examples/jsm/tsl/display/AnaglyphPassNode.js +1 -0
- package/examples/jsm/tsl/display/AnamorphicNode.js +5 -4
- package/examples/jsm/tsl/display/BloomNode.js +1 -0
- package/examples/jsm/tsl/display/DenoiseNode.js +33 -33
- package/examples/jsm/tsl/display/DepthOfFieldNode.js +1 -0
- package/examples/jsm/tsl/display/DotScreenNode.js +1 -0
- package/examples/jsm/tsl/display/FXAANode.js +3 -2
- package/examples/jsm/tsl/display/FilmNode.js +1 -0
- package/examples/jsm/tsl/display/GTAONode.js +1 -0
- package/examples/jsm/tsl/display/GaussianBlurNode.js +2 -27
- package/examples/jsm/tsl/display/LensflareNode.js +1 -0
- package/examples/jsm/tsl/display/Lut3DNode.js +1 -0
- package/examples/jsm/tsl/display/OutlineNode.js +1 -0
- package/examples/jsm/tsl/display/ParallaxBarrierPassNode.js +1 -0
- package/examples/jsm/tsl/display/PixelationPassNode.js +1 -0
- package/examples/jsm/tsl/display/RGBShiftNode.js +1 -0
- package/examples/jsm/tsl/display/SMAANode.js +9 -8
- package/examples/jsm/tsl/display/SSAAPassNode.js +3 -2
- package/examples/jsm/tsl/display/SSRNode.js +1 -0
- package/examples/jsm/tsl/display/SobelOperatorNode.js +1 -0
- package/examples/jsm/tsl/display/StereoCompositePassNode.js +1 -0
- package/examples/jsm/tsl/display/StereoPassNode.js +1 -0
- package/examples/jsm/tsl/display/TRAAPassNode.js +5 -4
- package/examples/jsm/tsl/display/TransitionNode.js +1 -0
- package/examples/jsm/tsl/display/hashBlur.js +28 -6
- package/examples/jsm/tsl/lighting/TiledLightsNode.js +4 -3
- package/examples/jsm/tsl/math/Bayer.js +4 -1
- package/examples/jsm/tsl/shadows/TileShadowNode.js +456 -0
- package/examples/jsm/tsl/shadows/TileShadowNodeHelper.js +212 -0
- package/examples/jsm/tsl/utils/Raymarching.js +6 -3
- package/examples/jsm/utils/BufferGeometryUtils.js +4 -1
- package/examples/jsm/utils/CameraUtils.js +4 -1
- package/examples/jsm/utils/GeometryCompressionUtils.js +4 -1
- package/examples/jsm/utils/GeometryUtils.js +4 -1
- package/examples/jsm/utils/LDrawUtils.js +2 -0
- package/examples/jsm/utils/SceneOptimizer.js +2 -0
- package/examples/jsm/utils/SceneUtils.js +4 -1
- package/examples/jsm/utils/ShadowMapViewer.js +2 -0
- package/examples/jsm/utils/ShadowMapViewerGPU.js +2 -0
- package/examples/jsm/utils/SkeletonUtils.js +4 -1
- package/examples/jsm/utils/SortUtils.js +4 -1
- package/examples/jsm/utils/UVsDebug.js +4 -1
- package/examples/jsm/utils/WebGLTextureUtils.js +4 -1
- package/examples/jsm/utils/WebGPUTextureUtils.js +4 -1
- package/examples/jsm/utils/WorkerPool.js +2 -0
- package/examples/jsm/webxr/ARButton.js +1 -0
- package/examples/jsm/webxr/OculusHandModel.js +1 -0
- package/examples/jsm/webxr/OculusHandPointerModel.js +1 -0
- package/examples/jsm/webxr/Text2D.js +4 -1
- package/examples/jsm/webxr/VRButton.js +1 -0
- package/examples/jsm/webxr/XRButton.js +1 -0
- package/examples/jsm/webxr/XRControllerModelFactory.js +2 -0
- package/examples/jsm/webxr/XREstimatedLight.js +1 -0
- package/examples/jsm/webxr/XRHandMeshModel.js +2 -0
- package/examples/jsm/webxr/XRHandModelFactory.js +2 -0
- package/examples/jsm/webxr/XRHandPrimitiveModel.js +2 -0
- package/examples/jsm/webxr/XRPlanes.js +1 -0
- package/package.json +6 -4
- package/src/Three.Core.js +1 -1
- package/src/Three.TSL.js +13 -5
- package/src/Three.WebGPU.Nodes.js +1 -0
- package/src/Three.WebGPU.js +1 -0
- package/src/audio/AudioListener.js +13 -10
- package/src/cameras/ArrayCamera.js +9 -1
- package/src/constants.js +47 -20
- package/src/core/BufferAttribute.js +1 -1
- package/src/core/BufferGeometry.js +2 -5
- package/src/core/Object3D.js +22 -21
- package/src/core/RenderTarget.js +65 -21
- package/src/core/RenderTarget3D.js +1 -0
- package/src/extras/TextureUtils.js +1 -5
- package/src/extras/core/Curve.js +1 -1
- package/src/geometries/CapsuleGeometry.js +167 -17
- package/src/geometries/ExtrudeGeometry.js +39 -29
- package/src/helpers/ArrowHelper.js +2 -2
- package/src/helpers/SkeletonHelper.js +1 -1
- package/src/lights/LightShadow.js +14 -0
- package/src/lights/SpotLightShadow.js +9 -1
- package/src/lights/webgpu/ProjectorLight.js +46 -0
- package/src/loaders/BufferGeometryLoader.js +1 -10
- package/src/loaders/ImageBitmapLoader.js +21 -5
- package/src/loaders/ObjectLoader.js +44 -16
- package/src/loaders/nodes/NodeObjectLoader.js +2 -2
- package/src/materials/Material.js +1 -7
- package/src/materials/nodes/NodeMaterial.js +81 -18
- package/src/materials/nodes/manager/NodeMaterialObserver.js +20 -2
- package/src/math/Box3.js +28 -0
- package/src/math/Color.js +7 -7
- package/src/math/ColorManagement.js +22 -3
- package/src/math/FrustumArray.js +253 -0
- package/src/math/Ray.js +2 -0
- package/src/math/Sphere.js +28 -0
- package/src/nodes/Nodes.js +1 -0
- package/src/nodes/TSL.js +1 -0
- package/src/nodes/accessors/Bitangent.js +31 -9
- package/src/nodes/accessors/Camera.js +31 -4
- package/src/nodes/accessors/CubeTextureNode.js +50 -2
- package/src/nodes/accessors/InstanceNode.js +5 -4
- package/src/nodes/accessors/Lights.js +2 -2
- package/src/nodes/accessors/MaterialNode.js +4 -0
- package/src/nodes/accessors/ModelNode.js +1 -1
- package/src/nodes/accessors/Normal.js +26 -6
- package/src/nodes/accessors/Object3DNode.js +6 -7
- package/src/nodes/accessors/Position.js +14 -4
- package/src/nodes/accessors/ReferenceBaseNode.js +1 -1
- package/src/nodes/accessors/ReferenceNode.js +1 -1
- package/src/nodes/accessors/SkinningNode.js +3 -2
- package/src/nodes/accessors/StorageBufferNode.js +25 -0
- package/src/nodes/accessors/StorageTextureNode.js +14 -3
- package/src/nodes/accessors/TextureNode.js +59 -8
- package/src/nodes/accessors/VelocityNode.js +1 -0
- package/src/nodes/accessors/VertexColorNode.js +4 -4
- package/src/nodes/code/CodeNode.js +8 -11
- package/src/nodes/core/AssignNode.js +27 -5
- package/src/nodes/core/AttributeNode.js +2 -2
- package/src/nodes/core/CacheNode.js +14 -0
- package/src/nodes/core/ContextNode.js +7 -3
- package/src/nodes/core/Node.js +68 -19
- package/src/nodes/core/NodeBuilder.js +100 -12
- package/src/nodes/core/NodeUtils.js +42 -0
- package/src/nodes/core/NodeVarying.js +19 -1
- package/src/nodes/core/PropertyNode.js +8 -12
- package/src/nodes/core/StackNode.js +127 -2
- package/src/nodes/core/StructTypeNode.js +26 -4
- package/src/nodes/core/VarNode.js +11 -2
- package/src/nodes/core/VaryingNode.js +40 -21
- package/src/nodes/display/BlendModes.js +42 -1
- package/src/nodes/display/ColorSpaceNode.js +4 -27
- package/src/nodes/display/PassNode.js +8 -11
- package/src/nodes/functions/ShadowMaskModel.js +5 -1
- package/src/nodes/functions/material/getParallaxCorrectNormal.js +1 -1
- package/src/nodes/gpgpu/AtomicFunctionNode.js +28 -10
- package/src/nodes/gpgpu/BarrierNode.js +3 -3
- package/src/nodes/gpgpu/ComputeNode.js +1 -1
- package/src/nodes/lighting/AnalyticLightNode.js +7 -13
- package/src/nodes/lighting/HemisphereLightNode.js +2 -2
- package/src/nodes/lighting/IESSpotLightNode.js +2 -1
- package/src/nodes/lighting/LightsNode.js +25 -7
- package/src/nodes/lighting/ProjectorLightNode.js +78 -0
- package/src/nodes/lighting/ShadowBaseNode.js +1 -12
- package/src/nodes/lighting/ShadowFilterNode.js +274 -0
- package/src/nodes/lighting/ShadowNode.js +172 -240
- package/src/nodes/lighting/SpotLightNode.js +44 -7
- package/src/nodes/materialx/lib/mx_noise.js +1 -1
- package/src/nodes/math/MathNode.js +56 -20
- package/src/nodes/math/OperatorNode.js +109 -82
- package/src/nodes/shapes/Shapes.js +5 -4
- package/src/nodes/tsl/TSLCore.js +140 -49
- package/src/nodes/utils/DebugNode.js +15 -3
- package/src/nodes/utils/Discard.js +2 -2
- package/src/nodes/utils/LoopNode.js +64 -17
- package/src/nodes/utils/ReflectorNode.js +67 -4
- package/src/objects/BatchedMesh.js +16 -4
- package/src/objects/Mesh.js +9 -0
- package/src/objects/Skeleton.js +1 -1
- package/src/objects/Sprite.js +9 -0
- package/src/renderers/WebGL3DRenderTarget.js +1 -0
- package/src/renderers/WebGLArrayRenderTarget.js +1 -0
- package/src/renderers/WebGLCubeRenderTarget.js +2 -4
- package/src/renderers/WebGLRenderer.js +21 -10
- package/src/renderers/common/Animation.js +2 -2
- package/src/renderers/common/Background.js +11 -0
- package/src/renderers/common/RenderList.js +0 -4
- package/src/renderers/common/RenderObject.js +12 -1
- package/src/renderers/common/Renderer.js +116 -8
- package/src/renderers/common/Textures.js +15 -21
- package/src/renderers/common/TimestampQueryPool.js +1 -0
- package/src/renderers/common/Uniform.js +1 -1
- package/src/renderers/common/UniformsGroup.js +14 -18
- package/src/renderers/common/XRManager.js +154 -25
- package/src/renderers/common/extras/PMREMGenerator.js +29 -22
- package/src/renderers/common/nodes/Nodes.js +13 -3
- package/src/renderers/shaders/ShaderChunk/premultiplied_alpha_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderLib/background.glsl.js +1 -1
- package/src/renderers/webgl/WebGLShadowMap.js +3 -2
- package/src/renderers/webgl/WebGLTextures.js +143 -4
- package/src/renderers/webgl/WebGLUtils.js +1 -3
- package/src/renderers/webgl-fallback/WebGLBackend.js +170 -34
- package/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js +75 -7
- package/src/renderers/webgl-fallback/utils/WebGLConstants.js +1 -0
- package/src/renderers/webgl-fallback/utils/WebGLTextureUtils.js +42 -29
- package/src/renderers/webgl-fallback/utils/WebGLUtils.js +22 -21
- package/src/renderers/webgpu/WebGPUBackend.js +442 -127
- package/src/renderers/webgpu/WebGPURenderer.js +7 -0
- package/src/renderers/webgpu/nodes/BasicNodeLibrary.js +4 -1
- package/src/renderers/webgpu/nodes/StandardNodeLibrary.js +4 -1
- package/src/renderers/webgpu/nodes/WGSLNodeBuilder.js +75 -27
- package/src/renderers/webgpu/nodes/WGSLNodeFunction.js +3 -0
- package/src/renderers/webgpu/utils/WebGPUAttributeUtils.js +3 -1
- package/src/renderers/webgpu/utils/WebGPUBindingUtils.js +18 -5
- package/src/renderers/webgpu/utils/WebGPUConstants.js +1 -1
- package/src/renderers/webgpu/utils/WebGPUPipelineUtils.js +34 -4
- package/src/renderers/webgpu/utils/WebGPUTextureUtils.js +44 -49
- package/src/renderers/webxr/WebXRController.js +1 -1
- package/src/renderers/webxr/WebXRManager.js +2 -1
- package/src/textures/DepthTexture.js +6 -10
- package/src/textures/Source.js +22 -0
- package/src/textures/Texture.js +118 -1
- package/src/textures/VideoTexture.js +1 -1
- package/examples/jsm/effects/PeppersGhostEffect.js +0 -172
- package/src/core/RenderTargetArray.js +0 -40
package/src/objects/Sprite.js
CHANGED
|
@@ -108,6 +108,15 @@ class Sprite extends Object3D {
|
|
|
108
108
|
*/
|
|
109
109
|
this.center = new Vector2( 0.5, 0.5 );
|
|
110
110
|
|
|
111
|
+
/**
|
|
112
|
+
* The number of instances of this sprite.
|
|
113
|
+
* Can only be used with {@link WebGPURenderer}.
|
|
114
|
+
*
|
|
115
|
+
* @type {number}
|
|
116
|
+
* @default 1
|
|
117
|
+
*/
|
|
118
|
+
this.count = 1;
|
|
119
|
+
|
|
111
120
|
}
|
|
112
121
|
|
|
113
122
|
/**
|
|
@@ -41,7 +41,8 @@ class WebGLCubeRenderTarget extends WebGLRenderTarget {
|
|
|
41
41
|
*
|
|
42
42
|
* @type {DataArrayTexture}
|
|
43
43
|
*/
|
|
44
|
-
this.texture = new CubeTexture( images
|
|
44
|
+
this.texture = new CubeTexture( images );
|
|
45
|
+
this._setTextureOptions( options );
|
|
45
46
|
|
|
46
47
|
// By convention -- likely based on the RenderMan spec from the 1990's -- cube maps are specified by WebGL (and three.js)
|
|
47
48
|
// in a coordinate system in which positive-x is to the right when looking up the positive-z axis -- in other words,
|
|
@@ -53,9 +54,6 @@ class WebGLCubeRenderTarget extends WebGLRenderTarget {
|
|
|
53
54
|
|
|
54
55
|
this.texture.isRenderTargetTexture = true;
|
|
55
56
|
|
|
56
|
-
this.texture.generateMipmaps = options.generateMipmaps !== undefined ? options.generateMipmaps : false;
|
|
57
|
-
this.texture.minFilter = options.minFilter !== undefined ? options.minFilter : LinearFilter;
|
|
58
|
-
|
|
59
57
|
}
|
|
60
58
|
|
|
61
59
|
/**
|
|
@@ -1301,7 +1301,7 @@ class WebGLRenderer {
|
|
|
1301
1301
|
* @param {Object3D} scene - The scene or another type of 3D object to precompile.
|
|
1302
1302
|
* @param {Camera} camera - The camera.
|
|
1303
1303
|
* @param {?Scene} [targetScene=null] - The target scene.
|
|
1304
|
-
* @return {
|
|
1304
|
+
* @return {Set<Material>} The precompiled materials.
|
|
1305
1305
|
*/
|
|
1306
1306
|
this.compile = function ( scene, camera, targetScene = null ) {
|
|
1307
1307
|
|
|
@@ -2914,8 +2914,9 @@ class WebGLRenderer {
|
|
|
2914
2914
|
* @param {number} height - The height of the copy region.
|
|
2915
2915
|
* @param {TypedArray} buffer - The result buffer.
|
|
2916
2916
|
* @param {number} [activeCubeFaceIndex] - The active cube face index.
|
|
2917
|
+
* @param {number} [textureIndex=0] - The texture index of an MRT render target.
|
|
2917
2918
|
*/
|
|
2918
|
-
this.readRenderTargetPixels = function ( renderTarget, x, y, width, height, buffer, activeCubeFaceIndex ) {
|
|
2919
|
+
this.readRenderTargetPixels = function ( renderTarget, x, y, width, height, buffer, activeCubeFaceIndex, textureIndex = 0 ) {
|
|
2919
2920
|
|
|
2920
2921
|
if ( ! ( renderTarget && renderTarget.isWebGLRenderTarget ) ) {
|
|
2921
2922
|
|
|
@@ -2938,7 +2939,7 @@ class WebGLRenderer {
|
|
|
2938
2939
|
|
|
2939
2940
|
try {
|
|
2940
2941
|
|
|
2941
|
-
const texture = renderTarget.
|
|
2942
|
+
const texture = renderTarget.textures[ textureIndex ];
|
|
2942
2943
|
const textureFormat = texture.format;
|
|
2943
2944
|
const textureType = texture.type;
|
|
2944
2945
|
|
|
@@ -2960,6 +2961,10 @@ class WebGLRenderer {
|
|
|
2960
2961
|
|
|
2961
2962
|
if ( ( x >= 0 && x <= ( renderTarget.width - width ) ) && ( y >= 0 && y <= ( renderTarget.height - height ) ) ) {
|
|
2962
2963
|
|
|
2964
|
+
// when using MRT, select the corect color buffer for the subsequent read command
|
|
2965
|
+
|
|
2966
|
+
if ( renderTarget.textures.length > 1 ) _gl.readBuffer( _gl.COLOR_ATTACHMENT0 + textureIndex );
|
|
2967
|
+
|
|
2963
2968
|
_gl.readPixels( x, y, width, height, utils.convert( textureFormat ), utils.convert( textureType ), buffer );
|
|
2964
2969
|
|
|
2965
2970
|
}
|
|
@@ -2990,9 +2995,10 @@ class WebGLRenderer {
|
|
|
2990
2995
|
* @param {number} height - The height of the copy region.
|
|
2991
2996
|
* @param {TypedArray} buffer - The result buffer.
|
|
2992
2997
|
* @param {number} [activeCubeFaceIndex] - The active cube face index.
|
|
2998
|
+
* @param {number} [textureIndex=0] - The texture index of an MRT render target.
|
|
2993
2999
|
* @return {Promise<TypedArray>} A Promise that resolves when the read has been finished. The resolve provides the read data as a typed array.
|
|
2994
3000
|
*/
|
|
2995
|
-
this.readRenderTargetPixelsAsync = async function ( renderTarget, x, y, width, height, buffer, activeCubeFaceIndex ) {
|
|
3001
|
+
this.readRenderTargetPixelsAsync = async function ( renderTarget, x, y, width, height, buffer, activeCubeFaceIndex, textureIndex = 0 ) {
|
|
2996
3002
|
|
|
2997
3003
|
if ( ! ( renderTarget && renderTarget.isWebGLRenderTarget ) ) {
|
|
2998
3004
|
|
|
@@ -3015,7 +3021,7 @@ class WebGLRenderer {
|
|
|
3015
3021
|
// set the active frame buffer to the one we want to read
|
|
3016
3022
|
state.bindFramebuffer( _gl.FRAMEBUFFER, framebuffer );
|
|
3017
3023
|
|
|
3018
|
-
const texture = renderTarget.
|
|
3024
|
+
const texture = renderTarget.textures[ textureIndex ];
|
|
3019
3025
|
const textureFormat = texture.format;
|
|
3020
3026
|
const textureType = texture.type;
|
|
3021
3027
|
|
|
@@ -3034,6 +3040,11 @@ class WebGLRenderer {
|
|
|
3034
3040
|
const glBuffer = _gl.createBuffer();
|
|
3035
3041
|
_gl.bindBuffer( _gl.PIXEL_PACK_BUFFER, glBuffer );
|
|
3036
3042
|
_gl.bufferData( _gl.PIXEL_PACK_BUFFER, buffer.byteLength, _gl.STREAM_READ );
|
|
3043
|
+
|
|
3044
|
+
// when using MRT, select the corect color buffer for the subsequent read command
|
|
3045
|
+
|
|
3046
|
+
if ( renderTarget.textures.length > 1 ) _gl.readBuffer( _gl.COLOR_ATTACHMENT0 + textureIndex );
|
|
3047
|
+
|
|
3037
3048
|
_gl.readPixels( x, y, width, height, utils.convert( textureFormat ), utils.convert( textureType ), 0 );
|
|
3038
3049
|
|
|
3039
3050
|
// reset the frame buffer to the currently set buffer before waiting
|
|
@@ -3069,7 +3080,7 @@ class WebGLRenderer {
|
|
|
3069
3080
|
* Copies pixels from the current bound framebuffer into the given texture.
|
|
3070
3081
|
*
|
|
3071
3082
|
* @param {FramebufferTexture} texture - The texture.
|
|
3072
|
-
* @param {Vector2} position - The start position of the copy operation.
|
|
3083
|
+
* @param {?Vector2} [position=null] - The start position of the copy operation.
|
|
3073
3084
|
* @param {number} [level=0] - The mip level. The default represents the base mip.
|
|
3074
3085
|
*/
|
|
3075
3086
|
this.copyFramebufferToTexture = function ( texture, position = null, level = 0 ) {
|
|
@@ -3100,10 +3111,10 @@ class WebGLRenderer {
|
|
|
3100
3111
|
*
|
|
3101
3112
|
* @param {Texture} srcTexture - The source texture.
|
|
3102
3113
|
* @param {Texture} dstTexture - The destination texture.
|
|
3103
|
-
* @param {Box2|Box3} [srcRegion=null] - A bounding box which describes the source region. Can be two or three-dimensional.
|
|
3104
|
-
* @param {Vector2|Vector3} [dstPosition=null] - A vector that represents the origin of the destination region. Can be two or three-dimensional.
|
|
3105
|
-
* @param {number} srcLevel - The source mipmap level to copy.
|
|
3106
|
-
* @param {number} dstLevel - The destination mipmap level.
|
|
3114
|
+
* @param {?(Box2|Box3)} [srcRegion=null] - A bounding box which describes the source region. Can be two or three-dimensional.
|
|
3115
|
+
* @param {?(Vector2|Vector3)} [dstPosition=null] - A vector that represents the origin of the destination region. Can be two or three-dimensional.
|
|
3116
|
+
* @param {number} [srcLevel=0] - The source mipmap level to copy.
|
|
3117
|
+
* @param {?number} [dstLevel=null] - The destination mipmap level.
|
|
3107
3118
|
*/
|
|
3108
3119
|
this.copyTextureToTexture = function ( srcTexture, dstTexture, srcRegion = null, dstPosition = null, srcLevel = 0, dstLevel = null ) {
|
|
3109
3120
|
|
|
@@ -32,9 +32,9 @@ class Animation {
|
|
|
32
32
|
* A reference to the context from `requestAnimationFrame()` can
|
|
33
33
|
* be called (usually `window`).
|
|
34
34
|
*
|
|
35
|
-
* @type {Window|XRSession}
|
|
35
|
+
* @type {?(Window|XRSession)}
|
|
36
36
|
*/
|
|
37
|
-
this._context = self;
|
|
37
|
+
this._context = typeof self !== 'undefined' ? self : null;
|
|
38
38
|
|
|
39
39
|
/**
|
|
40
40
|
* The user-defined animation loop.
|
|
@@ -118,6 +118,17 @@ class Background extends DataMap {
|
|
|
118
118
|
|
|
119
119
|
};
|
|
120
120
|
|
|
121
|
+
function onBackgroundDispose() {
|
|
122
|
+
|
|
123
|
+
background.removeEventListener( 'dispose', onBackgroundDispose );
|
|
124
|
+
|
|
125
|
+
backgroundMesh.material.dispose();
|
|
126
|
+
backgroundMesh.geometry.dispose();
|
|
127
|
+
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
background.addEventListener( 'dispose', onBackgroundDispose );
|
|
131
|
+
|
|
121
132
|
}
|
|
122
133
|
|
|
123
134
|
const backgroundCacheKey = backgroundNode.getCacheKey();
|
|
@@ -509,7 +509,18 @@ class RenderObject {
|
|
|
509
509
|
|
|
510
510
|
const index = this.getIndex();
|
|
511
511
|
const hasIndex = ( index !== null );
|
|
512
|
-
|
|
512
|
+
|
|
513
|
+
let instanceCount = 1;
|
|
514
|
+
|
|
515
|
+
if ( geometry.isInstancedBufferGeometry === true ) {
|
|
516
|
+
|
|
517
|
+
instanceCount = geometry.instanceCount;
|
|
518
|
+
|
|
519
|
+
} else if ( object.count !== undefined ) {
|
|
520
|
+
|
|
521
|
+
instanceCount = Math.max( 0, object.count );
|
|
522
|
+
|
|
523
|
+
}
|
|
513
524
|
|
|
514
525
|
if ( instanceCount === 0 ) return null;
|
|
515
526
|
|
|
@@ -22,16 +22,21 @@ import NodeMaterial from '../../materials/nodes/NodeMaterial.js';
|
|
|
22
22
|
|
|
23
23
|
import { Scene } from '../../scenes/Scene.js';
|
|
24
24
|
import { Frustum } from '../../math/Frustum.js';
|
|
25
|
+
import { FrustumArray } from '../../math/FrustumArray.js';
|
|
25
26
|
import { Matrix4 } from '../../math/Matrix4.js';
|
|
26
27
|
import { Vector2 } from '../../math/Vector2.js';
|
|
27
28
|
import { Vector4 } from '../../math/Vector4.js';
|
|
28
29
|
import { RenderTarget } from '../../core/RenderTarget.js';
|
|
29
30
|
import { DoubleSide, BackSide, FrontSide, SRGBColorSpace, NoToneMapping, LinearFilter, LinearSRGBColorSpace, HalfFloatType, RGBAFormat, PCFShadowMap } from '../../constants.js';
|
|
30
31
|
|
|
32
|
+
import { highpModelNormalViewMatrix, highpModelViewMatrix } from '../../nodes/accessors/ModelNode.js';
|
|
33
|
+
|
|
31
34
|
const _scene = /*@__PURE__*/ new Scene();
|
|
32
35
|
const _drawingBufferSize = /*@__PURE__*/ new Vector2();
|
|
33
36
|
const _screen = /*@__PURE__*/ new Vector4();
|
|
34
37
|
const _frustum = /*@__PURE__*/ new Frustum();
|
|
38
|
+
const _frustumArray = /*@__PURE__*/ new FrustumArray();
|
|
39
|
+
|
|
35
40
|
const _projScreenMatrix = /*@__PURE__*/ new Matrix4();
|
|
36
41
|
const _vector4 = /*@__PURE__*/ new Vector4();
|
|
37
42
|
|
|
@@ -54,6 +59,7 @@ class Renderer {
|
|
|
54
59
|
* @property {?Function} [getFallback=null] - This callback function can be used to provide a fallback backend, if the primary backend can't be targeted.
|
|
55
60
|
* @property {number} [colorBufferType=HalfFloatType] - Defines the type of color buffers. The default `HalfFloatType` is recommend for best
|
|
56
61
|
* quality. To save memory and bandwidth, `UnsignedByteType` might be used. This will reduce rendering quality though.
|
|
62
|
+
* @property {boolean} [multiview=false] - If set to `true`, the renderer will use multiview during WebXR rendering if supported.
|
|
57
63
|
*/
|
|
58
64
|
|
|
59
65
|
/**
|
|
@@ -84,7 +90,8 @@ class Renderer {
|
|
|
84
90
|
antialias = false,
|
|
85
91
|
samples = 0,
|
|
86
92
|
getFallback = null,
|
|
87
|
-
colorBufferType = HalfFloatType
|
|
93
|
+
colorBufferType = HalfFloatType,
|
|
94
|
+
multiview = false
|
|
88
95
|
} = parameters;
|
|
89
96
|
|
|
90
97
|
/**
|
|
@@ -225,7 +232,15 @@ class Renderer {
|
|
|
225
232
|
*/
|
|
226
233
|
this.info = new Info();
|
|
227
234
|
|
|
228
|
-
|
|
235
|
+
/**
|
|
236
|
+
* Stores override nodes for specific transformations or calculations.
|
|
237
|
+
* These nodes can be used to replace default behavior in the rendering pipeline.
|
|
238
|
+
*
|
|
239
|
+
* @type {Object}
|
|
240
|
+
* @property {?Node} modelViewMatrix - An override node for the model-view matrix.
|
|
241
|
+
* @property {?Node} modelNormalViewMatrix - An override node for the model normal view matrix.
|
|
242
|
+
*/
|
|
243
|
+
this.overrideNodes = {
|
|
229
244
|
modelViewMatrix: null,
|
|
230
245
|
modelNormalViewMatrix: null
|
|
231
246
|
};
|
|
@@ -676,7 +691,7 @@ class Renderer {
|
|
|
676
691
|
*
|
|
677
692
|
* @type {XRManager}
|
|
678
693
|
*/
|
|
679
|
-
this.xr = new XRManager( this );
|
|
694
|
+
this.xr = new XRManager( this, multiview );
|
|
680
695
|
|
|
681
696
|
/**
|
|
682
697
|
* Debug configuration.
|
|
@@ -977,6 +992,43 @@ class Renderer {
|
|
|
977
992
|
|
|
978
993
|
}
|
|
979
994
|
|
|
995
|
+
/**
|
|
996
|
+
* Enables or disables high precision for model-view and normal-view matrices.
|
|
997
|
+
* When enabled, will use CPU 64-bit precision for higher precision instead of GPU 32-bit for higher performance.
|
|
998
|
+
*
|
|
999
|
+
* NOTE: 64-bit precision is not compatible with `InstancedMesh` and `SkinnedMesh`.
|
|
1000
|
+
*
|
|
1001
|
+
* @param {boolean} value - Whether to enable or disable high precision.
|
|
1002
|
+
* @type {boolean}
|
|
1003
|
+
*/
|
|
1004
|
+
set highPrecision( value ) {
|
|
1005
|
+
|
|
1006
|
+
if ( value === true ) {
|
|
1007
|
+
|
|
1008
|
+
this.overrideNodes.modelViewMatrix = highpModelViewMatrix;
|
|
1009
|
+
this.overrideNodes.modelNormalViewMatrix = highpModelNormalViewMatrix;
|
|
1010
|
+
|
|
1011
|
+
} else if ( this.highPrecision ) {
|
|
1012
|
+
|
|
1013
|
+
this.overrideNodes.modelViewMatrix = null;
|
|
1014
|
+
this.overrideNodes.modelNormalViewMatrix = null;
|
|
1015
|
+
|
|
1016
|
+
}
|
|
1017
|
+
|
|
1018
|
+
}
|
|
1019
|
+
|
|
1020
|
+
/**
|
|
1021
|
+
* Returns whether high precision is enabled or not.
|
|
1022
|
+
*
|
|
1023
|
+
* @return {boolean} Whether high precision is enabled or not.
|
|
1024
|
+
* @type {boolean}
|
|
1025
|
+
*/
|
|
1026
|
+
get highPrecision() {
|
|
1027
|
+
|
|
1028
|
+
return this.overrideNodes.modelViewMatrix === highpModelViewMatrix && this.overrideNodes.modelNormalViewMatrix === highpModelNormalViewMatrix;
|
|
1029
|
+
|
|
1030
|
+
}
|
|
1031
|
+
|
|
980
1032
|
/**
|
|
981
1033
|
* Sets the given MRT configuration.
|
|
982
1034
|
*
|
|
@@ -1187,14 +1239,28 @@ class Renderer {
|
|
|
1187
1239
|
|
|
1188
1240
|
}
|
|
1189
1241
|
|
|
1242
|
+
const outputRenderTarget = this.getOutputRenderTarget();
|
|
1243
|
+
|
|
1190
1244
|
frameBufferTarget.depthBuffer = depth;
|
|
1191
1245
|
frameBufferTarget.stencilBuffer = stencil;
|
|
1192
|
-
|
|
1246
|
+
if ( outputRenderTarget !== null ) {
|
|
1247
|
+
|
|
1248
|
+
frameBufferTarget.setSize( outputRenderTarget.width, outputRenderTarget.height, outputRenderTarget.depth );
|
|
1249
|
+
|
|
1250
|
+
} else {
|
|
1251
|
+
|
|
1252
|
+
frameBufferTarget.setSize( width, height, 1 );
|
|
1253
|
+
|
|
1254
|
+
}
|
|
1255
|
+
|
|
1193
1256
|
frameBufferTarget.viewport.copy( this._viewport );
|
|
1194
1257
|
frameBufferTarget.scissor.copy( this._scissor );
|
|
1195
1258
|
frameBufferTarget.viewport.multiplyScalar( this._pixelRatio );
|
|
1196
1259
|
frameBufferTarget.scissor.multiplyScalar( this._pixelRatio );
|
|
1197
1260
|
frameBufferTarget.scissorTest = this._scissorTest;
|
|
1261
|
+
frameBufferTarget.multiview = outputRenderTarget !== null ? outputRenderTarget.multiview : false;
|
|
1262
|
+
frameBufferTarget.resolveDepthBuffer = outputRenderTarget !== null ? outputRenderTarget.resolveDepthBuffer : true;
|
|
1263
|
+
frameBufferTarget.autoAllocateDepthBuffer = outputRenderTarget !== null ? outputRenderTarget.autoAllocateDepthBuffer : false;
|
|
1198
1264
|
|
|
1199
1265
|
return frameBufferTarget;
|
|
1200
1266
|
|
|
@@ -1341,8 +1407,14 @@ class Renderer {
|
|
|
1341
1407
|
|
|
1342
1408
|
//
|
|
1343
1409
|
|
|
1344
|
-
|
|
1345
|
-
|
|
1410
|
+
const frustum = camera.isArrayCamera ? _frustumArray : _frustum;
|
|
1411
|
+
|
|
1412
|
+
if ( ! camera.isArrayCamera ) {
|
|
1413
|
+
|
|
1414
|
+
_projScreenMatrix.multiplyMatrices( camera.projectionMatrix, camera.matrixWorldInverse );
|
|
1415
|
+
frustum.setFromProjectionMatrix( _projScreenMatrix, coordinateSystem );
|
|
1416
|
+
|
|
1417
|
+
}
|
|
1346
1418
|
|
|
1347
1419
|
const renderList = this._renderLists.get( scene, camera );
|
|
1348
1420
|
renderList.begin();
|
|
@@ -1396,6 +1468,7 @@ class Renderer {
|
|
|
1396
1468
|
|
|
1397
1469
|
//
|
|
1398
1470
|
|
|
1471
|
+
renderContext.camera = camera;
|
|
1399
1472
|
this.backend.beginRender( renderContext );
|
|
1400
1473
|
|
|
1401
1474
|
// process render lists
|
|
@@ -1443,6 +1516,15 @@ class Renderer {
|
|
|
1443
1516
|
|
|
1444
1517
|
}
|
|
1445
1518
|
|
|
1519
|
+
_setXRLayerSize( width, height ) {
|
|
1520
|
+
|
|
1521
|
+
this._width = width;
|
|
1522
|
+
this._height = height;
|
|
1523
|
+
|
|
1524
|
+
this.setViewport( 0, 0, width, height );
|
|
1525
|
+
|
|
1526
|
+
}
|
|
1527
|
+
|
|
1446
1528
|
/**
|
|
1447
1529
|
* The output pass performs tone mapping and color space conversion.
|
|
1448
1530
|
*
|
|
@@ -2163,6 +2245,21 @@ class Renderer {
|
|
|
2163
2245
|
|
|
2164
2246
|
}
|
|
2165
2247
|
|
|
2248
|
+
/**
|
|
2249
|
+
* Resets the renderer to the initial state before WebXR started.
|
|
2250
|
+
*
|
|
2251
|
+
*/
|
|
2252
|
+
_resetXRState() {
|
|
2253
|
+
|
|
2254
|
+
this.backend.setXRTarget( null );
|
|
2255
|
+
this.setOutputRenderTarget( null );
|
|
2256
|
+
this.setRenderTarget( null );
|
|
2257
|
+
|
|
2258
|
+
this._frameBufferTarget.dispose();
|
|
2259
|
+
this._frameBufferTarget = null;
|
|
2260
|
+
|
|
2261
|
+
}
|
|
2262
|
+
|
|
2166
2263
|
/**
|
|
2167
2264
|
* Callback for {@link Renderer#setRenderObjectFunction}.
|
|
2168
2265
|
*
|
|
@@ -2545,7 +2642,9 @@ class Renderer {
|
|
|
2545
2642
|
|
|
2546
2643
|
} else if ( object.isSprite ) {
|
|
2547
2644
|
|
|
2548
|
-
|
|
2645
|
+
const frustum = camera.isArrayCamera ? _frustumArray : _frustum;
|
|
2646
|
+
|
|
2647
|
+
if ( ! object.frustumCulled || frustum.intersectsSprite( object, camera ) ) {
|
|
2549
2648
|
|
|
2550
2649
|
if ( this.sortObjects === true ) {
|
|
2551
2650
|
|
|
@@ -2569,7 +2668,9 @@ class Renderer {
|
|
|
2569
2668
|
|
|
2570
2669
|
} else if ( object.isMesh || object.isLine || object.isPoints ) {
|
|
2571
2670
|
|
|
2572
|
-
|
|
2671
|
+
const frustum = camera.isArrayCamera ? _frustumArray : _frustum;
|
|
2672
|
+
|
|
2673
|
+
if ( ! object.frustumCulled || frustum.intersectsObject( object, camera ) ) {
|
|
2573
2674
|
|
|
2574
2675
|
const { geometry, material } = object;
|
|
2575
2676
|
|
|
@@ -2791,6 +2892,13 @@ class Renderer {
|
|
|
2791
2892
|
|
|
2792
2893
|
}
|
|
2793
2894
|
|
|
2895
|
+
if ( material.castShadowPositionNode && material.castShadowPositionNode.isNode ) {
|
|
2896
|
+
|
|
2897
|
+
overridePositionNode = overrideMaterial.positionNode;
|
|
2898
|
+
overrideMaterial.positionNode = material.castShadowPositionNode;
|
|
2899
|
+
|
|
2900
|
+
}
|
|
2901
|
+
|
|
2794
2902
|
}
|
|
2795
2903
|
|
|
2796
2904
|
material = overrideMaterial;
|
|
@@ -2,7 +2,7 @@ import DataMap from './DataMap.js';
|
|
|
2
2
|
|
|
3
3
|
import { Vector3 } from '../../math/Vector3.js';
|
|
4
4
|
import { DepthTexture } from '../../textures/DepthTexture.js';
|
|
5
|
-
import { DepthStencilFormat, DepthFormat, UnsignedIntType, UnsignedInt248Type,
|
|
5
|
+
import { DepthStencilFormat, DepthFormat, UnsignedIntType, UnsignedInt248Type, UnsignedByteType } from '../../constants.js';
|
|
6
6
|
|
|
7
7
|
const _size = /*@__PURE__*/ new Vector3();
|
|
8
8
|
|
|
@@ -77,10 +77,13 @@ class Textures extends DataMap {
|
|
|
77
77
|
if ( depthTexture === undefined && useDepthTexture ) {
|
|
78
78
|
|
|
79
79
|
depthTexture = new DepthTexture();
|
|
80
|
+
|
|
80
81
|
depthTexture.format = renderTarget.stencilBuffer ? DepthStencilFormat : DepthFormat;
|
|
81
82
|
depthTexture.type = renderTarget.stencilBuffer ? UnsignedInt248Type : UnsignedIntType; // FloatType
|
|
82
83
|
depthTexture.image.width = mipWidth;
|
|
83
84
|
depthTexture.image.height = mipHeight;
|
|
85
|
+
depthTexture.image.depth = size.depth;
|
|
86
|
+
depthTexture.isArrayTexture = renderTarget.multiview === true && size.depth > 1;
|
|
84
87
|
|
|
85
88
|
depthTextureMips[ activeMipmapLevel ] = depthTexture;
|
|
86
89
|
|
|
@@ -95,6 +98,7 @@ class Textures extends DataMap {
|
|
|
95
98
|
depthTexture.needsUpdate = true;
|
|
96
99
|
depthTexture.image.width = mipWidth;
|
|
97
100
|
depthTexture.image.height = mipHeight;
|
|
101
|
+
depthTexture.image.depth = depthTexture.isArrayTexture ? depthTexture.image.depth : 1;
|
|
98
102
|
|
|
99
103
|
}
|
|
100
104
|
|
|
@@ -330,8 +334,6 @@ class Textures extends DataMap {
|
|
|
330
334
|
|
|
331
335
|
this._destroyTexture( texture );
|
|
332
336
|
|
|
333
|
-
this.info.memory.textures --;
|
|
334
|
-
|
|
335
337
|
};
|
|
336
338
|
|
|
337
339
|
texture.addEventListener( 'dispose', onDispose );
|
|
@@ -420,21 +422,7 @@ class Textures extends DataMap {
|
|
|
420
422
|
*/
|
|
421
423
|
needsMipmaps( texture ) {
|
|
422
424
|
|
|
423
|
-
return
|
|
424
|
-
|
|
425
|
-
}
|
|
426
|
-
|
|
427
|
-
/**
|
|
428
|
-
* Returns `true` if the given texture is an environment map.
|
|
429
|
-
*
|
|
430
|
-
* @param {Texture} texture - The texture.
|
|
431
|
-
* @return {boolean} Whether the given texture is an environment map or not.
|
|
432
|
-
*/
|
|
433
|
-
isEnvironmentTexture( texture ) {
|
|
434
|
-
|
|
435
|
-
const mapping = texture.mapping;
|
|
436
|
-
|
|
437
|
-
return ( mapping === EquirectangularReflectionMapping || mapping === EquirectangularRefractionMapping ) || ( mapping === CubeReflectionMapping || mapping === CubeRefractionMapping );
|
|
425
|
+
return texture.isCompressedTexture === true || texture.generateMipmaps;
|
|
438
426
|
|
|
439
427
|
}
|
|
440
428
|
|
|
@@ -446,10 +434,16 @@ class Textures extends DataMap {
|
|
|
446
434
|
*/
|
|
447
435
|
_destroyTexture( texture ) {
|
|
448
436
|
|
|
449
|
-
this.
|
|
450
|
-
|
|
437
|
+
if ( this.has( texture ) === true ) {
|
|
438
|
+
|
|
439
|
+
this.backend.destroySampler( texture );
|
|
440
|
+
this.backend.destroyTexture( texture );
|
|
451
441
|
|
|
452
|
-
|
|
442
|
+
this.delete( texture );
|
|
443
|
+
|
|
444
|
+
this.info.memory.textures --;
|
|
445
|
+
|
|
446
|
+
}
|
|
453
447
|
|
|
454
448
|
}
|
|
455
449
|
|
|
@@ -129,38 +129,34 @@ class UniformsGroup extends UniformBuffer {
|
|
|
129
129
|
*/
|
|
130
130
|
get byteLength() {
|
|
131
131
|
|
|
132
|
+
const bytesPerElement = this.bytesPerElement;
|
|
133
|
+
|
|
132
134
|
let offset = 0; // global buffer offset in bytes
|
|
133
135
|
|
|
134
136
|
for ( let i = 0, l = this.uniforms.length; i < l; i ++ ) {
|
|
135
137
|
|
|
136
138
|
const uniform = this.uniforms[ i ];
|
|
137
139
|
|
|
138
|
-
const
|
|
139
|
-
|
|
140
|
-
// offset within a single chunk in bytes
|
|
141
|
-
|
|
142
|
-
const chunkOffset = offset % GPU_CHUNK_BYTES;
|
|
143
|
-
const remainingSizeInChunk = GPU_CHUNK_BYTES - chunkOffset;
|
|
144
|
-
|
|
145
|
-
// conformance tests
|
|
146
|
-
|
|
147
|
-
if ( chunkOffset !== 0 && ( remainingSizeInChunk - boundary ) < 0 ) {
|
|
148
|
-
|
|
149
|
-
// check for chunk overflow
|
|
140
|
+
const boundary = uniform.boundary;
|
|
141
|
+
const itemSize = uniform.itemSize * bytesPerElement; // size of the uniform in bytes
|
|
150
142
|
|
|
151
|
-
|
|
143
|
+
const chunkOffset = offset % GPU_CHUNK_BYTES; // offset in the current chunk
|
|
144
|
+
const chunkPadding = chunkOffset % boundary; // required padding to match boundary
|
|
145
|
+
const chunkStart = chunkOffset + chunkPadding; // start position in the current chunk for the data
|
|
152
146
|
|
|
153
|
-
|
|
147
|
+
offset += chunkPadding;
|
|
154
148
|
|
|
155
|
-
|
|
149
|
+
// Check for chunk overflow
|
|
150
|
+
if ( chunkStart !== 0 && ( GPU_CHUNK_BYTES - chunkStart ) < itemSize ) {
|
|
156
151
|
|
|
157
|
-
|
|
152
|
+
// Add padding to the end of the chunk
|
|
153
|
+
offset += ( GPU_CHUNK_BYTES - chunkStart );
|
|
158
154
|
|
|
159
155
|
}
|
|
160
156
|
|
|
161
|
-
uniform.offset =
|
|
157
|
+
uniform.offset = offset / bytesPerElement;
|
|
162
158
|
|
|
163
|
-
offset +=
|
|
159
|
+
offset += itemSize;
|
|
164
160
|
|
|
165
161
|
}
|
|
166
162
|
|