Skip to content

Commit 3be0076

Browse files
authored
Add damp accessor to WebGL AfterimagePass class (#31035)
* Added damp accessor with clamping to WebGL AfterimagePass * Updated Afterimage example GUI * Removed damp clamp and setter JSDocs, tweak getter JSDocs to include range
1 parent d0dd0fc commit 3be0076

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

examples/jsm/postprocessing/AfterimagePass.js

+18-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class AfterimagePass extends Pass {
4343
*/
4444
this.uniforms = UniformsUtils.clone( AfterimageShader.uniforms );
4545

46-
this.uniforms[ 'damp' ].value = damp;
46+
this.damp = damp;
4747

4848
/**
4949
* The composition material.
@@ -89,6 +89,23 @@ class AfterimagePass extends Pass {
8989

9090
}
9191

92+
/**
93+
* The damping intensity, from 0.0 to 1.0. A higher value means a stronger after image effect.
94+
*
95+
* @type {number}
96+
*/
97+
get damp() {
98+
99+
return this.uniforms[ 'damp' ].value;
100+
101+
}
102+
103+
set damp( value ) {
104+
105+
this.uniforms[ 'damp' ].value = value;
106+
107+
}
108+
92109
/**
93110
* Performs the after image pass.
94111
*

examples/webgl_postprocessing_afterimage.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
window.addEventListener( 'resize', onWindowResize );
7474

7575
const gui = new GUI( { title: 'Damp setting' } );
76-
gui.add( afterimagePass.uniforms[ 'damp' ], 'value', 0, 1 ).step( 0.001 );
76+
gui.add( afterimagePass, 'damp', 0, 1 ).step( 0.001 );
7777
gui.add( params, 'enable' );
7878

7979
}

0 commit comments

Comments
 (0)