Browse Source

Rename toonMap with gradientMap

Takahiro 8 years ago
parent
commit
8e5279ea8a

+ 4 - 4
examples/js/loaders/MMDLoader.js

@@ -2399,8 +2399,8 @@ THREE.MMDLoader.prototype.createMesh = function ( model, texturePath, onProgress
 
 				var toonFileName = ( p2.toonIndex === -1 ) ? 'toon00.bmp' : model.toonTextures[ p2.toonIndex ].fileName;
 				var uuid = loadTexture( toonFileName, { isToonTexture: true, defaultTexturePath: isDefaultToonTexture( toonFileName ) } );
-				m.toonMap = getTexture( uuid, textures );
-				m.toonMapDirectionY = true;
+				m.gradientMap = getTexture( uuid, textures );
+				m.gradientMapAxisY = true;
 
 			} else {
 
@@ -2428,8 +2428,8 @@ THREE.MMDLoader.prototype.createMesh = function ( model, texturePath, onProgress
 				}
 
 				var uuid = loadTexture( toonFileName, { isToonTexture: true, defaultTexturePath: isDefaultToon } );
-				m.toonMap = getTexture( uuid, textures );
-				m.toonMapDirectionY = true;
+				m.gradientMap = getTexture( uuid, textures );
+				m.gradientMapAxisY = true;
 
 			}
 

+ 2 - 2
src/loaders/MaterialLoader.js

@@ -140,8 +140,8 @@ Object.assign( MaterialLoader.prototype, {
 		if ( json.aoMap !== undefined ) material.aoMap = getTexture( json.aoMap );
 		if ( json.aoMapIntensity !== undefined ) material.aoMapIntensity = json.aoMapIntensity;
 
-		if ( json.toonMap !== undefined ) material.toonMap = getTexture( json.toonMap );
-		if ( json.toonMapDirectionY !== undefined ) material.toonMapDirectionY = json.toonMapDirectionY;
+		if ( json.gradientMap !== undefined ) material.gradientMap = getTexture( json.gradientMap );
+		if ( json.gradientMapAxisY !== undefined ) material.gradientMapAxisY = json.gradientMapAxisY;
 
 		// MultiMaterial
 

+ 3 - 3
src/materials/Material.js

@@ -198,10 +198,10 @@ Material.prototype = {
 
 		}
 
-		if ( this.toonMap && this.toonMap.isTexture ) {
+		if ( this.gradientMap && this.gradientMap.isTexture ) {
 
-			data.toonMap = this.toonMap.toJSON( meta ).uuid;
-			data.toonMapDirectionY = this.toonMapDirectionY;
+			data.gradientMap = this.gradientMap.toJSON( meta ).uuid;
+			data.gradientMapAxisY = this.gradientMapAxisY;
 
 		}
 

+ 4 - 4
src/materials/MeshPhongMaterial.js

@@ -44,8 +44,8 @@ import { Color } from '../math/Color';
  *  reflectivity: <float>,
  *  refractionRatio: <float>,
  *
- *  toonMap: new THREE.Texture( <Image> ),
- *  toonMapDirectonY: <bool>,
+ *  gradientMap: new THREE.Texture( <Image> ),
+ *  gradientMapAxisY: <bool>,
  *
  *  wireframe: <boolean>,
  *  wireframeLinewidth: <float>,
@@ -97,8 +97,8 @@ function MeshPhongMaterial( parameters ) {
 	this.reflectivity = 1;
 	this.refractionRatio = 0.98;
 
-	this.toonMap = null;
-	this.toonMapDirectionY = false;
+	this.gradientMap = null;
+	this.gradientMapAxisY = false;
 
 	this.wireframe = false;
 	this.wireframeLinewidth = 1;

+ 2 - 2
src/renderers/WebGLRenderer.js

@@ -2183,9 +2183,9 @@ function WebGLRenderer( parameters ) {
 
 		}
 
-		if ( material.toonMap ) {
+		if ( material.gradientMap ) {
 
-			uniforms.toonMap.value = material.toonMap;
+			uniforms.gradientMap.value = material.gradientMap;
 
 		}
 

+ 2 - 2
src/renderers/shaders/ShaderChunk.js

@@ -30,6 +30,7 @@ import envmap_pars_vertex from './ShaderChunk/envmap_pars_vertex.glsl';
 import envmap_vertex from './ShaderChunk/envmap_vertex.glsl';
 import fog_fragment from './ShaderChunk/fog_fragment.glsl';
 import fog_pars_fragment from './ShaderChunk/fog_pars_fragment.glsl';
+import gradientmap_pars_fragment from './ShaderChunk/gradientmap_pars_fragment.glsl';
 import lightmap_fragment from './ShaderChunk/lightmap_fragment.glsl';
 import lightmap_pars_fragment from './ShaderChunk/lightmap_pars_fragment.glsl';
 import lights_lambert_vertex from './ShaderChunk/lights_lambert_vertex.glsl';
@@ -72,7 +73,6 @@ import specularmap_fragment from './ShaderChunk/specularmap_fragment.glsl';
 import specularmap_pars_fragment from './ShaderChunk/specularmap_pars_fragment.glsl';
 import tonemapping_fragment from './ShaderChunk/tonemapping_fragment.glsl';
 import tonemapping_pars_fragment from './ShaderChunk/tonemapping_pars_fragment.glsl';
-import toonmap_pars_fragment from './ShaderChunk/toonmap_pars_fragment.glsl';
 import uv_pars_fragment from './ShaderChunk/uv_pars_fragment.glsl';
 import uv_pars_vertex from './ShaderChunk/uv_pars_vertex.glsl';
 import uv_vertex from './ShaderChunk/uv_vertex.glsl';
@@ -139,6 +139,7 @@ export var ShaderChunk = {
 	envmap_vertex: envmap_vertex,
 	fog_fragment: fog_fragment,
 	fog_pars_fragment: fog_pars_fragment,
+	gradientmap_pars_fragment: gradientmap_pars_fragment,
 	lightmap_fragment: lightmap_fragment,
 	lightmap_pars_fragment: lightmap_pars_fragment,
 	lights_lambert_vertex: lights_lambert_vertex,
@@ -181,7 +182,6 @@ export var ShaderChunk = {
 	specularmap_pars_fragment: specularmap_pars_fragment,
 	tonemapping_fragment: tonemapping_fragment,
 	tonemapping_pars_fragment: tonemapping_pars_fragment,
-	toonmap_pars_fragment: toonmap_pars_fragment,
 	uv_pars_fragment: uv_pars_fragment,
 	uv_pars_vertex: uv_pars_vertex,
 	uv_vertex: uv_vertex,

+ 5 - 5
src/renderers/shaders/ShaderChunk/toonmap_pars_fragment.glsl → src/renderers/shaders/ShaderChunk/gradientmap_pars_fragment.glsl

@@ -1,13 +1,13 @@
-#ifdef USE_TOONMAP
+#ifdef USE_GRADIENTMAP
 
-	uniform sampler2D toonMap;
+	uniform sampler2D gradientMap;
 
-	vec3 getToonIrradiance( vec3 normal, vec3 lightDirection ) {
+	vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
 
 		// dotNL will be from -1.0 to 1.0
 		float dotNL = dot( normal, lightDirection );
 
-		#ifdef TOONMAP_DIRECTION_Y
+		#ifdef GRADIENTMAP_AXIS_Y
 
 			vec2 coord = vec2( 0.0, dotNL * 0.5 + 0.5 );
 
@@ -17,7 +17,7 @@
 
 		#endif
 
-		return texture2D( toonMap, coord ).rgb;
+		return texture2D( gradientMap, coord ).rgb;
 
 	}
 #endif

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

@@ -18,9 +18,9 @@ struct BlinnPhongMaterial {
 
 void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
 
-	#ifdef USE_TOONMAP
+	#ifdef USE_GRADIENTMAP
 
-		vec3 irradiance = getToonIrradiance( geometry.normal, directLight.direction ) * directLight.color;
+		vec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;
 
 	#else
 

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

@@ -60,7 +60,7 @@ var ShaderLib = {
 			UniformsLib.bumpmap,
 			UniformsLib.normalmap,
 			UniformsLib.displacementmap,
-			UniformsLib.toonmap,
+			UniformsLib.gradientmap,
 			UniformsLib.fog,
 			UniformsLib.lights,
 

+ 1 - 1
src/renderers/shaders/ShaderLib/meshphong_frag.glsl

@@ -17,7 +17,7 @@ uniform float opacity;
 #include <lightmap_pars_fragment>
 #include <emissivemap_pars_fragment>
 #include <envmap_pars_fragment>
-#include <toonmap_pars_fragment>
+#include <gradientmap_pars_fragment>
 #include <fog_pars_fragment>
 #include <bsdfs>
 #include <lights_pars>

+ 2 - 2
src/renderers/shaders/UniformsLib.js

@@ -80,9 +80,9 @@ var UniformsLib = {
 
 	},
 
-	toonmap: {
+	gradientmap: {
 
-		toonMap: { value: null }
+		gradientMap: { value: null }
 
 	},
 

+ 2 - 2
src/renderers/webgl/WebGLProgram.js

@@ -445,8 +445,8 @@ function WebGLProgram( renderer, code, material, parameters ) {
 			parameters.alphaMap ? '#define USE_ALPHAMAP' : '',
 			parameters.vertexColors ? '#define USE_COLOR' : '',
 
-			parameters.toonMap ? '#define USE_TOONMAP' : '',
-			parameters.toonMapDirectionY ? '#define TOONMAP_DIRECTION_Y' : '',
+			parameters.gradientMap ? '#define USE_GRADIENTMAP' : '',
+			parameters.gradientMapAxisY ? '#define GRADIENTMAP_AXIS_Y' : '',
 
 			parameters.flatShading ? '#define FLAT_SHADED' : '',
 

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

@@ -25,7 +25,7 @@ function WebGLPrograms( renderer, capabilities ) {
 	var parameterNames = [
 		"precision", "supportsVertexTextures", "map", "mapEncoding", "envMap", "envMapMode", "envMapEncoding",
 		"lightMap", "aoMap", "emissiveMap", "emissiveMapEncoding", "bumpMap", "normalMap", "displacementMap", "specularMap",
-		"roughnessMap", "metalnessMap", "toonMap",
+		"roughnessMap", "metalnessMap", "gradientMap",
 		"alphaMap", "combine", "vertexColors", "fog", "useFog", "fogExp",
 		"flatShading", "sizeAttenuation", "logarithmicDepthBuffer", "skinning",
 		"maxBones", "useVertexTexture", "morphTargets", "morphNormals",
@@ -153,8 +153,8 @@ function WebGLPrograms( renderer, capabilities ) {
 			specularMap: !! material.specularMap,
 			alphaMap: !! material.alphaMap,
 
-			toonMap: !! material.toonMap,
-			toonMapDirectionY: !! material.toonMapDirectionY,
+			gradientMap: !! material.gradientMap,
+			gradientMapAxisY: !! material.gradientMapAxisY,
 
 			combine: material.combine,