浏览代码

Moved `object.dynamic` to `geometry.dynamic`.

Mr.doob 14 年之前
父节点
当前提交
d65aec1874

+ 59 - 59
build/Three.js

@@ -57,7 +57,7 @@ n=this.w,p=n*e+h*g-m*f,o=n*f+m*e-j*g,t=n*g+j*f-h*e,e=-j*e-h*f-m*g;c.x=p*n+e*-j+o
 THREE.Quaternion.slerp=function(b,c,e,f){var g=b.w*c.w+b.x*c.x+b.y*c.y+b.z*c.z;if(Math.abs(g)>=1)return e.w=b.w,e.x=b.x,e.y=b.y,e.z=b.z,e;var j=Math.acos(g),h=Math.sqrt(1-g*g);if(Math.abs(h)<0.001)return e.w=0.5*(b.w+c.w),e.x=0.5*(b.x+c.x),e.y=0.5*(b.y+c.y),e.z=0.5*(b.z+c.z),e;g=Math.sin((1-f)*j)/h;f=Math.sin(f*j)/h;e.w=b.w*g+c.w*f;e.x=b.x*g+c.x*f;e.y=b.y*g+c.y*f;e.z=b.z*g+c.z*f;return e};THREE.Vertex=function(b){this.position=b||new THREE.Vector3};
 THREE.Face3=function(b,c,e,f,g,j){this.a=b;this.b=c;this.c=e;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=j instanceof Array?j:[j];this.centroid=new THREE.Vector3};
 THREE.Face4=function(b,c,e,f,g,j,h){this.a=b;this.b=c;this.c=e;this.d=f;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.color=j instanceof THREE.Color?j:new THREE.Color;this.vertexColors=j instanceof Array?j:[];this.vertexTangents=[];this.materials=h instanceof Array?h:[h];this.centroid=new THREE.Vector3};THREE.UV=function(b,c){this.set(b||0,c||0)};
-THREE.UV.prototype={constructor:THREE.UV,set:function(b,c){this.u=b;this.v=c;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.edges=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
+THREE.UV.prototype={constructor:THREE.UV,set:function(b,c){this.u=b;this.v=c;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.edges=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.dynamic=this.hasTangents=!1};
 THREE.Geometry.prototype={constructor:THREE.Geometry,computeCentroids:function(){var b,c,e;b=0;for(c=this.faces.length;b<c;b++)e=this.faces[b],e.centroid.set(0,0,0),e instanceof THREE.Face3?(e.centroid.addSelf(this.vertices[e.a].position),e.centroid.addSelf(this.vertices[e.b].position),e.centroid.addSelf(this.vertices[e.c].position),e.centroid.divideScalar(3)):e instanceof THREE.Face4&&(e.centroid.addSelf(this.vertices[e.a].position),e.centroid.addSelf(this.vertices[e.b].position),e.centroid.addSelf(this.vertices[e.c].position),
 e.centroid.addSelf(this.vertices[e.d].position),e.centroid.divideScalar(4))},computeFaceNormals:function(b){var c,e,f,g,j,h,m=new THREE.Vector3,n=new THREE.Vector3;f=0;for(g=this.faces.length;f<g;f++){j=this.faces[f];if(b&&j.vertexNormals.length){m.set(0,0,0);c=0;for(e=j.vertexNormals.length;c<e;c++)m.addSelf(j.vertexNormals[c]);m.divideScalar(3)}else c=this.vertices[j.a],e=this.vertices[j.b],h=this.vertices[j.c],m.sub(h.position,e.position),n.sub(c.position,e.position),m.crossSelf(n);m.isZero()||
 m.normalize();j.normal.copy(m)}},computeVertexNormals:function(){var b,c,e,f;if(this.__tmpVertices==void 0){f=this.__tmpVertices=Array(this.vertices.length);b=0;for(c=this.vertices.length;b<c;b++)f[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)if(e=this.faces[b],e instanceof THREE.Face3)e.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(e instanceof THREE.Face4)e.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{f=
@@ -272,62 +272,62 @@ k.bindTexture(k.TEXTURE_2D,Q.occlusionTexture);k.activeTexture(k.TEXTURE1);for(f
 k.uniform2fv(x.scale,v);k.uniform3fv(x.screenPosition,y);k.disable(k.BLEND);k.enable(k.DEPTH_TEST);k.drawElements(k.TRIANGLES,6,k.UNSIGNED_SHORT,0);k.bindTexture(k.TEXTURE_2D,Q.occlusionTexture);k.copyTexImage2D(k.TEXTURE_2D,0,k.RGBA,w[0]-8,w[1]-8,16,16,0);k.uniform1i(x.renderType,1);k.disable(k.DEPTH_TEST);k.bindTexture(k.TEXTURE_2D,Q.tempTexture);k.drawElements(k.TRIANGLES,6,k.UNSIGNED_SHORT,0);e.positionScreen.x=y[0];e.positionScreen.y=y[1];e.positionScreen.z=y[2];e.customUpdateCallback?e.customUpdateCallback(e):
 e.updateLensFlares();k.uniform1i(x.renderType,2);k.enable(k.BLEND);h=0;for(j=e.lensFlares.length;h<j;h++)if(m=e.lensFlares[h],m.opacity>0.001&&m.scale>0.001)y[0]=m.x,y[1]=m.y,y[2]=m.z,u=m.size*m.scale/V,v[0]=u*t,v[1]=u,k.uniform3fv(x.screenPosition,y),k.uniform2fv(x.scale,v),k.uniform1f(x.rotation,m.rotation),k.uniform1f(x.opacity,m.opacity),I(m.blending),da(m.texture,1),k.drawElements(k.TRIANGLES,6,k.UNSIGNED_SHORT,0)}k.enable(k.CULL_FACE);k.enable(k.DEPTH_TEST);k.depthMask(Z)}function H(b,c,e){b._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,
 b.matrixWorld,b._modelViewMatrixArray);e&&THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}function B(b){var c,e,f,g;g=b.__materials;b=0;for(e=g.length;b<e;b++)if(f=g[b],f.attributes)for(c in f.attributes)if(f.attributes[c].needsUpdate)return!0;return!1}function F(b){var c,e,f,g;g=b.__materials;b=0;for(e=g.length;b<e;b++)if(f=g[b],f.attributes)for(c in f.attributes)f.attributes[c].needsUpdate=!1}function J(b){var e,f,g,h;if(b instanceof THREE.Mesh){f=b.geometry;
-for(e in f.geometryGroups)if(g=f.geometryGroups[e],h=B(g),f.__dirtyVertices||f.__dirtyMorphTargets||f.__dirtyElements||f.__dirtyUvs||f.__dirtyNormals||f.__dirtyColors||f.__dirtyTangents||h){h=g;var j=b,m=k.DYNAMIC_DRAW;if(h.__inittedArrays){var n=void 0,t=void 0,p=void 0,o=void 0,u=p=void 0,v=void 0,y=void 0,w=void 0,x=void 0,z=void 0,H=void 0,G=void 0,J=void 0,K=void 0,D=void 0,I=void 0,V=void 0,E=o=w=o=y=v=void 0,A=void 0,C=A=E=v=void 0,M=void 0,U=C=A=E=p=p=u=w=o=C=A=E=M=C=A=E=M=C=A=E=void 0,L=
-0,ga=0,X=0,Q=0,R=0,Z=0,O=0,T=0,ja=0,N=0,P=0,C=E=0,C=void 0,S=h.__vertexArray,da=h.__uvArray,ea=h.__uv2Array,ka=h.__normalArray,W=h.__tangentArray,aa=h.__colorArray,Y=h.__skinVertexAArray,fa=h.__skinVertexBArray,ca=h.__skinIndexArray,$=h.__skinWeightArray,ma=h.__morphTargetsArrays,ha=h.__webglCustomAttributes,A=void 0,qa=h.__faceArray,la=h.__lineArray,na=h.__needsSmoothNormals,z=h.__vertexColorType,x=h.__uvType,H=h.__normalType,ia=j.geometry,sa=ia.__dirtyVertices,pa=ia.__dirtyElements,wa=ia.__dirtyUvs,
-ra=ia.__dirtyNormals,Aa=ia.__dirtyTangents,ta=ia.__dirtyColors,za=ia.__dirtyMorphTargets,ua=ia.vertices,Ba=h.faces,La=ia.faces,Da=ia.faceVertexUvs[0],Ea=ia.faceVertexUvs[1],xa=ia.skinVerticesA,ya=ia.skinVerticesB,Na=ia.skinIndices,Ga=ia.skinWeights,Ka=j instanceof THREE.ShadowVolume?ia.edgeFaces:void 0,Fa=ia.morphTargets;if(ha)for(U in ha)ha[U].offset=0,ha[U].offsetSrc=0;n=0;for(t=Ba.length;n<t;n++)if(p=Ba[n],o=La[p],Da&&(G=Da[p]),Ea&&(J=Ea[p]),p=o.vertexNormals,u=o.normal,v=o.vertexColors,y=o.color,
-w=o.vertexTangents,o instanceof THREE.Face3){if(sa)K=ua[o.a].position,D=ua[o.b].position,I=ua[o.c].position,S[ga]=K.x,S[ga+1]=K.y,S[ga+2]=K.z,S[ga+3]=D.x,S[ga+4]=D.y,S[ga+5]=D.z,S[ga+6]=I.x,S[ga+7]=I.y,S[ga+8]=I.z,ga+=9;if(ha)for(U in ha)if(A=ha[U],A.__original.needsUpdate)E=A.offset,C=A.offsetSrc,A.size===1?(A.boundTo===void 0||A.boundTo==="vertices"?(A.array[E]=A.value[o.a],A.array[E+1]=A.value[o.b],A.array[E+2]=A.value[o.c]):A.boundTo==="faces"?(C=A.value[C],A.array[E]=C,A.array[E+1]=C,A.array[E+
-2]=C,A.offsetSrc++):A.boundTo==="faceVertices"&&(A.array[E]=A.value[C],A.array[E+1]=A.value[C+1],A.array[E+2]=A.value[C+2],A.offsetSrc+=3),A.offset+=3):(A.boundTo===void 0||A.boundTo==="vertices"?(K=A.value[o.a],D=A.value[o.b],I=A.value[o.c]):A.boundTo==="faces"?(I=D=K=C=A.value[C],A.offsetSrc++):A.boundTo==="faceVertices"&&(K=A.value[C],D=A.value[C+1],I=A.value[C+2],A.offsetSrc+=3),A.size===2?(A.array[E]=K.x,A.array[E+1]=K.y,A.array[E+2]=D.x,A.array[E+3]=D.y,A.array[E+4]=I.x,A.array[E+5]=I.y,A.offset+=
-6):A.size===3?(A.type==="c"?(A.array[E]=K.r,A.array[E+1]=K.g,A.array[E+2]=K.b,A.array[E+3]=D.r,A.array[E+4]=D.g,A.array[E+5]=D.b,A.array[E+6]=I.r,A.array[E+7]=I.g,A.array[E+8]=I.b):(A.array[E]=K.x,A.array[E+1]=K.y,A.array[E+2]=K.z,A.array[E+3]=D.x,A.array[E+4]=D.y,A.array[E+5]=D.z,A.array[E+6]=I.x,A.array[E+7]=I.y,A.array[E+8]=I.z),A.offset+=9):(A.array[E]=K.x,A.array[E+1]=K.y,A.array[E+2]=K.z,A.array[E+3]=K.w,A.array[E+4]=D.x,A.array[E+5]=D.y,A.array[E+6]=D.z,A.array[E+7]=D.w,A.array[E+8]=I.x,A.array[E+
-9]=I.y,A.array[E+10]=I.z,A.array[E+11]=I.w,A.offset+=12));if(za){E=0;for(A=Fa.length;E<A;E++)K=Fa[E].vertices[o.a].position,D=Fa[E].vertices[o.b].position,I=Fa[E].vertices[o.c].position,C=ma[E],C[P]=K.x,C[P+1]=K.y,C[P+2]=K.z,C[P+3]=D.x,C[P+4]=D.y,C[P+5]=D.z,C[P+6]=I.x,C[P+7]=I.y,C[P+8]=I.z;P+=9}if(Ga.length)E=Ga[o.a],A=Ga[o.b],C=Ga[o.c],$[N]=E.x,$[N+1]=E.y,$[N+2]=E.z,$[N+3]=E.w,$[N+4]=A.x,$[N+5]=A.y,$[N+6]=A.z,$[N+7]=A.w,$[N+8]=C.x,$[N+9]=C.y,$[N+10]=C.z,$[N+11]=C.w,E=Na[o.a],A=Na[o.b],C=Na[o.c],
-ca[N]=E.x,ca[N+1]=E.y,ca[N+2]=E.z,ca[N+3]=E.w,ca[N+4]=A.x,ca[N+5]=A.y,ca[N+6]=A.z,ca[N+7]=A.w,ca[N+8]=C.x,ca[N+9]=C.y,ca[N+10]=C.z,ca[N+11]=C.w,E=xa[o.a],A=xa[o.b],C=xa[o.c],Y[N]=E.x,Y[N+1]=E.y,Y[N+2]=E.z,Y[N+3]=1,Y[N+4]=A.x,Y[N+5]=A.y,Y[N+6]=A.z,Y[N+7]=1,Y[N+8]=C.x,Y[N+9]=C.y,Y[N+10]=C.z,Y[N+11]=1,E=ya[o.a],A=ya[o.b],C=ya[o.c],fa[N]=E.x,fa[N+1]=E.y,fa[N+2]=E.z,fa[N+3]=1,fa[N+4]=A.x,fa[N+5]=A.y,fa[N+6]=A.z,fa[N+7]=1,fa[N+8]=C.x,fa[N+9]=C.y,fa[N+10]=C.z,fa[N+11]=1,N+=12;if(ta&&z)v.length==3&&z==THREE.VertexColors?
-(o=v[0],E=v[1],A=v[2]):A=E=o=y,aa[ja]=o.r,aa[ja+1]=o.g,aa[ja+2]=o.b,aa[ja+3]=E.r,aa[ja+4]=E.g,aa[ja+5]=E.b,aa[ja+6]=A.r,aa[ja+7]=A.g,aa[ja+8]=A.b,ja+=9;if(Aa&&ia.hasTangents)v=w[0],y=w[1],o=w[2],W[O]=v.x,W[O+1]=v.y,W[O+2]=v.z,W[O+3]=v.w,W[O+4]=y.x,W[O+5]=y.y,W[O+6]=y.z,W[O+7]=y.w,W[O+8]=o.x,W[O+9]=o.y,W[O+10]=o.z,W[O+11]=o.w,O+=12;if(ra&&H)if(p.length==3&&na)for(w=0;w<3;w++)u=p[w],ka[Z]=u.x,ka[Z+1]=u.y,ka[Z+2]=u.z,Z+=3;else for(w=0;w<3;w++)ka[Z]=u.x,ka[Z+1]=u.y,ka[Z+2]=u.z,Z+=3;if(wa&&G!==void 0&&
-x)for(w=0;w<3;w++)p=G[w],da[X]=p.u,da[X+1]=p.v,X+=2;if(wa&&J!==void 0&&x)for(w=0;w<3;w++)p=J[w],ea[Q]=p.u,ea[Q+1]=p.v,Q+=2;pa&&(qa[R]=L,qa[R+1]=L+1,qa[R+2]=L+2,R+=3,la[T]=L,la[T+1]=L+1,la[T+2]=L,la[T+3]=L+2,la[T+4]=L+1,la[T+5]=L+2,T+=6,L+=3)}else if(o instanceof THREE.Face4){if(sa)K=ua[o.a].position,D=ua[o.b].position,I=ua[o.c].position,V=ua[o.d].position,S[ga]=K.x,S[ga+1]=K.y,S[ga+2]=K.z,S[ga+3]=D.x,S[ga+4]=D.y,S[ga+5]=D.z,S[ga+6]=I.x,S[ga+7]=I.y,S[ga+8]=I.z,S[ga+9]=V.x,S[ga+10]=V.y,S[ga+11]=V.z,
-ga+=12;if(ha)for(U in ha)if(A=ha[U],A.__original.needsUpdate)E=A.offset,C=A.offsetSrc,A.size===1?(A.boundTo===void 0||A.boundTo==="vertices"?(A.array[E]=A.value[o.a],A.array[E+1]=A.value[o.b],A.array[E+2]=A.value[o.c],A.array[E+3]=A.value[o.d]):A.boundTo==="faces"?(C=A.value[C],A.array[E]=C,A.array[E+1]=C,A.array[E+2]=C,A.array[E+3]=C,A.offsetSrc++):A.boundTo==="faceVertices"&&(A.array[E]=A.value[C],A.array[E+1]=A.value[C+1],A.array[E+2]=A.value[C+2],A.array[E+3]=A.value[C+3],A.offsetSrc+=4),A.offset+=
-4):(A.boundTo===void 0||A.boundTo==="vertices"?(K=A.value[o.a],D=A.value[o.b],I=A.value[o.c],V=A.value[o.d]):A.boundTo==="faces"?(V=I=D=K=C=A.value[C],A.offsetSrc++):A.boundTo==="faceVertices"&&(K=A.value[C],D=A.value[C+1],I=A.value[C+2],V=A.value[C+3],A.offsetSrc+=4),A.size===2?(A.array[E]=K.x,A.array[E+1]=K.y,A.array[E+2]=D.x,A.array[E+3]=D.y,A.array[E+4]=I.x,A.array[E+5]=I.y,A.array[E+6]=V.x,A.array[E+7]=V.y,A.offset+=8):A.size===3?(A.type==="c"?(A.array[E]=K.r,A.array[E+1]=K.g,A.array[E+2]=K.b,
-A.array[E+3]=D.r,A.array[E+4]=D.g,A.array[E+5]=D.b,A.array[E+6]=I.r,A.array[E+7]=I.g,A.array[E+8]=I.b,A.array[E+9]=V.r,A.array[E+10]=V.g,A.array[E+11]=V.b):(A.array[E]=K.x,A.array[E+1]=K.y,A.array[E+2]=K.z,A.array[E+3]=D.x,A.array[E+4]=D.y,A.array[E+5]=D.z,A.array[E+6]=I.x,A.array[E+7]=I.y,A.array[E+8]=I.z,A.array[E+9]=V.x,A.array[E+10]=V.y,A.array[E+11]=V.z),A.offset+=12):(A.array[E]=K.x,A.array[E+1]=K.y,A.array[E+2]=K.z,A.array[E+3]=K.w,A.array[E+4]=D.x,A.array[E+5]=D.y,A.array[E+6]=D.z,A.array[E+
-7]=D.w,A.array[E+8]=I.x,A.array[E+9]=I.y,A.array[E+10]=I.z,A.array[E+11]=I.w,A.array[E+12]=V.x,A.array[E+13]=V.y,A.array[E+14]=V.z,A.array[E+15]=V.w,A.offset+=16));if(za){E=0;for(A=Fa.length;E<A;E++)K=Fa[E].vertices[o.a].position,D=Fa[E].vertices[o.b].position,I=Fa[E].vertices[o.c].position,V=Fa[E].vertices[o.d].position,C=ma[E],C[P]=K.x,C[P+1]=K.y,C[P+2]=K.z,C[P+3]=D.x,C[P+4]=D.y,C[P+5]=D.z,C[P+6]=I.x,C[P+7]=I.y,C[P+8]=I.z,C[P+9]=V.x,C[P+10]=V.y,C[P+11]=V.z;P+=12}if(Ga.length)E=Ga[o.a],A=Ga[o.b],
-C=Ga[o.c],M=Ga[o.d],$[N]=E.x,$[N+1]=E.y,$[N+2]=E.z,$[N+3]=E.w,$[N+4]=A.x,$[N+5]=A.y,$[N+6]=A.z,$[N+7]=A.w,$[N+8]=C.x,$[N+9]=C.y,$[N+10]=C.z,$[N+11]=C.w,$[N+12]=M.x,$[N+13]=M.y,$[N+14]=M.z,$[N+15]=M.w,E=Na[o.a],A=Na[o.b],C=Na[o.c],M=Na[o.d],ca[N]=E.x,ca[N+1]=E.y,ca[N+2]=E.z,ca[N+3]=E.w,ca[N+4]=A.x,ca[N+5]=A.y,ca[N+6]=A.z,ca[N+7]=A.w,ca[N+8]=C.x,ca[N+9]=C.y,ca[N+10]=C.z,ca[N+11]=C.w,ca[N+12]=M.x,ca[N+13]=M.y,ca[N+14]=M.z,ca[N+15]=M.w,E=xa[o.a],A=xa[o.b],C=xa[o.c],M=xa[o.d],Y[N]=E.x,Y[N+1]=E.y,Y[N+2]=
-E.z,Y[N+3]=1,Y[N+4]=A.x,Y[N+5]=A.y,Y[N+6]=A.z,Y[N+7]=1,Y[N+8]=C.x,Y[N+9]=C.y,Y[N+10]=C.z,Y[N+11]=1,Y[N+12]=M.x,Y[N+13]=M.y,Y[N+14]=M.z,Y[N+15]=1,E=ya[o.a],A=ya[o.b],C=ya[o.c],o=ya[o.d],fa[N]=E.x,fa[N+1]=E.y,fa[N+2]=E.z,fa[N+3]=1,fa[N+4]=A.x,fa[N+5]=A.y,fa[N+6]=A.z,fa[N+7]=1,fa[N+8]=C.x,fa[N+9]=C.y,fa[N+10]=C.z,fa[N+11]=1,fa[N+12]=o.x,fa[N+13]=o.y,fa[N+14]=o.z,fa[N+15]=1,N+=16;if(ta&&z)v.length==4&&z==THREE.VertexColors?(o=v[0],E=v[1],A=v[2],v=v[3]):v=A=E=o=y,aa[ja]=o.r,aa[ja+1]=o.g,aa[ja+2]=o.b,aa[ja+
-3]=E.r,aa[ja+4]=E.g,aa[ja+5]=E.b,aa[ja+6]=A.r,aa[ja+7]=A.g,aa[ja+8]=A.b,aa[ja+9]=v.r,aa[ja+10]=v.g,aa[ja+11]=v.b,ja+=12;if(Aa&&ia.hasTangents)v=w[0],y=w[1],o=w[2],w=w[3],W[O]=v.x,W[O+1]=v.y,W[O+2]=v.z,W[O+3]=v.w,W[O+4]=y.x,W[O+5]=y.y,W[O+6]=y.z,W[O+7]=y.w,W[O+8]=o.x,W[O+9]=o.y,W[O+10]=o.z,W[O+11]=o.w,W[O+12]=w.x,W[O+13]=w.y,W[O+14]=w.z,W[O+15]=w.w,O+=16;if(ra&&H)if(p.length==4&&na)for(w=0;w<4;w++)u=p[w],ka[Z]=u.x,ka[Z+1]=u.y,ka[Z+2]=u.z,Z+=3;else for(w=0;w<4;w++)ka[Z]=u.x,ka[Z+1]=u.y,ka[Z+2]=u.z,
-Z+=3;if(wa&&G!==void 0&&x)for(w=0;w<4;w++)p=G[w],da[X]=p.u,da[X+1]=p.v,X+=2;if(wa&&J!==void 0&&x)for(w=0;w<4;w++)p=J[w],ea[Q]=p.u,ea[Q+1]=p.v,Q+=2;pa&&(qa[R]=L,qa[R+1]=L+1,qa[R+2]=L+3,qa[R+3]=L+1,qa[R+4]=L+2,qa[R+5]=L+3,R+=6,la[T]=L,la[T+1]=L+1,la[T+2]=L,la[T+3]=L+3,la[T+4]=L+1,la[T+5]=L+2,la[T+6]=L+2,la[T+7]=L+3,T+=8,L+=4)}if(Ka){n=0;for(t=Ka.length;n<t;n++)qa[R]=Ka[n].a,qa[R+1]=Ka[n].b,qa[R+2]=Ka[n].c,qa[R+3]=Ka[n].a,qa[R+4]=Ka[n].c,qa[R+5]=Ka[n].d,R+=6}sa&&(k.bindBuffer(k.ARRAY_BUFFER,h.__webglVertexBuffer),
-k.bufferData(k.ARRAY_BUFFER,S,m));if(ha)for(U in ha)A=ha[U],A.__original.needsUpdate&&(k.bindBuffer(k.ARRAY_BUFFER,A.buffer),k.bufferData(k.ARRAY_BUFFER,A.array,m));if(za){E=0;for(A=Fa.length;E<A;E++)k.bindBuffer(k.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[E]),k.bufferData(k.ARRAY_BUFFER,ma[E],m)}ta&&ja>0&&(k.bindBuffer(k.ARRAY_BUFFER,h.__webglColorBuffer),k.bufferData(k.ARRAY_BUFFER,aa,m));ra&&(k.bindBuffer(k.ARRAY_BUFFER,h.__webglNormalBuffer),k.bufferData(k.ARRAY_BUFFER,ka,m));Aa&&ia.hasTangents&&
-(k.bindBuffer(k.ARRAY_BUFFER,h.__webglTangentBuffer),k.bufferData(k.ARRAY_BUFFER,W,m));wa&&X>0&&(k.bindBuffer(k.ARRAY_BUFFER,h.__webglUVBuffer),k.bufferData(k.ARRAY_BUFFER,da,m));wa&&Q>0&&(k.bindBuffer(k.ARRAY_BUFFER,h.__webglUV2Buffer),k.bufferData(k.ARRAY_BUFFER,ea,m));pa&&(k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,h.__webglFaceBuffer),k.bufferData(k.ELEMENT_ARRAY_BUFFER,qa,m),k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,h.__webglLineBuffer),k.bufferData(k.ELEMENT_ARRAY_BUFFER,la,m));N>0&&(k.bindBuffer(k.ARRAY_BUFFER,
-h.__webglSkinVertexABuffer),k.bufferData(k.ARRAY_BUFFER,Y,m),k.bindBuffer(k.ARRAY_BUFFER,h.__webglSkinVertexBBuffer),k.bufferData(k.ARRAY_BUFFER,fa,m),k.bindBuffer(k.ARRAY_BUFFER,h.__webglSkinIndicesBuffer),k.bufferData(k.ARRAY_BUFFER,ca,m),k.bindBuffer(k.ARRAY_BUFFER,h.__webglSkinWeightsBuffer),k.bufferData(k.ARRAY_BUFFER,$,m));j.dynamic||(delete h.__inittedArrays,delete h.__colorArray,delete h.__normalArray,delete h.__tangentArray,delete h.__uvArray,delete h.__uv2Array,delete h.__faceArray,delete h.__vertexArray,
-delete h.__lineArray,delete h.__skinVertexAArray,delete h.__skinVertexBArray,delete h.__skinIndexArray,delete h.__skinWeightArray)}}f.__dirtyVertices=!1;f.__dirtyMorphTargets=!1;f.__dirtyElements=!1;f.__dirtyUvs=!1;f.__dirtyNormals=!1;f.__dirtyTangents=!1;f.__dirtyColors=!1;F(g)}else if(b instanceof THREE.Ribbon){f=b.geometry;if(f.__dirtyVertices||f.__dirtyColors){b=f;e=k.DYNAMIC_DRAW;x=b.vertices;h=b.colors;z=x.length;j=h.length;H=b.__vertexArray;m=b.__colorArray;G=b.__dirtyColors;if(b.__dirtyVertices){for(n=
-0;n<z;n++)t=x[n].position,g=n*3,H[g]=t.x,H[g+1]=t.y,H[g+2]=t.z;k.bindBuffer(k.ARRAY_BUFFER,b.__webglVertexBuffer);k.bufferData(k.ARRAY_BUFFER,H,e)}if(G){for(n=0;n<j;n++)color=h[n],g=n*3,m[g]=color.r,m[g+1]=color.g,m[g+2]=color.b;k.bindBuffer(k.ARRAY_BUFFER,b.__webglColorBuffer);k.bufferData(k.ARRAY_BUFFER,m,e)}}f.__dirtyVertices=!1;f.__dirtyColors=!1}else if(b instanceof THREE.Line){f=b.geometry;if(f.__dirtyVertices||f.__dirtyColors){b=f;e=k.DYNAMIC_DRAW;x=b.vertices;h=b.colors;z=x.length;j=h.length;
-H=b.__vertexArray;m=b.__colorArray;G=b.__dirtyColors;if(b.__dirtyVertices){for(n=0;n<z;n++)t=x[n].position,g=n*3,H[g]=t.x,H[g+1]=t.y,H[g+2]=t.z;k.bindBuffer(k.ARRAY_BUFFER,b.__webglVertexBuffer);k.bufferData(k.ARRAY_BUFFER,H,e)}if(G){for(n=0;n<j;n++)color=h[n],g=n*3,m[g]=color.r,m[g+1]=color.g,m[g+2]=color.b;k.bindBuffer(k.ARRAY_BUFFER,b.__webglColorBuffer);k.bufferData(k.ARRAY_BUFFER,m,e)}}f.__dirtyVertices=!1;f.__dirtyColors=!1}else if(b instanceof THREE.ParticleSystem)f=b.geometry,h=B(f),(f.__dirtyVertices||
-f.__dirtyColors||b.sortParticles||h)&&c(f,k.DYNAMIC_DRAW,b),f.__dirtyVertices=!1,f.__dirtyColors=!1,F(f)}function D(b,e){var c;for(c=b.length-1;c>=0;c--)b[c].object==e&&b.splice(c,1)}function L(b){function e(b){var h=[];c=0;for(f=b.length;c<f;c++)b[c]==void 0?h.push("undefined"):h.push(b[c].id);return h.join("_")}var c,f,h,g,j,k,m,n,o={},t=b.morphTargets!==void 0?b.morphTargets.length:0;b.geometryGroups={};h=0;for(g=b.faces.length;h<g;h++)j=b.faces[h],k=j.materials,m=e(k),o[m]==void 0&&(o[m]={hash:m,
-counter:0}),n=o[m].hash+"_"+o[m].counter,b.geometryGroups[n]==void 0&&(b.geometryGroups[n]={faces:[],materials:k,vertices:0,numMorphTargets:t}),j=j instanceof THREE.Face3?3:4,b.geometryGroups[n].vertices+j>65535&&(o[m].counter+=1,n=o[m].hash+"_"+o[m].counter,b.geometryGroups[n]==void 0&&(b.geometryGroups[n]={faces:[],materials:k,vertices:0,numMorphTargets:t})),b.geometryGroups[n].faces.push(h),b.geometryGroups[n].vertices+=j}function G(b,c,e){b.push({buffer:c,object:e,opaque:{list:[],count:0},transparent:{list:[],
-count:0}})}function I(b){if(b!=fa){switch(b){case THREE.AdditiveBlending:k.blendEquation(k.FUNC_ADD);k.blendFunc(k.SRC_ALPHA,k.ONE);break;case THREE.SubtractiveBlending:k.blendEquation(k.FUNC_ADD);k.blendFunc(k.ZERO,k.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:k.blendEquation(k.FUNC_ADD);k.blendFunc(k.ZERO,k.SRC_COLOR);break;default:k.blendEquationSeparate(k.FUNC_ADD,k.FUNC_ADD),k.blendFuncSeparate(k.SRC_ALPHA,k.ONE_MINUS_SRC_ALPHA,k.ONE,k.ONE_MINUS_SRC_ALPHA)}fa=b}}function R(b,c,e){(e.width&
-e.width-1)==0&&(e.height&e.height-1)==0?(k.texParameteri(b,k.TEXTURE_WRAP_S,S(c.wrapS)),k.texParameteri(b,k.TEXTURE_WRAP_T,S(c.wrapT)),k.texParameteri(b,k.TEXTURE_MAG_FILTER,S(c.magFilter)),k.texParameteri(b,k.TEXTURE_MIN_FILTER,S(c.minFilter)),k.generateMipmap(b)):(k.texParameteri(b,k.TEXTURE_WRAP_S,k.CLAMP_TO_EDGE),k.texParameteri(b,k.TEXTURE_WRAP_T,k.CLAMP_TO_EDGE),k.texParameteri(b,k.TEXTURE_MAG_FILTER,ea(c.magFilter)),k.texParameteri(b,k.TEXTURE_MIN_FILTER,ea(c.minFilter)))}function da(b,c){if(b.needsUpdate){if(!b.__webglInit)b.__webglTexture=
-k.createTexture(),b.__webglInit=!0;k.bindTexture(k.TEXTURE_2D,b.__webglTexture);b.image.data?k.texImage2D(k.TEXTURE_2D,0,S(b.format),b.image.width,b.image.height,0,S(b.format),k.UNSIGNED_BYTE,b.image.data):k.texImage2D(k.TEXTURE_2D,0,k.RGBA,k.RGBA,k.UNSIGNED_BYTE,b.image);R(k.TEXTURE_2D,b,b.image);k.bindTexture(k.TEXTURE_2D,null);b.needsUpdate=!1}k.activeTexture(k.TEXTURE0+c);k.bindTexture(k.TEXTURE_2D,b.__webglTexture)}function T(b){if(b&&!b.__webglFramebuffer){if(b.depthBuffer===void 0)b.depthBuffer=
-!0;if(b.stencilBuffer===void 0)b.stencilBuffer=!0;b.__webglFramebuffer=k.createFramebuffer();b.__webglRenderbuffer=k.createRenderbuffer();b.__webglTexture=k.createTexture();k.bindTexture(k.TEXTURE_2D,b.__webglTexture);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_WRAP_S,S(b.wrapS));k.texParameteri(k.TEXTURE_2D,k.TEXTURE_WRAP_T,S(b.wrapT));k.texParameteri(k.TEXTURE_2D,k.TEXTURE_MAG_FILTER,S(b.magFilter));k.texParameteri(k.TEXTURE_2D,k.TEXTURE_MIN_FILTER,S(b.minFilter));k.texImage2D(k.TEXTURE_2D,0,S(b.format),
-b.width,b.height,0,S(b.format),S(b.type),null);k.bindRenderbuffer(k.RENDERBUFFER,b.__webglRenderbuffer);k.bindFramebuffer(k.FRAMEBUFFER,b.__webglFramebuffer);k.framebufferTexture2D(k.FRAMEBUFFER,k.COLOR_ATTACHMENT0,k.TEXTURE_2D,b.__webglTexture,0);b.depthBuffer&&!b.stencilBuffer?(k.renderbufferStorage(k.RENDERBUFFER,k.DEPTH_COMPONENT16,b.width,b.height),k.framebufferRenderbuffer(k.FRAMEBUFFER,k.DEPTH_ATTACHMENT,k.RENDERBUFFER,b.__webglRenderbuffer)):b.depthBuffer&&b.stencilBuffer?(k.renderbufferStorage(k.RENDERBUFFER,
-k.DEPTH_STENCIL,b.width,b.height),k.framebufferRenderbuffer(k.FRAMEBUFFER,k.DEPTH_STENCIL_ATTACHMENT,k.RENDERBUFFER,b.__webglRenderbuffer)):k.renderbufferStorage(k.RENDERBUFFER,k.RGBA4,b.width,b.height);k.bindTexture(k.TEXTURE_2D,null);k.bindRenderbuffer(k.RENDERBUFFER,null);k.bindFramebuffer(k.FRAMEBUFFER,null)}var c,e;b?(c=b.__webglFramebuffer,e=b.width,b=b.height):(c=null,e=K,b=V);c!=aa&&(k.bindFramebuffer(k.FRAMEBUFFER,c),k.viewport(la,sa,e,b),aa=c)}function C(b,c){var e;b=="fragment"?e=k.createShader(k.FRAGMENT_SHADER):
-b=="vertex"&&(e=k.createShader(k.VERTEX_SHADER));k.shaderSource(e,c);k.compileShader(e);if(!k.getShaderParameter(e,k.COMPILE_STATUS))return console.error(k.getShaderInfoLog(e)),console.error(c),null;return e}function ea(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return k.NEAREST;default:return k.LINEAR}}function S(b){switch(b){case THREE.RepeatWrapping:return k.REPEAT;case THREE.ClampToEdgeWrapping:return k.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return k.MIRRORED_REPEAT;
-case THREE.NearestFilter:return k.NEAREST;case THREE.NearestMipMapNearestFilter:return k.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return k.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return k.LINEAR;case THREE.LinearMipMapNearestFilter:return k.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return k.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return k.BYTE;case THREE.UnsignedByteType:return k.UNSIGNED_BYTE;case THREE.ShortType:return k.SHORT;case THREE.UnsignedShortType:return k.UNSIGNED_SHORT;
-case THREE.IntType:return k.INT;case THREE.UnsignedShortType:return k.UNSIGNED_INT;case THREE.FloatType:return k.FLOAT;case THREE.AlphaFormat:return k.ALPHA;case THREE.RGBFormat:return k.RGB;case THREE.RGBAFormat:return k.RGBA;case THREE.LuminanceFormat:return k.LUMINANCE;case THREE.LuminanceAlphaFormat:return k.LUMINANCE_ALPHA}return 0}var P=this,k,M=[],Y=null,aa=null,Z=!0,ha=null,ka=null,fa=null,U=null,X=null,ca=null,ma=null,la=0,sa=0,K=0,V=0,ga=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,
-new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ja=new THREE.Matrix4,qa=new Float32Array(16),wa=new Float32Array(16),Aa=new THREE.Vector4,La={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},za=b.canvas!==void 0?b.canvas:document.createElement("canvas"),Oa=b.stencil!==void 0?b.stencil:!0,W=b.preserveDrawingBuffer!==void 0?b.preserveDrawingBuffer:!1,ta=b.antialias!==void 0?b.antialias:!1,na=b.clearColor!==void 0?new THREE.Color(b.clearColor):
-new THREE.Color(0),ua=b.clearAlpha!==void 0?b.clearAlpha:0;this.data={vertices:0,faces:0,drawCalls:0};this.maxMorphTargets=8;this.domElement=za;this.sortObjects=this.autoClear=!0;this.shadowMapBias=0.0039;this.shadowMapDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCameraNear=1;this.shadowCameraFar=5E3;this.shadowCameraFov=50;this.shadowMap=[];this.shadowMapEnabled=!1;this.shadowMapSoft=!0;var ia,ra=[],b=THREE.ShaderLib.depthRGBA,xa=THREE.UniformsUtils.clone(b.uniforms),Ba=new THREE.MeshShaderMaterial({fragmentShader:b.fragmentShader,
-vertexShader:b.vertexShader,uniforms:xa}),pa=new THREE.MeshShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:xa,morphTargets:!0});Ba._shadowPass=!0;pa._shadowPass=!0;try{if(!(k=za.getContext("experimental-webgl",{antialias:ta,stencil:Oa,preserveDrawingBuffer:W})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+k.getParameter(k.VERSION)+" | "+k.getParameter(k.VENDOR)+" | "+k.getParameter(k.RENDERER)+" | "+k.getParameter(k.SHADING_LANGUAGE_VERSION))}catch(ya){console.error(ya)}k.clearColor(0,
-0,0,1);k.clearDepth(1);k.enable(k.DEPTH_TEST);k.depthFunc(k.LEQUAL);k.frontFace(k.CCW);k.cullFace(k.BACK);k.enable(k.CULL_FACE);k.enable(k.BLEND);k.blendEquation(k.FUNC_ADD);k.blendFunc(k.SRC_ALPHA,k.ONE_MINUS_SRC_ALPHA);k.clearColor(na.r,na.g,na.b,ua);this.context=k;var Da=k.getParameter(k.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0;if(Oa){var $={};$.vertices=new Float32Array(12);$.faces=new Uint16Array(6);$.darkness=0.5;$.vertices[0]=-20;$.vertices[1]=-20;$.vertices[2]=-1;$.vertices[3]=20;$.vertices[4]=-20;
-$.vertices[5]=-1;$.vertices[6]=20;$.vertices[7]=20;$.vertices[8]=-1;$.vertices[9]=-20;$.vertices[10]=20;$.vertices[11]=-1;$.faces[0]=0;$.faces[1]=1;$.faces[2]=2;$.faces[3]=0;$.faces[4]=2;$.faces[5]=3;$.vertexBuffer=k.createBuffer();$.elementBuffer=k.createBuffer();k.bindBuffer(k.ARRAY_BUFFER,$.vertexBuffer);k.bufferData(k.ARRAY_BUFFER,$.vertices,k.STATIC_DRAW);k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,$.elementBuffer);k.bufferData(k.ELEMENT_ARRAY_BUFFER,$.faces,k.STATIC_DRAW);$.program=k.createProgram();
-k.attachShader($.program,C("fragment",THREE.ShaderLib.shadowPost.fragmentShader));k.attachShader($.program,C("vertex",THREE.ShaderLib.shadowPost.vertexShader));k.linkProgram($.program);$.vertexLocation=k.getAttribLocation($.program,"position");$.projectionLocation=k.getUniformLocation($.program,"projectionMatrix");$.darknessLocation=k.getUniformLocation($.program,"darkness")}var Q={};Q.vertices=new Float32Array(16);Q.faces=new Uint16Array(6);W=0;Q.vertices[W++]=-1;Q.vertices[W++]=-1;Q.vertices[W++]=
-0;Q.vertices[W++]=0;Q.vertices[W++]=1;Q.vertices[W++]=-1;Q.vertices[W++]=1;Q.vertices[W++]=0;Q.vertices[W++]=1;Q.vertices[W++]=1;Q.vertices[W++]=1;Q.vertices[W++]=1;Q.vertices[W++]=-1;Q.vertices[W++]=1;Q.vertices[W++]=0;Q.vertices[W++]=1;W=0;Q.faces[W++]=0;Q.faces[W++]=1;Q.faces[W++]=2;Q.faces[W++]=0;Q.faces[W++]=2;Q.faces[W++]=3;Q.vertexBuffer=k.createBuffer();Q.elementBuffer=k.createBuffer();Q.tempTexture=k.createTexture();Q.occlusionTexture=k.createTexture();k.bindBuffer(k.ARRAY_BUFFER,Q.vertexBuffer);
-k.bufferData(k.ARRAY_BUFFER,Q.vertices,k.STATIC_DRAW);k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,Q.elementBuffer);k.bufferData(k.ELEMENT_ARRAY_BUFFER,Q.faces,k.STATIC_DRAW);k.bindTexture(k.TEXTURE_2D,Q.tempTexture);k.texImage2D(k.TEXTURE_2D,0,k.RGB,16,16,0,k.RGB,k.UNSIGNED_BYTE,null);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_WRAP_S,k.CLAMP_TO_EDGE);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_WRAP_T,k.CLAMP_TO_EDGE);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_MAG_FILTER,k.NEAREST);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_MIN_FILTER,
-k.NEAREST);k.bindTexture(k.TEXTURE_2D,Q.occlusionTexture);k.texImage2D(k.TEXTURE_2D,0,k.RGBA,16,16,0,k.RGBA,k.UNSIGNED_BYTE,null);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_WRAP_S,k.CLAMP_TO_EDGE);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_WRAP_T,k.CLAMP_TO_EDGE);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_MAG_FILTER,k.NEAREST);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_MIN_FILTER,k.NEAREST);k.getParameter(k.MAX_VERTEX_TEXTURE_IMAGE_UNITS)<=0?(Q.hasVertexTexture=!1,Q.program=k.createProgram(),k.attachShader(Q.program,
-C("fragment",THREE.ShaderLib.lensFlare.fragmentShader)),k.attachShader(Q.program,C("vertex",THREE.ShaderLib.lensFlare.vertexShader))):(Q.hasVertexTexture=!0,Q.program=k.createProgram(),k.attachShader(Q.program,C("fragment",THREE.ShaderLib.lensFlareVertexTexture.fragmentShader)),k.attachShader(Q.program,C("vertex",THREE.ShaderLib.lensFlareVertexTexture.vertexShader)));k.linkProgram(Q.program);Q.attributes={};Q.uniforms={};Q.attributes.vertex=k.getAttribLocation(Q.program,"position");Q.attributes.uv=
-k.getAttribLocation(Q.program,"UV");Q.uniforms.renderType=k.getUniformLocation(Q.program,"renderType");Q.uniforms.map=k.getUniformLocation(Q.program,"map");Q.uniforms.occlusionMap=k.getUniformLocation(Q.program,"occlusionMap");Q.uniforms.opacity=k.getUniformLocation(Q.program,"opacity");Q.uniforms.scale=k.getUniformLocation(Q.program,"scale");Q.uniforms.rotation=k.getUniformLocation(Q.program,"rotation");Q.uniforms.screenPosition=k.getUniformLocation(Q.program,"screenPosition");var Ea=!1,O={};O.vertices=
-new Float32Array(16);O.faces=new Uint16Array(6);W=0;O.vertices[W++]=-1;O.vertices[W++]=-1;O.vertices[W++]=0;O.vertices[W++]=1;O.vertices[W++]=1;O.vertices[W++]=-1;O.vertices[W++]=1;O.vertices[W++]=1;O.vertices[W++]=1;O.vertices[W++]=1;O.vertices[W++]=1;O.vertices[W++]=0;O.vertices[W++]=-1;O.vertices[W++]=1;O.vertices[W++]=0;W=O.vertices[W++]=0;O.faces[W++]=0;O.faces[W++]=1;O.faces[W++]=2;O.faces[W++]=0;O.faces[W++]=2;O.faces[W++]=3;O.vertexBuffer=k.createBuffer();O.elementBuffer=k.createBuffer();
-k.bindBuffer(k.ARRAY_BUFFER,O.vertexBuffer);k.bufferData(k.ARRAY_BUFFER,O.vertices,k.STATIC_DRAW);k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,O.elementBuffer);k.bufferData(k.ELEMENT_ARRAY_BUFFER,O.faces,k.STATIC_DRAW);O.program=k.createProgram();k.attachShader(O.program,C("fragment",THREE.ShaderLib.sprite.fragmentShader));k.attachShader(O.program,C("vertex",THREE.ShaderLib.sprite.vertexShader));k.linkProgram(O.program);O.attributes={};O.uniforms={};O.attributes.position=k.getAttribLocation(O.program,"position");
-O.attributes.uv=k.getAttribLocation(O.program,"uv");O.uniforms.uvOffset=k.getUniformLocation(O.program,"uvOffset");O.uniforms.uvScale=k.getUniformLocation(O.program,"uvScale");O.uniforms.rotation=k.getUniformLocation(O.program,"rotation");O.uniforms.scale=k.getUniformLocation(O.program,"scale");O.uniforms.alignment=k.getUniformLocation(O.program,"alignment");O.uniforms.map=k.getUniformLocation(O.program,"map");O.uniforms.opacity=k.getUniformLocation(O.program,"opacity");O.uniforms.useScreenCoordinates=
-k.getUniformLocation(O.program,"useScreenCoordinates");O.uniforms.affectedByDistance=k.getUniformLocation(O.program,"affectedByDistance");O.uniforms.screenPosition=k.getUniformLocation(O.program,"screenPosition");O.uniforms.modelViewMatrix=k.getUniformLocation(O.program,"modelViewMatrix");O.uniforms.projectionMatrix=k.getUniformLocation(O.program,"projectionMatrix");var Wa=!1;this.setSize=function(b,c){za.width=b;za.height=c;this.setViewport(0,0,za.width,za.height)};this.setViewport=function(b,c,
-e,f){la=b;sa=c;K=e;V=f;k.viewport(la,sa,K,V)};this.setScissor=function(b,c,e,f){k.scissor(b,c,e,f)};this.enableScissorTest=function(b){b?k.enable(k.SCISSOR_TEST):k.disable(k.SCISSOR_TEST)};this.enableDepthBufferWrite=function(b){Z=b;k.depthMask(b)};this.setClearColorHex=function(b,c){na.setHex(b);ua=c;k.clearColor(na.r,na.g,na.b,ua)};this.setClearColor=function(b,c){na.copy(b);ua=c;k.clearColor(na.r,na.g,na.b,ua)};this.clear=function(){k.clear(k.COLOR_BUFFER_BIT|k.DEPTH_BUFFER_BIT|k.STENCIL_BUFFER_BIT)};
-this.setStencilShadowDarkness=function(b){$.darkness=b};this.getContext=function(){return k};this.initMaterial=function(b,c,e,f){var h,g,j;b instanceof THREE.MeshDepthMaterial?j="depth":b instanceof THREE.ShadowVolumeDynamicMaterial?j="shadowVolumeDynamic":b instanceof THREE.MeshNormalMaterial?j="normal":b instanceof THREE.MeshBasicMaterial?j="basic":b instanceof THREE.MeshLambertMaterial?j="lambert":b instanceof THREE.MeshPhongMaterial?j="phong":b instanceof THREE.LineBasicMaterial?j="basic":b instanceof
-THREE.ParticleBasicMaterial&&(j="particle_basic");if(j){var m=THREE.ShaderLib[j];b.uniforms=THREE.UniformsUtils.clone(m.uniforms);b.vertexShader=m.vertexShader;b.fragmentShader=m.fragmentShader}var n,o,t;n=t=m=0;for(o=c.length;n<o;n++)g=c[n],g instanceof THREE.SpotLight&&t++,g instanceof THREE.DirectionalLight&&t++,g instanceof THREE.PointLight&&m++;m+t<=4?n=t:(n=Math.ceil(4*t/(m+t)),m=4-n);g={directional:n,point:m};m=t=0;for(n=c.length;m<n;m++)o=c[m],o instanceof THREE.SpotLight&&o.castShadow&&t++;
-var p=50;if(f!==void 0&&f instanceof THREE.SkinnedMesh)p=f.bones.length;var u;a:{n=b.fragmentShader;o=b.vertexShader;var m=b.uniforms,c=b.attributes,e={map:!!b.map,envMap:!!b.envMap,lightMap:!!b.lightMap,vertexColors:b.vertexColors,fog:e,sizeAttenuation:b.sizeAttenuation,skinning:b.skinning,morphTargets:b.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:g.directional,maxPointLights:g.point,maxBones:p,shadowMapEnabled:this.shadowMapEnabled&&f.receiveShadow,shadowMapSoft:this.shadowMapSoft,
-shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:t,alphaTest:b.alphaTest},v,f=[];j?f.push(j):(f.push(n),f.push(o));for(v in e)f.push(v),f.push(e[v]);j=f.join();v=0;for(f=M.length;v<f;v++)if(M[v].code==j){u=M[v].program;break a}v=k.createProgram();f=[Da?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+e.maxDirLights,"#define MAX_POINT_LIGHTS "+e.maxPointLights,"#define MAX_SHADOWS "+e.maxShadows,"#define MAX_BONES "+e.maxBones,e.map?"#define USE_MAP":"",e.envMap?
-"#define USE_ENVMAP":"",e.lightMap?"#define USE_LIGHTMAP":"",e.vertexColors?"#define USE_COLOR":"",e.skinning?"#define USE_SKINNING":"",e.morphTargets?"#define USE_MORPHTARGETS":"",e.shadowMapEnabled?"#define USE_SHADOWMAP":"",e.shadowMapSoft?"#define SHADOWMAP_SOFT":"",e.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");
+for(e in f.geometryGroups)if(g=f.geometryGroups[e],h=B(g),f.__dirtyVertices||f.__dirtyMorphTargets||f.__dirtyElements||f.__dirtyUvs||f.__dirtyNormals||f.__dirtyColors||f.__dirtyTangents||h){h=g;var j=k.DYNAMIC_DRAW,m=!f.dynamic;if(h.__inittedArrays){var n=void 0,t=void 0,p=void 0,o=void 0,u=p=void 0,v=void 0,y=void 0,w=void 0,x=void 0,z=void 0,H=void 0,G=void 0,J=void 0,K=void 0,D=void 0,I=void 0,V=void 0,E=o=w=o=y=v=void 0,A=void 0,C=A=E=v=void 0,M=void 0,U=C=A=E=p=p=u=w=o=C=A=E=M=C=A=E=M=C=A=E=
+void 0,L=0,ga=0,X=0,Q=0,R=0,Z=0,O=0,T=0,ja=0,N=0,P=0,C=E=0,C=void 0,S=h.__vertexArray,da=h.__uvArray,ea=h.__uv2Array,ka=h.__normalArray,W=h.__tangentArray,aa=h.__colorArray,Y=h.__skinVertexAArray,fa=h.__skinVertexBArray,ca=h.__skinIndexArray,$=h.__skinWeightArray,ma=h.__morphTargetsArrays,ha=h.__webglCustomAttributes,A=void 0,qa=h.__faceArray,la=h.__lineArray,na=h.__needsSmoothNormals,z=h.__vertexColorType,x=h.__uvType,H=h.__normalType,ia=b.geometry,sa=ia.__dirtyVertices,pa=ia.__dirtyElements,wa=
+ia.__dirtyUvs,ra=ia.__dirtyNormals,Aa=ia.__dirtyTangents,ta=ia.__dirtyColors,za=ia.__dirtyMorphTargets,ua=ia.vertices,Ba=h.faces,La=ia.faces,Da=ia.faceVertexUvs[0],Ea=ia.faceVertexUvs[1],xa=ia.skinVerticesA,ya=ia.skinVerticesB,Na=ia.skinIndices,Ga=ia.skinWeights,Ka=b instanceof THREE.ShadowVolume?ia.edgeFaces:void 0,Fa=ia.morphTargets;if(ha)for(U in ha)ha[U].offset=0,ha[U].offsetSrc=0;n=0;for(t=Ba.length;n<t;n++)if(p=Ba[n],o=La[p],Da&&(G=Da[p]),Ea&&(J=Ea[p]),p=o.vertexNormals,u=o.normal,v=o.vertexColors,
+y=o.color,w=o.vertexTangents,o instanceof THREE.Face3){if(sa)K=ua[o.a].position,D=ua[o.b].position,I=ua[o.c].position,S[ga]=K.x,S[ga+1]=K.y,S[ga+2]=K.z,S[ga+3]=D.x,S[ga+4]=D.y,S[ga+5]=D.z,S[ga+6]=I.x,S[ga+7]=I.y,S[ga+8]=I.z,ga+=9;if(ha)for(U in ha)if(A=ha[U],A.__original.needsUpdate)E=A.offset,C=A.offsetSrc,A.size===1?(A.boundTo===void 0||A.boundTo==="vertices"?(A.array[E]=A.value[o.a],A.array[E+1]=A.value[o.b],A.array[E+2]=A.value[o.c]):A.boundTo==="faces"?(C=A.value[C],A.array[E]=C,A.array[E+1]=
+C,A.array[E+2]=C,A.offsetSrc++):A.boundTo==="faceVertices"&&(A.array[E]=A.value[C],A.array[E+1]=A.value[C+1],A.array[E+2]=A.value[C+2],A.offsetSrc+=3),A.offset+=3):(A.boundTo===void 0||A.boundTo==="vertices"?(K=A.value[o.a],D=A.value[o.b],I=A.value[o.c]):A.boundTo==="faces"?(I=D=K=C=A.value[C],A.offsetSrc++):A.boundTo==="faceVertices"&&(K=A.value[C],D=A.value[C+1],I=A.value[C+2],A.offsetSrc+=3),A.size===2?(A.array[E]=K.x,A.array[E+1]=K.y,A.array[E+2]=D.x,A.array[E+3]=D.y,A.array[E+4]=I.x,A.array[E+
+5]=I.y,A.offset+=6):A.size===3?(A.type==="c"?(A.array[E]=K.r,A.array[E+1]=K.g,A.array[E+2]=K.b,A.array[E+3]=D.r,A.array[E+4]=D.g,A.array[E+5]=D.b,A.array[E+6]=I.r,A.array[E+7]=I.g,A.array[E+8]=I.b):(A.array[E]=K.x,A.array[E+1]=K.y,A.array[E+2]=K.z,A.array[E+3]=D.x,A.array[E+4]=D.y,A.array[E+5]=D.z,A.array[E+6]=I.x,A.array[E+7]=I.y,A.array[E+8]=I.z),A.offset+=9):(A.array[E]=K.x,A.array[E+1]=K.y,A.array[E+2]=K.z,A.array[E+3]=K.w,A.array[E+4]=D.x,A.array[E+5]=D.y,A.array[E+6]=D.z,A.array[E+7]=D.w,A.array[E+
+8]=I.x,A.array[E+9]=I.y,A.array[E+10]=I.z,A.array[E+11]=I.w,A.offset+=12));if(za){E=0;for(A=Fa.length;E<A;E++)K=Fa[E].vertices[o.a].position,D=Fa[E].vertices[o.b].position,I=Fa[E].vertices[o.c].position,C=ma[E],C[P]=K.x,C[P+1]=K.y,C[P+2]=K.z,C[P+3]=D.x,C[P+4]=D.y,C[P+5]=D.z,C[P+6]=I.x,C[P+7]=I.y,C[P+8]=I.z;P+=9}if(Ga.length)E=Ga[o.a],A=Ga[o.b],C=Ga[o.c],$[N]=E.x,$[N+1]=E.y,$[N+2]=E.z,$[N+3]=E.w,$[N+4]=A.x,$[N+5]=A.y,$[N+6]=A.z,$[N+7]=A.w,$[N+8]=C.x,$[N+9]=C.y,$[N+10]=C.z,$[N+11]=C.w,E=Na[o.a],A=Na[o.b],
+C=Na[o.c],ca[N]=E.x,ca[N+1]=E.y,ca[N+2]=E.z,ca[N+3]=E.w,ca[N+4]=A.x,ca[N+5]=A.y,ca[N+6]=A.z,ca[N+7]=A.w,ca[N+8]=C.x,ca[N+9]=C.y,ca[N+10]=C.z,ca[N+11]=C.w,E=xa[o.a],A=xa[o.b],C=xa[o.c],Y[N]=E.x,Y[N+1]=E.y,Y[N+2]=E.z,Y[N+3]=1,Y[N+4]=A.x,Y[N+5]=A.y,Y[N+6]=A.z,Y[N+7]=1,Y[N+8]=C.x,Y[N+9]=C.y,Y[N+10]=C.z,Y[N+11]=1,E=ya[o.a],A=ya[o.b],C=ya[o.c],fa[N]=E.x,fa[N+1]=E.y,fa[N+2]=E.z,fa[N+3]=1,fa[N+4]=A.x,fa[N+5]=A.y,fa[N+6]=A.z,fa[N+7]=1,fa[N+8]=C.x,fa[N+9]=C.y,fa[N+10]=C.z,fa[N+11]=1,N+=12;if(ta&&z)v.length==
+3&&z==THREE.VertexColors?(o=v[0],E=v[1],A=v[2]):A=E=o=y,aa[ja]=o.r,aa[ja+1]=o.g,aa[ja+2]=o.b,aa[ja+3]=E.r,aa[ja+4]=E.g,aa[ja+5]=E.b,aa[ja+6]=A.r,aa[ja+7]=A.g,aa[ja+8]=A.b,ja+=9;if(Aa&&ia.hasTangents)v=w[0],y=w[1],o=w[2],W[O]=v.x,W[O+1]=v.y,W[O+2]=v.z,W[O+3]=v.w,W[O+4]=y.x,W[O+5]=y.y,W[O+6]=y.z,W[O+7]=y.w,W[O+8]=o.x,W[O+9]=o.y,W[O+10]=o.z,W[O+11]=o.w,O+=12;if(ra&&H)if(p.length==3&&na)for(w=0;w<3;w++)u=p[w],ka[Z]=u.x,ka[Z+1]=u.y,ka[Z+2]=u.z,Z+=3;else for(w=0;w<3;w++)ka[Z]=u.x,ka[Z+1]=u.y,ka[Z+2]=u.z,
+Z+=3;if(wa&&G!==void 0&&x)for(w=0;w<3;w++)p=G[w],da[X]=p.u,da[X+1]=p.v,X+=2;if(wa&&J!==void 0&&x)for(w=0;w<3;w++)p=J[w],ea[Q]=p.u,ea[Q+1]=p.v,Q+=2;pa&&(qa[R]=L,qa[R+1]=L+1,qa[R+2]=L+2,R+=3,la[T]=L,la[T+1]=L+1,la[T+2]=L,la[T+3]=L+2,la[T+4]=L+1,la[T+5]=L+2,T+=6,L+=3)}else if(o instanceof THREE.Face4){if(sa)K=ua[o.a].position,D=ua[o.b].position,I=ua[o.c].position,V=ua[o.d].position,S[ga]=K.x,S[ga+1]=K.y,S[ga+2]=K.z,S[ga+3]=D.x,S[ga+4]=D.y,S[ga+5]=D.z,S[ga+6]=I.x,S[ga+7]=I.y,S[ga+8]=I.z,S[ga+9]=V.x,S[ga+
+10]=V.y,S[ga+11]=V.z,ga+=12;if(ha)for(U in ha)if(A=ha[U],A.__original.needsUpdate)E=A.offset,C=A.offsetSrc,A.size===1?(A.boundTo===void 0||A.boundTo==="vertices"?(A.array[E]=A.value[o.a],A.array[E+1]=A.value[o.b],A.array[E+2]=A.value[o.c],A.array[E+3]=A.value[o.d]):A.boundTo==="faces"?(C=A.value[C],A.array[E]=C,A.array[E+1]=C,A.array[E+2]=C,A.array[E+3]=C,A.offsetSrc++):A.boundTo==="faceVertices"&&(A.array[E]=A.value[C],A.array[E+1]=A.value[C+1],A.array[E+2]=A.value[C+2],A.array[E+3]=A.value[C+3],
+A.offsetSrc+=4),A.offset+=4):(A.boundTo===void 0||A.boundTo==="vertices"?(K=A.value[o.a],D=A.value[o.b],I=A.value[o.c],V=A.value[o.d]):A.boundTo==="faces"?(V=I=D=K=C=A.value[C],A.offsetSrc++):A.boundTo==="faceVertices"&&(K=A.value[C],D=A.value[C+1],I=A.value[C+2],V=A.value[C+3],A.offsetSrc+=4),A.size===2?(A.array[E]=K.x,A.array[E+1]=K.y,A.array[E+2]=D.x,A.array[E+3]=D.y,A.array[E+4]=I.x,A.array[E+5]=I.y,A.array[E+6]=V.x,A.array[E+7]=V.y,A.offset+=8):A.size===3?(A.type==="c"?(A.array[E]=K.r,A.array[E+
+1]=K.g,A.array[E+2]=K.b,A.array[E+3]=D.r,A.array[E+4]=D.g,A.array[E+5]=D.b,A.array[E+6]=I.r,A.array[E+7]=I.g,A.array[E+8]=I.b,A.array[E+9]=V.r,A.array[E+10]=V.g,A.array[E+11]=V.b):(A.array[E]=K.x,A.array[E+1]=K.y,A.array[E+2]=K.z,A.array[E+3]=D.x,A.array[E+4]=D.y,A.array[E+5]=D.z,A.array[E+6]=I.x,A.array[E+7]=I.y,A.array[E+8]=I.z,A.array[E+9]=V.x,A.array[E+10]=V.y,A.array[E+11]=V.z),A.offset+=12):(A.array[E]=K.x,A.array[E+1]=K.y,A.array[E+2]=K.z,A.array[E+3]=K.w,A.array[E+4]=D.x,A.array[E+5]=D.y,
+A.array[E+6]=D.z,A.array[E+7]=D.w,A.array[E+8]=I.x,A.array[E+9]=I.y,A.array[E+10]=I.z,A.array[E+11]=I.w,A.array[E+12]=V.x,A.array[E+13]=V.y,A.array[E+14]=V.z,A.array[E+15]=V.w,A.offset+=16));if(za){E=0;for(A=Fa.length;E<A;E++)K=Fa[E].vertices[o.a].position,D=Fa[E].vertices[o.b].position,I=Fa[E].vertices[o.c].position,V=Fa[E].vertices[o.d].position,C=ma[E],C[P]=K.x,C[P+1]=K.y,C[P+2]=K.z,C[P+3]=D.x,C[P+4]=D.y,C[P+5]=D.z,C[P+6]=I.x,C[P+7]=I.y,C[P+8]=I.z,C[P+9]=V.x,C[P+10]=V.y,C[P+11]=V.z;P+=12}if(Ga.length)E=
+Ga[o.a],A=Ga[o.b],C=Ga[o.c],M=Ga[o.d],$[N]=E.x,$[N+1]=E.y,$[N+2]=E.z,$[N+3]=E.w,$[N+4]=A.x,$[N+5]=A.y,$[N+6]=A.z,$[N+7]=A.w,$[N+8]=C.x,$[N+9]=C.y,$[N+10]=C.z,$[N+11]=C.w,$[N+12]=M.x,$[N+13]=M.y,$[N+14]=M.z,$[N+15]=M.w,E=Na[o.a],A=Na[o.b],C=Na[o.c],M=Na[o.d],ca[N]=E.x,ca[N+1]=E.y,ca[N+2]=E.z,ca[N+3]=E.w,ca[N+4]=A.x,ca[N+5]=A.y,ca[N+6]=A.z,ca[N+7]=A.w,ca[N+8]=C.x,ca[N+9]=C.y,ca[N+10]=C.z,ca[N+11]=C.w,ca[N+12]=M.x,ca[N+13]=M.y,ca[N+14]=M.z,ca[N+15]=M.w,E=xa[o.a],A=xa[o.b],C=xa[o.c],M=xa[o.d],Y[N]=E.x,
+Y[N+1]=E.y,Y[N+2]=E.z,Y[N+3]=1,Y[N+4]=A.x,Y[N+5]=A.y,Y[N+6]=A.z,Y[N+7]=1,Y[N+8]=C.x,Y[N+9]=C.y,Y[N+10]=C.z,Y[N+11]=1,Y[N+12]=M.x,Y[N+13]=M.y,Y[N+14]=M.z,Y[N+15]=1,E=ya[o.a],A=ya[o.b],C=ya[o.c],o=ya[o.d],fa[N]=E.x,fa[N+1]=E.y,fa[N+2]=E.z,fa[N+3]=1,fa[N+4]=A.x,fa[N+5]=A.y,fa[N+6]=A.z,fa[N+7]=1,fa[N+8]=C.x,fa[N+9]=C.y,fa[N+10]=C.z,fa[N+11]=1,fa[N+12]=o.x,fa[N+13]=o.y,fa[N+14]=o.z,fa[N+15]=1,N+=16;if(ta&&z)v.length==4&&z==THREE.VertexColors?(o=v[0],E=v[1],A=v[2],v=v[3]):v=A=E=o=y,aa[ja]=o.r,aa[ja+1]=
+o.g,aa[ja+2]=o.b,aa[ja+3]=E.r,aa[ja+4]=E.g,aa[ja+5]=E.b,aa[ja+6]=A.r,aa[ja+7]=A.g,aa[ja+8]=A.b,aa[ja+9]=v.r,aa[ja+10]=v.g,aa[ja+11]=v.b,ja+=12;if(Aa&&ia.hasTangents)v=w[0],y=w[1],o=w[2],w=w[3],W[O]=v.x,W[O+1]=v.y,W[O+2]=v.z,W[O+3]=v.w,W[O+4]=y.x,W[O+5]=y.y,W[O+6]=y.z,W[O+7]=y.w,W[O+8]=o.x,W[O+9]=o.y,W[O+10]=o.z,W[O+11]=o.w,W[O+12]=w.x,W[O+13]=w.y,W[O+14]=w.z,W[O+15]=w.w,O+=16;if(ra&&H)if(p.length==4&&na)for(w=0;w<4;w++)u=p[w],ka[Z]=u.x,ka[Z+1]=u.y,ka[Z+2]=u.z,Z+=3;else for(w=0;w<4;w++)ka[Z]=u.x,ka[Z+
+1]=u.y,ka[Z+2]=u.z,Z+=3;if(wa&&G!==void 0&&x)for(w=0;w<4;w++)p=G[w],da[X]=p.u,da[X+1]=p.v,X+=2;if(wa&&J!==void 0&&x)for(w=0;w<4;w++)p=J[w],ea[Q]=p.u,ea[Q+1]=p.v,Q+=2;pa&&(qa[R]=L,qa[R+1]=L+1,qa[R+2]=L+3,qa[R+3]=L+1,qa[R+4]=L+2,qa[R+5]=L+3,R+=6,la[T]=L,la[T+1]=L+1,la[T+2]=L,la[T+3]=L+3,la[T+4]=L+1,la[T+5]=L+2,la[T+6]=L+2,la[T+7]=L+3,T+=8,L+=4)}if(Ka){n=0;for(t=Ka.length;n<t;n++)qa[R]=Ka[n].a,qa[R+1]=Ka[n].b,qa[R+2]=Ka[n].c,qa[R+3]=Ka[n].a,qa[R+4]=Ka[n].c,qa[R+5]=Ka[n].d,R+=6}sa&&(k.bindBuffer(k.ARRAY_BUFFER,
+h.__webglVertexBuffer),k.bufferData(k.ARRAY_BUFFER,S,j));if(ha)for(U in ha)A=ha[U],A.__original.needsUpdate&&(k.bindBuffer(k.ARRAY_BUFFER,A.buffer),k.bufferData(k.ARRAY_BUFFER,A.array,j));if(za){E=0;for(A=Fa.length;E<A;E++)k.bindBuffer(k.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[E]),k.bufferData(k.ARRAY_BUFFER,ma[E],j)}ta&&ja>0&&(k.bindBuffer(k.ARRAY_BUFFER,h.__webglColorBuffer),k.bufferData(k.ARRAY_BUFFER,aa,j));ra&&(k.bindBuffer(k.ARRAY_BUFFER,h.__webglNormalBuffer),k.bufferData(k.ARRAY_BUFFER,
+ka,j));Aa&&ia.hasTangents&&(k.bindBuffer(k.ARRAY_BUFFER,h.__webglTangentBuffer),k.bufferData(k.ARRAY_BUFFER,W,j));wa&&X>0&&(k.bindBuffer(k.ARRAY_BUFFER,h.__webglUVBuffer),k.bufferData(k.ARRAY_BUFFER,da,j));wa&&Q>0&&(k.bindBuffer(k.ARRAY_BUFFER,h.__webglUV2Buffer),k.bufferData(k.ARRAY_BUFFER,ea,j));pa&&(k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,h.__webglFaceBuffer),k.bufferData(k.ELEMENT_ARRAY_BUFFER,qa,j),k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,h.__webglLineBuffer),k.bufferData(k.ELEMENT_ARRAY_BUFFER,la,j));
+N>0&&(k.bindBuffer(k.ARRAY_BUFFER,h.__webglSkinVertexABuffer),k.bufferData(k.ARRAY_BUFFER,Y,j),k.bindBuffer(k.ARRAY_BUFFER,h.__webglSkinVertexBBuffer),k.bufferData(k.ARRAY_BUFFER,fa,j),k.bindBuffer(k.ARRAY_BUFFER,h.__webglSkinIndicesBuffer),k.bufferData(k.ARRAY_BUFFER,ca,j),k.bindBuffer(k.ARRAY_BUFFER,h.__webglSkinWeightsBuffer),k.bufferData(k.ARRAY_BUFFER,$,j));m&&(delete h.__inittedArrays,delete h.__colorArray,delete h.__normalArray,delete h.__tangentArray,delete h.__uvArray,delete h.__uv2Array,
+delete h.__faceArray,delete h.__vertexArray,delete h.__lineArray,delete h.__skinVertexAArray,delete h.__skinVertexBArray,delete h.__skinIndexArray,delete h.__skinWeightArray)}}f.__dirtyVertices=!1;f.__dirtyMorphTargets=!1;f.__dirtyElements=!1;f.__dirtyUvs=!1;f.__dirtyNormals=!1;f.__dirtyTangents=!1;f.__dirtyColors=!1;F(g)}else if(b instanceof THREE.Ribbon){f=b.geometry;if(f.__dirtyVertices||f.__dirtyColors){b=f;e=k.DYNAMIC_DRAW;x=b.vertices;h=b.colors;z=x.length;j=h.length;H=b.__vertexArray;m=b.__colorArray;
+G=b.__dirtyColors;if(b.__dirtyVertices){for(n=0;n<z;n++)t=x[n].position,g=n*3,H[g]=t.x,H[g+1]=t.y,H[g+2]=t.z;k.bindBuffer(k.ARRAY_BUFFER,b.__webglVertexBuffer);k.bufferData(k.ARRAY_BUFFER,H,e)}if(G){for(n=0;n<j;n++)color=h[n],g=n*3,m[g]=color.r,m[g+1]=color.g,m[g+2]=color.b;k.bindBuffer(k.ARRAY_BUFFER,b.__webglColorBuffer);k.bufferData(k.ARRAY_BUFFER,m,e)}}f.__dirtyVertices=!1;f.__dirtyColors=!1}else if(b instanceof THREE.Line){f=b.geometry;if(f.__dirtyVertices||f.__dirtyColors){b=f;e=k.DYNAMIC_DRAW;
+x=b.vertices;h=b.colors;z=x.length;j=h.length;H=b.__vertexArray;m=b.__colorArray;G=b.__dirtyColors;if(b.__dirtyVertices){for(n=0;n<z;n++)t=x[n].position,g=n*3,H[g]=t.x,H[g+1]=t.y,H[g+2]=t.z;k.bindBuffer(k.ARRAY_BUFFER,b.__webglVertexBuffer);k.bufferData(k.ARRAY_BUFFER,H,e)}if(G){for(n=0;n<j;n++)color=h[n],g=n*3,m[g]=color.r,m[g+1]=color.g,m[g+2]=color.b;k.bindBuffer(k.ARRAY_BUFFER,b.__webglColorBuffer);k.bufferData(k.ARRAY_BUFFER,m,e)}}f.__dirtyVertices=!1;f.__dirtyColors=!1}else if(b instanceof THREE.ParticleSystem)f=
+b.geometry,h=B(f),(f.__dirtyVertices||f.__dirtyColors||b.sortParticles||h)&&c(f,k.DYNAMIC_DRAW,b),f.__dirtyVertices=!1,f.__dirtyColors=!1,F(f)}function D(b,e){var c;for(c=b.length-1;c>=0;c--)b[c].object==e&&b.splice(c,1)}function L(b){function e(b){var h=[];c=0;for(f=b.length;c<f;c++)b[c]==void 0?h.push("undefined"):h.push(b[c].id);return h.join("_")}var c,f,h,g,j,k,m,n,o={},t=b.morphTargets!==void 0?b.morphTargets.length:0;b.geometryGroups={};h=0;for(g=b.faces.length;h<g;h++)j=b.faces[h],k=j.materials,
+m=e(k),o[m]==void 0&&(o[m]={hash:m,counter:0}),n=o[m].hash+"_"+o[m].counter,b.geometryGroups[n]==void 0&&(b.geometryGroups[n]={faces:[],materials:k,vertices:0,numMorphTargets:t}),j=j instanceof THREE.Face3?3:4,b.geometryGroups[n].vertices+j>65535&&(o[m].counter+=1,n=o[m].hash+"_"+o[m].counter,b.geometryGroups[n]==void 0&&(b.geometryGroups[n]={faces:[],materials:k,vertices:0,numMorphTargets:t})),b.geometryGroups[n].faces.push(h),b.geometryGroups[n].vertices+=j}function G(b,c,e){b.push({buffer:c,object:e,
+opaque:{list:[],count:0},transparent:{list:[],count:0}})}function I(b){if(b!=fa){switch(b){case THREE.AdditiveBlending:k.blendEquation(k.FUNC_ADD);k.blendFunc(k.SRC_ALPHA,k.ONE);break;case THREE.SubtractiveBlending:k.blendEquation(k.FUNC_ADD);k.blendFunc(k.ZERO,k.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:k.blendEquation(k.FUNC_ADD);k.blendFunc(k.ZERO,k.SRC_COLOR);break;default:k.blendEquationSeparate(k.FUNC_ADD,k.FUNC_ADD),k.blendFuncSeparate(k.SRC_ALPHA,k.ONE_MINUS_SRC_ALPHA,k.ONE,k.ONE_MINUS_SRC_ALPHA)}fa=
+b}}function R(b,c,e){(e.width&e.width-1)==0&&(e.height&e.height-1)==0?(k.texParameteri(b,k.TEXTURE_WRAP_S,S(c.wrapS)),k.texParameteri(b,k.TEXTURE_WRAP_T,S(c.wrapT)),k.texParameteri(b,k.TEXTURE_MAG_FILTER,S(c.magFilter)),k.texParameteri(b,k.TEXTURE_MIN_FILTER,S(c.minFilter)),k.generateMipmap(b)):(k.texParameteri(b,k.TEXTURE_WRAP_S,k.CLAMP_TO_EDGE),k.texParameteri(b,k.TEXTURE_WRAP_T,k.CLAMP_TO_EDGE),k.texParameteri(b,k.TEXTURE_MAG_FILTER,ea(c.magFilter)),k.texParameteri(b,k.TEXTURE_MIN_FILTER,ea(c.minFilter)))}
+function da(b,c){if(b.needsUpdate){if(!b.__webglInit)b.__webglTexture=k.createTexture(),b.__webglInit=!0;k.bindTexture(k.TEXTURE_2D,b.__webglTexture);b.image.data?k.texImage2D(k.TEXTURE_2D,0,S(b.format),b.image.width,b.image.height,0,S(b.format),k.UNSIGNED_BYTE,b.image.data):k.texImage2D(k.TEXTURE_2D,0,k.RGBA,k.RGBA,k.UNSIGNED_BYTE,b.image);R(k.TEXTURE_2D,b,b.image);k.bindTexture(k.TEXTURE_2D,null);b.needsUpdate=!1}k.activeTexture(k.TEXTURE0+c);k.bindTexture(k.TEXTURE_2D,b.__webglTexture)}function T(b){if(b&&
+!b.__webglFramebuffer){if(b.depthBuffer===void 0)b.depthBuffer=!0;if(b.stencilBuffer===void 0)b.stencilBuffer=!0;b.__webglFramebuffer=k.createFramebuffer();b.__webglRenderbuffer=k.createRenderbuffer();b.__webglTexture=k.createTexture();k.bindTexture(k.TEXTURE_2D,b.__webglTexture);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_WRAP_S,S(b.wrapS));k.texParameteri(k.TEXTURE_2D,k.TEXTURE_WRAP_T,S(b.wrapT));k.texParameteri(k.TEXTURE_2D,k.TEXTURE_MAG_FILTER,S(b.magFilter));k.texParameteri(k.TEXTURE_2D,k.TEXTURE_MIN_FILTER,
+S(b.minFilter));k.texImage2D(k.TEXTURE_2D,0,S(b.format),b.width,b.height,0,S(b.format),S(b.type),null);k.bindRenderbuffer(k.RENDERBUFFER,b.__webglRenderbuffer);k.bindFramebuffer(k.FRAMEBUFFER,b.__webglFramebuffer);k.framebufferTexture2D(k.FRAMEBUFFER,k.COLOR_ATTACHMENT0,k.TEXTURE_2D,b.__webglTexture,0);b.depthBuffer&&!b.stencilBuffer?(k.renderbufferStorage(k.RENDERBUFFER,k.DEPTH_COMPONENT16,b.width,b.height),k.framebufferRenderbuffer(k.FRAMEBUFFER,k.DEPTH_ATTACHMENT,k.RENDERBUFFER,b.__webglRenderbuffer)):
+b.depthBuffer&&b.stencilBuffer?(k.renderbufferStorage(k.RENDERBUFFER,k.DEPTH_STENCIL,b.width,b.height),k.framebufferRenderbuffer(k.FRAMEBUFFER,k.DEPTH_STENCIL_ATTACHMENT,k.RENDERBUFFER,b.__webglRenderbuffer)):k.renderbufferStorage(k.RENDERBUFFER,k.RGBA4,b.width,b.height);k.bindTexture(k.TEXTURE_2D,null);k.bindRenderbuffer(k.RENDERBUFFER,null);k.bindFramebuffer(k.FRAMEBUFFER,null)}var c,e;b?(c=b.__webglFramebuffer,e=b.width,b=b.height):(c=null,e=K,b=V);c!=aa&&(k.bindFramebuffer(k.FRAMEBUFFER,c),k.viewport(la,
+sa,e,b),aa=c)}function C(b,c){var e;b=="fragment"?e=k.createShader(k.FRAGMENT_SHADER):b=="vertex"&&(e=k.createShader(k.VERTEX_SHADER));k.shaderSource(e,c);k.compileShader(e);if(!k.getShaderParameter(e,k.COMPILE_STATUS))return console.error(k.getShaderInfoLog(e)),console.error(c),null;return e}function ea(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return k.NEAREST;default:return k.LINEAR}}function S(b){switch(b){case THREE.RepeatWrapping:return k.REPEAT;
+case THREE.ClampToEdgeWrapping:return k.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return k.MIRRORED_REPEAT;case THREE.NearestFilter:return k.NEAREST;case THREE.NearestMipMapNearestFilter:return k.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return k.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return k.LINEAR;case THREE.LinearMipMapNearestFilter:return k.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return k.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return k.BYTE;
+case THREE.UnsignedByteType:return k.UNSIGNED_BYTE;case THREE.ShortType:return k.SHORT;case THREE.UnsignedShortType:return k.UNSIGNED_SHORT;case THREE.IntType:return k.INT;case THREE.UnsignedShortType:return k.UNSIGNED_INT;case THREE.FloatType:return k.FLOAT;case THREE.AlphaFormat:return k.ALPHA;case THREE.RGBFormat:return k.RGB;case THREE.RGBAFormat:return k.RGBA;case THREE.LuminanceFormat:return k.LUMINANCE;case THREE.LuminanceAlphaFormat:return k.LUMINANCE_ALPHA}return 0}var P=this,k,M=[],Y=null,
+aa=null,Z=!0,ha=null,ka=null,fa=null,U=null,X=null,ca=null,ma=null,la=0,sa=0,K=0,V=0,ga=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ja=new THREE.Matrix4,qa=new Float32Array(16),wa=new Float32Array(16),Aa=new THREE.Vector4,La={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},za=b.canvas!==void 0?b.canvas:document.createElement("canvas"),Oa=b.stencil!==void 0?
+b.stencil:!0,W=b.preserveDrawingBuffer!==void 0?b.preserveDrawingBuffer:!1,ta=b.antialias!==void 0?b.antialias:!1,na=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),ua=b.clearAlpha!==void 0?b.clearAlpha:0;this.data={vertices:0,faces:0,drawCalls:0};this.maxMorphTargets=8;this.domElement=za;this.sortObjects=this.autoClear=!0;this.shadowMapBias=0.0039;this.shadowMapDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCameraNear=1;this.shadowCameraFar=5E3;this.shadowCameraFov=
+50;this.shadowMap=[];this.shadowMapEnabled=!1;this.shadowMapSoft=!0;var ia,ra=[],b=THREE.ShaderLib.depthRGBA,xa=THREE.UniformsUtils.clone(b.uniforms),Ba=new THREE.MeshShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:xa}),pa=new THREE.MeshShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:xa,morphTargets:!0});Ba._shadowPass=!0;pa._shadowPass=!0;try{if(!(k=za.getContext("experimental-webgl",{antialias:ta,stencil:Oa,preserveDrawingBuffer:W})))throw"Error creating WebGL context.";
+console.log(navigator.userAgent+" | "+k.getParameter(k.VERSION)+" | "+k.getParameter(k.VENDOR)+" | "+k.getParameter(k.RENDERER)+" | "+k.getParameter(k.SHADING_LANGUAGE_VERSION))}catch(ya){console.error(ya)}k.clearColor(0,0,0,1);k.clearDepth(1);k.enable(k.DEPTH_TEST);k.depthFunc(k.LEQUAL);k.frontFace(k.CCW);k.cullFace(k.BACK);k.enable(k.CULL_FACE);k.enable(k.BLEND);k.blendEquation(k.FUNC_ADD);k.blendFunc(k.SRC_ALPHA,k.ONE_MINUS_SRC_ALPHA);k.clearColor(na.r,na.g,na.b,ua);this.context=k;var Da=k.getParameter(k.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>
+0;if(Oa){var $={};$.vertices=new Float32Array(12);$.faces=new Uint16Array(6);$.darkness=0.5;$.vertices[0]=-20;$.vertices[1]=-20;$.vertices[2]=-1;$.vertices[3]=20;$.vertices[4]=-20;$.vertices[5]=-1;$.vertices[6]=20;$.vertices[7]=20;$.vertices[8]=-1;$.vertices[9]=-20;$.vertices[10]=20;$.vertices[11]=-1;$.faces[0]=0;$.faces[1]=1;$.faces[2]=2;$.faces[3]=0;$.faces[4]=2;$.faces[5]=3;$.vertexBuffer=k.createBuffer();$.elementBuffer=k.createBuffer();k.bindBuffer(k.ARRAY_BUFFER,$.vertexBuffer);k.bufferData(k.ARRAY_BUFFER,
+$.vertices,k.STATIC_DRAW);k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,$.elementBuffer);k.bufferData(k.ELEMENT_ARRAY_BUFFER,$.faces,k.STATIC_DRAW);$.program=k.createProgram();k.attachShader($.program,C("fragment",THREE.ShaderLib.shadowPost.fragmentShader));k.attachShader($.program,C("vertex",THREE.ShaderLib.shadowPost.vertexShader));k.linkProgram($.program);$.vertexLocation=k.getAttribLocation($.program,"position");$.projectionLocation=k.getUniformLocation($.program,"projectionMatrix");$.darknessLocation=
+k.getUniformLocation($.program,"darkness")}var Q={};Q.vertices=new Float32Array(16);Q.faces=new Uint16Array(6);W=0;Q.vertices[W++]=-1;Q.vertices[W++]=-1;Q.vertices[W++]=0;Q.vertices[W++]=0;Q.vertices[W++]=1;Q.vertices[W++]=-1;Q.vertices[W++]=1;Q.vertices[W++]=0;Q.vertices[W++]=1;Q.vertices[W++]=1;Q.vertices[W++]=1;Q.vertices[W++]=1;Q.vertices[W++]=-1;Q.vertices[W++]=1;Q.vertices[W++]=0;Q.vertices[W++]=1;W=0;Q.faces[W++]=0;Q.faces[W++]=1;Q.faces[W++]=2;Q.faces[W++]=0;Q.faces[W++]=2;Q.faces[W++]=3;
+Q.vertexBuffer=k.createBuffer();Q.elementBuffer=k.createBuffer();Q.tempTexture=k.createTexture();Q.occlusionTexture=k.createTexture();k.bindBuffer(k.ARRAY_BUFFER,Q.vertexBuffer);k.bufferData(k.ARRAY_BUFFER,Q.vertices,k.STATIC_DRAW);k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,Q.elementBuffer);k.bufferData(k.ELEMENT_ARRAY_BUFFER,Q.faces,k.STATIC_DRAW);k.bindTexture(k.TEXTURE_2D,Q.tempTexture);k.texImage2D(k.TEXTURE_2D,0,k.RGB,16,16,0,k.RGB,k.UNSIGNED_BYTE,null);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_WRAP_S,
+k.CLAMP_TO_EDGE);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_WRAP_T,k.CLAMP_TO_EDGE);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_MAG_FILTER,k.NEAREST);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_MIN_FILTER,k.NEAREST);k.bindTexture(k.TEXTURE_2D,Q.occlusionTexture);k.texImage2D(k.TEXTURE_2D,0,k.RGBA,16,16,0,k.RGBA,k.UNSIGNED_BYTE,null);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_WRAP_S,k.CLAMP_TO_EDGE);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_WRAP_T,k.CLAMP_TO_EDGE);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_MAG_FILTER,k.NEAREST);
+k.texParameteri(k.TEXTURE_2D,k.TEXTURE_MIN_FILTER,k.NEAREST);k.getParameter(k.MAX_VERTEX_TEXTURE_IMAGE_UNITS)<=0?(Q.hasVertexTexture=!1,Q.program=k.createProgram(),k.attachShader(Q.program,C("fragment",THREE.ShaderLib.lensFlare.fragmentShader)),k.attachShader(Q.program,C("vertex",THREE.ShaderLib.lensFlare.vertexShader))):(Q.hasVertexTexture=!0,Q.program=k.createProgram(),k.attachShader(Q.program,C("fragment",THREE.ShaderLib.lensFlareVertexTexture.fragmentShader)),k.attachShader(Q.program,C("vertex",
+THREE.ShaderLib.lensFlareVertexTexture.vertexShader)));k.linkProgram(Q.program);Q.attributes={};Q.uniforms={};Q.attributes.vertex=k.getAttribLocation(Q.program,"position");Q.attributes.uv=k.getAttribLocation(Q.program,"UV");Q.uniforms.renderType=k.getUniformLocation(Q.program,"renderType");Q.uniforms.map=k.getUniformLocation(Q.program,"map");Q.uniforms.occlusionMap=k.getUniformLocation(Q.program,"occlusionMap");Q.uniforms.opacity=k.getUniformLocation(Q.program,"opacity");Q.uniforms.scale=k.getUniformLocation(Q.program,
+"scale");Q.uniforms.rotation=k.getUniformLocation(Q.program,"rotation");Q.uniforms.screenPosition=k.getUniformLocation(Q.program,"screenPosition");var Ea=!1,O={};O.vertices=new Float32Array(16);O.faces=new Uint16Array(6);W=0;O.vertices[W++]=-1;O.vertices[W++]=-1;O.vertices[W++]=0;O.vertices[W++]=1;O.vertices[W++]=1;O.vertices[W++]=-1;O.vertices[W++]=1;O.vertices[W++]=1;O.vertices[W++]=1;O.vertices[W++]=1;O.vertices[W++]=1;O.vertices[W++]=0;O.vertices[W++]=-1;O.vertices[W++]=1;O.vertices[W++]=0;W=
+O.vertices[W++]=0;O.faces[W++]=0;O.faces[W++]=1;O.faces[W++]=2;O.faces[W++]=0;O.faces[W++]=2;O.faces[W++]=3;O.vertexBuffer=k.createBuffer();O.elementBuffer=k.createBuffer();k.bindBuffer(k.ARRAY_BUFFER,O.vertexBuffer);k.bufferData(k.ARRAY_BUFFER,O.vertices,k.STATIC_DRAW);k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,O.elementBuffer);k.bufferData(k.ELEMENT_ARRAY_BUFFER,O.faces,k.STATIC_DRAW);O.program=k.createProgram();k.attachShader(O.program,C("fragment",THREE.ShaderLib.sprite.fragmentShader));k.attachShader(O.program,
+C("vertex",THREE.ShaderLib.sprite.vertexShader));k.linkProgram(O.program);O.attributes={};O.uniforms={};O.attributes.position=k.getAttribLocation(O.program,"position");O.attributes.uv=k.getAttribLocation(O.program,"uv");O.uniforms.uvOffset=k.getUniformLocation(O.program,"uvOffset");O.uniforms.uvScale=k.getUniformLocation(O.program,"uvScale");O.uniforms.rotation=k.getUniformLocation(O.program,"rotation");O.uniforms.scale=k.getUniformLocation(O.program,"scale");O.uniforms.alignment=k.getUniformLocation(O.program,
+"alignment");O.uniforms.map=k.getUniformLocation(O.program,"map");O.uniforms.opacity=k.getUniformLocation(O.program,"opacity");O.uniforms.useScreenCoordinates=k.getUniformLocation(O.program,"useScreenCoordinates");O.uniforms.affectedByDistance=k.getUniformLocation(O.program,"affectedByDistance");O.uniforms.screenPosition=k.getUniformLocation(O.program,"screenPosition");O.uniforms.modelViewMatrix=k.getUniformLocation(O.program,"modelViewMatrix");O.uniforms.projectionMatrix=k.getUniformLocation(O.program,
+"projectionMatrix");var Wa=!1;this.setSize=function(b,c){za.width=b;za.height=c;this.setViewport(0,0,za.width,za.height)};this.setViewport=function(b,c,e,f){la=b;sa=c;K=e;V=f;k.viewport(la,sa,K,V)};this.setScissor=function(b,c,e,f){k.scissor(b,c,e,f)};this.enableScissorTest=function(b){b?k.enable(k.SCISSOR_TEST):k.disable(k.SCISSOR_TEST)};this.enableDepthBufferWrite=function(b){Z=b;k.depthMask(b)};this.setClearColorHex=function(b,c){na.setHex(b);ua=c;k.clearColor(na.r,na.g,na.b,ua)};this.setClearColor=
+function(b,c){na.copy(b);ua=c;k.clearColor(na.r,na.g,na.b,ua)};this.clear=function(){k.clear(k.COLOR_BUFFER_BIT|k.DEPTH_BUFFER_BIT|k.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness=function(b){$.darkness=b};this.getContext=function(){return k};this.initMaterial=function(b,c,e,f){var h,g,j;b instanceof THREE.MeshDepthMaterial?j="depth":b instanceof THREE.ShadowVolumeDynamicMaterial?j="shadowVolumeDynamic":b instanceof THREE.MeshNormalMaterial?j="normal":b instanceof THREE.MeshBasicMaterial?j="basic":
+b instanceof THREE.MeshLambertMaterial?j="lambert":b instanceof THREE.MeshPhongMaterial?j="phong":b instanceof THREE.LineBasicMaterial?j="basic":b instanceof THREE.ParticleBasicMaterial&&(j="particle_basic");if(j){var m=THREE.ShaderLib[j];b.uniforms=THREE.UniformsUtils.clone(m.uniforms);b.vertexShader=m.vertexShader;b.fragmentShader=m.fragmentShader}var n,o,t;n=t=m=0;for(o=c.length;n<o;n++)g=c[n],g instanceof THREE.SpotLight&&t++,g instanceof THREE.DirectionalLight&&t++,g instanceof THREE.PointLight&&
+m++;m+t<=4?n=t:(n=Math.ceil(4*t/(m+t)),m=4-n);g={directional:n,point:m};m=t=0;for(n=c.length;m<n;m++)o=c[m],o instanceof THREE.SpotLight&&o.castShadow&&t++;var p=50;if(f!==void 0&&f instanceof THREE.SkinnedMesh)p=f.bones.length;var u;a:{n=b.fragmentShader;o=b.vertexShader;var m=b.uniforms,c=b.attributes,e={map:!!b.map,envMap:!!b.envMap,lightMap:!!b.lightMap,vertexColors:b.vertexColors,fog:e,sizeAttenuation:b.sizeAttenuation,skinning:b.skinning,morphTargets:b.morphTargets,maxMorphTargets:this.maxMorphTargets,
+maxDirLights:g.directional,maxPointLights:g.point,maxBones:p,shadowMapEnabled:this.shadowMapEnabled&&f.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:t,alphaTest:b.alphaTest},v,f=[];j?f.push(j):(f.push(n),f.push(o));for(v in e)f.push(v),f.push(e[v]);j=f.join();v=0;for(f=M.length;v<f;v++)if(M[v].code==j){u=M[v].program;break a}v=k.createProgram();f=[Da?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+e.maxDirLights,
+"#define MAX_POINT_LIGHTS "+e.maxPointLights,"#define MAX_SHADOWS "+e.maxShadows,"#define MAX_BONES "+e.maxBones,e.map?"#define USE_MAP":"",e.envMap?"#define USE_ENVMAP":"",e.lightMap?"#define USE_LIGHTMAP":"",e.vertexColors?"#define USE_COLOR":"",e.skinning?"#define USE_SKINNING":"",e.morphTargets?"#define USE_MORPHTARGETS":"",e.shadowMapEnabled?"#define USE_SHADOWMAP":"",e.shadowMapSoft?"#define SHADOWMAP_SOFT":"",e.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");
 g=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+e.maxDirLights,"#define MAX_POINT_LIGHTS "+e.maxPointLights,"#define MAX_SHADOWS "+e.maxShadows,e.alphaTest?"#define ALPHATEST "+e.alphaTest:"",e.fog?"#define USE_FOG":"",e.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",e.map?"#define USE_MAP":"",e.envMap?"#define USE_ENVMAP":"",e.lightMap?"#define USE_LIGHTMAP":"",e.vertexColors?"#define USE_COLOR":"",e.shadowMapEnabled?"#define USE_SHADOWMAP":"",e.shadowMapSoft?"#define SHADOWMAP_SOFT":
 "",e.shadowMapSoft?"#define SHADOWMAP_WIDTH "+e.shadowMapWidth.toFixed(1):"",e.shadowMapSoft?"#define SHADOWMAP_HEIGHT "+e.shadowMapHeight.toFixed(1):"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");k.attachShader(v,C("fragment",g+n));k.attachShader(v,C("vertex",f+o));k.linkProgram(v);k.getProgramParameter(v,k.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+k.getProgramParameter(v,k.VALIDATE_STATUS)+", gl error ["+k.getError()+"]");v.uniforms=
 {};v.attributes={};var w,f=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(w in m)f.push(w);w=f;f=0;for(m=w.length;f<m;f++)n=w[f],v.uniforms[n]=k.getUniformLocation(v,n);f=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(w=0;w<e.maxMorphTargets;w++)f.push("morphTarget"+w);for(u in c)f.push(u);u=f;w=0;for(c=u.length;w<c;w++)e=
@@ -496,8 +496,8 @@ THREE.CylinderGeometry=function(b,c,e,f,g,j){function h(b,c,e){m.vertices.push(n
 (g||0));for(n=b+b/2;n<2*b;n++)m.faces.push(new THREE.Face4(2*b+1,(2*n-2*b+2)%b+b,(2*n-2*b+1)%b+b,(2*n-2*b)%b+b))}n=0;for(b=this.faces.length;n<b;n++){var c=[],e=this.faces[n],g=this.vertices[e.a],j=this.vertices[e.b],o=this.vertices[e.c],t=this.vertices[e.d];c.push(new THREE.UV(0.5+Math.atan2(g.position.x,g.position.y)/p,0.5+g.position.z/f));c.push(new THREE.UV(0.5+Math.atan2(j.position.x,j.position.y)/p,0.5+j.position.z/f));c.push(new THREE.UV(0.5+Math.atan2(o.position.x,o.position.y)/p,0.5+o.position.z/
 f));e instanceof THREE.Face4&&c.push(new THREE.UV(0.5+Math.atan2(t.position.x,t.position.y)/p,0.5+t.position.z/f));this.faceVertexUvs[0].push(c)}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;THREE.ExtrudeGeometry=function(b,c){if(typeof b!="undefined"){THREE.Geometry.call(this);var b=b instanceof Array?b:[b],e,f=b.length,g;for(e=0;e<f;e++)g=b[e],this.addShape(g,c)}};
 THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;
-THREE.ExtrudeGeometry.prototype.addShape=function(b,c){function e(b,c,e){c||console.log("die");return c.clone().multiplyScalar(e).addSelf(b)}function f(b,c,e){var f=THREE.ExtrudeGeometry.__v1,h=THREE.ExtrudeGeometry.__v2,g=THREE.ExtrudeGeometry.__v3,j=THREE.ExtrudeGeometry.__v4,m=THREE.ExtrudeGeometry.__v5,k=THREE.ExtrudeGeometry.__v6;f.set(b.x-c.x,b.y-c.y);h.set(b.x-e.x,b.y-e.y);f=f.normalize();h=h.normalize();g.set(-f.y,f.x);j.set(h.y,-h.x);m.copy(b).addSelf(g);k.copy(b).addSelf(j);if(m.equals(k))return j.clone();
-m.copy(c).addSelf(g);k.copy(e).addSelf(j);g=f.dot(j);j=k.subSelf(m).dot(j);g==0&&(console.log("Either infinite or no solutions!"),j==0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));j/=g;if(j<0)return c=Math.atan2(c.y-b.y,c.x-b.x),b=Math.atan2(e.y-b.y,e.x-b.x),c>b&&(b+=Math.PI*2),anglec=(c+b)/2,new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));return f.multiplyScalar(j).addSelf(m).subSelf(b).clone()}function g(b){for(G=b.length;--G>=0;){aa=G;Z=G-1;Z<0&&(Z=b.length-
+THREE.ExtrudeGeometry.prototype.addShape=function(b,c){function e(b,c,e){c||console.log("die");return c.clone().multiplyScalar(e).addSelf(b)}function f(b,c,e){var f=THREE.ExtrudeGeometry.__v1,h=THREE.ExtrudeGeometry.__v2,g=THREE.ExtrudeGeometry.__v3,j=THREE.ExtrudeGeometry.__v4,k=THREE.ExtrudeGeometry.__v5,m=THREE.ExtrudeGeometry.__v6;f.set(b.x-c.x,b.y-c.y);h.set(b.x-e.x,b.y-e.y);f=f.normalize();h=h.normalize();g.set(-f.y,f.x);j.set(h.y,-h.x);k.copy(b).addSelf(g);m.copy(b).addSelf(j);if(k.equals(m))return j.clone();
+k.copy(c).addSelf(g);m.copy(e).addSelf(j);g=f.dot(j);j=m.subSelf(k).dot(j);g==0&&(console.log("Either infinite or no solutions!"),j==0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));j/=g;if(j<0)return c=Math.atan2(c.y-b.y,c.x-b.x),b=Math.atan2(e.y-b.y,e.x-b.x),c>b&&(b+=Math.PI*2),anglec=(c+b)/2,new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));return f.multiplyScalar(j).addSelf(k).subSelf(b).clone()}function g(b){for(G=b.length;--G>=0;){aa=G;Z=G-1;Z<0&&(Z=b.length-
 1);for(var c=0,c=0;c<u+o*2;c++){var e=ea*c,f=ea*(c+1),h=ha+aa+e,e=ha+Z+e,g=ha+Z+f,f=ha+aa+f;h+=L;e+=L;g+=L;f+=L;D.faces.push(new THREE.Face4(h,e,g,f))}}}function j(b,c,e){D.vertices.push(new THREE.Vertex(new THREE.Vector3(b,c,e)))}function h(b,c,e){b+=L;c+=L;e+=L;D.faces.push(new THREE.Face3(b,c,e))}var m=c.amount!==void 0?c.amount:100,n=c.bevelThickness!==void 0?c.bevelThickness:6,p=c.bevelSize!==void 0?c.bevelSize:n-2,o=c.bevelSegments!==void 0?c.bevelSegments:3,t=c.bevelEnabled!==void 0?c.bevelEnabled:
 !0,v=c.curveSegments!==void 0?c.curveSegments:12,u=c.steps!==void 0?c.steps:1,y=c.bendPath,z=c.extrudePath,x,w=!1,H=c.useSpacedPoints!==void 0?c.useSpacedPoints:!1;if(z)x=z.getPoints(v),u=x.length,w=!0,t=!1;t||(p=n=o=0);var B,F,J,D=this,L=this.vertices.length;y&&b.addWrapPath(y);v=H?b.extractAllSpacedPoints(v):b.extractAllPoints(v);y=v.shape;v=v.holes;if(z=!THREE.Shape.Utils.isClockWise(y)){y=y.reverse();F=0;for(J=v.length;F<J;F++)B=v[F],THREE.Shape.Utils.isClockWise(B)&&(v[F]=B.reverse());z=!1}z=
 THREE.Shape.Utils.triangulateShape(y,v);H=y;F=0;for(J=v.length;F<J;F++)B=v[F],y=y.concat(B);var G,I,R,da,T,C,ea=y.length,S=z.length,P=[];G=0;I=H.length;aa=I-1;for(Z=G+1;G<I;G++,aa++,Z++)aa==I&&(aa=0),Z==I&&(Z=0),P[G]=f(H[G],H[aa],H[Z]);var k=[],M,Y=P.concat();F=0;for(J=v.length;F<J;F++){B=v[F];M=[];G=0;I=B.length;aa=I-1;for(Z=G+1;G<I;G++,aa++,Z++)aa==I&&(aa=0),Z==I&&(Z=0),M[G]=f(B[G],B[aa],B[Z]);k.push(M);Y=Y.concat(M)}for(R=0;R<o;R++){da=R/o;T=n*(1-da);da=p*Math.sin(da*Math.PI/2);G=0;for(I=H.length;G<

+ 1 - 1
build/custom/ThreeCanvas.js

@@ -57,7 +57,7 @@ k=this.w,l=k*c+e*f-h*d,m=k*d+h*c-g*f,i=k*f+g*d-e*c,c=-g*c-e*d-h*f;b.x=l*k+c*-g+m
 THREE.Quaternion.slerp=function(a,b,c,d){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(f)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var g=Math.acos(f),e=Math.sqrt(1-f*f);if(Math.abs(e)<0.001)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;f=Math.sin((1-d)*g)/e;d=Math.sin(d*g)/e;c.w=a.w*f+b.w*d;c.x=a.x*f+b.x*d;c.y=a.y*f+b.y*d;c.z=a.z*f+b.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
 THREE.Face3=function(a,b,c,d,f,g){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3};
 THREE.Face4=function(a,b,c,d,f,g,e){this.a=a;this.b=b;this.c=c;this.d=d;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=e instanceof Array?e:[e];this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.set(a||0,b||0)};
-THREE.UV.prototype={constructor:THREE.UV,set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.edges=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
+THREE.UV.prototype={constructor:THREE.UV,set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.edges=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.dynamic=this.hasTangents=!1};
 THREE.Geometry.prototype={constructor:THREE.Geometry,computeCentroids:function(){var a,b,c;a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],c.centroid.set(0,0,0),c instanceof THREE.Face3?(c.centroid.addSelf(this.vertices[c.a].position),c.centroid.addSelf(this.vertices[c.b].position),c.centroid.addSelf(this.vertices[c.c].position),c.centroid.divideScalar(3)):c instanceof THREE.Face4&&(c.centroid.addSelf(this.vertices[c.a].position),c.centroid.addSelf(this.vertices[c.b].position),c.centroid.addSelf(this.vertices[c.c].position),
 c.centroid.addSelf(this.vertices[c.d].position),c.centroid.divideScalar(4))},computeFaceNormals:function(a){var b,c,d,f,g,e,h=new THREE.Vector3,k=new THREE.Vector3;d=0;for(f=this.faces.length;d<f;d++){g=this.faces[d];if(a&&g.vertexNormals.length){h.set(0,0,0);b=0;for(c=g.vertexNormals.length;b<c;b++)h.addSelf(g.vertexNormals[b]);h.divideScalar(3)}else b=this.vertices[g.a],c=this.vertices[g.b],e=this.vertices[g.c],h.sub(e.position,c.position),k.sub(b.position,c.position),h.crossSelf(k);h.isZero()||
 h.normalize();g.normal.copy(h)}},computeVertexNormals:function(){var a,b,c,d;if(this.__tmpVertices==void 0){d=this.__tmpVertices=Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)d[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++)if(c=this.faces[a],c instanceof THREE.Face3)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{d=

+ 1 - 1
build/custom/ThreeSVG.js

@@ -57,7 +57,7 @@ l=this.w,i=l*c+e*f-h*d,k=l*d+h*c-g*f,j=l*f+g*d-e*c,c=-g*c-e*d-h*f;b.x=i*l+c*-g+k
 THREE.Quaternion.slerp=function(a,b,c,d){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(f)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var g=Math.acos(f),e=Math.sqrt(1-f*f);if(Math.abs(e)<0.001)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;f=Math.sin((1-d)*g)/e;d=Math.sin(d*g)/e;c.w=a.w*f+b.w*d;c.x=a.x*f+b.x*d;c.y=a.y*f+b.y*d;c.z=a.z*f+b.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
 THREE.Face3=function(a,b,c,d,f,g){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3};
 THREE.Face4=function(a,b,c,d,f,g,e){this.a=a;this.b=b;this.c=c;this.d=d;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=e instanceof Array?e:[e];this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.set(a||0,b||0)};
-THREE.UV.prototype={constructor:THREE.UV,set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.edges=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
+THREE.UV.prototype={constructor:THREE.UV,set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.edges=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.dynamic=this.hasTangents=!1};
 THREE.Geometry.prototype={constructor:THREE.Geometry,computeCentroids:function(){var a,b,c;a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],c.centroid.set(0,0,0),c instanceof THREE.Face3?(c.centroid.addSelf(this.vertices[c.a].position),c.centroid.addSelf(this.vertices[c.b].position),c.centroid.addSelf(this.vertices[c.c].position),c.centroid.divideScalar(3)):c instanceof THREE.Face4&&(c.centroid.addSelf(this.vertices[c.a].position),c.centroid.addSelf(this.vertices[c.b].position),c.centroid.addSelf(this.vertices[c.c].position),
 c.centroid.addSelf(this.vertices[c.d].position),c.centroid.divideScalar(4))},computeFaceNormals:function(a){var b,c,d,f,g,e,h=new THREE.Vector3,l=new THREE.Vector3;d=0;for(f=this.faces.length;d<f;d++){g=this.faces[d];if(a&&g.vertexNormals.length){h.set(0,0,0);b=0;for(c=g.vertexNormals.length;b<c;b++)h.addSelf(g.vertexNormals[b]);h.divideScalar(3)}else b=this.vertices[g.a],c=this.vertices[g.b],e=this.vertices[g.c],h.sub(e.position,c.position),l.sub(b.position,c.position),h.crossSelf(l);h.isZero()||
 h.normalize();g.normal.copy(h)}},computeVertexNormals:function(){var a,b,c,d;if(this.__tmpVertices==void 0){d=this.__tmpVertices=Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)d[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++)if(c=this.faces[a],c instanceof THREE.Face3)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{d=

+ 22 - 22
build/custom/ThreeWebGL.js

@@ -57,7 +57,7 @@ k=this.w,q=k*e+g*h-j*f,n=k*f+j*e-i*h,r=k*h+i*f-g*e,e=-i*e-g*f-j*h;d.x=q*k+e*-i+n
 THREE.Quaternion.slerp=function(b,d,e,f){var h=b.w*d.w+b.x*d.x+b.y*d.y+b.z*d.z;if(Math.abs(h)>=1)return e.w=b.w,e.x=b.x,e.y=b.y,e.z=b.z,e;var i=Math.acos(h),g=Math.sqrt(1-h*h);if(Math.abs(g)<0.001)return e.w=0.5*(b.w+d.w),e.x=0.5*(b.x+d.x),e.y=0.5*(b.y+d.y),e.z=0.5*(b.z+d.z),e;h=Math.sin((1-f)*i)/g;f=Math.sin(f*i)/g;e.w=b.w*h+d.w*f;e.x=b.x*h+d.x*f;e.y=b.y*h+d.y*f;e.z=b.z*h+d.z*f;return e};THREE.Vertex=function(b){this.position=b||new THREE.Vector3};
 THREE.Face3=function(b,d,e,f,h,i){this.a=b;this.b=d;this.c=e;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.vertexTangents=[];this.materials=i instanceof Array?i:[i];this.centroid=new THREE.Vector3};
 THREE.Face4=function(b,d,e,f,h,i,g){this.a=b;this.b=d;this.c=e;this.d=f;this.normal=h instanceof THREE.Vector3?h:new THREE.Vector3;this.vertexNormals=h instanceof Array?h:[];this.color=i instanceof THREE.Color?i:new THREE.Color;this.vertexColors=i instanceof Array?i:[];this.vertexTangents=[];this.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3};THREE.UV=function(b,d){this.set(b||0,d||0)};
-THREE.UV.prototype={constructor:THREE.UV,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.edges=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
+THREE.UV.prototype={constructor:THREE.UV,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.edges=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.dynamic=this.hasTangents=!1};
 THREE.Geometry.prototype={constructor:THREE.Geometry,computeCentroids:function(){var b,d,e;b=0;for(d=this.faces.length;b<d;b++)e=this.faces[b],e.centroid.set(0,0,0),e instanceof THREE.Face3?(e.centroid.addSelf(this.vertices[e.a].position),e.centroid.addSelf(this.vertices[e.b].position),e.centroid.addSelf(this.vertices[e.c].position),e.centroid.divideScalar(3)):e instanceof THREE.Face4&&(e.centroid.addSelf(this.vertices[e.a].position),e.centroid.addSelf(this.vertices[e.b].position),e.centroid.addSelf(this.vertices[e.c].position),
 e.centroid.addSelf(this.vertices[e.d].position),e.centroid.divideScalar(4))},computeFaceNormals:function(b){var d,e,f,h,i,g,j=new THREE.Vector3,k=new THREE.Vector3;f=0;for(h=this.faces.length;f<h;f++){i=this.faces[f];if(b&&i.vertexNormals.length){j.set(0,0,0);d=0;for(e=i.vertexNormals.length;d<e;d++)j.addSelf(i.vertexNormals[d]);j.divideScalar(3)}else d=this.vertices[i.a],e=this.vertices[i.b],g=this.vertices[i.c],j.sub(g.position,e.position),k.sub(d.position,e.position),j.crossSelf(k);j.isZero()||
 j.normalize();i.normal.copy(j)}},computeVertexNormals:function(){var b,d,e,f;if(this.__tmpVertices==void 0){f=this.__tmpVertices=Array(this.vertices.length);b=0;for(d=this.vertices.length;b<d;b++)f[b]=new THREE.Vector3;b=0;for(d=this.faces.length;b<d;b++)if(e=this.faces[b],e instanceof THREE.Face3)e.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(e instanceof THREE.Face4)e.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{f=
@@ -229,27 +229,27 @@ c.disable(c.CULL_FACE);c.depthMask(!1);c.activeTexture(c.TEXTURE0);c.bindTexture
 0,c.RGB,w[0]-8,w[1]-8,16,16,0);c.uniform1i(v.renderType,0);c.uniform2fv(v.scale,t);c.uniform3fv(v.screenPosition,o);c.disable(c.BLEND);c.enable(c.DEPTH_TEST);c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0);c.bindTexture(c.TEXTURE_2D,A.occlusionTexture);c.copyTexImage2D(c.TEXTURE_2D,0,c.RGBA,w[0]-8,w[1]-8,16,16,0);c.uniform1i(v.renderType,1);c.disable(c.DEPTH_TEST);c.bindTexture(c.TEXTURE_2D,A.tempTexture);c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0);d.positionScreen.x=o[0];d.positionScreen.y=
 o[1];d.positionScreen.z=o[2];d.customUpdateCallback?d.customUpdateCallback(d):d.updateLensFlares();c.uniform1i(v.renderType,2);c.enable(c.BLEND);h=0;for(i=d.lensFlares.length;h<i;h++)if(j=d.lensFlares[h],j.opacity>0.001&&j.scale>0.001)o[0]=j.x,o[1]=j.y,o[2]=j.z,r=j.size*j.scale/qa,t[0]=r*q,t[1]=r,c.uniform3fv(v.screenPosition,o),c.uniform2fv(v.scale,t),c.uniform1f(v.rotation,j.rotation),c.uniform1f(v.opacity,j.opacity),M(j.blending),ra(j.texture,1),c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0)}c.enable(c.CULL_FACE);
 c.enable(c.DEPTH_TEST);c.depthMask(L)}function U(b,c,d){b._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);d&&THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}function ta(b){var c,d,e,f;f=b.__materials;b=0;for(d=f.length;b<d;b++)if(e=f[b],e.attributes)for(c in e.attributes)if(e.attributes[c].needsUpdate)return!0;return!1}function fa(b){var c,d,e,f;f=b.__materials;b=0;for(d=f.length;b<d;b++)if(e=f[b],e.attributes)for(c in e.attributes)e.attributes[c].needsUpdate=
-!1}function I(b){var e,f,g,h;if(b instanceof THREE.Mesh){f=b.geometry;for(e in f.geometryGroups)if(g=f.geometryGroups[e],h=ta(g),f.__dirtyVertices||f.__dirtyMorphTargets||f.__dirtyElements||f.__dirtyUvs||f.__dirtyNormals||f.__dirtyColors||f.__dirtyTangents||h){h=g;var i=b,j=c.DYNAMIC_DRAW;if(h.__inittedArrays){var k=void 0,q=void 0,n=void 0,p=void 0,r=n=void 0,C=void 0,t=void 0,o=void 0,w=void 0,v=void 0,A=void 0,E=void 0,F=void 0,x=void 0,y=void 0,u=void 0,G=void 0,s=p=o=p=t=C=void 0,m=void 0,B=
-m=s=C=void 0,K=void 0,L=B=m=s=n=n=r=o=p=B=m=s=K=B=m=s=K=B=m=s=void 0,I=0,J=0,R=0,S=0,M=0,N=0,V=0,O=0,ea=0,z=0,ga=0,B=s=0,B=void 0,ia=h.__vertexArray,aa=h.__uvArray,ca=h.__uv2Array,Q=h.__normalArray,W=h.__tangentArray,ja=h.__colorArray,X=h.__skinVertexAArray,Y=h.__skinVertexBArray,Z=h.__skinIndexArray,$=h.__skinWeightArray,da=h.__morphTargetsArrays,U=h.__webglCustomAttributes,m=void 0,P=h.__faceArray,T=h.__lineArray,ma=h.__needsSmoothNormals,v=h.__vertexColorType,w=h.__uvType,A=h.__normalType,oa=i.geometry,
-la=oa.__dirtyVertices,na=oa.__dirtyElements,ha=oa.__dirtyUvs,pa=oa.__dirtyNormals,qa=oa.__dirtyTangents,ra=oa.__dirtyColors,sa=oa.__dirtyMorphTargets,ka=oa.vertices,ua=h.faces,va=oa.faces,wa=oa.faceVertexUvs[0],xa=oa.faceVertexUvs[1],Da=oa.skinVerticesA,Ea=oa.skinVerticesB,Fa=oa.skinIndices,za=oa.skinWeights,Aa=i instanceof THREE.ShadowVolume?oa.edgeFaces:void 0,ya=oa.morphTargets;if(U)for(L in U)U[L].offset=0,U[L].offsetSrc=0;k=0;for(q=ua.length;k<q;k++)if(n=ua[k],p=va[n],wa&&(E=wa[n]),xa&&(F=xa[n]),
-n=p.vertexNormals,r=p.normal,C=p.vertexColors,t=p.color,o=p.vertexTangents,p instanceof THREE.Face3){if(la)x=ka[p.a].position,y=ka[p.b].position,u=ka[p.c].position,ia[J]=x.x,ia[J+1]=x.y,ia[J+2]=x.z,ia[J+3]=y.x,ia[J+4]=y.y,ia[J+5]=y.z,ia[J+6]=u.x,ia[J+7]=u.y,ia[J+8]=u.z,J+=9;if(U)for(L in U)if(m=U[L],m.__original.needsUpdate)s=m.offset,B=m.offsetSrc,m.size===1?(m.boundTo===void 0||m.boundTo==="vertices"?(m.array[s]=m.value[p.a],m.array[s+1]=m.value[p.b],m.array[s+2]=m.value[p.c]):m.boundTo==="faces"?
-(B=m.value[B],m.array[s]=B,m.array[s+1]=B,m.array[s+2]=B,m.offsetSrc++):m.boundTo==="faceVertices"&&(m.array[s]=m.value[B],m.array[s+1]=m.value[B+1],m.array[s+2]=m.value[B+2],m.offsetSrc+=3),m.offset+=3):(m.boundTo===void 0||m.boundTo==="vertices"?(x=m.value[p.a],y=m.value[p.b],u=m.value[p.c]):m.boundTo==="faces"?(u=y=x=B=m.value[B],m.offsetSrc++):m.boundTo==="faceVertices"&&(x=m.value[B],y=m.value[B+1],u=m.value[B+2],m.offsetSrc+=3),m.size===2?(m.array[s]=x.x,m.array[s+1]=x.y,m.array[s+2]=y.x,m.array[s+
-3]=y.y,m.array[s+4]=u.x,m.array[s+5]=u.y,m.offset+=6):m.size===3?(m.type==="c"?(m.array[s]=x.r,m.array[s+1]=x.g,m.array[s+2]=x.b,m.array[s+3]=y.r,m.array[s+4]=y.g,m.array[s+5]=y.b,m.array[s+6]=u.r,m.array[s+7]=u.g,m.array[s+8]=u.b):(m.array[s]=x.x,m.array[s+1]=x.y,m.array[s+2]=x.z,m.array[s+3]=y.x,m.array[s+4]=y.y,m.array[s+5]=y.z,m.array[s+6]=u.x,m.array[s+7]=u.y,m.array[s+8]=u.z),m.offset+=9):(m.array[s]=x.x,m.array[s+1]=x.y,m.array[s+2]=x.z,m.array[s+3]=x.w,m.array[s+4]=y.x,m.array[s+5]=y.y,m.array[s+
-6]=y.z,m.array[s+7]=y.w,m.array[s+8]=u.x,m.array[s+9]=u.y,m.array[s+10]=u.z,m.array[s+11]=u.w,m.offset+=12));if(sa){s=0;for(m=ya.length;s<m;s++)x=ya[s].vertices[p.a].position,y=ya[s].vertices[p.b].position,u=ya[s].vertices[p.c].position,B=da[s],B[ga]=x.x,B[ga+1]=x.y,B[ga+2]=x.z,B[ga+3]=y.x,B[ga+4]=y.y,B[ga+5]=y.z,B[ga+6]=u.x,B[ga+7]=u.y,B[ga+8]=u.z;ga+=9}if(za.length)s=za[p.a],m=za[p.b],B=za[p.c],$[z]=s.x,$[z+1]=s.y,$[z+2]=s.z,$[z+3]=s.w,$[z+4]=m.x,$[z+5]=m.y,$[z+6]=m.z,$[z+7]=m.w,$[z+8]=B.x,$[z+
-9]=B.y,$[z+10]=B.z,$[z+11]=B.w,s=Fa[p.a],m=Fa[p.b],B=Fa[p.c],Z[z]=s.x,Z[z+1]=s.y,Z[z+2]=s.z,Z[z+3]=s.w,Z[z+4]=m.x,Z[z+5]=m.y,Z[z+6]=m.z,Z[z+7]=m.w,Z[z+8]=B.x,Z[z+9]=B.y,Z[z+10]=B.z,Z[z+11]=B.w,s=Da[p.a],m=Da[p.b],B=Da[p.c],X[z]=s.x,X[z+1]=s.y,X[z+2]=s.z,X[z+3]=1,X[z+4]=m.x,X[z+5]=m.y,X[z+6]=m.z,X[z+7]=1,X[z+8]=B.x,X[z+9]=B.y,X[z+10]=B.z,X[z+11]=1,s=Ea[p.a],m=Ea[p.b],B=Ea[p.c],Y[z]=s.x,Y[z+1]=s.y,Y[z+2]=s.z,Y[z+3]=1,Y[z+4]=m.x,Y[z+5]=m.y,Y[z+6]=m.z,Y[z+7]=1,Y[z+8]=B.x,Y[z+9]=B.y,Y[z+10]=B.z,Y[z+11]=
-1,z+=12;if(ra&&v)C.length==3&&v==THREE.VertexColors?(p=C[0],s=C[1],m=C[2]):m=s=p=t,ja[ea]=p.r,ja[ea+1]=p.g,ja[ea+2]=p.b,ja[ea+3]=s.r,ja[ea+4]=s.g,ja[ea+5]=s.b,ja[ea+6]=m.r,ja[ea+7]=m.g,ja[ea+8]=m.b,ea+=9;if(qa&&oa.hasTangents)C=o[0],t=o[1],p=o[2],W[V]=C.x,W[V+1]=C.y,W[V+2]=C.z,W[V+3]=C.w,W[V+4]=t.x,W[V+5]=t.y,W[V+6]=t.z,W[V+7]=t.w,W[V+8]=p.x,W[V+9]=p.y,W[V+10]=p.z,W[V+11]=p.w,V+=12;if(pa&&A)if(n.length==3&&ma)for(o=0;o<3;o++)r=n[o],Q[N]=r.x,Q[N+1]=r.y,Q[N+2]=r.z,N+=3;else for(o=0;o<3;o++)Q[N]=r.x,
-Q[N+1]=r.y,Q[N+2]=r.z,N+=3;if(ha&&E!==void 0&&w)for(o=0;o<3;o++)n=E[o],aa[R]=n.u,aa[R+1]=n.v,R+=2;if(ha&&F!==void 0&&w)for(o=0;o<3;o++)n=F[o],ca[S]=n.u,ca[S+1]=n.v,S+=2;na&&(P[M]=I,P[M+1]=I+1,P[M+2]=I+2,M+=3,T[O]=I,T[O+1]=I+1,T[O+2]=I,T[O+3]=I+2,T[O+4]=I+1,T[O+5]=I+2,O+=6,I+=3)}else if(p instanceof THREE.Face4){if(la)x=ka[p.a].position,y=ka[p.b].position,u=ka[p.c].position,G=ka[p.d].position,ia[J]=x.x,ia[J+1]=x.y,ia[J+2]=x.z,ia[J+3]=y.x,ia[J+4]=y.y,ia[J+5]=y.z,ia[J+6]=u.x,ia[J+7]=u.y,ia[J+8]=u.z,
-ia[J+9]=G.x,ia[J+10]=G.y,ia[J+11]=G.z,J+=12;if(U)for(L in U)if(m=U[L],m.__original.needsUpdate)s=m.offset,B=m.offsetSrc,m.size===1?(m.boundTo===void 0||m.boundTo==="vertices"?(m.array[s]=m.value[p.a],m.array[s+1]=m.value[p.b],m.array[s+2]=m.value[p.c],m.array[s+3]=m.value[p.d]):m.boundTo==="faces"?(B=m.value[B],m.array[s]=B,m.array[s+1]=B,m.array[s+2]=B,m.array[s+3]=B,m.offsetSrc++):m.boundTo==="faceVertices"&&(m.array[s]=m.value[B],m.array[s+1]=m.value[B+1],m.array[s+2]=m.value[B+2],m.array[s+3]=
-m.value[B+3],m.offsetSrc+=4),m.offset+=4):(m.boundTo===void 0||m.boundTo==="vertices"?(x=m.value[p.a],y=m.value[p.b],u=m.value[p.c],G=m.value[p.d]):m.boundTo==="faces"?(G=u=y=x=B=m.value[B],m.offsetSrc++):m.boundTo==="faceVertices"&&(x=m.value[B],y=m.value[B+1],u=m.value[B+2],G=m.value[B+3],m.offsetSrc+=4),m.size===2?(m.array[s]=x.x,m.array[s+1]=x.y,m.array[s+2]=y.x,m.array[s+3]=y.y,m.array[s+4]=u.x,m.array[s+5]=u.y,m.array[s+6]=G.x,m.array[s+7]=G.y,m.offset+=8):m.size===3?(m.type==="c"?(m.array[s]=
-x.r,m.array[s+1]=x.g,m.array[s+2]=x.b,m.array[s+3]=y.r,m.array[s+4]=y.g,m.array[s+5]=y.b,m.array[s+6]=u.r,m.array[s+7]=u.g,m.array[s+8]=u.b,m.array[s+9]=G.r,m.array[s+10]=G.g,m.array[s+11]=G.b):(m.array[s]=x.x,m.array[s+1]=x.y,m.array[s+2]=x.z,m.array[s+3]=y.x,m.array[s+4]=y.y,m.array[s+5]=y.z,m.array[s+6]=u.x,m.array[s+7]=u.y,m.array[s+8]=u.z,m.array[s+9]=G.x,m.array[s+10]=G.y,m.array[s+11]=G.z),m.offset+=12):(m.array[s]=x.x,m.array[s+1]=x.y,m.array[s+2]=x.z,m.array[s+3]=x.w,m.array[s+4]=y.x,m.array[s+
-5]=y.y,m.array[s+6]=y.z,m.array[s+7]=y.w,m.array[s+8]=u.x,m.array[s+9]=u.y,m.array[s+10]=u.z,m.array[s+11]=u.w,m.array[s+12]=G.x,m.array[s+13]=G.y,m.array[s+14]=G.z,m.array[s+15]=G.w,m.offset+=16));if(sa){s=0;for(m=ya.length;s<m;s++)x=ya[s].vertices[p.a].position,y=ya[s].vertices[p.b].position,u=ya[s].vertices[p.c].position,G=ya[s].vertices[p.d].position,B=da[s],B[ga]=x.x,B[ga+1]=x.y,B[ga+2]=x.z,B[ga+3]=y.x,B[ga+4]=y.y,B[ga+5]=y.z,B[ga+6]=u.x,B[ga+7]=u.y,B[ga+8]=u.z,B[ga+9]=G.x,B[ga+10]=G.y,B[ga+
-11]=G.z;ga+=12}if(za.length)s=za[p.a],m=za[p.b],B=za[p.c],K=za[p.d],$[z]=s.x,$[z+1]=s.y,$[z+2]=s.z,$[z+3]=s.w,$[z+4]=m.x,$[z+5]=m.y,$[z+6]=m.z,$[z+7]=m.w,$[z+8]=B.x,$[z+9]=B.y,$[z+10]=B.z,$[z+11]=B.w,$[z+12]=K.x,$[z+13]=K.y,$[z+14]=K.z,$[z+15]=K.w,s=Fa[p.a],m=Fa[p.b],B=Fa[p.c],K=Fa[p.d],Z[z]=s.x,Z[z+1]=s.y,Z[z+2]=s.z,Z[z+3]=s.w,Z[z+4]=m.x,Z[z+5]=m.y,Z[z+6]=m.z,Z[z+7]=m.w,Z[z+8]=B.x,Z[z+9]=B.y,Z[z+10]=B.z,Z[z+11]=B.w,Z[z+12]=K.x,Z[z+13]=K.y,Z[z+14]=K.z,Z[z+15]=K.w,s=Da[p.a],m=Da[p.b],B=Da[p.c],K=Da[p.d],
-X[z]=s.x,X[z+1]=s.y,X[z+2]=s.z,X[z+3]=1,X[z+4]=m.x,X[z+5]=m.y,X[z+6]=m.z,X[z+7]=1,X[z+8]=B.x,X[z+9]=B.y,X[z+10]=B.z,X[z+11]=1,X[z+12]=K.x,X[z+13]=K.y,X[z+14]=K.z,X[z+15]=1,s=Ea[p.a],m=Ea[p.b],B=Ea[p.c],p=Ea[p.d],Y[z]=s.x,Y[z+1]=s.y,Y[z+2]=s.z,Y[z+3]=1,Y[z+4]=m.x,Y[z+5]=m.y,Y[z+6]=m.z,Y[z+7]=1,Y[z+8]=B.x,Y[z+9]=B.y,Y[z+10]=B.z,Y[z+11]=1,Y[z+12]=p.x,Y[z+13]=p.y,Y[z+14]=p.z,Y[z+15]=1,z+=16;if(ra&&v)C.length==4&&v==THREE.VertexColors?(p=C[0],s=C[1],m=C[2],C=C[3]):C=m=s=p=t,ja[ea]=p.r,ja[ea+1]=p.g,ja[ea+
-2]=p.b,ja[ea+3]=s.r,ja[ea+4]=s.g,ja[ea+5]=s.b,ja[ea+6]=m.r,ja[ea+7]=m.g,ja[ea+8]=m.b,ja[ea+9]=C.r,ja[ea+10]=C.g,ja[ea+11]=C.b,ea+=12;if(qa&&oa.hasTangents)C=o[0],t=o[1],p=o[2],o=o[3],W[V]=C.x,W[V+1]=C.y,W[V+2]=C.z,W[V+3]=C.w,W[V+4]=t.x,W[V+5]=t.y,W[V+6]=t.z,W[V+7]=t.w,W[V+8]=p.x,W[V+9]=p.y,W[V+10]=p.z,W[V+11]=p.w,W[V+12]=o.x,W[V+13]=o.y,W[V+14]=o.z,W[V+15]=o.w,V+=16;if(pa&&A)if(n.length==4&&ma)for(o=0;o<4;o++)r=n[o],Q[N]=r.x,Q[N+1]=r.y,Q[N+2]=r.z,N+=3;else for(o=0;o<4;o++)Q[N]=r.x,Q[N+1]=r.y,Q[N+
-2]=r.z,N+=3;if(ha&&E!==void 0&&w)for(o=0;o<4;o++)n=E[o],aa[R]=n.u,aa[R+1]=n.v,R+=2;if(ha&&F!==void 0&&w)for(o=0;o<4;o++)n=F[o],ca[S]=n.u,ca[S+1]=n.v,S+=2;na&&(P[M]=I,P[M+1]=I+1,P[M+2]=I+3,P[M+3]=I+1,P[M+4]=I+2,P[M+5]=I+3,M+=6,T[O]=I,T[O+1]=I+1,T[O+2]=I,T[O+3]=I+3,T[O+4]=I+1,T[O+5]=I+2,T[O+6]=I+2,T[O+7]=I+3,O+=8,I+=4)}if(Aa){k=0;for(q=Aa.length;k<q;k++)P[M]=Aa[k].a,P[M+1]=Aa[k].b,P[M+2]=Aa[k].c,P[M+3]=Aa[k].a,P[M+4]=Aa[k].c,P[M+5]=Aa[k].d,M+=6}la&&(c.bindBuffer(c.ARRAY_BUFFER,h.__webglVertexBuffer),
-c.bufferData(c.ARRAY_BUFFER,ia,j));if(U)for(L in U)m=U[L],m.__original.needsUpdate&&(c.bindBuffer(c.ARRAY_BUFFER,m.buffer),c.bufferData(c.ARRAY_BUFFER,m.array,j));if(sa){s=0;for(m=ya.length;s<m;s++)c.bindBuffer(c.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[s]),c.bufferData(c.ARRAY_BUFFER,da[s],j)}ra&&ea>0&&(c.bindBuffer(c.ARRAY_BUFFER,h.__webglColorBuffer),c.bufferData(c.ARRAY_BUFFER,ja,j));pa&&(c.bindBuffer(c.ARRAY_BUFFER,h.__webglNormalBuffer),c.bufferData(c.ARRAY_BUFFER,Q,j));qa&&oa.hasTangents&&
-(c.bindBuffer(c.ARRAY_BUFFER,h.__webglTangentBuffer),c.bufferData(c.ARRAY_BUFFER,W,j));ha&&R>0&&(c.bindBuffer(c.ARRAY_BUFFER,h.__webglUVBuffer),c.bufferData(c.ARRAY_BUFFER,aa,j));ha&&S>0&&(c.bindBuffer(c.ARRAY_BUFFER,h.__webglUV2Buffer),c.bufferData(c.ARRAY_BUFFER,ca,j));na&&(c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,h.__webglFaceBuffer),c.bufferData(c.ELEMENT_ARRAY_BUFFER,P,j),c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,h.__webglLineBuffer),c.bufferData(c.ELEMENT_ARRAY_BUFFER,T,j));z>0&&(c.bindBuffer(c.ARRAY_BUFFER,
-h.__webglSkinVertexABuffer),c.bufferData(c.ARRAY_BUFFER,X,j),c.bindBuffer(c.ARRAY_BUFFER,h.__webglSkinVertexBBuffer),c.bufferData(c.ARRAY_BUFFER,Y,j),c.bindBuffer(c.ARRAY_BUFFER,h.__webglSkinIndicesBuffer),c.bufferData(c.ARRAY_BUFFER,Z,j),c.bindBuffer(c.ARRAY_BUFFER,h.__webglSkinWeightsBuffer),c.bufferData(c.ARRAY_BUFFER,$,j));i.dynamic||(delete h.__inittedArrays,delete h.__colorArray,delete h.__normalArray,delete h.__tangentArray,delete h.__uvArray,delete h.__uv2Array,delete h.__faceArray,delete h.__vertexArray,
+!1}function I(b){var e,f,g,h;if(b instanceof THREE.Mesh){f=b.geometry;for(e in f.geometryGroups)if(g=f.geometryGroups[e],h=ta(g),f.__dirtyVertices||f.__dirtyMorphTargets||f.__dirtyElements||f.__dirtyUvs||f.__dirtyNormals||f.__dirtyColors||f.__dirtyTangents||h){h=g;var i=c.DYNAMIC_DRAW,j=!f.dynamic;if(h.__inittedArrays){var k=void 0,q=void 0,n=void 0,p=void 0,r=n=void 0,C=void 0,t=void 0,o=void 0,w=void 0,v=void 0,A=void 0,E=void 0,F=void 0,x=void 0,y=void 0,u=void 0,G=void 0,s=p=o=p=t=C=void 0,m=
+void 0,B=m=s=C=void 0,K=void 0,L=B=m=s=n=n=r=o=p=B=m=s=K=B=m=s=K=B=m=s=void 0,I=0,J=0,R=0,S=0,M=0,N=0,V=0,O=0,ea=0,z=0,ga=0,B=s=0,B=void 0,ia=h.__vertexArray,aa=h.__uvArray,ca=h.__uv2Array,Q=h.__normalArray,W=h.__tangentArray,ja=h.__colorArray,X=h.__skinVertexAArray,Y=h.__skinVertexBArray,Z=h.__skinIndexArray,$=h.__skinWeightArray,da=h.__morphTargetsArrays,U=h.__webglCustomAttributes,m=void 0,P=h.__faceArray,T=h.__lineArray,ma=h.__needsSmoothNormals,v=h.__vertexColorType,w=h.__uvType,A=h.__normalType,
+oa=b.geometry,la=oa.__dirtyVertices,na=oa.__dirtyElements,ha=oa.__dirtyUvs,pa=oa.__dirtyNormals,qa=oa.__dirtyTangents,ra=oa.__dirtyColors,sa=oa.__dirtyMorphTargets,ka=oa.vertices,ua=h.faces,va=oa.faces,wa=oa.faceVertexUvs[0],xa=oa.faceVertexUvs[1],Da=oa.skinVerticesA,Ea=oa.skinVerticesB,Fa=oa.skinIndices,za=oa.skinWeights,Aa=b instanceof THREE.ShadowVolume?oa.edgeFaces:void 0,ya=oa.morphTargets;if(U)for(L in U)U[L].offset=0,U[L].offsetSrc=0;k=0;for(q=ua.length;k<q;k++)if(n=ua[k],p=va[n],wa&&(E=wa[n]),
+xa&&(F=xa[n]),n=p.vertexNormals,r=p.normal,C=p.vertexColors,t=p.color,o=p.vertexTangents,p instanceof THREE.Face3){if(la)x=ka[p.a].position,y=ka[p.b].position,u=ka[p.c].position,ia[J]=x.x,ia[J+1]=x.y,ia[J+2]=x.z,ia[J+3]=y.x,ia[J+4]=y.y,ia[J+5]=y.z,ia[J+6]=u.x,ia[J+7]=u.y,ia[J+8]=u.z,J+=9;if(U)for(L in U)if(m=U[L],m.__original.needsUpdate)s=m.offset,B=m.offsetSrc,m.size===1?(m.boundTo===void 0||m.boundTo==="vertices"?(m.array[s]=m.value[p.a],m.array[s+1]=m.value[p.b],m.array[s+2]=m.value[p.c]):m.boundTo===
+"faces"?(B=m.value[B],m.array[s]=B,m.array[s+1]=B,m.array[s+2]=B,m.offsetSrc++):m.boundTo==="faceVertices"&&(m.array[s]=m.value[B],m.array[s+1]=m.value[B+1],m.array[s+2]=m.value[B+2],m.offsetSrc+=3),m.offset+=3):(m.boundTo===void 0||m.boundTo==="vertices"?(x=m.value[p.a],y=m.value[p.b],u=m.value[p.c]):m.boundTo==="faces"?(u=y=x=B=m.value[B],m.offsetSrc++):m.boundTo==="faceVertices"&&(x=m.value[B],y=m.value[B+1],u=m.value[B+2],m.offsetSrc+=3),m.size===2?(m.array[s]=x.x,m.array[s+1]=x.y,m.array[s+2]=
+y.x,m.array[s+3]=y.y,m.array[s+4]=u.x,m.array[s+5]=u.y,m.offset+=6):m.size===3?(m.type==="c"?(m.array[s]=x.r,m.array[s+1]=x.g,m.array[s+2]=x.b,m.array[s+3]=y.r,m.array[s+4]=y.g,m.array[s+5]=y.b,m.array[s+6]=u.r,m.array[s+7]=u.g,m.array[s+8]=u.b):(m.array[s]=x.x,m.array[s+1]=x.y,m.array[s+2]=x.z,m.array[s+3]=y.x,m.array[s+4]=y.y,m.array[s+5]=y.z,m.array[s+6]=u.x,m.array[s+7]=u.y,m.array[s+8]=u.z),m.offset+=9):(m.array[s]=x.x,m.array[s+1]=x.y,m.array[s+2]=x.z,m.array[s+3]=x.w,m.array[s+4]=y.x,m.array[s+
+5]=y.y,m.array[s+6]=y.z,m.array[s+7]=y.w,m.array[s+8]=u.x,m.array[s+9]=u.y,m.array[s+10]=u.z,m.array[s+11]=u.w,m.offset+=12));if(sa){s=0;for(m=ya.length;s<m;s++)x=ya[s].vertices[p.a].position,y=ya[s].vertices[p.b].position,u=ya[s].vertices[p.c].position,B=da[s],B[ga]=x.x,B[ga+1]=x.y,B[ga+2]=x.z,B[ga+3]=y.x,B[ga+4]=y.y,B[ga+5]=y.z,B[ga+6]=u.x,B[ga+7]=u.y,B[ga+8]=u.z;ga+=9}if(za.length)s=za[p.a],m=za[p.b],B=za[p.c],$[z]=s.x,$[z+1]=s.y,$[z+2]=s.z,$[z+3]=s.w,$[z+4]=m.x,$[z+5]=m.y,$[z+6]=m.z,$[z+7]=m.w,
+$[z+8]=B.x,$[z+9]=B.y,$[z+10]=B.z,$[z+11]=B.w,s=Fa[p.a],m=Fa[p.b],B=Fa[p.c],Z[z]=s.x,Z[z+1]=s.y,Z[z+2]=s.z,Z[z+3]=s.w,Z[z+4]=m.x,Z[z+5]=m.y,Z[z+6]=m.z,Z[z+7]=m.w,Z[z+8]=B.x,Z[z+9]=B.y,Z[z+10]=B.z,Z[z+11]=B.w,s=Da[p.a],m=Da[p.b],B=Da[p.c],X[z]=s.x,X[z+1]=s.y,X[z+2]=s.z,X[z+3]=1,X[z+4]=m.x,X[z+5]=m.y,X[z+6]=m.z,X[z+7]=1,X[z+8]=B.x,X[z+9]=B.y,X[z+10]=B.z,X[z+11]=1,s=Ea[p.a],m=Ea[p.b],B=Ea[p.c],Y[z]=s.x,Y[z+1]=s.y,Y[z+2]=s.z,Y[z+3]=1,Y[z+4]=m.x,Y[z+5]=m.y,Y[z+6]=m.z,Y[z+7]=1,Y[z+8]=B.x,Y[z+9]=B.y,Y[z+
+10]=B.z,Y[z+11]=1,z+=12;if(ra&&v)C.length==3&&v==THREE.VertexColors?(p=C[0],s=C[1],m=C[2]):m=s=p=t,ja[ea]=p.r,ja[ea+1]=p.g,ja[ea+2]=p.b,ja[ea+3]=s.r,ja[ea+4]=s.g,ja[ea+5]=s.b,ja[ea+6]=m.r,ja[ea+7]=m.g,ja[ea+8]=m.b,ea+=9;if(qa&&oa.hasTangents)C=o[0],t=o[1],p=o[2],W[V]=C.x,W[V+1]=C.y,W[V+2]=C.z,W[V+3]=C.w,W[V+4]=t.x,W[V+5]=t.y,W[V+6]=t.z,W[V+7]=t.w,W[V+8]=p.x,W[V+9]=p.y,W[V+10]=p.z,W[V+11]=p.w,V+=12;if(pa&&A)if(n.length==3&&ma)for(o=0;o<3;o++)r=n[o],Q[N]=r.x,Q[N+1]=r.y,Q[N+2]=r.z,N+=3;else for(o=0;o<
+3;o++)Q[N]=r.x,Q[N+1]=r.y,Q[N+2]=r.z,N+=3;if(ha&&E!==void 0&&w)for(o=0;o<3;o++)n=E[o],aa[R]=n.u,aa[R+1]=n.v,R+=2;if(ha&&F!==void 0&&w)for(o=0;o<3;o++)n=F[o],ca[S]=n.u,ca[S+1]=n.v,S+=2;na&&(P[M]=I,P[M+1]=I+1,P[M+2]=I+2,M+=3,T[O]=I,T[O+1]=I+1,T[O+2]=I,T[O+3]=I+2,T[O+4]=I+1,T[O+5]=I+2,O+=6,I+=3)}else if(p instanceof THREE.Face4){if(la)x=ka[p.a].position,y=ka[p.b].position,u=ka[p.c].position,G=ka[p.d].position,ia[J]=x.x,ia[J+1]=x.y,ia[J+2]=x.z,ia[J+3]=y.x,ia[J+4]=y.y,ia[J+5]=y.z,ia[J+6]=u.x,ia[J+7]=u.y,
+ia[J+8]=u.z,ia[J+9]=G.x,ia[J+10]=G.y,ia[J+11]=G.z,J+=12;if(U)for(L in U)if(m=U[L],m.__original.needsUpdate)s=m.offset,B=m.offsetSrc,m.size===1?(m.boundTo===void 0||m.boundTo==="vertices"?(m.array[s]=m.value[p.a],m.array[s+1]=m.value[p.b],m.array[s+2]=m.value[p.c],m.array[s+3]=m.value[p.d]):m.boundTo==="faces"?(B=m.value[B],m.array[s]=B,m.array[s+1]=B,m.array[s+2]=B,m.array[s+3]=B,m.offsetSrc++):m.boundTo==="faceVertices"&&(m.array[s]=m.value[B],m.array[s+1]=m.value[B+1],m.array[s+2]=m.value[B+2],
+m.array[s+3]=m.value[B+3],m.offsetSrc+=4),m.offset+=4):(m.boundTo===void 0||m.boundTo==="vertices"?(x=m.value[p.a],y=m.value[p.b],u=m.value[p.c],G=m.value[p.d]):m.boundTo==="faces"?(G=u=y=x=B=m.value[B],m.offsetSrc++):m.boundTo==="faceVertices"&&(x=m.value[B],y=m.value[B+1],u=m.value[B+2],G=m.value[B+3],m.offsetSrc+=4),m.size===2?(m.array[s]=x.x,m.array[s+1]=x.y,m.array[s+2]=y.x,m.array[s+3]=y.y,m.array[s+4]=u.x,m.array[s+5]=u.y,m.array[s+6]=G.x,m.array[s+7]=G.y,m.offset+=8):m.size===3?(m.type===
+"c"?(m.array[s]=x.r,m.array[s+1]=x.g,m.array[s+2]=x.b,m.array[s+3]=y.r,m.array[s+4]=y.g,m.array[s+5]=y.b,m.array[s+6]=u.r,m.array[s+7]=u.g,m.array[s+8]=u.b,m.array[s+9]=G.r,m.array[s+10]=G.g,m.array[s+11]=G.b):(m.array[s]=x.x,m.array[s+1]=x.y,m.array[s+2]=x.z,m.array[s+3]=y.x,m.array[s+4]=y.y,m.array[s+5]=y.z,m.array[s+6]=u.x,m.array[s+7]=u.y,m.array[s+8]=u.z,m.array[s+9]=G.x,m.array[s+10]=G.y,m.array[s+11]=G.z),m.offset+=12):(m.array[s]=x.x,m.array[s+1]=x.y,m.array[s+2]=x.z,m.array[s+3]=x.w,m.array[s+
+4]=y.x,m.array[s+5]=y.y,m.array[s+6]=y.z,m.array[s+7]=y.w,m.array[s+8]=u.x,m.array[s+9]=u.y,m.array[s+10]=u.z,m.array[s+11]=u.w,m.array[s+12]=G.x,m.array[s+13]=G.y,m.array[s+14]=G.z,m.array[s+15]=G.w,m.offset+=16));if(sa){s=0;for(m=ya.length;s<m;s++)x=ya[s].vertices[p.a].position,y=ya[s].vertices[p.b].position,u=ya[s].vertices[p.c].position,G=ya[s].vertices[p.d].position,B=da[s],B[ga]=x.x,B[ga+1]=x.y,B[ga+2]=x.z,B[ga+3]=y.x,B[ga+4]=y.y,B[ga+5]=y.z,B[ga+6]=u.x,B[ga+7]=u.y,B[ga+8]=u.z,B[ga+9]=G.x,B[ga+
+10]=G.y,B[ga+11]=G.z;ga+=12}if(za.length)s=za[p.a],m=za[p.b],B=za[p.c],K=za[p.d],$[z]=s.x,$[z+1]=s.y,$[z+2]=s.z,$[z+3]=s.w,$[z+4]=m.x,$[z+5]=m.y,$[z+6]=m.z,$[z+7]=m.w,$[z+8]=B.x,$[z+9]=B.y,$[z+10]=B.z,$[z+11]=B.w,$[z+12]=K.x,$[z+13]=K.y,$[z+14]=K.z,$[z+15]=K.w,s=Fa[p.a],m=Fa[p.b],B=Fa[p.c],K=Fa[p.d],Z[z]=s.x,Z[z+1]=s.y,Z[z+2]=s.z,Z[z+3]=s.w,Z[z+4]=m.x,Z[z+5]=m.y,Z[z+6]=m.z,Z[z+7]=m.w,Z[z+8]=B.x,Z[z+9]=B.y,Z[z+10]=B.z,Z[z+11]=B.w,Z[z+12]=K.x,Z[z+13]=K.y,Z[z+14]=K.z,Z[z+15]=K.w,s=Da[p.a],m=Da[p.b],
+B=Da[p.c],K=Da[p.d],X[z]=s.x,X[z+1]=s.y,X[z+2]=s.z,X[z+3]=1,X[z+4]=m.x,X[z+5]=m.y,X[z+6]=m.z,X[z+7]=1,X[z+8]=B.x,X[z+9]=B.y,X[z+10]=B.z,X[z+11]=1,X[z+12]=K.x,X[z+13]=K.y,X[z+14]=K.z,X[z+15]=1,s=Ea[p.a],m=Ea[p.b],B=Ea[p.c],p=Ea[p.d],Y[z]=s.x,Y[z+1]=s.y,Y[z+2]=s.z,Y[z+3]=1,Y[z+4]=m.x,Y[z+5]=m.y,Y[z+6]=m.z,Y[z+7]=1,Y[z+8]=B.x,Y[z+9]=B.y,Y[z+10]=B.z,Y[z+11]=1,Y[z+12]=p.x,Y[z+13]=p.y,Y[z+14]=p.z,Y[z+15]=1,z+=16;if(ra&&v)C.length==4&&v==THREE.VertexColors?(p=C[0],s=C[1],m=C[2],C=C[3]):C=m=s=p=t,ja[ea]=
+p.r,ja[ea+1]=p.g,ja[ea+2]=p.b,ja[ea+3]=s.r,ja[ea+4]=s.g,ja[ea+5]=s.b,ja[ea+6]=m.r,ja[ea+7]=m.g,ja[ea+8]=m.b,ja[ea+9]=C.r,ja[ea+10]=C.g,ja[ea+11]=C.b,ea+=12;if(qa&&oa.hasTangents)C=o[0],t=o[1],p=o[2],o=o[3],W[V]=C.x,W[V+1]=C.y,W[V+2]=C.z,W[V+3]=C.w,W[V+4]=t.x,W[V+5]=t.y,W[V+6]=t.z,W[V+7]=t.w,W[V+8]=p.x,W[V+9]=p.y,W[V+10]=p.z,W[V+11]=p.w,W[V+12]=o.x,W[V+13]=o.y,W[V+14]=o.z,W[V+15]=o.w,V+=16;if(pa&&A)if(n.length==4&&ma)for(o=0;o<4;o++)r=n[o],Q[N]=r.x,Q[N+1]=r.y,Q[N+2]=r.z,N+=3;else for(o=0;o<4;o++)Q[N]=
+r.x,Q[N+1]=r.y,Q[N+2]=r.z,N+=3;if(ha&&E!==void 0&&w)for(o=0;o<4;o++)n=E[o],aa[R]=n.u,aa[R+1]=n.v,R+=2;if(ha&&F!==void 0&&w)for(o=0;o<4;o++)n=F[o],ca[S]=n.u,ca[S+1]=n.v,S+=2;na&&(P[M]=I,P[M+1]=I+1,P[M+2]=I+3,P[M+3]=I+1,P[M+4]=I+2,P[M+5]=I+3,M+=6,T[O]=I,T[O+1]=I+1,T[O+2]=I,T[O+3]=I+3,T[O+4]=I+1,T[O+5]=I+2,T[O+6]=I+2,T[O+7]=I+3,O+=8,I+=4)}if(Aa){k=0;for(q=Aa.length;k<q;k++)P[M]=Aa[k].a,P[M+1]=Aa[k].b,P[M+2]=Aa[k].c,P[M+3]=Aa[k].a,P[M+4]=Aa[k].c,P[M+5]=Aa[k].d,M+=6}la&&(c.bindBuffer(c.ARRAY_BUFFER,h.__webglVertexBuffer),
+c.bufferData(c.ARRAY_BUFFER,ia,i));if(U)for(L in U)m=U[L],m.__original.needsUpdate&&(c.bindBuffer(c.ARRAY_BUFFER,m.buffer),c.bufferData(c.ARRAY_BUFFER,m.array,i));if(sa){s=0;for(m=ya.length;s<m;s++)c.bindBuffer(c.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[s]),c.bufferData(c.ARRAY_BUFFER,da[s],i)}ra&&ea>0&&(c.bindBuffer(c.ARRAY_BUFFER,h.__webglColorBuffer),c.bufferData(c.ARRAY_BUFFER,ja,i));pa&&(c.bindBuffer(c.ARRAY_BUFFER,h.__webglNormalBuffer),c.bufferData(c.ARRAY_BUFFER,Q,i));qa&&oa.hasTangents&&
+(c.bindBuffer(c.ARRAY_BUFFER,h.__webglTangentBuffer),c.bufferData(c.ARRAY_BUFFER,W,i));ha&&R>0&&(c.bindBuffer(c.ARRAY_BUFFER,h.__webglUVBuffer),c.bufferData(c.ARRAY_BUFFER,aa,i));ha&&S>0&&(c.bindBuffer(c.ARRAY_BUFFER,h.__webglUV2Buffer),c.bufferData(c.ARRAY_BUFFER,ca,i));na&&(c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,h.__webglFaceBuffer),c.bufferData(c.ELEMENT_ARRAY_BUFFER,P,i),c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,h.__webglLineBuffer),c.bufferData(c.ELEMENT_ARRAY_BUFFER,T,i));z>0&&(c.bindBuffer(c.ARRAY_BUFFER,
+h.__webglSkinVertexABuffer),c.bufferData(c.ARRAY_BUFFER,X,i),c.bindBuffer(c.ARRAY_BUFFER,h.__webglSkinVertexBBuffer),c.bufferData(c.ARRAY_BUFFER,Y,i),c.bindBuffer(c.ARRAY_BUFFER,h.__webglSkinIndicesBuffer),c.bufferData(c.ARRAY_BUFFER,Z,i),c.bindBuffer(c.ARRAY_BUFFER,h.__webglSkinWeightsBuffer),c.bufferData(c.ARRAY_BUFFER,$,i));j&&(delete h.__inittedArrays,delete h.__colorArray,delete h.__normalArray,delete h.__tangentArray,delete h.__uvArray,delete h.__uv2Array,delete h.__faceArray,delete h.__vertexArray,
 delete h.__lineArray,delete h.__skinVertexAArray,delete h.__skinVertexBArray,delete h.__skinIndexArray,delete h.__skinWeightArray)}}f.__dirtyVertices=!1;f.__dirtyMorphTargets=!1;f.__dirtyElements=!1;f.__dirtyUvs=!1;f.__dirtyNormals=!1;f.__dirtyTangents=!1;f.__dirtyColors=!1;fa(g)}else if(b instanceof THREE.Ribbon){f=b.geometry;if(f.__dirtyVertices||f.__dirtyColors){b=f;e=c.DYNAMIC_DRAW;w=b.vertices;h=b.colors;v=w.length;i=h.length;A=b.__vertexArray;j=b.__colorArray;E=b.__dirtyColors;if(b.__dirtyVertices){for(k=
 0;k<v;k++)q=w[k].position,g=k*3,A[g]=q.x,A[g+1]=q.y,A[g+2]=q.z;c.bindBuffer(c.ARRAY_BUFFER,b.__webglVertexBuffer);c.bufferData(c.ARRAY_BUFFER,A,e)}if(E){for(k=0;k<i;k++)color=h[k],g=k*3,j[g]=color.r,j[g+1]=color.g,j[g+2]=color.b;c.bindBuffer(c.ARRAY_BUFFER,b.__webglColorBuffer);c.bufferData(c.ARRAY_BUFFER,j,e)}}f.__dirtyVertices=!1;f.__dirtyColors=!1}else if(b instanceof THREE.Line){f=b.geometry;if(f.__dirtyVertices||f.__dirtyColors){b=f;e=c.DYNAMIC_DRAW;w=b.vertices;h=b.colors;v=w.length;i=h.length;
 A=b.__vertexArray;j=b.__colorArray;E=b.__dirtyColors;if(b.__dirtyVertices){for(k=0;k<v;k++)q=w[k].position,g=k*3,A[g]=q.x,A[g+1]=q.y,A[g+2]=q.z;c.bindBuffer(c.ARRAY_BUFFER,b.__webglVertexBuffer);c.bufferData(c.ARRAY_BUFFER,A,e)}if(E){for(k=0;k<i;k++)color=h[k],g=k*3,j[g]=color.r,j[g+1]=color.g,j[g+2]=color.b;c.bindBuffer(c.ARRAY_BUFFER,b.__webglColorBuffer);c.bufferData(c.ARRAY_BUFFER,j,e)}}f.__dirtyVertices=!1;f.__dirtyColors=!1}else if(b instanceof THREE.ParticleSystem)f=b.geometry,h=ta(f),(f.__dirtyVertices||

+ 1 - 1
examples/webgl_geometry_dynamic.html

@@ -90,6 +90,7 @@
 				camera.target.position.y = camera.position.y;
 
 				geometry = new THREE.PlaneGeometry( 20000, 20000, worldWidth - 1, worldDepth - 1 );
+				geometry.dynamic = true;
 
 				var i, j, il, jl;
 
@@ -111,7 +112,6 @@
 				material = new THREE.MeshBasicMaterial( { color:0x0044ff, opacity:1, map: texture } );
 
 				mesh = new THREE.Mesh( geometry, material );
-				mesh.dynamic = true;
 				mesh.rotation.x = - 90 * Math.PI / 180;
 				scene.addObject( mesh );
 

+ 2 - 0
src/core/Geometry.js

@@ -30,6 +30,8 @@ THREE.Geometry = function () {
 
 	this.hasTangents = false;
 
+	this.dynamic = false; // unless set to true the *Arrays will be deleted once sent to a buffer.
+
 };
 
 THREE.Geometry.prototype = {

+ 3 - 3
src/renderers/WebGLRenderer.js

@@ -887,7 +887,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 	};
 
 
-	function setMeshBuffers ( geometryGroup, object, hint ) {
+	function setMeshBuffers( geometryGroup, object, hint, dispose ) {
 
 		if ( ! geometryGroup.__inittedArrays ) {
 
@@ -2076,7 +2076,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 		}
 
-		if ( ! object.dynamic ) {
+		if ( dispose ) {
 
 			delete geometryGroup.__inittedArrays;
 			delete geometryGroup.__colorArray;
@@ -4715,7 +4715,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 					 geometry.__dirtyUvs || geometry.__dirtyNormals ||
 					 geometry.__dirtyColors || geometry.__dirtyTangents || customAttributeDirty ) {
 
-					setMeshBuffers( geometryGroup, object, _gl.DYNAMIC_DRAW );
+					setMeshBuffers( geometryGroup, object, _gl.DYNAMIC_DRAW, !geometry.dynamic );
 
 				}