Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
mamayaya1
GitHub Repository: mamayaya1/game
Path: blob/main/projects/HexGL/libs/postprocessing/RenderPass.js
4627 views
1
/**
2
* @author alteredq / http://alteredqualia.com/
3
*/
4
5
THREE.RenderPass = function ( scene, camera, overrideMaterial, clearColor, clearAlpha ) {
6
7
this.scene = scene;
8
this.camera = camera;
9
10
this.overrideMaterial = overrideMaterial;
11
12
this.clearColor = clearColor;
13
this.clearAlpha = ( clearAlpha !== undefined ) ? clearAlpha : 1;
14
15
this.oldClearColor = new THREE.Color();
16
this.oldClearAlpha = 1;
17
18
this.enabled = true;
19
this.clear = true;
20
this.needsSwap = false;
21
22
this.prePass = null;
23
this.postPass = null;
24
};
25
26
THREE.RenderPass.prototype = {
27
28
render: function ( renderer, writeBuffer, readBuffer, delta ) {
29
30
if( this.prePass )
31
{
32
this.prePass.call(this, renderer);
33
}
34
35
this.scene.overrideMaterial = this.overrideMaterial;
36
37
if ( this.clearColor ) {
38
39
this.oldClearColor.copy( renderer.getClearColor() );
40
this.oldClearAlpha = renderer.getClearAlpha();
41
42
renderer.setClearColor( this.clearColor, this.clearAlpha );
43
44
}
45
46
renderer.render( this.scene, this.camera, readBuffer, this.clear );
47
48
if ( this.clearColor ) {
49
50
renderer.setClearColor( this.oldClearColor, this.oldClearAlpha );
51
52
}
53
54
this.scene.overrideMaterial = null;
55
56
if( this.postPass )
57
{
58
this.postPass.call(this, renderer);
59
}
60
61
}
62
63
};
64
65