提交 e1be6103 编写于 作者: S sunag

fix sheen example needsCompile

上级 786e0150
......@@ -118,14 +118,36 @@
var gui = new GUI();
gui.add( params, 'nodeMaterial' );
function onUpdate() {
mesh.material = sphere.material = params.nodeMaterial
? nodeMaterial
: material;
material.sheen = params.sheenBRDF
? new THREE.Color()
: null;
material.needsUpdate = true;
nodeMaterial.sheen = params.sheenBRDF
? new Nodes.ColorNode( material.sheen )
: undefined;
nodeMaterial.needsCompile = true;
}
gui.add( params, 'nodeMaterial' ).onChange( onUpdate );
gui.addColor( params, 'color' );
gui.add( params, 'sheenBRDF' );
gui.add( params, 'sheenBRDF' ).onChange( onUpdate );
gui.addColor( params, 'sheen' );
gui.add( params, 'roughness', 0, 1 );
gui.add( params, 'exposure', 0, 3 );
gui.open();
onUpdate();
animate();
}
......@@ -150,32 +172,23 @@
function render() {
mesh.material = sphere.material = params.nodeMaterial
? nodeMaterial
: material;
//
material.sheen = params.sheenBRDF
? new THREE.Color().copy( params.sheen ).multiplyScalar( 1 / 255 )
: null;
material.color.copy( params.color ).multiplyScalar( 1 / 255 );
material.roughness = params.roughness;
material.needsUpdate = true;
//
nodeMaterial.sheen = params.sheenBRDF
? new Nodes.ColorNode( material.sheen )
: undefined;
nodeMaterial.color.value.copy( material.color );
nodeMaterial.roughness.value = params.roughness;
nodeMaterial.needsCompile = true;
//
if ( params.sheenBRDF ) {
material.sheen.copy( params.sheen ).multiplyScalar( 1 / 255 );
}
//
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册