Skip to content

Commit ed96b8d

Browse files
authored
TextureNode: Rename .uv() -> .sample() (mrdoob#30061)
1 parent f5f25c3 commit ed96b8d

33 files changed

+108
-100
lines changed

examples/jsm/misc/ProgressiveLightMapGPU.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class ProgressiveLightMap {
5050

5151
this._uvMat = new MeshPhongNodeMaterial();
5252
this._uvMat.vertexNode = vec4( sub( uvNode, vec2( 0.5 ) ).mul( 2 ), 1, 1 );
53-
this._uvMat.outputNode = vec4( mix( this._previousShadowMap.uv( uv( 1 ) ), output, float( 1 ).div( this._averagingWindow ) ) );
53+
this._uvMat.outputNode = vec4( mix( this._previousShadowMap.sample( uv( 1 ) ), output, float( 1 ).div( this._averagingWindow ) ) );
5454

5555
}
5656

@@ -229,7 +229,7 @@ class ProgressiveLightMap {
229229
if ( this._labelMesh === null ) {
230230

231231
const labelMaterial = new NodeMaterial();
232-
labelMaterial.colorNode = texture( this._progressiveLightMap1.texture ).uv( uv().flipY() );
232+
labelMaterial.colorNode = texture( this._progressiveLightMap1.texture ).sample( uv().flipY() );
233233
labelMaterial.side = DoubleSide;
234234

235235
const labelGeometry = new PlaneGeometry( 100, 100 );
@@ -267,14 +267,14 @@ class ProgressiveLightMap {
267267
const pixelOffset = float( 0.5 ).div( float( this.resolution ) ).toVar();
268268

269269
const color = add(
270-
this._previousShadowMap.uv( uvNode.add( vec2( pixelOffset, 0 ) ) ),
271-
this._previousShadowMap.uv( uvNode.add( vec2( 0, pixelOffset ) ) ),
272-
this._previousShadowMap.uv( uvNode.add( vec2( 0, pixelOffset.negate() ) ) ),
273-
this._previousShadowMap.uv( uvNode.add( vec2( pixelOffset.negate(), 0 ) ) ),
274-
this._previousShadowMap.uv( uvNode.add( vec2( pixelOffset, pixelOffset ) ) ),
275-
this._previousShadowMap.uv( uvNode.add( vec2( pixelOffset.negate(), pixelOffset ) ) ),
276-
this._previousShadowMap.uv( uvNode.add( vec2( pixelOffset, pixelOffset.negate() ) ) ),
277-
this._previousShadowMap.uv( uvNode.add( vec2( pixelOffset.negate(), pixelOffset.negate() ) ) ),
270+
this._previousShadowMap.sample( uvNode.add( vec2( pixelOffset, 0 ) ) ),
271+
this._previousShadowMap.sample( uvNode.add( vec2( 0, pixelOffset ) ) ),
272+
this._previousShadowMap.sample( uvNode.add( vec2( 0, pixelOffset.negate() ) ) ),
273+
this._previousShadowMap.sample( uvNode.add( vec2( pixelOffset.negate(), 0 ) ) ),
274+
this._previousShadowMap.sample( uvNode.add( vec2( pixelOffset, pixelOffset ) ) ),
275+
this._previousShadowMap.sample( uvNode.add( vec2( pixelOffset.negate(), pixelOffset ) ) ),
276+
this._previousShadowMap.sample( uvNode.add( vec2( pixelOffset, pixelOffset.negate() ) ) ),
277+
this._previousShadowMap.sample( uvNode.add( vec2( pixelOffset.negate(), pixelOffset.negate() ) ) ),
278278
).div( 8 );
279279

280280
blurMaterial.fragmentNode = color;

examples/jsm/objects/Water2Mesh.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,8 @@ class WaterNode extends TempNode {
122122
const normalUv0 = uvs.mul( this.scale ).add( flow.mul( flowMapOffset0 ) );
123123
const normalUv1 = uvs.mul( this.scale ).add( flow.mul( flowMapOffset1 ) );
124124

125-
const normalColor0 = this.normalMap0.uv( normalUv0 );
126-
const normalColor1 = this.normalMap1.uv( normalUv1 );
125+
const normalColor0 = this.normalMap0.sample( normalUv0 );
126+
const normalColor1 = this.normalMap1.sample( normalUv1 );
127127

128128
// linear interpolate to get the final normal color
129129
const flowLerp = abs( halfCycle.sub( flowMapOffset0 ) ).div( halfCycle );

examples/jsm/objects/WaterMesh.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,10 @@ class WaterMesh extends Mesh {
4747
const uv2 = add( div( uv, vec2( 8907.0, 9803.0 ) ), vec2( div( offset, 101 ), div( offset, 97 ) ) ).toVar();
4848
const uv3 = sub( div( uv, vec2( 1091.0, 1027.0 ) ), vec2( div( offset, 109 ), div( offset, - 113 ) ) ).toVar();
4949

50-
const sample0 = this.waterNormals.uv( uv0 );
51-
const sample1 = this.waterNormals.uv( uv1 );
52-
const sample2 = this.waterNormals.uv( uv2 );
53-
const sample3 = this.waterNormals.uv( uv3 );
50+
const sample0 = this.waterNormals.sample( uv0 );
51+
const sample1 = this.waterNormals.sample( uv1 );
52+
const sample2 = this.waterNormals.sample( uv2 );
53+
const sample3 = this.waterNormals.sample( uv3 );
5454

5555
const noise = sample0.add( sample1 ).add( sample2 ).add( sample3 );
5656

examples/jsm/tsl/display/AfterImageNode.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ class AfterImageNode extends TempNode {
101101

102102
textureNodeOld.uvNode = uvNode;
103103

104-
const sampleTexture = ( uv ) => textureNode.uv( uv );
104+
const sampleTexture = ( uv ) => textureNode.sample( uv );
105105

106106
const when_gt = Fn( ( [ x_immutable, y_immutable ] ) => {
107107

examples/jsm/tsl/display/AnaglyphPassNode.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ class AnaglyphPassNode extends StereoCompositePassNode {
3838

3939
const anaglyph = Fn( () => {
4040

41-
const colorL = this._mapLeft.uv( uvNode );
42-
const colorR = this._mapRight.uv( uvNode );
41+
const colorL = this._mapLeft.sample( uvNode );
42+
const colorR = this._mapRight.sample( uvNode );
4343

4444
const color = clamp( this._colorMatrixLeft.mul( colorL.rgb ).add( this._colorMatrixRight.mul( colorR.rgb ) ) );
4545

examples/jsm/tsl/display/AnamorphicNode.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ class AnamorphicNode extends TempNode {
9090
const textureNode = this.textureNode;
9191
const uvNode = textureNode.uvNode || uv();
9292

93-
const sampleTexture = ( uv ) => textureNode.uv( uv );
93+
const sampleTexture = ( uv ) => textureNode.sample( uv );
9494

9595
const threshold = ( color, threshold ) => mix( vec3( 0.0 ), color, luminance( color ).sub( threshold ).max( 0 ) );
9696

examples/jsm/tsl/display/BloomNode.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ class BloomNode extends TempNode {
268268
const direction = uniform( new Vector2( 0.5, 0.5 ) );
269269

270270
const uvNode = uv();
271-
const sampleTexel = ( uv ) => colorTexture.uv( uv );
271+
const sampleTexel = ( uv ) => colorTexture.sample( uv );
272272

273273
const seperableBlurPass = Fn( () => {
274274

examples/jsm/tsl/display/DenoiseNode.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,10 @@ class DenoiseNode extends TempNode {
4848

4949
const uvNode = uv();
5050

51-
const sampleTexture = ( uv ) => this.textureNode.uv( uv );
52-
const sampleDepth = ( uv ) => this.depthNode.uv( uv ).x;
53-
const sampleNormal = ( uv ) => ( this.normalNode !== null ) ? this.normalNode.uv( uv ).rgb.normalize() : getNormalFromDepth( uv, this.depthNode.value, this._cameraProjectionMatrixInverse );
54-
const sampleNoise = ( uv ) => this.noiseNode.uv( uv );
51+
const sampleTexture = ( uv ) => this.textureNode.sample( uv );
52+
const sampleDepth = ( uv ) => this.depthNode.sample( uv ).x;
53+
const sampleNormal = ( uv ) => ( this.normalNode !== null ) ? this.normalNode.sample( uv ).rgb.normalize() : getNormalFromDepth( uv, this.depthNode.value, this._cameraProjectionMatrixInverse );
54+
const sampleNoise = ( uv ) => this.noiseNode.sample( uv );
5555

5656
const denoiseSample = Fn( ( [ center, viewNormal, viewPosition, sampleUv ] ) => {
5757

examples/jsm/tsl/display/DepthOfFieldNode.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class DepthOfFieldNode extends TempNode {
3939
const textureNode = this.textureNode;
4040
const uvNode = textureNode.uvNode || uv();
4141

42-
const sampleTexture = ( uv ) => textureNode.uv( uv );
42+
const sampleTexture = ( uv ) => textureNode.sample( uv );
4343

4444
const dof = Fn( () => {
4545

examples/jsm/tsl/display/FXAANode.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class FXAANode extends TempNode {
4444

4545
const Sample = Fn( ( [ uv ] ) => {
4646

47-
return textureNode.uv( uv );
47+
return textureNode.sample( uv );
4848

4949
} );
5050

0 commit comments

Comments
 (0)