@plastic-software/three 0.179.0 → 0.181.1
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/build/three.cjs +1108 -591
- package/build/three.core.js +616 -345
- package/build/three.core.min.js +1 -1
- package/build/three.module.js +488 -250
- package/build/three.module.min.js +1 -1
- package/build/three.tsl.js +37 -6
- package/build/three.tsl.min.js +1 -1
- package/build/three.webgpu.js +6576 -2152
- package/build/three.webgpu.min.js +1 -1
- package/build/three.webgpu.nodes.js +6575 -2151
- package/build/three.webgpu.nodes.min.js +1 -1
- package/examples/fonts/MPLUSRounded1c/MPLUSRounded1c-Regular.typeface.json.zip +0 -0
- package/examples/fonts/MPLUSRounded1c/OFL.txt +91 -0
- package/examples/jsm/Addons.js +1 -1
- package/examples/jsm/animation/CCDIKSolver.js +1 -1
- package/examples/jsm/controls/ArcballControls.js +8 -8
- package/examples/jsm/controls/DragControls.js +7 -57
- package/examples/jsm/controls/FirstPersonControls.js +3 -3
- package/examples/jsm/controls/FlyControls.js +1 -1
- package/examples/jsm/controls/OrbitControls.js +2 -2
- package/examples/jsm/controls/PointerLockControls.js +2 -10
- package/examples/jsm/controls/TrackballControls.js +1 -1
- package/examples/jsm/controls/TransformControls.js +1 -1
- package/examples/jsm/effects/AsciiEffect.js +8 -8
- package/examples/jsm/exporters/DRACOExporter.js +2 -2
- package/examples/jsm/exporters/EXRExporter.js +1 -1
- package/examples/jsm/exporters/GLTFExporter.js +33 -25
- package/examples/jsm/exporters/KTX2Exporter.js +4 -2
- package/examples/jsm/exporters/PLYExporter.js +1 -1
- package/examples/jsm/exporters/USDZExporter.js +9 -2
- package/examples/jsm/geometries/DecalGeometry.js +2 -2
- package/examples/jsm/geometries/ParametricGeometry.js +1 -1
- package/examples/jsm/geometries/TeapotGeometry.js +2 -2
- package/examples/jsm/geometries/TextGeometry.js +3 -2
- package/examples/jsm/gpgpu/BitonicSort.js +715 -0
- package/examples/jsm/helpers/ViewHelper.js +43 -5
- package/examples/jsm/inspector/Inspector.js +427 -0
- package/examples/jsm/inspector/RendererInspector.js +415 -0
- package/examples/jsm/inspector/tabs/Console.js +204 -0
- package/examples/jsm/inspector/tabs/Parameters.js +332 -0
- package/examples/jsm/inspector/tabs/Performance.js +268 -0
- package/examples/jsm/inspector/tabs/Viewer.js +166 -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 +170 -0
- package/examples/jsm/inspector/ui/Style.js +654 -0
- package/examples/jsm/inspector/ui/Tab.js +46 -0
- package/examples/jsm/inspector/ui/Values.js +423 -0
- package/examples/jsm/inspector/ui/utils.js +56 -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/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/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/3MFLoader.js +1 -1
- package/examples/jsm/loaders/ColladaLoader.js +3 -3
- package/examples/jsm/loaders/DDSLoader.js +1 -1
- package/examples/jsm/loaders/DRACOLoader.js +73 -22
- package/examples/jsm/loaders/EXRLoader.js +5 -5
- package/examples/jsm/loaders/FBXLoader.js +2 -2
- package/examples/jsm/loaders/FontLoader.js +23 -5
- package/examples/jsm/loaders/GLTFLoader.js +14 -8
- package/examples/jsm/loaders/HDRCubeTextureLoader.js +5 -5
- package/examples/jsm/loaders/HDRLoader.js +486 -0
- package/examples/jsm/loaders/KTX2Loader.js +136 -49
- package/examples/jsm/loaders/KTXLoader.js +2 -2
- package/examples/jsm/loaders/LDrawLoader.js +1 -1
- package/examples/jsm/loaders/LUT3dlLoader.js +2 -2
- package/examples/jsm/loaders/LUTCubeLoader.js +1 -1
- package/examples/jsm/loaders/LWOLoader.js +2 -2
- package/examples/jsm/loaders/MaterialXLoader.js +22 -5
- package/examples/jsm/loaders/OBJLoader.js +1 -1
- package/examples/jsm/loaders/PDBLoader.js +1 -1
- package/examples/jsm/loaders/RGBELoader.js +7 -473
- package/examples/jsm/loaders/SVGLoader.js +2 -2
- package/examples/jsm/loaders/TTFLoader.js +4 -4
- package/examples/jsm/loaders/UltraHDRLoader.js +2 -2
- package/examples/jsm/loaders/lwo/IFFParser.js +1 -1
- 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/SimplexNoise.js +1 -1
- 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/TubePainter.js +383 -40
- package/examples/jsm/misc/Volume.js +1 -1
- package/examples/jsm/modifiers/SimplifyModifier.js +1 -1
- package/examples/jsm/objects/ReflectorForSSRPass.js +1 -0
- package/examples/jsm/objects/Sky.js +1 -1
- package/examples/jsm/objects/SkyMesh.js +1 -1
- package/examples/jsm/objects/Water.js +3 -3
- package/examples/jsm/objects/WaterMesh.js +6 -6
- package/examples/jsm/postprocessing/GlitchPass.js +2 -2
- package/examples/jsm/postprocessing/OutlinePass.js +1 -1
- package/examples/jsm/postprocessing/SSRPass.js +37 -8
- package/examples/jsm/postprocessing/UnrealBloomPass.js +8 -6
- package/examples/jsm/renderers/CSS2DRenderer.js +16 -5
- package/examples/jsm/renderers/CSS3DRenderer.js +7 -6
- package/examples/jsm/renderers/SVGRenderer.js +1 -1
- 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 +2 -2
- package/examples/jsm/shaders/GodRaysShader.js +1 -1
- package/examples/jsm/shaders/KaleidoShader.js +1 -1
- package/examples/jsm/shaders/PoissonDenoiseShader.js +2 -2
- package/examples/jsm/shaders/SSRShader.js +1 -1
- 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 +1 -1
- package/examples/jsm/shaders/VignetteShader.js +1 -1
- package/examples/jsm/transpiler/GLSLDecoder.js +22 -19
- package/examples/jsm/transpiler/TSLEncoder.js +9 -10
- package/examples/jsm/transpiler/WGSLEncoder.js +24 -0
- package/examples/jsm/tsl/display/AfterImageNode.js +26 -24
- package/examples/jsm/tsl/display/AnamorphicNode.js +28 -4
- package/examples/jsm/tsl/display/BloomNode.js +7 -3
- package/examples/jsm/tsl/display/ChromaticAberrationNode.js +2 -1
- package/examples/jsm/tsl/display/DenoiseNode.js +2 -0
- package/examples/jsm/tsl/display/DepthOfFieldNode.js +446 -90
- package/examples/jsm/tsl/display/GTAONode.js +53 -5
- package/examples/jsm/tsl/display/GaussianBlurNode.js +49 -35
- package/examples/jsm/tsl/display/OutlineNode.js +13 -2
- package/examples/jsm/tsl/display/SSGINode.js +654 -0
- package/examples/jsm/tsl/display/SSRNode.js +182 -65
- package/examples/jsm/tsl/display/SSSNode.js +488 -0
- package/examples/jsm/tsl/display/TRAANode.js +124 -7
- package/examples/jsm/tsl/display/boxBlur.js +65 -0
- package/examples/jsm/tsl/display/hashBlur.js +16 -18
- package/examples/jsm/tsl/lighting/TiledLightsNode.js +21 -1
- package/examples/jsm/utils/BufferGeometryUtils.js +1 -1
- package/examples/jsm/utils/ShadowMapViewerGPU.js +12 -5
- package/examples/jsm/webxr/OculusHandModel.js +1 -1
- package/examples/jsm/webxr/XRControllerModelFactory.js +1 -1
- package/examples/jsm/webxr/XRHandModelFactory.js +2 -6
- package/package.json +5 -10
- package/src/Three.Core.js +4 -2
- package/src/Three.TSL.js +36 -5
- package/src/Three.WebGPU.Nodes.js +2 -0
- package/src/Three.WebGPU.js +2 -0
- package/src/animation/AnimationClip.js +20 -4
- package/src/animation/AnimationMixer.js +3 -3
- package/src/animation/AnimationObjectGroup.js +2 -1
- package/src/animation/KeyframeTrack.js +7 -6
- package/src/animation/PropertyBinding.js +12 -11
- package/src/audio/Audio.js +10 -9
- package/src/audio/PositionalAudio.js +1 -1
- 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 +11 -3
- package/src/core/BufferGeometry.js +10 -10
- 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 +3 -2
- package/src/core/Raycaster.js +2 -1
- package/src/core/RenderTarget.js +10 -1
- 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 +268 -55
- package/src/extras/TextureUtils.js +2 -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/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 +8 -6
- 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/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 +1 -0
- package/src/geometries/TorusKnotGeometry.js +1 -0
- package/src/geometries/TubeGeometry.js +1 -0
- package/src/helpers/CameraHelper.js +1 -1
- package/src/lights/webgpu/ProjectorLight.js +1 -1
- package/src/loaders/AnimationLoader.js +2 -1
- package/src/loaders/AudioLoader.js +2 -1
- package/src/loaders/BufferGeometryLoader.js +2 -2
- package/src/loaders/Cache.js +2 -2
- package/src/loaders/DataTextureLoader.js +1 -1
- package/src/loaders/FileLoader.js +3 -2
- package/src/loaders/ImageBitmapLoader.js +5 -4
- package/src/loaders/ImageLoader.js +1 -1
- package/src/loaders/Loader.js +3 -3
- package/src/loaders/LoadingManager.js +25 -3
- package/src/loaders/MaterialLoader.js +3 -2
- package/src/loaders/ObjectLoader.js +13 -13
- package/src/loaders/TextureLoader.js +1 -1
- package/src/loaders/nodes/NodeLoader.js +3 -2
- package/src/materials/Material.js +16 -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 +2 -1
- package/src/materials/MeshMatcapMaterial.js +22 -0
- package/src/materials/MeshNormalMaterial.js +1 -0
- package/src/materials/MeshPhongMaterial.js +2 -1
- package/src/materials/MeshPhysicalMaterial.js +2 -1
- package/src/materials/MeshStandardMaterial.js +8 -7
- package/src/materials/MeshToonMaterial.js +1 -0
- package/src/materials/PointsMaterial.js +1 -1
- package/src/materials/ShaderMaterial.js +2 -2
- package/src/materials/nodes/Line2NodeMaterial.js +2 -2
- package/src/materials/nodes/MeshSSSNodeMaterial.js +1 -1
- package/src/materials/nodes/NodeMaterial.js +62 -22
- package/src/materials/nodes/PointsNodeMaterial.js +81 -28
- package/src/materials/nodes/SpriteNodeMaterial.js +3 -15
- package/src/materials/nodes/manager/NodeMaterialObserver.js +3 -2
- 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/MathUtils.js +13 -11
- package/src/math/Matrix2.js +1 -1
- package/src/math/Matrix3.js +2 -2
- package/src/math/Matrix4.js +7 -7
- package/src/math/Plane.js +1 -1
- package/src/math/Quaternion.js +68 -66
- package/src/math/Spherical.js +1 -1
- package/src/nodes/Nodes.js +4 -1
- package/src/nodes/TSL.js +4 -1
- package/src/nodes/accessors/BufferNode.js +1 -1
- package/src/nodes/accessors/Camera.js +133 -7
- package/src/nodes/accessors/ClippingNode.js +6 -5
- package/src/nodes/accessors/CubeTextureNode.js +5 -4
- package/src/nodes/accessors/InstanceNode.js +25 -5
- package/src/nodes/accessors/Lights.js +10 -0
- package/src/nodes/accessors/Normal.js +5 -4
- package/src/nodes/accessors/Object3DNode.js +1 -1
- package/src/nodes/accessors/Position.js +18 -2
- package/src/nodes/accessors/ReferenceBaseNode.js +1 -1
- package/src/nodes/accessors/ReferenceNode.js +3 -2
- package/src/nodes/accessors/SceneNode.js +2 -1
- package/src/nodes/accessors/StorageBufferNode.js +2 -1
- package/src/nodes/accessors/StorageTextureNode.js +22 -0
- package/src/nodes/accessors/Texture3DNode.js +14 -1
- package/src/nodes/accessors/TextureNode.js +130 -44
- package/src/nodes/code/FunctionCallNode.js +24 -4
- package/src/nodes/code/FunctionNode.js +23 -0
- package/src/nodes/core/ArrayNode.js +1 -0
- package/src/nodes/core/AssignNode.js +4 -3
- package/src/nodes/core/AttributeNode.js +2 -1
- package/src/nodes/core/ContextNode.js +29 -10
- package/src/nodes/core/IndexNode.js +2 -2
- package/src/nodes/core/InputNode.js +2 -1
- package/src/nodes/core/InspectorNode.js +128 -0
- package/src/nodes/core/{CacheNode.js → IsolateNode.js} +40 -7
- package/src/nodes/core/Node.js +152 -31
- package/src/nodes/core/NodeBuilder.js +183 -35
- package/src/nodes/core/NodeFrame.js +21 -21
- 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 +17 -91
- package/src/nodes/core/ParameterNode.js +31 -0
- package/src/nodes/core/PropertyNode.js +7 -0
- package/src/nodes/core/StackNode.js +43 -16
- package/src/nodes/core/StructNode.js +5 -5
- package/src/nodes/core/StructTypeNode.js +1 -0
- package/src/nodes/core/SubBuildNode.js +2 -2
- package/src/nodes/core/UniformNode.js +18 -10
- package/src/nodes/core/VarNode.js +70 -33
- package/src/nodes/core/VaryingNode.js +3 -2
- package/src/nodes/display/BlendModes.js +5 -4
- package/src/nodes/display/BumpMapNode.js +1 -1
- package/src/nodes/display/ColorAdjustment.js +1 -1
- package/src/nodes/display/FrontFacingNode.js +4 -8
- package/src/nodes/display/NormalMapNode.js +2 -1
- package/src/nodes/display/PassNode.js +52 -11
- package/src/nodes/display/RenderOutputNode.js +28 -2
- package/src/nodes/display/ScreenNode.js +44 -14
- package/src/nodes/display/ToneMappingNode.js +31 -4
- package/src/nodes/display/ToonOutlinePassNode.js +8 -0
- package/src/nodes/display/ViewportDepthTextureNode.js +16 -4
- package/src/nodes/display/ViewportSharedTextureNode.js +12 -0
- package/src/nodes/display/ViewportTextureNode.js +42 -12
- package/src/nodes/fog/Fog.js +3 -2
- package/src/nodes/functions/BSDF/BRDF_GGX_Multiscatter.js +52 -0
- package/src/nodes/functions/BSDF/DFGApprox.js +60 -19
- package/src/nodes/functions/BasicLightingModel.js +2 -1
- package/src/nodes/functions/PhysicalLightingModel.js +3 -2
- package/src/nodes/functions/VolumetricLightingModel.js +5 -5
- package/src/nodes/geometry/RangeNode.js +40 -4
- package/src/nodes/gpgpu/ComputeBuiltinNode.js +2 -1
- package/src/nodes/gpgpu/ComputeNode.js +17 -5
- package/src/nodes/gpgpu/SubgroupFunctionNode.js +455 -0
- package/src/nodes/gpgpu/WorkgroupInfoNode.js +2 -1
- package/src/nodes/lighting/EnvironmentNode.js +6 -6
- package/src/nodes/lighting/LightsNode.js +3 -4
- package/src/nodes/lighting/PointShadowNode.js +6 -0
- package/src/nodes/lighting/ShadowFilterNode.js +2 -0
- package/src/nodes/lighting/ShadowNode.js +75 -8
- package/src/nodes/math/BitcastNode.js +156 -0
- package/src/nodes/math/ConditionalNode.js +24 -7
- package/src/nodes/math/MathNode.js +25 -19
- package/src/nodes/math/OperatorNode.js +7 -5
- package/src/nodes/pmrem/PMREMUtils.js +117 -2
- package/src/nodes/shapes/Shapes.js +1 -1
- package/src/nodes/tsl/TSLBase.js +5 -2
- package/src/nodes/tsl/TSLCore.js +460 -159
- package/src/nodes/utils/DebugNode.js +2 -1
- package/src/nodes/utils/EventNode.js +36 -0
- package/src/nodes/utils/FunctionOverloadingNode.js +37 -19
- package/src/nodes/utils/JoinNode.js +6 -3
- package/src/nodes/utils/LoopNode.js +20 -24
- package/src/nodes/utils/MemberNode.js +59 -7
- package/src/nodes/utils/PostProcessingUtils.js +28 -1
- package/src/nodes/utils/RTTNode.js +13 -3
- package/src/nodes/utils/ReflectorNode.js +58 -7
- package/src/nodes/utils/SampleNode.js +12 -2
- package/src/nodes/utils/SplitNode.js +11 -0
- package/src/nodes/utils/Timer.js +0 -47
- package/src/objects/BatchedMesh.js +2 -2
- package/src/objects/LOD.js +1 -1
- package/src/objects/Line.js +2 -1
- package/src/objects/LineSegments.js +2 -1
- package/src/objects/Skeleton.js +3 -2
- package/src/objects/SkinnedMesh.js +3 -1
- package/src/objects/Sprite.js +4 -3
- package/src/renderers/WebGLRenderer.js +48 -41
- package/src/renderers/common/Animation.js +13 -1
- package/src/renderers/common/Attributes.js +1 -1
- package/src/renderers/common/Backend.js +108 -27
- package/src/renderers/common/Background.js +2 -1
- package/src/renderers/common/Bindings.js +58 -2
- package/src/renderers/common/CanvasTarget.js +341 -0
- package/src/renderers/common/ChainMap.js +1 -1
- package/src/renderers/common/DataMap.js +1 -1
- package/src/renderers/common/Geometries.js +26 -0
- package/src/renderers/common/Info.js +4 -2
- package/src/renderers/common/InspectorBase.js +146 -0
- package/src/renderers/common/Pipelines.js +1 -1
- package/src/renderers/common/PostProcessing.js +6 -25
- package/src/renderers/common/QuadMesh.js +7 -1
- package/src/renderers/common/RenderContext.js +2 -2
- package/src/renderers/common/RenderList.js +7 -3
- package/src/renderers/common/RenderObject.js +16 -2
- package/src/renderers/common/RenderObjects.js +1 -1
- package/src/renderers/common/Renderer.js +473 -245
- package/src/renderers/common/RendererUtils.js +9 -0
- package/src/renderers/common/SampledTexture.js +9 -1
- package/src/renderers/common/Sampler.js +50 -12
- package/src/renderers/common/StorageTexture.js +9 -1
- package/src/renderers/common/Textures.js +121 -45
- package/src/renderers/common/TimestampQueryPool.js +65 -3
- package/src/renderers/common/UniformsGroup.js +2 -1
- package/src/renderers/common/XRManager.js +42 -22
- package/src/renderers/common/extras/PMREMGenerator.js +160 -65
- package/src/renderers/common/nodes/NodeBuilderState.js +1 -1
- package/src/renderers/common/nodes/NodeLibrary.js +9 -7
- package/src/renderers/common/nodes/NodeSampler.js +13 -1
- package/src/renderers/common/nodes/Nodes.js +38 -16
- package/src/renderers/shaders/DFGLUTData.js +64 -0
- package/src/renderers/shaders/ShaderChunk/common.glsl.js +0 -12
- package/src/renderers/shaders/ShaderChunk/envmap_common_pars_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/envmap_physical_pars_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl.js +52 -18
- 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/shadowmap_pars_fragment.glsl.js +7 -15
- package/src/renderers/shaders/ShaderLib/depth.glsl.js +1 -1
- package/src/renderers/shaders/UniformsLib.js +1 -0
- package/src/renderers/shaders/UniformsUtils.js +25 -4
- package/src/renderers/webgl/WebGLCapabilities.js +2 -1
- package/src/renderers/webgl/WebGLExtensions.js +2 -25
- package/src/renderers/webgl/WebGLInfo.js +3 -1
- package/src/renderers/webgl/WebGLProgram.js +15 -14
- package/src/renderers/webgl/WebGLPrograms.js +2 -1
- package/src/renderers/webgl/WebGLShadowMap.js +3 -2
- package/src/renderers/webgl/WebGLState.js +15 -14
- package/src/renderers/webgl/WebGLTextures.js +19 -14
- package/src/renderers/webgl/WebGLUniformsGroups.js +5 -3
- package/src/renderers/webgl/WebGLUtils.js +3 -2
- package/src/renderers/webgl-fallback/WebGLBackend.js +199 -167
- package/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js +181 -25
- package/src/renderers/webgl-fallback/utils/WebGLConstants.js +2 -3
- package/src/renderers/webgl-fallback/utils/WebGLState.js +7 -6
- package/src/renderers/webgl-fallback/utils/WebGLTextureUtils.js +169 -19
- package/src/renderers/webgl-fallback/utils/WebGLTimestampQueryPool.js +51 -22
- package/src/renderers/webgl-fallback/utils/WebGLUtils.js +3 -2
- package/src/renderers/webgpu/WebGPUBackend.js +153 -123
- package/src/renderers/webgpu/WebGPURenderer.Nodes.js +2 -1
- package/src/renderers/webgpu/WebGPURenderer.js +3 -2
- package/src/renderers/webgpu/nodes/WGSLNodeBuilder.js +142 -50
- package/src/renderers/webgpu/utils/WebGPUAttributeUtils.js +2 -1
- package/src/renderers/webgpu/utils/WebGPUBindingUtils.js +5 -3
- package/src/renderers/webgpu/utils/WebGPUConstants.js +7 -2
- package/src/renderers/webgpu/utils/WebGPUPipelineUtils.js +53 -34
- package/src/renderers/webgpu/utils/WebGPUTexturePassUtils.js +6 -8
- package/src/renderers/webgpu/utils/WebGPUTextureUtils.js +260 -99
- package/src/renderers/webgpu/utils/WebGPUTimestampQueryPool.js +32 -9
- package/src/renderers/webgpu/utils/WebGPUUtils.js +22 -2
- package/src/renderers/webxr/WebXRManager.js +42 -26
- package/src/textures/ExternalTexture.js +15 -4
- package/src/textures/Source.js +3 -2
- package/src/textures/Texture.js +3 -2
- package/src/textures/VideoTexture.js +2 -3
- package/src/utils.js +67 -3
- package/examples/jsm/loaders/RGBMLoader.js +0 -1148
|
@@ -2,6 +2,7 @@ import Node from './Node.js';
|
|
|
2
2
|
import { NodeShaderStage } from './constants.js';
|
|
3
3
|
import { addMethodChaining, nodeProxy } from '../tsl/TSLCore.js';
|
|
4
4
|
import { subBuild } from './SubBuildNode.js';
|
|
5
|
+
import { warn } from '../../utils.js';
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* Class for representing shader varyings as nodes. Varyings are create from
|
|
@@ -213,14 +214,14 @@ addMethodChaining( 'toVertexStage', vertexStage );
|
|
|
213
214
|
|
|
214
215
|
addMethodChaining( 'varying', ( ...params ) => { // @deprecated, r173
|
|
215
216
|
|
|
216
|
-
|
|
217
|
+
warn( 'TSL: .varying() has been renamed to .toVarying().' );
|
|
217
218
|
return varying( ...params );
|
|
218
219
|
|
|
219
220
|
} );
|
|
220
221
|
|
|
221
222
|
addMethodChaining( 'vertexStage', ( ...params ) => { // @deprecated, r173
|
|
222
223
|
|
|
223
|
-
|
|
224
|
+
warn( 'TSL: .vertexStage() has been renamed to .toVertexStage().' );
|
|
224
225
|
return varying( ...params );
|
|
225
226
|
|
|
226
227
|
} );
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Fn, If, vec4 } from '../tsl/TSLBase.js';
|
|
2
2
|
import { mix, min, step } from '../math/MathNode.js';
|
|
3
|
+
import { warn } from '../../utils.js';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* Represents a "Color Burn" blend mode.
|
|
@@ -183,7 +184,7 @@ export const unpremultiplyAlpha = /*@__PURE__*/ Fn( ( [ color ] ) => {
|
|
|
183
184
|
*/
|
|
184
185
|
export const burn = ( ...params ) => { // @deprecated, r171
|
|
185
186
|
|
|
186
|
-
|
|
187
|
+
warn( 'TSL: "burn" has been renamed. Use "blendBurn" instead.' );
|
|
187
188
|
return blendBurn( params );
|
|
188
189
|
|
|
189
190
|
};
|
|
@@ -198,7 +199,7 @@ export const burn = ( ...params ) => { // @deprecated, r171
|
|
|
198
199
|
*/
|
|
199
200
|
export const dodge = ( ...params ) => { // @deprecated, r171
|
|
200
201
|
|
|
201
|
-
|
|
202
|
+
warn( 'TSL: "dodge" has been renamed. Use "blendDodge" instead.' );
|
|
202
203
|
return blendDodge( params );
|
|
203
204
|
|
|
204
205
|
};
|
|
@@ -213,7 +214,7 @@ export const dodge = ( ...params ) => { // @deprecated, r171
|
|
|
213
214
|
*/
|
|
214
215
|
export const screen = ( ...params ) => { // @deprecated, r171
|
|
215
216
|
|
|
216
|
-
|
|
217
|
+
warn( 'TSL: "screen" has been renamed. Use "blendScreen" instead.' );
|
|
217
218
|
return blendScreen( params );
|
|
218
219
|
|
|
219
220
|
};
|
|
@@ -228,7 +229,7 @@ export const screen = ( ...params ) => { // @deprecated, r171
|
|
|
228
229
|
*/
|
|
229
230
|
export const overlay = ( ...params ) => { // @deprecated, r171
|
|
230
231
|
|
|
231
|
-
|
|
232
|
+
warn( 'TSL: "overlay" has been renamed. Use "blendOverlay" instead.' );
|
|
232
233
|
return blendOverlay( params );
|
|
233
234
|
|
|
234
235
|
};
|
|
@@ -11,7 +11,7 @@ import { Fn, nodeProxy, float, vec2 } from '../tsl/TSLBase.js';
|
|
|
11
11
|
const dHdxy_fwd = Fn( ( { textureNode, bumpScale } ) => {
|
|
12
12
|
|
|
13
13
|
// It's used to preserve the same TextureNode instance
|
|
14
|
-
const sampleTexture = ( callback ) => textureNode.
|
|
14
|
+
const sampleTexture = ( callback ) => textureNode.isolate().context( { getUV: ( texNode ) => callback( texNode.uvNode || uv() ), forceUVContext: true } );
|
|
15
15
|
|
|
16
16
|
const Hll = float( sampleTexture( ( uvNode ) => uvNode ) );
|
|
17
17
|
|
|
@@ -82,7 +82,7 @@ export const hue = /*@__PURE__*/ Fn( ( [ color, adjustment = float( 1 ) ] ) => {
|
|
|
82
82
|
* @function
|
|
83
83
|
* @param {Node<vec3>} color - The color value to compute the luminance for.
|
|
84
84
|
* @param {?Node<vec3>} luminanceCoefficients - The luminance coefficients. By default predefined values of the current working color space are used.
|
|
85
|
-
* @return {Node<
|
|
85
|
+
* @return {Node<float>} The luminance.
|
|
86
86
|
*/
|
|
87
87
|
export const luminance = (
|
|
88
88
|
color,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import Node from '../core/Node.js';
|
|
2
2
|
import { nodeImmutable, float, Fn } from '../tsl/TSLBase.js';
|
|
3
3
|
|
|
4
|
-
import { BackSide, DoubleSide
|
|
4
|
+
import { BackSide, DoubleSide } from '../../constants.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* This node can be used to evaluate whether a primitive is front or back facing.
|
|
@@ -40,15 +40,11 @@ class FrontFacingNode extends Node {
|
|
|
40
40
|
|
|
41
41
|
//
|
|
42
42
|
|
|
43
|
-
const {
|
|
43
|
+
const { material } = builder;
|
|
44
44
|
|
|
45
|
-
if (
|
|
45
|
+
if ( material.side === BackSide ) {
|
|
46
46
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
return 'false';
|
|
50
|
-
|
|
51
|
-
}
|
|
47
|
+
return 'false';
|
|
52
48
|
|
|
53
49
|
}
|
|
54
50
|
|
|
@@ -6,6 +6,7 @@ import { nodeProxy, vec3 } from '../tsl/TSLBase.js';
|
|
|
6
6
|
|
|
7
7
|
import { TangentSpaceNormalMap, ObjectSpaceNormalMap } from '../../constants.js';
|
|
8
8
|
import { directionToFaceDirection } from './FrontFacingNode.js';
|
|
9
|
+
import { error } from '../../utils.js';
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
* This class can be used for applying normals maps to materials.
|
|
@@ -91,7 +92,7 @@ class NormalMapNode extends TempNode {
|
|
|
91
92
|
|
|
92
93
|
} else {
|
|
93
94
|
|
|
94
|
-
|
|
95
|
+
error( `NodeMaterial: Unsupported normal map type: ${ normalMapType }` );
|
|
95
96
|
|
|
96
97
|
output = normalView; // Fallback to default normal view
|
|
97
98
|
|
|
@@ -10,6 +10,7 @@ import { Vector2 } from '../../math/Vector2.js';
|
|
|
10
10
|
import { Vector4 } from '../../math/Vector4.js';
|
|
11
11
|
import { DepthTexture } from '../../textures/DepthTexture.js';
|
|
12
12
|
import { RenderTarget } from '../../core/RenderTarget.js';
|
|
13
|
+
import { warn } from '../../utils.js';
|
|
13
14
|
|
|
14
15
|
const _size = /*@__PURE__*/ new Vector2();
|
|
15
16
|
|
|
@@ -135,6 +136,7 @@ class PassMultipleTextureNode extends PassTextureNode {
|
|
|
135
136
|
newNode.depthNode = this.depthNode;
|
|
136
137
|
newNode.compareNode = this.compareNode;
|
|
137
138
|
newNode.gradNode = this.gradNode;
|
|
139
|
+
newNode.offsetNode = this.offsetNode;
|
|
138
140
|
|
|
139
141
|
return newNode;
|
|
140
142
|
|
|
@@ -341,7 +343,7 @@ class PassNode extends TempNode {
|
|
|
341
343
|
* @type {number}
|
|
342
344
|
* @default 1
|
|
343
345
|
*/
|
|
344
|
-
this.
|
|
346
|
+
this._resolutionScale = 1;
|
|
345
347
|
|
|
346
348
|
/**
|
|
347
349
|
* Custom viewport definition.
|
|
@@ -389,18 +391,45 @@ class PassNode extends TempNode {
|
|
|
389
391
|
|
|
390
392
|
}
|
|
391
393
|
|
|
394
|
+
/**
|
|
395
|
+
* Sets the resolution scale for the pass.
|
|
396
|
+
* The resolution scale is a factor that is multiplied with the renderer's width and height.
|
|
397
|
+
*
|
|
398
|
+
* @param {number} resolutionScale - The resolution scale to set. A value of `1` means full resolution.
|
|
399
|
+
* @return {PassNode} A reference to this pass.
|
|
400
|
+
*/
|
|
401
|
+
setResolutionScale( resolutionScale ) {
|
|
402
|
+
|
|
403
|
+
this._resolutionScale = resolutionScale;
|
|
404
|
+
|
|
405
|
+
return this;
|
|
406
|
+
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
/**
|
|
410
|
+
* Gets the current resolution scale of the pass.
|
|
411
|
+
*
|
|
412
|
+
* @return {number} The current resolution scale. A value of `1` means full resolution.
|
|
413
|
+
*/
|
|
414
|
+
getResolutionScale() {
|
|
415
|
+
|
|
416
|
+
return this._resolutionScale;
|
|
417
|
+
|
|
418
|
+
}
|
|
419
|
+
|
|
392
420
|
/**
|
|
393
421
|
* Sets the resolution for the pass.
|
|
394
422
|
* The resolution is a factor that is multiplied with the renderer's width and height.
|
|
395
423
|
*
|
|
396
424
|
* @param {number} resolution - The resolution to set. A value of `1` means full resolution.
|
|
397
425
|
* @return {PassNode} A reference to this pass.
|
|
426
|
+
* @deprecated since r181. Use {@link PassNode#setResolutionScale `setResolutionScale()`} instead.
|
|
398
427
|
*/
|
|
399
|
-
setResolution( resolution ) {
|
|
428
|
+
setResolution( resolution ) { // @deprecated, r181
|
|
400
429
|
|
|
401
|
-
|
|
430
|
+
warn( 'PassNode: .setResolution() is deprecated. Use .setResolutionScale() instead.' );
|
|
402
431
|
|
|
403
|
-
return this;
|
|
432
|
+
return this.setResolutionScale( resolution );
|
|
404
433
|
|
|
405
434
|
}
|
|
406
435
|
|
|
@@ -408,10 +437,13 @@ class PassNode extends TempNode {
|
|
|
408
437
|
* Gets the current resolution of the pass.
|
|
409
438
|
*
|
|
410
439
|
* @return {number} The current resolution. A value of `1` means full resolution.
|
|
440
|
+
* @deprecated since r181. Use {@link PassNode#getResolutionScale `getResolutionScale()`} instead.
|
|
411
441
|
*/
|
|
412
|
-
getResolution() {
|
|
442
|
+
getResolution() { // @deprecated, r181
|
|
443
|
+
|
|
444
|
+
warn( 'PassNode: .getResolution() is deprecated. Use .getResolutionScale() instead.' );
|
|
413
445
|
|
|
414
|
-
return this.
|
|
446
|
+
return this.getResolutionScale();
|
|
415
447
|
|
|
416
448
|
}
|
|
417
449
|
|
|
@@ -638,7 +670,7 @@ class PassNode extends TempNode {
|
|
|
638
670
|
/**
|
|
639
671
|
* Precompiles the pass.
|
|
640
672
|
*
|
|
641
|
-
* Note that this method must be called after the pass
|
|
673
|
+
* Note that this method must be called after the pass configuration is complete.
|
|
642
674
|
* So calls like `setMRT()` and `getTextureNode()` must proceed the precompilation.
|
|
643
675
|
*
|
|
644
676
|
* @async
|
|
@@ -705,6 +737,7 @@ class PassNode extends TempNode {
|
|
|
705
737
|
|
|
706
738
|
const currentRenderTarget = renderer.getRenderTarget();
|
|
707
739
|
const currentMRT = renderer.getMRT();
|
|
740
|
+
const currentAutoClear = renderer.autoClear;
|
|
708
741
|
const currentMask = camera.layers.mask;
|
|
709
742
|
|
|
710
743
|
this._cameraNear.value = camera.near;
|
|
@@ -724,11 +757,19 @@ class PassNode extends TempNode {
|
|
|
724
757
|
|
|
725
758
|
renderer.setRenderTarget( this.renderTarget );
|
|
726
759
|
renderer.setMRT( this._mrt );
|
|
760
|
+
renderer.autoClear = true;
|
|
761
|
+
|
|
762
|
+
const currentSceneName = scene.name;
|
|
763
|
+
|
|
764
|
+
scene.name = this.name ? this.name : scene.name;
|
|
727
765
|
|
|
728
766
|
renderer.render( scene, camera );
|
|
729
767
|
|
|
768
|
+
scene.name = currentSceneName;
|
|
769
|
+
|
|
730
770
|
renderer.setRenderTarget( currentRenderTarget );
|
|
731
771
|
renderer.setMRT( currentMRT );
|
|
772
|
+
renderer.autoClear = currentAutoClear;
|
|
732
773
|
|
|
733
774
|
camera.layers.mask = currentMask;
|
|
734
775
|
|
|
@@ -745,8 +786,8 @@ class PassNode extends TempNode {
|
|
|
745
786
|
this._width = width;
|
|
746
787
|
this._height = height;
|
|
747
788
|
|
|
748
|
-
const effectiveWidth = this._width * this._pixelRatio * this.
|
|
749
|
-
const effectiveHeight = this._height * this._pixelRatio * this.
|
|
789
|
+
const effectiveWidth = Math.floor( this._width * this._pixelRatio * this._resolutionScale );
|
|
790
|
+
const effectiveHeight = Math.floor( this._height * this._pixelRatio * this._resolutionScale );
|
|
750
791
|
|
|
751
792
|
this.renderTarget.setSize( effectiveWidth, effectiveHeight );
|
|
752
793
|
|
|
@@ -786,7 +827,7 @@ class PassNode extends TempNode {
|
|
|
786
827
|
|
|
787
828
|
}
|
|
788
829
|
|
|
789
|
-
this._scissor.multiplyScalar( this._pixelRatio * this.
|
|
830
|
+
this._scissor.multiplyScalar( this._pixelRatio * this._resolutionScale ).floor();
|
|
790
831
|
|
|
791
832
|
}
|
|
792
833
|
|
|
@@ -822,7 +863,7 @@ class PassNode extends TempNode {
|
|
|
822
863
|
|
|
823
864
|
}
|
|
824
865
|
|
|
825
|
-
this._viewport.multiplyScalar( this._pixelRatio * this.
|
|
866
|
+
this._viewport.multiplyScalar( this._pixelRatio * this._resolutionScale ).floor();
|
|
826
867
|
|
|
827
868
|
}
|
|
828
869
|
|
|
@@ -56,9 +56,10 @@ class RenderOutputNode extends TempNode {
|
|
|
56
56
|
/**
|
|
57
57
|
* The tone mapping type.
|
|
58
58
|
*
|
|
59
|
+
* @private
|
|
59
60
|
* @type {?number}
|
|
60
61
|
*/
|
|
61
|
-
this.
|
|
62
|
+
this._toneMapping = toneMapping;
|
|
62
63
|
|
|
63
64
|
/**
|
|
64
65
|
* The output color space.
|
|
@@ -78,13 +79,38 @@ class RenderOutputNode extends TempNode {
|
|
|
78
79
|
|
|
79
80
|
}
|
|
80
81
|
|
|
82
|
+
/**
|
|
83
|
+
* Sets the tone mapping type.
|
|
84
|
+
*
|
|
85
|
+
* @param {number} value - The tone mapping type.
|
|
86
|
+
* @return {ToneMappingNode} A reference to this node.
|
|
87
|
+
*/
|
|
88
|
+
setToneMapping( value ) {
|
|
89
|
+
|
|
90
|
+
this._toneMapping = value;
|
|
91
|
+
|
|
92
|
+
return this;
|
|
93
|
+
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Gets the tone mapping type.
|
|
98
|
+
*
|
|
99
|
+
* @returns {number} The tone mapping type.
|
|
100
|
+
*/
|
|
101
|
+
getToneMapping() {
|
|
102
|
+
|
|
103
|
+
return this._toneMapping;
|
|
104
|
+
|
|
105
|
+
}
|
|
106
|
+
|
|
81
107
|
setup( { context } ) {
|
|
82
108
|
|
|
83
109
|
let outputNode = this.colorNode || context.color;
|
|
84
110
|
|
|
85
111
|
// tone mapping
|
|
86
112
|
|
|
87
|
-
const toneMapping = ( this.
|
|
113
|
+
const toneMapping = ( this._toneMapping !== null ? this._toneMapping : context.toneMapping ) || NoToneMapping;
|
|
88
114
|
const outputColorSpace = ( this.outputColorSpace !== null ? this.outputColorSpace : context.outputColorSpace ) || NoColorSpace;
|
|
89
115
|
|
|
90
116
|
if ( toneMapping !== NoToneMapping ) {
|
|
@@ -5,8 +5,9 @@ import { Fn, nodeImmutable, vec2 } from '../tsl/TSLBase.js';
|
|
|
5
5
|
|
|
6
6
|
import { Vector2 } from '../../math/Vector2.js';
|
|
7
7
|
import { Vector4 } from '../../math/Vector4.js';
|
|
8
|
+
import { warn } from '../../utils.js';
|
|
8
9
|
|
|
9
|
-
let
|
|
10
|
+
let _screenSizeVec, _viewportVec;
|
|
10
11
|
|
|
11
12
|
/**
|
|
12
13
|
* This node provides a collection of screen related metrics.
|
|
@@ -26,7 +27,7 @@ class ScreenNode extends Node {
|
|
|
26
27
|
/**
|
|
27
28
|
* Constructs a new screen node.
|
|
28
29
|
*
|
|
29
|
-
* @param {('coordinate'|'viewport'|'size'|'uv')} scope - The node's scope.
|
|
30
|
+
* @param {('coordinate'|'viewport'|'size'|'uv'|'dpr')} scope - The node's scope.
|
|
30
31
|
*/
|
|
31
32
|
constructor( scope ) {
|
|
32
33
|
|
|
@@ -39,11 +40,20 @@ class ScreenNode extends Node {
|
|
|
39
40
|
* - `ScreenNode.VIEWPORT`: The current viewport defined as a four-dimensional vector.
|
|
40
41
|
* - `ScreenNode.SIZE`: The dimensions of the current bound framebuffer.
|
|
41
42
|
* - `ScreenNode.UV`: Normalized coordinates.
|
|
43
|
+
* - `ScreenNode.DPR`: Device pixel ratio.
|
|
42
44
|
*
|
|
43
|
-
* @type {('coordinate'|'viewport'|'size'|'uv')}
|
|
45
|
+
* @type {('coordinate'|'viewport'|'size'|'uv'|'dpr')}
|
|
44
46
|
*/
|
|
45
47
|
this.scope = scope;
|
|
46
48
|
|
|
49
|
+
/**
|
|
50
|
+
* This output node.
|
|
51
|
+
*
|
|
52
|
+
* @type {?Node}
|
|
53
|
+
* @default null
|
|
54
|
+
*/
|
|
55
|
+
this._output = null;
|
|
56
|
+
|
|
47
57
|
/**
|
|
48
58
|
* This flag can be used for type testing.
|
|
49
59
|
*
|
|
@@ -58,10 +68,11 @@ class ScreenNode extends Node {
|
|
|
58
68
|
/**
|
|
59
69
|
* This method is overwritten since the node type depends on the selected scope.
|
|
60
70
|
*
|
|
61
|
-
* @return {('vec2'|'vec4')} The node type.
|
|
71
|
+
* @return {('float'|'vec2'|'vec4')} The node type.
|
|
62
72
|
*/
|
|
63
73
|
getNodeType() {
|
|
64
74
|
|
|
75
|
+
if ( this.scope === ScreenNode.DPR ) return 'float';
|
|
65
76
|
if ( this.scope === ScreenNode.VIEWPORT ) return 'vec4';
|
|
66
77
|
else return 'vec2';
|
|
67
78
|
|
|
@@ -76,7 +87,7 @@ class ScreenNode extends Node {
|
|
|
76
87
|
|
|
77
88
|
let updateType = NodeUpdateType.NONE;
|
|
78
89
|
|
|
79
|
-
if ( this.scope === ScreenNode.SIZE || this.scope === ScreenNode.VIEWPORT ) {
|
|
90
|
+
if ( this.scope === ScreenNode.SIZE || this.scope === ScreenNode.VIEWPORT || this.scope === ScreenNode.DPR ) {
|
|
80
91
|
|
|
81
92
|
updateType = NodeUpdateType.RENDER;
|
|
82
93
|
|
|
@@ -102,26 +113,30 @@ class ScreenNode extends Node {
|
|
|
102
113
|
|
|
103
114
|
if ( renderTarget !== null ) {
|
|
104
115
|
|
|
105
|
-
|
|
116
|
+
_viewportVec.copy( renderTarget.viewport );
|
|
106
117
|
|
|
107
118
|
} else {
|
|
108
119
|
|
|
109
|
-
renderer.getViewport(
|
|
120
|
+
renderer.getViewport( _viewportVec );
|
|
110
121
|
|
|
111
|
-
|
|
122
|
+
_viewportVec.multiplyScalar( renderer.getPixelRatio() );
|
|
112
123
|
|
|
113
124
|
}
|
|
114
125
|
|
|
126
|
+
} else if ( this.scope === ScreenNode.DPR ) {
|
|
127
|
+
|
|
128
|
+
this._output.value = renderer.getPixelRatio();
|
|
129
|
+
|
|
115
130
|
} else {
|
|
116
131
|
|
|
117
132
|
if ( renderTarget !== null ) {
|
|
118
133
|
|
|
119
|
-
|
|
120
|
-
|
|
134
|
+
_screenSizeVec.width = renderTarget.width;
|
|
135
|
+
_screenSizeVec.height = renderTarget.height;
|
|
121
136
|
|
|
122
137
|
} else {
|
|
123
138
|
|
|
124
|
-
renderer.getDrawingBufferSize(
|
|
139
|
+
renderer.getDrawingBufferSize( _screenSizeVec );
|
|
125
140
|
|
|
126
141
|
}
|
|
127
142
|
|
|
@@ -137,11 +152,15 @@ class ScreenNode extends Node {
|
|
|
137
152
|
|
|
138
153
|
if ( scope === ScreenNode.SIZE ) {
|
|
139
154
|
|
|
140
|
-
output = uniform(
|
|
155
|
+
output = uniform( _screenSizeVec || ( _screenSizeVec = new Vector2() ) );
|
|
141
156
|
|
|
142
157
|
} else if ( scope === ScreenNode.VIEWPORT ) {
|
|
143
158
|
|
|
144
|
-
output = uniform(
|
|
159
|
+
output = uniform( _viewportVec || ( _viewportVec = new Vector4() ) );
|
|
160
|
+
|
|
161
|
+
} else if ( scope === ScreenNode.DPR ) {
|
|
162
|
+
|
|
163
|
+
output = uniform( 1 );
|
|
145
164
|
|
|
146
165
|
} else {
|
|
147
166
|
|
|
@@ -149,6 +168,8 @@ class ScreenNode extends Node {
|
|
|
149
168
|
|
|
150
169
|
}
|
|
151
170
|
|
|
171
|
+
this._output = output;
|
|
172
|
+
|
|
152
173
|
return output;
|
|
153
174
|
|
|
154
175
|
}
|
|
@@ -183,11 +204,20 @@ ScreenNode.COORDINATE = 'coordinate';
|
|
|
183
204
|
ScreenNode.VIEWPORT = 'viewport';
|
|
184
205
|
ScreenNode.SIZE = 'size';
|
|
185
206
|
ScreenNode.UV = 'uv';
|
|
207
|
+
ScreenNode.DPR = 'dpr';
|
|
186
208
|
|
|
187
209
|
export default ScreenNode;
|
|
188
210
|
|
|
189
211
|
// Screen
|
|
190
212
|
|
|
213
|
+
/**
|
|
214
|
+
* TSL object that represents the current DPR.
|
|
215
|
+
*
|
|
216
|
+
* @tsl
|
|
217
|
+
* @type {ScreenNode<float>}
|
|
218
|
+
*/
|
|
219
|
+
export const screenDPR = /*@__PURE__*/ nodeImmutable( ScreenNode, ScreenNode.DPR );
|
|
220
|
+
|
|
191
221
|
/**
|
|
192
222
|
* TSL object that represents normalized screen coordinates, unitless in `[0, 1]`.
|
|
193
223
|
*
|
|
@@ -253,7 +283,7 @@ export const viewportUV = /*@__PURE__*/ viewportCoordinate.div( viewportSize );
|
|
|
253
283
|
*/
|
|
254
284
|
export const viewportResolution = /*@__PURE__*/ ( Fn( () => { // @deprecated, r169
|
|
255
285
|
|
|
256
|
-
|
|
286
|
+
warn( 'TSL: "viewportResolution" is deprecated. Use "screenSize" instead.' );
|
|
257
287
|
|
|
258
288
|
return screenSize;
|
|
259
289
|
|
|
@@ -4,6 +4,7 @@ import { rendererReference } from '../accessors/RendererReferenceNode.js';
|
|
|
4
4
|
|
|
5
5
|
import { NoToneMapping } from '../../constants.js';
|
|
6
6
|
import { hash } from '../core/NodeUtils.js';
|
|
7
|
+
import { error } from '../../utils.js';
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* This node represents a tone mapping operation.
|
|
@@ -32,9 +33,10 @@ class ToneMappingNode extends TempNode {
|
|
|
32
33
|
/**
|
|
33
34
|
* The tone mapping type.
|
|
34
35
|
*
|
|
36
|
+
* @private
|
|
35
37
|
* @type {number}
|
|
36
38
|
*/
|
|
37
|
-
this.
|
|
39
|
+
this._toneMapping = toneMapping;
|
|
38
40
|
|
|
39
41
|
/**
|
|
40
42
|
* The tone mapping exposure.
|
|
@@ -62,14 +64,39 @@ class ToneMappingNode extends TempNode {
|
|
|
62
64
|
*/
|
|
63
65
|
customCacheKey() {
|
|
64
66
|
|
|
65
|
-
return hash( this.
|
|
67
|
+
return hash( this._toneMapping );
|
|
68
|
+
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Sets the tone mapping type.
|
|
73
|
+
*
|
|
74
|
+
* @param {number} value - The tone mapping type.
|
|
75
|
+
* @return {ToneMappingNode} A reference to this node.
|
|
76
|
+
*/
|
|
77
|
+
setToneMapping( value ) {
|
|
78
|
+
|
|
79
|
+
this._toneMapping = value;
|
|
80
|
+
|
|
81
|
+
return this;
|
|
82
|
+
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Gets the tone mapping type.
|
|
87
|
+
*
|
|
88
|
+
* @returns {number} The tone mapping type.
|
|
89
|
+
*/
|
|
90
|
+
getToneMapping() {
|
|
91
|
+
|
|
92
|
+
return this._toneMapping;
|
|
66
93
|
|
|
67
94
|
}
|
|
68
95
|
|
|
69
96
|
setup( builder ) {
|
|
70
97
|
|
|
71
98
|
const colorNode = this.colorNode || builder.context.color;
|
|
72
|
-
const toneMapping = this.
|
|
99
|
+
const toneMapping = this._toneMapping;
|
|
73
100
|
|
|
74
101
|
if ( toneMapping === NoToneMapping ) return colorNode;
|
|
75
102
|
|
|
@@ -83,7 +110,7 @@ class ToneMappingNode extends TempNode {
|
|
|
83
110
|
|
|
84
111
|
} else {
|
|
85
112
|
|
|
86
|
-
|
|
113
|
+
error( 'ToneMappingNode: Unsupported Tone Mapping configuration.', toneMapping );
|
|
87
114
|
|
|
88
115
|
outputNode = colorNode;
|
|
89
116
|
|
|
@@ -72,6 +72,14 @@ class ToonOutlinePassNode extends PassNode {
|
|
|
72
72
|
*/
|
|
73
73
|
this._materialCache = new WeakMap();
|
|
74
74
|
|
|
75
|
+
/**
|
|
76
|
+
* The name of this pass.
|
|
77
|
+
*
|
|
78
|
+
* @type {string}
|
|
79
|
+
* @default 'Outline Pass'
|
|
80
|
+
*/
|
|
81
|
+
this.name = 'Outline Pass';
|
|
82
|
+
|
|
75
83
|
}
|
|
76
84
|
|
|
77
85
|
updateBefore( frame ) {
|
|
@@ -4,7 +4,7 @@ import { screenUV } from './ScreenNode.js';
|
|
|
4
4
|
|
|
5
5
|
import { DepthTexture } from '../../textures/DepthTexture.js';
|
|
6
6
|
|
|
7
|
-
let
|
|
7
|
+
let _sharedDepthbuffer = null;
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Represents the depth of the current viewport as a texture. This module
|
|
@@ -29,13 +29,25 @@ class ViewportDepthTextureNode extends ViewportTextureNode {
|
|
|
29
29
|
*/
|
|
30
30
|
constructor( uvNode = screenUV, levelNode = null ) {
|
|
31
31
|
|
|
32
|
-
if (
|
|
32
|
+
if ( _sharedDepthbuffer === null ) {
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
_sharedDepthbuffer = new DepthTexture();
|
|
35
35
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
super( uvNode, levelNode,
|
|
38
|
+
super( uvNode, levelNode, _sharedDepthbuffer );
|
|
39
|
+
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Overwritten so the method always returns the unique shared
|
|
44
|
+
* depth texture.
|
|
45
|
+
*
|
|
46
|
+
* @return {DepthTexture} The shared depth texture.
|
|
47
|
+
*/
|
|
48
|
+
getTextureForReference() {
|
|
49
|
+
|
|
50
|
+
return _sharedDepthbuffer;
|
|
39
51
|
|
|
40
52
|
}
|
|
41
53
|
|
|
@@ -39,6 +39,18 @@ class ViewportSharedTextureNode extends ViewportTextureNode {
|
|
|
39
39
|
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
+
/**
|
|
43
|
+
* Overwritten so the method always returns the unique shared
|
|
44
|
+
* framebuffer texture.
|
|
45
|
+
*
|
|
46
|
+
* @return {FramebufferTexture} The shared framebuffer texture.
|
|
47
|
+
*/
|
|
48
|
+
getTextureForReference() {
|
|
49
|
+
|
|
50
|
+
return _sharedFramebuffer;
|
|
51
|
+
|
|
52
|
+
}
|
|
53
|
+
|
|
42
54
|
updateReference() {
|
|
43
55
|
|
|
44
56
|
return this;
|