2
0
Эх сурвалжийг харах

Expose the sheen parameter for Physical Material
in the editor

Dinesh Salunke 5 жил өмнө
parent
commit
c49ed806b5

+ 36 - 0
editor/js/Sidebar.Material.js

@@ -195,6 +195,18 @@ Sidebar.Material = function ( editor ) {
 
 	container.add( materialMetalnessRow );
 
+	// sheen
+
+	var materialSheenRow = new UI.Row();
+	var materialSheenEnabled = new UI.Checkbox( false ).onChange( update );
+	var materialSheen = new UI.Color().setHexValue(0x000000).onChange( update );
+
+	materialSheenRow.add( new UI.Text( strings.getKey( 'sidebar/material/sheen' ) ).setWidth( '90px' ) )
+	materialSheenRow.add( materialSheenEnabled );
+	materialSheenRow.add( materialSheen );
+
+	container.add( materialSheenRow );
+
 	// emissive
 
 	var materialEmissiveRow = new UI.Row();
@@ -636,6 +648,22 @@ Sidebar.Material = function ( editor ) {
 
 			}
 
+			if ( material.sheen !== undefined ) {
+
+				var sheenEnabled = materialSheenEnabled.getValue() === true;
+
+				var sheen = sheenEnabled ? new THREE.Color(materialSheen.getHexValue()) : null;
+
+				editor.execute( new SetMaterialValueCommand( editor, currentObject, 'sheen', sheen, currentMaterialSlot ) );
+				
+			}
+			
+			if ( material.sheen !== undefined && material.sheen !== null && material.sheen.getHex() !== materialSheen.getHexValue() ) {
+
+				editor.execute( new SetMaterialColorCommand( editor, currentObject, 'sheen', materialSheen.getHexValue(), currentMaterialSlot ) );
+
+			}
+
 			if ( material.emissive !== undefined && material.emissive.getHex() !== materialEmissive.getHexValue() ) {
 
 				editor.execute( new SetMaterialColorCommand( editor, currentObject, 'emissive', materialEmissive.getHexValue(), currentMaterialSlot ) );
@@ -1157,6 +1185,7 @@ Sidebar.Material = function ( editor ) {
 			'roughness': materialRoughnessRow,
 			'metalness': materialMetalnessRow,
 			'emissive': materialEmissiveRow,
+			'sheen': materialSheenRow,
 			'specular': materialSpecularRow,
 			'shininess': materialShininessRow,
 			'clearcoat': materialClearcoatRow,
@@ -1268,6 +1297,13 @@ Sidebar.Material = function ( editor ) {
 			materialMetalness.setValue( material.metalness );
 
 		}
+		
+		if ( material.sheen !== undefined && material.sheen !== null ) {
+			
+			materialSheenEnabled.setValue( true );
+			materialSheen.setHexValue( material.sheen.getHexString() );
+
+		}
 
 		if ( material.emissive !== undefined ) {
 

+ 1 - 0
editor/js/Strings.js

@@ -221,6 +221,7 @@ var Strings = function ( config ) {
 			'sidebar/material/depthPacking': 'Depth Packing',
 			'sidebar/material/roughness': 'Roughness',
 			'sidebar/material/metalness': 'Metalness',
+			'sidebar/material/sheen': 'Sheen',
 			'sidebar/material/emissive': 'Emissive',
 			'sidebar/material/specular': 'Specular',
 			'sidebar/material/shininess': 'Shininess',