|
@@ -199,8 +199,8 @@ l=e[a+5],t.set(k,n,l),k=e[a+6],n=e[a+7],l=e[a+8],s.set(k,n,l),m.subVectors(s,t),
|
|
|
ha.z=d[3*a+2];Aa.copy(ha);T=g[a];E.copy(T);E.sub(ha.multiplyScalar(ha.dot(T))).normalize();S.crossVectors(Aa,T);ca=S.dot(i[a]);G=0>ca?-1:1;h[4*a]=E.x;h[4*a+1]=E.y;h[4*a+2]=E.z;h[4*a+3]=G}if(void 0===this.attributes.index||void 0===this.attributes.position||void 0===this.attributes.normal||void 0===this.attributes.uv)console.warn("Missing required attributes (index, position, normal or uv) in BufferGeometry.computeTangents()");else{var b=this.attributes.index.array,c=this.attributes.position.array,
|
|
|
d=this.attributes.normal.array,e=this.attributes.uv.array,f=c.length/3;void 0===this.attributes.tangent&&(this.attributes.tangent={itemSize:4,array:new Float32Array(4*f)});for(var h=this.attributes.tangent.array,g=[],i=[],k=0;k<f;k++)g[k]=new THREE.Vector3,i[k]=new THREE.Vector3;var n,l,p,t,s,m,r,u,q,v,z,D,K,F,H,f=new THREE.Vector3,k=new THREE.Vector3,w,I,N,x,C,y,L,A=this.offsets;N=0;for(x=A.length;N<x;++N){I=A[N].start;C=A[N].count;var M=A[N].index;w=I;for(I+=C;w<I;w+=3)C=M+b[w],y=M+b[w+1],L=M+b[w+
|
|
|
2],n=c[3*C],l=c[3*C+1],p=c[3*C+2],t=c[3*y],s=c[3*y+1],m=c[3*y+2],r=c[3*L],u=c[3*L+1],q=c[3*L+2],v=e[2*C],z=e[2*C+1],D=e[2*y],K=e[2*y+1],F=e[2*L],H=e[2*L+1],t-=n,n=r-n,s-=l,l=u-l,m-=p,p=q-p,D-=v,v=F-v,K-=z,z=H-z,H=1/(D*z-v*K),f.set((z*t-K*n)*H,(z*s-K*l)*H,(z*m-K*p)*H),k.set((D*n-v*t)*H,(D*l-v*s)*H,(D*p-v*m)*H),g[C].add(f),g[y].add(f),g[L].add(f),i[C].add(k),i[y].add(k),i[L].add(k)}var E=new THREE.Vector3,S=new THREE.Vector3,ha=new THREE.Vector3,Aa=new THREE.Vector3,G,T,ca;N=0;for(x=A.length;N<x;++N){I=
|
|
|
-A[N].start;C=A[N].count;M=A[N].index;w=I;for(I+=C;w<I;w+=3)C=M+b[w],y=M+b[w+1],L=M+b[w+2],a(C),a(y),a(L)}this.tangentsNeedUpdate=this.hasTangents=!0}},clone:function(){var a=new THREE.BufferGeometry,b=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],c;for(c in this.attributes){for(var d=this.attributes[c],e=d.array,f={itemSize:d.itemSize,numItems:d.numItems,array:null},d=0,h=b.length;d<h;d++){var g=b[d];if(e instanceof g){f.array=new g(e);
|
|
|
-break}}a.attributes[c]=f}d=0;for(h=this.offsets.length;d<h;d++)b=this.offsets[d],a.offsets.push({start:b.start,index:b.index,count:b.count});return a},dispose:function(){this.dispatchEvent({type:"dispose"})}};THREE.EventDispatcher.prototype.apply(THREE.BufferGeometry.prototype);THREE.Camera=function(){THREE.Object3D.call(this);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4};THREE.Camera.prototype=Object.create(THREE.Object3D.prototype);THREE.Camera.prototype.lookAt=function(){var a=new THREE.Matrix4;return function(b){a.lookAt(this.position,b,this.up);this.quaternion.setFromRotationMatrix(a)}}();
|
|
|
+A[N].start;C=A[N].count;M=A[N].index;w=I;for(I+=C;w<I;w+=3)C=M+b[w],y=M+b[w+1],L=M+b[w+2],a(C),a(y),a(L)}this.tangentsNeedUpdate=this.hasTangents=!0}},clone:function(){var a=new THREE.BufferGeometry,b=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],c;for(c in this.attributes){for(var d=this.attributes[c],e=d.array,f={itemSize:d.itemSize,array:null},d=0,h=b.length;d<h;d++){var g=b[d];if(e instanceof g){f.array=new g(e);break}}a.attributes[c]=
|
|
|
+f}d=0;for(h=this.offsets.length;d<h;d++)b=this.offsets[d],a.offsets.push({start:b.start,index:b.index,count:b.count});return a},dispose:function(){this.dispatchEvent({type:"dispose"})}};THREE.EventDispatcher.prototype.apply(THREE.BufferGeometry.prototype);THREE.Camera=function(){THREE.Object3D.call(this);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4};THREE.Camera.prototype=Object.create(THREE.Object3D.prototype);THREE.Camera.prototype.lookAt=function(){var a=new THREE.Matrix4;return function(b){a.lookAt(this.position,b,this.up);this.quaternion.setFromRotationMatrix(a)}}();
|
|
|
THREE.Camera.prototype.clone=function(a){void 0===a&&(a=new THREE.Camera);THREE.Object3D.prototype.clone.call(this,a);a.matrixWorldInverse.copy(this.matrixWorldInverse);a.projectionMatrix.copy(this.projectionMatrix);return a};THREE.OrthographicCamera=function(a,b,c,d,e,f){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=d;this.near=void 0!==e?e:0.1;this.far=void 0!==f?f:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=Object.create(THREE.Camera.prototype);THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix.makeOrthographic(this.left,this.right,this.top,this.bottom,this.near,this.far)};
|
|
|
THREE.OrthographicCamera.prototype.clone=function(){var a=new THREE.OrthographicCamera;THREE.Camera.prototype.clone.call(this,a);a.left=this.left;a.right=this.right;a.top=this.top;a.bottom=this.bottom;a.near=this.near;a.far=this.far;return a};THREE.PerspectiveCamera=function(a,b,c,d){THREE.Camera.call(this);this.fov=void 0!==a?a:50;this.aspect=void 0!==b?b:1;this.near=void 0!==c?c:0.1;this.far=void 0!==d?d:2E3;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype=Object.create(THREE.Camera.prototype);THREE.PerspectiveCamera.prototype.setLens=function(a,b){void 0===b&&(b=24);this.fov=2*THREE.Math.radToDeg(Math.atan(b/(2*a)));this.updateProjectionMatrix()};
|
|
|
THREE.PerspectiveCamera.prototype.setViewOffset=function(a,b,c,d,e,f){this.fullWidth=a;this.fullHeight=b;this.x=c;this.y=d;this.width=e;this.height=f;this.updateProjectionMatrix()};
|
|
@@ -378,119 +378,119 @@ a.material.materials[b.materialIndex]:a.material}function e(a){return a instance
|
|
|
i,j.FLOAT,!1,0,4*d*i)):a.defaultAttributeValues&&(2===a.defaultAttributeValues[f].length?j.vertexAttrib2fv(h,a.defaultAttributeValues[f]):3===a.defaultAttributeValues[f].length&&j.vertexAttrib3fv(h,a.defaultAttributeValues[f])))}function g(a){Da[a]||(j.enableVertexAttribArray(a),Da[a]=!0)}function i(){for(var a in Da)Da[a]&&(j.disableVertexAttribArray(a),Da[a]=!1)}function k(a,b){return a.z!==b.z?b.z-a.z:a.id-b.id}function n(a,b){return b[0]-a[0]}function l(a,b,c){if(a.length)for(var d=0,e=a.length;d<
|
|
|
e;d++)Ka=Ha=null,Ga=Y=sa=za=Va=Ua=ta=-1,ua=!0,a[d].render(b,c,Wa,La),Ka=Ha=null,Ga=Y=sa=za=Va=Ua=ta=-1,ua=!0}function p(a,b,c,d,e,f,h,g){var j,i,k,n;b?(i=a.length-1,n=b=-1):(i=0,b=a.length,n=1);for(var l=i;l!==b;l+=n)if(j=a[l],j.render){i=j.object;k=j.buffer;if(g)j=g;else{j=j[c];if(!j)continue;h&&B.setBlending(j.blending,j.blendEquation,j.blendSrc,j.blendDst);B.setDepthTest(j.depthTest);B.setDepthWrite(j.depthWrite);I(j.polygonOffset,j.polygonOffsetFactor,j.polygonOffsetUnits)}B.setMaterialFaces(j);
|
|
|
k instanceof THREE.BufferGeometry?B.renderBufferDirect(d,e,f,j,k,i):B.renderBuffer(d,e,f,j,k,i)}}function t(a,b,c,d,e,f,h){for(var g,j,i=0,k=a.length;i<k;i++)if(g=a[i],j=g.object,j.visible){if(h)g=h;else{g=g[b];if(!g)continue;f&&B.setBlending(g.blending,g.blendEquation,g.blendSrc,g.blendDst);B.setDepthTest(g.depthTest);B.setDepthWrite(g.depthWrite);I(g.polygonOffset,g.polygonOffsetFactor,g.polygonOffsetUnits)}B.renderImmediateObject(c,d,e,g,j)}}function s(a,d){var e,f,h,g;if(void 0===a.__webglInit&&
|
|
|
-(a.__webglInit=!0,a._modelViewMatrix=new THREE.Matrix4,a._normalMatrix=new THREE.Matrix3,void 0!==a.geometry&&void 0===a.geometry.__webglInit&&(a.geometry.__webglInit=!0,a.geometry.addEventListener("dispose",Jb)),f=a.geometry,void 0!==f))if(f instanceof THREE.BufferGeometry){var i,k;for(i in f.attributes)k="index"===i?j.ELEMENT_ARRAY_BUFFER:j.ARRAY_BUFFER,g=f.attributes[i],void 0===g.numItems&&(g.numItems=g.array.length),g.buffer=j.createBuffer(),j.bindBuffer(k,g.buffer),j.bufferData(k,g.array,j.STATIC_DRAW)}else if(a instanceof
|
|
|
-THREE.Mesh){h=a.material;if(void 0===f.geometryGroups){i=f;var n,l,p;k={};var r=i.morphTargets.length,s=i.morphNormals.length,q=h instanceof THREE.MeshFaceMaterial;i.geometryGroups={};h=0;for(n=i.faces.length;h<n;h++)l=i.faces[h],l=q?l.materialIndex:0,void 0===k[l]&&(k[l]={hash:l,counter:0}),p=k[l].hash+"_"+k[l].counter,void 0===i.geometryGroups[p]&&(i.geometryGroups[p]={faces3:[],materialIndex:l,vertices:0,numMorphTargets:r,numMorphNormals:s}),65535<i.geometryGroups[p].vertices+3&&(k[l].counter+=
|
|
|
-1,p=k[l].hash+"_"+k[l].counter,void 0===i.geometryGroups[p]&&(i.geometryGroups[p]={faces3:[],materialIndex:l,vertices:0,numMorphTargets:r,numMorphNormals:s})),i.geometryGroups[p].faces3.push(h),i.geometryGroups[p].vertices+=3;i.geometryGroupsList=[];for(g in i.geometryGroups)i.geometryGroups[g].id=Sa++,i.geometryGroupsList.push(i.geometryGroups[g])}for(e in f.geometryGroups)if(g=f.geometryGroups[e],!g.__webglVertexBuffer){i=g;i.__webglVertexBuffer=j.createBuffer();i.__webglNormalBuffer=j.createBuffer();
|
|
|
-i.__webglTangentBuffer=j.createBuffer();i.__webglColorBuffer=j.createBuffer();i.__webglUVBuffer=j.createBuffer();i.__webglUV2Buffer=j.createBuffer();i.__webglSkinIndicesBuffer=j.createBuffer();i.__webglSkinWeightsBuffer=j.createBuffer();i.__webglFaceBuffer=j.createBuffer();i.__webglLineBuffer=j.createBuffer();r=k=void 0;if(i.numMorphTargets){i.__webglMorphTargetsBuffers=[];k=0;for(r=i.numMorphTargets;k<r;k++)i.__webglMorphTargetsBuffers.push(j.createBuffer())}if(i.numMorphNormals){i.__webglMorphNormalsBuffers=
|
|
|
-[];k=0;for(r=i.numMorphNormals;k<r;k++)i.__webglMorphNormalsBuffers.push(j.createBuffer())}B.info.memory.geometries++;c(g,a);f.verticesNeedUpdate=!0;f.morphTargetsNeedUpdate=!0;f.elementsNeedUpdate=!0;f.uvsNeedUpdate=!0;f.normalsNeedUpdate=!0;f.tangentsNeedUpdate=!0;f.colorsNeedUpdate=!0}}else a instanceof THREE.Line?f.__webglVertexBuffer||(g=f,g.__webglVertexBuffer=j.createBuffer(),g.__webglColorBuffer=j.createBuffer(),g.__webglLineDistanceBuffer=j.createBuffer(),B.info.memory.geometries++,g=f,i=
|
|
|
-g.vertices.length,g.__vertexArray=new Float32Array(3*i),g.__colorArray=new Float32Array(3*i),g.__lineDistanceArray=new Float32Array(1*i),g.__webglLineCount=i,b(g,a),f.verticesNeedUpdate=!0,f.colorsNeedUpdate=!0,f.lineDistancesNeedUpdate=!0):a instanceof THREE.ParticleSystem&&!f.__webglVertexBuffer&&(g=f,g.__webglVertexBuffer=j.createBuffer(),g.__webglColorBuffer=j.createBuffer(),B.info.memory.geometries++,g=f,i=g.vertices.length,g.__vertexArray=new Float32Array(3*i),g.__colorArray=new Float32Array(3*
|
|
|
-i),g.__sortArray=[],g.__webglParticleCount=i,b(g,a),f.verticesNeedUpdate=!0,f.colorsNeedUpdate=!0);if(void 0===a.__webglActive){if(a instanceof THREE.Mesh)if(f=a.geometry,f instanceof THREE.BufferGeometry)m(d.__webglObjects,f,a);else{if(f instanceof THREE.Geometry)for(e in f.geometryGroups)g=f.geometryGroups[e],m(d.__webglObjects,g,a)}else a instanceof THREE.Line||a instanceof THREE.ParticleSystem?(f=a.geometry,m(d.__webglObjects,f,a)):a instanceof THREE.ImmediateRenderObject||a.immediateRenderCallback?
|
|
|
-d.__webglObjectsImmediate.push({id:null,object:a,opaque:null,transparent:null,z:0}):a instanceof THREE.Sprite?d.__webglSprites.push(a):a instanceof THREE.LensFlare&&d.__webglFlares.push(a);a.__webglActive=!0}}function m(a,b,c){a.push({id:null,buffer:b,object:c,opaque:null,transparent:null,z:0})}function r(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function u(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function q(a,b){a instanceof THREE.Mesh||a instanceof
|
|
|
-THREE.ParticleSystem||a instanceof THREE.Line?v(b.__webglObjects,a):a instanceof THREE.Sprite?z(b.__webglSprites,a):a instanceof THREE.LensFlare?z(b.__webglFlares,a):(a instanceof THREE.ImmediateRenderObject||a.immediateRenderCallback)&&v(b.__webglObjectsImmediate,a);delete a.__webglActive}function v(a,b){for(var c=a.length-1;0<=c;c--)a[c].object===b&&a.splice(c,1)}function z(a,b){for(var c=a.length-1;0<=c;c--)a[c]===b&&a.splice(c,1)}function D(a,b,c,d,e){wa=0;d.needsUpdate&&(d.program&&Bb(d),B.initMaterial(d,
|
|
|
-b,c,e),d.needsUpdate=!1);d.morphTargets&&!e.__webglMorphTargetInfluences&&(e.__webglMorphTargetInfluences=new Float32Array(B.maxMorphTargets));var f=!1,h=d.program,g=h.uniforms,i=d.uniforms;h!==Ha&&(j.useProgram(h),Ha=h,f=!0);d.id!==Ga&&(Ga=d.id,f=!0);if(f||a!==Ka)j.uniformMatrix4fv(g.projectionMatrix,!1,a.projectionMatrix.elements),a!==Ka&&(Ka=a);if(d.skinning)if(xb&&e.useVertexTexture){if(null!==g.boneTexture){var k=K();j.uniform1i(g.boneTexture,k);B.setTexture(e.boneTexture,k)}null!==g.boneTextureWidth&&
|
|
|
-j.uniform1i(g.boneTextureWidth,e.boneTextureWidth);null!==g.boneTextureHeight&&j.uniform1i(g.boneTextureHeight,e.boneTextureHeight)}else null!==g.boneGlobalMatrices&&j.uniformMatrix4fv(g.boneGlobalMatrices,!1,e.boneMatrices);if(f){c&&d.fog&&(i.fogColor.value=c.color,c instanceof THREE.Fog?(i.fogNear.value=c.near,i.fogFar.value=c.far):c instanceof THREE.FogExp2&&(i.fogDensity.value=c.density));if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){if(ua){for(var n,
|
|
|
-l=k=0,p=0,m,r,s,q=Oa,t=q.directional.colors,u=q.directional.positions,v=q.point.colors,w=q.point.positions,z=q.point.distances,y=q.spot.colors,x=q.spot.positions,I=q.spot.distances,E=q.spot.directions,D=q.spot.anglesCos,L=q.spot.exponents,N=q.hemi.skyColors,G=q.hemi.groundColors,X=q.hemi.positions,S=0,ia=0,da=0,T=0,ba=0,V=0,W=0,U=0,R=n=0,c=s=R=0,f=b.length;c<f;c++)n=b[c],n.onlyShadow||(m=n.color,r=n.intensity,s=n.distance,n instanceof THREE.AmbientLight?n.visible&&(B.gammaInput?(k+=m.r*m.r,l+=m.g*
|
|
|
-m.g,p+=m.b*m.b):(k+=m.r,l+=m.g,p+=m.b)):n instanceof THREE.DirectionalLight?(ba+=1,n.visible&&(fa.setFromMatrixPosition(n.matrixWorld),ra.setFromMatrixPosition(n.target.matrixWorld),fa.sub(ra),fa.normalize(),0===fa.x&&0===fa.y&&0===fa.z||(n=3*S,u[n]=fa.x,u[n+1]=fa.y,u[n+2]=fa.z,B.gammaInput?F(t,n,m,r*r):H(t,n,m,r),S+=1))):n instanceof THREE.PointLight?(V+=1,n.visible&&(R=3*ia,B.gammaInput?F(v,R,m,r*r):H(v,R,m,r),ra.setFromMatrixPosition(n.matrixWorld),w[R]=ra.x,w[R+1]=ra.y,w[R+2]=ra.z,z[ia]=s,ia+=
|
|
|
-1)):n instanceof THREE.SpotLight?(W+=1,n.visible&&(R=3*da,B.gammaInput?F(y,R,m,r*r):H(y,R,m,r),ra.setFromMatrixPosition(n.matrixWorld),x[R]=ra.x,x[R+1]=ra.y,x[R+2]=ra.z,I[da]=s,fa.copy(ra),ra.setFromMatrixPosition(n.target.matrixWorld),fa.sub(ra),fa.normalize(),E[R]=fa.x,E[R+1]=fa.y,E[R+2]=fa.z,D[da]=Math.cos(n.angle),L[da]=n.exponent,da+=1)):n instanceof THREE.HemisphereLight&&(U+=1,n.visible&&(fa.setFromMatrixPosition(n.matrixWorld),fa.normalize(),0===fa.x&&0===fa.y&&0===fa.z||(s=3*T,X[s]=fa.x,
|
|
|
-X[s+1]=fa.y,X[s+2]=fa.z,m=n.color,n=n.groundColor,B.gammaInput?(r*=r,F(N,s,m,r),F(G,s,n,r)):(H(N,s,m,r),H(G,s,n,r)),T+=1))));c=3*S;for(f=Math.max(t.length,3*ba);c<f;c++)t[c]=0;c=3*ia;for(f=Math.max(v.length,3*V);c<f;c++)v[c]=0;c=3*da;for(f=Math.max(y.length,3*W);c<f;c++)y[c]=0;c=3*T;for(f=Math.max(N.length,3*U);c<f;c++)N[c]=0;c=3*T;for(f=Math.max(G.length,3*U);c<f;c++)G[c]=0;q.directional.length=S;q.point.length=ia;q.spot.length=da;q.hemi.length=T;q.ambient[0]=k;q.ambient[1]=l;q.ambient[2]=p;ua=!1}c=
|
|
|
-Oa;i.ambientLightColor.value=c.ambient;i.directionalLightColor.value=c.directional.colors;i.directionalLightDirection.value=c.directional.positions;i.pointLightColor.value=c.point.colors;i.pointLightPosition.value=c.point.positions;i.pointLightDistance.value=c.point.distances;i.spotLightColor.value=c.spot.colors;i.spotLightPosition.value=c.spot.positions;i.spotLightDistance.value=c.spot.distances;i.spotLightDirection.value=c.spot.directions;i.spotLightAngleCos.value=c.spot.anglesCos;i.spotLightExponent.value=
|
|
|
-c.spot.exponents;i.hemisphereLightSkyColor.value=c.hemi.skyColors;i.hemisphereLightGroundColor.value=c.hemi.groundColors;i.hemisphereLightDirection.value=c.hemi.positions}if(d instanceof THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshPhongMaterial){i.opacity.value=d.opacity;B.gammaInput?i.diffuse.value.copyGammaToLinear(d.color):i.diffuse.value=d.color;i.map.value=d.map;i.lightMap.value=d.lightMap;i.specularMap.value=d.specularMap;d.bumpMap&&(i.bumpMap.value=
|
|
|
-d.bumpMap,i.bumpScale.value=d.bumpScale);d.normalMap&&(i.normalMap.value=d.normalMap,i.normalScale.value.copy(d.normalScale));var Y;d.map?Y=d.map:d.specularMap?Y=d.specularMap:d.normalMap?Y=d.normalMap:d.bumpMap&&(Y=d.bumpMap);void 0!==Y&&(c=Y.offset,Y=Y.repeat,i.offsetRepeat.value.set(c.x,c.y,Y.x,Y.y));i.envMap.value=d.envMap;i.flipEnvMap.value=d.envMap instanceof THREE.WebGLRenderTargetCube?1:-1;i.reflectivity.value=d.reflectivity;i.refractionRatio.value=d.refractionRatio;i.combine.value=d.combine;
|
|
|
-i.useRefract.value=d.envMap&&d.envMap.mapping instanceof THREE.CubeRefractionMapping}d instanceof THREE.LineBasicMaterial?(i.diffuse.value=d.color,i.opacity.value=d.opacity):d instanceof THREE.LineDashedMaterial?(i.diffuse.value=d.color,i.opacity.value=d.opacity,i.dashSize.value=d.dashSize,i.totalSize.value=d.dashSize+d.gapSize,i.scale.value=d.scale):d instanceof THREE.ParticleSystemMaterial?(i.psColor.value=d.color,i.opacity.value=d.opacity,i.size.value=d.size,i.scale.value=M.height/2,i.map.value=
|
|
|
-d.map):d instanceof THREE.MeshPhongMaterial?(i.shininess.value=d.shininess,B.gammaInput?(i.ambient.value.copyGammaToLinear(d.ambient),i.emissive.value.copyGammaToLinear(d.emissive),i.specular.value.copyGammaToLinear(d.specular)):(i.ambient.value=d.ambient,i.emissive.value=d.emissive,i.specular.value=d.specular),d.wrapAround&&i.wrapRGB.value.copy(d.wrapRGB)):d instanceof THREE.MeshLambertMaterial?(B.gammaInput?(i.ambient.value.copyGammaToLinear(d.ambient),i.emissive.value.copyGammaToLinear(d.emissive)):
|
|
|
-(i.ambient.value=d.ambient,i.emissive.value=d.emissive),d.wrapAround&&i.wrapRGB.value.copy(d.wrapRGB)):d instanceof THREE.MeshDepthMaterial?(i.mNear.value=a.near,i.mFar.value=a.far,i.opacity.value=d.opacity):d instanceof THREE.MeshNormalMaterial&&(i.opacity.value=d.opacity);if(e.receiveShadow&&!d._shadowPass&&i.shadowMatrix){c=Y=0;for(f=b.length;c<f;c++)if(k=b[c],k.castShadow&&(k instanceof THREE.SpotLight||k instanceof THREE.DirectionalLight&&!k.shadowCascade))i.shadowMap.value[Y]=k.shadowMap,i.shadowMapSize.value[Y]=
|
|
|
-k.shadowMapSize,i.shadowMatrix.value[Y]=k.shadowMatrix,i.shadowDarkness.value[Y]=k.shadowDarkness,i.shadowBias.value[Y]=k.shadowBias,Y++}b=d.uniformsList;i=0;for(Y=b.length;i<Y;i++)if(f=h.uniforms[b[i][1]])if(c=b[i][0],l=c.type,k=c.value,"i"===l)j.uniform1i(f,k);else if("f"===l)j.uniform1f(f,k);else if("v2"===l)j.uniform2f(f,k.x,k.y);else if("v3"===l)j.uniform3f(f,k.x,k.y,k.z);else if("v4"===l)j.uniform4f(f,k.x,k.y,k.z,k.w);else if("c"===l)j.uniform3f(f,k.r,k.g,k.b);else if("iv1"===l)j.uniform1iv(f,
|
|
|
-k);else if("iv"===l)j.uniform3iv(f,k);else if("fv1"===l)j.uniform1fv(f,k);else if("fv"===l)j.uniform3fv(f,k);else if("v2v"===l){void 0===c._array&&(c._array=new Float32Array(2*k.length));l=0;for(p=k.length;l<p;l++)q=2*l,c._array[q]=k[l].x,c._array[q+1]=k[l].y;j.uniform2fv(f,c._array)}else if("v3v"===l){void 0===c._array&&(c._array=new Float32Array(3*k.length));l=0;for(p=k.length;l<p;l++)q=3*l,c._array[q]=k[l].x,c._array[q+1]=k[l].y,c._array[q+2]=k[l].z;j.uniform3fv(f,c._array)}else if("v4v"===l){void 0===
|
|
|
-c._array&&(c._array=new Float32Array(4*k.length));l=0;for(p=k.length;l<p;l++)q=4*l,c._array[q]=k[l].x,c._array[q+1]=k[l].y,c._array[q+2]=k[l].z,c._array[q+3]=k[l].w;j.uniform4fv(f,c._array)}else if("m4"===l)void 0===c._array&&(c._array=new Float32Array(16)),k.flattenToArray(c._array),j.uniformMatrix4fv(f,!1,c._array);else if("m4v"===l){void 0===c._array&&(c._array=new Float32Array(16*k.length));l=0;for(p=k.length;l<p;l++)k[l].flattenToArrayOffset(c._array,16*l);j.uniformMatrix4fv(f,!1,c._array)}else if("t"===
|
|
|
-l){if(q=k,k=K(),j.uniform1i(f,k),q)if(q.image instanceof Array&&6===q.image.length){if(c=q,f=k,6===c.image.length)if(c.needsUpdate){c.image.__webglTextureCube||(c.addEventListener("dispose",sb),c.image.__webglTextureCube=j.createTexture(),B.info.memory.textures++);j.activeTexture(j.TEXTURE0+f);j.bindTexture(j.TEXTURE_CUBE_MAP,c.image.__webglTextureCube);j.pixelStorei(j.UNPACK_FLIP_Y_WEBGL,c.flipY);f=c instanceof THREE.CompressedTexture;k=[];for(l=0;6>l;l++)B.autoScaleCubemaps&&!f?(p=k,q=l,t=c.image[l],
|
|
|
-v=Yb,t.width<=v&&t.height<=v||(w=Math.max(t.width,t.height),u=Math.floor(t.width*v/w),v=Math.floor(t.height*v/w),w=document.createElement("canvas"),w.width=u,w.height=v,w.getContext("2d").drawImage(t,0,0,t.width,t.height,0,0,u,v),t=w),p[q]=t):k[l]=c.image[l];l=k[0];p=THREE.Math.isPowerOfTwo(l.width)&&THREE.Math.isPowerOfTwo(l.height);q=A(c.format);t=A(c.type);C(j.TEXTURE_CUBE_MAP,c,p);for(l=0;6>l;l++)if(f){v=k[l].mipmaps;w=0;for(z=v.length;w<z;w++)u=v[w],c.format!==THREE.RGBAFormat?j.compressedTexImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+
|
|
|
-l,w,q,u.width,u.height,0,u.data):j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+l,w,q,u.width,u.height,0,q,t,u.data)}else j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+l,0,q,q,t,k[l]);c.generateMipmaps&&p&&j.generateMipmap(j.TEXTURE_CUBE_MAP);c.needsUpdate=!1;if(c.onUpdate)c.onUpdate()}else j.activeTexture(j.TEXTURE0+f),j.bindTexture(j.TEXTURE_CUBE_MAP,c.image.__webglTextureCube)}else q instanceof THREE.WebGLRenderTargetCube?(c=q,j.activeTexture(j.TEXTURE0+k),j.bindTexture(j.TEXTURE_CUBE_MAP,c.__webglTexture)):
|
|
|
-B.setTexture(q,k)}else if("tv"===l){void 0===c._array&&(c._array=[]);l=0;for(p=c.value.length;l<p;l++)c._array[l]=K();j.uniform1iv(f,c._array);l=0;for(p=c.value.length;l<p;l++)q=c.value[l],k=c._array[l],q&&B.setTexture(q,k)}else console.warn("THREE.WebGLRenderer: Unknown uniform type: "+l);if((d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&null!==g.cameraPosition)ra.setFromMatrixPosition(a.matrixWorld),j.uniform3f(g.cameraPosition,ra.x,ra.y,ra.z);(d instanceof
|
|
|
-THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.ShaderMaterial||d.skinning)&&null!==g.viewMatrix&&j.uniformMatrix4fv(g.viewMatrix,!1,a.matrixWorldInverse.elements)}j.uniformMatrix4fv(g.modelViewMatrix,!1,e._modelViewMatrix.elements);g.normalMatrix&&j.uniformMatrix3fv(g.normalMatrix,!1,e._normalMatrix.elements);null!==g.modelMatrix&&j.uniformMatrix4fv(g.modelMatrix,!1,e.matrixWorld.elements);return h}function K(){var a=wa;a>=Hb&&console.warn("WebGLRenderer: trying to use "+
|
|
|
-a+" texture units while this GPU supports only "+Hb);wa+=1;return a}function F(a,b,c,d){a[b]=c.r*c.r*d;a[b+1]=c.g*c.g*d;a[b+2]=c.b*c.b*d}function H(a,b,c,d){a[b]=c.r*d;a[b+1]=c.g*d;a[b+2]=c.b*d}function w(a){a!==ea&&(j.lineWidth(a),ea=a)}function I(a,b,c){la!==a&&(a?j.enable(j.POLYGON_OFFSET_FILL):j.disable(j.POLYGON_OFFSET_FILL),la=a);if(a&&(va!==b||xa!==c))j.polygonOffset(b,c),va=b,xa=c}function N(a){for(var a=a.split("\n"),b=0,c=a.length;b<c;b++)a[b]=b+1+": "+a[b];return a.join("\n")}function x(a,
|
|
|
-b){var c;"fragment"===a?c=j.createShader(j.FRAGMENT_SHADER):"vertex"===a&&(c=j.createShader(j.VERTEX_SHADER));j.shaderSource(c,b);j.compileShader(c);return!j.getShaderParameter(c,j.COMPILE_STATUS)?(console.error(j.getShaderInfoLog(c)),console.error(N(b)),null):c}function C(a,b,c){c?(j.texParameteri(a,j.TEXTURE_WRAP_S,A(b.wrapS)),j.texParameteri(a,j.TEXTURE_WRAP_T,A(b.wrapT)),j.texParameteri(a,j.TEXTURE_MAG_FILTER,A(b.magFilter)),j.texParameteri(a,j.TEXTURE_MIN_FILTER,A(b.minFilter))):(j.texParameteri(a,
|
|
|
-j.TEXTURE_WRAP_S,j.CLAMP_TO_EDGE),j.texParameteri(a,j.TEXTURE_WRAP_T,j.CLAMP_TO_EDGE),j.texParameteri(a,j.TEXTURE_MAG_FILTER,L(b.magFilter)),j.texParameteri(a,j.TEXTURE_MIN_FILTER,L(b.minFilter)));if(Na&&b.type!==THREE.FloatType&&(1<b.anisotropy||b.__oldAnisotropy))j.texParameterf(a,Na.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(b.anisotropy,Ab)),b.__oldAnisotropy=b.anisotropy}function y(a,b){j.bindRenderbuffer(j.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?(j.renderbufferStorage(j.RENDERBUFFER,j.DEPTH_COMPONENT16,
|
|
|
-b.width,b.height),j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_ATTACHMENT,j.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(j.renderbufferStorage(j.RENDERBUFFER,j.DEPTH_STENCIL,b.width,b.height),j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_STENCIL_ATTACHMENT,j.RENDERBUFFER,a)):j.renderbufferStorage(j.RENDERBUFFER,j.RGBA4,b.width,b.height)}function L(a){return a===THREE.NearestFilter||a===THREE.NearestMipMapNearestFilter||a===THREE.NearestMipMapLinearFilter?j.NEAREST:j.LINEAR}function A(a){if(a===
|
|
|
-THREE.RepeatWrapping)return j.REPEAT;if(a===THREE.ClampToEdgeWrapping)return j.CLAMP_TO_EDGE;if(a===THREE.MirroredRepeatWrapping)return j.MIRRORED_REPEAT;if(a===THREE.NearestFilter)return j.NEAREST;if(a===THREE.NearestMipMapNearestFilter)return j.NEAREST_MIPMAP_NEAREST;if(a===THREE.NearestMipMapLinearFilter)return j.NEAREST_MIPMAP_LINEAR;if(a===THREE.LinearFilter)return j.LINEAR;if(a===THREE.LinearMipMapNearestFilter)return j.LINEAR_MIPMAP_NEAREST;if(a===THREE.LinearMipMapLinearFilter)return j.LINEAR_MIPMAP_LINEAR;
|
|
|
-if(a===THREE.UnsignedByteType)return j.UNSIGNED_BYTE;if(a===THREE.UnsignedShort4444Type)return j.UNSIGNED_SHORT_4_4_4_4;if(a===THREE.UnsignedShort5551Type)return j.UNSIGNED_SHORT_5_5_5_1;if(a===THREE.UnsignedShort565Type)return j.UNSIGNED_SHORT_5_6_5;if(a===THREE.ByteType)return j.BYTE;if(a===THREE.ShortType)return j.SHORT;if(a===THREE.UnsignedShortType)return j.UNSIGNED_SHORT;if(a===THREE.IntType)return j.INT;if(a===THREE.UnsignedIntType)return j.UNSIGNED_INT;if(a===THREE.FloatType)return j.FLOAT;
|
|
|
-if(a===THREE.AlphaFormat)return j.ALPHA;if(a===THREE.RGBFormat)return j.RGB;if(a===THREE.RGBAFormat)return j.RGBA;if(a===THREE.LuminanceFormat)return j.LUMINANCE;if(a===THREE.LuminanceAlphaFormat)return j.LUMINANCE_ALPHA;if(a===THREE.AddEquation)return j.FUNC_ADD;if(a===THREE.SubtractEquation)return j.FUNC_SUBTRACT;if(a===THREE.ReverseSubtractEquation)return j.FUNC_REVERSE_SUBTRACT;if(a===THREE.ZeroFactor)return j.ZERO;if(a===THREE.OneFactor)return j.ONE;if(a===THREE.SrcColorFactor)return j.SRC_COLOR;
|
|
|
-if(a===THREE.OneMinusSrcColorFactor)return j.ONE_MINUS_SRC_COLOR;if(a===THREE.SrcAlphaFactor)return j.SRC_ALPHA;if(a===THREE.OneMinusSrcAlphaFactor)return j.ONE_MINUS_SRC_ALPHA;if(a===THREE.DstAlphaFactor)return j.DST_ALPHA;if(a===THREE.OneMinusDstAlphaFactor)return j.ONE_MINUS_DST_ALPHA;if(a===THREE.DstColorFactor)return j.DST_COLOR;if(a===THREE.OneMinusDstColorFactor)return j.ONE_MINUS_DST_COLOR;if(a===THREE.SrcAlphaSaturateFactor)return j.SRC_ALPHA_SATURATE;if(void 0!==Ma){if(a===THREE.RGB_S3TC_DXT1_Format)return Ma.COMPRESSED_RGB_S3TC_DXT1_EXT;
|
|
|
-if(a===THREE.RGBA_S3TC_DXT1_Format)return Ma.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(a===THREE.RGBA_S3TC_DXT3_Format)return Ma.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(a===THREE.RGBA_S3TC_DXT5_Format)return Ma.COMPRESSED_RGBA_S3TC_DXT5_EXT}return 0}console.log("THREE.WebGLRenderer",THREE.REVISION);var a=a||{},M=void 0!==a.canvas?a.canvas:document.createElement("canvas"),E=void 0!==a.precision?a.precision:"highp",S=void 0!==a.alpha?a.alpha:!1,ha=void 0!==a.premultipliedAlpha?a.premultipliedAlpha:!0,Aa=void 0!==a.antialias?
|
|
|
-a.antialias:!1,G=void 0!==a.stencil?a.stencil:!0,T=void 0!==a.preserveDrawingBuffer?a.preserveDrawingBuffer:!1,ca=new THREE.Color(0),ja=0;this.domElement=M;this.context=null;this.devicePixelRatio=void 0!==a.devicePixelRatio?a.devicePixelRatio:void 0!==self.devicePixelRatio?self.devicePixelRatio:1;this.autoUpdateObjects=this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.shadowMapEnabled=this.gammaOutput=this.gammaInput=!1;this.shadowMapAutoUpdate=
|
|
|
-!0;this.shadowMapType=THREE.PCFShadowMap;this.shadowMapCullFace=THREE.CullFaceFront;this.shadowMapCascade=this.shadowMapDebug=!1;this.maxMorphTargets=8;this.maxMorphNormals=4;this.autoScaleCubemaps=!0;this.renderPluginsPre=[];this.renderPluginsPost=[];this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0,points:0}};var B=this,X=[],ia=0,Ha=null,da=null,Ga=-1,Y=null,Ka=null,Sa=0,wa=0,za=-1,sa=-1,ta=-1,Ba=-1,Ta=-1,Ca=-1,Ua=-1,Va=-1,la=null,va=null,xa=null,ea=null,
|
|
|
-qa=0,Ia=0,ma=M.width,ya=M.height,Wa=0,La=0,Da={},R=new THREE.Frustum,ba=new THREE.Matrix4,Ja=new THREE.Matrix4,ra=new THREE.Vector3,fa=new THREE.Vector3,ua=!0,Oa={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]},spot:{length:0,colors:[],positions:[],distances:[],directions:[],anglesCos:[],exponents:[]},hemi:{length:0,skyColors:[],groundColors:[],positions:[]}},j,db,$,Na,Ma;try{var Za={alpha:S,premultipliedAlpha:ha,antialias:Aa,stencil:G,
|
|
|
-preserveDrawingBuffer:T};j=M.getContext("webgl",Za)||M.getContext("experimental-webgl",Za);if(null===j)throw"Error creating WebGL context.";}catch(Wb){console.error(Wb)}db=j.getExtension("OES_texture_float");j.getExtension("OES_texture_float_linear");$=j.getExtension("OES_standard_derivatives");Na=j.getExtension("EXT_texture_filter_anisotropic")||j.getExtension("MOZ_EXT_texture_filter_anisotropic")||j.getExtension("WEBKIT_EXT_texture_filter_anisotropic");Ma=j.getExtension("WEBGL_compressed_texture_s3tc")||
|
|
|
-j.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||j.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");db||console.log("THREE.WebGLRenderer: Float textures not supported.");$||console.log("THREE.WebGLRenderer: Standard derivatives not supported.");Na||console.log("THREE.WebGLRenderer: Anisotropic texture filtering not supported.");Ma||console.log("THREE.WebGLRenderer: S3TC compressed textures not supported.");void 0===j.getShaderPrecisionFormat&&(j.getShaderPrecisionFormat=function(){return{rangeMin:1,
|
|
|
-rangeMax:1,precision:1}});j.clearColor(0,0,0,1);j.clearDepth(1);j.clearStencil(0);j.enable(j.DEPTH_TEST);j.depthFunc(j.LEQUAL);j.frontFace(j.CCW);j.cullFace(j.BACK);j.enable(j.CULL_FACE);j.enable(j.BLEND);j.blendEquation(j.FUNC_ADD);j.blendFunc(j.SRC_ALPHA,j.ONE_MINUS_SRC_ALPHA);j.viewport(qa,Ia,ma,ya);j.clearColor(ca.r,ca.g,ca.b,ja);this.context=j;var Hb=j.getParameter(j.MAX_TEXTURE_IMAGE_UNITS),Xb=j.getParameter(j.MAX_VERTEX_TEXTURE_IMAGE_UNITS);j.getParameter(j.MAX_TEXTURE_SIZE);var Yb=j.getParameter(j.MAX_CUBE_MAP_TEXTURE_SIZE),
|
|
|
-Ab=Na?j.getParameter(Na.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0,wb=0<Xb,xb=wb&&db;Ma&&j.getParameter(j.COMPRESSED_TEXTURE_FORMATS);var Zb=j.getShaderPrecisionFormat(j.VERTEX_SHADER,j.HIGH_FLOAT),$b=j.getShaderPrecisionFormat(j.VERTEX_SHADER,j.MEDIUM_FLOAT);j.getShaderPrecisionFormat(j.VERTEX_SHADER,j.LOW_FLOAT);var pc=j.getShaderPrecisionFormat(j.FRAGMENT_SHADER,j.HIGH_FLOAT),qc=j.getShaderPrecisionFormat(j.FRAGMENT_SHADER,j.MEDIUM_FLOAT);j.getShaderPrecisionFormat(j.FRAGMENT_SHADER,j.LOW_FLOAT);j.getShaderPrecisionFormat(j.VERTEX_SHADER,
|
|
|
-j.HIGH_INT);j.getShaderPrecisionFormat(j.VERTEX_SHADER,j.MEDIUM_INT);j.getShaderPrecisionFormat(j.VERTEX_SHADER,j.LOW_INT);j.getShaderPrecisionFormat(j.FRAGMENT_SHADER,j.HIGH_INT);j.getShaderPrecisionFormat(j.FRAGMENT_SHADER,j.MEDIUM_INT);j.getShaderPrecisionFormat(j.FRAGMENT_SHADER,j.LOW_INT);var rc=0<Zb.precision&&0<pc.precision,Ib=0<$b.precision&&0<qc.precision;"highp"===E&&!rc&&(Ib?(E="mediump",console.warn("WebGLRenderer: highp not supported, using mediump")):(E="lowp",console.warn("WebGLRenderer: highp and mediump not supported, using lowp")));
|
|
|
-"mediump"===E&&!Ib&&(E="lowp",console.warn("WebGLRenderer: mediump not supported, using lowp"));this.getContext=function(){return j};this.supportsVertexTextures=function(){return wb};this.supportsFloatTextures=function(){return db};this.supportsStandardDerivatives=function(){return $};this.supportsCompressedTextureS3TC=function(){return Ma};this.getMaxAnisotropy=function(){return Ab};this.getPrecision=function(){return E};this.setSize=function(a,b,c){M.width=a*this.devicePixelRatio;M.height=b*this.devicePixelRatio;
|
|
|
-1!==this.devicePixelRatio&&!1!==c&&(M.style.width=a+"px",M.style.height=b+"px");this.setViewport(0,0,a,b)};this.setViewport=function(a,b,c,d){qa=a*this.devicePixelRatio;Ia=b*this.devicePixelRatio;ma=c*this.devicePixelRatio;ya=d*this.devicePixelRatio;j.viewport(qa,Ia,ma,ya)};this.setScissor=function(a,b,c,d){j.scissor(a*this.devicePixelRatio,b*this.devicePixelRatio,c*this.devicePixelRatio,d*this.devicePixelRatio)};this.enableScissorTest=function(a){a?j.enable(j.SCISSOR_TEST):j.disable(j.SCISSOR_TEST)};
|
|
|
-this.setClearColor=function(a,b){ca.set(a);ja=void 0!==b?b:1;j.clearColor(ca.r,ca.g,ca.b,ja)};this.setClearColorHex=function(a,b){console.warn("DEPRECATED: .setClearColorHex() is being removed. Use .setClearColor() instead.");this.setClearColor(a,b)};this.getClearColor=function(){return ca};this.getClearAlpha=function(){return ja};this.clear=function(a,b,c){var d=0;if(void 0===a||a)d|=j.COLOR_BUFFER_BIT;if(void 0===b||b)d|=j.DEPTH_BUFFER_BIT;if(void 0===c||c)d|=j.STENCIL_BUFFER_BIT;j.clear(d)};this.clearColor=
|
|
|
-function(){j.clear(j.COLOR_BUFFER_BIT)};this.clearDepth=function(){j.clear(j.DEPTH_BUFFER_BIT)};this.clearStencil=function(){j.clear(j.STENCIL_BUFFER_BIT)};this.clearTarget=function(a,b,c,d){this.setRenderTarget(a);this.clear(b,c,d)};this.addPostPlugin=function(a){a.init(this);this.renderPluginsPost.push(a)};this.addPrePlugin=function(a){a.init(this);this.renderPluginsPre.push(a)};this.updateShadowMap=function(a,b){Ha=null;Ga=Y=Va=Ua=ta=-1;ua=!0;sa=za=-1;this.shadowMapPlugin.update(a,b)};var Jb=function(a){a=
|
|
|
-a.target;a.removeEventListener("dispose",Jb);a.__webglInit=void 0;if(a instanceof THREE.BufferGeometry){var b=a.attributes,c;for(c in b)void 0!==b[c].buffer&&j.deleteBuffer(b[c].buffer);B.info.memory.geometries--}else if(void 0!==a.geometryGroups)for(b in a.geometryGroups){c=a.geometryGroups[b];if(void 0!==c.numMorphTargets)for(var d=0,e=c.numMorphTargets;d<e;d++)j.deleteBuffer(c.__webglMorphTargetsBuffers[d]);if(void 0!==c.numMorphNormals){d=0;for(e=c.numMorphNormals;d<e;d++)j.deleteBuffer(c.__webglMorphNormalsBuffers[d])}Cb(c)}else Cb(a)},
|
|
|
-sb=function(a){a=a.target;a.removeEventListener("dispose",sb);a.image&&a.image.__webglTextureCube?j.deleteTexture(a.image.__webglTextureCube):a.__webglInit&&(a.__webglInit=!1,j.deleteTexture(a.__webglTexture));B.info.memory.textures--},Kb=function(a){a=a.target;a.removeEventListener("dispose",Kb);if(a&&a.__webglTexture)if(j.deleteTexture(a.__webglTexture),a instanceof THREE.WebGLRenderTargetCube)for(var b=0;6>b;b++)j.deleteFramebuffer(a.__webglFramebuffer[b]),j.deleteRenderbuffer(a.__webglRenderbuffer[b]);
|
|
|
-else j.deleteFramebuffer(a.__webglFramebuffer),j.deleteRenderbuffer(a.__webglRenderbuffer);B.info.memory.textures--},Lb=function(a){a=a.target;a.removeEventListener("dispose",Lb);Bb(a)},Cb=function(a){void 0!==a.__webglVertexBuffer&&j.deleteBuffer(a.__webglVertexBuffer);void 0!==a.__webglNormalBuffer&&j.deleteBuffer(a.__webglNormalBuffer);void 0!==a.__webglTangentBuffer&&j.deleteBuffer(a.__webglTangentBuffer);void 0!==a.__webglColorBuffer&&j.deleteBuffer(a.__webglColorBuffer);void 0!==a.__webglUVBuffer&&
|
|
|
-j.deleteBuffer(a.__webglUVBuffer);void 0!==a.__webglUV2Buffer&&j.deleteBuffer(a.__webglUV2Buffer);void 0!==a.__webglSkinIndicesBuffer&&j.deleteBuffer(a.__webglSkinIndicesBuffer);void 0!==a.__webglSkinWeightsBuffer&&j.deleteBuffer(a.__webglSkinWeightsBuffer);void 0!==a.__webglFaceBuffer&&j.deleteBuffer(a.__webglFaceBuffer);void 0!==a.__webglLineBuffer&&j.deleteBuffer(a.__webglLineBuffer);void 0!==a.__webglLineDistanceBuffer&&j.deleteBuffer(a.__webglLineDistanceBuffer);if(void 0!==a.__webglCustomAttributesList)for(var b in a.__webglCustomAttributesList)j.deleteBuffer(a.__webglCustomAttributesList[b].buffer);
|
|
|
-B.info.memory.geometries--},Bb=function(a){var b=a.program;if(void 0!==b){a.program=void 0;var c,d,e=!1,a=0;for(c=X.length;a<c;a++)if(d=X[a],d.program===b){d.usedTimes--;0===d.usedTimes&&(e=!0);break}if(!0===e){e=[];a=0;for(c=X.length;a<c;a++)d=X[a],d.program!==b&&e.push(d);X=e;j.deleteProgram(b);B.info.memory.programs--}}};this.renderBufferImmediate=function(a,b,c){a.hasPositions&&!a.__webglVertexBuffer&&(a.__webglVertexBuffer=j.createBuffer());a.hasNormals&&!a.__webglNormalBuffer&&(a.__webglNormalBuffer=
|
|
|
-j.createBuffer());a.hasUvs&&!a.__webglUvBuffer&&(a.__webglUvBuffer=j.createBuffer());a.hasColors&&!a.__webglColorBuffer&&(a.__webglColorBuffer=j.createBuffer());a.hasPositions&&(j.bindBuffer(j.ARRAY_BUFFER,a.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,a.positionArray,j.DYNAMIC_DRAW),j.enableVertexAttribArray(b.attributes.position),j.vertexAttribPointer(b.attributes.position,3,j.FLOAT,!1,0,0));if(a.hasNormals){j.bindBuffer(j.ARRAY_BUFFER,a.__webglNormalBuffer);if(c.shading===THREE.FlatShading){var d,
|
|
|
-e,f,g,h,i,k,l,n,p,m,r=3*a.count;for(m=0;m<r;m+=9)p=a.normalArray,d=p[m],e=p[m+1],f=p[m+2],g=p[m+3],i=p[m+4],l=p[m+5],h=p[m+6],k=p[m+7],n=p[m+8],d=(d+g+h)/3,e=(e+i+k)/3,f=(f+l+n)/3,p[m]=d,p[m+1]=e,p[m+2]=f,p[m+3]=d,p[m+4]=e,p[m+5]=f,p[m+6]=d,p[m+7]=e,p[m+8]=f}j.bufferData(j.ARRAY_BUFFER,a.normalArray,j.DYNAMIC_DRAW);j.enableVertexAttribArray(b.attributes.normal);j.vertexAttribPointer(b.attributes.normal,3,j.FLOAT,!1,0,0)}a.hasUvs&&c.map&&(j.bindBuffer(j.ARRAY_BUFFER,a.__webglUvBuffer),j.bufferData(j.ARRAY_BUFFER,
|
|
|
-a.uvArray,j.DYNAMIC_DRAW),j.enableVertexAttribArray(b.attributes.uv),j.vertexAttribPointer(b.attributes.uv,2,j.FLOAT,!1,0,0));a.hasColors&&c.vertexColors!==THREE.NoColors&&(j.bindBuffer(j.ARRAY_BUFFER,a.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,a.colorArray,j.DYNAMIC_DRAW),j.enableVertexAttribArray(b.attributes.color),j.vertexAttribPointer(b.attributes.color,3,j.FLOAT,!1,0,0));j.drawArrays(j.TRIANGLES,0,a.count);a.count=0};this.renderBufferDirect=function(a,b,c,d,e,f){if(!1!==d.visible){var k,
|
|
|
-l,n,p;k=D(a,b,c,d,f);a=k.attributes;b=e.attributes;c=!1;k=16777215*e.id+2*k.id+(d.wireframe?1:0);k!==Y&&(Y=k,c=!0);c&&i();if(f instanceof THREE.Mesh)if(f=b.index){e=e.offsets;1<e.length&&(c=!0);for(var m=0,r=e.length;m<r;m++){var q=e[m].index;if(c){for(l in a)n=a[l],k=b[l],0<=n&&(k?(p=k.itemSize,j.bindBuffer(j.ARRAY_BUFFER,k.buffer),g(n),j.vertexAttribPointer(n,p,j.FLOAT,!1,0,4*q*p)):d.defaultAttributeValues&&(2===d.defaultAttributeValues[l].length?j.vertexAttrib2fv(n,d.defaultAttributeValues[l]):
|
|
|
-3===d.defaultAttributeValues[l].length&&j.vertexAttrib3fv(n,d.defaultAttributeValues[l])));j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,f.buffer)}j.drawElements(j.TRIANGLES,e[m].count,j.UNSIGNED_SHORT,2*e[m].start);B.info.render.calls++;B.info.render.vertices+=e[m].count;B.info.render.faces+=e[m].count/3}}else{if(c)for(l in a)"index"!==l&&(n=a[l],k=b[l],0<=n&&(k?(p=k.itemSize,j.bindBuffer(j.ARRAY_BUFFER,k.buffer),g(n),j.vertexAttribPointer(n,p,j.FLOAT,!1,0,0)):d.defaultAttributeValues&&d.defaultAttributeValues[l]&&
|
|
|
-(2===d.defaultAttributeValues[l].length?j.vertexAttrib2fv(n,d.defaultAttributeValues[l]):3===d.defaultAttributeValues[l].length&&j.vertexAttrib3fv(n,d.defaultAttributeValues[l]))));d=e.attributes.position;j.drawArrays(j.TRIANGLES,0,d.numItems/3);B.info.render.calls++;B.info.render.vertices+=d.numItems/3;B.info.render.faces+=d.numItems/3/3}else if(f instanceof THREE.ParticleSystem){if(c)for(l in a)n=a[l],k=b[l],0<=n&&(k?(p=k.itemSize,j.bindBuffer(j.ARRAY_BUFFER,k.buffer),g(n),j.vertexAttribPointer(n,
|
|
|
-p,j.FLOAT,!1,0,0)):d.defaultAttributeValues&&d.defaultAttributeValues[l]&&(2===d.defaultAttributeValues[l].length?j.vertexAttrib2fv(n,d.defaultAttributeValues[l]):3===d.defaultAttributeValues[l].length&&j.vertexAttrib3fv(n,d.defaultAttributeValues[l])));d=b.position;j.drawArrays(j.POINTS,0,d.numItems/3);B.info.render.calls++;B.info.render.points+=d.numItems/3}else if(f instanceof THREE.Line)if(l=f.type===THREE.LineStrip?j.LINE_STRIP:j.LINES,w(d.linewidth),f=b.index){e=e.offsets;1<e.length&&(c=!0);
|
|
|
-m=0;for(r=e.length;m<r;m++)q=e[m].index,c&&(h(d,a,b,q),j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,f.buffer)),j.drawElements(j.LINES,e[m].count,j.UNSIGNED_SHORT,2*e[m].start),B.info.render.calls++,B.info.render.vertices+=e[m].count}else c&&h(d,a,b,0),d=b.position,j.drawArrays(l,0,d.numItems/3),B.info.render.calls++,B.info.render.points+=d.numItems}};this.renderBuffer=function(a,b,c,d,e,f){if(!1!==d.visible){var h,k,c=D(a,b,c,d,f),a=c.attributes,b=!1,c=16777215*e.id+2*c.id+(d.wireframe?1:0);c!==Y&&(Y=c,b=
|
|
|
-!0);b&&i();if(!d.morphTargets&&0<=a.position)b&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglVertexBuffer),g(a.position),j.vertexAttribPointer(a.position,3,j.FLOAT,!1,0,0));else if(f.morphTargetBase){c=d.program.attributes;-1!==f.morphTargetBase&&0<=c.position?(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[f.morphTargetBase]),g(c.position),j.vertexAttribPointer(c.position,3,j.FLOAT,!1,0,0)):0<=c.position&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglVertexBuffer),g(c.position),j.vertexAttribPointer(c.position,
|
|
|
-3,j.FLOAT,!1,0,0));if(f.morphTargetForcedOrder.length){var l=0;k=f.morphTargetForcedOrder;for(h=f.morphTargetInfluences;l<d.numSupportedMorphTargets&&l<k.length;)0<=c["morphTarget"+l]&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[k[l]]),g(c["morphTarget"+l]),j.vertexAttribPointer(c["morphTarget"+l],3,j.FLOAT,!1,0,0)),0<=c["morphNormal"+l]&&d.morphNormals&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[k[l]]),g(c["morphNormal"+l]),j.vertexAttribPointer(c["morphNormal"+l],3,
|
|
|
-j.FLOAT,!1,0,0)),f.__webglMorphTargetInfluences[l]=h[k[l]],l++}else{k=[];h=f.morphTargetInfluences;var p,m=h.length;for(p=0;p<m;p++)l=h[p],0<l&&k.push([l,p]);k.length>d.numSupportedMorphTargets?(k.sort(n),k.length=d.numSupportedMorphTargets):k.length>d.numSupportedMorphNormals?k.sort(n):0===k.length&&k.push([0,0]);for(l=0;l<d.numSupportedMorphTargets;)k[l]?(p=k[l][1],0<=c["morphTarget"+l]&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[p]),g(c["morphTarget"+l]),j.vertexAttribPointer(c["morphTarget"+
|
|
|
-l],3,j.FLOAT,!1,0,0)),0<=c["morphNormal"+l]&&d.morphNormals&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[p]),g(c["morphNormal"+l]),j.vertexAttribPointer(c["morphNormal"+l],3,j.FLOAT,!1,0,0)),f.__webglMorphTargetInfluences[l]=h[p]):f.__webglMorphTargetInfluences[l]=0,l++}null!==d.program.uniforms.morphTargetInfluences&&j.uniform1fv(d.program.uniforms.morphTargetInfluences,f.__webglMorphTargetInfluences)}if(b){if(e.__webglCustomAttributesList){h=0;for(k=e.__webglCustomAttributesList.length;h<
|
|
|
-k;h++)c=e.__webglCustomAttributesList[h],0<=a[c.buffer.belongsToAttribute]&&(j.bindBuffer(j.ARRAY_BUFFER,c.buffer),g(a[c.buffer.belongsToAttribute]),j.vertexAttribPointer(a[c.buffer.belongsToAttribute],c.size,j.FLOAT,!1,0,0))}0<=a.color&&(0<f.geometry.colors.length||0<f.geometry.faces.length?(j.bindBuffer(j.ARRAY_BUFFER,e.__webglColorBuffer),g(a.color),j.vertexAttribPointer(a.color,3,j.FLOAT,!1,0,0)):d.defaultAttributeValues&&j.vertexAttrib3fv(a.color,d.defaultAttributeValues.color));0<=a.normal&&
|
|
|
-(j.bindBuffer(j.ARRAY_BUFFER,e.__webglNormalBuffer),g(a.normal),j.vertexAttribPointer(a.normal,3,j.FLOAT,!1,0,0));0<=a.tangent&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglTangentBuffer),g(a.tangent),j.vertexAttribPointer(a.tangent,4,j.FLOAT,!1,0,0));0<=a.uv&&(f.geometry.faceVertexUvs[0]?(j.bindBuffer(j.ARRAY_BUFFER,e.__webglUVBuffer),g(a.uv),j.vertexAttribPointer(a.uv,2,j.FLOAT,!1,0,0)):d.defaultAttributeValues&&j.vertexAttrib2fv(a.uv,d.defaultAttributeValues.uv));0<=a.uv2&&(f.geometry.faceVertexUvs[1]?
|
|
|
-(j.bindBuffer(j.ARRAY_BUFFER,e.__webglUV2Buffer),g(a.uv2),j.vertexAttribPointer(a.uv2,2,j.FLOAT,!1,0,0)):d.defaultAttributeValues&&j.vertexAttrib2fv(a.uv2,d.defaultAttributeValues.uv2));d.skinning&&(0<=a.skinIndex&&0<=a.skinWeight)&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinIndicesBuffer),g(a.skinIndex),j.vertexAttribPointer(a.skinIndex,4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinWeightsBuffer),g(a.skinWeight),j.vertexAttribPointer(a.skinWeight,4,j.FLOAT,!1,0,0));0<=a.lineDistance&&
|
|
|
-(j.bindBuffer(j.ARRAY_BUFFER,e.__webglLineDistanceBuffer),g(a.lineDistance),j.vertexAttribPointer(a.lineDistance,1,j.FLOAT,!1,0,0))}f instanceof THREE.Mesh?(d.wireframe?(w(d.wireframeLinewidth),b&&j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,e.__webglLineBuffer),j.drawElements(j.LINES,e.__webglLineCount,j.UNSIGNED_SHORT,0)):(b&&j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer),j.drawElements(j.TRIANGLES,e.__webglFaceCount,j.UNSIGNED_SHORT,0)),B.info.render.calls++,B.info.render.vertices+=e.__webglFaceCount,
|
|
|
-B.info.render.faces+=e.__webglFaceCount/3):f instanceof THREE.Line?(f=f.type===THREE.LineStrip?j.LINE_STRIP:j.LINES,w(d.linewidth),j.drawArrays(f,0,e.__webglLineCount),B.info.render.calls++):f instanceof THREE.ParticleSystem&&(j.drawArrays(j.POINTS,0,e.__webglParticleCount),B.info.render.calls++,B.info.render.points+=e.__webglParticleCount)}};this.render=function(a,b,c,d){if(!1===b instanceof THREE.Camera)console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");else{var e,
|
|
|
-f,h,g,i=a.__lights,n=a.fog;Ga=-1;ua=!0;!0===a.autoUpdate&&a.updateMatrixWorld();void 0===b.parent&&b.updateMatrixWorld();b.matrixWorldInverse.getInverse(b.matrixWorld);ba.multiplyMatrices(b.projectionMatrix,b.matrixWorldInverse);R.setFromMatrix(ba);this.autoUpdateObjects&&this.initWebGLObjects(a);l(this.renderPluginsPre,a,b);B.info.render.calls=0;B.info.render.vertices=0;B.info.render.faces=0;B.info.render.points=0;this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,
|
|
|
-this.autoClearStencil);g=a.__webglObjects;d=0;for(e=g.length;d<e;d++)if(f=g[d],h=f.object,f.id=d,f.render=!1,h.visible&&(!(h instanceof THREE.Mesh||h instanceof THREE.ParticleSystem)||!h.frustumCulled||R.intersectsObject(h))){var m=h;m._modelViewMatrix.multiplyMatrices(b.matrixWorldInverse,m.matrixWorld);m._normalMatrix.getNormalMatrix(m._modelViewMatrix);var m=f,r=m.buffer,q=void 0,s=q=void 0,s=m.object.material;if(s instanceof THREE.MeshFaceMaterial)q=r.materialIndex,q=s.materials[q],q.transparent?
|
|
|
-(m.transparent=q,m.opaque=null):(m.opaque=q,m.transparent=null);else if(q=s)q.transparent?(m.transparent=q,m.opaque=null):(m.opaque=q,m.transparent=null);f.render=!0;!0===this.sortObjects&&(null!==h.renderDepth?f.z=h.renderDepth:(ra.setFromMatrixPosition(h.matrixWorld),ra.applyProjection(ba),f.z=ra.z))}this.sortObjects&&g.sort(k);g=a.__webglObjectsImmediate;d=0;for(e=g.length;d<e;d++)f=g[d],h=f.object,h.visible&&(h._modelViewMatrix.multiplyMatrices(b.matrixWorldInverse,h.matrixWorld),h._normalMatrix.getNormalMatrix(h._modelViewMatrix),
|
|
|
-h=f.object.material,h.transparent?(f.transparent=h,f.opaque=null):(f.opaque=h,f.transparent=null));a.overrideMaterial?(d=a.overrideMaterial,this.setBlending(d.blending,d.blendEquation,d.blendSrc,d.blendDst),this.setDepthTest(d.depthTest),this.setDepthWrite(d.depthWrite),I(d.polygonOffset,d.polygonOffsetFactor,d.polygonOffsetUnits),p(a.__webglObjects,!1,"",b,i,n,!0,d),t(a.__webglObjectsImmediate,"",b,i,n,!1,d)):(d=null,this.setBlending(THREE.NoBlending),p(a.__webglObjects,!0,"opaque",b,i,n,!1,d),t(a.__webglObjectsImmediate,
|
|
|
-"opaque",b,i,n,!1,d),p(a.__webglObjects,!1,"transparent",b,i,n,!0,d),t(a.__webglObjectsImmediate,"transparent",b,i,n,!0,d));l(this.renderPluginsPost,a,b);c&&(c.generateMipmaps&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter)&&(c instanceof THREE.WebGLRenderTargetCube?(j.bindTexture(j.TEXTURE_CUBE_MAP,c.__webglTexture),j.generateMipmap(j.TEXTURE_CUBE_MAP),j.bindTexture(j.TEXTURE_CUBE_MAP,null)):(j.bindTexture(j.TEXTURE_2D,c.__webglTexture),j.generateMipmap(j.TEXTURE_2D),j.bindTexture(j.TEXTURE_2D,
|
|
|
-null)));this.setDepthTest(!0);this.setDepthWrite(!0)}};this.renderImmediateObject=function(a,b,c,d,e){var f=D(a,b,c,d,e);Y=-1;B.setMaterialFaces(d);e.immediateRenderCallback?e.immediateRenderCallback(f,j,R):e.render(function(a){B.renderBufferImmediate(a,f,d)})};this.initWebGLObjects=function(a){a.__webglObjects||(a.__webglObjects=[],a.__webglObjectsImmediate=[],a.__webglSprites=[],a.__webglFlares=[]);for(;a.__objectsAdded.length;)s(a.__objectsAdded[0],a),a.__objectsAdded.splice(0,1);for(;a.__objectsRemoved.length;)q(a.__objectsRemoved[0],
|
|
|
-a),a.__objectsRemoved.splice(0,1);for(var b=0,h=a.__webglObjects.length;b<h;b++){var g=a.__webglObjects[b].object;void 0===g.__webglInit&&(void 0!==g.__webglActive&&q(g,a),s(g,a));var i=g,k=i.geometry,l=void 0,m=void 0,p=void 0;if(k instanceof THREE.BufferGeometry){var t=j.DYNAMIC_DRAW,v=!k.dynamic,w=k.attributes,z=void 0,y=void 0;for(z in w)y=w[z],y.needsUpdate&&("index"===z?(j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,y.buffer),j.bufferData(j.ELEMENT_ARRAY_BUFFER,y.array,t)):(j.bindBuffer(j.ARRAY_BUFFER,
|
|
|
-y.buffer),j.bufferData(j.ARRAY_BUFFER,y.array,t)),y.needsUpdate=!1),v&&!y.dynamic&&(y.array=null)}else if(i instanceof THREE.Mesh){for(var F=0,A=k.geometryGroupsList.length;F<A;F++)if(l=k.geometryGroupsList[F],p=d(i,l),k.buffersNeedUpdate&&c(l,i),m=p.attributes&&r(p),k.verticesNeedUpdate||k.morphTargetsNeedUpdate||k.elementsNeedUpdate||k.uvsNeedUpdate||k.normalsNeedUpdate||k.colorsNeedUpdate||k.tangentsNeedUpdate||m){var x=l,H=i,C=j.DYNAMIC_DRAW,I=!k.dynamic,E=p;if(x.__inittedArrays){var D=e(E),N=
|
|
|
-E.vertexColors?E.vertexColors:!1,L=f(E),K=D===THREE.SmoothShading,B=void 0,G=void 0,X=void 0,M=void 0,S=void 0,ia=void 0,Y=void 0,da=void 0,R=void 0,T=void 0,Ha=void 0,V=void 0,W=void 0,U=void 0,Ka=void 0,wa=void 0,Ga=void 0,ca=void 0,ea=void 0,fa=void 0,ha=void 0,Sa=void 0,ja=void 0,la=void 0,za=void 0,sa=void 0,ta=void 0,qa=void 0,ua=void 0,$=void 0,Aa=void 0,xa=void 0,Da=void 0,Ia=void 0,ma=void 0,Ma=void 0,va=void 0,Ba=void 0,Ta=void 0,Na=void 0,Ca=0,ya=0,Ua=0,Va=0,Wa=0,hb=0,Ya=0,La=0,eb=0,pa=
|
|
|
-0,Ea=0,O=0,Xa=void 0,ib=x.__vertexArray,Za=x.__uvArray,db=x.__uv2Array,Oa=x.__normalArray,$a=x.__tangentArray,jb=x.__colorArray,ab=x.__skinIndexArray,bb=x.__skinWeightArray,wb=x.__morphTargetsArrays,xb=x.__morphNormalsArrays,sb=x.__webglCustomAttributesList,J=void 0,Mb=x.__faceArray,tb=x.__lineArray,Pa=H.geometry,Hb=Pa.elementsNeedUpdate,Ab=Pa.uvsNeedUpdate,Ib=Pa.normalsNeedUpdate,Jb=Pa.tangentsNeedUpdate,Kb=Pa.colorsNeedUpdate,Lb=Pa.morphTargetsNeedUpdate,ac=Pa.vertices,aa=x.faces3,kb=Pa.faces,Bb=
|
|
|
-Pa.faceVertexUvs[0],Cb=Pa.faceVertexUvs[1],bc=Pa.skinIndices,Nb=Pa.skinWeights,Ob=Pa.morphTargets,gc=Pa.morphNormals;if(Pa.verticesNeedUpdate){B=0;for(G=aa.length;B<G;B++)M=kb[aa[B]],V=ac[M.a],W=ac[M.b],U=ac[M.c],ib[ya]=V.x,ib[ya+1]=V.y,ib[ya+2]=V.z,ib[ya+3]=W.x,ib[ya+4]=W.y,ib[ya+5]=W.z,ib[ya+6]=U.x,ib[ya+7]=U.y,ib[ya+8]=U.z,ya+=9;j.bindBuffer(j.ARRAY_BUFFER,x.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,ib,C)}if(Lb){ma=0;for(Ma=Ob.length;ma<Ma;ma++){B=Ea=0;for(G=aa.length;B<G;B++)Ta=aa[B],M=
|
|
|
-kb[Ta],V=Ob[ma].vertices[M.a],W=Ob[ma].vertices[M.b],U=Ob[ma].vertices[M.c],va=wb[ma],va[Ea]=V.x,va[Ea+1]=V.y,va[Ea+2]=V.z,va[Ea+3]=W.x,va[Ea+4]=W.y,va[Ea+5]=W.z,va[Ea+6]=U.x,va[Ea+7]=U.y,va[Ea+8]=U.z,E.morphNormals&&(K?(Na=gc[ma].vertexNormals[Ta],ca=Na.a,ea=Na.b,fa=Na.c):fa=ea=ca=gc[ma].faceNormals[Ta],Ba=xb[ma],Ba[Ea]=ca.x,Ba[Ea+1]=ca.y,Ba[Ea+2]=ca.z,Ba[Ea+3]=ea.x,Ba[Ea+4]=ea.y,Ba[Ea+5]=ea.z,Ba[Ea+6]=fa.x,Ba[Ea+7]=fa.y,Ba[Ea+8]=fa.z),Ea+=9;j.bindBuffer(j.ARRAY_BUFFER,x.__webglMorphTargetsBuffers[ma]);
|
|
|
-j.bufferData(j.ARRAY_BUFFER,wb[ma],C);E.morphNormals&&(j.bindBuffer(j.ARRAY_BUFFER,x.__webglMorphNormalsBuffers[ma]),j.bufferData(j.ARRAY_BUFFER,xb[ma],C))}}if(Nb.length){B=0;for(G=aa.length;B<G;B++)M=kb[aa[B]],la=Nb[M.a],za=Nb[M.b],sa=Nb[M.c],bb[pa]=la.x,bb[pa+1]=la.y,bb[pa+2]=la.z,bb[pa+3]=la.w,bb[pa+4]=za.x,bb[pa+5]=za.y,bb[pa+6]=za.z,bb[pa+7]=za.w,bb[pa+8]=sa.x,bb[pa+9]=sa.y,bb[pa+10]=sa.z,bb[pa+11]=sa.w,ta=bc[M.a],qa=bc[M.b],ua=bc[M.c],ab[pa]=ta.x,ab[pa+1]=ta.y,ab[pa+2]=ta.z,ab[pa+3]=ta.w,ab[pa+
|
|
|
-4]=qa.x,ab[pa+5]=qa.y,ab[pa+6]=qa.z,ab[pa+7]=qa.w,ab[pa+8]=ua.x,ab[pa+9]=ua.y,ab[pa+10]=ua.z,ab[pa+11]=ua.w,pa+=12;0<pa&&(j.bindBuffer(j.ARRAY_BUFFER,x.__webglSkinIndicesBuffer),j.bufferData(j.ARRAY_BUFFER,ab,C),j.bindBuffer(j.ARRAY_BUFFER,x.__webglSkinWeightsBuffer),j.bufferData(j.ARRAY_BUFFER,bb,C))}if(Kb&&N){B=0;for(G=aa.length;B<G;B++)M=kb[aa[B]],Y=M.vertexColors,da=M.color,3===Y.length&&N===THREE.VertexColors?(ha=Y[0],Sa=Y[1],ja=Y[2]):ja=Sa=ha=da,jb[eb]=ha.r,jb[eb+1]=ha.g,jb[eb+2]=ha.b,jb[eb+
|
|
|
-3]=Sa.r,jb[eb+4]=Sa.g,jb[eb+5]=Sa.b,jb[eb+6]=ja.r,jb[eb+7]=ja.g,jb[eb+8]=ja.b,eb+=9;0<eb&&(j.bindBuffer(j.ARRAY_BUFFER,x.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,jb,C))}if(Jb&&Pa.hasTangents){B=0;for(G=aa.length;B<G;B++)M=kb[aa[B]],R=M.vertexTangents,Ka=R[0],wa=R[1],Ga=R[2],$a[Ya]=Ka.x,$a[Ya+1]=Ka.y,$a[Ya+2]=Ka.z,$a[Ya+3]=Ka.w,$a[Ya+4]=wa.x,$a[Ya+5]=wa.y,$a[Ya+6]=wa.z,$a[Ya+7]=wa.w,$a[Ya+8]=Ga.x,$a[Ya+9]=Ga.y,$a[Ya+10]=Ga.z,$a[Ya+11]=Ga.w,Ya+=12;j.bindBuffer(j.ARRAY_BUFFER,x.__webglTangentBuffer);
|
|
|
-j.bufferData(j.ARRAY_BUFFER,$a,C)}if(Ib&&D){B=0;for(G=aa.length;B<G;B++)if(M=kb[aa[B]],S=M.vertexNormals,ia=M.normal,3===S.length&&K)for($=0;3>$;$++)xa=S[$],Oa[hb]=xa.x,Oa[hb+1]=xa.y,Oa[hb+2]=xa.z,hb+=3;else for($=0;3>$;$++)Oa[hb]=ia.x,Oa[hb+1]=ia.y,Oa[hb+2]=ia.z,hb+=3;j.bindBuffer(j.ARRAY_BUFFER,x.__webglNormalBuffer);j.bufferData(j.ARRAY_BUFFER,Oa,C)}if(Ab&&Bb&&L){B=0;for(G=aa.length;B<G;B++)if(X=aa[B],T=Bb[X],void 0!==T)for($=0;3>$;$++)Da=T[$],Za[Ua]=Da.x,Za[Ua+1]=Da.y,Ua+=2;0<Ua&&(j.bindBuffer(j.ARRAY_BUFFER,
|
|
|
-x.__webglUVBuffer),j.bufferData(j.ARRAY_BUFFER,Za,C))}if(Ab&&Cb&&L){B=0;for(G=aa.length;B<G;B++)if(X=aa[B],Ha=Cb[X],void 0!==Ha)for($=0;3>$;$++)Ia=Ha[$],db[Va]=Ia.x,db[Va+1]=Ia.y,Va+=2;0<Va&&(j.bindBuffer(j.ARRAY_BUFFER,x.__webglUV2Buffer),j.bufferData(j.ARRAY_BUFFER,db,C))}if(Hb){B=0;for(G=aa.length;B<G;B++)Mb[Wa]=Ca,Mb[Wa+1]=Ca+1,Mb[Wa+2]=Ca+2,Wa+=3,tb[La]=Ca,tb[La+1]=Ca+1,tb[La+2]=Ca,tb[La+3]=Ca+2,tb[La+4]=Ca+1,tb[La+5]=Ca+2,La+=6,Ca+=3;j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,x.__webglFaceBuffer);
|
|
|
-j.bufferData(j.ELEMENT_ARRAY_BUFFER,Mb,C);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,x.__webglLineBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,tb,C)}if(sb){$=0;for(Aa=sb.length;$<Aa;$++)if(J=sb[$],J.__original.needsUpdate){O=0;if(1===J.size)if(void 0===J.boundTo||"vertices"===J.boundTo){B=0;for(G=aa.length;B<G;B++)M=kb[aa[B]],J.array[O]=J.value[M.a],J.array[O+1]=J.value[M.b],J.array[O+2]=J.value[M.c],O+=3}else{if("faces"===J.boundTo){B=0;for(G=aa.length;B<G;B++)Xa=J.value[aa[B]],J.array[O]=Xa,J.array[O+1]=
|
|
|
-Xa,J.array[O+2]=Xa,O+=3}}else if(2===J.size)if(void 0===J.boundTo||"vertices"===J.boundTo){B=0;for(G=aa.length;B<G;B++)M=kb[aa[B]],V=J.value[M.a],W=J.value[M.b],U=J.value[M.c],J.array[O]=V.x,J.array[O+1]=V.y,J.array[O+2]=W.x,J.array[O+3]=W.y,J.array[O+4]=U.x,J.array[O+5]=U.y,O+=6}else{if("faces"===J.boundTo){B=0;for(G=aa.length;B<G;B++)U=W=V=Xa=J.value[aa[B]],J.array[O]=V.x,J.array[O+1]=V.y,J.array[O+2]=W.x,J.array[O+3]=W.y,J.array[O+4]=U.x,J.array[O+5]=U.y,O+=6}}else if(3===J.size){var oa;oa="c"===
|
|
|
-J.type?["r","g","b"]:["x","y","z"];if(void 0===J.boundTo||"vertices"===J.boundTo){B=0;for(G=aa.length;B<G;B++)M=kb[aa[B]],V=J.value[M.a],W=J.value[M.b],U=J.value[M.c],J.array[O]=V[oa[0]],J.array[O+1]=V[oa[1]],J.array[O+2]=V[oa[2]],J.array[O+3]=W[oa[0]],J.array[O+4]=W[oa[1]],J.array[O+5]=W[oa[2]],J.array[O+6]=U[oa[0]],J.array[O+7]=U[oa[1]],J.array[O+8]=U[oa[2]],O+=9}else if("faces"===J.boundTo){B=0;for(G=aa.length;B<G;B++)U=W=V=Xa=J.value[aa[B]],J.array[O]=V[oa[0]],J.array[O+1]=V[oa[1]],J.array[O+
|
|
|
-2]=V[oa[2]],J.array[O+3]=W[oa[0]],J.array[O+4]=W[oa[1]],J.array[O+5]=W[oa[2]],J.array[O+6]=U[oa[0]],J.array[O+7]=U[oa[1]],J.array[O+8]=U[oa[2]],O+=9}else if("faceVertices"===J.boundTo){B=0;for(G=aa.length;B<G;B++)Xa=J.value[aa[B]],V=Xa[0],W=Xa[1],U=Xa[2],J.array[O]=V[oa[0]],J.array[O+1]=V[oa[1]],J.array[O+2]=V[oa[2]],J.array[O+3]=W[oa[0]],J.array[O+4]=W[oa[1]],J.array[O+5]=W[oa[2]],J.array[O+6]=U[oa[0]],J.array[O+7]=U[oa[1]],J.array[O+8]=U[oa[2]],O+=9}}else if(4===J.size)if(void 0===J.boundTo||"vertices"===
|
|
|
-J.boundTo){B=0;for(G=aa.length;B<G;B++)M=kb[aa[B]],V=J.value[M.a],W=J.value[M.b],U=J.value[M.c],J.array[O]=V.x,J.array[O+1]=V.y,J.array[O+2]=V.z,J.array[O+3]=V.w,J.array[O+4]=W.x,J.array[O+5]=W.y,J.array[O+6]=W.z,J.array[O+7]=W.w,J.array[O+8]=U.x,J.array[O+9]=U.y,J.array[O+10]=U.z,J.array[O+11]=U.w,O+=12}else if("faces"===J.boundTo){B=0;for(G=aa.length;B<G;B++)U=W=V=Xa=J.value[aa[B]],J.array[O]=V.x,J.array[O+1]=V.y,J.array[O+2]=V.z,J.array[O+3]=V.w,J.array[O+4]=W.x,J.array[O+5]=W.y,J.array[O+6]=W.z,
|
|
|
-J.array[O+7]=W.w,J.array[O+8]=U.x,J.array[O+9]=U.y,J.array[O+10]=U.z,J.array[O+11]=U.w,O+=12}else if("faceVertices"===J.boundTo){B=0;for(G=aa.length;B<G;B++)Xa=J.value[aa[B]],V=Xa[0],W=Xa[1],U=Xa[2],J.array[O]=V.x,J.array[O+1]=V.y,J.array[O+2]=V.z,J.array[O+3]=V.w,J.array[O+4]=W.x,J.array[O+5]=W.y,J.array[O+6]=W.z,J.array[O+7]=W.w,J.array[O+8]=U.x,J.array[O+9]=U.y,J.array[O+10]=U.z,J.array[O+11]=U.w,O+=12}j.bindBuffer(j.ARRAY_BUFFER,J.buffer);j.bufferData(j.ARRAY_BUFFER,J.array,C)}}I&&(delete x.__inittedArrays,
|
|
|
-delete x.__colorArray,delete x.__normalArray,delete x.__tangentArray,delete x.__uvArray,delete x.__uv2Array,delete x.__faceArray,delete x.__vertexArray,delete x.__lineArray,delete x.__skinIndexArray,delete x.__skinWeightArray)}}k.verticesNeedUpdate=!1;k.morphTargetsNeedUpdate=!1;k.elementsNeedUpdate=!1;k.uvsNeedUpdate=!1;k.normalsNeedUpdate=!1;k.colorsNeedUpdate=!1;k.tangentsNeedUpdate=!1;k.buffersNeedUpdate=!1;p.attributes&&u(p)}else if(i instanceof THREE.Line){p=d(i,k);m=p.attributes&&r(p);if(k.verticesNeedUpdate||
|
|
|
-k.colorsNeedUpdate||k.lineDistancesNeedUpdate||m){var cb=k,Pb=j.DYNAMIC_DRAW,Db=void 0,Eb=void 0,Fb=void 0,Qb=void 0,na=void 0,Rb=void 0,hc=cb.vertices,ic=cb.colors,jc=cb.lineDistances,Wb=hc.length,Xb=ic.length,Yb=jc.length,Sb=cb.__vertexArray,Tb=cb.__colorArray,kc=cb.__lineDistanceArray,Zb=cb.colorsNeedUpdate,$b=cb.lineDistancesNeedUpdate,cc=cb.__webglCustomAttributesList,Ub=void 0,lc=void 0,Fa=void 0,yb=void 0,Qa=void 0,ka=void 0;if(cb.verticesNeedUpdate){for(Db=0;Db<Wb;Db++)Qb=hc[Db],na=3*Db,Sb[na]=
|
|
|
-Qb.x,Sb[na+1]=Qb.y,Sb[na+2]=Qb.z;j.bindBuffer(j.ARRAY_BUFFER,cb.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,Sb,Pb)}if(Zb){for(Eb=0;Eb<Xb;Eb++)Rb=ic[Eb],na=3*Eb,Tb[na]=Rb.r,Tb[na+1]=Rb.g,Tb[na+2]=Rb.b;j.bindBuffer(j.ARRAY_BUFFER,cb.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,Tb,Pb)}if($b){for(Fb=0;Fb<Yb;Fb++)kc[Fb]=jc[Fb];j.bindBuffer(j.ARRAY_BUFFER,cb.__webglLineDistanceBuffer);j.bufferData(j.ARRAY_BUFFER,kc,Pb)}if(cc){Ub=0;for(lc=cc.length;Ub<lc;Ub++)if(ka=cc[Ub],ka.needsUpdate&&(void 0===
|
|
|
-ka.boundTo||"vertices"===ka.boundTo)){na=0;yb=ka.value.length;if(1===ka.size)for(Fa=0;Fa<yb;Fa++)ka.array[Fa]=ka.value[Fa];else if(2===ka.size)for(Fa=0;Fa<yb;Fa++)Qa=ka.value[Fa],ka.array[na]=Qa.x,ka.array[na+1]=Qa.y,na+=2;else if(3===ka.size)if("c"===ka.type)for(Fa=0;Fa<yb;Fa++)Qa=ka.value[Fa],ka.array[na]=Qa.r,ka.array[na+1]=Qa.g,ka.array[na+2]=Qa.b,na+=3;else for(Fa=0;Fa<yb;Fa++)Qa=ka.value[Fa],ka.array[na]=Qa.x,ka.array[na+1]=Qa.y,ka.array[na+2]=Qa.z,na+=3;else if(4===ka.size)for(Fa=0;Fa<yb;Fa++)Qa=
|
|
|
-ka.value[Fa],ka.array[na]=Qa.x,ka.array[na+1]=Qa.y,ka.array[na+2]=Qa.z,ka.array[na+3]=Qa.w,na+=4;j.bindBuffer(j.ARRAY_BUFFER,ka.buffer);j.bufferData(j.ARRAY_BUFFER,ka.array,Pb)}}}k.verticesNeedUpdate=!1;k.colorsNeedUpdate=!1;k.lineDistancesNeedUpdate=!1;p.attributes&&u(p)}else if(i instanceof THREE.ParticleSystem){p=d(i,k);m=p.attributes&&r(p);if(k.verticesNeedUpdate||k.colorsNeedUpdate||i.sortParticles||m){var lb=k,dc=j.DYNAMIC_DRAW,Gb=i,Ra=void 0,mb=void 0,nb=void 0,Q=void 0,ob=void 0,rb=void 0,
|
|
|
-Vb=lb.vertices,ec=Vb.length,fc=lb.colors,mc=fc.length,ub=lb.__vertexArray,vb=lb.__colorArray,pb=lb.__sortArray,nc=lb.verticesNeedUpdate,oc=lb.colorsNeedUpdate,qb=lb.__webglCustomAttributesList,fb=void 0,zb=void 0,Z=void 0,gb=void 0,ga=void 0,P=void 0;if(Gb.sortParticles){Ja.copy(ba);Ja.multiply(Gb.matrixWorld);for(Ra=0;Ra<ec;Ra++)nb=Vb[Ra],ra.copy(nb),ra.applyProjection(Ja),pb[Ra]=[ra.z,Ra];pb.sort(n);for(Ra=0;Ra<ec;Ra++)nb=Vb[pb[Ra][1]],Q=3*Ra,ub[Q]=nb.x,ub[Q+1]=nb.y,ub[Q+2]=nb.z;for(mb=0;mb<mc;mb++)Q=
|
|
|
-3*mb,rb=fc[pb[mb][1]],vb[Q]=rb.r,vb[Q+1]=rb.g,vb[Q+2]=rb.b;if(qb){fb=0;for(zb=qb.length;fb<zb;fb++)if(P=qb[fb],void 0===P.boundTo||"vertices"===P.boundTo)if(Q=0,gb=P.value.length,1===P.size)for(Z=0;Z<gb;Z++)ob=pb[Z][1],P.array[Z]=P.value[ob];else if(2===P.size)for(Z=0;Z<gb;Z++)ob=pb[Z][1],ga=P.value[ob],P.array[Q]=ga.x,P.array[Q+1]=ga.y,Q+=2;else if(3===P.size)if("c"===P.type)for(Z=0;Z<gb;Z++)ob=pb[Z][1],ga=P.value[ob],P.array[Q]=ga.r,P.array[Q+1]=ga.g,P.array[Q+2]=ga.b,Q+=3;else for(Z=0;Z<gb;Z++)ob=
|
|
|
-pb[Z][1],ga=P.value[ob],P.array[Q]=ga.x,P.array[Q+1]=ga.y,P.array[Q+2]=ga.z,Q+=3;else if(4===P.size)for(Z=0;Z<gb;Z++)ob=pb[Z][1],ga=P.value[ob],P.array[Q]=ga.x,P.array[Q+1]=ga.y,P.array[Q+2]=ga.z,P.array[Q+3]=ga.w,Q+=4}}else{if(nc)for(Ra=0;Ra<ec;Ra++)nb=Vb[Ra],Q=3*Ra,ub[Q]=nb.x,ub[Q+1]=nb.y,ub[Q+2]=nb.z;if(oc)for(mb=0;mb<mc;mb++)rb=fc[mb],Q=3*mb,vb[Q]=rb.r,vb[Q+1]=rb.g,vb[Q+2]=rb.b;if(qb){fb=0;for(zb=qb.length;fb<zb;fb++)if(P=qb[fb],P.needsUpdate&&(void 0===P.boundTo||"vertices"===P.boundTo))if(gb=
|
|
|
-P.value.length,Q=0,1===P.size)for(Z=0;Z<gb;Z++)P.array[Z]=P.value[Z];else if(2===P.size)for(Z=0;Z<gb;Z++)ga=P.value[Z],P.array[Q]=ga.x,P.array[Q+1]=ga.y,Q+=2;else if(3===P.size)if("c"===P.type)for(Z=0;Z<gb;Z++)ga=P.value[Z],P.array[Q]=ga.r,P.array[Q+1]=ga.g,P.array[Q+2]=ga.b,Q+=3;else for(Z=0;Z<gb;Z++)ga=P.value[Z],P.array[Q]=ga.x,P.array[Q+1]=ga.y,P.array[Q+2]=ga.z,Q+=3;else if(4===P.size)for(Z=0;Z<gb;Z++)ga=P.value[Z],P.array[Q]=ga.x,P.array[Q+1]=ga.y,P.array[Q+2]=ga.z,P.array[Q+3]=ga.w,Q+=4}}if(nc||
|
|
|
-Gb.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,lb.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,ub,dc);if(oc||Gb.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,lb.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,vb,dc);if(qb){fb=0;for(zb=qb.length;fb<zb;fb++)if(P=qb[fb],P.needsUpdate||Gb.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,P.buffer),j.bufferData(j.ARRAY_BUFFER,P.array,dc)}}k.verticesNeedUpdate=!1;k.colorsNeedUpdate=!1;p.attributes&&u(p)}}};this.initMaterial=function(a,b,c,d){var e,f,h,g;a.addEventListener("dispose",
|
|
|
-Lb);var i,k,l,n,p;a instanceof THREE.MeshDepthMaterial?p="depth":a instanceof THREE.MeshNormalMaterial?p="normal":a instanceof THREE.MeshBasicMaterial?p="basic":a instanceof THREE.MeshLambertMaterial?p="lambert":a instanceof THREE.MeshPhongMaterial?p="phong":a instanceof THREE.LineBasicMaterial?p="basic":a instanceof THREE.LineDashedMaterial?p="dashed":a instanceof THREE.ParticleSystemMaterial&&(p="particle_basic");if(p){var m=THREE.ShaderLib[p];a.uniforms=THREE.UniformsUtils.clone(m.uniforms);a.vertexShader=
|
|
|
-m.vertexShader;a.fragmentShader=m.fragmentShader}var r=e=0,q=0,s=m=0;for(f=b.length;s<f;s++)h=b[s],h.onlyShadow||(h instanceof THREE.DirectionalLight&&e++,h instanceof THREE.PointLight&&r++,h instanceof THREE.SpotLight&&q++,h instanceof THREE.HemisphereLight&&m++);f=r;h=q;g=m;q=m=0;for(r=b.length;q<r;q++)s=b[q],s.castShadow&&(s instanceof THREE.SpotLight&&m++,s instanceof THREE.DirectionalLight&&!s.shadowCascade&&m++);n=m;xb&&d&&d.useVertexTexture?l=1024:(b=j.getParameter(j.MAX_VERTEX_UNIFORM_VECTORS),
|
|
|
-b=Math.floor((b-20)/4),void 0!==d&&d instanceof THREE.SkinnedMesh&&(b=Math.min(d.bones.length,b),b<d.bones.length&&console.warn("WebGLRenderer: too many bones - "+d.bones.length+", this GPU supports just "+b+" (try OpenGL instead of ANGLE)")),l=b);a:{var q=a.fragmentShader,r=a.vertexShader,m=a.uniforms,b=a.attributes,s=a.defines,c={map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap,bumpMap:!!a.bumpMap,normalMap:!!a.normalMap,specularMap:!!a.specularMap,vertexColors:a.vertexColors,fog:c,useFog:a.fog,
|
|
|
-fogExp:c instanceof THREE.FogExp2,sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,maxBones:l,useVertexTexture:xb&&d&&d.useVertexTexture,morphTargets:a.morphTargets,morphNormals:a.morphNormals,maxMorphTargets:this.maxMorphTargets,maxMorphNormals:this.maxMorphNormals,maxDirLights:e,maxPointLights:f,maxSpotLights:h,maxHemiLights:g,maxShadows:n,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapType:this.shadowMapType,shadowMapDebug:this.shadowMapDebug,shadowMapCascade:this.shadowMapCascade,
|
|
|
-alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel,wrapAround:a.wrapAround,doubleSided:a.side===THREE.DoubleSide,flipSided:a.side===THREE.BackSide},d=a.index0AttributeName,t,u,v;e=[];p?e.push(p):(e.push(q),e.push(r));for(u in s)e.push(u),e.push(s[u]);for(t in c)e.push(t),e.push(c[t]);p=e.join();t=0;for(u=X.length;t<u;t++)if(e=X[t],e.code===p){e.usedTimes++;k=e.program;break a}t="SHADOWMAP_TYPE_BASIC";c.shadowMapType===THREE.PCFShadowMap?t="SHADOWMAP_TYPE_PCF":c.shadowMapType===THREE.PCFSoftShadowMap&&
|
|
|
-(t="SHADOWMAP_TYPE_PCF_SOFT");u=[];for(v in s)e=s[v],!1!==e&&(e="#define "+v+" "+e,u.push(e));e=u.join("\n");v=j.createProgram();u=["precision "+E+" float;","precision "+E+" int;",e,wb?"#define VERTEX_TEXTURES":"",B.gammaInput?"#define GAMMA_INPUT":"",B.gammaOutput?"#define GAMMA_OUTPUT":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SPOT_LIGHTS "+c.maxSpotLights,"#define MAX_HEMI_LIGHTS "+c.maxHemiLights,"#define MAX_SHADOWS "+c.maxShadows,"#define MAX_BONES "+
|
|
|
-c.maxBones,c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.bumpMap?"#define USE_BUMPMAP":"",c.normalMap?"#define USE_NORMALMAP":"",c.specularMap?"#define USE_SPECULARMAP":"",c.vertexColors?"#define USE_COLOR":"",c.skinning?"#define USE_SKINNING":"",c.useVertexTexture?"#define BONE_TEXTURE":"",c.morphTargets?"#define USE_MORPHTARGETS":"",c.morphNormals?"#define USE_MORPHNORMALS":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.wrapAround?"#define WRAP_AROUND":
|
|
|
-"",c.doubleSided?"#define DOUBLE_SIDED":"",c.flipSided?"#define FLIP_SIDED":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapEnabled?"#define "+t:"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"",c.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 modelMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\n#ifdef USE_MORPHNORMALS\nattribute vec3 morphNormal0;\nattribute vec3 morphNormal1;\nattribute vec3 morphNormal2;\nattribute vec3 morphNormal3;\n#else\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
|
|
|
+(a.__webglInit=!0,a._modelViewMatrix=new THREE.Matrix4,a._normalMatrix=new THREE.Matrix3,void 0!==a.geometry&&void 0===a.geometry.__webglInit&&(a.geometry.__webglInit=!0,a.geometry.addEventListener("dispose",Jb)),f=a.geometry,void 0!==f))if(f instanceof THREE.BufferGeometry){var i,k;for(i in f.attributes)k="index"===i?j.ELEMENT_ARRAY_BUFFER:j.ARRAY_BUFFER,g=f.attributes[i],g.buffer=j.createBuffer(),j.bindBuffer(k,g.buffer),j.bufferData(k,g.array,j.STATIC_DRAW)}else if(a instanceof THREE.Mesh){h=a.material;
|
|
|
+if(void 0===f.geometryGroups){i=f;var n,l,p;k={};var r=i.morphTargets.length,s=i.morphNormals.length,q=h instanceof THREE.MeshFaceMaterial;i.geometryGroups={};h=0;for(n=i.faces.length;h<n;h++)l=i.faces[h],l=q?l.materialIndex:0,void 0===k[l]&&(k[l]={hash:l,counter:0}),p=k[l].hash+"_"+k[l].counter,void 0===i.geometryGroups[p]&&(i.geometryGroups[p]={faces3:[],materialIndex:l,vertices:0,numMorphTargets:r,numMorphNormals:s}),65535<i.geometryGroups[p].vertices+3&&(k[l].counter+=1,p=k[l].hash+"_"+k[l].counter,
|
|
|
+void 0===i.geometryGroups[p]&&(i.geometryGroups[p]={faces3:[],materialIndex:l,vertices:0,numMorphTargets:r,numMorphNormals:s})),i.geometryGroups[p].faces3.push(h),i.geometryGroups[p].vertices+=3;i.geometryGroupsList=[];for(g in i.geometryGroups)i.geometryGroups[g].id=Sa++,i.geometryGroupsList.push(i.geometryGroups[g])}for(e in f.geometryGroups)if(g=f.geometryGroups[e],!g.__webglVertexBuffer){i=g;i.__webglVertexBuffer=j.createBuffer();i.__webglNormalBuffer=j.createBuffer();i.__webglTangentBuffer=j.createBuffer();
|
|
|
+i.__webglColorBuffer=j.createBuffer();i.__webglUVBuffer=j.createBuffer();i.__webglUV2Buffer=j.createBuffer();i.__webglSkinIndicesBuffer=j.createBuffer();i.__webglSkinWeightsBuffer=j.createBuffer();i.__webglFaceBuffer=j.createBuffer();i.__webglLineBuffer=j.createBuffer();r=k=void 0;if(i.numMorphTargets){i.__webglMorphTargetsBuffers=[];k=0;for(r=i.numMorphTargets;k<r;k++)i.__webglMorphTargetsBuffers.push(j.createBuffer())}if(i.numMorphNormals){i.__webglMorphNormalsBuffers=[];k=0;for(r=i.numMorphNormals;k<
|
|
|
+r;k++)i.__webglMorphNormalsBuffers.push(j.createBuffer())}B.info.memory.geometries++;c(g,a);f.verticesNeedUpdate=!0;f.morphTargetsNeedUpdate=!0;f.elementsNeedUpdate=!0;f.uvsNeedUpdate=!0;f.normalsNeedUpdate=!0;f.tangentsNeedUpdate=!0;f.colorsNeedUpdate=!0}}else a instanceof THREE.Line?f.__webglVertexBuffer||(g=f,g.__webglVertexBuffer=j.createBuffer(),g.__webglColorBuffer=j.createBuffer(),g.__webglLineDistanceBuffer=j.createBuffer(),B.info.memory.geometries++,g=f,i=g.vertices.length,g.__vertexArray=
|
|
|
+new Float32Array(3*i),g.__colorArray=new Float32Array(3*i),g.__lineDistanceArray=new Float32Array(1*i),g.__webglLineCount=i,b(g,a),f.verticesNeedUpdate=!0,f.colorsNeedUpdate=!0,f.lineDistancesNeedUpdate=!0):a instanceof THREE.ParticleSystem&&!f.__webglVertexBuffer&&(g=f,g.__webglVertexBuffer=j.createBuffer(),g.__webglColorBuffer=j.createBuffer(),B.info.memory.geometries++,g=f,i=g.vertices.length,g.__vertexArray=new Float32Array(3*i),g.__colorArray=new Float32Array(3*i),g.__sortArray=[],g.__webglParticleCount=
|
|
|
+i,b(g,a),f.verticesNeedUpdate=!0,f.colorsNeedUpdate=!0);if(void 0===a.__webglActive){if(a instanceof THREE.Mesh)if(f=a.geometry,f instanceof THREE.BufferGeometry)m(d.__webglObjects,f,a);else{if(f instanceof THREE.Geometry)for(e in f.geometryGroups)g=f.geometryGroups[e],m(d.__webglObjects,g,a)}else a instanceof THREE.Line||a instanceof THREE.ParticleSystem?(f=a.geometry,m(d.__webglObjects,f,a)):a instanceof THREE.ImmediateRenderObject||a.immediateRenderCallback?d.__webglObjectsImmediate.push({id:null,
|
|
|
+object:a,opaque:null,transparent:null,z:0}):a instanceof THREE.Sprite?d.__webglSprites.push(a):a instanceof THREE.LensFlare&&d.__webglFlares.push(a);a.__webglActive=!0}}function m(a,b,c){a.push({id:null,buffer:b,object:c,opaque:null,transparent:null,z:0})}function r(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function u(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function q(a,b){a instanceof THREE.Mesh||a instanceof THREE.ParticleSystem||a instanceof
|
|
|
+THREE.Line?v(b.__webglObjects,a):a instanceof THREE.Sprite?z(b.__webglSprites,a):a instanceof THREE.LensFlare?z(b.__webglFlares,a):(a instanceof THREE.ImmediateRenderObject||a.immediateRenderCallback)&&v(b.__webglObjectsImmediate,a);delete a.__webglActive}function v(a,b){for(var c=a.length-1;0<=c;c--)a[c].object===b&&a.splice(c,1)}function z(a,b){for(var c=a.length-1;0<=c;c--)a[c]===b&&a.splice(c,1)}function D(a,b,c,d,e){wa=0;d.needsUpdate&&(d.program&&Bb(d),B.initMaterial(d,b,c,e),d.needsUpdate=
|
|
|
+!1);d.morphTargets&&!e.__webglMorphTargetInfluences&&(e.__webglMorphTargetInfluences=new Float32Array(B.maxMorphTargets));var f=!1,h=d.program,g=h.uniforms,i=d.uniforms;h!==Ha&&(j.useProgram(h),Ha=h,f=!0);d.id!==Ga&&(Ga=d.id,f=!0);if(f||a!==Ka)j.uniformMatrix4fv(g.projectionMatrix,!1,a.projectionMatrix.elements),a!==Ka&&(Ka=a);if(d.skinning)if(xb&&e.useVertexTexture){if(null!==g.boneTexture){var k=K();j.uniform1i(g.boneTexture,k);B.setTexture(e.boneTexture,k)}null!==g.boneTextureWidth&&j.uniform1i(g.boneTextureWidth,
|
|
|
+e.boneTextureWidth);null!==g.boneTextureHeight&&j.uniform1i(g.boneTextureHeight,e.boneTextureHeight)}else null!==g.boneGlobalMatrices&&j.uniformMatrix4fv(g.boneGlobalMatrices,!1,e.boneMatrices);if(f){c&&d.fog&&(i.fogColor.value=c.color,c instanceof THREE.Fog?(i.fogNear.value=c.near,i.fogFar.value=c.far):c instanceof THREE.FogExp2&&(i.fogDensity.value=c.density));if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){if(ua){for(var n,l=k=0,p=0,m,r,s,q=Oa,t=q.directional.colors,
|
|
|
+u=q.directional.positions,v=q.point.colors,w=q.point.positions,z=q.point.distances,y=q.spot.colors,x=q.spot.positions,I=q.spot.distances,E=q.spot.directions,D=q.spot.anglesCos,L=q.spot.exponents,N=q.hemi.skyColors,G=q.hemi.groundColors,X=q.hemi.positions,S=0,ia=0,da=0,T=0,ba=0,V=0,W=0,U=0,R=n=0,c=s=R=0,f=b.length;c<f;c++)n=b[c],n.onlyShadow||(m=n.color,r=n.intensity,s=n.distance,n instanceof THREE.AmbientLight?n.visible&&(B.gammaInput?(k+=m.r*m.r,l+=m.g*m.g,p+=m.b*m.b):(k+=m.r,l+=m.g,p+=m.b)):n instanceof
|
|
|
+THREE.DirectionalLight?(ba+=1,n.visible&&(fa.setFromMatrixPosition(n.matrixWorld),ra.setFromMatrixPosition(n.target.matrixWorld),fa.sub(ra),fa.normalize(),0===fa.x&&0===fa.y&&0===fa.z||(n=3*S,u[n]=fa.x,u[n+1]=fa.y,u[n+2]=fa.z,B.gammaInput?F(t,n,m,r*r):H(t,n,m,r),S+=1))):n instanceof THREE.PointLight?(V+=1,n.visible&&(R=3*ia,B.gammaInput?F(v,R,m,r*r):H(v,R,m,r),ra.setFromMatrixPosition(n.matrixWorld),w[R]=ra.x,w[R+1]=ra.y,w[R+2]=ra.z,z[ia]=s,ia+=1)):n instanceof THREE.SpotLight?(W+=1,n.visible&&(R=
|
|
|
+3*da,B.gammaInput?F(y,R,m,r*r):H(y,R,m,r),ra.setFromMatrixPosition(n.matrixWorld),x[R]=ra.x,x[R+1]=ra.y,x[R+2]=ra.z,I[da]=s,fa.copy(ra),ra.setFromMatrixPosition(n.target.matrixWorld),fa.sub(ra),fa.normalize(),E[R]=fa.x,E[R+1]=fa.y,E[R+2]=fa.z,D[da]=Math.cos(n.angle),L[da]=n.exponent,da+=1)):n instanceof THREE.HemisphereLight&&(U+=1,n.visible&&(fa.setFromMatrixPosition(n.matrixWorld),fa.normalize(),0===fa.x&&0===fa.y&&0===fa.z||(s=3*T,X[s]=fa.x,X[s+1]=fa.y,X[s+2]=fa.z,m=n.color,n=n.groundColor,B.gammaInput?
|
|
|
+(r*=r,F(N,s,m,r),F(G,s,n,r)):(H(N,s,m,r),H(G,s,n,r)),T+=1))));c=3*S;for(f=Math.max(t.length,3*ba);c<f;c++)t[c]=0;c=3*ia;for(f=Math.max(v.length,3*V);c<f;c++)v[c]=0;c=3*da;for(f=Math.max(y.length,3*W);c<f;c++)y[c]=0;c=3*T;for(f=Math.max(N.length,3*U);c<f;c++)N[c]=0;c=3*T;for(f=Math.max(G.length,3*U);c<f;c++)G[c]=0;q.directional.length=S;q.point.length=ia;q.spot.length=da;q.hemi.length=T;q.ambient[0]=k;q.ambient[1]=l;q.ambient[2]=p;ua=!1}c=Oa;i.ambientLightColor.value=c.ambient;i.directionalLightColor.value=
|
|
|
+c.directional.colors;i.directionalLightDirection.value=c.directional.positions;i.pointLightColor.value=c.point.colors;i.pointLightPosition.value=c.point.positions;i.pointLightDistance.value=c.point.distances;i.spotLightColor.value=c.spot.colors;i.spotLightPosition.value=c.spot.positions;i.spotLightDistance.value=c.spot.distances;i.spotLightDirection.value=c.spot.directions;i.spotLightAngleCos.value=c.spot.anglesCos;i.spotLightExponent.value=c.spot.exponents;i.hemisphereLightSkyColor.value=c.hemi.skyColors;
|
|
|
+i.hemisphereLightGroundColor.value=c.hemi.groundColors;i.hemisphereLightDirection.value=c.hemi.positions}if(d instanceof THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshPhongMaterial){i.opacity.value=d.opacity;B.gammaInput?i.diffuse.value.copyGammaToLinear(d.color):i.diffuse.value=d.color;i.map.value=d.map;i.lightMap.value=d.lightMap;i.specularMap.value=d.specularMap;d.bumpMap&&(i.bumpMap.value=d.bumpMap,i.bumpScale.value=d.bumpScale);d.normalMap&&(i.normalMap.value=
|
|
|
+d.normalMap,i.normalScale.value.copy(d.normalScale));var Y;d.map?Y=d.map:d.specularMap?Y=d.specularMap:d.normalMap?Y=d.normalMap:d.bumpMap&&(Y=d.bumpMap);void 0!==Y&&(c=Y.offset,Y=Y.repeat,i.offsetRepeat.value.set(c.x,c.y,Y.x,Y.y));i.envMap.value=d.envMap;i.flipEnvMap.value=d.envMap instanceof THREE.WebGLRenderTargetCube?1:-1;i.reflectivity.value=d.reflectivity;i.refractionRatio.value=d.refractionRatio;i.combine.value=d.combine;i.useRefract.value=d.envMap&&d.envMap.mapping instanceof THREE.CubeRefractionMapping}d instanceof
|
|
|
+THREE.LineBasicMaterial?(i.diffuse.value=d.color,i.opacity.value=d.opacity):d instanceof THREE.LineDashedMaterial?(i.diffuse.value=d.color,i.opacity.value=d.opacity,i.dashSize.value=d.dashSize,i.totalSize.value=d.dashSize+d.gapSize,i.scale.value=d.scale):d instanceof THREE.ParticleSystemMaterial?(i.psColor.value=d.color,i.opacity.value=d.opacity,i.size.value=d.size,i.scale.value=M.height/2,i.map.value=d.map):d instanceof THREE.MeshPhongMaterial?(i.shininess.value=d.shininess,B.gammaInput?(i.ambient.value.copyGammaToLinear(d.ambient),
|
|
|
+i.emissive.value.copyGammaToLinear(d.emissive),i.specular.value.copyGammaToLinear(d.specular)):(i.ambient.value=d.ambient,i.emissive.value=d.emissive,i.specular.value=d.specular),d.wrapAround&&i.wrapRGB.value.copy(d.wrapRGB)):d instanceof THREE.MeshLambertMaterial?(B.gammaInput?(i.ambient.value.copyGammaToLinear(d.ambient),i.emissive.value.copyGammaToLinear(d.emissive)):(i.ambient.value=d.ambient,i.emissive.value=d.emissive),d.wrapAround&&i.wrapRGB.value.copy(d.wrapRGB)):d instanceof THREE.MeshDepthMaterial?
|
|
|
+(i.mNear.value=a.near,i.mFar.value=a.far,i.opacity.value=d.opacity):d instanceof THREE.MeshNormalMaterial&&(i.opacity.value=d.opacity);if(e.receiveShadow&&!d._shadowPass&&i.shadowMatrix){c=Y=0;for(f=b.length;c<f;c++)if(k=b[c],k.castShadow&&(k instanceof THREE.SpotLight||k instanceof THREE.DirectionalLight&&!k.shadowCascade))i.shadowMap.value[Y]=k.shadowMap,i.shadowMapSize.value[Y]=k.shadowMapSize,i.shadowMatrix.value[Y]=k.shadowMatrix,i.shadowDarkness.value[Y]=k.shadowDarkness,i.shadowBias.value[Y]=
|
|
|
+k.shadowBias,Y++}b=d.uniformsList;i=0;for(Y=b.length;i<Y;i++)if(f=h.uniforms[b[i][1]])if(c=b[i][0],l=c.type,k=c.value,"i"===l)j.uniform1i(f,k);else if("f"===l)j.uniform1f(f,k);else if("v2"===l)j.uniform2f(f,k.x,k.y);else if("v3"===l)j.uniform3f(f,k.x,k.y,k.z);else if("v4"===l)j.uniform4f(f,k.x,k.y,k.z,k.w);else if("c"===l)j.uniform3f(f,k.r,k.g,k.b);else if("iv1"===l)j.uniform1iv(f,k);else if("iv"===l)j.uniform3iv(f,k);else if("fv1"===l)j.uniform1fv(f,k);else if("fv"===l)j.uniform3fv(f,k);else if("v2v"===
|
|
|
+l){void 0===c._array&&(c._array=new Float32Array(2*k.length));l=0;for(p=k.length;l<p;l++)q=2*l,c._array[q]=k[l].x,c._array[q+1]=k[l].y;j.uniform2fv(f,c._array)}else if("v3v"===l){void 0===c._array&&(c._array=new Float32Array(3*k.length));l=0;for(p=k.length;l<p;l++)q=3*l,c._array[q]=k[l].x,c._array[q+1]=k[l].y,c._array[q+2]=k[l].z;j.uniform3fv(f,c._array)}else if("v4v"===l){void 0===c._array&&(c._array=new Float32Array(4*k.length));l=0;for(p=k.length;l<p;l++)q=4*l,c._array[q]=k[l].x,c._array[q+1]=
|
|
|
+k[l].y,c._array[q+2]=k[l].z,c._array[q+3]=k[l].w;j.uniform4fv(f,c._array)}else if("m4"===l)void 0===c._array&&(c._array=new Float32Array(16)),k.flattenToArray(c._array),j.uniformMatrix4fv(f,!1,c._array);else if("m4v"===l){void 0===c._array&&(c._array=new Float32Array(16*k.length));l=0;for(p=k.length;l<p;l++)k[l].flattenToArrayOffset(c._array,16*l);j.uniformMatrix4fv(f,!1,c._array)}else if("t"===l){if(q=k,k=K(),j.uniform1i(f,k),q)if(q.image instanceof Array&&6===q.image.length){if(c=q,f=k,6===c.image.length)if(c.needsUpdate){c.image.__webglTextureCube||
|
|
|
+(c.addEventListener("dispose",sb),c.image.__webglTextureCube=j.createTexture(),B.info.memory.textures++);j.activeTexture(j.TEXTURE0+f);j.bindTexture(j.TEXTURE_CUBE_MAP,c.image.__webglTextureCube);j.pixelStorei(j.UNPACK_FLIP_Y_WEBGL,c.flipY);f=c instanceof THREE.CompressedTexture;k=[];for(l=0;6>l;l++)B.autoScaleCubemaps&&!f?(p=k,q=l,t=c.image[l],v=Yb,t.width<=v&&t.height<=v||(w=Math.max(t.width,t.height),u=Math.floor(t.width*v/w),v=Math.floor(t.height*v/w),w=document.createElement("canvas"),w.width=
|
|
|
+u,w.height=v,w.getContext("2d").drawImage(t,0,0,t.width,t.height,0,0,u,v),t=w),p[q]=t):k[l]=c.image[l];l=k[0];p=THREE.Math.isPowerOfTwo(l.width)&&THREE.Math.isPowerOfTwo(l.height);q=A(c.format);t=A(c.type);C(j.TEXTURE_CUBE_MAP,c,p);for(l=0;6>l;l++)if(f){v=k[l].mipmaps;w=0;for(z=v.length;w<z;w++)u=v[w],c.format!==THREE.RGBAFormat?j.compressedTexImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+l,w,q,u.width,u.height,0,u.data):j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+l,w,q,u.width,u.height,0,q,t,u.data)}else j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+
|
|
|
+l,0,q,q,t,k[l]);c.generateMipmaps&&p&&j.generateMipmap(j.TEXTURE_CUBE_MAP);c.needsUpdate=!1;if(c.onUpdate)c.onUpdate()}else j.activeTexture(j.TEXTURE0+f),j.bindTexture(j.TEXTURE_CUBE_MAP,c.image.__webglTextureCube)}else q instanceof THREE.WebGLRenderTargetCube?(c=q,j.activeTexture(j.TEXTURE0+k),j.bindTexture(j.TEXTURE_CUBE_MAP,c.__webglTexture)):B.setTexture(q,k)}else if("tv"===l){void 0===c._array&&(c._array=[]);l=0;for(p=c.value.length;l<p;l++)c._array[l]=K();j.uniform1iv(f,c._array);l=0;for(p=
|
|
|
+c.value.length;l<p;l++)q=c.value[l],k=c._array[l],q&&B.setTexture(q,k)}else console.warn("THREE.WebGLRenderer: Unknown uniform type: "+l);if((d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&null!==g.cameraPosition)ra.setFromMatrixPosition(a.matrixWorld),j.uniform3f(g.cameraPosition,ra.x,ra.y,ra.z);(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.ShaderMaterial||d.skinning)&&null!==g.viewMatrix&&j.uniformMatrix4fv(g.viewMatrix,
|
|
|
+!1,a.matrixWorldInverse.elements)}j.uniformMatrix4fv(g.modelViewMatrix,!1,e._modelViewMatrix.elements);g.normalMatrix&&j.uniformMatrix3fv(g.normalMatrix,!1,e._normalMatrix.elements);null!==g.modelMatrix&&j.uniformMatrix4fv(g.modelMatrix,!1,e.matrixWorld.elements);return h}function K(){var a=wa;a>=Hb&&console.warn("WebGLRenderer: trying to use "+a+" texture units while this GPU supports only "+Hb);wa+=1;return a}function F(a,b,c,d){a[b]=c.r*c.r*d;a[b+1]=c.g*c.g*d;a[b+2]=c.b*c.b*d}function H(a,b,c,
|
|
|
+d){a[b]=c.r*d;a[b+1]=c.g*d;a[b+2]=c.b*d}function w(a){a!==ea&&(j.lineWidth(a),ea=a)}function I(a,b,c){la!==a&&(a?j.enable(j.POLYGON_OFFSET_FILL):j.disable(j.POLYGON_OFFSET_FILL),la=a);if(a&&(va!==b||xa!==c))j.polygonOffset(b,c),va=b,xa=c}function N(a){for(var a=a.split("\n"),b=0,c=a.length;b<c;b++)a[b]=b+1+": "+a[b];return a.join("\n")}function x(a,b){var c;"fragment"===a?c=j.createShader(j.FRAGMENT_SHADER):"vertex"===a&&(c=j.createShader(j.VERTEX_SHADER));j.shaderSource(c,b);j.compileShader(c);return!j.getShaderParameter(c,
|
|
|
+j.COMPILE_STATUS)?(console.error(j.getShaderInfoLog(c)),console.error(N(b)),null):c}function C(a,b,c){c?(j.texParameteri(a,j.TEXTURE_WRAP_S,A(b.wrapS)),j.texParameteri(a,j.TEXTURE_WRAP_T,A(b.wrapT)),j.texParameteri(a,j.TEXTURE_MAG_FILTER,A(b.magFilter)),j.texParameteri(a,j.TEXTURE_MIN_FILTER,A(b.minFilter))):(j.texParameteri(a,j.TEXTURE_WRAP_S,j.CLAMP_TO_EDGE),j.texParameteri(a,j.TEXTURE_WRAP_T,j.CLAMP_TO_EDGE),j.texParameteri(a,j.TEXTURE_MAG_FILTER,L(b.magFilter)),j.texParameteri(a,j.TEXTURE_MIN_FILTER,
|
|
|
+L(b.minFilter)));if(Na&&b.type!==THREE.FloatType&&(1<b.anisotropy||b.__oldAnisotropy))j.texParameterf(a,Na.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(b.anisotropy,Ab)),b.__oldAnisotropy=b.anisotropy}function y(a,b){j.bindRenderbuffer(j.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?(j.renderbufferStorage(j.RENDERBUFFER,j.DEPTH_COMPONENT16,b.width,b.height),j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_ATTACHMENT,j.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(j.renderbufferStorage(j.RENDERBUFFER,j.DEPTH_STENCIL,
|
|
|
+b.width,b.height),j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_STENCIL_ATTACHMENT,j.RENDERBUFFER,a)):j.renderbufferStorage(j.RENDERBUFFER,j.RGBA4,b.width,b.height)}function L(a){return a===THREE.NearestFilter||a===THREE.NearestMipMapNearestFilter||a===THREE.NearestMipMapLinearFilter?j.NEAREST:j.LINEAR}function A(a){if(a===THREE.RepeatWrapping)return j.REPEAT;if(a===THREE.ClampToEdgeWrapping)return j.CLAMP_TO_EDGE;if(a===THREE.MirroredRepeatWrapping)return j.MIRRORED_REPEAT;if(a===THREE.NearestFilter)return j.NEAREST;
|
|
|
+if(a===THREE.NearestMipMapNearestFilter)return j.NEAREST_MIPMAP_NEAREST;if(a===THREE.NearestMipMapLinearFilter)return j.NEAREST_MIPMAP_LINEAR;if(a===THREE.LinearFilter)return j.LINEAR;if(a===THREE.LinearMipMapNearestFilter)return j.LINEAR_MIPMAP_NEAREST;if(a===THREE.LinearMipMapLinearFilter)return j.LINEAR_MIPMAP_LINEAR;if(a===THREE.UnsignedByteType)return j.UNSIGNED_BYTE;if(a===THREE.UnsignedShort4444Type)return j.UNSIGNED_SHORT_4_4_4_4;if(a===THREE.UnsignedShort5551Type)return j.UNSIGNED_SHORT_5_5_5_1;
|
|
|
+if(a===THREE.UnsignedShort565Type)return j.UNSIGNED_SHORT_5_6_5;if(a===THREE.ByteType)return j.BYTE;if(a===THREE.ShortType)return j.SHORT;if(a===THREE.UnsignedShortType)return j.UNSIGNED_SHORT;if(a===THREE.IntType)return j.INT;if(a===THREE.UnsignedIntType)return j.UNSIGNED_INT;if(a===THREE.FloatType)return j.FLOAT;if(a===THREE.AlphaFormat)return j.ALPHA;if(a===THREE.RGBFormat)return j.RGB;if(a===THREE.RGBAFormat)return j.RGBA;if(a===THREE.LuminanceFormat)return j.LUMINANCE;if(a===THREE.LuminanceAlphaFormat)return j.LUMINANCE_ALPHA;
|
|
|
+if(a===THREE.AddEquation)return j.FUNC_ADD;if(a===THREE.SubtractEquation)return j.FUNC_SUBTRACT;if(a===THREE.ReverseSubtractEquation)return j.FUNC_REVERSE_SUBTRACT;if(a===THREE.ZeroFactor)return j.ZERO;if(a===THREE.OneFactor)return j.ONE;if(a===THREE.SrcColorFactor)return j.SRC_COLOR;if(a===THREE.OneMinusSrcColorFactor)return j.ONE_MINUS_SRC_COLOR;if(a===THREE.SrcAlphaFactor)return j.SRC_ALPHA;if(a===THREE.OneMinusSrcAlphaFactor)return j.ONE_MINUS_SRC_ALPHA;if(a===THREE.DstAlphaFactor)return j.DST_ALPHA;
|
|
|
+if(a===THREE.OneMinusDstAlphaFactor)return j.ONE_MINUS_DST_ALPHA;if(a===THREE.DstColorFactor)return j.DST_COLOR;if(a===THREE.OneMinusDstColorFactor)return j.ONE_MINUS_DST_COLOR;if(a===THREE.SrcAlphaSaturateFactor)return j.SRC_ALPHA_SATURATE;if(void 0!==Ma){if(a===THREE.RGB_S3TC_DXT1_Format)return Ma.COMPRESSED_RGB_S3TC_DXT1_EXT;if(a===THREE.RGBA_S3TC_DXT1_Format)return Ma.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(a===THREE.RGBA_S3TC_DXT3_Format)return Ma.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(a===THREE.RGBA_S3TC_DXT5_Format)return Ma.COMPRESSED_RGBA_S3TC_DXT5_EXT}return 0}
|
|
|
+console.log("THREE.WebGLRenderer",THREE.REVISION);var a=a||{},M=void 0!==a.canvas?a.canvas:document.createElement("canvas"),E=void 0!==a.precision?a.precision:"highp",S=void 0!==a.alpha?a.alpha:!1,ha=void 0!==a.premultipliedAlpha?a.premultipliedAlpha:!0,Aa=void 0!==a.antialias?a.antialias:!1,G=void 0!==a.stencil?a.stencil:!0,T=void 0!==a.preserveDrawingBuffer?a.preserveDrawingBuffer:!1,ca=new THREE.Color(0),ja=0;this.domElement=M;this.context=null;this.devicePixelRatio=void 0!==a.devicePixelRatio?
|
|
|
+a.devicePixelRatio:void 0!==self.devicePixelRatio?self.devicePixelRatio:1;this.autoUpdateObjects=this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.shadowMapEnabled=this.gammaOutput=this.gammaInput=!1;this.shadowMapAutoUpdate=!0;this.shadowMapType=THREE.PCFShadowMap;this.shadowMapCullFace=THREE.CullFaceFront;this.shadowMapCascade=this.shadowMapDebug=!1;this.maxMorphTargets=8;this.maxMorphNormals=4;this.autoScaleCubemaps=!0;this.renderPluginsPre=[];
|
|
|
+this.renderPluginsPost=[];this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0,points:0}};var B=this,X=[],ia=0,Ha=null,da=null,Ga=-1,Y=null,Ka=null,Sa=0,wa=0,za=-1,sa=-1,ta=-1,Ba=-1,Ta=-1,Ca=-1,Ua=-1,Va=-1,la=null,va=null,xa=null,ea=null,qa=0,Ia=0,ma=M.width,ya=M.height,Wa=0,La=0,Da={},R=new THREE.Frustum,ba=new THREE.Matrix4,Ja=new THREE.Matrix4,ra=new THREE.Vector3,fa=new THREE.Vector3,ua=!0,Oa={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,
|
|
|
+colors:[],positions:[],distances:[]},spot:{length:0,colors:[],positions:[],distances:[],directions:[],anglesCos:[],exponents:[]},hemi:{length:0,skyColors:[],groundColors:[],positions:[]}},j,db,$,Na,Ma;try{var Za={alpha:S,premultipliedAlpha:ha,antialias:Aa,stencil:G,preserveDrawingBuffer:T};j=M.getContext("webgl",Za)||M.getContext("experimental-webgl",Za);if(null===j)throw"Error creating WebGL context.";}catch(Wb){console.error(Wb)}db=j.getExtension("OES_texture_float");j.getExtension("OES_texture_float_linear");
|
|
|
+$=j.getExtension("OES_standard_derivatives");Na=j.getExtension("EXT_texture_filter_anisotropic")||j.getExtension("MOZ_EXT_texture_filter_anisotropic")||j.getExtension("WEBKIT_EXT_texture_filter_anisotropic");Ma=j.getExtension("WEBGL_compressed_texture_s3tc")||j.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||j.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");db||console.log("THREE.WebGLRenderer: Float textures not supported.");$||console.log("THREE.WebGLRenderer: Standard derivatives not supported.");
|
|
|
+Na||console.log("THREE.WebGLRenderer: Anisotropic texture filtering not supported.");Ma||console.log("THREE.WebGLRenderer: S3TC compressed textures not supported.");void 0===j.getShaderPrecisionFormat&&(j.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}});j.clearColor(0,0,0,1);j.clearDepth(1);j.clearStencil(0);j.enable(j.DEPTH_TEST);j.depthFunc(j.LEQUAL);j.frontFace(j.CCW);j.cullFace(j.BACK);j.enable(j.CULL_FACE);j.enable(j.BLEND);j.blendEquation(j.FUNC_ADD);j.blendFunc(j.SRC_ALPHA,
|
|
|
+j.ONE_MINUS_SRC_ALPHA);j.viewport(qa,Ia,ma,ya);j.clearColor(ca.r,ca.g,ca.b,ja);this.context=j;var Hb=j.getParameter(j.MAX_TEXTURE_IMAGE_UNITS),Xb=j.getParameter(j.MAX_VERTEX_TEXTURE_IMAGE_UNITS);j.getParameter(j.MAX_TEXTURE_SIZE);var Yb=j.getParameter(j.MAX_CUBE_MAP_TEXTURE_SIZE),Ab=Na?j.getParameter(Na.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0,wb=0<Xb,xb=wb&&db;Ma&&j.getParameter(j.COMPRESSED_TEXTURE_FORMATS);var Zb=j.getShaderPrecisionFormat(j.VERTEX_SHADER,j.HIGH_FLOAT),$b=j.getShaderPrecisionFormat(j.VERTEX_SHADER,
|
|
|
+j.MEDIUM_FLOAT);j.getShaderPrecisionFormat(j.VERTEX_SHADER,j.LOW_FLOAT);var pc=j.getShaderPrecisionFormat(j.FRAGMENT_SHADER,j.HIGH_FLOAT),qc=j.getShaderPrecisionFormat(j.FRAGMENT_SHADER,j.MEDIUM_FLOAT);j.getShaderPrecisionFormat(j.FRAGMENT_SHADER,j.LOW_FLOAT);j.getShaderPrecisionFormat(j.VERTEX_SHADER,j.HIGH_INT);j.getShaderPrecisionFormat(j.VERTEX_SHADER,j.MEDIUM_INT);j.getShaderPrecisionFormat(j.VERTEX_SHADER,j.LOW_INT);j.getShaderPrecisionFormat(j.FRAGMENT_SHADER,j.HIGH_INT);j.getShaderPrecisionFormat(j.FRAGMENT_SHADER,
|
|
|
+j.MEDIUM_INT);j.getShaderPrecisionFormat(j.FRAGMENT_SHADER,j.LOW_INT);var rc=0<Zb.precision&&0<pc.precision,Ib=0<$b.precision&&0<qc.precision;"highp"===E&&!rc&&(Ib?(E="mediump",console.warn("WebGLRenderer: highp not supported, using mediump")):(E="lowp",console.warn("WebGLRenderer: highp and mediump not supported, using lowp")));"mediump"===E&&!Ib&&(E="lowp",console.warn("WebGLRenderer: mediump not supported, using lowp"));this.getContext=function(){return j};this.supportsVertexTextures=function(){return wb};
|
|
|
+this.supportsFloatTextures=function(){return db};this.supportsStandardDerivatives=function(){return $};this.supportsCompressedTextureS3TC=function(){return Ma};this.getMaxAnisotropy=function(){return Ab};this.getPrecision=function(){return E};this.setSize=function(a,b,c){M.width=a*this.devicePixelRatio;M.height=b*this.devicePixelRatio;1!==this.devicePixelRatio&&!1!==c&&(M.style.width=a+"px",M.style.height=b+"px");this.setViewport(0,0,a,b)};this.setViewport=function(a,b,c,d){qa=a*this.devicePixelRatio;
|
|
|
+Ia=b*this.devicePixelRatio;ma=c*this.devicePixelRatio;ya=d*this.devicePixelRatio;j.viewport(qa,Ia,ma,ya)};this.setScissor=function(a,b,c,d){j.scissor(a*this.devicePixelRatio,b*this.devicePixelRatio,c*this.devicePixelRatio,d*this.devicePixelRatio)};this.enableScissorTest=function(a){a?j.enable(j.SCISSOR_TEST):j.disable(j.SCISSOR_TEST)};this.setClearColor=function(a,b){ca.set(a);ja=void 0!==b?b:1;j.clearColor(ca.r,ca.g,ca.b,ja)};this.setClearColorHex=function(a,b){console.warn("DEPRECATED: .setClearColorHex() is being removed. Use .setClearColor() instead.");
|
|
|
+this.setClearColor(a,b)};this.getClearColor=function(){return ca};this.getClearAlpha=function(){return ja};this.clear=function(a,b,c){var d=0;if(void 0===a||a)d|=j.COLOR_BUFFER_BIT;if(void 0===b||b)d|=j.DEPTH_BUFFER_BIT;if(void 0===c||c)d|=j.STENCIL_BUFFER_BIT;j.clear(d)};this.clearColor=function(){j.clear(j.COLOR_BUFFER_BIT)};this.clearDepth=function(){j.clear(j.DEPTH_BUFFER_BIT)};this.clearStencil=function(){j.clear(j.STENCIL_BUFFER_BIT)};this.clearTarget=function(a,b,c,d){this.setRenderTarget(a);
|
|
|
+this.clear(b,c,d)};this.addPostPlugin=function(a){a.init(this);this.renderPluginsPost.push(a)};this.addPrePlugin=function(a){a.init(this);this.renderPluginsPre.push(a)};this.updateShadowMap=function(a,b){Ha=null;Ga=Y=Va=Ua=ta=-1;ua=!0;sa=za=-1;this.shadowMapPlugin.update(a,b)};var Jb=function(a){a=a.target;a.removeEventListener("dispose",Jb);a.__webglInit=void 0;if(a instanceof THREE.BufferGeometry){var b=a.attributes,c;for(c in b)void 0!==b[c].buffer&&j.deleteBuffer(b[c].buffer);B.info.memory.geometries--}else if(void 0!==
|
|
|
+a.geometryGroups)for(b in a.geometryGroups){c=a.geometryGroups[b];if(void 0!==c.numMorphTargets)for(var d=0,e=c.numMorphTargets;d<e;d++)j.deleteBuffer(c.__webglMorphTargetsBuffers[d]);if(void 0!==c.numMorphNormals){d=0;for(e=c.numMorphNormals;d<e;d++)j.deleteBuffer(c.__webglMorphNormalsBuffers[d])}Cb(c)}else Cb(a)},sb=function(a){a=a.target;a.removeEventListener("dispose",sb);a.image&&a.image.__webglTextureCube?j.deleteTexture(a.image.__webglTextureCube):a.__webglInit&&(a.__webglInit=!1,j.deleteTexture(a.__webglTexture));
|
|
|
+B.info.memory.textures--},Kb=function(a){a=a.target;a.removeEventListener("dispose",Kb);if(a&&a.__webglTexture)if(j.deleteTexture(a.__webglTexture),a instanceof THREE.WebGLRenderTargetCube)for(var b=0;6>b;b++)j.deleteFramebuffer(a.__webglFramebuffer[b]),j.deleteRenderbuffer(a.__webglRenderbuffer[b]);else j.deleteFramebuffer(a.__webglFramebuffer),j.deleteRenderbuffer(a.__webglRenderbuffer);B.info.memory.textures--},Lb=function(a){a=a.target;a.removeEventListener("dispose",Lb);Bb(a)},Cb=function(a){void 0!==
|
|
|
+a.__webglVertexBuffer&&j.deleteBuffer(a.__webglVertexBuffer);void 0!==a.__webglNormalBuffer&&j.deleteBuffer(a.__webglNormalBuffer);void 0!==a.__webglTangentBuffer&&j.deleteBuffer(a.__webglTangentBuffer);void 0!==a.__webglColorBuffer&&j.deleteBuffer(a.__webglColorBuffer);void 0!==a.__webglUVBuffer&&j.deleteBuffer(a.__webglUVBuffer);void 0!==a.__webglUV2Buffer&&j.deleteBuffer(a.__webglUV2Buffer);void 0!==a.__webglSkinIndicesBuffer&&j.deleteBuffer(a.__webglSkinIndicesBuffer);void 0!==a.__webglSkinWeightsBuffer&&
|
|
|
+j.deleteBuffer(a.__webglSkinWeightsBuffer);void 0!==a.__webglFaceBuffer&&j.deleteBuffer(a.__webglFaceBuffer);void 0!==a.__webglLineBuffer&&j.deleteBuffer(a.__webglLineBuffer);void 0!==a.__webglLineDistanceBuffer&&j.deleteBuffer(a.__webglLineDistanceBuffer);if(void 0!==a.__webglCustomAttributesList)for(var b in a.__webglCustomAttributesList)j.deleteBuffer(a.__webglCustomAttributesList[b].buffer);B.info.memory.geometries--},Bb=function(a){var b=a.program;if(void 0!==b){a.program=void 0;var c,d,e=!1,
|
|
|
+a=0;for(c=X.length;a<c;a++)if(d=X[a],d.program===b){d.usedTimes--;0===d.usedTimes&&(e=!0);break}if(!0===e){e=[];a=0;for(c=X.length;a<c;a++)d=X[a],d.program!==b&&e.push(d);X=e;j.deleteProgram(b);B.info.memory.programs--}}};this.renderBufferImmediate=function(a,b,c){a.hasPositions&&!a.__webglVertexBuffer&&(a.__webglVertexBuffer=j.createBuffer());a.hasNormals&&!a.__webglNormalBuffer&&(a.__webglNormalBuffer=j.createBuffer());a.hasUvs&&!a.__webglUvBuffer&&(a.__webglUvBuffer=j.createBuffer());a.hasColors&&
|
|
|
+!a.__webglColorBuffer&&(a.__webglColorBuffer=j.createBuffer());a.hasPositions&&(j.bindBuffer(j.ARRAY_BUFFER,a.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,a.positionArray,j.DYNAMIC_DRAW),j.enableVertexAttribArray(b.attributes.position),j.vertexAttribPointer(b.attributes.position,3,j.FLOAT,!1,0,0));if(a.hasNormals){j.bindBuffer(j.ARRAY_BUFFER,a.__webglNormalBuffer);if(c.shading===THREE.FlatShading){var d,e,f,g,h,i,k,l,n,p,m,r=3*a.count;for(m=0;m<r;m+=9)p=a.normalArray,d=p[m],e=p[m+1],f=p[m+2],
|
|
|
+g=p[m+3],i=p[m+4],l=p[m+5],h=p[m+6],k=p[m+7],n=p[m+8],d=(d+g+h)/3,e=(e+i+k)/3,f=(f+l+n)/3,p[m]=d,p[m+1]=e,p[m+2]=f,p[m+3]=d,p[m+4]=e,p[m+5]=f,p[m+6]=d,p[m+7]=e,p[m+8]=f}j.bufferData(j.ARRAY_BUFFER,a.normalArray,j.DYNAMIC_DRAW);j.enableVertexAttribArray(b.attributes.normal);j.vertexAttribPointer(b.attributes.normal,3,j.FLOAT,!1,0,0)}a.hasUvs&&c.map&&(j.bindBuffer(j.ARRAY_BUFFER,a.__webglUvBuffer),j.bufferData(j.ARRAY_BUFFER,a.uvArray,j.DYNAMIC_DRAW),j.enableVertexAttribArray(b.attributes.uv),j.vertexAttribPointer(b.attributes.uv,
|
|
|
+2,j.FLOAT,!1,0,0));a.hasColors&&c.vertexColors!==THREE.NoColors&&(j.bindBuffer(j.ARRAY_BUFFER,a.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,a.colorArray,j.DYNAMIC_DRAW),j.enableVertexAttribArray(b.attributes.color),j.vertexAttribPointer(b.attributes.color,3,j.FLOAT,!1,0,0));j.drawArrays(j.TRIANGLES,0,a.count);a.count=0};this.renderBufferDirect=function(a,b,c,d,e,f){if(!1!==d.visible){var k,l,n,p;k=D(a,b,c,d,f);a=k.attributes;b=e.attributes;c=!1;k=16777215*e.id+2*k.id+(d.wireframe?1:0);k!==Y&&
|
|
|
+(Y=k,c=!0);c&&i();if(f instanceof THREE.Mesh)if(f=b.index){e=e.offsets;1<e.length&&(c=!0);for(var m=0,r=e.length;m<r;m++){var q=e[m].index;if(c){for(l in a)n=a[l],k=b[l],0<=n&&(k?(p=k.itemSize,j.bindBuffer(j.ARRAY_BUFFER,k.buffer),g(n),j.vertexAttribPointer(n,p,j.FLOAT,!1,0,4*q*p)):d.defaultAttributeValues&&(2===d.defaultAttributeValues[l].length?j.vertexAttrib2fv(n,d.defaultAttributeValues[l]):3===d.defaultAttributeValues[l].length&&j.vertexAttrib3fv(n,d.defaultAttributeValues[l])));j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,
|
|
|
+f.buffer)}j.drawElements(j.TRIANGLES,e[m].count,j.UNSIGNED_SHORT,2*e[m].start);B.info.render.calls++;B.info.render.vertices+=e[m].count;B.info.render.faces+=e[m].count/3}}else{if(c)for(l in a)"index"!==l&&(n=a[l],k=b[l],0<=n&&(k?(p=k.itemSize,j.bindBuffer(j.ARRAY_BUFFER,k.buffer),g(n),j.vertexAttribPointer(n,p,j.FLOAT,!1,0,0)):d.defaultAttributeValues&&d.defaultAttributeValues[l]&&(2===d.defaultAttributeValues[l].length?j.vertexAttrib2fv(n,d.defaultAttributeValues[l]):3===d.defaultAttributeValues[l].length&&
|
|
|
+j.vertexAttrib3fv(n,d.defaultAttributeValues[l]))));d=e.attributes.position;j.drawArrays(j.TRIANGLES,0,d.array.length/3);B.info.render.calls++;B.info.render.vertices+=d.array.length/3;B.info.render.faces+=d.array.length/3/3}else if(f instanceof THREE.ParticleSystem){if(c)for(l in a)n=a[l],k=b[l],0<=n&&(k?(p=k.itemSize,j.bindBuffer(j.ARRAY_BUFFER,k.buffer),g(n),j.vertexAttribPointer(n,p,j.FLOAT,!1,0,0)):d.defaultAttributeValues&&d.defaultAttributeValues[l]&&(2===d.defaultAttributeValues[l].length?
|
|
|
+j.vertexAttrib2fv(n,d.defaultAttributeValues[l]):3===d.defaultAttributeValues[l].length&&j.vertexAttrib3fv(n,d.defaultAttributeValues[l])));d=b.position;j.drawArrays(j.POINTS,0,d.array.length/3);B.info.render.calls++;B.info.render.points+=d.array.length/3}else if(f instanceof THREE.Line)if(l=f.type===THREE.LineStrip?j.LINE_STRIP:j.LINES,w(d.linewidth),f=b.index){e=e.offsets;1<e.length&&(c=!0);m=0;for(r=e.length;m<r;m++)q=e[m].index,c&&(h(d,a,b,q),j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,f.buffer)),j.drawElements(j.LINES,
|
|
|
+e[m].count,j.UNSIGNED_SHORT,2*e[m].start),B.info.render.calls++,B.info.render.vertices+=e[m].count}else c&&h(d,a,b,0),d=b.position,j.drawArrays(l,0,d.array.length/3),B.info.render.calls++,B.info.render.points+=d.array.length}};this.renderBuffer=function(a,b,c,d,e,f){if(!1!==d.visible){var h,k,c=D(a,b,c,d,f),a=c.attributes,b=!1,c=16777215*e.id+2*c.id+(d.wireframe?1:0);c!==Y&&(Y=c,b=!0);b&&i();if(!d.morphTargets&&0<=a.position)b&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglVertexBuffer),g(a.position),j.vertexAttribPointer(a.position,
|
|
|
+3,j.FLOAT,!1,0,0));else if(f.morphTargetBase){c=d.program.attributes;-1!==f.morphTargetBase&&0<=c.position?(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[f.morphTargetBase]),g(c.position),j.vertexAttribPointer(c.position,3,j.FLOAT,!1,0,0)):0<=c.position&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglVertexBuffer),g(c.position),j.vertexAttribPointer(c.position,3,j.FLOAT,!1,0,0));if(f.morphTargetForcedOrder.length){var l=0;k=f.morphTargetForcedOrder;for(h=f.morphTargetInfluences;l<d.numSupportedMorphTargets&&
|
|
|
+l<k.length;)0<=c["morphTarget"+l]&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[k[l]]),g(c["morphTarget"+l]),j.vertexAttribPointer(c["morphTarget"+l],3,j.FLOAT,!1,0,0)),0<=c["morphNormal"+l]&&d.morphNormals&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[k[l]]),g(c["morphNormal"+l]),j.vertexAttribPointer(c["morphNormal"+l],3,j.FLOAT,!1,0,0)),f.__webglMorphTargetInfluences[l]=h[k[l]],l++}else{k=[];h=f.morphTargetInfluences;var p,m=h.length;for(p=0;p<m;p++)l=h[p],0<l&&k.push([l,
|
|
|
+p]);k.length>d.numSupportedMorphTargets?(k.sort(n),k.length=d.numSupportedMorphTargets):k.length>d.numSupportedMorphNormals?k.sort(n):0===k.length&&k.push([0,0]);for(l=0;l<d.numSupportedMorphTargets;)k[l]?(p=k[l][1],0<=c["morphTarget"+l]&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[p]),g(c["morphTarget"+l]),j.vertexAttribPointer(c["morphTarget"+l],3,j.FLOAT,!1,0,0)),0<=c["morphNormal"+l]&&d.morphNormals&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[p]),g(c["morphNormal"+
|
|
|
+l]),j.vertexAttribPointer(c["morphNormal"+l],3,j.FLOAT,!1,0,0)),f.__webglMorphTargetInfluences[l]=h[p]):f.__webglMorphTargetInfluences[l]=0,l++}null!==d.program.uniforms.morphTargetInfluences&&j.uniform1fv(d.program.uniforms.morphTargetInfluences,f.__webglMorphTargetInfluences)}if(b){if(e.__webglCustomAttributesList){h=0;for(k=e.__webglCustomAttributesList.length;h<k;h++)c=e.__webglCustomAttributesList[h],0<=a[c.buffer.belongsToAttribute]&&(j.bindBuffer(j.ARRAY_BUFFER,c.buffer),g(a[c.buffer.belongsToAttribute]),
|
|
|
+j.vertexAttribPointer(a[c.buffer.belongsToAttribute],c.size,j.FLOAT,!1,0,0))}0<=a.color&&(0<f.geometry.colors.length||0<f.geometry.faces.length?(j.bindBuffer(j.ARRAY_BUFFER,e.__webglColorBuffer),g(a.color),j.vertexAttribPointer(a.color,3,j.FLOAT,!1,0,0)):d.defaultAttributeValues&&j.vertexAttrib3fv(a.color,d.defaultAttributeValues.color));0<=a.normal&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglNormalBuffer),g(a.normal),j.vertexAttribPointer(a.normal,3,j.FLOAT,!1,0,0));0<=a.tangent&&(j.bindBuffer(j.ARRAY_BUFFER,
|
|
|
+e.__webglTangentBuffer),g(a.tangent),j.vertexAttribPointer(a.tangent,4,j.FLOAT,!1,0,0));0<=a.uv&&(f.geometry.faceVertexUvs[0]?(j.bindBuffer(j.ARRAY_BUFFER,e.__webglUVBuffer),g(a.uv),j.vertexAttribPointer(a.uv,2,j.FLOAT,!1,0,0)):d.defaultAttributeValues&&j.vertexAttrib2fv(a.uv,d.defaultAttributeValues.uv));0<=a.uv2&&(f.geometry.faceVertexUvs[1]?(j.bindBuffer(j.ARRAY_BUFFER,e.__webglUV2Buffer),g(a.uv2),j.vertexAttribPointer(a.uv2,2,j.FLOAT,!1,0,0)):d.defaultAttributeValues&&j.vertexAttrib2fv(a.uv2,
|
|
|
+d.defaultAttributeValues.uv2));d.skinning&&(0<=a.skinIndex&&0<=a.skinWeight)&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinIndicesBuffer),g(a.skinIndex),j.vertexAttribPointer(a.skinIndex,4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinWeightsBuffer),g(a.skinWeight),j.vertexAttribPointer(a.skinWeight,4,j.FLOAT,!1,0,0));0<=a.lineDistance&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglLineDistanceBuffer),g(a.lineDistance),j.vertexAttribPointer(a.lineDistance,1,j.FLOAT,!1,0,0))}f instanceof THREE.Mesh?
|
|
|
+(d.wireframe?(w(d.wireframeLinewidth),b&&j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,e.__webglLineBuffer),j.drawElements(j.LINES,e.__webglLineCount,j.UNSIGNED_SHORT,0)):(b&&j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer),j.drawElements(j.TRIANGLES,e.__webglFaceCount,j.UNSIGNED_SHORT,0)),B.info.render.calls++,B.info.render.vertices+=e.__webglFaceCount,B.info.render.faces+=e.__webglFaceCount/3):f instanceof THREE.Line?(f=f.type===THREE.LineStrip?j.LINE_STRIP:j.LINES,w(d.linewidth),j.drawArrays(f,0,
|
|
|
+e.__webglLineCount),B.info.render.calls++):f instanceof THREE.ParticleSystem&&(j.drawArrays(j.POINTS,0,e.__webglParticleCount),B.info.render.calls++,B.info.render.points+=e.__webglParticleCount)}};this.render=function(a,b,c,d){if(!1===b instanceof THREE.Camera)console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");else{var e,f,h,g,i=a.__lights,n=a.fog;Ga=-1;ua=!0;!0===a.autoUpdate&&a.updateMatrixWorld();void 0===b.parent&&b.updateMatrixWorld();b.matrixWorldInverse.getInverse(b.matrixWorld);
|
|
|
+ba.multiplyMatrices(b.projectionMatrix,b.matrixWorldInverse);R.setFromMatrix(ba);this.autoUpdateObjects&&this.initWebGLObjects(a);l(this.renderPluginsPre,a,b);B.info.render.calls=0;B.info.render.vertices=0;B.info.render.faces=0;B.info.render.points=0;this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);g=a.__webglObjects;d=0;for(e=g.length;d<e;d++)if(f=g[d],h=f.object,f.id=d,f.render=!1,h.visible&&(!(h instanceof THREE.Mesh||h instanceof
|
|
|
+THREE.ParticleSystem)||!h.frustumCulled||R.intersectsObject(h))){var m=h;m._modelViewMatrix.multiplyMatrices(b.matrixWorldInverse,m.matrixWorld);m._normalMatrix.getNormalMatrix(m._modelViewMatrix);var m=f,r=m.buffer,q=void 0,s=q=void 0,s=m.object.material;if(s instanceof THREE.MeshFaceMaterial)q=r.materialIndex,q=s.materials[q],q.transparent?(m.transparent=q,m.opaque=null):(m.opaque=q,m.transparent=null);else if(q=s)q.transparent?(m.transparent=q,m.opaque=null):(m.opaque=q,m.transparent=null);f.render=
|
|
|
+!0;!0===this.sortObjects&&(null!==h.renderDepth?f.z=h.renderDepth:(ra.setFromMatrixPosition(h.matrixWorld),ra.applyProjection(ba),f.z=ra.z))}this.sortObjects&&g.sort(k);g=a.__webglObjectsImmediate;d=0;for(e=g.length;d<e;d++)f=g[d],h=f.object,h.visible&&(h._modelViewMatrix.multiplyMatrices(b.matrixWorldInverse,h.matrixWorld),h._normalMatrix.getNormalMatrix(h._modelViewMatrix),h=f.object.material,h.transparent?(f.transparent=h,f.opaque=null):(f.opaque=h,f.transparent=null));a.overrideMaterial?(d=a.overrideMaterial,
|
|
|
+this.setBlending(d.blending,d.blendEquation,d.blendSrc,d.blendDst),this.setDepthTest(d.depthTest),this.setDepthWrite(d.depthWrite),I(d.polygonOffset,d.polygonOffsetFactor,d.polygonOffsetUnits),p(a.__webglObjects,!1,"",b,i,n,!0,d),t(a.__webglObjectsImmediate,"",b,i,n,!1,d)):(d=null,this.setBlending(THREE.NoBlending),p(a.__webglObjects,!0,"opaque",b,i,n,!1,d),t(a.__webglObjectsImmediate,"opaque",b,i,n,!1,d),p(a.__webglObjects,!1,"transparent",b,i,n,!0,d),t(a.__webglObjectsImmediate,"transparent",b,
|
|
|
+i,n,!0,d));l(this.renderPluginsPost,a,b);c&&(c.generateMipmaps&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter)&&(c instanceof THREE.WebGLRenderTargetCube?(j.bindTexture(j.TEXTURE_CUBE_MAP,c.__webglTexture),j.generateMipmap(j.TEXTURE_CUBE_MAP),j.bindTexture(j.TEXTURE_CUBE_MAP,null)):(j.bindTexture(j.TEXTURE_2D,c.__webglTexture),j.generateMipmap(j.TEXTURE_2D),j.bindTexture(j.TEXTURE_2D,null)));this.setDepthTest(!0);this.setDepthWrite(!0)}};this.renderImmediateObject=function(a,
|
|
|
+b,c,d,e){var f=D(a,b,c,d,e);Y=-1;B.setMaterialFaces(d);e.immediateRenderCallback?e.immediateRenderCallback(f,j,R):e.render(function(a){B.renderBufferImmediate(a,f,d)})};this.initWebGLObjects=function(a){a.__webglObjects||(a.__webglObjects=[],a.__webglObjectsImmediate=[],a.__webglSprites=[],a.__webglFlares=[]);for(;a.__objectsAdded.length;)s(a.__objectsAdded[0],a),a.__objectsAdded.splice(0,1);for(;a.__objectsRemoved.length;)q(a.__objectsRemoved[0],a),a.__objectsRemoved.splice(0,1);for(var b=0,h=a.__webglObjects.length;b<
|
|
|
+h;b++){var g=a.__webglObjects[b].object;void 0===g.__webglInit&&(void 0!==g.__webglActive&&q(g,a),s(g,a));var i=g,k=i.geometry,l=void 0,m=void 0,p=void 0;if(k instanceof THREE.BufferGeometry){var t=j.DYNAMIC_DRAW,v=!k.dynamic,w=k.attributes,z=void 0,y=void 0;for(z in w)y=w[z],y.needsUpdate&&("index"===z?(j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,y.buffer),j.bufferData(j.ELEMENT_ARRAY_BUFFER,y.array,t)):(j.bindBuffer(j.ARRAY_BUFFER,y.buffer),j.bufferData(j.ARRAY_BUFFER,y.array,t)),y.needsUpdate=!1),v&&!y.dynamic&&
|
|
|
+(y.array=null)}else if(i instanceof THREE.Mesh){for(var F=0,A=k.geometryGroupsList.length;F<A;F++)if(l=k.geometryGroupsList[F],p=d(i,l),k.buffersNeedUpdate&&c(l,i),m=p.attributes&&r(p),k.verticesNeedUpdate||k.morphTargetsNeedUpdate||k.elementsNeedUpdate||k.uvsNeedUpdate||k.normalsNeedUpdate||k.colorsNeedUpdate||k.tangentsNeedUpdate||m){var x=l,H=i,C=j.DYNAMIC_DRAW,I=!k.dynamic,E=p;if(x.__inittedArrays){var D=e(E),N=E.vertexColors?E.vertexColors:!1,L=f(E),K=D===THREE.SmoothShading,B=void 0,G=void 0,
|
|
|
+X=void 0,M=void 0,S=void 0,ia=void 0,Y=void 0,da=void 0,R=void 0,T=void 0,Ha=void 0,V=void 0,W=void 0,U=void 0,Ka=void 0,wa=void 0,Ga=void 0,ca=void 0,ea=void 0,fa=void 0,ha=void 0,Sa=void 0,ja=void 0,la=void 0,za=void 0,sa=void 0,ta=void 0,qa=void 0,ua=void 0,$=void 0,Aa=void 0,xa=void 0,Da=void 0,Ia=void 0,ma=void 0,Ma=void 0,va=void 0,Ba=void 0,Ta=void 0,Na=void 0,Ca=0,ya=0,Ua=0,Va=0,Wa=0,hb=0,Ya=0,La=0,eb=0,pa=0,Ea=0,O=0,Xa=void 0,ib=x.__vertexArray,Za=x.__uvArray,db=x.__uv2Array,Oa=x.__normalArray,
|
|
|
+$a=x.__tangentArray,jb=x.__colorArray,ab=x.__skinIndexArray,bb=x.__skinWeightArray,wb=x.__morphTargetsArrays,xb=x.__morphNormalsArrays,sb=x.__webglCustomAttributesList,J=void 0,Mb=x.__faceArray,tb=x.__lineArray,Pa=H.geometry,Hb=Pa.elementsNeedUpdate,Ab=Pa.uvsNeedUpdate,Ib=Pa.normalsNeedUpdate,Jb=Pa.tangentsNeedUpdate,Kb=Pa.colorsNeedUpdate,Lb=Pa.morphTargetsNeedUpdate,ac=Pa.vertices,aa=x.faces3,kb=Pa.faces,Bb=Pa.faceVertexUvs[0],Cb=Pa.faceVertexUvs[1],bc=Pa.skinIndices,Nb=Pa.skinWeights,Ob=Pa.morphTargets,
|
|
|
+gc=Pa.morphNormals;if(Pa.verticesNeedUpdate){B=0;for(G=aa.length;B<G;B++)M=kb[aa[B]],V=ac[M.a],W=ac[M.b],U=ac[M.c],ib[ya]=V.x,ib[ya+1]=V.y,ib[ya+2]=V.z,ib[ya+3]=W.x,ib[ya+4]=W.y,ib[ya+5]=W.z,ib[ya+6]=U.x,ib[ya+7]=U.y,ib[ya+8]=U.z,ya+=9;j.bindBuffer(j.ARRAY_BUFFER,x.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,ib,C)}if(Lb){ma=0;for(Ma=Ob.length;ma<Ma;ma++){B=Ea=0;for(G=aa.length;B<G;B++)Ta=aa[B],M=kb[Ta],V=Ob[ma].vertices[M.a],W=Ob[ma].vertices[M.b],U=Ob[ma].vertices[M.c],va=wb[ma],va[Ea]=V.x,
|
|
|
+va[Ea+1]=V.y,va[Ea+2]=V.z,va[Ea+3]=W.x,va[Ea+4]=W.y,va[Ea+5]=W.z,va[Ea+6]=U.x,va[Ea+7]=U.y,va[Ea+8]=U.z,E.morphNormals&&(K?(Na=gc[ma].vertexNormals[Ta],ca=Na.a,ea=Na.b,fa=Na.c):fa=ea=ca=gc[ma].faceNormals[Ta],Ba=xb[ma],Ba[Ea]=ca.x,Ba[Ea+1]=ca.y,Ba[Ea+2]=ca.z,Ba[Ea+3]=ea.x,Ba[Ea+4]=ea.y,Ba[Ea+5]=ea.z,Ba[Ea+6]=fa.x,Ba[Ea+7]=fa.y,Ba[Ea+8]=fa.z),Ea+=9;j.bindBuffer(j.ARRAY_BUFFER,x.__webglMorphTargetsBuffers[ma]);j.bufferData(j.ARRAY_BUFFER,wb[ma],C);E.morphNormals&&(j.bindBuffer(j.ARRAY_BUFFER,x.__webglMorphNormalsBuffers[ma]),
|
|
|
+j.bufferData(j.ARRAY_BUFFER,xb[ma],C))}}if(Nb.length){B=0;for(G=aa.length;B<G;B++)M=kb[aa[B]],la=Nb[M.a],za=Nb[M.b],sa=Nb[M.c],bb[pa]=la.x,bb[pa+1]=la.y,bb[pa+2]=la.z,bb[pa+3]=la.w,bb[pa+4]=za.x,bb[pa+5]=za.y,bb[pa+6]=za.z,bb[pa+7]=za.w,bb[pa+8]=sa.x,bb[pa+9]=sa.y,bb[pa+10]=sa.z,bb[pa+11]=sa.w,ta=bc[M.a],qa=bc[M.b],ua=bc[M.c],ab[pa]=ta.x,ab[pa+1]=ta.y,ab[pa+2]=ta.z,ab[pa+3]=ta.w,ab[pa+4]=qa.x,ab[pa+5]=qa.y,ab[pa+6]=qa.z,ab[pa+7]=qa.w,ab[pa+8]=ua.x,ab[pa+9]=ua.y,ab[pa+10]=ua.z,ab[pa+11]=ua.w,pa+=12;
|
|
|
+0<pa&&(j.bindBuffer(j.ARRAY_BUFFER,x.__webglSkinIndicesBuffer),j.bufferData(j.ARRAY_BUFFER,ab,C),j.bindBuffer(j.ARRAY_BUFFER,x.__webglSkinWeightsBuffer),j.bufferData(j.ARRAY_BUFFER,bb,C))}if(Kb&&N){B=0;for(G=aa.length;B<G;B++)M=kb[aa[B]],Y=M.vertexColors,da=M.color,3===Y.length&&N===THREE.VertexColors?(ha=Y[0],Sa=Y[1],ja=Y[2]):ja=Sa=ha=da,jb[eb]=ha.r,jb[eb+1]=ha.g,jb[eb+2]=ha.b,jb[eb+3]=Sa.r,jb[eb+4]=Sa.g,jb[eb+5]=Sa.b,jb[eb+6]=ja.r,jb[eb+7]=ja.g,jb[eb+8]=ja.b,eb+=9;0<eb&&(j.bindBuffer(j.ARRAY_BUFFER,
|
|
|
+x.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,jb,C))}if(Jb&&Pa.hasTangents){B=0;for(G=aa.length;B<G;B++)M=kb[aa[B]],R=M.vertexTangents,Ka=R[0],wa=R[1],Ga=R[2],$a[Ya]=Ka.x,$a[Ya+1]=Ka.y,$a[Ya+2]=Ka.z,$a[Ya+3]=Ka.w,$a[Ya+4]=wa.x,$a[Ya+5]=wa.y,$a[Ya+6]=wa.z,$a[Ya+7]=wa.w,$a[Ya+8]=Ga.x,$a[Ya+9]=Ga.y,$a[Ya+10]=Ga.z,$a[Ya+11]=Ga.w,Ya+=12;j.bindBuffer(j.ARRAY_BUFFER,x.__webglTangentBuffer);j.bufferData(j.ARRAY_BUFFER,$a,C)}if(Ib&&D){B=0;for(G=aa.length;B<G;B++)if(M=kb[aa[B]],S=M.vertexNormals,ia=M.normal,
|
|
|
+3===S.length&&K)for($=0;3>$;$++)xa=S[$],Oa[hb]=xa.x,Oa[hb+1]=xa.y,Oa[hb+2]=xa.z,hb+=3;else for($=0;3>$;$++)Oa[hb]=ia.x,Oa[hb+1]=ia.y,Oa[hb+2]=ia.z,hb+=3;j.bindBuffer(j.ARRAY_BUFFER,x.__webglNormalBuffer);j.bufferData(j.ARRAY_BUFFER,Oa,C)}if(Ab&&Bb&&L){B=0;for(G=aa.length;B<G;B++)if(X=aa[B],T=Bb[X],void 0!==T)for($=0;3>$;$++)Da=T[$],Za[Ua]=Da.x,Za[Ua+1]=Da.y,Ua+=2;0<Ua&&(j.bindBuffer(j.ARRAY_BUFFER,x.__webglUVBuffer),j.bufferData(j.ARRAY_BUFFER,Za,C))}if(Ab&&Cb&&L){B=0;for(G=aa.length;B<G;B++)if(X=
|
|
|
+aa[B],Ha=Cb[X],void 0!==Ha)for($=0;3>$;$++)Ia=Ha[$],db[Va]=Ia.x,db[Va+1]=Ia.y,Va+=2;0<Va&&(j.bindBuffer(j.ARRAY_BUFFER,x.__webglUV2Buffer),j.bufferData(j.ARRAY_BUFFER,db,C))}if(Hb){B=0;for(G=aa.length;B<G;B++)Mb[Wa]=Ca,Mb[Wa+1]=Ca+1,Mb[Wa+2]=Ca+2,Wa+=3,tb[La]=Ca,tb[La+1]=Ca+1,tb[La+2]=Ca,tb[La+3]=Ca+2,tb[La+4]=Ca+1,tb[La+5]=Ca+2,La+=6,Ca+=3;j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,x.__webglFaceBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,Mb,C);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,x.__webglLineBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,
|
|
|
+tb,C)}if(sb){$=0;for(Aa=sb.length;$<Aa;$++)if(J=sb[$],J.__original.needsUpdate){O=0;if(1===J.size)if(void 0===J.boundTo||"vertices"===J.boundTo){B=0;for(G=aa.length;B<G;B++)M=kb[aa[B]],J.array[O]=J.value[M.a],J.array[O+1]=J.value[M.b],J.array[O+2]=J.value[M.c],O+=3}else{if("faces"===J.boundTo){B=0;for(G=aa.length;B<G;B++)Xa=J.value[aa[B]],J.array[O]=Xa,J.array[O+1]=Xa,J.array[O+2]=Xa,O+=3}}else if(2===J.size)if(void 0===J.boundTo||"vertices"===J.boundTo){B=0;for(G=aa.length;B<G;B++)M=kb[aa[B]],V=
|
|
|
+J.value[M.a],W=J.value[M.b],U=J.value[M.c],J.array[O]=V.x,J.array[O+1]=V.y,J.array[O+2]=W.x,J.array[O+3]=W.y,J.array[O+4]=U.x,J.array[O+5]=U.y,O+=6}else{if("faces"===J.boundTo){B=0;for(G=aa.length;B<G;B++)U=W=V=Xa=J.value[aa[B]],J.array[O]=V.x,J.array[O+1]=V.y,J.array[O+2]=W.x,J.array[O+3]=W.y,J.array[O+4]=U.x,J.array[O+5]=U.y,O+=6}}else if(3===J.size){var oa;oa="c"===J.type?["r","g","b"]:["x","y","z"];if(void 0===J.boundTo||"vertices"===J.boundTo){B=0;for(G=aa.length;B<G;B++)M=kb[aa[B]],V=J.value[M.a],
|
|
|
+W=J.value[M.b],U=J.value[M.c],J.array[O]=V[oa[0]],J.array[O+1]=V[oa[1]],J.array[O+2]=V[oa[2]],J.array[O+3]=W[oa[0]],J.array[O+4]=W[oa[1]],J.array[O+5]=W[oa[2]],J.array[O+6]=U[oa[0]],J.array[O+7]=U[oa[1]],J.array[O+8]=U[oa[2]],O+=9}else if("faces"===J.boundTo){B=0;for(G=aa.length;B<G;B++)U=W=V=Xa=J.value[aa[B]],J.array[O]=V[oa[0]],J.array[O+1]=V[oa[1]],J.array[O+2]=V[oa[2]],J.array[O+3]=W[oa[0]],J.array[O+4]=W[oa[1]],J.array[O+5]=W[oa[2]],J.array[O+6]=U[oa[0]],J.array[O+7]=U[oa[1]],J.array[O+8]=U[oa[2]],
|
|
|
+O+=9}else if("faceVertices"===J.boundTo){B=0;for(G=aa.length;B<G;B++)Xa=J.value[aa[B]],V=Xa[0],W=Xa[1],U=Xa[2],J.array[O]=V[oa[0]],J.array[O+1]=V[oa[1]],J.array[O+2]=V[oa[2]],J.array[O+3]=W[oa[0]],J.array[O+4]=W[oa[1]],J.array[O+5]=W[oa[2]],J.array[O+6]=U[oa[0]],J.array[O+7]=U[oa[1]],J.array[O+8]=U[oa[2]],O+=9}}else if(4===J.size)if(void 0===J.boundTo||"vertices"===J.boundTo){B=0;for(G=aa.length;B<G;B++)M=kb[aa[B]],V=J.value[M.a],W=J.value[M.b],U=J.value[M.c],J.array[O]=V.x,J.array[O+1]=V.y,J.array[O+
|
|
|
+2]=V.z,J.array[O+3]=V.w,J.array[O+4]=W.x,J.array[O+5]=W.y,J.array[O+6]=W.z,J.array[O+7]=W.w,J.array[O+8]=U.x,J.array[O+9]=U.y,J.array[O+10]=U.z,J.array[O+11]=U.w,O+=12}else if("faces"===J.boundTo){B=0;for(G=aa.length;B<G;B++)U=W=V=Xa=J.value[aa[B]],J.array[O]=V.x,J.array[O+1]=V.y,J.array[O+2]=V.z,J.array[O+3]=V.w,J.array[O+4]=W.x,J.array[O+5]=W.y,J.array[O+6]=W.z,J.array[O+7]=W.w,J.array[O+8]=U.x,J.array[O+9]=U.y,J.array[O+10]=U.z,J.array[O+11]=U.w,O+=12}else if("faceVertices"===J.boundTo){B=0;for(G=
|
|
|
+aa.length;B<G;B++)Xa=J.value[aa[B]],V=Xa[0],W=Xa[1],U=Xa[2],J.array[O]=V.x,J.array[O+1]=V.y,J.array[O+2]=V.z,J.array[O+3]=V.w,J.array[O+4]=W.x,J.array[O+5]=W.y,J.array[O+6]=W.z,J.array[O+7]=W.w,J.array[O+8]=U.x,J.array[O+9]=U.y,J.array[O+10]=U.z,J.array[O+11]=U.w,O+=12}j.bindBuffer(j.ARRAY_BUFFER,J.buffer);j.bufferData(j.ARRAY_BUFFER,J.array,C)}}I&&(delete x.__inittedArrays,delete x.__colorArray,delete x.__normalArray,delete x.__tangentArray,delete x.__uvArray,delete x.__uv2Array,delete x.__faceArray,
|
|
|
+delete x.__vertexArray,delete x.__lineArray,delete x.__skinIndexArray,delete x.__skinWeightArray)}}k.verticesNeedUpdate=!1;k.morphTargetsNeedUpdate=!1;k.elementsNeedUpdate=!1;k.uvsNeedUpdate=!1;k.normalsNeedUpdate=!1;k.colorsNeedUpdate=!1;k.tangentsNeedUpdate=!1;k.buffersNeedUpdate=!1;p.attributes&&u(p)}else if(i instanceof THREE.Line){p=d(i,k);m=p.attributes&&r(p);if(k.verticesNeedUpdate||k.colorsNeedUpdate||k.lineDistancesNeedUpdate||m){var cb=k,Pb=j.DYNAMIC_DRAW,Db=void 0,Eb=void 0,Fb=void 0,Qb=
|
|
|
+void 0,na=void 0,Rb=void 0,hc=cb.vertices,ic=cb.colors,jc=cb.lineDistances,Wb=hc.length,Xb=ic.length,Yb=jc.length,Sb=cb.__vertexArray,Tb=cb.__colorArray,kc=cb.__lineDistanceArray,Zb=cb.colorsNeedUpdate,$b=cb.lineDistancesNeedUpdate,cc=cb.__webglCustomAttributesList,Ub=void 0,lc=void 0,Fa=void 0,yb=void 0,Qa=void 0,ka=void 0;if(cb.verticesNeedUpdate){for(Db=0;Db<Wb;Db++)Qb=hc[Db],na=3*Db,Sb[na]=Qb.x,Sb[na+1]=Qb.y,Sb[na+2]=Qb.z;j.bindBuffer(j.ARRAY_BUFFER,cb.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,
|
|
|
+Sb,Pb)}if(Zb){for(Eb=0;Eb<Xb;Eb++)Rb=ic[Eb],na=3*Eb,Tb[na]=Rb.r,Tb[na+1]=Rb.g,Tb[na+2]=Rb.b;j.bindBuffer(j.ARRAY_BUFFER,cb.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,Tb,Pb)}if($b){for(Fb=0;Fb<Yb;Fb++)kc[Fb]=jc[Fb];j.bindBuffer(j.ARRAY_BUFFER,cb.__webglLineDistanceBuffer);j.bufferData(j.ARRAY_BUFFER,kc,Pb)}if(cc){Ub=0;for(lc=cc.length;Ub<lc;Ub++)if(ka=cc[Ub],ka.needsUpdate&&(void 0===ka.boundTo||"vertices"===ka.boundTo)){na=0;yb=ka.value.length;if(1===ka.size)for(Fa=0;Fa<yb;Fa++)ka.array[Fa]=
|
|
|
+ka.value[Fa];else if(2===ka.size)for(Fa=0;Fa<yb;Fa++)Qa=ka.value[Fa],ka.array[na]=Qa.x,ka.array[na+1]=Qa.y,na+=2;else if(3===ka.size)if("c"===ka.type)for(Fa=0;Fa<yb;Fa++)Qa=ka.value[Fa],ka.array[na]=Qa.r,ka.array[na+1]=Qa.g,ka.array[na+2]=Qa.b,na+=3;else for(Fa=0;Fa<yb;Fa++)Qa=ka.value[Fa],ka.array[na]=Qa.x,ka.array[na+1]=Qa.y,ka.array[na+2]=Qa.z,na+=3;else if(4===ka.size)for(Fa=0;Fa<yb;Fa++)Qa=ka.value[Fa],ka.array[na]=Qa.x,ka.array[na+1]=Qa.y,ka.array[na+2]=Qa.z,ka.array[na+3]=Qa.w,na+=4;j.bindBuffer(j.ARRAY_BUFFER,
|
|
|
+ka.buffer);j.bufferData(j.ARRAY_BUFFER,ka.array,Pb)}}}k.verticesNeedUpdate=!1;k.colorsNeedUpdate=!1;k.lineDistancesNeedUpdate=!1;p.attributes&&u(p)}else if(i instanceof THREE.ParticleSystem){p=d(i,k);m=p.attributes&&r(p);if(k.verticesNeedUpdate||k.colorsNeedUpdate||i.sortParticles||m){var lb=k,dc=j.DYNAMIC_DRAW,Gb=i,Ra=void 0,mb=void 0,nb=void 0,Q=void 0,ob=void 0,rb=void 0,Vb=lb.vertices,ec=Vb.length,fc=lb.colors,mc=fc.length,ub=lb.__vertexArray,vb=lb.__colorArray,pb=lb.__sortArray,nc=lb.verticesNeedUpdate,
|
|
|
+oc=lb.colorsNeedUpdate,qb=lb.__webglCustomAttributesList,fb=void 0,zb=void 0,Z=void 0,gb=void 0,ga=void 0,P=void 0;if(Gb.sortParticles){Ja.copy(ba);Ja.multiply(Gb.matrixWorld);for(Ra=0;Ra<ec;Ra++)nb=Vb[Ra],ra.copy(nb),ra.applyProjection(Ja),pb[Ra]=[ra.z,Ra];pb.sort(n);for(Ra=0;Ra<ec;Ra++)nb=Vb[pb[Ra][1]],Q=3*Ra,ub[Q]=nb.x,ub[Q+1]=nb.y,ub[Q+2]=nb.z;for(mb=0;mb<mc;mb++)Q=3*mb,rb=fc[pb[mb][1]],vb[Q]=rb.r,vb[Q+1]=rb.g,vb[Q+2]=rb.b;if(qb){fb=0;for(zb=qb.length;fb<zb;fb++)if(P=qb[fb],void 0===P.boundTo||
|
|
|
+"vertices"===P.boundTo)if(Q=0,gb=P.value.length,1===P.size)for(Z=0;Z<gb;Z++)ob=pb[Z][1],P.array[Z]=P.value[ob];else if(2===P.size)for(Z=0;Z<gb;Z++)ob=pb[Z][1],ga=P.value[ob],P.array[Q]=ga.x,P.array[Q+1]=ga.y,Q+=2;else if(3===P.size)if("c"===P.type)for(Z=0;Z<gb;Z++)ob=pb[Z][1],ga=P.value[ob],P.array[Q]=ga.r,P.array[Q+1]=ga.g,P.array[Q+2]=ga.b,Q+=3;else for(Z=0;Z<gb;Z++)ob=pb[Z][1],ga=P.value[ob],P.array[Q]=ga.x,P.array[Q+1]=ga.y,P.array[Q+2]=ga.z,Q+=3;else if(4===P.size)for(Z=0;Z<gb;Z++)ob=pb[Z][1],
|
|
|
+ga=P.value[ob],P.array[Q]=ga.x,P.array[Q+1]=ga.y,P.array[Q+2]=ga.z,P.array[Q+3]=ga.w,Q+=4}}else{if(nc)for(Ra=0;Ra<ec;Ra++)nb=Vb[Ra],Q=3*Ra,ub[Q]=nb.x,ub[Q+1]=nb.y,ub[Q+2]=nb.z;if(oc)for(mb=0;mb<mc;mb++)rb=fc[mb],Q=3*mb,vb[Q]=rb.r,vb[Q+1]=rb.g,vb[Q+2]=rb.b;if(qb){fb=0;for(zb=qb.length;fb<zb;fb++)if(P=qb[fb],P.needsUpdate&&(void 0===P.boundTo||"vertices"===P.boundTo))if(gb=P.value.length,Q=0,1===P.size)for(Z=0;Z<gb;Z++)P.array[Z]=P.value[Z];else if(2===P.size)for(Z=0;Z<gb;Z++)ga=P.value[Z],P.array[Q]=
|
|
|
+ga.x,P.array[Q+1]=ga.y,Q+=2;else if(3===P.size)if("c"===P.type)for(Z=0;Z<gb;Z++)ga=P.value[Z],P.array[Q]=ga.r,P.array[Q+1]=ga.g,P.array[Q+2]=ga.b,Q+=3;else for(Z=0;Z<gb;Z++)ga=P.value[Z],P.array[Q]=ga.x,P.array[Q+1]=ga.y,P.array[Q+2]=ga.z,Q+=3;else if(4===P.size)for(Z=0;Z<gb;Z++)ga=P.value[Z],P.array[Q]=ga.x,P.array[Q+1]=ga.y,P.array[Q+2]=ga.z,P.array[Q+3]=ga.w,Q+=4}}if(nc||Gb.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,lb.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,ub,dc);if(oc||Gb.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,
|
|
|
+lb.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,vb,dc);if(qb){fb=0;for(zb=qb.length;fb<zb;fb++)if(P=qb[fb],P.needsUpdate||Gb.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,P.buffer),j.bufferData(j.ARRAY_BUFFER,P.array,dc)}}k.verticesNeedUpdate=!1;k.colorsNeedUpdate=!1;p.attributes&&u(p)}}};this.initMaterial=function(a,b,c,d){var e,f,h,g;a.addEventListener("dispose",Lb);var i,k,l,n,p;a instanceof THREE.MeshDepthMaterial?p="depth":a instanceof THREE.MeshNormalMaterial?p="normal":a instanceof THREE.MeshBasicMaterial?
|
|
|
+p="basic":a instanceof THREE.MeshLambertMaterial?p="lambert":a instanceof THREE.MeshPhongMaterial?p="phong":a instanceof THREE.LineBasicMaterial?p="basic":a instanceof THREE.LineDashedMaterial?p="dashed":a instanceof THREE.ParticleSystemMaterial&&(p="particle_basic");if(p){var m=THREE.ShaderLib[p];a.uniforms=THREE.UniformsUtils.clone(m.uniforms);a.vertexShader=m.vertexShader;a.fragmentShader=m.fragmentShader}var r=e=0,q=0,s=m=0;for(f=b.length;s<f;s++)h=b[s],h.onlyShadow||(h instanceof THREE.DirectionalLight&&
|
|
|
+e++,h instanceof THREE.PointLight&&r++,h instanceof THREE.SpotLight&&q++,h instanceof THREE.HemisphereLight&&m++);f=r;h=q;g=m;q=m=0;for(r=b.length;q<r;q++)s=b[q],s.castShadow&&(s instanceof THREE.SpotLight&&m++,s instanceof THREE.DirectionalLight&&!s.shadowCascade&&m++);n=m;xb&&d&&d.useVertexTexture?l=1024:(b=j.getParameter(j.MAX_VERTEX_UNIFORM_VECTORS),b=Math.floor((b-20)/4),void 0!==d&&d instanceof THREE.SkinnedMesh&&(b=Math.min(d.bones.length,b),b<d.bones.length&&console.warn("WebGLRenderer: too many bones - "+
|
|
|
+d.bones.length+", this GPU supports just "+b+" (try OpenGL instead of ANGLE)")),l=b);a:{var q=a.fragmentShader,r=a.vertexShader,m=a.uniforms,b=a.attributes,s=a.defines,c={map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap,bumpMap:!!a.bumpMap,normalMap:!!a.normalMap,specularMap:!!a.specularMap,vertexColors:a.vertexColors,fog:c,useFog:a.fog,fogExp:c instanceof THREE.FogExp2,sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,maxBones:l,useVertexTexture:xb&&d&&d.useVertexTexture,morphTargets:a.morphTargets,
|
|
|
+morphNormals:a.morphNormals,maxMorphTargets:this.maxMorphTargets,maxMorphNormals:this.maxMorphNormals,maxDirLights:e,maxPointLights:f,maxSpotLights:h,maxHemiLights:g,maxShadows:n,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapType:this.shadowMapType,shadowMapDebug:this.shadowMapDebug,shadowMapCascade:this.shadowMapCascade,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel,wrapAround:a.wrapAround,doubleSided:a.side===THREE.DoubleSide,flipSided:a.side===THREE.BackSide},d=a.index0AttributeName,
|
|
|
+t,u,v;e=[];p?e.push(p):(e.push(q),e.push(r));for(u in s)e.push(u),e.push(s[u]);for(t in c)e.push(t),e.push(c[t]);p=e.join();t=0;for(u=X.length;t<u;t++)if(e=X[t],e.code===p){e.usedTimes++;k=e.program;break a}t="SHADOWMAP_TYPE_BASIC";c.shadowMapType===THREE.PCFShadowMap?t="SHADOWMAP_TYPE_PCF":c.shadowMapType===THREE.PCFSoftShadowMap&&(t="SHADOWMAP_TYPE_PCF_SOFT");u=[];for(v in s)e=s[v],!1!==e&&(e="#define "+v+" "+e,u.push(e));e=u.join("\n");v=j.createProgram();u=["precision "+E+" float;","precision "+
|
|
|
+E+" int;",e,wb?"#define VERTEX_TEXTURES":"",B.gammaInput?"#define GAMMA_INPUT":"",B.gammaOutput?"#define GAMMA_OUTPUT":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SPOT_LIGHTS "+c.maxSpotLights,"#define MAX_HEMI_LIGHTS "+c.maxHemiLights,"#define MAX_SHADOWS "+c.maxShadows,"#define MAX_BONES "+c.maxBones,c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.bumpMap?"#define USE_BUMPMAP":"",c.normalMap?
|
|
|
+"#define USE_NORMALMAP":"",c.specularMap?"#define USE_SPECULARMAP":"",c.vertexColors?"#define USE_COLOR":"",c.skinning?"#define USE_SKINNING":"",c.useVertexTexture?"#define BONE_TEXTURE":"",c.morphTargets?"#define USE_MORPHTARGETS":"",c.morphNormals?"#define USE_MORPHNORMALS":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.wrapAround?"#define WRAP_AROUND":"",c.doubleSided?"#define DOUBLE_SIDED":"",c.flipSided?"#define FLIP_SIDED":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapEnabled?"#define "+
|
|
|
+t:"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"",c.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 modelMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\n#ifdef USE_MORPHNORMALS\nattribute vec3 morphNormal0;\nattribute vec3 morphNormal1;\nattribute vec3 morphNormal2;\nattribute vec3 morphNormal3;\n#else\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
|
|
|
t=["precision "+E+" float;","precision "+E+" int;",c.bumpMap||c.normalMap?"#extension GL_OES_standard_derivatives : enable":"",e,"#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SPOT_LIGHTS "+c.maxSpotLights,"#define MAX_HEMI_LIGHTS "+c.maxHemiLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",B.gammaInput?"#define GAMMA_INPUT":"",B.gammaOutput?"#define GAMMA_OUTPUT":"",c.useFog&&c.fog?"#define USE_FOG":"",c.useFog&&
|
|
|
c.fogExp?"#define FOG_EXP2":"",c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.bumpMap?"#define USE_BUMPMAP":"",c.normalMap?"#define USE_NORMALMAP":"",c.specularMap?"#define USE_SPECULARMAP":"",c.vertexColors?"#define USE_COLOR":"",c.metal?"#define METAL":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.wrapAround?"#define WRAP_AROUND":"",c.doubleSided?"#define DOUBLE_SIDED":"",c.flipSided?"#define FLIP_SIDED":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":
|
|
|
"",c.shadowMapEnabled?"#define "+t:"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");u=x("vertex",u+r);t=x("fragment",t+q);j.attachShader(v,u);j.attachShader(v,t);d&&j.bindAttribLocation(v,0,d);j.linkProgram(v);j.getProgramParameter(v,j.LINK_STATUS)||(console.error("Could not initialise shader\nVALIDATE_STATUS: "+j.getProgramParameter(v,j.VALIDATE_STATUS)+", gl error ["+j.getError()+
|