提交 79155fd5 编写于 作者: M Mugen87

Examples: Make SSAOPass WebGL 2 compatible.

上级 65bb7e70
......@@ -369,19 +369,26 @@ THREE.SSAOPass.prototype = Object.assign( Object.create( THREE.Pass.prototype ),
var simplex = new SimplexNoise();
var size = width * height;
var data = new Float32Array( size );
var data = new Float32Array( size * 4 );
for ( var i = 0; i < size; i ++ ) {
var stride = i * 4;
var x = ( Math.random() * 2 ) - 1;
var y = ( Math.random() * 2 ) - 1;
var z = 0;
data[ i ] = simplex.noise3d( x, y, z );
var noise = simplex.noise3d( x, y, z );
data[ stride ] = noise;
data[ stride + 1 ] = noise;
data[ stride + 2 ] = noise;
data[ stride + 3 ] = 1;
}
this.noiseTexture = new THREE.DataTexture( data, width, height, THREE.LuminanceFormat, THREE.FloatType );
this.noiseTexture = new THREE.DataTexture( data, width, height, THREE.RGBA, THREE.FloatType );
this.noiseTexture.wrapS = THREE.RepeatWrapping;
this.noiseTexture.wrapT = THREE.RepeatWrapping;
this.noiseTexture.needsUpdate = true;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册