Skip to content

Commit 9aa74de

Browse files
authored
LensflareNode, OutlineNode: Added *Node suffix (mrdoob#29719)
1 parent cdc33fe commit 9aa74de

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

examples/jsm/tsl/display/LensflareNode.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@ class LensflareNode extends TempNode {
3333
downSampleRatio = 4
3434
} = params;
3535

36-
this.ghostTint = ghostTint;
37-
this.threshold = threshold;
38-
this.ghostSamples = ghostSamples;
39-
this.ghostSpacing = ghostSpacing;
40-
this.ghostAttenuationFactor = ghostAttenuationFactor;
36+
this.ghostTintNode = nodeObject( ghostTint );
37+
this.thresholdNode = nodeObject( threshold );
38+
this.ghostSamplesNode = nodeObject( ghostSamples );
39+
this.ghostSpacingNode = nodeObject( ghostSpacing );
40+
this.ghostAttenuationFactorNode = nodeObject( ghostAttenuationFactor );
4141
this.downSampleRatio = downSampleRatio;
4242

4343
this.updateBeforeType = NodeUpdateType.FRAME;
@@ -109,13 +109,13 @@ class LensflareNode extends TempNode {
109109

110110
// ghosts are positioned along this vector
111111

112-
const ghostVec = sub( vec2( 0.5 ), texCoord ).mul( this.ghostSpacing ).toVar();
112+
const ghostVec = sub( vec2( 0.5 ), texCoord ).mul( this.ghostSpacingNode ).toVar();
113113

114114
// sample ghosts
115115

116116
const result = vec4().toVar();
117117

118-
Loop( { start: int( 0 ), end: int( this.ghostSamples ), type: 'int', condition: '<' }, ( { i } ) => {
118+
Loop( { start: int( 0 ), end: int( this.ghostSamplesNode ), type: 'int', condition: '<' }, ( { i } ) => {
119119

120120
// use fract() to ensure that the texture coordinates wrap around
121121

@@ -124,13 +124,13 @@ class LensflareNode extends TempNode {
124124
// reduce contributions from samples at the screen edge
125125

126126
const d = distance( sampleUv, vec2( 0.5 ) );
127-
const weight = pow( d.oneMinus(), this.ghostAttenuationFactor );
127+
const weight = pow( d.oneMinus(), this.ghostAttenuationFactorNode );
128128

129129
// accumulate
130130

131131
let sample = this.textureNode.uv( sampleUv ).rgb;
132132

133-
sample = max( sample.sub( this.threshold ), vec3( 0 ) ).mul( this.ghostTint );
133+
sample = max( sample.sub( this.thresholdNode ), vec3( 0 ) ).mul( this.ghostTintNode );
134134

135135
result.addAssign( sample.mul( weight ) );
136136

examples/jsm/tsl/display/OutlineNode.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ class OutlineNode extends TempNode {
3030
this.scene = scene;
3131
this.camera = camera;
3232
this.selectedObjects = selectedObjects;
33+
this.edgeThicknessNode = nodeObject( edgeThickness );
34+
this.edgeGlowNode = nodeObject( edgeGlow );
3335
this.downSampleRatio = downSampleRatio;
34-
this.edgeThickness = edgeThickness;
35-
this.edgeGlow = edgeGlow;
3636

3737
this.updateBeforeType = NodeUpdateType.FRAME;
3838

@@ -360,7 +360,7 @@ class OutlineNode extends TempNode {
360360

361361
} );
362362

363-
this._separableBlurMaterial.fragmentNode = seperableBlur( this.edgeThickness );
363+
this._separableBlurMaterial.fragmentNode = seperableBlur( this.edgeThicknessNode );
364364
this._separableBlurMaterial.needsUpdate = true;
365365

366366
this._separableBlurMaterial2.fragmentNode = seperableBlur( MAX_RADIUS );
@@ -374,7 +374,7 @@ class OutlineNode extends TempNode {
374374
const edgeValue2 = this._edge2TextureUniform;
375375
const maskColor = this._maskTextureUniform;
376376

377-
const edgeValue = edgeValue1.add( edgeValue2.mul( this.edgeGlow ) );
377+
const edgeValue = edgeValue1.add( edgeValue2.mul( this.edgeGlowNode ) );
378378

379379
return maskColor.r.mul( edgeValue );
380380

0 commit comments

Comments
 (0)