|
@@ -48,7 +48,7 @@ d,c)}};THREE.Quaternion=function(b,d,c,f){this.set(b||0,d||0,c||0,f!==undefined?
|
|
|
THREE.Quaternion.prototype={set:function(b,d,c,f){this.x=b;this.y=d;this.z=c;this.w=f;return this},setFromEuler:function(b){var d=0.5*Math.PI/360,c=b.x*d,f=b.y*d,g=b.z*d;b=Math.cos(f);f=Math.sin(f);d=Math.cos(-g);g=Math.sin(-g);var h=Math.cos(c);c=Math.sin(c);var j=b*d,k=f*g;this.w=j*h-k*c;this.x=j*c+k*h;this.y=f*d*h+b*g*c;this.z=b*g*h-f*d*c;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=
|
|
|
-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var b=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(b==0)this.w=this.z=this.y=this.x=0;else{b=1/b;this.x*=b;this.y*=b;this.z*=b;this.w*=b}return this},multiplySelf:function(b){var d=this.x,c=this.y,f=this.z,g=this.w,h=b.x,j=b.y,k=b.z;b=b.w;this.x=d*b+g*h+c*k-f*j;this.y=c*b+g*j+f*h-d*k;this.z=f*b+g*k+d*j-c*h;this.w=g*b-d*h-c*j-f*k;return this},
|
|
|
multiplyVector3:function(b,d){d||(d=b);var c=b.x,f=b.y,g=b.z,h=this.x,j=this.y,k=this.z,n=this.w,p=n*c+j*g-k*f,o=n*f+k*c-h*g,u=n*g+h*f-j*c;c=-h*c-j*f-k*g;d.x=p*n+c*-h+o*-k-u*-j;d.y=o*n+c*-j+u*-h-p*-k;d.z=u*n+c*-k+p*-j-o*-h;return d}};
|
|
|
-THREE.Quaternion.slerp=function(b,d,c,f){var g=b.w*d.w+b.x*d.x+b.y*d.y+b.z*d.z;if(Math.abs(g)>=1){c.w=b.w;c.x=b.x;c.y=b.y;c.z=b.z;return c}var h=Math.acos(g),j=Math.sqrt(1-g*g);if(Math.abs(j)<0.001){c.w=0.5*(b.w+d.w);c.x=0.5*(b.x+d.x);c.y=0.5*(b.y+d.y);c.z=0.5*(b.z+d.z);return c}g=Math.sin((1-f)*h)/j;f=Math.sin(f*h)/j;c.w=b.w*g+d.w*f;c.x=b.x*g+d.x*f;c.y=b.y*g+d.y*f;c.z=b.z*g+d.z*f;return c};THREE.Vertex=function(b){this.position=b||new THREE.Vector3};
|
|
|
+THREE.Quaternion.slerp=function(b,d,c,f){var g=b.w*d.w+b.x*d.x+b.y*d.y+b.z*d.z;if(Math.abs(g)>=1){c.w=b.w;c.x=b.x;c.y=b.y;c.z=b.z;return c}var h=Math.acos(g),j=Math.sqrt(1-g*g);if(Math.abs(j)<0.0010){c.w=0.5*(b.w+d.w);c.x=0.5*(b.x+d.x);c.y=0.5*(b.y+d.y);c.z=0.5*(b.z+d.z);return c}g=Math.sin((1-f)*h)/j;f=Math.sin(f*h)/j;c.w=b.w*g+d.w*f;c.x=b.x*g+d.x*f;c.y=b.y*g+d.y*f;c.z=b.z*g+d.z*f;return c};THREE.Vertex=function(b){this.position=b||new THREE.Vector3};
|
|
|
THREE.Face3=function(b,d,c,f,g,h){this.a=b;this.b=d;this.c=c;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materials=h instanceof Array?h:[h];this.centroid=new THREE.Vector3};
|
|
|
THREE.Face4=function(b,d,c,f,g,h,j){this.a=b;this.b=d;this.c=c;this.d=f;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.color=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.vertexTangents=[];this.materials=j instanceof Array?j:[j];this.centroid=new THREE.Vector3};THREE.UV=function(b,d){this.set(b||0,d||0)};
|
|
|
THREE.UV.prototype={set:function(b,d){this.u=b;this.v=d;return this},copy:function(b){this.set(b.u,b.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
|
|
@@ -139,7 +139,7 @@ THREE.LOD.prototype.update=function(b,d,c){this.matrixAutoUpdate&&(d|=this.updat
|
|
|
!1;this.LODs[f].object3D.visible=!0}else break;for(;f<this.LODs.length;f++)this.LODs[f].object3D.visible=!1}for(b=0;b<this.children.length;b++)this.children[b].update(this.matrixWorld,d,c)};THREE.ShadowVolume=function(b,d){THREE.Mesh.call(this,b.geometry,d?[new THREE.ShadowVolumeDynamicMaterial]:[new THREE.ShadowVolumeDynamicMaterial]);b.addChild(this);this.calculateShadowVolumeGeometry(b.geometry)};THREE.ShadowVolume.prototype=new THREE.Mesh;THREE.ShadowVolume.prototype.constructor=THREE.ShadowVolume;
|
|
|
THREE.ShadowVolume.prototype.supr=THREE.Mesh.prototype;
|
|
|
THREE.ShadowVolume.prototype.calculateShadowVolumeGeometry=function(b){this.geometry=new THREE.Geometry;this.geometry.boundingSphere=b.boundingSphere;this.geometry.edgeFaces=[];var d=this.geometry.vertices,c=this.geometry.faces,f=this.geometry.edgeFaces,g=b.faces;b=b.vertices;var h=g.length,j,k,n,p,o,u=["a","b","c","d"];for(n=0;n<h;n++){k=d.length;j=g[n];if(j instanceof THREE.Face4){p=4;k=new THREE.Face4(k,k+1,k+2,k+3)}else{p=3;k=new THREE.Face3(k,k+1,k+2)}k.normal.copy(j.normal);c.push(k);for(k=
|
|
|
-0;k<p;k++){o=b[j[u[k]]];d.push(new THREE.Vertex(o.position.clone()))}}for(h=0;h<g.length-1;h++){b=c[h];for(j=h+1;j<g.length;j++){k=c[j];k=this.facesShareEdge(d,b,k);if(k!==undefined){k=new THREE.Face4(k.indices[0],k.indices[3],k.indices[2],k.indices[1]);k.normal.set(1,0,0);f.push(k)}}}};
|
|
|
+0;k<p;k++){o=b[j[u[k]]];d.push(new THREE.Vertex(o.position.clone()))}}for(h=0;h<g.length-1;h++){b=c[h];for(j=h+1;j<g.length;j++){k=c[j];k=this.facesShareEdge(d,b,k);if(k!==undefined){k=new THREE.Face4(k.indices[0],k.indices[1],k.indices[2],k.indices[3]);k.normal.set(1,0,0);f.push(k)}}}};
|
|
|
THREE.ShadowVolume.prototype.facesShareEdge=function(b,d,c){var f,g,h,j,k,n,p,o,u,y,v,B,C,G=0,H=["a","b","c","d"];f=d instanceof THREE.Face4?4:3;g=c instanceof THREE.Face4?4:3;for(B=0;B<f;B++){h=d[H[B]];k=b[h];for(C=0;C<g;C++){j=c[H[C]];n=b[j];if(Math.abs(k.position.x-n.position.x)<1.0E-4&&Math.abs(k.position.y-n.position.y)<1.0E-4&&Math.abs(k.position.z-n.position.z)<1.0E-4){G++;if(G===1){p=k;o=n;u=h;y=j;v=H[B]}if(G===2){v+=H[B];return v==="ad"||v==="ac"?{faces:[d,c],vertices:[p,o,n,k],indices:[u,
|
|
|
y,j,h],vertexTypes:[1,2,2,1],extrudable:!0}:{faces:[d,c],vertices:[p,k,n,o],indices:[u,h,j,y],vertexTypes:[1,1,2,2],extrudable:!0}}}}}};THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.fog=null;this.objects=[];this.lights=[];this.sounds=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;THREE.Scene.prototype.supr=THREE.Object3D.prototype;
|
|
|
THREE.Scene.prototype.addChild=function(b){this.supr.addChild.call(this,b);this.addChildRecurse(b)};THREE.Scene.prototype.addChildRecurse=function(b){if(b instanceof THREE.Light)this.lights.indexOf(b)===-1&&this.lights.push(b);else if(b instanceof THREE.Sound)this.sounds.indexOf(b)===-1&&this.sounds.push(b);else if(!(b instanceof THREE.Camera||b instanceof THREE.Bone)&&this.objects.indexOf(b)===-1){this.objects.push(b);this.__objectsAdded.push(b)}for(var d=0;d<b.children.length;d++)this.addChildRecurse(b.children[d])};
|
|
@@ -244,63 +244,63 @@ THREE.ParticleSystem)e.drawArrays(e.POINTS,0,w.__webglParticleCount);else R inst
|
|
|
3,e.FLOAT,!1,0,0)}if(m.hasNormal){e.bindBuffer(e.ARRAY_BUFFER,m.__webglNormalBuffer);e.bufferData(e.ARRAY_BUFFER,m.normalArray,e.DYNAMIC_DRAW);e.enableVertexAttribArray(A.attributes.normal);e.vertexAttribPointer(A.attributes.normal,3,e.FLOAT,!1,0,0)}e.drawArrays(e.TRIANGLES,0,m.count);m.count=0}function j(m){if(pa!=m.doubleSided){m.doubleSided?e.disable(e.CULL_FACE):e.enable(e.CULL_FACE);pa=m.doubleSided}if(Da!=m.flipSided){m.flipSided?e.frontFace(e.CW):e.frontFace(e.CCW);Da=m.flipSided}}function k(m){if(Y!=
|
|
|
m){m?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST);Y=m}}function n(m){wa[0].set(m.n41-m.n11,m.n42-m.n12,m.n43-m.n13,m.n44-m.n14);wa[1].set(m.n41+m.n11,m.n42+m.n12,m.n43+m.n13,m.n44+m.n14);wa[2].set(m.n41+m.n21,m.n42+m.n22,m.n43+m.n23,m.n44+m.n24);wa[3].set(m.n41-m.n21,m.n42-m.n22,m.n43-m.n23,m.n44-m.n24);wa[4].set(m.n41-m.n31,m.n42-m.n32,m.n43-m.n33,m.n44-m.n34);wa[5].set(m.n41+m.n31,m.n42+m.n32,m.n43+m.n33,m.n44+m.n34);var A;for(m=0;m<6;m++){A=wa[m];A.divideScalar(Math.sqrt(A.x*A.x+A.y*A.y+A.z*
|
|
|
A.z))}}function p(m){for(var A=m.matrixWorld,x=-m.geometry.boundingSphere.radius*Math.max(m.scale.x,Math.max(m.scale.y,m.scale.z)),t=0;t<6;t++){m=wa[t].x*A.n14+wa[t].y*A.n24+wa[t].z*A.n34+wa[t].w;if(m<=x)return!1}return!0}function o(m,A){m.list[m.count]=A;m.count+=1}function u(m){var A,x,t=m.object,w=m.opaque,R=m.transparent;R.count=0;m=w.count=0;for(A=t.materials.length;m<A;m++){x=t.materials[m];x.transparent?o(R,x):o(w,x)}}function y(m){var A,x,t,w,R=m.object,F=m.buffer,D=m.opaque,O=m.transparent;
|
|
|
-O.count=0;m=D.count=0;for(t=R.materials.length;m<t;m++){A=R.materials[m];if(A instanceof THREE.MeshFaceMaterial){A=0;for(x=F.materials.length;A<x;A++)(w=F.materials[A])&&(w.transparent?o(O,w):o(D,w))}else(w=A)&&(w.transparent?o(O,w):o(D,w))}}function v(m,A){return A.z-m.z}function B(m){e.enable(e.POLYGON_OFFSET_FILL);e.polygonOffset(0.1,1);e.enable(e.STENCIL_TEST);e.depthMask(!1);e.colorMask(!1,!1,!1,!1);e.stencilFunc(e.ALWAYS,1,255);e.stencilOpSeparate(e.BACK,e.KEEP,e.INCR,e.KEEP);e.stencilOpSeparate(e.FRONT,
|
|
|
-e.KEEP,e.DECR,e.KEEP);var A,x=m.lights.length,t,w=m.lights,R=[],F,D,O,E,I,S=m.__webglShadowVolumes.length;for(A=0;A<x;A++){t=m.lights[A];if(t instanceof THREE.DirectionalLight){R[0]=-t.position.x;R[1]=-t.position.y;R[2]=-t.position.z;for(I=0;I<S;I++){t=m.__webglShadowVolumes[I].object;F=m.__webglShadowVolumes[I].buffer;D=t.materials[0];D.program||$.initMaterial(D,w,undefined,t);D=D.program;O=D.uniforms;E=D.attributes;if(Aa!==D){e.useProgram(D);Aa=D;e.uniformMatrix4fv(O.projectionMatrix,!1,cb);e.uniformMatrix4fv(O.viewMatrix,
|
|
|
-!1,ab);e.uniform3fv(O.directionalLightDirection,R)}t.matrixWorld.flattenToArray(t._objectMatrixArray);e.uniformMatrix4fv(O.objectMatrix,!1,t._objectMatrixArray);e.bindBuffer(e.ARRAY_BUFFER,F.__webglVertexBuffer);e.vertexAttribPointer(E.position,3,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,F.__webglNormalBuffer);e.vertexAttribPointer(E.normal,3,e.FLOAT,!1,0,0);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,F.__webglFaceBuffer);e.cullFace(e.FRONT);e.drawElements(e.TRIANGLES,F.__webglFaceCount,e.UNSIGNED_SHORT,
|
|
|
-0);e.cullFace(e.BACK);e.drawElements(e.TRIANGLES,F.__webglFaceCount,e.UNSIGNED_SHORT,0)}}}e.disable(e.POLYGON_OFFSET_FILL);e.colorMask(!0,!0,!0,!0);e.stencilFunc(e.NOTEQUAL,0,255);e.stencilOp(e.KEEP,e.KEEP,e.KEEP);e.disable(e.DEPTH_TEST);ga="";Aa=ya.program;e.useProgram(ya.program);e.uniformMatrix4fv(ya.projectionLocation,!1,cb);e.uniform1f(ya.darknessLocation,ya.darkness);e.bindBuffer(e.ARRAY_BUFFER,ya.vertexBuffer);e.vertexAttribPointer(ya.vertexLocation,3,e.FLOAT,!1,0,0);e.enableVertexAttribArray(ya.vertexLocation);
|
|
|
-e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA);e.blendEquation(e.FUNC_ADD);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,ya.elementBuffer);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0);e.disable(e.STENCIL_TEST);e.enable(e.DEPTH_TEST);e.depthMask(qa)}function C(m,A){var x,t,w,R=m.__webglLensFlares.length,F,D,O;F=new THREE.Vector3;var E=na/ka;D=ka*0.5;O=na*0.5;var I=16/na,S=[I*E,I],sa=[1,1,0];I=[1,1];var W,Ba=ia.readBackPixels,ra,za,Ia=ia.uniforms;x=ia.attributes;e.useProgram(ia.program);Aa=ia.program;ga="";e.uniform1i(Ia.map,
|
|
|
-0);e.activeTexture(e.TEXTURE0);e.uniform1f(Ia.opacity,1);e.uniform1f(Ia.rotation,0);e.uniform2fv(Ia.scale,S);e.bindBuffer(e.ARRAY_BUFFER,ia.vertexBuffer);e.vertexAttribPointer(x.vertex,2,e.FLOAT,!1,16,0);e.vertexAttribPointer(x.uv,2,e.FLOAT,!1,16,8);e.bindTexture(e.TEXTURE_2D,ia.tempTexture);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,ia.elementBuffer);e.disable(e.CULL_FACE);e.depthMask(!1);for(w=0;w<R;w++){x=m.__webglLensFlares[w].object;F.set(x.matrixWorld.n14,x.matrixWorld.n24,x.matrixWorld.n34);A.matrixWorldInverse.multiplyVector3(F);
|
|
|
-t=F.z;A.projectionMatrix.multiplyVector3(F);sa[0]=F.x;sa[1]=F.y;sa[2]=F.z;I[0]=sa[0]*D+D;I[1]=sa[1]*O+O;e.copyTexSubImage2D(e.TEXTURE_2D,0,0,0,I[0]-8,I[1]-8,16,16);e.uniform3fv(Ia.screenPosition,sa);e.uniform1i(Ia.renderPink,1);e.enable(e.DEPTH_TEST);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0);try{e.readPixels(I[0]-8,I[1]-8,16,16,e.RGBA,e.UNSIGNED_BYTE,ia.readBackPixels)}catch(Sa){console.log("WebGLRenderer.renderLensFlare: readPixels failed!")}e.getError()&&console.log("WebGLRenderer.renderLensFlare: readPixels failed!");
|
|
|
-sampleDistance=parseInt(5*(1-Math.max(0,Math.min(-t,A.far))/A.far),10)+2;t=sampleDistance*4;W=sampleDistance*64;za=0;ra=28-t+(448-W);ia.readBackPixels[ra+0]===255&&ia.readBackPixels[ra+1]===0&&ia.readBackPixels[ra+2]===255&&(za+=0.2);ra=28+t+(448-W);Ba[ra+0]===255&&Ba[ra+1]===0&&Ba[ra+2]===255&&(za+=0.2);ra=28+t+(448+W);Ba[ra+0]===255&&Ba[ra+1]===0&&Ba[ra+2]===255&&(za+=0.2);ra=28-t+(448+W);Ba[ra+0]===255&&Ba[ra+1]===0&&Ba[ra+2]===255&&(za+=0.2);ra=476;Ba[ra+0]===255&&Ba[ra+1]===0&&Ba[ra+2]===255&&
|
|
|
-(za+=0.2);x.positionScreen.x=sa[0];x.positionScreen.y=sa[1];x.positionScreen.z=sa[2];x.customUpdateCallback?x.customUpdateCallback(za,x):x.updateLensFlares(za);e.uniform1i(Ia.renderPink,0);e.disable(e.DEPTH_TEST);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0)}for(w=0;w<R;w++){x=m.__webglLensFlares[w].object;F=0;for(D=x.lensFlares.length;F<D;F++){O=x.lensFlares[F];if(O.opacity>0.001&&O.scale>0.001){sa[0]=O.x;sa[1]=O.y;sa[2]=O.z;I=O.size*O.scale/na;S[0]=I*E;S[1]=I;e.uniform3fv(Ia.screenPosition,sa);
|
|
|
-e.uniform1f(Ia.rotation,O.rotation);e.uniform2fv(Ia.scale,S);e.uniform1f(Ia.opacity,O.opacity);J(O.blending);M(O.texture,0);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0)}}}e.enable(e.CULL_FACE);e.enable(e.DEPTH_TEST);e.depthMask(qa)}function G(m,A){m._modelViewMatrix.multiplyToArray(A.matrixWorldInverse,m.matrixWorld,m._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(m._modelViewMatrix).transposeIntoArray(m._normalMatrixArray)}function H(m){var A,x,t,w,R;if(m instanceof THREE.Mesh){x=m.geometry;
|
|
|
-for(A in x.geometryGroups){t=x.geometryGroups[A];R=!1;for(w in t.__webglCustomAttributes)if(t.__webglCustomAttributes[w].needsUpdate){R=!0;break}if(x.__dirtyVertices||x.__dirtyMorphTargets||x.__dirtyElements||x.__dirtyUvs||x.__dirtyNormals||x.__dirtyColors||x.__dirtyTangents||R){R=e.DYNAMIC_DRAW;var F=void 0,D=void 0,O=void 0,E=void 0;O=void 0;var I=void 0,S=void 0,sa=void 0,W=void 0,Ba=void 0,ra=void 0,za=void 0,Ia=void 0,Sa=void 0,ea=void 0,ca=void 0,ja=void 0,La=void 0;S=void 0;sa=void 0;E=void 0;
|
|
|
-W=void 0;E=void 0;ea=void 0;ca=void 0;S=void 0;ea=void 0;ca=void 0;ja=void 0;La=void 0;ea=void 0;ca=void 0;ja=void 0;La=void 0;ea=void 0;ca=void 0;ja=void 0;La=void 0;ea=void 0;ca=void 0;ja=void 0;E=void 0;W=void 0;I=void 0;O=void 0;O=void 0;var V=void 0,P=void 0,Oa=void 0,fb=void 0,Na=0,Xa=0,gb=0,hb=0,Ya=0,eb=0,Ra=0,Ja=0,Ma=0,Q=0,Va=0;V=0;var Za=t.__vertexArray,$a=t.__uvArray,T=t.__uv2Array,ta=t.__normalArray,fa=t.__tangentArray,aa=t.__colorArray,va=t.__skinVertexAArray,ua=t.__skinVertexBArray,ha=
|
|
|
-t.__skinIndexArray,K=t.__skinWeightArray,Qa=t.__morphTargetsArrays,db=t.__webglCustomAttributes;P=void 0;var Wa=t.__faceArray,bb=t.__lineArray,lb=t.__needsSmoothNormals;ra=t.__vertexColorType;Ba=t.__uvType;za=t.__normalType;var Ta=m.geometry,ib=Ta.__dirtyVertices,sb=Ta.__dirtyElements,rb=Ta.__dirtyUvs,tb=Ta.__dirtyNormals,ub=Ta.__dirtyTangents,vb=Ta.__dirtyColors,wb=Ta.__dirtyMorphTargets,nb=Ta.vertices,xb=t.faces,Ab=Ta.faces,yb=Ta.faceVertexUvs[0],zb=Ta.faceVertexUvs[1],ob=Ta.skinVerticesA,pb=Ta.skinVerticesB,
|
|
|
-qb=Ta.skinIndices,kb=Ta.skinWeights,mb=Ta.edgeFaces,jb=Ta.morphTargets;if(db)for(fb in db)db[fb].offset=0;F=0;for(D=xb.length;F<D;F++){O=xb[F];E=Ab[O];yb&&(Ia=yb[O]);zb&&(Sa=zb[O]);O=E.vertexNormals;I=E.normal;S=E.vertexColors;sa=E.color;W=E.vertexTangents;if(E instanceof THREE.Face3){if(ib){ea=nb[E.a].position;ca=nb[E.b].position;ja=nb[E.c].position;Za[Xa]=ea.x;Za[Xa+1]=ea.y;Za[Xa+2]=ea.z;Za[Xa+3]=ca.x;Za[Xa+4]=ca.y;Za[Xa+5]=ca.z;Za[Xa+6]=ja.x;Za[Xa+7]=ja.y;Za[Xa+8]=ja.z;Xa+=9}if(db)for(fb in db){P=
|
|
|
-db[fb];if(P.needsUpdate){V=P.offset;if(P.size===1){P.array[V+0]=P.value[E.a];P.array[V+1]=P.value[E.b];P.array[V+2]=P.value[E.c];P.offset+=3}else{ea=P.value[E.a];ca=P.value[E.b];ja=P.value[E.c];if(P.size===2){P.array[V+0]=ea.x;P.array[V+1]=ea.y;P.array[V+2]=ca.x;P.array[V+3]=ca.y;P.array[V+4]=ja.x;P.array[V+5]=ja.y;P.offset+=6}else if(P.size===3){P.array[V+0]=ea.x;P.array[V+1]=ea.y;P.array[V+2]=ea.z;P.array[V+3]=ca.x;P.array[V+4]=ca.y;P.array[V+5]=ca.z;P.array[V+6]=ja.x;P.array[V+7]=ja.y;P.array[V+
|
|
|
-8]=ja.z;P.offset+=9}else{P.array[V+0]=ea.x;P.array[V+1]=ea.y;P.array[V+2]=ea.z;P.array[V+3]=ea.w;P.array[V+4]=ca.x;P.array[V+5]=ca.y;P.array[V+6]=ca.z;P.array[V+7]=ca.w;P.array[V+8]=ja.x;P.array[V+9]=ja.y;P.array[V+10]=ja.z;P.array[V+11]=ja.w;P.offset+=12}}}}if(wb){V=0;for(P=jb.length;V<P;V++){ea=jb[V].vertices[E.a].position;ca=jb[V].vertices[E.b].position;ja=jb[V].vertices[E.c].position;Oa=Qa[V];Oa[Va+0]=ea.x;Oa[Va+1]=ea.y;Oa[Va+2]=ea.z;Oa[Va+3]=ca.x;Oa[Va+4]=ca.y;Oa[Va+5]=ca.z;Oa[Va+6]=ja.x;Oa[Va+
|
|
|
-7]=ja.y;Oa[Va+8]=ja.z}Va+=9}if(kb.length){ea=kb[E.a];ca=kb[E.b];ja=kb[E.c];K[Q]=ea.x;K[Q+1]=ea.y;K[Q+2]=ea.z;K[Q+3]=ea.w;K[Q+4]=ca.x;K[Q+5]=ca.y;K[Q+6]=ca.z;K[Q+7]=ca.w;K[Q+8]=ja.x;K[Q+9]=ja.y;K[Q+10]=ja.z;K[Q+11]=ja.w;ea=qb[E.a];ca=qb[E.b];ja=qb[E.c];ha[Q]=ea.x;ha[Q+1]=ea.y;ha[Q+2]=ea.z;ha[Q+3]=ea.w;ha[Q+4]=ca.x;ha[Q+5]=ca.y;ha[Q+6]=ca.z;ha[Q+7]=ca.w;ha[Q+8]=ja.x;ha[Q+9]=ja.y;ha[Q+10]=ja.z;ha[Q+11]=ja.w;ea=ob[E.a];ca=ob[E.b];ja=ob[E.c];va[Q]=ea.x;va[Q+1]=ea.y;va[Q+2]=ea.z;va[Q+3]=1;va[Q+4]=ca.x;
|
|
|
-va[Q+5]=ca.y;va[Q+6]=ca.z;va[Q+7]=1;va[Q+8]=ja.x;va[Q+9]=ja.y;va[Q+10]=ja.z;va[Q+11]=1;ea=pb[E.a];ca=pb[E.b];ja=pb[E.c];ua[Q]=ea.x;ua[Q+1]=ea.y;ua[Q+2]=ea.z;ua[Q+3]=1;ua[Q+4]=ca.x;ua[Q+5]=ca.y;ua[Q+6]=ca.z;ua[Q+7]=1;ua[Q+8]=ja.x;ua[Q+9]=ja.y;ua[Q+10]=ja.z;ua[Q+11]=1;Q+=12}if(vb&&ra){if(S.length==3&&ra==THREE.VertexColors){E=S[0];ea=S[1];ca=S[2]}else ca=ea=E=sa;aa[Ma]=E.r;aa[Ma+1]=E.g;aa[Ma+2]=E.b;aa[Ma+3]=ea.r;aa[Ma+4]=ea.g;aa[Ma+5]=ea.b;aa[Ma+6]=ca.r;aa[Ma+7]=ca.g;aa[Ma+8]=ca.b;Ma+=9}if(ub&&Ta.hasTangents){S=
|
|
|
-W[0];sa=W[1];E=W[2];fa[Ra]=S.x;fa[Ra+1]=S.y;fa[Ra+2]=S.z;fa[Ra+3]=S.w;fa[Ra+4]=sa.x;fa[Ra+5]=sa.y;fa[Ra+6]=sa.z;fa[Ra+7]=sa.w;fa[Ra+8]=E.x;fa[Ra+9]=E.y;fa[Ra+10]=E.z;fa[Ra+11]=E.w;Ra+=12}if(tb&&za)if(O.length==3&&lb)for(W=0;W<3;W++){I=O[W];ta[eb]=I.x;ta[eb+1]=I.y;ta[eb+2]=I.z;eb+=3}else for(W=0;W<3;W++){ta[eb]=I.x;ta[eb+1]=I.y;ta[eb+2]=I.z;eb+=3}if(rb&&Ia!==undefined&&Ba)for(W=0;W<3;W++){O=Ia[W];$a[gb]=O.u;$a[gb+1]=O.v;gb+=2}if(rb&&Sa!==undefined&&Ba)for(W=0;W<3;W++){O=Sa[W];T[hb]=O.u;T[hb+1]=O.v;
|
|
|
-hb+=2}if(sb){Wa[Ya]=Na;Wa[Ya+1]=Na+1;Wa[Ya+2]=Na+2;Ya+=3;bb[Ja]=Na;bb[Ja+1]=Na+1;bb[Ja+2]=Na;bb[Ja+3]=Na+2;bb[Ja+4]=Na+1;bb[Ja+5]=Na+2;Ja+=6;Na+=3}}else if(E instanceof THREE.Face4){if(ib){ea=nb[E.a].position;ca=nb[E.b].position;ja=nb[E.c].position;La=nb[E.d].position;Za[Xa]=ea.x;Za[Xa+1]=ea.y;Za[Xa+2]=ea.z;Za[Xa+3]=ca.x;Za[Xa+4]=ca.y;Za[Xa+5]=ca.z;Za[Xa+6]=ja.x;Za[Xa+7]=ja.y;Za[Xa+8]=ja.z;Za[Xa+9]=La.x;Za[Xa+10]=La.y;Za[Xa+11]=La.z;Xa+=12}if(db)for(fb in db){P=db[fb];if(P.needsUpdate){V=P.offset;
|
|
|
-if(P.size===1){P.array[V+0]=P.value[E.a];P.array[V+1]=P.value[E.b];P.array[V+2]=P.value[E.c];P.array[V+2]=P.value[E.d];P.offset+=4}else{ea=P.value[E.a];ca=P.value[E.b];ja=P.value[E.c];La=P.value[E.d];if(P.size===2){P.array[V+0]=ea.x;P.array[V+1]=ea.y;P.array[V+2]=ca.x;P.array[V+3]=ca.y;P.array[V+4]=ja.x;P.array[V+5]=ja.y;P.array[V+6]=La.x;P.array[V+7]=La.y;P.offset+=8}else if(P.size===3){P.array[V+0]=ea.x;P.array[V+1]=ea.y;P.array[V+2]=ea.z;P.array[V+3]=ca.x;P.array[V+4]=ca.y;P.array[V+5]=ca.z;P.array[V+
|
|
|
-6]=ja.x;P.array[V+7]=ja.y;P.array[V+8]=ja.z;P.array[V+9]=La.x;P.array[V+10]=La.y;P.array[V+11]=La.z;P.offset+=12}else{P.array[V+0]=ea.x;P.array[V+1]=ea.y;P.array[V+2]=ea.z;P.array[V+3]=ea.w;P.array[V+4]=ca.x;P.array[V+5]=ca.y;P.array[V+6]=ca.z;P.array[V+7]=ca.w;P.array[V+8]=ja.x;P.array[V+9]=ja.y;P.array[V+10]=ja.z;P.array[V+11]=ja.w;P.array[V+12]=La.x;P.array[V+13]=La.y;P.array[V+14]=La.z;P.array[V+15]=La.w;P.offset+=16}}}}if(wb){V=0;for(P=jb.length;V<P;V++){ea=jb[V].vertices[E.a].position;ca=jb[V].vertices[E.b].position;
|
|
|
-ja=jb[V].vertices[E.c].position;La=jb[V].vertices[E.d].position;Oa=Qa[V];Oa[Va+0]=ea.x;Oa[Va+1]=ea.y;Oa[Va+2]=ea.z;Oa[Va+3]=ca.x;Oa[Va+4]=ca.y;Oa[Va+5]=ca.z;Oa[Va+6]=ja.x;Oa[Va+7]=ja.y;Oa[Va+8]=ja.z;Oa[Va+9]=La.x;Oa[Va+10]=La.y;Oa[Va+11]=La.z}Va+=12}if(kb.length){ea=kb[E.a];ca=kb[E.b];ja=kb[E.c];La=kb[E.d];K[Q]=ea.x;K[Q+1]=ea.y;K[Q+2]=ea.z;K[Q+3]=ea.w;K[Q+4]=ca.x;K[Q+5]=ca.y;K[Q+6]=ca.z;K[Q+7]=ca.w;K[Q+8]=ja.x;K[Q+9]=ja.y;K[Q+10]=ja.z;K[Q+11]=ja.w;K[Q+12]=La.x;K[Q+13]=La.y;K[Q+14]=La.z;K[Q+15]=La.w;
|
|
|
-ea=qb[E.a];ca=qb[E.b];ja=qb[E.c];La=qb[E.d];ha[Q]=ea.x;ha[Q+1]=ea.y;ha[Q+2]=ea.z;ha[Q+3]=ea.w;ha[Q+4]=ca.x;ha[Q+5]=ca.y;ha[Q+6]=ca.z;ha[Q+7]=ca.w;ha[Q+8]=ja.x;ha[Q+9]=ja.y;ha[Q+10]=ja.z;ha[Q+11]=ja.w;ha[Q+12]=La.x;ha[Q+13]=La.y;ha[Q+14]=La.z;ha[Q+15]=La.w;ea=ob[E.a];ca=ob[E.b];ja=ob[E.c];La=ob[E.d];va[Q]=ea.x;va[Q+1]=ea.y;va[Q+2]=ea.z;va[Q+3]=1;va[Q+4]=ca.x;va[Q+5]=ca.y;va[Q+6]=ca.z;va[Q+7]=1;va[Q+8]=ja.x;va[Q+9]=ja.y;va[Q+10]=ja.z;va[Q+11]=1;va[Q+12]=La.x;va[Q+13]=La.y;va[Q+14]=La.z;va[Q+15]=1;ea=
|
|
|
-pb[E.a];ca=pb[E.b];ja=pb[E.c];E=pb[E.d];ua[Q]=ea.x;ua[Q+1]=ea.y;ua[Q+2]=ea.z;ua[Q+3]=1;ua[Q+4]=ca.x;ua[Q+5]=ca.y;ua[Q+6]=ca.z;ua[Q+7]=1;ua[Q+8]=ja.x;ua[Q+9]=ja.y;ua[Q+10]=ja.z;ua[Q+11]=1;ua[Q+12]=E.x;ua[Q+13]=E.y;ua[Q+14]=E.z;ua[Q+15]=1;Q+=16}if(vb&&ra){if(S.length==4&&ra==THREE.VertexColors){E=S[0];ea=S[1];ca=S[2];S=S[3]}else S=ca=ea=E=sa;aa[Ma]=E.r;aa[Ma+1]=E.g;aa[Ma+2]=E.b;aa[Ma+3]=ea.r;aa[Ma+4]=ea.g;aa[Ma+5]=ea.b;aa[Ma+6]=ca.r;aa[Ma+7]=ca.g;aa[Ma+8]=ca.b;aa[Ma+9]=S.r;aa[Ma+10]=S.g;aa[Ma+11]=S.b;
|
|
|
-Ma+=12}if(ub&&Ta.hasTangents){S=W[0];sa=W[1];E=W[2];W=W[3];fa[Ra]=S.x;fa[Ra+1]=S.y;fa[Ra+2]=S.z;fa[Ra+3]=S.w;fa[Ra+4]=sa.x;fa[Ra+5]=sa.y;fa[Ra+6]=sa.z;fa[Ra+7]=sa.w;fa[Ra+8]=E.x;fa[Ra+9]=E.y;fa[Ra+10]=E.z;fa[Ra+11]=E.w;fa[Ra+12]=W.x;fa[Ra+13]=W.y;fa[Ra+14]=W.z;fa[Ra+15]=W.w;Ra+=16}if(tb&&za)if(O.length==4&&lb)for(W=0;W<4;W++){I=O[W];ta[eb]=I.x;ta[eb+1]=I.y;ta[eb+2]=I.z;eb+=3}else for(W=0;W<4;W++){ta[eb]=I.x;ta[eb+1]=I.y;ta[eb+2]=I.z;eb+=3}if(rb&&Ia!==undefined&&Ba)for(W=0;W<4;W++){O=Ia[W];$a[gb]=
|
|
|
-O.u;$a[gb+1]=O.v;gb+=2}if(rb&&Sa!==undefined&&Ba)for(W=0;W<4;W++){O=Sa[W];T[hb]=O.u;T[hb+1]=O.v;hb+=2}if(sb){Wa[Ya]=Na;Wa[Ya+1]=Na+1;Wa[Ya+2]=Na+3;Wa[Ya+3]=Na+1;Wa[Ya+4]=Na+2;Wa[Ya+5]=Na+3;Ya+=6;bb[Ja]=Na;bb[Ja+1]=Na+1;bb[Ja+2]=Na;bb[Ja+3]=Na+3;bb[Ja+4]=Na+1;bb[Ja+5]=Na+2;bb[Ja+6]=Na+2;bb[Ja+7]=Na+3;Ja+=8;Na+=4}}}if(mb){F=0;for(D=mb.length;F<D;F++){Wa[Ya]=mb[F].a;Wa[Ya+1]=mb[F].b;Wa[Ya+2]=mb[F].c;Wa[Ya+3]=mb[F].a;Wa[Ya+4]=mb[F].c;Wa[Ya+5]=mb[F].d;Ya+=6}}if(ib){e.bindBuffer(e.ARRAY_BUFFER,t.__webglVertexBuffer);
|
|
|
-e.bufferData(e.ARRAY_BUFFER,Za,R)}if(db)for(fb in db){P=db[fb];if(P.needsUpdate){e.bindBuffer(e.ARRAY_BUFFER,P.buffer);e.bufferData(e.ARRAY_BUFFER,P.array,R);P.needsUpdate=!1}}if(wb){V=0;for(P=jb.length;V<P;V++){e.bindBuffer(e.ARRAY_BUFFER,t.__webglMorphTargetsBuffers[V]);e.bufferData(e.ARRAY_BUFFER,Qa[V],R)}}if(vb&&Ma>0){e.bindBuffer(e.ARRAY_BUFFER,t.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,aa,R)}if(tb){e.bindBuffer(e.ARRAY_BUFFER,t.__webglNormalBuffer);e.bufferData(e.ARRAY_BUFFER,ta,R)}if(ub&&
|
|
|
-Ta.hasTangents){e.bindBuffer(e.ARRAY_BUFFER,t.__webglTangentBuffer);e.bufferData(e.ARRAY_BUFFER,fa,R)}if(rb&&gb>0){e.bindBuffer(e.ARRAY_BUFFER,t.__webglUVBuffer);e.bufferData(e.ARRAY_BUFFER,$a,R)}if(rb&&hb>0){e.bindBuffer(e.ARRAY_BUFFER,t.__webglUV2Buffer);e.bufferData(e.ARRAY_BUFFER,T,R)}if(sb){e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t.__webglFaceBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,Wa,R);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t.__webglLineBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,bb,R)}if(Q>0){e.bindBuffer(e.ARRAY_BUFFER,
|
|
|
-t.__webglSkinVertexABuffer);e.bufferData(e.ARRAY_BUFFER,va,R);e.bindBuffer(e.ARRAY_BUFFER,t.__webglSkinVertexBBuffer);e.bufferData(e.ARRAY_BUFFER,ua,R);e.bindBuffer(e.ARRAY_BUFFER,t.__webglSkinIndicesBuffer);e.bufferData(e.ARRAY_BUFFER,ha,R);e.bindBuffer(e.ARRAY_BUFFER,t.__webglSkinWeightsBuffer);e.bufferData(e.ARRAY_BUFFER,K,R)}}}x.__dirtyVertices=!1;x.__dirtyMorphTargets=!1;x.__dirtyElements=!1;x.__dirtyUvs=!1;x.__dirtyNormals=!1;x.__dirtyTangents=!1;x.__dirtyColors=!1}else if(m instanceof THREE.Ribbon){x=
|
|
|
-m.geometry;if(x.__dirtyVertices||x.__dirtyColors){m=x;A=e.DYNAMIC_DRAW;ra=m.vertices;t=m.colors;za=ra.length;R=t.length;Ia=m.__vertexArray;F=m.__colorArray;Sa=m.__dirtyColors;if(m.__dirtyVertices){for(D=0;D<za;D++){Ba=ra[D].position;w=D*3;Ia[w]=Ba.x;Ia[w+1]=Ba.y;Ia[w+2]=Ba.z}e.bindBuffer(e.ARRAY_BUFFER,m.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,Ia,A)}if(Sa){for(D=0;D<R;D++){color=t[D];w=D*3;F[w]=color.r;F[w+1]=color.g;F[w+2]=color.b}e.bindBuffer(e.ARRAY_BUFFER,m.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,
|
|
|
-F,A)}}x.__dirtyVertices=!1;x.__dirtyColors=!1}else if(m instanceof THREE.Line){x=m.geometry;if(x.__dirtyVertices||x.__dirtyColors){m=x;A=e.DYNAMIC_DRAW;ra=m.vertices;t=m.colors;za=ra.length;R=t.length;Ia=m.__vertexArray;F=m.__colorArray;Sa=m.__dirtyColors;if(m.__dirtyVertices){for(D=0;D<za;D++){Ba=ra[D].position;w=D*3;Ia[w]=Ba.x;Ia[w+1]=Ba.y;Ia[w+2]=Ba.z}e.bindBuffer(e.ARRAY_BUFFER,m.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,Ia,A)}if(Sa){for(D=0;D<R;D++){color=t[D];w=D*3;F[w]=color.r;F[w+1]=
|
|
|
-color.g;F[w+2]=color.b}e.bindBuffer(e.ARRAY_BUFFER,m.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,F,A)}}x.__dirtyVertices=!1;x.__dirtyColors=!1}else if(m instanceof THREE.ParticleSystem){x=m.geometry;(x.__dirtyVertices||x.__dirtyColors||m.sortParticles)&&d(x,e.DYNAMIC_DRAW,m);x.__dirtyVertices=!1;x.__dirtyColors=!1}}function U(m){function A(sa){var W=[];x=0;for(t=sa.length;x<t;x++)sa[x]==undefined?W.push("undefined"):W.push(sa[x].id);return W.join("_")}var x,t,w,R,F,D,O,E,I={},S=m.morphTargets!==
|
|
|
-undefined?m.morphTargets.length:0;m.geometryGroups={};w=0;for(R=m.faces.length;w<R;w++){F=m.faces[w];D=F.materials;O=A(D);I[O]==undefined&&(I[O]={hash:O,counter:0});E=I[O].hash+"_"+I[O].counter;m.geometryGroups[E]==undefined&&(m.geometryGroups[E]={faces:[],materials:D,vertices:0,numMorphTargets:S});F=F instanceof THREE.Face3?3:4;if(m.geometryGroups[E].vertices+F>65535){I[O].counter+=1;E=I[O].hash+"_"+I[O].counter;m.geometryGroups[E]==undefined&&(m.geometryGroups[E]={faces:[],materials:D,vertices:0,
|
|
|
-numMorphTargets:S})}m.geometryGroups[E].faces.push(w);m.geometryGroups[E].vertices+=F}}function z(m,A,x){m.push({buffer:A,object:x,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function J(m){if(m!=ga){switch(m){case THREE.AdditiveBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.SRC_ALPHA,e.ONE);break;case THREE.SubtractiveBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ZERO,e.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ZERO,e.SRC_COLOR);
|
|
|
-break;default:e.blendEquationSeparate(e.FUNC_ADD,e.FUNC_ADD);e.blendFuncSeparate(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA)}ga=m}}function L(m,A,x){if((x.width&x.width-1)==0&&(x.height&x.height-1)==0){e.texParameteri(m,e.TEXTURE_WRAP_S,Z(A.wrapS));e.texParameteri(m,e.TEXTURE_WRAP_T,Z(A.wrapT));e.texParameteri(m,e.TEXTURE_MAG_FILTER,Z(A.magFilter));e.texParameteri(m,e.TEXTURE_MIN_FILTER,Z(A.minFilter));e.generateMipmap(m)}else{e.texParameteri(m,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE);
|
|
|
-e.texParameteri(m,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE);e.texParameteri(m,e.TEXTURE_MAG_FILTER,xa(A.magFilter));e.texParameteri(m,e.TEXTURE_MIN_FILTER,xa(A.minFilter))}}function M(m,A){if(m.needsUpdate){if(m.__webglInit){e.bindTexture(e.TEXTURE_2D,m.__webglTexture);e.texSubImage2D(e.TEXTURE_2D,0,0,0,e.RGBA,e.UNSIGNED_BYTE,m.image)}else{m.__webglTexture=e.createTexture();e.bindTexture(e.TEXTURE_2D,m.__webglTexture);e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,m.image);m.__webglInit=!0}L(e.TEXTURE_2D,
|
|
|
-m,m.image);e.bindTexture(e.TEXTURE_2D,null);m.needsUpdate=!1}e.activeTexture(e.TEXTURE0+A);e.bindTexture(e.TEXTURE_2D,m.__webglTexture)}function Fa(m){if(m&&!m.__webglFramebuffer){m.__webglFramebuffer=e.createFramebuffer();m.__webglRenderbuffer=e.createRenderbuffer();m.__webglTexture=e.createTexture();e.bindRenderbuffer(e.RENDERBUFFER,m.__webglRenderbuffer);e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_COMPONENT16,m.width,m.height);e.bindTexture(e.TEXTURE_2D,m.__webglTexture);e.texParameteri(e.TEXTURE_2D,
|
|
|
-e.TEXTURE_WRAP_S,Z(m.wrapS));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,Z(m.wrapT));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,Z(m.magFilter));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,Z(m.minFilter));e.texImage2D(e.TEXTURE_2D,0,Z(m.format),m.width,m.height,0,Z(m.format),Z(m.type),null);e.bindFramebuffer(e.FRAMEBUFFER,m.__webglFramebuffer);e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,m.__webglTexture,0);e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,
|
|
|
-e.RENDERBUFFER,m.__webglRenderbuffer);e.bindTexture(e.TEXTURE_2D,null);e.bindRenderbuffer(e.RENDERBUFFER,null);e.bindFramebuffer(e.FRAMEBUFFER,null)}var A,x;if(m){A=m.__webglFramebuffer;x=m.width;m=m.height}else{A=null;x=ka;m=na}if(A!=Ha){e.bindFramebuffer(e.FRAMEBUFFER,A);e.viewport(la,Ga,x,m);Ha=A}}function oa(m,A){var x;if(m=="fragment")x=e.createShader(e.FRAGMENT_SHADER);else m=="vertex"&&(x=e.createShader(e.VERTEX_SHADER));e.shaderSource(x,A);e.compileShader(x);if(!e.getShaderParameter(x,e.COMPILE_STATUS)){console.error(e.getShaderInfoLog(x));
|
|
|
-console.error(A);return null}return x}function xa(m){switch(m){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return e.NEAREST;default:return e.LINEAR}}function Z(m){switch(m){case THREE.RepeatWrapping:return e.REPEAT;case THREE.ClampToEdgeWrapping:return e.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return e.MIRRORED_REPEAT;case THREE.NearestFilter:return e.NEAREST;case THREE.NearestMipMapNearestFilter:return e.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return e.NEAREST_MIPMAP_LINEAR;
|
|
|
-case THREE.LinearFilter:return e.LINEAR;case THREE.LinearMipMapNearestFilter:return e.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return e.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return e.BYTE;case THREE.UnsignedByteType:return e.UNSIGNED_BYTE;case THREE.ShortType:return e.SHORT;case THREE.UnsignedShortType:return e.UNSIGNED_SHORT;case THREE.IntType:return e.INT;case THREE.UnsignedShortType:return e.UNSIGNED_INT;case THREE.FloatType:return e.FLOAT;case THREE.AlphaFormat:return e.ALPHA;
|
|
|
-case THREE.RGBFormat:return e.RGB;case THREE.RGBAFormat:return e.RGBA;case THREE.LuminanceFormat:return e.LUMINANCE;case THREE.LuminanceAlphaFormat:return e.LUMINANCE_ALPHA}return 0}var e,da=document.createElement("canvas"),Ca=[],Aa=null,Ha=null,qa=!0,$=this,pa=null,Da=null,ga=null,Y=null,la=0,Ga=0,ka=0,na=0,wa=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Ua=new THREE.Matrix4,cb=new Float32Array(16),ab=new Float32Array(16),Pa=new THREE.Vector4,
|
|
|
-N={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},X=!0,ma=!0,Ea=new THREE.Color(0),Ka=0;if(b){if(b.stencil!=undefined)X=b.stencil;if(b.antialias!==undefined)ma=b.antialias;b.clearColor!==undefined&&Ea.setHex(b.clearColor);if(b.clearAlpha!==undefined)Ka=b.clearAlpha}this.maxMorphTargets=8;this.domElement=da;this.autoClear=!0;this.sortObjects=!0;(function(m,A,x,t){try{if(!(e=da.getContext("experimental-webgl",{antialias:m,stencil:t})))throw"Error creating WebGL context.";
|
|
|
-}catch(w){console.error(w)}e.clearColor(0,0,0,1);e.clearDepth(1);e.enable(e.DEPTH_TEST);e.depthFunc(e.LEQUAL);e.frontFace(e.CCW);e.cullFace(e.BACK);e.enable(e.CULL_FACE);e.enable(e.BLEND);e.blendEquation(e.FUNC_ADD);e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA);e.clearColor(A.r,A.g,A.b,x)})(ma,Ea,Ka,X);this.context=e;if(X){var ya={};ya.vertices=new Float32Array(12);ya.faces=new Uint16Array(6);ya.darkness=0.5;ya.vertices[0]=-2;ya.vertices[1]=-1;ya.vertices[2]=-1;ya.vertices[3]=2;ya.vertices[4]=-1;
|
|
|
-ya.vertices[5]=-1;ya.vertices[6]=2;ya.vertices[7]=1;ya.vertices[8]=-1;ya.vertices[9]=-2;ya.vertices[10]=1;ya.vertices[11]=-1;ya.faces[0]=0;ya.faces[1]=1;ya.faces[2]=2;ya.faces[3]=0;ya.faces[4]=2;ya.faces[5]=3;ya.vertexBuffer=e.createBuffer();ya.elementBuffer=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,ya.vertexBuffer);e.bufferData(e.ARRAY_BUFFER,ya.vertices,e.STATIC_DRAW);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,ya.elementBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,ya.faces,e.STATIC_DRAW);ya.program=
|
|
|
-e.createProgram();e.attachShader(ya.program,oa("fragment",THREE.ShaderLib.shadowPost.fragmentShader));e.attachShader(ya.program,oa("vertex",THREE.ShaderLib.shadowPost.vertexShader));e.linkProgram(ya.program);ya.vertexLocation=e.getAttribLocation(ya.program,"position");ya.projectionLocation=e.getUniformLocation(ya.program,"projectionMatrix");ya.darknessLocation=e.getUniformLocation(ya.program,"darkness")}var ia={};ia.vertices=new Float32Array(16);ia.faces=new Uint16Array(6);ia.transparency=0.5;b=0;
|
|
|
-ia.vertices[b++]=-1;ia.vertices[b++]=-1;ia.vertices[b++]=0;ia.vertices[b++]=0;ia.vertices[b++]=1;ia.vertices[b++]=-1;ia.vertices[b++]=1;ia.vertices[b++]=0;ia.vertices[b++]=1;ia.vertices[b++]=1;ia.vertices[b++]=1;ia.vertices[b++]=1;ia.vertices[b++]=-1;ia.vertices[b++]=1;ia.vertices[b++]=0;ia.vertices[b++]=1;b=0;ia.faces[b++]=0;ia.faces[b++]=1;ia.faces[b++]=2;ia.faces[b++]=0;ia.faces[b++]=2;ia.faces[b++]=3;ia.vertexBuffer=e.createBuffer();ia.elementBuffer=e.createBuffer();ia.tempTexture=e.createTexture();
|
|
|
-ia.readBackPixels=new Uint8Array(1024);e.bindBuffer(e.ARRAY_BUFFER,ia.vertexBuffer);e.bufferData(e.ARRAY_BUFFER,ia.vertices,e.STATIC_DRAW);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,ia.elementBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,ia.faces,e.STATIC_DRAW);e.bindTexture(e.TEXTURE_2D,ia.tempTexture);e.texImage2D(e.TEXTURE_2D,0,e.RGB,16,16,0,e.RGB,e.UNSIGNED_BYTE,null);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE);e.texParameteri(e.TEXTURE_2D,
|
|
|
-e.TEXTURE_MAG_FILTER,e.NEAREST);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST);ia.program=e.createProgram();e.attachShader(ia.program,oa("fragment",THREE.ShaderLib.lensFlare.fragmentShader));e.attachShader(ia.program,oa("vertex",THREE.ShaderLib.lensFlare.vertexShader));e.linkProgram(ia.program);ia.attributes={};ia.uniforms={};ia.attributes.vertex=e.getAttribLocation(ia.program,"position");ia.attributes.uv=e.getAttribLocation(ia.program,"UV");ia.uniforms.map=e.getUniformLocation(ia.program,
|
|
|
-"map");ia.uniforms.opacity=e.getUniformLocation(ia.program,"opacity");ia.uniforms.scale=e.getUniformLocation(ia.program,"scale");ia.uniforms.rotation=e.getUniformLocation(ia.program,"rotation");ia.uniforms.screenPosition=e.getUniformLocation(ia.program,"screenPosition");ia.uniforms.renderPink=e.getUniformLocation(ia.program,"renderPink");this.setSize=function(m,A){da.width=m;da.height=A;this.setViewport(0,0,da.width,da.height)};this.setViewport=function(m,A,x,t){la=m;Ga=A;ka=x;na=t;e.viewport(la,
|
|
|
-Ga,ka,na)};this.setScissor=function(m,A,x,t){e.scissor(m,A,x,t)};this.enableScissorTest=function(m){m?e.enable(e.SCISSOR_TEST):e.disable(e.SCISSOR_TEST)};this.enableDepthBufferWrite=function(m){qa=m;e.depthMask(m)};this.setClearColorHex=function(m,A){var x=new THREE.Color(m);e.clearColor(x.r,x.g,x.b,A)};this.setClearColor=function(m,A){e.clearColor(m.r,m.g,m.b,A)};this.clear=function(){e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT|e.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness=function(m){ya.darkness=
|
|
|
-m};this.initMaterial=function(m,A,x,t){var w,R,F,D;if(m instanceof THREE.MeshDepthMaterial)c(m,THREE.ShaderLib.depth);else if(m instanceof THREE.ShadowVolumeDynamicMaterial)c(m,THREE.ShaderLib.shadowVolumeDynamic);else if(m instanceof THREE.MeshNormalMaterial)c(m,THREE.ShaderLib.normal);else if(m instanceof THREE.MeshBasicMaterial)c(m,THREE.ShaderLib.basic);else if(m instanceof THREE.MeshLambertMaterial)c(m,THREE.ShaderLib.lambert);else if(m instanceof THREE.MeshPhongMaterial)c(m,THREE.ShaderLib.phong);
|
|
|
-else if(m instanceof THREE.LineBasicMaterial)c(m,THREE.ShaderLib.basic);else m instanceof THREE.ParticleBasicMaterial&&c(m,THREE.ShaderLib.particle_basic);if(!m.program){var O,E,I,S;O=S=D=0;for(E=A.length;O<E;O++){I=A[O];I instanceof THREE.DirectionalLight&&S++;I instanceof THREE.PointLight&&D++}if(D+S<=4)A=S;else{A=Math.ceil(4*S/(D+S));D=4-A}D={directional:A,point:D};A=50;if(t!==undefined&&t instanceof THREE.SkinnedMesh)A=t.bones.length;x={map:m.map,envMap:m.envMap,lightMap:m.lightMap,vertexColors:m.vertexColors,
|
|
|
-fog:x,sizeAttenuation:m.sizeAttenuation,skinning:m.skinning,morphTargets:m.morphTargets,maxDirLights:D.directional,maxPointLights:D.point,maxBones:A};a:{D=m.fragmentShader;A=m.vertexShader;O=D+"\n\n"+A+"\n\n";for(F in x)O+=F+": "+x[F]+",\n";F=0;for(E=Ca.length;F<E;F++)if(Ca[F].code==O){F=Ca[F].program;break a}F=e.createProgram();prefix_fragment=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+x.maxDirLights,"#define MAX_POINT_LIGHTS "+x.maxPointLights,x.fog?"#define USE_FOG":
|
|
|
-"",x.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",x.map?"#define USE_MAP":"",x.envMap?"#define USE_ENVMAP":"",x.lightMap?"#define USE_LIGHTMAP":"",x.vertexColors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");prefix_vertex=[e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+x.maxDirLights,"#define MAX_POINT_LIGHTS "+x.maxPointLights,"#define MAX_BONES "+x.maxBones,x.map?"#define USE_MAP":"",
|
|
|
-x.envMap?"#define USE_ENVMAP":"",x.lightMap?"#define USE_LIGHTMAP":"",x.vertexColors?"#define USE_COLOR":"",x.skinning?"#define USE_SKINNING":"",x.morphTargets?"#define USE_MORPHTARGETS":"",x.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\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;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
|
|
|
+O.count=0;m=D.count=0;for(t=R.materials.length;m<t;m++){A=R.materials[m];if(A instanceof THREE.MeshFaceMaterial){A=0;for(x=F.materials.length;A<x;A++)(w=F.materials[A])&&(w.transparent?o(O,w):o(D,w))}else(w=A)&&(w.transparent?o(O,w):o(D,w))}}function v(m,A){return A.z-m.z}function B(m){e.enable(e.POLYGON_OFFSET_FILL);e.polygonOffset(0.1,1);e.enable(e.STENCIL_TEST);e.enable(e.DEPTH_TEST);e.depthMask(!1);e.colorMask(!1,!1,!1,!1);e.stencilFunc(e.ALWAYS,1,255);e.stencilOpSeparate(e.BACK,e.KEEP,e.INCR,
|
|
|
+e.KEEP);e.stencilOpSeparate(e.FRONT,e.KEEP,e.DECR,e.KEEP);var A,x=m.lights.length,t,w=m.lights,R=[],F,D,O,E,I,S=m.__webglShadowVolumes.length;for(A=0;A<x;A++){t=m.lights[A];if(t instanceof THREE.DirectionalLight){R[0]=-t.position.x;R[1]=-t.position.y;R[2]=-t.position.z;for(I=0;I<S;I++){t=m.__webglShadowVolumes[I].object;F=m.__webglShadowVolumes[I].buffer;D=t.materials[0];D.program||$.initMaterial(D,w,undefined,t);D=D.program;O=D.uniforms;E=D.attributes;if(Aa!==D){e.useProgram(D);Aa=D;e.uniformMatrix4fv(O.projectionMatrix,
|
|
|
+!1,cb);e.uniformMatrix4fv(O.viewMatrix,!1,ab);e.uniform3fv(O.directionalLightDirection,R)}t.matrixWorld.flattenToArray(t._objectMatrixArray);e.uniformMatrix4fv(O.objectMatrix,!1,t._objectMatrixArray);e.bindBuffer(e.ARRAY_BUFFER,F.__webglVertexBuffer);e.vertexAttribPointer(E.position,3,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,F.__webglNormalBuffer);e.vertexAttribPointer(E.normal,3,e.FLOAT,!1,0,0);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,F.__webglFaceBuffer);e.cullFace(e.FRONT);e.drawElements(e.TRIANGLES,
|
|
|
+F.__webglFaceCount,e.UNSIGNED_SHORT,0);e.cullFace(e.BACK);e.drawElements(e.TRIANGLES,F.__webglFaceCount,e.UNSIGNED_SHORT,0)}}}e.disable(e.POLYGON_OFFSET_FILL);e.colorMask(!0,!0,!0,!0);e.stencilFunc(e.NOTEQUAL,0,255);e.stencilOp(e.KEEP,e.KEEP,e.KEEP);e.disable(e.DEPTH_TEST);ga="";Aa=ya.program;e.useProgram(ya.program);e.uniformMatrix4fv(ya.projectionLocation,!1,cb);e.uniform1f(ya.darknessLocation,ya.darkness);e.bindBuffer(e.ARRAY_BUFFER,ya.vertexBuffer);e.vertexAttribPointer(ya.vertexLocation,3,e.FLOAT,
|
|
|
+!1,0,0);e.enableVertexAttribArray(ya.vertexLocation);e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA);e.blendEquation(e.FUNC_ADD);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,ya.elementBuffer);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0);e.disable(e.STENCIL_TEST);e.enable(e.DEPTH_TEST);e.depthMask(qa)}function C(m,A){var x,t,w,R=m.__webglLensFlares.length,F,D,O;F=new THREE.Vector3;var E=na/ka;D=ka*0.5;O=na*0.5;var I=16/na,S=[I*E,I],sa=[1,1,0];I=[1,1];var W,Ba=ia.readBackPixels,ra,za,Ia=ia.uniforms;x=ia.attributes;
|
|
|
+e.useProgram(ia.program);Aa=ia.program;ga="";e.uniform1i(Ia.map,0);e.activeTexture(e.TEXTURE0);e.uniform1f(Ia.opacity,1);e.uniform1f(Ia.rotation,0);e.uniform2fv(Ia.scale,S);e.bindBuffer(e.ARRAY_BUFFER,ia.vertexBuffer);e.vertexAttribPointer(x.vertex,2,e.FLOAT,!1,16,0);e.vertexAttribPointer(x.uv,2,e.FLOAT,!1,16,8);e.bindTexture(e.TEXTURE_2D,ia.tempTexture);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,ia.elementBuffer);e.disable(e.CULL_FACE);e.depthMask(!1);for(w=0;w<R;w++){x=m.__webglLensFlares[w].object;F.set(x.matrixWorld.n14,
|
|
|
+x.matrixWorld.n24,x.matrixWorld.n34);A.matrixWorldInverse.multiplyVector3(F);t=F.z;A.projectionMatrix.multiplyVector3(F);sa[0]=F.x;sa[1]=F.y;sa[2]=F.z;I[0]=sa[0]*D+D;I[1]=sa[1]*O+O;e.copyTexSubImage2D(e.TEXTURE_2D,0,0,0,I[0]-8,I[1]-8,16,16);e.uniform3fv(Ia.screenPosition,sa);e.uniform1i(Ia.renderPink,1);e.enable(e.DEPTH_TEST);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0);try{e.readPixels(I[0]-8,I[1]-8,16,16,e.RGBA,e.UNSIGNED_BYTE,ia.readBackPixels)}catch(Sa){console.log("WebGLRenderer.renderLensFlare: readPixels failed!")}e.getError()&&
|
|
|
+console.log("WebGLRenderer.renderLensFlare: readPixels failed!");sampleDistance=parseInt(5*(1-Math.max(0,Math.min(-t,A.far))/A.far),10)+2;t=sampleDistance*4;W=sampleDistance*64;za=0;ra=28-t+(448-W);ia.readBackPixels[ra+0]===255&&ia.readBackPixels[ra+1]===0&&ia.readBackPixels[ra+2]===255&&(za+=0.2);ra=28+t+(448-W);Ba[ra+0]===255&&Ba[ra+1]===0&&Ba[ra+2]===255&&(za+=0.2);ra=28+t+(448+W);Ba[ra+0]===255&&Ba[ra+1]===0&&Ba[ra+2]===255&&(za+=0.2);ra=28-t+(448+W);Ba[ra+0]===255&&Ba[ra+1]===0&&Ba[ra+2]===255&&
|
|
|
+(za+=0.2);ra=476;Ba[ra+0]===255&&Ba[ra+1]===0&&Ba[ra+2]===255&&(za+=0.2);x.positionScreen.x=sa[0];x.positionScreen.y=sa[1];x.positionScreen.z=sa[2];x.customUpdateCallback?x.customUpdateCallback(za,x):x.updateLensFlares(za);e.uniform1i(Ia.renderPink,0);e.disable(e.DEPTH_TEST);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0)}for(w=0;w<R;w++){x=m.__webglLensFlares[w].object;F=0;for(D=x.lensFlares.length;F<D;F++){O=x.lensFlares[F];if(O.opacity>0.0010&&O.scale>0.0010){sa[0]=O.x;sa[1]=O.y;sa[2]=O.z;I=O.size*
|
|
|
+O.scale/na;S[0]=I*E;S[1]=I;e.uniform3fv(Ia.screenPosition,sa);e.uniform1f(Ia.rotation,O.rotation);e.uniform2fv(Ia.scale,S);e.uniform1f(Ia.opacity,O.opacity);J(O.blending);M(O.texture,0);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0)}}}e.enable(e.CULL_FACE);e.enable(e.DEPTH_TEST);e.depthMask(qa)}function G(m,A){m._modelViewMatrix.multiplyToArray(A.matrixWorldInverse,m.matrixWorld,m._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(m._modelViewMatrix).transposeIntoArray(m._normalMatrixArray)}function H(m){var A,
|
|
|
+x,t,w,R;if(m instanceof THREE.Mesh){x=m.geometry;for(A in x.geometryGroups){t=x.geometryGroups[A];R=!1;for(w in t.__webglCustomAttributes)if(t.__webglCustomAttributes[w].needsUpdate){R=!0;break}if(x.__dirtyVertices||x.__dirtyMorphTargets||x.__dirtyElements||x.__dirtyUvs||x.__dirtyNormals||x.__dirtyColors||x.__dirtyTangents||R){R=e.DYNAMIC_DRAW;var F=void 0,D=void 0,O=void 0,E=void 0;O=void 0;var I=void 0,S=void 0,sa=void 0,W=void 0,Ba=void 0,ra=void 0,za=void 0,Ia=void 0,Sa=void 0,ea=void 0,ca=void 0,
|
|
|
+ja=void 0,La=void 0;S=void 0;sa=void 0;E=void 0;W=void 0;E=void 0;ea=void 0;ca=void 0;S=void 0;ea=void 0;ca=void 0;ja=void 0;La=void 0;ea=void 0;ca=void 0;ja=void 0;La=void 0;ea=void 0;ca=void 0;ja=void 0;La=void 0;ea=void 0;ca=void 0;ja=void 0;E=void 0;W=void 0;I=void 0;O=void 0;O=void 0;var V=void 0,P=void 0,Oa=void 0,fb=void 0,Na=0,Xa=0,gb=0,hb=0,Ya=0,eb=0,Ra=0,Ja=0,Ma=0,Q=0,Va=0;V=0;var Za=t.__vertexArray,$a=t.__uvArray,T=t.__uv2Array,ta=t.__normalArray,fa=t.__tangentArray,aa=t.__colorArray,va=
|
|
|
+t.__skinVertexAArray,ua=t.__skinVertexBArray,ha=t.__skinIndexArray,K=t.__skinWeightArray,Qa=t.__morphTargetsArrays,db=t.__webglCustomAttributes;P=void 0;var Wa=t.__faceArray,bb=t.__lineArray,lb=t.__needsSmoothNormals;ra=t.__vertexColorType;Ba=t.__uvType;za=t.__normalType;var Ta=m.geometry,ib=Ta.__dirtyVertices,sb=Ta.__dirtyElements,rb=Ta.__dirtyUvs,tb=Ta.__dirtyNormals,ub=Ta.__dirtyTangents,vb=Ta.__dirtyColors,wb=Ta.__dirtyMorphTargets,nb=Ta.vertices,xb=t.faces,Ab=Ta.faces,yb=Ta.faceVertexUvs[0],
|
|
|
+zb=Ta.faceVertexUvs[1],ob=Ta.skinVerticesA,pb=Ta.skinVerticesB,qb=Ta.skinIndices,kb=Ta.skinWeights,mb=Ta.edgeFaces,jb=Ta.morphTargets;if(db)for(fb in db)db[fb].offset=0;F=0;for(D=xb.length;F<D;F++){O=xb[F];E=Ab[O];yb&&(Ia=yb[O]);zb&&(Sa=zb[O]);O=E.vertexNormals;I=E.normal;S=E.vertexColors;sa=E.color;W=E.vertexTangents;if(E instanceof THREE.Face3){if(ib){ea=nb[E.a].position;ca=nb[E.b].position;ja=nb[E.c].position;Za[Xa]=ea.x;Za[Xa+1]=ea.y;Za[Xa+2]=ea.z;Za[Xa+3]=ca.x;Za[Xa+4]=ca.y;Za[Xa+5]=ca.z;Za[Xa+
|
|
|
+6]=ja.x;Za[Xa+7]=ja.y;Za[Xa+8]=ja.z;Xa+=9}if(db)for(fb in db){P=db[fb];if(P.needsUpdate){V=P.offset;if(P.size===1){P.array[V+0]=P.value[E.a];P.array[V+1]=P.value[E.b];P.array[V+2]=P.value[E.c];P.offset+=3}else{ea=P.value[E.a];ca=P.value[E.b];ja=P.value[E.c];if(P.size===2){P.array[V+0]=ea.x;P.array[V+1]=ea.y;P.array[V+2]=ca.x;P.array[V+3]=ca.y;P.array[V+4]=ja.x;P.array[V+5]=ja.y;P.offset+=6}else if(P.size===3){P.array[V+0]=ea.x;P.array[V+1]=ea.y;P.array[V+2]=ea.z;P.array[V+3]=ca.x;P.array[V+4]=ca.y;
|
|
|
+P.array[V+5]=ca.z;P.array[V+6]=ja.x;P.array[V+7]=ja.y;P.array[V+8]=ja.z;P.offset+=9}else{P.array[V+0]=ea.x;P.array[V+1]=ea.y;P.array[V+2]=ea.z;P.array[V+3]=ea.w;P.array[V+4]=ca.x;P.array[V+5]=ca.y;P.array[V+6]=ca.z;P.array[V+7]=ca.w;P.array[V+8]=ja.x;P.array[V+9]=ja.y;P.array[V+10]=ja.z;P.array[V+11]=ja.w;P.offset+=12}}}}if(wb){V=0;for(P=jb.length;V<P;V++){ea=jb[V].vertices[E.a].position;ca=jb[V].vertices[E.b].position;ja=jb[V].vertices[E.c].position;Oa=Qa[V];Oa[Va+0]=ea.x;Oa[Va+1]=ea.y;Oa[Va+2]=
|
|
|
+ea.z;Oa[Va+3]=ca.x;Oa[Va+4]=ca.y;Oa[Va+5]=ca.z;Oa[Va+6]=ja.x;Oa[Va+7]=ja.y;Oa[Va+8]=ja.z}Va+=9}if(kb.length){ea=kb[E.a];ca=kb[E.b];ja=kb[E.c];K[Q]=ea.x;K[Q+1]=ea.y;K[Q+2]=ea.z;K[Q+3]=ea.w;K[Q+4]=ca.x;K[Q+5]=ca.y;K[Q+6]=ca.z;K[Q+7]=ca.w;K[Q+8]=ja.x;K[Q+9]=ja.y;K[Q+10]=ja.z;K[Q+11]=ja.w;ea=qb[E.a];ca=qb[E.b];ja=qb[E.c];ha[Q]=ea.x;ha[Q+1]=ea.y;ha[Q+2]=ea.z;ha[Q+3]=ea.w;ha[Q+4]=ca.x;ha[Q+5]=ca.y;ha[Q+6]=ca.z;ha[Q+7]=ca.w;ha[Q+8]=ja.x;ha[Q+9]=ja.y;ha[Q+10]=ja.z;ha[Q+11]=ja.w;ea=ob[E.a];ca=ob[E.b];ja=ob[E.c];
|
|
|
+va[Q]=ea.x;va[Q+1]=ea.y;va[Q+2]=ea.z;va[Q+3]=1;va[Q+4]=ca.x;va[Q+5]=ca.y;va[Q+6]=ca.z;va[Q+7]=1;va[Q+8]=ja.x;va[Q+9]=ja.y;va[Q+10]=ja.z;va[Q+11]=1;ea=pb[E.a];ca=pb[E.b];ja=pb[E.c];ua[Q]=ea.x;ua[Q+1]=ea.y;ua[Q+2]=ea.z;ua[Q+3]=1;ua[Q+4]=ca.x;ua[Q+5]=ca.y;ua[Q+6]=ca.z;ua[Q+7]=1;ua[Q+8]=ja.x;ua[Q+9]=ja.y;ua[Q+10]=ja.z;ua[Q+11]=1;Q+=12}if(vb&&ra){if(S.length==3&&ra==THREE.VertexColors){E=S[0];ea=S[1];ca=S[2]}else ca=ea=E=sa;aa[Ma]=E.r;aa[Ma+1]=E.g;aa[Ma+2]=E.b;aa[Ma+3]=ea.r;aa[Ma+4]=ea.g;aa[Ma+5]=ea.b;
|
|
|
+aa[Ma+6]=ca.r;aa[Ma+7]=ca.g;aa[Ma+8]=ca.b;Ma+=9}if(ub&&Ta.hasTangents){S=W[0];sa=W[1];E=W[2];fa[Ra]=S.x;fa[Ra+1]=S.y;fa[Ra+2]=S.z;fa[Ra+3]=S.w;fa[Ra+4]=sa.x;fa[Ra+5]=sa.y;fa[Ra+6]=sa.z;fa[Ra+7]=sa.w;fa[Ra+8]=E.x;fa[Ra+9]=E.y;fa[Ra+10]=E.z;fa[Ra+11]=E.w;Ra+=12}if(tb&&za)if(O.length==3&&lb)for(W=0;W<3;W++){I=O[W];ta[eb]=I.x;ta[eb+1]=I.y;ta[eb+2]=I.z;eb+=3}else for(W=0;W<3;W++){ta[eb]=I.x;ta[eb+1]=I.y;ta[eb+2]=I.z;eb+=3}if(rb&&Ia!==undefined&&Ba)for(W=0;W<3;W++){O=Ia[W];$a[gb]=O.u;$a[gb+1]=O.v;gb+=2}if(rb&&
|
|
|
+Sa!==undefined&&Ba)for(W=0;W<3;W++){O=Sa[W];T[hb]=O.u;T[hb+1]=O.v;hb+=2}if(sb){Wa[Ya]=Na;Wa[Ya+1]=Na+1;Wa[Ya+2]=Na+2;Ya+=3;bb[Ja]=Na;bb[Ja+1]=Na+1;bb[Ja+2]=Na;bb[Ja+3]=Na+2;bb[Ja+4]=Na+1;bb[Ja+5]=Na+2;Ja+=6;Na+=3}}else if(E instanceof THREE.Face4){if(ib){ea=nb[E.a].position;ca=nb[E.b].position;ja=nb[E.c].position;La=nb[E.d].position;Za[Xa]=ea.x;Za[Xa+1]=ea.y;Za[Xa+2]=ea.z;Za[Xa+3]=ca.x;Za[Xa+4]=ca.y;Za[Xa+5]=ca.z;Za[Xa+6]=ja.x;Za[Xa+7]=ja.y;Za[Xa+8]=ja.z;Za[Xa+9]=La.x;Za[Xa+10]=La.y;Za[Xa+11]=La.z;
|
|
|
+Xa+=12}if(db)for(fb in db){P=db[fb];if(P.needsUpdate){V=P.offset;if(P.size===1){P.array[V+0]=P.value[E.a];P.array[V+1]=P.value[E.b];P.array[V+2]=P.value[E.c];P.array[V+2]=P.value[E.d];P.offset+=4}else{ea=P.value[E.a];ca=P.value[E.b];ja=P.value[E.c];La=P.value[E.d];if(P.size===2){P.array[V+0]=ea.x;P.array[V+1]=ea.y;P.array[V+2]=ca.x;P.array[V+3]=ca.y;P.array[V+4]=ja.x;P.array[V+5]=ja.y;P.array[V+6]=La.x;P.array[V+7]=La.y;P.offset+=8}else if(P.size===3){P.array[V+0]=ea.x;P.array[V+1]=ea.y;P.array[V+
|
|
|
+2]=ea.z;P.array[V+3]=ca.x;P.array[V+4]=ca.y;P.array[V+5]=ca.z;P.array[V+6]=ja.x;P.array[V+7]=ja.y;P.array[V+8]=ja.z;P.array[V+9]=La.x;P.array[V+10]=La.y;P.array[V+11]=La.z;P.offset+=12}else{P.array[V+0]=ea.x;P.array[V+1]=ea.y;P.array[V+2]=ea.z;P.array[V+3]=ea.w;P.array[V+4]=ca.x;P.array[V+5]=ca.y;P.array[V+6]=ca.z;P.array[V+7]=ca.w;P.array[V+8]=ja.x;P.array[V+9]=ja.y;P.array[V+10]=ja.z;P.array[V+11]=ja.w;P.array[V+12]=La.x;P.array[V+13]=La.y;P.array[V+14]=La.z;P.array[V+15]=La.w;P.offset+=16}}}}if(wb){V=
|
|
|
+0;for(P=jb.length;V<P;V++){ea=jb[V].vertices[E.a].position;ca=jb[V].vertices[E.b].position;ja=jb[V].vertices[E.c].position;La=jb[V].vertices[E.d].position;Oa=Qa[V];Oa[Va+0]=ea.x;Oa[Va+1]=ea.y;Oa[Va+2]=ea.z;Oa[Va+3]=ca.x;Oa[Va+4]=ca.y;Oa[Va+5]=ca.z;Oa[Va+6]=ja.x;Oa[Va+7]=ja.y;Oa[Va+8]=ja.z;Oa[Va+9]=La.x;Oa[Va+10]=La.y;Oa[Va+11]=La.z}Va+=12}if(kb.length){ea=kb[E.a];ca=kb[E.b];ja=kb[E.c];La=kb[E.d];K[Q]=ea.x;K[Q+1]=ea.y;K[Q+2]=ea.z;K[Q+3]=ea.w;K[Q+4]=ca.x;K[Q+5]=ca.y;K[Q+6]=ca.z;K[Q+7]=ca.w;K[Q+8]=ja.x;
|
|
|
+K[Q+9]=ja.y;K[Q+10]=ja.z;K[Q+11]=ja.w;K[Q+12]=La.x;K[Q+13]=La.y;K[Q+14]=La.z;K[Q+15]=La.w;ea=qb[E.a];ca=qb[E.b];ja=qb[E.c];La=qb[E.d];ha[Q]=ea.x;ha[Q+1]=ea.y;ha[Q+2]=ea.z;ha[Q+3]=ea.w;ha[Q+4]=ca.x;ha[Q+5]=ca.y;ha[Q+6]=ca.z;ha[Q+7]=ca.w;ha[Q+8]=ja.x;ha[Q+9]=ja.y;ha[Q+10]=ja.z;ha[Q+11]=ja.w;ha[Q+12]=La.x;ha[Q+13]=La.y;ha[Q+14]=La.z;ha[Q+15]=La.w;ea=ob[E.a];ca=ob[E.b];ja=ob[E.c];La=ob[E.d];va[Q]=ea.x;va[Q+1]=ea.y;va[Q+2]=ea.z;va[Q+3]=1;va[Q+4]=ca.x;va[Q+5]=ca.y;va[Q+6]=ca.z;va[Q+7]=1;va[Q+8]=ja.x;va[Q+
|
|
|
+9]=ja.y;va[Q+10]=ja.z;va[Q+11]=1;va[Q+12]=La.x;va[Q+13]=La.y;va[Q+14]=La.z;va[Q+15]=1;ea=pb[E.a];ca=pb[E.b];ja=pb[E.c];E=pb[E.d];ua[Q]=ea.x;ua[Q+1]=ea.y;ua[Q+2]=ea.z;ua[Q+3]=1;ua[Q+4]=ca.x;ua[Q+5]=ca.y;ua[Q+6]=ca.z;ua[Q+7]=1;ua[Q+8]=ja.x;ua[Q+9]=ja.y;ua[Q+10]=ja.z;ua[Q+11]=1;ua[Q+12]=E.x;ua[Q+13]=E.y;ua[Q+14]=E.z;ua[Q+15]=1;Q+=16}if(vb&&ra){if(S.length==4&&ra==THREE.VertexColors){E=S[0];ea=S[1];ca=S[2];S=S[3]}else S=ca=ea=E=sa;aa[Ma]=E.r;aa[Ma+1]=E.g;aa[Ma+2]=E.b;aa[Ma+3]=ea.r;aa[Ma+4]=ea.g;aa[Ma+
|
|
|
+5]=ea.b;aa[Ma+6]=ca.r;aa[Ma+7]=ca.g;aa[Ma+8]=ca.b;aa[Ma+9]=S.r;aa[Ma+10]=S.g;aa[Ma+11]=S.b;Ma+=12}if(ub&&Ta.hasTangents){S=W[0];sa=W[1];E=W[2];W=W[3];fa[Ra]=S.x;fa[Ra+1]=S.y;fa[Ra+2]=S.z;fa[Ra+3]=S.w;fa[Ra+4]=sa.x;fa[Ra+5]=sa.y;fa[Ra+6]=sa.z;fa[Ra+7]=sa.w;fa[Ra+8]=E.x;fa[Ra+9]=E.y;fa[Ra+10]=E.z;fa[Ra+11]=E.w;fa[Ra+12]=W.x;fa[Ra+13]=W.y;fa[Ra+14]=W.z;fa[Ra+15]=W.w;Ra+=16}if(tb&&za)if(O.length==4&&lb)for(W=0;W<4;W++){I=O[W];ta[eb]=I.x;ta[eb+1]=I.y;ta[eb+2]=I.z;eb+=3}else for(W=0;W<4;W++){ta[eb]=I.x;
|
|
|
+ta[eb+1]=I.y;ta[eb+2]=I.z;eb+=3}if(rb&&Ia!==undefined&&Ba)for(W=0;W<4;W++){O=Ia[W];$a[gb]=O.u;$a[gb+1]=O.v;gb+=2}if(rb&&Sa!==undefined&&Ba)for(W=0;W<4;W++){O=Sa[W];T[hb]=O.u;T[hb+1]=O.v;hb+=2}if(sb){Wa[Ya]=Na;Wa[Ya+1]=Na+1;Wa[Ya+2]=Na+3;Wa[Ya+3]=Na+1;Wa[Ya+4]=Na+2;Wa[Ya+5]=Na+3;Ya+=6;bb[Ja]=Na;bb[Ja+1]=Na+1;bb[Ja+2]=Na;bb[Ja+3]=Na+3;bb[Ja+4]=Na+1;bb[Ja+5]=Na+2;bb[Ja+6]=Na+2;bb[Ja+7]=Na+3;Ja+=8;Na+=4}}}if(mb){F=0;for(D=mb.length;F<D;F++){Wa[Ya]=mb[F].a;Wa[Ya+1]=mb[F].b;Wa[Ya+2]=mb[F].c;Wa[Ya+3]=mb[F].a;
|
|
|
+Wa[Ya+4]=mb[F].c;Wa[Ya+5]=mb[F].d;Ya+=6}}if(ib){e.bindBuffer(e.ARRAY_BUFFER,t.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,Za,R)}if(db)for(fb in db){P=db[fb];if(P.needsUpdate){e.bindBuffer(e.ARRAY_BUFFER,P.buffer);e.bufferData(e.ARRAY_BUFFER,P.array,R);P.needsUpdate=!1}}if(wb){V=0;for(P=jb.length;V<P;V++){e.bindBuffer(e.ARRAY_BUFFER,t.__webglMorphTargetsBuffers[V]);e.bufferData(e.ARRAY_BUFFER,Qa[V],R)}}if(vb&&Ma>0){e.bindBuffer(e.ARRAY_BUFFER,t.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,
|
|
|
+aa,R)}if(tb){e.bindBuffer(e.ARRAY_BUFFER,t.__webglNormalBuffer);e.bufferData(e.ARRAY_BUFFER,ta,R)}if(ub&&Ta.hasTangents){e.bindBuffer(e.ARRAY_BUFFER,t.__webglTangentBuffer);e.bufferData(e.ARRAY_BUFFER,fa,R)}if(rb&&gb>0){e.bindBuffer(e.ARRAY_BUFFER,t.__webglUVBuffer);e.bufferData(e.ARRAY_BUFFER,$a,R)}if(rb&&hb>0){e.bindBuffer(e.ARRAY_BUFFER,t.__webglUV2Buffer);e.bufferData(e.ARRAY_BUFFER,T,R)}if(sb){e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t.__webglFaceBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,Wa,R);
|
|
|
+e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t.__webglLineBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,bb,R)}if(Q>0){e.bindBuffer(e.ARRAY_BUFFER,t.__webglSkinVertexABuffer);e.bufferData(e.ARRAY_BUFFER,va,R);e.bindBuffer(e.ARRAY_BUFFER,t.__webglSkinVertexBBuffer);e.bufferData(e.ARRAY_BUFFER,ua,R);e.bindBuffer(e.ARRAY_BUFFER,t.__webglSkinIndicesBuffer);e.bufferData(e.ARRAY_BUFFER,ha,R);e.bindBuffer(e.ARRAY_BUFFER,t.__webglSkinWeightsBuffer);e.bufferData(e.ARRAY_BUFFER,K,R)}}}x.__dirtyVertices=!1;x.__dirtyMorphTargets=
|
|
|
+!1;x.__dirtyElements=!1;x.__dirtyUvs=!1;x.__dirtyNormals=!1;x.__dirtyTangents=!1;x.__dirtyColors=!1}else if(m instanceof THREE.Ribbon){x=m.geometry;if(x.__dirtyVertices||x.__dirtyColors){m=x;A=e.DYNAMIC_DRAW;ra=m.vertices;t=m.colors;za=ra.length;R=t.length;Ia=m.__vertexArray;F=m.__colorArray;Sa=m.__dirtyColors;if(m.__dirtyVertices){for(D=0;D<za;D++){Ba=ra[D].position;w=D*3;Ia[w]=Ba.x;Ia[w+1]=Ba.y;Ia[w+2]=Ba.z}e.bindBuffer(e.ARRAY_BUFFER,m.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,Ia,A)}if(Sa){for(D=
|
|
|
+0;D<R;D++){color=t[D];w=D*3;F[w]=color.r;F[w+1]=color.g;F[w+2]=color.b}e.bindBuffer(e.ARRAY_BUFFER,m.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,F,A)}}x.__dirtyVertices=!1;x.__dirtyColors=!1}else if(m instanceof THREE.Line){x=m.geometry;if(x.__dirtyVertices||x.__dirtyColors){m=x;A=e.DYNAMIC_DRAW;ra=m.vertices;t=m.colors;za=ra.length;R=t.length;Ia=m.__vertexArray;F=m.__colorArray;Sa=m.__dirtyColors;if(m.__dirtyVertices){for(D=0;D<za;D++){Ba=ra[D].position;w=D*3;Ia[w]=Ba.x;Ia[w+1]=Ba.y;Ia[w+2]=
|
|
|
+Ba.z}e.bindBuffer(e.ARRAY_BUFFER,m.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,Ia,A)}if(Sa){for(D=0;D<R;D++){color=t[D];w=D*3;F[w]=color.r;F[w+1]=color.g;F[w+2]=color.b}e.bindBuffer(e.ARRAY_BUFFER,m.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,F,A)}}x.__dirtyVertices=!1;x.__dirtyColors=!1}else if(m instanceof THREE.ParticleSystem){x=m.geometry;(x.__dirtyVertices||x.__dirtyColors||m.sortParticles)&&d(x,e.DYNAMIC_DRAW,m);x.__dirtyVertices=!1;x.__dirtyColors=!1}}function U(m){function A(sa){var W=
|
|
|
+[];x=0;for(t=sa.length;x<t;x++)sa[x]==undefined?W.push("undefined"):W.push(sa[x].id);return W.join("_")}var x,t,w,R,F,D,O,E,I={},S=m.morphTargets!==undefined?m.morphTargets.length:0;m.geometryGroups={};w=0;for(R=m.faces.length;w<R;w++){F=m.faces[w];D=F.materials;O=A(D);I[O]==undefined&&(I[O]={hash:O,counter:0});E=I[O].hash+"_"+I[O].counter;m.geometryGroups[E]==undefined&&(m.geometryGroups[E]={faces:[],materials:D,vertices:0,numMorphTargets:S});F=F instanceof THREE.Face3?3:4;if(m.geometryGroups[E].vertices+
|
|
|
+F>65535){I[O].counter+=1;E=I[O].hash+"_"+I[O].counter;m.geometryGroups[E]==undefined&&(m.geometryGroups[E]={faces:[],materials:D,vertices:0,numMorphTargets:S})}m.geometryGroups[E].faces.push(w);m.geometryGroups[E].vertices+=F}}function z(m,A,x){m.push({buffer:A,object:x,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function J(m){if(m!=ga){switch(m){case THREE.AdditiveBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.SRC_ALPHA,e.ONE);break;case THREE.SubtractiveBlending:e.blendEquation(e.FUNC_ADD);
|
|
|
+e.blendFunc(e.ZERO,e.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ZERO,e.SRC_COLOR);break;default:e.blendEquationSeparate(e.FUNC_ADD,e.FUNC_ADD);e.blendFuncSeparate(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA)}ga=m}}function L(m,A,x){if((x.width&x.width-1)==0&&(x.height&x.height-1)==0){e.texParameteri(m,e.TEXTURE_WRAP_S,Z(A.wrapS));e.texParameteri(m,e.TEXTURE_WRAP_T,Z(A.wrapT));e.texParameteri(m,e.TEXTURE_MAG_FILTER,Z(A.magFilter));
|
|
|
+e.texParameteri(m,e.TEXTURE_MIN_FILTER,Z(A.minFilter));e.generateMipmap(m)}else{e.texParameteri(m,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE);e.texParameteri(m,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE);e.texParameteri(m,e.TEXTURE_MAG_FILTER,xa(A.magFilter));e.texParameteri(m,e.TEXTURE_MIN_FILTER,xa(A.minFilter))}}function M(m,A){if(m.needsUpdate){if(m.__webglInit){e.bindTexture(e.TEXTURE_2D,m.__webglTexture);e.texSubImage2D(e.TEXTURE_2D,0,0,0,e.RGBA,e.UNSIGNED_BYTE,m.image)}else{m.__webglTexture=e.createTexture();
|
|
|
+e.bindTexture(e.TEXTURE_2D,m.__webglTexture);e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,m.image);m.__webglInit=!0}L(e.TEXTURE_2D,m,m.image);e.bindTexture(e.TEXTURE_2D,null);m.needsUpdate=!1}e.activeTexture(e.TEXTURE0+A);e.bindTexture(e.TEXTURE_2D,m.__webglTexture)}function Fa(m){if(m&&!m.__webglFramebuffer){m.__webglFramebuffer=e.createFramebuffer();m.__webglRenderbuffer=e.createRenderbuffer();m.__webglTexture=e.createTexture();e.bindRenderbuffer(e.RENDERBUFFER,m.__webglRenderbuffer);
|
|
|
+e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_STENCIL,m.width,m.height);e.bindTexture(e.TEXTURE_2D,m.__webglTexture);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,Z(m.wrapS));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,Z(m.wrapT));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,Z(m.magFilter));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,Z(m.minFilter));e.texImage2D(e.TEXTURE_2D,0,Z(m.format),m.width,m.height,0,Z(m.format),Z(m.type),null);e.bindFramebuffer(e.FRAMEBUFFER,m.__webglFramebuffer);
|
|
|
+e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,m.__webglTexture,0);e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,m.__webglRenderbuffer);e.bindTexture(e.TEXTURE_2D,null);e.bindRenderbuffer(e.RENDERBUFFER,null);e.bindFramebuffer(e.FRAMEBUFFER,null)}var A,x;if(m){A=m.__webglFramebuffer;x=m.width;m=m.height}else{A=null;x=ka;m=na}if(A!=Ha){e.bindFramebuffer(e.FRAMEBUFFER,A);e.viewport(la,Ga,x,m);Ha=A}}function oa(m,A){var x;if(m=="fragment")x=
|
|
|
+e.createShader(e.FRAGMENT_SHADER);else m=="vertex"&&(x=e.createShader(e.VERTEX_SHADER));e.shaderSource(x,A);e.compileShader(x);if(!e.getShaderParameter(x,e.COMPILE_STATUS)){console.error(e.getShaderInfoLog(x));console.error(A);return null}return x}function xa(m){switch(m){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return e.NEAREST;default:return e.LINEAR}}function Z(m){switch(m){case THREE.RepeatWrapping:return e.REPEAT;case THREE.ClampToEdgeWrapping:return e.CLAMP_TO_EDGE;
|
|
|
+case THREE.MirroredRepeatWrapping:return e.MIRRORED_REPEAT;case THREE.NearestFilter:return e.NEAREST;case THREE.NearestMipMapNearestFilter:return e.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return e.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return e.LINEAR;case THREE.LinearMipMapNearestFilter:return e.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return e.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return e.BYTE;case THREE.UnsignedByteType:return e.UNSIGNED_BYTE;case THREE.ShortType:return e.SHORT;
|
|
|
+case THREE.UnsignedShortType:return e.UNSIGNED_SHORT;case THREE.IntType:return e.INT;case THREE.UnsignedShortType:return e.UNSIGNED_INT;case THREE.FloatType:return e.FLOAT;case THREE.AlphaFormat:return e.ALPHA;case THREE.RGBFormat:return e.RGB;case THREE.RGBAFormat:return e.RGBA;case THREE.LuminanceFormat:return e.LUMINANCE;case THREE.LuminanceAlphaFormat:return e.LUMINANCE_ALPHA}return 0}var e,da=document.createElement("canvas"),Ca=[],Aa=null,Ha=null,qa=!0,$=this,pa=null,Da=null,ga=null,Y=null,la=
|
|
|
+0,Ga=0,ka=0,na=0,wa=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Ua=new THREE.Matrix4,cb=new Float32Array(16),ab=new Float32Array(16),Pa=new THREE.Vector4,N={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},X=!0,ma=!0,Ea=new THREE.Color(0),Ka=0;if(b){if(b.stencil!=undefined)X=b.stencil;if(b.antialias!==undefined)ma=b.antialias;b.clearColor!==undefined&&Ea.setHex(b.clearColor);
|
|
|
+if(b.clearAlpha!==undefined)Ka=b.clearAlpha}this.maxMorphTargets=8;this.domElement=da;this.autoClear=!0;this.sortObjects=!0;(function(m,A,x,t){try{if(!(e=da.getContext("experimental-webgl",{antialias:m,stencil:t})))throw"Error creating WebGL context.";}catch(w){console.error(w)}e.clearColor(0,0,0,1);e.clearDepth(1);e.enable(e.DEPTH_TEST);e.depthFunc(e.LEQUAL);e.frontFace(e.CCW);e.cullFace(e.BACK);e.enable(e.CULL_FACE);e.enable(e.BLEND);e.blendEquation(e.FUNC_ADD);e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA);
|
|
|
+e.clearColor(A.r,A.g,A.b,x)})(ma,Ea,Ka,X);this.context=e;if(X){var ya={};ya.vertices=new Float32Array(12);ya.faces=new Uint16Array(6);ya.darkness=0.5;ya.vertices[0]=-20;ya.vertices[1]=-20;ya.vertices[2]=-1;ya.vertices[3]=20;ya.vertices[4]=-20;ya.vertices[5]=-1;ya.vertices[6]=20;ya.vertices[7]=20;ya.vertices[8]=-1;ya.vertices[9]=-20;ya.vertices[10]=20;ya.vertices[11]=-1;ya.faces[0]=0;ya.faces[1]=1;ya.faces[2]=2;ya.faces[3]=0;ya.faces[4]=2;ya.faces[5]=3;ya.vertexBuffer=e.createBuffer();ya.elementBuffer=
|
|
|
+e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,ya.vertexBuffer);e.bufferData(e.ARRAY_BUFFER,ya.vertices,e.STATIC_DRAW);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,ya.elementBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,ya.faces,e.STATIC_DRAW);ya.program=e.createProgram();e.attachShader(ya.program,oa("fragment",THREE.ShaderLib.shadowPost.fragmentShader));e.attachShader(ya.program,oa("vertex",THREE.ShaderLib.shadowPost.vertexShader));e.linkProgram(ya.program);ya.vertexLocation=e.getAttribLocation(ya.program,"position");
|
|
|
+ya.projectionLocation=e.getUniformLocation(ya.program,"projectionMatrix");ya.darknessLocation=e.getUniformLocation(ya.program,"darkness")}var ia={};ia.vertices=new Float32Array(16);ia.faces=new Uint16Array(6);ia.transparency=0.5;b=0;ia.vertices[b++]=-1;ia.vertices[b++]=-1;ia.vertices[b++]=0;ia.vertices[b++]=0;ia.vertices[b++]=1;ia.vertices[b++]=-1;ia.vertices[b++]=1;ia.vertices[b++]=0;ia.vertices[b++]=1;ia.vertices[b++]=1;ia.vertices[b++]=1;ia.vertices[b++]=1;ia.vertices[b++]=-1;ia.vertices[b++]=
|
|
|
+1;ia.vertices[b++]=0;ia.vertices[b++]=1;b=0;ia.faces[b++]=0;ia.faces[b++]=1;ia.faces[b++]=2;ia.faces[b++]=0;ia.faces[b++]=2;ia.faces[b++]=3;ia.vertexBuffer=e.createBuffer();ia.elementBuffer=e.createBuffer();ia.tempTexture=e.createTexture();ia.readBackPixels=new Uint8Array(1024);e.bindBuffer(e.ARRAY_BUFFER,ia.vertexBuffer);e.bufferData(e.ARRAY_BUFFER,ia.vertices,e.STATIC_DRAW);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,ia.elementBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,ia.faces,e.STATIC_DRAW);e.bindTexture(e.TEXTURE_2D,
|
|
|
+ia.tempTexture);e.texImage2D(e.TEXTURE_2D,0,e.RGB,16,16,0,e.RGB,e.UNSIGNED_BYTE,null);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST);ia.program=e.createProgram();e.attachShader(ia.program,oa("fragment",THREE.ShaderLib.lensFlare.fragmentShader));e.attachShader(ia.program,oa("vertex",THREE.ShaderLib.lensFlare.vertexShader));
|
|
|
+e.linkProgram(ia.program);ia.attributes={};ia.uniforms={};ia.attributes.vertex=e.getAttribLocation(ia.program,"position");ia.attributes.uv=e.getAttribLocation(ia.program,"UV");ia.uniforms.map=e.getUniformLocation(ia.program,"map");ia.uniforms.opacity=e.getUniformLocation(ia.program,"opacity");ia.uniforms.scale=e.getUniformLocation(ia.program,"scale");ia.uniforms.rotation=e.getUniformLocation(ia.program,"rotation");ia.uniforms.screenPosition=e.getUniformLocation(ia.program,"screenPosition");ia.uniforms.renderPink=
|
|
|
+e.getUniformLocation(ia.program,"renderPink");this.setSize=function(m,A){da.width=m;da.height=A;this.setViewport(0,0,da.width,da.height)};this.setViewport=function(m,A,x,t){la=m;Ga=A;ka=x;na=t;e.viewport(la,Ga,ka,na)};this.setScissor=function(m,A,x,t){e.scissor(m,A,x,t)};this.enableScissorTest=function(m){m?e.enable(e.SCISSOR_TEST):e.disable(e.SCISSOR_TEST)};this.enableDepthBufferWrite=function(m){qa=m;e.depthMask(m)};this.setClearColorHex=function(m,A){var x=new THREE.Color(m);e.clearColor(x.r,x.g,
|
|
|
+x.b,A)};this.setClearColor=function(m,A){e.clearColor(m.r,m.g,m.b,A)};this.clear=function(){e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT|e.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness=function(m){ya.darkness=m};this.initMaterial=function(m,A,x,t){var w,R,F,D;if(m instanceof THREE.MeshDepthMaterial)c(m,THREE.ShaderLib.depth);else if(m instanceof THREE.ShadowVolumeDynamicMaterial)c(m,THREE.ShaderLib.shadowVolumeDynamic);else if(m instanceof THREE.MeshNormalMaterial)c(m,THREE.ShaderLib.normal);
|
|
|
+else if(m instanceof THREE.MeshBasicMaterial)c(m,THREE.ShaderLib.basic);else if(m instanceof THREE.MeshLambertMaterial)c(m,THREE.ShaderLib.lambert);else if(m instanceof THREE.MeshPhongMaterial)c(m,THREE.ShaderLib.phong);else if(m instanceof THREE.LineBasicMaterial)c(m,THREE.ShaderLib.basic);else m instanceof THREE.ParticleBasicMaterial&&c(m,THREE.ShaderLib.particle_basic);if(!m.program){var O,E,I,S;O=S=D=0;for(E=A.length;O<E;O++){I=A[O];I instanceof THREE.DirectionalLight&&S++;I instanceof THREE.PointLight&&
|
|
|
+D++}if(D+S<=4)A=S;else{A=Math.ceil(4*S/(D+S));D=4-A}D={directional:A,point:D};A=50;if(t!==undefined&&t instanceof THREE.SkinnedMesh)A=t.bones.length;x={map:m.map,envMap:m.envMap,lightMap:m.lightMap,vertexColors:m.vertexColors,fog:x,sizeAttenuation:m.sizeAttenuation,skinning:m.skinning,morphTargets:m.morphTargets,maxDirLights:D.directional,maxPointLights:D.point,maxBones:A};a:{D=m.fragmentShader;A=m.vertexShader;O=D+"\n\n"+A+"\n\n";for(F in x)O+=F+": "+x[F]+",\n";F=0;for(E=Ca.length;F<E;F++)if(Ca[F].code==
|
|
|
+O){F=Ca[F].program;break a}F=e.createProgram();prefix_fragment=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+x.maxDirLights,"#define MAX_POINT_LIGHTS "+x.maxPointLights,x.fog?"#define USE_FOG":"",x.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",x.map?"#define USE_MAP":"",x.envMap?"#define USE_ENVMAP":"",x.lightMap?"#define USE_LIGHTMAP":"",x.vertexColors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");prefix_vertex=[e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>
|
|
|
+0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+x.maxDirLights,"#define MAX_POINT_LIGHTS "+x.maxPointLights,"#define MAX_BONES "+x.maxBones,x.map?"#define USE_MAP":"",x.envMap?"#define USE_ENVMAP":"",x.lightMap?"#define USE_LIGHTMAP":"",x.vertexColors?"#define USE_COLOR":"",x.skinning?"#define USE_SKINNING":"",x.morphTargets?"#define USE_MORPHTARGETS":"",x.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\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;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
|
|
|
e.attachShader(F,oa("fragment",prefix_fragment+D));e.attachShader(F,oa("vertex",prefix_vertex+A));e.linkProgram(F);e.getProgramParameter(F,e.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+e.getProgramParameter(F,e.VALIDATE_STATUS)+", gl error ["+e.getError()+"]");F.uniforms={};F.attributes={};Ca.push({program:F,code:O})}m.program=F;F=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices",
|
|
|
"morphTargetInfluences"];for(w in m.uniforms)F.push(w);w=m.program;x=0;for(D=F.length;x<D;x++){A=F[x];w.uniforms[A]=e.getUniformLocation(w,A)}F=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(w=0;w<this.maxMorphTargets;w++)F.push("morphTarget"+w);for(R in m.attributes)F.push(R);w=m.program;x=0;for(D=F.length;x<D;x++){A=F[x];w.attributes[A]=e.getAttribLocation(w,A)}w=m.program.attributes;e.enableVertexAttribArray(w.position);w.color>=0&&e.enableVertexAttribArray(w.color);
|
|
|
w.normal>=0&&e.enableVertexAttribArray(w.normal);w.tangent>=0&&e.enableVertexAttribArray(w.tangent);if(m.skinning&&w.skinVertexA>=0&&w.skinVertexB>=0&&w.skinIndex>=0&&w.skinWeight>=0){e.enableVertexAttribArray(w.skinVertexA);e.enableVertexAttribArray(w.skinVertexB);e.enableVertexAttribArray(w.skinIndex);e.enableVertexAttribArray(w.skinWeight)}for(R in m.attributes)w[R]>=0&&e.enableVertexAttribArray(w[R]);if(m.morphTargets){m.numSupportedMorphTargets=0;if(w.morphTarget0>=0){e.enableVertexAttribArray(w.morphTarget0);
|
|
@@ -353,17 +353,17 @@ value:0,texture:null},uImageIncrement:{type:"v2",value:new THREE.Vector2(0.00195
|
|
|
film:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},time:{type:"f",value:0},nIntensity:{type:"f",value:0.5},sIntensity:{type:"f",value:0.05},sCount:{type:"f",value:4096},grayscale:{type:"i",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float time;\nuniform bool grayscale;\nuniform float nIntensity;\nuniform float sIntensity;\nuniform float sCount;\nvoid main() {\nvec4 cTextureScreen = texture2D( tDiffuse, vUv );\nfloat x = vUv.x * vUv.y * time * 1000.0;\nx = mod( x, 13.0 ) * mod( x, 123.0 );\nfloat dx = mod( x, 0.01 );\nvec3 cResult = cTextureScreen.rgb + cTextureScreen.rgb * clamp( 0.1 + dx * 100.0, 0.0, 1.0 );\nvec2 sc = vec2( sin( vUv.y * sCount ), cos( vUv.y * sCount ) );\ncResult += cTextureScreen.rgb * vec3( sc.x, sc.y, sc.x ) * sIntensity;\ncResult = cTextureScreen.rgb + clamp( nIntensity, 0.0,1.0 ) * ( cResult - cTextureScreen.rgb );\nif( grayscale ) {\ncResult = vec3( cResult.r * 0.3 + cResult.g * 0.59 + cResult.b * 0.11 );\n}\ngl_FragColor = vec4( cResult, cTextureScreen.a );\n}"},
|
|
|
screen:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},opacity:{type:"f",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float opacity;\nvoid main() {\nvec4 texel = texture2D( tDiffuse, vUv );\ngl_FragColor = opacity * texel;\n}"},basic:{uniforms:{},vertexShader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",
|
|
|
fragmentShader:"void main() {\ngl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );\n}"}},buildKernel:function(b){var d,c,f,g,h=2*Math.ceil(b*3)+1;h>25&&(h=25);g=(h-1)*0.5;c=Array(h);for(d=f=0;d<h;++d){c[d]=Math.exp(-((d-g)*(d-g))/(2*b*b));f+=c[d]}for(d=0;d<h;++d)c[d]/=f;return c}};
|
|
|
-THREE.QuakeCamera=function(b){function d(c,f){return function(){f.apply(c,arguments)}}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.movementSpeed=1;this.lookSpeed=0.005;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.domElement=document;if(b){if(b.movementSpeed!==undefined)this.movementSpeed=b.movementSpeed;if(b.lookSpeed!==undefined)this.lookSpeed=b.lookSpeed;if(b.noFly!==undefined)this.noFly=
|
|
|
+THREE.QuakeCamera=function(b){function d(c,f){return function(){f.apply(c,arguments)}}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.movementSpeed=1;this.lookSpeed=0.0050;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.domElement=document;if(b){if(b.movementSpeed!==undefined)this.movementSpeed=b.movementSpeed;if(b.lookSpeed!==undefined)this.lookSpeed=b.lookSpeed;if(b.noFly!==undefined)this.noFly=
|
|
|
b.noFly;if(b.lookVertical!==undefined)this.lookVertical=b.lookVertical;if(b.autoForward!==undefined)this.autoForward=b.autoForward;if(b.activeLook!==undefined)this.activeLook=b.activeLook;if(b.heightSpeed!==undefined)this.heightSpeed=b.heightSpeed;if(b.heightCoef!==undefined)this.heightCoef=b.heightCoef;if(b.heightMin!==undefined)this.heightMin=b.heightMin;if(b.heightMax!==undefined)this.heightMax=b.heightMax;if(b.domElement!==undefined)this.domElement=b.domElement}this.theta=this.phi=this.lon=this.lat=
|
|
|
-this.mouseY=this.mouseX=this.autoSpeedFactor=0;this.moveForward=!1;this.moveBackward=!1;this.moveLeft=!1;this.moveRight=!1;this.mouseDragOn=!1;this.windowHalfX=window.innerWidth/2;this.windowHalfY=window.innerHeight/2;this.onMouseDown=function(c){c.preventDefault();c.stopPropagation();if(this.activeLook)switch(c.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}this.mouseDragOn=!0};this.onMouseUp=function(c){c.preventDefault();c.stopPropagation();if(this.activeLook)switch(c.button){case 0:this.moveForward=
|
|
|
-!1;break;case 2:this.moveBackward=!1}this.mouseDragOn=!1};this.onMouseMove=function(c){this.mouseX=c.clientX-this.windowHalfX;this.mouseY=c.clientY-this.windowHalfY};this.onKeyDown=function(c){switch(c.keyCode){case 38:case 87:this.moveForward=!0;break;case 37:case 65:this.moveLeft=!0;break;case 40:case 83:this.moveBackward=!0;break;case 39:case 68:this.moveRight=!0}};this.onKeyUp=function(c){switch(c.keyCode){case 38:case 87:this.moveForward=!1;break;case 37:case 65:this.moveLeft=!1;break;case 40:case 83:this.moveBackward=
|
|
|
-!1;break;case 39:case 68:this.moveRight=!1}};this.update=function(){this.autoSpeedFactor=this.heightSpeed?((this.position.y<this.heightMin?this.heightMin:this.position.y>this.heightMax?this.heightMax:this.position.y)-this.heightMin)*this.heightCoef:0;(this.moveForward||this.autoForward)&&this.translateZ(-(this.movementSpeed+this.autoSpeedFactor));this.moveBackward&&this.translateZ(this.movementSpeed);this.moveLeft&&this.translateX(-this.movementSpeed);this.moveRight&&this.translateX(this.movementSpeed);
|
|
|
-var c=this.lookSpeed;this.activeLook||(c=0);this.lon+=this.mouseX*c;this.lookVertical&&(this.lat-=this.mouseY*c);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;c=this.target.position;var f=this.position;c.x=f.x+100*Math.sin(this.phi)*Math.cos(this.theta);c.y=f.y+100*Math.cos(this.phi);c.z=f.z+100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this)};this.domElement.addEventListener("contextmenu",function(c){c.preventDefault()},
|
|
|
-!1);this.domElement.addEventListener("mousemove",d(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",d(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",d(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",d(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",d(this,this.onKeyUp),!1)};THREE.QuakeCamera.prototype=new THREE.Camera;THREE.QuakeCamera.prototype.constructor=THREE.QuakeCamera;THREE.QuakeCamera.prototype.supr=THREE.Camera.prototype;
|
|
|
-THREE.QuakeCamera.prototype.translate=function(b,d){this.matrix.rotateAxis(d);if(this.noFly)d.y=0;this.position.addSelf(d.multiplyScalar(b));this.target.position.addSelf(d.multiplyScalar(b))};
|
|
|
+this.mouseY=this.mouseX=this.autoSpeedFactor=0;this.moveForward=!1;this.moveBackward=!1;this.moveLeft=!1;this.moveRight=!1;this.freeze=!1;this.mouseDragOn=!1;this.windowHalfX=window.innerWidth/2;this.windowHalfY=window.innerHeight/2;this.onMouseDown=function(c){c.preventDefault();c.stopPropagation();if(this.activeLook)switch(c.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}this.mouseDragOn=!0};this.onMouseUp=function(c){c.preventDefault();c.stopPropagation();if(this.activeLook)switch(c.button){case 0:this.moveForward=
|
|
|
+!1;break;case 2:this.moveBackward=!1}this.mouseDragOn=!1};this.onMouseMove=function(c){this.mouseX=c.clientX-this.windowHalfX;this.mouseY=c.clientY-this.windowHalfY};this.onKeyDown=function(c){switch(c.keyCode){case 38:case 87:this.moveForward=!0;break;case 37:case 65:this.moveLeft=!0;break;case 40:case 83:this.moveBackward=!0;break;case 39:case 68:this.moveRight=!0;break;case 81:this.freeze=!this.freeze}};this.onKeyUp=function(c){switch(c.keyCode){case 38:case 87:this.moveForward=!1;break;case 37:case 65:this.moveLeft=
|
|
|
+!1;break;case 40:case 83:this.moveBackward=!1;break;case 39:case 68:this.moveRight=!1}};this.update=function(){if(!this.freeze){this.autoSpeedFactor=this.heightSpeed?((this.position.y<this.heightMin?this.heightMin:this.position.y>this.heightMax?this.heightMax:this.position.y)-this.heightMin)*this.heightCoef:0;(this.moveForward||this.autoForward)&&this.translateZ(-(this.movementSpeed+this.autoSpeedFactor));this.moveBackward&&this.translateZ(this.movementSpeed);this.moveLeft&&this.translateX(-this.movementSpeed);
|
|
|
+this.moveRight&&this.translateX(this.movementSpeed);var c=this.lookSpeed;this.activeLook||(c=0);this.lon+=this.mouseX*c;this.lookVertical&&(this.lat-=this.mouseY*c);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;c=this.target.position;var f=this.position;c.x=f.x+100*Math.sin(this.phi)*Math.cos(this.theta);c.y=f.y+100*Math.cos(this.phi);c.z=f.z+100*Math.sin(this.phi)*Math.sin(this.theta)}this.supr.update.call(this)};this.domElement.addEventListener("contextmenu",
|
|
|
+function(c){c.preventDefault()},!1);this.domElement.addEventListener("mousemove",d(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",d(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",d(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",d(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",d(this,this.onKeyUp),!1)};THREE.QuakeCamera.prototype=new THREE.Camera;THREE.QuakeCamera.prototype.constructor=THREE.QuakeCamera;
|
|
|
+THREE.QuakeCamera.prototype.supr=THREE.Camera.prototype;THREE.QuakeCamera.prototype.translate=function(b,d){this.matrix.rotateAxis(d);if(this.noFly)d.y=0;this.position.addSelf(d.multiplyScalar(b));this.target.position.addSelf(d.multiplyScalar(b))};
|
|
|
THREE.PathCamera=function(b){function d(p,o,u,y){var v={name:u,fps:0.6,length:y,hierarchy:[]},B,C=o.getControlPointsArray(),G=o.getLength(),H=C.length,U=0;B=H-1;o={parent:-1,keys:[]};o.keys[0]={time:0,pos:C[0],rot:[0,0,0,1],scl:[1,1,1]};o.keys[B]={time:y,pos:C[B],rot:[0,0,0,1],scl:[1,1,1]};for(B=1;B<H-1;B++){U=y*G.chunks[B]/G.total;o.keys[B]={time:U,pos:C[B]}}v.hierarchy[0]=o;THREE.AnimationHandler.add(v);return new THREE.Animation(p,u,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function c(p,o){var u,
|
|
|
y,v=new THREE.Geometry;for(u=0;u<p.points.length*o;u++){y=u/(p.points.length*o);y=p.getPoint(y);v.vertices[u]=new THREE.Vertex(new THREE.Vector3(y.x,y.y,y.z))}return v}function f(p,o){var u=c(o,10),y=c(o,10),v=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(u,v);particleObj=new THREE.ParticleSystem(y,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);p.addChild(lineObj);particleObj.scale.set(1,1,1);p.addChild(particleObj);y=new Sphere(1,
|
|
|
-16,8);v=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<o.points.length;i++){u=new THREE.Mesh(y,v);u.position.copy(o.points[i]);u.updateMatrix();p.addChild(u)}}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.id="PathCamera"+THREE.PathCameraIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.005;this.lookVertical=
|
|
|
+16,8);v=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<o.points.length;i++){u=new THREE.Mesh(y,v);u.position.copy(o.points[i]);u.updateMatrix();p.addChild(u)}}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.id="PathCamera"+THREE.PathCameraIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.0050;this.lookVertical=
|
|
|
!0;this.lookHorizontal=!0;this.verticalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.horizontalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.domElement=document;if(b){if(b.duration!==undefined)this.duration=b.duration*1E3;if(b.waypoints!==undefined)this.waypoints=b.waypoints;if(b.useConstantSpeed!==undefined)this.useConstantSpeed=b.useConstantSpeed;if(b.resamplingCoef!==undefined)this.resamplingCoef=b.resamplingCoef;if(b.createDebugPath!==undefined)this.createDebugPath=b.createDebugPath;
|
|
|
if(b.createDebugDummy!==undefined)this.createDebugDummy=b.createDebugDummy;if(b.lookSpeed!==undefined)this.lookSpeed=b.lookSpeed;if(b.lookVertical!==undefined)this.lookVertical=b.lookVertical;if(b.lookHorizontal!==undefined)this.lookHorizontal=b.lookHorizontal;if(b.verticalAngleMap!==undefined)this.verticalAngleMap=b.verticalAngleMap;if(b.horizontalAngleMap!==undefined)this.horizontalAngleMap=b.horizontalAngleMap;if(b.domElement!==undefined)this.domElement=b.domElement}this.theta=this.phi=this.lon=
|
|
|
this.lat=this.mouseY=this.mouseX=0;this.windowHalfX=window.innerWidth/2;this.windowHalfY=window.innerHeight/2;var g=Math.PI*2,h=Math.PI/180;this.update=function(p,o,u){var y,v;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*h;this.theta=this.lon*h;y=this.phi%g;this.phi=y>=0?y:y+g;y=this.verticalAngleMap.srcRange;v=this.verticalAngleMap.dstRange;
|
|
@@ -379,7 +379,7 @@ for(f=b+b/2;f<2*b;f++)k.faces.push(new THREE.Face4(2*b+1,(2*f-2*b+2)%b+b,(2*f-2*
|
|
|
var Icosahedron=function(b){function d(u,y,v){var B=Math.sqrt(u*u+y*y+v*v);return g.vertices.push(new THREE.Vertex(new THREE.Vector3(u/B,y/B,v/B)))-1}function c(u,y,v,B){B.faces.push(new THREE.Face3(u,y,v))}function f(u,y){var v=g.vertices[u].position,B=g.vertices[y].position;return d((v.x+B.x)/2,(v.y+B.y)/2,(v.z+B.z)/2)}var g=this,h=new THREE.Geometry,j;this.subdivisions=b||0;THREE.Geometry.call(this);b=(1+Math.sqrt(5))/2;d(-1,b,0);d(1,b,0);d(-1,-b,0);d(1,-b,0);d(0,-1,b);d(0,1,b);d(0,-1,-b);d(0,
|
|
|
1,-b);d(b,0,-1);d(b,0,1);d(-b,0,-1);d(-b,0,1);c(0,11,5,h);c(0,5,1,h);c(0,1,7,h);c(0,7,10,h);c(0,10,11,h);c(1,5,9,h);c(5,11,4,h);c(11,10,2,h);c(10,7,6,h);c(7,1,8,h);c(3,9,4,h);c(3,4,2,h);c(3,2,6,h);c(3,6,8,h);c(3,8,9,h);c(4,9,5,h);c(2,4,11,h);c(6,2,10,h);c(8,6,7,h);c(9,8,1,h);for(b=0;b<this.subdivisions;b++){j=new THREE.Geometry;for(var k in h.faces){var n=f(h.faces[k].a,h.faces[k].b),p=f(h.faces[k].b,h.faces[k].c),o=f(h.faces[k].c,h.faces[k].a);c(h.faces[k].a,n,o,j);c(h.faces[k].b,p,n,j);c(h.faces[k].c,
|
|
|
o,p,j);c(n,p,o,j)}h.faces=j.faces}g.faces=h.faces;delete h;delete j;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Icosahedron.prototype=new THREE.Geometry;Icosahedron.prototype.constructor=Icosahedron;
|
|
|
-function Lathe(b,d,c){THREE.Geometry.call(this);this.steps=d||12;this.angle=c||2*Math.PI;d=this.angle/this.steps;for(var f=[],g=[],h=[],j=[],k=0;k<b.length;k++){this.vertices.push(new THREE.Vertex(b[k]));f[k]=b[k].clone();g[k]=this.vertices.length-1}for(var n=(new THREE.Matrix4).setRotationZ(d),p=0;p<=this.angle+0.001;p+=d){for(k=0;k<f.length;k++)if(p<this.angle){f[k]=n.multiplyVector3(f[k].clone());this.vertices.push(new THREE.Vertex(f[k]));h[k]=this.vertices.length-1}else h=j;p==0&&(j=g);for(k=
|
|
|
+function Lathe(b,d,c){THREE.Geometry.call(this);this.steps=d||12;this.angle=c||2*Math.PI;d=this.angle/this.steps;for(var f=[],g=[],h=[],j=[],k=0;k<b.length;k++){this.vertices.push(new THREE.Vertex(b[k]));f[k]=b[k].clone();g[k]=this.vertices.length-1}for(var n=(new THREE.Matrix4).setRotationZ(d),p=0;p<=this.angle+0.0010;p+=d){for(k=0;k<f.length;k++)if(p<this.angle){f[k]=n.multiplyVector3(f[k].clone());this.vertices.push(new THREE.Vertex(f[k]));h[k]=this.vertices.length-1}else h=j;p==0&&(j=g);for(k=
|
|
|
0;k<g.length-1;k++){this.faces.push(new THREE.Face4(h[k],h[k+1],g[k+1],g[k]));this.faceVertexUvs[0].push([new THREE.UV(p/c,k/b.length),new THREE.UV(p/c,(k+1)/b.length),new THREE.UV((p-d)/c,(k+1)/b.length),new THREE.UV((p-d)/c,k/b.length)])}g=h;h=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()}Lathe.prototype=new THREE.Geometry;Lathe.prototype.constructor=Lathe;
|
|
|
var Plane=function(b,d,c,f){THREE.Geometry.call(this);var g,h=b/2,j=d/2;c=c||1;f=f||1;var k=c+1,n=f+1;b/=c;var p=d/f;for(g=0;g<n;g++)for(d=0;d<k;d++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(d*b-h,-(g*p-j),0)));for(g=0;g<f;g++)for(d=0;d<c;d++){this.faces.push(new THREE.Face4(d+k*g,d+k*(g+1),d+1+k*(g+1),d+1+k*g));this.faceVertexUvs[0].push([new THREE.UV(d/c,g/f),new THREE.UV(d/c,(g+1)/f),new THREE.UV((d+1)/c,(g+1)/f),new THREE.UV((d+1)/c,g/f)])}this.computeCentroids();this.computeFaceNormals()};
|
|
|
Plane.prototype=new THREE.Geometry;Plane.prototype.constructor=Plane;
|