super-three 0.167.0 → 0.168.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 +165 -44
- package/build/three.module.js +165 -45
- package/build/three.module.min.js +1 -1
- package/build/three.webgpu.js +23600 -21931
- package/build/three.webgpu.min.js +1 -1
- package/examples/jsm/Addons.js +3 -1
- 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 +453 -452
- 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/GLTFExporter.js +6 -1
- package/examples/jsm/exporters/USDZExporter.js +29 -8
- package/examples/jsm/helpers/LightProbeHelper.js +42 -43
- package/examples/jsm/loaders/KTX2Loader.js +19 -7
- package/examples/jsm/loaders/MaterialXLoader.js +11 -4
- package/examples/jsm/loaders/PCDLoader.js +9 -9
- package/examples/jsm/objects/SkyMesh.js +188 -0
- package/examples/jsm/objects/Water2Mesh.js +159 -0
- package/examples/jsm/objects/WaterMesh.js +102 -0
- package/examples/jsm/physics/RapierPhysics.js +20 -0
- 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/TSLEncoder.js +8 -8
- package/examples/jsm/utils/TextureUtils.js +1 -1
- package/package.json +2 -1
- package/src/Three.WebGPU.js +6 -0
- package/src/Three.js +1 -0
- package/src/constants.js +1 -1
- package/src/extras/Controls.js +32 -0
- package/src/loaders/ObjectLoader.js +3 -3
- package/src/{nodes/loaders → loaders/nodes}/NodeLoader.js +4 -4
- package/src/{nodes/loaders → loaders/nodes}/NodeMaterialLoader.js +1 -2
- package/src/materials/Material.js +4 -7
- package/src/{nodes/materials → materials/nodes}/InstancedPointsNodeMaterial.js +33 -24
- package/src/{nodes/materials → materials/nodes}/Line2NodeMaterial.js +34 -37
- package/src/{nodes/materials → materials/nodes}/LineBasicNodeMaterial.js +3 -4
- package/src/{nodes/materials → materials/nodes}/LineDashedNodeMaterial.js +7 -9
- package/src/{nodes/materials → materials/nodes}/MeshBasicNodeMaterial.js +11 -11
- package/src/{nodes/materials → materials/nodes}/MeshLambertNodeMaterial.js +5 -5
- package/src/{nodes/materials → materials/nodes}/MeshMatcapNodeMaterial.js +8 -8
- package/src/materials/nodes/MeshNormalNodeMaterial.js +40 -0
- package/src/{nodes/materials → materials/nodes}/MeshPhongNodeMaterial.js +9 -8
- package/src/{nodes/materials → materials/nodes}/MeshPhysicalNodeMaterial.js +18 -17
- package/src/{nodes/materials → materials/nodes}/MeshSSSNodeMaterial.js +6 -6
- package/src/{nodes/materials → materials/nodes}/MeshStandardNodeMaterial.js +17 -11
- package/src/{nodes/materials → materials/nodes}/MeshToonNodeMaterial.js +4 -4
- package/src/{nodes/materials → materials/nodes}/NodeMaterial.js +67 -86
- package/src/{nodes/materials/Materials.js → materials/nodes/NodeMaterials.js} +1 -1
- package/src/{nodes/materials → materials/nodes}/PointsNodeMaterial.js +3 -4
- package/src/{nodes/materials → materials/nodes}/ShadowNodeMaterial.js +4 -4
- package/src/{nodes/materials → materials/nodes}/SpriteNodeMaterial.js +11 -11
- package/src/{nodes/materials → materials/nodes}/VolumeNodeMaterial.js +14 -16
- package/src/nodes/Nodes.js +103 -159
- package/src/nodes/TSL.js +176 -0
- package/src/nodes/accessors/AccessorsUtils.js +8 -8
- package/src/nodes/accessors/BatchNode.js +48 -20
- package/src/nodes/accessors/{BitangentNode.js → Bitangent.js} +9 -9
- package/src/nodes/accessors/BufferAttributeNode.js +5 -5
- package/src/nodes/accessors/BufferNode.js +4 -4
- package/src/nodes/accessors/{CameraNode.js → Camera.js} +10 -10
- package/src/nodes/accessors/ClippingNode.js +16 -14
- package/src/nodes/accessors/CubeTextureNode.js +5 -7
- package/src/nodes/accessors/InstanceNode.js +17 -13
- package/src/nodes/accessors/InstancedPointsMaterialNode.js +4 -4
- package/src/nodes/accessors/MaterialNode.js +52 -55
- package/src/nodes/accessors/MaterialProperties.js +3 -0
- package/src/nodes/accessors/MaterialReferenceNode.js +6 -4
- package/src/nodes/accessors/ModelNode.js +11 -11
- package/src/nodes/accessors/ModelViewProjectionNode.js +6 -7
- package/src/nodes/accessors/MorphNode.js +12 -12
- package/src/nodes/accessors/Normal.js +62 -0
- package/src/nodes/accessors/Object3DNode.js +10 -10
- package/src/nodes/accessors/PointUVNode.js +4 -4
- package/src/nodes/accessors/Position.js +10 -0
- package/src/nodes/accessors/ReferenceBaseNode.js +143 -0
- package/src/nodes/accessors/ReferenceNode.js +13 -7
- package/src/nodes/accessors/ReflectVector.js +10 -0
- package/src/nodes/accessors/RendererReferenceNode.js +6 -6
- package/src/nodes/accessors/SceneNode.js +5 -6
- package/src/nodes/accessors/SkinningNode.js +84 -21
- package/src/nodes/accessors/StorageBufferNode.js +4 -5
- package/src/nodes/accessors/StorageTextureNode.js +5 -5
- package/src/nodes/accessors/Tangent.js +22 -0
- package/src/nodes/accessors/Texture3DNode.js +11 -11
- package/src/nodes/accessors/{TextureBicubicNode.js → TextureBicubic.js} +3 -32
- package/src/nodes/accessors/TextureNode.js +16 -21
- package/src/nodes/accessors/TextureSizeNode.js +4 -6
- package/src/nodes/accessors/{UniformsNode.js → UniformArrayNode.js} +17 -8
- package/src/nodes/accessors/UserDataNode.js +4 -4
- package/src/nodes/accessors/VelocityNode.js +83 -0
- package/src/nodes/accessors/VertexColorNode.js +4 -4
- package/src/nodes/code/CodeNode.js +5 -5
- package/src/nodes/code/ExpressionNode.js +4 -4
- package/src/nodes/code/FunctionCallNode.js +5 -5
- package/src/nodes/code/FunctionNode.js +5 -23
- package/src/nodes/code/ScriptableNode.js +4 -6
- package/src/nodes/code/ScriptableValueNode.js +4 -6
- package/src/nodes/core/AssignNode.js +5 -5
- package/src/nodes/core/AttributeNode.js +7 -20
- package/src/nodes/core/BypassNode.js +5 -5
- package/src/nodes/core/CacheNode.js +5 -5
- package/src/nodes/core/ConstNode.js +2 -2
- package/src/nodes/core/ContextNode.js +17 -11
- package/src/nodes/core/IndexNode.js +12 -7
- package/src/nodes/core/InputNode.js +2 -2
- package/src/nodes/core/MRTNode.js +12 -6
- package/src/nodes/core/Node.js +39 -19
- package/src/nodes/core/NodeBuilder.js +46 -33
- package/src/nodes/core/NodeUtils.js +1 -0
- package/src/nodes/core/OutputStructNode.js +4 -4
- package/src/nodes/core/ParameterNode.js +4 -4
- package/src/nodes/core/PropertyNode.js +32 -32
- package/src/nodes/core/StackNode.js +26 -10
- package/src/nodes/core/StructTypeNode.js +2 -2
- package/src/nodes/core/TempNode.js +2 -2
- package/src/nodes/core/UniformGroupNode.js +8 -9
- package/src/nodes/core/UniformNode.js +4 -4
- package/src/nodes/core/VarNode.js +6 -6
- package/src/nodes/core/VaryingNode.js +5 -5
- package/src/nodes/display/AfterImageNode.js +9 -9
- package/src/nodes/display/AnaglyphPassNode.js +61 -0
- package/src/nodes/display/AnamorphicNode.js +11 -11
- package/src/nodes/display/BleachBypass.js +26 -0
- package/src/nodes/display/BlendMode.js +54 -0
- package/src/nodes/display/BloomNode.js +21 -19
- package/src/nodes/display/BumpMapNode.js +7 -12
- package/src/nodes/display/ColorAdjustment.js +46 -0
- package/src/nodes/display/ColorSpaceFunctions.js +38 -0
- package/src/nodes/display/ColorSpaceNode.js +40 -63
- package/src/nodes/display/DenoiseNode.js +20 -17
- package/src/nodes/display/DepthOfFieldNode.js +8 -6
- package/src/nodes/display/DotScreenNode.js +10 -22
- package/src/nodes/display/FXAANode.js +17 -15
- package/src/nodes/display/FilmNode.js +7 -6
- package/src/nodes/display/FrontFacingNode.js +5 -5
- package/src/nodes/display/GTAONode.js +19 -15
- package/src/nodes/display/GaussianBlurNode.js +11 -8
- package/src/nodes/display/Lut3DNode.js +6 -5
- package/src/nodes/display/MotionBlur.js +25 -0
- package/src/nodes/display/NormalMapNode.js +8 -10
- package/src/nodes/display/ParallaxBarrierPassNode.js +55 -0
- package/src/nodes/display/PassNode.js +84 -8
- package/src/nodes/display/PixelationPassNode.js +12 -7
- package/src/nodes/display/PosterizeNode.js +4 -6
- package/src/nodes/display/RGBShiftNode.js +8 -7
- package/src/nodes/display/RenderOutputNode.js +9 -9
- package/src/nodes/display/SSAAPassNode.js +284 -0
- package/src/nodes/display/Sepia.js +17 -0
- package/src/nodes/display/SobelOperatorNode.js +9 -7
- package/src/nodes/display/StereoCompositePassNode.js +107 -0
- package/src/nodes/display/StereoPassNode.js +80 -0
- package/src/nodes/display/ToneMappingFunctions.js +190 -0
- package/src/nodes/display/ToneMappingNode.js +12 -173
- package/src/nodes/display/TransitionNode.js +9 -8
- package/src/nodes/display/ViewportDepthNode.js +30 -29
- package/src/nodes/display/ViewportDepthTextureNode.js +6 -8
- package/src/nodes/display/ViewportNode.js +26 -25
- package/src/nodes/display/ViewportSharedTextureNode.js +6 -8
- package/src/nodes/display/ViewportTextureNode.js +7 -10
- package/src/nodes/fog/FogExp2Node.js +4 -6
- package/src/nodes/fog/FogNode.js +5 -7
- package/src/nodes/fog/FogRangeNode.js +4 -6
- 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 +32 -31
- 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/geometry/RangeNode.js +4 -4
- package/src/nodes/gpgpu/ComputeNode.js +5 -5
- package/src/nodes/lighting/AONode.js +2 -2
- package/src/nodes/lighting/AmbientLightNode.js +2 -7
- package/src/nodes/lighting/AnalyticLightNode.js +34 -13
- package/src/nodes/lighting/BasicEnvironmentNode.js +4 -3
- package/src/nodes/lighting/BasicLightMapNode.js +3 -3
- package/src/nodes/lighting/DirectionalLightNode.js +2 -7
- package/src/nodes/lighting/EnvironmentNode.js +20 -19
- package/src/nodes/lighting/HemisphereLightNode.js +3 -7
- package/src/nodes/lighting/IESSpotLightNode.js +3 -8
- package/src/nodes/lighting/IrradianceNode.js +2 -2
- package/src/nodes/lighting/LightNode.js +5 -5
- package/src/nodes/lighting/LightProbeNode.js +76 -0
- package/src/nodes/lighting/LightUtils.js +3 -3
- package/src/nodes/lighting/LightingContextNode.js +15 -17
- package/src/nodes/lighting/LightingNode.js +2 -2
- package/src/nodes/lighting/LightsNode.js +94 -76
- package/src/nodes/lighting/PointLightNode.js +3 -8
- package/src/nodes/lighting/RectAreaLightNode.js +2 -6
- package/src/nodes/lighting/SpotLightNode.js +3 -8
- 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} +18 -7
- package/src/nodes/math/Hash.js +13 -0
- package/src/nodes/math/MathNode.js +124 -124
- package/src/nodes/math/MathUtils.js +0 -7
- package/src/nodes/math/OperatorNode.js +94 -52
- package/src/nodes/math/TriNoise3D.js +19 -29
- package/src/nodes/pmrem/PMREMNode.js +58 -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 +2 -2
- package/src/nodes/utils/ConvertNode.js +2 -2
- package/src/nodes/utils/CubeMapNode.js +157 -0
- package/src/nodes/utils/Discard.js +8 -0
- package/src/nodes/utils/EquirectUVNode.js +5 -5
- package/src/nodes/utils/FlipNode.js +65 -0
- package/src/nodes/utils/FunctionOverloadingNode.js +5 -5
- package/src/nodes/utils/JoinNode.js +2 -2
- package/src/nodes/utils/LoopNode.js +12 -6
- package/src/nodes/utils/MatcapUVNode.js +6 -6
- package/src/nodes/utils/MaxMipLevelNode.js +4 -4
- package/src/nodes/utils/OscNode.js +7 -7
- package/src/nodes/utils/Packing.js +4 -0
- package/src/nodes/utils/RTTNode.js +8 -8
- package/src/nodes/utils/ReflectorNode.js +8 -3
- package/src/nodes/utils/RemapNode.js +7 -7
- package/src/nodes/utils/RotateNode.js +4 -12
- package/src/nodes/utils/SetNode.js +2 -2
- package/src/nodes/utils/SplitNode.js +2 -2
- package/src/nodes/utils/SpriteSheetUVNode.js +5 -5
- package/src/nodes/utils/SpriteUtils.js +47 -0
- package/src/nodes/utils/StorageArrayElementNode.js +4 -6
- package/src/nodes/utils/TimerNode.js +5 -5
- package/src/nodes/utils/TriplanarTexturesNode.js +7 -9
- package/src/nodes/utils/UVUtils.js +19 -0
- package/src/nodes/utils/ViewportUtils.js +14 -0
- package/src/objects/BatchedMesh.js +2 -3
- package/src/renderers/WebGLRenderer.js +24 -0
- 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/ClippingContext.js +14 -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 +24 -0
- package/src/renderers/common/RenderList.js +1 -1
- package/src/renderers/common/RenderObject.js +2 -2
- package/src/renderers/common/Renderer.js +75 -49
- package/src/renderers/common/SampledTexture.js +12 -3
- package/src/renderers/common/StandardRenderer.js +18 -0
- package/src/renderers/common/Textures.js +8 -12
- package/src/renderers/common/extras/PMREMGenerator.js +12 -13
- package/src/renderers/common/nodes/NodeBuilderState.js +1 -1
- 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 +36 -9
- package/src/renderers/common/nodes/StandardNodeLibrary.js +105 -0
- package/src/renderers/shaders/ShaderChunk/tonemapping_pars_fragment.glsl.js +2 -2
- package/src/renderers/webgl/WebGLProgram.js +1 -1
- package/src/renderers/webgl/WebGLProperties.js +7 -0
- package/src/renderers/webgl/WebGLTextures.js +61 -4
- package/src/renderers/webgl-fallback/WebGLBackend.js +88 -68
- package/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js +57 -9
- package/src/renderers/webgl-fallback/utils/WebGLState.js +21 -0
- package/src/renderers/webgl-fallback/utils/WebGLTextureUtils.js +28 -21
- package/src/renderers/webgpu/WebGPUBackend.js +86 -68
- package/src/renderers/webgpu/WebGPURenderer.js +8 -8
- package/src/renderers/webgpu/nodes/WGSLNodeBuilder.js +99 -63
- 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 +6 -15
- package/src/renderers/webgpu/utils/WebGPUTexturePassUtils.js +62 -5
- package/src/renderers/webgpu/utils/WebGPUTextureUtils.js +36 -21
- package/src/renderers/webgpu/utils/WebGPUUtils.js +18 -1
- package/src/renderers/webxr/WebXRManager.js +32 -25
- package/examples/jsm/loaders/LogLuvLoader.js +0 -606
- 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/materials/MeshNormalNodeMaterial.js +0 -40
- 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/loaders → loaders/nodes}/NodeObjectLoader.js +0 -0
- /package/src/nodes/accessors/{UVNode.js → UV.js} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { registerNode } from '../core/Node.js';
|
|
2
2
|
import TextureNode from './TextureNode.js';
|
|
3
|
-
import { nodeProxy } from '../
|
|
3
|
+
import { nodeProxy } from '../tsl/TSLBase.js';
|
|
4
4
|
import { GPUStorageTextureAccess } from '../../renderers/webgpu/utils/WebGPUConstants.js';
|
|
5
5
|
|
|
6
6
|
class StorageTextureNode extends TextureNode {
|
|
@@ -89,7 +89,9 @@ class StorageTextureNode extends TextureNode {
|
|
|
89
89
|
|
|
90
90
|
export default StorageTextureNode;
|
|
91
91
|
|
|
92
|
-
|
|
92
|
+
StorageTextureNode.type = /*@__PURE__*/ registerNode( 'StorageTexture', StorageTextureNode );
|
|
93
|
+
|
|
94
|
+
export const storageTexture = /*@__PURE__*/ nodeProxy( StorageTextureNode );
|
|
93
95
|
|
|
94
96
|
export const textureStore = ( value, uvNode, storeNode ) => {
|
|
95
97
|
|
|
@@ -100,5 +102,3 @@ export const textureStore = ( value, uvNode, storeNode ) => {
|
|
|
100
102
|
return node;
|
|
101
103
|
|
|
102
104
|
};
|
|
103
|
-
|
|
104
|
-
addNodeClass( 'StorageTextureNode', StorageTextureNode );
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { attribute } from '../core/AttributeNode.js';
|
|
2
|
+
import { cameraViewMatrix } from './Camera.js';
|
|
3
|
+
import { modelViewMatrix } from './ModelNode.js';
|
|
4
|
+
import { Fn, vec4 } from '../tsl/TSLBase.js';
|
|
5
|
+
|
|
6
|
+
export const tangentGeometry = /*@__PURE__*/ Fn( ( builder ) => {
|
|
7
|
+
|
|
8
|
+
if ( builder.geometry.hasAttribute( 'tangent' ) === false ) {
|
|
9
|
+
|
|
10
|
+
builder.geometry.computeTangents();
|
|
11
|
+
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
return attribute( 'tangent', 'vec4' );
|
|
15
|
+
|
|
16
|
+
} )();
|
|
17
|
+
|
|
18
|
+
export const tangentLocal = /*@__PURE__*/ tangentGeometry.xyz.toVar( 'tangentLocal' );
|
|
19
|
+
export const tangentView = /*@__PURE__*/ modelViewMatrix.mul( vec4( tangentLocal, 0 ) ).xyz.varying( 'v_tangentView' ).normalize().toVar( 'tangentView' );
|
|
20
|
+
export const tangentWorld = /*@__PURE__*/ tangentView.transformDirection( cameraViewMatrix ).varying( 'v_tangentWorld' ).normalize().toVar( 'tangentWorld' );
|
|
21
|
+
export const transformedTangentView = /*@__PURE__*/ tangentView.toVar( 'transformedTangentView' );
|
|
22
|
+
export const transformedTangentWorld = /*@__PURE__*/ transformedTangentView.transformDirection( cameraViewMatrix ).normalize().toVar( 'transformedTangentWorld' );
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { registerNode } from '../core/Node.js';
|
|
1
2
|
import TextureNode from './TextureNode.js';
|
|
2
|
-
import {
|
|
3
|
-
import { nodeProxy, vec3, tslFn, If } from '../shadernode/ShaderNode.js';
|
|
3
|
+
import { nodeProxy, vec3, Fn, If } from '../tsl/TSLBase.js';
|
|
4
4
|
|
|
5
|
-
const normal =
|
|
5
|
+
const normal = Fn( ( { texture, uv } ) => {
|
|
6
6
|
|
|
7
7
|
const epsilon = 0.0001;
|
|
8
8
|
|
|
@@ -12,27 +12,27 @@ const normal = tslFn( ( { texture, uv } ) => {
|
|
|
12
12
|
|
|
13
13
|
ret.assign( vec3( 1, 0, 0 ) );
|
|
14
14
|
|
|
15
|
-
} ).
|
|
15
|
+
} ).ElseIf( uv.y.lessThan( epsilon ), () => {
|
|
16
16
|
|
|
17
17
|
ret.assign( vec3( 0, 1, 0 ) );
|
|
18
18
|
|
|
19
|
-
} ).
|
|
19
|
+
} ).ElseIf( uv.z.lessThan( epsilon ), () => {
|
|
20
20
|
|
|
21
21
|
ret.assign( vec3( 0, 0, 1 ) );
|
|
22
22
|
|
|
23
|
-
} ).
|
|
23
|
+
} ).ElseIf( uv.x.greaterThan( 1 - epsilon ), () => {
|
|
24
24
|
|
|
25
25
|
ret.assign( vec3( - 1, 0, 0 ) );
|
|
26
26
|
|
|
27
|
-
} ).
|
|
27
|
+
} ).ElseIf( uv.y.greaterThan( 1 - epsilon ), () => {
|
|
28
28
|
|
|
29
29
|
ret.assign( vec3( 0, - 1, 0 ) );
|
|
30
30
|
|
|
31
|
-
} ).
|
|
31
|
+
} ).ElseIf( uv.z.greaterThan( 1 - epsilon ), () => {
|
|
32
32
|
|
|
33
33
|
ret.assign( vec3( 0, 0, - 1 ) );
|
|
34
34
|
|
|
35
|
-
} ).
|
|
35
|
+
} ).Else( () => {
|
|
36
36
|
|
|
37
37
|
const step = 0.01;
|
|
38
38
|
|
|
@@ -95,6 +95,6 @@ class Texture3DNode extends TextureNode {
|
|
|
95
95
|
|
|
96
96
|
export default Texture3DNode;
|
|
97
97
|
|
|
98
|
-
|
|
98
|
+
Texture3DNode.type = /*@__PURE__*/ registerNode( 'Texture3D', Texture3DNode );
|
|
99
99
|
|
|
100
|
-
|
|
100
|
+
export const texture3D = /*@__PURE__*/ nodeProxy( Texture3DNode );
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import TempNode from '../core/TempNode.js';
|
|
2
|
-
import { addNodeClass } from '../core/Node.js';
|
|
3
1
|
import { add, mul, div } from '../math/OperatorNode.js';
|
|
4
2
|
import { floor, ceil, fract, pow } from '../math/MathNode.js';
|
|
5
|
-
import {
|
|
3
|
+
import { Fn, float, vec2, vec4, int } from '../tsl/TSLBase.js';
|
|
6
4
|
|
|
7
5
|
// Mipped Bicubic Texture Filtering by N8
|
|
8
6
|
// https://www.shadertoy.com/view/Dl2SDW
|
|
@@ -53,7 +51,7 @@ const bicubic = ( textureNode, texelSize, lod ) => {
|
|
|
53
51
|
|
|
54
52
|
};
|
|
55
53
|
|
|
56
|
-
const
|
|
54
|
+
export const textureBicubic = /*@__PURE__*/ Fn( ( [ textureNode, lodNode = float( 3 ) ] ) => {
|
|
57
55
|
|
|
58
56
|
const fLodSize = vec2( textureNode.size( int( lodNode ) ) );
|
|
59
57
|
const cLodSize = vec2( textureNode.size( int( lodNode.add( 1.0 ) ) ) );
|
|
@@ -64,31 +62,4 @@ const textureBicubicMethod = ( textureNode, lodNode ) => {
|
|
|
64
62
|
|
|
65
63
|
return fract( lodNode ).mix( fSample, cSample );
|
|
66
64
|
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
class TextureBicubicNode extends TempNode {
|
|
70
|
-
|
|
71
|
-
constructor( textureNode, blurNode = float( 3 ) ) {
|
|
72
|
-
|
|
73
|
-
super( 'vec4' );
|
|
74
|
-
|
|
75
|
-
this.textureNode = textureNode;
|
|
76
|
-
this.blurNode = blurNode;
|
|
77
|
-
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
setup() {
|
|
81
|
-
|
|
82
|
-
return textureBicubicMethod( this.textureNode, this.blurNode );
|
|
83
|
-
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
export default TextureBicubicNode;
|
|
89
|
-
|
|
90
|
-
export const textureBicubic = nodeProxy( TextureBicubicNode );
|
|
91
|
-
|
|
92
|
-
addNodeElement( 'bicubic', textureBicubic );
|
|
93
|
-
|
|
94
|
-
addNodeClass( 'TextureBicubicNode', TextureBicubicNode );
|
|
65
|
+
} );
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
+
import { registerNode } from '../core/Node.js';
|
|
1
2
|
import UniformNode, { uniform } from '../core/UniformNode.js';
|
|
2
|
-
import { uv } from './
|
|
3
|
+
import { uv } from './UV.js';
|
|
3
4
|
import { textureSize } from './TextureSizeNode.js';
|
|
4
|
-
import {
|
|
5
|
+
import { toWorkingColorSpace } from '../display/ColorSpaceNode.js';
|
|
5
6
|
import { expression } from '../code/ExpressionNode.js';
|
|
6
|
-
import { addNodeClass } from '../core/Node.js';
|
|
7
7
|
import { maxMipLevel } from '../utils/MaxMipLevelNode.js';
|
|
8
|
-
import {
|
|
8
|
+
import { nodeProxy, vec3, nodeObject } from '../tsl/TSLBase.js';
|
|
9
9
|
import { NodeUpdateType } from '../core/constants.js';
|
|
10
10
|
|
|
11
11
|
import { IntType, UnsignedIntType } from '../../constants.js';
|
|
@@ -106,7 +106,6 @@ class TextureNode extends UniformNode {
|
|
|
106
106
|
|
|
107
107
|
return this._matrixUniform.mul( vec3( uvNode, 1 ) ).xy;
|
|
108
108
|
|
|
109
|
-
|
|
110
109
|
}
|
|
111
110
|
|
|
112
111
|
setUpdateMatrix( value ) {
|
|
@@ -275,9 +274,9 @@ class TextureNode extends UniformNode {
|
|
|
275
274
|
let snippet = propertyName;
|
|
276
275
|
const nodeType = this.getNodeType( builder );
|
|
277
276
|
|
|
278
|
-
if ( builder.
|
|
277
|
+
if ( builder.needsToWorkingColorSpace( texture ) ) {
|
|
279
278
|
|
|
280
|
-
snippet =
|
|
279
|
+
snippet = toWorkingColorSpace( expression( snippet, nodeType ), texture.colorSpace ).setup( builder ).build( builder, nodeType );
|
|
281
280
|
|
|
282
281
|
}
|
|
283
282
|
|
|
@@ -307,7 +306,7 @@ class TextureNode extends UniformNode {
|
|
|
307
306
|
|
|
308
307
|
const textureNode = this.clone();
|
|
309
308
|
textureNode.uvNode = nodeObject( uvNode );
|
|
310
|
-
textureNode.referenceNode = this;
|
|
309
|
+
textureNode.referenceNode = this.getSelf();
|
|
311
310
|
|
|
312
311
|
return nodeObject( textureNode );
|
|
313
312
|
|
|
@@ -317,7 +316,7 @@ class TextureNode extends UniformNode {
|
|
|
317
316
|
|
|
318
317
|
const textureNode = this.clone();
|
|
319
318
|
textureNode.biasNode = nodeObject( amountNode ).mul( maxMipLevel( textureNode ) );
|
|
320
|
-
textureNode.referenceNode = this;
|
|
319
|
+
textureNode.referenceNode = this.getSelf();
|
|
321
320
|
|
|
322
321
|
return nodeObject( textureNode );
|
|
323
322
|
|
|
@@ -327,7 +326,7 @@ class TextureNode extends UniformNode {
|
|
|
327
326
|
|
|
328
327
|
const textureNode = this.clone();
|
|
329
328
|
textureNode.levelNode = nodeObject( levelNode );
|
|
330
|
-
textureNode.referenceNode = this;
|
|
329
|
+
textureNode.referenceNode = this.getSelf();
|
|
331
330
|
|
|
332
331
|
return nodeObject( textureNode );
|
|
333
332
|
|
|
@@ -343,7 +342,7 @@ class TextureNode extends UniformNode {
|
|
|
343
342
|
|
|
344
343
|
const textureNode = this.clone();
|
|
345
344
|
textureNode.biasNode = nodeObject( biasNode );
|
|
346
|
-
textureNode.referenceNode = this;
|
|
345
|
+
textureNode.referenceNode = this.getSelf();
|
|
347
346
|
|
|
348
347
|
return nodeObject( textureNode );
|
|
349
348
|
|
|
@@ -353,7 +352,7 @@ class TextureNode extends UniformNode {
|
|
|
353
352
|
|
|
354
353
|
const textureNode = this.clone();
|
|
355
354
|
textureNode.compareNode = nodeObject( compareNode );
|
|
356
|
-
textureNode.referenceNode = this;
|
|
355
|
+
textureNode.referenceNode = this.getSelf();
|
|
357
356
|
|
|
358
357
|
return nodeObject( textureNode );
|
|
359
358
|
|
|
@@ -363,8 +362,7 @@ class TextureNode extends UniformNode {
|
|
|
363
362
|
|
|
364
363
|
const textureNode = this.clone();
|
|
365
364
|
textureNode.gradNode = [ nodeObject( gradNodeX ), nodeObject( gradNodeY ) ];
|
|
366
|
-
|
|
367
|
-
textureNode.referenceNode = this;
|
|
365
|
+
textureNode.referenceNode = this.getSelf();
|
|
368
366
|
|
|
369
367
|
return nodeObject( textureNode );
|
|
370
368
|
|
|
@@ -374,7 +372,7 @@ class TextureNode extends UniformNode {
|
|
|
374
372
|
|
|
375
373
|
const textureNode = this.clone();
|
|
376
374
|
textureNode.depthNode = nodeObject( depthNode );
|
|
377
|
-
textureNode.referenceNode = this;
|
|
375
|
+
textureNode.referenceNode = this.getSelf();
|
|
378
376
|
|
|
379
377
|
return nodeObject( textureNode );
|
|
380
378
|
|
|
@@ -432,14 +430,11 @@ class TextureNode extends UniformNode {
|
|
|
432
430
|
|
|
433
431
|
export default TextureNode;
|
|
434
432
|
|
|
435
|
-
|
|
433
|
+
TextureNode.type = /*@__PURE__*/ registerNode( 'Texture', TextureNode );
|
|
434
|
+
|
|
435
|
+
export const texture = /*@__PURE__*/ nodeProxy( TextureNode );
|
|
436
436
|
export const textureLoad = ( ...params ) => texture( ...params ).setSampler( false );
|
|
437
437
|
|
|
438
438
|
//export const textureLevel = ( value, uv, level ) => texture( value, uv ).level( level );
|
|
439
439
|
|
|
440
440
|
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,6 +1,6 @@
|
|
|
1
|
+
import { registerNode } from '../core/Node.js';
|
|
1
2
|
import Node from '../core/Node.js';
|
|
2
|
-
import {
|
|
3
|
-
import { addNodeElement, nodeProxy } from '../shadernode/ShaderNode.js';
|
|
3
|
+
import { nodeProxy } from '../tsl/TSLBase.js';
|
|
4
4
|
|
|
5
5
|
class TextureSizeNode extends Node {
|
|
6
6
|
|
|
@@ -28,8 +28,6 @@ class TextureSizeNode extends Node {
|
|
|
28
28
|
|
|
29
29
|
export default TextureSizeNode;
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
TextureSizeNode.type = /*@__PURE__*/ registerNode( 'TextureSize', TextureSizeNode );
|
|
32
32
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
addNodeClass( 'TextureSizeNode', TextureSizeNode );
|
|
33
|
+
export const textureSize = /*@__PURE__*/ nodeProxy( TextureSizeNode );
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { nodeObject } from '../
|
|
1
|
+
import { registerNode } from '../core/Node.js';
|
|
2
|
+
import { nodeObject } from '../tsl/TSLBase.js';
|
|
3
3
|
import { NodeUpdateType } from '../core/constants.js';
|
|
4
4
|
import { getValueType } from '../core/NodeUtils.js';
|
|
5
5
|
import ArrayElementNode from '../utils/ArrayElementNode.js';
|
|
6
6
|
import BufferNode from './BufferNode.js';
|
|
7
7
|
|
|
8
|
-
class
|
|
8
|
+
class UniformArrayElementNode extends ArrayElementNode {
|
|
9
9
|
|
|
10
10
|
constructor( arrayBuffer, indexNode ) {
|
|
11
11
|
|
|
@@ -32,7 +32,7 @@ class UniformsElementNode extends ArrayElementNode {
|
|
|
32
32
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
class
|
|
35
|
+
class UniformArrayNode extends BufferNode {
|
|
36
36
|
|
|
37
37
|
constructor( value, elementType = null ) {
|
|
38
38
|
|
|
@@ -133,14 +133,23 @@ class UniformsNode extends BufferNode {
|
|
|
133
133
|
|
|
134
134
|
element( indexNode ) {
|
|
135
135
|
|
|
136
|
-
return nodeObject( new
|
|
136
|
+
return nodeObject( new UniformArrayElementNode( this, nodeObject( indexNode ) ) );
|
|
137
137
|
|
|
138
138
|
}
|
|
139
139
|
|
|
140
140
|
}
|
|
141
141
|
|
|
142
|
-
export default
|
|
142
|
+
export default UniformArrayNode;
|
|
143
143
|
|
|
144
|
-
|
|
144
|
+
UniformArrayNode.type = /*@__PURE__*/ registerNode( 'UniformArray', UniformArrayNode );
|
|
145
145
|
|
|
146
|
-
|
|
146
|
+
export const uniformArray = ( values, nodeType ) => nodeObject( new UniformArrayNode( values, nodeType ) );
|
|
147
|
+
|
|
148
|
+
//
|
|
149
|
+
|
|
150
|
+
export const uniforms = ( values, nodeType ) => { // @deprecated, r168
|
|
151
|
+
|
|
152
|
+
console.warn( 'TSL.UniformArrayNode: uniforms() has been renamed to uniformArray().' );
|
|
153
|
+
return nodeObject( new UniformArrayNode( values, nodeType ) );
|
|
154
|
+
|
|
155
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { registerNode } from '../core/Node.js';
|
|
1
2
|
import ReferenceNode from './ReferenceNode.js';
|
|
2
|
-
import {
|
|
3
|
-
import { nodeObject } from '../shadernode/ShaderNode.js';
|
|
3
|
+
import { nodeObject } from '../tsl/TSLBase.js';
|
|
4
4
|
|
|
5
5
|
class UserDataNode extends ReferenceNode {
|
|
6
6
|
|
|
@@ -24,6 +24,6 @@ class UserDataNode extends ReferenceNode {
|
|
|
24
24
|
|
|
25
25
|
export default UserDataNode;
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
UserDataNode.type = /*@__PURE__*/ registerNode( 'UserData', UserDataNode );
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
export const userData = ( name, inputType, userData ) => nodeObject( new UserDataNode( name, inputType, userData ) );
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { registerNode } from '../core/Node.js';
|
|
2
|
+
import TempNode from '../core/TempNode.js';
|
|
3
|
+
import { modelViewMatrix } from './ModelNode.js';
|
|
4
|
+
import { positionLocal, positionPrevious } from './Position.js';
|
|
5
|
+
import { nodeImmutable } from '../tsl/TSLBase.js';
|
|
6
|
+
import { NodeUpdateType } from '../core/constants.js';
|
|
7
|
+
import { Matrix4 } from '../../math/Matrix4.js';
|
|
8
|
+
import { uniform } from '../core/UniformNode.js';
|
|
9
|
+
import { sub } from '../math/OperatorNode.js';
|
|
10
|
+
import { cameraProjectionMatrix } from './Camera.js';
|
|
11
|
+
|
|
12
|
+
const _matrixCache = new WeakMap();
|
|
13
|
+
|
|
14
|
+
class VelocityNode extends TempNode {
|
|
15
|
+
|
|
16
|
+
constructor() {
|
|
17
|
+
|
|
18
|
+
super( 'vec2' );
|
|
19
|
+
|
|
20
|
+
this.updateType = NodeUpdateType.OBJECT;
|
|
21
|
+
this.updateAfterType = NodeUpdateType.OBJECT;
|
|
22
|
+
|
|
23
|
+
this.previousProjectionMatrix = uniform( new Matrix4() );
|
|
24
|
+
this.previousModelViewMatrix = uniform( new Matrix4() );
|
|
25
|
+
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
update( { camera, object } ) {
|
|
29
|
+
|
|
30
|
+
const previousModelMatrix = getPreviousMatrix( object );
|
|
31
|
+
const previousCameraMatrix = getPreviousMatrix( camera );
|
|
32
|
+
|
|
33
|
+
this.previousModelViewMatrix.value.copy( previousModelMatrix );
|
|
34
|
+
this.previousProjectionMatrix.value.copy( previousCameraMatrix );
|
|
35
|
+
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
updateAfter( { camera, object } ) {
|
|
39
|
+
|
|
40
|
+
const previousModelMatrix = getPreviousMatrix( object );
|
|
41
|
+
const previousCameraMatrix = getPreviousMatrix( camera );
|
|
42
|
+
|
|
43
|
+
previousModelMatrix.copy( object.modelViewMatrix );
|
|
44
|
+
previousCameraMatrix.copy( camera.projectionMatrix );
|
|
45
|
+
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
setup( /*builder*/ ) {
|
|
49
|
+
|
|
50
|
+
const clipPositionCurrent = cameraProjectionMatrix.mul( modelViewMatrix ).mul( positionLocal );
|
|
51
|
+
const clipPositionPrevious = this.previousProjectionMatrix.mul( this.previousModelViewMatrix ).mul( positionPrevious );
|
|
52
|
+
|
|
53
|
+
const ndcPositionCurrent = clipPositionCurrent.xy.div( clipPositionCurrent.w );
|
|
54
|
+
const ndcPositionPrevious = clipPositionPrevious.xy.div( clipPositionPrevious.w );
|
|
55
|
+
|
|
56
|
+
const velocity = sub( ndcPositionCurrent, ndcPositionPrevious );
|
|
57
|
+
|
|
58
|
+
return velocity;
|
|
59
|
+
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function getPreviousMatrix( object ) {
|
|
65
|
+
|
|
66
|
+
let previousMatrix = _matrixCache.get( object );
|
|
67
|
+
|
|
68
|
+
if ( previousMatrix === undefined ) {
|
|
69
|
+
|
|
70
|
+
previousMatrix = new Matrix4();
|
|
71
|
+
_matrixCache.set( object, previousMatrix );
|
|
72
|
+
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return previousMatrix;
|
|
76
|
+
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export default VelocityNode;
|
|
80
|
+
|
|
81
|
+
VelocityNode.type = /*@__PURE__*/ registerNode( 'Velocity', VelocityNode );
|
|
82
|
+
|
|
83
|
+
export const velocity = /*@__PURE__*/ nodeImmutable( VelocityNode );
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { registerNode } from '../core/Node.js';
|
|
2
2
|
import AttributeNode from '../core/AttributeNode.js';
|
|
3
|
-
import { nodeObject } from '../
|
|
3
|
+
import { nodeObject } from '../tsl/TSLBase.js';
|
|
4
4
|
|
|
5
5
|
import { Vector4 } from '../../math/Vector4.js';
|
|
6
6
|
|
|
@@ -66,6 +66,6 @@ class VertexColorNode extends AttributeNode {
|
|
|
66
66
|
|
|
67
67
|
export default VertexColorNode;
|
|
68
68
|
|
|
69
|
-
|
|
69
|
+
VertexColorNode.type = /*@__PURE__*/ registerNode( 'VertexColor', VertexColorNode );
|
|
70
70
|
|
|
71
|
-
|
|
71
|
+
export const vertexColor = ( ...params ) => nodeObject( new VertexColorNode( ...params ) );
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import Node, {
|
|
2
|
-
import { nodeProxy } from '../
|
|
1
|
+
import Node, { registerNode } from '../core/Node.js';
|
|
2
|
+
import { nodeProxy } from '../tsl/TSLBase.js';
|
|
3
3
|
|
|
4
4
|
class CodeNode extends Node {
|
|
5
5
|
|
|
@@ -75,10 +75,10 @@ class CodeNode extends Node {
|
|
|
75
75
|
|
|
76
76
|
export default CodeNode;
|
|
77
77
|
|
|
78
|
-
|
|
78
|
+
CodeNode.type = /*@__PURE__*/ registerNode( 'Code', CodeNode );
|
|
79
|
+
|
|
80
|
+
export const code = /*@__PURE__*/ nodeProxy( CodeNode );
|
|
79
81
|
|
|
80
82
|
export const js = ( src, includes ) => code( src, includes, 'js' );
|
|
81
83
|
export const wgsl = ( src, includes ) => code( src, includes, 'wgsl' );
|
|
82
84
|
export const glsl = ( src, includes ) => code( src, includes, 'glsl' );
|
|
83
|
-
|
|
84
|
-
addNodeClass( 'CodeNode', CodeNode );
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import Node, {
|
|
2
|
-
import { nodeProxy } from '../
|
|
1
|
+
import Node, { registerNode } from '../core/Node.js';
|
|
2
|
+
import { nodeProxy } from '../tsl/TSLCore.js';
|
|
3
3
|
|
|
4
4
|
class ExpressionNode extends Node {
|
|
5
5
|
|
|
@@ -32,6 +32,6 @@ class ExpressionNode extends Node {
|
|
|
32
32
|
|
|
33
33
|
export default ExpressionNode;
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
ExpressionNode.type = /*@__PURE__*/ registerNode( 'Expression', ExpressionNode );
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
export const expression = /*@__PURE__*/ nodeProxy( ExpressionNode );
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { registerNode } from '../core/Node.js';
|
|
1
2
|
import TempNode from '../core/TempNode.js';
|
|
2
|
-
import {
|
|
3
|
-
import { addNodeElement, nodeArray, nodeObject, nodeObjects } from '../shadernode/ShaderNode.js';
|
|
3
|
+
import { addMethodChaining, nodeArray, nodeObject, nodeObjects } from '../tsl/TSLCore.js';
|
|
4
4
|
|
|
5
5
|
class FunctionCallNode extends TempNode {
|
|
6
6
|
|
|
@@ -83,6 +83,8 @@ class FunctionCallNode extends TempNode {
|
|
|
83
83
|
|
|
84
84
|
export default FunctionCallNode;
|
|
85
85
|
|
|
86
|
+
FunctionCallNode.type = /*@__PURE__*/ registerNode( 'FunctionCall', FunctionCallNode );
|
|
87
|
+
|
|
86
88
|
export const call = ( func, ...params ) => {
|
|
87
89
|
|
|
88
90
|
params = params.length > 1 || ( params[ 0 ] && params[ 0 ].isNode === true ) ? nodeArray( params ) : nodeObjects( params[ 0 ] );
|
|
@@ -91,6 +93,4 @@ export const call = ( func, ...params ) => {
|
|
|
91
93
|
|
|
92
94
|
};
|
|
93
95
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
addNodeClass( 'FunctionCallNode', FunctionCallNode );
|
|
96
|
+
addMethodChaining( 'call', call );
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { registerNode } from '../core/Node.js';
|
|
1
2
|
import CodeNode from './CodeNode.js';
|
|
2
|
-
import {
|
|
3
|
-
import { nodeObject } from '../shadernode/ShaderNode.js';
|
|
3
|
+
import { nodeObject } from '../tsl/TSLBase.js';
|
|
4
4
|
|
|
5
5
|
class FunctionNode extends CodeNode {
|
|
6
6
|
|
|
@@ -8,8 +8,6 @@ class FunctionNode extends CodeNode {
|
|
|
8
8
|
|
|
9
9
|
super( code, includes, language );
|
|
10
10
|
|
|
11
|
-
this.keywords = {};
|
|
12
|
-
|
|
13
11
|
}
|
|
14
12
|
|
|
15
13
|
getNodeType( builder ) {
|
|
@@ -63,23 +61,7 @@ class FunctionNode extends CodeNode {
|
|
|
63
61
|
|
|
64
62
|
const propertyName = builder.getPropertyName( nodeCode );
|
|
65
63
|
|
|
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
|
-
}
|
|
64
|
+
const code = this.getNodeFunction( builder ).getCode( propertyName );
|
|
83
65
|
|
|
84
66
|
nodeCode.code = code + '\n';
|
|
85
67
|
|
|
@@ -99,6 +81,8 @@ class FunctionNode extends CodeNode {
|
|
|
99
81
|
|
|
100
82
|
export default FunctionNode;
|
|
101
83
|
|
|
84
|
+
FunctionNode.type = /*@__PURE__*/ registerNode( 'Function', FunctionNode );
|
|
85
|
+
|
|
102
86
|
const nativeFn = ( code, includes = [], language = '' ) => {
|
|
103
87
|
|
|
104
88
|
for ( let i = 0; i < includes.length; i ++ ) {
|
|
@@ -126,5 +110,3 @@ const nativeFn = ( code, includes = [], language = '' ) => {
|
|
|
126
110
|
|
|
127
111
|
export const glslFn = ( code, includes ) => nativeFn( code, includes, 'glsl' );
|
|
128
112
|
export const wgslFn = ( code, includes ) => nativeFn( code, includes, 'wgsl' );
|
|
129
|
-
|
|
130
|
-
addNodeClass( 'FunctionNode', FunctionNode );
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import Node, {
|
|
1
|
+
import Node, { registerNode } from '../core/Node.js';
|
|
2
2
|
import { scriptableValue } from './ScriptableValueNode.js';
|
|
3
|
-
import {
|
|
3
|
+
import { nodeProxy, float } from '../tsl/TSLBase.js';
|
|
4
4
|
|
|
5
5
|
class Resources extends Map {
|
|
6
6
|
|
|
@@ -495,8 +495,6 @@ class ScriptableNode extends Node {
|
|
|
495
495
|
|
|
496
496
|
export default ScriptableNode;
|
|
497
497
|
|
|
498
|
-
|
|
498
|
+
ScriptableNode.type = /*@__PURE__*/ registerNode( 'Scriptable', ScriptableNode );
|
|
499
499
|
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
addNodeClass( 'ScriptableNode', ScriptableNode );
|
|
500
|
+
export const scriptable = /*@__PURE__*/ nodeProxy( ScriptableNode );
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import Node, {
|
|
1
|
+
import Node, { registerNode } 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
|
|
|
@@ -161,8 +161,6 @@ class ScriptableValueNode extends Node {
|
|
|
161
161
|
|
|
162
162
|
export default ScriptableValueNode;
|
|
163
163
|
|
|
164
|
-
|
|
164
|
+
ScriptableValueNode.type = /*@__PURE__*/ registerNode( 'ScriptableValue', ScriptableValueNode );
|
|
165
165
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
addNodeClass( 'ScriptableValueNode', ScriptableValueNode );
|
|
166
|
+
export const scriptableValue = /*@__PURE__*/ nodeProxy( ScriptableValueNode );
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { registerNode } from '../core/Node.js';
|
|
2
2
|
import TempNode from '../core/TempNode.js';
|
|
3
|
-
import {
|
|
3
|
+
import { addMethodChaining, nodeProxy } from '../tsl/TSLCore.js';
|
|
4
4
|
import { vectorComponents } from '../core/constants.js';
|
|
5
5
|
|
|
6
6
|
class AssignNode extends TempNode {
|
|
@@ -121,8 +121,8 @@ class AssignNode extends TempNode {
|
|
|
121
121
|
|
|
122
122
|
export default AssignNode;
|
|
123
123
|
|
|
124
|
-
|
|
124
|
+
AssignNode.type = /*@__PURE__*/ registerNode( 'Assign', AssignNode );
|
|
125
125
|
|
|
126
|
-
|
|
126
|
+
export const assign = /*@__PURE__*/ nodeProxy( AssignNode );
|
|
127
127
|
|
|
128
|
-
|
|
128
|
+
addMethodChaining( 'assign', assign );
|