照片墙/js/three.min.js

(开头部分) 499KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

// threejs.org/license
(function(m,na){"object"===typeof exports&&"undefined"!==typeof module?na(exports):"function"===typeof define&&define.amd?define(["exports"],na):na(m.THREE=m.THREE||{})})(this,function(m){function na(){}function D(a,b){this.x=a||0;this.y=b||0}function N(a,b,c,d,e,f,g,h,k,l){Object.defineProperty(this,"id",{value:lf++});this.uuid=R.generateUUID();this.name="";this.image=void 0!==a?a:N.DEFAULT_IMAGE;this.mipmaps=[];this.mapping=void 0!==b?b:N.DEFAULT_MAPPING;this.wrapS=void 0!==c?c:1001;this.wrapT=
void 0!==d?d:1001;this.magFilter=void 0!==e?e:1006;this.minFilter=void 0!==f?f:1008;this.anisotropy=void 0!==k?k:1;this.format=void 0!==g?g:1023;this.type=void 0!==h?h:1009;this.offset=new D(0,0);this.repeat=new D(1,1);this.generateMipmaps=!0;this.premultiplyAlpha=!1;this.flipY=!0;this.unpackAlignment=4;this.encoding=void 0!==l?l:3E3;this.version=0;this.onUpdate=null}function S(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=void 0!==d?d:1}function Ab(a,b,c){this.uuid=R.generateUUID();this.width=
a;this.height=b;this.scissor=new S(0,0,a,b);this.scissorTest=!1;this.viewport=new S(0,0,a,b);c=c||{};void 0===c.minFilter&&(c.minFilter=1006);this.texture=new N(void 0,void 0,c.wrapS,c.wrapT,c.magFilter,c.minFilter,c.format,c.type,c.anisotropy,c.encoding);this.depthBuffer=void 0!==c.depthBuffer?c.depthBuffer:!0;this.stencilBuffer=void 0!==c.stencilBuffer?c.stencilBuffer:!0;this.depthTexture=void 0!==c.depthTexture?c.depthTexture:null}function Bb(a,b,c){Ab.call(this,a,b,c);this.activeMipMapLevel=this.activeCubeFace=
0}function ia(a,b,c,d){this._x=a||0;this._y=b||0;this._z=c||0;this._w=void 0!==d?d:1}function n(a,b,c){this.x=a||0;this.y=b||0;this.z=c||0}function O(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];0<arguments.length&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}function bb(a,b,c,d,e,f,g,h,k,l,q,p){N.call(this,null,f,g,h,k,l,d,e,q,p);this.image={data:a,width:b,height:c};this.magFilter=void 0!==k?k:1003;this.minFilter=void 0!==l?l:1003;this.flipY=
this.generateMipmaps=!1;this.unpackAlignment=1}function Va(a,b,c,d,e,f,g,h,k,l){a=void 0!==a?a:[];N.call(this,a,void 0!==b?b:301,c,d,e,f,g,h,k,l);this.flipY=!1}function Cb(a,b,c){var d=a[0];if(0>=d||0<d)return a;var e=b*c,f=ye[e];void 0===f&&(f=new Float32Array(e),ye[e]=f);if(0!==b)for(d.toArray(f,0),d=1,e=0;d!==b;++d)e+=c,a[d].toArray(f,e);return f}function ze(a,b){var c=Ae[b];void 0===c&&(c=new Int32Array(b),Ae[b]=c);for(var d=0;d!==b;++d)c[d]=a.allocTextureUnit();return c}function mf(a,b){a.uniform1f(this.addr,
b)}function nf(a,b){a.uniform1i(this.addr,b)}function of(a,b){void 0===b.x?a.uniform2fv(this.addr,b):a.uniform2f(this.addr,b.x,b.y)}function pf(a,b){void 0!==b.x?a.uniform3f(this.addr,b.x,b.y,b.z):void 0!==b.r?a.uniform3f(this.addr,b.r,b.g,b.b):a.uniform3fv(this.addr,b)}function qf(a,b){void 0===b.x?a.uniform4fv(this.addr,b):a.uniform4f(this.addr,b.x,b.y,b.z,b.w)}function rf(a,b){a.uniformMatrix2fv(this.addr,!1,b.elements||b)}function sf(a,b){void 0===b.elements?a.uniformMatrix3fv(this.addr,!1,b):
(Be.set(b.elements),a.uniformMatrix3fv(this.addr,!1,Be))}function tf(a,b){void 0===b.elements?a.uniformMatrix4fv(this.addr,!1,b):(Ce.set(b.elements),a.uniformMatrix4fv(this.addr,!1,Ce))}function uf(a,b,c){var d=c.allocTextureUnit();a.uniform1i(this.addr,d);c.setTexture2D(b||De,d)}function vf(a,b,c){var d=c.allocTextureUnit();a.uniform1i(this.addr,d);c.setTextureCube(b||Ee,d)}function Fe(a,b){a.uniform2iv(this.addr,b)}function Ge(a,b){a.uniform3iv(this.addr,b)}function He(a,b){a.uniform4iv(this.addr,
b)}function wf(a){switch(a){case 5126:return mf;case 35664:return of;case 35665:return pf;case 35666:return qf;case 35674:return rf;case 35675:return sf;case 35676:return tf;case 35678:case 36198:return uf;case 35680:return vf;case 5124:case 35670:return nf;case 35667:case 35671:return Fe;case 35668:case 35672:return Ge;case 35669:case 35673:return He}}function xf(a,b){a.uniform1fv(this.addr,b)}function yf(a,b){a.uniform1iv(this.addr,b)}function zf(a,b){a.uniform2fv(this.addr,Cb(b,this.size,2))}function Af(a,
b){a.uniform3fv(this.addr,Cb(b,this.size,3))}function Bf(a,b){a.uniform4fv(this.addr,Cb(b,this.size,4))}function Cf(a,b){a.uniformMatrix2fv(this.addr,!1,Cb(b,this.size,4))}function Df(a,b){a.uniformMatrix3fv(this.addr,!1,Cb(b,this.size,9))}function Ef(a,b){a.uniformMatrix4fv(this.addr,!1,Cb(b,this.size,16))}function Ff(a,b,c){var d=b.length,e=ze(c,d);a.uniform1iv(this.addr,e);for(a=0;a!==d;++a)c.setTexture2D(b[a]||De,e[a])}function Gf(a,b,c){var d=b.length,e=ze(c,d);a.uniform1iv(this.addr,e);for(a=
0;a!==d;++a)c.setTextureCube(b[a]||Ee,e[a])}function Hf(a){switch(a){case 5126:return xf;case 35664:return zf;case 35665:return Af;case 35666:return Bf;case 35674:return Cf;case 35675:return Df;case 35676:return Ef;case 35678:return Ff;case 35680:return Gf;case 5124:case 35670:return yf;case 35667:case 35671:return Fe;case 35668:case 35672:return Ge;case 35669:case 35673:return He}}function If(a,b,c){this.id=a;this.addr=c;this.setValue=wf(b.type)}function Jf(a,b,c){this.id=a;this.addr=c;this.size=
b.size;this.setValue=Hf(b.type)}function Ie(a){this.id=a;this.seq=[];this.map={}}function cb(a,b,c){this.seq=[];this.map={};this.renderer=c;c=a.getProgramParameter(b,a.ACTIVE_UNIFORMS);for(var d=0;d<c;++d){var e=a.getActiveUniform(b,d),f=a.getUniformLocation(b,e.name),g=this,h=e.name,k=h.length;for(Pd.lastIndex=0;;){var l=Pd.exec(h),q=Pd.lastIndex,p=l[1],t=l[3];"]"===l[2]&&(p|=0);if(void 0===t||"["===t&&q+2===k){h=g;e=void 0===t?new If(p,e,f):new Jf(p,e,f);h.seq.push(e);h.map[e.id]=e;break}else t=
g.map[p],void 0===t&&(t=new Ie(p),p=g,g=t,p.seq.push(g),p.map[g.id]=g),g=t}}}function C(a,b,c){return void 0===b&&void 0===c?this.set(a):this.setRGB(a,b,c)}function id(a,b){this.min=void 0!==a?a:new D(Infinity,Infinity);this.max=void 0!==b?b:new D(-Infinity,-Infinity)}function Kf(a,b,c,d,e){var f,g,h,k,l,q,p,t,r,m,u,x,y,A,I,B;this.render=function(a,v,xa,la){if(0!==a.length){v=new n;var H=la.w/la.z,va=.5*la.z,jd=.5*la.w,J=16/la.w,Ga=new D(J*H,J),ga=new n(1,1,0),M=new D(1,1),T=new id;T.min.set(la.x,
la.y);T.max.set(la.x+(la.z-16),la.y+(la.w-16));if(void 0===A){var J=new Float32Array([-1,-1,0,0,1,-1,1,0,1,1,1,1,-1,1,0,1]),La=new Uint16Array([0,1,2,0,2,3]);u=b.createBuffer();x=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,u);b.bufferData(b.ARRAY_BUFFER,J,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,x);b.bufferData(b.ELEMENT_ARRAY_BUFFER,La,b.STATIC_DRAW);I=b.createTexture();B=b.createTexture();c.bindTexture(b.TEXTURE_2D,I);b.texImage2D(b.TEXTURE_2D,0,b.RGB,16,16,0,b.RGB,b.UNSIGNED_BYTE,null);
b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);c.bindTexture(b.TEXTURE_2D,B);b.texImage2D(b.TEXTURE_2D,0,b.RGBA,16,16,0,b.RGBA,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,
b.TEXTURE_MAG_FILTER,b.NEAREST);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);var J=y={vertexShader:"uniform lowp int renderType;\nuniform vec3 screenPosition;\nuniform vec2 scale;\nuniform float rotation;\nuniform sampler2D occlusionMap;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nvUV = uv;\nvec2 pos = position;\nif ( renderType == 2 ) {\nvec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.5, 0.1 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.9, 0.1 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.9, 0.9 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.1, 0.9 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.5, 0.5 ) );\nvVisibility =        visibility.r / 9.0;\nvVisibility *= 1.0 - visibility.g / 9.0;\nvVisibility *=       visibility.b / 9.0;\nvVisibility *= 1.0 - visibility.a / 9.0;\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",
fragmentShader:"uniform lowp int renderType;\nuniform sampler2D map;\nuniform float opacity;\nuniform vec3 color;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nif ( renderType == 0 ) {\ngl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );\n} else if ( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nvec4 texture = texture2D( map, vUV );\ntexture.a *= opacity * vVisibility;\ngl_FragColor = texture;\ngl_FragColor.rgb *= color;\n}\n}"},La=b.createProgram(),z=b.createShader(b.FRAGMENT_SHADER),
Y=b.createShader(b.VERTEX_SHADER),w="precision "+e.precision+" float;\n";b.shaderSource(z,w+J.fragmentShader);b.shaderSource(Y,w+J.vertexShader);b.compileShader(z);b.compileShader(Y);b.attachShader(La,z);b.attachShader(La,Y);b.linkProgram(La);A=La;r=b.getAttribLocation(A,"position");m=b.getAttribLocation(A,"uv");f=b.getUniformLocation(A,"renderType");g=b.getUniformLocation(A,"map");h=b.getUniformLocation(A,"occlusionMap");k=b.getUniformLocation(A,"opacity");l=b.getUniformLocation(A,"color");q=b.getUniformLocation(A,
"scale");p=b.getUniformLocation(A,"rotation");t=b.getUniformLocation(A,"screenPosition")}c.useProgram(A);c.initAttributes();c.enableAttribute(r);c.enableAttribute(m);c.disableUnusedAttributes();b.uniform1i(h,0);b.uniform1i(g,1);b.bindBuffer(b.ARRAY_BUFFER,u);b.vertexAttribPointer(r,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(m,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,x);c.disable(b.CULL_FACE);c.buffers.depth.setMask(!1);La=0;for(z=a.length;La<z;La++)if(J=16/la.w,Ga.set(J*H,J),Y=a[La],v.set(Y.matrixWorld.elements[12],
Y.matrixWorld.elements[13],Y.matrixWorld.elements[14]),v.applyMatrix4(xa.matrixWorldInverse),v.applyMatrix4(xa.projectionMatrix),ga.copy(v),M.x=la.x+ga.x*va+va-8,M.y=la.y+ga.y*jd+jd-8,!0===T.containsPoint(M)){c.activeTexture(b.TEXTURE0);c.bindTexture(b.TEXTURE_2D,null);c.activeTexture(b.TEXTURE1);c.bindTexture(b.TEXTURE_2D,I);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,M.x,M.y,16,16,0);b.uniform1i(f,0);b.uniform2f(q,Ga.x,Ga.y);b.uniform3f(t,ga.x,ga.y,ga.z);c.disable(b.BLEND);c.enable(b.DEPTH_TEST);b.drawElements(b.TRIANGLES,
6,b.UNSIGNED_SHORT,0);c.activeTexture(b.TEXTURE0);c.bindTexture(b.TEXTURE_2D,B);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,M.x,M.y,16,16,0);b.uniform1i(f,1);c.disable(b.DEPTH_TEST);c.activeTexture(b.TEXTURE1);c.bindTexture(b.TEXTURE_2D,I);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);Y.positionScreen.copy(ga);Y.customUpdateCallback?Y.customUpdateCallback(Y):Y.updateLensFlares();b.uniform1i(f,2);c.enable(b.BLEND);for(var w=0,F=Y.lensFlares.length;w<F;w++){var C=Y.lensFlares[w];.001<C.opacity&&.001<
C.scale&&(ga.x=C.x,ga.y=C.y,ga.z=C.z,J=C.size*C.scale/la.w,Ga.x=J*H,Ga.y=J,b.uniform3f(t,ga.x,ga.y,ga.z),b.uniform2f(q,Ga.x,Ga.y),b.uniform1f(p,C.rotation),b.uniform1f(k,C.opacity),b.uniform3f(l,C.color.r,C.color.g,C.color.b),c.setBlending(C.blending,C.blendEquation,C.blendSrc,C.blendDst),d.setTexture2D(C.texture,1),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0))}}c.enable(b.CULL_FACE);c.enable(b.DEPTH_TEST);c.buffers.depth.setMask(!0);c.reset()}}}function oc(a,b,c,d,e,f,g,h,k){N.call(this,a,b,
c,d,e,f,g,h,k);this.needsUpdate=!0}function Lf(a,b,c,d,e){var f,g,h,k,l,q,p,t,r,m,u,x,y,A,I,B,H;function va(a,b){return a.renderOrder!==b.renderOrder?a.renderOrder-b.renderOrder:a.z!==b.z?b.z-a.z:b.id-a.id}var xa,la,ba,Je,jd=new n,J=new ia,Ga=new n;this.render=function(v,n,T){if(0!==v.length){if(void 0===ba){var M=new Float32Array([-.5,-.5,0,0,.5,-.5,1,0,.5,.5,1,1,-.5,.5,0,1]),z=new Uint16Array([0,1,2,0,2,3]);xa=b.createBuffer();la=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,xa);b.bufferData(b.ARRAY_BUFFER,
M,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,la);b.bufferData(b.ELEMENT_ARRAY_BUFFER,z,b.STATIC_DRAW);M=b.createProgram();z=b.createShader(b.VERTEX_SHADER);var w=b.createShader(b.FRAGMENT_SHADER);b.shaderSource(z,["precision "+e.precision+" float;","#define SHADER_NAME SpriteMaterial\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform float rotation;\nuniform vec2 scale;\nuniform vec2 uvOffset;\nuniform vec2 uvScale;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvoid main() {\nvUV = uvOffset + uv * uvScale;\nvec2 alignedPosition = position * scale;\nvec2 rotatedPosition;\nrotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\nrotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\nvec4 finalPosition;\nfinalPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\nfinalPosition.xy += rotatedPosition;\nfinalPosition = projectionMatrix * finalPosition;\ngl_Position = finalPosition;\n}"].join("\n"));
b.shaderSource(w,["precision "+e.precision+" float;","#define SHADER_NAME SpriteMaterial\nuniform vec3 color;\nuniform sampler2D map;\nuniform float opacity;\nuniform int fogType;\nuniform vec3 fogColor;\nuniform float fogDensity;\nuniform float fogNear;\nuniform float fogFar;\nuniform float alphaTest;\nvarying vec2 vUV;\nvoid main() {\nvec4 texture = texture2D( map, vUV );\nif ( texture.a < alphaTest ) discard;\ngl_FragColor = vec4( color * texture.xyz, texture.a * opacity );\nif ( fogType > 0 ) {\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\nfloat fogFactor = 0.0;\nif ( fogType == 1 ) {\nfogFactor = smoothstep( fogNear, fogFar, depth );\n} else {\nconst float LOG2 = 1.442695;\nfogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n}\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n}\n}"].join("\n"));
b.compileShader(z);b.compileShader(w);b.attachShader(M,z);b.attachShader(M,w);b.linkProgram(M);ba=M;B=b.getAttribLocation(ba,"position");H=b.getAttribLocation(ba,"uv");f=b.getUniformLocation(ba,"uvOffset");g=b.getUniformLocation(ba,"uvScale");h=b.getUniformLocation(ba,"rotation");k=b.getUniformLocation(ba,"scale");l=b.getUniformLocation(ba,"color");q=b.getUniformLocation(ba,"map");p=b.getUniformLocation(ba,"opacity");t=b.getUniformLocation(ba,"modelViewMatrix");r=b.getUniformLocation(ba,"projectionMatrix");
m=b.getUniformLocation(ba,"fogType");u=b.getUniformLocation(ba,"fogDensity");x=b.getUniformLocation(ba,"fogNear");y=b.getUniformLocation(ba,"fogFar");A=b.getUniformLocation(ba,"fogColor");I=b.getUniformLocation(ba,"alphaTest");M=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");M.width=8;M.height=8;z=M.getContext("2d");z.fillStyle="white";z.fillRect(0,0,8,8);Je=new oc(M)}c.useProgram(ba);c.initAttributes();c.enableAttribute(B);c.enableAttribute(H);c.disableUnusedAttributes();c.disable(b.CULL_FACE);
c.enable(b.BLEND);b.bindBuffer(b.ARRAY_BUFFER,xa);b.vertexAttribPointer(B,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(H,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,la);b.uniformMatrix4fv(r,!1,T.projectionMatrix.elements);c.activeTexture(b.TEXTURE0);b.uniform1i(q,0);z=M=0;(w=n.fog)?(b.uniform3f(A,w.color.r,w.color.g,w.color.b),w.isFog?(b.uniform1f(x,w.near),b.uniform1f(y,w.far),b.uniform1i(m,1),z=M=1):w.isFogExp2&&(b.uniform1f(u,w.density),b.uniform1i(m,2),z=M=2)):(b.uniform1i(m,0),z=M=0);
for(var D=0,C=v.length;D<C;D++)w=v[D],w.modelViewMatrix.multiplyMatrices(T.matrixWorldInverse,w.matrixWorld),w.z=-w.modelViewMatrix.elements[14];v.sort(va);for(var ga=[],D=0,C=v.length;D<C;D++){w=v[D];var G=w.material;if(!1!==G.visible){w.onBeforeRender(a,n,T,void 0,G,void 0);b.uniform1f(I,G.alphaTest);b.uniformMatrix4fv(t,!1,w.modelViewMatrix.elements);w.matrixWorld.decompose(jd,J,Ga);ga[0]=Ga.x;ga[1]=Ga.y;var F=0;n.fog&&G.fog&&(F=z);M!==F&&(b.uniform1i(m,F),M=F);null!==G.map?(b.uniform2f(f,G.map.offset.x,
G.map.offset.y),b.uniform2f(g,G.map.repeat.x,G.map.repeat.y)):(b.uniform2f(f,0,0),b.uniform2f(g,1,1));b.uniform1f(p,G.opacity);b.uniform3f(l,G.color.r,G.color.g,G.color.b);b.uniform1f(h,G.rotation);b.uniform2fv(k,ga);c.setBlending(G.blending,G.blendEquation,G.blendSrc,G.blendDst,G.blendEquationAlpha,G.blendSrcAlpha,G.blendDstAlpha,G.premultipliedAlpha);c.buffers.depth.setTest(G.depthTest);c.buffers.depth.setMask(G.depthWrite);d.setTexture2D(G.map||Je,0);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,
0);w.onAfterRender(a,n,T,void 0,G,void 0)}}c.enable(b.CULL_FACE);c.reset()}}}function P(){Object.defineProperty(this,"id",{value:Mf++});this.uuid=R.generateUUID();this.name="";this.type="Material";this.lights=this.fog=!0;this.blending=1;this.side=0;this.flatShading=!1;this.vertexColors=0;this.opacity=1;this.transparent=!1;this.blendSrc=204;this.blendDst=205;this.blendEquation=100;this.blendEquationAlpha=this.blendDstAlpha=this.blendSrcAlpha=null;this.depthFunc=3;this.depthWrite=this.depthTest=!0;
this.clippingPlanes=null;this.clipShadows=this.clipIntersection=!1;this.colorWrite=!0;this.precision=null;this.polygonOffset=!1;this.polygonOffsetUnits=this.polygonOffsetFactor=0;this.dithering=!1;this.alphaTest=0;this.premultipliedAlpha=!1;this.overdraw=0;this.visible=!0;this.userData={};this.needsUpdate=!0}function ya(a){P.call(this);this.type="ShaderMaterial";this.defines={};this.uniforms={};this.vertexShader="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}";
this.fragmentShader="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}";this.linewidth=1;this.wireframe=!1;this.wireframeLinewidth=1;this.morphNormals=this.morphTargets=this.skinning=this.clipping=this.lights=this.fog=!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;void 0!==a&&(void 0!==a.attributes&&console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."),
this.setValues(a))}function Wa(a){P.call(this);this.type="MeshDepthMaterial";this.depthPacking=3200;this.morphTargets=this.skinning=!1;this.displacementMap=this.alphaMap=this.map=null;this.displacementScale=1;this.displacementBias=0;this.wireframe=!1;this.wireframeLinewidth=1;this.lights=this.fog=!1;this.setValues(a)}function Xa(a){P.call(this);this.type="MeshDistanceMaterial";this.referencePosition=new n;this.nearDistance=1;this.farDistance=1E3;this.morphTargets=this.skinning=!1;this.displacementMap=
this.alphaMap=this.map=null;this.displacementScale=1;this.displacementBias=0;this.lights=this.fog=!1;this.setValues(a)}function Pa(a,b){this.min=void 0!==a?a:new n(Infinity,Infinity,Infinity);this.max=void 0!==b?b:new n(-Infinity,-Infinity,-Infinity)}function Ca(a,b){this.center=void 0!==a?a:new n;this.radius=void 0!==b?b:0}function qa(){this.elements=[1,0,0,0,1,0,0,0,1];0<arguments.length&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}function za(a,
b){this.normal=void 0!==a?a:new n(1,0,0);this.constant=void 0!==b?b:0}function kd(a,b,c,d,e,f){this.planes=[void 0!==a?a:new za,void 0!==b?b:new za,void 0!==c?c:new za,void 0!==d?d:new za,void 0!==e?e:new za,void 0!==f?f:new za]}function Ke(a,b,c){function d(b,c,d,e,f,g){var h=b.geometry;var l=p;var k=b.customDepthMaterial;d&&(l=t,k=b.customDistanceMaterial);k?l=k:(k=!1,c.morphTargets&&(h&&h.isBufferGeometry?k=h.morphAttributes&&h.morphAttributes.position&&0<h.morphAttributes.position.length:h&&h.isGeometry&&
(k=h.morphTargets&&0<h.morphTargets.length)),b.isSkinnedMesh&&!1===c.skinning&&console.warn("THREE.WebGLShadowMap: THREE.SkinnedMesh with material.skinning set to false:",b),b=b.isSkinnedMesh&&c.skinning,h=0,k&&(h|=1),b&&(h|=2),l=l[h]);a.localClippingEnabled&&!0===c.clipShadows&&0!==c.clippingPlanes.length&&(h=l.uuid,k=c.uuid,b=r[h],void 0===b&&(b={},r[h]=b),h=b[k],void 0===h&&(h=l.clone(),b[k]=h),l=h);l.visible=c.visible;l.wireframe=c.wireframe;k=c.side;B.renderSingleSided&&2==k&&(k=0);B.renderReverseSided&&
(0===k?k=1:1===k&&(k=0));l.side=k;l.clipShadows=c.clipShadows;l.clippingPlanes=c.clippingPlanes;l.clipIntersection=c.clipIntersection;l.wireframeLinewidth=c.wireframeLinewidth;l.linewidth=c.linewidth;d&&l.isMeshDistanceMaterial&&(l.referencePosition.copy(e),l.nearDistance=f,l.farDistance=g);return l}function e(c,g,h,l){var k;if(!1!==c.visible){if(c.layers.test(g.layers)&&(c.isMesh||c.isLine||c.isPoints)&&c.castShadow&&(!c.frustumCulled||f.intersectsObject(c))){c.modelViewMatrix.multiplyMatrices(h.matrixWorldInverse,
c.matrixWorld);var p=b.update(c),t=c.material;if(Array.isArray(t))for(var r=p.groups,A=0,m=r.length;A<m;A++){var v=r[A];(k=t[v.materialIndex])&&k.visible&&(k=d(c,k,l,q,h.near,h.far),a.renderBufferDirect(h,null,p,k,c,v))}else t.visible&&(k=d(c,t,l,q,h.near,h.far),a.renderBufferDirect(h,null,p,k,c,null))}c=c.children;p=0;for(t=c.length;p<t;p++)e(c[p],g,h,l)}}var f=new kd,g=new O,h=new D,k=new D(c,c),l=new n,q=new n,p=Array(4),t=Array(4),r={},m=[new n(1,0,0),new n(-1,0,0),new n(0,0,1),new n(0,0,-1),
new n(0,1,0),new n(0,-1,0)],u=[new n(0,1,0),new n(0,1,0),new n(0,1,0),new n(0,1,0),new n(0,0,1),new n(0,0,-1)],x=[new S,new S,new S,new S,new S,new S];for(c=0;4!==c;++c){var y=0!==(c&1),A=0!==(c&2),I=new Wa({depthPacking:3201,morphTargets:y,skinning:A});p[c]=I;y=new Xa({morphTargets:y,skinning:A});t[c]=y}var B=this;this.enabled=!1;this.autoUpdate=!0;this.needsUpdate=!1;this.type=1;this.renderSingleSided=this.renderReverseSided=!0;this.render=function(b,c,d){if(!1!==B.enabled&&(!1!==B.autoUpdate||
!1!==B.needsUpdate)&&0!==b.length){var p=a.state;p.disable(a.context.BLEND);p.buffers.color.setClear(1,1,1,1);p.buffers.depth.setTest(!0);p.setScissorTest(!1);for(var t,r=0,A=b.length;r<A;r++){var v=b[r];t=v.shadow;var I=v&&v.isPointLight;if(void 0===t)console.warn("THREE.WebGLShadowMap:",v,"has no shadow.");else{var n=t.camera;h.copy(t.mapSize);h.min(k);if(I){var y=h.x,H=h.y;x[0].set(2*y,H,y,H);x[1].set(0,H,y,H);x[2].set(3*y,H,y,H);x[3].set(y,H,y,H);x[4].set(3*y,0,y,H);x[5].set(y,0,y,H);h.x*=4;h.y*=
2}null===t.map&&(t.map=new Ab(h.x,h.y,{minFilter:1003,magFilter:1003,format:1023}),t.map.texture.name=v.name+".shadowMap",n.updateProjectionMatrix());t.isSpotLightShadow&&t.update(v);y=t.map;H=t.matrix;q.setFromMatrixPosition(v.matrixWorld);n.position.copy(q);I?(t=6,H.makeTranslation(-q.x,-q.y,-q.z)):(t=1,l.setFromMatrixPosition(v.target.matrixWorld),n.lookAt(l),n.updateMatrixWorld(),H.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),H.multiply(n.projectionMatrix),H.multiply(n.matrixWorldInverse));a.setRenderTarget(y);
a.clear();for(v=0;v<t;v++)I&&(l.copy(n.position),l.add(m[v]),n.up.copy(u[v]),n.lookAt(l),n.updateMatrixWorld(),p.viewport(x[v])),g.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),f.setFromMatrix(g),e(c,d,n,I)}}B.needsUpdate=!1}}}function Nf(a){var b={};return{get:function(a){a.isInterleavedBufferAttribute&&(a=a.data);return b[a.uuid]},remove:function(c){c.isInterleavedBufferAttribute&&(c=c.data);var d=b[c.uuid];d&&(a.deleteBuffer(d.buffer),delete b[c.uuid])},update:function(c,d){c.isInterleavedBufferAttribute&&
(c=c.data);var e=b[c.uuid];if(void 0===e){var e=c.uuid,f=c.array,g=c.dynamic?a.DYNAMIC_DRAW:a.STATIC_DRAW,h=a.createBuffer();a.bindBuffer(d,h);a.bufferData(d,f,g);c.onUploadCallback();d=a.FLOAT;f instanceof Float32Array?d=a.FLOAT:f instanceof Float64Array?console.warn("THREE.WebGLAttributes: Unsupported data buffer format: Float64Array."):f instanceof Uint16Array?d=a.UNSIGNED_SHORT:f instanceof Int16Array?d=a.SHORT:f instanceof Uint32Array?d=a.UNSIGNED_INT:f instanceof Int32Array?d=a.INT:f instanceof
Int8Array?d=a.BYTE:f instanceof Uint8Array&&(d=a.UNSIGNED_BYTE);b[e]={buffer:h,type:d,bytesPerElement:f.BYTES_PER_ELEMENT,version:c.version}}else e.version<c.version&&(f=c,h=f.array,g=f.updateRange,a.bindBuffer(d,e.buffer),!1===f.dynamic?a.bufferData(d,h,a.STATIC_DRAW):-1===g.count?a.bufferSubData(d,0,h):0===g.count?console.error("THREE.WebGLObjects.updateBuffer: dynamic THREE.BufferAttribute marked as needsUpdate but updateRange.count is 0, ensure you are using set methods or updating manually."):
(a.bufferSubData(d,g.offset*h.BYTES_PER_ELEMENT,h.subarray(g.offset,g.offset+g.count)),g.count=-1),e.version=c.version)}}}function Ya(a,b,c,d){this._x=a||0;this._y=b||0;this._z=c||0;this._order=d||Ya.DefaultOrder}function Qd(){this.mask=1}function w(){Object.defineProperty(this,"id",{value:Of++});this.uuid=R.generateUUID();this.name="";this.type="Object3D";this.parent=null;this.children=[];this.up=w.DefaultUp.clone();var a=new n,b=new Ya,c=new ia,d=new n(1,1,1);b.onChange(function(){c.setFromEuler(b,
!1)});c.onChange(function(){b.setFromQuaternion(c,void 0,!1)});Object.defineProperties(this,{position:{enumerable:!0,value:a},rotation:{enumerable:!0,value:b},quaternion:{enumerable:!0,value:c},scale:{enumerable:!0,value:d},modelViewMatrix:{value:new O},normalMatrix:{value:new qa}});this.matrix=new O;this.matrixWorld=new O;this.matrixAutoUpdate=w.DefaultMatrixAutoUpdate;this.matrixWorldNeedsUpdate=!1;this.layers=new Qd;this.visible=!0;this.receiveShadow=this.castShadow=!1;this.frustumCulled=!0;this.renderOrder=
0;this.userData={}}function Ma(){w.call(this);this.type="Camera";this.matrixWorldInverse=new O;this.projectionMatrix=new O}function Db(a,b,c,d,e,f){Ma.call(this);this.type="OrthographicCamera";this.zoom=1;this.view=null;this.left=a;this.right=b;this.top=c;this.bottom=d;this.near=void 0!==e?e:.1;this.far=void 0!==f?f:2E3;this.updateProjectionMatrix()}function ja(a,b,c,d){Ma.call(this);this.type="PerspectiveCamera";this.fov=void 0!==a?a:50;this.zoom=1;this.near=void 0!==c?c:.1;this.far=void 0!==d?d:
2E3;this.focus=10;this.aspect=void 0!==b?b:1;this.view=null;this.filmGauge=35;this.filmOffset=0;this.updateProjectionMatrix()}function Qa(a,b,c,d,e,f){this.a=a;this.b=b;this.c=c;this.normal=d&&d.isVector3?d:new n;this.vertexNormals=Array.isArray(d)?d:[];this.color=e&&e.isColor?e:new C;this.vertexColors=Array.isArray(e)?e:[];this.materialIndex=void 0!==f?f:0}function Q(){Object.defineProperty(this,"id",{value:Rd++});this.uuid=R.generateUUID();this.name="";this.type="Geometry";this.vertices=[];this.colors=
[];this.faces=[];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphNormals=[];this.skinWeights=[];this.skinIndices=[];this.lineDistances=[];this.boundingSphere=this.boundingBox=null;this.groupsNeedUpdate=this.lineDistancesNeedUpdate=this.colorsNeedUpdate=this.normalsNeedUpdate=this.uvsNeedUpdate=this.verticesNeedUpdate=this.elementsNeedUpdate=!1}function K(a,b,c){if(Array.isArray(a))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.uuid=R.generateUUID();this.name=
"";this.array=a;this.itemSize=b;this.count=void 0!==a?a.length/b:0;this.normalized=!0===c;this.dynamic=!1;this.updateRange={offset:0,count:-1};this.onUploadCallback=function(){};this.version=0}function pc(a,b){K.call(this,new Int8Array(a),b)}function qc(a,b){K.call(this,new Uint8Array(a),b)}function rc(a,b){K.call(this,new Uint8ClampedArray(a),b)}function sc(a,b){K.call(this,new Int16Array(a),b)}function db(a,b){K.call(this,new Uint16Array(a),b)}function tc(a,b){K.call(this,new Int32Array(a),b)}function eb(a,
b){K.call(this,new Uint32Array(a),b)}function z(a,b){K.call(this,new Float32Array(a),b)}function uc(a,b){K.call(this,new Float64Array(a),b)}function Le(){this.indices=[];this.vertices=[];this.normals=[];this.colors=[];this.uvs=[];this.uvs2=[];this.groups=[];this.morphTargets={};this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.groupsNeedUpdate=this.uvsNeedUpdate=this.colorsNeedUpdate=this.normalsNeedUpdate=this.verticesNeedUpdate=!1}function Sd(a){if(0===a.length)return-Infinity;
for(var b=a[0],c=1,d=a.length;c<d;++c)a[c]>b&&(b=a[c]);return b}function F(){Object.defineProperty(this,"id",{value:Rd++});this.uuid=R.generateUUID();this.name="";this.type="BufferGeometry";this.index=null;this.attributes={};this.morphAttributes={};this.groups=[];this.boundingSphere=this.boundingBox=null;this.drawRange={start:0,count:Infinity}}function Eb(a,b,c,d,e,f){Q.call(this);this.type="BoxGeometry";this.parameters={width:a,height:b,depth:c,widthSegments:d,heightSegments:e,depthSegments:f};this.fromBufferGeometry(new fb(a,
b,c,d,e,f));this.mergeVertices()}function fb(a,b,c,d,e,f){function g(a,b,c,d,e,f,g,m,va,xa,la){var A=f/va,v=g/xa,u=f/2,x=g/2,I=m/2;g=va+1;var B=xa+1,y=f=0,H,w,z=new n;for(w=0;w<B;w++){var D=w*v-x;for(H=0;H<g;H++)z[a]=(H*A-u)*d,z[b]=D*e,z[c]=I,l.push(z.x,z.y,z.z),z[a]=0,z[b]=0,z[c]=0<m?1:-1,q.push(z.x,z.y,z.z),p.push(H/va),p.push(1-w/xa),f+=1}for(w=0;w<xa;w++)for(H=0;H<va;H++)a=t+H+g*(w+1),b=t+(H+1)+g*(w+1),c=t+(H+1)+g*w,k.push(t+H+g*w,a,c),k.push(a,b,c),y+=6;h.addGroup(r,y,la);r+=y;t+=f}F.call(this);
this.type="BoxBufferGeometry";this.parameters={width:a,height:b,depth:c,widthSegments:d,heightSegments:e,depthSegments:f};var h=this;d=Math.floor(d)||1;e=Math.floor(e)||1;f=Math.floor(f)||1;var k=[],l=[],q=[],p=[],t=0,r=0;g("z","y","x",-1,-1,c,b,a,f,e,0);g("z","y","x",1,-1,c,b,-a,f,e,1);g("x","z","y",1,1,a,c,b,d,f,2);g("x","z","y",1,-1,a,c,-b,d,f,3);g("x","y","z",1,-1,a,b,c,d,e,4);g("x","y","z",-1,-1,a,b,-c,d,e,5);this.setIndex(k);this.addAttribute("position",new z(l,3));this.addAttribute("normal",
new z(q,3));this.addAttribute("uv",new z(p,2))}function vc(a,b,c,d){Q.call(this);this.type="PlaneGeometry";this.parameters={width:a,height:b,widthSegments:c,heightSegments:d};this.fromBufferGeometry(new gb(a,b,c,d));this.mergeVertices()}function gb(a,b,c,d){F.call(this);this.type="PlaneBufferGeometry";this.parameters={width:a,height:b,widthSegments:c,heightSegments:d};var e=a/2,f=b/2;c=Math.floor(c)||1;d=Math.floor(d)||1;var g=c+1,h=d+1,k=a/c,l=b/d,q=[],p=[],t=[],r=[];for(a=0;a<h;a++){var m=a*l-f;
for(b=0;b<g;b++)p.push(b*k-e,-m,0),t.push(0,0,1),r.push(b/c),r.push(1-a/d)}for(a=0;a<d;a++)for(b=0;b<c;b++)e=b+g*(a+1),f=b+1+g*(a+1),h=b+1+g*a,q.push(b+g*a,e,h),q.push(e,f,h);this.setIndex(q);this.addAttribute("position",new z(p,3));this.addAttribute("normal",new z(t,3));this.addAttribute("uv",new z(r,2))}function sa(a){P.call(this);this.type="MeshBasicMaterial";this.color=new C(16777215);this.lightMap=this.map=null;this.lightMapIntensity=1;this.aoMap=null;this.aoMapIntensity=1;this.envMap=this.alphaMap=
this.specularMap=null;this.combine=0;this.reflectivity=1;this.refractionRatio=.98;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap="round";this.lights=this.morphTargets=this.skinning=!1;this.setValues(a)}function hb(a,b){this.origin=void 0!==a?a:new n;this.direction=void 0!==b?b:new n}function Fb(a,b){this.start=void 0!==a?a:new n;this.end=void 0!==b?b:new n}function Ra(a,b,c){this.a=void 0!==a?a:new n;this.b=void 0!==b?b:new n;this.c=void 0!==c?c:new n}function fa(a,
b){w.call(this);this.type="Mesh";this.geometry=void 0!==a?a:new F;this.material=void 0!==b?b:new sa({color:16777215*Math.random()});this.drawMode=0;this.updateMorphTargets()}function Pf(a,b,c,d){function e(a,c){b.buffers.color.setClear(a.r,a.g,a.b,c,d)}var f=new C(0),g=0,h,k,l;return{getClearColor:function(){return f},setClearColor:function(a,b){f.set(a);g=void 0!==b?b:1;e(f,g)},getClearAlpha:function(){return g},setClearAlpha:function(a){g=a;e(f,g)},render:function(b,d,t,r){d=d.background;null===
d?e(f,g):d&&d.isColor&&(e(d,1),r=!0);(a.autoClear||r)&&a.clear(a.autoClearColor,a.autoClearDepth,a.autoClearStencil);d&&d.isCubeTexture?(void 0===l&&(l=new fa(new fb(1,1,1),new ya({uniforms:ib.cube.uniforms,vertexShader:ib.cube.vertexShader,fragmentShader:ib.cube.fragmentShader,side:1,depthTest:!0,depthWrite:!1,polygonOffset:!0,fog:!1})),l.geometry.removeAttribute("normal"),l.geometry.removeAttribute("uv"),l.onBeforeRender=function(a,b,c){a=c.far;this.matrixWorld.makeScale(a,a,a);this.matrixWorld.copyPosition(c.matrixWorld);
后面还有 357+ 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。