super-three 0.167.0 → 0.169.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/build/three.cjs +532 -173
- package/build/three.module.js +532 -174
- package/build/three.module.min.js +1 -1
- package/build/three.webgpu.js +18173 -14266
- package/build/three.webgpu.min.js +1 -1
- package/build/three.webgpu.nodes.js +79941 -0
- package/build/three.webgpu.nodes.min.js +6 -0
- package/examples/jsm/Addons.js +0 -4
- package/examples/jsm/animation/AnimationClipCreator.js +1 -1
- package/examples/jsm/capabilities/WebGL.js +27 -21
- package/examples/jsm/controls/ArcballControls.js +174 -158
- package/examples/jsm/controls/DragControls.js +260 -132
- package/examples/jsm/controls/FirstPersonControls.js +175 -163
- package/examples/jsm/controls/FlyControls.js +194 -188
- package/examples/jsm/controls/OrbitControls.js +777 -786
- package/examples/jsm/controls/PointerLockControls.js +24 -15
- package/examples/jsm/controls/TrackballControls.js +469 -448
- package/examples/jsm/controls/TransformControls.js +97 -62
- package/examples/jsm/effects/AnaglyphEffect.js +6 -13
- package/examples/jsm/effects/ParallaxBarrierEffect.js +17 -11
- package/examples/jsm/effects/StereoEffect.js +6 -1
- package/examples/jsm/environments/RoomEnvironment.js +1 -1
- package/examples/jsm/exporters/DRACOExporter.js +4 -2
- package/examples/jsm/exporters/EXRExporter.js +19 -11
- package/examples/jsm/exporters/GLTFExporter.js +6 -1
- package/examples/jsm/exporters/KTX2Exporter.js +21 -13
- package/examples/jsm/exporters/OBJExporter.js +5 -1
- package/examples/jsm/exporters/PLYExporter.js +9 -7
- package/examples/jsm/exporters/USDZExporter.js +29 -8
- package/examples/jsm/geometries/DecalGeometry.js +4 -1
- package/examples/jsm/geometries/InstancedPointsGeometry.js +1 -1
- package/examples/jsm/helpers/LightProbeHelper.js +43 -44
- package/examples/jsm/helpers/LightProbeHelperGPU.js +65 -0
- package/examples/jsm/libs/basis/basis_transcoder.js +8 -10
- package/examples/jsm/libs/basis/basis_transcoder.wasm +0 -0
- package/examples/jsm/libs/ktx-parse.module.js +1 -1
- package/examples/jsm/lights/LightProbeGenerator.js +24 -10
- package/examples/jsm/loaders/ColladaLoader.js +9 -6
- package/examples/jsm/loaders/DRACOLoader.js +3 -1
- package/examples/jsm/loaders/FBXLoader.js +30 -20
- package/examples/jsm/loaders/GLTFLoader.js +5 -10
- package/examples/jsm/loaders/KTX2Loader.js +27 -12
- package/examples/jsm/loaders/MTLLoader.js +4 -3
- package/examples/jsm/loaders/MaterialXLoader.js +40 -14
- package/examples/jsm/loaders/OBJLoader.js +5 -3
- package/examples/jsm/loaders/PCDLoader.js +14 -13
- package/examples/jsm/loaders/PDBLoader.js +3 -2
- package/examples/jsm/loaders/PLYLoader.js +8 -5
- package/examples/jsm/loaders/STLLoader.js +3 -2
- package/examples/jsm/loaders/VRMLLoader.js +10 -10
- package/examples/jsm/loaders/VTKLoader.js +4 -3
- package/examples/jsm/loaders/XYZLoader.js +3 -2
- package/examples/jsm/misc/Timer.js +1 -1
- package/examples/jsm/modifiers/CurveModifierGPU.js +233 -0
- package/examples/jsm/objects/LensflareMesh.js +322 -0
- package/examples/jsm/objects/SkyMesh.js +187 -0
- package/examples/jsm/objects/Water2Mesh.js +158 -0
- package/examples/jsm/objects/WaterMesh.js +101 -0
- package/examples/jsm/physics/JoltPhysics.js +1 -1
- package/examples/jsm/physics/RapierPhysics.js +21 -1
- package/examples/jsm/postprocessing/OutlinePass.js +31 -46
- package/examples/jsm/postprocessing/SSAARenderPass.js +3 -1
- package/examples/jsm/shaders/BleachBypassShader.js +1 -2
- package/examples/jsm/shaders/OutputShader.js +1 -1
- package/examples/jsm/transpiler/GLSLDecoder.js +1 -1
- package/examples/jsm/transpiler/ShaderToyDecoder.js +2 -2
- package/examples/jsm/transpiler/TSLEncoder.js +8 -8
- package/examples/jsm/utils/GeometryCompressionUtils.js +37 -122
- package/examples/jsm/utils/ShadowMapViewer.js +3 -8
- package/examples/jsm/utils/ShadowMapViewerGPU.js +201 -0
- package/examples/jsm/utils/SkeletonUtils.js +84 -66
- package/examples/jsm/utils/TextureUtils.js +2 -1
- package/examples/jsm/utils/TextureUtilsGPU.js +63 -0
- package/examples/jsm/webxr/XRControllerModelFactory.js +1 -1
- package/package.json +3 -2
- package/src/Three.WebGPU.Nodes.js +200 -0
- package/src/Three.WebGPU.js +7 -0
- package/src/Three.js +1 -0
- package/src/audio/Audio.js +2 -2
- package/src/constants.js +1 -1
- package/src/core/BufferAttribute.js +0 -9
- package/src/core/Clock.js +1 -1
- package/src/core/InterleavedBuffer.js +0 -9
- package/src/extras/Controls.js +32 -0
- package/src/geometries/CylinderGeometry.js +11 -4
- package/src/loaders/MaterialLoader.js +7 -1
- package/src/loaders/ObjectLoader.js +3 -3
- package/src/{nodes/loaders → loaders/nodes}/NodeLoader.js +25 -5
- package/src/{nodes/loaders → loaders/nodes}/NodeMaterialLoader.js +21 -18
- package/src/{nodes/loaders → loaders/nodes}/NodeObjectLoader.js +19 -0
- package/src/materials/Material.js +4 -7
- package/src/materials/nodes/InstancedPointsNodeMaterial.js +156 -0
- package/src/{nodes/materials → materials/nodes}/Line2NodeMaterial.js +56 -59
- package/src/{nodes/materials → materials/nodes}/LineBasicNodeMaterial.js +8 -5
- package/src/{nodes/materials → materials/nodes}/LineDashedNodeMaterial.js +12 -10
- package/src/{nodes/materials → materials/nodes}/MeshBasicNodeMaterial.js +16 -12
- package/src/{nodes/materials → materials/nodes}/MeshLambertNodeMaterial.js +10 -6
- package/src/{nodes/materials → materials/nodes}/MeshMatcapNodeMaterial.js +13 -9
- package/src/{nodes/materials → materials/nodes}/MeshNormalNodeMaterial.js +13 -9
- package/src/{nodes/materials → materials/nodes}/MeshPhongNodeMaterial.js +14 -9
- package/src/{nodes/materials → materials/nodes}/MeshPhysicalNodeMaterial.js +22 -18
- package/src/{nodes/materials → materials/nodes}/MeshSSSNodeMaterial.js +10 -7
- package/src/{nodes/materials → materials/nodes}/MeshStandardNodeMaterial.js +22 -12
- package/src/{nodes/materials → materials/nodes}/MeshToonNodeMaterial.js +9 -5
- package/src/{nodes/materials → materials/nodes}/NodeMaterial.js +71 -115
- package/src/{nodes/materials/Materials.js → materials/nodes/NodeMaterials.js} +3 -1
- package/src/{nodes/materials → materials/nodes}/PointsNodeMaterial.js +8 -5
- package/src/{nodes/materials → materials/nodes}/ShadowNodeMaterial.js +9 -5
- package/src/{nodes/materials → materials/nodes}/SpriteNodeMaterial.js +47 -14
- package/src/{nodes/materials → materials/nodes}/VolumeNodeMaterial.js +24 -22
- package/src/materials/nodes/manager/NodeMaterialObserver.js +302 -0
- package/src/math/Triangle.js +24 -0
- package/src/nodes/Nodes.js +103 -159
- package/src/nodes/TSL.js +179 -0
- package/src/nodes/accessors/AccessorsUtils.js +8 -8
- package/src/nodes/accessors/BatchNode.js +53 -21
- package/src/nodes/accessors/{BitangentNode.js → Bitangent.js} +9 -9
- package/src/nodes/accessors/BufferAttributeNode.js +8 -5
- package/src/nodes/accessors/BufferNode.js +7 -4
- package/src/nodes/accessors/Camera.js +13 -0
- package/src/nodes/accessors/ClippingNode.js +19 -13
- package/src/nodes/accessors/CubeTextureNode.js +9 -8
- package/src/nodes/accessors/InstanceNode.js +19 -15
- package/src/nodes/accessors/InstancedPointsMaterialNode.js +8 -5
- package/src/nodes/accessors/Lights.js +51 -0
- package/src/nodes/accessors/MaterialNode.js +56 -55
- package/src/nodes/accessors/MaterialProperties.js +3 -0
- package/src/nodes/accessors/MaterialReferenceNode.js +9 -4
- package/src/nodes/accessors/ModelNode.js +47 -12
- package/src/nodes/accessors/ModelViewProjectionNode.js +12 -9
- package/src/nodes/accessors/MorphNode.js +17 -13
- package/src/nodes/accessors/Normal.js +88 -0
- package/src/nodes/accessors/Object3DNode.js +17 -33
- package/src/nodes/accessors/PointUVNode.js +9 -5
- package/src/nodes/accessors/Position.js +10 -0
- package/src/nodes/accessors/ReferenceBaseNode.js +171 -0
- package/src/nodes/accessors/ReferenceNode.js +50 -7
- package/src/nodes/accessors/ReflectVector.js +10 -0
- package/src/nodes/accessors/RendererReferenceNode.js +12 -6
- package/src/nodes/accessors/SceneNode.js +9 -6
- package/src/nodes/accessors/SkinningNode.js +88 -21
- package/src/nodes/accessors/StorageBufferNode.js +22 -5
- package/src/nodes/accessors/StorageTextureNode.js +9 -6
- package/src/nodes/accessors/Tangent.js +22 -0
- package/src/nodes/accessors/Texture3DNode.js +16 -13
- package/src/nodes/accessors/{TextureBicubicNode.js → TextureBicubic.js} +3 -32
- package/src/nodes/accessors/TextureNode.js +29 -23
- package/src/nodes/accessors/TextureSizeNode.js +10 -9
- package/src/nodes/accessors/{UniformsNode.js → UniformArrayNode.js} +26 -14
- package/src/nodes/accessors/UserDataNode.js +10 -7
- package/src/nodes/accessors/VelocityNode.js +134 -0
- package/src/nodes/accessors/VertexColorNode.js +7 -4
- package/src/nodes/code/CodeNode.js +9 -5
- package/src/nodes/code/ExpressionNode.js +10 -6
- package/src/nodes/code/FunctionCallNode.js +8 -5
- package/src/nodes/code/FunctionNode.js +8 -23
- package/src/nodes/code/ScriptableNode.js +13 -10
- package/src/nodes/code/ScriptableValueNode.js +9 -7
- package/src/nodes/core/AssignNode.js +12 -9
- package/src/nodes/core/AttributeNode.js +12 -21
- package/src/nodes/core/BypassNode.js +11 -7
- package/src/nodes/core/CacheNode.js +10 -6
- package/src/nodes/core/ConstNode.js +6 -3
- package/src/nodes/core/ContextNode.js +21 -11
- package/src/nodes/core/IndexNode.js +35 -8
- package/src/nodes/core/InputNode.js +7 -3
- package/src/nodes/core/MRTNode.js +16 -7
- package/src/nodes/core/Node.js +19 -40
- package/src/nodes/core/NodeBuilder.js +117 -38
- package/src/nodes/core/NodeUtils.js +49 -6
- package/src/nodes/core/OutputStructNode.js +10 -6
- package/src/nodes/core/ParameterNode.js +7 -4
- package/src/nodes/core/PropertyNode.js +36 -32
- package/src/nodes/core/StackNode.js +31 -11
- package/src/nodes/core/StructTypeNode.js +7 -3
- package/src/nodes/core/TempNode.js +8 -4
- package/src/nodes/core/UniformGroupNode.js +14 -11
- package/src/nodes/core/UniformNode.js +7 -4
- package/src/nodes/core/VarNode.js +12 -8
- package/src/nodes/core/VaryingNode.js +10 -6
- package/src/nodes/display/AfterImageNode.js +15 -9
- package/src/nodes/display/AnaglyphPassNode.js +67 -0
- package/src/nodes/display/AnamorphicNode.js +17 -11
- package/src/nodes/display/BleachBypass.js +26 -0
- package/src/nodes/display/BlendMode.js +54 -0
- package/src/nodes/display/BloomNode.js +27 -19
- package/src/nodes/display/BumpMapNode.js +13 -12
- package/src/nodes/display/ColorAdjustment.js +46 -0
- package/src/nodes/display/ColorSpaceFunctions.js +38 -0
- package/src/nodes/display/ColorSpaceNode.js +67 -61
- package/src/nodes/display/DenoiseNode.js +23 -17
- package/src/nodes/display/DepthOfFieldNode.js +12 -7
- package/src/nodes/display/DotScreenNode.js +13 -22
- package/src/nodes/display/FXAANode.js +21 -16
- package/src/nodes/display/FilmNode.js +11 -7
- package/src/nodes/display/FrontFacingNode.js +10 -6
- package/src/nodes/display/GTAONode.js +22 -15
- package/src/nodes/display/GaussianBlurNode.js +14 -8
- package/src/nodes/display/Lut3DNode.js +10 -6
- package/src/nodes/display/MotionBlur.js +25 -0
- package/src/nodes/display/NormalMapNode.js +13 -13
- package/src/nodes/display/ParallaxBarrierPassNode.js +58 -0
- package/src/nodes/display/PassNode.js +95 -8
- package/src/nodes/display/PixelationPassNode.js +20 -8
- package/src/nodes/display/PosterizeNode.js +8 -7
- package/src/nodes/display/RGBShiftNode.js +11 -7
- package/src/nodes/display/RenderOutputNode.js +15 -11
- package/src/nodes/display/SSAAPassNode.js +287 -0
- package/src/nodes/display/ScreenNode.js +181 -0
- package/src/nodes/display/Sepia.js +17 -0
- package/src/nodes/display/SobelOperatorNode.js +13 -8
- package/src/nodes/display/StereoCompositePassNode.js +110 -0
- package/src/nodes/display/StereoPassNode.js +83 -0
- package/src/nodes/display/ToneMappingFunctions.js +190 -0
- package/src/nodes/display/ToneMappingNode.js +15 -175
- package/src/nodes/display/ToonOutlinePassNode.js +111 -0
- package/src/nodes/display/TransitionNode.js +12 -8
- package/src/nodes/display/ViewportDepthNode.js +34 -29
- package/src/nodes/display/ViewportDepthTextureNode.js +10 -9
- package/src/nodes/display/ViewportSharedTextureNode.js +10 -9
- package/src/nodes/display/ViewportTextureNode.js +11 -11
- package/src/nodes/fog/FogExp2Node.js +8 -7
- package/src/nodes/fog/FogNode.js +10 -8
- package/src/nodes/fog/FogRangeNode.js +8 -7
- package/src/nodes/functions/BSDF/BRDF_GGX.js +4 -4
- package/src/nodes/functions/BSDF/BRDF_Lambert.js +2 -2
- package/src/nodes/functions/BSDF/BRDF_Sheen.js +6 -6
- package/src/nodes/functions/BSDF/DFGApprox.js +2 -2
- package/src/nodes/functions/BSDF/D_GGX.js +2 -2
- package/src/nodes/functions/BSDF/D_GGX_Anisotropic.js +3 -3
- package/src/nodes/functions/BSDF/EnvironmentBRDF.js +2 -2
- package/src/nodes/functions/BSDF/F_Schlick.js +2 -2
- package/src/nodes/functions/BSDF/LTC.js +6 -6
- package/src/nodes/functions/BSDF/Schlick_to_F0.js +2 -2
- package/src/nodes/functions/BSDF/V_GGX_SmithCorrelated.js +2 -2
- package/src/nodes/functions/BSDF/V_GGX_SmithCorrelated_Anisotropic.js +2 -2
- package/src/nodes/functions/BasicLightingModel.js +1 -1
- package/src/nodes/functions/PhongLightingModel.js +5 -5
- package/src/nodes/functions/PhysicalLightingModel.js +34 -33
- package/src/nodes/functions/ShadowMaskModel.js +1 -1
- package/src/nodes/functions/ToonLightingModel.js +3 -3
- package/src/nodes/functions/material/getGeometryRoughness.js +4 -4
- package/src/nodes/functions/material/getRoughness.js +2 -2
- package/src/nodes/functions/material/getShIrradianceAt.js +28 -0
- package/src/nodes/geometry/RangeNode.js +9 -5
- package/src/nodes/gpgpu/AtomicFunctionNode.js +99 -0
- package/src/nodes/gpgpu/BarrierNode.js +40 -0
- package/src/nodes/gpgpu/ComputeBuiltinNode.js +98 -0
- package/src/nodes/gpgpu/ComputeNode.js +10 -6
- package/src/nodes/gpgpu/WorkgroupInfoNode.js +100 -0
- package/src/nodes/lighting/AONode.js +6 -3
- package/src/nodes/lighting/AmbientLightNode.js +6 -8
- package/src/nodes/lighting/AnalyticLightNode.js +225 -36
- package/src/nodes/lighting/BasicEnvironmentNode.js +8 -4
- package/src/nodes/lighting/BasicLightMapNode.js +7 -4
- package/src/nodes/lighting/DirectionalLightNode.js +7 -9
- package/src/nodes/lighting/EnvironmentNode.js +23 -19
- package/src/nodes/lighting/HemisphereLightNode.js +11 -11
- package/src/nodes/lighting/IESSpotLightNode.js +7 -9
- package/src/nodes/lighting/IrradianceNode.js +6 -3
- package/src/nodes/lighting/LightProbeNode.js +53 -0
- package/src/nodes/lighting/LightUtils.js +3 -3
- package/src/nodes/lighting/LightingContextNode.js +19 -18
- package/src/nodes/lighting/LightingNode.js +7 -3
- package/src/nodes/lighting/LightsNode.js +112 -75
- package/src/nodes/lighting/PointLightNode.js +12 -13
- package/src/nodes/lighting/RectAreaLightNode.js +11 -11
- package/src/nodes/lighting/SpotLightNode.js +14 -16
- package/src/nodes/materialx/MaterialXNodes.js +2 -2
- package/src/nodes/materialx/lib/mx_hsv.js +36 -31
- package/src/nodes/materialx/lib/mx_noise.js +96 -96
- package/src/nodes/materialx/lib/mx_transform_color.js +2 -2
- package/src/nodes/math/{CondNode.js → ConditionalNode.js} +38 -10
- package/src/nodes/math/Hash.js +13 -0
- package/src/nodes/math/MathNode.js +127 -124
- package/src/nodes/math/MathUtils.js +0 -7
- package/src/nodes/math/OperatorNode.js +97 -52
- package/src/nodes/math/TriNoise3D.js +19 -29
- package/src/nodes/pmrem/PMREMNode.js +61 -15
- package/src/nodes/pmrem/PMREMUtils.js +46 -46
- package/src/nodes/procedural/Checker.js +14 -0
- package/src/nodes/tsl/TSLBase.js +30 -0
- package/src/nodes/{shadernode/ShaderNode.js → tsl/TSLCore.js} +105 -97
- package/src/nodes/utils/ArrayElementNode.js +8 -4
- package/src/nodes/utils/ConvertNode.js +7 -3
- package/src/nodes/utils/CubeMapNode.js +160 -0
- package/src/nodes/utils/Discard.js +8 -0
- package/src/nodes/utils/EquirectUVNode.js +9 -6
- package/src/nodes/utils/FlipNode.js +68 -0
- package/src/nodes/utils/FunctionOverloadingNode.js +9 -5
- package/src/nodes/utils/JoinNode.js +6 -3
- package/src/nodes/utils/LoopNode.js +16 -6
- package/src/nodes/utils/MatcapUVNode.js +10 -7
- package/src/nodes/utils/MaxMipLevelNode.js +8 -5
- package/src/nodes/utils/OscNode.js +12 -8
- package/src/nodes/utils/Packing.js +4 -0
- package/src/nodes/utils/RTTNode.js +11 -8
- package/src/nodes/utils/ReflectorNode.js +12 -4
- package/src/nodes/utils/RemapNode.js +12 -8
- package/src/nodes/utils/RotateNode.js +8 -13
- package/src/nodes/utils/SetNode.js +7 -4
- package/src/nodes/utils/SplitNode.js +7 -3
- package/src/nodes/utils/SpriteSheetUVNode.js +10 -6
- package/src/nodes/utils/SpriteUtils.js +47 -0
- package/src/nodes/utils/StorageArrayElementNode.js +11 -12
- package/src/nodes/utils/TimerNode.js +8 -5
- package/src/nodes/utils/TriplanarTexturesNode.js +11 -9
- package/src/nodes/utils/UVUtils.js +19 -0
- package/src/nodes/utils/ViewportUtils.js +14 -0
- package/src/objects/BatchedMesh.js +78 -13
- package/src/objects/LOD.js +21 -0
- package/src/objects/Line.js +1 -0
- package/src/objects/Mesh.js +7 -23
- package/src/objects/Points.js +2 -0
- package/src/renderers/WebGLRenderer.js +88 -41
- package/src/renderers/common/Backend.js +2 -2
- package/src/renderers/common/Background.js +3 -1
- package/src/renderers/common/BindGroup.js +3 -1
- package/src/renderers/common/Bindings.js +13 -15
- package/src/renderers/common/BundleGroup.js +26 -0
- package/src/renderers/common/ClippingContext.js +15 -5
- package/src/renderers/common/CubeRenderTarget.js +9 -3
- package/src/renderers/common/PostProcessing.js +4 -1
- package/src/renderers/common/QuadMesh.js +2 -0
- package/src/renderers/common/RenderContext.js +23 -0
- package/src/renderers/common/RenderList.js +1 -1
- package/src/renderers/common/RenderObject.js +117 -6
- package/src/renderers/common/RenderObjects.js +8 -1
- package/src/renderers/common/Renderer.js +128 -94
- package/src/renderers/common/SampledTexture.js +12 -3
- package/src/renderers/common/Textures.js +8 -12
- package/src/renderers/common/extras/PMREMGenerator.js +19 -22
- package/src/renderers/common/nodes/NodeBuilderState.js +4 -4
- package/src/renderers/common/nodes/NodeLibrary.js +118 -0
- package/src/renderers/common/nodes/NodeSampledTexture.js +2 -2
- package/src/renderers/common/nodes/Nodes.js +65 -19
- package/src/renderers/shaders/ShaderChunk/tonemapping_pars_fragment.glsl.js +2 -2
- package/src/renderers/shaders/ShaderLib/sprite.glsl.js +2 -4
- package/src/renderers/webgl/WebGLAttributes.js +45 -14
- package/src/renderers/webgl/WebGLCapabilities.js +9 -0
- package/src/renderers/webgl/WebGLProgram.js +3 -1
- package/src/renderers/webgl/WebGLPrograms.js +21 -17
- package/src/renderers/webgl/WebGLProperties.js +7 -0
- package/src/renderers/webgl/WebGLState.js +21 -0
- package/src/renderers/webgl/WebGLTextures.js +83 -4
- package/src/renderers/webgl-fallback/WebGLBackend.js +135 -110
- package/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js +60 -12
- package/src/renderers/webgl-fallback/utils/WebGLAttributeUtils.js +6 -0
- package/src/renderers/webgl-fallback/utils/WebGLState.js +20 -2
- package/src/renderers/webgl-fallback/utils/WebGLTextureUtils.js +89 -37
- package/src/renderers/webgpu/WebGPUBackend.js +112 -86
- package/src/renderers/webgpu/WebGPURenderer.Nodes.js +42 -0
- package/src/renderers/webgpu/WebGPURenderer.js +9 -6
- package/src/renderers/webgpu/nodes/BasicNodeLibrary.js +59 -0
- package/src/renderers/webgpu/nodes/StandardNodeLibrary.js +105 -0
- package/src/renderers/webgpu/nodes/WGSLNodeBuilder.js +189 -73
- package/src/renderers/webgpu/utils/WebGPUAttributeUtils.js +6 -16
- package/src/renderers/webgpu/utils/WebGPUBindingUtils.js +45 -21
- package/src/renderers/webgpu/utils/WebGPUConstants.js +2 -1
- package/src/renderers/webgpu/utils/WebGPUPipelineUtils.js +7 -16
- package/src/renderers/webgpu/utils/WebGPUTexturePassUtils.js +62 -5
- package/src/renderers/webgpu/utils/WebGPUTextureUtils.js +43 -26
- package/src/renderers/webgpu/utils/WebGPUUtils.js +19 -2
- package/src/renderers/webxr/WebXRManager.js +32 -25
- package/src/utils.js +33 -1
- package/examples/jsm/geometries/SDFGeometryGenerator.js +0 -144
- package/examples/jsm/loaders/LogLuvLoader.js +0 -606
- package/examples/jsm/loaders/TiltLoader.js +0 -520
- package/examples/jsm/utils/GPUStatsPanel.js +0 -95
- package/examples/jsm/utils/PackedPhongMaterial.js +0 -178
- package/src/nodes/accessors/CameraNode.js +0 -19
- package/src/nodes/accessors/NormalNode.js +0 -14
- package/src/nodes/accessors/PositionNode.js +0 -10
- package/src/nodes/accessors/ReflectVectorNode.js +0 -10
- package/src/nodes/accessors/TangentNode.js +0 -23
- package/src/nodes/core/NodeKeywords.js +0 -80
- package/src/nodes/display/BlendModeNode.js +0 -128
- package/src/nodes/display/ColorAdjustmentNode.js +0 -104
- package/src/nodes/display/ViewportNode.js +0 -137
- package/src/nodes/lighting/LightNode.js +0 -57
- package/src/nodes/materials/InstancedPointsNodeMaterial.js +0 -162
- package/src/nodes/math/HashNode.js +0 -34
- package/src/nodes/procedural/CheckerNode.js +0 -42
- package/src/nodes/utils/DiscardNode.js +0 -28
- package/src/nodes/utils/PackingNode.js +0 -55
- package/src/nodes/utils/RotateUVNode.js +0 -35
- /package/src/nodes/accessors/{UVNode.js → UV.js} +0 -0
|
@@ -1,17 +1,22 @@
|
|
|
1
1
|
import UniformNode, { uniform } from '../core/UniformNode.js';
|
|
2
|
-
import { uv } from './
|
|
2
|
+
import { uv } from './UV.js';
|
|
3
3
|
import { textureSize } from './TextureSizeNode.js';
|
|
4
|
-
import {
|
|
4
|
+
import { colorSpaceToWorking } from '../display/ColorSpaceNode.js';
|
|
5
5
|
import { expression } from '../code/ExpressionNode.js';
|
|
6
|
-
import { addNodeClass } from '../core/Node.js';
|
|
7
6
|
import { maxMipLevel } from '../utils/MaxMipLevelNode.js';
|
|
8
|
-
import {
|
|
7
|
+
import { nodeProxy, vec3, nodeObject, int } from '../tsl/TSLBase.js';
|
|
9
8
|
import { NodeUpdateType } from '../core/constants.js';
|
|
10
9
|
|
|
11
10
|
import { IntType, UnsignedIntType } from '../../constants.js';
|
|
12
11
|
|
|
13
12
|
class TextureNode extends UniformNode {
|
|
14
13
|
|
|
14
|
+
static get type() {
|
|
15
|
+
|
|
16
|
+
return 'TextureNode';
|
|
17
|
+
|
|
18
|
+
}
|
|
19
|
+
|
|
15
20
|
constructor( value, uvNode = null, levelNode = null, biasNode = null ) {
|
|
16
21
|
|
|
17
22
|
super( value );
|
|
@@ -106,7 +111,6 @@ class TextureNode extends UniformNode {
|
|
|
106
111
|
|
|
107
112
|
return this._matrixUniform.mul( vec3( uvNode, 1 ) ).xy;
|
|
108
113
|
|
|
109
|
-
|
|
110
114
|
}
|
|
111
115
|
|
|
112
116
|
setUpdateMatrix( value ) {
|
|
@@ -124,7 +128,15 @@ class TextureNode extends UniformNode {
|
|
|
124
128
|
|
|
125
129
|
if ( builder.isFlipY() && ( texture.isRenderTargetTexture === true || texture.isFramebufferTexture === true || texture.isDepthTexture === true ) ) {
|
|
126
130
|
|
|
127
|
-
|
|
131
|
+
if ( this.sampler ) {
|
|
132
|
+
|
|
133
|
+
uvNode = uvNode.flipY();
|
|
134
|
+
|
|
135
|
+
} else {
|
|
136
|
+
|
|
137
|
+
uvNode = uvNode.setY( int( textureSize( this, this.levelNode ).y ).sub( uvNode.y ).sub( 1 ) );
|
|
138
|
+
|
|
139
|
+
}
|
|
128
140
|
|
|
129
141
|
}
|
|
130
142
|
|
|
@@ -265,7 +277,7 @@ class TextureNode extends UniformNode {
|
|
|
265
277
|
|
|
266
278
|
const snippet = this.generateSnippet( builder, textureProperty, uvSnippet, levelSnippet, biasSnippet, depthSnippet, compareSnippet, gradSnippet );
|
|
267
279
|
|
|
268
|
-
builder.addLineFlowCode( `${propertyName} = ${snippet}
|
|
280
|
+
builder.addLineFlowCode( `${propertyName} = ${snippet}`, this );
|
|
269
281
|
|
|
270
282
|
nodeData.snippet = snippet;
|
|
271
283
|
nodeData.propertyName = propertyName;
|
|
@@ -275,9 +287,9 @@ class TextureNode extends UniformNode {
|
|
|
275
287
|
let snippet = propertyName;
|
|
276
288
|
const nodeType = this.getNodeType( builder );
|
|
277
289
|
|
|
278
|
-
if ( builder.
|
|
290
|
+
if ( builder.needsToWorkingColorSpace( texture ) ) {
|
|
279
291
|
|
|
280
|
-
snippet =
|
|
292
|
+
snippet = colorSpaceToWorking( expression( snippet, nodeType ), texture.colorSpace ).setup( builder ).build( builder, nodeType );
|
|
281
293
|
|
|
282
294
|
}
|
|
283
295
|
|
|
@@ -307,7 +319,7 @@ class TextureNode extends UniformNode {
|
|
|
307
319
|
|
|
308
320
|
const textureNode = this.clone();
|
|
309
321
|
textureNode.uvNode = nodeObject( uvNode );
|
|
310
|
-
textureNode.referenceNode = this;
|
|
322
|
+
textureNode.referenceNode = this.getSelf();
|
|
311
323
|
|
|
312
324
|
return nodeObject( textureNode );
|
|
313
325
|
|
|
@@ -317,7 +329,7 @@ class TextureNode extends UniformNode {
|
|
|
317
329
|
|
|
318
330
|
const textureNode = this.clone();
|
|
319
331
|
textureNode.biasNode = nodeObject( amountNode ).mul( maxMipLevel( textureNode ) );
|
|
320
|
-
textureNode.referenceNode = this;
|
|
332
|
+
textureNode.referenceNode = this.getSelf();
|
|
321
333
|
|
|
322
334
|
return nodeObject( textureNode );
|
|
323
335
|
|
|
@@ -327,7 +339,7 @@ class TextureNode extends UniformNode {
|
|
|
327
339
|
|
|
328
340
|
const textureNode = this.clone();
|
|
329
341
|
textureNode.levelNode = nodeObject( levelNode );
|
|
330
|
-
textureNode.referenceNode = this;
|
|
342
|
+
textureNode.referenceNode = this.getSelf();
|
|
331
343
|
|
|
332
344
|
return nodeObject( textureNode );
|
|
333
345
|
|
|
@@ -343,7 +355,7 @@ class TextureNode extends UniformNode {
|
|
|
343
355
|
|
|
344
356
|
const textureNode = this.clone();
|
|
345
357
|
textureNode.biasNode = nodeObject( biasNode );
|
|
346
|
-
textureNode.referenceNode = this;
|
|
358
|
+
textureNode.referenceNode = this.getSelf();
|
|
347
359
|
|
|
348
360
|
return nodeObject( textureNode );
|
|
349
361
|
|
|
@@ -353,7 +365,7 @@ class TextureNode extends UniformNode {
|
|
|
353
365
|
|
|
354
366
|
const textureNode = this.clone();
|
|
355
367
|
textureNode.compareNode = nodeObject( compareNode );
|
|
356
|
-
textureNode.referenceNode = this;
|
|
368
|
+
textureNode.referenceNode = this.getSelf();
|
|
357
369
|
|
|
358
370
|
return nodeObject( textureNode );
|
|
359
371
|
|
|
@@ -363,8 +375,7 @@ class TextureNode extends UniformNode {
|
|
|
363
375
|
|
|
364
376
|
const textureNode = this.clone();
|
|
365
377
|
textureNode.gradNode = [ nodeObject( gradNodeX ), nodeObject( gradNodeY ) ];
|
|
366
|
-
|
|
367
|
-
textureNode.referenceNode = this;
|
|
378
|
+
textureNode.referenceNode = this.getSelf();
|
|
368
379
|
|
|
369
380
|
return nodeObject( textureNode );
|
|
370
381
|
|
|
@@ -374,7 +385,7 @@ class TextureNode extends UniformNode {
|
|
|
374
385
|
|
|
375
386
|
const textureNode = this.clone();
|
|
376
387
|
textureNode.depthNode = nodeObject( depthNode );
|
|
377
|
-
textureNode.referenceNode = this;
|
|
388
|
+
textureNode.referenceNode = this.getSelf();
|
|
378
389
|
|
|
379
390
|
return nodeObject( textureNode );
|
|
380
391
|
|
|
@@ -432,14 +443,9 @@ class TextureNode extends UniformNode {
|
|
|
432
443
|
|
|
433
444
|
export default TextureNode;
|
|
434
445
|
|
|
435
|
-
export const texture = nodeProxy( TextureNode );
|
|
446
|
+
export const texture = /*@__PURE__*/ nodeProxy( TextureNode );
|
|
436
447
|
export const textureLoad = ( ...params ) => texture( ...params ).setSampler( false );
|
|
437
448
|
|
|
438
449
|
//export const textureLevel = ( value, uv, level ) => texture( value, uv ).level( level );
|
|
439
450
|
|
|
440
451
|
export const sampler = ( aTexture ) => ( aTexture.isNode === true ? aTexture : texture( aTexture ) ).convert( 'sampler' );
|
|
441
|
-
|
|
442
|
-
addNodeElement( 'texture', texture );
|
|
443
|
-
//addNodeElement( 'textureLevel', textureLevel );
|
|
444
|
-
|
|
445
|
-
addNodeClass( 'TextureNode', TextureNode );
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import Node from '../core/Node.js';
|
|
2
|
-
import {
|
|
3
|
-
import { addNodeElement, nodeProxy } from '../shadernode/ShaderNode.js';
|
|
2
|
+
import { nodeProxy } from '../tsl/TSLBase.js';
|
|
4
3
|
|
|
5
4
|
class TextureSizeNode extends Node {
|
|
6
5
|
|
|
6
|
+
static get type() {
|
|
7
|
+
|
|
8
|
+
return 'TextureSizeNode';
|
|
9
|
+
|
|
10
|
+
}
|
|
11
|
+
|
|
7
12
|
constructor( textureNode, levelNode = null ) {
|
|
8
13
|
|
|
9
14
|
super( 'uvec2' );
|
|
@@ -18,9 +23,9 @@ class TextureSizeNode extends Node {
|
|
|
18
23
|
generate( builder, output ) {
|
|
19
24
|
|
|
20
25
|
const textureProperty = this.textureNode.build( builder, 'property' );
|
|
21
|
-
const
|
|
26
|
+
const level = this.levelNode === null ? '0' : this.levelNode.build( builder, 'int' );
|
|
22
27
|
|
|
23
|
-
return builder.format( `${ builder.getMethod( 'textureDimensions' ) }( ${ textureProperty }, ${
|
|
28
|
+
return builder.format( `${ builder.getMethod( 'textureDimensions' ) }( ${ textureProperty }, ${ level } )`, this.getNodeType( builder ), output );
|
|
24
29
|
|
|
25
30
|
}
|
|
26
31
|
|
|
@@ -28,8 +33,4 @@ class TextureSizeNode extends Node {
|
|
|
28
33
|
|
|
29
34
|
export default TextureSizeNode;
|
|
30
35
|
|
|
31
|
-
export const textureSize = nodeProxy( TextureSizeNode );
|
|
32
|
-
|
|
33
|
-
addNodeElement( 'textureSize', textureSize );
|
|
34
|
-
|
|
35
|
-
addNodeClass( 'TextureSizeNode', TextureSizeNode );
|
|
36
|
+
export const textureSize = /*@__PURE__*/ nodeProxy( TextureSizeNode );
|
|
@@ -1,23 +1,22 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { nodeObject } from '../shadernode/ShaderNode.js';
|
|
1
|
+
import { nodeObject } from '../tsl/TSLBase.js';
|
|
3
2
|
import { NodeUpdateType } from '../core/constants.js';
|
|
4
3
|
import { getValueType } from '../core/NodeUtils.js';
|
|
5
4
|
import ArrayElementNode from '../utils/ArrayElementNode.js';
|
|
6
5
|
import BufferNode from './BufferNode.js';
|
|
7
6
|
|
|
8
|
-
class
|
|
7
|
+
class UniformArrayElementNode extends ArrayElementNode {
|
|
9
8
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
super( arrayBuffer, indexNode );
|
|
9
|
+
static get type() {
|
|
13
10
|
|
|
14
|
-
|
|
11
|
+
return 'UniformArrayElementNode';
|
|
15
12
|
|
|
16
13
|
}
|
|
17
14
|
|
|
18
|
-
|
|
15
|
+
constructor( arrayBuffer, indexNode ) {
|
|
16
|
+
|
|
17
|
+
super( arrayBuffer, indexNode );
|
|
19
18
|
|
|
20
|
-
|
|
19
|
+
this.isArrayBufferElementNode = true;
|
|
21
20
|
|
|
22
21
|
}
|
|
23
22
|
|
|
@@ -32,7 +31,13 @@ class UniformsElementNode extends ArrayElementNode {
|
|
|
32
31
|
|
|
33
32
|
}
|
|
34
33
|
|
|
35
|
-
class
|
|
34
|
+
class UniformArrayNode extends BufferNode {
|
|
35
|
+
|
|
36
|
+
static get type() {
|
|
37
|
+
|
|
38
|
+
return 'UniformArrayNode';
|
|
39
|
+
|
|
40
|
+
}
|
|
36
41
|
|
|
37
42
|
constructor( value, elementType = null ) {
|
|
38
43
|
|
|
@@ -133,14 +138,21 @@ class UniformsNode extends BufferNode {
|
|
|
133
138
|
|
|
134
139
|
element( indexNode ) {
|
|
135
140
|
|
|
136
|
-
return nodeObject( new
|
|
141
|
+
return nodeObject( new UniformArrayElementNode( this, nodeObject( indexNode ) ) );
|
|
137
142
|
|
|
138
143
|
}
|
|
139
144
|
|
|
140
145
|
}
|
|
141
146
|
|
|
142
|
-
export default
|
|
147
|
+
export default UniformArrayNode;
|
|
148
|
+
|
|
149
|
+
export const uniformArray = ( values, nodeType ) => nodeObject( new UniformArrayNode( values, nodeType ) );
|
|
150
|
+
|
|
151
|
+
//
|
|
152
|
+
|
|
153
|
+
export const uniforms = ( values, nodeType ) => { // @deprecated, r168
|
|
143
154
|
|
|
144
|
-
|
|
155
|
+
console.warn( 'TSL.UniformArrayNode: uniforms() has been renamed to uniformArray().' );
|
|
156
|
+
return nodeObject( new UniformArrayNode( values, nodeType ) );
|
|
145
157
|
|
|
146
|
-
|
|
158
|
+
};
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import ReferenceNode from './ReferenceNode.js';
|
|
2
|
-
import {
|
|
3
|
-
import { nodeObject } from '../shadernode/ShaderNode.js';
|
|
2
|
+
import { nodeObject } from '../tsl/TSLBase.js';
|
|
4
3
|
|
|
5
4
|
class UserDataNode extends ReferenceNode {
|
|
6
5
|
|
|
6
|
+
static get type() {
|
|
7
|
+
|
|
8
|
+
return 'UserDataNode';
|
|
9
|
+
|
|
10
|
+
}
|
|
11
|
+
|
|
7
12
|
constructor( property, inputType, userData = null ) {
|
|
8
13
|
|
|
9
14
|
super( property, inputType, userData );
|
|
@@ -12,11 +17,11 @@ class UserDataNode extends ReferenceNode {
|
|
|
12
17
|
|
|
13
18
|
}
|
|
14
19
|
|
|
15
|
-
|
|
20
|
+
updateReference( state ) {
|
|
16
21
|
|
|
17
|
-
this.reference = this.userData !== null ? this.userData :
|
|
22
|
+
this.reference = this.userData !== null ? this.userData : state.object.userData;
|
|
18
23
|
|
|
19
|
-
|
|
24
|
+
return this.reference;
|
|
20
25
|
|
|
21
26
|
}
|
|
22
27
|
|
|
@@ -25,5 +30,3 @@ class UserDataNode extends ReferenceNode {
|
|
|
25
30
|
export default UserDataNode;
|
|
26
31
|
|
|
27
32
|
export const userData = ( name, inputType, userData ) => nodeObject( new UserDataNode( name, inputType, userData ) );
|
|
28
|
-
|
|
29
|
-
addNodeClass( 'UserDataNode', UserDataNode );
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import TempNode from '../core/TempNode.js';
|
|
2
|
+
import { modelViewMatrix } from './ModelNode.js';
|
|
3
|
+
import { positionLocal, positionPrevious } from './Position.js';
|
|
4
|
+
import { nodeImmutable } from '../tsl/TSLBase.js';
|
|
5
|
+
import { NodeUpdateType } from '../core/constants.js';
|
|
6
|
+
import { Matrix4 } from '../../math/Matrix4.js';
|
|
7
|
+
import { uniform } from '../core/UniformNode.js';
|
|
8
|
+
import { sub } from '../math/OperatorNode.js';
|
|
9
|
+
import { cameraProjectionMatrix } from './Camera.js';
|
|
10
|
+
import { renderGroup } from '../core/UniformGroupNode.js';
|
|
11
|
+
|
|
12
|
+
const _objectData = new WeakMap();
|
|
13
|
+
|
|
14
|
+
class VelocityNode extends TempNode {
|
|
15
|
+
|
|
16
|
+
static get type() {
|
|
17
|
+
|
|
18
|
+
return 'VelocityNode';
|
|
19
|
+
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
constructor() {
|
|
23
|
+
|
|
24
|
+
super( 'vec2' );
|
|
25
|
+
|
|
26
|
+
this.updateType = NodeUpdateType.OBJECT;
|
|
27
|
+
this.updateAfterType = NodeUpdateType.OBJECT;
|
|
28
|
+
|
|
29
|
+
this.previousModelWorldMatrix = uniform( new Matrix4() );
|
|
30
|
+
this.previousProjectionMatrix = uniform( new Matrix4() ).setGroup( renderGroup );
|
|
31
|
+
this.previousCameraViewMatrix = uniform( new Matrix4() );
|
|
32
|
+
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
update( { frameId, camera, object } ) {
|
|
36
|
+
|
|
37
|
+
const previousModelMatrix = getPreviousMatrix( object );
|
|
38
|
+
|
|
39
|
+
this.previousModelWorldMatrix.value.copy( previousModelMatrix );
|
|
40
|
+
|
|
41
|
+
//
|
|
42
|
+
|
|
43
|
+
const cameraData = getData( camera );
|
|
44
|
+
|
|
45
|
+
if ( cameraData.frameId !== frameId ) {
|
|
46
|
+
|
|
47
|
+
cameraData.frameId = frameId;
|
|
48
|
+
|
|
49
|
+
if ( cameraData.previousProjectionMatrix === undefined ) {
|
|
50
|
+
|
|
51
|
+
cameraData.previousProjectionMatrix = new Matrix4();
|
|
52
|
+
cameraData.previousCameraViewMatrix = new Matrix4();
|
|
53
|
+
|
|
54
|
+
cameraData.currentProjectionMatrix = new Matrix4();
|
|
55
|
+
cameraData.currentCameraViewMatrix = new Matrix4();
|
|
56
|
+
|
|
57
|
+
cameraData.previousProjectionMatrix.copy( camera.projectionMatrix );
|
|
58
|
+
cameraData.previousCameraViewMatrix.copy( camera.matrixWorldInverse );
|
|
59
|
+
|
|
60
|
+
} else {
|
|
61
|
+
|
|
62
|
+
cameraData.previousProjectionMatrix.copy( cameraData.currentProjectionMatrix );
|
|
63
|
+
cameraData.previousCameraViewMatrix.copy( cameraData.currentCameraViewMatrix );
|
|
64
|
+
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
cameraData.currentProjectionMatrix.copy( camera.projectionMatrix );
|
|
68
|
+
cameraData.currentCameraViewMatrix.copy( camera.matrixWorldInverse );
|
|
69
|
+
|
|
70
|
+
this.previousProjectionMatrix.value.copy( cameraData.previousProjectionMatrix );
|
|
71
|
+
this.previousCameraViewMatrix.value.copy( cameraData.previousCameraViewMatrix );
|
|
72
|
+
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
updateAfter( { object } ) {
|
|
78
|
+
|
|
79
|
+
getPreviousMatrix( object ).copy( object.matrixWorld );
|
|
80
|
+
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
setup( /*builder*/ ) {
|
|
84
|
+
|
|
85
|
+
const previousModelViewMatrix = this.previousCameraViewMatrix.mul( this.previousModelWorldMatrix );
|
|
86
|
+
|
|
87
|
+
const clipPositionCurrent = cameraProjectionMatrix.mul( modelViewMatrix ).mul( positionLocal );
|
|
88
|
+
const clipPositionPrevious = this.previousProjectionMatrix.mul( previousModelViewMatrix ).mul( positionPrevious );
|
|
89
|
+
|
|
90
|
+
const ndcPositionCurrent = clipPositionCurrent.xy.div( clipPositionCurrent.w );
|
|
91
|
+
const ndcPositionPrevious = clipPositionPrevious.xy.div( clipPositionPrevious.w );
|
|
92
|
+
|
|
93
|
+
const velocity = sub( ndcPositionCurrent, ndcPositionPrevious );
|
|
94
|
+
|
|
95
|
+
return velocity;
|
|
96
|
+
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function getData( object ) {
|
|
102
|
+
|
|
103
|
+
let objectData = _objectData.get( object );
|
|
104
|
+
|
|
105
|
+
if ( objectData === undefined ) {
|
|
106
|
+
|
|
107
|
+
objectData = {};
|
|
108
|
+
_objectData.set( object, objectData );
|
|
109
|
+
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
return objectData;
|
|
113
|
+
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
function getPreviousMatrix( object, index = 0 ) {
|
|
117
|
+
|
|
118
|
+
const objectData = getData( object );
|
|
119
|
+
|
|
120
|
+
let matrix = objectData[ index ];
|
|
121
|
+
|
|
122
|
+
if ( matrix === undefined ) {
|
|
123
|
+
|
|
124
|
+
objectData[ index ] = matrix = new Matrix4();
|
|
125
|
+
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
return matrix;
|
|
129
|
+
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export default VelocityNode;
|
|
133
|
+
|
|
134
|
+
export const velocity = /*@__PURE__*/ nodeImmutable( VelocityNode );
|
|
@@ -1,11 +1,16 @@
|
|
|
1
|
-
import { addNodeClass } from '../core/Node.js';
|
|
2
1
|
import AttributeNode from '../core/AttributeNode.js';
|
|
3
|
-
import { nodeObject } from '../
|
|
2
|
+
import { nodeObject } from '../tsl/TSLBase.js';
|
|
4
3
|
|
|
5
4
|
import { Vector4 } from '../../math/Vector4.js';
|
|
6
5
|
|
|
7
6
|
class VertexColorNode extends AttributeNode {
|
|
8
7
|
|
|
8
|
+
static get type() {
|
|
9
|
+
|
|
10
|
+
return 'VertexColorNode';
|
|
11
|
+
|
|
12
|
+
}
|
|
13
|
+
|
|
9
14
|
constructor( index = 0 ) {
|
|
10
15
|
|
|
11
16
|
super( null, 'vec4' );
|
|
@@ -67,5 +72,3 @@ class VertexColorNode extends AttributeNode {
|
|
|
67
72
|
export default VertexColorNode;
|
|
68
73
|
|
|
69
74
|
export const vertexColor = ( ...params ) => nodeObject( new VertexColorNode( ...params ) );
|
|
70
|
-
|
|
71
|
-
addNodeClass( 'VertexColorNode', VertexColorNode );
|
|
@@ -1,8 +1,14 @@
|
|
|
1
|
-
import Node
|
|
2
|
-
import { nodeProxy } from '../
|
|
1
|
+
import Node from '../core/Node.js';
|
|
2
|
+
import { nodeProxy } from '../tsl/TSLBase.js';
|
|
3
3
|
|
|
4
4
|
class CodeNode extends Node {
|
|
5
5
|
|
|
6
|
+
static get type() {
|
|
7
|
+
|
|
8
|
+
return 'CodeNode';
|
|
9
|
+
|
|
10
|
+
}
|
|
11
|
+
|
|
6
12
|
constructor( code = '', includes = [], language = '' ) {
|
|
7
13
|
|
|
8
14
|
super( 'code' );
|
|
@@ -75,10 +81,8 @@ class CodeNode extends Node {
|
|
|
75
81
|
|
|
76
82
|
export default CodeNode;
|
|
77
83
|
|
|
78
|
-
export const code = nodeProxy( CodeNode );
|
|
84
|
+
export const code = /*@__PURE__*/ nodeProxy( CodeNode );
|
|
79
85
|
|
|
80
86
|
export const js = ( src, includes ) => code( src, includes, 'js' );
|
|
81
87
|
export const wgsl = ( src, includes ) => code( src, includes, 'wgsl' );
|
|
82
88
|
export const glsl = ( src, includes ) => code( src, includes, 'glsl' );
|
|
83
|
-
|
|
84
|
-
addNodeClass( 'CodeNode', CodeNode );
|
|
@@ -1,8 +1,14 @@
|
|
|
1
|
-
import Node
|
|
2
|
-
import { nodeProxy } from '../
|
|
1
|
+
import Node from '../core/Node.js';
|
|
2
|
+
import { nodeProxy } from '../tsl/TSLCore.js';
|
|
3
3
|
|
|
4
4
|
class ExpressionNode extends Node {
|
|
5
5
|
|
|
6
|
+
static get type() {
|
|
7
|
+
|
|
8
|
+
return 'ExpressionNode';
|
|
9
|
+
|
|
10
|
+
}
|
|
11
|
+
|
|
6
12
|
constructor( snippet = '', nodeType = 'void' ) {
|
|
7
13
|
|
|
8
14
|
super( nodeType );
|
|
@@ -18,7 +24,7 @@ class ExpressionNode extends Node {
|
|
|
18
24
|
|
|
19
25
|
if ( type === 'void' ) {
|
|
20
26
|
|
|
21
|
-
builder.addLineFlowCode( snippet );
|
|
27
|
+
builder.addLineFlowCode( snippet, this );
|
|
22
28
|
|
|
23
29
|
} else {
|
|
24
30
|
|
|
@@ -32,6 +38,4 @@ class ExpressionNode extends Node {
|
|
|
32
38
|
|
|
33
39
|
export default ExpressionNode;
|
|
34
40
|
|
|
35
|
-
export const expression = nodeProxy( ExpressionNode );
|
|
36
|
-
|
|
37
|
-
addNodeClass( 'ExpressionNode', ExpressionNode );
|
|
41
|
+
export const expression = /*@__PURE__*/ nodeProxy( ExpressionNode );
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import TempNode from '../core/TempNode.js';
|
|
2
|
-
import {
|
|
3
|
-
import { addNodeElement, nodeArray, nodeObject, nodeObjects } from '../shadernode/ShaderNode.js';
|
|
2
|
+
import { addMethodChaining, nodeArray, nodeObject, nodeObjects } from '../tsl/TSLCore.js';
|
|
4
3
|
|
|
5
4
|
class FunctionCallNode extends TempNode {
|
|
6
5
|
|
|
6
|
+
static get type() {
|
|
7
|
+
|
|
8
|
+
return 'FunctionCallNode';
|
|
9
|
+
|
|
10
|
+
}
|
|
11
|
+
|
|
7
12
|
constructor( functionNode = null, parameters = {} ) {
|
|
8
13
|
|
|
9
14
|
super();
|
|
@@ -91,6 +96,4 @@ export const call = ( func, ...params ) => {
|
|
|
91
96
|
|
|
92
97
|
};
|
|
93
98
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
addNodeClass( 'FunctionCallNode', FunctionCallNode );
|
|
99
|
+
addMethodChaining( 'call', call );
|
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
import CodeNode from './CodeNode.js';
|
|
2
|
-
import {
|
|
3
|
-
import { nodeObject } from '../shadernode/ShaderNode.js';
|
|
2
|
+
import { nodeObject } from '../tsl/TSLBase.js';
|
|
4
3
|
|
|
5
4
|
class FunctionNode extends CodeNode {
|
|
6
5
|
|
|
6
|
+
static get type() {
|
|
7
|
+
|
|
8
|
+
return 'FunctionNode';
|
|
9
|
+
|
|
10
|
+
}
|
|
11
|
+
|
|
7
12
|
constructor( code = '', includes = [], language = '' ) {
|
|
8
13
|
|
|
9
14
|
super( code, includes, language );
|
|
10
15
|
|
|
11
|
-
this.keywords = {};
|
|
12
|
-
|
|
13
16
|
}
|
|
14
17
|
|
|
15
18
|
getNodeType( builder ) {
|
|
@@ -63,23 +66,7 @@ class FunctionNode extends CodeNode {
|
|
|
63
66
|
|
|
64
67
|
const propertyName = builder.getPropertyName( nodeCode );
|
|
65
68
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
const keywords = this.keywords;
|
|
69
|
-
const keywordsProperties = Object.keys( keywords );
|
|
70
|
-
|
|
71
|
-
if ( keywordsProperties.length > 0 ) {
|
|
72
|
-
|
|
73
|
-
for ( const property of keywordsProperties ) {
|
|
74
|
-
|
|
75
|
-
const propertyRegExp = new RegExp( `\\b${property}\\b`, 'g' );
|
|
76
|
-
const nodeProperty = keywords[ property ].build( builder, 'property' );
|
|
77
|
-
|
|
78
|
-
code = code.replace( propertyRegExp, nodeProperty );
|
|
79
|
-
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
}
|
|
69
|
+
const code = this.getNodeFunction( builder ).getCode( propertyName );
|
|
83
70
|
|
|
84
71
|
nodeCode.code = code + '\n';
|
|
85
72
|
|
|
@@ -126,5 +113,3 @@ const nativeFn = ( code, includes = [], language = '' ) => {
|
|
|
126
113
|
|
|
127
114
|
export const glslFn = ( code, includes ) => nativeFn( code, includes, 'glsl' );
|
|
128
115
|
export const wgslFn = ( code, includes ) => nativeFn( code, includes, 'wgsl' );
|
|
129
|
-
|
|
130
|
-
addNodeClass( 'FunctionNode', FunctionNode );
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import Node
|
|
1
|
+
import Node from '../core/Node.js';
|
|
2
2
|
import { scriptableValue } from './ScriptableValueNode.js';
|
|
3
|
-
import {
|
|
3
|
+
import { nodeProxy, float } from '../tsl/TSLBase.js';
|
|
4
|
+
import { hashArray, hashString } from '../core/NodeUtils.js';
|
|
4
5
|
|
|
5
6
|
class Resources extends Map {
|
|
6
7
|
|
|
@@ -61,6 +62,12 @@ export const global = new Resources();
|
|
|
61
62
|
|
|
62
63
|
class ScriptableNode extends Node {
|
|
63
64
|
|
|
65
|
+
static get type() {
|
|
66
|
+
|
|
67
|
+
return 'ScriptableNode';
|
|
68
|
+
|
|
69
|
+
}
|
|
70
|
+
|
|
64
71
|
constructor( codeNode = null, parameters = {} ) {
|
|
65
72
|
|
|
66
73
|
super();
|
|
@@ -439,15 +446,15 @@ class ScriptableNode extends Node {
|
|
|
439
446
|
|
|
440
447
|
getCacheKey( force ) {
|
|
441
448
|
|
|
442
|
-
const
|
|
449
|
+
const values = [ hashString( this.source ), this.getDefaultOutputNode().getCacheKey( force ) ];
|
|
443
450
|
|
|
444
451
|
for ( const param in this.parameters ) {
|
|
445
452
|
|
|
446
|
-
|
|
453
|
+
values.push( this.parameters[ param ].getCacheKey( force ) );
|
|
447
454
|
|
|
448
455
|
}
|
|
449
456
|
|
|
450
|
-
return
|
|
457
|
+
return hashArray( values );
|
|
451
458
|
|
|
452
459
|
}
|
|
453
460
|
|
|
@@ -495,8 +502,4 @@ class ScriptableNode extends Node {
|
|
|
495
502
|
|
|
496
503
|
export default ScriptableNode;
|
|
497
504
|
|
|
498
|
-
export const scriptable = nodeProxy( ScriptableNode );
|
|
499
|
-
|
|
500
|
-
addNodeElement( 'scriptable', scriptable );
|
|
501
|
-
|
|
502
|
-
addNodeClass( 'ScriptableNode', ScriptableNode );
|
|
505
|
+
export const scriptable = /*@__PURE__*/ nodeProxy( ScriptableNode );
|
|
@@ -1,11 +1,17 @@
|
|
|
1
|
-
import Node
|
|
1
|
+
import Node from '../core/Node.js';
|
|
2
2
|
import { arrayBufferToBase64, base64ToArrayBuffer } from '../core/NodeUtils.js';
|
|
3
|
-
import {
|
|
3
|
+
import { nodeProxy, float } from '../tsl/TSLBase.js';
|
|
4
4
|
|
|
5
5
|
import { EventDispatcher } from '../../core/EventDispatcher.js';
|
|
6
6
|
|
|
7
7
|
class ScriptableValueNode extends Node {
|
|
8
8
|
|
|
9
|
+
static get type() {
|
|
10
|
+
|
|
11
|
+
return 'ScriptableValueNode';
|
|
12
|
+
|
|
13
|
+
}
|
|
14
|
+
|
|
9
15
|
constructor( value = null ) {
|
|
10
16
|
|
|
11
17
|
super();
|
|
@@ -161,8 +167,4 @@ class ScriptableValueNode extends Node {
|
|
|
161
167
|
|
|
162
168
|
export default ScriptableValueNode;
|
|
163
169
|
|
|
164
|
-
export const scriptableValue = nodeProxy( ScriptableValueNode );
|
|
165
|
-
|
|
166
|
-
addNodeElement( 'scriptableValue', scriptableValue );
|
|
167
|
-
|
|
168
|
-
addNodeClass( 'ScriptableValueNode', ScriptableValueNode );
|
|
170
|
+
export const scriptableValue = /*@__PURE__*/ nodeProxy( ScriptableValueNode );
|