diff --git a/examples/jsm/Addons.js b/examples/jsm/Addons.js index 417e3e0cb5213b..78ff662983b2ed 100644 --- a/examples/jsm/Addons.js +++ b/examples/jsm/Addons.js @@ -123,7 +123,6 @@ export * from './loaders/VRMLLoader.js'; export * from './loaders/VTKLoader.js'; export * from './loaders/XYZLoader.js'; -export * from './materials/MeshGouraudMaterial.js'; export * from './materials/LDrawConditionalLineMaterial.js'; export * from './materials/MeshPostProcessingMaterial.js'; diff --git a/examples/jsm/materials/MeshGouraudMaterial.js b/examples/jsm/materials/MeshGouraudMaterial.js deleted file mode 100644 index 44526da8d2656e..00000000000000 --- a/examples/jsm/materials/MeshGouraudMaterial.js +++ /dev/null @@ -1,433 +0,0 @@ -/** - * MeshGouraudMaterial - * - * Lambert illumination model with Gouraud (per-vertex) shading - * - */ - -import { UniformsUtils, UniformsLib, ShaderMaterial, Color, MultiplyOperation } from 'three'; - -const GouraudShader = { - - name: 'GouraudShader', - - uniforms: UniformsUtils.merge( [ - UniformsLib.common, - UniformsLib.specularmap, - UniformsLib.envmap, - UniformsLib.aomap, - UniformsLib.lightmap, - UniformsLib.emissivemap, - UniformsLib.fog, - UniformsLib.lights, - { - emissive: { value: new Color( 0x000000 ) } - } - ] ), - - vertexShader: /* glsl */` - - #define GOURAUD - - varying vec3 vLightFront; - varying vec3 vIndirectFront; - - #ifdef DOUBLE_SIDED - varying vec3 vLightBack; - varying vec3 vIndirectBack; - #endif - - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - - void main() { - - #include - #include - #include - - #include - #include - #include - #include - #include - - #include - #include - #include - #include - #include - #include - - #include - #include - - // inlining legacy - - vec3 diffuse = vec3( 1.0 ); - - vec3 geometryPosition = mvPosition.xyz; - vec3 geometryNormal = normalize( transformedNormal ); - vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( -mvPosition.xyz ); - - vec3 backGeometryNormal = - geometryNormal; - - vLightFront = vec3( 0.0 ); - vIndirectFront = vec3( 0.0 ); - #ifdef DOUBLE_SIDED - vLightBack = vec3( 0.0 ); - vIndirectBack = vec3( 0.0 ); - #endif - - IncidentLight directLight; - float dotNL; - vec3 directLightColor_Diffuse; - - vIndirectFront += getAmbientLightIrradiance( ambientLightColor ); - - #if defined( USE_LIGHT_PROBES ) - - vIndirectFront += getLightProbeIrradiance( lightProbe, geometryNormal ); - - #endif - - #ifdef DOUBLE_SIDED - - vIndirectBack += getAmbientLightIrradiance( ambientLightColor ); - - #if defined( USE_LIGHT_PROBES ) - - vIndirectBack += getLightProbeIrradiance( lightProbe, backGeometryNormal ); - - #endif - - #endif - - #if NUM_POINT_LIGHTS > 0 - - #pragma unroll_loop_start - for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) { - - getPointLightInfo( pointLights[ i ], geometryPosition, directLight ); - - dotNL = dot( geometryNormal, directLight.direction ); - directLightColor_Diffuse = directLight.color; - - vLightFront += saturate( dotNL ) * directLightColor_Diffuse; - - #ifdef DOUBLE_SIDED - - vLightBack += saturate( - dotNL ) * directLightColor_Diffuse; - - #endif - - } - #pragma unroll_loop_end - - #endif - - #if NUM_SPOT_LIGHTS > 0 - - #pragma unroll_loop_start - for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) { - - getSpotLightInfo( spotLights[ i ], geometryPosition, directLight ); - - dotNL = dot( geometryNormal, directLight.direction ); - directLightColor_Diffuse = directLight.color; - - vLightFront += saturate( dotNL ) * directLightColor_Diffuse; - - #ifdef DOUBLE_SIDED - - vLightBack += saturate( - dotNL ) * directLightColor_Diffuse; - - #endif - } - #pragma unroll_loop_end - - #endif - - #if NUM_DIR_LIGHTS > 0 - - #pragma unroll_loop_start - for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) { - - getDirectionalLightInfo( directionalLights[ i ], directLight ); - - dotNL = dot( geometryNormal, directLight.direction ); - directLightColor_Diffuse = directLight.color; - - vLightFront += saturate( dotNL ) * directLightColor_Diffuse; - - #ifdef DOUBLE_SIDED - - vLightBack += saturate( - dotNL ) * directLightColor_Diffuse; - - #endif - - } - #pragma unroll_loop_end - - #endif - - #if NUM_HEMI_LIGHTS > 0 - - #pragma unroll_loop_start - for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) { - - vIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal ); - - #ifdef DOUBLE_SIDED - - vIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometryNormal ); - - #endif - - } - #pragma unroll_loop_end - - #endif - - #include - #include - - }`, - - fragmentShader: /* glsl */` - - #define GOURAUD - - uniform vec3 diffuse; - uniform vec3 emissive; - uniform float opacity; - - varying vec3 vLightFront; - varying vec3 vIndirectFront; - - #ifdef DOUBLE_SIDED - varying vec3 vLightBack; - varying vec3 vIndirectBack; - #endif - - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - - void main() { - - #include - - vec4 diffuseColor = vec4( diffuse, opacity ); - ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); - vec3 totalEmissiveRadiance = emissive; - - #include - #include - #include - #include - #include - #include - #include - - // accumulation - - #ifdef DOUBLE_SIDED - - reflectedLight.indirectDiffuse += ( gl_FrontFacing ) ? vIndirectFront : vIndirectBack; - - #else - - reflectedLight.indirectDiffuse += vIndirectFront; - - #endif - - #ifdef USE_LIGHTMAP - - vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); - vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; - reflectedLight.indirectDiffuse += lightMapIrradiance; - - #endif - - reflectedLight.indirectDiffuse *= BRDF_Lambert( diffuseColor.rgb ); - - #ifdef DOUBLE_SIDED - - reflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack; - - #else - - reflectedLight.directDiffuse = vLightFront; - - #endif - - reflectedLight.directDiffuse *= BRDF_Lambert( diffuseColor.rgb ) * getShadowMask(); - - // modulation - - #include - - vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; - - #include - - #include - #include - #include - #include - #include - #include - - }` - -}; - -// - -class MeshGouraudMaterial extends ShaderMaterial { - - constructor( parameters ) { - - super(); - - console.warn( 'THREE.MeshGouraudMaterial: MeshGouraudMaterial has been deprecated and will be removed with r183. Use THREE.MeshLambertMaterial instead.' ); // @deprecated r173 - - this.isMeshGouraudMaterial = true; - - this.type = 'MeshGouraudMaterial'; - - //this.color = new THREE.Color( 0xffffff ); // diffuse - - //this.map = null; - - //this.lightMap = null; - //this.lightMapIntensity = 1.0; - - //this.aoMap = null; - //this.aoMapIntensity = 1.0; - - //this.emissive = new THREE.Color( 0x000000 ); - //this.emissiveIntensity = 1.0; - //this.emissiveMap = null; - - //this.specularMap = null; - - //this.alphaMap = null; - - //this.envMap = null; - this.combine = MultiplyOperation; // combine has no uniform - //this.reflectivity = 1; - //this.refractionRatio = 0.98; - - this.fog = false; // set to use scene fog - this.lights = true; // set to use scene lights - this.clipping = false; // set to use user-defined clipping planes - - const shader = GouraudShader; - - this.defines = Object.assign( {}, shader.defines ); - this.uniforms = UniformsUtils.clone( shader.uniforms ); - this.vertexShader = shader.vertexShader; - this.fragmentShader = shader.fragmentShader; - - const exposePropertyNames = [ - 'map', 'lightMap', 'lightMapIntensity', 'aoMap', 'aoMapIntensity', - 'emissive', 'emissiveIntensity', 'emissiveMap', 'specularMap', 'alphaMap', - 'envMap', 'reflectivity', 'refractionRatio', 'opacity', 'diffuse' - ]; - - for ( const propertyName of exposePropertyNames ) { - - Object.defineProperty( this, propertyName, { - - get: function () { - - return this.uniforms[ propertyName ].value; - - }, - - set: function ( value ) { - - this.uniforms[ propertyName ].value = value; - - } - - } ); - - } - - Object.defineProperty( this, 'color', Object.getOwnPropertyDescriptor( this, 'diffuse' ) ); - - this.setValues( parameters ); - - } - - copy( source ) { - - super.copy( source ); - - this.color.copy( source.color ); - - this.map = source.map; - - this.lightMap = source.lightMap; - this.lightMapIntensity = source.lightMapIntensity; - - this.aoMap = source.aoMap; - this.aoMapIntensity = source.aoMapIntensity; - - this.emissive.copy( source.emissive ); - this.emissiveMap = source.emissiveMap; - this.emissiveIntensity = source.emissiveIntensity; - - this.specularMap = source.specularMap; - - this.alphaMap = source.alphaMap; - - this.envMap = source.envMap; - this.combine = source.combine; - this.reflectivity = source.reflectivity; - this.refractionRatio = source.refractionRatio; - - this.wireframe = source.wireframe; - this.wireframeLinewidth = source.wireframeLinewidth; - this.wireframeLinecap = source.wireframeLinecap; - this.wireframeLinejoin = source.wireframeLinejoin; - - this.fog = source.fog; - - return this; - - } - -} - -export { MeshGouraudMaterial }; diff --git a/examples/jsm/shaders/VignetteShader.js b/examples/jsm/shaders/VignetteShader.js index 4a49caeec97376..3ac5845ac21861 100644 --- a/examples/jsm/shaders/VignetteShader.js +++ b/examples/jsm/shaders/VignetteShader.js @@ -4,7 +4,7 @@ */ /** - * Based on [PaintEffect postprocess from ro.me](http://code.google.com/p/3-dreams-of-black/source/browse/deploy/js/effects/PaintEffect.js). + * Based on [PaintEffect postprocess from ro.me](https://github.com/dataarts/3-dreams-of-black/blob/master/deploy/js/effects/PaintEffect.js). * * @constant * @type {ShaderMaterial~Shader} diff --git a/src/nodes/core/VaryingNode.js b/src/nodes/core/VaryingNode.js index 8ba5cc18fec01c..c1728a543dbe55 100644 --- a/src/nodes/core/VaryingNode.js +++ b/src/nodes/core/VaryingNode.js @@ -2,7 +2,6 @@ import Node from './Node.js'; import { NodeShaderStage } from './constants.js'; import { addMethodChaining, nodeProxy } from '../tsl/TSLCore.js'; import { subBuild } from './SubBuildNode.js'; -import { warn } from '../../utils.js'; /** * Class for representing shader varyings as nodes. Varyings are create from @@ -209,19 +208,3 @@ export const vertexStage = ( node ) => varying( node ); addMethodChaining( 'toVarying', varying ); addMethodChaining( 'toVertexStage', vertexStage ); - -// Deprecated - -addMethodChaining( 'varying', ( ...params ) => { // @deprecated, r173 - - warn( 'TSL: .varying() has been renamed to .toVarying().' ); - return varying( ...params ); - -} ); - -addMethodChaining( 'vertexStage', ( ...params ) => { // @deprecated, r173 - - warn( 'TSL: .vertexStage() has been renamed to .toVertexStage().' ); - return varying( ...params ); - -} ); diff --git a/src/renderers/WebGLRenderer.js b/src/renderers/WebGLRenderer.js index 850e766dcba240..d1334bbe3ac3ff 100644 --- a/src/renderers/WebGLRenderer.js +++ b/src/renderers/WebGLRenderer.js @@ -2598,16 +2598,6 @@ class WebGLRenderer { } - // https://github.com/mrdoob/three.js/pull/24467#issuecomment-1209031512 - - if ( material.isMeshGouraudMaterial && material.envMap !== null ) { - - m_uniforms.envMap.value = envMap; - - m_uniforms.flipEnvMap.value = ( envMap.isCubeTexture && envMap.isRenderTargetTexture === false ) ? - 1 : 1; - - } - if ( material.isMeshStandardMaterial && material.envMap === null && scene.environment !== null ) { m_uniforms.envMapIntensity.value = scene.environmentIntensity;