Browse Source

Src: encodings_fragment -> colorspace_fragment (#26206)

* encodings_fragment -> color_space_fragment

* Add check for deprecated chunks

* color_space_fragment -> colorspace_fragment
WestLangley 2 years ago
parent
commit
f8d580c88e
36 changed files with 58 additions and 42 deletions
  1. 1 1
      examples/jsm/effects/AnaglyphEffect.js
  2. 1 1
      examples/jsm/effects/OutlineEffect.js
  3. 1 1
      examples/jsm/effects/ParallaxBarrierEffect.js
  4. 1 1
      examples/jsm/lines/LineMaterial.js
  5. 1 1
      examples/jsm/loaders/LDrawLoader.js
  6. 1 1
      examples/jsm/materials/MeshGouraudMaterial.js
  7. 1 1
      examples/jsm/objects/GroundProjectedSkybox.js
  8. 1 1
      examples/jsm/objects/Reflector.js
  9. 1 1
      examples/jsm/objects/Refractor.js
  10. 1 1
      examples/jsm/objects/Sky.js
  11. 1 1
      examples/jsm/objects/Water.js
  12. 1 1
      examples/jsm/objects/Water2.js
  13. 1 1
      examples/jsm/shaders/BokehShader2.js
  14. 4 4
      examples/jsm/shaders/ToonShader.js
  15. 1 1
      examples/jsm/shaders/WaterRefractionShader.js
  16. 1 1
      examples/webgl_postprocessing_crossfade.html
  17. 1 1
      examples/webgl_read_float_buffer.html
  18. 1 1
      examples/webgl_rtt.html
  19. 4 4
      src/renderers/shaders/ShaderChunk.js
  20. 0 0
      src/renderers/shaders/ShaderChunk/colorspace_fragment.glsl.js
  21. 0 0
      src/renderers/shaders/ShaderChunk/colorspace_pars_fragment.glsl.js
  22. 1 1
      src/renderers/shaders/ShaderLib/background.glsl.js
  23. 1 1
      src/renderers/shaders/ShaderLib/backgroundCube.glsl.js
  24. 1 1
      src/renderers/shaders/ShaderLib/cube.glsl.js
  25. 1 1
      src/renderers/shaders/ShaderLib/equirect.glsl.js
  26. 1 1
      src/renderers/shaders/ShaderLib/linedashed.glsl.js
  27. 1 1
      src/renderers/shaders/ShaderLib/meshbasic.glsl.js
  28. 1 1
      src/renderers/shaders/ShaderLib/meshlambert.glsl.js
  29. 1 1
      src/renderers/shaders/ShaderLib/meshmatcap.glsl.js
  30. 1 1
      src/renderers/shaders/ShaderLib/meshphong.glsl.js
  31. 1 1
      src/renderers/shaders/ShaderLib/meshphysical.glsl.js
  32. 1 1
      src/renderers/shaders/ShaderLib/meshtoon.glsl.js
  33. 1 1
      src/renderers/shaders/ShaderLib/points.glsl.js
  34. 1 1
      src/renderers/shaders/ShaderLib/shadow.glsl.js
  35. 1 1
      src/renderers/shaders/ShaderLib/sprite.glsl.js
  36. 19 3
      src/renderers/webgl/WebGLProgram.js

+ 1 - 1
examples/jsm/effects/AnaglyphEffect.js

@@ -91,7 +91,7 @@ class AnaglyphEffect {
 				'			max( colorL.a, colorR.a ) );',
 
 				'	#include <tonemapping_fragment>',
-				'	#include <encodings_fragment>',
+				'	#include <colorspace_fragment>',
 
 				'}'
 

+ 1 - 1
examples/jsm/effects/OutlineEffect.js

@@ -165,7 +165,7 @@ class OutlineEffect {
 			'	gl_FragColor = vec4( outlineColor, outlineAlpha );',
 
 			'	#include <tonemapping_fragment>',
-			'	#include <encodings_fragment>',
+			'	#include <colorspace_fragment>',
 			'	#include <fog_fragment>',
 			'	#include <premultiplied_alpha_fragment>',
 

+ 1 - 1
examples/jsm/effects/ParallaxBarrierEffect.js

@@ -69,7 +69,7 @@ class ParallaxBarrierEffect {
 				'	}',
 
 				'	#include <tonemapping_fragment>',
-				'	#include <encodings_fragment>',
+				'	#include <colorspace_fragment>',
 
 				'}'
 

+ 1 - 1
examples/jsm/lines/LineMaterial.js

@@ -426,7 +426,7 @@ ShaderLib[ 'line' ] = {
 			gl_FragColor = vec4( diffuseColor.rgb, alpha );
 
 			#include <tonemapping_fragment>
-			#include <encodings_fragment>
+			#include <colorspace_fragment>
 			#include <fog_fragment>
 			#include <premultiplied_alpha_fragment>
 

+ 1 - 1
examples/jsm/loaders/LDrawLoader.js

@@ -133,7 +133,7 @@ class LDrawConditionalLineMaterial extends ShaderMaterial {
 				outgoingLight = diffuseColor.rgb; // simple shader
 				gl_FragColor = vec4( outgoingLight, diffuseColor.a );
 				#include <tonemapping_fragment>
-				#include <encodings_fragment>
+				#include <colorspace_fragment>
 				#include <fog_fragment>
 				#include <premultiplied_alpha_fragment>
 			}

+ 1 - 1
examples/jsm/materials/MeshGouraudMaterial.js

@@ -290,7 +290,7 @@ const GouraudShader = {
 
 			#include <output_fragment>
 			#include <tonemapping_fragment>
-			#include <encodings_fragment>
+			#include <colorspace_fragment>
 			#include <fog_fragment>
 			#include <premultiplied_alpha_fragment>
 			#include <dithering_fragment>

+ 1 - 1
examples/jsm/objects/GroundProjectedSkybox.js

@@ -120,7 +120,7 @@ class GroundProjectedSkybox extends Mesh {
 					gl_FragColor = vec4( outcolor, 1.0 );
 
 					#include <tonemapping_fragment>
-					#include <encodings_fragment>
+					#include <colorspace_fragment>
 
 				}
 				`;

+ 1 - 1
examples/jsm/objects/Reflector.js

@@ -264,7 +264,7 @@ Reflector.ReflectorShader = {
 			gl_FragColor = vec4( blendOverlay( base.rgb, color ), 1.0 );
 
 			#include <tonemapping_fragment>
-			#include <encodings_fragment>
+			#include <colorspace_fragment>
 
 		}`
 };

+ 1 - 1
examples/jsm/objects/Refractor.js

@@ -323,7 +323,7 @@ Refractor.RefractorShader = {
 			gl_FragColor = vec4( blendOverlay( base.rgb, color ), 1.0 );
 
 			#include <tonemapping_fragment>
-			#include <encodings_fragment>
+			#include <colorspace_fragment>
 
 		}`
 

+ 1 - 1
examples/jsm/objects/Sky.js

@@ -210,7 +210,7 @@ Sky.SkyShader = {
 			gl_FragColor = vec4( retColor, 1.0 );
 
 			#include <tonemapping_fragment>
-			#include <encodings_fragment>
+			#include <colorspace_fragment>
 
 		}`
 

+ 1 - 1
examples/jsm/objects/Water.js

@@ -181,7 +181,7 @@ class Water extends Mesh {
 					gl_FragColor = vec4( outgoingLight, alpha );
 
 					#include <tonemapping_fragment>
-					#include <encodings_fragment>
+					#include <colorspace_fragment>
 					#include <fog_fragment>	
 				}`
 

+ 1 - 1
examples/jsm/objects/Water2.js

@@ -348,7 +348,7 @@ Water.WaterShader = {
 			gl_FragColor = vec4( color, 1.0 ) * mix( refractColor, reflectColor, reflectance );
 
 			#include <tonemapping_fragment>
-			#include <encodings_fragment>
+			#include <colorspace_fragment>
 			#include <fog_fragment>
 
 		}`

+ 1 - 1
examples/jsm/shaders/BokehShader2.js

@@ -347,7 +347,7 @@ const BokehShader = {
 			gl_FragColor.a = 1.0;
 
 			#include <tonemapping_fragment>
-			#include <encodings_fragment>
+			#include <colorspace_fragment>
 		}`
 
 };

+ 4 - 4
examples/jsm/shaders/ToonShader.js

@@ -80,7 +80,7 @@ const ToonShader1 = {
 
 			}
 
-			#include <encodings_fragment>
+			#include <colorspace_fragment>
 
 		}`
 
@@ -148,7 +148,7 @@ const ToonShader2 = {
 
 			}
 
-			#include <encodings_fragment>
+			#include <colorspace_fragment>
 
 		}`
 
@@ -244,7 +244,7 @@ const ToonShaderHatching = {
 
 			}
 
-			#include <encodings_fragment>
+			#include <colorspace_fragment>
 
 		}`
 
@@ -317,7 +317,7 @@ const ToonShaderDotted = {
 
 			}
 
-			#include <encodings_fragment>
+			#include <colorspace_fragment>
 
 		}`
 

+ 1 - 1
examples/jsm/shaders/WaterRefractionShader.js

@@ -84,7 +84,7 @@ const WaterRefractionShader = {
 			gl_FragColor = vec4( blendOverlay( base.rgb, color ), 1.0 );
 
 			#include <tonemapping_fragment>
-			#include <encodings_fragment>
+			#include <colorspace_fragment>
 
 		}`
 

+ 1 - 1
examples/webgl_postprocessing_crossfade.html

@@ -300,7 +300,7 @@
 						'	}',
 
 						'	#include <tonemapping_fragment>',
-						'	#include <encodings_fragment>',
+						'	#include <colorspace_fragment>',
 
 						'}'
 

+ 1 - 1
examples/webgl_read_float_buffer.html

@@ -22,7 +22,7 @@
 			void main() {
 
 				gl_FragColor = texture2D( tDiffuse, vUv );
-				#include <encodings_fragment>
+				#include <colorspace_fragment>
 
 			}
 

+ 1 - 1
examples/webgl_rtt.html

@@ -19,7 +19,7 @@
 			void main() {
 
 				gl_FragColor = texture2D( tDiffuse, vUv );
-				#include <encodings_fragment>
+				#include <colorspace_fragment>
 
 			}
 

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

@@ -24,8 +24,8 @@ import displacementmap_pars_vertex from './ShaderChunk/displacementmap_pars_vert
 import displacementmap_vertex from './ShaderChunk/displacementmap_vertex.glsl.js';
 import emissivemap_fragment from './ShaderChunk/emissivemap_fragment.glsl.js';
 import emissivemap_pars_fragment from './ShaderChunk/emissivemap_pars_fragment.glsl.js';
-import encodings_fragment from './ShaderChunk/encodings_fragment.glsl.js';
-import encodings_pars_fragment from './ShaderChunk/encodings_pars_fragment.glsl.js';
+import colorspace_fragment from './ShaderChunk/colorspace_fragment.glsl.js';
+import colorspace_pars_fragment from './ShaderChunk/colorspace_pars_fragment.glsl.js';
 import envmap_fragment from './ShaderChunk/envmap_fragment.glsl.js';
 import envmap_common_pars_fragment from './ShaderChunk/envmap_common_pars_fragment.glsl.js';
 import envmap_pars_fragment from './ShaderChunk/envmap_pars_fragment.glsl.js';
@@ -147,8 +147,8 @@ export const ShaderChunk = {
 	displacementmap_vertex: displacementmap_vertex,
 	emissivemap_fragment: emissivemap_fragment,
 	emissivemap_pars_fragment: emissivemap_pars_fragment,
-	encodings_fragment: encodings_fragment,
-	encodings_pars_fragment: encodings_pars_fragment,
+	colorspace_fragment: colorspace_fragment,
+	colorspace_pars_fragment: colorspace_pars_fragment,
 	envmap_fragment: envmap_fragment,
 	envmap_common_pars_fragment: envmap_common_pars_fragment,
 	envmap_pars_fragment: envmap_pars_fragment,

+ 0 - 0
src/renderers/shaders/ShaderChunk/encodings_fragment.glsl.js → src/renderers/shaders/ShaderChunk/colorspace_fragment.glsl.js


+ 0 - 0
src/renderers/shaders/ShaderChunk/encodings_pars_fragment.glsl.js → src/renderers/shaders/ShaderChunk/colorspace_pars_fragment.glsl.js


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

@@ -26,7 +26,7 @@ void main() {
 	gl_FragColor = texColor;
 
 	#include <tonemapping_fragment>
-	#include <encodings_fragment>
+	#include <colorspace_fragment>
 
 }
 `;

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

@@ -56,7 +56,7 @@ void main() {
 	gl_FragColor = texColor;
 
 	#include <tonemapping_fragment>
-	#include <encodings_fragment>
+	#include <colorspace_fragment>
 
 }
 `;

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

@@ -30,7 +30,7 @@ void main() {
 	gl_FragColor.a *= opacity;
 
 	#include <tonemapping_fragment>
-	#include <encodings_fragment>
+	#include <colorspace_fragment>
 
 }
 `;

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

@@ -29,7 +29,7 @@ void main() {
 	gl_FragColor = texture2D( tEquirect, sampleUV );
 
 	#include <tonemapping_fragment>
-	#include <encodings_fragment>
+	#include <colorspace_fragment>
 
 }
 `;

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

@@ -67,7 +67,7 @@ void main() {
 
 	#include <output_fragment>
 	#include <tonemapping_fragment>
-	#include <encodings_fragment>
+	#include <colorspace_fragment>
 	#include <fog_fragment>
 	#include <premultiplied_alpha_fragment>
 

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

@@ -103,7 +103,7 @@ void main() {
 
 	#include <output_fragment>
 	#include <tonemapping_fragment>
-	#include <encodings_fragment>
+	#include <colorspace_fragment>
 	#include <fog_fragment>
 	#include <premultiplied_alpha_fragment>
 	#include <dithering_fragment>

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

@@ -111,7 +111,7 @@ void main() {
 	#include <envmap_fragment>
 	#include <output_fragment>
 	#include <tonemapping_fragment>
-	#include <encodings_fragment>
+	#include <colorspace_fragment>
 	#include <fog_fragment>
 	#include <premultiplied_alpha_fragment>
 	#include <dithering_fragment>

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

@@ -98,7 +98,7 @@ void main() {
 
 	#include <output_fragment>
 	#include <tonemapping_fragment>
-	#include <encodings_fragment>
+	#include <colorspace_fragment>
 	#include <fog_fragment>
 	#include <premultiplied_alpha_fragment>
 	#include <dithering_fragment>

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

@@ -113,7 +113,7 @@ void main() {
 	#include <envmap_fragment>
 	#include <output_fragment>
 	#include <tonemapping_fragment>
-	#include <encodings_fragment>
+	#include <colorspace_fragment>
 	#include <fog_fragment>
 	#include <premultiplied_alpha_fragment>
 	#include <dithering_fragment>

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

@@ -211,7 +211,7 @@ void main() {
 
 	#include <output_fragment>
 	#include <tonemapping_fragment>
-	#include <encodings_fragment>
+	#include <colorspace_fragment>
 	#include <fog_fragment>
 	#include <premultiplied_alpha_fragment>
 	#include <dithering_fragment>

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

@@ -105,7 +105,7 @@ void main() {
 
 	#include <output_fragment>
 	#include <tonemapping_fragment>
-	#include <encodings_fragment>
+	#include <colorspace_fragment>
 	#include <fog_fragment>
 	#include <premultiplied_alpha_fragment>
 	#include <dithering_fragment>

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

@@ -76,7 +76,7 @@ void main() {
 
 	#include <output_fragment>
 	#include <tonemapping_fragment>
-	#include <encodings_fragment>
+	#include <colorspace_fragment>
 	#include <fog_fragment>
 	#include <premultiplied_alpha_fragment>
 

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

@@ -47,7 +47,7 @@ void main() {
 	gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );
 
 	#include <tonemapping_fragment>
-	#include <encodings_fragment>
+	#include <colorspace_fragment>
 	#include <fog_fragment>
 
 }

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

@@ -72,7 +72,7 @@ void main() {
 
 	#include <output_fragment>
 	#include <tonemapping_fragment>
-	#include <encodings_fragment>
+	#include <colorspace_fragment>
 	#include <fog_fragment>
 
 }

+ 19 - 3
src/renderers/webgl/WebGLProgram.js

@@ -211,13 +211,29 @@ function resolveIncludes( string ) {
 
 }
 
+const shaderChunkMap = new Map( [
+	[ 'encodings_fragment', 'colorspace_fragment' ], // @deprecated, r154
+	[ 'encodings_pars_fragment', 'colorspace_pars_fragment' ] // @deprecated, r154
+] );
+
 function includeReplacer( match, include ) {
 
-	const string = ShaderChunk[ include ];
+	let string = ShaderChunk[ include ];
 
 	if ( string === undefined ) {
 
-		throw new Error( 'Can not resolve #include <' + include + '>' );
+		const newInclude = shaderChunkMap.get( include );
+
+		if ( newInclude !== undefined ) {
+
+			string = ShaderChunk[ newInclude ];
+			console.warn( 'THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.', include, newInclude );
+
+		} else {
+
+			throw new Error( 'Can not resolve #include <' + include + '>' );
+
+		}
 
 	}
 
@@ -760,7 +776,7 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
 			parameters.dithering ? '#define DITHERING' : '',
 			parameters.opaque ? '#define OPAQUE' : '',
 
-			ShaderChunk[ 'encodings_pars_fragment' ], // this code is required here because it is used by the various encoding/decoding function defined below
+			ShaderChunk[ 'colorspace_pars_fragment' ], // this code is required here because it is used by the various encoding/decoding function defined below
 			getTexelEncodingFunction( 'linearToOutputTexel', parameters.outputColorSpace ),
 
 			parameters.useDepthPacking ? '#define DEPTH_PACKING ' + parameters.depthPacking : '',