@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
|
@@ -24,13 +24,16 @@ import ChainMap from '../../renderers/common/ChainMap.js';
|
|
|
24
24
|
|
|
25
25
|
import BindGroup from '../../renderers/common/BindGroup.js';
|
|
26
26
|
|
|
27
|
-
import { REVISION, IntType, UnsignedIntType, LinearFilter, LinearMipmapNearestFilter, NearestMipmapLinearFilter, LinearMipmapLinearFilter } from '../../constants.js';
|
|
27
|
+
import { REVISION, IntType, UnsignedIntType, LinearFilter, LinearMipmapNearestFilter, NearestMipmapLinearFilter, LinearMipmapLinearFilter, NormalBlending } from '../../constants.js';
|
|
28
28
|
import { RenderTarget } from '../../core/RenderTarget.js';
|
|
29
29
|
import { Color } from '../../math/Color.js';
|
|
30
30
|
import { Vector2 } from '../../math/Vector2.js';
|
|
31
31
|
import { Vector3 } from '../../math/Vector3.js';
|
|
32
32
|
import { Vector4 } from '../../math/Vector4.js';
|
|
33
33
|
import { Float16BufferAttribute } from '../../core/BufferAttribute.js';
|
|
34
|
+
import { warn, error } from '../../utils.js';
|
|
35
|
+
|
|
36
|
+
let _id = 0;
|
|
34
37
|
|
|
35
38
|
const rendererCache = new WeakMap();
|
|
36
39
|
|
|
@@ -259,6 +262,13 @@ class NodeBuilder {
|
|
|
259
262
|
*/
|
|
260
263
|
this.structs = { vertex: [], fragment: [], compute: [], index: 0 };
|
|
261
264
|
|
|
265
|
+
/**
|
|
266
|
+
* This dictionary holds the types of the builder.
|
|
267
|
+
*
|
|
268
|
+
* @type {Object}
|
|
269
|
+
*/
|
|
270
|
+
this.types = { vertex: [], fragment: [], compute: [], index: 0 };
|
|
271
|
+
|
|
262
272
|
/**
|
|
263
273
|
* This dictionary holds the bindings for each shader stage.
|
|
264
274
|
*
|
|
@@ -427,13 +437,13 @@ class NodeBuilder {
|
|
|
427
437
|
*/
|
|
428
438
|
this.subBuildLayers = [];
|
|
429
439
|
|
|
440
|
+
|
|
430
441
|
/**
|
|
431
|
-
* The
|
|
442
|
+
* The active stack nodes.
|
|
432
443
|
*
|
|
433
|
-
* @type {
|
|
434
|
-
* @default null
|
|
444
|
+
* @type {Array<StackNode>}
|
|
435
445
|
*/
|
|
436
|
-
this.
|
|
446
|
+
this.activeStacks = [];
|
|
437
447
|
|
|
438
448
|
/**
|
|
439
449
|
* The current sub-build TSL function(Fn).
|
|
@@ -443,6 +453,29 @@ class NodeBuilder {
|
|
|
443
453
|
*/
|
|
444
454
|
this.subBuildFn = null;
|
|
445
455
|
|
|
456
|
+
/**
|
|
457
|
+
* The current TSL function(Fn) call node.
|
|
458
|
+
*
|
|
459
|
+
* @type {?Node}
|
|
460
|
+
* @default null
|
|
461
|
+
*/
|
|
462
|
+
this.fnCall = null;
|
|
463
|
+
|
|
464
|
+
Object.defineProperty( this, 'id', { value: _id ++ } );
|
|
465
|
+
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
/**
|
|
469
|
+
* Whether the material is opaque or not.
|
|
470
|
+
*
|
|
471
|
+
* @return {boolean} Whether the material is opaque or not.
|
|
472
|
+
*/
|
|
473
|
+
isOpaque() {
|
|
474
|
+
|
|
475
|
+
const material = this.material;
|
|
476
|
+
|
|
477
|
+
return material.transparent === false && material.blending === NormalBlending && material.alphaToCoverage === false;
|
|
478
|
+
|
|
446
479
|
}
|
|
447
480
|
|
|
448
481
|
/**
|
|
@@ -722,7 +755,7 @@ class NodeBuilder {
|
|
|
722
755
|
|
|
723
756
|
if ( updateType !== NodeUpdateType.NONE ) {
|
|
724
757
|
|
|
725
|
-
this.updateNodes.push( node
|
|
758
|
+
this.updateNodes.push( node );
|
|
726
759
|
|
|
727
760
|
}
|
|
728
761
|
|
|
@@ -735,13 +768,13 @@ class NodeBuilder {
|
|
|
735
768
|
|
|
736
769
|
if ( updateBeforeType !== NodeUpdateType.NONE ) {
|
|
737
770
|
|
|
738
|
-
this.updateBeforeNodes.push( node
|
|
771
|
+
this.updateBeforeNodes.push( node );
|
|
739
772
|
|
|
740
773
|
}
|
|
741
774
|
|
|
742
775
|
if ( updateAfterType !== NodeUpdateType.NONE ) {
|
|
743
776
|
|
|
744
|
-
this.updateAfterNodes.push( node
|
|
777
|
+
this.updateAfterNodes.push( node );
|
|
745
778
|
|
|
746
779
|
}
|
|
747
780
|
|
|
@@ -785,7 +818,7 @@ class NodeBuilder {
|
|
|
785
818
|
/*
|
|
786
819
|
if ( this.chaining.indexOf( node ) !== - 1 ) {
|
|
787
820
|
|
|
788
|
-
|
|
821
|
+
warn( 'Recursive node: ', node );
|
|
789
822
|
|
|
790
823
|
}
|
|
791
824
|
*/
|
|
@@ -826,6 +859,22 @@ class NodeBuilder {
|
|
|
826
859
|
|
|
827
860
|
}
|
|
828
861
|
|
|
862
|
+
/**
|
|
863
|
+
* Returns the native snippet for a ternary operation. E.g. GLSL would output
|
|
864
|
+
* a ternary op as `cond ? x : y` whereas WGSL would output it as `select(y, x, cond)`
|
|
865
|
+
*
|
|
866
|
+
* @abstract
|
|
867
|
+
* @param {string} condSnippet - The condition determining which expression gets resolved.
|
|
868
|
+
* @param {string} ifSnippet - The expression to resolve to if the condition is true.
|
|
869
|
+
* @param {string} elseSnippet - The expression to resolve to if the condition is false.
|
|
870
|
+
* @return {string} The resolved method name.
|
|
871
|
+
*/
|
|
872
|
+
getTernary( /* condSnippet, ifSnippet, elseSnippet*/ ) {
|
|
873
|
+
|
|
874
|
+
return null;
|
|
875
|
+
|
|
876
|
+
}
|
|
877
|
+
|
|
829
878
|
/**
|
|
830
879
|
* Returns a node for the given hash, see {@link NodeBuilder#setHashNode}.
|
|
831
880
|
*
|
|
@@ -875,6 +924,22 @@ class NodeBuilder {
|
|
|
875
924
|
|
|
876
925
|
}
|
|
877
926
|
|
|
927
|
+
/**
|
|
928
|
+
* Adds context data to the builder's current context.
|
|
929
|
+
*
|
|
930
|
+
* @param {Object} context - The context to add.
|
|
931
|
+
* @return {Object} The previous context.
|
|
932
|
+
*/
|
|
933
|
+
addContext( context ) {
|
|
934
|
+
|
|
935
|
+
const previousContext = this.getContext();
|
|
936
|
+
|
|
937
|
+
this.setContext( { ...this.context, ...context } );
|
|
938
|
+
|
|
939
|
+
return previousContext;
|
|
940
|
+
|
|
941
|
+
}
|
|
942
|
+
|
|
878
943
|
/**
|
|
879
944
|
* Gets a context used in shader construction that can be shared across different materials.
|
|
880
945
|
* This is necessary since the renderer cache can reuse shaders generated in one material and use them in another.
|
|
@@ -950,19 +1015,20 @@ class NodeBuilder {
|
|
|
950
1015
|
*/
|
|
951
1016
|
getVertexIndex() {
|
|
952
1017
|
|
|
953
|
-
|
|
1018
|
+
warn( 'Abstract function.' );
|
|
954
1019
|
|
|
955
1020
|
}
|
|
956
1021
|
|
|
957
1022
|
/**
|
|
958
|
-
*
|
|
1023
|
+
* Contextually returns either the vertex stage instance index builtin
|
|
1024
|
+
* or the linearized index of an compute invocation within a grid of workgroups.
|
|
959
1025
|
*
|
|
960
1026
|
* @abstract
|
|
961
1027
|
* @return {string} The instanceIndex shader string.
|
|
962
1028
|
*/
|
|
963
1029
|
getInstanceIndex() {
|
|
964
1030
|
|
|
965
|
-
|
|
1031
|
+
warn( 'Abstract function.' );
|
|
966
1032
|
|
|
967
1033
|
}
|
|
968
1034
|
|
|
@@ -975,7 +1041,7 @@ class NodeBuilder {
|
|
|
975
1041
|
*/
|
|
976
1042
|
getDrawIndex() {
|
|
977
1043
|
|
|
978
|
-
|
|
1044
|
+
warn( 'Abstract function.' );
|
|
979
1045
|
|
|
980
1046
|
}
|
|
981
1047
|
|
|
@@ -987,7 +1053,7 @@ class NodeBuilder {
|
|
|
987
1053
|
*/
|
|
988
1054
|
getFrontFacing() {
|
|
989
1055
|
|
|
990
|
-
|
|
1056
|
+
warn( 'Abstract function.' );
|
|
991
1057
|
|
|
992
1058
|
}
|
|
993
1059
|
|
|
@@ -999,7 +1065,7 @@ class NodeBuilder {
|
|
|
999
1065
|
*/
|
|
1000
1066
|
getFragCoord() {
|
|
1001
1067
|
|
|
1002
|
-
|
|
1068
|
+
warn( 'Abstract function.' );
|
|
1003
1069
|
|
|
1004
1070
|
}
|
|
1005
1071
|
|
|
@@ -1042,7 +1108,7 @@ class NodeBuilder {
|
|
|
1042
1108
|
*/
|
|
1043
1109
|
generateTexture( /* texture, textureProperty, uvSnippet */ ) {
|
|
1044
1110
|
|
|
1045
|
-
|
|
1111
|
+
warn( 'Abstract function.' );
|
|
1046
1112
|
|
|
1047
1113
|
}
|
|
1048
1114
|
|
|
@@ -1059,7 +1125,7 @@ class NodeBuilder {
|
|
|
1059
1125
|
*/
|
|
1060
1126
|
generateTextureLod( /* texture, textureProperty, uvSnippet, depthSnippet, levelSnippet */ ) {
|
|
1061
1127
|
|
|
1062
|
-
|
|
1128
|
+
warn( 'Abstract function.' );
|
|
1063
1129
|
|
|
1064
1130
|
}
|
|
1065
1131
|
|
|
@@ -1144,7 +1210,6 @@ class NodeBuilder {
|
|
|
1144
1210
|
|
|
1145
1211
|
}
|
|
1146
1212
|
|
|
1147
|
-
|
|
1148
1213
|
/**
|
|
1149
1214
|
* Generates the shader string for the given type and value.
|
|
1150
1215
|
*
|
|
@@ -1544,6 +1609,58 @@ class NodeBuilder {
|
|
|
1544
1609
|
|
|
1545
1610
|
}
|
|
1546
1611
|
|
|
1612
|
+
/**
|
|
1613
|
+
* Adds an active stack to the internal stack.
|
|
1614
|
+
*
|
|
1615
|
+
* @param {StackNode} stack - The stack node to add.
|
|
1616
|
+
*/
|
|
1617
|
+
setActiveStack( stack ) {
|
|
1618
|
+
|
|
1619
|
+
this.activeStacks.push( stack );
|
|
1620
|
+
|
|
1621
|
+
}
|
|
1622
|
+
|
|
1623
|
+
/**
|
|
1624
|
+
* Removes the active stack from the internal stack.
|
|
1625
|
+
*
|
|
1626
|
+
* @param {StackNode} stack - The stack node to remove.
|
|
1627
|
+
*/
|
|
1628
|
+
removeActiveStack( stack ) {
|
|
1629
|
+
|
|
1630
|
+
if ( this.activeStacks[ this.activeStacks.length - 1 ] === stack ) {
|
|
1631
|
+
|
|
1632
|
+
this.activeStacks.pop();
|
|
1633
|
+
|
|
1634
|
+
} else {
|
|
1635
|
+
|
|
1636
|
+
throw new Error( 'NodeBuilder: Invalid active stack removal.' );
|
|
1637
|
+
|
|
1638
|
+
}
|
|
1639
|
+
|
|
1640
|
+
}
|
|
1641
|
+
|
|
1642
|
+
/**
|
|
1643
|
+
* Returns the active stack.
|
|
1644
|
+
*
|
|
1645
|
+
* @return {StackNode} The active stack.
|
|
1646
|
+
*/
|
|
1647
|
+
getActiveStack() {
|
|
1648
|
+
|
|
1649
|
+
return this.activeStacks[ this.activeStacks.length - 1 ];
|
|
1650
|
+
|
|
1651
|
+
}
|
|
1652
|
+
|
|
1653
|
+
/**
|
|
1654
|
+
* Returns the base stack.
|
|
1655
|
+
*
|
|
1656
|
+
* @return {StackNode} The base stack.
|
|
1657
|
+
*/
|
|
1658
|
+
getBaseStack() {
|
|
1659
|
+
|
|
1660
|
+
return this.activeStacks[ 0 ];
|
|
1661
|
+
|
|
1662
|
+
}
|
|
1663
|
+
|
|
1547
1664
|
/**
|
|
1548
1665
|
* Adds a stack node to the internal stack.
|
|
1549
1666
|
*
|
|
@@ -1553,7 +1670,9 @@ class NodeBuilder {
|
|
|
1553
1670
|
|
|
1554
1671
|
this.stack = stack( this.stack );
|
|
1555
1672
|
|
|
1556
|
-
|
|
1673
|
+
const previousStack = getCurrentStack();
|
|
1674
|
+
|
|
1675
|
+
this.stacks.push( previousStack );
|
|
1557
1676
|
setCurrentStack( this.stack );
|
|
1558
1677
|
|
|
1559
1678
|
return this.stack;
|
|
@@ -1568,6 +1687,14 @@ class NodeBuilder {
|
|
|
1568
1687
|
removeStack() {
|
|
1569
1688
|
|
|
1570
1689
|
const lastStack = this.stack;
|
|
1690
|
+
|
|
1691
|
+
for ( const node of lastStack.nodes ) {
|
|
1692
|
+
|
|
1693
|
+
const nodeData = this.getDataFromNode( node );
|
|
1694
|
+
nodeData.stack = lastStack;
|
|
1695
|
+
|
|
1696
|
+
}
|
|
1697
|
+
|
|
1571
1698
|
this.stack = lastStack.parent;
|
|
1572
1699
|
|
|
1573
1700
|
setCurrentStack( this.stacks.pop() );
|
|
@@ -1624,6 +1751,11 @@ class NodeBuilder {
|
|
|
1624
1751
|
/**
|
|
1625
1752
|
* Returns the properties for the given node and shader stage.
|
|
1626
1753
|
*
|
|
1754
|
+
* Properties are typically used within a build stage to reference a node's
|
|
1755
|
+
* child node or nodes manually assigned to the properties in a separate build stage.
|
|
1756
|
+
* A typical usage pattern for defining nodes manually would be assigning dependency nodes
|
|
1757
|
+
* to the current node's properties in the setup stage and building those properties in the generate stage.
|
|
1758
|
+
*
|
|
1627
1759
|
* @param {Node} node - The node to get the properties for.
|
|
1628
1760
|
* @param {('vertex'|'fragment'|'compute'|'any')} [shaderStage='any'] - The shader stage.
|
|
1629
1761
|
* @return {Object} The node properties.
|
|
@@ -1665,6 +1797,20 @@ class NodeBuilder {
|
|
|
1665
1797
|
|
|
1666
1798
|
}
|
|
1667
1799
|
|
|
1800
|
+
/**
|
|
1801
|
+
* Returns an instance of {@link StructType} for the given struct name and shader stage
|
|
1802
|
+
* or null if not found.
|
|
1803
|
+
*
|
|
1804
|
+
* @param {string} name - The name of the struct.
|
|
1805
|
+
* @param {('vertex'|'fragment'|'compute'|'any')} [shaderStage=this.shaderStage] - The shader stage.
|
|
1806
|
+
* @return {?StructType} The struct type or null if not found.
|
|
1807
|
+
*/
|
|
1808
|
+
getStructTypeNode( name, shaderStage = this.shaderStage ) {
|
|
1809
|
+
|
|
1810
|
+
return this.types[ shaderStage ][ name ] || null;
|
|
1811
|
+
|
|
1812
|
+
}
|
|
1813
|
+
|
|
1668
1814
|
/**
|
|
1669
1815
|
* Returns an instance of {@link StructType} for the given output struct node.
|
|
1670
1816
|
*
|
|
@@ -1689,6 +1835,7 @@ class NodeBuilder {
|
|
|
1689
1835
|
structType = new StructType( name, membersLayout );
|
|
1690
1836
|
|
|
1691
1837
|
this.structs[ shaderStage ].push( structType );
|
|
1838
|
+
this.types[ shaderStage ][ name ] = node;
|
|
1692
1839
|
|
|
1693
1840
|
nodeData.structType = structType;
|
|
1694
1841
|
|
|
@@ -1932,7 +2079,7 @@ class NodeBuilder {
|
|
|
1932
2079
|
|
|
1933
2080
|
node.name = name;
|
|
1934
2081
|
|
|
1935
|
-
|
|
2082
|
+
warn( `TSL: Declaration name '${ property }' of '${ node.type }' already in use. Renamed to '${ name }'.` );
|
|
1936
2083
|
|
|
1937
2084
|
}
|
|
1938
2085
|
|
|
@@ -2219,10 +2366,16 @@ class NodeBuilder {
|
|
|
2219
2366
|
/**
|
|
2220
2367
|
* Executes the node in a specific build stage.
|
|
2221
2368
|
*
|
|
2369
|
+
* This function can be used to arbitrarily execute the specified build stage
|
|
2370
|
+
* outside of the standard build process. For instance, if a node's type depends
|
|
2371
|
+
* on properties created by the 'setup' stage, then flowBuildStage(node, 'setup')
|
|
2372
|
+
* can be used to execute the setup build stage and access its generated nodes
|
|
2373
|
+
* before the standard build process begins.
|
|
2374
|
+
*
|
|
2222
2375
|
* @param {Node} node - The node to execute.
|
|
2223
2376
|
* @param {string} buildStage - The build stage to execute the node in.
|
|
2224
|
-
* @param {Node|string
|
|
2225
|
-
* @return {Node|string
|
|
2377
|
+
* @param {?(Node|string)} [output=null] - Expected output type. For example 'vec3'.
|
|
2378
|
+
* @return {?(Node|string)} The result of the node build.
|
|
2226
2379
|
*/
|
|
2227
2380
|
flowBuildStage( node, buildStage, output = null ) {
|
|
2228
2381
|
|
|
@@ -2309,7 +2462,7 @@ class NodeBuilder {
|
|
|
2309
2462
|
*/
|
|
2310
2463
|
buildFunctionCode( /* shaderNode */ ) {
|
|
2311
2464
|
|
|
2312
|
-
|
|
2465
|
+
warn( 'Abstract function.' );
|
|
2313
2466
|
|
|
2314
2467
|
}
|
|
2315
2468
|
|
|
@@ -2348,7 +2501,7 @@ class NodeBuilder {
|
|
|
2348
2501
|
* @param {Node} node - The node to execute.
|
|
2349
2502
|
* @param {?string} output - Expected output type. For example 'vec3'.
|
|
2350
2503
|
* @param {?string} propertyName - The property name to assign the result.
|
|
2351
|
-
* @return {Object|Node
|
|
2504
|
+
* @return {?(Object|Node)} The code flow or node.build() result.
|
|
2352
2505
|
*/
|
|
2353
2506
|
flowNodeFromShaderStage( shaderStage, node, output = null, propertyName = null ) {
|
|
2354
2507
|
|
|
@@ -2418,7 +2571,7 @@ class NodeBuilder {
|
|
|
2418
2571
|
*/
|
|
2419
2572
|
getAttributes( /*shaderStage*/ ) {
|
|
2420
2573
|
|
|
2421
|
-
|
|
2574
|
+
warn( 'Abstract function.' );
|
|
2422
2575
|
|
|
2423
2576
|
}
|
|
2424
2577
|
|
|
@@ -2431,7 +2584,7 @@ class NodeBuilder {
|
|
|
2431
2584
|
*/
|
|
2432
2585
|
getVaryings( /*shaderStage*/ ) {
|
|
2433
2586
|
|
|
2434
|
-
|
|
2587
|
+
warn( 'Abstract function.' );
|
|
2435
2588
|
|
|
2436
2589
|
}
|
|
2437
2590
|
|
|
@@ -2484,7 +2637,7 @@ class NodeBuilder {
|
|
|
2484
2637
|
*/
|
|
2485
2638
|
getUniforms( /*shaderStage*/ ) {
|
|
2486
2639
|
|
|
2487
|
-
|
|
2640
|
+
warn( 'Abstract function.' );
|
|
2488
2641
|
|
|
2489
2642
|
}
|
|
2490
2643
|
|
|
@@ -2576,7 +2729,7 @@ class NodeBuilder {
|
|
|
2576
2729
|
*/
|
|
2577
2730
|
buildCode() {
|
|
2578
2731
|
|
|
2579
|
-
|
|
2732
|
+
warn( 'Abstract function.' );
|
|
2580
2733
|
|
|
2581
2734
|
}
|
|
2582
2735
|
|
|
@@ -2616,7 +2769,7 @@ class NodeBuilder {
|
|
|
2616
2769
|
/**
|
|
2617
2770
|
* Returns the closest sub-build layer for the given data.
|
|
2618
2771
|
*
|
|
2619
|
-
* @param {Node|Set
|
|
2772
|
+
* @param {Node|Set<string>|Array<string>} data - The data to get the closest sub-build layer from.
|
|
2620
2773
|
* @return {?string} The closest sub-build name or null if none found.
|
|
2621
2774
|
*/
|
|
2622
2775
|
getClosestSubBuild( data ) {
|
|
@@ -2734,7 +2887,7 @@ class NodeBuilder {
|
|
|
2734
2887
|
|
|
2735
2888
|
if ( nodeMaterial === null ) {
|
|
2736
2889
|
|
|
2737
|
-
|
|
2890
|
+
error( `NodeMaterial: Material "${ material.type }" is not compatible.` );
|
|
2738
2891
|
|
|
2739
2892
|
nodeMaterial = new NodeMaterial();
|
|
2740
2893
|
|
|
@@ -2923,11 +3076,6 @@ class NodeBuilder {
|
|
|
2923
3076
|
|
|
2924
3077
|
}
|
|
2925
3078
|
|
|
2926
|
-
/**
|
|
2927
|
-
* Prevents the node builder from being used as an iterable in TSL.Fn(), avoiding potential runtime errors.
|
|
2928
|
-
*/
|
|
2929
|
-
*[ Symbol.iterator ]() { }
|
|
2930
|
-
|
|
2931
3079
|
}
|
|
2932
3080
|
|
|
2933
3081
|
export default NodeBuilder;
|
|
@@ -115,7 +115,7 @@ class NodeFrame {
|
|
|
115
115
|
* @private
|
|
116
116
|
* @param {WeakMap<Node, Object>} referenceMap - The reference weak map.
|
|
117
117
|
* @param {Node} nodeRef - The reference to the current node.
|
|
118
|
-
* @return {Object<string,WeakMap
|
|
118
|
+
* @return {Object<string,WeakMap<Object, number>>} The dictionary.
|
|
119
119
|
*/
|
|
120
120
|
_getMaps( referenceMap, nodeRef ) {
|
|
121
121
|
|
|
@@ -124,8 +124,8 @@ class NodeFrame {
|
|
|
124
124
|
if ( maps === undefined ) {
|
|
125
125
|
|
|
126
126
|
maps = {
|
|
127
|
-
|
|
128
|
-
|
|
127
|
+
renderId: 0,
|
|
128
|
+
frameId: 0,
|
|
129
129
|
};
|
|
130
130
|
|
|
131
131
|
referenceMap.set( nodeRef, maps );
|
|
@@ -151,13 +151,13 @@ class NodeFrame {
|
|
|
151
151
|
|
|
152
152
|
if ( updateType === NodeUpdateType.FRAME ) {
|
|
153
153
|
|
|
154
|
-
const
|
|
154
|
+
const nodeUpdateBeforeMap = this._getMaps( this.updateBeforeMap, reference );
|
|
155
155
|
|
|
156
|
-
if (
|
|
156
|
+
if ( nodeUpdateBeforeMap.frameId !== this.frameId ) {
|
|
157
157
|
|
|
158
158
|
if ( node.updateBefore( this ) !== false ) {
|
|
159
159
|
|
|
160
|
-
|
|
160
|
+
nodeUpdateBeforeMap.frameId = this.frameId;
|
|
161
161
|
|
|
162
162
|
}
|
|
163
163
|
|
|
@@ -165,13 +165,13 @@ class NodeFrame {
|
|
|
165
165
|
|
|
166
166
|
} else if ( updateType === NodeUpdateType.RENDER ) {
|
|
167
167
|
|
|
168
|
-
const
|
|
168
|
+
const nodeUpdateBeforeMap = this._getMaps( this.updateBeforeMap, reference );
|
|
169
169
|
|
|
170
|
-
if (
|
|
170
|
+
if ( nodeUpdateBeforeMap.renderId !== this.renderId ) {
|
|
171
171
|
|
|
172
172
|
if ( node.updateBefore( this ) !== false ) {
|
|
173
173
|
|
|
174
|
-
|
|
174
|
+
nodeUpdateBeforeMap.renderId = this.renderId;
|
|
175
175
|
|
|
176
176
|
}
|
|
177
177
|
|
|
@@ -200,13 +200,13 @@ class NodeFrame {
|
|
|
200
200
|
|
|
201
201
|
if ( updateType === NodeUpdateType.FRAME ) {
|
|
202
202
|
|
|
203
|
-
const
|
|
203
|
+
const nodeUpdateAfterMap = this._getMaps( this.updateAfterMap, reference );
|
|
204
204
|
|
|
205
|
-
if (
|
|
205
|
+
if ( nodeUpdateAfterMap.frameId !== this.frameId ) {
|
|
206
206
|
|
|
207
207
|
if ( node.updateAfter( this ) !== false ) {
|
|
208
208
|
|
|
209
|
-
|
|
209
|
+
nodeUpdateAfterMap.frameId = this.frameId;
|
|
210
210
|
|
|
211
211
|
}
|
|
212
212
|
|
|
@@ -214,13 +214,13 @@ class NodeFrame {
|
|
|
214
214
|
|
|
215
215
|
} else if ( updateType === NodeUpdateType.RENDER ) {
|
|
216
216
|
|
|
217
|
-
const
|
|
217
|
+
const nodeUpdateAfterMap = this._getMaps( this.updateAfterMap, reference );
|
|
218
218
|
|
|
219
|
-
if (
|
|
219
|
+
if ( nodeUpdateAfterMap.renderId !== this.renderId ) {
|
|
220
220
|
|
|
221
221
|
if ( node.updateAfter( this ) !== false ) {
|
|
222
222
|
|
|
223
|
-
|
|
223
|
+
nodeUpdateAfterMap.renderId = this.renderId;
|
|
224
224
|
|
|
225
225
|
}
|
|
226
226
|
|
|
@@ -249,13 +249,13 @@ class NodeFrame {
|
|
|
249
249
|
|
|
250
250
|
if ( updateType === NodeUpdateType.FRAME ) {
|
|
251
251
|
|
|
252
|
-
const
|
|
252
|
+
const nodeUpdateMap = this._getMaps( this.updateMap, reference );
|
|
253
253
|
|
|
254
|
-
if (
|
|
254
|
+
if ( nodeUpdateMap.frameId !== this.frameId ) {
|
|
255
255
|
|
|
256
256
|
if ( node.update( this ) !== false ) {
|
|
257
257
|
|
|
258
|
-
|
|
258
|
+
nodeUpdateMap.frameId = this.frameId;
|
|
259
259
|
|
|
260
260
|
}
|
|
261
261
|
|
|
@@ -263,13 +263,13 @@ class NodeFrame {
|
|
|
263
263
|
|
|
264
264
|
} else if ( updateType === NodeUpdateType.RENDER ) {
|
|
265
265
|
|
|
266
|
-
const
|
|
266
|
+
const nodeUpdateMap = this._getMaps( this.updateMap, reference );
|
|
267
267
|
|
|
268
|
-
if (
|
|
268
|
+
if ( nodeUpdateMap.renderId !== this.renderId ) {
|
|
269
269
|
|
|
270
270
|
if ( node.update( this ) !== false ) {
|
|
271
271
|
|
|
272
|
-
|
|
272
|
+
nodeUpdateMap.renderId = this.renderId;
|
|
273
273
|
|
|
274
274
|
}
|
|
275
275
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { warn } from '../../utils.js';
|
|
1
2
|
/**
|
|
2
3
|
* Base class for node functions. A derived module must be implemented
|
|
3
4
|
* for each supported native shader language. Similar to other `Node*` modules,
|
|
@@ -57,7 +58,7 @@ class NodeFunction {
|
|
|
57
58
|
*/
|
|
58
59
|
getCode( /*name = this.name*/ ) {
|
|
59
60
|
|
|
60
|
-
|
|
61
|
+
warn( 'Abstract function.' );
|
|
61
62
|
|
|
62
63
|
}
|
|
63
64
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { warn } from '../../utils.js';
|
|
1
2
|
/**
|
|
2
3
|
* Base class for node parsers. A derived parser must be implemented
|
|
3
4
|
* for each supported native shader language.
|
|
@@ -13,7 +14,7 @@ class NodeParser {
|
|
|
13
14
|
*/
|
|
14
15
|
parseFunction( /*source*/ ) {
|
|
15
16
|
|
|
16
|
-
|
|
17
|
+
warn( 'Abstract function.' );
|
|
17
18
|
|
|
18
19
|
}
|
|
19
20
|
|