浏览代码

Renamed MeshPhysicalMaterial back to MeshStandardMaterial.

Mr.doob 9 年之前
父节点
当前提交
0de14543d9

+ 1 - 1
editor/js/Sidebar.Material.js

@@ -63,7 +63,7 @@ Sidebar.Material = function ( editor ) {
 		'MeshNormalMaterial': 'MeshNormalMaterial',
 		'MeshLambertMaterial': 'MeshLambertMaterial',
 		'MeshPhongMaterial': 'MeshPhongMaterial',
-		'MeshPhysicalMaterial': 'MeshPhysicalMaterial',
+		'MeshStandardMaterial': 'MeshStandardMaterial',
 		'ShaderMaterial': 'ShaderMaterial',
 		'SpriteMaterial': 'SpriteMaterial'
 

+ 2 - 2
examples/index.html

@@ -318,8 +318,8 @@
 				"webgl_materials_variations_basic",
 				"webgl_materials_variations_lambert",
 				"webgl_materials_variations_phong",
-				"webgl_materials_variations_physical",
-				"webgl_materials_variations_physical2",
+				"webgl_materials_variations_standard",
+				"webgl_materials_variations_standard2",
 				"webgl_materials_video",
 				"webgl_materials_wireframe",
 				"webgl_mirror",

+ 3 - 3
examples/webgl_loader_ctm_materials.html

@@ -214,7 +214,7 @@
 
 					if ( m.name.indexOf( "Body" ) !== -1 ) {
 
-						var mm = new THREE.MeshPhysicalMaterial();
+						var mm = new THREE.MeshStandardMaterial();
 
 						mm.color.setHex( 0x000000 );
 						mm.lightMap = m.map;
@@ -226,7 +226,7 @@
 
 					} else if ( m.name.indexOf( "mirror" ) !== -1 ) {
 
-						var mm = new THREE.MeshPhysicalMaterial();
+						var mm = new THREE.MeshStandardMaterial();
 
 						mm.color.setHex( 0x808080 );
 						mm.lightMap = m.map;
@@ -238,7 +238,7 @@
 
 					} else if ( m.name.indexOf( "glass" ) !== -1 ) {
 
-						var mm = new THREE.MeshPhysicalMaterial();
+						var mm = new THREE.MeshStandardMaterial();
 
 						mm.color.copy( m.color );
 //						mm.lightMap = m.map;

+ 4 - 4
examples/webgl_materials_variations_physical.html → examples/webgl_materials_variations_standard.html

@@ -26,7 +26,7 @@
 	<body>
 
 		<div id="container"></div>
-		<div id="info"><a href="http://threejs.org" target="_blank">three.js</a> - Physical Material Variantions by <a href="http://clara.io/" target="_blank">Ben Houston</a>.</div>
+		<div id="info"><a href="http://threejs.org" target="_blank">three.js</a> - Standard Material Variantions by <a href="http://clara.io/" target="_blank">Ben Houston</a>.</div>
 
 		<script src="../build/three.min.js"></script>
 		<script src="js/controls/OrbitControls.js"></script>
@@ -89,7 +89,7 @@
 				var geometry = new THREE.SphereBufferGeometry( sphereRadius, 32, 16 );
 
 				var localReflectionCube;
-				
+
 				for( var alpha = 0, alphaIndex = 0; alpha <= 1.0; alpha += stepSize, alphaIndex ++ ) {
 
 					var roughness = 1.0 - alpha;
@@ -110,7 +110,7 @@
 							// basic monochromatic energy preservation
 							var diffuseColor = new THREE.Color( gamma, 0, 0 ).multiplyScalar( 1 - 0.08 );
 
-							var material = new THREE.MeshPhysicalMaterial( { map: imgTexture, bumpMap: imgTexture, bumpScale: bumpScale, color: diffuseColor, metalness: metalness, roughness: roughness, shading: THREE.SmoothShading, envMap: localReflectionCube } )
+							var material = new THREE.MeshStandardMaterial( { map: imgTexture, bumpMap: imgTexture, bumpScale: bumpScale, color: diffuseColor, metalness: metalness, roughness: roughness, shading: THREE.SmoothShading, envMap: localReflectionCube } )
 
 							var mesh = new THREE.Mesh( geometry, material );
 
@@ -124,7 +124,7 @@
 						}
 					}
 				}
-	
+
 				function addLabel( name, location ) {
 					var textGeo = new THREE.TextGeometry( name, {
 

+ 4 - 4
examples/webgl_materials_variations_physical2.html → examples/webgl_materials_variations_standard2.html

@@ -26,7 +26,7 @@
 	<body>
 
 		<div id="container"></div>
-		<div id="info"><a href="http://threejs.org" target="_blank">three.js</a> - Physical Material Variantions v2 by <a href="http://clara.io/" target="_blank">Ben Houston</a>.</div>
+		<div id="info"><a href="http://threejs.org" target="_blank">three.js</a> - Standard Material Variantions v2 by <a href="http://clara.io/" target="_blank">Ben Houston</a>.</div>
 
 		<script src="../build/three.min.js"></script>
 		<script src="js/controls/OrbitControls.js"></script>
@@ -89,7 +89,7 @@
 				var geometry = new THREE.SphereBufferGeometry( sphereRadius, 32, 16 );
 
 				var localReflectionCube;
-				
+
 				for( var alpha = 0, alphaIndex = 0; alpha <= 1.0; alpha += stepSize, alphaIndex ++ ) {
 
 					var roughness = 1.0 - alpha;
@@ -110,7 +110,7 @@
 							// basic monochromatic energy preservation
 							var diffuseColor = new THREE.Color( gamma, 0, 0 ).multiplyScalar( 1 - 0.08 );
 
-							var material = new THREE.MeshPhysicalMaterial( { map: imgTexture, bumpMap: imgTexture, bumpScale: bumpScale, color: diffuseColor, reflectivity: reflectivity, roughness: roughness, shading: THREE.SmoothShading, envMap: localReflectionCube } )
+							var material = new THREE.MeshStandardMaterial( { map: imgTexture, bumpMap: imgTexture, bumpScale: bumpScale, color: diffuseColor, reflectivity: reflectivity, roughness: roughness, shading: THREE.SmoothShading, envMap: localReflectionCube } )
 
 							var mesh = new THREE.Mesh( geometry, material );
 
@@ -124,7 +124,7 @@
 						}
 					}
 				}
-	
+
 				function addLabel( name, location ) {
 					var textGeo = new THREE.TextGeometry( name, {
 

+ 2 - 2
src/Three.Legacy.js

@@ -351,11 +351,11 @@ Object.defineProperties( THREE, {
 Object.defineProperties( THREE.MeshPhongMaterial.prototype, {
 	metal: {
 		get: function () {
-			console.warn( 'THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshPhysicalMaterial instead.' );
+			console.warn( 'THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead.' );
 			return false;
 		},
 		set: function ( value ) {
-			console.warn( 'THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshPhysicalMaterial instead' );
+			console.warn( 'THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead' );
 		}
 	}
 } );

+ 5 - 5
src/materials/MeshPhysicalMaterial.js → src/materials/MeshStandardMaterial.js

@@ -59,11 +59,11 @@
  * }
  */
 
-THREE.MeshPhysicalMaterial = function ( parameters ) {
+THREE.MeshStandardMaterial = function ( parameters ) {
 
 	THREE.Material.call( this );
 
-	this.type = 'MeshPhysicalMaterial';
+	this.type = 'MeshStandardMaterial';
 
 	this.color = new THREE.Color( 0xffffff ); // diffuse
 	this.roughness = 0.5;
@@ -124,10 +124,10 @@ THREE.MeshPhysicalMaterial = function ( parameters ) {
 
 };
 
-THREE.MeshPhysicalMaterial.prototype = Object.create( THREE.Material.prototype );
-THREE.MeshPhysicalMaterial.prototype.constructor = THREE.MeshPhysicalMaterial;
+THREE.MeshStandardMaterial.prototype = Object.create( THREE.Material.prototype );
+THREE.MeshStandardMaterial.prototype.constructor = THREE.MeshStandardMaterial;
 
-THREE.MeshPhysicalMaterial.prototype.copy = function ( source ) {
+THREE.MeshStandardMaterial.prototype.copy = function ( source ) {
 
 	THREE.Material.prototype.copy.call( this, source );
 

+ 9 - 9
src/renderers/WebGLRenderer.js

@@ -636,7 +636,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 			_gl.bindBuffer( _gl.ARRAY_BUFFER, buffers.normal );
 
-			if ( material.type !== 'MeshPhongMaterial' && material.type !== 'MeshPhysicalMaterial' && material.shading === THREE.FlatShading ) {
+			if ( material.type !== 'MeshPhongMaterial' && material.type !== 'MeshStandardMaterial' && material.shading === THREE.FlatShading ) {
 
 				for ( var i = 0, l = object.count * 3; i < l; i += 9 ) {
 
@@ -1506,7 +1506,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 		if ( material instanceof THREE.MeshPhongMaterial ||
 				material instanceof THREE.MeshLambertMaterial ||
-				material instanceof THREE.MeshPhysicalMaterial ||
+				material instanceof THREE.MeshStandardMaterial ||
 				material.lights ) {
 
 			// store the light setup it was created for
@@ -1636,7 +1636,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 			if ( material instanceof THREE.ShaderMaterial ||
 				 material instanceof THREE.MeshPhongMaterial ||
-				 material instanceof THREE.MeshPhysicalMaterial ||
+				 material instanceof THREE.MeshStandardMaterial ||
 				 material.envMap ) {
 
 				if ( p_uniforms.cameraPosition !== undefined ) {
@@ -1651,7 +1651,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 			if ( material instanceof THREE.MeshPhongMaterial ||
 				 material instanceof THREE.MeshLambertMaterial ||
 				 material instanceof THREE.MeshBasicMaterial ||
-				 material instanceof THREE.MeshPhysicalMaterial ||
+				 material instanceof THREE.MeshStandardMaterial ||
 				 material instanceof THREE.ShaderMaterial ||
 				 material.skinning ) {
 
@@ -1722,7 +1722,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 			if ( material instanceof THREE.MeshPhongMaterial ||
 				 material instanceof THREE.MeshLambertMaterial ||
-				 material instanceof THREE.MeshPhysicalMaterial ||
+				 material instanceof THREE.MeshStandardMaterial ||
 				 material.lights ) {
 
 				// the current material requires lighting info
@@ -1749,7 +1749,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 			if ( material instanceof THREE.MeshBasicMaterial ||
 				 material instanceof THREE.MeshLambertMaterial ||
 				 material instanceof THREE.MeshPhongMaterial ||
-				 material instanceof THREE.MeshPhysicalMaterial ) {
+				 material instanceof THREE.MeshStandardMaterial ) {
 
 				refreshUniformsCommon( m_uniforms, material );
 
@@ -1774,9 +1774,9 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 				refreshUniformsPhong( m_uniforms, material );
 
-			} else if ( material instanceof THREE.MeshPhysicalMaterial ) {
+			} else if ( material instanceof THREE.MeshStandardMaterial ) {
 
-				refreshUniformsPhysical( m_uniforms, material );
+				refreshUniformsStandard( m_uniforms, material );
 
 			} else if ( material instanceof THREE.MeshDepthMaterial ) {
 
@@ -1995,7 +1995,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 	}
 
-	function refreshUniformsPhysical ( uniforms, material ) {
+	function refreshUniformsStandard ( uniforms, material ) {
 
 		uniforms.roughness.value = material.roughness;
 		//uniforms.reflectivity.value = material.reflectivity; // part of uniforms common

+ 2 - 2
src/renderers/shaders/ShaderChunk/envmap_pars_fragment.glsl

@@ -1,4 +1,4 @@
-#if defined( USE_ENVMAP ) || defined( PHYSICAL )
+#if defined( USE_ENVMAP ) || defined( STANDARD )
 	uniform float reflectivity;
 #endif
 
@@ -10,7 +10,7 @@
 	#endif
 	uniform float flipEnvMap;
 
-	#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( PHYSICAL )
+	#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( STANDARD )
 
 		uniform float refractionRatio;
 

+ 1 - 1
src/renderers/shaders/ShaderChunk/envmap_pars_vertex.glsl

@@ -1,4 +1,4 @@
-#if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP ) && ! defined( PHONG ) && ! defined( PHYSICAL )
+#if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP ) && ! defined( PHONG ) && ! defined( STANDARD )
 
 	varying vec3 vReflect;
 

+ 1 - 1
src/renderers/shaders/ShaderChunk/envmap_vertex.glsl

@@ -1,4 +1,4 @@
-#if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP ) && ! defined( PHONG ) && ! defined( PHYSICAL )
+#if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP ) && ! defined( PHONG ) && ! defined( STANDARD )
 
 	vec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );
 

+ 1 - 1
src/renderers/shaders/ShaderChunk/lights_pars.glsl

@@ -122,7 +122,7 @@ vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {
 #endif
 
 
-#if defined( USE_ENVMAP ) && defined( PHYSICAL )
+#if defined( USE_ENVMAP ) && defined( STANDARD )
 
 	vec3 getLightProbeIndirectIrradiance( /*const in SpecularLightProbe specularLightProbe,*/ const in GeometricContext geometry, const in int maxMIPLevel ) {
 

+ 0 - 0
src/renderers/shaders/ShaderChunk/lights_physical_fragment.glsl → src/renderers/shaders/ShaderChunk/lights_standard_fragment.glsl


+ 0 - 0
src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl → src/renderers/shaders/ShaderChunk/lights_standard_pars_fragment.glsl


+ 4 - 4
src/renderers/shaders/ShaderChunk/lights_template.glsl

@@ -46,7 +46,7 @@ GeometricContext geometry = GeometricContext( -vViewPosition, normalize( normal
 		IncidentLight directLight = getDirectionalDirectLight( directionalLights[ i ], geometry );
 
 		Material_RE_DirectLight( directLight, geometry, material, reflectedLight );
-		
+
 	}
 
 #endif
@@ -54,7 +54,7 @@ GeometricContext geometry = GeometricContext( -vViewPosition, normalize( normal
 #if defined( Material_RE_IndirectDiffuseLight )
 
 	{
-	
+
 		vec3 indirectDiffuseIrradiance = getAmbientLightIrradiance( ambientLightColor );
 
 #ifdef USE_LIGHTMAP
@@ -73,7 +73,7 @@ GeometricContext geometry = GeometricContext( -vViewPosition, normalize( normal
 
 #endif
 
-#if defined( USE_ENVMAP ) && defined( PHYSICAL )
+#if defined( USE_ENVMAP ) && defined( STANDARD )
 
 		// TODO, replace 8 with the real maxMIPLevel
 		indirectDiffuseIrradiance += getLightProbeIndirectIrradiance( /*lightProbe,*/ geometry, 8 );
@@ -97,4 +97,4 @@ GeometricContext geometry = GeometricContext( -vViewPosition, normalize( normal
 
     }
 
-#endif
+#endif

+ 1 - 1
src/renderers/shaders/ShaderChunk/worldpos_vertex.glsl

@@ -1,4 +1,4 @@
-#if defined( USE_ENVMAP ) || defined( PHONG ) || defined( PHYSICAL ) || defined( LAMBERT ) || defined ( USE_SHADOWMAP )
+#if defined( USE_ENVMAP ) || defined( PHONG ) || defined( STANDARD ) || defined( LAMBERT ) || defined ( USE_SHADOWMAP )
 
 	#ifdef USE_SKINNING
 

+ 6 - 6
src/renderers/shaders/ShaderLib.js

@@ -409,7 +409,7 @@ THREE.ShaderLib = {
 
 	},
 
-	'physical': {
+	'standard': {
 
 		uniforms: THREE.UniformsUtils.merge( [
 
@@ -438,7 +438,7 @@ THREE.ShaderLib = {
 
 		vertexShader: [
 
-			"#define PHYSICAL",
+			"#define STANDARD",
 
 			"varying vec3 vViewPosition;",
 
@@ -461,7 +461,7 @@ THREE.ShaderLib = {
 			THREE.ShaderChunk[ "specularmap_pars_fragment" ],
 			THREE.ShaderChunk[ "logdepthbuf_pars_vertex" ],
 
-			"void main() {", // PHYSICAL
+			"void main() {", // STANDARD
 
 				THREE.ShaderChunk[ "uv_vertex" ],
 				THREE.ShaderChunk[ "uv2_vertex" ],
@@ -499,7 +499,7 @@ THREE.ShaderLib = {
 
 		fragmentShader: [
 
-			"#define PHYSICAL",
+			"#define STANDARD",
 
 			"uniform vec3 diffuse;",
 			"uniform vec3 emissive;",
@@ -530,7 +530,7 @@ THREE.ShaderLib = {
 			THREE.ShaderChunk[ "fog_pars_fragment" ],
 			THREE.ShaderChunk[ "bsdfs" ],
 			THREE.ShaderChunk[ "lights_pars" ],
-			THREE.ShaderChunk[ "lights_physical_pars_fragment" ],
+			THREE.ShaderChunk[ "lights_standard_pars_fragment" ],
 			THREE.ShaderChunk[ "shadowmap_pars_fragment" ],
 			THREE.ShaderChunk[ "bumpmap_pars_fragment" ],
 			THREE.ShaderChunk[ "normalmap_pars_fragment" ],
@@ -558,7 +558,7 @@ THREE.ShaderLib = {
 				THREE.ShaderChunk[ "emissivemap_fragment" ],
 
 				// accumulation
-				THREE.ShaderChunk[ "lights_physical_fragment" ],
+				THREE.ShaderChunk[ "lights_standard_fragment" ],
 				THREE.ShaderChunk[ "lights_template" ],
 				THREE.ShaderChunk[ "lightmap_fragment" ],
 

+ 1 - 1
src/renderers/webgl/WebGLPrograms.js

@@ -8,7 +8,7 @@ THREE.WebGLPrograms = function ( renderer, capabilities ) {
 		MeshBasicMaterial: 'basic',
 		MeshLambertMaterial: 'lambert',
 		MeshPhongMaterial: 'phong',
-		MeshPhysicalMaterial: 'physical',
+		MeshStandardMaterial: 'standard',
 		LineBasicMaterial: 'basic',
 		LineDashedMaterial: 'dashed',
 		PointsMaterial: 'points'

+ 3 - 3
utils/build/includes/common.json

@@ -83,7 +83,7 @@
 	"src/materials/MeshBasicMaterial.js",
 	"src/materials/MeshLambertMaterial.js",
 	"src/materials/MeshPhongMaterial.js",
-	"src/materials/MeshPhysicalMaterial.js",
+	"src/materials/MeshStandardMaterial.js",
 	"src/materials/MeshDepthMaterial.js",
 	"src/materials/MeshNormalMaterial.js",
 	"src/materials/MultiMaterial.js",
@@ -144,8 +144,8 @@
 	"src/renderers/shaders/ShaderChunk/lights_phong_pars_fragment.glsl",
 	"src/renderers/shaders/ShaderChunk/lights_phong_pars_vertex.glsl",
 	"src/renderers/shaders/ShaderChunk/lights_phong_vertex.glsl",
-	"src/renderers/shaders/ShaderChunk/lights_physical_fragment.glsl",
-	"src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl",
+	"src/renderers/shaders/ShaderChunk/lights_standard_fragment.glsl",
+	"src/renderers/shaders/ShaderChunk/lights_standard_pars_fragment.glsl",
 	"src/renderers/shaders/ShaderChunk/lights_template.glsl",
 	"src/renderers/shaders/ShaderChunk/linear_to_gamma_fragment.glsl",
 	"src/renderers/shaders/ShaderChunk/logdepthbuf_fragment.glsl",