1212 * - Ambient occlusion clamp (numeric value).
1313 * - lumInfluence
1414 * - Pixel luminosity influence in AO calculation (numeric value).
15- *
15+ *
1616 * To output to screen set renderToScreens true
1717 *
1818 * @author alteredq / http://alteredqualia.com/
2121 */
2222THREE . SSAOPass = function ( scene , camera , width , height ) {
2323
24- if ( THREE . SSAOShader === undefined ) {
24+ if ( THREE . SSAOShader === undefined ) {
2525
2626 console . warn ( 'THREE.SSAOPass depends on THREE.SSAOShader' ) ;
2727 return new THREE . ShaderPass ( ) ;
@@ -46,7 +46,7 @@ THREE.SSAOPass = function ( scene, camera, width, height ) {
4646 //Depth render target
4747 this . depthRenderTarget = new THREE . WebGLRenderTarget ( this . width , this . height , { minFilter : THREE . LinearFilter , magFilter : THREE . LinearFilter } ) ;
4848 //this.depthRenderTarget.texture.name = 'SSAOShader.rt';
49-
49+
5050 //Shader uniforms
5151 this . uniforms [ 'tDepth' ] . value = this . depthRenderTarget . texture ;
5252 this . uniforms [ 'size' ] . value . set ( this . width , this . height ) ;
@@ -59,51 +59,84 @@ THREE.SSAOPass = function ( scene, camera, width, height ) {
5959 this . uniforms [ 'lumInfluence' ] . value = 0.7 ;
6060
6161 //Setters and getters for uniforms
62- var self = this ;
63- Object . defineProperties ( this , {
62+
63+ Object . defineProperties ( this , {
6464
6565 radius : {
66- get : function ( ) { return this . uniforms [ 'radius' ] . value ; } ,
67- set : function ( value ) { this . uniforms [ 'radius' ] . value = value ; }
66+ get : function ( ) {
67+
68+ return this . uniforms [ 'radius' ] . value ;
69+
70+ } ,
71+ set : function ( value ) {
72+
73+ this . uniforms [ 'radius' ] . value = value ;
74+
75+ }
6876 } ,
6977
7078 onlyAO : {
71- get : function ( ) { return this . uniforms [ 'onlyAO' ] . value ; } ,
72- set : function ( value ) { this . uniforms [ 'onlyAO' ] . value = value ; }
79+ get : function ( ) {
80+
81+ return this . uniforms [ 'onlyAO' ] . value ;
82+
83+ } ,
84+ set : function ( value ) {
85+
86+ this . uniforms [ 'onlyAO' ] . value = value ;
87+
88+ }
7389 } ,
7490
7591 aoClamp : {
76- get : function ( ) { return this . uniforms [ 'aoClamp' ] . value ; } ,
77- set : function ( value ) { this . uniforms [ 'aoClamp' ] . value = value ; }
92+ get : function ( ) {
93+
94+ return this . uniforms [ 'aoClamp' ] . value ;
95+
96+ } ,
97+ set : function ( value ) {
98+
99+ this . uniforms [ 'aoClamp' ] . value = value ;
100+
101+ }
78102 } ,
79103
80104 lumInfluence : {
81- get : function ( ) { return this . uniforms [ 'lumInfluence' ] . value ; } ,
82- set : function ( value ) { this . uniforms [ 'lumInfluence' ] . value = value ; }
105+ get : function ( ) {
106+
107+ return this . uniforms [ 'lumInfluence' ] . value ;
108+
109+ } ,
110+ set : function ( value ) {
111+
112+ this . uniforms [ 'lumInfluence' ] . value = value ;
113+
114+ }
83115 } ,
84116
85- } ) ;
86- }
117+ } ) ;
118+
119+ } ;
87120
88121THREE . SSAOPass . prototype = Object . create ( THREE . ShaderPass . prototype ) ;
89122
90123/**
91124 * Render using this pass.
92- *
125+ *
93126 * @method render
94127 * @param {WebGLRenderer } renderer
95128 * @param {WebGLRenderTarget } writeBuffer Buffer to write output.
96129 * @param {WebGLRenderTarget } readBuffer Input buffer.
97130 * @param {Number } delta Delta time in milliseconds.
98131 * @param {Boolean } maskActive Not used in this pass.
99132 */
100- THREE . SSAOPass . prototype . render = function ( renderer , writeBuffer , readBuffer , delta , maskActive ) {
133+ THREE . SSAOPass . prototype . render = function ( renderer , writeBuffer , readBuffer , delta , maskActive ) {
101134
102135 //Render depth into depthRenderTarget
103136 this . scene2 . overrideMaterial = this . depthMaterial ;
104-
137+
105138 renderer . render ( this . scene2 , this . camera2 , this . depthRenderTarget , true ) ;
106-
139+
107140 this . scene2 . overrideMaterial = null ;
108141
109142
@@ -118,8 +151,8 @@ THREE.SSAOPass.prototype.render = function( renderer, writeBuffer, readBuffer, d
118151 * @method setScene
119152 * @param {Scene } scene
120153 */
121- THREE . SSAOPass . prototype . setScene = function ( scene ) {
122-
154+ THREE . SSAOPass . prototype . setScene = function ( scene ) {
155+
123156 this . scene2 = scene ;
124157
125158} ;
@@ -130,7 +163,7 @@ THREE.SSAOPass.prototype.setScene = function(scene) {
130163 * @method setCamera
131164 * @param {Camera } camera
132165 */
133- THREE . SSAOPass . prototype . setCamera = function ( camera ) {
166+ THREE . SSAOPass . prototype . setCamera = function ( camera ) {
134167
135168 this . camera2 = camera ;
136169
@@ -141,12 +174,12 @@ THREE.SSAOPass.prototype.setCamera = function( camera ) {
141174
142175/**
143176 * Set resolution of this render pass.
144- *
177+ *
145178 * @method setSize
146179 * @param {Number } width
147180 * @param {Number } height
148181 */
149- THREE . SSAOPass . prototype . setSize = function ( width , height ) {
182+ THREE . SSAOPass . prototype . setSize = function ( width , height ) {
150183
151184 this . width = width ;
152185 this . height = height ;
0 commit comments