提交 183baa4a 编写于 作者: M Mr.doob

Clean up.

上级 ebaa0d64
......@@ -110,6 +110,7 @@ Spiral sampling http://web.archive.org/web/20120421191837/http://www.cgafaq.info
mesh.scale.x = mesh.scale.y = mesh.scale.z = Math.random() * 10 + 1;
group.add( mesh );
}
stats = new Stats();
......@@ -124,17 +125,27 @@ Spiral sampling http://web.archive.org/web/20120421191837/http://www.cgafaq.info
gui.add( postprocessing, "renderMode", { framebuffer: 0, onlyAO: 1 } ).onChange( renderModeChange ).listen();
window.addEventListener( 'resize', onWindowResize, false );
}
function renderModeChange( value ) {
if ( value == 0 ) { // framebuffer
if ( value == 0 ) {
// framebuffer
ssaoPass.uniforms[ 'onlyAO' ].value = false;
} else if ( value == 1 ) { // onlyAO
} else if ( value == 1 ) {
// onlyAO
ssaoPass.uniforms[ 'onlyAO' ].value = true;
} else {
console.error( "Not define renderModeChange type: " + value );
}
}
function onWindowResize() {
......@@ -154,6 +165,7 @@ Spiral sampling http://web.archive.org/web/20120421191837/http://www.cgafaq.info
var newHeight = Math.floor( height / pixelRatio ) || 1;
depthRenderTarget.setSize( newWidth, newHeight );
effectComposer.setSize( newWidth, newHeight );
}
function initPostprocessing() {
......@@ -163,7 +175,6 @@ Spiral sampling http://web.archive.org/web/20120421191837/http://www.cgafaq.info
// Setup depth pass
depthMaterial = new THREE.MeshDepthMaterial();
depthMaterial.depthFormat = THREE.AutoDepthFormat;
depthMaterial.depthPacking = THREE.RGBADepthPacking;
depthMaterial.blending = THREE.NoBlending;
......@@ -186,17 +197,21 @@ Spiral sampling http://web.archive.org/web/20120421191837/http://www.cgafaq.info
effectComposer = new THREE.EffectComposer( renderer );
effectComposer.addPass( renderPass );
effectComposer.addPass( ssaoPass );
}
function animate() {
requestAnimationFrame( animate );
stats.begin();
render();
stats.end();
}
function render() {
var timer = performance.now();
group.rotation.x = timer * 0.0002;
group.rotation.y = timer * 0.0001;
......@@ -212,8 +227,11 @@ Spiral sampling http://web.archive.org/web/20120421191837/http://www.cgafaq.info
effectComposer.render();
} else {
renderer.render( scene, camera );
}
}
</script>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册