Преглед на файлове

MeshPhysicalMaterial: Renamed sheenColor to sheen.

Mr.doob преди 6 години
родител
ревизия
3e9af1f445

+ 1 - 1
examples/jsm/nodes/materials/StandardNodeMaterial.js

@@ -37,7 +37,7 @@ NodeUtils.addShortcuts( StandardNodeMaterial.prototype, 'fragment', [
 	'environment',
 	'mask',
 	'position',
-	'sheenColor'
+	'sheen'
 ] );
 
 export { StandardNodeMaterial };

+ 6 - 6
examples/jsm/nodes/materials/nodes/StandardNode.js

@@ -179,7 +179,7 @@ StandardNode.prototype.build = function ( builder ) {
 
 		}
 
-		if ( this.sheenColor ) this.sheenColor.analyze( builder );
+		if ( this.sheen ) this.sheen.analyze( builder );
 
 		// build code
 
@@ -224,7 +224,7 @@ StandardNode.prototype.build = function ( builder ) {
 
 		var clearCoatEnv = useClearCoat && environment ? this.environment.flow( builder, 'c', { cache: 'clearCoat', context: contextClearCoatEnvironment, slot: 'environment' } ) : undefined;
 
-		var sheenColor = this.sheenColor ? this.sheenColor.flow( builder, 'c' ) : undefined;
+		var sheen = this.sheen ? this.sheen.flow( builder, 'c' ) : undefined;
 
 		builder.requires.transparent = alpha !== undefined;
 
@@ -346,9 +346,9 @@ StandardNode.prototype.build = function ( builder ) {
 
 		}
 
-		if ( sheenColor ) {
+		if ( sheen ) {
 
-			output.push( 'material.sheenColor = ' + sheenColor.result + ';' );
+			output.push( 'material.sheenColor = ' + sheen.result + ';' );
 
 		}
 
@@ -525,7 +525,7 @@ StandardNode.prototype.copy = function ( source ) {
 
 	if ( source.environment ) this.environment = source.environment;
 
-	if ( source.sheenColor ) this.sheenColor = source.sheenColor;
+	if ( source.sheen ) this.sheen = source.sheen;
 
 	return this;
 
@@ -571,7 +571,7 @@ StandardNode.prototype.toJSON = function ( meta ) {
 
 		if ( this.environment ) data.environment = this.environment.toJSON( meta ).uuid;
 
-		if ( this.sheenColor ) data.sheenColor = this.sheenColor.toJSON( meta ).uuid;
+		if ( this.sheen ) data.sheen = this.sheen.toJSON( meta ).uuid;
 
 	}
 

+ 6 - 6
examples/webgl_materials_sheen.html

@@ -38,7 +38,7 @@
 				nodeMaterial: true,
 				color: new THREE.Color( 255, 0, 127 ),
 				sheenBRDF: true,
-				sheenColor: new THREE.Color( 10, 10, 10 ), // corresponds to .04 reflectance
+				sheen: new THREE.Color( 10, 10, 10 ), // corresponds to .04 reflectance
 				roughness: .9,
 				exposure: 2,
 			};
@@ -121,7 +121,7 @@
 				gui.add( params, 'nodeMaterial' );
 				gui.addColor( params, 'color' );
 				gui.add( params, 'sheenBRDF' );
-				gui.addColor( params, 'sheenColor' );
+				gui.addColor( params, 'sheen' );
 				gui.add( params, 'roughness', 0, 1 );
 				gui.add( params, 'exposure', 0, 3 );
 				gui.open();
@@ -156,8 +156,8 @@
 
 				//
 
-				material.sheenColor = params.sheenBRDF
-					? new THREE.Color().copy( params.sheenColor ).multiplyScalar( 1 / 255 )
+				material.sheen = params.sheenBRDF
+					? new THREE.Color().copy( params.sheen ).multiplyScalar( 1 / 255 )
 					: null;
 
 				material.color.copy( params.color ).multiplyScalar( 1 / 255 );
@@ -167,8 +167,8 @@
 
 				//
 
-				nodeMaterial.sheenColor = params.sheenBRDF
-					? new Nodes.ColorNode( material.sheenColor )
+				nodeMaterial.sheen = params.sheenBRDF
+					? new Nodes.ColorNode( material.sheen )
 					: undefined;
 
 				nodeMaterial.color.value.copy( material.color );

+ 2 - 2
src/materials/MeshPhysicalMaterial.d.ts

@@ -12,7 +12,7 @@ export interface MeshPhysicalMaterialParameters
 	clearCoat?: number;
 	clearCoatRoughness?: number;
 
-	sheenColor?: Color;
+	sheen?: Color;
 
 	clearCoatNormalScale?: Vector2;
 	clearCoatNormalMap?: Texture;
@@ -27,7 +27,7 @@ export class MeshPhysicalMaterial extends MeshStandardMaterial {
 	clearCoat: number;
 	clearCoatRoughness: number;
 
-	sheenColor: Color | null;
+	sheen: Color | null;
 
 	clearCoatNormalScale: Vector2;
 	clearCoatNormalMap: Texture | null;

+ 3 - 3
src/materials/MeshPhysicalMaterial.js

@@ -30,7 +30,7 @@ function MeshPhysicalMaterial( parameters ) {
 	this.clearCoat = 0.0;
 	this.clearCoatRoughness = 0.0;
 
-	this.sheenColor = null; // null will disable sheen bsdf
+	this.sheen = null; // null will disable sheen bsdf
 
 	this.clearCoatNormalScale = new Vector2( 1, 1 );
 	this.clearCoatNormalMap = null;
@@ -55,8 +55,8 @@ MeshPhysicalMaterial.prototype.copy = function ( source ) {
 	this.clearCoat = source.clearCoat;
 	this.clearCoatRoughness = source.clearCoatRoughness;
 
-	if ( source.sheenColor ) this.sheenColor = ( this.sheenColor || new Color() ).copy( source.sheenColor );
-	else this.sheenColor = null;
+	if ( source.sheen ) this.sheen = ( this.sheen || new Color() ).copy( source.sheen );
+	else this.sheen = null;
 
 	this.clearCoatNormalMap = source.clearCoatNormalMap;
 	this.clearCoatNormalScale.copy( source.clearCoatNormalScale );

+ 1 - 1
src/renderers/WebGLRenderer.js

@@ -2271,7 +2271,7 @@ function WebGLRenderer( parameters ) {
 
 		uniforms.clearCoat.value = material.clearCoat;
 		uniforms.clearCoatRoughness.value = material.clearCoatRoughness;
-		if ( material.sheenColor ) uniforms.sheenColor.value.copy( material.sheenColor );
+		if ( material.sheen ) uniforms.sheen.value.copy( material.sheen );
 
 		if ( material.clearCoatNormalMap ) {
 

+ 1 - 1
src/renderers/shaders/ShaderChunk/lights_physical_fragment.glsl.js

@@ -10,6 +10,6 @@ material.specularRoughness = clamp( roughnessFactor, 0.04, 1.0 );
 	material.clearCoatRoughness = clamp( clearCoatRoughness, 0.04, 1.0 );
 #endif
 #ifdef USE_SHEEN
-	material.sheenColor = sheenColor;
+	material.sheenColor = sheen;
 #endif
 `;

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

@@ -275,7 +275,7 @@ ShaderLib.physical = {
 		{
 			clearCoat: { value: 0 },
 			clearCoatRoughness: { value: 0 },
-			sheenColor: { value: new Color( 0x000000 ) },
+			sheen: { value: new Color( 0x000000 ) },
 			clearCoatNormalScale: { value: new Vector2( 1, 1 ) },
 			clearCoatNormalMap: { value: null },
 		}

+ 1 - 1
src/renderers/shaders/ShaderLib/meshphysical_frag.glsl.js

@@ -13,7 +13,7 @@ uniform float opacity;
 #endif
 
 #ifdef USE_SHEEN
-	uniform vec3 sheenColor;
+	uniform vec3 sheen;
 #endif
 
 varying vec3 vViewPosition;

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

@@ -163,7 +163,7 @@ function WebGLPrograms( renderer, extensions, capabilities ) {
 
 			gradientMap: !! material.gradientMap,
 
-			sheen: !! material.sheenColor,
+			sheen: !! material.sheen,
 
 			combine: material.combine,