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

Editor: Added MeshPhysicalMaterial support.

上级 ed4534ef
......@@ -60,9 +60,10 @@ Sidebar.Material = function ( editor ) {
'LineDashedMaterial': 'LineDashedMaterial',
'MeshBasicMaterial': 'MeshBasicMaterial',
'MeshDepthMaterial': 'MeshDepthMaterial',
'MeshLambertMaterial': 'MeshLambertMaterial',
'MeshNormalMaterial': 'MeshNormalMaterial',
'MeshLambertMaterial': 'MeshLambertMaterial',
'MeshPhongMaterial': 'MeshPhongMaterial',
'MeshPhysicalMaterial': 'MeshPhysicalMaterial',
'ShaderMaterial': 'ShaderMaterial',
'SpriteMaterial': 'SpriteMaterial'
......@@ -117,6 +118,26 @@ Sidebar.Material = function ( editor ) {
container.add( materialColorRow );
// roughness
var materialRoughnessRow = new UI.Panel();
var materialRoughness = new UI.Number( 0.5 ).setWidth( '60px' ).setRange( 0, 1 ).onChange( update );
materialRoughnessRow.add( new UI.Text( 'Roughness' ).setWidth( '90px' ) );
materialRoughnessRow.add( materialRoughness );
container.add( materialRoughnessRow );
// metalness
var materialMetalnessRow = new UI.Panel();
var materialMetalness = new UI.Number( 1 ).setWidth( '60px' ).setRange( 0, 1 ).onChange( update );
materialMetalnessRow.add( new UI.Text( 'Metalness' ).setWidth( '90px' ) );
materialMetalnessRow.add( materialMetalness );
container.add( materialMetalnessRow );
// emissive
var materialEmissiveRow = new UI.Panel();
......@@ -425,6 +446,18 @@ Sidebar.Material = function ( editor ) {
}
if ( material.roughness !== undefined && Math.abs( material.roughness - materialRoughness.getValue() ) >= 0.01 ) {
editor.execute( new SetMaterialValueCommand( currentObject, 'roughness', materialRoughness.getValue() ) );
}
if ( material.metalness !== undefined && Math.abs( material.metalness - materialMetalness.getValue() ) >= 0.01 ) {
editor.execute( new SetMaterialValueCommand( currentObject, 'metalness', materialMetalness.getValue() ) );
}
if ( material.emissive !== undefined && material.emissive.getHex() !== materialEmissive.getHexValue() ) {
editor.execute( new SetMaterialColorCommand( currentObject, 'emissive', materialEmissive.getHexValue() ) );
......@@ -752,6 +785,8 @@ Sidebar.Material = function ( editor ) {
var properties = {
'name': materialNameRow,
'color': materialColorRow,
'roughness': materialRoughnessRow,
'metalness': materialMetalnessRow,
'emissive': materialEmissiveRow,
'specular': materialSpecularRow,
'shininess': materialShininessRow,
......@@ -813,6 +848,18 @@ Sidebar.Material = function ( editor ) {
}
if ( material.roughness !== undefined ) {
materialRoughness.setValue( material.roughness );
}
if ( material.metalness !== undefined ) {
materialMetalness.setValue( material.metalness );
}
if ( material.emissive !== undefined ) {
materialEmissive.setHexValue( material.emissive.getHexString() );
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册