super-three 0.170.0 → 0.171.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/three.cjs +24410 -24422
- package/build/three.core.js +37002 -0
- package/build/three.core.min.js +6 -0
- package/build/three.module.js +10573 -47578
- package/build/three.module.min.js +1 -1
- package/build/three.tsl.js +533 -0
- package/build/three.tsl.min.js +6 -0
- package/build/three.webgpu.js +2907 -37975
- package/build/three.webgpu.min.js +1 -1
- package/build/three.webgpu.nodes.js +2914 -37959
- package/build/three.webgpu.nodes.min.js +1 -1
- package/examples/jsm/capabilities/WebGPU.js +1 -10
- package/examples/jsm/controls/ArcballControls.js +25 -21
- package/examples/jsm/controls/OrbitControls.js +41 -9
- package/examples/jsm/controls/PointerLockControls.js +2 -5
- package/examples/jsm/csm/CSMShadowNode.js +7 -5
- package/examples/jsm/geometries/DecalGeometry.js +5 -1
- package/examples/jsm/lighting/TiledLighting.js +1 -1
- package/examples/jsm/lines/LineGeometry.js +25 -0
- package/examples/jsm/lines/LineMaterial.js +1 -7
- package/examples/jsm/lines/webgpu/Line2.js +2 -1
- package/examples/jsm/lines/webgpu/LineSegments2.js +2 -1
- package/examples/jsm/lines/webgpu/Wireframe.js +2 -1
- package/examples/jsm/loaders/KTX2Loader.js +3 -0
- package/examples/jsm/loaders/MMDLoader.js +2 -6
- package/examples/jsm/loaders/MaterialXLoader.js +2 -2
- package/examples/jsm/materials/MeshGouraudMaterial.js +2 -6
- package/examples/jsm/misc/ProgressiveLightMapGPU.js +2 -2
- package/examples/jsm/objects/InstancedPoints.js +2 -4
- package/examples/jsm/objects/LensflareMesh.js +4 -2
- package/examples/jsm/objects/SkyMesh.js +5 -3
- package/examples/jsm/objects/Water2Mesh.js +7 -3
- package/examples/jsm/objects/WaterMesh.js +5 -3
- package/examples/jsm/transpiler/AST.js +2 -2
- package/examples/jsm/transpiler/GLSLDecoder.js +57 -25
- package/examples/jsm/transpiler/TSLEncoder.js +11 -6
- package/examples/jsm/tsl/display/AfterImageNode.js +3 -3
- package/examples/jsm/tsl/display/AnaglyphPassNode.js +2 -2
- package/examples/jsm/tsl/display/AnamorphicNode.js +2 -2
- package/examples/jsm/tsl/display/BloomNode.js +3 -3
- package/examples/jsm/tsl/display/DenoiseNode.js +48 -12
- package/examples/jsm/tsl/display/DepthOfFieldNode.js +3 -2
- package/examples/jsm/tsl/display/DotScreenNode.js +2 -2
- package/examples/jsm/tsl/display/FXAANode.js +3 -3
- package/examples/jsm/tsl/display/FilmNode.js +3 -2
- package/examples/jsm/tsl/display/GTAONode.js +62 -27
- package/examples/jsm/tsl/display/GaussianBlurNode.js +6 -8
- package/examples/jsm/tsl/display/LensflareNode.js +3 -3
- package/examples/jsm/tsl/display/Lut3DNode.js +3 -2
- package/examples/jsm/tsl/display/OutlineNode.js +2 -2
- package/examples/jsm/tsl/display/ParallaxBarrierPassNode.js +2 -1
- package/examples/jsm/tsl/display/PixelationPassNode.js +4 -4
- package/examples/jsm/tsl/display/RGBShiftNode.js +2 -1
- package/examples/jsm/tsl/display/SMAANode.js +3 -3
- package/examples/jsm/tsl/display/SSAAPassNode.js +2 -2
- package/examples/jsm/tsl/display/SSRNode.js +31 -8
- package/examples/jsm/tsl/display/SobelOperatorNode.js +3 -3
- package/examples/jsm/tsl/display/StereoCompositePassNode.js +4 -4
- package/examples/jsm/tsl/display/StereoPassNode.js +2 -2
- package/examples/jsm/tsl/display/TRAAPassNode.js +2 -2
- package/examples/jsm/tsl/display/TransitionNode.js +3 -2
- package/examples/jsm/tsl/lighting/TiledLightsNode.js +6 -9
- package/examples/jsm/utils/SceneOptimizer.js +410 -0
- package/examples/jsm/utils/UVsDebug.js +1 -1
- package/package.json +3 -3
- package/src/Three.Core.js +178 -0
- package/src/Three.TSL.js +526 -0
- package/src/Three.WebGPU.Nodes.js +5 -186
- package/src/Three.WebGPU.js +4 -186
- package/src/Three.js +1 -177
- package/src/animation/AnimationClip.js +2 -2
- package/src/animation/AnimationObjectGroup.js +2 -2
- package/src/audio/Audio.js +38 -0
- package/src/cameras/PerspectiveCamera.js +6 -6
- package/src/cameras/StereoCamera.js +2 -2
- package/src/constants.js +1 -1
- package/src/core/BufferGeometry.js +5 -3
- package/src/core/InterleavedBuffer.js +4 -4
- package/src/core/Object3D.js +2 -2
- package/src/extras/core/Curve.js +3 -3
- package/src/extras/core/Shape.js +2 -2
- package/src/geometries/EdgesGeometry.js +2 -2
- package/src/geometries/LatheGeometry.js +2 -2
- package/src/lights/SpotLightShadow.js +2 -2
- package/src/materials/LineBasicMaterial.js +2 -6
- package/src/materials/LineDashedMaterial.js +1 -6
- package/src/materials/Material.js +3 -16
- package/src/materials/MeshBasicMaterial.js +2 -6
- package/src/materials/MeshDepthMaterial.js +2 -6
- package/src/materials/MeshDistanceMaterial.js +2 -6
- package/src/materials/MeshLambertMaterial.js +2 -6
- package/src/materials/MeshMatcapMaterial.js +2 -6
- package/src/materials/MeshNormalMaterial.js +2 -6
- package/src/materials/MeshPhongMaterial.js +3 -7
- package/src/materials/MeshPhysicalMaterial.js +4 -8
- package/src/materials/MeshStandardMaterial.js +2 -6
- package/src/materials/MeshToonMaterial.js +2 -6
- package/src/materials/PointsMaterial.js +2 -6
- package/src/materials/RawShaderMaterial.js +2 -6
- package/src/materials/ShaderMaterial.js +2 -6
- package/src/materials/ShadowMaterial.js +2 -6
- package/src/materials/SpriteMaterial.js +2 -6
- package/src/materials/nodes/Line2NodeMaterial.js +32 -13
- package/src/materials/nodes/LineDashedNodeMaterial.js +4 -2
- package/src/materials/nodes/NodeMaterial.js +64 -16
- package/src/materials/nodes/manager/NodeMaterialObserver.js +13 -10
- package/src/math/ColorManagement.js +130 -122
- package/src/math/Line3.js +2 -2
- package/src/math/Quaternion.js +2 -2
- package/src/math/Spherical.js +3 -3
- package/src/math/Vector2.js +7 -7
- package/src/math/Vector3.js +9 -9
- package/src/math/Vector4.js +11 -9
- package/src/nodes/Nodes.js +1 -0
- package/src/nodes/TSL.js +3 -1
- package/src/nodes/accessors/Arrays.js +27 -0
- package/src/nodes/accessors/BuiltinNode.js +26 -0
- package/src/nodes/accessors/ClippingNode.js +76 -42
- package/src/nodes/accessors/InstanceNode.js +17 -20
- package/src/nodes/accessors/InstancedMeshNode.js +26 -0
- package/src/nodes/accessors/Lights.js +32 -0
- package/src/nodes/accessors/StorageBufferNode.js +29 -9
- package/src/nodes/accessors/StorageTextureNode.js +10 -4
- package/src/nodes/accessors/TextureNode.js +1 -1
- package/src/nodes/core/NodeBuilder.js +2 -9
- package/src/nodes/core/NodeUtils.js +28 -0
- package/src/nodes/core/constants.js +6 -0
- package/src/nodes/display/BlendModes.js +99 -0
- package/src/nodes/display/ToonOutlinePassNode.js +3 -3
- package/src/nodes/display/ViewportDepthNode.js +21 -6
- package/src/nodes/functions/material/getAlphaHashThreshold.js +13 -7
- package/src/nodes/functions/material/getParallaxCorrectNormal.js +1 -1
- package/src/nodes/lighting/AnalyticLightNode.js +12 -4
- package/src/nodes/lighting/PointLightNode.js +10 -1
- package/src/nodes/lighting/PointShadowNode.js +254 -0
- package/src/nodes/lighting/ShadowNode.js +176 -67
- package/src/nodes/lighting/SpotLightNode.js +14 -2
- package/src/nodes/utils/RTTNode.js +9 -1
- package/src/nodes/utils/StorageArrayElementNode.js +2 -2
- package/src/objects/BatchedMesh.js +54 -95
- package/src/objects/ClippingGroup.js +19 -0
- package/src/objects/Skeleton.js +2 -2
- package/src/renderers/WebGLRenderer.js +94 -23
- package/src/renderers/common/Animation.js +23 -11
- package/src/renderers/common/Background.js +1 -1
- package/src/renderers/common/Bindings.js +20 -4
- package/src/renderers/common/ClippingContext.js +77 -85
- package/src/renderers/common/RenderList.js +9 -6
- package/src/renderers/common/RenderObject.js +27 -27
- package/src/renderers/common/RenderObjects.js +12 -6
- package/src/renderers/common/Renderer.js +63 -57
- package/src/renderers/common/Textures.js +11 -3
- package/src/renderers/common/UniformsGroup.js +16 -4
- package/src/renderers/common/extras/PMREMGenerator.js +89 -13
- package/src/renderers/common/nodes/NodeLibrary.js +2 -2
- package/src/renderers/common/nodes/NodeStorageBuffer.js +2 -3
- package/src/renderers/common/nodes/NodeUniform.js +42 -0
- package/src/renderers/webgl/WebGLBackground.js +20 -1
- package/src/renderers/webgl/WebGLGeometries.js +0 -28
- package/src/renderers/webgl-fallback/WebGLBackend.js +13 -6
- package/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js +43 -12
- package/src/renderers/webgl-fallback/utils/WebGLState.js +26 -1
- package/src/renderers/webgl-fallback/utils/WebGLTextureUtils.js +4 -1
- package/src/renderers/webgpu/WebGPUBackend.js +47 -31
- package/src/renderers/webgpu/nodes/StandardNodeLibrary.js +13 -26
- package/src/renderers/webgpu/nodes/WGSLNodeBuilder.js +184 -74
- package/src/renderers/webgpu/utils/WebGPUAttributeUtils.js +15 -2
- package/src/renderers/webgpu/utils/WebGPUBindingUtils.js +72 -7
- package/src/renderers/webgpu/utils/WebGPUTextureUtils.js +5 -1
- package/src/textures/Source.js +2 -2
- package/src/textures/Texture.js +2 -2
- package/src/nodes/display/BlendMode.js +0 -54
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { TempNode
|
|
1
|
+
import { TempNode } from 'three/webgpu';
|
|
2
|
+
import { nodeObject, Fn, float, uniform, vec3, vec4, mix } from 'three/tsl';
|
|
2
3
|
|
|
3
4
|
class Lut3DNode extends TempNode {
|
|
4
5
|
|
|
@@ -10,7 +11,7 @@ class Lut3DNode extends TempNode {
|
|
|
10
11
|
|
|
11
12
|
constructor( inputNode, lutNode, size, intensityNode ) {
|
|
12
13
|
|
|
13
|
-
super();
|
|
14
|
+
super( 'vec4' );
|
|
14
15
|
|
|
15
16
|
this.inputNode = inputNode;
|
|
16
17
|
this.lutNode = lutNode;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Color, DepthTexture, FloatType, RenderTarget, Vector2, PostProcessingUtils } from 'three';
|
|
2
|
-
import { Loop, int, exp, min, float, mul, uv, vec2, vec3, Fn, textureSize, orthographicDepthToViewZ,
|
|
1
|
+
import { Color, DepthTexture, FloatType, RenderTarget, Vector2, TempNode, QuadMesh, NodeMaterial, PostProcessingUtils, NodeUpdateType } from 'three/webgpu';
|
|
2
|
+
import { Loop, int, exp, min, float, mul, uv, vec2, vec3, Fn, textureSize, orthographicDepthToViewZ, screenUV, nodeObject, uniform, vec4, passTexture, texture, perspectiveDepthToViewZ, positionView } from 'three/tsl';
|
|
3
3
|
|
|
4
4
|
const _quadMesh = /*@__PURE__*/ new QuadMesh();
|
|
5
5
|
const _size = /*@__PURE__*/ new Vector2();
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { NodeMaterial } from 'three/webgpu';
|
|
2
|
+
import { nodeObject, Fn, vec4, uv, If, mod, screenCoordinate } from 'three/tsl';
|
|
2
3
|
import StereoCompositePassNode from './StereoCompositePassNode.js';
|
|
3
4
|
|
|
4
5
|
class ParallaxBarrierPassNode extends StereoCompositePassNode {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { NearestFilter, Vector4 } from 'three';
|
|
2
|
-
import {
|
|
1
|
+
import { NearestFilter, Vector4, TempNode, NodeUpdateType, PassNode } from 'three/webgpu';
|
|
2
|
+
import { nodeObject, Fn, float, uv, uniform, convertToTexture, vec2, vec3, clamp, floor, dot, smoothstep, If, sign, step, mrt, output, normalView, property } from 'three/tsl';
|
|
3
3
|
|
|
4
4
|
class PixelationNode extends TempNode {
|
|
5
5
|
|
|
@@ -11,7 +11,7 @@ class PixelationNode extends TempNode {
|
|
|
11
11
|
|
|
12
12
|
constructor( textureNode, depthNode, normalNode, pixelSize, normalEdgeStrength, depthEdgeStrength ) {
|
|
13
13
|
|
|
14
|
-
super();
|
|
14
|
+
super( 'vec4' );
|
|
15
15
|
|
|
16
16
|
// Input textures
|
|
17
17
|
|
|
@@ -158,7 +158,7 @@ class PixelationPassNode extends PassNode {
|
|
|
158
158
|
|
|
159
159
|
constructor( scene, camera, pixelSize = 6, normalEdgeStrength = 0.3, depthEdgeStrength = 0.4 ) {
|
|
160
160
|
|
|
161
|
-
super(
|
|
161
|
+
super( PassNode.COLOR, scene, camera, { minFilter: NearestFilter, magFilter: NearestFilter } );
|
|
162
162
|
|
|
163
163
|
this.pixelSize = pixelSize;
|
|
164
164
|
this.normalEdgeStrength = normalEdgeStrength;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { TempNode
|
|
1
|
+
import { TempNode } from 'three/webgpu';
|
|
2
|
+
import { nodeObject, Fn, uv, uniform, vec2, sin, cos, vec4, convertToTexture } from 'three/tsl';
|
|
2
3
|
|
|
3
4
|
class RGBShiftNode extends TempNode {
|
|
4
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { HalfFloatType, LinearFilter, NearestFilter, RenderTarget, Texture, Vector2, PostProcessingUtils } from 'three';
|
|
2
|
-
import { abs,
|
|
1
|
+
import { HalfFloatType, LinearFilter, NearestFilter, RenderTarget, Texture, Vector2, QuadMesh, NodeMaterial, TempNode, PostProcessingUtils } from 'three/webgpu';
|
|
2
|
+
import { abs, nodeObject, Fn, NodeUpdateType, uv, uniform, convertToTexture, varyingProperty, vec2, vec4, modelViewProjection, passTexture, max, step, dot, float, texture, If, Loop, int, Break, sqrt, sign, mix } from 'three/tsl';
|
|
3
3
|
|
|
4
4
|
const _quadMesh = /*@__PURE__*/ new QuadMesh();
|
|
5
5
|
const _size = /*@__PURE__*/ new Vector2();
|
|
@@ -22,7 +22,7 @@ class SMAANode extends TempNode {
|
|
|
22
22
|
|
|
23
23
|
constructor( textureNode ) {
|
|
24
24
|
|
|
25
|
-
super();
|
|
25
|
+
super( 'vec4' );
|
|
26
26
|
|
|
27
27
|
this.textureNode = textureNode;
|
|
28
28
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { AdditiveBlending, Color, Vector2, PostProcessingUtils } from 'three';
|
|
2
|
-
import { nodeObject, uniform, mrt,
|
|
1
|
+
import { AdditiveBlending, Color, Vector2, PostProcessingUtils, PassNode, QuadMesh, NodeMaterial } from 'three/webgpu';
|
|
2
|
+
import { nodeObject, uniform, mrt, texture, getTextureIndex } from 'three/tsl';
|
|
3
3
|
|
|
4
4
|
const _size = /*@__PURE__*/ new Vector2();
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { NearestFilter, RenderTarget, Vector2, PostProcessingUtils } from 'three';
|
|
2
|
-
import { getScreenPosition, getViewPosition, sqrt, mul, div, cross, float, Continue, Break, Loop, int, max, abs, sub, If, dot, reflect, normalize, screenCoordinate,
|
|
1
|
+
import { NearestFilter, RenderTarget, Vector2, PostProcessingUtils, QuadMesh, TempNode, NodeMaterial, NodeUpdateType } from 'three/webgpu';
|
|
2
|
+
import { reference, viewZToPerspectiveDepth, logarithmicDepthToViewZ, getScreenPosition, getViewPosition, sqrt, mul, div, cross, float, Continue, Break, Loop, int, max, abs, sub, If, dot, reflect, normalize, screenCoordinate, nodeObject, Fn, passTexture, uv, uniform, perspectiveDepthToViewZ, orthographicDepthToViewZ, vec2, vec3, vec4 } from 'three/tsl';
|
|
3
3
|
|
|
4
4
|
const _quadMesh = /*@__PURE__*/ new QuadMesh();
|
|
5
5
|
const _size = /*@__PURE__*/ new Vector2();
|
|
@@ -19,7 +19,7 @@ class SSRNode extends TempNode {
|
|
|
19
19
|
|
|
20
20
|
constructor( colorNode, depthNode, normalNode, metalnessNode, camera ) {
|
|
21
21
|
|
|
22
|
-
super();
|
|
22
|
+
super( 'vec4' );
|
|
23
23
|
|
|
24
24
|
this.colorNode = colorNode;
|
|
25
25
|
this.depthNode = depthNode;
|
|
@@ -42,10 +42,10 @@ class SSRNode extends TempNode {
|
|
|
42
42
|
this.thickness = uniform( 0.1 ); // controls the cutoff between what counts as a possible reflection hit and what does not
|
|
43
43
|
this.opacity = uniform( 1 ); // controls the transparency of the reflected colors
|
|
44
44
|
|
|
45
|
-
this._cameraNear = uniform( camera.near );
|
|
46
|
-
this._cameraFar = uniform( camera.far );
|
|
47
45
|
this._cameraProjectionMatrix = uniform( camera.projectionMatrix );
|
|
48
46
|
this._cameraProjectionMatrixInverse = uniform( camera.projectionMatrixInverse );
|
|
47
|
+
this._cameraNear = reference( 'near', 'float', camera );
|
|
48
|
+
this._cameraFar = reference( 'far', 'float', camera );
|
|
49
49
|
this._isPerspectiveCamera = uniform( camera.isPerspectiveCamera ? 1 : 0 );
|
|
50
50
|
this._resolution = uniform( new Vector2() );
|
|
51
51
|
this._maxStep = uniform( 0 );
|
|
@@ -151,15 +151,31 @@ class SSRNode extends TempNode {
|
|
|
151
151
|
|
|
152
152
|
} );
|
|
153
153
|
|
|
154
|
+
const sampleDepth = ( uv ) => {
|
|
155
|
+
|
|
156
|
+
const depth = this.depthNode.uv( uv ).r;
|
|
157
|
+
|
|
158
|
+
if ( builder.renderer.logarithmicDepthBuffer === true ) {
|
|
159
|
+
|
|
160
|
+
const viewZ = logarithmicDepthToViewZ( depth, this._cameraNear, this._cameraFar );
|
|
161
|
+
|
|
162
|
+
return viewZToPerspectiveDepth( viewZ, this._cameraNear, this._cameraFar );
|
|
163
|
+
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
return depth;
|
|
167
|
+
|
|
168
|
+
};
|
|
169
|
+
|
|
154
170
|
const ssr = Fn( () => {
|
|
155
171
|
|
|
156
172
|
const metalness = this.metalnessNode.uv( uvNode ).r;
|
|
157
173
|
|
|
158
|
-
|
|
174
|
+
// fragments with no metalness do not reflect their environment
|
|
159
175
|
metalness.equal( 0.0 ).discard();
|
|
160
176
|
|
|
161
177
|
// compute some standard FX entities
|
|
162
|
-
const depth =
|
|
178
|
+
const depth = sampleDepth( uvNode ).toVar();
|
|
163
179
|
const viewPosition = getViewPosition( uvNode, depth, this._cameraProjectionMatrixInverse ).toVar();
|
|
164
180
|
const viewNormal = this.normalNode.rgb.normalize().toVar();
|
|
165
181
|
|
|
@@ -214,6 +230,13 @@ class SSRNode extends TempNode {
|
|
|
214
230
|
// it does not exceed d1 (the maximum ray extend)
|
|
215
231
|
Loop( { start: int( 0 ), end: int( this._maxStep ), type: 'int', condition: '<' }, ( { i } ) => {
|
|
216
232
|
|
|
233
|
+
// TODO: Remove this when Chrome is fixed, see https://issues.chromium.org/issues/372714384#comment14
|
|
234
|
+
If( metalness.equal( 0 ), () => {
|
|
235
|
+
|
|
236
|
+
Break();
|
|
237
|
+
|
|
238
|
+
} );
|
|
239
|
+
|
|
217
240
|
// stop if the maximum number of steps is reached for this specific ray
|
|
218
241
|
If( float( i ).greaterThanEqual( totalStep ), () => {
|
|
219
242
|
|
|
@@ -233,7 +256,7 @@ class SSRNode extends TempNode {
|
|
|
233
256
|
|
|
234
257
|
// compute new uv, depth, viewZ and viewPosition for the new location on the ray
|
|
235
258
|
const uvNode = xy.div( this._resolution );
|
|
236
|
-
const d =
|
|
259
|
+
const d = sampleDepth( uvNode ).toVar();
|
|
237
260
|
const vZ = getViewZ( d ).toVar();
|
|
238
261
|
const vP = getViewPosition( uvNode, d, this._cameraProjectionMatrixInverse ).toVar();
|
|
239
262
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Vector2 } from 'three';
|
|
2
|
-
import {
|
|
1
|
+
import { Vector2, TempNode, NodeUpdateType } from 'three/webgpu';
|
|
2
|
+
import { nodeObject, Fn, uv, uniform, convertToTexture, vec2, vec3, vec4, mat3, luminance, add } from 'three/tsl';
|
|
3
3
|
|
|
4
4
|
class SobelOperatorNode extends TempNode {
|
|
5
5
|
|
|
@@ -11,7 +11,7 @@ class SobelOperatorNode extends TempNode {
|
|
|
11
11
|
|
|
12
12
|
constructor( textureNode ) {
|
|
13
13
|
|
|
14
|
-
super();
|
|
14
|
+
super( 'vec4' );
|
|
15
15
|
|
|
16
16
|
this.textureNode = textureNode;
|
|
17
17
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { RenderTarget, StereoCamera, HalfFloatType, LinearFilter, NearestFilter, Vector2, PostProcessingUtils } from 'three';
|
|
2
|
-
import {
|
|
1
|
+
import { RenderTarget, StereoCamera, HalfFloatType, LinearFilter, NearestFilter, Vector2, PassNode, QuadMesh, PostProcessingUtils } from 'three/webgpu';
|
|
2
|
+
import { texture } from 'three/tsl';
|
|
3
3
|
|
|
4
4
|
const _size = /*@__PURE__*/ new Vector2();
|
|
5
5
|
const _quadMesh = /*@__PURE__*/ new QuadMesh();
|
|
@@ -55,7 +55,7 @@ class StereoCompositePassNode extends PassNode {
|
|
|
55
55
|
const { renderer } = frame;
|
|
56
56
|
const { scene, stereo, renderTarget } = this;
|
|
57
57
|
|
|
58
|
-
_rendererState = PostProcessingUtils.
|
|
58
|
+
_rendererState = PostProcessingUtils.resetRendererState( renderer, _rendererState );
|
|
59
59
|
|
|
60
60
|
//
|
|
61
61
|
|
|
@@ -84,7 +84,7 @@ class StereoCompositePassNode extends PassNode {
|
|
|
84
84
|
|
|
85
85
|
// restore
|
|
86
86
|
|
|
87
|
-
PostProcessingUtils.restoreRendererState( renderer,
|
|
87
|
+
PostProcessingUtils.restoreRendererState( renderer, _rendererState );
|
|
88
88
|
|
|
89
89
|
}
|
|
90
90
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { StereoCamera, Vector2, PostProcessingUtils } from 'three';
|
|
2
|
-
import {
|
|
1
|
+
import { StereoCamera, Vector2, PassNode, PostProcessingUtils } from 'three/webgpu';
|
|
2
|
+
import { nodeObject } from 'three/tsl';
|
|
3
3
|
|
|
4
4
|
const _size = /*@__PURE__*/ new Vector2();
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Color, Vector2, PostProcessingUtils,
|
|
2
|
-
import { add, float, If, Loop, int, Fn, min, max, clamp, nodeObject,
|
|
1
|
+
import { Color, Vector2, NearestFilter, Matrix4, PostProcessingUtils, PassNode, QuadMesh, NodeMaterial } from 'three/webgpu';
|
|
2
|
+
import { add, float, If, Loop, int, Fn, min, max, clamp, nodeObject, texture, uniform, uv, vec2, vec4, luminance } from 'three/tsl';
|
|
3
3
|
|
|
4
4
|
const _quadMesh = /*@__PURE__*/ new QuadMesh();
|
|
5
5
|
const _size = /*@__PURE__*/ new Vector2();
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { TempNode
|
|
1
|
+
import { TempNode } from 'three/webgpu';
|
|
2
|
+
import { nodeObject, Fn, float, uv, convertToTexture, vec4, If, int, clamp, sub, mix } from 'three/tsl';
|
|
2
3
|
|
|
3
4
|
class TransitionNode extends TempNode {
|
|
4
5
|
|
|
@@ -10,7 +11,7 @@ class TransitionNode extends TempNode {
|
|
|
10
11
|
|
|
11
12
|
constructor( textureNodeA, textureNodeB, mixTextureNode, mixRatioNode, thresholdNode, useTextureNode ) {
|
|
12
13
|
|
|
13
|
-
super();
|
|
14
|
+
super( 'vec4' );
|
|
14
15
|
|
|
15
16
|
// Input textures
|
|
16
17
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import { DataTexture, FloatType, RGBAFormat, Vector2, Vector3, LightsNode, NodeUpdateType } from 'three/webgpu';
|
|
2
|
+
|
|
1
3
|
import {
|
|
2
|
-
|
|
4
|
+
attributeArray, nodeProxy, int, float, vec2, ivec2, ivec4, uniform, Break, Loop,
|
|
3
5
|
Fn, If, Return, textureLoad, instanceIndex, screenCoordinate, directPointLight
|
|
4
6
|
} from 'three/tsl';
|
|
5
7
|
|
|
6
|
-
import { DataTexture, FloatType, LightsNode, NodeUpdateType, RGBAFormat, StorageBufferAttribute, Vector2, Vector3 } from 'three';
|
|
7
|
-
|
|
8
8
|
export const circleIntersectsAABB = /*@__PURE__*/ Fn( ( [ circleCenter, radius, minBounds, maxBounds ] ) => {
|
|
9
9
|
|
|
10
10
|
// Find the closest point on the AABB to the circle's center using method chaining
|
|
@@ -204,6 +204,8 @@ class TiledLightsNode extends LightsNode {
|
|
|
204
204
|
lightingModel.directDiffuse.append();
|
|
205
205
|
lightingModel.directSpecular.append();
|
|
206
206
|
|
|
207
|
+
super.setupLights( builder, lightNodes );
|
|
208
|
+
|
|
207
209
|
Fn( () => {
|
|
208
210
|
|
|
209
211
|
Loop( this.tileLightCount, ( { i } ) => {
|
|
@@ -229,10 +231,6 @@ class TiledLightsNode extends LightsNode {
|
|
|
229
231
|
|
|
230
232
|
} )().append();
|
|
231
233
|
|
|
232
|
-
// others lights
|
|
233
|
-
|
|
234
|
-
super.setupLights( builder, lightNodes );
|
|
235
|
-
|
|
236
234
|
}
|
|
237
235
|
|
|
238
236
|
getBufferFitSize( value ) {
|
|
@@ -291,8 +289,7 @@ class TiledLightsNode extends LightsNode {
|
|
|
291
289
|
const lightsTexture = new DataTexture( lightsData, lightsData.length / 8, 2, RGBAFormat, FloatType );
|
|
292
290
|
|
|
293
291
|
const lightIndexesArray = new Int32Array( count * 4 * 2 );
|
|
294
|
-
const
|
|
295
|
-
const lightIndexes = storageObject( lightIndexesAttribute, 'ivec4', lightIndexesAttribute.count ).label( 'lightIndexes' );
|
|
292
|
+
const lightIndexes = attributeArray( lightIndexesArray, 'ivec4' ).label( 'lightIndexes' );
|
|
296
293
|
|
|
297
294
|
// compute
|
|
298
295
|
|