@@ -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
0 commit comments