Browse Source

Editor: material.shading support.

Mr.doob 11 years ago
parent
commit
4940ca4d33
1 changed files with 54 additions and 26 deletions
  1. 54 26
      editor/js/Sidebar.Material.js

+ 54 - 26
editor/js/Sidebar.Material.js

@@ -284,6 +284,38 @@ Sidebar.Material = function ( editor ) {
 
 	container.add( materialEnvMapRow );
 
+	// side
+
+	var materialSideRow = new UI.Panel();
+	var materialSide = new UI.Select().setOptions( {
+
+		0: 'Front',
+		1: 'Back',
+		2: 'Double'
+
+	} ).setWidth( '150px' ).setColor( '#444' ).setFontSize( '12px' ).onChange( update );
+
+	materialSideRow.add( new UI.Text( 'Side' ).setWidth( '90px' ) );
+	materialSideRow.add( materialSide );
+
+	container.add( materialSideRow );
+
+	// shading
+
+	var materialShadingRow = new UI.Panel();
+	var materialShading = new UI.Select().setOptions( {
+
+		0: 'No',
+		1: 'Flat',
+		2: 'Smooth'
+
+	} ).setWidth( '150px' ).setColor( '#444' ).setFontSize( '12px' ).onChange( update );
+
+	materialShadingRow.add( new UI.Text( 'Shading' ).setWidth( '90px' ) );
+	materialShadingRow.add( materialShading );
+
+	container.add( materialShadingRow );
+
 	// blending
 
 	var materialBlendingRow = new UI.Panel();
@@ -302,23 +334,6 @@ Sidebar.Material = function ( editor ) {
 	materialBlendingRow.add( materialBlending );
 
 	container.add( materialBlendingRow );
-
-	// side
-
-	var materialSideRow = new UI.Panel();
-	var materialSide = new UI.Select().setOptions( {
-
-		0: 'Front',
-		1: 'Back',
-		2: 'Double'
-
-	} ).setWidth( '150px' ).setColor( '#444' ).setFontSize( '12px' ).onChange( update );
-
-	materialSideRow.add( new UI.Text( 'Side' ).setWidth( '90px' ) );
-	materialSideRow.add( materialSide );
-
-	container.add( materialSideRow );
-
 	// opacity
 
 	var materialOpacityRow = new UI.Panel();
@@ -596,15 +611,21 @@ Sidebar.Material = function ( editor ) {
 
 			}
 
-			if ( material.blending !== undefined ) {
+			if ( material.side !== undefined ) {
 
-				material.blending = parseInt( materialBlending.getValue() );
+				material.side = parseInt( materialSide.getValue() );
 
 			}
 
-			if ( material.side !== undefined ) {
+			if ( material.shading !== undefined ) {
 
-				material.side = parseInt( materialSide.getValue() );
+				material.shading = parseInt( materialShading.getValue() );
+
+			}
+
+			if ( material.blending !== undefined ) {
+
+				material.blending = parseInt( materialBlending.getValue() );
 
 			}
 
@@ -667,8 +688,9 @@ Sidebar.Material = function ( editor ) {
 			'normalMap': materialNormalMapRow,
 			'specularMap': materialSpecularMapRow,
 			'envMap': materialEnvMapRow,
-			'blending': materialBlendingRow,
 			'side': materialSideRow,
+			'shading': materialShadingRow,
+			'blending': materialBlendingRow,
 			'opacity': materialOpacityRow,
 			'transparent': materialTransparentRow,
 			'wireframe': materialWireframeRow
@@ -821,15 +843,21 @@ Sidebar.Material = function ( editor ) {
 
 			}
 
-			if ( material.blending !== undefined ) {
+			if ( material.side !== undefined ) {
 
-				materialBlending.setValue( material.blending );
+				materialSide.setValue( material.side );
 
 			}
 
-			if ( material.side !== undefined ) {
+			if ( material.shading !== undefined ) {
 
-				materialSide.setValue( material.side );
+				materialShading.setValue( material.shading );
+
+			}
+
+			if ( material.blending !== undefined ) {
+
+				materialBlending.setValue( material.blending );
 
 			}