super-three 0.133.5 → 0.135.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.js +617 -536
- package/build/three.min.js +1 -1
- package/build/three.module.js +760 -613
- package/examples/fonts/open-sans/open-sans-v15-cyrillic-ext_greek_greek-ext_cyrillic_latin_latin-ext_vietnamese-regular.woff +0 -0
- package/examples/fonts/open-sans/open-sans-v15-cyrillic-ext_greek_greek-ext_cyrillic_latin_latin-ext_vietnamese-regular.woff2 +0 -0
- package/examples/fonts/open-sans/open-sans.css +9 -0
- package/examples/fonts/tabler-icons/fonts/tabler-icons.eot +0 -0
- package/examples/fonts/tabler-icons/fonts/tabler-icons.ttf +0 -0
- package/examples/fonts/tabler-icons/fonts/tabler-icons.woff +0 -0
- package/examples/fonts/tabler-icons/fonts/tabler-icons.woff2 +0 -0
- package/examples/fonts/tabler-icons/tabler-icons.min.css +4 -0
- package/examples/js/controls/ArcballControls.js +68 -27
- package/examples/js/controls/DragControls.js +7 -0
- package/examples/js/controls/OrbitControls.js +5 -36
- package/examples/js/controls/TrackballControls.js +3 -2
- package/examples/js/csm/CSM.js +2 -2
- package/examples/js/csm/CSMFrustum.js +133 -0
- package/examples/js/exporters/GLTFExporter.js +147 -63
- package/examples/js/exporters/USDZExporter.js +45 -26
- package/examples/js/lines/LineMaterial.js +58 -20
- package/examples/js/lines/LineSegments2.js +29 -24
- package/examples/js/loaders/3DMLoader.js +24 -11
- package/examples/js/loaders/3MFLoader.js +2 -2
- package/examples/js/loaders/ColladaLoader.js +61 -3
- package/examples/js/loaders/FBXLoader.js +1 -1
- package/examples/js/loaders/GLTFLoader.js +94 -31
- package/examples/js/loaders/KTX2Loader.js +12 -0
- package/examples/js/loaders/LWOLoader.js +8 -6
- package/examples/js/loaders/LogLuvLoader.js +766 -0
- package/examples/js/loaders/PLYLoader.js +32 -7
- package/examples/js/loaders/RGBELoader.js +2 -1
- package/examples/js/loaders/SVGLoader.js +7 -3
- package/examples/js/loaders/TDSLoader.js +237 -271
- package/examples/js/loaders/lwo/LWO2Parser.js +1 -0
- package/examples/js/loaders/lwo/LWO3Parser.js +4 -2
- package/examples/js/objects/MarchingCubes.js +42 -128
- package/examples/js/renderers/CSS2DRenderer.js +4 -4
- package/examples/js/renderers/CSS3DRenderer.js +4 -4
- package/examples/js/utils/RoughnessMipmapper.js +1 -0
- package/examples/jsm/controls/ArcballControls.js +61 -29
- package/examples/jsm/controls/DragControls.js +7 -0
- package/examples/jsm/controls/OrbitControls.js +9 -51
- package/examples/jsm/controls/TrackballControls.js +1 -1
- package/examples/jsm/csm/CSM.js +3 -3
- package/examples/jsm/csm/{Frustum.js → CSMFrustum.js} +3 -3
- package/examples/jsm/exporters/GLTFExporter.js +160 -74
- package/examples/jsm/exporters/USDZExporter.js +47 -26
- package/examples/jsm/libs/flow.module.js +3218 -0
- package/examples/jsm/libs/lil-gui.module.min.js +8 -0
- package/examples/jsm/libs/rhino3dm/rhino3dm.wasm +0 -0
- package/examples/jsm/lines/LineMaterial.js +59 -23
- package/examples/jsm/lines/LineSegments2.js +22 -18
- package/examples/jsm/loaders/3DMLoader.js +18 -12
- package/examples/jsm/loaders/3MFLoader.js +2 -2
- package/examples/jsm/loaders/ColladaLoader.js +61 -3
- package/examples/jsm/loaders/FBXLoader.js +1 -1
- package/examples/jsm/loaders/GLTFLoader.js +99 -35
- package/examples/jsm/loaders/KTX2Loader.js +19 -0
- package/examples/jsm/loaders/LWOLoader.js +8 -6
- package/examples/jsm/loaders/LogLuvLoader.js +606 -0
- package/examples/jsm/loaders/PLYLoader.js +33 -7
- package/examples/jsm/loaders/SVGLoader.js +7 -4
- package/examples/jsm/loaders/TDSLoader.js +225 -285
- package/examples/jsm/loaders/lwo/LWO2Parser.js +1 -0
- package/examples/jsm/loaders/lwo/LWO3Parser.js +2 -2
- package/examples/jsm/node-editor/NodeEditor.js +455 -0
- package/examples/jsm/node-editor/accessors/NormalEditor.js +30 -0
- package/examples/jsm/node-editor/accessors/PositionEditor.js +30 -0
- package/examples/jsm/node-editor/accessors/UVEditor.js +26 -0
- package/examples/jsm/node-editor/display/BlendEditor.js +43 -0
- package/examples/jsm/node-editor/examples/animate-uv.json +1 -0
- package/examples/jsm/node-editor/examples/fake-top-light.json +1 -0
- package/examples/jsm/node-editor/examples/oscillator-color.json +1 -0
- package/examples/jsm/node-editor/examples/rim.json +1 -0
- package/examples/jsm/node-editor/inputs/ColorEditor.js +91 -0
- package/examples/jsm/node-editor/inputs/FloatEditor.js +24 -0
- package/examples/jsm/node-editor/inputs/SliderEditor.js +68 -0
- package/examples/jsm/node-editor/inputs/Vector2Editor.js +28 -0
- package/examples/jsm/node-editor/inputs/Vector3Editor.js +30 -0
- package/examples/jsm/node-editor/inputs/Vector4Editor.js +37 -0
- package/examples/jsm/node-editor/materials/StandardMaterialEditor.js +69 -0
- package/examples/jsm/node-editor/math/DotEditor.js +36 -0
- package/examples/jsm/node-editor/math/InvertEditor.js +38 -0
- package/examples/jsm/node-editor/math/LimiterEditor.js +48 -0
- package/examples/jsm/node-editor/math/NormalizeEditor.js +26 -0
- package/examples/jsm/node-editor/math/OperatorEditor.js +50 -0
- package/examples/jsm/node-editor/math/PowerEditor.js +34 -0
- package/examples/jsm/node-editor/math/TrigonometryEditor.js +39 -0
- package/examples/jsm/node-editor/procedural/CheckerEditor.js +26 -0
- package/examples/jsm/node-editor/utils/OscillatorEditor.js +42 -0
- package/examples/jsm/node-editor/utils/TimerEditor.js +57 -0
- package/examples/jsm/nodes/materials/StandardNodeMaterial.js +1 -1
- package/examples/jsm/nodes/materials/nodes/StandardNode.js +6 -6
- package/examples/jsm/nodes/utils/ColorSpaceNode.js +1 -49
- package/examples/jsm/objects/MarchingCubes.js +46 -152
- package/examples/jsm/postprocessing/AdaptiveToneMappingPass.js +1 -1
- package/examples/jsm/postprocessing/AfterimagePass.js +1 -1
- package/examples/jsm/postprocessing/BloomPass.js +1 -1
- package/examples/jsm/postprocessing/BokehPass.js +1 -1
- package/examples/jsm/postprocessing/ClearPass.js +1 -1
- package/examples/jsm/postprocessing/CubeTexturePass.js +1 -1
- package/examples/jsm/postprocessing/DotScreenPass.js +1 -1
- package/examples/jsm/postprocessing/EffectComposer.js +3 -3
- package/examples/jsm/postprocessing/FilmPass.js +1 -1
- package/examples/jsm/postprocessing/GlitchPass.js +1 -1
- package/examples/jsm/postprocessing/HalftonePass.js +1 -1
- package/examples/jsm/postprocessing/MaskPass.js +1 -1
- package/examples/jsm/postprocessing/OutlinePass.js +1 -1
- package/examples/jsm/postprocessing/RenderPass.js +1 -1
- package/examples/jsm/postprocessing/SAOPass.js +1 -1
- package/examples/jsm/postprocessing/SMAAPass.js +1 -1
- package/examples/jsm/postprocessing/SSAARenderPass.js +1 -1
- package/examples/jsm/postprocessing/SSAOPass.js +1 -1
- package/examples/jsm/postprocessing/SSRPass.js +1 -1
- package/examples/jsm/postprocessing/SSRrPass.js +1 -1
- package/examples/jsm/postprocessing/SavePass.js +1 -1
- package/examples/jsm/postprocessing/ShaderPass.js +1 -1
- package/examples/jsm/postprocessing/TAARenderPass.js +1 -1
- package/examples/jsm/postprocessing/TexturePass.js +1 -1
- package/examples/jsm/postprocessing/UnrealBloomPass.js +1 -1
- package/examples/jsm/renderers/CSS2DRenderer.js +5 -4
- package/examples/jsm/renderers/CSS3DRenderer.js +5 -4
- package/examples/jsm/renderers/nodes/Nodes.js +14 -13
- package/examples/jsm/renderers/nodes/ShaderNode.js +193 -41
- package/examples/jsm/renderers/nodes/accessors/MaterialNode.js +6 -6
- package/examples/jsm/renderers/nodes/accessors/ModelViewProjectionNode.js +5 -5
- package/examples/jsm/renderers/nodes/accessors/NormalNode.js +14 -3
- package/examples/jsm/renderers/nodes/accessors/PointUVNode.js +3 -3
- package/examples/jsm/renderers/nodes/accessors/PositionNode.js +15 -5
- package/examples/jsm/renderers/nodes/accessors/SkinningNode.js +107 -0
- package/examples/jsm/renderers/nodes/accessors/UVNode.js +7 -5
- package/examples/jsm/renderers/nodes/core/ArrayInputNode.js +3 -3
- package/examples/jsm/renderers/nodes/core/AttributeNode.js +6 -0
- package/examples/jsm/renderers/nodes/core/BypassNode.js +38 -0
- package/examples/jsm/renderers/nodes/core/CodeNode.js +3 -3
- package/examples/jsm/renderers/nodes/core/ContextNode.js +4 -19
- package/examples/jsm/renderers/nodes/core/ExpressionNode.js +13 -2
- package/examples/jsm/renderers/nodes/core/FunctionNode.js +19 -132
- package/examples/jsm/renderers/nodes/core/InputNode.js +13 -3
- package/examples/jsm/renderers/nodes/core/Node.js +32 -10
- package/examples/jsm/renderers/nodes/core/NodeBuilder.js +146 -128
- package/examples/jsm/renderers/nodes/core/NodeFunction.js +22 -0
- package/examples/jsm/renderers/nodes/core/NodeFunctionInput.js +4 -4
- package/examples/jsm/renderers/nodes/core/NodeKeywords.js +18 -179
- package/examples/jsm/renderers/nodes/core/NodeParser.js +11 -0
- package/examples/jsm/renderers/nodes/core/NodeVar.js +2 -2
- package/examples/jsm/renderers/nodes/core/PropertyNode.js +14 -2
- package/examples/jsm/renderers/nodes/core/TempNode.js +10 -13
- package/examples/jsm/renderers/nodes/core/VarNode.js +12 -7
- package/examples/jsm/renderers/nodes/core/VaryNode.js +23 -8
- package/examples/jsm/renderers/nodes/core/constants.js +2 -0
- package/examples/jsm/renderers/nodes/display/ColorSpaceNode.js +47 -25
- package/examples/jsm/renderers/nodes/display/NormalMapNode.js +21 -22
- package/examples/jsm/renderers/nodes/functions/BSDFs.js +64 -101
- package/examples/jsm/renderers/nodes/inputs/BufferNode.js +25 -0
- package/examples/jsm/renderers/nodes/inputs/IntNode.js +17 -0
- package/examples/jsm/renderers/nodes/inputs/TextureNode.js +10 -2
- package/examples/jsm/renderers/nodes/lights/LightContextNode.js +20 -14
- package/examples/jsm/renderers/nodes/lights/LightNode.js +32 -36
- package/examples/jsm/renderers/nodes/math/CondNode.js +60 -0
- package/examples/jsm/renderers/nodes/math/MathNode.js +87 -36
- package/examples/jsm/renderers/nodes/math/OperatorNode.js +124 -31
- package/examples/jsm/renderers/nodes/parsers/GLSLNodeFunction.js +137 -0
- package/examples/jsm/renderers/nodes/parsers/GLSLNodeParser.js +14 -0
- package/examples/jsm/renderers/nodes/parsers/WGSLNodeFunction.js +89 -0
- package/examples/jsm/renderers/nodes/parsers/WGSLNodeParser.js +14 -0
- package/examples/jsm/renderers/nodes/procedural/CheckerNode.js +7 -9
- package/examples/jsm/renderers/nodes/utils/ArrayElementNode.js +31 -0
- package/examples/jsm/renderers/nodes/utils/ConvertNode.js +33 -0
- package/examples/jsm/renderers/nodes/utils/JoinNode.js +7 -7
- package/examples/jsm/renderers/nodes/utils/OscNode.js +58 -0
- package/examples/jsm/renderers/nodes/utils/SplitNode.js +18 -8
- package/examples/jsm/renderers/nodes/utils/SpriteSheetUVNode.js +7 -7
- package/examples/jsm/renderers/webgl/nodes/SlotNode.js +22 -0
- package/examples/jsm/renderers/webgl/nodes/WebGLNodeBuilder.js +191 -94
- package/examples/jsm/renderers/webgl/nodes/WebGLNodes.js +2 -2
- package/examples/jsm/renderers/webgl/nodes/WebGLPhysicalContextNode.js +2 -2
- package/examples/jsm/renderers/webgpu/WebGPUBackground.js +1 -1
- package/examples/jsm/renderers/webgpu/WebGPUBindings.js +3 -3
- package/examples/jsm/renderers/webgpu/WebGPUComputePipelines.js +2 -4
- package/examples/jsm/renderers/webgpu/WebGPUProgrammableStage.js +2 -4
- package/examples/jsm/renderers/webgpu/WebGPURenderPipeline.js +15 -23
- package/examples/jsm/renderers/webgpu/WebGPURenderPipelines.js +3 -5
- package/examples/jsm/renderers/webgpu/WebGPURenderer.js +11 -27
- package/examples/jsm/renderers/webgpu/WebGPUTextureUtils.js +62 -28
- package/examples/jsm/renderers/webgpu/WebGPUTextures.js +34 -27
- package/examples/jsm/renderers/webgpu/constants.js +2 -2
- package/examples/jsm/renderers/webgpu/nodes/WebGPUNodeBuilder.js +430 -98
- package/examples/jsm/renderers/webgpu/nodes/WebGPUNodes.js +1 -1
- package/examples/jsm/utils/RoughnessMipmapper.js +1 -0
- package/examples/jsm/webxr/OculusHandPointerModel.js +6 -6
- package/package.json +10 -10
- package/src/Three.Legacy.js +6 -0
- package/src/Three.js +0 -1
- package/src/cameras/StereoCamera.js +8 -7
- package/src/constants.js +1 -2
- package/src/core/Layers.js +7 -1
- package/src/core/Object3D.js +2 -0
- package/src/extras/PMREMGenerator.js +11 -6
- package/src/loaders/FileLoader.js +89 -152
- package/src/loaders/ImageLoader.js +9 -4
- package/src/loaders/LoaderUtils.js +26 -0
- package/src/loaders/MaterialLoader.js +7 -4
- package/src/loaders/ObjectLoader.js +2 -0
- package/src/materials/Material.js +4 -4
- package/src/materials/MeshPhysicalMaterial.js +20 -14
- package/src/math/MathUtils.js +5 -16
- package/src/renderers/WebGLMultisampleRenderTarget.js +7 -1
- package/src/renderers/WebGLRenderer.js +83 -117
- package/src/renderers/shaders/ShaderChunk/bsdfs.glsl.js +2 -2
- package/src/renderers/shaders/ShaderChunk/encodings_pars_fragment.glsl.js +0 -27
- package/src/renderers/shaders/ShaderChunk/envmap_common_pars_fragment.glsl.js +0 -1
- package/src/renderers/shaders/ShaderChunk/lights_physical_fragment.glsl.js +19 -6
- package/src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl.js +2 -2
- package/src/renderers/shaders/ShaderChunk/transmission_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/transmission_pars_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderLib/meshphysical.glsl.js +13 -5
- package/src/renderers/shaders/ShaderLib/vsm.glsl.js +2 -1
- package/src/renderers/shaders/ShaderLib.js +6 -4
- package/src/renderers/shaders/UniformsLib.js +1 -2
- package/src/renderers/webgl/WebGLExtensions.js +1 -0
- package/src/renderers/webgl/WebGLMaterials.js +27 -15
- package/src/renderers/webgl/WebGLProgram.js +10 -6
- package/src/renderers/webgl/WebGLPrograms.js +17 -12
- package/src/renderers/webgl/WebGLShadowMap.js +14 -5
- package/src/renderers/webgl/WebGLState.js +31 -17
- package/src/renderers/webgl/WebGLTextures.js +188 -51
- package/src/renderers/webgl/WebGLUniforms.js +45 -1
- package/src/renderers/webxr/WebXRManager.js +68 -107
- package/src/textures/Texture.js +6 -0
- package/src/utils.js +37 -1
- package/examples/js/controls/DeviceOrientationControls.js +0 -147
- package/examples/js/libs/dat.gui.min.js +0 -14
- package/examples/jsm/controls/DeviceOrientationControls.js +0 -153
- package/examples/jsm/libs/dat.gui.module.js +0 -3575
- package/examples/jsm/libs/glslang.js +0 -78
- package/examples/jsm/libs/glslang.wasm +0 -0
- package/examples/jsm/renderers/nodes/consts/MathConsts.js +0 -7
- package/examples/jsm/renderers/nodes/core/ConstNode.js +0 -39
- package/examples/jsm/renderers/nodes/core/NodeSlot.js +0 -13
- package/examples/jsm/renderers/nodes/core/StructNode.js +0 -80
- package/examples/jsm/renderers/nodes/core/StructVarNode.js +0 -75
- package/examples/jsm/renderers/nodes/functions/EncodingFunctions.js +0 -99
- package/examples/jsm/renderers/nodes/functions/MathFunctions.js +0 -47
- package/examples/jsm/renderers/webgpu/nodes/ShaderLib.js +0 -152
- package/src/extras/objects/ImmediateRenderObject.js +0 -31
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import TempNode from '../core/
|
|
1
|
+
import TempNode from '../core/TempNode.js';
|
|
2
|
+
import ExpressionNode from '../core/ExpressionNode.js';
|
|
3
|
+
import JoinNode from '../utils/JoinNode.js';
|
|
4
|
+
import SplitNode from '../utils/SplitNode.js';
|
|
5
|
+
import OperatorNode from './OperatorNode.js';
|
|
2
6
|
|
|
3
7
|
class MathNode extends TempNode {
|
|
4
8
|
|
|
@@ -16,7 +20,6 @@ class MathNode extends TempNode {
|
|
|
16
20
|
static CEIL = 'ceil';
|
|
17
21
|
static NORMALIZE = 'normalize';
|
|
18
22
|
static FRACT = 'fract';
|
|
19
|
-
static SATURATE = 'saturate';
|
|
20
23
|
static SIN = 'sin';
|
|
21
24
|
static COS = 'cos';
|
|
22
25
|
static TAN = 'tan';
|
|
@@ -28,6 +31,9 @@ class MathNode extends TempNode {
|
|
|
28
31
|
static LENGTH = 'length';
|
|
29
32
|
static NEGATE = 'negate';
|
|
30
33
|
static INVERT = 'invert';
|
|
34
|
+
static DFDX = 'dFdx';
|
|
35
|
+
static DFDY = 'dFdy';
|
|
36
|
+
static SATURATE = 'saturate'
|
|
31
37
|
|
|
32
38
|
// 2 inputs
|
|
33
39
|
|
|
@@ -40,6 +46,7 @@ class MathNode extends TempNode {
|
|
|
40
46
|
static DOT = 'dot';
|
|
41
47
|
static CROSS = 'cross';
|
|
42
48
|
static POW = 'pow';
|
|
49
|
+
static TRANSFORM_DIRECTION = 'transformDirection';
|
|
43
50
|
|
|
44
51
|
// 3 inputs
|
|
45
52
|
|
|
@@ -49,39 +56,43 @@ class MathNode extends TempNode {
|
|
|
49
56
|
static SMOOTHSTEP = 'smoothstep';
|
|
50
57
|
static FACEFORWARD = 'faceforward';
|
|
51
58
|
|
|
52
|
-
constructor( method,
|
|
59
|
+
constructor( method, aNode, bNode = null, cNode = null ) {
|
|
53
60
|
|
|
54
61
|
super();
|
|
55
62
|
|
|
56
63
|
this.method = method;
|
|
57
64
|
|
|
58
|
-
this.
|
|
59
|
-
this.
|
|
60
|
-
this.
|
|
65
|
+
this.aNode = aNode;
|
|
66
|
+
this.bNode = bNode;
|
|
67
|
+
this.cNode = cNode;
|
|
61
68
|
|
|
62
69
|
}
|
|
63
70
|
|
|
64
71
|
getInputType( builder ) {
|
|
65
72
|
|
|
66
|
-
const
|
|
67
|
-
const
|
|
68
|
-
const
|
|
73
|
+
const aType = this.aNode.getNodeType( builder );
|
|
74
|
+
const bType = this.bNode ? this.bNode.getNodeType( builder ) : null;
|
|
75
|
+
const cType = this.cNode ? this.cNode.getNodeType( builder ) : null;
|
|
76
|
+
|
|
77
|
+
const aLen = builder.getTypeLength( aType );
|
|
78
|
+
const bLen = builder.getTypeLength( bType );
|
|
79
|
+
const cLen = builder.getTypeLength( cType );
|
|
69
80
|
|
|
70
81
|
if ( aLen > bLen && aLen > cLen ) {
|
|
71
82
|
|
|
72
|
-
return
|
|
83
|
+
return aType;
|
|
73
84
|
|
|
74
85
|
} else if ( bLen > cLen ) {
|
|
75
86
|
|
|
76
|
-
return
|
|
87
|
+
return bType;
|
|
77
88
|
|
|
78
89
|
} else if ( cLen > aLen ) {
|
|
79
90
|
|
|
80
|
-
|
|
91
|
+
return cType;
|
|
81
92
|
|
|
82
93
|
}
|
|
83
94
|
|
|
84
|
-
return
|
|
95
|
+
return aType;
|
|
85
96
|
|
|
86
97
|
}
|
|
87
98
|
|
|
@@ -93,7 +104,7 @@ class MathNode extends TempNode {
|
|
|
93
104
|
|
|
94
105
|
return 'float';
|
|
95
106
|
|
|
96
|
-
} else if (method === MathNode.CROSS) {
|
|
107
|
+
} else if ( method === MathNode.CROSS ) {
|
|
97
108
|
|
|
98
109
|
return 'vec3';
|
|
99
110
|
|
|
@@ -105,20 +116,60 @@ class MathNode extends TempNode {
|
|
|
105
116
|
|
|
106
117
|
}
|
|
107
118
|
|
|
108
|
-
generate( builder ) {
|
|
119
|
+
generate( builder, output ) {
|
|
109
120
|
|
|
110
121
|
const method = this.method;
|
|
111
122
|
|
|
112
123
|
const type = this.getNodeType( builder );
|
|
113
124
|
const inputType = this.getInputType( builder );
|
|
114
125
|
|
|
115
|
-
|
|
126
|
+
const a = this.aNode;
|
|
127
|
+
const b = this.bNode;
|
|
128
|
+
const c = this.cNode;
|
|
129
|
+
|
|
130
|
+
if ( builder.renderer.isWebGLRenderer === true && ( method === MathNode.DFDX || method === MathNode.DFDY ) && output === 'vec3' ) {
|
|
131
|
+
|
|
132
|
+
// Workaround for Adreno 3XX dFd*( vec3 ) bug. See #9988
|
|
133
|
+
|
|
134
|
+
return new JoinNode( [
|
|
135
|
+
new MathNode( method, new SplitNode( a, 'x' ) ),
|
|
136
|
+
new MathNode( method, new SplitNode( a, 'y' ) ),
|
|
137
|
+
new MathNode( method, new SplitNode( a, 'z' ) )
|
|
138
|
+
] ).build( builder );
|
|
139
|
+
|
|
140
|
+
} else if ( method === MathNode.TRANSFORM_DIRECTION ) {
|
|
141
|
+
|
|
142
|
+
// dir can be either a direction vector or a normal vector
|
|
143
|
+
// upper-left 3x3 of matrix is assumed to be orthogonal
|
|
144
|
+
|
|
145
|
+
let tA = a;
|
|
146
|
+
let tB = b;
|
|
147
|
+
|
|
148
|
+
if ( builder.isMatrix( tA.getNodeType( builder ) ) ) {
|
|
149
|
+
|
|
150
|
+
tB = new ExpressionNode( `${ builder.getType( 'vec4' ) }( ${ tB.build( builder, 'vec3' ) }, 0.0 )`, 'vec4' );
|
|
151
|
+
|
|
152
|
+
} else {
|
|
153
|
+
|
|
154
|
+
tA = new ExpressionNode( `${ builder.getType( 'vec4' ) }( ${ tA.build( builder, 'vec3' ) }, 0.0 )`, 'vec4' );
|
|
155
|
+
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
const mulNode = new SplitNode( new OperatorNode( '*', tA, tB ), 'xyz' );
|
|
159
|
+
|
|
160
|
+
return new MathNode( MathNode.NORMALIZE, mulNode ).build( builder );
|
|
161
|
+
|
|
162
|
+
} else if ( method === MathNode.SATURATE ) {
|
|
163
|
+
|
|
164
|
+
return `clamp( ${ a.build( builder, inputType ) }, 0.0, 1.0 )`;
|
|
165
|
+
|
|
166
|
+
} else if ( method === MathNode.NEGATE ) {
|
|
116
167
|
|
|
117
|
-
return '( -' +
|
|
168
|
+
return '( -' + a.build( builder, inputType ) + ' )';
|
|
118
169
|
|
|
119
170
|
} else if ( method === MathNode.INVERT ) {
|
|
120
171
|
|
|
121
|
-
return '( 1.0 - ' +
|
|
172
|
+
return '( 1.0 - ' + a.build( builder, inputType ) + ' )';
|
|
122
173
|
|
|
123
174
|
} else {
|
|
124
175
|
|
|
@@ -127,57 +178,57 @@ class MathNode extends TempNode {
|
|
|
127
178
|
if ( method === MathNode.CROSS ) {
|
|
128
179
|
|
|
129
180
|
params.push(
|
|
130
|
-
|
|
131
|
-
|
|
181
|
+
a.build( builder, type ),
|
|
182
|
+
b.build( builder, type )
|
|
132
183
|
);
|
|
133
184
|
|
|
134
185
|
} else if ( method === MathNode.STEP ) {
|
|
135
186
|
|
|
136
187
|
params.push(
|
|
137
|
-
|
|
138
|
-
|
|
188
|
+
b.build( builder, builder.getTypeLength( a.getNodeType( builder ) ) === 1 ? 'float' : inputType ),
|
|
189
|
+
b.build( builder, inputType )
|
|
139
190
|
);
|
|
140
191
|
|
|
141
192
|
} else if ( method === MathNode.MIN || method === MathNode.MAX || method === MathNode.MOD ) {
|
|
142
193
|
|
|
143
194
|
params.push(
|
|
144
|
-
|
|
145
|
-
|
|
195
|
+
a.build( builder, inputType ),
|
|
196
|
+
b.build( builder, builder.getTypeLength( b.getNodeType( builder ) ) === 1 ? 'float' : inputType )
|
|
146
197
|
);
|
|
147
198
|
|
|
148
199
|
} else if ( method === MathNode.REFRACT ) {
|
|
149
200
|
|
|
150
201
|
params.push(
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
202
|
+
a.build( builder, inputType ),
|
|
203
|
+
b.build( builder, inputType ),
|
|
204
|
+
c.build( builder, 'float' )
|
|
154
205
|
);
|
|
155
206
|
|
|
156
207
|
} else if ( method === MathNode.MIX ) {
|
|
157
208
|
|
|
158
209
|
params.push(
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
210
|
+
a.build( builder, inputType ),
|
|
211
|
+
b.build( builder, inputType ),
|
|
212
|
+
c.build( builder, builder.getTypeLength( c.getNodeType( builder ) ) === 1 ? 'float' : inputType )
|
|
162
213
|
);
|
|
163
214
|
|
|
164
215
|
} else {
|
|
165
216
|
|
|
166
|
-
params.push(
|
|
217
|
+
params.push( a.build( builder, inputType ) );
|
|
167
218
|
|
|
168
|
-
if (
|
|
219
|
+
if ( c !== null ) {
|
|
169
220
|
|
|
170
|
-
params.push(
|
|
221
|
+
params.push( b.build( builder, inputType ), c.build( builder, inputType ) );
|
|
171
222
|
|
|
172
|
-
} else if (
|
|
223
|
+
} else if ( b !== null ) {
|
|
173
224
|
|
|
174
|
-
params.push(
|
|
225
|
+
params.push( b.build( builder, inputType ) );
|
|
175
226
|
|
|
176
227
|
}
|
|
177
228
|
|
|
178
229
|
}
|
|
179
230
|
|
|
180
|
-
return `${method}( ${params.join(', ')} )`;
|
|
231
|
+
return `${ builder.getMethod( method ) }( ${params.join( ', ' )} )`;
|
|
181
232
|
|
|
182
233
|
}
|
|
183
234
|
|
|
@@ -2,77 +2,170 @@ import TempNode from '../core/TempNode.js';
|
|
|
2
2
|
|
|
3
3
|
class OperatorNode extends TempNode {
|
|
4
4
|
|
|
5
|
-
constructor( op,
|
|
5
|
+
constructor( op, aNode, bNode, ...params ) {
|
|
6
6
|
|
|
7
7
|
super();
|
|
8
8
|
|
|
9
9
|
this.op = op;
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
if ( params.length > 0 ) {
|
|
12
|
+
|
|
13
|
+
let finalBNode = bNode;
|
|
14
|
+
|
|
15
|
+
for ( let i = 0; i < params.length; i ++ ) {
|
|
16
|
+
|
|
17
|
+
finalBNode = new OperatorNode( op, finalBNode, params[ i ] );
|
|
18
|
+
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
bNode = finalBNode;
|
|
22
|
+
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
this.aNode = aNode;
|
|
26
|
+
this.bNode = bNode;
|
|
13
27
|
|
|
14
28
|
}
|
|
15
29
|
|
|
16
|
-
getNodeType( builder ) {
|
|
30
|
+
getNodeType( builder, output ) {
|
|
17
31
|
|
|
18
|
-
const
|
|
19
|
-
const typeB = this.b.getNodeType( builder );
|
|
32
|
+
const op = this.op;
|
|
20
33
|
|
|
21
|
-
|
|
34
|
+
const aNode = this.aNode;
|
|
35
|
+
const bNode = this.bNode;
|
|
22
36
|
|
|
23
|
-
|
|
37
|
+
const typeA = aNode.getNodeType( builder );
|
|
38
|
+
const typeB = bNode.getNodeType( builder );
|
|
24
39
|
|
|
25
|
-
|
|
40
|
+
if ( typeA === 'void' || typeB === 'void' ) {
|
|
26
41
|
|
|
27
|
-
|
|
42
|
+
return 'void';
|
|
28
43
|
|
|
29
|
-
|
|
44
|
+
} else if ( op === '=' ) {
|
|
30
45
|
|
|
31
|
-
return
|
|
46
|
+
return typeA;
|
|
32
47
|
|
|
33
|
-
} else if (
|
|
48
|
+
} else if ( op === '==' || op === '&&' ) {
|
|
34
49
|
|
|
35
|
-
|
|
50
|
+
return 'bool';
|
|
36
51
|
|
|
37
|
-
|
|
52
|
+
} else if ( op === '<=' || op === '>' ) {
|
|
38
53
|
|
|
39
|
-
|
|
54
|
+
const length = builder.getTypeLength( output );
|
|
55
|
+
|
|
56
|
+
return length > 1 ? `bvec${ length }` : 'bool';
|
|
57
|
+
|
|
58
|
+
} else {
|
|
59
|
+
|
|
60
|
+
if ( typeA === 'float' && builder.isMatrix( typeB ) ) {
|
|
40
61
|
|
|
41
|
-
|
|
62
|
+
return typeB;
|
|
63
|
+
|
|
64
|
+
} else if ( builder.isMatrix( typeA ) && builder.isVector( typeB ) ) {
|
|
65
|
+
|
|
66
|
+
// matrix x vector
|
|
67
|
+
|
|
68
|
+
return builder.getVectorFromMatrix( typeA );
|
|
69
|
+
|
|
70
|
+
} else if ( builder.isVector( typeA ) && builder.isMatrix( typeB ) ) {
|
|
71
|
+
|
|
72
|
+
// vector x matrix
|
|
73
|
+
|
|
74
|
+
return builder.getVectorFromMatrix( typeB );
|
|
75
|
+
|
|
76
|
+
} else if ( builder.getTypeLength( typeB ) > builder.getTypeLength( typeA ) ) {
|
|
77
|
+
|
|
78
|
+
// anytype x anytype: use the greater length vector
|
|
79
|
+
|
|
80
|
+
return typeB;
|
|
81
|
+
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
return typeA;
|
|
85
|
+
|
|
86
|
+
}
|
|
42
87
|
|
|
43
88
|
}
|
|
44
89
|
|
|
45
90
|
generate( builder, output ) {
|
|
46
91
|
|
|
47
|
-
|
|
48
|
-
let typeB = this.b.getNodeType( builder );
|
|
92
|
+
const op = this.op;
|
|
49
93
|
|
|
50
|
-
|
|
94
|
+
const aNode = this.aNode;
|
|
95
|
+
const bNode = this.bNode;
|
|
51
96
|
|
|
52
|
-
|
|
97
|
+
const type = this.getNodeType( builder, output );
|
|
53
98
|
|
|
54
|
-
|
|
99
|
+
let typeA = null;
|
|
100
|
+
let typeB = null;
|
|
55
101
|
|
|
56
|
-
|
|
102
|
+
if ( type !== 'void' ) {
|
|
57
103
|
|
|
58
|
-
|
|
104
|
+
typeA = aNode.getNodeType( builder );
|
|
105
|
+
typeB = bNode.getNodeType( builder );
|
|
59
106
|
|
|
60
|
-
|
|
107
|
+
if ( op === '=' ) {
|
|
61
108
|
|
|
62
|
-
|
|
109
|
+
typeB = typeA;
|
|
63
110
|
|
|
64
|
-
|
|
111
|
+
} else if ( builder.isMatrix( typeA ) && builder.isVector( typeB ) ) {
|
|
112
|
+
|
|
113
|
+
// matrix x vector
|
|
114
|
+
|
|
115
|
+
typeB = builder.getVectorFromMatrix( typeA );
|
|
116
|
+
|
|
117
|
+
} else if ( builder.isVector( typeA ) && builder.isMatrix( typeB ) ) {
|
|
118
|
+
|
|
119
|
+
// vector x matrix
|
|
120
|
+
|
|
121
|
+
typeA = builder.getVectorFromMatrix( typeB );
|
|
122
|
+
|
|
123
|
+
} else {
|
|
65
124
|
|
|
66
|
-
|
|
125
|
+
// anytype x anytype
|
|
126
|
+
|
|
127
|
+
typeA = typeB = type;
|
|
128
|
+
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
} else {
|
|
67
132
|
|
|
68
133
|
typeA = typeB = type;
|
|
69
134
|
|
|
70
135
|
}
|
|
71
136
|
|
|
72
|
-
const a =
|
|
73
|
-
const b =
|
|
137
|
+
const a = aNode.build( builder, typeA );
|
|
138
|
+
const b = bNode.build( builder, typeB );
|
|
139
|
+
|
|
140
|
+
const outputLength = builder.getTypeLength( output );
|
|
141
|
+
|
|
142
|
+
if ( output !== 'void' ) {
|
|
74
143
|
|
|
75
|
-
|
|
144
|
+
if ( op === '=' ) {
|
|
145
|
+
|
|
146
|
+
builder.addFlowCode( `${a} ${this.op} ${b}` );
|
|
147
|
+
|
|
148
|
+
return a;
|
|
149
|
+
|
|
150
|
+
} else if ( op === '>' && outputLength > 1 ) {
|
|
151
|
+
|
|
152
|
+
return `greaterThan( ${a}, ${b} )`;
|
|
153
|
+
|
|
154
|
+
} else if ( op === '<=' && outputLength > 1 ) {
|
|
155
|
+
|
|
156
|
+
return `lessThanEqual( ${a}, ${b} )`;
|
|
157
|
+
|
|
158
|
+
} else {
|
|
159
|
+
|
|
160
|
+
return `( ${a} ${this.op} ${b} )`;
|
|
161
|
+
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
} else if ( typeA !== 'void' ) {
|
|
165
|
+
|
|
166
|
+
return `${a} ${this.op} ${b}`;
|
|
167
|
+
|
|
168
|
+
}
|
|
76
169
|
|
|
77
170
|
}
|
|
78
171
|
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import NodeFunction from '../core/NodeFunction.js';
|
|
2
|
+
import NodeFunctionInput from '../core/NodeFunctionInput.js';
|
|
3
|
+
|
|
4
|
+
const declarationRegexp = /^\s*(highp|mediump|lowp)?\s*([a-z_0-9]+)\s*([a-z_0-9]+)?\s*\(([\s\S]*?)\)/i;
|
|
5
|
+
const propertiesRegexp = /[a-z_0-9]+/ig;
|
|
6
|
+
|
|
7
|
+
const pragmaMain = '#pragma main';
|
|
8
|
+
|
|
9
|
+
const parse = ( source ) => {
|
|
10
|
+
|
|
11
|
+
source = source.trim();
|
|
12
|
+
|
|
13
|
+
const pragmaMainIndex = source.indexOf( pragmaMain );
|
|
14
|
+
|
|
15
|
+
const mainCode = pragmaMainIndex !== - 1 ? source.substr( pragmaMainIndex + pragmaMain.length ) : source;
|
|
16
|
+
|
|
17
|
+
const declaration = mainCode.match( declarationRegexp );
|
|
18
|
+
|
|
19
|
+
if ( declaration !== null && declaration.length === 5 ) {
|
|
20
|
+
|
|
21
|
+
// tokenizer
|
|
22
|
+
|
|
23
|
+
const inputsCode = declaration[ 4 ];
|
|
24
|
+
const propsMatches = [];
|
|
25
|
+
|
|
26
|
+
let nameMatch = null;
|
|
27
|
+
|
|
28
|
+
while ( ( nameMatch = propertiesRegexp.exec( inputsCode ) ) !== null ) {
|
|
29
|
+
|
|
30
|
+
propsMatches.push( nameMatch );
|
|
31
|
+
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// parser
|
|
35
|
+
|
|
36
|
+
const inputs = [];
|
|
37
|
+
|
|
38
|
+
let i = 0;
|
|
39
|
+
|
|
40
|
+
while ( i < propsMatches.length ) {
|
|
41
|
+
|
|
42
|
+
const isConst = propsMatches[ i ][ 0 ] === 'const';
|
|
43
|
+
|
|
44
|
+
if ( isConst === true ) {
|
|
45
|
+
|
|
46
|
+
i ++;
|
|
47
|
+
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
let qualifier = propsMatches[ i ][ 0 ];
|
|
51
|
+
|
|
52
|
+
if ( qualifier === 'in' || qualifier === 'out' || qualifier === 'inout' ) {
|
|
53
|
+
|
|
54
|
+
i ++;
|
|
55
|
+
|
|
56
|
+
} else {
|
|
57
|
+
|
|
58
|
+
qualifier = '';
|
|
59
|
+
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const type = propsMatches[ i ++ ][ 0 ];
|
|
63
|
+
|
|
64
|
+
let count = Number.parseInt( propsMatches[ i ][ 0 ] );
|
|
65
|
+
|
|
66
|
+
if ( Number.isNaN( count ) === false ) i ++;
|
|
67
|
+
else count = null;
|
|
68
|
+
|
|
69
|
+
const name = propsMatches[ i ++ ][ 0 ];
|
|
70
|
+
|
|
71
|
+
inputs.push( new NodeFunctionInput( type, name, count, qualifier, isConst ) );
|
|
72
|
+
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
//
|
|
76
|
+
|
|
77
|
+
const blockCode = mainCode.substring( declaration[ 0 ].length );
|
|
78
|
+
|
|
79
|
+
const name = declaration[ 3 ] !== undefined ? declaration[ 3 ] : '';
|
|
80
|
+
const type = declaration[ 2 ];
|
|
81
|
+
|
|
82
|
+
const presicion = declaration[ 1 ] !== undefined ? declaration[ 1 ] : '';
|
|
83
|
+
|
|
84
|
+
const headerCode = pragmaMainIndex !== - 1 ? source.substr( 0, pragmaMainIndex ) : '';
|
|
85
|
+
|
|
86
|
+
return {
|
|
87
|
+
type,
|
|
88
|
+
inputs,
|
|
89
|
+
name,
|
|
90
|
+
presicion,
|
|
91
|
+
inputsCode,
|
|
92
|
+
blockCode,
|
|
93
|
+
headerCode
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
} else {
|
|
97
|
+
|
|
98
|
+
throw new Error( 'FunctionNode: Function is not a GLSL code.' );
|
|
99
|
+
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
class GLSLNodeFunction extends NodeFunction {
|
|
105
|
+
|
|
106
|
+
constructor( source ) {
|
|
107
|
+
|
|
108
|
+
const { type, inputs, name, presicion, inputsCode, blockCode, headerCode } = parse( source );
|
|
109
|
+
|
|
110
|
+
super( type, inputs, name, presicion );
|
|
111
|
+
|
|
112
|
+
this.inputsCode = inputsCode;
|
|
113
|
+
this.blockCode = blockCode;
|
|
114
|
+
this.headerCode = headerCode;
|
|
115
|
+
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
getCode( name = this.name ) {
|
|
119
|
+
|
|
120
|
+
const headerCode = this.headerCode;
|
|
121
|
+
const presicion = this.presicion;
|
|
122
|
+
|
|
123
|
+
let declarationCode = `${ this.type } ${ name } ( ${ this.inputsCode.trim() } )`;
|
|
124
|
+
|
|
125
|
+
if ( presicion !== '' ) {
|
|
126
|
+
|
|
127
|
+
declarationCode = `${ presicion } ${ declarationCode }`;
|
|
128
|
+
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
return headerCode + declarationCode + this.blockCode;
|
|
132
|
+
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export default GLSLNodeFunction;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import NodeParser from '../core/NodeParser.js';
|
|
2
|
+
import GLSLNodeFunction from './GLSLNodeFunction.js';
|
|
3
|
+
|
|
4
|
+
class GLSLNodeParser extends NodeParser {
|
|
5
|
+
|
|
6
|
+
parseFunction( source ) {
|
|
7
|
+
|
|
8
|
+
return new GLSLNodeFunction( source );
|
|
9
|
+
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export default GLSLNodeParser;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import NodeFunction from '../core/NodeFunction.js';
|
|
2
|
+
import NodeFunctionInput from '../core/NodeFunctionInput.js';
|
|
3
|
+
|
|
4
|
+
const declarationRegexp = /^fn\s*([a-z_0-9]+)?\s*\(([\s\S]*?)\)\s*\-\>\s*([a-z_0-9]+)?/i;
|
|
5
|
+
const propertiesRegexp = /[a-z_0-9]+/ig;
|
|
6
|
+
|
|
7
|
+
const parse = ( source ) => {
|
|
8
|
+
|
|
9
|
+
source = source.trim();
|
|
10
|
+
|
|
11
|
+
const declaration = source.match( declarationRegexp );
|
|
12
|
+
|
|
13
|
+
if ( declaration !== null && declaration.length === 4 ) {
|
|
14
|
+
|
|
15
|
+
// tokenizer
|
|
16
|
+
|
|
17
|
+
const inputsCode = declaration[ 2 ];
|
|
18
|
+
const propsMatches = [];
|
|
19
|
+
|
|
20
|
+
let nameMatch = null;
|
|
21
|
+
|
|
22
|
+
while ( ( nameMatch = propertiesRegexp.exec( inputsCode ) ) !== null ) {
|
|
23
|
+
|
|
24
|
+
propsMatches.push( nameMatch );
|
|
25
|
+
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// parser
|
|
29
|
+
|
|
30
|
+
const inputs = [];
|
|
31
|
+
|
|
32
|
+
let i = 0;
|
|
33
|
+
|
|
34
|
+
while ( i < propsMatches.length ) {
|
|
35
|
+
|
|
36
|
+
const name = propsMatches[ i ++ ][ 0 ];
|
|
37
|
+
const type = propsMatches[ i ++ ][ 0 ];
|
|
38
|
+
|
|
39
|
+
propsMatches[ i ++ ][ 0 ]; // precision
|
|
40
|
+
|
|
41
|
+
inputs.push( new NodeFunctionInput( type, name ) );
|
|
42
|
+
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
//
|
|
46
|
+
|
|
47
|
+
const blockCode = source.substring( declaration[ 0 ].length );
|
|
48
|
+
|
|
49
|
+
const name = declaration[ 1 ] !== undefined ? declaration[ 1 ] : '';
|
|
50
|
+
const type = declaration[ 3 ];
|
|
51
|
+
|
|
52
|
+
return {
|
|
53
|
+
type,
|
|
54
|
+
inputs,
|
|
55
|
+
name,
|
|
56
|
+
inputsCode,
|
|
57
|
+
blockCode
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
} else {
|
|
61
|
+
|
|
62
|
+
throw new Error( 'FunctionNode: Function is not a WGSL code.' );
|
|
63
|
+
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
class WGSLNodeFunction extends NodeFunction {
|
|
69
|
+
|
|
70
|
+
constructor( source ) {
|
|
71
|
+
|
|
72
|
+
const { type, inputs, name, inputsCode, blockCode } = parse( source );
|
|
73
|
+
|
|
74
|
+
super( type, inputs, name );
|
|
75
|
+
|
|
76
|
+
this.inputsCode = inputsCode;
|
|
77
|
+
this.blockCode = blockCode;
|
|
78
|
+
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
getCode( name = this.name ) {
|
|
82
|
+
|
|
83
|
+
return `fn ${ name } ( ${ this.inputsCode.trim() } ) -> ${ this.type }` + this.blockCode;
|
|
84
|
+
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export default WGSLNodeFunction;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import NodeParser from '../core/NodeParser.js';
|
|
2
|
+
import WGSLNodeFunction from './WGSLNodeFunction.js';
|
|
3
|
+
|
|
4
|
+
class WGSLNodeParser extends NodeParser {
|
|
5
|
+
|
|
6
|
+
parseFunction( source ) {
|
|
7
|
+
|
|
8
|
+
return new WGSLNodeFunction( source );
|
|
9
|
+
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export default WGSLNodeParser;
|