super-three 0.158.0 → 0.160.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/three.cjs +1720 -380
- package/build/three.js +1720 -380
- package/build/three.min.js +1 -1
- package/build/three.module.js +1719 -381
- package/build/three.module.min.js +1 -1
- package/examples/jsm/Addons.js +2 -1
- package/examples/jsm/controls/OrbitControls.js +50 -40
- package/examples/jsm/csm/CSMShader.js +52 -47
- package/examples/jsm/exporters/GLTFExporter.js +79 -1
- package/examples/jsm/exporters/USDZExporter.js +27 -19
- package/examples/jsm/helpers/TextureHelper.js +237 -0
- package/examples/jsm/interactive/HTMLMesh.js +9 -2
- package/examples/jsm/lines/LineMaterial.js +16 -33
- package/examples/jsm/loaders/ColladaLoader.js +0 -6
- package/examples/jsm/loaders/DRACOLoader.js +4 -3
- package/examples/jsm/loaders/FBXLoader.js +294 -124
- package/examples/jsm/loaders/GLTFLoader.js +71 -3
- package/examples/jsm/loaders/MaterialXLoader.js +73 -54
- package/examples/jsm/loaders/NRRDLoader.js +0 -13
- package/examples/jsm/loaders/SVGLoader.js +4 -4
- package/examples/jsm/loaders/USDZLoader.js +3 -17
- package/examples/jsm/math/Octree.js +15 -4
- package/examples/jsm/misc/Timer.js +119 -0
- package/examples/jsm/misc/TubePainter.js +3 -6
- package/examples/jsm/modifiers/CurveModifier.js +20 -2
- package/examples/jsm/nodes/Nodes.js +11 -7
- package/examples/jsm/nodes/accessors/CameraNode.js +18 -2
- package/examples/jsm/nodes/accessors/CubeTextureNode.js +5 -73
- package/examples/jsm/nodes/accessors/MaterialReferenceNode.js +11 -2
- package/examples/jsm/nodes/accessors/ModelNode.js +1 -1
- package/examples/jsm/nodes/accessors/ModelViewProjectionNode.js +12 -3
- package/examples/jsm/nodes/accessors/MorphNode.js +191 -16
- package/examples/jsm/nodes/accessors/ReferenceNode.js +25 -1
- package/examples/jsm/nodes/accessors/TextureNode.js +122 -36
- package/examples/jsm/nodes/code/CodeNode.js +3 -3
- package/examples/jsm/nodes/core/AttributeNode.js +7 -1
- package/examples/jsm/nodes/core/CacheNode.js +4 -1
- package/examples/jsm/nodes/core/ConstNode.js +1 -1
- package/examples/jsm/nodes/core/Node.js +6 -3
- package/examples/jsm/nodes/core/NodeBuilder.js +84 -27
- package/examples/jsm/nodes/core/NodeFrame.js +10 -8
- package/examples/jsm/nodes/core/NodeUniform.js +12 -0
- package/examples/jsm/nodes/core/NodeUtils.js +3 -7
- package/examples/jsm/nodes/core/OutputStructNode.js +3 -3
- package/examples/jsm/nodes/core/PropertyNode.js +17 -2
- package/examples/jsm/nodes/core/StructTypeNode.js +4 -4
- package/examples/jsm/nodes/core/UniformGroup.js +13 -0
- package/examples/jsm/nodes/core/UniformGroupNode.js +36 -0
- package/examples/jsm/nodes/core/UniformNode.js +17 -0
- package/examples/jsm/nodes/core/VarNode.js +2 -0
- package/examples/jsm/nodes/core/VaryingNode.js +1 -7
- package/examples/jsm/nodes/display/BumpMapNode.js +1 -1
- package/examples/jsm/nodes/display/ColorAdjustmentNode.js +6 -10
- package/examples/jsm/nodes/display/GaussianBlurNode.js +170 -0
- package/examples/jsm/nodes/display/PassNode.js +182 -0
- package/examples/jsm/nodes/display/ViewportDepthNode.js +31 -3
- package/examples/jsm/nodes/display/ViewportDepthTextureNode.js +2 -2
- package/examples/jsm/nodes/display/ViewportNode.js +5 -8
- package/examples/jsm/nodes/functions/PhysicalLightingModel.js +1 -1
- package/examples/jsm/nodes/lighting/AnalyticLightNode.js +52 -17
- package/examples/jsm/nodes/lighting/EnvironmentNode.js +8 -12
- package/examples/jsm/nodes/lighting/LightsNode.js +34 -32
- package/examples/jsm/nodes/materials/InstancedPointsNodeMaterial.js +1 -1
- package/examples/jsm/nodes/materials/Line2NodeMaterial.js +12 -12
- package/examples/jsm/nodes/materials/MeshBasicNodeMaterial.js +1 -0
- package/examples/jsm/nodes/materials/MeshNormalNodeMaterial.js +1 -1
- package/examples/jsm/nodes/materials/NodeMaterial.js +66 -41
- package/examples/jsm/nodes/materials/PointsNodeMaterial.js +0 -10
- package/examples/jsm/nodes/materials/SpriteNodeMaterial.js +0 -7
- package/examples/jsm/nodes/materialx/MaterialXNodes.js +10 -10
- package/examples/jsm/nodes/materialx/lib/mx_hsv.js +128 -54
- package/examples/jsm/nodes/materialx/lib/mx_noise.js +1430 -618
- package/examples/jsm/nodes/materialx/lib/mx_transform_color.js +24 -14
- package/examples/jsm/nodes/math/MathNode.js +2 -0
- package/examples/jsm/nodes/math/OperatorNode.js +19 -6
- package/examples/jsm/nodes/shadernode/ShaderNode.js +32 -3
- package/examples/jsm/nodes/utils/FunctionOverloadingNode.js +95 -0
- package/examples/jsm/nodes/utils/RemapNode.js +2 -2
- package/examples/jsm/nodes/utils/SplitNode.js +8 -2
- package/examples/jsm/nodes/utils/TriplanarTexturesNode.js +3 -3
- package/examples/jsm/objects/QuadMesh.js +60 -0
- package/examples/jsm/postprocessing/GTAOPass.js +572 -0
- package/examples/jsm/postprocessing/OutputPass.js +2 -0
- package/examples/jsm/renderers/common/Animation.js +10 -21
- package/examples/jsm/renderers/common/Backend.js +19 -3
- package/examples/jsm/renderers/common/Background.js +20 -22
- package/examples/jsm/renderers/common/Bindings.js +30 -21
- package/examples/jsm/renderers/common/ChainMap.js +3 -3
- package/examples/jsm/renderers/common/Color4.js +37 -0
- package/examples/jsm/renderers/common/Geometries.js +4 -4
- package/examples/jsm/renderers/common/Info.js +12 -2
- package/examples/jsm/renderers/common/Pipelines.js +3 -51
- package/examples/jsm/renderers/common/PostProcessing.js +25 -0
- package/examples/jsm/renderers/common/RenderContext.js +1 -1
- package/examples/jsm/renderers/common/RenderContexts.js +1 -1
- package/examples/jsm/renderers/common/RenderObject.js +13 -1
- package/examples/jsm/renderers/common/RenderObjects.js +4 -2
- package/examples/jsm/renderers/common/Renderer.js +137 -37
- package/examples/jsm/renderers/common/StorageTexture.js +1 -0
- package/examples/jsm/renderers/common/Textures.js +4 -1
- package/examples/jsm/renderers/common/nodes/NodeBuilderState.js +10 -2
- package/examples/jsm/renderers/common/nodes/NodeUniformsGroup.js +44 -0
- package/examples/jsm/renderers/common/nodes/Nodes.js +74 -7
- package/examples/jsm/renderers/webgl/WebGLBackend.js +91 -33
- package/examples/jsm/renderers/webgl/nodes/GLSLNodeBuilder.js +100 -31
- package/examples/jsm/renderers/webgl/utils/WebGLAttributeUtils.js +57 -5
- package/examples/jsm/renderers/webgl/utils/WebGLCapabilities.js +36 -0
- package/examples/jsm/renderers/webgl/utils/WebGLExtensions.js +11 -1
- package/examples/jsm/renderers/webgl/utils/WebGLTextureUtils.js +71 -2
- package/examples/jsm/renderers/webgl/utils/WebGLUtils.js +42 -0
- package/examples/jsm/renderers/webgl-legacy/nodes/SlotNode.js +1 -1
- package/examples/jsm/renderers/webgl-legacy/nodes/WebGLNodeBuilder.js +33 -3
- package/examples/jsm/renderers/webgl-legacy/nodes/WebGLNodes.js +4 -14
- package/examples/jsm/renderers/webgpu/WebGPUBackend.js +186 -137
- package/examples/jsm/renderers/webgpu/WebGPURenderer.js +1 -1
- package/examples/jsm/renderers/webgpu/nodes/WGSLNodeBuilder.js +209 -90
- package/examples/jsm/renderers/webgpu/utils/WebGPUAttributeUtils.js +15 -10
- package/examples/jsm/renderers/webgpu/utils/WebGPUBindingUtils.js +11 -3
- package/examples/jsm/renderers/webgpu/utils/WebGPUPipelineUtils.js +2 -3
- package/examples/jsm/renderers/webgpu/utils/WebGPUTextureUtils.js +88 -6
- package/examples/jsm/shaders/FXAAShader.js +133 -133
- package/examples/jsm/shaders/GTAOShader.js +424 -0
- package/examples/jsm/shaders/OutputShader.js +4 -0
- package/examples/jsm/shaders/PoissonDenoiseShader.js +226 -0
- package/examples/jsm/shaders/SAOShader.js +2 -3
- package/examples/jsm/shaders/SSAOShader.js +2 -3
- package/examples/jsm/transpiler/AST.js +40 -1
- package/examples/jsm/transpiler/GLSLDecoder.js +50 -8
- package/examples/jsm/transpiler/ShaderToyDecoder.js +4 -4
- package/examples/jsm/transpiler/TSLEncoder.js +124 -20
- package/examples/jsm/utils/SortUtils.js +158 -0
- package/examples/jsm/utils/TextureUtils.js +33 -21
- package/examples/jsm/webxr/ARButton.js +14 -0
- package/examples/jsm/webxr/VRButton.js +23 -8
- package/examples/jsm/webxr/XRButton.js +25 -11
- package/package.json +5 -6
- package/src/Three.js +1 -0
- package/src/constants.js +2 -1
- package/src/core/BufferAttribute.js +21 -2
- package/src/core/InterleavedBuffer.js +21 -1
- package/src/core/Object3D.js +60 -12
- package/src/core/UniformsGroup.js +7 -1
- package/src/extras/curves/LineCurve3.js +4 -0
- package/src/loaders/AudioLoader.js +1 -1
- package/src/loaders/BufferGeometryLoader.js +0 -7
- package/src/loaders/ImageBitmapLoader.js +25 -1
- package/src/loaders/ObjectLoader.js +49 -0
- package/src/materials/ShaderMaterial.js +2 -1
- package/src/math/ColorManagement.js +0 -16
- package/src/math/Quaternion.js +5 -4
- package/src/math/Sphere.js +2 -0
- package/src/math/Triangle.js +17 -5
- package/src/objects/BatchedMesh.js +1020 -0
- package/src/objects/Skeleton.js +1 -3
- package/src/renderers/WebGL3DRenderTarget.js +2 -2
- package/src/renderers/WebGLArrayRenderTarget.js +2 -2
- package/src/renderers/WebGLRenderer.js +24 -19
- package/src/renderers/shaders/ShaderChunk/batching_pars_vertex.glsl.js +19 -0
- package/src/renderers/shaders/ShaderChunk/batching_vertex.glsl.js +5 -0
- package/src/renderers/shaders/ShaderChunk/cube_uv_reflection_fragment.glsl.js +0 -5
- package/src/renderers/shaders/ShaderChunk/defaultnormal_vertex.glsl.js +31 -4
- package/src/renderers/shaders/ShaderChunk/lights_physical_fragment.glsl.js +9 -4
- package/src/renderers/shaders/ShaderChunk/project_vertex.glsl.js +6 -0
- package/src/renderers/shaders/ShaderChunk/skinning_pars_vertex.glsl.js +9 -17
- package/src/renderers/shaders/ShaderChunk/tonemapping_pars_fragment.glsl.js +84 -0
- package/src/renderers/shaders/ShaderChunk/worldpos_vertex.glsl.js +6 -0
- package/src/renderers/shaders/ShaderChunk.js +4 -0
- package/src/renderers/shaders/ShaderLib/depth.glsl.js +2 -0
- package/src/renderers/shaders/ShaderLib/distanceRGBA.glsl.js +2 -0
- package/src/renderers/shaders/ShaderLib/meshbasic.glsl.js +2 -0
- package/src/renderers/shaders/ShaderLib/meshlambert.glsl.js +2 -0
- package/src/renderers/shaders/ShaderLib/meshmatcap.glsl.js +3 -0
- package/src/renderers/shaders/ShaderLib/meshnormal.glsl.js +2 -0
- package/src/renderers/shaders/ShaderLib/meshphong.glsl.js +2 -0
- package/src/renderers/shaders/ShaderLib/meshphysical.glsl.js +2 -0
- package/src/renderers/shaders/ShaderLib/meshtoon.glsl.js +2 -0
- package/src/renderers/shaders/ShaderLib/shadow.glsl.js +3 -0
- package/src/renderers/webgl/WebGLAttributes.js +39 -5
- package/src/renderers/webgl/WebGLBufferRenderer.js +31 -0
- package/src/renderers/webgl/WebGLCubeMaps.js +1 -1
- package/src/renderers/webgl/WebGLExtensions.js +1 -0
- package/src/renderers/webgl/WebGLIndexedBufferRenderer.js +31 -0
- package/src/renderers/webgl/WebGLLights.js +11 -2
- package/src/renderers/webgl/WebGLProgram.js +20 -1
- package/src/renderers/webgl/WebGLPrograms.js +5 -0
- package/src/renderers/webgl/WebGLShadowMap.js +35 -0
- package/src/renderers/webgl/WebGLTextures.js +7 -11
- package/src/renderers/webgl/WebGLUniforms.js +11 -1
- package/src/renderers/webgl/WebGLUniformsGroups.js +72 -93
- package/src/renderers/webxr/WebXRManager.js +16 -0
- package/examples/jsm/objects/BatchedMesh.js +0 -586
|
@@ -1,618 +1,1430 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
{
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
{
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
{
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
float
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
uint
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
{
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
{
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
}
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
const
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
1
|
+
// Three.js Transpiler
|
|
2
|
+
// https://raw.githubusercontent.com/AcademySoftwareFoundation/MaterialX/main/libraries/stdlib/genglsl/lib/mx_noise.glsl
|
|
3
|
+
|
|
4
|
+
import { int, uint, float, vec3, bool, uvec3, vec2, vec4, If, tslFn } from '../../shadernode/ShaderNode.js';
|
|
5
|
+
import { cond } from '../../math/CondNode.js';
|
|
6
|
+
import { sub, mul } from '../../math/OperatorNode.js';
|
|
7
|
+
import { floor, abs, max, dot, min, sqrt } from '../../math/MathNode.js';
|
|
8
|
+
import { overloadingFn } from '../../utils/FunctionOverloadingNode.js';
|
|
9
|
+
import { loop } from '../../utils/LoopNode.js';
|
|
10
|
+
|
|
11
|
+
const mx_select = tslFn( ( [ b_immutable, t_immutable, f_immutable ] ) => {
|
|
12
|
+
|
|
13
|
+
const f = float( f_immutable ).toVar();
|
|
14
|
+
const t = float( t_immutable ).toVar();
|
|
15
|
+
const b = bool( b_immutable ).toVar();
|
|
16
|
+
|
|
17
|
+
return cond( b, t, f );
|
|
18
|
+
|
|
19
|
+
} );
|
|
20
|
+
|
|
21
|
+
const mx_negate_if = tslFn( ( [ val_immutable, b_immutable ] ) => {
|
|
22
|
+
|
|
23
|
+
const b = bool( b_immutable ).toVar();
|
|
24
|
+
const val = float( val_immutable ).toVar();
|
|
25
|
+
|
|
26
|
+
return cond( b, val.negate(), val );
|
|
27
|
+
|
|
28
|
+
} );
|
|
29
|
+
|
|
30
|
+
const mx_floor = tslFn( ( [ x_immutable ] ) => {
|
|
31
|
+
|
|
32
|
+
const x = float( x_immutable ).toVar();
|
|
33
|
+
|
|
34
|
+
return int( floor( x ) );
|
|
35
|
+
|
|
36
|
+
} );
|
|
37
|
+
|
|
38
|
+
const mx_floorfrac = tslFn( ( [ x_immutable, i ] ) => {
|
|
39
|
+
|
|
40
|
+
const x = float( x_immutable ).toVar();
|
|
41
|
+
i.assign( mx_floor( x ) );
|
|
42
|
+
|
|
43
|
+
return x.sub( float( i ) );
|
|
44
|
+
|
|
45
|
+
} );
|
|
46
|
+
|
|
47
|
+
const mx_bilerp_0 = tslFn( ( [ v0_immutable, v1_immutable, v2_immutable, v3_immutable, s_immutable, t_immutable ] ) => {
|
|
48
|
+
|
|
49
|
+
const t = float( t_immutable ).toVar();
|
|
50
|
+
const s = float( s_immutable ).toVar();
|
|
51
|
+
const v3 = float( v3_immutable ).toVar();
|
|
52
|
+
const v2 = float( v2_immutable ).toVar();
|
|
53
|
+
const v1 = float( v1_immutable ).toVar();
|
|
54
|
+
const v0 = float( v0_immutable ).toVar();
|
|
55
|
+
const s1 = float( sub( 1.0, s ) ).toVar();
|
|
56
|
+
|
|
57
|
+
return sub( 1.0, t ).mul( v0.mul( s1 ).add( v1.mul( s ) ) ).add( t.mul( v2.mul( s1 ).add( v3.mul( s ) ) ) );
|
|
58
|
+
|
|
59
|
+
} );
|
|
60
|
+
|
|
61
|
+
const mx_bilerp_1 = tslFn( ( [ v0_immutable, v1_immutable, v2_immutable, v3_immutable, s_immutable, t_immutable ] ) => {
|
|
62
|
+
|
|
63
|
+
const t = float( t_immutable ).toVar();
|
|
64
|
+
const s = float( s_immutable ).toVar();
|
|
65
|
+
const v3 = vec3( v3_immutable ).toVar();
|
|
66
|
+
const v2 = vec3( v2_immutable ).toVar();
|
|
67
|
+
const v1 = vec3( v1_immutable ).toVar();
|
|
68
|
+
const v0 = vec3( v0_immutable ).toVar();
|
|
69
|
+
const s1 = float( sub( 1.0, s ) ).toVar();
|
|
70
|
+
|
|
71
|
+
return sub( 1.0, t ).mul( v0.mul( s1 ).add( v1.mul( s ) ) ).add( t.mul( v2.mul( s1 ).add( v3.mul( s ) ) ) );
|
|
72
|
+
|
|
73
|
+
} );
|
|
74
|
+
|
|
75
|
+
const mx_bilerp = overloadingFn( [ mx_bilerp_0, mx_bilerp_1 ] );
|
|
76
|
+
|
|
77
|
+
const mx_trilerp_0 = tslFn( ( [ v0_immutable, v1_immutable, v2_immutable, v3_immutable, v4_immutable, v5_immutable, v6_immutable, v7_immutable, s_immutable, t_immutable, r_immutable ] ) => {
|
|
78
|
+
|
|
79
|
+
const r = float( r_immutable ).toVar();
|
|
80
|
+
const t = float( t_immutable ).toVar();
|
|
81
|
+
const s = float( s_immutable ).toVar();
|
|
82
|
+
const v7 = float( v7_immutable ).toVar();
|
|
83
|
+
const v6 = float( v6_immutable ).toVar();
|
|
84
|
+
const v5 = float( v5_immutable ).toVar();
|
|
85
|
+
const v4 = float( v4_immutable ).toVar();
|
|
86
|
+
const v3 = float( v3_immutable ).toVar();
|
|
87
|
+
const v2 = float( v2_immutable ).toVar();
|
|
88
|
+
const v1 = float( v1_immutable ).toVar();
|
|
89
|
+
const v0 = float( v0_immutable ).toVar();
|
|
90
|
+
const s1 = float( sub( 1.0, s ) ).toVar();
|
|
91
|
+
const t1 = float( sub( 1.0, t ) ).toVar();
|
|
92
|
+
const r1 = float( sub( 1.0, r ) ).toVar();
|
|
93
|
+
|
|
94
|
+
return r1.mul( t1.mul( v0.mul( s1 ).add( v1.mul( s ) ) ).add( t.mul( v2.mul( s1 ).add( v3.mul( s ) ) ) ) ).add( r.mul( t1.mul( v4.mul( s1 ).add( v5.mul( s ) ) ).add( t.mul( v6.mul( s1 ).add( v7.mul( s ) ) ) ) ) );
|
|
95
|
+
|
|
96
|
+
} );
|
|
97
|
+
|
|
98
|
+
const mx_trilerp_1 = tslFn( ( [ v0_immutable, v1_immutable, v2_immutable, v3_immutable, v4_immutable, v5_immutable, v6_immutable, v7_immutable, s_immutable, t_immutable, r_immutable ] ) => {
|
|
99
|
+
|
|
100
|
+
const r = float( r_immutable ).toVar();
|
|
101
|
+
const t = float( t_immutable ).toVar();
|
|
102
|
+
const s = float( s_immutable ).toVar();
|
|
103
|
+
const v7 = vec3( v7_immutable ).toVar();
|
|
104
|
+
const v6 = vec3( v6_immutable ).toVar();
|
|
105
|
+
const v5 = vec3( v5_immutable ).toVar();
|
|
106
|
+
const v4 = vec3( v4_immutable ).toVar();
|
|
107
|
+
const v3 = vec3( v3_immutable ).toVar();
|
|
108
|
+
const v2 = vec3( v2_immutable ).toVar();
|
|
109
|
+
const v1 = vec3( v1_immutable ).toVar();
|
|
110
|
+
const v0 = vec3( v0_immutable ).toVar();
|
|
111
|
+
const s1 = float( sub( 1.0, s ) ).toVar();
|
|
112
|
+
const t1 = float( sub( 1.0, t ) ).toVar();
|
|
113
|
+
const r1 = float( sub( 1.0, r ) ).toVar();
|
|
114
|
+
|
|
115
|
+
return r1.mul( t1.mul( v0.mul( s1 ).add( v1.mul( s ) ) ).add( t.mul( v2.mul( s1 ).add( v3.mul( s ) ) ) ) ).add( r.mul( t1.mul( v4.mul( s1 ).add( v5.mul( s ) ) ).add( t.mul( v6.mul( s1 ).add( v7.mul( s ) ) ) ) ) );
|
|
116
|
+
|
|
117
|
+
} );
|
|
118
|
+
|
|
119
|
+
const mx_trilerp = overloadingFn( [ mx_trilerp_0, mx_trilerp_1 ] );
|
|
120
|
+
|
|
121
|
+
const mx_gradient_float_0 = tslFn( ( [ hash_immutable, x_immutable, y_immutable ] ) => {
|
|
122
|
+
|
|
123
|
+
const y = float( y_immutable ).toVar();
|
|
124
|
+
const x = float( x_immutable ).toVar();
|
|
125
|
+
const hash = uint( hash_immutable ).toVar();
|
|
126
|
+
const h = uint( hash.bitAnd( uint( 7 ) ) ).toVar();
|
|
127
|
+
const u = float( mx_select( h.lessThan( uint( 4 ) ), x, y ) ).toVar();
|
|
128
|
+
const v = float( mul( 2.0, mx_select( h.lessThan( uint( 4 ) ), y, x ) ) ).toVar();
|
|
129
|
+
|
|
130
|
+
return mx_negate_if( u, bool( h.bitAnd( uint( 1 ) ) ) ).add( mx_negate_if( v, bool( h.bitAnd( uint( 2 ) ) ) ) );
|
|
131
|
+
|
|
132
|
+
} );
|
|
133
|
+
|
|
134
|
+
const mx_gradient_float_1 = tslFn( ( [ hash_immutable, x_immutable, y_immutable, z_immutable ] ) => {
|
|
135
|
+
|
|
136
|
+
const z = float( z_immutable ).toVar();
|
|
137
|
+
const y = float( y_immutable ).toVar();
|
|
138
|
+
const x = float( x_immutable ).toVar();
|
|
139
|
+
const hash = uint( hash_immutable ).toVar();
|
|
140
|
+
const h = uint( hash.bitAnd( uint( 15 ) ) ).toVar();
|
|
141
|
+
const u = float( mx_select( h.lessThan( uint( 8 ) ), x, y ) ).toVar();
|
|
142
|
+
const v = float( mx_select( h.lessThan( uint( 4 ) ), y, mx_select( h.equal( uint( 12 ) ).or( h.equal( uint( 14 ) ) ), x, z ) ) ).toVar();
|
|
143
|
+
|
|
144
|
+
return mx_negate_if( u, bool( h.bitAnd( uint( 1 ) ) ) ).add( mx_negate_if( v, bool( h.bitAnd( uint( 2 ) ) ) ) );
|
|
145
|
+
|
|
146
|
+
} );
|
|
147
|
+
|
|
148
|
+
const mx_gradient_float = overloadingFn( [ mx_gradient_float_0, mx_gradient_float_1 ] );
|
|
149
|
+
|
|
150
|
+
const mx_gradient_vec3_0 = tslFn( ( [ hash_immutable, x_immutable, y_immutable ] ) => {
|
|
151
|
+
|
|
152
|
+
const y = float( y_immutable ).toVar();
|
|
153
|
+
const x = float( x_immutable ).toVar();
|
|
154
|
+
const hash = uvec3( hash_immutable ).toVar();
|
|
155
|
+
|
|
156
|
+
return vec3( mx_gradient_float( hash.x, x, y ), mx_gradient_float( hash.y, x, y ), mx_gradient_float( hash.z, x, y ) );
|
|
157
|
+
|
|
158
|
+
} );
|
|
159
|
+
|
|
160
|
+
const mx_gradient_vec3_1 = tslFn( ( [ hash_immutable, x_immutable, y_immutable, z_immutable ] ) => {
|
|
161
|
+
|
|
162
|
+
const z = float( z_immutable ).toVar();
|
|
163
|
+
const y = float( y_immutable ).toVar();
|
|
164
|
+
const x = float( x_immutable ).toVar();
|
|
165
|
+
const hash = uvec3( hash_immutable ).toVar();
|
|
166
|
+
|
|
167
|
+
return vec3( mx_gradient_float( hash.x, x, y, z ), mx_gradient_float( hash.y, x, y, z ), mx_gradient_float( hash.z, x, y, z ) );
|
|
168
|
+
|
|
169
|
+
} );
|
|
170
|
+
|
|
171
|
+
const mx_gradient_vec3 = overloadingFn( [ mx_gradient_vec3_0, mx_gradient_vec3_1 ] );
|
|
172
|
+
|
|
173
|
+
const mx_gradient_scale2d_0 = tslFn( ( [ v_immutable ] ) => {
|
|
174
|
+
|
|
175
|
+
const v = float( v_immutable ).toVar();
|
|
176
|
+
|
|
177
|
+
return mul( 0.6616, v );
|
|
178
|
+
|
|
179
|
+
} );
|
|
180
|
+
|
|
181
|
+
const mx_gradient_scale3d_0 = tslFn( ( [ v_immutable ] ) => {
|
|
182
|
+
|
|
183
|
+
const v = float( v_immutable ).toVar();
|
|
184
|
+
|
|
185
|
+
return mul( 0.9820, v );
|
|
186
|
+
|
|
187
|
+
} );
|
|
188
|
+
|
|
189
|
+
const mx_gradient_scale2d_1 = tslFn( ( [ v_immutable ] ) => {
|
|
190
|
+
|
|
191
|
+
const v = vec3( v_immutable ).toVar();
|
|
192
|
+
|
|
193
|
+
return mul( 0.6616, v );
|
|
194
|
+
|
|
195
|
+
} );
|
|
196
|
+
|
|
197
|
+
const mx_gradient_scale2d = overloadingFn( [ mx_gradient_scale2d_0, mx_gradient_scale2d_1 ] );
|
|
198
|
+
|
|
199
|
+
const mx_gradient_scale3d_1 = tslFn( ( [ v_immutable ] ) => {
|
|
200
|
+
|
|
201
|
+
const v = vec3( v_immutable ).toVar();
|
|
202
|
+
|
|
203
|
+
return mul( 0.9820, v );
|
|
204
|
+
|
|
205
|
+
} );
|
|
206
|
+
|
|
207
|
+
const mx_gradient_scale3d = overloadingFn( [ mx_gradient_scale3d_0, mx_gradient_scale3d_1 ] );
|
|
208
|
+
|
|
209
|
+
const mx_rotl32 = tslFn( ( [ x_immutable, k_immutable ] ) => {
|
|
210
|
+
|
|
211
|
+
const k = int( k_immutable ).toVar();
|
|
212
|
+
const x = uint( x_immutable ).toVar();
|
|
213
|
+
|
|
214
|
+
return x.shiftLeft( k ).bitOr( x.shiftRight( int( 32 ).sub( k ) ) );
|
|
215
|
+
|
|
216
|
+
} );
|
|
217
|
+
|
|
218
|
+
const mx_bjmix = tslFn( ( [ a, b, c ] ) => {
|
|
219
|
+
|
|
220
|
+
a.subAssign( c );
|
|
221
|
+
a.bitXorAssign( mx_rotl32( c, int( 4 ) ) );
|
|
222
|
+
c.addAssign( b );
|
|
223
|
+
b.subAssign( a );
|
|
224
|
+
b.bitXorAssign( mx_rotl32( a, int( 6 ) ) );
|
|
225
|
+
a.addAssign( c );
|
|
226
|
+
c.subAssign( b );
|
|
227
|
+
c.bitXorAssign( mx_rotl32( b, int( 8 ) ) );
|
|
228
|
+
b.addAssign( a );
|
|
229
|
+
a.subAssign( c );
|
|
230
|
+
a.bitXorAssign( mx_rotl32( c, int( 16 ) ) );
|
|
231
|
+
c.addAssign( b );
|
|
232
|
+
b.subAssign( a );
|
|
233
|
+
b.bitXorAssign( mx_rotl32( a, int( 19 ) ) );
|
|
234
|
+
a.addAssign( c );
|
|
235
|
+
c.subAssign( b );
|
|
236
|
+
c.bitXorAssign( mx_rotl32( b, int( 4 ) ) );
|
|
237
|
+
b.addAssign( a );
|
|
238
|
+
|
|
239
|
+
} );
|
|
240
|
+
|
|
241
|
+
const mx_bjfinal = tslFn( ( [ a_immutable, b_immutable, c_immutable ] ) => {
|
|
242
|
+
|
|
243
|
+
const c = uint( c_immutable ).toVar();
|
|
244
|
+
const b = uint( b_immutable ).toVar();
|
|
245
|
+
const a = uint( a_immutable ).toVar();
|
|
246
|
+
c.bitXorAssign( b );
|
|
247
|
+
c.subAssign( mx_rotl32( b, int( 14 ) ) );
|
|
248
|
+
a.bitXorAssign( c );
|
|
249
|
+
a.subAssign( mx_rotl32( c, int( 11 ) ) );
|
|
250
|
+
b.bitXorAssign( a );
|
|
251
|
+
b.subAssign( mx_rotl32( a, int( 25 ) ) );
|
|
252
|
+
c.bitXorAssign( b );
|
|
253
|
+
c.subAssign( mx_rotl32( b, int( 16 ) ) );
|
|
254
|
+
a.bitXorAssign( c );
|
|
255
|
+
a.subAssign( mx_rotl32( c, int( 4 ) ) );
|
|
256
|
+
b.bitXorAssign( a );
|
|
257
|
+
b.subAssign( mx_rotl32( a, int( 14 ) ) );
|
|
258
|
+
c.bitXorAssign( b );
|
|
259
|
+
c.subAssign( mx_rotl32( b, int( 24 ) ) );
|
|
260
|
+
|
|
261
|
+
return c;
|
|
262
|
+
|
|
263
|
+
} );
|
|
264
|
+
|
|
265
|
+
const mx_bits_to_01 = tslFn( ( [ bits_immutable ] ) => {
|
|
266
|
+
|
|
267
|
+
const bits = uint( bits_immutable ).toVar();
|
|
268
|
+
|
|
269
|
+
return float( bits ).div( float( uint( int( 0xffffffff ) ) ) );
|
|
270
|
+
|
|
271
|
+
} );
|
|
272
|
+
|
|
273
|
+
const mx_fade = tslFn( ( [ t_immutable ] ) => {
|
|
274
|
+
|
|
275
|
+
const t = float( t_immutable ).toVar();
|
|
276
|
+
|
|
277
|
+
return t.mul( t.mul( t.mul( t.mul( t.mul( 6.0 ).sub( 15.0 ) ).add( 10.0 ) ) ) );
|
|
278
|
+
|
|
279
|
+
} );
|
|
280
|
+
|
|
281
|
+
const mx_hash_int_0 = tslFn( ( [ x_immutable ] ) => {
|
|
282
|
+
|
|
283
|
+
const x = int( x_immutable ).toVar();
|
|
284
|
+
const len = uint( uint( 1 ) ).toVar();
|
|
285
|
+
const seed = uint( uint( int( 0xdeadbeef ) ).add( len.shiftLeft( uint( 2 ) ).add( uint( 13 ) ) ) ).toVar();
|
|
286
|
+
|
|
287
|
+
return mx_bjfinal( seed.add( uint( x ) ), seed, seed );
|
|
288
|
+
|
|
289
|
+
} );
|
|
290
|
+
|
|
291
|
+
const mx_hash_int_1 = tslFn( ( [ x_immutable, y_immutable ] ) => {
|
|
292
|
+
|
|
293
|
+
const y = int( y_immutable ).toVar();
|
|
294
|
+
const x = int( x_immutable ).toVar();
|
|
295
|
+
const len = uint( uint( 2 ) ).toVar();
|
|
296
|
+
const a = uint().toVar(), b = uint().toVar(), c = uint().toVar();
|
|
297
|
+
a.assign( b.assign( c.assign( uint( int( 0xdeadbeef ) ).add( len.shiftLeft( uint( 2 ) ).add( uint( 13 ) ) ) ) ) );
|
|
298
|
+
a.addAssign( uint( x ) );
|
|
299
|
+
b.addAssign( uint( y ) );
|
|
300
|
+
|
|
301
|
+
return mx_bjfinal( a, b, c );
|
|
302
|
+
|
|
303
|
+
} );
|
|
304
|
+
|
|
305
|
+
const mx_hash_int_2 = tslFn( ( [ x_immutable, y_immutable, z_immutable ] ) => {
|
|
306
|
+
|
|
307
|
+
const z = int( z_immutable ).toVar();
|
|
308
|
+
const y = int( y_immutable ).toVar();
|
|
309
|
+
const x = int( x_immutable ).toVar();
|
|
310
|
+
const len = uint( uint( 3 ) ).toVar();
|
|
311
|
+
const a = uint().toVar(), b = uint().toVar(), c = uint().toVar();
|
|
312
|
+
a.assign( b.assign( c.assign( uint( int( 0xdeadbeef ) ).add( len.shiftLeft( uint( 2 ) ).add( uint( 13 ) ) ) ) ) );
|
|
313
|
+
a.addAssign( uint( x ) );
|
|
314
|
+
b.addAssign( uint( y ) );
|
|
315
|
+
c.addAssign( uint( z ) );
|
|
316
|
+
|
|
317
|
+
return mx_bjfinal( a, b, c );
|
|
318
|
+
|
|
319
|
+
} );
|
|
320
|
+
|
|
321
|
+
const mx_hash_int_3 = tslFn( ( [ x_immutable, y_immutable, z_immutable, xx_immutable ] ) => {
|
|
322
|
+
|
|
323
|
+
const xx = int( xx_immutable ).toVar();
|
|
324
|
+
const z = int( z_immutable ).toVar();
|
|
325
|
+
const y = int( y_immutable ).toVar();
|
|
326
|
+
const x = int( x_immutable ).toVar();
|
|
327
|
+
const len = uint( uint( 4 ) ).toVar();
|
|
328
|
+
const a = uint().toVar(), b = uint().toVar(), c = uint().toVar();
|
|
329
|
+
a.assign( b.assign( c.assign( uint( int( 0xdeadbeef ) ).add( len.shiftLeft( uint( 2 ) ).add( uint( 13 ) ) ) ) ) );
|
|
330
|
+
a.addAssign( uint( x ) );
|
|
331
|
+
b.addAssign( uint( y ) );
|
|
332
|
+
c.addAssign( uint( z ) );
|
|
333
|
+
mx_bjmix( a, b, c );
|
|
334
|
+
a.addAssign( uint( xx ) );
|
|
335
|
+
|
|
336
|
+
return mx_bjfinal( a, b, c );
|
|
337
|
+
|
|
338
|
+
} );
|
|
339
|
+
|
|
340
|
+
const mx_hash_int_4 = tslFn( ( [ x_immutable, y_immutable, z_immutable, xx_immutable, yy_immutable ] ) => {
|
|
341
|
+
|
|
342
|
+
const yy = int( yy_immutable ).toVar();
|
|
343
|
+
const xx = int( xx_immutable ).toVar();
|
|
344
|
+
const z = int( z_immutable ).toVar();
|
|
345
|
+
const y = int( y_immutable ).toVar();
|
|
346
|
+
const x = int( x_immutable ).toVar();
|
|
347
|
+
const len = uint( uint( 5 ) ).toVar();
|
|
348
|
+
const a = uint().toVar(), b = uint().toVar(), c = uint().toVar();
|
|
349
|
+
a.assign( b.assign( c.assign( uint( int( 0xdeadbeef ) ).add( len.shiftLeft( uint( 2 ) ).add( uint( 13 ) ) ) ) ) );
|
|
350
|
+
a.addAssign( uint( x ) );
|
|
351
|
+
b.addAssign( uint( y ) );
|
|
352
|
+
c.addAssign( uint( z ) );
|
|
353
|
+
mx_bjmix( a, b, c );
|
|
354
|
+
a.addAssign( uint( xx ) );
|
|
355
|
+
b.addAssign( uint( yy ) );
|
|
356
|
+
|
|
357
|
+
return mx_bjfinal( a, b, c );
|
|
358
|
+
|
|
359
|
+
} );
|
|
360
|
+
|
|
361
|
+
const mx_hash_int = overloadingFn( [ mx_hash_int_0, mx_hash_int_1, mx_hash_int_2, mx_hash_int_3, mx_hash_int_4 ] );
|
|
362
|
+
|
|
363
|
+
const mx_hash_vec3_0 = tslFn( ( [ x_immutable, y_immutable ] ) => {
|
|
364
|
+
|
|
365
|
+
const y = int( y_immutable ).toVar();
|
|
366
|
+
const x = int( x_immutable ).toVar();
|
|
367
|
+
const h = uint( mx_hash_int( x, y ) ).toVar();
|
|
368
|
+
const result = uvec3().toVar();
|
|
369
|
+
result.x.assign( h.bitAnd( int( 0xFF ) ) );
|
|
370
|
+
result.y.assign( h.shiftRight( int( 8 ) ).bitAnd( int( 0xFF ) ) );
|
|
371
|
+
result.z.assign( h.shiftRight( int( 16 ) ).bitAnd( int( 0xFF ) ) );
|
|
372
|
+
|
|
373
|
+
return result;
|
|
374
|
+
|
|
375
|
+
} );
|
|
376
|
+
|
|
377
|
+
const mx_hash_vec3_1 = tslFn( ( [ x_immutable, y_immutable, z_immutable ] ) => {
|
|
378
|
+
|
|
379
|
+
const z = int( z_immutable ).toVar();
|
|
380
|
+
const y = int( y_immutable ).toVar();
|
|
381
|
+
const x = int( x_immutable ).toVar();
|
|
382
|
+
const h = uint( mx_hash_int( x, y, z ) ).toVar();
|
|
383
|
+
const result = uvec3().toVar();
|
|
384
|
+
result.x.assign( h.bitAnd( int( 0xFF ) ) );
|
|
385
|
+
result.y.assign( h.shiftRight( int( 8 ) ).bitAnd( int( 0xFF ) ) );
|
|
386
|
+
result.z.assign( h.shiftRight( int( 16 ) ).bitAnd( int( 0xFF ) ) );
|
|
387
|
+
|
|
388
|
+
return result;
|
|
389
|
+
|
|
390
|
+
} );
|
|
391
|
+
|
|
392
|
+
const mx_hash_vec3 = overloadingFn( [ mx_hash_vec3_0, mx_hash_vec3_1 ] );
|
|
393
|
+
|
|
394
|
+
const mx_perlin_noise_float_0 = tslFn( ( [ p_immutable ] ) => {
|
|
395
|
+
|
|
396
|
+
const p = vec2( p_immutable ).toVar();
|
|
397
|
+
const X = int().toVar(), Y = int().toVar();
|
|
398
|
+
const fx = float( mx_floorfrac( p.x, X ) ).toVar();
|
|
399
|
+
const fy = float( mx_floorfrac( p.y, Y ) ).toVar();
|
|
400
|
+
const u = float( mx_fade( fx ) ).toVar();
|
|
401
|
+
const v = float( mx_fade( fy ) ).toVar();
|
|
402
|
+
const result = float( mx_bilerp( mx_gradient_float( mx_hash_int( X, Y ), fx, fy ), mx_gradient_float( mx_hash_int( X.add( int( 1 ) ), Y ), fx.sub( 1.0 ), fy ), mx_gradient_float( mx_hash_int( X, Y.add( int( 1 ) ) ), fx, fy.sub( 1.0 ) ), mx_gradient_float( mx_hash_int( X.add( int( 1 ) ), Y.add( int( 1 ) ) ), fx.sub( 1.0 ), fy.sub( 1.0 ) ), u, v ) ).toVar();
|
|
403
|
+
|
|
404
|
+
return mx_gradient_scale2d( result );
|
|
405
|
+
|
|
406
|
+
} );
|
|
407
|
+
|
|
408
|
+
const mx_perlin_noise_float_1 = tslFn( ( [ p_immutable ] ) => {
|
|
409
|
+
|
|
410
|
+
const p = vec3( p_immutable ).toVar();
|
|
411
|
+
const X = int().toVar(), Y = int().toVar(), Z = int().toVar();
|
|
412
|
+
const fx = float( mx_floorfrac( p.x, X ) ).toVar();
|
|
413
|
+
const fy = float( mx_floorfrac( p.y, Y ) ).toVar();
|
|
414
|
+
const fz = float( mx_floorfrac( p.z, Z ) ).toVar();
|
|
415
|
+
const u = float( mx_fade( fx ) ).toVar();
|
|
416
|
+
const v = float( mx_fade( fy ) ).toVar();
|
|
417
|
+
const w = float( mx_fade( fz ) ).toVar();
|
|
418
|
+
const result = float( mx_trilerp( mx_gradient_float( mx_hash_int( X, Y, Z ), fx, fy, fz ), mx_gradient_float( mx_hash_int( X.add( int( 1 ) ), Y, Z ), fx.sub( 1.0 ), fy, fz ), mx_gradient_float( mx_hash_int( X, Y.add( int( 1 ) ), Z ), fx, fy.sub( 1.0 ), fz ), mx_gradient_float( mx_hash_int( X.add( int( 1 ) ), Y.add( int( 1 ) ), Z ), fx.sub( 1.0 ), fy.sub( 1.0 ), fz ), mx_gradient_float( mx_hash_int( X, Y, Z.add( int( 1 ) ) ), fx, fy, fz.sub( 1.0 ) ), mx_gradient_float( mx_hash_int( X.add( int( 1 ) ), Y, Z.add( int( 1 ) ) ), fx.sub( 1.0 ), fy, fz.sub( 1.0 ) ), mx_gradient_float( mx_hash_int( X, Y.add( int( 1 ) ), Z.add( int( 1 ) ) ), fx, fy.sub( 1.0 ), fz.sub( 1.0 ) ), mx_gradient_float( mx_hash_int( X.add( int( 1 ) ), Y.add( int( 1 ) ), Z.add( int( 1 ) ) ), fx.sub( 1.0 ), fy.sub( 1.0 ), fz.sub( 1.0 ) ), u, v, w ) ).toVar();
|
|
419
|
+
|
|
420
|
+
return mx_gradient_scale3d( result );
|
|
421
|
+
|
|
422
|
+
} );
|
|
423
|
+
|
|
424
|
+
const mx_perlin_noise_float = overloadingFn( [ mx_perlin_noise_float_0, mx_perlin_noise_float_1 ] );
|
|
425
|
+
|
|
426
|
+
const mx_perlin_noise_vec3_0 = tslFn( ( [ p_immutable ] ) => {
|
|
427
|
+
|
|
428
|
+
const p = vec2( p_immutable ).toVar();
|
|
429
|
+
const X = int().toVar(), Y = int().toVar();
|
|
430
|
+
const fx = float( mx_floorfrac( p.x, X ) ).toVar();
|
|
431
|
+
const fy = float( mx_floorfrac( p.y, Y ) ).toVar();
|
|
432
|
+
const u = float( mx_fade( fx ) ).toVar();
|
|
433
|
+
const v = float( mx_fade( fy ) ).toVar();
|
|
434
|
+
const result = vec3( mx_bilerp( mx_gradient_vec3( mx_hash_vec3( X, Y ), fx, fy ), mx_gradient_vec3( mx_hash_vec3( X.add( int( 1 ) ), Y ), fx.sub( 1.0 ), fy ), mx_gradient_vec3( mx_hash_vec3( X, Y.add( int( 1 ) ) ), fx, fy.sub( 1.0 ) ), mx_gradient_vec3( mx_hash_vec3( X.add( int( 1 ) ), Y.add( int( 1 ) ) ), fx.sub( 1.0 ), fy.sub( 1.0 ) ), u, v ) ).toVar();
|
|
435
|
+
|
|
436
|
+
return mx_gradient_scale2d( result );
|
|
437
|
+
|
|
438
|
+
} );
|
|
439
|
+
|
|
440
|
+
const mx_perlin_noise_vec3_1 = tslFn( ( [ p_immutable ] ) => {
|
|
441
|
+
|
|
442
|
+
const p = vec3( p_immutable ).toVar();
|
|
443
|
+
const X = int().toVar(), Y = int().toVar(), Z = int().toVar();
|
|
444
|
+
const fx = float( mx_floorfrac( p.x, X ) ).toVar();
|
|
445
|
+
const fy = float( mx_floorfrac( p.y, Y ) ).toVar();
|
|
446
|
+
const fz = float( mx_floorfrac( p.z, Z ) ).toVar();
|
|
447
|
+
const u = float( mx_fade( fx ) ).toVar();
|
|
448
|
+
const v = float( mx_fade( fy ) ).toVar();
|
|
449
|
+
const w = float( mx_fade( fz ) ).toVar();
|
|
450
|
+
const result = vec3( mx_trilerp( mx_gradient_vec3( mx_hash_vec3( X, Y, Z ), fx, fy, fz ), mx_gradient_vec3( mx_hash_vec3( X.add( int( 1 ) ), Y, Z ), fx.sub( 1.0 ), fy, fz ), mx_gradient_vec3( mx_hash_vec3( X, Y.add( int( 1 ) ), Z ), fx, fy.sub( 1.0 ), fz ), mx_gradient_vec3( mx_hash_vec3( X.add( int( 1 ) ), Y.add( int( 1 ) ), Z ), fx.sub( 1.0 ), fy.sub( 1.0 ), fz ), mx_gradient_vec3( mx_hash_vec3( X, Y, Z.add( int( 1 ) ) ), fx, fy, fz.sub( 1.0 ) ), mx_gradient_vec3( mx_hash_vec3( X.add( int( 1 ) ), Y, Z.add( int( 1 ) ) ), fx.sub( 1.0 ), fy, fz.sub( 1.0 ) ), mx_gradient_vec3( mx_hash_vec3( X, Y.add( int( 1 ) ), Z.add( int( 1 ) ) ), fx, fy.sub( 1.0 ), fz.sub( 1.0 ) ), mx_gradient_vec3( mx_hash_vec3( X.add( int( 1 ) ), Y.add( int( 1 ) ), Z.add( int( 1 ) ) ), fx.sub( 1.0 ), fy.sub( 1.0 ), fz.sub( 1.0 ) ), u, v, w ) ).toVar();
|
|
451
|
+
|
|
452
|
+
return mx_gradient_scale3d( result );
|
|
453
|
+
|
|
454
|
+
} );
|
|
455
|
+
|
|
456
|
+
const mx_perlin_noise_vec3 = overloadingFn( [ mx_perlin_noise_vec3_0, mx_perlin_noise_vec3_1 ] );
|
|
457
|
+
|
|
458
|
+
const mx_cell_noise_float_0 = tslFn( ( [ p_immutable ] ) => {
|
|
459
|
+
|
|
460
|
+
const p = float( p_immutable ).toVar();
|
|
461
|
+
const ix = int( mx_floor( p ) ).toVar();
|
|
462
|
+
|
|
463
|
+
return mx_bits_to_01( mx_hash_int( ix ) );
|
|
464
|
+
|
|
465
|
+
} );
|
|
466
|
+
|
|
467
|
+
const mx_cell_noise_float_1 = tslFn( ( [ p_immutable ] ) => {
|
|
468
|
+
|
|
469
|
+
const p = vec2( p_immutable ).toVar();
|
|
470
|
+
const ix = int( mx_floor( p.x ) ).toVar();
|
|
471
|
+
const iy = int( mx_floor( p.y ) ).toVar();
|
|
472
|
+
|
|
473
|
+
return mx_bits_to_01( mx_hash_int( ix, iy ) );
|
|
474
|
+
|
|
475
|
+
} );
|
|
476
|
+
|
|
477
|
+
const mx_cell_noise_float_2 = tslFn( ( [ p_immutable ] ) => {
|
|
478
|
+
|
|
479
|
+
const p = vec3( p_immutable ).toVar();
|
|
480
|
+
const ix = int( mx_floor( p.x ) ).toVar();
|
|
481
|
+
const iy = int( mx_floor( p.y ) ).toVar();
|
|
482
|
+
const iz = int( mx_floor( p.z ) ).toVar();
|
|
483
|
+
|
|
484
|
+
return mx_bits_to_01( mx_hash_int( ix, iy, iz ) );
|
|
485
|
+
|
|
486
|
+
} );
|
|
487
|
+
|
|
488
|
+
const mx_cell_noise_float_3 = tslFn( ( [ p_immutable ] ) => {
|
|
489
|
+
|
|
490
|
+
const p = vec4( p_immutable ).toVar();
|
|
491
|
+
const ix = int( mx_floor( p.x ) ).toVar();
|
|
492
|
+
const iy = int( mx_floor( p.y ) ).toVar();
|
|
493
|
+
const iz = int( mx_floor( p.z ) ).toVar();
|
|
494
|
+
const iw = int( mx_floor( p.w ) ).toVar();
|
|
495
|
+
|
|
496
|
+
return mx_bits_to_01( mx_hash_int( ix, iy, iz, iw ) );
|
|
497
|
+
|
|
498
|
+
} );
|
|
499
|
+
|
|
500
|
+
const mx_cell_noise_float = overloadingFn( [ mx_cell_noise_float_0, mx_cell_noise_float_1, mx_cell_noise_float_2, mx_cell_noise_float_3 ] );
|
|
501
|
+
|
|
502
|
+
const mx_cell_noise_vec3_0 = tslFn( ( [ p_immutable ] ) => {
|
|
503
|
+
|
|
504
|
+
const p = float( p_immutable ).toVar();
|
|
505
|
+
const ix = int( mx_floor( p ) ).toVar();
|
|
506
|
+
|
|
507
|
+
return vec3( mx_bits_to_01( mx_hash_int( ix, int( 0 ) ) ), mx_bits_to_01( mx_hash_int( ix, int( 1 ) ) ), mx_bits_to_01( mx_hash_int( ix, int( 2 ) ) ) );
|
|
508
|
+
|
|
509
|
+
} );
|
|
510
|
+
|
|
511
|
+
const mx_cell_noise_vec3_1 = tslFn( ( [ p_immutable ] ) => {
|
|
512
|
+
|
|
513
|
+
const p = vec2( p_immutable ).toVar();
|
|
514
|
+
const ix = int( mx_floor( p.x ) ).toVar();
|
|
515
|
+
const iy = int( mx_floor( p.y ) ).toVar();
|
|
516
|
+
|
|
517
|
+
return vec3( mx_bits_to_01( mx_hash_int( ix, iy, int( 0 ) ) ), mx_bits_to_01( mx_hash_int( ix, iy, int( 1 ) ) ), mx_bits_to_01( mx_hash_int( ix, iy, int( 2 ) ) ) );
|
|
518
|
+
|
|
519
|
+
} );
|
|
520
|
+
|
|
521
|
+
const mx_cell_noise_vec3_2 = tslFn( ( [ p_immutable ] ) => {
|
|
522
|
+
|
|
523
|
+
const p = vec3( p_immutable ).toVar();
|
|
524
|
+
const ix = int( mx_floor( p.x ) ).toVar();
|
|
525
|
+
const iy = int( mx_floor( p.y ) ).toVar();
|
|
526
|
+
const iz = int( mx_floor( p.z ) ).toVar();
|
|
527
|
+
|
|
528
|
+
return vec3( mx_bits_to_01( mx_hash_int( ix, iy, iz, int( 0 ) ) ), mx_bits_to_01( mx_hash_int( ix, iy, iz, int( 1 ) ) ), mx_bits_to_01( mx_hash_int( ix, iy, iz, int( 2 ) ) ) );
|
|
529
|
+
|
|
530
|
+
} );
|
|
531
|
+
|
|
532
|
+
const mx_cell_noise_vec3_3 = tslFn( ( [ p_immutable ] ) => {
|
|
533
|
+
|
|
534
|
+
const p = vec4( p_immutable ).toVar();
|
|
535
|
+
const ix = int( mx_floor( p.x ) ).toVar();
|
|
536
|
+
const iy = int( mx_floor( p.y ) ).toVar();
|
|
537
|
+
const iz = int( mx_floor( p.z ) ).toVar();
|
|
538
|
+
const iw = int( mx_floor( p.w ) ).toVar();
|
|
539
|
+
|
|
540
|
+
return vec3( mx_bits_to_01( mx_hash_int( ix, iy, iz, iw, int( 0 ) ) ), mx_bits_to_01( mx_hash_int( ix, iy, iz, iw, int( 1 ) ) ), mx_bits_to_01( mx_hash_int( ix, iy, iz, iw, int( 2 ) ) ) );
|
|
541
|
+
|
|
542
|
+
} );
|
|
543
|
+
|
|
544
|
+
const mx_cell_noise_vec3 = overloadingFn( [ mx_cell_noise_vec3_0, mx_cell_noise_vec3_1, mx_cell_noise_vec3_2, mx_cell_noise_vec3_3 ] );
|
|
545
|
+
|
|
546
|
+
const mx_fractal_noise_float = tslFn( ( [ p_immutable, octaves_immutable, lacunarity_immutable, diminish_immutable ] ) => {
|
|
547
|
+
|
|
548
|
+
const diminish = float( diminish_immutable ).toVar();
|
|
549
|
+
const lacunarity = float( lacunarity_immutable ).toVar();
|
|
550
|
+
const octaves = int( octaves_immutable ).toVar();
|
|
551
|
+
const p = vec3( p_immutable ).toVar();
|
|
552
|
+
const result = float( 0.0 ).toVar();
|
|
553
|
+
const amplitude = float( 1.0 ).toVar();
|
|
554
|
+
|
|
555
|
+
loop( { start: int( 0 ), end: octaves }, ( { i } ) => {
|
|
556
|
+
|
|
557
|
+
result.addAssign( amplitude.mul( mx_perlin_noise_float( p ) ) );
|
|
558
|
+
amplitude.mulAssign( diminish );
|
|
559
|
+
p.mulAssign( lacunarity );
|
|
560
|
+
|
|
561
|
+
} );
|
|
562
|
+
|
|
563
|
+
return result;
|
|
564
|
+
|
|
565
|
+
} );
|
|
566
|
+
|
|
567
|
+
const mx_fractal_noise_vec3 = tslFn( ( [ p_immutable, octaves_immutable, lacunarity_immutable, diminish_immutable ] ) => {
|
|
568
|
+
|
|
569
|
+
const diminish = float( diminish_immutable ).toVar();
|
|
570
|
+
const lacunarity = float( lacunarity_immutable ).toVar();
|
|
571
|
+
const octaves = int( octaves_immutable ).toVar();
|
|
572
|
+
const p = vec3( p_immutable ).toVar();
|
|
573
|
+
const result = vec3( 0.0 ).toVar();
|
|
574
|
+
const amplitude = float( 1.0 ).toVar();
|
|
575
|
+
|
|
576
|
+
loop( { start: int( 0 ), end: octaves }, ( { i } ) => {
|
|
577
|
+
|
|
578
|
+
result.addAssign( amplitude.mul( mx_perlin_noise_vec3( p ) ) );
|
|
579
|
+
amplitude.mulAssign( diminish );
|
|
580
|
+
p.mulAssign( lacunarity );
|
|
581
|
+
|
|
582
|
+
} );
|
|
583
|
+
|
|
584
|
+
return result;
|
|
585
|
+
|
|
586
|
+
} );
|
|
587
|
+
|
|
588
|
+
const mx_fractal_noise_vec2 = tslFn( ( [ p_immutable, octaves_immutable, lacunarity_immutable, diminish_immutable ] ) => {
|
|
589
|
+
|
|
590
|
+
const diminish = float( diminish_immutable ).toVar();
|
|
591
|
+
const lacunarity = float( lacunarity_immutable ).toVar();
|
|
592
|
+
const octaves = int( octaves_immutable ).toVar();
|
|
593
|
+
const p = vec3( p_immutable ).toVar();
|
|
594
|
+
|
|
595
|
+
return vec2( mx_fractal_noise_float( p, octaves, lacunarity, diminish ), mx_fractal_noise_float( p.add( vec3( int( 19 ), int( 193 ), int( 17 ) ) ), octaves, lacunarity, diminish ) );
|
|
596
|
+
|
|
597
|
+
} );
|
|
598
|
+
|
|
599
|
+
const mx_fractal_noise_vec4 = tslFn( ( [ p_immutable, octaves_immutable, lacunarity_immutable, diminish_immutable ] ) => {
|
|
600
|
+
|
|
601
|
+
const diminish = float( diminish_immutable ).toVar();
|
|
602
|
+
const lacunarity = float( lacunarity_immutable ).toVar();
|
|
603
|
+
const octaves = int( octaves_immutable ).toVar();
|
|
604
|
+
const p = vec3( p_immutable ).toVar();
|
|
605
|
+
const c = vec3( mx_fractal_noise_vec3( p, octaves, lacunarity, diminish ) ).toVar();
|
|
606
|
+
const f = float( mx_fractal_noise_float( p.add( vec3( int( 19 ), int( 193 ), int( 17 ) ) ), octaves, lacunarity, diminish ) ).toVar();
|
|
607
|
+
|
|
608
|
+
return vec4( c, f );
|
|
609
|
+
|
|
610
|
+
} );
|
|
611
|
+
|
|
612
|
+
const mx_worley_distance_0 = tslFn( ( [ p_immutable, x_immutable, y_immutable, xoff_immutable, yoff_immutable, jitter_immutable, metric_immutable ] ) => {
|
|
613
|
+
|
|
614
|
+
const metric = int( metric_immutable ).toVar();
|
|
615
|
+
const jitter = float( jitter_immutable ).toVar();
|
|
616
|
+
const yoff = int( yoff_immutable ).toVar();
|
|
617
|
+
const xoff = int( xoff_immutable ).toVar();
|
|
618
|
+
const y = int( y_immutable ).toVar();
|
|
619
|
+
const x = int( x_immutable ).toVar();
|
|
620
|
+
const p = vec2( p_immutable ).toVar();
|
|
621
|
+
const tmp = vec3( mx_cell_noise_vec3( vec2( x.add( xoff ), y.add( yoff ) ) ) ).toVar();
|
|
622
|
+
const off = vec2( tmp.x, tmp.y ).toVar();
|
|
623
|
+
off.subAssign( 0.5 );
|
|
624
|
+
off.mulAssign( jitter );
|
|
625
|
+
off.addAssign( 0.5 );
|
|
626
|
+
const cellpos = vec2( vec2( float( x ), float( y ) ).add( off ) ).toVar();
|
|
627
|
+
const diff = vec2( cellpos.sub( p ) ).toVar();
|
|
628
|
+
|
|
629
|
+
If( metric.equal( int( 2 ) ), () => {
|
|
630
|
+
|
|
631
|
+
return abs( diff.x ).add( abs( diff.y ) );
|
|
632
|
+
|
|
633
|
+
} );
|
|
634
|
+
|
|
635
|
+
If( metric.equal( int( 3 ) ), () => {
|
|
636
|
+
|
|
637
|
+
return max( abs( diff.x ), abs( diff.y ) );
|
|
638
|
+
|
|
639
|
+
} );
|
|
640
|
+
|
|
641
|
+
return dot( diff, diff );
|
|
642
|
+
|
|
643
|
+
} );
|
|
644
|
+
|
|
645
|
+
const mx_worley_distance_1 = tslFn( ( [ p_immutable, x_immutable, y_immutable, z_immutable, xoff_immutable, yoff_immutable, zoff_immutable, jitter_immutable, metric_immutable ] ) => {
|
|
646
|
+
|
|
647
|
+
const metric = int( metric_immutable ).toVar();
|
|
648
|
+
const jitter = float( jitter_immutable ).toVar();
|
|
649
|
+
const zoff = int( zoff_immutable ).toVar();
|
|
650
|
+
const yoff = int( yoff_immutable ).toVar();
|
|
651
|
+
const xoff = int( xoff_immutable ).toVar();
|
|
652
|
+
const z = int( z_immutable ).toVar();
|
|
653
|
+
const y = int( y_immutable ).toVar();
|
|
654
|
+
const x = int( x_immutable ).toVar();
|
|
655
|
+
const p = vec3( p_immutable ).toVar();
|
|
656
|
+
const off = vec3( mx_cell_noise_vec3( vec3( x.add( xoff ), y.add( yoff ), z.add( zoff ) ) ) ).toVar();
|
|
657
|
+
off.subAssign( 0.5 );
|
|
658
|
+
off.mulAssign( jitter );
|
|
659
|
+
off.addAssign( 0.5 );
|
|
660
|
+
const cellpos = vec3( vec3( float( x ), float( y ), float( z ) ).add( off ) ).toVar();
|
|
661
|
+
const diff = vec3( cellpos.sub( p ) ).toVar();
|
|
662
|
+
|
|
663
|
+
If( metric.equal( int( 2 ) ), () => {
|
|
664
|
+
|
|
665
|
+
return abs( diff.x ).add( abs( diff.y ).add( abs( diff.z ) ) );
|
|
666
|
+
|
|
667
|
+
} );
|
|
668
|
+
|
|
669
|
+
If( metric.equal( int( 3 ) ), () => {
|
|
670
|
+
|
|
671
|
+
return max( max( abs( diff.x ), abs( diff.y ) ), abs( diff.z ) );
|
|
672
|
+
|
|
673
|
+
} );
|
|
674
|
+
|
|
675
|
+
return dot( diff, diff );
|
|
676
|
+
|
|
677
|
+
} );
|
|
678
|
+
|
|
679
|
+
const mx_worley_distance = overloadingFn( [ mx_worley_distance_0, mx_worley_distance_1 ] );
|
|
680
|
+
|
|
681
|
+
const mx_worley_noise_float_0 = tslFn( ( [ p_immutable, jitter_immutable, metric_immutable ] ) => {
|
|
682
|
+
|
|
683
|
+
const metric = int( metric_immutable ).toVar();
|
|
684
|
+
const jitter = float( jitter_immutable ).toVar();
|
|
685
|
+
const p = vec2( p_immutable ).toVar();
|
|
686
|
+
const X = int().toVar(), Y = int().toVar();
|
|
687
|
+
const localpos = vec2( mx_floorfrac( p.x, X ), mx_floorfrac( p.y, Y ) ).toVar();
|
|
688
|
+
const sqdist = float( 1e6 ).toVar();
|
|
689
|
+
|
|
690
|
+
loop( { start: - 1, end: int( 1 ), name: 'x', condition: '<=' }, ( { x } ) => {
|
|
691
|
+
|
|
692
|
+
loop( { start: - 1, end: int( 1 ), name: 'y', condition: '<=' }, ( { y } ) => {
|
|
693
|
+
|
|
694
|
+
const dist = float( mx_worley_distance( localpos, x, y, X, Y, jitter, metric ) ).toVar();
|
|
695
|
+
sqdist.assign( min( sqdist, dist ) );
|
|
696
|
+
|
|
697
|
+
} );
|
|
698
|
+
|
|
699
|
+
} );
|
|
700
|
+
|
|
701
|
+
If( metric.equal( int( 0 ) ), () => {
|
|
702
|
+
|
|
703
|
+
sqdist.assign( sqrt( sqdist ) );
|
|
704
|
+
|
|
705
|
+
} );
|
|
706
|
+
|
|
707
|
+
return sqdist;
|
|
708
|
+
|
|
709
|
+
} );
|
|
710
|
+
|
|
711
|
+
const mx_worley_noise_vec2_0 = tslFn( ( [ p_immutable, jitter_immutable, metric_immutable ] ) => {
|
|
712
|
+
|
|
713
|
+
const metric = int( metric_immutable ).toVar();
|
|
714
|
+
const jitter = float( jitter_immutable ).toVar();
|
|
715
|
+
const p = vec2( p_immutable ).toVar();
|
|
716
|
+
const X = int().toVar(), Y = int().toVar();
|
|
717
|
+
const localpos = vec2( mx_floorfrac( p.x, X ), mx_floorfrac( p.y, Y ) ).toVar();
|
|
718
|
+
const sqdist = vec2( 1e6, 1e6 ).toVar();
|
|
719
|
+
|
|
720
|
+
loop( { start: - 1, end: int( 1 ), name: 'x', condition: '<=' }, ( { x } ) => {
|
|
721
|
+
|
|
722
|
+
loop( { start: - 1, end: int( 1 ), name: 'y', condition: '<=' }, ( { y } ) => {
|
|
723
|
+
|
|
724
|
+
const dist = float( mx_worley_distance( localpos, x, y, X, Y, jitter, metric ) ).toVar();
|
|
725
|
+
|
|
726
|
+
If( dist.lessThan( sqdist.x ), () => {
|
|
727
|
+
|
|
728
|
+
sqdist.y.assign( sqdist.x );
|
|
729
|
+
sqdist.x.assign( dist );
|
|
730
|
+
|
|
731
|
+
} ).elseif( dist.lessThan( sqdist.y ), () => {
|
|
732
|
+
|
|
733
|
+
sqdist.y.assign( dist );
|
|
734
|
+
|
|
735
|
+
} );
|
|
736
|
+
|
|
737
|
+
} );
|
|
738
|
+
|
|
739
|
+
} );
|
|
740
|
+
|
|
741
|
+
If( metric.equal( int( 0 ) ), () => {
|
|
742
|
+
|
|
743
|
+
sqdist.assign( sqrt( sqdist ) );
|
|
744
|
+
|
|
745
|
+
} );
|
|
746
|
+
|
|
747
|
+
return sqdist;
|
|
748
|
+
|
|
749
|
+
} );
|
|
750
|
+
|
|
751
|
+
const mx_worley_noise_vec3_0 = tslFn( ( [ p_immutable, jitter_immutable, metric_immutable ] ) => {
|
|
752
|
+
|
|
753
|
+
const metric = int( metric_immutable ).toVar();
|
|
754
|
+
const jitter = float( jitter_immutable ).toVar();
|
|
755
|
+
const p = vec2( p_immutable ).toVar();
|
|
756
|
+
const X = int().toVar(), Y = int().toVar();
|
|
757
|
+
const localpos = vec2( mx_floorfrac( p.x, X ), mx_floorfrac( p.y, Y ) ).toVar();
|
|
758
|
+
const sqdist = vec3( 1e6, 1e6, 1e6 ).toVar();
|
|
759
|
+
|
|
760
|
+
loop( { start: - 1, end: int( 1 ), name: 'x', condition: '<=' }, ( { x } ) => {
|
|
761
|
+
|
|
762
|
+
loop( { start: - 1, end: int( 1 ), name: 'y', condition: '<=' }, ( { y } ) => {
|
|
763
|
+
|
|
764
|
+
const dist = float( mx_worley_distance( localpos, x, y, X, Y, jitter, metric ) ).toVar();
|
|
765
|
+
|
|
766
|
+
If( dist.lessThan( sqdist.x ), () => {
|
|
767
|
+
|
|
768
|
+
sqdist.z.assign( sqdist.y );
|
|
769
|
+
sqdist.y.assign( sqdist.x );
|
|
770
|
+
sqdist.x.assign( dist );
|
|
771
|
+
|
|
772
|
+
} ).elseif( dist.lessThan( sqdist.y ), () => {
|
|
773
|
+
|
|
774
|
+
sqdist.z.assign( sqdist.y );
|
|
775
|
+
sqdist.y.assign( dist );
|
|
776
|
+
|
|
777
|
+
} ).elseif( dist.lessThan( sqdist.z ), () => {
|
|
778
|
+
|
|
779
|
+
sqdist.z.assign( dist );
|
|
780
|
+
|
|
781
|
+
} );
|
|
782
|
+
|
|
783
|
+
} );
|
|
784
|
+
|
|
785
|
+
} );
|
|
786
|
+
|
|
787
|
+
If( metric.equal( int( 0 ) ), () => {
|
|
788
|
+
|
|
789
|
+
sqdist.assign( sqrt( sqdist ) );
|
|
790
|
+
|
|
791
|
+
} );
|
|
792
|
+
|
|
793
|
+
return sqdist;
|
|
794
|
+
|
|
795
|
+
} );
|
|
796
|
+
|
|
797
|
+
const mx_worley_noise_float_1 = tslFn( ( [ p_immutable, jitter_immutable, metric_immutable ] ) => {
|
|
798
|
+
|
|
799
|
+
const metric = int( metric_immutable ).toVar();
|
|
800
|
+
const jitter = float( jitter_immutable ).toVar();
|
|
801
|
+
const p = vec3( p_immutable ).toVar();
|
|
802
|
+
const X = int().toVar(), Y = int().toVar(), Z = int().toVar();
|
|
803
|
+
const localpos = vec3( mx_floorfrac( p.x, X ), mx_floorfrac( p.y, Y ), mx_floorfrac( p.z, Z ) ).toVar();
|
|
804
|
+
const sqdist = float( 1e6 ).toVar();
|
|
805
|
+
|
|
806
|
+
loop( { start: - 1, end: int( 1 ), name: 'x', condition: '<=' }, ( { x } ) => {
|
|
807
|
+
|
|
808
|
+
loop( { start: - 1, end: int( 1 ), name: 'y', condition: '<=' }, ( { y } ) => {
|
|
809
|
+
|
|
810
|
+
loop( { start: - 1, end: int( 1 ), name: 'z', condition: '<=' }, ( { z } ) => {
|
|
811
|
+
|
|
812
|
+
const dist = float( mx_worley_distance( localpos, x, y, z, X, Y, Z, jitter, metric ) ).toVar();
|
|
813
|
+
sqdist.assign( min( sqdist, dist ) );
|
|
814
|
+
|
|
815
|
+
} );
|
|
816
|
+
|
|
817
|
+
} );
|
|
818
|
+
|
|
819
|
+
} );
|
|
820
|
+
|
|
821
|
+
If( metric.equal( int( 0 ) ), () => {
|
|
822
|
+
|
|
823
|
+
sqdist.assign( sqrt( sqdist ) );
|
|
824
|
+
|
|
825
|
+
} );
|
|
826
|
+
|
|
827
|
+
return sqdist;
|
|
828
|
+
|
|
829
|
+
} );
|
|
830
|
+
|
|
831
|
+
const mx_worley_noise_float = overloadingFn( [ mx_worley_noise_float_0, mx_worley_noise_float_1 ] );
|
|
832
|
+
|
|
833
|
+
const mx_worley_noise_vec2_1 = tslFn( ( [ p_immutable, jitter_immutable, metric_immutable ] ) => {
|
|
834
|
+
|
|
835
|
+
const metric = int( metric_immutable ).toVar();
|
|
836
|
+
const jitter = float( jitter_immutable ).toVar();
|
|
837
|
+
const p = vec3( p_immutable ).toVar();
|
|
838
|
+
const X = int().toVar(), Y = int().toVar(), Z = int().toVar();
|
|
839
|
+
const localpos = vec3( mx_floorfrac( p.x, X ), mx_floorfrac( p.y, Y ), mx_floorfrac( p.z, Z ) ).toVar();
|
|
840
|
+
const sqdist = vec2( 1e6, 1e6 ).toVar();
|
|
841
|
+
|
|
842
|
+
loop( { start: - 1, end: int( 1 ), name: 'x', condition: '<=' }, ( { x } ) => {
|
|
843
|
+
|
|
844
|
+
loop( { start: - 1, end: int( 1 ), name: 'y', condition: '<=' }, ( { y } ) => {
|
|
845
|
+
|
|
846
|
+
loop( { start: - 1, end: int( 1 ), name: 'z', condition: '<=' }, ( { z } ) => {
|
|
847
|
+
|
|
848
|
+
const dist = float( mx_worley_distance( localpos, x, y, z, X, Y, Z, jitter, metric ) ).toVar();
|
|
849
|
+
|
|
850
|
+
If( dist.lessThan( sqdist.x ), () => {
|
|
851
|
+
|
|
852
|
+
sqdist.y.assign( sqdist.x );
|
|
853
|
+
sqdist.x.assign( dist );
|
|
854
|
+
|
|
855
|
+
} ).elseif( dist.lessThan( sqdist.y ), () => {
|
|
856
|
+
|
|
857
|
+
sqdist.y.assign( dist );
|
|
858
|
+
|
|
859
|
+
} );
|
|
860
|
+
|
|
861
|
+
} );
|
|
862
|
+
|
|
863
|
+
} );
|
|
864
|
+
|
|
865
|
+
} );
|
|
866
|
+
|
|
867
|
+
If( metric.equal( int( 0 ) ), () => {
|
|
868
|
+
|
|
869
|
+
sqdist.assign( sqrt( sqdist ) );
|
|
870
|
+
|
|
871
|
+
} );
|
|
872
|
+
|
|
873
|
+
return sqdist;
|
|
874
|
+
|
|
875
|
+
} );
|
|
876
|
+
|
|
877
|
+
const mx_worley_noise_vec2 = overloadingFn( [ mx_worley_noise_vec2_0, mx_worley_noise_vec2_1 ] );
|
|
878
|
+
|
|
879
|
+
const mx_worley_noise_vec3_1 = tslFn( ( [ p_immutable, jitter_immutable, metric_immutable ] ) => {
|
|
880
|
+
|
|
881
|
+
const metric = int( metric_immutable ).toVar();
|
|
882
|
+
const jitter = float( jitter_immutable ).toVar();
|
|
883
|
+
const p = vec3( p_immutable ).toVar();
|
|
884
|
+
const X = int().toVar(), Y = int().toVar(), Z = int().toVar();
|
|
885
|
+
const localpos = vec3( mx_floorfrac( p.x, X ), mx_floorfrac( p.y, Y ), mx_floorfrac( p.z, Z ) ).toVar();
|
|
886
|
+
const sqdist = vec3( 1e6, 1e6, 1e6 ).toVar();
|
|
887
|
+
|
|
888
|
+
loop( { start: - 1, end: int( 1 ), name: 'x', condition: '<=' }, ( { x } ) => {
|
|
889
|
+
|
|
890
|
+
loop( { start: - 1, end: int( 1 ), name: 'y', condition: '<=' }, ( { y } ) => {
|
|
891
|
+
|
|
892
|
+
loop( { start: - 1, end: int( 1 ), name: 'z', condition: '<=' }, ( { z } ) => {
|
|
893
|
+
|
|
894
|
+
const dist = float( mx_worley_distance( localpos, x, y, z, X, Y, Z, jitter, metric ) ).toVar();
|
|
895
|
+
|
|
896
|
+
If( dist.lessThan( sqdist.x ), () => {
|
|
897
|
+
|
|
898
|
+
sqdist.z.assign( sqdist.y );
|
|
899
|
+
sqdist.y.assign( sqdist.x );
|
|
900
|
+
sqdist.x.assign( dist );
|
|
901
|
+
|
|
902
|
+
} ).elseif( dist.lessThan( sqdist.y ), () => {
|
|
903
|
+
|
|
904
|
+
sqdist.z.assign( sqdist.y );
|
|
905
|
+
sqdist.y.assign( dist );
|
|
906
|
+
|
|
907
|
+
} ).elseif( dist.lessThan( sqdist.z ), () => {
|
|
908
|
+
|
|
909
|
+
sqdist.z.assign( dist );
|
|
910
|
+
|
|
911
|
+
} );
|
|
912
|
+
|
|
913
|
+
} );
|
|
914
|
+
|
|
915
|
+
} );
|
|
916
|
+
|
|
917
|
+
} );
|
|
918
|
+
|
|
919
|
+
If( metric.equal( int( 0 ) ), () => {
|
|
920
|
+
|
|
921
|
+
sqdist.assign( sqrt( sqdist ) );
|
|
922
|
+
|
|
923
|
+
} );
|
|
924
|
+
|
|
925
|
+
return sqdist;
|
|
926
|
+
|
|
927
|
+
} );
|
|
928
|
+
|
|
929
|
+
const mx_worley_noise_vec3 = overloadingFn( [ mx_worley_noise_vec3_0, mx_worley_noise_vec3_1 ] );
|
|
930
|
+
|
|
931
|
+
// layouts
|
|
932
|
+
|
|
933
|
+
mx_select.setLayout( {
|
|
934
|
+
name: 'mx_select',
|
|
935
|
+
type: 'float',
|
|
936
|
+
inputs: [
|
|
937
|
+
{ name: 'b', type: 'bool' },
|
|
938
|
+
{ name: 't', type: 'float' },
|
|
939
|
+
{ name: 'f', type: 'float' }
|
|
940
|
+
]
|
|
941
|
+
} );
|
|
942
|
+
|
|
943
|
+
mx_negate_if.setLayout( {
|
|
944
|
+
name: 'mx_negate_if',
|
|
945
|
+
type: 'float',
|
|
946
|
+
inputs: [
|
|
947
|
+
{ name: 'val', type: 'float' },
|
|
948
|
+
{ name: 'b', type: 'bool' }
|
|
949
|
+
]
|
|
950
|
+
} );
|
|
951
|
+
|
|
952
|
+
mx_floor.setLayout( {
|
|
953
|
+
name: 'mx_floor',
|
|
954
|
+
type: 'int',
|
|
955
|
+
inputs: [
|
|
956
|
+
{ name: 'x', type: 'float' }
|
|
957
|
+
]
|
|
958
|
+
} );
|
|
959
|
+
|
|
960
|
+
mx_bilerp_0.setLayout( {
|
|
961
|
+
name: 'mx_bilerp_0',
|
|
962
|
+
type: 'float',
|
|
963
|
+
inputs: [
|
|
964
|
+
{ name: 'v0', type: 'float' },
|
|
965
|
+
{ name: 'v1', type: 'float' },
|
|
966
|
+
{ name: 'v2', type: 'float' },
|
|
967
|
+
{ name: 'v3', type: 'float' },
|
|
968
|
+
{ name: 's', type: 'float' },
|
|
969
|
+
{ name: 't', type: 'float' }
|
|
970
|
+
]
|
|
971
|
+
} );
|
|
972
|
+
|
|
973
|
+
mx_bilerp_1.setLayout( {
|
|
974
|
+
name: 'mx_bilerp_1',
|
|
975
|
+
type: 'vec3',
|
|
976
|
+
inputs: [
|
|
977
|
+
{ name: 'v0', type: 'vec3' },
|
|
978
|
+
{ name: 'v1', type: 'vec3' },
|
|
979
|
+
{ name: 'v2', type: 'vec3' },
|
|
980
|
+
{ name: 'v3', type: 'vec3' },
|
|
981
|
+
{ name: 's', type: 'float' },
|
|
982
|
+
{ name: 't', type: 'float' }
|
|
983
|
+
]
|
|
984
|
+
} );
|
|
985
|
+
|
|
986
|
+
mx_trilerp_0.setLayout( {
|
|
987
|
+
name: 'mx_trilerp_0',
|
|
988
|
+
type: 'float',
|
|
989
|
+
inputs: [
|
|
990
|
+
{ name: 'v0', type: 'float' },
|
|
991
|
+
{ name: 'v1', type: 'float' },
|
|
992
|
+
{ name: 'v2', type: 'float' },
|
|
993
|
+
{ name: 'v3', type: 'float' },
|
|
994
|
+
{ name: 'v4', type: 'float' },
|
|
995
|
+
{ name: 'v5', type: 'float' },
|
|
996
|
+
{ name: 'v6', type: 'float' },
|
|
997
|
+
{ name: 'v7', type: 'float' },
|
|
998
|
+
{ name: 's', type: 'float' },
|
|
999
|
+
{ name: 't', type: 'float' },
|
|
1000
|
+
{ name: 'r', type: 'float' }
|
|
1001
|
+
]
|
|
1002
|
+
} );
|
|
1003
|
+
|
|
1004
|
+
mx_trilerp_1.setLayout( {
|
|
1005
|
+
name: 'mx_trilerp_1',
|
|
1006
|
+
type: 'vec3',
|
|
1007
|
+
inputs: [
|
|
1008
|
+
{ name: 'v0', type: 'vec3' },
|
|
1009
|
+
{ name: 'v1', type: 'vec3' },
|
|
1010
|
+
{ name: 'v2', type: 'vec3' },
|
|
1011
|
+
{ name: 'v3', type: 'vec3' },
|
|
1012
|
+
{ name: 'v4', type: 'vec3' },
|
|
1013
|
+
{ name: 'v5', type: 'vec3' },
|
|
1014
|
+
{ name: 'v6', type: 'vec3' },
|
|
1015
|
+
{ name: 'v7', type: 'vec3' },
|
|
1016
|
+
{ name: 's', type: 'float' },
|
|
1017
|
+
{ name: 't', type: 'float' },
|
|
1018
|
+
{ name: 'r', type: 'float' }
|
|
1019
|
+
]
|
|
1020
|
+
} );
|
|
1021
|
+
|
|
1022
|
+
mx_gradient_float_0.setLayout( {
|
|
1023
|
+
name: 'mx_gradient_float_0',
|
|
1024
|
+
type: 'float',
|
|
1025
|
+
inputs: [
|
|
1026
|
+
{ name: 'hash', type: 'uint' },
|
|
1027
|
+
{ name: 'x', type: 'float' },
|
|
1028
|
+
{ name: 'y', type: 'float' }
|
|
1029
|
+
]
|
|
1030
|
+
} );
|
|
1031
|
+
|
|
1032
|
+
mx_gradient_float_1.setLayout( {
|
|
1033
|
+
name: 'mx_gradient_float_1',
|
|
1034
|
+
type: 'float',
|
|
1035
|
+
inputs: [
|
|
1036
|
+
{ name: 'hash', type: 'uint' },
|
|
1037
|
+
{ name: 'x', type: 'float' },
|
|
1038
|
+
{ name: 'y', type: 'float' },
|
|
1039
|
+
{ name: 'z', type: 'float' }
|
|
1040
|
+
]
|
|
1041
|
+
} );
|
|
1042
|
+
|
|
1043
|
+
mx_gradient_vec3_0.setLayout( {
|
|
1044
|
+
name: 'mx_gradient_vec3_0',
|
|
1045
|
+
type: 'vec3',
|
|
1046
|
+
inputs: [
|
|
1047
|
+
{ name: 'hash', type: 'uvec3' },
|
|
1048
|
+
{ name: 'x', type: 'float' },
|
|
1049
|
+
{ name: 'y', type: 'float' }
|
|
1050
|
+
]
|
|
1051
|
+
} );
|
|
1052
|
+
|
|
1053
|
+
mx_gradient_vec3_1.setLayout( {
|
|
1054
|
+
name: 'mx_gradient_vec3_1',
|
|
1055
|
+
type: 'vec3',
|
|
1056
|
+
inputs: [
|
|
1057
|
+
{ name: 'hash', type: 'uvec3' },
|
|
1058
|
+
{ name: 'x', type: 'float' },
|
|
1059
|
+
{ name: 'y', type: 'float' },
|
|
1060
|
+
{ name: 'z', type: 'float' }
|
|
1061
|
+
]
|
|
1062
|
+
} );
|
|
1063
|
+
|
|
1064
|
+
mx_gradient_scale2d_0.setLayout( {
|
|
1065
|
+
name: 'mx_gradient_scale2d_0',
|
|
1066
|
+
type: 'float',
|
|
1067
|
+
inputs: [
|
|
1068
|
+
{ name: 'v', type: 'float' }
|
|
1069
|
+
]
|
|
1070
|
+
} );
|
|
1071
|
+
|
|
1072
|
+
mx_gradient_scale3d_0.setLayout( {
|
|
1073
|
+
name: 'mx_gradient_scale3d_0',
|
|
1074
|
+
type: 'float',
|
|
1075
|
+
inputs: [
|
|
1076
|
+
{ name: 'v', type: 'float' }
|
|
1077
|
+
]
|
|
1078
|
+
} );
|
|
1079
|
+
|
|
1080
|
+
mx_gradient_scale2d_1.setLayout( {
|
|
1081
|
+
name: 'mx_gradient_scale2d_1',
|
|
1082
|
+
type: 'vec3',
|
|
1083
|
+
inputs: [
|
|
1084
|
+
{ name: 'v', type: 'vec3' }
|
|
1085
|
+
]
|
|
1086
|
+
} );
|
|
1087
|
+
|
|
1088
|
+
mx_gradient_scale3d_1.setLayout( {
|
|
1089
|
+
name: 'mx_gradient_scale3d_1',
|
|
1090
|
+
type: 'vec3',
|
|
1091
|
+
inputs: [
|
|
1092
|
+
{ name: 'v', type: 'vec3' }
|
|
1093
|
+
]
|
|
1094
|
+
} );
|
|
1095
|
+
|
|
1096
|
+
mx_rotl32.setLayout( {
|
|
1097
|
+
name: 'mx_rotl32',
|
|
1098
|
+
type: 'uint',
|
|
1099
|
+
inputs: [
|
|
1100
|
+
{ name: 'x', type: 'uint' },
|
|
1101
|
+
{ name: 'k', type: 'int' }
|
|
1102
|
+
]
|
|
1103
|
+
} );
|
|
1104
|
+
|
|
1105
|
+
mx_bjfinal.setLayout( {
|
|
1106
|
+
name: 'mx_bjfinal',
|
|
1107
|
+
type: 'uint',
|
|
1108
|
+
inputs: [
|
|
1109
|
+
{ name: 'a', type: 'uint' },
|
|
1110
|
+
{ name: 'b', type: 'uint' },
|
|
1111
|
+
{ name: 'c', type: 'uint' }
|
|
1112
|
+
]
|
|
1113
|
+
} );
|
|
1114
|
+
|
|
1115
|
+
mx_bits_to_01.setLayout( {
|
|
1116
|
+
name: 'mx_bits_to_01',
|
|
1117
|
+
type: 'float',
|
|
1118
|
+
inputs: [
|
|
1119
|
+
{ name: 'bits', type: 'uint' }
|
|
1120
|
+
]
|
|
1121
|
+
} );
|
|
1122
|
+
|
|
1123
|
+
mx_fade.setLayout( {
|
|
1124
|
+
name: 'mx_fade',
|
|
1125
|
+
type: 'float',
|
|
1126
|
+
inputs: [
|
|
1127
|
+
{ name: 't', type: 'float' }
|
|
1128
|
+
]
|
|
1129
|
+
} );
|
|
1130
|
+
|
|
1131
|
+
mx_hash_int_0.setLayout( {
|
|
1132
|
+
name: 'mx_hash_int_0',
|
|
1133
|
+
type: 'uint',
|
|
1134
|
+
inputs: [
|
|
1135
|
+
{ name: 'x', type: 'int' }
|
|
1136
|
+
]
|
|
1137
|
+
} );
|
|
1138
|
+
|
|
1139
|
+
mx_hash_int_1.setLayout( {
|
|
1140
|
+
name: 'mx_hash_int_1',
|
|
1141
|
+
type: 'uint',
|
|
1142
|
+
inputs: [
|
|
1143
|
+
{ name: 'x', type: 'int' },
|
|
1144
|
+
{ name: 'y', type: 'int' }
|
|
1145
|
+
]
|
|
1146
|
+
} );
|
|
1147
|
+
|
|
1148
|
+
mx_hash_int_2.setLayout( {
|
|
1149
|
+
name: 'mx_hash_int_2',
|
|
1150
|
+
type: 'uint',
|
|
1151
|
+
inputs: [
|
|
1152
|
+
{ name: 'x', type: 'int' },
|
|
1153
|
+
{ name: 'y', type: 'int' },
|
|
1154
|
+
{ name: 'z', type: 'int' }
|
|
1155
|
+
]
|
|
1156
|
+
} );
|
|
1157
|
+
|
|
1158
|
+
mx_hash_int_3.setLayout( {
|
|
1159
|
+
name: 'mx_hash_int_3',
|
|
1160
|
+
type: 'uint',
|
|
1161
|
+
inputs: [
|
|
1162
|
+
{ name: 'x', type: 'int' },
|
|
1163
|
+
{ name: 'y', type: 'int' },
|
|
1164
|
+
{ name: 'z', type: 'int' },
|
|
1165
|
+
{ name: 'xx', type: 'int' }
|
|
1166
|
+
]
|
|
1167
|
+
} );
|
|
1168
|
+
|
|
1169
|
+
mx_hash_int_4.setLayout( {
|
|
1170
|
+
name: 'mx_hash_int_4',
|
|
1171
|
+
type: 'uint',
|
|
1172
|
+
inputs: [
|
|
1173
|
+
{ name: 'x', type: 'int' },
|
|
1174
|
+
{ name: 'y', type: 'int' },
|
|
1175
|
+
{ name: 'z', type: 'int' },
|
|
1176
|
+
{ name: 'xx', type: 'int' },
|
|
1177
|
+
{ name: 'yy', type: 'int' }
|
|
1178
|
+
]
|
|
1179
|
+
} );
|
|
1180
|
+
|
|
1181
|
+
mx_hash_vec3_0.setLayout( {
|
|
1182
|
+
name: 'mx_hash_vec3_0',
|
|
1183
|
+
type: 'uvec3',
|
|
1184
|
+
inputs: [
|
|
1185
|
+
{ name: 'x', type: 'int' },
|
|
1186
|
+
{ name: 'y', type: 'int' }
|
|
1187
|
+
]
|
|
1188
|
+
} );
|
|
1189
|
+
|
|
1190
|
+
mx_hash_vec3_1.setLayout( {
|
|
1191
|
+
name: 'mx_hash_vec3_1',
|
|
1192
|
+
type: 'uvec3',
|
|
1193
|
+
inputs: [
|
|
1194
|
+
{ name: 'x', type: 'int' },
|
|
1195
|
+
{ name: 'y', type: 'int' },
|
|
1196
|
+
{ name: 'z', type: 'int' }
|
|
1197
|
+
]
|
|
1198
|
+
} );
|
|
1199
|
+
|
|
1200
|
+
mx_perlin_noise_float_0.setLayout( {
|
|
1201
|
+
name: 'mx_perlin_noise_float_0',
|
|
1202
|
+
type: 'float',
|
|
1203
|
+
inputs: [
|
|
1204
|
+
{ name: 'p', type: 'vec2' }
|
|
1205
|
+
]
|
|
1206
|
+
} );
|
|
1207
|
+
|
|
1208
|
+
mx_perlin_noise_float_1.setLayout( {
|
|
1209
|
+
name: 'mx_perlin_noise_float_1',
|
|
1210
|
+
type: 'float',
|
|
1211
|
+
inputs: [
|
|
1212
|
+
{ name: 'p', type: 'vec3' }
|
|
1213
|
+
]
|
|
1214
|
+
} );
|
|
1215
|
+
|
|
1216
|
+
mx_perlin_noise_vec3_0.setLayout( {
|
|
1217
|
+
name: 'mx_perlin_noise_vec3_0',
|
|
1218
|
+
type: 'vec3',
|
|
1219
|
+
inputs: [
|
|
1220
|
+
{ name: 'p', type: 'vec2' }
|
|
1221
|
+
]
|
|
1222
|
+
} );
|
|
1223
|
+
|
|
1224
|
+
mx_perlin_noise_vec3_1.setLayout( {
|
|
1225
|
+
name: 'mx_perlin_noise_vec3_1',
|
|
1226
|
+
type: 'vec3',
|
|
1227
|
+
inputs: [
|
|
1228
|
+
{ name: 'p', type: 'vec3' }
|
|
1229
|
+
]
|
|
1230
|
+
} );
|
|
1231
|
+
|
|
1232
|
+
mx_cell_noise_float_0.setLayout( {
|
|
1233
|
+
name: 'mx_cell_noise_float_0',
|
|
1234
|
+
type: 'float',
|
|
1235
|
+
inputs: [
|
|
1236
|
+
{ name: 'p', type: 'float' }
|
|
1237
|
+
]
|
|
1238
|
+
} );
|
|
1239
|
+
|
|
1240
|
+
mx_cell_noise_float_1.setLayout( {
|
|
1241
|
+
name: 'mx_cell_noise_float_1',
|
|
1242
|
+
type: 'float',
|
|
1243
|
+
inputs: [
|
|
1244
|
+
{ name: 'p', type: 'vec2' }
|
|
1245
|
+
]
|
|
1246
|
+
} );
|
|
1247
|
+
|
|
1248
|
+
mx_cell_noise_float_2.setLayout( {
|
|
1249
|
+
name: 'mx_cell_noise_float_2',
|
|
1250
|
+
type: 'float',
|
|
1251
|
+
inputs: [
|
|
1252
|
+
{ name: 'p', type: 'vec3' }
|
|
1253
|
+
]
|
|
1254
|
+
} );
|
|
1255
|
+
|
|
1256
|
+
mx_cell_noise_float_3.setLayout( {
|
|
1257
|
+
name: 'mx_cell_noise_float_3',
|
|
1258
|
+
type: 'float',
|
|
1259
|
+
inputs: [
|
|
1260
|
+
{ name: 'p', type: 'vec4' }
|
|
1261
|
+
]
|
|
1262
|
+
} );
|
|
1263
|
+
|
|
1264
|
+
mx_cell_noise_vec3_0.setLayout( {
|
|
1265
|
+
name: 'mx_cell_noise_vec3_0',
|
|
1266
|
+
type: 'vec3',
|
|
1267
|
+
inputs: [
|
|
1268
|
+
{ name: 'p', type: 'float' }
|
|
1269
|
+
]
|
|
1270
|
+
} );
|
|
1271
|
+
|
|
1272
|
+
mx_cell_noise_vec3_1.setLayout( {
|
|
1273
|
+
name: 'mx_cell_noise_vec3_1',
|
|
1274
|
+
type: 'vec3',
|
|
1275
|
+
inputs: [
|
|
1276
|
+
{ name: 'p', type: 'vec2' }
|
|
1277
|
+
]
|
|
1278
|
+
} );
|
|
1279
|
+
|
|
1280
|
+
mx_cell_noise_vec3_2.setLayout( {
|
|
1281
|
+
name: 'mx_cell_noise_vec3_2',
|
|
1282
|
+
type: 'vec3',
|
|
1283
|
+
inputs: [
|
|
1284
|
+
{ name: 'p', type: 'vec3' }
|
|
1285
|
+
]
|
|
1286
|
+
} );
|
|
1287
|
+
|
|
1288
|
+
mx_cell_noise_vec3_3.setLayout( {
|
|
1289
|
+
name: 'mx_cell_noise_vec3_3',
|
|
1290
|
+
type: 'vec3',
|
|
1291
|
+
inputs: [
|
|
1292
|
+
{ name: 'p', type: 'vec4' }
|
|
1293
|
+
]
|
|
1294
|
+
} );
|
|
1295
|
+
|
|
1296
|
+
mx_fractal_noise_float.setLayout( {
|
|
1297
|
+
name: 'mx_fractal_noise_float',
|
|
1298
|
+
type: 'float',
|
|
1299
|
+
inputs: [
|
|
1300
|
+
{ name: 'p', type: 'vec3' },
|
|
1301
|
+
{ name: 'octaves', type: 'int' },
|
|
1302
|
+
{ name: 'lacunarity', type: 'float' },
|
|
1303
|
+
{ name: 'diminish', type: 'float' }
|
|
1304
|
+
]
|
|
1305
|
+
} );
|
|
1306
|
+
|
|
1307
|
+
mx_fractal_noise_vec3.setLayout( {
|
|
1308
|
+
name: 'mx_fractal_noise_vec3',
|
|
1309
|
+
type: 'vec3',
|
|
1310
|
+
inputs: [
|
|
1311
|
+
{ name: 'p', type: 'vec3' },
|
|
1312
|
+
{ name: 'octaves', type: 'int' },
|
|
1313
|
+
{ name: 'lacunarity', type: 'float' },
|
|
1314
|
+
{ name: 'diminish', type: 'float' }
|
|
1315
|
+
]
|
|
1316
|
+
} );
|
|
1317
|
+
|
|
1318
|
+
mx_fractal_noise_vec2.setLayout( {
|
|
1319
|
+
name: 'mx_fractal_noise_vec2',
|
|
1320
|
+
type: 'vec2',
|
|
1321
|
+
inputs: [
|
|
1322
|
+
{ name: 'p', type: 'vec3' },
|
|
1323
|
+
{ name: 'octaves', type: 'int' },
|
|
1324
|
+
{ name: 'lacunarity', type: 'float' },
|
|
1325
|
+
{ name: 'diminish', type: 'float' }
|
|
1326
|
+
]
|
|
1327
|
+
} );
|
|
1328
|
+
|
|
1329
|
+
mx_fractal_noise_vec4.setLayout( {
|
|
1330
|
+
name: 'mx_fractal_noise_vec4',
|
|
1331
|
+
type: 'vec4',
|
|
1332
|
+
inputs: [
|
|
1333
|
+
{ name: 'p', type: 'vec3' },
|
|
1334
|
+
{ name: 'octaves', type: 'int' },
|
|
1335
|
+
{ name: 'lacunarity', type: 'float' },
|
|
1336
|
+
{ name: 'diminish', type: 'float' }
|
|
1337
|
+
]
|
|
1338
|
+
} );
|
|
1339
|
+
|
|
1340
|
+
mx_worley_distance_0.setLayout( {
|
|
1341
|
+
name: 'mx_worley_distance_0',
|
|
1342
|
+
type: 'float',
|
|
1343
|
+
inputs: [
|
|
1344
|
+
{ name: 'p', type: 'vec2' },
|
|
1345
|
+
{ name: 'x', type: 'int' },
|
|
1346
|
+
{ name: 'y', type: 'int' },
|
|
1347
|
+
{ name: 'xoff', type: 'int' },
|
|
1348
|
+
{ name: 'yoff', type: 'int' },
|
|
1349
|
+
{ name: 'jitter', type: 'float' },
|
|
1350
|
+
{ name: 'metric', type: 'int' }
|
|
1351
|
+
]
|
|
1352
|
+
} );
|
|
1353
|
+
|
|
1354
|
+
mx_worley_distance_1.setLayout( {
|
|
1355
|
+
name: 'mx_worley_distance_1',
|
|
1356
|
+
type: 'float',
|
|
1357
|
+
inputs: [
|
|
1358
|
+
{ name: 'p', type: 'vec3' },
|
|
1359
|
+
{ name: 'x', type: 'int' },
|
|
1360
|
+
{ name: 'y', type: 'int' },
|
|
1361
|
+
{ name: 'z', type: 'int' },
|
|
1362
|
+
{ name: 'xoff', type: 'int' },
|
|
1363
|
+
{ name: 'yoff', type: 'int' },
|
|
1364
|
+
{ name: 'zoff', type: 'int' },
|
|
1365
|
+
{ name: 'jitter', type: 'float' },
|
|
1366
|
+
{ name: 'metric', type: 'int' }
|
|
1367
|
+
]
|
|
1368
|
+
} );
|
|
1369
|
+
|
|
1370
|
+
mx_worley_noise_float_0.setLayout( {
|
|
1371
|
+
name: 'mx_worley_noise_float_0',
|
|
1372
|
+
type: 'float',
|
|
1373
|
+
inputs: [
|
|
1374
|
+
{ name: 'p', type: 'vec2' },
|
|
1375
|
+
{ name: 'jitter', type: 'float' },
|
|
1376
|
+
{ name: 'metric', type: 'int' }
|
|
1377
|
+
]
|
|
1378
|
+
} );
|
|
1379
|
+
|
|
1380
|
+
mx_worley_noise_vec2_0.setLayout( {
|
|
1381
|
+
name: 'mx_worley_noise_vec2_0',
|
|
1382
|
+
type: 'vec2',
|
|
1383
|
+
inputs: [
|
|
1384
|
+
{ name: 'p', type: 'vec2' },
|
|
1385
|
+
{ name: 'jitter', type: 'float' },
|
|
1386
|
+
{ name: 'metric', type: 'int' }
|
|
1387
|
+
]
|
|
1388
|
+
} );
|
|
1389
|
+
|
|
1390
|
+
mx_worley_noise_vec3_0.setLayout( {
|
|
1391
|
+
name: 'mx_worley_noise_vec3_0',
|
|
1392
|
+
type: 'vec3',
|
|
1393
|
+
inputs: [
|
|
1394
|
+
{ name: 'p', type: 'vec2' },
|
|
1395
|
+
{ name: 'jitter', type: 'float' },
|
|
1396
|
+
{ name: 'metric', type: 'int' }
|
|
1397
|
+
]
|
|
1398
|
+
} );
|
|
1399
|
+
|
|
1400
|
+
mx_worley_noise_float_1.setLayout( {
|
|
1401
|
+
name: 'mx_worley_noise_float_1',
|
|
1402
|
+
type: 'float',
|
|
1403
|
+
inputs: [
|
|
1404
|
+
{ name: 'p', type: 'vec3' },
|
|
1405
|
+
{ name: 'jitter', type: 'float' },
|
|
1406
|
+
{ name: 'metric', type: 'int' }
|
|
1407
|
+
]
|
|
1408
|
+
} );
|
|
1409
|
+
|
|
1410
|
+
mx_worley_noise_vec2_1.setLayout( {
|
|
1411
|
+
name: 'mx_worley_noise_vec2_1',
|
|
1412
|
+
type: 'vec2',
|
|
1413
|
+
inputs: [
|
|
1414
|
+
{ name: 'p', type: 'vec3' },
|
|
1415
|
+
{ name: 'jitter', type: 'float' },
|
|
1416
|
+
{ name: 'metric', type: 'int' }
|
|
1417
|
+
]
|
|
1418
|
+
} );
|
|
1419
|
+
|
|
1420
|
+
mx_worley_noise_vec3_1.setLayout( {
|
|
1421
|
+
name: 'mx_worley_noise_vec3_1',
|
|
1422
|
+
type: 'vec3',
|
|
1423
|
+
inputs: [
|
|
1424
|
+
{ name: 'p', type: 'vec3' },
|
|
1425
|
+
{ name: 'jitter', type: 'float' },
|
|
1426
|
+
{ name: 'metric', type: 'int' }
|
|
1427
|
+
]
|
|
1428
|
+
} );
|
|
1429
|
+
|
|
1430
|
+
export { mx_select, mx_negate_if, mx_floor, mx_floorfrac, mx_bilerp, mx_trilerp, mx_gradient_float, mx_gradient_vec3, mx_gradient_scale2d, mx_gradient_scale3d, mx_rotl32, mx_bjmix, mx_bjfinal, mx_bits_to_01, mx_fade, mx_hash_int, mx_hash_vec3, mx_perlin_noise_float, mx_perlin_noise_vec3, mx_cell_noise_float, mx_cell_noise_vec3, mx_fractal_noise_float, mx_fractal_noise_vec3, mx_fractal_noise_vec2, mx_fractal_noise_vec4, mx_worley_distance, mx_worley_noise_float, mx_worley_noise_vec2, mx_worley_noise_vec3 };
|