2021-05-11 13:53:06 +02:00
var $a = "128" , Oy = { LEFT : 0 , MIDDLE : 1 , RIGHT : 2 , ROTATE : 0 , DOLLY : 1 , PAN : 2 } , Uy = { ROTATE : 0 , PAN : 1 , DOLLY _PAN : 2 , DOLLY _ROTATE : 3 } , su = 0 , Qa = 1 , ou = 2 , Hy = 3 , Gy = 0 , Ka = 1 , au = 2 , Mi = 3 , Si = 0 , Qe = 1 , fr = 2 , el = 1 , ky = 2 , en = 0 , Ti = 1 , tl = 2 , nl = 3 , il = 4 , lu = 5 , Gn = 100 , cu = 101 , hu = 102 , rl = 103 , sl = 104 , uu = 200 , du = 201 , fu = 202 , pu = 203 , ol = 204 , al = 205 , mu = 206 , gu = 207 , xu = 208 , yu = 209 , vu = 210 , _u = 0 , wu = 1 , bu = 2 , Gs = 3 , Mu = 4 , Su = 5 , Tu = 6 , Eu = 7 , pr = 0 , Au = 1 , Lu = 2 , kn = 0 , Ru = 1 , Cu = 2 , Pu = 3 , Iu = 4 , Du = 5 , ks = 300 , mr = 301 , gr = 302 , Vs = 303 , Ws = 304 , Ei = 306 , xr = 307 , yr = 1e3 , xt = 1001 , vr = 1002 , nt = 1003 , qs = 1004 , Vy = 1004 , Xs = 1005 , Wy = 1005 , it = 1006 , ll = 1007 , qy = 1007 , Ai = 1008 , Xy = 1008 , Li = 1009 , Fu = 1010 , Nu = 1011 , _r = 1012 , Bu = 1013 , wr = 1014 , tn = 1015 , br = 1016 , zu = 1017 , Ou = 1018 , Uu = 1019 , Ri = 1020 , Hu = 1021 , Sn = 1022 , Tt = 1023 , Gu = 1024 , ku = 1025 , Vu = Tt , Vn = 1026 , Ci = 1027 , Wu = 1028 , qu = 1029 , Xu = 1030 , Yu = 1031 , Zu = 1032 , Ju = 1033 , cl = 33776 , hl = 33777 , ul = 33778 , dl = 33779 , fl = 35840 , pl = 35841 , ml = 35842 , gl = 35843 , ju = 36196 , xl = 37492 , yl = 37496 , $u = 37808 , Qu = 37809 , Ku = 37810 , ed = 37811 , td = 37812 , nd = 37813 , id = 37814 , rd = 37815 , sd = 37816 , od = 37817 , ad = 37818 , ld = 37819 , cd = 37820 , hd = 37821 , ud = 36492 , dd = 37840 , fd = 37841 , pd = 37842 , md = 37843 , gd = 37844 , xd = 37845 , yd = 37846 , vd = 37847 , _d = 37848 , wd = 37849 , bd = 37850 , Md = 37851 , Sd = 37852 , Td = 37853 , Ed = 2200 , Ad = 2201 , Ld = 2202 , Mr = 2300 , Sr = 2301 , Ys = 2302 , Wn = 2400 , qn = 2401 , Tr = 2402 , Zs = 2500 , vl = 2501 , Rd = 0 , Yy = 1 , Zy = 2 , yt = 3e3 , Er = 3001 , Js = 3007 , js = 3002 , Cd = 3003 , _l = 3004 , wl = 3005 , bl = 3006 , Pd = 3200 , Id = 3201 , Xn = 0 , Dd = 1 , Jy = 0 , $s = 7680 , jy = 7681 , $y = 7682 , Qy = 7683 , Ky = 34055 , ev = 34056 , tv = 5386 , nv = 512 , iv = 513 , rv = 514 , sv = 515 , ov = 516 , av = 517 , lv = 518 , Fd = 519 , Pi = 35044 , Ii = 35048 , cv = 35040 , hv = 35045 , uv = 35049 , dv = 35041 , fv = 35046 , pv = 35050 , mv = 35042 , gv = "100" , Ml = "300 es" , nn = class { addEventListener ( e , t ) { this . _listeners === void 0 && ( this . _listeners = { } ) ; let n = this . _listeners ; n [ e ] === void 0 && ( n [ e ] = [ ] ) , n [ e ] . indexOf ( t ) === - 1 && n [ e ] . push ( t ) } hasEventListener ( e , t ) { if ( this . _listeners === void 0 ) return ! 1 ; let n = this . _listeners ; return n [ e ] !== void 0 && n [ e ] . indexOf ( t ) !== - 1 } removeEventListener ( e , t ) { if ( this . _listeners === void 0 ) return ; let i = this . _listeners [ e ] ; if ( i !== void 0 ) { let r = i . indexOf ( t ) ; r !== - 1 && i . splice ( r , 1 ) } } dispatchEvent ( e ) { if ( this . _listeners === void 0 ) return ; let n = this . _listeners [ e . type ] ; if ( n !== void 0 ) { e . target = this ; let i = n . slice ( 0 ) ; for ( let r = 0 , o = i . length ; r < o ; r ++ ) i [ r ] . call ( this , e ) ; e . target = null } } } , lt = [ ] ; for ( let s = 0 ; s < 256 ; s ++ ) lt [ s ] = ( s < 16 ? "0" : "" ) + s . toString ( 16 ) ; var Ar = 1234567 , Tn = Math . PI / 180 , Di = 180 / Math . PI ; function wt ( ) { let s = Math . random ( ) * 4294967295 | 0 , e = Math . random ( ) * 4294967295 | 0 , t = Math . random ( ) * 4294967295 | 0 , n = Math . random ( ) * 4294967295 | 0 ; return ( lt [ s & 255 ] + lt [ s >> 8 & 255 ] + lt [ s >> 16 & 255 ] + lt [ s >> 24 & 255 ] + "-" + lt [ e & 255 ] + lt [ e >> 8 & 255 ] + "-" + lt [ e >> 16 & 15 | 64 ] + lt [ e >> 24 & 255 ] + "-" + lt [ t & 63 | 128 ] + lt [ t >> 8 & 255 ] + "-" + lt [ t >> 16 & 255 ] + lt [ t >> 24 & 255 ] + lt [ n & 255 ] + lt [ n >> 8 & 255 ] + lt [ n >> 16 & 255 ] + lt [ n >> 24 & 255 ] ) . toUpperCase ( ) } function ct ( s , e , t ) { return Math . max ( e , Math . min ( t , s ) ) } function Qs ( s , e ) { return ( s % e + e ) % e } function Nd ( s , e , t , n , i ) { return n + ( s - e ) * ( i - n ) / ( t - e ) } function Bd ( s , e , t ) { return s !== e ? ( t - s ) / ( e - s ) : 0 } function Fi ( s , e , t ) { return ( 1 - t ) * s + t * e } function zd ( s , e , t , n ) { return Fi ( s , e , 1 - Math . exp ( - t * n ) ) } function Od ( s , e = 1 ) { return e - Math . abs ( Qs ( s , e * 2 ) - e ) } function Ud ( s , e , t ) { return s <= e ? 0 : s >= t ? 1 : ( s = ( s - e ) / ( t - e ) , s * s * ( 3 - 2 * s ) ) } function Hd ( s , e , t ) { return s <= e ? 0 : s >= t ? 1 : ( s = ( s - e ) / ( t - e ) , s * s * s * ( s * ( s * 6 - 15 ) + 10 ) ) } function Gd ( s , e ) { return s + Math . floor ( Math . random ( ) * ( e - s + 1 ) ) } function kd ( s , e ) { return s + Math . random ( ) * ( e - s ) } function Vd ( s ) { return s * ( . 5 - Math . random ( ) ) } function Wd ( s ) { return s !== void 0 && ( Ar = s % 2147483647 ) , Ar = Ar * 16807 % 2147483647 , ( Ar - 1 ) / 2147483646 } function qd ( s ) { return s * Tn } function Xd ( s ) { return s * Di } function Ks ( s ) { return ( s & s - 1 ) == 0 && s !== 0 } function Sl ( s ) { return Math . pow ( 2 , Math . ceil ( Math . log ( s ) / Math . LN2 ) ) } function Tl ( s ) { return Math . pow ( 2 , Math . floor ( Math . log ( s ) / Math . LN2 ) ) } function Yd ( s , e , t , n , i ) { let r = Math . cos , o = Math . sin , a = r ( t / 2 ) , c = o ( t / 2 ) , l = r ( ( e + n ) / 2 ) , h = o ( ( e + n ) / 2 ) , u = r ( ( e - n ) / 2 ) , d = o ( ( e - n ) / 2 ) , f = r ( ( n - e ) / 2 ) , m = o ( ( n - e ) / 2 ) ; switch ( i ) { case "XYX" : s . set ( a * h , c * u , c * d , a * l ) ; break ; case "YZY" : s . set ( c * d , a * h , c * u , a * l ) ; break ; case "ZXZ" : s . set ( c * u , c * d , a * h , a * l ) ; break ; case "XZX" : s . set ( a * h , c * m , c * f , a * l ) ; break ; case "YXY" : s . set ( c * f , a * h , c * m , a * l ) ; break ; case "ZYZ" : s . set ( c * m , c * f , a * h , a * l ) ; break ; default : console . warn ( "THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: " + i ) } } var xv = Object . freeze
gl _Position = projectionMatrix * modelViewMatrix * vec4 ( position , 1.0 ) ;
} ` ,uf= ` void main ( ) {
gl _FragColor = vec4 ( 1.0 , 0.0 , 0.0 , 1.0 ) ;
} ` ,jt=class extends tt{constructor(e){super();this.type="ShaderMaterial",this.defines={},this.uniforms={},this.vertexShader=hf,this.fragmentShader=uf,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,e!==void 0&&(e.attributes!==void 0&&console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."),this.setValues(e))}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=ri(e.uniforms),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.lights=e.lights,this.clipping=e.clipping,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this}toJSON(e){let t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(let i in this.uniforms){let o=this.uniforms[i].value;o&&o.isTexture?t.uniforms[i]={type:"t",value:o.toJSON(e).uuid}:o&&o.isColor?t.uniforms[i]={type:"c",value:o.getHex()}:o&&o.isVector2?t.uniforms[i]={type:"v2",value:o.toArray()}:o&&o.isVector3?t.uniforms[i]={type:"v3",value:o.toArray()}:o&&o.isVector4?t.uniforms[i]={type:"v4",value:o.toArray()}:o&&o.isMatrix3?t.uniforms[i]={type:"m3",value:o.toArray()}:o&&o.isMatrix4?t.uniforms[i]={type:"m4",value:o.toArray()}:t.uniforms[i]={value:o}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader;let n={};for(let i in this.extensions)this.extensions[i]===!0&&(n[i]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}};jt.prototype.isShaderMaterial=!0;var Hi=class extends Se{constructor(){super();this.type="Camera",this.matrixWorldInverse=new le,this.projectionMatrix=new le,this.projectionMatrixInverse=new le}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this}getWorldDirection(e){e===void 0&&(console.warn("THREE.Camera: .getWorldDirection() target is now required"),e=new _),this.updateWorldMatrix(!0,!1);let t=this.matrixWorld.elements;return e.set(-t[8],-t[9],-t[10]).normalize()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}};Hi.prototype.isCamera=!0;var ot=class extends Hi{constructor(e=50,t=1,n=.1,i=2e3){super();this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,this.far=i,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){let t=.5*this.getFilmHeight()/e;this.fov=Di*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){let e=Math.tan(Tn*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Di*2*Math.atan(Math.tan(Tn*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}setViewOffset(e,t,n,i,r,o){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=o,this.updateProjectionMat
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
varying vec3 vWorldDirection ;
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
vec3 transformDirection ( in vec3 dir , in mat4 matrix ) {
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
return normalize ( ( matrix * vec4 ( dir , 0.0 ) ) . xyz ) ;
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
}
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
void main ( ) {
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
vWorldDirection = transformDirection ( position , modelMatrix ) ;
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
# include < begin _vertex >
# include < project _vertex >
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
}
` ,fragmentShader: `
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
uniform sampler2D tEquirect ;
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
varying vec3 vWorldDirection ;
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
# include < common >
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
void main ( ) {
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
vec3 direction = normalize ( vWorldDirection ) ;
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
vec2 sampleUV = equirectUv ( direction ) ;
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
gl _FragColor = texture2D ( tEquirect , sampleUV ) ;
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
}
` },i=new ii(5,5,5),r=new jt({name:"CubemapFromEquirect",uniforms:ri(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:Qe,blending:en});r.uniforms.tEquirect.value=t;let o=new je(i,r),a=t.minFilter;return t.minFilter===Ai&&(t.minFilter=it),new Xr(1,10,this).update(e,o),t.minFilter=a,o.geometry.dispose(),o.material.dispose(),this}clear(e,t,n,i){let r=e.getRenderTarget();for(let o=0;o<6;o++)e.setRenderTarget(this,o),e.clear(t,n,i);e.setRenderTarget(r)}};Yr.prototype.isWebGLCubeRenderTarget=!0;var li=class extends et{constructor(e,t,n,i,r,o,a,c,l,h,u,d){super(null,o,a,c,l,h,i,r,u,d);this.image={data:e||null,width:t||1,height:n||1},this.magFilter=l!==void 0?l:nt,this.minFilter=h!==void 0?h:nt,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.needsUpdate=!0}};li.prototype.isDataTexture=!0;var ci=new on,Zr=new _,Gi=class{constructor(e=new Lt,t=new Lt,n=new Lt,i=new Lt,r=new Lt,o=new Lt){this.planes=[e,t,n,i,r,o]}set(e,t,n,i,r,o){let a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(n),a[3].copy(i),a[4].copy(r),a[5].copy(o),this}copy(e){let t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e){let t=this.planes,n=e.elements,i=n[0],r=n[1],o=n[2],a=n[3],c=n[4],l=n[5],h=n[6],u=n[7],d=n[8],f=n[9],m=n[10],x=n[11],y=n[12],g=n[13],p=n[14],w=n[15];return t[0].setComponents(a-i,u-c,x-d,w-y).normalize(),t[1].setComponents(a+i,u+c,x+d,w+y).normalize(),t[2].setComponents(a+r,u+l,x+f,w+g).normalize(),t[3].setComponents(a-r,u-l,x-f,w-g).normalize(),t[4].setComponents(a-o,u-h,x-m,w-p).normalize(),t[5].setComponents(a+o,u+h,x+m,w+p).normalize(),this}intersectsObject(e){let t=e.geometry;return t.boundingSphere===null&&t.computeBoundingSphere(),ci.copy(t.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(ci)}intersectsSprite(e){return ci.center.set(0,0,0),ci.radius=.7071067811865476,ci.applyMatrix4(e.matrixWorld),this.intersectsSphere(ci)}intersectsSphere(e){let t=this.planes,n=e.center,i=-e.radius;for(let r=0;r<6;r++)if(t[r].distanceToPoint(n)<i)return!1;return!0}intersectsBox(e){let t=this.planes;for(let n=0;n<6;n++){let i=t[n];if(Zr.x=i.normal.x>0?e.max.x:e.min.x,Zr.y=i.normal.y>0?e.max.y:e.min.y,Zr.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(Zr)<0)return!1}return!0}containsPoint(e){let t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}};function Yl(){let s=null,e=!1,t=null,n=null;function i(r,o){t(r,o),n=s.requestAnimationFrame(i)}return{start:function(){e!==!0&&t!==null&&(n=s.requestAnimationFrame(i),e=!0)},stop:function(){s.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(r){t=r},setContext:function(r){s=r}}}function df(s,e){let t=e.isWebGL2,n=new WeakMap;function i(l,h){let u=l.array,d=l.usage,f=s.createBuffer();s.bindBuffer(h,f),s.bufferData(h,u,d),l.onUploadCallback();let m=5126;return u instanceof Float32Array?m=5126:u instanceof Float64Array?console.warn("THREE.WebGLAttributes: Unsupported data buffer format: Float64Array."):u instanceof Uint16Array?l.isFloat16BufferAttribute?t?m=5131:console.warn("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2."):m=5123:u instanceof Int16Array?m=5122:u instanceof Uint32Array?m=5125:u instanceof Int32Array?m=5124:u instanceof Int8Array?m=5120:u instanceof Uint8Array&&(m=5121),{buffer:f,type:m,bytesPerElement:u.BYTES_PER_ELEMENT,version:l.version}}function r(l,h,u){let d=h.array,f=h.updateRange;s.bindBuffer(u,l),f.count===-1?s.bufferSubData(u,0,d):(t?s.bufferSubData(u,f.offset*d.BYTES_PER_ELEMENT,d,f.offset,f.count):s.bufferSubData(u,f.offset*d.BYTES_PER_ELEMENT,d.subarray(f.offset,f.offset+f.count)),f.count=-1)}function o(l){return l.isInterleavedBufferAttribute&&(l=l.data),n.get(l)}function a(l){l.isInterleavedBufferAttribute&&(l=l.data);let h=n.get(l);h&&(s.deleteBuffer(h.buffer),n.delete(l))}function c(l,h){if(l.isGLBufferAttribute){let d=n.get(l);(!d||d.version<l.version)&&n.set(l,{buffer:l.buffer,type:l.type,bytesPerElement:l.elementSize,version:l.version});return}l.isInterle
diffuseColor . a *= texture2D ( alphaMap , vUv ) . g ;
# endif ` ,pf= ` # ifdef USE _ALPHAMAP
uniform sampler2D alphaMap ;
# endif ` ,mf= ` # ifdef ALPHATEST
if ( diffuseColor . a < ALPHATEST ) discard ;
# endif ` ,gf= ` # ifdef USE _AOMAP
float ambientOcclusion = ( texture2D ( aoMap , vUv2 ) . r - 1.0 ) * aoMapIntensity + 1.0 ;
reflectedLight . indirectDiffuse *= ambientOcclusion ;
# if defined ( USE _ENVMAP ) && defined ( STANDARD )
float dotNV = saturate ( dot ( geometry . normal , geometry . viewDir ) ) ;
reflectedLight . indirectSpecular *= computeSpecularOcclusion ( dotNV , ambientOcclusion , material . specularRoughness ) ;
# endif
# endif ` ,xf= ` # ifdef USE _AOMAP
uniform sampler2D aoMap ;
uniform float aoMapIntensity ;
# endif ` ,yf="vec3 transformed = vec3( position );",vf= ` vec3 objectNormal = vec3 ( normal ) ;
# ifdef USE _TANGENT
vec3 objectTangent = vec3 ( tangent . xyz ) ;
# endif ` ,_f= ` vec2 integrateSpecularBRDF ( const in float dotNV , const in float roughness ) {
const vec4 c0 = vec4 ( - 1 , - 0.0275 , - 0.572 , 0.022 ) ;
const vec4 c1 = vec4 ( 1 , 0.0425 , 1.04 , - 0.04 ) ;
vec4 r = roughness * c0 + c1 ;
float a004 = min ( r . x * r . x , exp2 ( - 9.28 * dotNV ) ) * r . x + r . y ;
return vec2 ( - 1.04 , 1.04 ) * a004 + r . zw ;
}
float punctualLightIntensityToIrradianceFactor ( const in float lightDistance , const in float cutoffDistance , const in float decayExponent ) {
# if defined ( PHYSICALLY _CORRECT _LIGHTS )
float distanceFalloff = 1.0 / max ( pow ( lightDistance , decayExponent ) , 0.01 ) ;
if ( cutoffDistance > 0.0 ) {
distanceFalloff *= pow2 ( saturate ( 1.0 - pow4 ( lightDistance / cutoffDistance ) ) ) ;
}
return distanceFalloff ;
# else
if ( cutoffDistance > 0.0 && decayExponent > 0.0 ) {
return pow ( saturate ( - lightDistance / cutoffDistance + 1.0 ) , decayExponent ) ;
}
return 1.0 ;
# endif
}
vec3 BRDF _Diffuse _Lambert ( const in vec3 diffuseColor ) {
return RECIPROCAL _PI * diffuseColor ;
}
vec3 F _Schlick ( const in vec3 specularColor , const in float dotLH ) {
float fresnel = exp2 ( ( - 5.55473 * dotLH - 6.98316 ) * dotLH ) ;
return ( 1.0 - specularColor ) * fresnel + specularColor ;
}
vec3 F _Schlick _RoughnessDependent ( const in vec3 F0 , const in float dotNV , const in float roughness ) {
float fresnel = exp2 ( ( - 5.55473 * dotNV - 6.98316 ) * dotNV ) ;
vec3 Fr = max ( vec3 ( 1.0 - roughness ) , F0 ) - F0 ;
return Fr * fresnel + F0 ;
}
float G _GGX _Smith ( const in float alpha , const in float dotNL , const in float dotNV ) {
float a2 = pow2 ( alpha ) ;
float gl = dotNL + sqrt ( a2 + ( 1.0 - a2 ) * pow2 ( dotNL ) ) ;
float gv = dotNV + sqrt ( a2 + ( 1.0 - a2 ) * pow2 ( dotNV ) ) ;
return 1.0 / ( gl * gv ) ;
}
float G _GGX _SmithCorrelated ( const in float alpha , const in float dotNL , const in float dotNV ) {
float a2 = pow2 ( alpha ) ;
float gv = dotNL * sqrt ( a2 + ( 1.0 - a2 ) * pow2 ( dotNV ) ) ;
float gl = dotNV * sqrt ( a2 + ( 1.0 - a2 ) * pow2 ( dotNL ) ) ;
return 0.5 / max ( gv + gl , EPSILON ) ;
}
float D _GGX ( const in float alpha , const in float dotNH ) {
float a2 = pow2 ( alpha ) ;
float denom = pow2 ( dotNH ) * ( a2 - 1.0 ) + 1.0 ;
return RECIPROCAL _PI * a2 / pow2 ( denom ) ;
}
vec3 BRDF _Specular _GGX ( const in IncidentLight incidentLight , const in vec3 viewDir , const in vec3 normal , const in vec3 specularColor , const in float roughness ) {
float alpha = pow2 ( roughness ) ;
vec3 halfDir = normalize ( incidentLight . direction + viewDir ) ;
float dotNL = saturate ( dot ( normal , incidentLight . direction ) ) ;
float dotNV = saturate ( dot ( normal , viewDir ) ) ;
float dotNH = saturate ( dot ( normal , halfDir ) ) ;
float dotLH = saturate ( dot ( incidentLight . direction , halfDir ) ) ;
vec3 F = F _Schlick ( specularColor , dotLH ) ;
float G = G _GGX _SmithCorrelated ( alpha , dotNL , dotNV ) ;
float D = D _GGX ( alpha , dotNH ) ;
return F * ( G * D ) ;
}
vec2 LTC _Uv ( const in vec3 N , const in vec3 V , const in float roughness ) {
const float LUT _SIZE = 64.0 ;
const float LUT _SCALE = ( LUT _SIZE - 1.0 ) / LUT _SIZE ;
const float LUT _BIAS = 0.5 / LUT _SIZE ;
float dotNV = saturate ( dot ( N , V ) ) ;
vec2 uv = vec2 ( roughness , sqrt ( 1.0 - dotNV ) ) ;
uv = uv * LUT _SCALE + LUT _BIAS ;
return uv ;
}
float LTC _ClippedSphereFormFactor ( const in vec3 f ) {
float l = length ( f ) ;
return max ( ( l * l + f . z ) / ( l + 1.0 ) , 0.0 ) ;
}
vec3 LTC _EdgeVectorFormFactor ( const in vec3 v1 , const in vec3 v2 ) {
float x = dot ( v1 , v2 ) ;
float y = abs ( x ) ;
float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y ;
float b = 3.4175940 + ( 4.1616724 + y ) * y ;
float v = a / b ;
float theta _sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt ( max ( 1.0 - x * x , 1e-7 ) ) - v ;
return cross ( v1 , v2 ) * theta _sintheta ;
}
vec3 LTC _Evaluate ( const in vec3 N , const in vec3 V , const in vec3 P , const in mat3 mInv , const in vec3 rectCoords [ 4 ] ) {
vec3 v1 = rectCoords [ 1 ] - rectCoords [ 0 ] ;
vec3 v2 = rectCoords [ 3 ] - rectCoords [ 0 ] ;
vec3 lightNormal = cross ( v1 , v2 ) ;
if ( dot ( lightNormal , P - rectCoords [ 0 ] ) < 0.0 ) return vec3 ( 0.0 ) ;
vec3 T1 , T2 ;
T1 = normalize ( V - N * dot ( V , N ) ) ;
T2 = - cross ( N , T1 ) ;
mat3 mat = mInv * transposeMat3 ( mat3 ( T1 , T2 , N ) ) ;
vec3 coords [ 4 ] ;
coords [ 0 ] = mat * ( rectCoords [ 0 ] - P ) ;
coords [ 1 ] = mat * ( rectCoords [ 1 ] - P ) ;
coords [ 2 ] = mat * ( rectCoords [ 2 ] - P ) ;
coords [ 3 ] = mat * ( rectCoords [ 3 ] - P ) ;
coords [ 0 ] = normalize ( coords [ 0 ] ) ;
coords [ 1 ] = normalize ( coords [ 1 ] ) ;
coords [ 2 ] = normalize ( coords [ 2 ] ) ;
coords [ 3 ] = normalize ( coords [ 3 ] ) ;
vec3 vectorFormFactor = vec3 ( 0.0 ) ;
vectorFormFactor += LTC _EdgeVectorFormFactor ( coords [ 0 ] , coords [ 1 ] ) ;
vectorFormFactor += LTC _EdgeVectorFormFactor ( coords [ 1 ] , coords [ 2 ] ) ;
vectorFormFactor += LTC _EdgeVectorFormFactor ( coords [ 2 ] , coords [ 3 ] ) ;
vectorFormFactor += LTC _EdgeVectorFormFactor ( coords [ 3 ] , coords [ 0 ] ) ;
float result = LTC _ClippedSphereFormFactor ( vectorFormFactor ) ;
return vec3 ( result ) ;
}
vec3 BRDF _Specular _GGX _Environment ( const in vec3 viewDir , const in vec3 normal , const in vec3 specularColor , const in float roughness ) {
float dotNV = saturate ( dot ( normal , viewDir ) ) ;
vec2 brdf = integrateSpecularBRDF ( dotNV , roughness ) ;
return specularColor * brdf . x + brdf . y ;
}
void BRDF _Specular _Multiscattering _Environment ( const in GeometricContext geometry , const in vec3 specularColor , const in float roughness , inout vec3 singleScatter , inout vec3 multiScatter ) {
float dotNV = saturate ( dot ( geometry . normal , geometry . viewDir ) ) ;
vec3 F = F _Schlick _RoughnessDependent ( specularColor , dotNV , roughness ) ;
vec2 brdf = integrateSpecularBRDF ( dotNV , roughness ) ;
vec3 FssEss = F * brdf . x + brdf . y ;
float Ess = brdf . x + brdf . y ;
float Ems = 1.0 - Ess ;
vec3 Favg = specularColor + ( 1.0 - specularColor ) * 0.047619 ; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg ) ;
singleScatter += FssEss ;
multiScatter += Fms * Ems ;
}
float G _BlinnPhong _Implicit ( ) {
return 0.25 ;
}
float D _BlinnPhong ( const in float shininess , const in float dotNH ) {
return RECIPROCAL _PI * ( shininess * 0.5 + 1.0 ) * pow ( dotNH , shininess ) ;
}
vec3 BRDF _Specular _BlinnPhong ( const in IncidentLight incidentLight , const in GeometricContext geometry , const in vec3 specularColor , const in float shininess ) {
vec3 halfDir = normalize ( incidentLight . direction + geometry . viewDir ) ;
float dotNH = saturate ( dot ( geometry . normal , halfDir ) ) ;
float dotLH = saturate ( dot ( incidentLight . direction , halfDir ) ) ;
vec3 F = F _Schlick ( specularColor , dotLH ) ;
float G = G _BlinnPhong _Implicit ( ) ;
float D = D _BlinnPhong ( shininess , dotNH ) ;
return F * ( G * D ) ;
}
float GGXRoughnessToBlinnExponent ( const in float ggxRoughness ) {
return ( 2.0 / pow2 ( ggxRoughness + 0.0001 ) - 2.0 ) ;
}
float BlinnExponentToGGXRoughness ( const in float blinnExponent ) {
return sqrt ( 2.0 / ( blinnExponent + 2.0 ) ) ;
}
# if defined ( USE _SHEEN )
float D _Charlie ( float roughness , float NoH ) {
float invAlpha = 1.0 / roughness ;
float cos2h = NoH * NoH ;
float sin2h = max ( 1.0 - cos2h , 0.0078125 ) ; return ( 2.0 + invAlpha ) * pow ( sin2h , invAlpha * 0.5 ) / ( 2.0 * PI ) ;
}
float V _Neubelt ( float NoV , float NoL ) {
return saturate ( 1.0 / ( 4.0 * ( NoL + NoV - NoL * NoV ) ) ) ;
}
vec3 BRDF _Specular _Sheen ( const in float roughness , const in vec3 L , const in GeometricContext geometry , vec3 specularColor ) {
vec3 N = geometry . normal ;
vec3 V = geometry . viewDir ;
vec3 H = normalize ( V + L ) ;
float dotNH = saturate ( dot ( N , H ) ) ;
return specularColor * D _Charlie ( roughness , dotNH ) * V _Neubelt ( dot ( N , V ) , dot ( N , L ) ) ;
}
# endif ` ,wf= ` # ifdef USE _BUMPMAP
uniform sampler2D bumpMap ;
uniform float bumpScale ;
vec2 dHdxy _fwd ( ) {
vec2 dSTdx = dFdx ( vUv ) ;
vec2 dSTdy = dFdy ( vUv ) ;
float Hll = bumpScale * texture2D ( bumpMap , vUv ) . x ;
float dBx = bumpScale * texture2D ( bumpMap , vUv + dSTdx ) . x - Hll ;
float dBy = bumpScale * texture2D ( bumpMap , vUv + dSTdy ) . x - Hll ;
return vec2 ( dBx , dBy ) ;
}
vec3 perturbNormalArb ( vec3 surf _pos , vec3 surf _norm , vec2 dHdxy , float faceDirection ) {
vec3 vSigmaX = vec3 ( dFdx ( surf _pos . x ) , dFdx ( surf _pos . y ) , dFdx ( surf _pos . z ) ) ;
vec3 vSigmaY = vec3 ( dFdy ( surf _pos . x ) , dFdy ( surf _pos . y ) , dFdy ( surf _pos . z ) ) ;
vec3 vN = surf _norm ;
vec3 R1 = cross ( vSigmaY , vN ) ;
vec3 R2 = cross ( vN , vSigmaX ) ;
float fDet = dot ( vSigmaX , R1 ) * faceDirection ;
vec3 vGrad = sign ( fDet ) * ( dHdxy . x * R1 + dHdxy . y * R2 ) ;
return normalize ( abs ( fDet ) * surf _norm - vGrad ) ;
}
# endif ` ,bf= ` # if NUM _CLIPPING _PLANES > 0
vec4 plane ;
# pragma unroll _loop _start
for ( int i = 0 ; i < UNION _CLIPPING _PLANES ; i ++ ) {
plane = clippingPlanes [ i ] ;
if ( dot ( vClipPosition , plane . xyz ) > plane . w ) discard ;
}
# pragma unroll _loop _end
# if UNION _CLIPPING _PLANES < NUM _CLIPPING _PLANES
bool clipped = true ;
# pragma unroll _loop _start
for ( int i = UNION _CLIPPING _PLANES ; i < NUM _CLIPPING _PLANES ; i ++ ) {
plane = clippingPlanes [ i ] ;
clipped = ( dot ( vClipPosition , plane . xyz ) > plane . w ) && clipped ;
}
# pragma unroll _loop _end
if ( clipped ) discard ;
# endif
# endif ` ,Mf= ` # if NUM _CLIPPING _PLANES > 0
varying vec3 vClipPosition ;
uniform vec4 clippingPlanes [ NUM _CLIPPING _PLANES ] ;
# endif ` ,Sf= ` # if NUM _CLIPPING _PLANES > 0
varying vec3 vClipPosition ;
# endif ` ,Tf= ` # if NUM _CLIPPING _PLANES > 0
vClipPosition = - mvPosition . xyz ;
# endif ` ,Ef= ` # if defined ( USE _COLOR _ALPHA )
diffuseColor *= vColor ;
# elif defined ( USE _COLOR )
diffuseColor . rgb *= vColor ;
# endif ` ,Af= ` # if defined ( USE _COLOR _ALPHA )
varying vec4 vColor ;
# elif defined ( USE _COLOR )
varying vec3 vColor ;
# endif ` ,Lf= ` # if defined ( USE _COLOR _ALPHA )
varying vec4 vColor ;
# elif defined ( USE _COLOR ) || defined ( USE _INSTANCING _COLOR )
varying vec3 vColor ;
# endif ` ,Rf= ` # if defined ( USE _COLOR _ALPHA )
vColor = vec4 ( 1.0 ) ;
# elif defined ( USE _COLOR ) || defined ( USE _INSTANCING _COLOR )
vColor = vec3 ( 1.0 ) ;
# endif
# ifdef USE _COLOR
vColor *= color ;
# endif
# ifdef USE _INSTANCING _COLOR
vColor . xyz *= instanceColor . xyz ;
# endif ` ,Cf= ` # define PI 3.141592653589793
# define PI2 6.283185307179586
# define PI _HALF 1.5707963267948966
# define RECIPROCAL _PI 0.3183098861837907
# define RECIPROCAL _PI2 0.15915494309189535
# define EPSILON 1e-6
# ifndef saturate
# define saturate ( a ) clamp ( a , 0.0 , 1.0 )
# endif
# define whiteComplement ( a ) ( 1.0 - saturate ( a ) )
float pow2 ( const in float x ) { return x * x ; }
float pow3 ( const in float x ) { return x * x * x ; }
float pow4 ( const in float x ) { float x2 = x * x ; return x2 * x2 ; }
float average ( const in vec3 color ) { return dot ( color , vec3 ( 0.3333 ) ) ; }
highp float rand ( const in vec2 uv ) {
const highp float a = 12.9898 , b = 78.233 , c = 43758.5453 ;
highp float dt = dot ( uv . xy , vec2 ( a , b ) ) , sn = mod ( dt , PI ) ;
return fract ( sin ( sn ) * c ) ;
}
# ifdef HIGH _PRECISION
float precisionSafeLength ( vec3 v ) { return length ( v ) ; }
# else
float max3 ( vec3 v ) { return max ( max ( v . x , v . y ) , v . z ) ; }
float precisionSafeLength ( vec3 v ) {
float maxComponent = max3 ( abs ( v ) ) ;
return length ( v / maxComponent ) * maxComponent ;
}
# endif
struct IncidentLight {
vec3 color ;
vec3 direction ;
bool visible ;
} ;
struct ReflectedLight {
vec3 directDiffuse ;
vec3 directSpecular ;
vec3 indirectDiffuse ;
vec3 indirectSpecular ;
} ;
struct GeometricContext {
vec3 position ;
vec3 normal ;
vec3 viewDir ;
# ifdef CLEARCOAT
vec3 clearcoatNormal ;
# endif
} ;
vec3 transformDirection ( in vec3 dir , in mat4 matrix ) {
return normalize ( ( matrix * vec4 ( dir , 0.0 ) ) . xyz ) ;
}
vec3 inverseTransformDirection ( in vec3 dir , in mat4 matrix ) {
return normalize ( ( vec4 ( dir , 0.0 ) * matrix ) . xyz ) ;
}
vec3 projectOnPlane ( in vec3 point , in vec3 pointOnPlane , in vec3 planeNormal ) {
float distance = dot ( planeNormal , point - pointOnPlane ) ;
return - distance * planeNormal + point ;
}
float sideOfPlane ( in vec3 point , in vec3 pointOnPlane , in vec3 planeNormal ) {
return sign ( dot ( point - pointOnPlane , planeNormal ) ) ;
}
vec3 linePlaneIntersect ( in vec3 pointOnLine , in vec3 lineDirection , in vec3 pointOnPlane , in vec3 planeNormal ) {
return lineDirection * ( dot ( planeNormal , pointOnPlane - pointOnLine ) / dot ( planeNormal , lineDirection ) ) + pointOnLine ;
}
mat3 transposeMat3 ( const in mat3 m ) {
mat3 tmp ;
tmp [ 0 ] = vec3 ( m [ 0 ] . x , m [ 1 ] . x , m [ 2 ] . x ) ;
tmp [ 1 ] = vec3 ( m [ 0 ] . y , m [ 1 ] . y , m [ 2 ] . y ) ;
tmp [ 2 ] = vec3 ( m [ 0 ] . z , m [ 1 ] . z , m [ 2 ] . z ) ;
return tmp ;
}
float linearToRelativeLuminance ( const in vec3 color ) {
vec3 weights = vec3 ( 0.2126 , 0.7152 , 0.0722 ) ;
return dot ( weights , color . rgb ) ;
}
bool isPerspectiveMatrix ( mat4 m ) {
return m [ 2 ] [ 3 ] == - 1.0 ;
}
vec2 equirectUv ( in vec3 dir ) {
float u = atan ( dir . z , dir . x ) * RECIPROCAL _PI2 + 0.5 ;
float v = asin ( clamp ( dir . y , - 1.0 , 1.0 ) ) * RECIPROCAL _PI + 0.5 ;
return vec2 ( u , v ) ;
} ` ,Pf= ` # ifdef ENVMAP _TYPE _CUBE _UV
# define cubeUV _maxMipLevel 8.0
# define cubeUV _minMipLevel 4.0
# define cubeUV _maxTileSize 256.0
# define cubeUV _minTileSize 16.0
float getFace ( vec3 direction ) {
vec3 absDirection = abs ( direction ) ;
float face = - 1.0 ;
if ( absDirection . x > absDirection . z ) {
if ( absDirection . x > absDirection . y )
face = direction . x > 0.0 ? 0.0 : 3.0 ;
else
face = direction . y > 0.0 ? 1.0 : 4.0 ;
} else {
if ( absDirection . z > absDirection . y )
face = direction . z > 0.0 ? 2.0 : 5.0 ;
else
face = direction . y > 0.0 ? 1.0 : 4.0 ;
}
return face ;
}
vec2 getUV ( vec3 direction , float face ) {
vec2 uv ;
if ( face == 0.0 ) {
uv = vec2 ( direction . z , direction . y ) / abs ( direction . x ) ;
} else if ( face == 1.0 ) {
uv = vec2 ( - direction . x , - direction . z ) / abs ( direction . y ) ;
} else if ( face == 2.0 ) {
uv = vec2 ( - direction . x , direction . y ) / abs ( direction . z ) ;
} else if ( face == 3.0 ) {
uv = vec2 ( - direction . z , direction . y ) / abs ( direction . x ) ;
} else if ( face == 4.0 ) {
uv = vec2 ( - direction . x , direction . z ) / abs ( direction . y ) ;
} else {
uv = vec2 ( direction . x , direction . y ) / abs ( direction . z ) ;
}
return 0.5 * ( uv + 1.0 ) ;
}
vec3 bilinearCubeUV ( sampler2D envMap , vec3 direction , float mipInt ) {
float face = getFace ( direction ) ;
float filterInt = max ( cubeUV _minMipLevel - mipInt , 0.0 ) ;
mipInt = max ( mipInt , cubeUV _minMipLevel ) ;
float faceSize = exp2 ( mipInt ) ;
float texelSize = 1.0 / ( 3.0 * cubeUV _maxTileSize ) ;
vec2 uv = getUV ( direction , face ) * ( faceSize - 1.0 ) ;
vec2 f = fract ( uv ) ;
uv += 0.5 - f ;
if ( face > 2.0 ) {
uv . y += faceSize ;
face -= 3.0 ;
}
uv . x += face * faceSize ;
if ( mipInt < cubeUV _maxMipLevel ) {
uv . y += 2.0 * cubeUV _maxTileSize ;
}
uv . y += filterInt * 2.0 * cubeUV _minTileSize ;
uv . x += 3.0 * max ( 0.0 , cubeUV _maxTileSize - 2.0 * faceSize ) ;
uv *= texelSize ;
vec3 tl = envMapTexelToLinear ( texture2D ( envMap , uv ) ) . rgb ;
uv . x += texelSize ;
vec3 tr = envMapTexelToLinear ( texture2D ( envMap , uv ) ) . rgb ;
uv . y += texelSize ;
vec3 br = envMapTexelToLinear ( texture2D ( envMap , uv ) ) . rgb ;
uv . x -= texelSize ;
vec3 bl = envMapTexelToLinear ( texture2D ( envMap , uv ) ) . rgb ;
vec3 tm = mix ( tl , tr , f . x ) ;
vec3 bm = mix ( bl , br , f . x ) ;
return mix ( tm , bm , f . y ) ;
}
# define r0 1.0
# define v0 0.339
# define m0 - 2.0
# define r1 0.8
# define v1 0.276
# define m1 - 1.0
# define r4 0.4
# define v4 0.046
# define m4 2.0
# define r5 0.305
# define v5 0.016
# define m5 3.0
# define r6 0.21
# define v6 0.0038
# define m6 4.0
float roughnessToMip ( float roughness ) {
float mip = 0.0 ;
if ( roughness >= r1 ) {
mip = ( r0 - roughness ) * ( m1 - m0 ) / ( r0 - r1 ) + m0 ;
} else if ( roughness >= r4 ) {
mip = ( r1 - roughness ) * ( m4 - m1 ) / ( r1 - r4 ) + m1 ;
} else if ( roughness >= r5 ) {
mip = ( r4 - roughness ) * ( m5 - m4 ) / ( r4 - r5 ) + m4 ;
} else if ( roughness >= r6 ) {
mip = ( r5 - roughness ) * ( m6 - m5 ) / ( r5 - r6 ) + m5 ;
} else {
mip = - 2.0 * log2 ( 1.16 * roughness ) ; }
return mip ;
}
vec4 textureCubeUV ( sampler2D envMap , vec3 sampleDir , float roughness ) {
float mip = clamp ( roughnessToMip ( roughness ) , m0 , cubeUV _maxMipLevel ) ;
float mipF = fract ( mip ) ;
float mipInt = floor ( mip ) ;
vec3 color0 = bilinearCubeUV ( envMap , sampleDir , mipInt ) ;
if ( mipF == 0.0 ) {
return vec4 ( color0 , 1.0 ) ;
} else {
vec3 color1 = bilinearCubeUV ( envMap , sampleDir , mipInt + 1.0 ) ;
return vec4 ( mix ( color0 , color1 , mipF ) , 1.0 ) ;
}
}
# endif ` ,If= ` vec3 transformedNormal = objectNormal ;
# ifdef USE _INSTANCING
mat3 m = mat3 ( instanceMatrix ) ;
transformedNormal /= vec3 ( dot ( m [ 0 ] , m [ 0 ] ) , dot ( m [ 1 ] , m [ 1 ] ) , dot ( m [ 2 ] , m [ 2 ] ) ) ;
transformedNormal = m * transformedNormal ;
# endif
transformedNormal = normalMatrix * transformedNormal ;
# ifdef FLIP _SIDED
transformedNormal = - transformedNormal ;
# endif
# ifdef USE _TANGENT
vec3 transformedTangent = ( modelViewMatrix * vec4 ( objectTangent , 0.0 ) ) . xyz ;
# ifdef FLIP _SIDED
transformedTangent = - transformedTangent ;
# endif
# endif ` ,Df= ` # ifdef USE _DISPLACEMENTMAP
uniform sampler2D displacementMap ;
uniform float displacementScale ;
uniform float displacementBias ;
# endif ` ,Ff= ` # ifdef USE _DISPLACEMENTMAP
transformed += normalize ( objectNormal ) * ( texture2D ( displacementMap , vUv ) . x * displacementScale + displacementBias ) ;
# endif ` ,Nf= ` # ifdef USE _EMISSIVEMAP
vec4 emissiveColor = texture2D ( emissiveMap , vUv ) ;
emissiveColor . rgb = emissiveMapTexelToLinear ( emissiveColor ) . rgb ;
totalEmissiveRadiance *= emissiveColor . rgb ;
# endif ` ,Bf= ` # ifdef USE _EMISSIVEMAP
uniform sampler2D emissiveMap ;
# endif ` ,zf="gl_FragColor = linearToOutputTexel( gl_FragColor );",Of= `
vec4 LinearToLinear ( in vec4 value ) {
return value ;
}
vec4 GammaToLinear ( in vec4 value , in float gammaFactor ) {
return vec4 ( pow ( value . rgb , vec3 ( gammaFactor ) ) , value . a ) ;
}
vec4 LinearToGamma ( in vec4 value , in float gammaFactor ) {
return vec4 ( pow ( value . rgb , vec3 ( 1.0 / gammaFactor ) ) , value . a ) ;
}
vec4 sRGBToLinear ( in vec4 value ) {
return vec4 ( mix ( pow ( value . rgb * 0.9478672986 + vec3 ( 0.0521327014 ) , vec3 ( 2.4 ) ) , value . rgb * 0.0773993808 , vec3 ( lessThanEqual ( value . rgb , vec3 ( 0.04045 ) ) ) ) , value . a ) ;
}
vec4 LinearTosRGB ( in vec4 value ) {
return vec4 ( mix ( pow ( value . rgb , vec3 ( 0.41666 ) ) * 1.055 - vec3 ( 0.055 ) , value . rgb * 12.92 , vec3 ( lessThanEqual ( value . rgb , vec3 ( 0.0031308 ) ) ) ) , value . a ) ;
}
vec4 RGBEToLinear ( in vec4 value ) {
return vec4 ( value . rgb * exp2 ( value . a * 255.0 - 128.0 ) , 1.0 ) ;
}
vec4 LinearToRGBE ( in vec4 value ) {
float maxComponent = max ( max ( value . r , value . g ) , value . b ) ;
float fExp = clamp ( ceil ( log2 ( maxComponent ) ) , - 128.0 , 127.0 ) ;
return vec4 ( value . rgb / exp2 ( fExp ) , ( fExp + 128.0 ) / 255.0 ) ;
}
vec4 RGBMToLinear ( in vec4 value , in float maxRange ) {
return vec4 ( value . rgb * value . a * maxRange , 1.0 ) ;
}
vec4 LinearToRGBM ( in vec4 value , in float maxRange ) {
float maxRGB = max ( value . r , max ( value . g , value . b ) ) ;
float M = clamp ( maxRGB / maxRange , 0.0 , 1.0 ) ;
M = ceil ( M * 255.0 ) / 255.0 ;
return vec4 ( value . rgb / ( M * maxRange ) , M ) ;
}
vec4 RGBDToLinear ( in vec4 value , in float maxRange ) {
return vec4 ( value . rgb * ( ( maxRange / 255.0 ) / value . a ) , 1.0 ) ;
}
vec4 LinearToRGBD ( in vec4 value , in float maxRange ) {
float maxRGB = max ( value . r , max ( value . g , value . b ) ) ;
float D = max ( maxRange / maxRGB , 1.0 ) ;
D = clamp ( floor ( D ) / 255.0 , 0.0 , 1.0 ) ;
return vec4 ( value . rgb * ( D * ( 255.0 / maxRange ) ) , D ) ;
}
const mat3 cLogLuvM = mat3 ( 0.2209 , 0.3390 , 0.4184 , 0.1138 , 0.6780 , 0.7319 , 0.0102 , 0.1130 , 0.2969 ) ;
vec4 LinearToLogLuv ( in vec4 value ) {
vec3 Xp _Y _XYZp = cLogLuvM * value . rgb ;
Xp _Y _XYZp = max ( Xp _Y _XYZp , vec3 ( 1e-6 , 1e-6 , 1e-6 ) ) ;
vec4 vResult ;
vResult . xy = Xp _Y _XYZp . xy / Xp _Y _XYZp . z ;
float Le = 2.0 * log2 ( Xp _Y _XYZp . y ) + 127.0 ;
vResult . w = fract ( Le ) ;
vResult . z = ( Le - ( floor ( vResult . w * 255.0 ) ) / 255.0 ) / 255.0 ;
return vResult ;
}
const mat3 cLogLuvInverseM = mat3 ( 6.0014 , - 2.7008 , - 1.7996 , - 1.3320 , 3.1029 , - 5.7721 , 0.3008 , - 1.0882 , 5.6268 ) ;
vec4 LogLuvToLinear ( in vec4 value ) {
float Le = value . z * 255.0 + value . w ;
vec3 Xp _Y _XYZp ;
Xp _Y _XYZp . y = exp2 ( ( Le - 127.0 ) / 2.0 ) ;
Xp _Y _XYZp . z = Xp _Y _XYZp . y / value . y ;
Xp _Y _XYZp . x = value . x * Xp _Y _XYZp . z ;
vec3 vRGB = cLogLuvInverseM * Xp _Y _XYZp . rgb ;
return vec4 ( max ( vRGB , 0.0 ) , 1.0 ) ;
} ` ,Uf= ` # ifdef USE _ENVMAP
# ifdef ENV _WORLDPOS
vec3 cameraToFrag ;
if ( isOrthographic ) {
cameraToFrag = normalize ( vec3 ( - viewMatrix [ 0 ] [ 2 ] , - viewMatrix [ 1 ] [ 2 ] , - viewMatrix [ 2 ] [ 2 ] ) ) ;
} else {
cameraToFrag = normalize ( vWorldPosition - cameraPosition ) ;
}
vec3 worldNormal = inverseTransformDirection ( normal , viewMatrix ) ;
# ifdef ENVMAP _MODE _REFLECTION
vec3 reflectVec = reflect ( cameraToFrag , worldNormal ) ;
# else
vec3 reflectVec = refract ( cameraToFrag , worldNormal , refractionRatio ) ;
# endif
# else
vec3 reflectVec = vReflect ;
# endif
# ifdef ENVMAP _TYPE _CUBE
vec4 envColor = textureCube ( envMap , vec3 ( flipEnvMap * reflectVec . x , reflectVec . yz ) ) ;
# elif defined ( ENVMAP _TYPE _CUBE _UV )
vec4 envColor = textureCubeUV ( envMap , reflectVec , 0.0 ) ;
# else
vec4 envColor = vec4 ( 0.0 ) ;
# endif
# ifndef ENVMAP _TYPE _CUBE _UV
envColor = envMapTexelToLinear ( envColor ) ;
# endif
# ifdef ENVMAP _BLENDING _MULTIPLY
outgoingLight = mix ( outgoingLight , outgoingLight * envColor . xyz , specularStrength * reflectivity ) ;
# elif defined ( ENVMAP _BLENDING _MIX )
outgoingLight = mix ( outgoingLight , envColor . xyz , specularStrength * reflectivity ) ;
# elif defined ( ENVMAP _BLENDING _ADD )
outgoingLight += envColor . xyz * specularStrength * reflectivity ;
# endif
# endif ` ,Hf= ` # ifdef USE _ENVMAP
uniform float envMapIntensity ;
uniform float flipEnvMap ;
uniform int maxMipLevel ;
# ifdef ENVMAP _TYPE _CUBE
uniform samplerCube envMap ;
# else
uniform sampler2D envMap ;
# endif
# endif ` ,Gf= ` # ifdef USE _ENVMAP
uniform float reflectivity ;
# if defined ( USE _BUMPMAP ) || defined ( USE _NORMALMAP ) || defined ( PHONG )
# define ENV _WORLDPOS
# endif
# ifdef ENV _WORLDPOS
varying vec3 vWorldPosition ;
uniform float refractionRatio ;
# else
varying vec3 vReflect ;
# endif
# endif ` ,kf= ` # ifdef USE _ENVMAP
# if defined ( USE _BUMPMAP ) || defined ( USE _NORMALMAP ) || defined ( PHONG )
# define ENV _WORLDPOS
# endif
# ifdef ENV _WORLDPOS
varying vec3 vWorldPosition ;
# else
varying vec3 vReflect ;
uniform float refractionRatio ;
# endif
# endif ` ,Vf= ` # ifdef USE _ENVMAP
# ifdef ENV _WORLDPOS
vWorldPosition = worldPosition . xyz ;
# else
vec3 cameraToVertex ;
if ( isOrthographic ) {
cameraToVertex = normalize ( vec3 ( - viewMatrix [ 0 ] [ 2 ] , - viewMatrix [ 1 ] [ 2 ] , - viewMatrix [ 2 ] [ 2 ] ) ) ;
} else {
cameraToVertex = normalize ( worldPosition . xyz - cameraPosition ) ;
}
vec3 worldNormal = inverseTransformDirection ( transformedNormal , viewMatrix ) ;
# ifdef ENVMAP _MODE _REFLECTION
vReflect = reflect ( cameraToVertex , worldNormal ) ;
# else
vReflect = refract ( cameraToVertex , worldNormal , refractionRatio ) ;
# endif
# endif
# endif ` ,Wf= ` # ifdef USE _FOG
fogDepth = - mvPosition . z ;
# endif ` ,qf= ` # ifdef USE _FOG
varying float fogDepth ;
# endif ` ,Xf= ` # ifdef USE _FOG
# ifdef FOG _EXP2
float fogFactor = 1.0 - exp ( - fogDensity * fogDensity * fogDepth * fogDepth ) ;
# else
float fogFactor = smoothstep ( fogNear , fogFar , fogDepth ) ;
# endif
gl _FragColor . rgb = mix ( gl _FragColor . rgb , fogColor , fogFactor ) ;
# endif ` ,Yf= ` # ifdef USE _FOG
uniform vec3 fogColor ;
varying float fogDepth ;
# ifdef FOG _EXP2
uniform float fogDensity ;
# else
uniform float fogNear ;
uniform float fogFar ;
# endif
# endif ` ,Zf= ` # ifdef USE _GRADIENTMAP
uniform sampler2D gradientMap ;
# endif
vec3 getGradientIrradiance ( vec3 normal , vec3 lightDirection ) {
float dotNL = dot ( normal , lightDirection ) ;
vec2 coord = vec2 ( dotNL * 0.5 + 0.5 , 0.0 ) ;
# ifdef USE _GRADIENTMAP
return texture2D ( gradientMap , coord ) . rgb ;
# else
return ( coord . x < 0.7 ) ? vec3 ( 0.7 ) : vec3 ( 1.0 ) ;
# endif
} ` ,Jf= ` # ifdef USE _LIGHTMAP
vec4 lightMapTexel = texture2D ( lightMap , vUv2 ) ;
reflectedLight . indirectDiffuse += PI * lightMapTexelToLinear ( lightMapTexel ) . rgb * lightMapIntensity ;
# endif ` ,jf= ` # ifdef USE _LIGHTMAP
uniform sampler2D lightMap ;
uniform float lightMapIntensity ;
# endif ` , $ f= ` vec3 diffuse = vec3 ( 1.0 ) ;
GeometricContext geometry ;
geometry . position = mvPosition . xyz ;
geometry . normal = normalize ( transformedNormal ) ;
geometry . viewDir = ( isOrthographic ) ? vec3 ( 0 , 0 , 1 ) : normalize ( - mvPosition . xyz ) ;
GeometricContext backGeometry ;
backGeometry . position = geometry . position ;
backGeometry . normal = - geometry . normal ;
backGeometry . viewDir = geometry . viewDir ;
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 ) ;
vIndirectFront += getLightProbeIrradiance ( lightProbe , geometry ) ;
# ifdef DOUBLE _SIDED
vIndirectBack += getAmbientLightIrradiance ( ambientLightColor ) ;
vIndirectBack += getLightProbeIrradiance ( lightProbe , backGeometry ) ;
# endif
# if NUM _POINT _LIGHTS > 0
# pragma unroll _loop _start
for ( int i = 0 ; i < NUM _POINT _LIGHTS ; i ++ ) {
getPointDirectLightIrradiance ( pointLights [ i ] , geometry , directLight ) ;
dotNL = dot ( geometry . normal , directLight . direction ) ;
directLightColor _Diffuse = PI * 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 ++ ) {
getSpotDirectLightIrradiance ( spotLights [ i ] , geometry , directLight ) ;
dotNL = dot ( geometry . normal , directLight . direction ) ;
directLightColor _Diffuse = PI * 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 ++ ) {
getDirectionalDirectLightIrradiance ( directionalLights [ i ] , geometry , directLight ) ;
dotNL = dot ( geometry . normal , directLight . direction ) ;
directLightColor _Diffuse = PI * 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 ] , geometry ) ;
# ifdef DOUBLE _SIDED
vIndirectBack += getHemisphereLightIrradiance ( hemisphereLights [ i ] , backGeometry ) ;
# endif
}
# pragma unroll _loop _end
# endif ` ,Qf= ` uniform bool receiveShadow ;
uniform vec3 ambientLightColor ;
uniform vec3 lightProbe [ 9 ] ;
vec3 shGetIrradianceAt ( in vec3 normal , in vec3 shCoefficients [ 9 ] ) {
float x = normal . x , y = normal . y , z = normal . z ;
vec3 result = shCoefficients [ 0 ] * 0.886227 ;
result += shCoefficients [ 1 ] * 2.0 * 0.511664 * y ;
result += shCoefficients [ 2 ] * 2.0 * 0.511664 * z ;
result += shCoefficients [ 3 ] * 2.0 * 0.511664 * x ;
result += shCoefficients [ 4 ] * 2.0 * 0.429043 * x * y ;
result += shCoefficients [ 5 ] * 2.0 * 0.429043 * y * z ;
result += shCoefficients [ 6 ] * ( 0.743125 * z * z - 0.247708 ) ;
result += shCoefficients [ 7 ] * 2.0 * 0.429043 * x * z ;
result += shCoefficients [ 8 ] * 0.429043 * ( x * x - y * y ) ;
return result ;
}
vec3 getLightProbeIrradiance ( const in vec3 lightProbe [ 9 ] , const in GeometricContext geometry ) {
vec3 worldNormal = inverseTransformDirection ( geometry . normal , viewMatrix ) ;
vec3 irradiance = shGetIrradianceAt ( worldNormal , lightProbe ) ;
return irradiance ;
}
vec3 getAmbientLightIrradiance ( const in vec3 ambientLightColor ) {
vec3 irradiance = ambientLightColor ;
# ifndef PHYSICALLY _CORRECT _LIGHTS
irradiance *= PI ;
# endif
return irradiance ;
}
# if NUM _DIR _LIGHTS > 0
struct DirectionalLight {
vec3 direction ;
vec3 color ;
} ;
uniform DirectionalLight directionalLights [ NUM _DIR _LIGHTS ] ;
void getDirectionalDirectLightIrradiance ( const in DirectionalLight directionalLight , const in GeometricContext geometry , out IncidentLight directLight ) {
directLight . color = directionalLight . color ;
directLight . direction = directionalLight . direction ;
directLight . visible = true ;
}
# endif
# if NUM _POINT _LIGHTS > 0
struct PointLight {
vec3 position ;
vec3 color ;
float distance ;
float decay ;
} ;
uniform PointLight pointLights [ NUM _POINT _LIGHTS ] ;
void getPointDirectLightIrradiance ( const in PointLight pointLight , const in GeometricContext geometry , out IncidentLight directLight ) {
vec3 lVector = pointLight . position - geometry . position ;
directLight . direction = normalize ( lVector ) ;
float lightDistance = length ( lVector ) ;
directLight . color = pointLight . color ;
directLight . color *= punctualLightIntensityToIrradianceFactor ( lightDistance , pointLight . distance , pointLight . decay ) ;
directLight . visible = ( directLight . color != vec3 ( 0.0 ) ) ;
}
# endif
# if NUM _SPOT _LIGHTS > 0
struct SpotLight {
vec3 position ;
vec3 direction ;
vec3 color ;
float distance ;
float decay ;
float coneCos ;
float penumbraCos ;
} ;
uniform SpotLight spotLights [ NUM _SPOT _LIGHTS ] ;
void getSpotDirectLightIrradiance ( const in SpotLight spotLight , const in GeometricContext geometry , out IncidentLight directLight ) {
vec3 lVector = spotLight . position - geometry . position ;
directLight . direction = normalize ( lVector ) ;
float lightDistance = length ( lVector ) ;
float angleCos = dot ( directLight . direction , spotLight . direction ) ;
if ( angleCos > spotLight . coneCos ) {
float spotEffect = smoothstep ( spotLight . coneCos , spotLight . penumbraCos , angleCos ) ;
directLight . color = spotLight . color ;
directLight . color *= spotEffect * punctualLightIntensityToIrradianceFactor ( lightDistance , spotLight . distance , spotLight . decay ) ;
directLight . visible = true ;
} else {
directLight . color = vec3 ( 0.0 ) ;
directLight . visible = false ;
}
}
# endif
# if NUM _RECT _AREA _LIGHTS > 0
struct RectAreaLight {
vec3 color ;
vec3 position ;
vec3 halfWidth ;
vec3 halfHeight ;
} ;
uniform sampler2D ltc _1 ; uniform sampler2D ltc _2 ;
uniform RectAreaLight rectAreaLights [ NUM _RECT _AREA _LIGHTS ] ;
# endif
# if NUM _HEMI _LIGHTS > 0
struct HemisphereLight {
vec3 direction ;
vec3 skyColor ;
vec3 groundColor ;
} ;
uniform HemisphereLight hemisphereLights [ NUM _HEMI _LIGHTS ] ;
vec3 getHemisphereLightIrradiance ( const in HemisphereLight hemiLight , const in GeometricContext geometry ) {
float dotNL = dot ( geometry . normal , hemiLight . direction ) ;
float hemiDiffuseWeight = 0.5 * dotNL + 0.5 ;
vec3 irradiance = mix ( hemiLight . groundColor , hemiLight . skyColor , hemiDiffuseWeight ) ;
# ifndef PHYSICALLY _CORRECT _LIGHTS
irradiance *= PI ;
# endif
return irradiance ;
}
# endif ` ,Kf= ` # if defined ( USE _ENVMAP )
# ifdef ENVMAP _MODE _REFRACTION
uniform float refractionRatio ;
# endif
vec3 getLightProbeIndirectIrradiance ( const in GeometricContext geometry , const in int maxMIPLevel ) {
vec3 worldNormal = inverseTransformDirection ( geometry . normal , viewMatrix ) ;
# ifdef ENVMAP _TYPE _CUBE
vec3 queryVec = vec3 ( flipEnvMap * worldNormal . x , worldNormal . yz ) ;
# ifdef TEXTURE _LOD _EXT
vec4 envMapColor = textureCubeLodEXT ( envMap , queryVec , float ( maxMIPLevel ) ) ;
# else
vec4 envMapColor = textureCube ( envMap , queryVec , float ( maxMIPLevel ) ) ;
# endif
envMapColor . rgb = envMapTexelToLinear ( envMapColor ) . rgb ;
# elif defined ( ENVMAP _TYPE _CUBE _UV )
vec4 envMapColor = textureCubeUV ( envMap , worldNormal , 1.0 ) ;
# else
vec4 envMapColor = vec4 ( 0.0 ) ;
# endif
return PI * envMapColor . rgb * envMapIntensity ;
}
float getSpecularMIPLevel ( const in float roughness , const in int maxMIPLevel ) {
float maxMIPLevelScalar = float ( maxMIPLevel ) ;
float sigma = PI * roughness * roughness / ( 1.0 + roughness ) ;
float desiredMIPLevel = maxMIPLevelScalar + log2 ( sigma ) ;
return clamp ( desiredMIPLevel , 0.0 , maxMIPLevelScalar ) ;
}
vec3 getLightProbeIndirectRadiance ( const in vec3 viewDir , const in vec3 normal , const in float roughness , const in int maxMIPLevel ) {
# ifdef ENVMAP _MODE _REFLECTION
vec3 reflectVec = reflect ( - viewDir , normal ) ;
reflectVec = normalize ( mix ( reflectVec , normal , roughness * roughness ) ) ;
# else
vec3 reflectVec = refract ( - viewDir , normal , refractionRatio ) ;
# endif
reflectVec = inverseTransformDirection ( reflectVec , viewMatrix ) ;
float specularMIPLevel = getSpecularMIPLevel ( roughness , maxMIPLevel ) ;
# ifdef ENVMAP _TYPE _CUBE
vec3 queryReflectVec = vec3 ( flipEnvMap * reflectVec . x , reflectVec . yz ) ;
# ifdef TEXTURE _LOD _EXT
vec4 envMapColor = textureCubeLodEXT ( envMap , queryReflectVec , specularMIPLevel ) ;
# else
vec4 envMapColor = textureCube ( envMap , queryReflectVec , specularMIPLevel ) ;
# endif
envMapColor . rgb = envMapTexelToLinear ( envMapColor ) . rgb ;
# elif defined ( ENVMAP _TYPE _CUBE _UV )
vec4 envMapColor = textureCubeUV ( envMap , reflectVec , roughness ) ;
# endif
return envMapColor . rgb * envMapIntensity ;
}
# endif ` ,ep= ` ToonMaterial material ;
material . diffuseColor = diffuseColor . rgb ; ` ,tp= ` varying vec3 vViewPosition ;
# ifndef FLAT _SHADED
varying vec3 vNormal ;
# endif
struct ToonMaterial {
vec3 diffuseColor ;
} ;
void RE _Direct _Toon ( const in IncidentLight directLight , const in GeometricContext geometry , const in ToonMaterial material , inout ReflectedLight reflectedLight ) {
vec3 irradiance = getGradientIrradiance ( geometry . normal , directLight . direction ) * directLight . color ;
# ifndef PHYSICALLY _CORRECT _LIGHTS
irradiance *= PI ;
# endif
reflectedLight . directDiffuse += irradiance * BRDF _Diffuse _Lambert ( material . diffuseColor ) ;
}
void RE _IndirectDiffuse _Toon ( const in vec3 irradiance , const in GeometricContext geometry , const in ToonMaterial material , inout ReflectedLight reflectedLight ) {
reflectedLight . indirectDiffuse += irradiance * BRDF _Diffuse _Lambert ( material . diffuseColor ) ;
}
# define RE _Direct RE _Direct _Toon
# define RE _IndirectDiffuse RE _IndirectDiffuse _Toon
# define Material _LightProbeLOD ( material ) ( 0 ) ` ,np= ` BlinnPhongMaterial material ;
material . diffuseColor = diffuseColor . rgb ;
material . specularColor = specular ;
material . specularShininess = shininess ;
material . specularStrength = specularStrength ; ` ,ip= ` varying vec3 vViewPosition ;
# ifndef FLAT _SHADED
varying vec3 vNormal ;
# endif
struct BlinnPhongMaterial {
vec3 diffuseColor ;
vec3 specularColor ;
float specularShininess ;
float specularStrength ;
} ;
void RE _Direct _BlinnPhong ( const in IncidentLight directLight , const in GeometricContext geometry , const in BlinnPhongMaterial material , inout ReflectedLight reflectedLight ) {
float dotNL = saturate ( dot ( geometry . normal , directLight . direction ) ) ;
vec3 irradiance = dotNL * directLight . color ;
# ifndef PHYSICALLY _CORRECT _LIGHTS
irradiance *= PI ;
# endif
reflectedLight . directDiffuse += irradiance * BRDF _Diffuse _Lambert ( material . diffuseColor ) ;
reflectedLight . directSpecular += irradiance * BRDF _Specular _BlinnPhong ( directLight , geometry , material . specularColor , material . specularShininess ) * material . specularStrength ;
}
void RE _IndirectDiffuse _BlinnPhong ( const in vec3 irradiance , const in GeometricContext geometry , const in BlinnPhongMaterial material , inout ReflectedLight reflectedLight ) {
reflectedLight . indirectDiffuse += irradiance * BRDF _Diffuse _Lambert ( material . diffuseColor ) ;
}
# define RE _Direct RE _Direct _BlinnPhong
# define RE _IndirectDiffuse RE _IndirectDiffuse _BlinnPhong
# define Material _LightProbeLOD ( material ) ( 0 ) ` ,rp= ` PhysicalMaterial material ;
material . diffuseColor = diffuseColor . rgb * ( 1.0 - metalnessFactor ) ;
vec3 dxy = max ( abs ( dFdx ( geometryNormal ) ) , abs ( dFdy ( geometryNormal ) ) ) ;
float geometryRoughness = max ( max ( dxy . x , dxy . y ) , dxy . z ) ;
material . specularRoughness = max ( roughnessFactor , 0.0525 ) ; material . specularRoughness += geometryRoughness ;
material . specularRoughness = min ( material . specularRoughness , 1.0 ) ;
# ifdef REFLECTIVITY
material . specularColor = mix ( vec3 ( MAXIMUM _SPECULAR _COEFFICIENT * pow2 ( reflectivity ) ) , diffuseColor . rgb , metalnessFactor ) ;
# else
material . specularColor = mix ( vec3 ( DEFAULT _SPECULAR _COEFFICIENT ) , diffuseColor . rgb , metalnessFactor ) ;
# endif
# ifdef CLEARCOAT
material . clearcoat = clearcoat ;
material . clearcoatRoughness = clearcoatRoughness ;
# ifdef USE _CLEARCOATMAP
material . clearcoat *= texture2D ( clearcoatMap , vUv ) . x ;
# endif
# ifdef USE _CLEARCOAT _ROUGHNESSMAP
material . clearcoatRoughness *= texture2D ( clearcoatRoughnessMap , vUv ) . y ;
# endif
material . clearcoat = saturate ( material . clearcoat ) ; material . clearcoatRoughness = max ( material . clearcoatRoughness , 0.0525 ) ;
material . clearcoatRoughness += geometryRoughness ;
material . clearcoatRoughness = min ( material . clearcoatRoughness , 1.0 ) ;
# endif
# ifdef USE _SHEEN
material . sheenColor = sheen ;
# endif ` ,sp= ` struct PhysicalMaterial {
vec3 diffuseColor ;
float specularRoughness ;
vec3 specularColor ;
# ifdef CLEARCOAT
float clearcoat ;
float clearcoatRoughness ;
# endif
# ifdef USE _SHEEN
vec3 sheenColor ;
# endif
} ;
# define MAXIMUM _SPECULAR _COEFFICIENT 0.16
# define DEFAULT _SPECULAR _COEFFICIENT 0.04
float clearcoatDHRApprox ( const in float roughness , const in float dotNL ) {
return DEFAULT _SPECULAR _COEFFICIENT + ( 1.0 - DEFAULT _SPECULAR _COEFFICIENT ) * ( pow ( 1.0 - dotNL , 5.0 ) * pow ( 1.0 - roughness , 2.0 ) ) ;
}
# if NUM _RECT _AREA _LIGHTS > 0
void RE _Direct _RectArea _Physical ( const in RectAreaLight rectAreaLight , const in GeometricContext geometry , const in PhysicalMaterial material , inout ReflectedLight reflectedLight ) {
vec3 normal = geometry . normal ;
vec3 viewDir = geometry . viewDir ;
vec3 position = geometry . position ;
vec3 lightPos = rectAreaLight . position ;
vec3 halfWidth = rectAreaLight . halfWidth ;
vec3 halfHeight = rectAreaLight . halfHeight ;
vec3 lightColor = rectAreaLight . color ;
float roughness = material . specularRoughness ;
vec3 rectCoords [ 4 ] ;
rectCoords [ 0 ] = lightPos + halfWidth - halfHeight ; rectCoords [ 1 ] = lightPos - halfWidth - halfHeight ;
rectCoords [ 2 ] = lightPos - halfWidth + halfHeight ;
rectCoords [ 3 ] = lightPos + halfWidth + halfHeight ;
vec2 uv = LTC _Uv ( normal , viewDir , roughness ) ;
vec4 t1 = texture2D ( ltc _1 , uv ) ;
vec4 t2 = texture2D ( ltc _2 , uv ) ;
mat3 mInv = mat3 (
vec3 ( t1 . x , 0 , t1 . y ) ,
vec3 ( 0 , 1 , 0 ) ,
vec3 ( t1 . z , 0 , t1 . w )
) ;
vec3 fresnel = ( material . specularColor * t2 . x + ( vec3 ( 1.0 ) - material . specularColor ) * t2 . y ) ;
reflectedLight . directSpecular += lightColor * fresnel * LTC _Evaluate ( normal , viewDir , position , mInv , rectCoords ) ;
reflectedLight . directDiffuse += lightColor * material . diffuseColor * LTC _Evaluate ( normal , viewDir , position , mat3 ( 1.0 ) , rectCoords ) ;
}
# endif
void RE _Direct _Physical ( const in IncidentLight directLight , const in GeometricContext geometry , const in PhysicalMaterial material , inout ReflectedLight reflectedLight ) {
float dotNL = saturate ( dot ( geometry . normal , directLight . direction ) ) ;
vec3 irradiance = dotNL * directLight . color ;
# ifndef PHYSICALLY _CORRECT _LIGHTS
irradiance *= PI ;
# endif
# ifdef CLEARCOAT
float ccDotNL = saturate ( dot ( geometry . clearcoatNormal , directLight . direction ) ) ;
vec3 ccIrradiance = ccDotNL * directLight . color ;
# ifndef PHYSICALLY _CORRECT _LIGHTS
ccIrradiance *= PI ;
# endif
float clearcoatDHR = material . clearcoat * clearcoatDHRApprox ( material . clearcoatRoughness , ccDotNL ) ;
reflectedLight . directSpecular += ccIrradiance * material . clearcoat * BRDF _Specular _GGX ( directLight , geometry . viewDir , geometry . clearcoatNormal , vec3 ( DEFAULT _SPECULAR _COEFFICIENT ) , material . clearcoatRoughness ) ;
# else
float clearcoatDHR = 0.0 ;
# endif
# ifdef USE _SHEEN
reflectedLight . directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF _Specular _Sheen (
material . specularRoughness ,
directLight . direction ,
geometry ,
material . sheenColor
) ;
# else
reflectedLight . directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF _Specular _GGX ( directLight , geometry . viewDir , geometry . normal , material . specularColor , material . specularRoughness ) ;
# endif
reflectedLight . directDiffuse += ( 1.0 - clearcoatDHR ) * irradiance * BRDF _Diffuse _Lambert ( material . diffuseColor ) ;
}
void RE _IndirectDiffuse _Physical ( const in vec3 irradiance , const in GeometricContext geometry , const in PhysicalMaterial material , inout ReflectedLight reflectedLight ) {
reflectedLight . indirectDiffuse += irradiance * BRDF _Diffuse _Lambert ( material . diffuseColor ) ;
}
void RE _IndirectSpecular _Physical ( const in vec3 radiance , const in vec3 irradiance , const in vec3 clearcoatRadiance , const in GeometricContext geometry , const in PhysicalMaterial material , inout ReflectedLight reflectedLight ) {
# ifdef CLEARCOAT
float ccDotNV = saturate ( dot ( geometry . clearcoatNormal , geometry . viewDir ) ) ;
reflectedLight . indirectSpecular += clearcoatRadiance * material . clearcoat * BRDF _Specular _GGX _Environment ( geometry . viewDir , geometry . clearcoatNormal , vec3 ( DEFAULT _SPECULAR _COEFFICIENT ) , material . clearcoatRoughness ) ;
float ccDotNL = ccDotNV ;
float clearcoatDHR = material . clearcoat * clearcoatDHRApprox ( material . clearcoatRoughness , ccDotNL ) ;
# else
float clearcoatDHR = 0.0 ;
# endif
float clearcoatInv = 1.0 - clearcoatDHR ;
vec3 singleScattering = vec3 ( 0.0 ) ;
vec3 multiScattering = vec3 ( 0.0 ) ;
vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL _PI ;
BRDF _Specular _Multiscattering _Environment ( geometry , material . specularColor , material . specularRoughness , singleScattering , multiScattering ) ;
vec3 diffuse = material . diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) ) ;
reflectedLight . indirectSpecular += clearcoatInv * radiance * singleScattering ;
reflectedLight . indirectSpecular += multiScattering * cosineWeightedIrradiance ;
reflectedLight . indirectDiffuse += diffuse * cosineWeightedIrradiance ;
}
# define RE _Direct RE _Direct _Physical
# define RE _Direct _RectArea RE _Direct _RectArea _Physical
# define RE _IndirectDiffuse RE _IndirectDiffuse _Physical
# define RE _IndirectSpecular RE _IndirectSpecular _Physical
float computeSpecularOcclusion ( const in float dotNV , const in float ambientOcclusion , const in float roughness ) {
return saturate ( pow ( dotNV + ambientOcclusion , exp2 ( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion ) ;
} ` ,op= `
GeometricContext geometry ;
geometry . position = - vViewPosition ;
geometry . normal = normal ;
geometry . viewDir = ( isOrthographic ) ? vec3 ( 0 , 0 , 1 ) : normalize ( vViewPosition ) ;
# ifdef CLEARCOAT
geometry . clearcoatNormal = clearcoatNormal ;
# endif
IncidentLight directLight ;
# if ( NUM _POINT _LIGHTS > 0 ) && defined ( RE _Direct )
PointLight pointLight ;
# if defined ( USE _SHADOWMAP ) && NUM _POINT _LIGHT _SHADOWS > 0
PointLightShadow pointLightShadow ;
# endif
# pragma unroll _loop _start
for ( int i = 0 ; i < NUM _POINT _LIGHTS ; i ++ ) {
pointLight = pointLights [ i ] ;
getPointDirectLightIrradiance ( pointLight , geometry , directLight ) ;
# if defined ( USE _SHADOWMAP ) && ( UNROLLED _LOOP _INDEX < NUM _POINT _LIGHT _SHADOWS )
pointLightShadow = pointLightShadows [ i ] ;
directLight . color *= all ( bvec2 ( directLight . visible , receiveShadow ) ) ? getPointShadow ( pointShadowMap [ i ] , pointLightShadow . shadowMapSize , pointLightShadow . shadowBias , pointLightShadow . shadowRadius , vPointShadowCoord [ i ] , pointLightShadow . shadowCameraNear , pointLightShadow . shadowCameraFar ) : 1.0 ;
# endif
RE _Direct ( directLight , geometry , material , reflectedLight ) ;
}
# pragma unroll _loop _end
# endif
# if ( NUM _SPOT _LIGHTS > 0 ) && defined ( RE _Direct )
SpotLight spotLight ;
# if defined ( USE _SHADOWMAP ) && NUM _SPOT _LIGHT _SHADOWS > 0
SpotLightShadow spotLightShadow ;
# endif
# pragma unroll _loop _start
for ( int i = 0 ; i < NUM _SPOT _LIGHTS ; i ++ ) {
spotLight = spotLights [ i ] ;
getSpotDirectLightIrradiance ( spotLight , geometry , directLight ) ;
# if defined ( USE _SHADOWMAP ) && ( UNROLLED _LOOP _INDEX < NUM _SPOT _LIGHT _SHADOWS )
spotLightShadow = spotLightShadows [ i ] ;
directLight . color *= all ( bvec2 ( directLight . visible , receiveShadow ) ) ? getShadow ( spotShadowMap [ i ] , spotLightShadow . shadowMapSize , spotLightShadow . shadowBias , spotLightShadow . shadowRadius , vSpotShadowCoord [ i ] ) : 1.0 ;
# endif
RE _Direct ( directLight , geometry , material , reflectedLight ) ;
}
# pragma unroll _loop _end
# endif
# if ( NUM _DIR _LIGHTS > 0 ) && defined ( RE _Direct )
DirectionalLight directionalLight ;
# if defined ( USE _SHADOWMAP ) && NUM _DIR _LIGHT _SHADOWS > 0
DirectionalLightShadow directionalLightShadow ;
# endif
# pragma unroll _loop _start
for ( int i = 0 ; i < NUM _DIR _LIGHTS ; i ++ ) {
directionalLight = directionalLights [ i ] ;
getDirectionalDirectLightIrradiance ( directionalLight , geometry , directLight ) ;
# if defined ( USE _SHADOWMAP ) && ( UNROLLED _LOOP _INDEX < NUM _DIR _LIGHT _SHADOWS )
directionalLightShadow = directionalLightShadows [ i ] ;
directLight . color *= all ( bvec2 ( directLight . visible , receiveShadow ) ) ? getShadow ( directionalShadowMap [ i ] , directionalLightShadow . shadowMapSize , directionalLightShadow . shadowBias , directionalLightShadow . shadowRadius , vDirectionalShadowCoord [ i ] ) : 1.0 ;
# endif
RE _Direct ( directLight , geometry , material , reflectedLight ) ;
}
# pragma unroll _loop _end
# endif
# if ( NUM _RECT _AREA _LIGHTS > 0 ) && defined ( RE _Direct _RectArea )
RectAreaLight rectAreaLight ;
# pragma unroll _loop _start
for ( int i = 0 ; i < NUM _RECT _AREA _LIGHTS ; i ++ ) {
rectAreaLight = rectAreaLights [ i ] ;
RE _Direct _RectArea ( rectAreaLight , geometry , material , reflectedLight ) ;
}
# pragma unroll _loop _end
# endif
# if defined ( RE _IndirectDiffuse )
vec3 iblIrradiance = vec3 ( 0.0 ) ;
vec3 irradiance = getAmbientLightIrradiance ( ambientLightColor ) ;
irradiance += getLightProbeIrradiance ( lightProbe , geometry ) ;
# if ( NUM _HEMI _LIGHTS > 0 )
# pragma unroll _loop _start
for ( int i = 0 ; i < NUM _HEMI _LIGHTS ; i ++ ) {
irradiance += getHemisphereLightIrradiance ( hemisphereLights [ i ] , geometry ) ;
}
# pragma unroll _loop _end
# endif
# endif
# if defined ( RE _IndirectSpecular )
vec3 radiance = vec3 ( 0.0 ) ;
vec3 clearcoatRadiance = vec3 ( 0.0 ) ;
# endif ` ,ap= ` # if defined ( RE _IndirectDiffuse )
# ifdef USE _LIGHTMAP
vec4 lightMapTexel = texture2D ( lightMap , vUv2 ) ;
vec3 lightMapIrradiance = lightMapTexelToLinear ( lightMapTexel ) . rgb * lightMapIntensity ;
# ifndef PHYSICALLY _CORRECT _LIGHTS
lightMapIrradiance *= PI ;
# endif
irradiance += lightMapIrradiance ;
# endif
# if defined ( USE _ENVMAP ) && defined ( STANDARD ) && defined ( ENVMAP _TYPE _CUBE _UV )
iblIrradiance += getLightProbeIndirectIrradiance ( geometry , maxMipLevel ) ;
# endif
# endif
# if defined ( USE _ENVMAP ) && defined ( RE _IndirectSpecular )
radiance += getLightProbeIndirectRadiance ( geometry . viewDir , geometry . normal , material . specularRoughness , maxMipLevel ) ;
# ifdef CLEARCOAT
clearcoatRadiance += getLightProbeIndirectRadiance ( geometry . viewDir , geometry . clearcoatNormal , material . clearcoatRoughness , maxMipLevel ) ;
# endif
# endif ` ,lp= ` # if defined ( RE _IndirectDiffuse )
RE _IndirectDiffuse ( irradiance , geometry , material , reflectedLight ) ;
# endif
# if defined ( RE _IndirectSpecular )
RE _IndirectSpecular ( radiance , iblIrradiance , clearcoatRadiance , geometry , material , reflectedLight ) ;
# endif ` ,cp= ` # if defined ( USE _LOGDEPTHBUF ) && defined ( USE _LOGDEPTHBUF _EXT )
gl _FragDepthEXT = vIsPerspective == 0.0 ? gl _FragCoord . z : log2 ( vFragDepth ) * logDepthBufFC * 0.5 ;
# endif ` ,hp= ` # if defined ( USE _LOGDEPTHBUF ) && defined ( USE _LOGDEPTHBUF _EXT )
uniform float logDepthBufFC ;
varying float vFragDepth ;
varying float vIsPerspective ;
# endif ` ,up= ` # ifdef USE _LOGDEPTHBUF
# ifdef USE _LOGDEPTHBUF _EXT
varying float vFragDepth ;
varying float vIsPerspective ;
# else
uniform float logDepthBufFC ;
# endif
# endif ` ,dp= ` # ifdef USE _LOGDEPTHBUF
# ifdef USE _LOGDEPTHBUF _EXT
vFragDepth = 1.0 + gl _Position . w ;
vIsPerspective = float ( isPerspectiveMatrix ( projectionMatrix ) ) ;
# else
if ( isPerspectiveMatrix ( projectionMatrix ) ) {
gl _Position . z = log2 ( max ( EPSILON , gl _Position . w + 1.0 ) ) * logDepthBufFC - 1.0 ;
gl _Position . z *= gl _Position . w ;
}
# endif
# endif ` ,fp= ` # ifdef USE _MAP
vec4 texelColor = texture2D ( map , vUv ) ;
texelColor = mapTexelToLinear ( texelColor ) ;
diffuseColor *= texelColor ;
# endif ` ,pp= ` # ifdef USE _MAP
uniform sampler2D map ;
# endif ` ,mp= ` # if defined ( USE _MAP ) || defined ( USE _ALPHAMAP )
vec2 uv = ( uvTransform * vec3 ( gl _PointCoord . x , 1.0 - gl _PointCoord . y , 1 ) ) . xy ;
# endif
# ifdef USE _MAP
vec4 mapTexel = texture2D ( map , uv ) ;
diffuseColor *= mapTexelToLinear ( mapTexel ) ;
# endif
# ifdef USE _ALPHAMAP
diffuseColor . a *= texture2D ( alphaMap , uv ) . g ;
# endif ` ,gp= ` # if defined ( USE _MAP ) || defined ( USE _ALPHAMAP )
uniform mat3 uvTransform ;
# endif
# ifdef USE _MAP
uniform sampler2D map ;
# endif
# ifdef USE _ALPHAMAP
uniform sampler2D alphaMap ;
# endif ` ,xp= ` float metalnessFactor = metalness ;
# ifdef USE _METALNESSMAP
vec4 texelMetalness = texture2D ( metalnessMap , vUv ) ;
metalnessFactor *= texelMetalness . b ;
# endif ` ,yp= ` # ifdef USE _METALNESSMAP
uniform sampler2D metalnessMap ;
# endif ` ,vp= ` # ifdef USE _MORPHNORMALS
objectNormal *= morphTargetBaseInfluence ;
objectNormal += morphNormal0 * morphTargetInfluences [ 0 ] ;
objectNormal += morphNormal1 * morphTargetInfluences [ 1 ] ;
objectNormal += morphNormal2 * morphTargetInfluences [ 2 ] ;
objectNormal += morphNormal3 * morphTargetInfluences [ 3 ] ;
# endif ` ,_p= ` # ifdef USE _MORPHTARGETS
uniform float morphTargetBaseInfluence ;
# ifndef USE _MORPHNORMALS
uniform float morphTargetInfluences [ 8 ] ;
# else
uniform float morphTargetInfluences [ 4 ] ;
# endif
# endif ` ,wp= ` # ifdef USE _MORPHTARGETS
transformed *= morphTargetBaseInfluence ;
transformed += morphTarget0 * morphTargetInfluences [ 0 ] ;
transformed += morphTarget1 * morphTargetInfluences [ 1 ] ;
transformed += morphTarget2 * morphTargetInfluences [ 2 ] ;
transformed += morphTarget3 * morphTargetInfluences [ 3 ] ;
# ifndef USE _MORPHNORMALS
transformed += morphTarget4 * morphTargetInfluences [ 4 ] ;
transformed += morphTarget5 * morphTargetInfluences [ 5 ] ;
transformed += morphTarget6 * morphTargetInfluences [ 6 ] ;
transformed += morphTarget7 * morphTargetInfluences [ 7 ] ;
# endif
# endif ` ,bp= ` float faceDirection = gl _FrontFacing ? 1.0 : - 1.0 ;
# ifdef FLAT _SHADED
vec3 fdx = vec3 ( dFdx ( vViewPosition . x ) , dFdx ( vViewPosition . y ) , dFdx ( vViewPosition . z ) ) ;
vec3 fdy = vec3 ( dFdy ( vViewPosition . x ) , dFdy ( vViewPosition . y ) , dFdy ( vViewPosition . z ) ) ;
vec3 normal = normalize ( cross ( fdx , fdy ) ) ;
# else
vec3 normal = normalize ( vNormal ) ;
# ifdef DOUBLE _SIDED
normal = normal * faceDirection ;
# endif
# ifdef USE _TANGENT
vec3 tangent = normalize ( vTangent ) ;
vec3 bitangent = normalize ( vBitangent ) ;
# ifdef DOUBLE _SIDED
tangent = tangent * faceDirection ;
bitangent = bitangent * faceDirection ;
# endif
# if defined ( TANGENTSPACE _NORMALMAP ) || defined ( USE _CLEARCOAT _NORMALMAP )
mat3 vTBN = mat3 ( tangent , bitangent , normal ) ;
# endif
# endif
# endif
vec3 geometryNormal = normal ; ` ,Mp= ` # ifdef OBJECTSPACE _NORMALMAP
normal = texture2D ( normalMap , vUv ) . xyz * 2.0 - 1.0 ;
# ifdef FLIP _SIDED
normal = - normal ;
# endif
# ifdef DOUBLE _SIDED
normal = normal * faceDirection ;
# endif
normal = normalize ( normalMatrix * normal ) ;
# elif defined ( TANGENTSPACE _NORMALMAP )
vec3 mapN = texture2D ( normalMap , vUv ) . xyz * 2.0 - 1.0 ;
mapN . xy *= normalScale ;
# ifdef USE _TANGENT
normal = normalize ( vTBN * mapN ) ;
# else
normal = perturbNormal2Arb ( - vViewPosition , normal , mapN , faceDirection ) ;
# endif
# elif defined ( USE _BUMPMAP )
normal = perturbNormalArb ( - vViewPosition , normal , dHdxy _fwd ( ) , faceDirection ) ;
# endif ` ,Sp= ` # ifdef USE _NORMALMAP
uniform sampler2D normalMap ;
uniform vec2 normalScale ;
# endif
# ifdef OBJECTSPACE _NORMALMAP
uniform mat3 normalMatrix ;
# endif
# if ! defined ( USE _TANGENT ) && ( defined ( TANGENTSPACE _NORMALMAP ) || defined ( USE _CLEARCOAT _NORMALMAP ) )
vec3 perturbNormal2Arb ( vec3 eye _pos , vec3 surf _norm , vec3 mapN , float faceDirection ) {
vec3 q0 = vec3 ( dFdx ( eye _pos . x ) , dFdx ( eye _pos . y ) , dFdx ( eye _pos . z ) ) ;
vec3 q1 = vec3 ( dFdy ( eye _pos . x ) , dFdy ( eye _pos . y ) , dFdy ( eye _pos . z ) ) ;
vec2 st0 = dFdx ( vUv . st ) ;
vec2 st1 = dFdy ( vUv . st ) ;
vec3 N = surf _norm ;
vec3 q1perp = cross ( q1 , N ) ;
vec3 q0perp = cross ( N , q0 ) ;
vec3 T = q1perp * st0 . x + q0perp * st1 . x ;
vec3 B = q1perp * st0 . y + q0perp * st1 . y ;
float det = max ( dot ( T , T ) , dot ( B , B ) ) ;
float scale = ( det == 0.0 ) ? 0.0 : faceDirection * inversesqrt ( det ) ;
return normalize ( T * ( mapN . x * scale ) + B * ( mapN . y * scale ) + N * mapN . z ) ;
}
# endif ` ,Tp= ` # ifdef CLEARCOAT
vec3 clearcoatNormal = geometryNormal ;
# endif ` ,Ep= ` # ifdef USE _CLEARCOAT _NORMALMAP
vec3 clearcoatMapN = texture2D ( clearcoatNormalMap , vUv ) . xyz * 2.0 - 1.0 ;
clearcoatMapN . xy *= clearcoatNormalScale ;
# ifdef USE _TANGENT
clearcoatNormal = normalize ( vTBN * clearcoatMapN ) ;
# else
clearcoatNormal = perturbNormal2Arb ( - vViewPosition , clearcoatNormal , clearcoatMapN , faceDirection ) ;
# endif
# endif ` ,Ap= ` # ifdef USE _CLEARCOATMAP
uniform sampler2D clearcoatMap ;
# endif
# ifdef USE _CLEARCOAT _ROUGHNESSMAP
uniform sampler2D clearcoatRoughnessMap ;
# endif
# ifdef USE _CLEARCOAT _NORMALMAP
uniform sampler2D clearcoatNormalMap ;
uniform vec2 clearcoatNormalScale ;
# endif ` ,Lp= ` vec3 packNormalToRGB ( const in vec3 normal ) {
return normalize ( normal ) * 0.5 + 0.5 ;
}
vec3 unpackRGBToNormal ( const in vec3 rgb ) {
return 2.0 * rgb . xyz - 1.0 ;
}
const float PackUpscale = 256. / 255. ; const float UnpackDownscale = 255. / 256. ;
const vec3 PackFactors = vec3 ( 256. * 256. * 256. , 256. * 256. , 256. ) ;
const vec4 UnpackFactors = UnpackDownscale / vec4 ( PackFactors , 1. ) ;
const float ShiftRight8 = 1. / 256. ;
vec4 packDepthToRGBA ( const in float v ) {
vec4 r = vec4 ( fract ( v * PackFactors ) , v ) ;
r . yzw -= r . xyz * ShiftRight8 ; return r * PackUpscale ;
}
float unpackRGBAToDepth ( const in vec4 v ) {
return dot ( v , UnpackFactors ) ;
}
vec4 pack2HalfToRGBA ( vec2 v ) {
vec4 r = vec4 ( v . x , fract ( v . x * 255.0 ) , v . y , fract ( v . y * 255.0 ) ) ;
return vec4 ( r . x - r . y / 255.0 , r . y , r . z - r . w / 255.0 , r . w ) ;
}
vec2 unpackRGBATo2Half ( vec4 v ) {
return vec2 ( v . x + ( v . y / 255.0 ) , v . z + ( v . w / 255.0 ) ) ;
}
float viewZToOrthographicDepth ( const in float viewZ , const in float near , const in float far ) {
return ( viewZ + near ) / ( near - far ) ;
}
float orthographicDepthToViewZ ( const in float linearClipZ , const in float near , const in float far ) {
return linearClipZ * ( near - far ) - near ;
}
float viewZToPerspectiveDepth ( const in float viewZ , const in float near , const in float far ) {
return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ ) ;
}
float perspectiveDepthToViewZ ( const in float invClipZ , const in float near , const in float far ) {
return ( near * far ) / ( ( far - near ) * invClipZ - far ) ;
} ` ,Rp= ` # ifdef PREMULTIPLIED _ALPHA
gl _FragColor . rgb *= gl _FragColor . a ;
# endif ` ,Cp= ` vec4 mvPosition = vec4 ( transformed , 1.0 ) ;
# ifdef USE _INSTANCING
mvPosition = instanceMatrix * mvPosition ;
# endif
mvPosition = modelViewMatrix * mvPosition ;
gl _Position = projectionMatrix * mvPosition ; ` ,Pp= ` # ifdef DITHERING
gl _FragColor . rgb = dithering ( gl _FragColor . rgb ) ;
# endif ` ,Ip= ` # ifdef DITHERING
vec3 dithering ( vec3 color ) {
float grid _position = rand ( gl _FragCoord . xy ) ;
vec3 dither _shift _RGB = vec3 ( 0.25 / 255.0 , - 0.25 / 255.0 , 0.25 / 255.0 ) ;
dither _shift _RGB = mix ( 2.0 * dither _shift _RGB , - 2.0 * dither _shift _RGB , grid _position ) ;
return color + dither _shift _RGB ;
}
# endif ` ,Dp= ` float roughnessFactor = roughness ;
# ifdef USE _ROUGHNESSMAP
vec4 texelRoughness = texture2D ( roughnessMap , vUv ) ;
roughnessFactor *= texelRoughness . g ;
# endif ` ,Fp= ` # ifdef USE _ROUGHNESSMAP
uniform sampler2D roughnessMap ;
# endif ` ,Np= ` # ifdef USE _SHADOWMAP
# if NUM _DIR _LIGHT _SHADOWS > 0
uniform sampler2D directionalShadowMap [ NUM _DIR _LIGHT _SHADOWS ] ;
varying vec4 vDirectionalShadowCoord [ NUM _DIR _LIGHT _SHADOWS ] ;
struct DirectionalLightShadow {
float shadowBias ;
float shadowNormalBias ;
float shadowRadius ;
vec2 shadowMapSize ;
} ;
uniform DirectionalLightShadow directionalLightShadows [ NUM _DIR _LIGHT _SHADOWS ] ;
# endif
# if NUM _SPOT _LIGHT _SHADOWS > 0
uniform sampler2D spotShadowMap [ NUM _SPOT _LIGHT _SHADOWS ] ;
varying vec4 vSpotShadowCoord [ NUM _SPOT _LIGHT _SHADOWS ] ;
struct SpotLightShadow {
float shadowBias ;
float shadowNormalBias ;
float shadowRadius ;
vec2 shadowMapSize ;
} ;
uniform SpotLightShadow spotLightShadows [ NUM _SPOT _LIGHT _SHADOWS ] ;
# endif
# if NUM _POINT _LIGHT _SHADOWS > 0
uniform sampler2D pointShadowMap [ NUM _POINT _LIGHT _SHADOWS ] ;
varying vec4 vPointShadowCoord [ NUM _POINT _LIGHT _SHADOWS ] ;
struct PointLightShadow {
float shadowBias ;
float shadowNormalBias ;
float shadowRadius ;
vec2 shadowMapSize ;
float shadowCameraNear ;
float shadowCameraFar ;
} ;
uniform PointLightShadow pointLightShadows [ NUM _POINT _LIGHT _SHADOWS ] ;
# endif
float texture2DCompare ( sampler2D depths , vec2 uv , float compare ) {
return step ( compare , unpackRGBAToDepth ( texture2D ( depths , uv ) ) ) ;
}
vec2 texture2DDistribution ( sampler2D shadow , vec2 uv ) {
return unpackRGBATo2Half ( texture2D ( shadow , uv ) ) ;
}
float VSMShadow ( sampler2D shadow , vec2 uv , float compare ) {
float occlusion = 1.0 ;
vec2 distribution = texture2DDistribution ( shadow , uv ) ;
float hard _shadow = step ( compare , distribution . x ) ;
if ( hard _shadow != 1.0 ) {
float distance = compare - distribution . x ;
float variance = max ( 0.00000 , distribution . y * distribution . y ) ;
float softness _probability = variance / ( variance + distance * distance ) ; softness _probability = clamp ( ( softness _probability - 0.3 ) / ( 0.95 - 0.3 ) , 0.0 , 1.0 ) ; occlusion = clamp ( max ( hard _shadow , softness _probability ) , 0.0 , 1.0 ) ;
}
return occlusion ;
}
float getShadow ( sampler2D shadowMap , vec2 shadowMapSize , float shadowBias , float shadowRadius , vec4 shadowCoord ) {
float shadow = 1.0 ;
shadowCoord . xyz /= shadowCoord . w ;
shadowCoord . z += shadowBias ;
bvec4 inFrustumVec = bvec4 ( shadowCoord . x >= 0.0 , shadowCoord . x <= 1.0 , shadowCoord . y >= 0.0 , shadowCoord . y <= 1.0 ) ;
bool inFrustum = all ( inFrustumVec ) ;
bvec2 frustumTestVec = bvec2 ( inFrustum , shadowCoord . z <= 1.0 ) ;
bool frustumTest = all ( frustumTestVec ) ;
if ( frustumTest ) {
# if defined ( SHADOWMAP _TYPE _PCF )
vec2 texelSize = vec2 ( 1.0 ) / shadowMapSize ;
float dx0 = - texelSize . x * shadowRadius ;
float dy0 = - texelSize . y * shadowRadius ;
float dx1 = + texelSize . x * shadowRadius ;
float dy1 = + texelSize . y * shadowRadius ;
float dx2 = dx0 / 2.0 ;
float dy2 = dy0 / 2.0 ;
float dx3 = dx1 / 2.0 ;
float dy3 = dy1 / 2.0 ;
shadow = (
texture2DCompare ( shadowMap , shadowCoord . xy + vec2 ( dx0 , dy0 ) , shadowCoord . z ) +
texture2DCompare ( shadowMap , shadowCoord . xy + vec2 ( 0.0 , dy0 ) , shadowCoord . z ) +
texture2DCompare ( shadowMap , shadowCoord . xy + vec2 ( dx1 , dy0 ) , shadowCoord . z ) +
texture2DCompare ( shadowMap , shadowCoord . xy + vec2 ( dx2 , dy2 ) , shadowCoord . z ) +
texture2DCompare ( shadowMap , shadowCoord . xy + vec2 ( 0.0 , dy2 ) , shadowCoord . z ) +
texture2DCompare ( shadowMap , shadowCoord . xy + vec2 ( dx3 , dy2 ) , shadowCoord . z ) +
texture2DCompare ( shadowMap , shadowCoord . xy + vec2 ( dx0 , 0.0 ) , shadowCoord . z ) +
texture2DCompare ( shadowMap , shadowCoord . xy + vec2 ( dx2 , 0.0 ) , shadowCoord . z ) +
texture2DCompare ( shadowMap , shadowCoord . xy , shadowCoord . z ) +
texture2DCompare ( shadowMap , shadowCoord . xy + vec2 ( dx3 , 0.0 ) , shadowCoord . z ) +
texture2DCompare ( shadowMap , shadowCoord . xy + vec2 ( dx1 , 0.0 ) , shadowCoord . z ) +
texture2DCompare ( shadowMap , shadowCoord . xy + vec2 ( dx2 , dy3 ) , shadowCoord . z ) +
texture2DCompare ( shadowMap , shadowCoord . xy + vec2 ( 0.0 , dy3 ) , shadowCoord . z ) +
texture2DCompare ( shadowMap , shadowCoord . xy + vec2 ( dx3 , dy3 ) , shadowCoord . z ) +
texture2DCompare ( shadowMap , shadowCoord . xy + vec2 ( dx0 , dy1 ) , shadowCoord . z ) +
texture2DCompare ( shadowMap , shadowCoord . xy + vec2 ( 0.0 , dy1 ) , shadowCoord . z ) +
texture2DCompare ( shadowMap , shadowCoord . xy + vec2 ( dx1 , dy1 ) , shadowCoord . z )
) * ( 1.0 / 17.0 ) ;
# elif defined ( SHADOWMAP _TYPE _PCF _SOFT )
vec2 texelSize = vec2 ( 1.0 ) / shadowMapSize ;
float dx = texelSize . x ;
float dy = texelSize . y ;
vec2 uv = shadowCoord . xy ;
vec2 f = fract ( uv * shadowMapSize + 0.5 ) ;
uv -= f * texelSize ;
shadow = (
texture2DCompare ( shadowMap , uv , shadowCoord . z ) +
texture2DCompare ( shadowMap , uv + vec2 ( dx , 0.0 ) , shadowCoord . z ) +
texture2DCompare ( shadowMap , uv + vec2 ( 0.0 , dy ) , shadowCoord . z ) +
texture2DCompare ( shadowMap , uv + texelSize , shadowCoord . z ) +
mix ( texture2DCompare ( shadowMap , uv + vec2 ( - dx , 0.0 ) , shadowCoord . z ) ,
texture2DCompare ( shadowMap , uv + vec2 ( 2.0 * dx , 0.0 ) , shadowCoord . z ) ,
f . x ) +
mix ( texture2DCompare ( shadowMap , uv + vec2 ( - dx , dy ) , shadowCoord . z ) ,
texture2DCompare ( shadowMap , uv + vec2 ( 2.0 * dx , dy ) , shadowCoord . z ) ,
f . x ) +
mix ( texture2DCompare ( shadowMap , uv + vec2 ( 0.0 , - dy ) , shadowCoord . z ) ,
texture2DCompare ( shadowMap , uv + vec2 ( 0.0 , 2.0 * dy ) , shadowCoord . z ) ,
f . y ) +
mix ( texture2DCompare ( shadowMap , uv + vec2 ( dx , - dy ) , shadowCoord . z ) ,
texture2DCompare ( shadowMap , uv + vec2 ( dx , 2.0 * dy ) , shadowCoord . z ) ,
f . y ) +
mix ( mix ( texture2DCompare ( shadowMap , uv + vec2 ( - dx , - dy ) , shadowCoord . z ) ,
texture2DCompare ( shadowMap , uv + vec2 ( 2.0 * dx , - dy ) , shadowCoord . z ) ,
f . x ) ,
mix ( texture2DCompare ( shadowMap , uv + vec2 ( - dx , 2.0 * dy ) , shadowCoord . z ) ,
texture2DCompare ( shadowMap , uv + vec2 ( 2.0 * dx , 2.0 * dy ) , shadowCoord . z ) ,
f . x ) ,
f . y )
) * ( 1.0 / 9.0 ) ;
# elif defined ( SHADOWMAP _TYPE _VSM )
shadow = VSMShadow ( shadowMap , shadowCoord . xy , shadowCoord . z ) ;
# else
shadow = texture2DCompare ( shadowMap , shadowCoord . xy , shadowCoord . z ) ;
# endif
}
return shadow ;
}
vec2 cubeToUV ( vec3 v , float texelSizeY ) {
vec3 absV = abs ( v ) ;
float scaleToCube = 1.0 / max ( absV . x , max ( absV . y , absV . z ) ) ;
absV *= scaleToCube ;
v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY ) ;
vec2 planar = v . xy ;
float almostATexel = 1.5 * texelSizeY ;
float almostOne = 1.0 - almostATexel ;
if ( absV . z >= almostOne ) {
if ( v . z > 0.0 )
planar . x = 4.0 - v . x ;
} else if ( absV . x >= almostOne ) {
float signX = sign ( v . x ) ;
planar . x = v . z * signX + 2.0 * signX ;
} else if ( absV . y >= almostOne ) {
float signY = sign ( v . y ) ;
planar . x = v . x + 2.0 * signY + 2.0 ;
planar . y = v . z * signY - 2.0 ;
}
return vec2 ( 0.125 , 0.25 ) * planar + vec2 ( 0.375 , 0.75 ) ;
}
float getPointShadow ( sampler2D shadowMap , vec2 shadowMapSize , float shadowBias , float shadowRadius , vec4 shadowCoord , float shadowCameraNear , float shadowCameraFar ) {
vec2 texelSize = vec2 ( 1.0 ) / ( shadowMapSize * vec2 ( 4.0 , 2.0 ) ) ;
vec3 lightToPosition = shadowCoord . xyz ;
float dp = ( length ( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ) ; dp += shadowBias ;
vec3 bd3D = normalize ( lightToPosition ) ;
# if defined ( SHADOWMAP _TYPE _PCF ) || defined ( SHADOWMAP _TYPE _PCF _SOFT ) || defined ( SHADOWMAP _TYPE _VSM )
vec2 offset = vec2 ( - 1 , 1 ) * shadowRadius * texelSize . y ;
return (
texture2DCompare ( shadowMap , cubeToUV ( bd3D + offset . xyy , texelSize . y ) , dp ) +
texture2DCompare ( shadowMap , cubeToUV ( bd3D + offset . yyy , texelSize . y ) , dp ) +
texture2DCompare ( shadowMap , cubeToUV ( bd3D + offset . xyx , texelSize . y ) , dp ) +
texture2DCompare ( shadowMap , cubeToUV ( bd3D + offset . yyx , texelSize . y ) , dp ) +
texture2DCompare ( shadowMap , cubeToUV ( bd3D , texelSize . y ) , dp ) +
texture2DCompare ( shadowMap , cubeToUV ( bd3D + offset . xxy , texelSize . y ) , dp ) +
texture2DCompare ( shadowMap , cubeToUV ( bd3D + offset . yxy , texelSize . y ) , dp ) +
texture2DCompare ( shadowMap , cubeToUV ( bd3D + offset . xxx , texelSize . y ) , dp ) +
texture2DCompare ( shadowMap , cubeToUV ( bd3D + offset . yxx , texelSize . y ) , dp )
) * ( 1.0 / 9.0 ) ;
# else
return texture2DCompare ( shadowMap , cubeToUV ( bd3D , texelSize . y ) , dp ) ;
# endif
}
# endif ` ,Bp= ` # ifdef USE _SHADOWMAP
# if NUM _DIR _LIGHT _SHADOWS > 0
uniform mat4 directionalShadowMatrix [ NUM _DIR _LIGHT _SHADOWS ] ;
varying vec4 vDirectionalShadowCoord [ NUM _DIR _LIGHT _SHADOWS ] ;
struct DirectionalLightShadow {
float shadowBias ;
float shadowNormalBias ;
float shadowRadius ;
vec2 shadowMapSize ;
} ;
uniform DirectionalLightShadow directionalLightShadows [ NUM _DIR _LIGHT _SHADOWS ] ;
# endif
# if NUM _SPOT _LIGHT _SHADOWS > 0
uniform mat4 spotShadowMatrix [ NUM _SPOT _LIGHT _SHADOWS ] ;
varying vec4 vSpotShadowCoord [ NUM _SPOT _LIGHT _SHADOWS ] ;
struct SpotLightShadow {
float shadowBias ;
float shadowNormalBias ;
float shadowRadius ;
vec2 shadowMapSize ;
} ;
uniform SpotLightShadow spotLightShadows [ NUM _SPOT _LIGHT _SHADOWS ] ;
# endif
# if NUM _POINT _LIGHT _SHADOWS > 0
uniform mat4 pointShadowMatrix [ NUM _POINT _LIGHT _SHADOWS ] ;
varying vec4 vPointShadowCoord [ NUM _POINT _LIGHT _SHADOWS ] ;
struct PointLightShadow {
float shadowBias ;
float shadowNormalBias ;
float shadowRadius ;
vec2 shadowMapSize ;
float shadowCameraNear ;
float shadowCameraFar ;
} ;
uniform PointLightShadow pointLightShadows [ NUM _POINT _LIGHT _SHADOWS ] ;
# endif
# endif ` ,zp= ` # ifdef USE _SHADOWMAP
# if NUM _DIR _LIGHT _SHADOWS > 0 || NUM _SPOT _LIGHT _SHADOWS > 0 || NUM _POINT _LIGHT _SHADOWS > 0
vec3 shadowWorldNormal = inverseTransformDirection ( transformedNormal , viewMatrix ) ;
vec4 shadowWorldPosition ;
# endif
# if NUM _DIR _LIGHT _SHADOWS > 0
# pragma unroll _loop _start
for ( int i = 0 ; i < NUM _DIR _LIGHT _SHADOWS ; i ++ ) {
shadowWorldPosition = worldPosition + vec4 ( shadowWorldNormal * directionalLightShadows [ i ] . shadowNormalBias , 0 ) ;
vDirectionalShadowCoord [ i ] = directionalShadowMatrix [ i ] * shadowWorldPosition ;
}
# pragma unroll _loop _end
# endif
# if NUM _SPOT _LIGHT _SHADOWS > 0
# pragma unroll _loop _start
for ( int i = 0 ; i < NUM _SPOT _LIGHT _SHADOWS ; i ++ ) {
shadowWorldPosition = worldPosition + vec4 ( shadowWorldNormal * spotLightShadows [ i ] . shadowNormalBias , 0 ) ;
vSpotShadowCoord [ i ] = spotShadowMatrix [ i ] * shadowWorldPosition ;
}
# pragma unroll _loop _end
# endif
# if NUM _POINT _LIGHT _SHADOWS > 0
# pragma unroll _loop _start
for ( int i = 0 ; i < NUM _POINT _LIGHT _SHADOWS ; i ++ ) {
shadowWorldPosition = worldPosition + vec4 ( shadowWorldNormal * pointLightShadows [ i ] . shadowNormalBias , 0 ) ;
vPointShadowCoord [ i ] = pointShadowMatrix [ i ] * shadowWorldPosition ;
}
# pragma unroll _loop _end
# endif
# endif ` ,Op= ` float getShadowMask ( ) {
float shadow = 1.0 ;
# ifdef USE _SHADOWMAP
# if NUM _DIR _LIGHT _SHADOWS > 0
DirectionalLightShadow directionalLight ;
# pragma unroll _loop _start
for ( int i = 0 ; i < NUM _DIR _LIGHT _SHADOWS ; i ++ ) {
directionalLight = directionalLightShadows [ i ] ;
shadow *= receiveShadow ? getShadow ( directionalShadowMap [ i ] , directionalLight . shadowMapSize , directionalLight . shadowBias , directionalLight . shadowRadius , vDirectionalShadowCoord [ i ] ) : 1.0 ;
}
# pragma unroll _loop _end
# endif
# if NUM _SPOT _LIGHT _SHADOWS > 0
SpotLightShadow spotLight ;
# pragma unroll _loop _start
for ( int i = 0 ; i < NUM _SPOT _LIGHT _SHADOWS ; i ++ ) {
spotLight = spotLightShadows [ i ] ;
shadow *= receiveShadow ? getShadow ( spotShadowMap [ i ] , spotLight . shadowMapSize , spotLight . shadowBias , spotLight . shadowRadius , vSpotShadowCoord [ i ] ) : 1.0 ;
}
# pragma unroll _loop _end
# endif
# if NUM _POINT _LIGHT _SHADOWS > 0
PointLightShadow pointLight ;
# pragma unroll _loop _start
for ( int i = 0 ; i < NUM _POINT _LIGHT _SHADOWS ; i ++ ) {
pointLight = pointLightShadows [ i ] ;
shadow *= receiveShadow ? getPointShadow ( pointShadowMap [ i ] , pointLight . shadowMapSize , pointLight . shadowBias , pointLight . shadowRadius , vPointShadowCoord [ i ] , pointLight . shadowCameraNear , pointLight . shadowCameraFar ) : 1.0 ;
}
# pragma unroll _loop _end
# endif
# endif
return shadow ;
} ` ,Up= ` # ifdef USE _SKINNING
mat4 boneMatX = getBoneMatrix ( skinIndex . x ) ;
mat4 boneMatY = getBoneMatrix ( skinIndex . y ) ;
mat4 boneMatZ = getBoneMatrix ( skinIndex . z ) ;
mat4 boneMatW = getBoneMatrix ( skinIndex . w ) ;
# endif ` ,Hp= ` # ifdef USE _SKINNING
uniform mat4 bindMatrix ;
uniform mat4 bindMatrixInverse ;
# ifdef BONE _TEXTURE
uniform highp sampler2D boneTexture ;
uniform int boneTextureSize ;
mat4 getBoneMatrix ( const in float i ) {
float j = i * 4.0 ;
float x = mod ( j , float ( boneTextureSize ) ) ;
float y = floor ( j / float ( boneTextureSize ) ) ;
float dx = 1.0 / float ( boneTextureSize ) ;
float dy = 1.0 / float ( boneTextureSize ) ;
y = dy * ( y + 0.5 ) ;
vec4 v1 = texture2D ( boneTexture , vec2 ( dx * ( x + 0.5 ) , y ) ) ;
vec4 v2 = texture2D ( boneTexture , vec2 ( dx * ( x + 1.5 ) , y ) ) ;
vec4 v3 = texture2D ( boneTexture , vec2 ( dx * ( x + 2.5 ) , y ) ) ;
vec4 v4 = texture2D ( boneTexture , vec2 ( dx * ( x + 3.5 ) , y ) ) ;
mat4 bone = mat4 ( v1 , v2 , v3 , v4 ) ;
return bone ;
}
# else
uniform mat4 boneMatrices [ MAX _BONES ] ;
mat4 getBoneMatrix ( const in float i ) {
mat4 bone = boneMatrices [ int ( i ) ] ;
return bone ;
}
# endif
# endif ` ,Gp= ` # ifdef USE _SKINNING
vec4 skinVertex = bindMatrix * vec4 ( transformed , 1.0 ) ;
vec4 skinned = vec4 ( 0.0 ) ;
skinned += boneMatX * skinVertex * skinWeight . x ;
skinned += boneMatY * skinVertex * skinWeight . y ;
skinned += boneMatZ * skinVertex * skinWeight . z ;
skinned += boneMatW * skinVertex * skinWeight . w ;
transformed = ( bindMatrixInverse * skinned ) . xyz ;
# endif ` ,kp= ` # ifdef USE _SKINNING
mat4 skinMatrix = mat4 ( 0.0 ) ;
skinMatrix += skinWeight . x * boneMatX ;
skinMatrix += skinWeight . y * boneMatY ;
skinMatrix += skinWeight . z * boneMatZ ;
skinMatrix += skinWeight . w * boneMatW ;
skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix ;
objectNormal = vec4 ( skinMatrix * vec4 ( objectNormal , 0.0 ) ) . xyz ;
# ifdef USE _TANGENT
objectTangent = vec4 ( skinMatrix * vec4 ( objectTangent , 0.0 ) ) . xyz ;
# endif
# endif ` ,Vp= ` float specularStrength ;
# ifdef USE _SPECULARMAP
vec4 texelSpecular = texture2D ( specularMap , vUv ) ;
specularStrength = texelSpecular . r ;
# else
specularStrength = 1.0 ;
# endif ` ,Wp= ` # ifdef USE _SPECULARMAP
uniform sampler2D specularMap ;
# endif ` ,qp= ` # if defined ( TONE _MAPPING )
gl _FragColor . rgb = toneMapping ( gl _FragColor . rgb ) ;
# endif ` ,Xp= ` # ifndef saturate
# define saturate ( a ) clamp ( a , 0.0 , 1.0 )
# endif
uniform float toneMappingExposure ;
vec3 LinearToneMapping ( vec3 color ) {
return toneMappingExposure * color ;
}
vec3 ReinhardToneMapping ( vec3 color ) {
color *= toneMappingExposure ;
return saturate ( color / ( vec3 ( 1.0 ) + color ) ) ;
}
vec3 OptimizedCineonToneMapping ( vec3 color ) {
color *= toneMappingExposure ;
color = max ( vec3 ( 0.0 ) , color - 0.004 ) ;
return pow ( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ) , vec3 ( 2.2 ) ) ;
}
vec3 RRTAndODTFit ( vec3 v ) {
vec3 a = v * ( v + 0.0245786 ) - 0.000090537 ;
vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081 ;
return a / b ;
}
vec3 ACESFilmicToneMapping ( vec3 color ) {
const mat3 ACESInputMat = mat3 (
vec3 ( 0.59719 , 0.07600 , 0.02840 ) , vec3 ( 0.35458 , 0.90834 , 0.13383 ) ,
vec3 ( 0.04823 , 0.01566 , 0.83777 )
) ;
const mat3 ACESOutputMat = mat3 (
vec3 ( 1.60475 , - 0.10208 , - 0.00327 ) , vec3 ( - 0.53108 , 1.10813 , - 0.07276 ) ,
vec3 ( - 0.07367 , - 0.00605 , 1.07602 )
) ;
color *= toneMappingExposure / 0.6 ;
color = ACESInputMat * color ;
color = RRTAndODTFit ( color ) ;
color = ACESOutputMat * color ;
return saturate ( color ) ;
}
vec3 CustomToneMapping ( vec3 color ) { return color ; } ` ,Yp= ` # ifdef USE _TRANSMISSIONMAP
totalTransmission *= texture2D ( transmissionMap , vUv ) . r ;
# endif ` ,Zp= ` # ifdef USE _TRANSMISSIONMAP
uniform sampler2D transmissionMap ;
# endif ` ,Jp= ` # if ( defined ( USE _UV ) && ! defined ( UVS _VERTEX _ONLY ) )
varying vec2 vUv ;
# endif ` ,jp= ` # ifdef USE _UV
# ifdef UVS _VERTEX _ONLY
vec2 vUv ;
# else
varying vec2 vUv ;
# endif
uniform mat3 uvTransform ;
# endif ` , $ p= ` # ifdef USE _UV
vUv = ( uvTransform * vec3 ( uv , 1 ) ) . xy ;
# endif ` ,Qp= ` # if defined ( USE _LIGHTMAP ) || defined ( USE _AOMAP )
varying vec2 vUv2 ;
# endif ` ,Kp= ` # if defined ( USE _LIGHTMAP ) || defined ( USE _AOMAP )
attribute vec2 uv2 ;
varying vec2 vUv2 ;
uniform mat3 uv2Transform ;
# endif ` ,em= ` # if defined ( USE _LIGHTMAP ) || defined ( USE _AOMAP )
vUv2 = ( uv2Transform * vec3 ( uv2 , 1 ) ) . xy ;
# endif ` ,tm= ` # if defined ( USE _ENVMAP ) || defined ( DISTANCE ) || defined ( USE _SHADOWMAP )
vec4 worldPosition = vec4 ( transformed , 1.0 ) ;
# ifdef USE _INSTANCING
worldPosition = instanceMatrix * worldPosition ;
# endif
worldPosition = modelMatrix * worldPosition ;
# endif ` ,nm= ` uniform sampler2D t2D ;
varying vec2 vUv ;
void main ( ) {
vec4 texColor = texture2D ( t2D , vUv ) ;
gl _FragColor = mapTexelToLinear ( texColor ) ;
# include < tonemapping _fragment >
# include < encodings _fragment >
} ` ,im= ` varying vec2 vUv ;
uniform mat3 uvTransform ;
void main ( ) {
vUv = ( uvTransform * vec3 ( uv , 1 ) ) . xy ;
gl _Position = vec4 ( position . xy , 1.0 , 1.0 ) ;
} ` ,rm= ` # include < envmap _common _pars _fragment >
uniform float opacity ;
varying vec3 vWorldDirection ;
# include < cube _uv _reflection _fragment >
void main ( ) {
vec3 vReflect = vWorldDirection ;
# include < envmap _fragment >
gl _FragColor = envColor ;
gl _FragColor . a *= opacity ;
# include < tonemapping _fragment >
# include < encodings _fragment >
} ` ,sm= ` varying vec3 vWorldDirection ;
# include < common >
void main ( ) {
vWorldDirection = transformDirection ( position , modelMatrix ) ;
# include < begin _vertex >
# include < project _vertex >
gl _Position . z = gl _Position . w ;
} ` ,om= ` # if DEPTH _PACKING == 3200
uniform float opacity ;
# endif
# include < common >
# include < packing >
# include < uv _pars _fragment >
# include < map _pars _fragment >
# include < alphamap _pars _fragment >
# include < logdepthbuf _pars _fragment >
# include < clipping _planes _pars _fragment >
varying vec2 vHighPrecisionZW ;
void main ( ) {
# include < clipping _planes _fragment >
vec4 diffuseColor = vec4 ( 1.0 ) ;
# if DEPTH _PACKING == 3200
diffuseColor . a = opacity ;
# endif
# include < map _fragment >
# include < alphamap _fragment >
# include < alphatest _fragment >
# include < logdepthbuf _fragment >
float fragCoordZ = 0.5 * vHighPrecisionZW [ 0 ] / vHighPrecisionZW [ 1 ] + 0.5 ;
# if DEPTH _PACKING == 3200
gl _FragColor = vec4 ( vec3 ( 1.0 - fragCoordZ ) , opacity ) ;
# elif DEPTH _PACKING == 3201
gl _FragColor = packDepthToRGBA ( fragCoordZ ) ;
# endif
} ` ,am= ` # include < common >
# include < uv _pars _vertex >
# include < displacementmap _pars _vertex >
# include < morphtarget _pars _vertex >
# include < skinning _pars _vertex >
# include < logdepthbuf _pars _vertex >
# include < clipping _planes _pars _vertex >
varying vec2 vHighPrecisionZW ;
void main ( ) {
# include < uv _vertex >
# include < skinbase _vertex >
# ifdef USE _DISPLACEMENTMAP
# include < beginnormal _vertex >
# include < morphnormal _vertex >
# include < skinnormal _vertex >
# endif
# include < begin _vertex >
# include < morphtarget _vertex >
# include < skinning _vertex >
# include < displacementmap _vertex >
# include < project _vertex >
# include < logdepthbuf _vertex >
# include < clipping _planes _vertex >
vHighPrecisionZW = gl _Position . zw ;
} ` ,lm= ` # define DISTANCE
uniform vec3 referencePosition ;
uniform float nearDistance ;
uniform float farDistance ;
varying vec3 vWorldPosition ;
# include < common >
# include < packing >
# include < uv _pars _fragment >
# include < map _pars _fragment >
# include < alphamap _pars _fragment >
# include < clipping _planes _pars _fragment >
void main ( ) {
# include < clipping _planes _fragment >
vec4 diffuseColor = vec4 ( 1.0 ) ;
# include < map _fragment >
# include < alphamap _fragment >
# include < alphatest _fragment >
float dist = length ( vWorldPosition - referencePosition ) ;
dist = ( dist - nearDistance ) / ( farDistance - nearDistance ) ;
dist = saturate ( dist ) ;
gl _FragColor = packDepthToRGBA ( dist ) ;
} ` ,cm= ` # define DISTANCE
varying vec3 vWorldPosition ;
# include < common >
# include < uv _pars _vertex >
# include < displacementmap _pars _vertex >
# include < morphtarget _pars _vertex >
# include < skinning _pars _vertex >
# include < clipping _planes _pars _vertex >
void main ( ) {
# include < uv _vertex >
# include < skinbase _vertex >
# ifdef USE _DISPLACEMENTMAP
# include < beginnormal _vertex >
# include < morphnormal _vertex >
# include < skinnormal _vertex >
# endif
# include < begin _vertex >
# include < morphtarget _vertex >
# include < skinning _vertex >
# include < displacementmap _vertex >
# include < project _vertex >
# include < worldpos _vertex >
# include < clipping _planes _vertex >
vWorldPosition = worldPosition . xyz ;
} ` ,hm= ` uniform sampler2D tEquirect ;
varying vec3 vWorldDirection ;
# include < common >
void main ( ) {
vec3 direction = normalize ( vWorldDirection ) ;
vec2 sampleUV = equirectUv ( direction ) ;
vec4 texColor = texture2D ( tEquirect , sampleUV ) ;
gl _FragColor = mapTexelToLinear ( texColor ) ;
# include < tonemapping _fragment >
# include < encodings _fragment >
} ` ,um= ` varying vec3 vWorldDirection ;
# include < common >
void main ( ) {
vWorldDirection = transformDirection ( position , modelMatrix ) ;
# include < begin _vertex >
# include < project _vertex >
} ` ,dm= ` uniform vec3 diffuse ;
uniform float opacity ;
uniform float dashSize ;
uniform float totalSize ;
varying float vLineDistance ;
# include < common >
# include < color _pars _fragment >
# include < fog _pars _fragment >
# include < logdepthbuf _pars _fragment >
# include < clipping _planes _pars _fragment >
void main ( ) {
# include < clipping _planes _fragment >
if ( mod ( vLineDistance , totalSize ) > dashSize ) {
discard ;
}
vec3 outgoingLight = vec3 ( 0.0 ) ;
vec4 diffuseColor = vec4 ( diffuse , opacity ) ;
# include < logdepthbuf _fragment >
# include < color _fragment >
outgoingLight = diffuseColor . rgb ;
gl _FragColor = vec4 ( outgoingLight , diffuseColor . a ) ;
# include < tonemapping _fragment >
# include < encodings _fragment >
# include < fog _fragment >
# include < premultiplied _alpha _fragment >
} ` ,fm= ` uniform float scale ;
attribute float lineDistance ;
varying float vLineDistance ;
# include < common >
# include < color _pars _vertex >
# include < fog _pars _vertex >
# include < morphtarget _pars _vertex >
# include < logdepthbuf _pars _vertex >
# include < clipping _planes _pars _vertex >
void main ( ) {
vLineDistance = scale * lineDistance ;
# include < color _vertex >
# include < begin _vertex >
# include < morphtarget _vertex >
# include < project _vertex >
# include < logdepthbuf _vertex >
# include < clipping _planes _vertex >
# include < fog _vertex >
} ` ,pm= ` uniform vec3 diffuse ;
uniform float opacity ;
# ifndef FLAT _SHADED
varying vec3 vNormal ;
# endif
# include < common >
# include < dithering _pars _fragment >
# include < color _pars _fragment >
# include < uv _pars _fragment >
# include < uv2 _pars _fragment >
# include < map _pars _fragment >
# include < alphamap _pars _fragment >
# include < aomap _pars _fragment >
# include < lightmap _pars _fragment >
# include < envmap _common _pars _fragment >
# include < envmap _pars _fragment >
# include < cube _uv _reflection _fragment >
# include < fog _pars _fragment >
# include < specularmap _pars _fragment >
# include < logdepthbuf _pars _fragment >
# include < clipping _planes _pars _fragment >
void main ( ) {
# include < clipping _planes _fragment >
vec4 diffuseColor = vec4 ( diffuse , opacity ) ;
# include < logdepthbuf _fragment >
# include < map _fragment >
# include < color _fragment >
# include < alphamap _fragment >
# include < alphatest _fragment >
# include < specularmap _fragment >
ReflectedLight reflectedLight = ReflectedLight ( vec3 ( 0.0 ) , vec3 ( 0.0 ) , vec3 ( 0.0 ) , vec3 ( 0.0 ) ) ;
# ifdef USE _LIGHTMAP
vec4 lightMapTexel = texture2D ( lightMap , vUv2 ) ;
reflectedLight . indirectDiffuse += lightMapTexelToLinear ( lightMapTexel ) . rgb * lightMapIntensity ;
# else
reflectedLight . indirectDiffuse += vec3 ( 1.0 ) ;
# endif
# include < aomap _fragment >
reflectedLight . indirectDiffuse *= diffuseColor . rgb ;
vec3 outgoingLight = reflectedLight . indirectDiffuse ;
# include < envmap _fragment >
gl _FragColor = vec4 ( outgoingLight , diffuseColor . a ) ;
# include < tonemapping _fragment >
# include < encodings _fragment >
# include < fog _fragment >
# include < premultiplied _alpha _fragment >
# include < dithering _fragment >
} ` ,mm= ` # include < common >
# include < uv _pars _vertex >
# include < uv2 _pars _vertex >
# include < envmap _pars _vertex >
# include < color _pars _vertex >
# include < fog _pars _vertex >
# include < morphtarget _pars _vertex >
# include < skinning _pars _vertex >
# include < logdepthbuf _pars _vertex >
# include < clipping _planes _pars _vertex >
void main ( ) {
# include < uv _vertex >
# include < uv2 _vertex >
# include < color _vertex >
# include < skinbase _vertex >
# ifdef USE _ENVMAP
# include < beginnormal _vertex >
# include < morphnormal _vertex >
# include < skinnormal _vertex >
# include < defaultnormal _vertex >
# endif
# include < begin _vertex >
# include < morphtarget _vertex >
# include < skinning _vertex >
# include < project _vertex >
# include < logdepthbuf _vertex >
# include < worldpos _vertex >
# include < clipping _planes _vertex >
# include < envmap _vertex >
# include < fog _vertex >
} ` ,gm= ` 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 < common >
# include < packing >
# include < dithering _pars _fragment >
# include < color _pars _fragment >
# include < uv _pars _fragment >
# include < uv2 _pars _fragment >
# include < map _pars _fragment >
# include < alphamap _pars _fragment >
# include < aomap _pars _fragment >
# include < lightmap _pars _fragment >
# include < emissivemap _pars _fragment >
# include < envmap _common _pars _fragment >
# include < envmap _pars _fragment >
# include < cube _uv _reflection _fragment >
# include < bsdfs >
# include < lights _pars _begin >
# include < fog _pars _fragment >
# include < shadowmap _pars _fragment >
# include < shadowmask _pars _fragment >
# include < specularmap _pars _fragment >
# include < logdepthbuf _pars _fragment >
# include < clipping _planes _pars _fragment >
void main ( ) {
# include < clipping _planes _fragment >
vec4 diffuseColor = vec4 ( diffuse , opacity ) ;
ReflectedLight reflectedLight = ReflectedLight ( vec3 ( 0.0 ) , vec3 ( 0.0 ) , vec3 ( 0.0 ) , vec3 ( 0.0 ) ) ;
vec3 totalEmissiveRadiance = emissive ;
# include < logdepthbuf _fragment >
# include < map _fragment >
# include < color _fragment >
# include < alphamap _fragment >
# include < alphatest _fragment >
# include < specularmap _fragment >
# include < emissivemap _fragment >
# ifdef DOUBLE _SIDED
reflectedLight . indirectDiffuse += ( gl _FrontFacing ) ? vIndirectFront : vIndirectBack ;
# else
reflectedLight . indirectDiffuse += vIndirectFront ;
# endif
# include < lightmap _fragment >
reflectedLight . indirectDiffuse *= BRDF _Diffuse _Lambert ( diffuseColor . rgb ) ;
# ifdef DOUBLE _SIDED
reflectedLight . directDiffuse = ( gl _FrontFacing ) ? vLightFront : vLightBack ;
# else
reflectedLight . directDiffuse = vLightFront ;
# endif
reflectedLight . directDiffuse *= BRDF _Diffuse _Lambert ( diffuseColor . rgb ) * getShadowMask ( ) ;
# include < aomap _fragment >
vec3 outgoingLight = reflectedLight . directDiffuse + reflectedLight . indirectDiffuse + totalEmissiveRadiance ;
# include < envmap _fragment >
gl _FragColor = vec4 ( outgoingLight , diffuseColor . a ) ;
# include < tonemapping _fragment >
# include < encodings _fragment >
# include < fog _fragment >
# include < premultiplied _alpha _fragment >
# include < dithering _fragment >
} ` ,xm= ` # define LAMBERT
varying vec3 vLightFront ;
varying vec3 vIndirectFront ;
# ifdef DOUBLE _SIDED
varying vec3 vLightBack ;
varying vec3 vIndirectBack ;
# endif
# include < common >
# include < uv _pars _vertex >
# include < uv2 _pars _vertex >
# include < envmap _pars _vertex >
# include < bsdfs >
# include < lights _pars _begin >
# include < color _pars _vertex >
# include < fog _pars _vertex >
# include < morphtarget _pars _vertex >
# include < skinning _pars _vertex >
# include < shadowmap _pars _vertex >
# include < logdepthbuf _pars _vertex >
# include < clipping _planes _pars _vertex >
void main ( ) {
# include < uv _vertex >
# include < uv2 _vertex >
# include < color _vertex >
# include < beginnormal _vertex >
# include < morphnormal _vertex >
# include < skinbase _vertex >
# include < skinnormal _vertex >
# include < defaultnormal _vertex >
# include < begin _vertex >
# include < morphtarget _vertex >
# include < skinning _vertex >
# include < project _vertex >
# include < logdepthbuf _vertex >
# include < clipping _planes _vertex >
# include < worldpos _vertex >
# include < envmap _vertex >
# include < lights _lambert _vertex >
# include < shadowmap _vertex >
# include < fog _vertex >
} ` ,ym= ` # define MATCAP
uniform vec3 diffuse ;
uniform float opacity ;
uniform sampler2D matcap ;
varying vec3 vViewPosition ;
# ifndef FLAT _SHADED
varying vec3 vNormal ;
# endif
# include < common >
# include < dithering _pars _fragment >
# include < color _pars _fragment >
# include < uv _pars _fragment >
# include < map _pars _fragment >
# include < alphamap _pars _fragment >
# include < fog _pars _fragment >
# include < bumpmap _pars _fragment >
# include < normalmap _pars _fragment >
# include < logdepthbuf _pars _fragment >
# include < clipping _planes _pars _fragment >
void main ( ) {
# include < clipping _planes _fragment >
vec4 diffuseColor = vec4 ( diffuse , opacity ) ;
# include < logdepthbuf _fragment >
# include < map _fragment >
# include < color _fragment >
# include < alphamap _fragment >
# include < alphatest _fragment >
# include < normal _fragment _begin >
# include < normal _fragment _maps >
vec3 viewDir = normalize ( vViewPosition ) ;
vec3 x = normalize ( vec3 ( viewDir . z , 0.0 , - viewDir . x ) ) ;
vec3 y = cross ( viewDir , x ) ;
vec2 uv = vec2 ( dot ( x , normal ) , dot ( y , normal ) ) * 0.495 + 0.5 ;
# ifdef USE _MATCAP
vec4 matcapColor = texture2D ( matcap , uv ) ;
matcapColor = matcapTexelToLinear ( matcapColor ) ;
# else
vec4 matcapColor = vec4 ( 1.0 ) ;
# endif
vec3 outgoingLight = diffuseColor . rgb * matcapColor . rgb ;
gl _FragColor = vec4 ( outgoingLight , diffuseColor . a ) ;
# include < tonemapping _fragment >
# include < encodings _fragment >
# include < fog _fragment >
# include < premultiplied _alpha _fragment >
# include < dithering _fragment >
} ` ,vm= ` # define MATCAP
varying vec3 vViewPosition ;
# ifndef FLAT _SHADED
varying vec3 vNormal ;
# endif
# include < common >
# include < uv _pars _vertex >
# include < color _pars _vertex >
# include < displacementmap _pars _vertex >
# include < fog _pars _vertex >
# include < morphtarget _pars _vertex >
# include < skinning _pars _vertex >
# include < logdepthbuf _pars _vertex >
# include < clipping _planes _pars _vertex >
void main ( ) {
# include < uv _vertex >
# include < color _vertex >
# include < beginnormal _vertex >
# include < morphnormal _vertex >
# include < skinbase _vertex >
# include < skinnormal _vertex >
# include < defaultnormal _vertex >
# ifndef FLAT _SHADED
vNormal = normalize ( transformedNormal ) ;
# endif
# include < begin _vertex >
# include < morphtarget _vertex >
# include < skinning _vertex >
# include < displacementmap _vertex >
# include < project _vertex >
# include < logdepthbuf _vertex >
# include < clipping _planes _vertex >
# include < fog _vertex >
vViewPosition = - mvPosition . xyz ;
} ` ,_m= ` # define TOON
uniform vec3 diffuse ;
uniform vec3 emissive ;
uniform float opacity ;
# include < common >
# include < packing >
# include < dithering _pars _fragment >
# include < color _pars _fragment >
# include < uv _pars _fragment >
# include < uv2 _pars _fragment >
# include < map _pars _fragment >
# include < alphamap _pars _fragment >
# include < aomap _pars _fragment >
# include < lightmap _pars _fragment >
# include < emissivemap _pars _fragment >
# include < gradientmap _pars _fragment >
# include < fog _pars _fragment >
# include < bsdfs >
# include < lights _pars _begin >
# include < lights _toon _pars _fragment >
# include < shadowmap _pars _fragment >
# include < bumpmap _pars _fragment >
# include < normalmap _pars _fragment >
# include < logdepthbuf _pars _fragment >
# include < clipping _planes _pars _fragment >
void main ( ) {
# include < clipping _planes _fragment >
vec4 diffuseColor = vec4 ( diffuse , opacity ) ;
ReflectedLight reflectedLight = ReflectedLight ( vec3 ( 0.0 ) , vec3 ( 0.0 ) , vec3 ( 0.0 ) , vec3 ( 0.0 ) ) ;
vec3 totalEmissiveRadiance = emissive ;
# include < logdepthbuf _fragment >
# include < map _fragment >
# include < color _fragment >
# include < alphamap _fragment >
# include < alphatest _fragment >
# include < normal _fragment _begin >
# include < normal _fragment _maps >
# include < emissivemap _fragment >
# include < lights _toon _fragment >
# include < lights _fragment _begin >
# include < lights _fragment _maps >
# include < lights _fragment _end >
# include < aomap _fragment >
vec3 outgoingLight = reflectedLight . directDiffuse + reflectedLight . indirectDiffuse + totalEmissiveRadiance ;
gl _FragColor = vec4 ( outgoingLight , diffuseColor . a ) ;
# include < tonemapping _fragment >
# include < encodings _fragment >
# include < fog _fragment >
# include < premultiplied _alpha _fragment >
# include < dithering _fragment >
} ` ,wm= ` # define TOON
varying vec3 vViewPosition ;
# ifndef FLAT _SHADED
varying vec3 vNormal ;
# endif
# include < common >
# include < uv _pars _vertex >
# include < uv2 _pars _vertex >
# include < displacementmap _pars _vertex >
# include < color _pars _vertex >
# include < fog _pars _vertex >
# include < morphtarget _pars _vertex >
# include < skinning _pars _vertex >
# include < shadowmap _pars _vertex >
# include < logdepthbuf _pars _vertex >
# include < clipping _planes _pars _vertex >
void main ( ) {
# include < uv _vertex >
# include < uv2 _vertex >
# include < color _vertex >
# include < beginnormal _vertex >
# include < morphnormal _vertex >
# include < skinbase _vertex >
# include < skinnormal _vertex >
# include < defaultnormal _vertex >
# ifndef FLAT _SHADED
vNormal = normalize ( transformedNormal ) ;
# endif
# include < begin _vertex >
# include < morphtarget _vertex >
# include < skinning _vertex >
# include < displacementmap _vertex >
# include < project _vertex >
# include < logdepthbuf _vertex >
# include < clipping _planes _vertex >
vViewPosition = - mvPosition . xyz ;
# include < worldpos _vertex >
# include < shadowmap _vertex >
# include < fog _vertex >
} ` ,bm= ` # define PHONG
uniform vec3 diffuse ;
uniform vec3 emissive ;
uniform vec3 specular ;
uniform float shininess ;
uniform float opacity ;
# include < common >
# include < packing >
# include < dithering _pars _fragment >
# include < color _pars _fragment >
# include < uv _pars _fragment >
# include < uv2 _pars _fragment >
# include < map _pars _fragment >
# include < alphamap _pars _fragment >
# include < aomap _pars _fragment >
# include < lightmap _pars _fragment >
# include < emissivemap _pars _fragment >
# include < envmap _common _pars _fragment >
# include < envmap _pars _fragment >
# include < cube _uv _reflection _fragment >
# include < fog _pars _fragment >
# include < bsdfs >
# include < lights _pars _begin >
# include < lights _phong _pars _fragment >
# include < shadowmap _pars _fragment >
# include < bumpmap _pars _fragment >
# include < normalmap _pars _fragment >
# include < specularmap _pars _fragment >
# include < logdepthbuf _pars _fragment >
# include < clipping _planes _pars _fragment >
void main ( ) {
# include < clipping _planes _fragment >
vec4 diffuseColor = vec4 ( diffuse , opacity ) ;
ReflectedLight reflectedLight = ReflectedLight ( vec3 ( 0.0 ) , vec3 ( 0.0 ) , vec3 ( 0.0 ) , vec3 ( 0.0 ) ) ;
vec3 totalEmissiveRadiance = emissive ;
# include < logdepthbuf _fragment >
# include < map _fragment >
# include < color _fragment >
# include < alphamap _fragment >
# include < alphatest _fragment >
# include < specularmap _fragment >
# include < normal _fragment _begin >
# include < normal _fragment _maps >
# include < emissivemap _fragment >
# include < lights _phong _fragment >
# include < lights _fragment _begin >
# include < lights _fragment _maps >
# include < lights _fragment _end >
# include < aomap _fragment >
vec3 outgoingLight = reflectedLight . directDiffuse + reflectedLight . indirectDiffuse + reflectedLight . directSpecular + reflectedLight . indirectSpecular + totalEmissiveRadiance ;
# include < envmap _fragment >
gl _FragColor = vec4 ( outgoingLight , diffuseColor . a ) ;
# include < tonemapping _fragment >
# include < encodings _fragment >
# include < fog _fragment >
# include < premultiplied _alpha _fragment >
# include < dithering _fragment >
} ` ,Mm= ` # define PHONG
varying vec3 vViewPosition ;
# ifndef FLAT _SHADED
varying vec3 vNormal ;
# endif
# include < common >
# include < uv _pars _vertex >
# include < uv2 _pars _vertex >
# include < displacementmap _pars _vertex >
# include < envmap _pars _vertex >
# include < color _pars _vertex >
# include < fog _pars _vertex >
# include < morphtarget _pars _vertex >
# include < skinning _pars _vertex >
# include < shadowmap _pars _vertex >
# include < logdepthbuf _pars _vertex >
# include < clipping _planes _pars _vertex >
void main ( ) {
# include < uv _vertex >
# include < uv2 _vertex >
# include < color _vertex >
# include < beginnormal _vertex >
# include < morphnormal _vertex >
# include < skinbase _vertex >
# include < skinnormal _vertex >
# include < defaultnormal _vertex >
# ifndef FLAT _SHADED
vNormal = normalize ( transformedNormal ) ;
# endif
# include < begin _vertex >
# include < morphtarget _vertex >
# include < skinning _vertex >
# include < displacementmap _vertex >
# include < project _vertex >
# include < logdepthbuf _vertex >
# include < clipping _planes _vertex >
vViewPosition = - mvPosition . xyz ;
# include < worldpos _vertex >
# include < envmap _vertex >
# include < shadowmap _vertex >
# include < fog _vertex >
} ` ,Sm= ` # define STANDARD
# ifdef PHYSICAL
# define REFLECTIVITY
# define CLEARCOAT
# define TRANSMISSION
# endif
uniform vec3 diffuse ;
uniform vec3 emissive ;
uniform float roughness ;
uniform float metalness ;
uniform float opacity ;
# ifdef TRANSMISSION
uniform float transmission ;
# endif
# ifdef REFLECTIVITY
uniform float reflectivity ;
# endif
# ifdef CLEARCOAT
uniform float clearcoat ;
uniform float clearcoatRoughness ;
# endif
# ifdef USE _SHEEN
uniform vec3 sheen ;
# endif
varying vec3 vViewPosition ;
# ifndef FLAT _SHADED
varying vec3 vNormal ;
# ifdef USE _TANGENT
varying vec3 vTangent ;
varying vec3 vBitangent ;
# endif
# endif
# include < common >
# include < packing >
# include < dithering _pars _fragment >
# include < color _pars _fragment >
# include < uv _pars _fragment >
# include < uv2 _pars _fragment >
# include < map _pars _fragment >
# include < alphamap _pars _fragment >
# include < aomap _pars _fragment >
# include < lightmap _pars _fragment >
# include < emissivemap _pars _fragment >
# include < transmissionmap _pars _fragment >
# include < bsdfs >
# include < cube _uv _reflection _fragment >
# include < envmap _common _pars _fragment >
# include < envmap _physical _pars _fragment >
# include < fog _pars _fragment >
# include < lights _pars _begin >
# include < lights _physical _pars _fragment >
# include < shadowmap _pars _fragment >
# include < bumpmap _pars _fragment >
# include < normalmap _pars _fragment >
# include < clearcoat _pars _fragment >
# include < roughnessmap _pars _fragment >
# include < metalnessmap _pars _fragment >
# include < logdepthbuf _pars _fragment >
# include < clipping _planes _pars _fragment >
void main ( ) {
# include < clipping _planes _fragment >
vec4 diffuseColor = vec4 ( diffuse , opacity ) ;
ReflectedLight reflectedLight = ReflectedLight ( vec3 ( 0.0 ) , vec3 ( 0.0 ) , vec3 ( 0.0 ) , vec3 ( 0.0 ) ) ;
vec3 totalEmissiveRadiance = emissive ;
# ifdef TRANSMISSION
float totalTransmission = transmission ;
# endif
# include < logdepthbuf _fragment >
# include < map _fragment >
# include < color _fragment >
# include < alphamap _fragment >
# include < alphatest _fragment >
# include < roughnessmap _fragment >
# include < metalnessmap _fragment >
# include < normal _fragment _begin >
# include < normal _fragment _maps >
# include < clearcoat _normal _fragment _begin >
# include < clearcoat _normal _fragment _maps >
# include < emissivemap _fragment >
# include < transmissionmap _fragment >
# include < lights _physical _fragment >
# include < lights _fragment _begin >
# include < lights _fragment _maps >
# include < lights _fragment _end >
# include < aomap _fragment >
vec3 outgoingLight = reflectedLight . directDiffuse + reflectedLight . indirectDiffuse + reflectedLight . directSpecular + reflectedLight . indirectSpecular + totalEmissiveRadiance ;
# ifdef TRANSMISSION
diffuseColor . a *= mix ( saturate ( 1. - totalTransmission + linearToRelativeLuminance ( reflectedLight . directSpecular + reflectedLight . indirectSpecular ) ) , 1.0 , metalness ) ;
# endif
gl _FragColor = vec4 ( outgoingLight , diffuseColor . a ) ;
# include < tonemapping _fragment >
# include < encodings _fragment >
# include < fog _fragment >
# include < premultiplied _alpha _fragment >
# include < dithering _fragment >
} ` ,Tm= ` # define STANDARD
varying vec3 vViewPosition ;
# ifndef FLAT _SHADED
varying vec3 vNormal ;
# ifdef USE _TANGENT
varying vec3 vTangent ;
varying vec3 vBitangent ;
# endif
# endif
# include < common >
# include < uv _pars _vertex >
# include < uv2 _pars _vertex >
# include < displacementmap _pars _vertex >
# include < color _pars _vertex >
# include < fog _pars _vertex >
# include < morphtarget _pars _vertex >
# include < skinning _pars _vertex >
# include < shadowmap _pars _vertex >
# include < logdepthbuf _pars _vertex >
# include < clipping _planes _pars _vertex >
void main ( ) {
# include < uv _vertex >
# include < uv2 _vertex >
# include < color _vertex >
# include < beginnormal _vertex >
# include < morphnormal _vertex >
# include < skinbase _vertex >
# include < skinnormal _vertex >
# include < defaultnormal _vertex >
# ifndef FLAT _SHADED
vNormal = normalize ( transformedNormal ) ;
# ifdef USE _TANGENT
vTangent = normalize ( transformedTangent ) ;
vBitangent = normalize ( cross ( vNormal , vTangent ) * tangent . w ) ;
# endif
# endif
# include < begin _vertex >
# include < morphtarget _vertex >
# include < skinning _vertex >
# include < displacementmap _vertex >
# include < project _vertex >
# include < logdepthbuf _vertex >
# include < clipping _planes _vertex >
vViewPosition = - mvPosition . xyz ;
# include < worldpos _vertex >
# include < shadowmap _vertex >
# include < fog _vertex >
} ` ,Em= ` # define NORMAL
uniform float opacity ;
# if defined ( FLAT _SHADED ) || defined ( USE _BUMPMAP ) || defined ( TANGENTSPACE _NORMALMAP )
varying vec3 vViewPosition ;
# endif
# ifndef FLAT _SHADED
varying vec3 vNormal ;
# ifdef USE _TANGENT
varying vec3 vTangent ;
varying vec3 vBitangent ;
# endif
# endif
# include < packing >
# include < uv _pars _fragment >
# include < bumpmap _pars _fragment >
# include < normalmap _pars _fragment >
# include < logdepthbuf _pars _fragment >
# include < clipping _planes _pars _fragment >
void main ( ) {
# include < clipping _planes _fragment >
# include < logdepthbuf _fragment >
# include < normal _fragment _begin >
# include < normal _fragment _maps >
gl _FragColor = vec4 ( packNormalToRGB ( normal ) , opacity ) ;
} ` ,Am= ` # define NORMAL
# if defined ( FLAT _SHADED ) || defined ( USE _BUMPMAP ) || defined ( TANGENTSPACE _NORMALMAP )
varying vec3 vViewPosition ;
# endif
# ifndef FLAT _SHADED
varying vec3 vNormal ;
# ifdef USE _TANGENT
varying vec3 vTangent ;
varying vec3 vBitangent ;
# endif
# endif
# include < common >
# include < uv _pars _vertex >
# include < displacementmap _pars _vertex >
# include < morphtarget _pars _vertex >
# include < skinning _pars _vertex >
# include < logdepthbuf _pars _vertex >
# include < clipping _planes _pars _vertex >
void main ( ) {
# include < uv _vertex >
# include < beginnormal _vertex >
# include < morphnormal _vertex >
# include < skinbase _vertex >
# include < skinnormal _vertex >
# include < defaultnormal _vertex >
# ifndef FLAT _SHADED
vNormal = normalize ( transformedNormal ) ;
# ifdef USE _TANGENT
vTangent = normalize ( transformedTangent ) ;
vBitangent = normalize ( cross ( vNormal , vTangent ) * tangent . w ) ;
# endif
# endif
# include < begin _vertex >
# include < morphtarget _vertex >
# include < skinning _vertex >
# include < displacementmap _vertex >
# include < project _vertex >
# include < logdepthbuf _vertex >
# include < clipping _planes _vertex >
# if defined ( FLAT _SHADED ) || defined ( USE _BUMPMAP ) || defined ( TANGENTSPACE _NORMALMAP )
vViewPosition = - mvPosition . xyz ;
# endif
} ` ,Lm= ` uniform vec3 diffuse ;
uniform float opacity ;
# include < common >
# include < color _pars _fragment >
# include < map _particle _pars _fragment >
# include < fog _pars _fragment >
# include < logdepthbuf _pars _fragment >
# include < clipping _planes _pars _fragment >
void main ( ) {
# include < clipping _planes _fragment >
vec3 outgoingLight = vec3 ( 0.0 ) ;
vec4 diffuseColor = vec4 ( diffuse , opacity ) ;
# include < logdepthbuf _fragment >
# include < map _particle _fragment >
# include < color _fragment >
# include < alphatest _fragment >
outgoingLight = diffuseColor . rgb ;
gl _FragColor = vec4 ( outgoingLight , diffuseColor . a ) ;
# include < tonemapping _fragment >
# include < encodings _fragment >
# include < fog _fragment >
# include < premultiplied _alpha _fragment >
} ` ,Rm= ` uniform float size ;
uniform float scale ;
# include < common >
# include < color _pars _vertex >
# include < fog _pars _vertex >
# include < morphtarget _pars _vertex >
# include < logdepthbuf _pars _vertex >
# include < clipping _planes _pars _vertex >
void main ( ) {
# include < color _vertex >
# include < begin _vertex >
# include < morphtarget _vertex >
# include < project _vertex >
gl _PointSize = size ;
# ifdef USE _SIZEATTENUATION
bool isPerspective = isPerspectiveMatrix ( projectionMatrix ) ;
if ( isPerspective ) gl _PointSize *= ( scale / - mvPosition . z ) ;
# endif
# include < logdepthbuf _vertex >
# include < clipping _planes _vertex >
# include < worldpos _vertex >
# include < fog _vertex >
} ` ,Cm= ` uniform vec3 color ;
uniform float opacity ;
# include < common >
# include < packing >
# include < fog _pars _fragment >
# include < bsdfs >
# include < lights _pars _begin >
# include < shadowmap _pars _fragment >
# include < shadowmask _pars _fragment >
void main ( ) {
gl _FragColor = vec4 ( color , opacity * ( 1.0 - getShadowMask ( ) ) ) ;
# include < tonemapping _fragment >
# include < encodings _fragment >
# include < fog _fragment >
} ` ,Pm= ` # include < common >
# include < fog _pars _vertex >
# include < shadowmap _pars _vertex >
void main ( ) {
# include < begin _vertex >
# include < project _vertex >
# include < worldpos _vertex >
# include < beginnormal _vertex >
# include < morphnormal _vertex >
# include < skinbase _vertex >
# include < skinnormal _vertex >
# include < defaultnormal _vertex >
# include < shadowmap _vertex >
# include < fog _vertex >
} ` ,Im= ` uniform vec3 diffuse ;
uniform float opacity ;
# include < common >
# include < uv _pars _fragment >
# include < map _pars _fragment >
# include < alphamap _pars _fragment >
# include < fog _pars _fragment >
# include < logdepthbuf _pars _fragment >
# include < clipping _planes _pars _fragment >
void main ( ) {
# include < clipping _planes _fragment >
vec3 outgoingLight = vec3 ( 0.0 ) ;
vec4 diffuseColor = vec4 ( diffuse , opacity ) ;
# include < logdepthbuf _fragment >
# include < map _fragment >
# include < alphamap _fragment >
# include < alphatest _fragment >
outgoingLight = diffuseColor . rgb ;
gl _FragColor = vec4 ( outgoingLight , diffuseColor . a ) ;
# include < tonemapping _fragment >
# include < encodings _fragment >
# include < fog _fragment >
} ` ,Dm= ` uniform float rotation ;
uniform vec2 center ;
# include < common >
# include < uv _pars _vertex >
# include < fog _pars _vertex >
# include < logdepthbuf _pars _vertex >
# include < clipping _planes _pars _vertex >
void main ( ) {
# include < uv _vertex >
vec4 mvPosition = modelViewMatrix * vec4 ( 0.0 , 0.0 , 0.0 , 1.0 ) ;
vec2 scale ;
scale . x = length ( vec3 ( modelMatrix [ 0 ] . x , modelMatrix [ 0 ] . y , modelMatrix [ 0 ] . z ) ) ;
scale . y = length ( vec3 ( modelMatrix [ 1 ] . x , modelMatrix [ 1 ] . y , modelMatrix [ 1 ] . z ) ) ;
# ifndef USE _SIZEATTENUATION
bool isPerspective = isPerspectiveMatrix ( projectionMatrix ) ;
if ( isPerspective ) scale *= - mvPosition . z ;
# endif
vec2 alignedPosition = ( position . xy - ( center - vec2 ( 0.5 ) ) ) * scale ;
vec2 rotatedPosition ;
rotatedPosition . x = cos ( rotation ) * alignedPosition . x - sin ( rotation ) * alignedPosition . y ;
rotatedPosition . y = sin ( rotation ) * alignedPosition . x + cos ( rotation ) * alignedPosition . y ;
mvPosition . xy += rotatedPosition ;
gl _Position = projectionMatrix * mvPosition ;
# include < logdepthbuf _vertex >
# include < clipping _planes _vertex >
# include < fog _vertex >
} ` ,Ee={alphamap_fragment:ff,alphamap_pars_fragment:pf,alphatest_fragment:mf,aomap_fragment:gf,aomap_pars_fragment:xf,begin_vertex:yf,beginnormal_vertex:vf,bsdfs:_f,bumpmap_pars_fragment:wf,clipping_planes_fragment:bf,clipping_planes_pars_fragment:Mf,clipping_planes_pars_vertex:Sf,clipping_planes_vertex:Tf,color_fragment:Ef,color_pars_fragment:Af,color_pars_vertex:Lf,color_vertex:Rf,common:Cf,cube_uv_reflection_fragment:Pf,defaultnormal_vertex:If,displacementmap_pars_vertex:Df,displacementmap_vertex:Ff,emissivemap_fragment:Nf,emissivemap_pars_fragment:Bf,encodings_fragment:zf,encodings_pars_fragment:Of,envmap_fragment:Uf,envmap_common_pars_fragment:Hf,envmap_pars_fragment:Gf,envmap_pars_vertex:kf,envmap_physical_pars_fragment:Kf,envmap_vertex:Vf,fog_vertex:Wf,fog_pars_vertex:qf,fog_fragment:Xf,fog_pars_fragment:Yf,gradientmap_pars_fragment:Zf,lightmap_fragment:Jf,lightmap_pars_fragment:jf,lights_lambert_vertex: $ f,lights_pars_begin:Qf,lights_toon_fragment:ep,lights_toon_pars_fragment:tp,lights_phong_fragment:np,lights_phong_pars_fragment:ip,lights_physical_fragment:rp,lights_physical_pars_fragment:sp,lights_fragment_begin:op,lights_fragment_maps:ap,lights_fragment_end:lp,logdepthbuf_fragment:cp,logdepthbuf_pars_fragment:hp,logdepthbuf_pars_vertex:up,logdepthbuf_vertex:dp,map_fragment:fp,map_pars_fragment:pp,map_particle_fragment:mp,map_particle_pars_fragment:gp,metalnessmap_fragment:xp,metalnessmap_pars_fragment:yp,morphnormal_vertex:vp,morphtarget_pars_vertex:_p,morphtarget_vertex:wp,normal_fragment_begin:bp,normal_fragment_maps:Mp,normalmap_pars_fragment:Sp,clearcoat_normal_fragment_begin:Tp,clearcoat_normal_fragment_maps:Ep,clearcoat_pars_fragment:Ap,packing:Lp,premultiplied_alpha_fragment:Rp,project_vertex:Cp,dithering_fragment:Pp,dithering_pars_fragment:Ip,roughnessmap_fragment:Dp,roughnessmap_pars_fragment:Fp,shadowmap_pars_fragment:Np,shadowmap_pars_vertex:Bp,shadowmap_vertex:zp,shadowmask_pars_fragment:Op,skinbase_vertex:Up,skinning_pars_vertex:Hp,skinning_vertex:Gp,skinnormal_vertex:kp,specularmap_fragment:Vp,specularmap_pars_fragment:Wp,tonemapping_fragment:qp,tonemapping_pars_fragment:Xp,transmissionmap_fragment:Yp,transmissionmap_pars_fragment:Zp,uv_pars_fragment:Jp,uv_pars_vertex:jp,uv_vertex: $ p,uv2_pars_fragment:Qp,uv2_pars_vertex:Kp,uv2_vertex:em,worldpos_vertex:tm,background_frag:nm,background_vert:im,cube_frag:rm,cube_vert:sm,depth_frag:om,depth_vert:am,distanceRGBA_frag:lm,distanceRGBA_vert:cm,equirect_frag:hm,equirect_vert:um,linedashed_frag:dm,linedashed_vert:fm,meshbasic_frag:pm,meshbasic_vert:mm,meshlambert_frag:gm,meshlambert_vert:xm,meshmatcap_frag:ym,meshmatcap_vert:vm,meshtoon_frag:_m,meshtoon_vert:wm,meshphong_frag:bm,meshphong_vert:Mm,meshphysical_frag:Sm,meshphysical_vert:Tm,normal_frag:Em,normal_vert:Am,points_frag:Lm,points_vert:Rm,shadow_frag:Cm,shadow_vert:Pm,sprite_frag:Im,sprite_vert:Dm},K={common:{diffuse:{value:new se(15658734)},opacity:{value:1},map:{value:null},uvTransform:{value:new Ke},uv2Transform:{value:new Ke},alphaMap:{value:null}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},refractionRatio:{value:.98},maxMipLevel:{value:0}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalScale:{value:new W(1,1)}},displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new se(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spot
` );for(let t=0;t<e.length;t++)e[t]=t+1+": "+e[t];return e.join( `
` )}function oc(s){switch(s){case yt:return["Linear","( value )"];case Er:return["sRGB","( value )"];case js:return["RGBE","( value )"];case _l:return["RGBM","( value, 7.0 )"];case wl:return["RGBM","( value, 16.0 )"];case bl:return["RGBD","( value, 256.0 )"];case Js:return["Gamma","( value, float( GAMMA_FACTOR ) )"];case Cd:return["LogLuv","( value )"];default:return console.warn("THREE.WebGLProgram: Unsupported encoding:",s),["Linear","( value )"]}}function ac(s,e,t){let n=s.getShaderParameter(e,35713),i=s.getShaderInfoLog(e).trim();if(n&&i==="")return"";let r=s.getShaderSource(e);return"THREE.WebGLShader: gl.getShaderInfoLog() "+t+ `
` +i+zg(r)}function ki(s,e){let t=oc(e);return"vec4 "+s+"( vec4 value ) { return "+t[0]+"ToLinear"+t[1]+"; }"}function Og(s,e){let t=oc(e);return"vec4 "+s+"( vec4 value ) { return LinearTo"+t[0]+t[1]+"; }"}function Ug(s,e){let t;switch(e){case Ru:t="Linear";break;case Cu:t="Reinhard";break;case Pu:t="OptimizedCineon";break;case Iu:t="ACESFilmic";break;case Du:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+s+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}function Hg(s){return[s.extensionDerivatives||s.envMapCubeUV||s.bumpMap||s.tangentSpaceNormalMap||s.clearcoatNormalMap||s.flatShading||s.shaderID==="physical"?"#extension GL_OES_standard_derivatives : enable":"",(s.extensionFragDepth||s.logarithmicDepthBuffer)&&s.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",s.extensionDrawBuffers&&s.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(s.extensionShaderTextureLOD||s.envMap)&&s.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(Vi).join( `
` )}function Gg(s){let e=[];for(let t in s){let n=s[t];n!==!1&&e.push("#define "+t+" "+n)}return e.join( `
` )}function kg(s,e){let t={},n=s.getProgramParameter(e,35721);for(let i=0;i<n;i++){let o=s.getActiveAttrib(e,i).name;t[o]=s.getAttribLocation(e,o)}return t}function Vi(s){return s!==""}function lc(s,e){return s.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function cc(s,e){return s.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}var Vg=/^[ \t ]*#include +<([ \w \d ./]+)>/gm;function Lo(s){return s.replace(Vg,Wg)}function Wg(s,e){let t=Ee[e];if(t===void 0)throw new Error("Can not resolve #include <"+e+">");return Lo(t)}var qg=/#pragma unroll_loop[ \s ]+?for \( int i \= ( \d +) \; i < ( \d +) \; i \+ \+ \) \{ ([ \s \S ]+?)(?= \} ) \} /g,Xg=/#pragma unroll_loop_start \s +for \s * \( \s *int \s +i \s *= \s *( \d +) \s *; \s *i \s *< \s *( \d +) \s *; \s *i \s * \+ \+ \s * \) \s *{([ \s \S ]+?)} \s +#pragma unroll_loop_end/g;function uc(s){return s.replace(Xg,hc).replace(qg,Yg)}function Yg(s,e,t,n){return console.warn("WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead."),hc(s,e,t,n)}function hc(s,e,t,n){let i="";for(let r=parseInt(e);r<parseInt(t);r++)i+=n.replace(/ \[ \s *i \s * \] /g,"[ "+r+" ]").replace(/UNROLLED_LOOP_INDEX/g,r);return i}function dc(s){let e="precision "+s.precision+ ` float ;
precision ` +s.precision+" int;";return s.precision==="highp"?e+= `
# define HIGH _PRECISION ` :s.precision==="mediump"?e+= `
# define MEDIUM _PRECISION ` :s.precision==="lowp"&&(e+= `
# define LOW _PRECISION ` ),e}function Zg(s){let e="SHADOWMAP_TYPE_BASIC";return s.shadowMapType===Ka?e="SHADOWMAP_TYPE_PCF":s.shadowMapType===au?e="SHADOWMAP_TYPE_PCF_SOFT":s.shadowMapType===Mi&&(e="SHADOWMAP_TYPE_VSM"),e}function Jg(s){let e="ENVMAP_TYPE_CUBE";if(s.envMap)switch(s.envMapMode){case mr:case gr:e="ENVMAP_TYPE_CUBE";break;case Ei:case xr:e="ENVMAP_TYPE_CUBE_UV";break}return e}function jg(s){let e="ENVMAP_MODE_REFLECTION";if(s.envMap)switch(s.envMapMode){case gr:case xr:e="ENVMAP_MODE_REFRACTION";break}return e}function $ g(s){let e="ENVMAP_BLENDING_NONE";if(s.envMap)switch(s.combine){case pr:e="ENVMAP_BLENDING_MULTIPLY";break;case Au:e="ENVMAP_BLENDING_MIX";break;case Lu:e="ENVMAP_BLENDING_ADD";break}return e}function Qg(s,e,t,n){let i=s.getContext(),r=t.defines,o=t.vertexShader,a=t.fragmentShader,c=Zg(t),l=Jg(t),h=jg(t),u= $ g(t),d=s.gammaFactor>0?s.gammaFactor:1,f=t.isWebGL2?"":Hg(t),m=Gg(r),x=i.createProgram(),y,g,p=t.glslVersion?"#version "+t.glslVersion+ `
` :"";t.isRawShaderMaterial?(y=[m].filter(Vi).join( `
` ),y.length>0&&(y+= `
` ),g=[f,m].filter(Vi).join( `
` ),g.length>0&&(g+= `
` )):(y=[dc(t),"#define SHADER_NAME "+t.shaderName,m,t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+d,"#define MAX_BONES "+t.maxBones,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+h:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMap&&t.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",t.normalMap&&t.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.displacementMap&&t.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.vertexTangents?"#define USE_TANGENT":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUvs?"#define USE_UV":"",t.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.useVertexTexture?"#define BONE_TEXTURE":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+c:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.logarithmicDepthBuffer&&t.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#ifdef USE_MORPHTARGETS"," attribute vec3 morphTarget0;"," attribute vec3 morphTarget1;"," attribute vec3 morphTarget2;"," attribute vec3 morphTarget3;"," #ifdef USE_MORPHNORMALS"," attribute vec3 morphNormal0;"," attribute vec3 morphNormal1;"," attribute vec3 morphNormal2;"," attribute vec3 morphNormal3;"," #else"," attribute vec3 morphTarget4;"," attribute vec3 morphTarget5;"," attribute vec3 morphTarget6;"," attribute vec3 morphTarget7;"," #endif","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif", `
` ].filter(Vi).join( `
` ),g=[f,dc(t),"#define SHADER_NAME "+t.shaderName,m,t.alphaTest?"#define ALPHATEST "+t.alphaTest+(t.alphaTest%1?"":".0"):"","#define GAMMA_FACTOR "+d,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+l:"",t.envMap?"#define "+h:"",t.envMap?"#define "+u:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMap&&t.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",t.normalMap&&t.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.sheen?"#define USE_SHEEN":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.vertexTangents?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUvs?"#define USE_UV":"",t.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+c:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.logarithmicDepthBuffer&&t.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"",(t.extensionShaderTextureLOD||t.envMap)&&t.rendererExtensionShaderTextureLod?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==kn?"#define TONE_MAPPING":"",t.toneMapping!==kn?Ee.tonemapping_pars_fragment:"",t.toneMapping!==kn?Ug("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",Ee.encodings_pars_fragment,t.map?ki("mapTexelToLinear",t.mapEncoding):"",t.matcap?ki("matcapTexelToLinear",t.matcapEncoding):"",t.envMap?ki("envMapTexelToLinear",t.envMapEncoding):"",t.emissiveMap?ki("emissiveMapTexelToLinear",t.emissiveMapEncoding):"",t.lightMap?ki("lightMapTexelToLinear",t.lightMapEncoding):"",Og("linearToOutputTexel",t.outputEncoding),t.depthPacking?"#define DEPTH_PACKING "+t.depthPacking:"", `
` ].filter(Vi).join( `
` )),o=Lo(o),o=lc(o,t),o=cc(o,t),a=Lo(a),a=lc(a,t),a=cc(a,t),o=uc(o),a=uc(a),t.isWebGL2&&t.isRawShaderMaterial!==!0&&(p= ` # version 300 es
` ,y=["#define attribute in","#define varying out","#define texture2D texture"].join( `
` )+ `
` +y,g=["#define varying in",t.glslVersion===Ml?"":"out highp vec4 pc_fragColor;",t.glslVersion===Ml?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join( `
` )+ `
` +g);let w=p+y+o,b=p+g+a,T=sc(i,35633,w),v=sc(i,35632,b);if(i.attachShader(x,T),i.attachShader(x,v),t.index0AttributeName!==void 0?i.bindAttribLocation(x,0,t.index0AttributeName):t.morphTargets===!0&&i.bindAttribLocation(x,0,"position"),i.linkProgram(x),s.debug.checkShaderErrors){let I=i.getProgramInfoLog(x).trim(),N=i.getShaderInfoLog(T).trim(),U=i.getShaderInfoLog(v).trim(),z=!0,R=!0;if(i.getProgramParameter(x,35714)===!1){z=!1;let D=ac(i,T,"vertex"),F=ac(i,v,"fragment");console.error("THREE.WebGLProgram: shader error: ",i.getError(),"35715",i.getProgramParameter(x,35715),"gl.getProgramInfoLog",I,D,F)}else I!==""?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",I):(N===""||U==="")&&(R=!1);R&&(this.diagnostics={runnable:z,programLog:I,vertexShader:{log:N,prefix:y},fragmentShader:{log:U,prefix:g}})}i.deleteShader(T),i.deleteShader(v);let A;this.getUniforms=function(){return A===void 0&&(A=new fn(i,x)),A};let L;return this.getAttributes=function(){return L===void 0&&(L=kg(i,x)),L},this.destroy=function(){n.releaseStatesOfProgram(this),i.deleteProgram(x),this.program=void 0},this.name=t.shaderName,this.id=Bg++,this.cacheKey=e,this.usedTimes=1,this.program=x,this.vertexShader=T,this.fragmentShader=v,this}function Kg(s,e,t,n,i,r){let o=[],a=n.isWebGL2,c=n.logarithmicDepthBuffer,l=n.floatVertexTextures,h=n.maxVertexUniforms,u=n.vertexTextures,d=n.precision,f={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"},m=["precision","isWebGL2","supportsVertexTextures","outputEncoding","instancing","instancingColor","map","mapEncoding","matcap","matcapEncoding","envMap","envMapMode","envMapEncoding","envMapCubeUV","lightMap","lightMapEncoding","aoMap","emissiveMap","emissiveMapEncoding","bumpMap","normalMap","objectSpaceNormalMap","tangentSpaceNormalMap","clearcoatMap","clearcoatRoughnessMap","clearcoatNormalMap","displacementMap","specularMap","roughnessMap","metalnessMap","gradientMap","alphaMap","combine","vertexColors","vertexAlphas","vertexTangents","vertexUvs","uvsVertexOnly","fog","useFog","fogExp2","flatShading","sizeAttenuation","logarithmicDepthBuffer","skinning","maxBones","useVertexTexture","morphTargets","morphNormals","premultipliedAlpha","numDirLights","numPointLights","numSpotLights","numHemiLights","numRectAreaLights","numDirLightShadows","numPointLightShadows","numSpotLightShadows","shadowMapEnabled","shadowMapType","toneMapping","physicallyCorrectLights","alphaTest","doubleSided","flipSided","numClippingPlanes","numClipIntersection","depthPacking","dithering","sheen","transmissionMap"];function x(v){let L=v.skeleton.bones;if(l)return 1024;{let N=Math.floor((h-20)/4),U=Math.min(N,L.length);return U<L.length?(console.warn("THREE.WebGLRenderer: Skeleton has "+L.length+" bones. This GPU supports "+U+"."),0):U}}function y(v){let A;return v&&v.isTexture?A=v.encoding:v&&v.isWebGLRenderTarget?(console.warn("THREE.WebGLPrograms.getTextureEncodingFromMap: don't use render targets as textures. Use their .texture property instead."),A=v.texture.encoding):A=yt,A}function g(v,A,L,I,N){let U=I.fog,z=v.isMeshStandardMaterial?I.environment:null,R=e.get(v.envMap||z),D=f[v.type],F=N.isSkinnedMesh?x(N):0;v.precision!==null&&(d=n.getMaxPrecision(v.precision),d!==v.precision&&console.warn("THREE.WebGLProgram.getParameters:",v.precision,"not supported, using",d,"instead."));let P,X;if(D){let oe=Bt[D];P=oe.vertexShader,X=oe.fragmentShader}else P=v.vertexShader,X=v.fragmentShader;let $ =s.getRenderTarget();return{isWebGL2:a,shaderID:D,shaderName:v.type,vertexShader:P,fragmentShader:X,defines:v.defines,isRawShaderMaterial:v.isRawShaderMaterial===!0,glslVersion:v.glslVersion,precision:d,instancing:N.isInstancedMesh===!0,instancingColor:N.isInstancedMesh===!0&&N.instanceColor!==
uniform vec2 resolution ;
uniform float radius ;
# include < packing >
void main ( ) {
float mean = 0.0 ;
float squared _mean = 0.0 ;
float depth = unpackRGBAToDepth ( texture2D ( shadow _pass , ( gl _FragCoord . xy ) / resolution ) ) ;
for ( float i = - 1.0 ; i < 1.0 ; i += SAMPLE _RATE ) {
# ifdef HORIZONTAL _PASS
vec2 distribution = unpackRGBATo2Half ( texture2D ( shadow _pass , ( gl _FragCoord . xy + vec2 ( i , 0.0 ) * radius ) / resolution ) ) ;
mean += distribution . x ;
squared _mean += distribution . y * distribution . y + distribution . x * distribution . x ;
# else
float depth = unpackRGBAToDepth ( texture2D ( shadow _pass , ( gl _FragCoord . xy + vec2 ( 0.0 , i ) * radius ) / resolution ) ) ;
mean += depth ;
squared _mean += depth * depth ;
# endif
}
mean = mean * HALF _SAMPLE _RATE ;
squared _mean = squared _mean * HALF _SAMPLE _RATE ;
float std _dev = sqrt ( squared _mean - mean * mean ) ;
gl _FragColor = pack2HalfToRGBA ( vec2 ( mean , std _dev ) ) ;
} ` ,ux= ` void main ( ) {
gl _Position = vec4 ( position , 1.0 ) ;
} ` ;function mc(s,e,t){let n=new Gi,i=new W,r=new W,o=new Fe,a=[],c=[],l={},h=t.maxTextureSize,u={0:Qe,1:Si,2:fr},d=new jt({defines:{SAMPLE_RATE:2/8,HALF_SAMPLE_RATE:1/8},uniforms:{shadow_pass:{value:null},resolution:{value:new W},radius:{value:4}},vertexShader:ux,fragmentShader:hx}),f=d.clone();f.defines.HORIZONTAL_PASS=1;let m=new ue;m.setAttribute("position",new Te(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let x=new je(m,d),y=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Ka,this.render=function(v,A,L){if(y.enabled===!1||y.autoUpdate===!1&&y.needsUpdate===!1||v.length===0)return;let I=s.getRenderTarget(),N=s.getActiveCubeFace(),U=s.getActiveMipmapLevel(),z=s.state;z.setBlending(en),z.buffers.color.setClear(1,1,1,1),z.buffers.depth.setTest(!0),z.setScissorTest(!1);for(let R=0,D=v.length;R<D;R++){let F=v[R],P=F.shadow;if(P===void 0){console.warn("THREE.WebGLShadowMap:",F,"has no shadow.");continue}if(P.autoUpdate===!1&&P.needsUpdate===!1)continue;i.copy(P.mapSize);let X=P.getFrameExtents();if(i.multiply(X),r.copy(P.mapSize),(i.x>h||i.y>h)&&(i.x>h&&(r.x=Math.floor(h/X.x),i.x=r.x*X.x,P.mapSize.x=r.x),i.y>h&&(r.y=Math.floor(h/X.y),i.y=r.y*X.y,P.mapSize.y=r.y)),P.map===null&&!P.isPointLightShadow&&this.type===Mi){let Z={minFilter:it,magFilter:it,format:Tt};P.map=new Vt(i.x,i.y,Z),P.map.texture.name=F.name+".shadowMap",P.mapPass=new Vt(i.x,i.y,Z),P.camera.updateProjectionMatrix()}if(P.map===null){let Z={minFilter:nt,magFilter:nt,format:Tt};P.map=new Vt(i.x,i.y,Z),P.map.texture.name=F.name+".shadowMap",P.camera.updateProjectionMatrix()}s.setRenderTarget(P.map),s.clear();let $ =P.getViewportCount();for(let Z=0;Z< $ ;Z++){let oe=P.getViewport(Z);o.set(r.x*oe.x,r.y*oe.y,r.x*oe.z,r.y*oe.w),z.viewport(o),P.updateMatrices(F,Z),n=P.getFrustum(),T(A,L,P.camera,F,this.type)}!P.isPointLightShadow&&this.type===Mi&&g(P,L),P.needsUpdate=!1}y.needsUpdate=!1,s.setRenderTarget(I,N,U)};function g(v,A){let L=e.update(x);d.uniforms.shadow_pass.value=v.map.texture,d.uniforms.resolution.value=v.mapSize,d.uniforms.radius.value=v.radius,s.setRenderTarget(v.mapPass),s.clear(),s.renderBufferDirect(A,null,L,d,x,null),f.uniforms.shadow_pass.value=v.mapPass.texture,f.uniforms.resolution.value=v.mapSize,f.uniforms.radius.value=v.radius,s.setRenderTarget(v.map),s.clear(),s.renderBufferDirect(A,null,L,f,x,null)}function p(v,A,L){let I=v<<0|A<<1|L<<2,N=a[I];return N===void 0&&(N=new jr({depthPacking:Id,morphTargets:v,skinning:A}),a[I]=N),N}function w(v,A,L){let I=v<<0|A<<1|L<<2,N=c[I];return N===void 0&&(N=new $ r({morphTargets:v,skinning:A}),c[I]=N),N}function b(v,A,L,I,N,U,z){let R=null,D=p,F=v.customDepthMaterial;if(I.isPointLight===!0&&(D=w,F=v.customDistanceMaterial),F===void 0){let P=!1;L.morphTargets===!0&&(P=A.morphAttributes&&A.morphAttributes.position&&A.morphAttributes.position.length>0);let X=!1;v.isSkinnedMesh===!0&&(L.skinning===!0?X=!0:console.warn("THREE.WebGLShadowMap: THREE.SkinnedMesh with material.skinning set to false:",v));let $ =v.isInstancedMesh===!0;R=D(P,X, $ )}else R=F;if(s.localClippingEnabled&&L.clipShadows===!0&&L.clippingPlanes.length!==0){let P=R.uuid,X=L.uuid, $ =l[P]; $ ===void 0&&( $ ={},l[P]= $ );let Z= $ [X];Z===void 0&&(Z=R.clone(), $ [X]=Z),R=Z}return R.visible=L.visible,R.wireframe=L.wireframe,z===Mi?R.side=L.shadowSide!==null?L.shadowSide:L.side:R.side=L.shadowSide!==null?L.shadowSide:u[L.side],R.clipShadows=L.clipShadows,R.clippingPlanes=L.clippingPlanes,R.clipIntersection=L.clipIntersection,R.wireframeLinewidth=L.wireframeLinewidth,R.linewidth=L.linewidth,I.isPointLight===!0&&R.isMeshDistanceMaterial===!0&&(R.referencePosition.setFromMatrixPosition(I.matrixWorld),R.nearDistance=N,R.farDistance=U),R}function T(v,A,L,I,N){if(v.visible===!1)return;if(v.layers.test(A.layers)&&(v.isMesh||v.isLine||v.isPoints)&&(v.castShadow||v.receiveShadow&&N===Mi)&&(!v.frustumCulled||n.intersectsObject(v))){v.modelViewMatrix.multiplyMatrices(L.matrixWorldInverse,v.matrixWorld);let R=e.update(v),D=v.material;if(Array.isArray(D)){let F=R.groups;for(let P=0,X=F.length;P<X;P++){let $ =F[P],Z=D[ $ .materialIndex];if(Z&&Z.visible){l
` )a=0,c-=r;else{let u=ny(h,i,a,c,t);a+=u.offsetX,o.push(u.path)}}return o}function ny(s,e,t,n,i){let r=i.glyphs[s]||i.glyphs["?"];if(!r){console.error('THREE.Font: character "'+s+'" does not exists in font family '+i.familyName+".");return}let o=new hh,a,c,l,h,u,d,f,m;if(r.o){let x=r._cachedOutline||(r._cachedOutline=r.o.split(" "));for(let y=0,g=x.length;y<g;)switch(x[y++]){case"m":a=x[y++]*e+t,c=x[y++]*e+n,o.moveTo(a,c);break;case"l":a=x[y++]*e+t,c=x[y++]*e+n,o.lineTo(a,c);break;case"q":l=x[y++]*e+t,h=x[y++]*e+n,u=x[y++]*e+t,d=x[y++]*e+n,o.quadraticCurveTo(u,d,l,h);break;case"b":l=x[y++]*e+t,h=x[y++]*e+n,u=x[y++]*e+t,d=x[y++]*e+n,f=x[y++]*e+t,m=x[y++]*e+n,o.bezierCurveTo(u,d,f,m,l,h);break}}return{offsetX:r.ha*e,path:o}}Da.prototype.isFont=!0;var iy=class extends dt{constructor(e){super(e)}load(e,t,n,i){let r=this,o=new Ot(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(r.withCredentials),o.load(e,function(a){let c;try{c=JSON.parse(a)}catch(h){console.warn("THREE.FontLoader: typeface.js support is being deprecated. Use typeface.json instead."),c=JSON.parse(a.substring(65,a.length-2))}let l=r.parse(c);t&&t(l)},n,i)}parse(e){return new Da(e)}},Rs,uh={getContext:function(){return Rs===void 0&&(Rs=new(window.AudioContext||window.webkitAudioContext)),Rs},setContext:function(s){Rs=s}},dh=class extends dt{constructor(e){super(e)}load(e,t,n,i){let r=this,o=new Ot(this.manager);o.setResponseType("arraybuffer"),o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(a){try{let c=a.slice(0);uh.getContext().decodeAudioData(c,function(h){t(h)})}catch(c){i?i(c):console.error(c),r.manager.itemError(e)}},n,i)}},fh=class extends ur{constructor(e,t,n=1){super(void 0,n);let i=new se().set(e),r=new se().set(t),o=new _(i.r,i.g,i.b),a=new _(r.r,r.g,r.b),c=Math.sqrt(Math.PI),l=c*Math.sqrt(.75);this.sh.coefficients[0].copy(o).add(a).multiplyScalar(c),this.sh.coefficients[1].copy(o).sub(a).multiplyScalar(l)}};fh.prototype.isHemisphereLightProbe=!0;var ph=class extends ur{constructor(e,t=1){super(void 0,t);let n=new se().set(e);this.sh.coefficients[0].set(n.r,n.g,n.b).multiplyScalar(2*Math.sqrt(Math.PI))}};ph.prototype.isAmbientLightProbe=!0;var mh=new le,gh=new le,ry=class{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new ot,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new ot,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(e){let t=this._cache;if(t.focus!==e.focus||t.fov!==e.fov||t.aspect!==e.aspect*this.aspect||t.near!==e.near||t.far!==e.far||t.zoom!==e.zoom||t.eyeSep!==this.eyeSep){t.focus=e.focus,t.fov=e.fov,t.aspect=e.aspect*this.aspect,t.near=e.near,t.far=e.far,t.zoom=e.zoom,t.eyeSep=this.eyeSep;let i=e.projectionMatrix.clone(),r=t.eyeSep/2,o=r*t.near/t.focus,a=t.near*Math.tan(Tn*t.fov*.5)/t.zoom,c,l;gh.elements[12]=-r,mh.elements[12]=r,c=-a*t.aspect+o,l=a*t.aspect+o,i.elements[0]=2*t.near/(l-c),i.elements[8]=(l+c)/(l-c),this.cameraL.projectionMatrix.copy(i),c=-a*t.aspect-o,l=a*t.aspect-o,i.elements[0]=2*t.near/(l-c),i.elements[8]=(l+c)/(l-c),this.cameraR.projectionMatrix.copy(i)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(gh),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(mh)}},xh=class{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=yh(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){let t=yh();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}};function yh(){return(typeof performance=="undefined"?Date:performance).now()}var Nn=new _,vh=new rt,sy=new _,Bn=new _,oy=class extends Se{constructor(){super();this.type="AudioLi
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
precision mediump float ;
precision mediump int ;
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
varying vec3 vOutputDirection ;
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
uniform sampler2D envMap ;
uniform int samples ;
uniform float weights [ n ] ;
uniform bool latitudinal ;
uniform float dTheta ;
uniform float mipInt ;
uniform vec3 poleAxis ;
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
$ { Va ( ) }
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
# define ENVMAP _TYPE _CUBE _UV
# include < cube _uv _reflection _fragment >
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
vec3 getSample ( float theta , vec3 axis ) {
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
float cosTheta = cos ( theta ) ;
// Rodrigues' axis-angle rotation
vec3 sampleDirection = vOutputDirection * cosTheta
+ cross ( axis , vOutputDirection ) * sin ( theta )
+ axis * dot ( axis , vOutputDirection ) * ( 1.0 - cosTheta ) ;
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
return bilinearCubeUV ( envMap , sampleDirection , mipInt ) ;
2021-03-29 21:59:16 +02:00
}
2021-05-11 13:53:06 +02:00
void main ( ) {
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
vec3 axis = latitudinal ? poleAxis : cross ( poleAxis , vOutputDirection ) ;
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
if ( all ( equal ( axis , vec3 ( 0.0 ) ) ) ) {
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
axis = vec3 ( vOutputDirection . z , 0.0 , - vOutputDirection . x ) ;
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
}
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
axis = normalize ( axis ) ;
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
gl _FragColor = vec4 ( 0.0 , 0.0 , 0.0 , 1.0 ) ;
gl _FragColor . rgb += weights [ 0 ] * getSample ( 0.0 , axis ) ;
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
for ( int i = 1 ; i < n ; i ++ ) {
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
if ( i >= samples ) {
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
break ;
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
}
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
float theta = dTheta * float ( i ) ;
gl _FragColor . rgb += weights [ i ] * getSample ( - 1.0 * theta , axis ) ;
gl _FragColor . rgb += weights [ i ] * getSample ( theta , axis ) ;
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
}
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
gl _FragColor = linearToOutputTexel ( gl _FragColor ) ;
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
}
` ,blending:en,depthTest:!1,depthWrite:!1})}function Kh(){let s=new W(1,1);return new gi({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null},texelSize:{value:s},inputEncoding:{value:Ht[yt]},outputEncoding:{value:Ht[yt]}},vertexShader:ka(),fragmentShader: `
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
precision mediump float ;
precision mediump int ;
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
varying vec3 vOutputDirection ;
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
uniform sampler2D envMap ;
uniform vec2 texelSize ;
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
$ { Va ( ) }
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
# include < common >
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
void main ( ) {
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
gl _FragColor = vec4 ( 0.0 , 0.0 , 0.0 , 1.0 ) ;
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
vec3 outputDirection = normalize ( vOutputDirection ) ;
vec2 uv = equirectUv ( outputDirection ) ;
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
vec2 f = fract ( uv / texelSize - 0.5 ) ;
uv -= f * texelSize ;
vec3 tl = envMapTexelToLinear ( texture2D ( envMap , uv ) ) . rgb ;
uv . x += texelSize . x ;
vec3 tr = envMapTexelToLinear ( texture2D ( envMap , uv ) ) . rgb ;
uv . y += texelSize . y ;
vec3 br = envMapTexelToLinear ( texture2D ( envMap , uv ) ) . rgb ;
uv . x -= texelSize . x ;
vec3 bl = envMapTexelToLinear ( texture2D ( envMap , uv ) ) . rgb ;
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
vec3 tm = mix ( tl , tr , f . x ) ;
vec3 bm = mix ( bl , br , f . x ) ;
gl _FragColor . rgb = mix ( tm , bm , f . y ) ;
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
gl _FragColor = linearToOutputTexel ( gl _FragColor ) ;
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
}
` ,blending:en,depthTest:!1,depthWrite:!1})}function eu(){return new gi({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},inputEncoding:{value:Ht[yt]},outputEncoding:{value:Ht[yt]}},vertexShader:ka(),fragmentShader: `
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
precision mediump float ;
precision mediump int ;
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
varying vec3 vOutputDirection ;
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
uniform samplerCube envMap ;
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
$ { Va ( ) }
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
void main ( ) {
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
gl _FragColor = vec4 ( 0.0 , 0.0 , 0.0 , 1.0 ) ;
gl _FragColor . rgb = envMapTexelToLinear ( textureCube ( envMap , vec3 ( - vOutputDirection . x , vOutputDirection . yz ) ) ) . rgb ;
gl _FragColor = linearToOutputTexel ( gl _FragColor ) ;
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
}
` ,blending:en,depthTest:!1,depthWrite:!1})}function ka(){return `
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
precision mediump float ;
precision mediump int ;
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
attribute vec3 position ;
attribute vec2 uv ;
attribute float faceIndex ;
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
varying vec3 vOutputDirection ;
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
// RH coordinate system; PMREM face-indexing convention
vec3 getDirection ( vec2 uv , float face ) {
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
uv = 2.0 * uv - 1.0 ;
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
vec3 direction = vec3 ( uv , 1.0 ) ;
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
if ( face == 0.0 ) {
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
direction = direction . zyx ; // ( 1, v, u ) pos x
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
} else if ( face == 1.0 ) {
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
direction = direction . xzy ;
direction . xz *= - 1.0 ; // ( -u, 1, -v ) pos y
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
} else if ( face == 2.0 ) {
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
direction . x *= - 1.0 ; // ( -u, v, 1 ) pos z
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
} else if ( face == 3.0 ) {
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
direction = direction . zyx ;
direction . xz *= - 1.0 ; // ( -1, v, -u ) neg x
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
} else if ( face == 4.0 ) {
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
direction = direction . xzy ;
direction . xy *= - 1.0 ; // ( -u, -1, v ) neg y
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
} else if ( face == 5.0 ) {
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
direction . z *= - 1.0 ; // ( u, v, -1 ) neg z
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
}
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
return direction ;
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
}
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
void main ( ) {
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
vOutputDirection = getDirection ( uv , faceIndex ) ;
gl _Position = vec4 ( position , 1.0 ) ;
2021-03-29 21:59:16 +02:00
}
2021-05-11 13:53:06 +02:00
` }function Va(){return `
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
uniform int inputEncoding ;
uniform int outputEncoding ;
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
# include < encodings _pars _fragment >
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
vec4 inputTexelToLinear ( vec4 value ) {
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
if ( inputEncoding == 0 ) {
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
return value ;
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
} else if ( inputEncoding == 1 ) {
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
return sRGBToLinear ( value ) ;
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
} else if ( inputEncoding == 2 ) {
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
return RGBEToLinear ( value ) ;
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
} else if ( inputEncoding == 3 ) {
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
return RGBMToLinear ( value , 7.0 ) ;
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
} else if ( inputEncoding == 4 ) {
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
return RGBMToLinear ( value , 16.0 ) ;
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
} else if ( inputEncoding == 5 ) {
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
return RGBDToLinear ( value , 256.0 ) ;
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
} else {
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
return GammaToLinear ( value , 2.2 ) ;
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
}
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
}
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
vec4 linearToOutputTexel ( vec4 value ) {
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
if ( outputEncoding == 0 ) {
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
return value ;
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
} else if ( outputEncoding == 1 ) {
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
return LinearTosRGB ( value ) ;
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
} else if ( outputEncoding == 2 ) {
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
return LinearToRGBE ( value ) ;
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
} else if ( outputEncoding == 3 ) {
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
return LinearToRGBM ( value , 7.0 ) ;
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
} else if ( outputEncoding == 4 ) {
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
return LinearToRGBM ( value , 16.0 ) ;
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
} else if ( outputEncoding == 5 ) {
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
return LinearToRGBD ( value , 256.0 ) ;
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
} else {
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
return LinearToGamma ( value , 2.2 ) ;
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
}
2021-03-29 21:59:16 +02:00
}
2021-05-11 13:53:06 +02:00
vec4 envMapTexelToLinear ( vec4 color ) {
2021-03-29 21:59:16 +02:00
2021-05-11 13:53:06 +02:00
return inputTexelToLinear ( color ) ;
2021-03-29 21:59:16 +02:00
}
2021-05-11 13:53:06 +02:00
` }var yv=0,vv=1,_v=0,wv=1,bv=2;function Mv(s){return console.warn("THREE.MeshFaceMaterial has been removed. Use an Array instead."),s}function Sv(s=[]){return console.warn("THREE.MultiMaterial has been removed. Use an Array instead."),s.isMultiMaterial=!0,s.materials=s,s.clone=function(){return s.slice()},s}function Tv(s,e){return console.warn("THREE.PointCloud has been renamed to THREE.Points."),new ji(s,e)}function Ev(s){return console.warn("THREE.Particle has been renamed to THREE.Sprite."),new is(s)}function Av(s,e){return console.warn("THREE.ParticleSystem has been renamed to THREE.Points."),new ji(s,e)}function Lv(s){return console.warn("THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial."),new Pn(s)}function Rv(s){return console.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial."),new Pn(s)}function Cv(s){return console.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial."),new Pn(s)}function Pv(s,e,t){return console.warn("THREE.Vertex has been removed. Use THREE.Vector3 instead."),new _(s,e,t)}function Iv(s,e){return console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setUsage( THREE.DynamicDrawUsage ) instead."),new Te(s,e).setUsage(Ii)}function Dv(s,e){return console.warn("THREE.Int8Attribute has been removed. Use new THREE.Int8BufferAttribute() instead."),new Ol(s,e)}function Fv(s,e){return console.warn("THREE.Uint8Attribute has been removed. Use new THREE.Uint8BufferAttribute() instead."),new Ul(s,e)}function Nv(s,e){return console.warn("THREE.Uint8ClampedAttribute has been removed. Use new THREE.Uint8ClampedBufferAttribute() instead."),new Hl(s,e)}function Bv(s,e){return console.warn("THREE.Int16Attribute has been removed. Use new THREE.Int16BufferAttribute() instead."),new Gl(s,e)}function zv(s,e){return console.warn("THREE.Uint16Attribute has been removed. Use new THREE.Uint16BufferAttribute() instead."),new Br(s,e)}function Ov(s,e){return console.warn("THREE.Int32Attribute has been removed. Use new THREE.Int32BufferAttribute() instead."),new kl(s,e)}function Uv(s,e){return console.warn("THREE.Uint32Attribute has been removed. Use new THREE.Uint32BufferAttribute() instead."),new zr(s,e)}function Hv(s,e){return console.warn("THREE.Float32Attribute has been removed. Use new THREE.Float32BufferAttribute() instead."),new ae(s,e)}function Gv(s,e){return console.warn("THREE.Float64Attribute has been removed. Use new THREE.Float64BufferAttribute() instead."),new Wl(s,e)}St.create=function(s,e){return console.log("THREE.Curve.create() has been deprecated"),s.prototype=Object.create(St.prototype),s.prototype.constructor=s,s.prototype.getPoint=e,s};lr.prototype.fromPoints=function(s){return console.warn("THREE.Path: .fromPoints() has been renamed to .setFromPoints()."),this.setFromPoints(s)};function kv(s){return console.warn("THREE.AxisHelper has been renamed to THREE.AxesHelper."),new Wh(s)}function Vv(s,e){return console.warn("THREE.BoundingBoxHelper has been deprecated. Creating a THREE.BoxHelper instead."),new kh(s,e)}function Wv(s,e){return console.warn("THREE.EdgesHelper has been removed. Use THREE.EdgesGeometry instead."),new _t(new Ho(s.geometry),new at({color:e!==void 0?e:16777215}))}Uh.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")};Nh.prototype.update=function(){console.error("THREE.SkeletonHelper: update() no longer needs to be called.")};function qv(s,e){return console.warn("THREE.WireframeHelper has been removed. Use THREE.WireframeGeometry instead."),new _t(new Qo(s.geometry),new at({color:e!==void 0?e:16777215}))}dt.prototype.extractUrlBase=function(s){return console.warn("THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead."),Ca.extractUrlBase(s)};dt.Handlers={add:function(){console.error("THREE.Loader: Handlers.add() has been removed. Use LoadingManager.addHandler() instead.")},get:function(){console.error("THREE.Loader: Handlers.get() has been removed. Use
/ * *
* @ license
* Copyright 2010 - 2021 Three . js Authors
* SPDX - License - Identifier : MIT
* /