super-three 0.179.0 → 0.184.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/LICENSE +1 -1
- package/README.md +3 -4
- package/build/three.cjs +14522 -12207
- package/build/three.core.js +12005 -10954
- package/build/three.core.min.js +2 -2
- package/build/three.module.js +2270 -1005
- package/build/three.module.min.js +2 -2
- package/build/three.tsl.js +63 -18
- package/build/three.tsl.min.js +2 -2
- package/build/three.webgpu.js +16573 -7890
- package/build/three.webgpu.min.js +2 -2
- package/build/three.webgpu.nodes.js +16533 -7888
- package/build/three.webgpu.nodes.min.js +2 -2
- package/examples/fonts/MPLUSRounded1c/MPLUSRounded1c-Regular.typeface.json.zip +0 -0
- package/examples/fonts/MPLUSRounded1c/OFL.txt +91 -0
- package/examples/jsm/Addons.js +12 -4
- package/examples/jsm/animation/CCDIKSolver.js +8 -4
- package/examples/jsm/controls/ArcballControls.js +15 -12
- package/examples/jsm/controls/DragControls.js +9 -59
- package/examples/jsm/controls/FirstPersonControls.js +61 -57
- package/examples/jsm/controls/FlyControls.js +5 -1
- package/examples/jsm/controls/MapControls.js +55 -1
- package/examples/jsm/controls/OrbitControls.js +113 -10
- package/examples/jsm/controls/PointerLockControls.js +2 -10
- package/examples/jsm/controls/TrackballControls.js +9 -9
- package/examples/jsm/controls/TransformControls.js +35 -3
- package/examples/jsm/csm/CSM.js +2 -1
- package/examples/jsm/csm/CSMShadowNode.js +6 -2
- package/examples/jsm/effects/AnaglyphEffect.js +102 -7
- package/examples/jsm/effects/AsciiEffect.js +8 -8
- package/examples/jsm/environments/ColorEnvironment.js +59 -0
- package/examples/jsm/environments/RoomEnvironment.js +3 -0
- package/examples/jsm/exporters/DRACOExporter.js +2 -2
- package/examples/jsm/exporters/EXRExporter.js +2 -2
- package/examples/jsm/exporters/GLTFExporter.js +185 -34
- package/examples/jsm/exporters/KTX2Exporter.js +4 -2
- package/examples/jsm/exporters/PLYExporter.js +1 -1
- package/examples/jsm/exporters/USDZExporter.js +31 -5
- package/examples/jsm/geometries/DecalGeometry.js +3 -3
- package/examples/jsm/geometries/ParametricGeometry.js +1 -1
- package/examples/jsm/geometries/TeapotGeometry.js +2 -2
- package/examples/jsm/geometries/TextGeometry.js +21 -2
- package/examples/jsm/gpgpu/BitonicSort.js +715 -0
- package/examples/jsm/helpers/AnimationPathHelper.js +302 -0
- package/examples/jsm/helpers/LightProbeGridHelper.js +221 -0
- package/examples/jsm/helpers/LightProbeHelperGPU.js +1 -1
- package/examples/jsm/helpers/TextureHelperGPU.js +1 -1
- package/examples/jsm/helpers/ViewHelper.js +110 -13
- package/examples/jsm/inspector/Extension.js +13 -0
- package/examples/jsm/inspector/Inspector.js +542 -0
- package/examples/jsm/inspector/RendererInspector.js +425 -0
- package/examples/jsm/inspector/extensions/extensions.json +6 -0
- package/examples/jsm/inspector/extensions/tsl-graph/TSLGraphEditor.js +916 -0
- package/examples/jsm/inspector/extensions/tsl-graph/TSLGraphLoader.js +281 -0
- package/examples/jsm/inspector/tabs/Console.js +238 -0
- package/examples/jsm/inspector/tabs/Memory.js +128 -0
- package/examples/jsm/inspector/tabs/Parameters.js +380 -0
- package/examples/jsm/inspector/tabs/Performance.js +268 -0
- package/examples/jsm/inspector/tabs/Settings.js +264 -0
- package/examples/jsm/inspector/tabs/Timeline.js +1611 -0
- package/examples/jsm/inspector/tabs/Viewer.js +268 -0
- package/examples/jsm/inspector/ui/Graph.js +95 -0
- package/examples/jsm/inspector/ui/Item.js +170 -0
- package/examples/jsm/inspector/ui/List.js +75 -0
- package/examples/jsm/inspector/ui/Profiler.js +2072 -0
- package/examples/jsm/inspector/ui/Style.js +1667 -0
- package/examples/jsm/inspector/ui/Tab.js +265 -0
- package/examples/jsm/inspector/ui/Values.js +476 -0
- package/examples/jsm/inspector/ui/utils.js +69 -0
- package/examples/jsm/interaction/InteractionManager.js +226 -0
- package/examples/jsm/interactive/HTMLMesh.js +6 -10
- package/examples/jsm/interactive/InteractiveGroup.js +1 -1
- package/examples/jsm/interactive/SelectionBox.js +30 -0
- package/examples/jsm/libs/ktx-parse.module.js +1 -1
- package/examples/jsm/libs/meshopt_decoder.module.js +9 -8
- package/examples/jsm/lighting/DynamicLighting.js +82 -0
- package/examples/jsm/lighting/LightProbeGrid.js +651 -0
- package/examples/jsm/lights/RectAreaLightTexturesLib.js +1 -1
- package/examples/jsm/lines/Line2.js +3 -3
- package/examples/jsm/lines/LineGeometry.js +1 -1
- package/examples/jsm/lines/LineMaterial.js +7 -1
- package/examples/jsm/lines/LineSegments2.js +2 -2
- package/examples/jsm/lines/Wireframe.js +2 -2
- package/examples/jsm/lines/WireframeGeometry2.js +1 -1
- package/examples/jsm/lines/webgpu/LineSegments2.js +1 -1
- package/examples/jsm/lines/webgpu/Wireframe.js +1 -1
- package/examples/jsm/loaders/3DMLoader.js +5 -4
- package/examples/jsm/loaders/3MFLoader.js +3 -3
- package/examples/jsm/loaders/AMFLoader.js +2 -2
- package/examples/jsm/loaders/ColladaLoader.js +27 -4029
- package/examples/jsm/loaders/DDSLoader.js +1 -1
- package/examples/jsm/loaders/DRACOLoader.js +73 -22
- package/examples/jsm/loaders/EXRLoader.js +692 -53
- package/examples/jsm/loaders/FBXLoader.js +237 -39
- package/examples/jsm/loaders/FontLoader.js +23 -5
- package/examples/jsm/loaders/GCodeLoader.js +34 -8
- package/examples/jsm/loaders/GLTFLoader.js +159 -185
- package/examples/jsm/loaders/HDRCubeTextureLoader.js +5 -5
- package/examples/jsm/loaders/HDRLoader.js +485 -0
- package/examples/jsm/loaders/KMZLoader.js +5 -5
- package/examples/jsm/loaders/KTX2Loader.js +162 -53
- package/examples/jsm/loaders/KTXLoader.js +2 -2
- package/examples/jsm/loaders/LDrawLoader.js +41 -50
- package/examples/jsm/loaders/LUT3dlLoader.js +2 -2
- package/examples/jsm/loaders/LUTCubeLoader.js +1 -1
- package/examples/jsm/loaders/LWOLoader.js +9 -41
- package/examples/jsm/loaders/MaterialXLoader.js +22 -5
- package/examples/jsm/loaders/NRRDLoader.js +2 -2
- package/examples/jsm/loaders/OBJLoader.js +1 -1
- package/examples/jsm/loaders/PCDLoader.js +4 -2
- package/examples/jsm/loaders/PDBLoader.js +1 -1
- package/examples/jsm/loaders/RGBELoader.js +7 -473
- package/examples/jsm/loaders/SVGLoader.js +4 -4
- package/examples/jsm/loaders/TDSLoader.js +0 -2
- package/examples/jsm/loaders/TGALoader.js +0 -2
- package/examples/jsm/loaders/TTFLoader.js +4 -4
- package/examples/jsm/loaders/USDLoader.js +100 -40
- package/examples/jsm/loaders/UltraHDRLoader.js +287 -162
- package/examples/jsm/loaders/VOXLoader.js +660 -117
- package/examples/jsm/loaders/VRMLLoader.js +79 -2
- package/examples/jsm/loaders/VTKLoader.js +42 -25
- package/examples/jsm/loaders/collada/ColladaComposer.js +3044 -0
- package/examples/jsm/loaders/collada/ColladaParser.js +1977 -0
- package/examples/jsm/loaders/lwo/IFFParser.js +1 -1
- package/examples/jsm/loaders/usd/USDAParser.js +450 -363
- package/examples/jsm/loaders/usd/USDCParser.js +1867 -6
- package/examples/jsm/loaders/usd/USDComposer.js +4594 -0
- package/examples/jsm/materials/LDrawConditionalLineNodeMaterial.js +2 -2
- package/examples/jsm/materials/WoodNodeMaterial.js +533 -0
- package/examples/jsm/math/ColorSpaces.js +19 -1
- package/examples/jsm/math/ConvexHull.js +3 -3
- package/examples/jsm/math/ImprovedNoise.js +1 -1
- package/examples/jsm/math/Lut.js +2 -2
- package/examples/jsm/math/Octree.js +131 -1
- package/examples/jsm/math/SimplexNoise.js +1 -1
- package/examples/jsm/misc/GPUComputationRenderer.js +2 -0
- package/examples/jsm/misc/MD2CharacterComplex.js +1 -1
- package/examples/jsm/misc/ProgressiveLightMap.js +9 -3
- package/examples/jsm/misc/ProgressiveLightMapGPU.js +7 -1
- package/examples/jsm/misc/RollerCoaster.js +42 -4
- package/examples/jsm/misc/TubePainter.js +383 -40
- package/examples/jsm/misc/Volume.js +1 -2
- package/examples/jsm/misc/VolumeSlice.js +0 -1
- package/examples/jsm/modifiers/SimplifyModifier.js +1 -1
- package/examples/jsm/modifiers/TessellateModifier.js +1 -1
- package/examples/jsm/objects/LensflareMesh.js +1 -1
- package/examples/jsm/objects/Reflector.js +73 -25
- package/examples/jsm/objects/ReflectorForSSRPass.js +1 -0
- package/examples/jsm/objects/Sky.js +91 -7
- package/examples/jsm/objects/SkyMesh.js +151 -17
- package/examples/jsm/objects/Water.js +7 -6
- package/examples/jsm/objects/Water2.js +5 -3
- package/examples/jsm/objects/WaterMesh.js +11 -13
- package/examples/jsm/physics/AmmoPhysics.js +12 -7
- package/examples/jsm/physics/JoltPhysics.js +10 -6
- package/examples/jsm/physics/RapierPhysics.js +9 -5
- package/examples/jsm/postprocessing/EffectComposer.js +7 -5
- package/examples/jsm/postprocessing/GlitchPass.js +2 -2
- package/examples/jsm/postprocessing/OutlinePass.js +1 -1
- package/examples/jsm/postprocessing/OutputPass.js +9 -0
- package/examples/jsm/postprocessing/RenderPass.js +10 -0
- package/examples/jsm/postprocessing/RenderTransitionPass.js +1 -1
- package/examples/jsm/postprocessing/SSRPass.js +37 -8
- package/examples/jsm/postprocessing/UnrealBloomPass.js +56 -24
- package/examples/jsm/renderers/CSS2DRenderer.js +16 -5
- package/examples/jsm/renderers/CSS3DRenderer.js +8 -7
- package/examples/jsm/renderers/Projector.js +246 -28
- package/examples/jsm/renderers/SVGRenderer.js +175 -61
- package/examples/jsm/shaders/ACESFilmicToneMappingShader.js +1 -1
- package/examples/jsm/shaders/AfterimageShader.js +1 -1
- package/examples/jsm/shaders/BleachBypassShader.js +1 -1
- package/examples/jsm/shaders/BokehShader.js +1 -1
- package/examples/jsm/shaders/BokehShader2.js +1 -1
- package/examples/jsm/shaders/DotScreenShader.js +1 -1
- package/examples/jsm/shaders/FocusShader.js +1 -1
- package/examples/jsm/shaders/GTAOShader.js +21 -8
- package/examples/jsm/shaders/HalftoneShader.js +12 -1
- package/examples/jsm/shaders/KaleidoShader.js +1 -1
- package/examples/jsm/shaders/PoissonDenoiseShader.js +8 -4
- package/examples/jsm/shaders/SAOShader.js +17 -4
- package/examples/jsm/shaders/SSAOShader.js +11 -1
- package/examples/jsm/shaders/SSRShader.js +7 -6
- package/examples/jsm/shaders/SepiaShader.js +1 -1
- package/examples/jsm/shaders/SubsurfaceScatteringShader.js +1 -1
- package/examples/jsm/shaders/TriangleBlurShader.js +1 -1
- package/examples/jsm/shaders/UnpackDepthRGBAShader.js +3 -5
- package/examples/jsm/shaders/VignetteShader.js +1 -1
- package/examples/jsm/transpiler/AST.js +44 -0
- package/examples/jsm/transpiler/GLSLDecoder.js +85 -25
- package/examples/jsm/transpiler/ShaderToyDecoder.js +2 -0
- package/examples/jsm/transpiler/TSLEncoder.js +52 -10
- package/examples/jsm/transpiler/TranspilerUtils.js +3 -3
- package/examples/jsm/transpiler/WGSLEncoder.js +51 -0
- package/examples/jsm/tsl/WebGLNodesHandler.js +605 -0
- package/examples/jsm/tsl/display/AfterImageNode.js +36 -24
- package/examples/jsm/tsl/display/AnaglyphPassNode.js +458 -16
- package/examples/jsm/tsl/display/AnamorphicNode.js +40 -5
- package/examples/jsm/tsl/display/BilateralBlurNode.js +374 -0
- package/examples/jsm/tsl/display/BloomNode.js +23 -9
- package/examples/jsm/tsl/display/CRT.js +150 -0
- package/examples/jsm/tsl/display/ChromaticAberrationNode.js +5 -37
- package/examples/jsm/tsl/display/DenoiseNode.js +3 -1
- package/examples/jsm/tsl/display/DepthOfFieldNode.js +446 -90
- package/examples/jsm/tsl/display/DotScreenNode.js +1 -1
- package/examples/jsm/tsl/display/FSR1Node.js +477 -0
- package/examples/jsm/tsl/display/FXAANode.js +2 -2
- package/examples/jsm/tsl/display/GTAONode.js +59 -9
- package/examples/jsm/tsl/display/GaussianBlurNode.js +68 -35
- package/examples/jsm/tsl/display/GodraysNode.js +615 -0
- package/examples/jsm/tsl/display/LensflareNode.js +1 -1
- package/examples/jsm/tsl/display/Lut3DNode.js +1 -1
- package/examples/jsm/tsl/display/OutlineNode.js +81 -20
- package/examples/jsm/tsl/display/ParallaxBarrierPassNode.js +2 -2
- package/examples/jsm/tsl/display/PixelationPassNode.js +7 -6
- package/examples/jsm/tsl/display/RGBShiftNode.js +2 -2
- package/examples/jsm/tsl/display/RetroPassNode.js +263 -0
- package/examples/jsm/tsl/display/SMAANode.js +2 -2
- package/examples/jsm/tsl/display/SSAAPassNode.js +2 -2
- package/examples/jsm/tsl/display/SSGINode.js +638 -0
- package/examples/jsm/tsl/display/SSRNode.js +186 -69
- package/examples/jsm/tsl/display/SSSNode.js +490 -0
- package/examples/jsm/tsl/display/Shape.js +29 -0
- package/examples/jsm/tsl/display/SharpenNode.js +283 -0
- package/examples/jsm/tsl/display/SobelOperatorNode.js +2 -2
- package/examples/jsm/tsl/display/StereoCompositePassNode.js +8 -1
- package/examples/jsm/tsl/display/StereoPassNode.js +1 -2
- package/examples/jsm/tsl/display/TAAUNode.js +835 -0
- package/examples/jsm/tsl/display/TRAANode.js +381 -75
- package/examples/jsm/tsl/display/TransitionNode.js +1 -1
- package/examples/jsm/tsl/display/boxBlur.js +65 -0
- package/examples/jsm/tsl/display/depthAwareBlend.js +80 -0
- package/examples/jsm/tsl/display/hashBlur.js +16 -18
- package/examples/jsm/tsl/display/radialBlur.js +68 -0
- package/examples/jsm/tsl/lighting/DynamicLightsNode.js +300 -0
- package/examples/jsm/tsl/lighting/TiledLightsNode.js +21 -1
- package/examples/jsm/tsl/lighting/data/AmbientLightDataNode.js +61 -0
- package/examples/jsm/tsl/lighting/data/DirectionalLightDataNode.js +111 -0
- package/examples/jsm/tsl/lighting/data/HemisphereLightDataNode.js +99 -0
- package/examples/jsm/tsl/lighting/data/PointLightDataNode.js +134 -0
- package/examples/jsm/tsl/lighting/data/SpotLightDataNode.js +161 -0
- package/examples/jsm/tsl/math/Bayer.js +53 -3
- package/examples/jsm/utils/BufferGeometryUtils.js +3 -4
- package/examples/jsm/utils/ColorUtils.js +76 -0
- package/examples/jsm/utils/LDrawUtils.js +1 -1
- package/examples/jsm/utils/ShadowMapViewer.js +24 -10
- package/examples/jsm/utils/ShadowMapViewerGPU.js +13 -6
- package/examples/jsm/utils/SkeletonUtils.js +14 -8
- package/examples/jsm/utils/WebGPUTextureUtils.js +1 -1
- package/examples/jsm/webxr/OculusHandModel.js +1 -1
- package/examples/jsm/webxr/XRControllerModelFactory.js +1 -1
- package/examples/jsm/webxr/XRHandMeshModel.js +36 -10
- package/examples/jsm/webxr/XRHandModelFactory.js +4 -7
- package/package.json +27 -38
- package/src/Three.Core.js +7 -3
- package/src/Three.TSL.js +61 -16
- package/src/Three.WebGPU.Nodes.js +7 -0
- package/src/Three.WebGPU.js +11 -0
- package/src/Three.js +1 -0
- package/src/animation/AnimationAction.js +12 -2
- package/src/animation/AnimationClip.js +21 -5
- package/src/animation/AnimationMixer.js +9 -3
- package/src/animation/AnimationObjectGroup.js +2 -1
- package/src/animation/AnimationUtils.js +1 -12
- package/src/animation/KeyframeTrack.js +54 -14
- package/src/animation/PropertyBinding.js +12 -11
- package/src/animation/PropertyMixer.js +4 -4
- package/src/animation/tracks/BooleanKeyframeTrack.js +1 -1
- package/src/animation/tracks/ColorKeyframeTrack.js +1 -1
- package/src/animation/tracks/NumberKeyframeTrack.js +1 -1
- package/src/animation/tracks/QuaternionKeyframeTrack.js +1 -1
- package/src/animation/tracks/StringKeyframeTrack.js +1 -1
- package/src/animation/tracks/VectorKeyframeTrack.js +1 -1
- package/src/audio/Audio.js +11 -10
- package/src/audio/AudioContext.js +2 -2
- package/src/audio/AudioListener.js +5 -3
- package/src/audio/PositionalAudio.js +1 -1
- package/src/cameras/Camera.js +32 -2
- package/src/cameras/CubeCamera.js +20 -0
- package/src/cameras/OrthographicCamera.js +1 -1
- package/src/cameras/PerspectiveCamera.js +1 -1
- package/src/cameras/StereoCamera.js +2 -2
- package/src/constants.js +100 -7
- package/src/core/BufferAttribute.js +13 -1
- package/src/core/BufferGeometry.js +24 -12
- package/src/core/Clock.js +7 -0
- package/src/core/EventDispatcher.js +1 -1
- package/src/core/InterleavedBuffer.js +1 -1
- package/src/core/InterleavedBufferAttribute.js +3 -2
- package/src/core/Object3D.js +55 -6
- package/src/core/Raycaster.js +4 -3
- package/src/core/RenderTarget.js +14 -5
- package/src/extras/Controls.js +5 -4
- package/src/extras/DataUtils.js +2 -1
- package/src/extras/Earcut.js +6 -0
- package/src/extras/ImageUtils.js +2 -2
- package/src/extras/PMREMGenerator.js +259 -57
- package/src/extras/TextureUtils.js +6 -1
- package/src/extras/core/Curve.js +2 -1
- package/src/extras/core/Interpolations.js +7 -1
- package/src/extras/core/ShapePath.js +4 -4
- package/src/extras/curves/CatmullRomCurve3.js +3 -2
- package/src/extras/lib/earcut.js +8 -8
- package/src/geometries/BoxGeometry.js +1 -0
- package/src/geometries/CapsuleGeometry.js +1 -0
- package/src/geometries/CircleGeometry.js +1 -0
- package/src/geometries/ConeGeometry.js +1 -0
- package/src/geometries/CylinderGeometry.js +1 -0
- package/src/geometries/DodecahedronGeometry.js +1 -0
- package/src/geometries/ExtrudeGeometry.js +10 -8
- package/src/geometries/IcosahedronGeometry.js +1 -0
- package/src/geometries/LatheGeometry.js +1 -0
- package/src/geometries/OctahedronGeometry.js +1 -0
- package/src/geometries/PlaneGeometry.js +1 -0
- package/src/geometries/PolyhedronGeometry.js +1 -1
- package/src/geometries/RingGeometry.js +1 -0
- package/src/geometries/ShapeGeometry.js +1 -0
- package/src/geometries/SphereGeometry.js +1 -0
- package/src/geometries/TetrahedronGeometry.js +1 -0
- package/src/geometries/TorusGeometry.js +9 -3
- package/src/geometries/TorusKnotGeometry.js +1 -0
- package/src/geometries/TubeGeometry.js +1 -0
- package/src/helpers/CameraHelper.js +4 -1
- package/src/helpers/DirectionalLightHelper.js +4 -1
- package/src/helpers/HemisphereLightHelper.js +3 -0
- package/src/helpers/PointLightHelper.js +1 -25
- package/src/helpers/SpotLightHelper.js +3 -0
- package/src/lights/DirectionalLight.js +13 -0
- package/src/lights/HemisphereLight.js +10 -0
- package/src/lights/Light.js +1 -11
- package/src/lights/LightProbe.js +0 -15
- package/src/lights/LightShadow.js +15 -6
- package/src/lights/PointLight.js +15 -0
- package/src/lights/PointLightShadow.js +0 -86
- package/src/lights/SpotLight.js +22 -1
- package/src/lights/webgpu/IESSpotLight.js +2 -1
- package/src/lights/webgpu/ProjectorLight.js +1 -1
- package/src/loaders/AnimationLoader.js +2 -1
- package/src/loaders/AudioLoader.js +13 -2
- package/src/loaders/BufferGeometryLoader.js +2 -2
- package/src/loaders/Cache.js +30 -2
- package/src/loaders/DataTextureLoader.js +6 -4
- package/src/loaders/FileLoader.js +4 -4
- package/src/loaders/ImageBitmapLoader.js +17 -13
- package/src/loaders/ImageLoader.js +1 -1
- package/src/loaders/Loader.js +9 -3
- package/src/loaders/LoadingManager.js +25 -3
- package/src/loaders/MaterialLoader.js +6 -4
- package/src/loaders/ObjectLoader.js +57 -17
- package/src/loaders/TextureLoader.js +1 -1
- package/src/loaders/nodes/NodeLoader.js +5 -4
- package/src/loaders/nodes/NodeObjectLoader.js +18 -0
- package/src/materials/Material.js +18 -3
- package/src/materials/MeshBasicMaterial.js +1 -0
- package/src/materials/MeshDepthMaterial.js +1 -0
- package/src/materials/MeshDistanceMaterial.js +1 -1
- package/src/materials/MeshLambertMaterial.js +11 -1
- package/src/materials/MeshMatcapMaterial.js +22 -0
- package/src/materials/MeshNormalMaterial.js +1 -0
- package/src/materials/MeshPhongMaterial.js +11 -1
- package/src/materials/MeshPhysicalMaterial.js +2 -1
- package/src/materials/MeshStandardMaterial.js +8 -7
- package/src/materials/MeshToonMaterial.js +2 -1
- package/src/materials/PointsMaterial.js +1 -1
- package/src/materials/ShaderMaterial.js +22 -3
- package/src/materials/nodes/Line2NodeMaterial.js +36 -9
- package/src/materials/nodes/MeshPhysicalNodeMaterial.js +5 -2
- package/src/materials/nodes/MeshSSSNodeMaterial.js +1 -1
- package/src/materials/nodes/MeshStandardNodeMaterial.js +5 -4
- package/src/materials/nodes/NodeMaterial.js +95 -35
- package/src/materials/nodes/PointsNodeMaterial.js +81 -28
- package/src/materials/nodes/SpriteNodeMaterial.js +3 -15
- package/src/materials/nodes/manager/NodeMaterialObserver.js +194 -88
- package/src/math/Color.js +6 -5
- package/src/math/ColorManagement.js +9 -3
- package/src/math/Cylindrical.js +1 -1
- package/src/math/Euler.js +2 -1
- package/src/math/Line3.js +6 -5
- package/src/math/MathUtils.js +23 -21
- package/src/math/Matrix2.js +14 -10
- package/src/math/Matrix3.js +15 -11
- package/src/math/Matrix4.js +94 -81
- package/src/math/Plane.js +5 -4
- package/src/math/Quaternion.js +60 -84
- package/src/math/Sphere.js +1 -1
- package/src/math/Spherical.js +1 -1
- package/src/math/Triangle.js +1 -1
- package/src/math/Vector2.js +11 -7
- package/src/math/Vector3.js +15 -13
- package/src/math/Vector4.js +13 -9
- package/src/math/interpolants/BezierInterpolant.js +108 -0
- package/src/nodes/Nodes.js +86 -65
- package/src/nodes/TSL.js +11 -8
- package/src/nodes/accessors/Arrays.js +1 -1
- package/src/nodes/accessors/BatchNode.js +10 -10
- package/src/nodes/accessors/Bitangent.js +5 -5
- package/src/nodes/accessors/BufferAttributeNode.js +107 -15
- package/src/nodes/accessors/BufferNode.js +30 -3
- package/src/nodes/accessors/Camera.js +260 -13
- package/src/nodes/accessors/ClippingNode.js +10 -9
- package/src/nodes/accessors/CubeTextureNode.js +32 -6
- package/src/nodes/accessors/InstanceNode.js +164 -39
- package/src/nodes/accessors/Lights.js +10 -0
- package/src/nodes/accessors/MaterialNode.js +9 -1
- package/src/nodes/accessors/MaterialProperties.js +2 -5
- package/src/nodes/accessors/MaterialReferenceNode.js +1 -2
- package/src/nodes/accessors/ModelNode.js +1 -1
- package/src/nodes/accessors/Normal.js +16 -15
- package/src/nodes/accessors/Object3DNode.js +2 -2
- package/src/nodes/accessors/Position.js +51 -3
- package/src/nodes/accessors/ReferenceBaseNode.js +7 -7
- package/src/nodes/accessors/ReferenceNode.js +11 -10
- package/src/nodes/accessors/RendererReferenceNode.js +1 -2
- package/src/nodes/accessors/SceneProperties.js +47 -0
- package/src/nodes/accessors/SkinningNode.js +27 -26
- package/src/nodes/accessors/StorageBufferNode.js +14 -24
- package/src/nodes/accessors/StorageTextureNode.js +62 -9
- package/src/nodes/accessors/Tangent.js +4 -14
- package/src/nodes/accessors/Texture3DNode.js +41 -31
- package/src/nodes/accessors/TextureNode.js +193 -63
- package/src/nodes/accessors/UniformArrayNode.js +6 -4
- package/src/nodes/accessors/UserDataNode.js +1 -2
- package/src/nodes/accessors/VertexColorNode.js +1 -2
- package/src/nodes/code/FunctionCallNode.js +25 -5
- package/src/nodes/code/FunctionNode.js +25 -3
- package/src/nodes/core/ArrayNode.js +22 -2
- package/src/nodes/core/AssignNode.js +6 -5
- package/src/nodes/core/AttributeNode.js +5 -4
- package/src/nodes/core/BypassNode.js +1 -1
- package/src/nodes/core/ContextNode.js +133 -15
- package/src/nodes/core/IndexNode.js +4 -3
- package/src/nodes/core/InputNode.js +3 -2
- package/src/nodes/core/InspectorNode.js +128 -0
- package/src/nodes/core/{CacheNode.js → IsolateNode.js} +41 -8
- package/src/nodes/core/MRTNode.js +48 -2
- package/src/nodes/core/Node.js +264 -46
- package/src/nodes/core/NodeBuilder.js +453 -87
- package/src/nodes/core/NodeError.js +28 -0
- package/src/nodes/core/NodeFrame.js +31 -23
- package/src/nodes/core/NodeFunction.js +2 -1
- package/src/nodes/core/NodeParser.js +2 -1
- package/src/nodes/core/NodeUniform.js +1 -1
- package/src/nodes/core/NodeUtils.js +25 -97
- package/src/nodes/core/OutputStructNode.js +12 -10
- package/src/nodes/core/ParameterNode.js +34 -3
- package/src/nodes/core/PropertyNode.js +26 -3
- package/src/nodes/core/StackNode.js +99 -23
- package/src/nodes/core/StackTrace.js +139 -0
- package/src/nodes/core/StructNode.js +22 -8
- package/src/nodes/core/StructTypeNode.js +13 -18
- package/src/nodes/core/SubBuildNode.js +4 -4
- package/src/nodes/core/UniformGroupNode.js +36 -6
- package/src/nodes/core/UniformNode.js +37 -13
- package/src/nodes/core/VarNode.js +96 -34
- package/src/nodes/core/VaryingNode.js +2 -18
- package/src/nodes/display/BlendModes.js +0 -63
- package/src/nodes/display/BumpMapNode.js +1 -1
- package/src/nodes/display/ColorAdjustment.js +18 -1
- package/src/nodes/display/ColorSpaceNode.js +3 -3
- package/src/nodes/display/FrontFacingNode.js +4 -8
- package/src/nodes/display/NormalMapNode.js +41 -5
- package/src/nodes/display/PassNode.js +175 -25
- package/src/nodes/display/RenderOutputNode.js +35 -9
- package/src/nodes/display/ScreenNode.js +47 -15
- package/src/nodes/display/ToneMappingNode.js +32 -5
- package/src/nodes/display/ToonOutlinePassNode.js +10 -2
- package/src/nodes/display/ViewportDepthNode.js +52 -4
- package/src/nodes/display/ViewportDepthTextureNode.js +14 -6
- package/src/nodes/display/ViewportSharedTextureNode.js +12 -0
- package/src/nodes/display/ViewportTextureNode.js +72 -14
- package/src/nodes/fog/Fog.js +18 -34
- package/src/nodes/functions/BSDF/BRDF_GGX_Multiscatter.js +52 -0
- package/src/nodes/functions/BSDF/DFGLUT.js +56 -0
- package/src/nodes/functions/BSDF/EnvironmentBRDF.js +2 -2
- package/src/nodes/functions/BSDF/V_GGX_SmithCorrelated_Anisotropic.js +2 -2
- package/src/nodes/functions/BasicLightingModel.js +2 -1
- package/src/nodes/functions/PhysicalLightingModel.js +128 -46
- package/src/nodes/functions/VolumetricLightingModel.js +5 -5
- package/src/nodes/geometry/RangeNode.js +44 -6
- package/src/nodes/gpgpu/AtomicFunctionNode.js +1 -1
- package/src/nodes/gpgpu/BarrierNode.js +9 -0
- package/src/nodes/gpgpu/ComputeBuiltinNode.js +4 -4
- package/src/nodes/gpgpu/ComputeNode.js +76 -38
- package/src/nodes/gpgpu/SubgroupFunctionNode.js +455 -0
- package/src/nodes/gpgpu/WorkgroupInfoNode.js +5 -4
- package/src/nodes/lighting/AnalyticLightNode.js +53 -0
- package/src/nodes/lighting/EnvironmentNode.js +34 -9
- package/src/nodes/lighting/LightsNode.js +10 -32
- package/src/nodes/lighting/PointShadowNode.js +167 -148
- package/src/nodes/lighting/ShadowFilterNode.js +55 -65
- package/src/nodes/lighting/ShadowNode.js +189 -44
- package/src/nodes/math/BitcastNode.js +156 -0
- package/src/nodes/math/BitcountNode.js +433 -0
- package/src/nodes/math/ConditionalNode.js +25 -8
- package/src/nodes/math/MathNode.js +98 -57
- package/src/nodes/math/OperatorNode.js +8 -5
- package/src/nodes/math/PackFloatNode.js +98 -0
- package/src/nodes/math/UnpackFloatNode.js +96 -0
- package/src/nodes/pmrem/PMREMNode.js +1 -1
- package/src/nodes/pmrem/PMREMUtils.js +111 -2
- package/src/nodes/shapes/Shapes.js +1 -1
- package/src/nodes/tsl/TSLBase.js +6 -3
- package/src/nodes/tsl/TSLCore.js +488 -166
- package/src/nodes/utils/ArrayElementNode.js +14 -1
- package/src/nodes/utils/ConvertNode.js +1 -1
- package/src/nodes/utils/DebugNode.js +14 -13
- package/src/nodes/utils/EventNode.js +67 -2
- package/src/nodes/utils/FlipNode.js +1 -1
- package/src/nodes/utils/FunctionOverloadingNode.js +37 -19
- package/src/nodes/utils/JoinNode.js +7 -4
- package/src/nodes/utils/LoopNode.js +20 -24
- package/src/nodes/utils/MemberNode.js +60 -8
- package/src/nodes/utils/Packing.js +13 -1
- package/src/nodes/utils/PostProcessingUtils.js +60 -1
- package/src/nodes/utils/RTTNode.js +14 -4
- package/src/nodes/utils/ReflectorNode.js +61 -11
- package/src/nodes/utils/Remap.js +48 -0
- package/src/nodes/utils/RotateNode.js +1 -1
- package/src/nodes/utils/SampleNode.js +12 -2
- package/src/nodes/utils/SetNode.js +1 -1
- package/src/nodes/utils/SplitNode.js +12 -1
- package/src/nodes/utils/SpriteSheetUV.js +35 -0
- package/src/nodes/utils/Timer.js +0 -47
- package/src/nodes/utils/UVUtils.js +28 -0
- package/src/objects/BatchedMesh.js +46 -18
- package/src/objects/InstancedMesh.js +30 -3
- package/src/objects/LOD.js +1 -1
- package/src/objects/Line.js +3 -2
- package/src/objects/LineSegments.js +2 -1
- package/src/objects/Mesh.js +1 -1
- package/src/objects/Points.js +1 -1
- package/src/objects/Skeleton.js +12 -2
- package/src/objects/SkinnedMesh.js +29 -10
- package/src/objects/Sprite.js +4 -3
- package/src/renderers/WebGLRenderer.js +372 -179
- package/src/renderers/common/Animation.js +16 -4
- package/src/renderers/common/Attributes.js +16 -2
- package/src/renderers/common/Backend.js +137 -35
- package/src/renderers/common/Background.js +28 -14
- package/src/renderers/common/BindGroup.js +1 -16
- package/src/renderers/common/Binding.js +11 -0
- package/src/renderers/common/Bindings.js +83 -12
- package/src/renderers/common/BlendMode.js +143 -0
- package/src/renderers/common/Buffer.js +40 -0
- package/src/renderers/common/BundleGroup.js +1 -1
- package/src/renderers/common/CanvasTarget.js +341 -0
- package/src/renderers/common/ChainMap.js +30 -6
- package/src/renderers/common/ComputePipeline.js +1 -1
- package/src/renderers/common/CubeRenderTarget.js +51 -7
- package/src/renderers/common/DataMap.js +1 -1
- package/src/renderers/common/Geometries.js +55 -3
- package/src/renderers/common/Info.js +337 -6
- package/src/renderers/common/InspectorBase.js +151 -0
- package/src/renderers/common/Lighting.js +5 -21
- package/src/renderers/common/Pipelines.js +41 -8
- package/src/renderers/common/PostProcessing.js +9 -226
- package/src/renderers/common/QuadMesh.js +7 -1
- package/src/renderers/common/ReadbackBuffer.js +78 -0
- package/src/renderers/common/RenderBundle.js +3 -1
- package/src/renderers/common/RenderBundles.js +7 -3
- package/src/renderers/common/RenderContext.js +18 -2
- package/src/renderers/common/RenderContexts.js +33 -49
- package/src/renderers/common/RenderList.js +7 -3
- package/src/renderers/common/RenderLists.js +2 -1
- package/src/renderers/common/RenderObject.js +32 -6
- package/src/renderers/common/RenderObjectPipeline.js +40 -0
- package/src/renderers/common/RenderObjects.js +22 -6
- package/src/renderers/common/RenderPipeline.js +232 -17
- package/src/renderers/common/Renderer.js +927 -335
- package/src/renderers/common/RendererUtils.js +9 -0
- package/src/renderers/common/SampledTexture.js +9 -1
- package/src/renderers/common/Sampler.js +52 -14
- package/src/renderers/common/StorageBuffer.js +13 -1
- package/src/renderers/common/StorageTexture.js +9 -1
- package/src/renderers/common/Textures.js +208 -47
- package/src/renderers/common/TimestampQueryPool.js +70 -6
- package/src/renderers/common/Uniform.js +8 -0
- package/src/renderers/common/UniformsGroup.js +64 -2
- package/src/renderers/common/XRManager.js +79 -51
- package/src/renderers/common/extras/PMREMGenerator.js +176 -79
- package/src/renderers/common/nodes/NodeBuilderState.js +1 -1
- package/src/renderers/common/nodes/NodeLibrary.js +9 -7
- package/src/renderers/common/nodes/{Nodes.js → NodeManager.js} +260 -95
- package/src/renderers/common/nodes/NodeSampler.js +13 -1
- package/src/renderers/common/nodes/NodeStorageBuffer.js +13 -2
- package/src/renderers/common/nodes/NodeUniformBuffer.js +52 -0
- package/src/renderers/shaders/DFGLUTData.js +49 -0
- package/src/renderers/shaders/ShaderChunk/batching_pars_vertex.glsl.js +2 -2
- package/src/renderers/shaders/ShaderChunk/color_fragment.glsl.js +1 -5
- package/src/renderers/shaders/ShaderChunk/color_pars_fragment.glsl.js +1 -5
- package/src/renderers/shaders/ShaderChunk/color_pars_vertex.glsl.js +1 -5
- package/src/renderers/shaders/ShaderChunk/color_vertex.glsl.js +8 -10
- package/src/renderers/shaders/ShaderChunk/common.glsl.js +0 -12
- package/src/renderers/shaders/ShaderChunk/envmap_common_pars_fragment.glsl.js +1 -2
- package/src/renderers/shaders/ShaderChunk/envmap_fragment.glsl.js +8 -12
- package/src/renderers/shaders/ShaderChunk/envmap_physical_pars_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/lightprobes_pars_fragment.glsl.js +80 -0
- package/src/renderers/shaders/ShaderChunk/lights_fragment_begin.glsl.js +13 -2
- package/src/renderers/shaders/ShaderChunk/lights_fragment_end.glsl.js +6 -0
- package/src/renderers/shaders/ShaderChunk/lights_fragment_maps.glsl.js +6 -2
- package/src/renderers/shaders/ShaderChunk/lights_pars_begin.glsl.js +2 -0
- package/src/renderers/shaders/ShaderChunk/lights_physical_fragment.glsl.js +8 -4
- package/src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl.js +152 -59
- package/src/renderers/shaders/ShaderChunk/logdepthbuf_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/logdepthbuf_pars_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/logdepthbuf_pars_vertex.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/logdepthbuf_vertex.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/normal_fragment_maps.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/packing.glsl.js +20 -4
- package/src/renderers/shaders/ShaderChunk/premultiplied_alpha_fragment.glsl.js +0 -1
- package/src/renderers/shaders/ShaderChunk/shadowmap_pars_fragment.glsl.js +221 -190
- package/src/renderers/shaders/ShaderChunk/shadowmap_vertex.glsl.js +12 -2
- package/src/renderers/shaders/ShaderChunk/shadowmask_pars_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/transmission_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk.js +5 -3
- package/src/renderers/shaders/ShaderLib/backgroundCube.glsl.js +1 -2
- package/src/renderers/shaders/ShaderLib/depth.glsl.js +4 -1
- package/src/renderers/shaders/ShaderLib/{distanceRGBA.glsl.js → distance.glsl.js} +1 -2
- package/src/renderers/shaders/ShaderLib/meshlambert.glsl.js +2 -1
- package/src/renderers/shaders/ShaderLib/meshnormal.glsl.js +1 -2
- package/src/renderers/shaders/ShaderLib/meshphong.glsl.js +2 -1
- package/src/renderers/shaders/ShaderLib/meshphysical.glsl.js +4 -9
- package/src/renderers/shaders/ShaderLib/meshtoon.glsl.js +0 -1
- package/src/renderers/shaders/ShaderLib/shadow.glsl.js +1 -1
- package/src/renderers/shaders/ShaderLib/vsm.glsl.js +4 -6
- package/src/renderers/shaders/ShaderLib.js +7 -6
- package/src/renderers/shaders/UniformsLib.js +8 -5
- package/src/renderers/shaders/UniformsUtils.js +52 -9
- package/src/renderers/webgl/WebGLAnimation.js +2 -1
- package/src/renderers/webgl/WebGLBackground.js +15 -15
- package/src/renderers/webgl/WebGLBindingStates.js +99 -27
- package/src/renderers/webgl/WebGLBufferRenderer.js +0 -32
- package/src/renderers/webgl/WebGLCapabilities.js +11 -5
- package/src/renderers/webgl/WebGLEnvironments.js +228 -0
- package/src/renderers/webgl/WebGLExtensions.js +2 -25
- package/src/renderers/webgl/WebGLGeometries.js +10 -7
- package/src/renderers/webgl/WebGLIndexedBufferRenderer.js +0 -32
- package/src/renderers/webgl/WebGLInfo.js +3 -1
- package/src/renderers/webgl/WebGLLights.js +18 -1
- package/src/renderers/webgl/WebGLMaterials.js +24 -13
- package/src/renderers/webgl/WebGLObjects.js +3 -1
- package/src/renderers/webgl/WebGLOutput.js +270 -0
- package/src/renderers/webgl/WebGLProgram.js +63 -122
- package/src/renderers/webgl/WebGLPrograms.js +65 -52
- package/src/renderers/webgl/WebGLRenderLists.js +15 -0
- package/src/renderers/webgl/WebGLRenderStates.js +13 -2
- package/src/renderers/webgl/WebGLShadowMap.js +191 -26
- package/src/renderers/webgl/WebGLState.js +79 -40
- package/src/renderers/webgl/WebGLTextures.js +234 -68
- package/src/renderers/webgl/WebGLUniforms.js +40 -3
- package/src/renderers/webgl/WebGLUniformsGroups.js +24 -3
- package/src/renderers/webgl/WebGLUtils.js +8 -3
- package/src/renderers/webgl-fallback/WebGLBackend.js +438 -235
- package/src/renderers/webgl-fallback/WebGLBufferRenderer.js +0 -41
- package/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js +339 -84
- package/src/renderers/webgl-fallback/utils/WebGLAttributeUtils.js +53 -19
- package/src/renderers/webgl-fallback/utils/WebGLCapabilities.js +25 -0
- package/src/renderers/webgl-fallback/utils/WebGLConstants.js +2 -3
- package/src/renderers/webgl-fallback/utils/WebGLState.js +229 -11
- package/src/renderers/webgl-fallback/utils/WebGLTextureUtils.js +237 -72
- package/src/renderers/webgl-fallback/utils/WebGLTimestampQueryPool.js +56 -27
- package/src/renderers/webgl-fallback/utils/WebGLUtils.js +8 -3
- package/src/renderers/webgpu/WebGPUBackend.js +403 -253
- package/src/renderers/webgpu/WebGPURenderer.Nodes.js +2 -1
- package/src/renderers/webgpu/WebGPURenderer.js +5 -3
- package/src/renderers/webgpu/nodes/WGSLNodeBuilder.js +491 -123
- package/src/renderers/webgpu/utils/WebGPUAttributeUtils.js +108 -34
- package/src/renderers/webgpu/utils/WebGPUBindingUtils.js +360 -201
- package/src/renderers/webgpu/utils/WebGPUCapabilities.js +48 -0
- package/src/renderers/webgpu/utils/WebGPUConstants.js +17 -2
- package/src/renderers/webgpu/utils/WebGPUPipelineUtils.js +111 -54
- package/src/renderers/webgpu/utils/WebGPUTexturePassUtils.js +155 -205
- package/src/renderers/webgpu/utils/WebGPUTextureUtils.js +407 -149
- package/src/renderers/webgpu/utils/WebGPUTimestampQueryPool.js +36 -13
- package/src/renderers/webgpu/utils/WebGPUUtils.js +55 -13
- package/src/renderers/webxr/WebXRController.js +12 -0
- package/src/renderers/webxr/WebXRManager.js +45 -29
- package/src/textures/CubeDepthTexture.js +76 -0
- package/src/textures/ExternalTexture.js +15 -4
- package/src/textures/HTMLTexture.js +74 -0
- package/src/textures/Source.js +5 -4
- package/src/textures/Texture.js +19 -7
- package/src/textures/VideoTexture.js +2 -3
- package/src/utils.js +344 -3
- package/examples/jsm/loaders/RGBMLoader.js +0 -1148
- package/examples/jsm/materials/MeshGouraudMaterial.js +0 -434
- package/examples/jsm/materials/MeshPostProcessingMaterial.js +0 -167
- package/examples/jsm/shaders/GodRaysShader.js +0 -333
- package/src/nodes/accessors/SceneNode.js +0 -144
- package/src/nodes/code/ScriptableNode.js +0 -726
- package/src/nodes/code/ScriptableValueNode.js +0 -253
- package/src/nodes/display/PosterizeNode.js +0 -65
- package/src/nodes/functions/BSDF/DFGApprox.js +0 -30
- package/src/nodes/utils/RemapNode.js +0 -125
- package/src/nodes/utils/SpriteSheetUVNode.js +0 -90
- package/src/renderers/webgl/WebGLCubeMaps.js +0 -99
- package/src/renderers/webgl/WebGLCubeUVMaps.js +0 -134
|
@@ -8,7 +8,6 @@ import {
|
|
|
8
8
|
NoToneMapping,
|
|
9
9
|
LinearMipmapLinearFilter,
|
|
10
10
|
SRGBColorSpace,
|
|
11
|
-
LinearSRGBColorSpace,
|
|
12
11
|
RGBAIntegerFormat,
|
|
13
12
|
RGIntegerFormat,
|
|
14
13
|
RedIntegerFormat,
|
|
@@ -31,8 +30,7 @@ import { WebGLBindingStates } from './webgl/WebGLBindingStates.js';
|
|
|
31
30
|
import { WebGLBufferRenderer } from './webgl/WebGLBufferRenderer.js';
|
|
32
31
|
import { WebGLCapabilities } from './webgl/WebGLCapabilities.js';
|
|
33
32
|
import { WebGLClipping } from './webgl/WebGLClipping.js';
|
|
34
|
-
import {
|
|
35
|
-
import { WebGLCubeUVMaps } from './webgl/WebGLCubeUVMaps.js';
|
|
33
|
+
import { WebGLEnvironments } from './webgl/WebGLEnvironments.js';
|
|
36
34
|
import { WebGLExtensions } from './webgl/WebGLExtensions.js';
|
|
37
35
|
import { WebGLGeometries } from './webgl/WebGLGeometries.js';
|
|
38
36
|
import { WebGLIndexedBufferRenderer } from './webgl/WebGLIndexedBufferRenderer.js';
|
|
@@ -40,6 +38,7 @@ import { WebGLInfo } from './webgl/WebGLInfo.js';
|
|
|
40
38
|
import { WebGLMorphtargets } from './webgl/WebGLMorphtargets.js';
|
|
41
39
|
import { WebGLMultiview } from './webgl/WebGLMultiview.js';
|
|
42
40
|
import { WebGLObjects } from './webgl/WebGLObjects.js';
|
|
41
|
+
import { WebGLOutput } from './webgl/WebGLOutput.js';
|
|
43
42
|
import { WebGLPrograms } from './webgl/WebGLPrograms.js';
|
|
44
43
|
import { WebGLProperties } from './webgl/WebGLProperties.js';
|
|
45
44
|
import { WebGLRenderLists } from './webgl/WebGLRenderLists.js';
|
|
@@ -53,8 +52,9 @@ import { WebGLUtils } from './webgl/WebGLUtils.js';
|
|
|
53
52
|
import { WebXRManager } from './webxr/WebXRManager.js';
|
|
54
53
|
import { WebGLMaterials } from './webgl/WebGLMaterials.js';
|
|
55
54
|
import { WebGLUniformsGroups } from './webgl/WebGLUniformsGroups.js';
|
|
56
|
-
import { createCanvasElement, probeAsync,
|
|
55
|
+
import { createCanvasElement, probeAsync, error, warn, log } from '../utils.js';
|
|
57
56
|
import { ColorManagement } from '../math/ColorManagement.js';
|
|
57
|
+
import { getDFGLUT } from './shaders/DFGLUTData.js';
|
|
58
58
|
|
|
59
59
|
/**
|
|
60
60
|
* This renderer uses WebGL 2 to display scenes.
|
|
@@ -82,6 +82,7 @@ class WebGLRenderer {
|
|
|
82
82
|
powerPreference = 'default',
|
|
83
83
|
failIfMajorPerformanceCaveat = false,
|
|
84
84
|
reversedDepthBuffer = false,
|
|
85
|
+
outputBufferType = UnsignedByteType,
|
|
85
86
|
multiviewStereo = false,
|
|
86
87
|
} = parameters;
|
|
87
88
|
|
|
@@ -112,8 +113,26 @@ class WebGLRenderer {
|
|
|
112
113
|
|
|
113
114
|
}
|
|
114
115
|
|
|
116
|
+
const _outputBufferType = outputBufferType;
|
|
117
|
+
|
|
118
|
+
const INTEGER_FORMATS = new Set( [
|
|
119
|
+
RGBAIntegerFormat,
|
|
120
|
+
RGIntegerFormat,
|
|
121
|
+
RedIntegerFormat
|
|
122
|
+
] );
|
|
123
|
+
|
|
124
|
+
const UNSIGNED_TYPES = new Set( [
|
|
125
|
+
UnsignedByteType,
|
|
126
|
+
UnsignedIntType,
|
|
127
|
+
UnsignedShortType,
|
|
128
|
+
UnsignedInt248Type,
|
|
129
|
+
UnsignedShort4444Type,
|
|
130
|
+
UnsignedShort5551Type
|
|
131
|
+
] );
|
|
132
|
+
|
|
115
133
|
const uintClearColor = new Uint32Array( 4 );
|
|
116
134
|
const intClearColor = new Int32Array( 4 );
|
|
135
|
+
const objectPosition = new Vector3();
|
|
117
136
|
|
|
118
137
|
let currentRenderList = null;
|
|
119
138
|
let currentRenderState = null;
|
|
@@ -124,16 +143,20 @@ class WebGLRenderer {
|
|
|
124
143
|
const renderListStack = [];
|
|
125
144
|
const renderStateStack = [];
|
|
126
145
|
|
|
146
|
+
// internal render target for non-UnsignedByteType color buffer
|
|
147
|
+
|
|
148
|
+
let output = null;
|
|
149
|
+
|
|
127
150
|
// public properties
|
|
128
151
|
|
|
129
152
|
/**
|
|
130
|
-
* A canvas where the renderer draws its output.This is automatically created by the renderer
|
|
153
|
+
* A canvas where the renderer draws its output. This is automatically created by the renderer
|
|
131
154
|
* in the constructor (if not provided already); you just need to add it to your page like so:
|
|
132
155
|
* ```js
|
|
133
156
|
* document.body.appendChild( renderer.domElement );
|
|
134
157
|
* ```
|
|
135
158
|
*
|
|
136
|
-
* @type {
|
|
159
|
+
* @type {HTMLCanvasElement|OffscreenCanvas}
|
|
137
160
|
*/
|
|
138
161
|
this.domElement = canvas;
|
|
139
162
|
|
|
@@ -143,7 +166,7 @@ class WebGLRenderer {
|
|
|
143
166
|
* - `checkShaderErrors`: If it is `true`, defines whether material shader programs are
|
|
144
167
|
* checked for errors during compilation and linkage process. It may be useful to disable
|
|
145
168
|
* this check in production for performance gain. It is strongly recommended to keep these
|
|
146
|
-
* checks enabled during development. If the shader does not compile and link
|
|
169
|
+
* checks enabled during development. If the shader does not compile and link, it will not
|
|
147
170
|
* work and associated material will not render.
|
|
148
171
|
* - `onShaderError(gl, program, glVertexShader,glFragmentShader)`: A callback function that
|
|
149
172
|
* can be used for custom error reporting. The callback receives the WebGL context, an instance
|
|
@@ -272,6 +295,7 @@ class WebGLRenderer {
|
|
|
272
295
|
const _this = this;
|
|
273
296
|
|
|
274
297
|
let _isContextLost = false;
|
|
298
|
+
let _nodesHandler = null;
|
|
275
299
|
|
|
276
300
|
// internal state cache
|
|
277
301
|
|
|
@@ -384,15 +408,15 @@ class WebGLRenderer {
|
|
|
384
408
|
|
|
385
409
|
}
|
|
386
410
|
|
|
387
|
-
} catch (
|
|
411
|
+
} catch ( e ) {
|
|
388
412
|
|
|
389
|
-
|
|
390
|
-
throw
|
|
413
|
+
error( 'WebGLRenderer: ' + e.message );
|
|
414
|
+
throw e;
|
|
391
415
|
|
|
392
416
|
}
|
|
393
417
|
|
|
394
418
|
let extensions, capabilities, state, info;
|
|
395
|
-
let properties, textures,
|
|
419
|
+
let properties, textures, environments, attributes, geometries, objects;
|
|
396
420
|
let programCache, materials, renderLists, renderStates, clipping, shadowMap;
|
|
397
421
|
let multiview;
|
|
398
422
|
|
|
@@ -420,19 +444,18 @@ class WebGLRenderer {
|
|
|
420
444
|
info = new WebGLInfo( _gl );
|
|
421
445
|
properties = new WebGLProperties();
|
|
422
446
|
textures = new WebGLTextures( _gl, extensions, state, properties, capabilities, utils, info );
|
|
423
|
-
|
|
424
|
-
cubeuvmaps = new WebGLCubeUVMaps( _this );
|
|
447
|
+
environments = new WebGLEnvironments( _this );
|
|
425
448
|
attributes = new WebGLAttributes( _gl );
|
|
426
449
|
bindingStates = new WebGLBindingStates( _gl, attributes );
|
|
427
450
|
geometries = new WebGLGeometries( _gl, attributes, info, bindingStates );
|
|
428
|
-
objects = new WebGLObjects( _gl, geometries, attributes, info );
|
|
451
|
+
objects = new WebGLObjects( _gl, geometries, attributes, bindingStates, info );
|
|
429
452
|
morphtargets = new WebGLMorphtargets( _gl, capabilities, textures );
|
|
430
453
|
clipping = new WebGLClipping( properties );
|
|
431
|
-
programCache = new WebGLPrograms( _this,
|
|
454
|
+
programCache = new WebGLPrograms( _this, environments, extensions, capabilities, bindingStates, clipping );
|
|
432
455
|
materials = new WebGLMaterials( _this, properties );
|
|
433
456
|
renderLists = new WebGLRenderLists();
|
|
434
457
|
renderStates = new WebGLRenderStates( extensions );
|
|
435
|
-
background = new WebGLBackground( _this,
|
|
458
|
+
background = new WebGLBackground( _this, environments, state, objects, _alpha, premultipliedAlpha );
|
|
436
459
|
multiview = new WebGLMultiview( _this, extensions, _gl );
|
|
437
460
|
shadowMap = new WebGLShadowMap( _this, objects, capabilities );
|
|
438
461
|
uniformsGroups = new WebGLUniformsGroups( _gl, info, capabilities, state );
|
|
@@ -521,9 +544,17 @@ class WebGLRenderer {
|
|
|
521
544
|
|
|
522
545
|
initGLContext();
|
|
523
546
|
|
|
547
|
+
// initialize internal render target for non-UnsignedByteType color buffer
|
|
548
|
+
|
|
549
|
+
if ( _outputBufferType !== UnsignedByteType ) {
|
|
550
|
+
|
|
551
|
+
output = new WebGLOutput( _outputBufferType, canvas.width, canvas.height, depth, stencil );
|
|
552
|
+
|
|
553
|
+
}
|
|
554
|
+
|
|
524
555
|
// xr
|
|
525
556
|
|
|
526
|
-
const xr = new WebXRManager( _this, _gl );
|
|
557
|
+
const xr = new WebXRManager( _this, _gl, extensions, multiviewStereo );
|
|
527
558
|
|
|
528
559
|
/**
|
|
529
560
|
* A reference to the XR manager.
|
|
@@ -625,7 +656,7 @@ class WebGLRenderer {
|
|
|
625
656
|
|
|
626
657
|
if ( xr.isPresenting ) {
|
|
627
658
|
|
|
628
|
-
|
|
659
|
+
warn( 'WebGLRenderer: Can\'t change size while VR device is presenting.' );
|
|
629
660
|
return;
|
|
630
661
|
|
|
631
662
|
}
|
|
@@ -643,6 +674,12 @@ class WebGLRenderer {
|
|
|
643
674
|
|
|
644
675
|
}
|
|
645
676
|
|
|
677
|
+
if ( output !== null ) {
|
|
678
|
+
|
|
679
|
+
output.setSize( canvas.width, canvas.height );
|
|
680
|
+
|
|
681
|
+
}
|
|
682
|
+
|
|
646
683
|
this.setViewport( 0, 0, width, height );
|
|
647
684
|
|
|
648
685
|
};
|
|
@@ -686,6 +723,39 @@ class WebGLRenderer {
|
|
|
686
723
|
|
|
687
724
|
};
|
|
688
725
|
|
|
726
|
+
/**
|
|
727
|
+
* Sets the post-processing effects to be applied after rendering.
|
|
728
|
+
*
|
|
729
|
+
* @param {Array} effects - An array of post-processing effects.
|
|
730
|
+
*/
|
|
731
|
+
this.setEffects = function ( effects ) {
|
|
732
|
+
|
|
733
|
+
if ( _outputBufferType === UnsignedByteType ) {
|
|
734
|
+
|
|
735
|
+
error( 'THREE.WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.' );
|
|
736
|
+
return;
|
|
737
|
+
|
|
738
|
+
}
|
|
739
|
+
|
|
740
|
+
if ( effects ) {
|
|
741
|
+
|
|
742
|
+
for ( let i = 0; i < effects.length; i ++ ) {
|
|
743
|
+
|
|
744
|
+
if ( effects[ i ].isOutputPass === true ) {
|
|
745
|
+
|
|
746
|
+
warn( 'THREE.WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.' );
|
|
747
|
+
break;
|
|
748
|
+
|
|
749
|
+
}
|
|
750
|
+
|
|
751
|
+
}
|
|
752
|
+
|
|
753
|
+
}
|
|
754
|
+
|
|
755
|
+
output.setEffects( effects || [] );
|
|
756
|
+
|
|
757
|
+
};
|
|
758
|
+
|
|
689
759
|
/**
|
|
690
760
|
* Returns the current viewport definition.
|
|
691
761
|
*
|
|
@@ -887,9 +957,7 @@ class WebGLRenderer {
|
|
|
887
957
|
if ( _currentRenderTarget !== null ) {
|
|
888
958
|
|
|
889
959
|
const targetFormat = _currentRenderTarget.texture.format;
|
|
890
|
-
isIntegerFormat = targetFormat
|
|
891
|
-
targetFormat === RGIntegerFormat ||
|
|
892
|
-
targetFormat === RedIntegerFormat;
|
|
960
|
+
isIntegerFormat = INTEGER_FORMATS.has( targetFormat );
|
|
893
961
|
|
|
894
962
|
}
|
|
895
963
|
|
|
@@ -898,12 +966,7 @@ class WebGLRenderer {
|
|
|
898
966
|
if ( isIntegerFormat ) {
|
|
899
967
|
|
|
900
968
|
const targetType = _currentRenderTarget.texture.type;
|
|
901
|
-
const isUnsignedType = targetType
|
|
902
|
-
targetType === UnsignedIntType ||
|
|
903
|
-
targetType === UnsignedShortType ||
|
|
904
|
-
targetType === UnsignedInt248Type ||
|
|
905
|
-
targetType === UnsignedShort4444Type ||
|
|
906
|
-
targetType === UnsignedShort5551Type;
|
|
969
|
+
const isUnsignedType = UNSIGNED_TYPES.has( targetType );
|
|
907
970
|
|
|
908
971
|
const clearColor = background.getClearColor();
|
|
909
972
|
const a = background.getClearAlpha();
|
|
@@ -940,6 +1003,7 @@ class WebGLRenderer {
|
|
|
940
1003
|
if ( depth ) {
|
|
941
1004
|
|
|
942
1005
|
bits |= _gl.DEPTH_BUFFER_BIT;
|
|
1006
|
+
this.state.buffers.depth.setMask( true );
|
|
943
1007
|
|
|
944
1008
|
}
|
|
945
1009
|
|
|
@@ -950,7 +1014,11 @@ class WebGLRenderer {
|
|
|
950
1014
|
|
|
951
1015
|
}
|
|
952
1016
|
|
|
953
|
-
|
|
1017
|
+
if ( bits !== 0 ) {
|
|
1018
|
+
|
|
1019
|
+
_gl.clear( bits );
|
|
1020
|
+
|
|
1021
|
+
}
|
|
954
1022
|
|
|
955
1023
|
};
|
|
956
1024
|
|
|
@@ -981,6 +1049,20 @@ class WebGLRenderer {
|
|
|
981
1049
|
|
|
982
1050
|
};
|
|
983
1051
|
|
|
1052
|
+
/**
|
|
1053
|
+
* Sets a compatibility node builder for rendering node materials with WebGLRenderer.
|
|
1054
|
+
* This enables using TSL (Three.js Shading Language) node materials to prepare
|
|
1055
|
+
* for migration to WebGPURenderer.
|
|
1056
|
+
*
|
|
1057
|
+
* @param {WebGLNodesHandler} nodesHandler - The node builder instance.
|
|
1058
|
+
*/
|
|
1059
|
+
this.setNodesHandler = function ( nodesHandler ) {
|
|
1060
|
+
|
|
1061
|
+
nodesHandler.setRenderer( this );
|
|
1062
|
+
_nodesHandler = nodesHandler;
|
|
1063
|
+
|
|
1064
|
+
};
|
|
1065
|
+
|
|
984
1066
|
/**
|
|
985
1067
|
* Frees the GPU-related resources allocated by this instance. Call this
|
|
986
1068
|
* method whenever this instance is no longer used in your app.
|
|
@@ -995,8 +1077,7 @@ class WebGLRenderer {
|
|
|
995
1077
|
renderLists.dispose();
|
|
996
1078
|
renderStates.dispose();
|
|
997
1079
|
properties.dispose();
|
|
998
|
-
|
|
999
|
-
cubeuvmaps.dispose();
|
|
1080
|
+
environments.dispose();
|
|
1000
1081
|
objects.dispose();
|
|
1001
1082
|
bindingStates.dispose();
|
|
1002
1083
|
uniformsGroups.dispose();
|
|
@@ -1017,7 +1098,7 @@ class WebGLRenderer {
|
|
|
1017
1098
|
|
|
1018
1099
|
event.preventDefault();
|
|
1019
1100
|
|
|
1020
|
-
|
|
1101
|
+
log( 'WebGLRenderer: Context Lost.' );
|
|
1021
1102
|
|
|
1022
1103
|
_isContextLost = true;
|
|
1023
1104
|
|
|
@@ -1025,7 +1106,7 @@ class WebGLRenderer {
|
|
|
1025
1106
|
|
|
1026
1107
|
function onContextRestore( /* event */ ) {
|
|
1027
1108
|
|
|
1028
|
-
|
|
1109
|
+
log( 'WebGLRenderer: Context Restored.' );
|
|
1029
1110
|
|
|
1030
1111
|
_isContextLost = false;
|
|
1031
1112
|
|
|
@@ -1047,7 +1128,7 @@ class WebGLRenderer {
|
|
|
1047
1128
|
|
|
1048
1129
|
function onContextCreationError( event ) {
|
|
1049
1130
|
|
|
1050
|
-
|
|
1131
|
+
error( 'WebGLRenderer: A WebGL context could not be created. Reason: ', event.statusMessage );
|
|
1051
1132
|
|
|
1052
1133
|
}
|
|
1053
1134
|
|
|
@@ -1217,33 +1298,23 @@ class WebGLRenderer {
|
|
|
1217
1298
|
|
|
1218
1299
|
if ( object.isBatchedMesh ) {
|
|
1219
1300
|
|
|
1220
|
-
if (
|
|
1221
|
-
|
|
1222
|
-
// @deprecated, r174
|
|
1223
|
-
warnOnce( 'THREE.WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection.' );
|
|
1224
|
-
renderer.renderMultiDrawInstances( object._multiDrawStarts, object._multiDrawCounts, object._multiDrawCount, object._multiDrawInstances );
|
|
1225
|
-
|
|
1226
|
-
} else {
|
|
1301
|
+
if ( ! extensions.get( 'WEBGL_multi_draw' ) ) {
|
|
1227
1302
|
|
|
1228
|
-
|
|
1303
|
+
const starts = object._multiDrawStarts;
|
|
1304
|
+
const counts = object._multiDrawCounts;
|
|
1305
|
+
const drawCount = object._multiDrawCount;
|
|
1306
|
+
const bytesPerElement = index ? attributes.get( index ).bytesPerElement : 1;
|
|
1307
|
+
const uniforms = properties.get( material ).currentProgram.getUniforms();
|
|
1308
|
+
for ( let i = 0; i < drawCount; i ++ ) {
|
|
1229
1309
|
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
const drawCount = object._multiDrawCount;
|
|
1233
|
-
const bytesPerElement = index ? attributes.get( index ).bytesPerElement : 1;
|
|
1234
|
-
const uniforms = properties.get( material ).currentProgram.getUniforms();
|
|
1235
|
-
for ( let i = 0; i < drawCount; i ++ ) {
|
|
1310
|
+
uniforms.setValue( _gl, '_gl_DrawID', i );
|
|
1311
|
+
renderer.render( starts[ i ] / bytesPerElement, counts[ i ] );
|
|
1236
1312
|
|
|
1237
|
-
|
|
1238
|
-
renderer.render( starts[ i ] / bytesPerElement, counts[ i ] );
|
|
1239
|
-
|
|
1240
|
-
}
|
|
1241
|
-
|
|
1242
|
-
} else {
|
|
1313
|
+
}
|
|
1243
1314
|
|
|
1244
|
-
|
|
1315
|
+
} else {
|
|
1245
1316
|
|
|
1246
|
-
|
|
1317
|
+
renderer.renderMultiDraw( object._multiDrawStarts, object._multiDrawCounts, object._multiDrawCount );
|
|
1247
1318
|
|
|
1248
1319
|
}
|
|
1249
1320
|
|
|
@@ -1496,6 +1567,13 @@ class WebGLRenderer {
|
|
|
1496
1567
|
|
|
1497
1568
|
if ( typeof self !== 'undefined' ) animation.setContext( self );
|
|
1498
1569
|
|
|
1570
|
+
/**
|
|
1571
|
+
* Applications are advised to always define the animation loop
|
|
1572
|
+
* with this method and not manually with `requestAnimationFrame()`
|
|
1573
|
+
* for best compatibility.
|
|
1574
|
+
*
|
|
1575
|
+
* @param {?onAnimationCallback} callback - The application's animation loop.
|
|
1576
|
+
*/
|
|
1499
1577
|
this.setAnimationLoop = function ( callback ) {
|
|
1500
1578
|
|
|
1501
1579
|
onAnimationFrameCallback = callback;
|
|
@@ -1528,13 +1606,26 @@ class WebGLRenderer {
|
|
|
1528
1606
|
|
|
1529
1607
|
if ( camera !== undefined && camera.isCamera !== true ) {
|
|
1530
1608
|
|
|
1531
|
-
|
|
1609
|
+
error( 'WebGLRenderer.render: camera is not an instance of THREE.Camera.' );
|
|
1532
1610
|
return;
|
|
1533
1611
|
|
|
1534
1612
|
}
|
|
1535
1613
|
|
|
1536
1614
|
if ( _isContextLost === true ) return;
|
|
1537
1615
|
|
|
1616
|
+
// update node builder if available
|
|
1617
|
+
if ( _nodesHandler !== null ) {
|
|
1618
|
+
|
|
1619
|
+
_nodesHandler.renderStart( scene, camera );
|
|
1620
|
+
|
|
1621
|
+
}
|
|
1622
|
+
|
|
1623
|
+
// use internal render target for HalfFloatType color buffer (only when tone mapping is enabled)
|
|
1624
|
+
|
|
1625
|
+
const isXRPresenting = xr.enabled === true && xr.isPresenting === true;
|
|
1626
|
+
|
|
1627
|
+
const useOutput = output !== null && ( _currentRenderTarget === null || isXRPresenting ) && output.begin( _this, _currentRenderTarget );
|
|
1628
|
+
|
|
1538
1629
|
// update scene graph
|
|
1539
1630
|
|
|
1540
1631
|
if ( scene.matrixWorldAutoUpdate === true ) scene.updateMatrixWorld();
|
|
@@ -1543,7 +1634,7 @@ class WebGLRenderer {
|
|
|
1543
1634
|
|
|
1544
1635
|
if ( camera.parent === null && camera.matrixWorldAutoUpdate === true ) camera.updateMatrixWorld();
|
|
1545
1636
|
|
|
1546
|
-
if ( xr.enabled === true && xr.isPresenting === true ) {
|
|
1637
|
+
if ( xr.enabled === true && xr.isPresenting === true && ( output === null || output.isCompositing() === false ) ) {
|
|
1547
1638
|
|
|
1548
1639
|
if ( xr.cameraAutoUpdate === true ) xr.updateCamera( camera );
|
|
1549
1640
|
|
|
@@ -1557,6 +1648,7 @@ class WebGLRenderer {
|
|
|
1557
1648
|
currentRenderState = renderStates.get( scene, renderStateStack.length );
|
|
1558
1649
|
currentRenderState.init( camera );
|
|
1559
1650
|
|
|
1651
|
+
currentRenderState.state.textureUnits = textures.getTextureUnits();
|
|
1560
1652
|
renderStateStack.push( currentRenderState );
|
|
1561
1653
|
|
|
1562
1654
|
_projScreenMatrix.multiplyMatrices( camera.projectionMatrix, camera.matrixWorldInverse );
|
|
@@ -1615,56 +1707,62 @@ class WebGLRenderer {
|
|
|
1615
1707
|
|
|
1616
1708
|
if ( this.info.autoReset === true ) this.info.reset();
|
|
1617
1709
|
|
|
1618
|
-
// render scene
|
|
1710
|
+
// render scene (skip if first effect is a render pass - it will render the scene itself)
|
|
1619
1711
|
|
|
1620
|
-
const
|
|
1621
|
-
const transmissiveObjects = currentRenderList.transmissive;
|
|
1712
|
+
const skipSceneRender = useOutput && output.hasRenderPass();
|
|
1622
1713
|
|
|
1623
|
-
|
|
1714
|
+
if ( skipSceneRender === false ) {
|
|
1715
|
+
|
|
1716
|
+
const opaqueObjects = currentRenderList.opaque;
|
|
1717
|
+
const transmissiveObjects = currentRenderList.transmissive;
|
|
1718
|
+
|
|
1719
|
+
currentRenderState.setupLights();
|
|
1624
1720
|
|
|
1625
|
-
|
|
1721
|
+
if ( camera.isArrayCamera ) {
|
|
1626
1722
|
|
|
1627
|
-
|
|
1723
|
+
const cameras = camera.cameras;
|
|
1628
1724
|
|
|
1629
|
-
|
|
1725
|
+
if ( transmissiveObjects.length > 0 ) {
|
|
1630
1726
|
|
|
1631
|
-
|
|
1727
|
+
for ( let i = 0, l = cameras.length; i < l; i ++ ) {
|
|
1632
1728
|
|
|
1633
|
-
|
|
1729
|
+
const camera2 = cameras[ i ];
|
|
1634
1730
|
|
|
1635
|
-
|
|
1731
|
+
renderTransmissionPass( opaqueObjects, transmissiveObjects, scene, camera2 );
|
|
1732
|
+
|
|
1733
|
+
}
|
|
1636
1734
|
|
|
1637
1735
|
}
|
|
1638
1736
|
|
|
1639
|
-
|
|
1737
|
+
if ( _renderBackground ) background.render( scene );
|
|
1640
1738
|
|
|
1641
|
-
|
|
1739
|
+
if ( xr.enabled && xr.isMultiview ) {
|
|
1642
1740
|
|
|
1643
|
-
|
|
1741
|
+
textures.setDeferTextureUploads( true );
|
|
1644
1742
|
|
|
1645
|
-
|
|
1743
|
+
renderScene( currentRenderList, scene, camera, camera.cameras[ 0 ].viewport );
|
|
1646
1744
|
|
|
1647
|
-
|
|
1745
|
+
} else {
|
|
1648
1746
|
|
|
1649
|
-
|
|
1747
|
+
for ( let i = 0, l = cameras.length; i < l; i ++ ) {
|
|
1650
1748
|
|
|
1651
|
-
|
|
1749
|
+
const camera2 = cameras[ i ];
|
|
1652
1750
|
|
|
1653
|
-
|
|
1751
|
+
renderScene( currentRenderList, scene, camera2, camera2.viewport );
|
|
1654
1752
|
|
|
1655
|
-
|
|
1753
|
+
}
|
|
1656
1754
|
|
|
1657
1755
|
}
|
|
1658
1756
|
|
|
1659
|
-
}
|
|
1757
|
+
} else {
|
|
1660
1758
|
|
|
1661
|
-
|
|
1759
|
+
if ( transmissiveObjects.length > 0 ) renderTransmissionPass( opaqueObjects, transmissiveObjects, scene, camera );
|
|
1662
1760
|
|
|
1663
|
-
|
|
1761
|
+
if ( _renderBackground ) background.render( scene );
|
|
1664
1762
|
|
|
1665
|
-
|
|
1763
|
+
renderScene( currentRenderList, scene, camera );
|
|
1666
1764
|
|
|
1667
|
-
|
|
1765
|
+
}
|
|
1668
1766
|
|
|
1669
1767
|
}
|
|
1670
1768
|
|
|
@@ -1682,6 +1780,14 @@ class WebGLRenderer {
|
|
|
1682
1780
|
|
|
1683
1781
|
}
|
|
1684
1782
|
|
|
1783
|
+
// copy from internal render target to canvas using fullscreen quad
|
|
1784
|
+
|
|
1785
|
+
if ( useOutput ) {
|
|
1786
|
+
|
|
1787
|
+
output.end( _this );
|
|
1788
|
+
|
|
1789
|
+
}
|
|
1790
|
+
|
|
1685
1791
|
//
|
|
1686
1792
|
|
|
1687
1793
|
if ( scene.isScene === true ) scene.onAfterRender( _this, scene, camera );
|
|
@@ -1698,6 +1804,8 @@ class WebGLRenderer {
|
|
|
1698
1804
|
|
|
1699
1805
|
currentRenderState = renderStateStack[ renderStateStack.length - 1 ];
|
|
1700
1806
|
|
|
1807
|
+
textures.setTextureUnits( currentRenderState.state.textureUnits );
|
|
1808
|
+
|
|
1701
1809
|
if ( _clippingEnabled === true ) clipping.setGlobalState( _this.clippingPlanes, currentRenderState.state.camera );
|
|
1702
1810
|
|
|
1703
1811
|
} else {
|
|
@@ -1718,6 +1826,12 @@ class WebGLRenderer {
|
|
|
1718
1826
|
|
|
1719
1827
|
}
|
|
1720
1828
|
|
|
1829
|
+
if ( _nodesHandler !== null ) {
|
|
1830
|
+
|
|
1831
|
+
_nodesHandler.renderEnd();
|
|
1832
|
+
|
|
1833
|
+
}
|
|
1834
|
+
|
|
1721
1835
|
};
|
|
1722
1836
|
|
|
1723
1837
|
function projectObject( object, camera, groupOrder, sortObjects ) {
|
|
@@ -1736,6 +1850,10 @@ class WebGLRenderer {
|
|
|
1736
1850
|
|
|
1737
1851
|
if ( object.autoUpdate === true ) object.update( camera );
|
|
1738
1852
|
|
|
1853
|
+
} else if ( object.isLightProbeGrid ) {
|
|
1854
|
+
|
|
1855
|
+
currentRenderState.pushLightProbeGrid( object );
|
|
1856
|
+
|
|
1739
1857
|
} else if ( object.isLight ) {
|
|
1740
1858
|
|
|
1741
1859
|
currentRenderState.pushLight( object );
|
|
@@ -1836,9 +1954,7 @@ class WebGLRenderer {
|
|
|
1836
1954
|
|
|
1837
1955
|
function renderScene( currentRenderList, scene, camera, viewport ) {
|
|
1838
1956
|
|
|
1839
|
-
const opaqueObjects = currentRenderList
|
|
1840
|
-
const transmissiveObjects = currentRenderList.transmissive;
|
|
1841
|
-
const transparentObjects = currentRenderList.transparent;
|
|
1957
|
+
const { opaque: opaqueObjects, transmissive: transmissiveObjects, transparent: transparentObjects } = currentRenderList;
|
|
1842
1958
|
|
|
1843
1959
|
currentRenderState.setupLightsView( camera );
|
|
1844
1960
|
|
|
@@ -1872,11 +1988,13 @@ class WebGLRenderer {
|
|
|
1872
1988
|
|
|
1873
1989
|
if ( currentRenderState.state.transmissionRenderTarget[ camera.id ] === undefined ) {
|
|
1874
1990
|
|
|
1991
|
+
const hasHalfFloatSupport = extensions.has( 'EXT_color_buffer_half_float' ) || extensions.has( 'EXT_color_buffer_float' );
|
|
1992
|
+
|
|
1875
1993
|
currentRenderState.state.transmissionRenderTarget[ camera.id ] = new WebGLRenderTarget( 1, 1, {
|
|
1876
1994
|
generateMipmaps: true,
|
|
1877
|
-
type:
|
|
1995
|
+
type: hasHalfFloatSupport ? HalfFloatType : UnsignedByteType,
|
|
1878
1996
|
minFilter: LinearMipmapLinearFilter,
|
|
1879
|
-
samples: 4,
|
|
1997
|
+
samples: Math.max( 4, capabilities.samples ), // to avoid feedback loops, the transmission render target requires a resolve, see #26177
|
|
1880
1998
|
stencilBuffer: stencil,
|
|
1881
1999
|
resolveDepthBuffer: false,
|
|
1882
2000
|
resolveStencilBuffer: false,
|
|
@@ -1943,10 +2061,7 @@ class WebGLRenderer {
|
|
|
1943
2061
|
|
|
1944
2062
|
const renderItem = transmissiveObjects[ i ];
|
|
1945
2063
|
|
|
1946
|
-
const object = renderItem
|
|
1947
|
-
const geometry = renderItem.geometry;
|
|
1948
|
-
const material = renderItem.material;
|
|
1949
|
-
const group = renderItem.group;
|
|
2064
|
+
const { object, geometry, material, group } = renderItem;
|
|
1950
2065
|
|
|
1951
2066
|
if ( material.side === DoubleSide && object.layers.test( camera.layers ) ) {
|
|
1952
2067
|
|
|
@@ -1993,9 +2108,7 @@ class WebGLRenderer {
|
|
|
1993
2108
|
|
|
1994
2109
|
const renderItem = renderList[ i ];
|
|
1995
2110
|
|
|
1996
|
-
const object = renderItem
|
|
1997
|
-
const geometry = renderItem.geometry;
|
|
1998
|
-
const group = renderItem.group;
|
|
2111
|
+
const { object, geometry, group } = renderItem;
|
|
1999
2112
|
let material = renderItem.material;
|
|
2000
2113
|
|
|
2001
2114
|
if ( material.allowOverride === true && overrideMaterial !== null ) {
|
|
@@ -2056,16 +2169,18 @@ class WebGLRenderer {
|
|
|
2056
2169
|
|
|
2057
2170
|
const lightsStateVersion = lights.state.version;
|
|
2058
2171
|
|
|
2059
|
-
const parameters = programCache.getParameters( material, lights.state, shadowsArray, scene, object );
|
|
2172
|
+
const parameters = programCache.getParameters( material, lights.state, shadowsArray, scene, object, currentRenderState.state.lightProbeGridArray );
|
|
2060
2173
|
const programCacheKey = programCache.getProgramCacheKey( parameters );
|
|
2061
2174
|
|
|
2062
2175
|
let programs = materialProperties.programs;
|
|
2063
2176
|
|
|
2064
2177
|
// always update environment and fog - changing these trigger an getProgram call, but it's possible that the program doesn't change
|
|
2065
2178
|
|
|
2066
|
-
materialProperties.environment = material.isMeshStandardMaterial ? scene.environment : null;
|
|
2179
|
+
materialProperties.environment = ( material.isMeshStandardMaterial || material.isMeshLambertMaterial || material.isMeshPhongMaterial ) ? scene.environment : null;
|
|
2067
2180
|
materialProperties.fog = scene.fog;
|
|
2068
|
-
|
|
2181
|
+
|
|
2182
|
+
const usePMREM = material.isMeshStandardMaterial || ( material.isMeshLambertMaterial && ! material.envMap ) || ( material.isMeshPhongMaterial && ! material.envMap );
|
|
2183
|
+
materialProperties.envMap = environments.get( material.envMap || materialProperties.environment, usePMREM );
|
|
2069
2184
|
materialProperties.envMapRotation = ( materialProperties.environment !== null && material.envMap === null ) ? scene.environmentRotation : material.envMapRotation;
|
|
2070
2185
|
|
|
2071
2186
|
if ( programs === undefined ) {
|
|
@@ -2097,6 +2212,13 @@ class WebGLRenderer {
|
|
|
2097
2212
|
|
|
2098
2213
|
parameters.uniforms = programCache.getUniforms( material );
|
|
2099
2214
|
|
|
2215
|
+
// Use node builder for node materials if available
|
|
2216
|
+
if ( _nodesHandler !== null && material.isNodeMaterial ) {
|
|
2217
|
+
|
|
2218
|
+
_nodesHandler.build( material, object, parameters );
|
|
2219
|
+
|
|
2220
|
+
}
|
|
2221
|
+
|
|
2100
2222
|
material.onBeforeCompile( parameters, _this );
|
|
2101
2223
|
|
|
2102
2224
|
program = programCache.acquireProgram( parameters, programCacheKey );
|
|
@@ -2138,17 +2260,16 @@ class WebGLRenderer {
|
|
|
2138
2260
|
uniforms.pointLightShadows.value = lights.state.pointShadow;
|
|
2139
2261
|
uniforms.hemisphereLights.value = lights.state.hemi;
|
|
2140
2262
|
|
|
2141
|
-
uniforms.directionalShadowMap.value = lights.state.directionalShadowMap;
|
|
2142
2263
|
uniforms.directionalShadowMatrix.value = lights.state.directionalShadowMatrix;
|
|
2143
|
-
uniforms.spotShadowMap.value = lights.state.spotShadowMap;
|
|
2144
2264
|
uniforms.spotLightMatrix.value = lights.state.spotLightMatrix;
|
|
2145
2265
|
uniforms.spotLightMap.value = lights.state.spotLightMap;
|
|
2146
|
-
uniforms.pointShadowMap.value = lights.state.pointShadowMap;
|
|
2147
2266
|
uniforms.pointShadowMatrix.value = lights.state.pointShadowMatrix;
|
|
2148
2267
|
// TODO (abelnation): add area lights shadow info to uniforms
|
|
2149
2268
|
|
|
2150
2269
|
}
|
|
2151
2270
|
|
|
2271
|
+
materialProperties.lightProbeGrid = currentRenderState.state.lightProbeGridArray.length > 0;
|
|
2272
|
+
|
|
2152
2273
|
materialProperties.currentProgram = program;
|
|
2153
2274
|
materialProperties.uniformsList = null;
|
|
2154
2275
|
|
|
@@ -2193,6 +2314,30 @@ class WebGLRenderer {
|
|
|
2193
2314
|
|
|
2194
2315
|
}
|
|
2195
2316
|
|
|
2317
|
+
function findLightProbeGrid( volumes, object ) {
|
|
2318
|
+
|
|
2319
|
+
if ( volumes.length === 0 ) return null;
|
|
2320
|
+
|
|
2321
|
+
if ( volumes.length === 1 ) {
|
|
2322
|
+
|
|
2323
|
+
return volumes[ 0 ].texture !== null ? volumes[ 0 ] : null;
|
|
2324
|
+
|
|
2325
|
+
}
|
|
2326
|
+
|
|
2327
|
+
objectPosition.setFromMatrixPosition( object.matrixWorld );
|
|
2328
|
+
|
|
2329
|
+
for ( let i = 0, l = volumes.length; i < l; i ++ ) {
|
|
2330
|
+
|
|
2331
|
+
const v = volumes[ i ];
|
|
2332
|
+
|
|
2333
|
+
if ( v.texture !== null && v.boundingBox.containsPoint( objectPosition ) ) return v;
|
|
2334
|
+
|
|
2335
|
+
}
|
|
2336
|
+
|
|
2337
|
+
return null;
|
|
2338
|
+
|
|
2339
|
+
}
|
|
2340
|
+
|
|
2196
2341
|
function setProgram( camera, scene, geometry, material, object ) {
|
|
2197
2342
|
|
|
2198
2343
|
if ( scene.isScene !== true ) scene = _emptyScene; // scene could be a Mesh, Line, Points, ...
|
|
@@ -2200,9 +2345,10 @@ class WebGLRenderer {
|
|
|
2200
2345
|
textures.resetTextureUnits();
|
|
2201
2346
|
|
|
2202
2347
|
const fog = scene.fog;
|
|
2203
|
-
const environment = material.isMeshStandardMaterial ? scene.environment : null;
|
|
2204
|
-
const colorSpace = ( _currentRenderTarget === null ) ? _this.outputColorSpace : ( _currentRenderTarget.isXRRenderTarget === true ? _currentRenderTarget.texture.colorSpace :
|
|
2205
|
-
const
|
|
2348
|
+
const environment = ( material.isMeshStandardMaterial || material.isMeshLambertMaterial || material.isMeshPhongMaterial ) ? scene.environment : null;
|
|
2349
|
+
const colorSpace = ( _currentRenderTarget === null ) ? _this.outputColorSpace : ( _currentRenderTarget.isXRRenderTarget === true ? _currentRenderTarget.texture.colorSpace : ColorManagement.workingColorSpace );
|
|
2350
|
+
const usePMREM = material.isMeshStandardMaterial || ( material.isMeshLambertMaterial && ! material.envMap ) || ( material.isMeshPhongMaterial && ! material.envMap );
|
|
2351
|
+
const envMap = environments.get( material.envMap || environment, usePMREM );
|
|
2206
2352
|
const vertexAlphas = material.vertexColors === true && !! geometry.attributes.color && geometry.attributes.color.itemSize === 4;
|
|
2207
2353
|
const vertexTangents = !! geometry.attributes.tangent && ( !! material.normalMap || material.anisotropy > 0 );
|
|
2208
2354
|
const morphTargets = !! geometry.morphAttributes.position;
|
|
@@ -2350,6 +2496,10 @@ class WebGLRenderer {
|
|
|
2350
2496
|
|
|
2351
2497
|
needsProgramChange = true;
|
|
2352
2498
|
|
|
2499
|
+
} else if ( !! materialProperties.lightProbeGrid !== ( currentRenderState.state.lightProbeGridArray.length > 0 ) ) {
|
|
2500
|
+
|
|
2501
|
+
needsProgramChange = true;
|
|
2502
|
+
|
|
2353
2503
|
} else if ( materialProperties.numMultiviewViews !== numMultiviewViews ) {
|
|
2354
2504
|
|
|
2355
2505
|
needsProgramChange = true;
|
|
@@ -2371,6 +2521,14 @@ class WebGLRenderer {
|
|
|
2371
2521
|
|
|
2372
2522
|
program = getProgram( material, scene, object );
|
|
2373
2523
|
|
|
2524
|
+
// notify the node builder that the program has changed so uniforms and update nodes can
|
|
2525
|
+
// be cached and triggered.
|
|
2526
|
+
if ( _nodesHandler && material.isNodeMaterial ) {
|
|
2527
|
+
|
|
2528
|
+
_nodesHandler.onUpdateProgram( material, program, materialProperties );
|
|
2529
|
+
|
|
2530
|
+
}
|
|
2531
|
+
|
|
2374
2532
|
}
|
|
2375
2533
|
|
|
2376
2534
|
let refreshProgram = false;
|
|
@@ -2396,6 +2554,19 @@ class WebGLRenderer {
|
|
|
2396
2554
|
|
|
2397
2555
|
}
|
|
2398
2556
|
|
|
2557
|
+
if ( materialProperties.needsLights ) {
|
|
2558
|
+
|
|
2559
|
+
const objectVolume = findLightProbeGrid( currentRenderState.state.lightProbeGridArray, object );
|
|
2560
|
+
|
|
2561
|
+
if ( materialProperties.lightProbeGrid !== objectVolume ) {
|
|
2562
|
+
|
|
2563
|
+
materialProperties.lightProbeGrid = objectVolume;
|
|
2564
|
+
refreshMaterial = true;
|
|
2565
|
+
|
|
2566
|
+
}
|
|
2567
|
+
|
|
2568
|
+
}
|
|
2569
|
+
|
|
2399
2570
|
if ( refreshProgram || _currentCamera !== camera ) {
|
|
2400
2571
|
|
|
2401
2572
|
// common camera uniforms
|
|
@@ -2422,6 +2593,7 @@ class WebGLRenderer {
|
|
|
2422
2593
|
|
|
2423
2594
|
}
|
|
2424
2595
|
|
|
2596
|
+
|
|
2425
2597
|
const uCamPos = p_uniforms.map.cameraPosition;
|
|
2426
2598
|
|
|
2427
2599
|
if ( uCamPos !== undefined ) {
|
|
@@ -2465,6 +2637,30 @@ class WebGLRenderer {
|
|
|
2465
2637
|
|
|
2466
2638
|
}
|
|
2467
2639
|
|
|
2640
|
+
// Pre-allocate texture units for shadow samplers before setting data textures
|
|
2641
|
+
if ( materialProperties.needsLights ) {
|
|
2642
|
+
|
|
2643
|
+
// Set shadow map uniforms first to ensure they get the first texture units
|
|
2644
|
+
if ( lights.state.directionalShadowMap.length > 0 ) {
|
|
2645
|
+
|
|
2646
|
+
p_uniforms.setValue( _gl, 'directionalShadowMap', lights.state.directionalShadowMap, textures );
|
|
2647
|
+
|
|
2648
|
+
}
|
|
2649
|
+
|
|
2650
|
+
if ( lights.state.spotShadowMap.length > 0 ) {
|
|
2651
|
+
|
|
2652
|
+
p_uniforms.setValue( _gl, 'spotShadowMap', lights.state.spotShadowMap, textures );
|
|
2653
|
+
|
|
2654
|
+
}
|
|
2655
|
+
|
|
2656
|
+
if ( lights.state.pointShadowMap.length > 0 ) {
|
|
2657
|
+
|
|
2658
|
+
p_uniforms.setValue( _gl, 'pointShadowMap', lights.state.pointShadowMap, textures );
|
|
2659
|
+
|
|
2660
|
+
}
|
|
2661
|
+
|
|
2662
|
+
}
|
|
2663
|
+
|
|
2468
2664
|
// skinning and morph target uniforms must be set even if material didn't change
|
|
2469
2665
|
// auto-setting of texture unit for bone and morph texture must go before other textures
|
|
2470
2666
|
// otherwise textures used for skinning and morphing can take over texture units reserved for other material textures
|
|
@@ -2518,19 +2714,16 @@ class WebGLRenderer {
|
|
|
2518
2714
|
|
|
2519
2715
|
}
|
|
2520
2716
|
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
if ( material.isMeshGouraudMaterial && material.envMap !== null ) {
|
|
2717
|
+
if ( ( material.isMeshStandardMaterial || material.isMeshLambertMaterial || material.isMeshPhongMaterial ) && material.envMap === null && scene.environment !== null ) {
|
|
2524
2718
|
|
|
2525
|
-
m_uniforms.
|
|
2526
|
-
|
|
2527
|
-
m_uniforms.flipEnvMap.value = ( envMap.isCubeTexture && envMap.isRenderTargetTexture === false ) ? - 1 : 1;
|
|
2719
|
+
m_uniforms.envMapIntensity.value = scene.environmentIntensity;
|
|
2528
2720
|
|
|
2529
2721
|
}
|
|
2530
2722
|
|
|
2531
|
-
|
|
2723
|
+
// Set DFG LUT for physically-based materials
|
|
2724
|
+
if ( m_uniforms.dfgLUT !== undefined ) {
|
|
2532
2725
|
|
|
2533
|
-
m_uniforms.
|
|
2726
|
+
m_uniforms.dfgLUT.value = getDFGLUT();
|
|
2534
2727
|
|
|
2535
2728
|
}
|
|
2536
2729
|
|
|
@@ -2563,6 +2756,19 @@ class WebGLRenderer {
|
|
|
2563
2756
|
|
|
2564
2757
|
materials.refreshMaterialUniforms( m_uniforms, material, _pixelRatio, _height, currentRenderState.state.transmissionRenderTarget[ camera.id ] );
|
|
2565
2758
|
|
|
2759
|
+
// light probe volume
|
|
2760
|
+
|
|
2761
|
+
if ( materialProperties.needsLights && materialProperties.lightProbeGrid ) {
|
|
2762
|
+
|
|
2763
|
+
const volume = materialProperties.lightProbeGrid;
|
|
2764
|
+
|
|
2765
|
+
m_uniforms.probesSH.value = volume.texture;
|
|
2766
|
+
m_uniforms.probesMin.value.copy( volume.boundingBox.min );
|
|
2767
|
+
m_uniforms.probesMax.value.copy( volume.boundingBox.max );
|
|
2768
|
+
m_uniforms.probesResolution.value.copy( volume.resolution );
|
|
2769
|
+
|
|
2770
|
+
}
|
|
2771
|
+
|
|
2566
2772
|
WebGLUniforms.upload( _gl, getUniformList( materialProperties ), m_uniforms, textures );
|
|
2567
2773
|
|
|
2568
2774
|
}
|
|
@@ -2597,7 +2803,7 @@ class WebGLRenderer {
|
|
|
2597
2803
|
|
|
2598
2804
|
// UBOs
|
|
2599
2805
|
|
|
2600
|
-
if ( material.
|
|
2806
|
+
if ( material.uniformsGroups !== undefined ) {
|
|
2601
2807
|
|
|
2602
2808
|
const groups = material.uniformsGroups;
|
|
2603
2809
|
|
|
@@ -2707,7 +2913,7 @@ class WebGLRenderer {
|
|
|
2707
2913
|
const renderTargetProperties = properties.get( renderTarget );
|
|
2708
2914
|
|
|
2709
2915
|
renderTargetProperties.__autoAllocateDepthBuffer = renderTarget.resolveDepthBuffer === false;
|
|
2710
|
-
if (
|
|
2916
|
+
if ( renderTargetProperties.__autoAllocateDepthBuffer === false && ( ! _currentRenderTarget || ! _currentRenderTarget.isWebGLMultiviewRenderTarget ) ) {
|
|
2711
2917
|
|
|
2712
2918
|
// The multisample_render_to_texture extension doesn't work properly if there
|
|
2713
2919
|
// are midframe flushes and an external depth buffer. Disable use of the extension.
|
|
@@ -2754,7 +2960,6 @@ class WebGLRenderer {
|
|
|
2754
2960
|
_currentActiveCubeFace = activeCubeFace;
|
|
2755
2961
|
_currentActiveMipmapLevel = activeMipmapLevel;
|
|
2756
2962
|
|
|
2757
|
-
let useDefaultFramebuffer = true;
|
|
2758
2963
|
let framebuffer = null;
|
|
2759
2964
|
let isCube = false;
|
|
2760
2965
|
let isRenderTarget3D = false;
|
|
@@ -2765,9 +2970,21 @@ class WebGLRenderer {
|
|
|
2765
2970
|
|
|
2766
2971
|
if ( renderTargetProperties.__useDefaultFramebuffer !== undefined ) {
|
|
2767
2972
|
|
|
2768
|
-
//
|
|
2769
|
-
|
|
2770
|
-
|
|
2973
|
+
// Externally-managed framebuffer (e.g. XR)
|
|
2974
|
+
// Bind to the stored framebuffer (may be null for default, or a WebGLFramebuffer)
|
|
2975
|
+
state.bindFramebuffer( _gl.FRAMEBUFFER, renderTargetProperties.__webglFramebuffer );
|
|
2976
|
+
|
|
2977
|
+
_currentViewport.copy( renderTarget.viewport );
|
|
2978
|
+
_currentScissor.copy( renderTarget.scissor );
|
|
2979
|
+
_currentScissorTest = renderTarget.scissorTest;
|
|
2980
|
+
|
|
2981
|
+
state.viewport( _currentViewport );
|
|
2982
|
+
state.scissor( _currentScissor );
|
|
2983
|
+
state.setScissorTest( _currentScissorTest );
|
|
2984
|
+
|
|
2985
|
+
_currentMaterialId = - 1;
|
|
2986
|
+
|
|
2987
|
+
return;
|
|
2771
2988
|
|
|
2772
2989
|
} else if ( renderTargetProperties.__webglFramebuffer === undefined ) {
|
|
2773
2990
|
|
|
@@ -2866,7 +3083,7 @@ class WebGLRenderer {
|
|
|
2866
3083
|
|
|
2867
3084
|
const framebufferBound = state.bindFramebuffer( _gl.FRAMEBUFFER, framebuffer );
|
|
2868
3085
|
|
|
2869
|
-
if ( framebufferBound
|
|
3086
|
+
if ( framebufferBound ) {
|
|
2870
3087
|
|
|
2871
3088
|
state.drawBuffers( renderTarget, framebuffer );
|
|
2872
3089
|
|
|
@@ -2922,7 +3139,7 @@ class WebGLRenderer {
|
|
|
2922
3139
|
|
|
2923
3140
|
if ( ! ( renderTarget && renderTarget.isWebGLRenderTarget ) ) {
|
|
2924
3141
|
|
|
2925
|
-
|
|
3142
|
+
error( 'WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.' );
|
|
2926
3143
|
return;
|
|
2927
3144
|
|
|
2928
3145
|
}
|
|
@@ -2945,16 +3162,20 @@ class WebGLRenderer {
|
|
|
2945
3162
|
const textureFormat = texture.format;
|
|
2946
3163
|
const textureType = texture.type;
|
|
2947
3164
|
|
|
3165
|
+
// when using MRT, select the correct color buffer for the subsequent read command
|
|
3166
|
+
|
|
3167
|
+
if ( renderTarget.textures.length > 1 ) _gl.readBuffer( _gl.COLOR_ATTACHMENT0 + textureIndex );
|
|
3168
|
+
|
|
2948
3169
|
if ( ! capabilities.textureFormatReadable( textureFormat ) ) {
|
|
2949
3170
|
|
|
2950
|
-
|
|
3171
|
+
error( 'WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.' );
|
|
2951
3172
|
return;
|
|
2952
3173
|
|
|
2953
3174
|
}
|
|
2954
3175
|
|
|
2955
3176
|
if ( ! capabilities.textureTypeReadable( textureType ) ) {
|
|
2956
3177
|
|
|
2957
|
-
|
|
3178
|
+
error( 'WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.' );
|
|
2958
3179
|
return;
|
|
2959
3180
|
|
|
2960
3181
|
}
|
|
@@ -2963,10 +3184,6 @@ class WebGLRenderer {
|
|
|
2963
3184
|
|
|
2964
3185
|
if ( ( x >= 0 && x <= ( renderTarget.width - width ) ) && ( y >= 0 && y <= ( renderTarget.height - height ) ) ) {
|
|
2965
3186
|
|
|
2966
|
-
// when using MRT, select the correct color buffer for the subsequent read command
|
|
2967
|
-
|
|
2968
|
-
if ( renderTarget.textures.length > 1 ) _gl.readBuffer( _gl.COLOR_ATTACHMENT0 + textureIndex );
|
|
2969
|
-
|
|
2970
3187
|
_gl.readPixels( x, y, width, height, utils.convert( textureFormat ), utils.convert( textureType ), buffer );
|
|
2971
3188
|
|
|
2972
3189
|
}
|
|
@@ -3027,6 +3244,11 @@ class WebGLRenderer {
|
|
|
3027
3244
|
const textureFormat = texture.format;
|
|
3028
3245
|
const textureType = texture.type;
|
|
3029
3246
|
|
|
3247
|
+
// when using MRT, select the correct color buffer for the subsequent read command
|
|
3248
|
+
|
|
3249
|
+
if ( renderTarget.textures.length > 1 ) _gl.readBuffer( _gl.COLOR_ATTACHMENT0 + textureIndex );
|
|
3250
|
+
|
|
3251
|
+
|
|
3030
3252
|
if ( ! capabilities.textureFormatReadable( textureFormat ) ) {
|
|
3031
3253
|
|
|
3032
3254
|
throw new Error( 'THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.' );
|
|
@@ -3043,10 +3265,6 @@ class WebGLRenderer {
|
|
|
3043
3265
|
_gl.bindBuffer( _gl.PIXEL_PACK_BUFFER, glBuffer );
|
|
3044
3266
|
_gl.bufferData( _gl.PIXEL_PACK_BUFFER, buffer.byteLength, _gl.STREAM_READ );
|
|
3045
3267
|
|
|
3046
|
-
// when using MRT, select the correct color buffer for the subsequent read command
|
|
3047
|
-
|
|
3048
|
-
if ( renderTarget.textures.length > 1 ) _gl.readBuffer( _gl.COLOR_ATTACHMENT0 + textureIndex );
|
|
3049
|
-
|
|
3050
3268
|
_gl.readPixels( x, y, width, height, utils.convert( textureFormat ), utils.convert( textureType ), 0 );
|
|
3051
3269
|
|
|
3052
3270
|
// reset the frame buffer to the currently set buffer before waiting
|
|
@@ -3116,27 +3334,9 @@ class WebGLRenderer {
|
|
|
3116
3334
|
* @param {?(Box2|Box3)} [srcRegion=null] - A bounding box which describes the source region. Can be two or three-dimensional.
|
|
3117
3335
|
* @param {?(Vector2|Vector3)} [dstPosition=null] - A vector that represents the origin of the destination region. Can be two or three-dimensional.
|
|
3118
3336
|
* @param {number} [srcLevel=0] - The source mipmap level to copy.
|
|
3119
|
-
* @param {?number} [dstLevel=
|
|
3337
|
+
* @param {?number} [dstLevel=0] - The destination mipmap level.
|
|
3120
3338
|
*/
|
|
3121
|
-
this.copyTextureToTexture = function ( srcTexture, dstTexture, srcRegion = null, dstPosition = null, srcLevel = 0, dstLevel =
|
|
3122
|
-
|
|
3123
|
-
// support the previous signature with just a single dst mipmap level
|
|
3124
|
-
if ( dstLevel === null ) {
|
|
3125
|
-
|
|
3126
|
-
if ( srcLevel !== 0 ) {
|
|
3127
|
-
|
|
3128
|
-
// @deprecated, r171
|
|
3129
|
-
warnOnce( 'WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels.' );
|
|
3130
|
-
dstLevel = srcLevel;
|
|
3131
|
-
srcLevel = 0;
|
|
3132
|
-
|
|
3133
|
-
} else {
|
|
3134
|
-
|
|
3135
|
-
dstLevel = 0;
|
|
3136
|
-
|
|
3137
|
-
}
|
|
3138
|
-
|
|
3139
|
-
}
|
|
3339
|
+
this.copyTextureToTexture = function ( srcTexture, dstTexture, srcRegion = null, dstPosition = null, srcLevel = 0, dstLevel = 0 ) {
|
|
3140
3340
|
|
|
3141
3341
|
// gather the necessary dimensions to copy
|
|
3142
3342
|
let width, height, depth, minX, minY, minZ;
|
|
@@ -3212,22 +3412,24 @@ class WebGLRenderer {
|
|
|
3212
3412
|
|
|
3213
3413
|
}
|
|
3214
3414
|
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3415
|
+
state.activeTexture( _gl.TEXTURE0 ); // see #33153
|
|
3416
|
+
|
|
3417
|
+
state.pixelStorei( _gl.UNPACK_FLIP_Y_WEBGL, dstTexture.flipY );
|
|
3418
|
+
state.pixelStorei( _gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, dstTexture.premultiplyAlpha );
|
|
3419
|
+
state.pixelStorei( _gl.UNPACK_ALIGNMENT, dstTexture.unpackAlignment );
|
|
3218
3420
|
|
|
3219
3421
|
// used for copying data from cpu
|
|
3220
|
-
const currentUnpackRowLen =
|
|
3221
|
-
const currentUnpackImageHeight =
|
|
3222
|
-
const currentUnpackSkipPixels =
|
|
3223
|
-
const currentUnpackSkipRows =
|
|
3224
|
-
const currentUnpackSkipImages =
|
|
3225
|
-
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
3422
|
+
const currentUnpackRowLen = state.getParameter( _gl.UNPACK_ROW_LENGTH );
|
|
3423
|
+
const currentUnpackImageHeight = state.getParameter( _gl.UNPACK_IMAGE_HEIGHT );
|
|
3424
|
+
const currentUnpackSkipPixels = state.getParameter( _gl.UNPACK_SKIP_PIXELS );
|
|
3425
|
+
const currentUnpackSkipRows = state.getParameter( _gl.UNPACK_SKIP_ROWS );
|
|
3426
|
+
const currentUnpackSkipImages = state.getParameter( _gl.UNPACK_SKIP_IMAGES );
|
|
3427
|
+
|
|
3428
|
+
state.pixelStorei( _gl.UNPACK_ROW_LENGTH, image.width );
|
|
3429
|
+
state.pixelStorei( _gl.UNPACK_IMAGE_HEIGHT, image.height );
|
|
3430
|
+
state.pixelStorei( _gl.UNPACK_SKIP_PIXELS, minX );
|
|
3431
|
+
state.pixelStorei( _gl.UNPACK_SKIP_ROWS, minY );
|
|
3432
|
+
state.pixelStorei( _gl.UNPACK_SKIP_IMAGES, minZ );
|
|
3231
3433
|
|
|
3232
3434
|
// set up the src texture
|
|
3233
3435
|
const isSrc3D = srcTexture.isDataArrayTexture || srcTexture.isData3DTexture;
|
|
@@ -3353,11 +3555,11 @@ class WebGLRenderer {
|
|
|
3353
3555
|
}
|
|
3354
3556
|
|
|
3355
3557
|
// reset values
|
|
3356
|
-
|
|
3357
|
-
|
|
3358
|
-
|
|
3359
|
-
|
|
3360
|
-
|
|
3558
|
+
state.pixelStorei( _gl.UNPACK_ROW_LENGTH, currentUnpackRowLen );
|
|
3559
|
+
state.pixelStorei( _gl.UNPACK_IMAGE_HEIGHT, currentUnpackImageHeight );
|
|
3560
|
+
state.pixelStorei( _gl.UNPACK_SKIP_PIXELS, currentUnpackSkipPixels );
|
|
3561
|
+
state.pixelStorei( _gl.UNPACK_SKIP_ROWS, currentUnpackSkipRows );
|
|
3562
|
+
state.pixelStorei( _gl.UNPACK_SKIP_IMAGES, currentUnpackSkipImages );
|
|
3361
3563
|
|
|
3362
3564
|
// Generate mipmaps only when copying level 0
|
|
3363
3565
|
if ( dstLevel === 0 && dstTexture.generateMipmaps ) {
|
|
@@ -3370,15 +3572,6 @@ class WebGLRenderer {
|
|
|
3370
3572
|
|
|
3371
3573
|
};
|
|
3372
3574
|
|
|
3373
|
-
this.copyTextureToTexture3D = function ( srcTexture, dstTexture, srcRegion = null, dstPosition = null, level = 0 ) {
|
|
3374
|
-
|
|
3375
|
-
// @deprecated, r170
|
|
3376
|
-
warnOnce( 'WebGLRenderer: copyTextureToTexture3D function has been deprecated. Use "copyTextureToTexture" instead.' );
|
|
3377
|
-
|
|
3378
|
-
return this.copyTextureToTexture( srcTexture, dstTexture, srcRegion, dstPosition, level );
|
|
3379
|
-
|
|
3380
|
-
};
|
|
3381
|
-
|
|
3382
3575
|
/**
|
|
3383
3576
|
* Initializes the given WebGLRenderTarget memory. Useful for initializing a render target so data
|
|
3384
3577
|
* can be copied into it using {@link WebGLRenderer#copyTextureToTexture} before it has been
|
|
@@ -3495,7 +3688,7 @@ class WebGLRenderer {
|
|
|
3495
3688
|
* WebGLRenderer options.
|
|
3496
3689
|
*
|
|
3497
3690
|
* @typedef {Object} WebGLRenderer~Options
|
|
3498
|
-
* @property {
|
|
3691
|
+
* @property {HTMLCanvasElement|OffscreenCanvas} [canvas=null] - A canvas element where the renderer draws its output. If not passed in here, a new canvas element will be created by the renderer.
|
|
3499
3692
|
* @property {WebGL2RenderingContext} [context=null] - Can be used to attach an existing rendering context to this renderer.
|
|
3500
3693
|
* @property {('highp'|'mediump'|'lowp')} [precision='highp'] - The default shader precision. Uses `highp` if supported by the device.
|
|
3501
3694
|
* @property {boolean} [alpha=false] - Controls the default clear alpha value. When set to`true`, the value is `0`. Otherwise it's `1`.
|
|
@@ -3510,6 +3703,7 @@ class WebGLRenderer {
|
|
|
3510
3703
|
* Note that this setting uses `gl_FragDepth` if available which disables the Early Fragment Test optimization and can cause a decrease in performance.
|
|
3511
3704
|
* @property {boolean} [reversedDepthBuffer=false] Whether to use a reverse depth buffer. Requires the `EXT_clip_control` extension.
|
|
3512
3705
|
* This is a more faster and accurate version than logarithmic depth buffer.
|
|
3706
|
+
* @property {number} [outputBufferType=UnsignedByteType] Defines the type of the output buffer. Use `HalfFloatType` for HDR rendering with tone mapping and post-processing support.
|
|
3513
3707
|
**/
|
|
3514
3708
|
|
|
3515
3709
|
/**
|
|
@@ -3531,7 +3725,6 @@ class WebGLRenderer {
|
|
|
3531
3725
|
* @property {string} precision - The shader precision currently being used by the renderer.
|
|
3532
3726
|
* @property {boolean} reversedDepthBuffer - `true` if `reversedDepthBuffer` was set to `true` in the constructor
|
|
3533
3727
|
* and the rendering context supports `EXT_clip_control`.
|
|
3534
|
-
* @property {boolean} vertexTextures - `true` if vertex textures can be used.
|
|
3535
3728
|
**/
|
|
3536
3729
|
|
|
3537
3730
|
/**
|
|
@@ -3573,7 +3766,7 @@ class WebGLRenderer {
|
|
|
3573
3766
|
* If you do not require dynamic lighting / shadows, you may set this to `false`.
|
|
3574
3767
|
* @property {boolean} [needsUpdate=false] - When set to `true`, shadow maps in the scene
|
|
3575
3768
|
* will be updated in the next `render` call.
|
|
3576
|
-
* @property {(BasicShadowMap|PCFShadowMap|
|
|
3769
|
+
* @property {(BasicShadowMap|PCFShadowMap|VSMShadowMap)} [type=PCFShadowMap] - Defines the shadow map type.
|
|
3577
3770
|
**/
|
|
3578
3771
|
|
|
3579
3772
|
export { WebGLRenderer };
|