@plastic-software/three 0.167.1 → 0.167.2
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 +6 -16
- package/build/three.module.js +6 -16
- package/build/three.module.min.js +1 -1
- package/build/three.webgpu.js +510 -354
- 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
|
@@ -5,9 +5,9 @@ import { materialReference } from '../accessors/MaterialReferenceNode.js';
|
|
|
5
5
|
import { modelWorldMatrixInverse } from '../accessors/ModelNode.js';
|
|
6
6
|
import { cameraPosition } from '../accessors/CameraNode.js';
|
|
7
7
|
import { positionGeometry } from '../accessors/PositionNode.js';
|
|
8
|
-
import {
|
|
8
|
+
import { Fn, vec2, vec3, vec4 } from '../shadernode/ShaderNode.js';
|
|
9
9
|
import { min, max } from '../math/MathNode.js';
|
|
10
|
-
import {
|
|
10
|
+
import { Loop, Break } from '../utils/LoopNode.js';
|
|
11
11
|
import { texture3D } from '../accessors/Texture3DNode.js';
|
|
12
12
|
|
|
13
13
|
class VolumeNodeMaterial extends NodeMaterial {
|
|
@@ -29,7 +29,7 @@ class VolumeNodeMaterial extends NodeMaterial {
|
|
|
29
29
|
|
|
30
30
|
const map = texture3D( this.map, null, 0 );
|
|
31
31
|
|
|
32
|
-
const hitBox =
|
|
32
|
+
const hitBox = Fn( ( { orig, dir } ) => {
|
|
33
33
|
|
|
34
34
|
const box_min = vec3( - 0.5 );
|
|
35
35
|
const box_max = vec3( 0.5 );
|
|
@@ -49,7 +49,7 @@ class VolumeNodeMaterial extends NodeMaterial {
|
|
|
49
49
|
|
|
50
50
|
} );
|
|
51
51
|
|
|
52
|
-
this.fragmentNode =
|
|
52
|
+
this.fragmentNode = Fn( () => {
|
|
53
53
|
|
|
54
54
|
const vOrigin = varying( vec3( modelWorldMatrixInverse.mul( vec4( cameraPosition, 1.0 ) ) ) );
|
|
55
55
|
const vDirection = varying( positionGeometry.sub( vOrigin ) );
|
|
@@ -69,7 +69,7 @@ class VolumeNodeMaterial extends NodeMaterial {
|
|
|
69
69
|
|
|
70
70
|
const ac = property( 'vec4', 'ac' ).assign( vec4( materialReference( 'base', 'color' ), 0.0 ) );
|
|
71
71
|
|
|
72
|
-
|
|
72
|
+
Loop( { type: 'float', start: bounds.x, end: bounds.y, update: '+= delta' }, () => {
|
|
73
73
|
|
|
74
74
|
const d = property( 'float', 'd' ).assign( map.uv( p.add( 0.5 ) ).r );
|
|
75
75
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// Three.js Transpiler
|
|
2
2
|
// https://github.com/AcademySoftwareFoundation/MaterialX/blob/main/libraries/stdlib/genglsl/lib/mx_hsv.glsl
|
|
3
3
|
|
|
4
|
-
import { int, float, vec3, If,
|
|
4
|
+
import { int, float, vec3, If, Fn } from '../../shadernode/ShaderNode.js';
|
|
5
5
|
import { add, sub, mul } from '../../math/OperatorNode.js';
|
|
6
6
|
import { floor, trunc, max, min } from '../../math/MathNode.js';
|
|
7
7
|
|
|
8
|
-
export const mx_hsvtorgb = /*#__PURE__*/
|
|
8
|
+
export const mx_hsvtorgb = /*#__PURE__*/ Fn( ( [ hsv_immutable ] ) => {
|
|
9
9
|
|
|
10
10
|
const hsv = vec3( hsv_immutable ).toVar();
|
|
11
11
|
const h = float( hsv.x ).toVar();
|
|
@@ -16,7 +16,7 @@ export const mx_hsvtorgb = /*#__PURE__*/ tslFn( ( [ hsv_immutable ] ) => {
|
|
|
16
16
|
|
|
17
17
|
return vec3( v, v, v );
|
|
18
18
|
|
|
19
|
-
} ).
|
|
19
|
+
} ).Else( () => {
|
|
20
20
|
|
|
21
21
|
h.assign( mul( 6.0, h.sub( floor( h ) ) ) );
|
|
22
22
|
const hi = int( trunc( h ) ).toVar();
|
|
@@ -29,19 +29,19 @@ export const mx_hsvtorgb = /*#__PURE__*/ tslFn( ( [ hsv_immutable ] ) => {
|
|
|
29
29
|
|
|
30
30
|
return vec3( v, t, p );
|
|
31
31
|
|
|
32
|
-
} ).
|
|
32
|
+
} ).ElseIf( hi.equal( int( 1 ) ), () => {
|
|
33
33
|
|
|
34
34
|
return vec3( q, v, p );
|
|
35
35
|
|
|
36
|
-
} ).
|
|
36
|
+
} ).ElseIf( hi.equal( int( 2 ) ), () => {
|
|
37
37
|
|
|
38
38
|
return vec3( p, v, t );
|
|
39
39
|
|
|
40
|
-
} ).
|
|
40
|
+
} ).ElseIf( hi.equal( int( 3 ) ), () => {
|
|
41
41
|
|
|
42
42
|
return vec3( p, q, v );
|
|
43
43
|
|
|
44
|
-
} ).
|
|
44
|
+
} ).ElseIf( hi.equal( int( 4 ) ), () => {
|
|
45
45
|
|
|
46
46
|
return vec3( t, p, v );
|
|
47
47
|
|
|
@@ -59,7 +59,7 @@ export const mx_hsvtorgb = /*#__PURE__*/ tslFn( ( [ hsv_immutable ] ) => {
|
|
|
59
59
|
]
|
|
60
60
|
} );
|
|
61
61
|
|
|
62
|
-
export const mx_rgbtohsv = /*#__PURE__*/
|
|
62
|
+
export const mx_rgbtohsv = /*#__PURE__*/ Fn( ( [ c_immutable ] ) => {
|
|
63
63
|
|
|
64
64
|
const c = vec3( c_immutable ).toVar();
|
|
65
65
|
const r = float( c.x ).toVar();
|
|
@@ -75,7 +75,7 @@ export const mx_rgbtohsv = /*#__PURE__*/ tslFn( ( [ c_immutable ] ) => {
|
|
|
75
75
|
|
|
76
76
|
s.assign( delta.div( maxcomp ) );
|
|
77
77
|
|
|
78
|
-
} ).
|
|
78
|
+
} ).Else( () => {
|
|
79
79
|
|
|
80
80
|
s.assign( 0.0 );
|
|
81
81
|
|
|
@@ -85,17 +85,17 @@ export const mx_rgbtohsv = /*#__PURE__*/ tslFn( ( [ c_immutable ] ) => {
|
|
|
85
85
|
|
|
86
86
|
h.assign( 0.0 );
|
|
87
87
|
|
|
88
|
-
} ).
|
|
88
|
+
} ).Else( () => {
|
|
89
89
|
|
|
90
90
|
If( r.greaterThanEqual( maxcomp ), () => {
|
|
91
91
|
|
|
92
92
|
h.assign( g.sub( b ).div( delta ) );
|
|
93
93
|
|
|
94
|
-
} ).
|
|
94
|
+
} ).ElseIf( g.greaterThanEqual( maxcomp ), () => {
|
|
95
95
|
|
|
96
96
|
h.assign( add( 2.0, b.sub( r ).div( delta ) ) );
|
|
97
97
|
|
|
98
|
-
} ).
|
|
98
|
+
} ).Else( () => {
|
|
99
99
|
|
|
100
100
|
h.assign( add( 4.0, r.sub( g ).div( delta ) ) );
|
|
101
101
|
|