PageSourceSearch

https://dino3d.games/libs/three/postprocessing/ShaderPass.js

js dino3d.games collected 2026-09-25 20:20:45 UTC 1,504 bytes, 66 lines download raw bytes

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

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.