PageSourceSearch

https://www.get3d.ai/lib/three/ShaderPass.js

js get3d.ai collected 2026-10-05 13:44:04 UTC 1,416 bytes, 63 lines download raw bytes

1( function () {
2
3	class ShaderPass extends THREE.Pass {
4
5		constructor( shader, textureID ) {
6
7			super();
8			this.textureID = textureID !== undefined ? textureID : 'tDiffuse';
9
10			if ( shader instanceof THREE.ShaderMaterial ) {
11
12				this.uniforms = shader.uniforms;
13				this.material = shader;
14
15			} else if ( shader ) {
16
17				this.uniforms = THREE.UniformsUtils.clone( shader.uniforms );
18				this.material = new THREE.ShaderMaterial( {
19					defines: Object.assign( {}, shader.defines ),
20					uniforms: this.uniforms,
21					vertexShader: shader.vertexShader,
22					fragmentShader: shader.fragmentShader
23				} );
24
25			}
26
27			this.fsQuad = new THREE.FullScreenQuad( this.material );
28
29		}
30
31		render( renderer, writeBuffer, readBuffer
32			/*, deltaTime, maskActive */
33		) {
34
35			if ( this.uniforms[ this.textureID ] ) {
36
37				this.uniforms[ this.textureID ].value = readBuffer.texture;
38
39			}
40
41			this.fsQuad.material = this.material;
42
43			if ( this.renderToScreen ) {
44
45				renderer.setRenderTarget( null );
46				this.fsQuad.render( renderer );
47
48			} else {
49
50				renderer.setRenderTarget( writeBuffer ); // TODO: Avoid using autoClear properties, see https://github.com/mrdoob/three.js/pull/15571#issuecomment-465669600
51
52				if ( this.clear ) renderer.clear( renderer.autoClearColor, renderer.autoClearDepth, renderer.autoClearStencil );
53				this.fsQuad.render( renderer );
54
55			}
56
57		}
58
59	}
60
61	THREE.ShaderPass = ShaderPass;
62
63} )();

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.