@plastic-software/three 0.167.1 → 0.167.3
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 +17 -8
- package/build/three.module.js +17 -8
- package/build/three.module.min.js +1 -1
- package/build/three.webgpu.js +746 -374
- package/build/three.webgpu.min.js +1 -1
- package/examples/jsm/controls/Controls.js +32 -0
- package/examples/jsm/controls/DragControls.js +260 -132
- package/examples/jsm/transpiler/TSLEncoder.js +8 -8
- package/package.json +1 -1
- package/src/loaders/ObjectLoader.js +3 -3
- package/src/nodes/Nodes.js +3 -2
- package/src/nodes/accessors/BatchNode.js +2 -2
- package/src/nodes/accessors/ClippingNode.js +8 -8
- package/src/nodes/accessors/MorphNode.js +4 -4
- package/src/nodes/accessors/TangentNode.js +2 -2
- package/src/nodes/accessors/Texture3DNode.js +8 -8
- package/src/nodes/accessors/UniformArrayNode.js +5 -3
- package/src/nodes/core/StackNode.js +22 -6
- package/src/nodes/display/AfterImageNode.js +3 -3
- package/src/nodes/display/AnamorphicNode.js +4 -4
- package/src/nodes/display/BleachBypassNode.js +2 -2
- package/src/nodes/display/BlendModeNode.js +8 -8
- package/src/nodes/display/BloomNode.js +9 -9
- package/src/nodes/display/BumpMapNode.js +3 -3
- package/src/nodes/display/ColorAdjustmentNode.js +4 -4
- package/src/nodes/display/ColorSpaceNode.js +3 -3
- package/src/nodes/display/DenoiseNode.js +8 -8
- package/src/nodes/display/DepthOfFieldNode.js +2 -2
- package/src/nodes/display/DotScreenNode.js +3 -3
- package/src/nodes/display/FXAANode.js +11 -11
- package/src/nodes/display/FilmNode.js +2 -2
- package/src/nodes/display/GTAONode.js +9 -9
- package/src/nodes/display/GaussianBlurNode.js +2 -2
- package/src/nodes/display/Lut3DNode.js +2 -2
- package/src/nodes/display/NormalMapNode.js +2 -2
- package/src/nodes/display/PassNode.js +71 -3
- package/src/nodes/display/PixelationPassNode.js +3 -3
- package/src/nodes/display/RGBShiftNode.js +2 -2
- package/src/nodes/display/SepiaNode.js +2 -2
- package/src/nodes/display/SobelOperatorNode.js +2 -2
- package/src/nodes/display/ToneMappingNode.js +13 -13
- package/src/nodes/display/TransitionNode.js +3 -3
- package/src/nodes/functions/BSDF/BRDF_GGX.js +2 -2
- package/src/nodes/functions/BSDF/BRDF_Lambert.js +2 -2
- package/src/nodes/functions/BSDF/BRDF_Sheen.js +4 -4
- package/src/nodes/functions/BSDF/DFGApprox.js +2 -2
- package/src/nodes/functions/BSDF/D_GGX.js +2 -2
- package/src/nodes/functions/BSDF/D_GGX_Anisotropic.js +2 -2
- package/src/nodes/functions/BSDF/EnvironmentBRDF.js +2 -2
- package/src/nodes/functions/BSDF/F_Schlick.js +2 -2
- package/src/nodes/functions/BSDF/LTC.js +6 -6
- package/src/nodes/functions/BSDF/Schlick_to_F0.js +2 -2
- package/src/nodes/functions/BSDF/V_GGX_SmithCorrelated.js +2 -2
- package/src/nodes/functions/BSDF/V_GGX_SmithCorrelated_Anisotropic.js +2 -2
- package/src/nodes/functions/PhongLightingModel.js +3 -3
- package/src/nodes/functions/PhysicalLightingModel.js +18 -18
- package/src/nodes/functions/ToonLightingModel.js +2 -2
- package/src/nodes/functions/material/getGeometryRoughness.js +2 -2
- package/src/nodes/functions/material/getRoughness.js +2 -2
- package/src/nodes/lighting/AnalyticLightNode.js +5 -5
- package/src/nodes/lighting/BasicEnvironmentNode.js +2 -1
- package/src/nodes/lighting/LightProbeNode.js +80 -0
- package/src/nodes/lighting/LightUtils.js +3 -3
- package/src/nodes/materials/InstancedPointsNodeMaterial.js +3 -3
- package/src/nodes/materials/Line2NodeMaterial.js +17 -17
- package/src/nodes/materials/MeshPhysicalNodeMaterial.js +1 -1
- package/src/nodes/materials/VolumeNodeMaterial.js +5 -5
- package/src/nodes/materialx/lib/mx_hsv.js +12 -12
- package/src/nodes/materialx/lib/mx_noise.js +80 -80
- package/src/nodes/materialx/lib/mx_transform_color.js +2 -2
- package/src/nodes/math/CondNode.js +13 -2
- package/src/nodes/math/MathNode.js +2 -2
- package/src/nodes/math/TriNoise3D.js +6 -6
- package/src/nodes/pmrem/PMREMUtils.js +34 -34
- package/src/nodes/procedural/CheckerNode.js +2 -2
- package/src/nodes/shadernode/ShaderNode.js +11 -4
- package/src/nodes/utils/CubeMapNode.js +157 -0
- package/src/nodes/utils/LoopNode.js +10 -4
- package/src/nodes/utils/SpriteUtils.js +2 -2
- package/src/nodes/utils/UVUtils.js +3 -3
- package/src/nodes/utils/ViewportUtils.js +3 -3
- package/src/renderers/WebGLRenderer.js +8 -0
- package/src/renderers/common/RenderContext.js +24 -0
- package/src/renderers/common/RenderObject.js +1 -1
- package/src/renderers/shaders/ShaderChunk/batching_pars_vertex.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/batching_vertex.glsl.js +1 -1
- package/src/renderers/shaders/ShaderLib/linedashed.glsl.js +0 -2
- package/src/renderers/shaders/ShaderLib/points.glsl.js +0 -2
- package/src/renderers/webgl/WebGLPrograms.js +2 -1
- package/src/renderers/webgl-fallback/WebGLBackend.js +31 -27
- package/src/renderers/webgl-fallback/utils/WebGLTextureUtils.js +12 -8
- package/src/renderers/webgpu/WebGPUBackend.js +10 -14
- package/src/renderers/webgpu/nodes/WGSLNodeBuilder.js +30 -2
- package/src/renderers/webgpu/utils/WebGPUConstants.js +2 -1
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
// Three.js Transpiler
|
|
2
2
|
// https://raw.githubusercontent.com/AcademySoftwareFoundation/MaterialX/main/libraries/stdlib/genglsl/lib/mx_noise.glsl
|
|
3
3
|
|
|
4
|
-
import { int, uint, float, vec3, bool, uvec3, vec2, vec4, If,
|
|
5
|
-
import {
|
|
4
|
+
import { int, uint, float, vec3, bool, uvec3, vec2, vec4, If, Fn } from '../../shadernode/ShaderNode.js';
|
|
5
|
+
import { select } from '../../math/CondNode.js';
|
|
6
6
|
import { sub, mul } from '../../math/OperatorNode.js';
|
|
7
7
|
import { floor, abs, max, dot, min, sqrt } from '../../math/MathNode.js';
|
|
8
8
|
import { overloadingFn } from '../../utils/FunctionOverloadingNode.js';
|
|
9
|
-
import {
|
|
9
|
+
import { Loop } from '../../utils/LoopNode.js';
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
export const mx_select = /*#__PURE__*/
|
|
12
|
+
export const mx_select = /*#__PURE__*/ Fn( ( [ b_immutable, t_immutable, f_immutable ] ) => {
|
|
13
13
|
|
|
14
14
|
const f = float( f_immutable ).toVar();
|
|
15
15
|
const t = float( t_immutable ).toVar();
|
|
16
16
|
const b = bool( b_immutable ).toVar();
|
|
17
17
|
|
|
18
|
-
return
|
|
18
|
+
return select( b, t, f );
|
|
19
19
|
|
|
20
20
|
} ).setLayout( {
|
|
21
21
|
name: 'mx_select',
|
|
@@ -27,12 +27,12 @@ export const mx_select = /*#__PURE__*/ tslFn( ( [ b_immutable, t_immutable, f_im
|
|
|
27
27
|
]
|
|
28
28
|
} );
|
|
29
29
|
|
|
30
|
-
export const mx_negate_if = /*#__PURE__*/
|
|
30
|
+
export const mx_negate_if = /*#__PURE__*/ Fn( ( [ val_immutable, b_immutable ] ) => {
|
|
31
31
|
|
|
32
32
|
const b = bool( b_immutable ).toVar();
|
|
33
33
|
const val = float( val_immutable ).toVar();
|
|
34
34
|
|
|
35
|
-
return
|
|
35
|
+
return select( b, val.negate(), val );
|
|
36
36
|
|
|
37
37
|
} ).setLayout( {
|
|
38
38
|
name: 'mx_negate_if',
|
|
@@ -43,7 +43,7 @@ export const mx_negate_if = /*#__PURE__*/ tslFn( ( [ val_immutable, b_immutable
|
|
|
43
43
|
]
|
|
44
44
|
} );
|
|
45
45
|
|
|
46
|
-
export const mx_floor = /*#__PURE__*/
|
|
46
|
+
export const mx_floor = /*#__PURE__*/ Fn( ( [ x_immutable ] ) => {
|
|
47
47
|
|
|
48
48
|
const x = float( x_immutable ).toVar();
|
|
49
49
|
|
|
@@ -57,7 +57,7 @@ export const mx_floor = /*#__PURE__*/ tslFn( ( [ x_immutable ] ) => {
|
|
|
57
57
|
]
|
|
58
58
|
} );
|
|
59
59
|
|
|
60
|
-
export const mx_floorfrac = /*#__PURE__*/
|
|
60
|
+
export const mx_floorfrac = /*#__PURE__*/ Fn( ( [ x_immutable, i ] ) => {
|
|
61
61
|
|
|
62
62
|
const x = float( x_immutable ).toVar();
|
|
63
63
|
i.assign( mx_floor( x ) );
|
|
@@ -66,7 +66,7 @@ export const mx_floorfrac = /*#__PURE__*/ tslFn( ( [ x_immutable, i ] ) => {
|
|
|
66
66
|
|
|
67
67
|
} );
|
|
68
68
|
|
|
69
|
-
export const mx_bilerp_0 = /*#__PURE__*/
|
|
69
|
+
export const mx_bilerp_0 = /*#__PURE__*/ Fn( ( [ v0_immutable, v1_immutable, v2_immutable, v3_immutable, s_immutable, t_immutable ] ) => {
|
|
70
70
|
|
|
71
71
|
const t = float( t_immutable ).toVar();
|
|
72
72
|
const s = float( s_immutable ).toVar();
|
|
@@ -91,7 +91,7 @@ export const mx_bilerp_0 = /*#__PURE__*/ tslFn( ( [ v0_immutable, v1_immutable,
|
|
|
91
91
|
]
|
|
92
92
|
} );
|
|
93
93
|
|
|
94
|
-
export const mx_bilerp_1 = /*#__PURE__*/
|
|
94
|
+
export const mx_bilerp_1 = /*#__PURE__*/ Fn( ( [ v0_immutable, v1_immutable, v2_immutable, v3_immutable, s_immutable, t_immutable ] ) => {
|
|
95
95
|
|
|
96
96
|
const t = float( t_immutable ).toVar();
|
|
97
97
|
const s = float( s_immutable ).toVar();
|
|
@@ -118,7 +118,7 @@ export const mx_bilerp_1 = /*#__PURE__*/ tslFn( ( [ v0_immutable, v1_immutable,
|
|
|
118
118
|
|
|
119
119
|
export const mx_bilerp = /*#__PURE__*/ overloadingFn( [ mx_bilerp_0, mx_bilerp_1 ] );
|
|
120
120
|
|
|
121
|
-
export const mx_trilerp_0 = /*#__PURE__*/
|
|
121
|
+
export const mx_trilerp_0 = /*#__PURE__*/ Fn( ( [ v0_immutable, v1_immutable, v2_immutable, v3_immutable, v4_immutable, v5_immutable, v6_immutable, v7_immutable, s_immutable, t_immutable, r_immutable ] ) => {
|
|
122
122
|
|
|
123
123
|
const r = float( r_immutable ).toVar();
|
|
124
124
|
const t = float( t_immutable ).toVar();
|
|
@@ -155,7 +155,7 @@ export const mx_trilerp_0 = /*#__PURE__*/ tslFn( ( [ v0_immutable, v1_immutable,
|
|
|
155
155
|
]
|
|
156
156
|
} );
|
|
157
157
|
|
|
158
|
-
export const mx_trilerp_1 = /*#__PURE__*/
|
|
158
|
+
export const mx_trilerp_1 = /*#__PURE__*/ Fn( ( [ v0_immutable, v1_immutable, v2_immutable, v3_immutable, v4_immutable, v5_immutable, v6_immutable, v7_immutable, s_immutable, t_immutable, r_immutable ] ) => {
|
|
159
159
|
|
|
160
160
|
const r = float( r_immutable ).toVar();
|
|
161
161
|
const t = float( t_immutable ).toVar();
|
|
@@ -194,7 +194,7 @@ export const mx_trilerp_1 = /*#__PURE__*/ tslFn( ( [ v0_immutable, v1_immutable,
|
|
|
194
194
|
|
|
195
195
|
export const mx_trilerp = /*#__PURE__*/ overloadingFn( [ mx_trilerp_0, mx_trilerp_1 ] );
|
|
196
196
|
|
|
197
|
-
export const mx_gradient_float_0 = /*#__PURE__*/
|
|
197
|
+
export const mx_gradient_float_0 = /*#__PURE__*/ Fn( ( [ hash_immutable, x_immutable, y_immutable ] ) => {
|
|
198
198
|
|
|
199
199
|
const y = float( y_immutable ).toVar();
|
|
200
200
|
const x = float( x_immutable ).toVar();
|
|
@@ -215,7 +215,7 @@ export const mx_gradient_float_0 = /*#__PURE__*/ tslFn( ( [ hash_immutable, x_im
|
|
|
215
215
|
]
|
|
216
216
|
} );
|
|
217
217
|
|
|
218
|
-
export const mx_gradient_float_1 = /*#__PURE__*/
|
|
218
|
+
export const mx_gradient_float_1 = /*#__PURE__*/ Fn( ( [ hash_immutable, x_immutable, y_immutable, z_immutable ] ) => {
|
|
219
219
|
|
|
220
220
|
const z = float( z_immutable ).toVar();
|
|
221
221
|
const y = float( y_immutable ).toVar();
|
|
@@ -240,7 +240,7 @@ export const mx_gradient_float_1 = /*#__PURE__*/ tslFn( ( [ hash_immutable, x_im
|
|
|
240
240
|
|
|
241
241
|
export const mx_gradient_float = /*#__PURE__*/ overloadingFn( [ mx_gradient_float_0, mx_gradient_float_1 ] );
|
|
242
242
|
|
|
243
|
-
export const mx_gradient_vec3_0 = /*#__PURE__*/
|
|
243
|
+
export const mx_gradient_vec3_0 = /*#__PURE__*/ Fn( ( [ hash_immutable, x_immutable, y_immutable ] ) => {
|
|
244
244
|
|
|
245
245
|
const y = float( y_immutable ).toVar();
|
|
246
246
|
const x = float( x_immutable ).toVar();
|
|
@@ -258,7 +258,7 @@ export const mx_gradient_vec3_0 = /*#__PURE__*/ tslFn( ( [ hash_immutable, x_imm
|
|
|
258
258
|
]
|
|
259
259
|
} );
|
|
260
260
|
|
|
261
|
-
export const mx_gradient_vec3_1 = /*#__PURE__*/
|
|
261
|
+
export const mx_gradient_vec3_1 = /*#__PURE__*/ Fn( ( [ hash_immutable, x_immutable, y_immutable, z_immutable ] ) => {
|
|
262
262
|
|
|
263
263
|
const z = float( z_immutable ).toVar();
|
|
264
264
|
const y = float( y_immutable ).toVar();
|
|
@@ -280,7 +280,7 @@ export const mx_gradient_vec3_1 = /*#__PURE__*/ tslFn( ( [ hash_immutable, x_imm
|
|
|
280
280
|
|
|
281
281
|
export const mx_gradient_vec3 = /*#__PURE__*/ overloadingFn( [ mx_gradient_vec3_0, mx_gradient_vec3_1 ] );
|
|
282
282
|
|
|
283
|
-
export const mx_gradient_scale2d_0 = /*#__PURE__*/
|
|
283
|
+
export const mx_gradient_scale2d_0 = /*#__PURE__*/ Fn( ( [ v_immutable ] ) => {
|
|
284
284
|
|
|
285
285
|
const v = float( v_immutable ).toVar();
|
|
286
286
|
|
|
@@ -294,7 +294,7 @@ export const mx_gradient_scale2d_0 = /*#__PURE__*/ tslFn( ( [ v_immutable ] ) =>
|
|
|
294
294
|
]
|
|
295
295
|
} );
|
|
296
296
|
|
|
297
|
-
export const mx_gradient_scale3d_0 = /*#__PURE__*/
|
|
297
|
+
export const mx_gradient_scale3d_0 = /*#__PURE__*/ Fn( ( [ v_immutable ] ) => {
|
|
298
298
|
|
|
299
299
|
const v = float( v_immutable ).toVar();
|
|
300
300
|
|
|
@@ -308,7 +308,7 @@ export const mx_gradient_scale3d_0 = /*#__PURE__*/ tslFn( ( [ v_immutable ] ) =>
|
|
|
308
308
|
]
|
|
309
309
|
} );
|
|
310
310
|
|
|
311
|
-
export const mx_gradient_scale2d_1 = /*#__PURE__*/
|
|
311
|
+
export const mx_gradient_scale2d_1 = /*#__PURE__*/ Fn( ( [ v_immutable ] ) => {
|
|
312
312
|
|
|
313
313
|
const v = vec3( v_immutable ).toVar();
|
|
314
314
|
|
|
@@ -324,7 +324,7 @@ export const mx_gradient_scale2d_1 = /*#__PURE__*/ tslFn( ( [ v_immutable ] ) =>
|
|
|
324
324
|
|
|
325
325
|
export const mx_gradient_scale2d = /*#__PURE__*/ overloadingFn( [ mx_gradient_scale2d_0, mx_gradient_scale2d_1 ] );
|
|
326
326
|
|
|
327
|
-
export const mx_gradient_scale3d_1 = /*#__PURE__*/
|
|
327
|
+
export const mx_gradient_scale3d_1 = /*#__PURE__*/ Fn( ( [ v_immutable ] ) => {
|
|
328
328
|
|
|
329
329
|
const v = vec3( v_immutable ).toVar();
|
|
330
330
|
|
|
@@ -340,7 +340,7 @@ export const mx_gradient_scale3d_1 = /*#__PURE__*/ tslFn( ( [ v_immutable ] ) =>
|
|
|
340
340
|
|
|
341
341
|
export const mx_gradient_scale3d = /*#__PURE__*/ overloadingFn( [ mx_gradient_scale3d_0, mx_gradient_scale3d_1 ] );
|
|
342
342
|
|
|
343
|
-
export const mx_rotl32 = /*#__PURE__*/
|
|
343
|
+
export const mx_rotl32 = /*#__PURE__*/ Fn( ( [ x_immutable, k_immutable ] ) => {
|
|
344
344
|
|
|
345
345
|
const k = int( k_immutable ).toVar();
|
|
346
346
|
const x = uint( x_immutable ).toVar();
|
|
@@ -356,7 +356,7 @@ export const mx_rotl32 = /*#__PURE__*/ tslFn( ( [ x_immutable, k_immutable ] ) =
|
|
|
356
356
|
]
|
|
357
357
|
} );
|
|
358
358
|
|
|
359
|
-
export const mx_bjmix = /*#__PURE__*/
|
|
359
|
+
export const mx_bjmix = /*#__PURE__*/ Fn( ( [ a, b, c ] ) => {
|
|
360
360
|
|
|
361
361
|
a.subAssign( c );
|
|
362
362
|
a.bitXorAssign( mx_rotl32( c, int( 4 ) ) );
|
|
@@ -379,7 +379,7 @@ export const mx_bjmix = /*#__PURE__*/ tslFn( ( [ a, b, c ] ) => {
|
|
|
379
379
|
|
|
380
380
|
} );
|
|
381
381
|
|
|
382
|
-
export const mx_bjfinal = /*#__PURE__*/
|
|
382
|
+
export const mx_bjfinal = /*#__PURE__*/ Fn( ( [ a_immutable, b_immutable, c_immutable ] ) => {
|
|
383
383
|
|
|
384
384
|
const c = uint( c_immutable ).toVar();
|
|
385
385
|
const b = uint( b_immutable ).toVar();
|
|
@@ -411,7 +411,7 @@ export const mx_bjfinal = /*#__PURE__*/ tslFn( ( [ a_immutable, b_immutable, c_i
|
|
|
411
411
|
]
|
|
412
412
|
} );
|
|
413
413
|
|
|
414
|
-
export const mx_bits_to_01 = /*#__PURE__*/
|
|
414
|
+
export const mx_bits_to_01 = /*#__PURE__*/ Fn( ( [ bits_immutable ] ) => {
|
|
415
415
|
|
|
416
416
|
const bits = uint( bits_immutable ).toVar();
|
|
417
417
|
|
|
@@ -425,7 +425,7 @@ export const mx_bits_to_01 = /*#__PURE__*/ tslFn( ( [ bits_immutable ] ) => {
|
|
|
425
425
|
]
|
|
426
426
|
} );
|
|
427
427
|
|
|
428
|
-
export const mx_fade = /*#__PURE__*/
|
|
428
|
+
export const mx_fade = /*#__PURE__*/ Fn( ( [ t_immutable ] ) => {
|
|
429
429
|
|
|
430
430
|
const t = float( t_immutable ).toVar();
|
|
431
431
|
|
|
@@ -439,7 +439,7 @@ export const mx_fade = /*#__PURE__*/ tslFn( ( [ t_immutable ] ) => {
|
|
|
439
439
|
]
|
|
440
440
|
} );
|
|
441
441
|
|
|
442
|
-
export const mx_hash_int_0 = /*#__PURE__*/
|
|
442
|
+
export const mx_hash_int_0 = /*#__PURE__*/ Fn( ( [ x_immutable ] ) => {
|
|
443
443
|
|
|
444
444
|
const x = int( x_immutable ).toVar();
|
|
445
445
|
const len = uint( uint( 1 ) ).toVar();
|
|
@@ -455,7 +455,7 @@ export const mx_hash_int_0 = /*#__PURE__*/ tslFn( ( [ x_immutable ] ) => {
|
|
|
455
455
|
]
|
|
456
456
|
} );
|
|
457
457
|
|
|
458
|
-
export const mx_hash_int_1 = /*#__PURE__*/
|
|
458
|
+
export const mx_hash_int_1 = /*#__PURE__*/ Fn( ( [ x_immutable, y_immutable ] ) => {
|
|
459
459
|
|
|
460
460
|
const y = int( y_immutable ).toVar();
|
|
461
461
|
const x = int( x_immutable ).toVar();
|
|
@@ -476,7 +476,7 @@ export const mx_hash_int_1 = /*#__PURE__*/ tslFn( ( [ x_immutable, y_immutable ]
|
|
|
476
476
|
]
|
|
477
477
|
} );
|
|
478
478
|
|
|
479
|
-
export const mx_hash_int_2 = /*#__PURE__*/
|
|
479
|
+
export const mx_hash_int_2 = /*#__PURE__*/ Fn( ( [ x_immutable, y_immutable, z_immutable ] ) => {
|
|
480
480
|
|
|
481
481
|
const z = int( z_immutable ).toVar();
|
|
482
482
|
const y = int( y_immutable ).toVar();
|
|
@@ -500,7 +500,7 @@ export const mx_hash_int_2 = /*#__PURE__*/ tslFn( ( [ x_immutable, y_immutable,
|
|
|
500
500
|
]
|
|
501
501
|
} );
|
|
502
502
|
|
|
503
|
-
export const mx_hash_int_3 = /*#__PURE__*/
|
|
503
|
+
export const mx_hash_int_3 = /*#__PURE__*/ Fn( ( [ x_immutable, y_immutable, z_immutable, xx_immutable ] ) => {
|
|
504
504
|
|
|
505
505
|
const xx = int( xx_immutable ).toVar();
|
|
506
506
|
const z = int( z_immutable ).toVar();
|
|
@@ -528,7 +528,7 @@ export const mx_hash_int_3 = /*#__PURE__*/ tslFn( ( [ x_immutable, y_immutable,
|
|
|
528
528
|
]
|
|
529
529
|
} );
|
|
530
530
|
|
|
531
|
-
export const mx_hash_int_4 = /*#__PURE__*/
|
|
531
|
+
export const mx_hash_int_4 = /*#__PURE__*/ Fn( ( [ x_immutable, y_immutable, z_immutable, xx_immutable, yy_immutable ] ) => {
|
|
532
532
|
|
|
533
533
|
const yy = int( yy_immutable ).toVar();
|
|
534
534
|
const xx = int( xx_immutable ).toVar();
|
|
@@ -561,7 +561,7 @@ export const mx_hash_int_4 = /*#__PURE__*/ tslFn( ( [ x_immutable, y_immutable,
|
|
|
561
561
|
|
|
562
562
|
export const mx_hash_int = /*#__PURE__*/ overloadingFn( [ mx_hash_int_0, mx_hash_int_1, mx_hash_int_2, mx_hash_int_3, mx_hash_int_4 ] );
|
|
563
563
|
|
|
564
|
-
export const mx_hash_vec3_0 = /*#__PURE__*/
|
|
564
|
+
export const mx_hash_vec3_0 = /*#__PURE__*/ Fn( ( [ x_immutable, y_immutable ] ) => {
|
|
565
565
|
|
|
566
566
|
const y = int( y_immutable ).toVar();
|
|
567
567
|
const x = int( x_immutable ).toVar();
|
|
@@ -582,7 +582,7 @@ export const mx_hash_vec3_0 = /*#__PURE__*/ tslFn( ( [ x_immutable, y_immutable
|
|
|
582
582
|
]
|
|
583
583
|
} );
|
|
584
584
|
|
|
585
|
-
export const mx_hash_vec3_1 = /*#__PURE__*/
|
|
585
|
+
export const mx_hash_vec3_1 = /*#__PURE__*/ Fn( ( [ x_immutable, y_immutable, z_immutable ] ) => {
|
|
586
586
|
|
|
587
587
|
const z = int( z_immutable ).toVar();
|
|
588
588
|
const y = int( y_immutable ).toVar();
|
|
@@ -607,7 +607,7 @@ export const mx_hash_vec3_1 = /*#__PURE__*/ tslFn( ( [ x_immutable, y_immutable,
|
|
|
607
607
|
|
|
608
608
|
export const mx_hash_vec3 = /*#__PURE__*/ overloadingFn( [ mx_hash_vec3_0, mx_hash_vec3_1 ] );
|
|
609
609
|
|
|
610
|
-
export const mx_perlin_noise_float_0 = /*#__PURE__*/
|
|
610
|
+
export const mx_perlin_noise_float_0 = /*#__PURE__*/ Fn( ( [ p_immutable ] ) => {
|
|
611
611
|
|
|
612
612
|
const p = vec2( p_immutable ).toVar();
|
|
613
613
|
const X = int().toVar(), Y = int().toVar();
|
|
@@ -627,7 +627,7 @@ export const mx_perlin_noise_float_0 = /*#__PURE__*/ tslFn( ( [ p_immutable ] )
|
|
|
627
627
|
]
|
|
628
628
|
} );
|
|
629
629
|
|
|
630
|
-
export const mx_perlin_noise_float_1 = /*#__PURE__*/
|
|
630
|
+
export const mx_perlin_noise_float_1 = /*#__PURE__*/ Fn( ( [ p_immutable ] ) => {
|
|
631
631
|
|
|
632
632
|
const p = vec3( p_immutable ).toVar();
|
|
633
633
|
const X = int().toVar(), Y = int().toVar(), Z = int().toVar();
|
|
@@ -651,7 +651,7 @@ export const mx_perlin_noise_float_1 = /*#__PURE__*/ tslFn( ( [ p_immutable ] )
|
|
|
651
651
|
|
|
652
652
|
export const mx_perlin_noise_float = /*#__PURE__*/ overloadingFn( [ mx_perlin_noise_float_0, mx_perlin_noise_float_1 ] );
|
|
653
653
|
|
|
654
|
-
export const mx_perlin_noise_vec3_0 = /*#__PURE__*/
|
|
654
|
+
export const mx_perlin_noise_vec3_0 = /*#__PURE__*/ Fn( ( [ p_immutable ] ) => {
|
|
655
655
|
|
|
656
656
|
const p = vec2( p_immutable ).toVar();
|
|
657
657
|
const X = int().toVar(), Y = int().toVar();
|
|
@@ -671,7 +671,7 @@ export const mx_perlin_noise_vec3_0 = /*#__PURE__*/ tslFn( ( [ p_immutable ] ) =
|
|
|
671
671
|
]
|
|
672
672
|
} );
|
|
673
673
|
|
|
674
|
-
export const mx_perlin_noise_vec3_1 = /*#__PURE__*/
|
|
674
|
+
export const mx_perlin_noise_vec3_1 = /*#__PURE__*/ Fn( ( [ p_immutable ] ) => {
|
|
675
675
|
|
|
676
676
|
const p = vec3( p_immutable ).toVar();
|
|
677
677
|
const X = int().toVar(), Y = int().toVar(), Z = int().toVar();
|
|
@@ -695,7 +695,7 @@ export const mx_perlin_noise_vec3_1 = /*#__PURE__*/ tslFn( ( [ p_immutable ] ) =
|
|
|
695
695
|
|
|
696
696
|
export const mx_perlin_noise_vec3 = /*#__PURE__*/ overloadingFn( [ mx_perlin_noise_vec3_0, mx_perlin_noise_vec3_1 ] );
|
|
697
697
|
|
|
698
|
-
export const mx_cell_noise_float_0 = /*#__PURE__*/
|
|
698
|
+
export const mx_cell_noise_float_0 = /*#__PURE__*/ Fn( ( [ p_immutable ] ) => {
|
|
699
699
|
|
|
700
700
|
const p = float( p_immutable ).toVar();
|
|
701
701
|
const ix = int( mx_floor( p ) ).toVar();
|
|
@@ -710,7 +710,7 @@ export const mx_cell_noise_float_0 = /*#__PURE__*/ tslFn( ( [ p_immutable ] ) =>
|
|
|
710
710
|
]
|
|
711
711
|
} );
|
|
712
712
|
|
|
713
|
-
export const mx_cell_noise_float_1 = /*#__PURE__*/
|
|
713
|
+
export const mx_cell_noise_float_1 = /*#__PURE__*/ Fn( ( [ p_immutable ] ) => {
|
|
714
714
|
|
|
715
715
|
const p = vec2( p_immutable ).toVar();
|
|
716
716
|
const ix = int( mx_floor( p.x ) ).toVar();
|
|
@@ -726,7 +726,7 @@ export const mx_cell_noise_float_1 = /*#__PURE__*/ tslFn( ( [ p_immutable ] ) =>
|
|
|
726
726
|
]
|
|
727
727
|
} );
|
|
728
728
|
|
|
729
|
-
export const mx_cell_noise_float_2 = /*#__PURE__*/
|
|
729
|
+
export const mx_cell_noise_float_2 = /*#__PURE__*/ Fn( ( [ p_immutable ] ) => {
|
|
730
730
|
|
|
731
731
|
const p = vec3( p_immutable ).toVar();
|
|
732
732
|
const ix = int( mx_floor( p.x ) ).toVar();
|
|
@@ -743,7 +743,7 @@ export const mx_cell_noise_float_2 = /*#__PURE__*/ tslFn( ( [ p_immutable ] ) =>
|
|
|
743
743
|
]
|
|
744
744
|
} );
|
|
745
745
|
|
|
746
|
-
export const mx_cell_noise_float_3 = /*#__PURE__*/
|
|
746
|
+
export const mx_cell_noise_float_3 = /*#__PURE__*/ Fn( ( [ p_immutable ] ) => {
|
|
747
747
|
|
|
748
748
|
const p = vec4( p_immutable ).toVar();
|
|
749
749
|
const ix = int( mx_floor( p.x ) ).toVar();
|
|
@@ -763,7 +763,7 @@ export const mx_cell_noise_float_3 = /*#__PURE__*/ tslFn( ( [ p_immutable ] ) =>
|
|
|
763
763
|
|
|
764
764
|
export const mx_cell_noise_float = /*#__PURE__*/ overloadingFn( [ mx_cell_noise_float_0, mx_cell_noise_float_1, mx_cell_noise_float_2, mx_cell_noise_float_3 ] );
|
|
765
765
|
|
|
766
|
-
export const mx_cell_noise_vec3_0 = /*#__PURE__*/
|
|
766
|
+
export const mx_cell_noise_vec3_0 = /*#__PURE__*/ Fn( ( [ p_immutable ] ) => {
|
|
767
767
|
|
|
768
768
|
const p = float( p_immutable ).toVar();
|
|
769
769
|
const ix = int( mx_floor( p ) ).toVar();
|
|
@@ -778,7 +778,7 @@ export const mx_cell_noise_vec3_0 = /*#__PURE__*/ tslFn( ( [ p_immutable ] ) =>
|
|
|
778
778
|
]
|
|
779
779
|
} );
|
|
780
780
|
|
|
781
|
-
export const mx_cell_noise_vec3_1 = /*#__PURE__*/
|
|
781
|
+
export const mx_cell_noise_vec3_1 = /*#__PURE__*/ Fn( ( [ p_immutable ] ) => {
|
|
782
782
|
|
|
783
783
|
const p = vec2( p_immutable ).toVar();
|
|
784
784
|
const ix = int( mx_floor( p.x ) ).toVar();
|
|
@@ -794,7 +794,7 @@ export const mx_cell_noise_vec3_1 = /*#__PURE__*/ tslFn( ( [ p_immutable ] ) =>
|
|
|
794
794
|
]
|
|
795
795
|
} );
|
|
796
796
|
|
|
797
|
-
export const mx_cell_noise_vec3_2 = /*#__PURE__*/
|
|
797
|
+
export const mx_cell_noise_vec3_2 = /*#__PURE__*/ Fn( ( [ p_immutable ] ) => {
|
|
798
798
|
|
|
799
799
|
const p = vec3( p_immutable ).toVar();
|
|
800
800
|
const ix = int( mx_floor( p.x ) ).toVar();
|
|
@@ -811,7 +811,7 @@ export const mx_cell_noise_vec3_2 = /*#__PURE__*/ tslFn( ( [ p_immutable ] ) =>
|
|
|
811
811
|
]
|
|
812
812
|
} );
|
|
813
813
|
|
|
814
|
-
export const mx_cell_noise_vec3_3 = /*#__PURE__*/
|
|
814
|
+
export const mx_cell_noise_vec3_3 = /*#__PURE__*/ Fn( ( [ p_immutable ] ) => {
|
|
815
815
|
|
|
816
816
|
const p = vec4( p_immutable ).toVar();
|
|
817
817
|
const ix = int( mx_floor( p.x ) ).toVar();
|
|
@@ -831,7 +831,7 @@ export const mx_cell_noise_vec3_3 = /*#__PURE__*/ tslFn( ( [ p_immutable ] ) =>
|
|
|
831
831
|
|
|
832
832
|
export const mx_cell_noise_vec3 = /*#__PURE__*/ overloadingFn( [ mx_cell_noise_vec3_0, mx_cell_noise_vec3_1, mx_cell_noise_vec3_2, mx_cell_noise_vec3_3 ] );
|
|
833
833
|
|
|
834
|
-
export const mx_fractal_noise_float = /*#__PURE__*/
|
|
834
|
+
export const mx_fractal_noise_float = /*#__PURE__*/ Fn( ( [ p_immutable, octaves_immutable, lacunarity_immutable, diminish_immutable ] ) => {
|
|
835
835
|
|
|
836
836
|
const diminish = float( diminish_immutable ).toVar();
|
|
837
837
|
const lacunarity = float( lacunarity_immutable ).toVar();
|
|
@@ -840,7 +840,7 @@ export const mx_fractal_noise_float = /*#__PURE__*/ tslFn( ( [ p_immutable, octa
|
|
|
840
840
|
const result = float( 0.0 ).toVar();
|
|
841
841
|
const amplitude = float( 1.0 ).toVar();
|
|
842
842
|
|
|
843
|
-
|
|
843
|
+
Loop( octaves, () => {
|
|
844
844
|
|
|
845
845
|
result.addAssign( amplitude.mul( mx_perlin_noise_float( p ) ) );
|
|
846
846
|
amplitude.mulAssign( diminish );
|
|
@@ -861,7 +861,7 @@ export const mx_fractal_noise_float = /*#__PURE__*/ tslFn( ( [ p_immutable, octa
|
|
|
861
861
|
]
|
|
862
862
|
} );
|
|
863
863
|
|
|
864
|
-
export const mx_fractal_noise_vec3 = /*#__PURE__*/
|
|
864
|
+
export const mx_fractal_noise_vec3 = /*#__PURE__*/ Fn( ( [ p_immutable, octaves_immutable, lacunarity_immutable, diminish_immutable ] ) => {
|
|
865
865
|
|
|
866
866
|
const diminish = float( diminish_immutable ).toVar();
|
|
867
867
|
const lacunarity = float( lacunarity_immutable ).toVar();
|
|
@@ -870,7 +870,7 @@ export const mx_fractal_noise_vec3 = /*#__PURE__*/ tslFn( ( [ p_immutable, octav
|
|
|
870
870
|
const result = vec3( 0.0 ).toVar();
|
|
871
871
|
const amplitude = float( 1.0 ).toVar();
|
|
872
872
|
|
|
873
|
-
|
|
873
|
+
Loop( octaves, () => {
|
|
874
874
|
|
|
875
875
|
result.addAssign( amplitude.mul( mx_perlin_noise_vec3( p ) ) );
|
|
876
876
|
amplitude.mulAssign( diminish );
|
|
@@ -891,7 +891,7 @@ export const mx_fractal_noise_vec3 = /*#__PURE__*/ tslFn( ( [ p_immutable, octav
|
|
|
891
891
|
]
|
|
892
892
|
} );
|
|
893
893
|
|
|
894
|
-
export const mx_fractal_noise_vec2 = /*#__PURE__*/
|
|
894
|
+
export const mx_fractal_noise_vec2 = /*#__PURE__*/ Fn( ( [ p_immutable, octaves_immutable, lacunarity_immutable, diminish_immutable ] ) => {
|
|
895
895
|
|
|
896
896
|
const diminish = float( diminish_immutable ).toVar();
|
|
897
897
|
const lacunarity = float( lacunarity_immutable ).toVar();
|
|
@@ -911,7 +911,7 @@ export const mx_fractal_noise_vec2 = /*#__PURE__*/ tslFn( ( [ p_immutable, octav
|
|
|
911
911
|
]
|
|
912
912
|
} );
|
|
913
913
|
|
|
914
|
-
export const mx_fractal_noise_vec4 = /*#__PURE__*/
|
|
914
|
+
export const mx_fractal_noise_vec4 = /*#__PURE__*/ Fn( ( [ p_immutable, octaves_immutable, lacunarity_immutable, diminish_immutable ] ) => {
|
|
915
915
|
|
|
916
916
|
const diminish = float( diminish_immutable ).toVar();
|
|
917
917
|
const lacunarity = float( lacunarity_immutable ).toVar();
|
|
@@ -933,7 +933,7 @@ export const mx_fractal_noise_vec4 = /*#__PURE__*/ tslFn( ( [ p_immutable, octav
|
|
|
933
933
|
]
|
|
934
934
|
} );
|
|
935
935
|
|
|
936
|
-
export const mx_worley_distance_0 = /*#__PURE__*/
|
|
936
|
+
export const mx_worley_distance_0 = /*#__PURE__*/ Fn( ( [ p_immutable, x_immutable, y_immutable, xoff_immutable, yoff_immutable, jitter_immutable, metric_immutable ] ) => {
|
|
937
937
|
|
|
938
938
|
const metric = int( metric_immutable ).toVar();
|
|
939
939
|
const jitter = float( jitter_immutable ).toVar();
|
|
@@ -978,7 +978,7 @@ export const mx_worley_distance_0 = /*#__PURE__*/ tslFn( ( [ p_immutable, x_immu
|
|
|
978
978
|
]
|
|
979
979
|
} );
|
|
980
980
|
|
|
981
|
-
export const mx_worley_distance_1 = /*#__PURE__*/
|
|
981
|
+
export const mx_worley_distance_1 = /*#__PURE__*/ Fn( ( [ p_immutable, x_immutable, y_immutable, z_immutable, xoff_immutable, yoff_immutable, zoff_immutable, jitter_immutable, metric_immutable ] ) => {
|
|
982
982
|
|
|
983
983
|
const metric = int( metric_immutable ).toVar();
|
|
984
984
|
const jitter = float( jitter_immutable ).toVar();
|
|
@@ -1028,7 +1028,7 @@ export const mx_worley_distance_1 = /*#__PURE__*/ tslFn( ( [ p_immutable, x_immu
|
|
|
1028
1028
|
|
|
1029
1029
|
export const mx_worley_distance = /*#__PURE__*/ overloadingFn( [ mx_worley_distance_0, mx_worley_distance_1 ] );
|
|
1030
1030
|
|
|
1031
|
-
export const mx_worley_noise_float_0 = /*#__PURE__*/
|
|
1031
|
+
export const mx_worley_noise_float_0 = /*#__PURE__*/ Fn( ( [ p_immutable, jitter_immutable, metric_immutable ] ) => {
|
|
1032
1032
|
|
|
1033
1033
|
const metric = int( metric_immutable ).toVar();
|
|
1034
1034
|
const jitter = float( jitter_immutable ).toVar();
|
|
@@ -1037,9 +1037,9 @@ export const mx_worley_noise_float_0 = /*#__PURE__*/ tslFn( ( [ p_immutable, jit
|
|
|
1037
1037
|
const localpos = vec2( mx_floorfrac( p.x, X ), mx_floorfrac( p.y, Y ) ).toVar();
|
|
1038
1038
|
const sqdist = float( 1e6 ).toVar();
|
|
1039
1039
|
|
|
1040
|
-
|
|
1040
|
+
Loop( { start: - 1, end: int( 1 ), name: 'x', condition: '<=' }, ( { x } ) => {
|
|
1041
1041
|
|
|
1042
|
-
|
|
1042
|
+
Loop( { start: - 1, end: int( 1 ), name: 'y', condition: '<=' }, ( { y } ) => {
|
|
1043
1043
|
|
|
1044
1044
|
const dist = float( mx_worley_distance( localpos, x, y, X, Y, jitter, metric ) ).toVar();
|
|
1045
1045
|
sqdist.assign( min( sqdist, dist ) );
|
|
@@ -1066,7 +1066,7 @@ export const mx_worley_noise_float_0 = /*#__PURE__*/ tslFn( ( [ p_immutable, jit
|
|
|
1066
1066
|
]
|
|
1067
1067
|
} );
|
|
1068
1068
|
|
|
1069
|
-
export const mx_worley_noise_vec2_0 = /*#__PURE__*/
|
|
1069
|
+
export const mx_worley_noise_vec2_0 = /*#__PURE__*/ Fn( ( [ p_immutable, jitter_immutable, metric_immutable ] ) => {
|
|
1070
1070
|
|
|
1071
1071
|
const metric = int( metric_immutable ).toVar();
|
|
1072
1072
|
const jitter = float( jitter_immutable ).toVar();
|
|
@@ -1075,9 +1075,9 @@ export const mx_worley_noise_vec2_0 = /*#__PURE__*/ tslFn( ( [ p_immutable, jitt
|
|
|
1075
1075
|
const localpos = vec2( mx_floorfrac( p.x, X ), mx_floorfrac( p.y, Y ) ).toVar();
|
|
1076
1076
|
const sqdist = vec2( 1e6, 1e6 ).toVar();
|
|
1077
1077
|
|
|
1078
|
-
|
|
1078
|
+
Loop( { start: - 1, end: int( 1 ), name: 'x', condition: '<=' }, ( { x } ) => {
|
|
1079
1079
|
|
|
1080
|
-
|
|
1080
|
+
Loop( { start: - 1, end: int( 1 ), name: 'y', condition: '<=' }, ( { y } ) => {
|
|
1081
1081
|
|
|
1082
1082
|
const dist = float( mx_worley_distance( localpos, x, y, X, Y, jitter, metric ) ).toVar();
|
|
1083
1083
|
|
|
@@ -1086,7 +1086,7 @@ export const mx_worley_noise_vec2_0 = /*#__PURE__*/ tslFn( ( [ p_immutable, jitt
|
|
|
1086
1086
|
sqdist.y.assign( sqdist.x );
|
|
1087
1087
|
sqdist.x.assign( dist );
|
|
1088
1088
|
|
|
1089
|
-
} ).
|
|
1089
|
+
} ).ElseIf( dist.lessThan( sqdist.y ), () => {
|
|
1090
1090
|
|
|
1091
1091
|
sqdist.y.assign( dist );
|
|
1092
1092
|
|
|
@@ -1114,7 +1114,7 @@ export const mx_worley_noise_vec2_0 = /*#__PURE__*/ tslFn( ( [ p_immutable, jitt
|
|
|
1114
1114
|
]
|
|
1115
1115
|
} );
|
|
1116
1116
|
|
|
1117
|
-
export const mx_worley_noise_vec3_0 = /*#__PURE__*/
|
|
1117
|
+
export const mx_worley_noise_vec3_0 = /*#__PURE__*/ Fn( ( [ p_immutable, jitter_immutable, metric_immutable ] ) => {
|
|
1118
1118
|
|
|
1119
1119
|
const metric = int( metric_immutable ).toVar();
|
|
1120
1120
|
const jitter = float( jitter_immutable ).toVar();
|
|
@@ -1123,9 +1123,9 @@ export const mx_worley_noise_vec3_0 = /*#__PURE__*/ tslFn( ( [ p_immutable, jitt
|
|
|
1123
1123
|
const localpos = vec2( mx_floorfrac( p.x, X ), mx_floorfrac( p.y, Y ) ).toVar();
|
|
1124
1124
|
const sqdist = vec3( 1e6, 1e6, 1e6 ).toVar();
|
|
1125
1125
|
|
|
1126
|
-
|
|
1126
|
+
Loop( { start: - 1, end: int( 1 ), name: 'x', condition: '<=' }, ( { x } ) => {
|
|
1127
1127
|
|
|
1128
|
-
|
|
1128
|
+
Loop( { start: - 1, end: int( 1 ), name: 'y', condition: '<=' }, ( { y } ) => {
|
|
1129
1129
|
|
|
1130
1130
|
const dist = float( mx_worley_distance( localpos, x, y, X, Y, jitter, metric ) ).toVar();
|
|
1131
1131
|
|
|
@@ -1135,12 +1135,12 @@ export const mx_worley_noise_vec3_0 = /*#__PURE__*/ tslFn( ( [ p_immutable, jitt
|
|
|
1135
1135
|
sqdist.y.assign( sqdist.x );
|
|
1136
1136
|
sqdist.x.assign( dist );
|
|
1137
1137
|
|
|
1138
|
-
} ).
|
|
1138
|
+
} ).ElseIf( dist.lessThan( sqdist.y ), () => {
|
|
1139
1139
|
|
|
1140
1140
|
sqdist.z.assign( sqdist.y );
|
|
1141
1141
|
sqdist.y.assign( dist );
|
|
1142
1142
|
|
|
1143
|
-
} ).
|
|
1143
|
+
} ).ElseIf( dist.lessThan( sqdist.z ), () => {
|
|
1144
1144
|
|
|
1145
1145
|
sqdist.z.assign( dist );
|
|
1146
1146
|
|
|
@@ -1168,7 +1168,7 @@ export const mx_worley_noise_vec3_0 = /*#__PURE__*/ tslFn( ( [ p_immutable, jitt
|
|
|
1168
1168
|
]
|
|
1169
1169
|
} );
|
|
1170
1170
|
|
|
1171
|
-
export const mx_worley_noise_float_1 = /*#__PURE__*/
|
|
1171
|
+
export const mx_worley_noise_float_1 = /*#__PURE__*/ Fn( ( [ p_immutable, jitter_immutable, metric_immutable ] ) => {
|
|
1172
1172
|
|
|
1173
1173
|
const metric = int( metric_immutable ).toVar();
|
|
1174
1174
|
const jitter = float( jitter_immutable ).toVar();
|
|
@@ -1177,11 +1177,11 @@ export const mx_worley_noise_float_1 = /*#__PURE__*/ tslFn( ( [ p_immutable, jit
|
|
|
1177
1177
|
const localpos = vec3( mx_floorfrac( p.x, X ), mx_floorfrac( p.y, Y ), mx_floorfrac( p.z, Z ) ).toVar();
|
|
1178
1178
|
const sqdist = float( 1e6 ).toVar();
|
|
1179
1179
|
|
|
1180
|
-
|
|
1180
|
+
Loop( { start: - 1, end: int( 1 ), name: 'x', condition: '<=' }, ( { x } ) => {
|
|
1181
1181
|
|
|
1182
|
-
|
|
1182
|
+
Loop( { start: - 1, end: int( 1 ), name: 'y', condition: '<=' }, ( { y } ) => {
|
|
1183
1183
|
|
|
1184
|
-
|
|
1184
|
+
Loop( { start: - 1, end: int( 1 ), name: 'z', condition: '<=' }, ( { z } ) => {
|
|
1185
1185
|
|
|
1186
1186
|
const dist = float( mx_worley_distance( localpos, x, y, z, X, Y, Z, jitter, metric ) ).toVar();
|
|
1187
1187
|
sqdist.assign( min( sqdist, dist ) );
|
|
@@ -1212,7 +1212,7 @@ export const mx_worley_noise_float_1 = /*#__PURE__*/ tslFn( ( [ p_immutable, jit
|
|
|
1212
1212
|
|
|
1213
1213
|
export const mx_worley_noise_float = /*#__PURE__*/ overloadingFn( [ mx_worley_noise_float_0, mx_worley_noise_float_1 ] );
|
|
1214
1214
|
|
|
1215
|
-
export const mx_worley_noise_vec2_1 = /*#__PURE__*/
|
|
1215
|
+
export const mx_worley_noise_vec2_1 = /*#__PURE__*/ Fn( ( [ p_immutable, jitter_immutable, metric_immutable ] ) => {
|
|
1216
1216
|
|
|
1217
1217
|
const metric = int( metric_immutable ).toVar();
|
|
1218
1218
|
const jitter = float( jitter_immutable ).toVar();
|
|
@@ -1221,11 +1221,11 @@ export const mx_worley_noise_vec2_1 = /*#__PURE__*/ tslFn( ( [ p_immutable, jitt
|
|
|
1221
1221
|
const localpos = vec3( mx_floorfrac( p.x, X ), mx_floorfrac( p.y, Y ), mx_floorfrac( p.z, Z ) ).toVar();
|
|
1222
1222
|
const sqdist = vec2( 1e6, 1e6 ).toVar();
|
|
1223
1223
|
|
|
1224
|
-
|
|
1224
|
+
Loop( { start: - 1, end: int( 1 ), name: 'x', condition: '<=' }, ( { x } ) => {
|
|
1225
1225
|
|
|
1226
|
-
|
|
1226
|
+
Loop( { start: - 1, end: int( 1 ), name: 'y', condition: '<=' }, ( { y } ) => {
|
|
1227
1227
|
|
|
1228
|
-
|
|
1228
|
+
Loop( { start: - 1, end: int( 1 ), name: 'z', condition: '<=' }, ( { z } ) => {
|
|
1229
1229
|
|
|
1230
1230
|
const dist = float( mx_worley_distance( localpos, x, y, z, X, Y, Z, jitter, metric ) ).toVar();
|
|
1231
1231
|
|
|
@@ -1234,7 +1234,7 @@ export const mx_worley_noise_vec2_1 = /*#__PURE__*/ tslFn( ( [ p_immutable, jitt
|
|
|
1234
1234
|
sqdist.y.assign( sqdist.x );
|
|
1235
1235
|
sqdist.x.assign( dist );
|
|
1236
1236
|
|
|
1237
|
-
} ).
|
|
1237
|
+
} ).ElseIf( dist.lessThan( sqdist.y ), () => {
|
|
1238
1238
|
|
|
1239
1239
|
sqdist.y.assign( dist );
|
|
1240
1240
|
|
|
@@ -1266,7 +1266,7 @@ export const mx_worley_noise_vec2_1 = /*#__PURE__*/ tslFn( ( [ p_immutable, jitt
|
|
|
1266
1266
|
|
|
1267
1267
|
export const mx_worley_noise_vec2 = /*#__PURE__*/ overloadingFn( [ mx_worley_noise_vec2_0, mx_worley_noise_vec2_1 ] );
|
|
1268
1268
|
|
|
1269
|
-
export const mx_worley_noise_vec3_1 = /*#__PURE__*/
|
|
1269
|
+
export const mx_worley_noise_vec3_1 = /*#__PURE__*/ Fn( ( [ p_immutable, jitter_immutable, metric_immutable ] ) => {
|
|
1270
1270
|
|
|
1271
1271
|
const metric = int( metric_immutable ).toVar();
|
|
1272
1272
|
const jitter = float( jitter_immutable ).toVar();
|
|
@@ -1275,11 +1275,11 @@ export const mx_worley_noise_vec3_1 = /*#__PURE__*/ tslFn( ( [ p_immutable, jitt
|
|
|
1275
1275
|
const localpos = vec3( mx_floorfrac( p.x, X ), mx_floorfrac( p.y, Y ), mx_floorfrac( p.z, Z ) ).toVar();
|
|
1276
1276
|
const sqdist = vec3( 1e6, 1e6, 1e6 ).toVar();
|
|
1277
1277
|
|
|
1278
|
-
|
|
1278
|
+
Loop( { start: - 1, end: int( 1 ), name: 'x', condition: '<=' }, ( { x } ) => {
|
|
1279
1279
|
|
|
1280
|
-
|
|
1280
|
+
Loop( { start: - 1, end: int( 1 ), name: 'y', condition: '<=' }, ( { y } ) => {
|
|
1281
1281
|
|
|
1282
|
-
|
|
1282
|
+
Loop( { start: - 1, end: int( 1 ), name: 'z', condition: '<=' }, ( { z } ) => {
|
|
1283
1283
|
|
|
1284
1284
|
const dist = float( mx_worley_distance( localpos, x, y, z, X, Y, Z, jitter, metric ) ).toVar();
|
|
1285
1285
|
|
|
@@ -1289,12 +1289,12 @@ export const mx_worley_noise_vec3_1 = /*#__PURE__*/ tslFn( ( [ p_immutable, jitt
|
|
|
1289
1289
|
sqdist.y.assign( sqdist.x );
|
|
1290
1290
|
sqdist.x.assign( dist );
|
|
1291
1291
|
|
|
1292
|
-
} ).
|
|
1292
|
+
} ).ElseIf( dist.lessThan( sqdist.y ), () => {
|
|
1293
1293
|
|
|
1294
1294
|
sqdist.z.assign( sqdist.y );
|
|
1295
1295
|
sqdist.y.assign( dist );
|
|
1296
1296
|
|
|
1297
|
-
} ).
|
|
1297
|
+
} ).ElseIf( dist.lessThan( sqdist.z ), () => {
|
|
1298
1298
|
|
|
1299
1299
|
sqdist.z.assign( dist );
|
|
1300
1300
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// Three.js Transpiler
|
|
2
2
|
// https://github.com/AcademySoftwareFoundation/MaterialX/blob/main/libraries/stdlib/genglsl/lib/mx_transform_color.glsl
|
|
3
3
|
|
|
4
|
-
import { bvec3, vec3,
|
|
4
|
+
import { bvec3, vec3, Fn } from '../../shadernode/ShaderNode.js';
|
|
5
5
|
import { greaterThan } from '../../math/OperatorNode.js';
|
|
6
6
|
import { max, pow, mix } from '../../math/MathNode.js';
|
|
7
7
|
|
|
8
|
-
export const mx_srgb_texture_to_lin_rec709 = /*#__PURE__*/
|
|
8
|
+
export const mx_srgb_texture_to_lin_rec709 = /*#__PURE__*/ Fn( ( [ color_immutable ] ) => {
|
|
9
9
|
|
|
10
10
|
const color = vec3( color_immutable ).toVar();
|
|
11
11
|
const isAbove = bvec3( greaterThan( color, vec3( 0.04045 ) ) ).toVar();
|
|
@@ -121,8 +121,19 @@ class CondNode extends Node {
|
|
|
121
121
|
|
|
122
122
|
export default CondNode;
|
|
123
123
|
|
|
124
|
-
export const
|
|
124
|
+
export const select = nodeProxy( CondNode );
|
|
125
125
|
|
|
126
|
-
addNodeElement( '
|
|
126
|
+
addNodeElement( 'select', select );
|
|
127
127
|
|
|
128
128
|
addNodeClass( 'CondNode', CondNode );
|
|
129
|
+
|
|
130
|
+
//
|
|
131
|
+
|
|
132
|
+
export const cond = ( ...params ) => { // @deprecated, r168
|
|
133
|
+
|
|
134
|
+
console.warn( 'TSL.CondNode: cond() has been renamed to select().' );
|
|
135
|
+
return select( ...params );
|
|
136
|
+
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
addNodeElement( 'cond', cond );
|