|
@@ -9,7 +9,7 @@ Math.floor(a);this.r=(a>>16&255)/255;this.g=(a>>8&255)/255;this.b=(a&255)/255;re
|
|
|
THREE.Vector2=function(a,b){this.x=a||0;this.y=b||0};
|
|
|
THREE.Vector2.prototype={constructor:THREE.Vector2,set:function(a,b){this.x=a;this.y=b;return this},copy:function(a){this.x=a.x;this.y=a.y;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;return this},addSelf:function(a){this.x=this.x+a.x;this.y=this.y+a.y;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;return this},subSelf:function(a){this.x=this.x-a.x;this.y=this.y-a.y;return this},multiplyScalar:function(a){this.x=this.x*a;this.y=this.y*a;return this},divideScalar:function(a){if(a){this.x=
|
|
|
this.x/a;this.y=this.y/a}else this.set(0,0);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.lengthSq())},normalize:function(){return this.divideScalar(this.length())},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var b=this.x-a.x,a=this.y-a.y;return b*b+a*a},setLength:function(a){return this.normalize().multiplyScalar(a)},
|
|
|
-lerpSelf:function(a,b){this.x=this.x+(a.x-this.x)*b;this.y=this.y+(a.y-this.y)*b;return this},equals:function(a){return a.x===this.x&&a.y===this.y},isZero:function(){return this.lengthSq()<1.0E-4},clone:function(){return new THREE.Vector2(this.x,this.y)}};THREE.Vector3=function(a,b,c){this.x=a||0;this.y=b||0;this.z=c||0};
|
|
|
+lerpSelf:function(a,b){this.x=this.x+(a.x-this.x)*b;this.y=this.y+(a.y-this.y)*b;return this},equals:function(a){return a.x===this.x&&a.y===this.y},isZero:function(){return this.lengthSq()<1.0E-4},clone:function(){return new THREE.Vector2(this.x,this.y)}};THREE.Vector3=function(a,b,c){a instanceof THREE.Vector3&&console.warn("OPS!");this.x=a||0;this.y=b||0;this.z=c||0};
|
|
|
THREE.Vector3.prototype={constructor:THREE.Vector3,set:function(a,b,c){this.x=a;this.y=b;this.z=c;return this},setX:function(a){this.x=a;return this},setY:function(a){this.y=a;return this},setZ:function(a){this.z=a;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;return this},addSelf:function(a){this.x=this.x+a.x;this.y=this.y+a.y;this.z=this.z+a.z;return this},addScalar:function(a){this.x=this.x+a;this.y=this.y+
|
|
|
a;this.z=this.z+a;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;return this},subSelf:function(a){this.x=this.x-a.x;this.y=this.y-a.y;this.z=this.z-a.z;return this},multiply:function(a,b){this.x=a.x*b.x;this.y=a.y*b.y;this.z=a.z*b.z;return this},multiplySelf:function(a){this.x=this.x*a.x;this.y=this.y*a.y;this.z=this.z*a.z;return this},multiplyScalar:function(a){this.x=this.x*a;this.y=this.y*a;this.z=this.z*a;return this},divideSelf:function(a){this.x=this.x/a.x;this.y=
|
|
|
this.y/a.y;this.z=this.z/a.z;return this},divideScalar:function(a){if(a){this.x=this.x/a;this.y=this.y/a;this.z=this.z/a}else this.z=this.y=this.x=0;return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.lengthSq())},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length())},
|
|
@@ -24,8 +24,8 @@ THREE.Frustum.prototype.contains=function(a){for(var b=this.planes,c=a.matrixWor
|
|
|
THREE.Ray=function(a,b){function c(a,b,c){r.sub(c,a);u=r.dot(b);t=n.add(a,q.copy(b).multiplyScalar(u));return y=c.distanceTo(t)}function d(a,b,c,d){r.sub(d,b);n.sub(c,b);q.sub(a,b);s=r.dot(r);x=r.dot(n);D=r.dot(q);B=n.dot(n);w=n.dot(q);v=1/(s*B-x*x);C=(B*D-x*w)*v;K=(s*w-x*D)*v;return C>=0&&K>=0&&C+K<1}this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3;var e=1.0E-4;this.setPrecision=function(a){e=a};var f=new THREE.Vector3,g=new THREE.Vector3,h=new THREE.Vector3,j=new THREE.Vector3,
|
|
|
k=new THREE.Vector3,l=new THREE.Vector3,p=new THREE.Vector3,m=new THREE.Vector3,o=new THREE.Vector3;this.intersectObject=function(a){var b,n=[];if(a instanceof THREE.Particle){var r=c(this.origin,this.direction,a.matrixWorld.getPosition());if(r>a.scale.x)return[];b={distance:r,point:a.position,face:null,object:a};n.push(b)}else if(a instanceof THREE.Mesh){var r=c(this.origin,this.direction,a.matrixWorld.getPosition()),q=THREE.Frustum.__v1.set(a.matrixWorld.getColumnX().length(),a.matrixWorld.getColumnY().length(),
|
|
|
a.matrixWorld.getColumnZ().length());if(r>a.geometry.boundingSphere.radius*Math.max(q.x,Math.max(q.y,q.z)))return n;var s,i,u=a.geometry,t=u.vertices,H;a.matrixRotationWorld.extractRotation(a.matrixWorld);r=0;for(q=u.faces.length;r<q;r++){b=u.faces[r];k.copy(this.origin);l.copy(this.direction);H=a.matrixWorld;p=H.multiplyVector3(p.copy(b.centroid)).subSelf(k);m=a.matrixRotationWorld.multiplyVector3(m.copy(b.normal));s=l.dot(m);if(!(Math.abs(s)<e)){i=m.dot(p)/s;if(!(i<0)&&(a.doubleSided||(a.flipSided?
|
|
|
-s>0:s<0))){o.add(k,l.multiplyScalar(i));if(b instanceof THREE.Face3){f=H.multiplyVector3(f.copy(t[b.a].position));g=H.multiplyVector3(g.copy(t[b.b].position));h=H.multiplyVector3(h.copy(t[b.c].position));if(d(o,f,g,h)){b={distance:k.distanceTo(o),point:o.clone(),face:b,object:a};n.push(b)}}else if(b instanceof THREE.Face4){f=H.multiplyVector3(f.copy(t[b.a].position));g=H.multiplyVector3(g.copy(t[b.b].position));h=H.multiplyVector3(h.copy(t[b.c].position));j=H.multiplyVector3(j.copy(t[b.d].position));
|
|
|
-if(d(o,f,g,j)||d(o,g,h,j)){b={distance:k.distanceTo(o),point:o.clone(),face:b,object:a};n.push(b)}}}}}}return n};this.intersectObjects=function(a){for(var b=[],c=0,d=a.length;c<d;c++)Array.prototype.push.apply(b,this.intersectObject(a[c]));b.sort(function(a,b){return a.distance-b.distance});return b};var r=new THREE.Vector3,n=new THREE.Vector3,q=new THREE.Vector3,u,t,y,s,x,D,B,w,v,C,K};
|
|
|
+s>0:s<0))){o.add(k,l.multiplyScalar(i));if(b instanceof THREE.Face3){f=H.multiplyVector3(f.copy(t[b.a]));g=H.multiplyVector3(g.copy(t[b.b]));h=H.multiplyVector3(h.copy(t[b.c]));if(d(o,f,g,h)){b={distance:k.distanceTo(o),point:o.clone(),face:b,object:a};n.push(b)}}else if(b instanceof THREE.Face4){f=H.multiplyVector3(f.copy(t[b.a]));g=H.multiplyVector3(g.copy(t[b.b]));h=H.multiplyVector3(h.copy(t[b.c]));j=H.multiplyVector3(j.copy(t[b.d]));if(d(o,f,g,j)||d(o,g,h,j)){b={distance:k.distanceTo(o),point:o.clone(),
|
|
|
+face:b,object:a};n.push(b)}}}}}}return n};this.intersectObjects=function(a){for(var b=[],c=0,d=a.length;c<d;c++)Array.prototype.push.apply(b,this.intersectObject(a[c]));b.sort(function(a,b){return a.distance-b.distance});return b};var r=new THREE.Vector3,n=new THREE.Vector3,q=new THREE.Vector3,u,t,y,s,x,D,B,w,v,C,K};
|
|
|
THREE.Rectangle=function(){function a(){f=d-b;g=e-c}var b,c,d,e,f,g,h=true;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return f};this.getHeight=function(){return g};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return e};this.set=function(f,g,l,p){h=false;b=f;c=g;d=l;e=p;a()};this.addPoint=function(f,g){if(h){h=false;b=f;c=g;d=f;e=g}else{b=b<f?b:f;c=c<g?c:g;d=d>f?d:f;e=e>g?
|
|
|
e:g}a()};this.add3Points=function(f,g,l,p,m,o){if(h){h=false;b=f<l?f<m?f:m:l<m?l:m;c=g<p?g<o?g:o:p<o?p:o;d=f>l?f>m?f:m:l>m?l:m;e=g>p?g>o?g:o:p>o?p:o}else{b=f<l?f<m?f<b?f:b:m<b?m:b:l<m?l<b?l:b:m<b?m:b;c=g<p?g<o?g<c?g:c:o<c?o:c:p<o?p<c?p:c:o<c?o:c;d=f>l?f>m?f>d?f:d:m>d?m:d:l>m?l>d?l:d:m>d?m:d;e=g>p?g>o?g>e?g:e:o>e?o:e:p>o?p>e?p:e:o>e?o:e}a()};this.addRectangle=function(f){if(h){h=false;b=f.getLeft();c=f.getTop();d=f.getRight();e=f.getBottom()}else{b=b<f.getLeft()?b:f.getLeft();c=c<f.getTop()?c:f.getTop();
|
|
|
d=d>f.getRight()?d:f.getRight();e=e>f.getBottom()?e:f.getBottom()}a()};this.inflate=function(f){b=b-f;c=c-f;d=d+f;e=e+f;a()};this.minSelf=function(f){b=b>f.getLeft()?b:f.getLeft();c=c>f.getTop()?c:f.getTop();d=d<f.getRight()?d:f.getRight();e=e<f.getBottom()?e:f.getBottom();a()};this.intersects=function(a){return d<a.getLeft()||b>a.getRight()||e<a.getTop()||c>a.getBottom()?false:true};this.empty=function(){h=true;e=d=c=b=0;a()};this.isEmpty=function(){return h}};
|
|
@@ -69,39 +69,38 @@ d);return true}var e,f,g=[],h,j,k=[],l,p,m=[],o,r=[],n,q,u=[],t,y,s=[],x={object
|
|
|
w.multiply(b.matrixWorld,b.projectionMatrixInverse);w.multiplyVector3(a);return a};this.pickingRay=function(a,b){var c;a.z=-1;c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Ray(a,c)};this.projectGraph=function(b,d){f=0;x.objects.length=0;x.sprites.length=0;x.lights.length=0;var g=function(b){if(b.visible!==false){if((b instanceof THREE.Mesh||b instanceof THREE.Line)&&(b.frustumCulled===false||C.contains(b))){D.copy(b.matrixWorld.getPosition());
|
|
|
w.multiplyVector3(D);e=a();e.object=b;e.z=D.z;x.objects.push(e)}else if(b instanceof THREE.Sprite||b instanceof THREE.Particle){D.copy(b.matrixWorld.getPosition());w.multiplyVector3(D);e=a();e.object=b;e.z=D.z;x.sprites.push(e)}else b instanceof THREE.Light&&x.lights.push(b);for(var c=0,d=b.children.length;c<d;c++)g(b.children[c])}};g(b);d&&x.objects.sort(c);return x};this.projectScene=function(a,e,f){var g=e.near,F=e.far,i=false,D,E,H,W,G,ha,fa,la,R,$,ba,aa,ea,Na,wa;y=q=o=p=0;x.elements.length=0;
|
|
|
if(e.parent===void 0){console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it...");a.add(e)}a.updateMatrixWorld();e.matrixWorldInverse.getInverse(e.matrixWorld);w.multiply(e.projectionMatrix,e.matrixWorldInverse);C.setFromMatrix(w);x=this.projectGraph(a,false);a=0;for(D=x.objects.length;a<D;a++){R=x.objects[a].object;$=R.matrixWorld;j=0;if(R instanceof THREE.Mesh){ba=R.geometry;aa=R.geometry.materials;W=ba.vertices;ea=ba.faces;Na=ba.faceVertexUvs;ba=R.matrixRotationWorld.extractRotation($);
|
|
|
-E=0;for(H=W.length;E<H;E++){h=b();h.positionWorld.copy(W[E].position);$.multiplyVector3(h.positionWorld);h.positionScreen.copy(h.positionWorld);w.multiplyVector4(h.positionScreen);h.positionScreen.x=h.positionScreen.x/h.positionScreen.w;h.positionScreen.y=h.positionScreen.y/h.positionScreen.w;h.visible=h.positionScreen.z>g&&h.positionScreen.z<F}W=0;for(E=ea.length;W<E;W++){H=ea[W];if(H instanceof THREE.Face3){G=k[H.a];ha=k[H.b];fa=k[H.c];if(G.visible&&ha.visible&&fa.visible){i=(fa.positionScreen.x-
|
|
|
-G.positionScreen.x)*(ha.positionScreen.y-G.positionScreen.y)-(fa.positionScreen.y-G.positionScreen.y)*(ha.positionScreen.x-G.positionScreen.x)<0;if(R.doubleSided||i!=R.flipSided){la=m[p]=m[p]||new THREE.RenderableFace3;p++;l=la;l.v1.copy(G);l.v2.copy(ha);l.v3.copy(fa)}else continue}else continue}else if(H instanceof THREE.Face4){G=k[H.a];ha=k[H.b];fa=k[H.c];la=k[H.d];if(G.visible&&ha.visible&&fa.visible&&la.visible){i=(la.positionScreen.x-G.positionScreen.x)*(ha.positionScreen.y-G.positionScreen.y)-
|
|
|
-(la.positionScreen.y-G.positionScreen.y)*(ha.positionScreen.x-G.positionScreen.x)<0||(ha.positionScreen.x-fa.positionScreen.x)*(la.positionScreen.y-fa.positionScreen.y)-(ha.positionScreen.y-fa.positionScreen.y)*(la.positionScreen.x-fa.positionScreen.x)<0;if(R.doubleSided||i!=R.flipSided){wa=r[o]=r[o]||new THREE.RenderableFace4;o++;l=wa;l.v1.copy(G);l.v2.copy(ha);l.v3.copy(fa);l.v4.copy(la)}else continue}else continue}l.normalWorld.copy(H.normal);!i&&(R.flipSided||R.doubleSided)&&l.normalWorld.negate();
|
|
|
-ba.multiplyVector3(l.normalWorld);l.centroidWorld.copy(H.centroid);$.multiplyVector3(l.centroidWorld);l.centroidScreen.copy(l.centroidWorld);w.multiplyVector3(l.centroidScreen);fa=H.vertexNormals;G=0;for(ha=fa.length;G<ha;G++){la=l.vertexNormalsWorld[G];la.copy(fa[G]);!i&&(R.flipSided||R.doubleSided)&&la.negate();ba.multiplyVector3(la)}G=0;for(ha=Na.length;G<ha;G++)if(wa=Na[G][W]){fa=0;for(la=wa.length;fa<la;fa++)l.uvs[G][fa]=wa[fa]}l.material=R.material;l.faceMaterial=H.materialIndex!==null?aa[H.materialIndex]:
|
|
|
-null;l.z=l.centroidScreen.z;x.elements.push(l)}}else if(R instanceof THREE.Line){v.multiply(w,$);W=R.geometry.vertices;G=b();G.positionScreen.copy(W[0].position);v.multiplyVector4(G.positionScreen);$=R.type===THREE.LinePieces?2:1;E=1;for(H=W.length;E<H;E++){G=b();G.positionScreen.copy(W[E].position);v.multiplyVector4(G.positionScreen);if(!((E+1)%$>0)){ha=k[j-2];K.copy(G.positionScreen);L.copy(ha.positionScreen);if(d(K,L)){K.multiplyScalar(1/K.w);L.multiplyScalar(1/L.w);aa=u[q]=u[q]||new THREE.RenderableLine;
|
|
|
-q++;n=aa;n.v1.positionScreen.copy(K);n.v2.positionScreen.copy(L);n.z=Math.max(K.z,L.z);n.material=R.material;x.elements.push(n)}}}}}a=0;for(D=x.sprites.length;a<D;a++){R=x.sprites[a].object;$=R.matrixWorld;if(R instanceof THREE.Particle){B.set($.n14,$.n24,$.n34,1);w.multiplyVector4(B);B.z=B.z/B.w;if(B.z>0&&B.z<1){g=s[y]=s[y]||new THREE.RenderableParticle;y++;t=g;t.x=B.x/B.w;t.y=B.y/B.w;t.z=B.z;t.rotation=R.rotation.z;t.scale.x=R.scale.x*Math.abs(t.x-(B.x+e.projectionMatrix.n11)/(B.w+e.projectionMatrix.n14));
|
|
|
-t.scale.y=R.scale.y*Math.abs(t.y-(B.y+e.projectionMatrix.n22)/(B.w+e.projectionMatrix.n24));t.material=R.material;x.elements.push(t)}}}f&&x.elements.sort(c);return x}};THREE.Quaternion=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=d!==void 0?d:1};
|
|
|
+E=0;for(H=W.length;E<H;E++){h=b();h.positionWorld.copy(W[E]);$.multiplyVector3(h.positionWorld);h.positionScreen.copy(h.positionWorld);w.multiplyVector4(h.positionScreen);h.positionScreen.x=h.positionScreen.x/h.positionScreen.w;h.positionScreen.y=h.positionScreen.y/h.positionScreen.w;h.visible=h.positionScreen.z>g&&h.positionScreen.z<F}W=0;for(E=ea.length;W<E;W++){H=ea[W];if(H instanceof THREE.Face3){G=k[H.a];ha=k[H.b];fa=k[H.c];if(G.visible&&ha.visible&&fa.visible){i=(fa.positionScreen.x-G.positionScreen.x)*
|
|
|
+(ha.positionScreen.y-G.positionScreen.y)-(fa.positionScreen.y-G.positionScreen.y)*(ha.positionScreen.x-G.positionScreen.x)<0;if(R.doubleSided||i!=R.flipSided){la=m[p]=m[p]||new THREE.RenderableFace3;p++;l=la;l.v1.copy(G);l.v2.copy(ha);l.v3.copy(fa)}else continue}else continue}else if(H instanceof THREE.Face4){G=k[H.a];ha=k[H.b];fa=k[H.c];la=k[H.d];if(G.visible&&ha.visible&&fa.visible&&la.visible){i=(la.positionScreen.x-G.positionScreen.x)*(ha.positionScreen.y-G.positionScreen.y)-(la.positionScreen.y-
|
|
|
+G.positionScreen.y)*(ha.positionScreen.x-G.positionScreen.x)<0||(ha.positionScreen.x-fa.positionScreen.x)*(la.positionScreen.y-fa.positionScreen.y)-(ha.positionScreen.y-fa.positionScreen.y)*(la.positionScreen.x-fa.positionScreen.x)<0;if(R.doubleSided||i!=R.flipSided){wa=r[o]=r[o]||new THREE.RenderableFace4;o++;l=wa;l.v1.copy(G);l.v2.copy(ha);l.v3.copy(fa);l.v4.copy(la)}else continue}else continue}l.normalWorld.copy(H.normal);!i&&(R.flipSided||R.doubleSided)&&l.normalWorld.negate();ba.multiplyVector3(l.normalWorld);
|
|
|
+l.centroidWorld.copy(H.centroid);$.multiplyVector3(l.centroidWorld);l.centroidScreen.copy(l.centroidWorld);w.multiplyVector3(l.centroidScreen);fa=H.vertexNormals;G=0;for(ha=fa.length;G<ha;G++){la=l.vertexNormalsWorld[G];la.copy(fa[G]);!i&&(R.flipSided||R.doubleSided)&&la.negate();ba.multiplyVector3(la)}G=0;for(ha=Na.length;G<ha;G++)if(wa=Na[G][W]){fa=0;for(la=wa.length;fa<la;fa++)l.uvs[G][fa]=wa[fa]}l.material=R.material;l.faceMaterial=H.materialIndex!==null?aa[H.materialIndex]:null;l.z=l.centroidScreen.z;
|
|
|
+x.elements.push(l)}}else if(R instanceof THREE.Line){v.multiply(w,$);W=R.geometry.vertices;G=b();G.positionScreen.copy(W[0]);v.multiplyVector4(G.positionScreen);$=R.type===THREE.LinePieces?2:1;E=1;for(H=W.length;E<H;E++){G=b();G.positionScreen.copy(W[E]);v.multiplyVector4(G.positionScreen);if(!((E+1)%$>0)){ha=k[j-2];K.copy(G.positionScreen);L.copy(ha.positionScreen);if(d(K,L)){K.multiplyScalar(1/K.w);L.multiplyScalar(1/L.w);aa=u[q]=u[q]||new THREE.RenderableLine;q++;n=aa;n.v1.positionScreen.copy(K);
|
|
|
+n.v2.positionScreen.copy(L);n.z=Math.max(K.z,L.z);n.material=R.material;x.elements.push(n)}}}}}a=0;for(D=x.sprites.length;a<D;a++){R=x.sprites[a].object;$=R.matrixWorld;if(R instanceof THREE.Particle){B.set($.n14,$.n24,$.n34,1);w.multiplyVector4(B);B.z=B.z/B.w;if(B.z>0&&B.z<1){g=s[y]=s[y]||new THREE.RenderableParticle;y++;t=g;t.x=B.x/B.w;t.y=B.y/B.w;t.z=B.z;t.rotation=R.rotation.z;t.scale.x=R.scale.x*Math.abs(t.x-(B.x+e.projectionMatrix.n11)/(B.w+e.projectionMatrix.n14));t.scale.y=R.scale.y*Math.abs(t.y-
|
|
|
+(B.y+e.projectionMatrix.n22)/(B.w+e.projectionMatrix.n24));t.material=R.material;x.elements.push(t)}}}f&&x.elements.sort(c);return x}};THREE.Quaternion=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=d!==void 0?d:1};
|
|
|
THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},setFromEuler:function(a){var b=Math.PI/360,c=a.x*b,d=a.y*b,e=a.z*b,a=Math.cos(d),d=Math.sin(d),b=Math.cos(-e),e=Math.sin(-e),f=Math.cos(c),c=Math.sin(c),g=a*b,h=d*e;this.w=g*f-h*c;this.x=g*c+h*f;this.y=d*b*f+a*e*c;this.z=a*e*f-d*b*c;return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);
|
|
|
this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRotationMatrix:function(a){var b=Math.pow(a.determinant(),1/3);this.w=Math.sqrt(Math.max(0,b+a.n11+a.n22+a.n33))/2;this.x=Math.sqrt(Math.max(0,b+a.n11-a.n22-a.n33))/2;this.y=Math.sqrt(Math.max(0,b-a.n11+a.n22-a.n33))/2;this.z=Math.sqrt(Math.max(0,b-a.n11-a.n22+a.n33))/2;this.x=a.n32-a.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=a.n13-a.n31<0?-Math.abs(this.y):Math.abs(this.y);this.z=a.n21-a.n12<0?-Math.abs(this.z):Math.abs(this.z);
|
|
|
this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x=this.x*-1;this.y=this.y*-1;this.z=this.z*-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a===0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x=this.x*a;this.y=this.y*a;this.z=this.z*
|
|
|
a;this.w=this.w*a}return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,e=this.w,f=a.x,g=a.y,h=a.z,a=a.w;this.x=b*a+e*f+c*h-d*g;this.y=c*a+e*g+d*f-b*h;this.z=d*a+e*h+b*g-c*f;this.w=e*a-b*f-c*g-d*h;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,f=this.x,g=this.y,h=this.z,
|
|
|
j=this.w,k=j*c+g*e-h*d,l=j*d+h*c-f*e,p=j*e+f*d-g*c,c=-f*c-g*d-h*e;b.x=k*j+c*-f+l*-h-p*-g;b.y=l*j+c*-g+p*-f-k*-h;b.z=p*j+c*-h+k*-g-l*-f;return b},clone:function(){return new THREE.Quaternion(this.x,this.y,this.z,this.w)}};
|
|
|
-THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(e<0){c.w=-b.w;c.x=-b.x;c.y=-b.y;c.z=-b.z;e=-e}else c.copy(b);if(Math.abs(e)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var f=Math.acos(e),e=Math.sqrt(1-e*e);if(Math.abs(e)<0.001){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);return c}b=Math.sin((1-d)*f)/e;d=Math.sin(d*f)/e;c.w=a.w*b+c.w*d;c.x=a.x*b+c.x*d;c.y=a.y*b+c.y*d;c.z=a.z*b+c.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
|
|
|
-THREE.Vertex.prototype={constructor:THREE.Vertex,clone:function(){return new THREE.Vertex(this.position.clone())}};THREE.Face3=function(a,b,c,d,e,f){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=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materialIndex=f;this.centroid=new THREE.Vector3};
|
|
|
+THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(e<0){c.w=-b.w;c.x=-b.x;c.y=-b.y;c.z=-b.z;e=-e}else c.copy(b);if(Math.abs(e)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var f=Math.acos(e),e=Math.sqrt(1-e*e);if(Math.abs(e)<0.001){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);return c}b=Math.sin((1-d)*f)/e;d=Math.sin(d*f)/e;c.w=a.w*b+c.w*d;c.x=a.x*b+c.x*d;c.y=a.y*b+c.y*d;c.z=a.z*b+c.z*d;return c};THREE.Vertex=THREE.Vector3;
|
|
|
+THREE.Face3=function(a,b,c,d,e,f){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=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materialIndex=f;this.centroid=new THREE.Vector3};
|
|
|
THREE.Face3.prototype={constructor:THREE.Face3,clone:function(){var a=new THREE.Face3(this.a,this.b,this.c);a.normal.copy(this.normal);a.color.copy(this.color);a.centroid.copy(this.centroid);a.materialIndex=this.materialIndex;var b,c;b=0;for(c=this.vertexNormals.length;b<c;b++)a.vertexNormals[b]=this.vertexNormals[b].clone();b=0;for(c=this.vertexColors.length;b<c;b++)a.vertexColors[b]=this.vertexColors[b].clone();b=0;for(c=this.vertexTangents.length;b<c;b++)a.vertexTangents[b]=this.vertexTangents[b].clone();
|
|
|
return a}};THREE.Face4=function(a,b,c,d,e,f,g){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materialIndex=g;this.centroid=new THREE.Vector3};
|
|
|
THREE.Face4.prototype={constructor:THREE.Face4,clone:function(){var a=new THREE.Face4(this.a,this.b,this.c,this.d);a.normal.copy(this.normal);a.color.copy(this.color);a.centroid.copy(this.centroid);a.materialIndex=this.materialIndex;var b,c;b=0;for(c=this.vertexNormals.length;b<c;b++)a.vertexNormals[b]=this.vertexNormals[b].clone();b=0;for(c=this.vertexColors.length;b<c;b++)a.vertexColors[b]=this.vertexColors[b].clone();b=0;for(c=this.vertexTangents.length;b<c;b++)a.vertexTangents[b]=this.vertexTangents[b].clone();
|
|
|
return a}};THREE.UV=function(a,b){this.u=a||0;this.v=b||0};THREE.UV.prototype={constructor:THREE.UV,set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.u=a.u;this.v=a.v;return this},lerpSelf:function(a,b){this.u=this.u+(a.u-this.u)*b;this.v=this.v+(a.v-this.v)*b;return this},clone:function(){return new THREE.UV(this.u,this.v)}};
|
|
|
THREE.Geometry=function(){this.id=THREE.GeometryCount++;this.vertices=[];this.colors=[];this.materials=[];this.faces=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.morphNormals=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.dynamic=this.hasTangents=false};
|
|
|
-THREE.Geometry.prototype={constructor:THREE.Geometry,applyMatrix:function(a){var b=new THREE.Matrix4;b.extractRotation(a);for(var c=0,d=this.vertices.length;c<d;c++)a.multiplyVector3(this.vertices[c].position);c=0;for(d=this.faces.length;c<d;c++){var e=this.faces[c];b.multiplyVector3(e.normal);for(var f=0,g=e.vertexNormals.length;f<g;f++)b.multiplyVector3(e.vertexNormals[f]);a.multiplyVector3(e.centroid)}},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);if(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)}else if(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(){var a,
|
|
|
-b,c,d,e,f,g=new THREE.Vector3,h=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];d=this.vertices[c.a];e=this.vertices[c.b];f=this.vertices[c.c];g.sub(f.position,e.position);h.sub(d.position,e.position);g.crossSelf(h);g.isZero()||g.normalize();c.normal.copy(g)}},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++){c=this.faces[a];if(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=this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)d[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3){d[c.a].addSelf(c.normal);d[c.b].addSelf(c.normal);d[c.c].addSelf(c.normal)}else if(c instanceof
|
|
|
-THREE.Face4){d[c.a].addSelf(c.normal);d[c.b].addSelf(c.normal);d[c.c].addSelf(c.normal);d[c.d].addSelf(c.normal)}}a=0;for(b=this.vertices.length;a<b;a++)d[a].normalize();a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c])}else if(c instanceof THREE.Face4){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c]);c.vertexNormals[3].copy(d[c.d])}}},
|
|
|
-computeMorphNormals:function(){var a,b,c,d,e;c=0;for(d=this.faces.length;c<d;c++){e=this.faces[c];e.__originalFaceNormal?e.__originalFaceNormal.copy(e.normal):e.__originalFaceNormal=e.normal.clone();if(!e.__originalVertexNormals)e.__originalVertexNormals=[];a=0;for(b=e.vertexNormals.length;a<b;a++)e.__originalVertexNormals[a]?e.__originalVertexNormals[a].copy(e.vertexNormals[a]):e.__originalVertexNormals[a]=e.vertexNormals[a].clone()}var f=new THREE.Geometry;f.faces=this.faces;a=0;for(b=this.morphTargets.length;a<
|
|
|
-b;a++){if(!this.morphNormals[a]){this.morphNormals[a]={};this.morphNormals[a].faceNormals=[];this.morphNormals[a].vertexNormals=[];var g=this.morphNormals[a].faceNormals,h=this.morphNormals[a].vertexNormals,j,k;c=0;for(d=this.faces.length;c<d;c++){e=this.faces[c];j=new THREE.Vector3;k=e instanceof THREE.Face3?{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3}:{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3,d:new THREE.Vector3};g.push(j);h.push(k)}}g=this.morphNormals[a];f.vertices=
|
|
|
-this.morphTargets[a].vertices;f.computeFaceNormals();f.computeVertexNormals();c=0;for(d=this.faces.length;c<d;c++){e=this.faces[c];j=g.faceNormals[c];k=g.vertexNormals[c];j.copy(e.normal);if(e instanceof THREE.Face3){k.a.copy(e.vertexNormals[0]);k.b.copy(e.vertexNormals[1]);k.c.copy(e.vertexNormals[2])}else{k.a.copy(e.vertexNormals[0]);k.b.copy(e.vertexNormals[1]);k.c.copy(e.vertexNormals[2]);k.d.copy(e.vertexNormals[3])}}}c=0;for(d=this.faces.length;c<d;c++){e=this.faces[c];e.normal=e.__originalFaceNormal;
|
|
|
-e.vertexNormals=e.__originalVertexNormals}},computeTangents:function(){function a(a,b,c,d,e,f,G){h=a.vertices[b].position;j=a.vertices[c].position;k=a.vertices[d].position;l=g[e];p=g[f];m=g[G];o=j.x-h.x;r=k.x-h.x;n=j.y-h.y;q=k.y-h.y;u=j.z-h.z;t=k.z-h.z;y=p.u-l.u;s=m.u-l.u;x=p.v-l.v;D=m.v-l.v;B=1/(y*D-s*x);K.set((D*o-x*r)*B,(D*n-x*q)*B,(D*u-x*t)*B);L.set((y*r-s*o)*B,(y*q-s*n)*B,(y*t-s*u)*B);v[b].addSelf(K);v[c].addSelf(K);v[d].addSelf(K);C[b].addSelf(L);C[c].addSelf(L);C[d].addSelf(L)}var b,c,d,e,
|
|
|
-f,g,h,j,k,l,p,m,o,r,n,q,u,t,y,s,x,D,B,w,v=[],C=[],K=new THREE.Vector3,L=new THREE.Vector3,T=new THREE.Vector3,P=new THREE.Vector3,J=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++){v[b]=new THREE.Vector3;C[b]=new THREE.Vector3}b=0;for(c=this.faces.length;b<c;b++){f=this.faces[b];g=this.faceVertexUvs[0][b];if(f instanceof THREE.Face3)a(this,f.a,f.b,f.c,0,1,2);else if(f instanceof THREE.Face4){a(this,f.a,f.b,f.d,0,1,3);a(this,f.b,f.c,f.d,1,2,3)}}var N=["a","b","c","d"];b=0;for(c=this.faces.length;b<
|
|
|
-c;b++){f=this.faces[b];for(d=0;d<f.vertexNormals.length;d++){J.copy(f.vertexNormals[d]);e=f[N[d]];w=v[e];T.copy(w);T.subSelf(J.multiplyScalar(J.dot(w))).normalize();P.cross(f.vertexNormals[d],w);e=P.dot(C[e]);e=e<0?-1:1;f.vertexTangents[d]=new THREE.Vector4(T.x,T.y,T.z,e)}}this.hasTangents=true},computeBoundingBox:function(){if(!this.boundingBox)this.boundingBox={min:new THREE.Vector3,max:new THREE.Vector3};if(this.vertices.length>0){var a;a=this.vertices[0].position;this.boundingBox.min.copy(a);
|
|
|
-this.boundingBox.max.copy(a);for(var b=this.boundingBox.min,c=this.boundingBox.max,d=1,e=this.vertices.length;d<e;d++){a=this.vertices[d].position;if(a.x<b.x)b.x=a.x;else if(a.x>c.x)c.x=a.x;if(a.y<b.y)b.y=a.y;else if(a.y>c.y)c.y=a.y;if(a.z<b.z)b.z=a.z;else if(a.z>c.z)c.z=a.z}}else{this.boundingBox.min.set(0,0,0);this.boundingBox.max.set(0,0,0)}},computeBoundingSphere:function(){if(!this.boundingSphere)this.boundingSphere={radius:0};for(var a,b=0,c=0,d=this.vertices.length;c<d;c++){a=this.vertices[c].position.length();
|
|
|
-a>b&&(b=a)}this.boundingSphere.radius=b},mergeVertices:function(){var a={},b=[],c=[],d,e=Math.pow(10,4),f,g;f=0;for(g=this.vertices.length;f<g;f++){d=this.vertices[f].position;d=[Math.round(d.x*e),Math.round(d.y*e),Math.round(d.z*e)].join("_");if(a[d]===void 0){a[d]=f;b.push(this.vertices[f]);c[f]=b.length-1}else c[f]=c[a[d]]}f=0;for(g=this.faces.length;f<g;f++){a=this.faces[f];if(a instanceof THREE.Face3){a.a=c[a.a];a.b=c[a.b];a.c=c[a.c]}else if(a instanceof THREE.Face4){a.a=c[a.a];a.b=c[a.b];a.c=
|
|
|
-c[a.c];a.d=c[a.d]}}this.vertices=b}};THREE.GeometryCount=0;
|
|
|
+THREE.Geometry.prototype={constructor:THREE.Geometry,applyMatrix:function(a){var b=new THREE.Matrix4;b.extractRotation(a);for(var c=0,d=this.vertices.length;c<d;c++)a.multiplyVector3(this.vertices[c]);c=0;for(d=this.faces.length;c<d;c++){var e=this.faces[c];b.multiplyVector3(e.normal);for(var f=0,g=e.vertexNormals.length;f<g;f++)b.multiplyVector3(e.vertexNormals[f]);a.multiplyVector3(e.centroid)}},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);if(c instanceof THREE.Face3){c.centroid.addSelf(this.vertices[c.a]);c.centroid.addSelf(this.vertices[c.b]);c.centroid.addSelf(this.vertices[c.c]);c.centroid.divideScalar(3)}else if(c instanceof THREE.Face4){c.centroid.addSelf(this.vertices[c.a]);c.centroid.addSelf(this.vertices[c.b]);c.centroid.addSelf(this.vertices[c.c]);c.centroid.addSelf(this.vertices[c.d]);c.centroid.divideScalar(4)}}},computeFaceNormals:function(){var a,b,c,d,e,f,g=new THREE.Vector3,h=new THREE.Vector3;a=0;for(b=this.faces.length;a<
|
|
|
+b;a++){c=this.faces[a];d=this.vertices[c.a];e=this.vertices[c.b];f=this.vertices[c.c];g.sub(f,e);h.sub(d,e);g.crossSelf(h);g.isZero()||g.normalize();c.normal.copy(g)}},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++){c=this.faces[a];if(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=this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)d[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3){d[c.a].addSelf(c.normal);d[c.b].addSelf(c.normal);d[c.c].addSelf(c.normal)}else if(c instanceof THREE.Face4){d[c.a].addSelf(c.normal);d[c.b].addSelf(c.normal);d[c.c].addSelf(c.normal);d[c.d].addSelf(c.normal)}}a=0;
|
|
|
+for(b=this.vertices.length;a<b;a++)d[a].normalize();a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c])}else if(c instanceof THREE.Face4){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c]);c.vertexNormals[3].copy(d[c.d])}}},computeMorphNormals:function(){var a,b,c,d,e;c=0;for(d=this.faces.length;c<d;c++){e=this.faces[c];e.__originalFaceNormal?
|
|
|
+e.__originalFaceNormal.copy(e.normal):e.__originalFaceNormal=e.normal.clone();if(!e.__originalVertexNormals)e.__originalVertexNormals=[];a=0;for(b=e.vertexNormals.length;a<b;a++)e.__originalVertexNormals[a]?e.__originalVertexNormals[a].copy(e.vertexNormals[a]):e.__originalVertexNormals[a]=e.vertexNormals[a].clone()}var f=new THREE.Geometry;f.faces=this.faces;a=0;for(b=this.morphTargets.length;a<b;a++){if(!this.morphNormals[a]){this.morphNormals[a]={};this.morphNormals[a].faceNormals=[];this.morphNormals[a].vertexNormals=
|
|
|
+[];var g=this.morphNormals[a].faceNormals,h=this.morphNormals[a].vertexNormals,j,k;c=0;for(d=this.faces.length;c<d;c++){e=this.faces[c];j=new THREE.Vector3;k=e instanceof THREE.Face3?{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3}:{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3,d:new THREE.Vector3};g.push(j);h.push(k)}}g=this.morphNormals[a];f.vertices=this.morphTargets[a].vertices;f.computeFaceNormals();f.computeVertexNormals();c=0;for(d=this.faces.length;c<d;c++){e=this.faces[c];
|
|
|
+j=g.faceNormals[c];k=g.vertexNormals[c];j.copy(e.normal);if(e instanceof THREE.Face3){k.a.copy(e.vertexNormals[0]);k.b.copy(e.vertexNormals[1]);k.c.copy(e.vertexNormals[2])}else{k.a.copy(e.vertexNormals[0]);k.b.copy(e.vertexNormals[1]);k.c.copy(e.vertexNormals[2]);k.d.copy(e.vertexNormals[3])}}}c=0;for(d=this.faces.length;c<d;c++){e=this.faces[c];e.normal=e.__originalFaceNormal;e.vertexNormals=e.__originalVertexNormals}},computeTangents:function(){function a(a,b,c,d,e,f,G){h=a.vertices[b];j=a.vertices[c];
|
|
|
+k=a.vertices[d];l=g[e];p=g[f];m=g[G];o=j.x-h.x;r=k.x-h.x;n=j.y-h.y;q=k.y-h.y;u=j.z-h.z;t=k.z-h.z;y=p.u-l.u;s=m.u-l.u;x=p.v-l.v;D=m.v-l.v;B=1/(y*D-s*x);K.set((D*o-x*r)*B,(D*n-x*q)*B,(D*u-x*t)*B);L.set((y*r-s*o)*B,(y*q-s*n)*B,(y*t-s*u)*B);v[b].addSelf(K);v[c].addSelf(K);v[d].addSelf(K);C[b].addSelf(L);C[c].addSelf(L);C[d].addSelf(L)}var b,c,d,e,f,g,h,j,k,l,p,m,o,r,n,q,u,t,y,s,x,D,B,w,v=[],C=[],K=new THREE.Vector3,L=new THREE.Vector3,T=new THREE.Vector3,P=new THREE.Vector3,J=new THREE.Vector3;b=0;for(c=
|
|
|
+this.vertices.length;b<c;b++){v[b]=new THREE.Vector3;C[b]=new THREE.Vector3}b=0;for(c=this.faces.length;b<c;b++){f=this.faces[b];g=this.faceVertexUvs[0][b];if(f instanceof THREE.Face3)a(this,f.a,f.b,f.c,0,1,2);else if(f instanceof THREE.Face4){a(this,f.a,f.b,f.d,0,1,3);a(this,f.b,f.c,f.d,1,2,3)}}var N=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){f=this.faces[b];for(d=0;d<f.vertexNormals.length;d++){J.copy(f.vertexNormals[d]);e=f[N[d]];w=v[e];T.copy(w);T.subSelf(J.multiplyScalar(J.dot(w))).normalize();
|
|
|
+P.cross(f.vertexNormals[d],w);e=P.dot(C[e]);e=e<0?-1:1;f.vertexTangents[d]=new THREE.Vector4(T.x,T.y,T.z,e)}}this.hasTangents=true},computeBoundingBox:function(){if(!this.boundingBox)this.boundingBox={min:new THREE.Vector3,max:new THREE.Vector3};if(this.vertices.length>0){var a;a=this.vertices[0];this.boundingBox.min.copy(a);this.boundingBox.max.copy(a);for(var b=this.boundingBox.min,c=this.boundingBox.max,d=1,e=this.vertices.length;d<e;d++){a=this.vertices[d];if(a.x<b.x)b.x=a.x;else if(a.x>c.x)c.x=
|
|
|
+a.x;if(a.y<b.y)b.y=a.y;else if(a.y>c.y)c.y=a.y;if(a.z<b.z)b.z=a.z;else if(a.z>c.z)c.z=a.z}}else{this.boundingBox.min.set(0,0,0);this.boundingBox.max.set(0,0,0)}},computeBoundingSphere:function(){if(!this.boundingSphere)this.boundingSphere={radius:0};for(var a,b=0,c=0,d=this.vertices.length;c<d;c++){a=this.vertices[c].length();a>b&&(b=a)}this.boundingSphere.radius=b},mergeVertices:function(){var a={},b=[],c=[],d,e=Math.pow(10,4),f,g;f=0;for(g=this.vertices.length;f<g;f++){d=this.vertices[f];d=[Math.round(d.x*
|
|
|
+e),Math.round(d.y*e),Math.round(d.z*e)].join("_");if(a[d]===void 0){a[d]=f;b.push(this.vertices[f]);c[f]=b.length-1}else c[f]=c[a[d]]}f=0;for(g=this.faces.length;f<g;f++){a=this.faces[f];if(a instanceof THREE.Face3){a.a=c[a.a];a.b=c[a.b];a.c=c[a.c]}else if(a instanceof THREE.Face4){a.a=c[a.a];a.b=c[a.b];a.c=c[a.c];a.d=c[a.d]}}this.vertices=b}};THREE.GeometryCount=0;
|
|
|
THREE.Spline=function(a){function b(a,b,c,d,e,f,g){a=(c-a)*0.5;d=(d-b)*0.5;return(2*(b-c)+a+d)*g+(-3*(b-c)-2*a-d)*f+a*e+b}this.points=a;var c=[],d={x:0,y:0,z:0},e,f,g,h,j,k,l,p,m;this.initFromArray=function(a){this.points=[];for(var b=0;b<a.length;b++)this.points[b]={x:a[b][0],y:a[b][1],z:a[b][2]}};this.getPoint=function(a){e=(this.points.length-1)*a;f=Math.floor(e);g=e-f;c[0]=f===0?f:f-1;c[1]=f;c[2]=f>this.points.length-2?this.points.length-1:f+1;c[3]=f>this.points.length-3?this.points.length-1:
|
|
|
f+2;k=this.points[c[0]];l=this.points[c[1]];p=this.points[c[2]];m=this.points[c[3]];h=g*g;j=g*h;d.x=b(k.x,l.x,p.x,m.x,g,h,j);d.y=b(k.y,l.y,p.y,m.y,g,h,j);d.z=b(k.z,l.z,p.z,m.z,g,h,j);return d};this.getControlPointsArray=function(){var a,b,c=this.points.length,d=[];for(a=0;a<c;a++){b=this.points[a];d[a]=[b.x,b.y,b.z]}return d};this.getLength=function(a){var b,c,d,e=b=b=0,f=new THREE.Vector3,g=new THREE.Vector3,h=[],k=0;h[0]=0;a||(a=100);c=this.points.length*a;f.copy(this.points[0]);for(a=1;a<c;a++){b=
|
|
|
a/c;d=this.getPoint(b);g.copy(d);k=k+g.distanceTo(f);f.copy(d);b=(this.points.length-1)*b;b=Math.floor(b);if(b!=e){h[b]=k;e=b}}h[h.length]=k;return{chunks:h,total:k}};this.reparametrizeByArcLength=function(a){var b,c,d,e,f,g,h=[],k=new THREE.Vector3,j=this.getLength();h.push(k.copy(this.points[0]).clone());for(b=1;b<this.points.length;b++){c=j.chunks[b]-j.chunks[b-1];g=Math.ceil(a*c/j.total);e=(b-1)/(this.points.length-1);f=b/(this.points.length-1);for(c=1;c<g-1;c++){d=e+c*(1/g)*(f-e);d=this.getPoint(d);
|
|
@@ -152,7 +151,7 @@ THREE.SkinnedMesh=function(a,b){THREE.Mesh.call(this,a,b);this.identityMatrix=ne
|
|
|
d=this.bones[c];e.parent===-1?this.add(d):this.bones[e.parent].add(d)}this.boneMatrices=new Float32Array(16*this.bones.length);this.pose()}};THREE.SkinnedMesh.prototype=new THREE.Mesh;THREE.SkinnedMesh.prototype.constructor=THREE.SkinnedMesh;THREE.SkinnedMesh.prototype.addBone=function(a){a===void 0&&(a=new THREE.Bone(this));this.bones.push(a);return a};
|
|
|
THREE.SkinnedMesh.prototype.updateMatrixWorld=function(a){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||a){this.parent?this.matrixWorld.multiply(this.parent.matrixWorld,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=false}for(var a=0,b=this.children.length;a<b;a++){var c=this.children[a];c instanceof THREE.Bone?c.update(this.identityMatrix,false):c.updateMatrixWorld(true)}for(var b=this.bones.length,c=this.bones,d=this.boneMatrices,a=0;a<b;a++)c[a].skinMatrix.flattenToArrayOffset(d,
|
|
|
a*16)};
|
|
|
-THREE.SkinnedMesh.prototype.pose=function(){this.updateMatrixWorld(true);for(var a,b=[],c=0;c<this.bones.length;c++){a=this.bones[c];var d=new THREE.Matrix4;d.getInverse(a.skinMatrix);b.push(d);a.skinMatrix.flattenToArrayOffset(this.boneMatrices,c*16)}if(this.geometry.skinVerticesA===void 0){this.geometry.skinVerticesA=[];this.geometry.skinVerticesB=[];for(a=0;a<this.geometry.skinIndices.length;a++){var c=this.geometry.vertices[a].position,e=this.geometry.skinIndices[a].x,f=this.geometry.skinIndices[a].y,d=
|
|
|
+THREE.SkinnedMesh.prototype.pose=function(){this.updateMatrixWorld(true);for(var a,b=[],c=0;c<this.bones.length;c++){a=this.bones[c];var d=new THREE.Matrix4;d.getInverse(a.skinMatrix);b.push(d);a.skinMatrix.flattenToArrayOffset(this.boneMatrices,c*16)}if(this.geometry.skinVerticesA===void 0){this.geometry.skinVerticesA=[];this.geometry.skinVerticesB=[];for(a=0;a<this.geometry.skinIndices.length;a++){var c=this.geometry.vertices[a],e=this.geometry.skinIndices[a].x,f=this.geometry.skinIndices[a].y,d=
|
|
|
new THREE.Vector3(c.x,c.y,c.z);this.geometry.skinVerticesA.push(b[e].multiplyVector3(d));d=new THREE.Vector3(c.x,c.y,c.z);this.geometry.skinVerticesB.push(b[f].multiplyVector3(d));if(this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y!==1){c=(1-(this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y))*0.5;this.geometry.skinWeights[a].x=this.geometry.skinWeights[a].x+c;this.geometry.skinWeights[a].y=this.geometry.skinWeights[a].y+c}}}};
|
|
|
THREE.MorphAnimMesh=function(a,b){THREE.Mesh.call(this,a,b);this.duration=1E3;this.mirroredLoop=false;this.currentKeyframe=this.lastKeyframe=this.time=0;this.direction=1;this.directionBackwards=false;this.setFrameRange(0,this.geometry.morphTargets.length-1)};THREE.MorphAnimMesh.prototype=new THREE.Mesh;THREE.MorphAnimMesh.prototype.constructor=THREE.MorphAnimMesh;
|
|
|
THREE.MorphAnimMesh.prototype.setFrameRange=function(a,b){this.startKeyframe=a;this.endKeyframe=b;this.length=this.endKeyframe-this.startKeyframe+1};THREE.MorphAnimMesh.prototype.setDirectionForward=function(){this.direction=1;this.directionBackwards=false};THREE.MorphAnimMesh.prototype.setDirectionBackward=function(){this.direction=-1;this.directionBackwards=true};
|
|
@@ -250,20 +249,20 @@ THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform vec3
|
|
|
"}"].join("\n")},depthRGBA:{uniforms:{},vertexShader:[THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n"),fragmentShader:"vec4 pack_depth( const in float depth ) {\nconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\nconst vec4 bit_mask = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\nvec4 res = fract( depth * bit_shift );\nres -= res.xxyz * bit_mask;\nreturn res;\n}\nvoid main() {\ngl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n}"}};
|
|
|
THREE.WebGLRenderer=function(a){function b(a,b){var c=a.vertices.length,d=b.material;if(d.attributes){if(a.__webglCustomAttributesList===void 0)a.__webglCustomAttributesList=[];for(var e in d.attributes){var f=d.attributes[e];if(!f.__webglInitialized||f.createUniqueBuffers){f.__webglInitialized=true;var g=1;f.type==="v2"?g=2:f.type==="v3"?g=3:f.type==="v4"?g=4:f.type==="c"&&(g=3);f.size=g;f.array=new Float32Array(c*g);f.buffer=i.createBuffer();f.buffer.belongsToAttribute=e;f.needsUpdate=true}a.__webglCustomAttributesList.push(f)}}}
|
|
|
function c(a,b){if(a.material&&!(a.material instanceof THREE.MeshFaceMaterial))return a.material;if(b.materialIndex>=0)return a.geometry.materials[b.materialIndex]}function d(a){return a instanceof THREE.MeshBasicMaterial&&!a.envMap||a instanceof THREE.MeshDepthMaterial?false:a&&a.shading!==void 0&&a.shading===THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading}function e(a){return a.map||a.lightMap||a instanceof THREE.ShaderMaterial?true:false}function f(a,b,c){var d,e,f,g,h=a.vertices;g=h.length;
|
|
|
-var j=a.colors,k=j.length,l=a.__vertexArray,n=a.__colorArray,m=a.__sortArray,p=a.__dirtyVertices,o=a.__dirtyColors,r=a.__webglCustomAttributesList;if(c.sortParticles){ua.copy(ta);ua.multiplySelf(c.matrixWorld);for(d=0;d<g;d++){e=h[d].position;ab.copy(e);ua.multiplyVector3(ab);m[d]=[ab.z,d]}m.sort(function(a,b){return b[0]-a[0]});for(d=0;d<g;d++){e=h[m[d][1]].position;f=d*3;l[f]=e.x;l[f+1]=e.y;l[f+2]=e.z}for(d=0;d<k;d++){f=d*3;e=j[m[d][1]];n[f]=e.r;n[f+1]=e.g;n[f+2]=e.b}if(r){j=0;for(k=r.length;j<
|
|
|
-k;j++){h=r[j];if(h.boundTo===void 0||h.boundTo==="vertices"){f=0;e=h.value.length;if(h.size===1)for(d=0;d<e;d++){g=m[d][1];h.array[d]=h.value[g]}else if(h.size===2)for(d=0;d<e;d++){g=m[d][1];g=h.value[g];h.array[f]=g.x;h.array[f+1]=g.y;f=f+2}else if(h.size===3)if(h.type==="c")for(d=0;d<e;d++){g=m[d][1];g=h.value[g];h.array[f]=g.r;h.array[f+1]=g.g;h.array[f+2]=g.b;f=f+3}else for(d=0;d<e;d++){g=m[d][1];g=h.value[g];h.array[f]=g.x;h.array[f+1]=g.y;h.array[f+2]=g.z;f=f+3}else if(h.size===4)for(d=0;d<
|
|
|
-e;d++){g=m[d][1];g=h.value[g];h.array[f]=g.x;h.array[f+1]=g.y;h.array[f+2]=g.z;h.array[f+3]=g.w;f=f+4}}}}}else{if(p)for(d=0;d<g;d++){e=h[d].position;f=d*3;l[f]=e.x;l[f+1]=e.y;l[f+2]=e.z}if(o)for(d=0;d<k;d++){e=j[d];f=d*3;n[f]=e.r;n[f+1]=e.g;n[f+2]=e.b}if(r){j=0;for(k=r.length;j<k;j++){h=r[j];if(h.needsUpdate&&(h.boundTo===void 0||h.boundTo==="vertices")){e=h.value.length;f=0;if(h.size===1)for(d=0;d<e;d++)h.array[d]=h.value[d];else if(h.size===2)for(d=0;d<e;d++){g=h.value[d];h.array[f]=g.x;h.array[f+
|
|
|
-1]=g.y;f=f+2}else if(h.size===3)if(h.type==="c")for(d=0;d<e;d++){g=h.value[d];h.array[f]=g.r;h.array[f+1]=g.g;h.array[f+2]=g.b;f=f+3}else for(d=0;d<e;d++){g=h.value[d];h.array[f]=g.x;h.array[f+1]=g.y;h.array[f+2]=g.z;f=f+3}else if(h.size===4)for(d=0;d<e;d++){g=h.value[d];h.array[f]=g.x;h.array[f+1]=g.y;h.array[f+2]=g.z;h.array[f+3]=g.w;f=f+4}}}}}if(p||c.sortParticles){i.bindBuffer(i.ARRAY_BUFFER,a.__webglVertexBuffer);i.bufferData(i.ARRAY_BUFFER,l,b)}if(o||c.sortParticles){i.bindBuffer(i.ARRAY_BUFFER,
|
|
|
-a.__webglColorBuffer);i.bufferData(i.ARRAY_BUFFER,n,b)}if(r){j=0;for(k=r.length;j<k;j++){h=r[j];if(h.needsUpdate||c.sortParticles){i.bindBuffer(i.ARRAY_BUFFER,h.buffer);i.bufferData(i.ARRAY_BUFFER,h.array,b)}}}}function g(a,b){return b.z-a.z}function h(a,b,c){if(a.length)for(var d=0,e=a.length;d<e;d++){ha=E=null;W=G=wa=Na=$=-1;a[d].render(b,c,hb,mb);ha=E=null;W=G=wa=Na=$=-1}}function j(a,b,c,d,e,f,g,h){var i,j,k,l;if(b){j=a.length-1;l=b=-1}else{j=0;b=a.length;l=1}for(var n=j;n!==b;n=n+l){i=a[n];if(i.render){j=
|
|
|
-i.object;k=i.buffer;if(h)i=h;else{i=i[c];if(!i)continue;g&&F.setBlending(i.blending,i.blendEquation,i.blendSrc,i.blendDst);F.setDepthTest(i.depthTest);F.setDepthWrite(i.depthWrite);u(i.polygonOffset,i.polygonOffsetFactor,i.polygonOffsetUnits)}F.setObjectFaces(j);k instanceof THREE.BufferGeometry?F.renderBufferDirect(d,e,f,i,k,j):F.renderBuffer(d,e,f,i,k,j)}}}function k(a,b,c,d,e,f,g){for(var h,i,j=0,k=a.length;j<k;j++){h=a[j];i=h.object;if(i.visible){if(g)h=g;else{h=h[b];if(!h)continue;f&&F.setBlending(h.blending,
|
|
|
-h.blendEquation,h.blendSrc,h.blendDst);F.setDepthTest(h.depthTest);F.setDepthWrite(h.depthWrite);u(h.polygonOffset,h.polygonOffsetFactor,h.polygonOffsetUnits)}F.renderImmediateObject(c,d,e,h,i)}}}function l(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}function p(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return true;return false}function m(a){for(var b in a.attributes)a.attributes[b].needsUpdate=false}function o(a,b){for(var c=a.length-1;c>=0;c--)a[c].object===
|
|
|
-b&&a.splice(c,1)}function r(a,b){for(var c=a.length-1;c>=0;c--)a[c]===b&&a.splice(c,1)}function n(a,b,c,d,e){if(!d.program||d.needsUpdate){F.initMaterial(d,b,c,e);d.needsUpdate=false}if(d.morphTargets&&!e.__webglMorphTargetInfluences){e.__webglMorphTargetInfluences=new Float32Array(F.maxMorphTargets);for(var f=0,g=F.maxMorphTargets;f<g;f++)e.__webglMorphTargetInfluences[f]=0}var h=false,f=d.program,g=f.uniforms,j=d.uniforms;if(f!==E){i.useProgram(f);E=f;h=true}if(d.id!==W){W=d.id;h=true}if(h||a!==
|
|
|
-ha){i.uniformMatrix4fv(g.projectionMatrix,false,a._projectionMatrixArray);a!==ha&&(ha=a)}if(h){if(c&&d.fog){j.fogColor.value=c.color;if(c instanceof THREE.Fog){j.fogNear.value=c.near;j.fogFar.value=c.far}else if(c instanceof THREE.FogExp2)j.fogDensity.value=c.density}if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){for(var k,l=0,n=0,m=0,p,o,r,q=Ia,s=q.directional.colors,u=q.directional.positions,t=q.point.colors,H=q.point.positions,G=q.point.distances,w=0,
|
|
|
-v=0,x=r=0,c=0,h=b.length;c<h;c++){k=b[c];if(!k.onlyShadow){p=k.color;o=k.intensity;r=k.distance;if(k instanceof THREE.AmbientLight)if(F.gammaInput){l=l+p.r*p.r;n=n+p.g*p.g;m=m+p.b*p.b}else{l=l+p.r;n=n+p.g;m=m+p.b}else if(k instanceof THREE.DirectionalLight){r=w*3;if(F.gammaInput){s[r]=p.r*p.r*o*o;s[r+1]=p.g*p.g*o*o;s[r+2]=p.b*p.b*o*o}else{s[r]=p.r*o;s[r+1]=p.g*o;s[r+2]=p.b*o}pa.copy(k.matrixWorld.getPosition());pa.subSelf(k.target.matrixWorld.getPosition());pa.normalize();u[r]=pa.x;u[r+1]=pa.y;u[r+
|
|
|
-2]=pa.z;w=w+1}else if(k instanceof THREE.PointLight||k instanceof THREE.SpotLight){x=v*3;if(F.gammaInput){t[x]=p.r*p.r*o*o;t[x+1]=p.g*p.g*o*o;t[x+2]=p.b*p.b*o*o}else{t[x]=p.r*o;t[x+1]=p.g*o;t[x+2]=p.b*o}k=k.matrixWorld.getPosition();H[x]=k.x;H[x+1]=k.y;H[x+2]=k.z;G[v]=r;v=v+1}}}c=w*3;for(h=s.length;c<h;c++)s[c]=0;c=v*3;for(h=t.length;c<h;c++)t[c]=0;q.point.length=v;q.directional.length=w;q.ambient[0]=l;q.ambient[1]=n;q.ambient[2]=m;c=Ia;j.ambientLightColor.value=c.ambient;j.directionalLightColor.value=
|
|
|
-c.directional.colors;j.directionalLightDirection.value=c.directional.positions;j.pointLightColor.value=c.point.colors;j.pointLightPosition.value=c.point.positions;j.pointLightDistance.value=c.point.distances}if(d instanceof THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshPhongMaterial){j.opacity.value=d.opacity;F.gammaInput?j.diffuse.value.copyGammaToLinear(d.color):j.diffuse.value=d.color;(j.map.texture=d.map)&&j.offsetRepeat.value.set(d.map.offset.x,d.map.offset.y,
|
|
|
-d.map.repeat.x,d.map.repeat.y);j.lightMap.texture=d.lightMap;j.envMap.texture=d.envMap;j.flipEnvMap.value=d.envMap instanceof THREE.WebGLRenderTargetCube?1:-1;j.reflectivity.value=d.reflectivity;j.refractionRatio.value=d.refractionRatio;j.combine.value=d.combine;j.useRefract.value=d.envMap&&d.envMap.mapping instanceof THREE.CubeRefractionMapping}if(d instanceof THREE.LineBasicMaterial){j.diffuse.value=d.color;j.opacity.value=d.opacity}else if(d instanceof THREE.ParticleBasicMaterial){j.psColor.value=
|
|
|
-d.color;j.opacity.value=d.opacity;j.size.value=d.size;j.scale.value=B.height/2;j.map.texture=d.map}else if(d instanceof THREE.MeshPhongMaterial){j.shininess.value=d.shininess;if(F.gammaInput){j.ambient.value.copyGammaToLinear(d.ambient);j.emissive.value.copyGammaToLinear(d.emissive);j.specular.value.copyGammaToLinear(d.specular)}else{j.ambient.value=d.ambient;j.emissive.value=d.emissive;j.specular.value=d.specular}d.wrapAround&&j.wrapRGB.value.copy(d.wrapRGB)}else if(d instanceof THREE.MeshLambertMaterial){if(F.gammaInput){j.ambient.value.copyGammaToLinear(d.ambient);
|
|
|
+var j=a.colors,k=j.length,l=a.__vertexArray,n=a.__colorArray,m=a.__sortArray,p=a.__dirtyVertices,o=a.__dirtyColors,r=a.__webglCustomAttributesList;if(c.sortParticles){ua.copy(ta);ua.multiplySelf(c.matrixWorld);for(d=0;d<g;d++){e=h[d];ab.copy(e);ua.multiplyVector3(ab);m[d]=[ab.z,d]}m.sort(function(a,b){return b[0]-a[0]});for(d=0;d<g;d++){e=h[m[d][1]];f=d*3;l[f]=e.x;l[f+1]=e.y;l[f+2]=e.z}for(d=0;d<k;d++){f=d*3;e=j[m[d][1]];n[f]=e.r;n[f+1]=e.g;n[f+2]=e.b}if(r){j=0;for(k=r.length;j<k;j++){h=r[j];if(h.boundTo===
|
|
|
+void 0||h.boundTo==="vertices"){f=0;e=h.value.length;if(h.size===1)for(d=0;d<e;d++){g=m[d][1];h.array[d]=h.value[g]}else if(h.size===2)for(d=0;d<e;d++){g=m[d][1];g=h.value[g];h.array[f]=g.x;h.array[f+1]=g.y;f=f+2}else if(h.size===3)if(h.type==="c")for(d=0;d<e;d++){g=m[d][1];g=h.value[g];h.array[f]=g.r;h.array[f+1]=g.g;h.array[f+2]=g.b;f=f+3}else for(d=0;d<e;d++){g=m[d][1];g=h.value[g];h.array[f]=g.x;h.array[f+1]=g.y;h.array[f+2]=g.z;f=f+3}else if(h.size===4)for(d=0;d<e;d++){g=m[d][1];g=h.value[g];
|
|
|
+h.array[f]=g.x;h.array[f+1]=g.y;h.array[f+2]=g.z;h.array[f+3]=g.w;f=f+4}}}}}else{if(p)for(d=0;d<g;d++){e=h[d];f=d*3;l[f]=e.x;l[f+1]=e.y;l[f+2]=e.z}if(o)for(d=0;d<k;d++){e=j[d];f=d*3;n[f]=e.r;n[f+1]=e.g;n[f+2]=e.b}if(r){j=0;for(k=r.length;j<k;j++){h=r[j];if(h.needsUpdate&&(h.boundTo===void 0||h.boundTo==="vertices")){e=h.value.length;f=0;if(h.size===1)for(d=0;d<e;d++)h.array[d]=h.value[d];else if(h.size===2)for(d=0;d<e;d++){g=h.value[d];h.array[f]=g.x;h.array[f+1]=g.y;f=f+2}else if(h.size===3)if(h.type===
|
|
|
+"c")for(d=0;d<e;d++){g=h.value[d];h.array[f]=g.r;h.array[f+1]=g.g;h.array[f+2]=g.b;f=f+3}else for(d=0;d<e;d++){g=h.value[d];h.array[f]=g.x;h.array[f+1]=g.y;h.array[f+2]=g.z;f=f+3}else if(h.size===4)for(d=0;d<e;d++){g=h.value[d];h.array[f]=g.x;h.array[f+1]=g.y;h.array[f+2]=g.z;h.array[f+3]=g.w;f=f+4}}}}}if(p||c.sortParticles){i.bindBuffer(i.ARRAY_BUFFER,a.__webglVertexBuffer);i.bufferData(i.ARRAY_BUFFER,l,b)}if(o||c.sortParticles){i.bindBuffer(i.ARRAY_BUFFER,a.__webglColorBuffer);i.bufferData(i.ARRAY_BUFFER,
|
|
|
+n,b)}if(r){j=0;for(k=r.length;j<k;j++){h=r[j];if(h.needsUpdate||c.sortParticles){i.bindBuffer(i.ARRAY_BUFFER,h.buffer);i.bufferData(i.ARRAY_BUFFER,h.array,b)}}}}function g(a,b){return b.z-a.z}function h(a,b,c){if(a.length)for(var d=0,e=a.length;d<e;d++){ha=E=null;W=G=wa=Na=$=-1;a[d].render(b,c,hb,mb);ha=E=null;W=G=wa=Na=$=-1}}function j(a,b,c,d,e,f,g,h){var i,j,k,l;if(b){j=a.length-1;l=b=-1}else{j=0;b=a.length;l=1}for(var n=j;n!==b;n=n+l){i=a[n];if(i.render){j=i.object;k=i.buffer;if(h)i=h;else{i=
|
|
|
+i[c];if(!i)continue;g&&F.setBlending(i.blending,i.blendEquation,i.blendSrc,i.blendDst);F.setDepthTest(i.depthTest);F.setDepthWrite(i.depthWrite);u(i.polygonOffset,i.polygonOffsetFactor,i.polygonOffsetUnits)}F.setObjectFaces(j);k instanceof THREE.BufferGeometry?F.renderBufferDirect(d,e,f,i,k,j):F.renderBuffer(d,e,f,i,k,j)}}}function k(a,b,c,d,e,f,g){for(var h,i,j=0,k=a.length;j<k;j++){h=a[j];i=h.object;if(i.visible){if(g)h=g;else{h=h[b];if(!h)continue;f&&F.setBlending(h.blending,h.blendEquation,h.blendSrc,
|
|
|
+h.blendDst);F.setDepthTest(h.depthTest);F.setDepthWrite(h.depthWrite);u(h.polygonOffset,h.polygonOffsetFactor,h.polygonOffsetUnits)}F.renderImmediateObject(c,d,e,h,i)}}}function l(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}function p(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return true;return false}function m(a){for(var b in a.attributes)a.attributes[b].needsUpdate=false}function o(a,b){for(var c=a.length-1;c>=0;c--)a[c].object===b&&a.splice(c,1)}function r(a,
|
|
|
+b){for(var c=a.length-1;c>=0;c--)a[c]===b&&a.splice(c,1)}function n(a,b,c,d,e){if(!d.program||d.needsUpdate){F.initMaterial(d,b,c,e);d.needsUpdate=false}if(d.morphTargets&&!e.__webglMorphTargetInfluences){e.__webglMorphTargetInfluences=new Float32Array(F.maxMorphTargets);for(var f=0,g=F.maxMorphTargets;f<g;f++)e.__webglMorphTargetInfluences[f]=0}var h=false,f=d.program,g=f.uniforms,j=d.uniforms;if(f!==E){i.useProgram(f);E=f;h=true}if(d.id!==W){W=d.id;h=true}if(h||a!==ha){i.uniformMatrix4fv(g.projectionMatrix,
|
|
|
+false,a._projectionMatrixArray);a!==ha&&(ha=a)}if(h){if(c&&d.fog){j.fogColor.value=c.color;if(c instanceof THREE.Fog){j.fogNear.value=c.near;j.fogFar.value=c.far}else if(c instanceof THREE.FogExp2)j.fogDensity.value=c.density}if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){for(var k,l=0,n=0,m=0,p,o,r,q=Ia,s=q.directional.colors,u=q.directional.positions,t=q.point.colors,H=q.point.positions,G=q.point.distances,w=0,v=0,x=r=0,c=0,h=b.length;c<h;c++){k=b[c];
|
|
|
+if(!k.onlyShadow){p=k.color;o=k.intensity;r=k.distance;if(k instanceof THREE.AmbientLight)if(F.gammaInput){l=l+p.r*p.r;n=n+p.g*p.g;m=m+p.b*p.b}else{l=l+p.r;n=n+p.g;m=m+p.b}else if(k instanceof THREE.DirectionalLight){r=w*3;if(F.gammaInput){s[r]=p.r*p.r*o*o;s[r+1]=p.g*p.g*o*o;s[r+2]=p.b*p.b*o*o}else{s[r]=p.r*o;s[r+1]=p.g*o;s[r+2]=p.b*o}pa.copy(k.matrixWorld.getPosition());pa.subSelf(k.target.matrixWorld.getPosition());pa.normalize();u[r]=pa.x;u[r+1]=pa.y;u[r+2]=pa.z;w=w+1}else if(k instanceof THREE.PointLight||
|
|
|
+k instanceof THREE.SpotLight){x=v*3;if(F.gammaInput){t[x]=p.r*p.r*o*o;t[x+1]=p.g*p.g*o*o;t[x+2]=p.b*p.b*o*o}else{t[x]=p.r*o;t[x+1]=p.g*o;t[x+2]=p.b*o}k=k.matrixWorld.getPosition();H[x]=k.x;H[x+1]=k.y;H[x+2]=k.z;G[v]=r;v=v+1}}}c=w*3;for(h=s.length;c<h;c++)s[c]=0;c=v*3;for(h=t.length;c<h;c++)t[c]=0;q.point.length=v;q.directional.length=w;q.ambient[0]=l;q.ambient[1]=n;q.ambient[2]=m;c=Ia;j.ambientLightColor.value=c.ambient;j.directionalLightColor.value=c.directional.colors;j.directionalLightDirection.value=
|
|
|
+c.directional.positions;j.pointLightColor.value=c.point.colors;j.pointLightPosition.value=c.point.positions;j.pointLightDistance.value=c.point.distances}if(d instanceof THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshPhongMaterial){j.opacity.value=d.opacity;F.gammaInput?j.diffuse.value.copyGammaToLinear(d.color):j.diffuse.value=d.color;(j.map.texture=d.map)&&j.offsetRepeat.value.set(d.map.offset.x,d.map.offset.y,d.map.repeat.x,d.map.repeat.y);j.lightMap.texture=
|
|
|
+d.lightMap;j.envMap.texture=d.envMap;j.flipEnvMap.value=d.envMap instanceof THREE.WebGLRenderTargetCube?1:-1;j.reflectivity.value=d.reflectivity;j.refractionRatio.value=d.refractionRatio;j.combine.value=d.combine;j.useRefract.value=d.envMap&&d.envMap.mapping instanceof THREE.CubeRefractionMapping}if(d instanceof THREE.LineBasicMaterial){j.diffuse.value=d.color;j.opacity.value=d.opacity}else if(d instanceof THREE.ParticleBasicMaterial){j.psColor.value=d.color;j.opacity.value=d.opacity;j.size.value=
|
|
|
+d.size;j.scale.value=B.height/2;j.map.texture=d.map}else if(d instanceof THREE.MeshPhongMaterial){j.shininess.value=d.shininess;if(F.gammaInput){j.ambient.value.copyGammaToLinear(d.ambient);j.emissive.value.copyGammaToLinear(d.emissive);j.specular.value.copyGammaToLinear(d.specular)}else{j.ambient.value=d.ambient;j.emissive.value=d.emissive;j.specular.value=d.specular}d.wrapAround&&j.wrapRGB.value.copy(d.wrapRGB)}else if(d instanceof THREE.MeshLambertMaterial){if(F.gammaInput){j.ambient.value.copyGammaToLinear(d.ambient);
|
|
|
j.emissive.value.copyGammaToLinear(d.emissive)}else{j.ambient.value=d.ambient;j.emissive.value=d.emissive}d.wrapAround&&j.wrapRGB.value.copy(d.wrapRGB)}else if(d instanceof THREE.MeshDepthMaterial){j.mNear.value=a.near;j.mFar.value=a.far;j.opacity.value=d.opacity}else if(d instanceof THREE.MeshNormalMaterial)j.opacity.value=d.opacity;if(e.receiveShadow&&!d._shadowPass&&j.shadowMatrix){h=c=0;for(l=b.length;h<l;h++){n=b[h];if(n.castShadow&&(n instanceof THREE.SpotLight||n instanceof THREE.DirectionalLight&&
|
|
|
!n.shadowCascade)){j.shadowMap.texture[c]=n.shadowMap;j.shadowMapSize.value[c]=n.shadowMapSize;j.shadowMatrix.value[c]=n.shadowMatrix;j.shadowDarkness.value[c]=n.shadowDarkness;j.shadowBias.value[c]=n.shadowBias;c++}}}b=d.uniformsList;j=0;for(c=b.length;j<c;j++)if(n=f.uniforms[b[j][1]]){h=b[j][0];m=h.type;l=h.value;if(m==="i")i.uniform1i(n,l);else if(m==="f")i.uniform1f(n,l);else if(m==="v2")i.uniform2f(n,l.x,l.y);else if(m==="v3")i.uniform3f(n,l.x,l.y,l.z);else if(m==="v4")i.uniform4f(n,l.x,l.y,
|
|
|
l.z,l.w);else if(m==="c")i.uniform3f(n,l.r,l.g,l.b);else if(m==="fv1")i.uniform1fv(n,l);else if(m==="fv")i.uniform3fv(n,l);else if(m==="v2v"){if(!h._array)h._array=new Float32Array(2*l.length);m=0;for(q=l.length;m<q;m++){s=m*2;h._array[s]=l[m].x;h._array[s+1]=l[m].y}i.uniform2fv(n,h._array)}else if(m==="v3v"){if(!h._array)h._array=new Float32Array(3*l.length);m=0;for(q=l.length;m<q;m++){s=m*3;h._array[s]=l[m].x;h._array[s+1]=l[m].y;h._array[s+2]=l[m].z}i.uniform3fv(n,h._array)}else if(m=="v4v"){if(!h._array)h._array=
|
|
@@ -325,43 +324,43 @@ Ka instanceof THREE.ParticleSystem||Ka instanceof THREE.Ribbon||Ka instanceof TH
|
|
|
void 0;if(nb instanceof THREE.Mesh)if(ka instanceof THREE.BufferGeometry){ka.__dirtyVertices=false;ka.__dirtyElements=false;ka.__dirtyUvs=false;ka.__dirtyNormals=false;ka.__dirtyColors=false}else{for(var Uc=0,od=ka.geometryGroupsList.length;Uc<od;Uc++){qc=ka.geometryGroupsList[Uc];bb=c(nb,qc);ic=bb.attributes&&p(bb);if(ka.__dirtyVertices||ka.__dirtyMorphTargets||ka.__dirtyElements||ka.__dirtyUvs||ka.__dirtyNormals||ka.__dirtyColors||ka.__dirtyTangents||ic){var ga=qc,pd=nb,eb=i.DYNAMIC_DRAW,qd=!ka.dynamic,
|
|
|
bc=bb;if(ga.__inittedArrays){var dd=d(bc),Vc=bc.vertexColors?bc.vertexColors:false,ed=e(bc),Fc=dd===THREE.SmoothShading,I=void 0,V=void 0,lb=void 0,O=void 0,jc=void 0,Ob=void 0,ob=void 0,Gc=void 0,Hb=void 0,kc=void 0,lc=void 0,X=void 0,Y=void 0,Z=void 0,qa=void 0,pb=void 0,qb=void 0,rb=void 0,rc=void 0,sb=void 0,tb=void 0,ub=void 0,sc=void 0,vb=void 0,wb=void 0,xb=void 0,tc=void 0,yb=void 0,zb=void 0,Ab=void 0,uc=void 0,Bb=void 0,Cb=void 0,Db=void 0,vc=void 0,Pb=void 0,Qb=void 0,Rb=void 0,Hc=void 0,
|
|
|
Sb=void 0,Tb=void 0,Ub=void 0,Ic=void 0,ma=void 0,fd=void 0,Vb=void 0,mc=void 0,nc=void 0,Qa=void 0,gd=void 0,La=void 0,Ma=void 0,Wb=void 0,Ib=void 0,Ea=0,Ja=0,Jb=0,Kb=0,ib=0,Va=0,ra=0,Za=0,Fa=0,M=0,da=0,A=0,fb=void 0,Ra=ga.__vertexArray,wc=ga.__uvArray,xc=ga.__uv2Array,jb=ga.__normalArray,ya=ga.__tangentArray,Sa=ga.__colorArray,za=ga.__skinVertexAArray,Aa=ga.__skinVertexBArray,Ba=ga.__skinIndexArray,Ca=ga.__skinWeightArray,Wc=ga.__morphTargetsArrays,Xc=ga.__morphNormalsArrays,Yc=ga.__webglCustomAttributesList,
|
|
|
-z=void 0,Eb=ga.__faceArray,gb=ga.__lineArray,$a=pd.geometry,rd=$a.__dirtyElements,hd=$a.__dirtyUvs,sd=$a.__dirtyNormals,td=$a.__dirtyTangents,ud=$a.__dirtyColors,vd=$a.__dirtyMorphTargets,cc=$a.vertices,na=ga.faces3,oa=ga.faces4,Ga=$a.faces,Zc=$a.faceVertexUvs[0],$c=$a.faceVertexUvs[1],dc=$a.skinVerticesA,ec=$a.skinVerticesB,fc=$a.skinIndices,Xb=$a.skinWeights,Yb=$a.morphTargets,Jc=$a.morphNormals;if($a.__dirtyVertices){I=0;for(V=na.length;I<V;I++){O=Ga[na[I]];X=cc[O.a].position;Y=cc[O.b].position;
|
|
|
-Z=cc[O.c].position;Ra[Ja]=X.x;Ra[Ja+1]=X.y;Ra[Ja+2]=X.z;Ra[Ja+3]=Y.x;Ra[Ja+4]=Y.y;Ra[Ja+5]=Y.z;Ra[Ja+6]=Z.x;Ra[Ja+7]=Z.y;Ra[Ja+8]=Z.z;Ja=Ja+9}I=0;for(V=oa.length;I<V;I++){O=Ga[oa[I]];X=cc[O.a].position;Y=cc[O.b].position;Z=cc[O.c].position;qa=cc[O.d].position;Ra[Ja]=X.x;Ra[Ja+1]=X.y;Ra[Ja+2]=X.z;Ra[Ja+3]=Y.x;Ra[Ja+4]=Y.y;Ra[Ja+5]=Y.z;Ra[Ja+6]=Z.x;Ra[Ja+7]=Z.y;Ra[Ja+8]=Z.z;Ra[Ja+9]=qa.x;Ra[Ja+10]=qa.y;Ra[Ja+11]=qa.z;Ja=Ja+12}i.bindBuffer(i.ARRAY_BUFFER,ga.__webglVertexBuffer);i.bufferData(i.ARRAY_BUFFER,
|
|
|
-Ra,eb)}if(vd){Qa=0;for(gd=Yb.length;Qa<gd;Qa++){I=da=0;for(V=na.length;I<V;I++){Wb=na[I];O=Ga[Wb];X=Yb[Qa].vertices[O.a].position;Y=Yb[Qa].vertices[O.b].position;Z=Yb[Qa].vertices[O.c].position;La=Wc[Qa];La[da]=X.x;La[da+1]=X.y;La[da+2]=X.z;La[da+3]=Y.x;La[da+4]=Y.y;La[da+5]=Y.z;La[da+6]=Z.x;La[da+7]=Z.y;La[da+8]=Z.z;if(bc.morphNormals){if(Fc){Ib=Jc[Qa].vertexNormals[Wb];sb=Ib.a;tb=Ib.b;ub=Ib.c}else ub=tb=sb=Jc[Qa].faceNormals[Wb];Ma=Xc[Qa];Ma[da]=sb.x;Ma[da+1]=sb.y;Ma[da+2]=sb.z;Ma[da+3]=tb.x;Ma[da+
|
|
|
-4]=tb.y;Ma[da+5]=tb.z;Ma[da+6]=ub.x;Ma[da+7]=ub.y;Ma[da+8]=ub.z}da=da+9}I=0;for(V=oa.length;I<V;I++){Wb=oa[I];O=Ga[Wb];X=Yb[Qa].vertices[O.a].position;Y=Yb[Qa].vertices[O.b].position;Z=Yb[Qa].vertices[O.c].position;qa=Yb[Qa].vertices[O.d].position;La=Wc[Qa];La[da]=X.x;La[da+1]=X.y;La[da+2]=X.z;La[da+3]=Y.x;La[da+4]=Y.y;La[da+5]=Y.z;La[da+6]=Z.x;La[da+7]=Z.y;La[da+8]=Z.z;La[da+9]=qa.x;La[da+10]=qa.y;La[da+11]=qa.z;if(bc.morphNormals){if(Fc){Ib=Jc[Qa].vertexNormals[Wb];sb=Ib.a;tb=Ib.b;ub=Ib.c;sc=Ib.d}else sc=
|
|
|
-ub=tb=sb=Jc[Qa].faceNormals[Wb];Ma=Xc[Qa];Ma[da]=sb.x;Ma[da+1]=sb.y;Ma[da+2]=sb.z;Ma[da+3]=tb.x;Ma[da+4]=tb.y;Ma[da+5]=tb.z;Ma[da+6]=ub.x;Ma[da+7]=ub.y;Ma[da+8]=ub.z;Ma[da+9]=sc.x;Ma[da+10]=sc.y;Ma[da+11]=sc.z}da=da+12}i.bindBuffer(i.ARRAY_BUFFER,ga.__webglMorphTargetsBuffers[Qa]);i.bufferData(i.ARRAY_BUFFER,Wc[Qa],eb);if(bc.morphNormals){i.bindBuffer(i.ARRAY_BUFFER,ga.__webglMorphNormalsBuffers[Qa]);i.bufferData(i.ARRAY_BUFFER,Xc[Qa],eb)}}}if(Xb.length){I=0;for(V=na.length;I<V;I++){O=Ga[na[I]];yb=
|
|
|
-Xb[O.a];zb=Xb[O.b];Ab=Xb[O.c];Ca[M]=yb.x;Ca[M+1]=yb.y;Ca[M+2]=yb.z;Ca[M+3]=yb.w;Ca[M+4]=zb.x;Ca[M+5]=zb.y;Ca[M+6]=zb.z;Ca[M+7]=zb.w;Ca[M+8]=Ab.x;Ca[M+9]=Ab.y;Ca[M+10]=Ab.z;Ca[M+11]=Ab.w;Bb=fc[O.a];Cb=fc[O.b];Db=fc[O.c];Ba[M]=Bb.x;Ba[M+1]=Bb.y;Ba[M+2]=Bb.z;Ba[M+3]=Bb.w;Ba[M+4]=Cb.x;Ba[M+5]=Cb.y;Ba[M+6]=Cb.z;Ba[M+7]=Cb.w;Ba[M+8]=Db.x;Ba[M+9]=Db.y;Ba[M+10]=Db.z;Ba[M+11]=Db.w;Pb=dc[O.a];Qb=dc[O.b];Rb=dc[O.c];za[M]=Pb.x;za[M+1]=Pb.y;za[M+2]=Pb.z;za[M+3]=1;za[M+4]=Qb.x;za[M+5]=Qb.y;za[M+6]=Qb.z;za[M+7]=
|
|
|
-1;za[M+8]=Rb.x;za[M+9]=Rb.y;za[M+10]=Rb.z;za[M+11]=1;Sb=ec[O.a];Tb=ec[O.b];Ub=ec[O.c];Aa[M]=Sb.x;Aa[M+1]=Sb.y;Aa[M+2]=Sb.z;Aa[M+3]=1;Aa[M+4]=Tb.x;Aa[M+5]=Tb.y;Aa[M+6]=Tb.z;Aa[M+7]=1;Aa[M+8]=Ub.x;Aa[M+9]=Ub.y;Aa[M+10]=Ub.z;Aa[M+11]=1;M=M+12}I=0;for(V=oa.length;I<V;I++){O=Ga[oa[I]];yb=Xb[O.a];zb=Xb[O.b];Ab=Xb[O.c];uc=Xb[O.d];Ca[M]=yb.x;Ca[M+1]=yb.y;Ca[M+2]=yb.z;Ca[M+3]=yb.w;Ca[M+4]=zb.x;Ca[M+5]=zb.y;Ca[M+6]=zb.z;Ca[M+7]=zb.w;Ca[M+8]=Ab.x;Ca[M+9]=Ab.y;Ca[M+10]=Ab.z;Ca[M+11]=Ab.w;Ca[M+12]=uc.x;Ca[M+13]=
|
|
|
-uc.y;Ca[M+14]=uc.z;Ca[M+15]=uc.w;Bb=fc[O.a];Cb=fc[O.b];Db=fc[O.c];vc=fc[O.d];Ba[M]=Bb.x;Ba[M+1]=Bb.y;Ba[M+2]=Bb.z;Ba[M+3]=Bb.w;Ba[M+4]=Cb.x;Ba[M+5]=Cb.y;Ba[M+6]=Cb.z;Ba[M+7]=Cb.w;Ba[M+8]=Db.x;Ba[M+9]=Db.y;Ba[M+10]=Db.z;Ba[M+11]=Db.w;Ba[M+12]=vc.x;Ba[M+13]=vc.y;Ba[M+14]=vc.z;Ba[M+15]=vc.w;Pb=dc[O.a];Qb=dc[O.b];Rb=dc[O.c];Hc=dc[O.d];za[M]=Pb.x;za[M+1]=Pb.y;za[M+2]=Pb.z;za[M+3]=1;za[M+4]=Qb.x;za[M+5]=Qb.y;za[M+6]=Qb.z;za[M+7]=1;za[M+8]=Rb.x;za[M+9]=Rb.y;za[M+10]=Rb.z;za[M+11]=1;za[M+12]=Hc.x;za[M+13]=
|
|
|
-Hc.y;za[M+14]=Hc.z;za[M+15]=1;Sb=ec[O.a];Tb=ec[O.b];Ub=ec[O.c];Ic=ec[O.d];Aa[M]=Sb.x;Aa[M+1]=Sb.y;Aa[M+2]=Sb.z;Aa[M+3]=1;Aa[M+4]=Tb.x;Aa[M+5]=Tb.y;Aa[M+6]=Tb.z;Aa[M+7]=1;Aa[M+8]=Ub.x;Aa[M+9]=Ub.y;Aa[M+10]=Ub.z;Aa[M+11]=1;Aa[M+12]=Ic.x;Aa[M+13]=Ic.y;Aa[M+14]=Ic.z;Aa[M+15]=1;M=M+16}if(M>0){i.bindBuffer(i.ARRAY_BUFFER,ga.__webglSkinVertexABuffer);i.bufferData(i.ARRAY_BUFFER,za,eb);i.bindBuffer(i.ARRAY_BUFFER,ga.__webglSkinVertexBBuffer);i.bufferData(i.ARRAY_BUFFER,Aa,eb);i.bindBuffer(i.ARRAY_BUFFER,
|
|
|
-ga.__webglSkinIndicesBuffer);i.bufferData(i.ARRAY_BUFFER,Ba,eb);i.bindBuffer(i.ARRAY_BUFFER,ga.__webglSkinWeightsBuffer);i.bufferData(i.ARRAY_BUFFER,Ca,eb)}}if(ud&&Vc){I=0;for(V=na.length;I<V;I++){O=Ga[na[I]];ob=O.vertexColors;Gc=O.color;if(ob.length===3&&Vc===THREE.VertexColors){vb=ob[0];wb=ob[1];xb=ob[2]}else xb=wb=vb=Gc;Sa[Fa]=vb.r;Sa[Fa+1]=vb.g;Sa[Fa+2]=vb.b;Sa[Fa+3]=wb.r;Sa[Fa+4]=wb.g;Sa[Fa+5]=wb.b;Sa[Fa+6]=xb.r;Sa[Fa+7]=xb.g;Sa[Fa+8]=xb.b;Fa=Fa+9}I=0;for(V=oa.length;I<V;I++){O=Ga[oa[I]];ob=
|
|
|
-O.vertexColors;Gc=O.color;if(ob.length===4&&Vc===THREE.VertexColors){vb=ob[0];wb=ob[1];xb=ob[2];tc=ob[3]}else tc=xb=wb=vb=Gc;Sa[Fa]=vb.r;Sa[Fa+1]=vb.g;Sa[Fa+2]=vb.b;Sa[Fa+3]=wb.r;Sa[Fa+4]=wb.g;Sa[Fa+5]=wb.b;Sa[Fa+6]=xb.r;Sa[Fa+7]=xb.g;Sa[Fa+8]=xb.b;Sa[Fa+9]=tc.r;Sa[Fa+10]=tc.g;Sa[Fa+11]=tc.b;Fa=Fa+12}if(Fa>0){i.bindBuffer(i.ARRAY_BUFFER,ga.__webglColorBuffer);i.bufferData(i.ARRAY_BUFFER,Sa,eb)}}if(td&&$a.hasTangents){I=0;for(V=na.length;I<V;I++){O=Ga[na[I]];Hb=O.vertexTangents;pb=Hb[0];qb=Hb[1];rb=
|
|
|
-Hb[2];ya[ra]=pb.x;ya[ra+1]=pb.y;ya[ra+2]=pb.z;ya[ra+3]=pb.w;ya[ra+4]=qb.x;ya[ra+5]=qb.y;ya[ra+6]=qb.z;ya[ra+7]=qb.w;ya[ra+8]=rb.x;ya[ra+9]=rb.y;ya[ra+10]=rb.z;ya[ra+11]=rb.w;ra=ra+12}I=0;for(V=oa.length;I<V;I++){O=Ga[oa[I]];Hb=O.vertexTangents;pb=Hb[0];qb=Hb[1];rb=Hb[2];rc=Hb[3];ya[ra]=pb.x;ya[ra+1]=pb.y;ya[ra+2]=pb.z;ya[ra+3]=pb.w;ya[ra+4]=qb.x;ya[ra+5]=qb.y;ya[ra+6]=qb.z;ya[ra+7]=qb.w;ya[ra+8]=rb.x;ya[ra+9]=rb.y;ya[ra+10]=rb.z;ya[ra+11]=rb.w;ya[ra+12]=rc.x;ya[ra+13]=rc.y;ya[ra+14]=rc.z;ya[ra+15]=
|
|
|
-rc.w;ra=ra+16}i.bindBuffer(i.ARRAY_BUFFER,ga.__webglTangentBuffer);i.bufferData(i.ARRAY_BUFFER,ya,eb)}if(sd&&dd){I=0;for(V=na.length;I<V;I++){O=Ga[na[I]];jc=O.vertexNormals;Ob=O.normal;if(jc.length===3&&Fc)for(ma=0;ma<3;ma++){Vb=jc[ma];jb[Va]=Vb.x;jb[Va+1]=Vb.y;jb[Va+2]=Vb.z;Va=Va+3}else for(ma=0;ma<3;ma++){jb[Va]=Ob.x;jb[Va+1]=Ob.y;jb[Va+2]=Ob.z;Va=Va+3}}I=0;for(V=oa.length;I<V;I++){O=Ga[oa[I]];jc=O.vertexNormals;Ob=O.normal;if(jc.length===4&&Fc)for(ma=0;ma<4;ma++){Vb=jc[ma];jb[Va]=Vb.x;jb[Va+1]=
|
|
|
-Vb.y;jb[Va+2]=Vb.z;Va=Va+3}else for(ma=0;ma<4;ma++){jb[Va]=Ob.x;jb[Va+1]=Ob.y;jb[Va+2]=Ob.z;Va=Va+3}}i.bindBuffer(i.ARRAY_BUFFER,ga.__webglNormalBuffer);i.bufferData(i.ARRAY_BUFFER,jb,eb)}if(hd&&Zc&&ed){I=0;for(V=na.length;I<V;I++){lb=na[I];O=Ga[lb];kc=Zc[lb];if(kc!==void 0)for(ma=0;ma<3;ma++){mc=kc[ma];wc[Jb]=mc.u;wc[Jb+1]=mc.v;Jb=Jb+2}}I=0;for(V=oa.length;I<V;I++){lb=oa[I];O=Ga[lb];kc=Zc[lb];if(kc!==void 0)for(ma=0;ma<4;ma++){mc=kc[ma];wc[Jb]=mc.u;wc[Jb+1]=mc.v;Jb=Jb+2}}if(Jb>0){i.bindBuffer(i.ARRAY_BUFFER,
|
|
|
-ga.__webglUVBuffer);i.bufferData(i.ARRAY_BUFFER,wc,eb)}}if(hd&&$c&&ed){I=0;for(V=na.length;I<V;I++){lb=na[I];O=Ga[lb];lc=$c[lb];if(lc!==void 0)for(ma=0;ma<3;ma++){nc=lc[ma];xc[Kb]=nc.u;xc[Kb+1]=nc.v;Kb=Kb+2}}I=0;for(V=oa.length;I<V;I++){lb=oa[I];O=Ga[lb];lc=$c[lb];if(lc!==void 0)for(ma=0;ma<4;ma++){nc=lc[ma];xc[Kb]=nc.u;xc[Kb+1]=nc.v;Kb=Kb+2}}if(Kb>0){i.bindBuffer(i.ARRAY_BUFFER,ga.__webglUV2Buffer);i.bufferData(i.ARRAY_BUFFER,xc,eb)}}if(rd){I=0;for(V=na.length;I<V;I++){O=Ga[na[I]];Eb[ib]=Ea;Eb[ib+
|
|
|
-1]=Ea+1;Eb[ib+2]=Ea+2;ib=ib+3;gb[Za]=Ea;gb[Za+1]=Ea+1;gb[Za+2]=Ea;gb[Za+3]=Ea+2;gb[Za+4]=Ea+1;gb[Za+5]=Ea+2;Za=Za+6;Ea=Ea+3}I=0;for(V=oa.length;I<V;I++){O=Ga[oa[I]];Eb[ib]=Ea;Eb[ib+1]=Ea+1;Eb[ib+2]=Ea+3;Eb[ib+3]=Ea+1;Eb[ib+4]=Ea+2;Eb[ib+5]=Ea+3;ib=ib+6;gb[Za]=Ea;gb[Za+1]=Ea+1;gb[Za+2]=Ea;gb[Za+3]=Ea+3;gb[Za+4]=Ea+1;gb[Za+5]=Ea+2;gb[Za+6]=Ea+2;gb[Za+7]=Ea+3;Za=Za+8;Ea=Ea+4}i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,ga.__webglFaceBuffer);i.bufferData(i.ELEMENT_ARRAY_BUFFER,Eb,eb);i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,
|
|
|
-ga.__webglLineBuffer);i.bufferData(i.ELEMENT_ARRAY_BUFFER,gb,eb)}if(Yc){ma=0;for(fd=Yc.length;ma<fd;ma++){z=Yc[ma];if(z.__original.needsUpdate){A=0;if(z.size===1)if(z.boundTo===void 0||z.boundTo==="vertices"){I=0;for(V=na.length;I<V;I++){O=Ga[na[I]];z.array[A]=z.value[O.a];z.array[A+1]=z.value[O.b];z.array[A+2]=z.value[O.c];A=A+3}I=0;for(V=oa.length;I<V;I++){O=Ga[oa[I]];z.array[A]=z.value[O.a];z.array[A+1]=z.value[O.b];z.array[A+2]=z.value[O.c];z.array[A+3]=z.value[O.d];A=A+4}}else{if(z.boundTo===
|
|
|
-"faces"){I=0;for(V=na.length;I<V;I++){fb=z.value[na[I]];z.array[A]=fb;z.array[A+1]=fb;z.array[A+2]=fb;A=A+3}I=0;for(V=oa.length;I<V;I++){fb=z.value[oa[I]];z.array[A]=fb;z.array[A+1]=fb;z.array[A+2]=fb;z.array[A+3]=fb;A=A+4}}}else if(z.size===2)if(z.boundTo===void 0||z.boundTo==="vertices"){I=0;for(V=na.length;I<V;I++){O=Ga[na[I]];X=z.value[O.a];Y=z.value[O.b];Z=z.value[O.c];z.array[A]=X.x;z.array[A+1]=X.y;z.array[A+2]=Y.x;z.array[A+3]=Y.y;z.array[A+4]=Z.x;z.array[A+5]=Z.y;A=A+6}I=0;for(V=oa.length;I<
|
|
|
-V;I++){O=Ga[oa[I]];X=z.value[O.a];Y=z.value[O.b];Z=z.value[O.c];qa=z.value[O.d];z.array[A]=X.x;z.array[A+1]=X.y;z.array[A+2]=Y.x;z.array[A+3]=Y.y;z.array[A+4]=Z.x;z.array[A+5]=Z.y;z.array[A+6]=qa.x;z.array[A+7]=qa.y;A=A+8}}else{if(z.boundTo==="faces"){I=0;for(V=na.length;I<V;I++){Z=Y=X=fb=z.value[na[I]];z.array[A]=X.x;z.array[A+1]=X.y;z.array[A+2]=Y.x;z.array[A+3]=Y.y;z.array[A+4]=Z.x;z.array[A+5]=Z.y;A=A+6}I=0;for(V=oa.length;I<V;I++){qa=Z=Y=X=fb=z.value[oa[I]];z.array[A]=X.x;z.array[A+1]=X.y;z.array[A+
|
|
|
-2]=Y.x;z.array[A+3]=Y.y;z.array[A+4]=Z.x;z.array[A+5]=Z.y;z.array[A+6]=qa.x;z.array[A+7]=qa.y;A=A+8}}}else if(z.size===3){var ia;ia=z.type==="c"?["r","g","b"]:["x","y","z"];if(z.boundTo===void 0||z.boundTo==="vertices"){I=0;for(V=na.length;I<V;I++){O=Ga[na[I]];X=z.value[O.a];Y=z.value[O.b];Z=z.value[O.c];z.array[A]=X[ia[0]];z.array[A+1]=X[ia[1]];z.array[A+2]=X[ia[2]];z.array[A+3]=Y[ia[0]];z.array[A+4]=Y[ia[1]];z.array[A+5]=Y[ia[2]];z.array[A+6]=Z[ia[0]];z.array[A+7]=Z[ia[1]];z.array[A+8]=Z[ia[2]];
|
|
|
-A=A+9}I=0;for(V=oa.length;I<V;I++){O=Ga[oa[I]];X=z.value[O.a];Y=z.value[O.b];Z=z.value[O.c];qa=z.value[O.d];z.array[A]=X[ia[0]];z.array[A+1]=X[ia[1]];z.array[A+2]=X[ia[2]];z.array[A+3]=Y[ia[0]];z.array[A+4]=Y[ia[1]];z.array[A+5]=Y[ia[2]];z.array[A+6]=Z[ia[0]];z.array[A+7]=Z[ia[1]];z.array[A+8]=Z[ia[2]];z.array[A+9]=qa[ia[0]];z.array[A+10]=qa[ia[1]];z.array[A+11]=qa[ia[2]];A=A+12}}else if(z.boundTo==="faces"){I=0;for(V=na.length;I<V;I++){Z=Y=X=fb=z.value[na[I]];z.array[A]=X[ia[0]];z.array[A+1]=X[ia[1]];
|
|
|
-z.array[A+2]=X[ia[2]];z.array[A+3]=Y[ia[0]];z.array[A+4]=Y[ia[1]];z.array[A+5]=Y[ia[2]];z.array[A+6]=Z[ia[0]];z.array[A+7]=Z[ia[1]];z.array[A+8]=Z[ia[2]];A=A+9}I=0;for(V=oa.length;I<V;I++){qa=Z=Y=X=fb=z.value[oa[I]];z.array[A]=X[ia[0]];z.array[A+1]=X[ia[1]];z.array[A+2]=X[ia[2]];z.array[A+3]=Y[ia[0]];z.array[A+4]=Y[ia[1]];z.array[A+5]=Y[ia[2]];z.array[A+6]=Z[ia[0]];z.array[A+7]=Z[ia[1]];z.array[A+8]=Z[ia[2]];z.array[A+9]=qa[ia[0]];z.array[A+10]=qa[ia[1]];z.array[A+11]=qa[ia[2]];A=A+12}}}else if(z.size===
|
|
|
-4)if(z.boundTo===void 0||z.boundTo==="vertices"){I=0;for(V=na.length;I<V;I++){O=Ga[na[I]];X=z.value[O.a];Y=z.value[O.b];Z=z.value[O.c];z.array[A]=X.x;z.array[A+1]=X.y;z.array[A+2]=X.z;z.array[A+3]=X.w;z.array[A+4]=Y.x;z.array[A+5]=Y.y;z.array[A+6]=Y.z;z.array[A+7]=Y.w;z.array[A+8]=Z.x;z.array[A+9]=Z.y;z.array[A+10]=Z.z;z.array[A+11]=Z.w;A=A+12}I=0;for(V=oa.length;I<V;I++){O=Ga[oa[I]];X=z.value[O.a];Y=z.value[O.b];Z=z.value[O.c];qa=z.value[O.d];z.array[A]=X.x;z.array[A+1]=X.y;z.array[A+2]=X.z;z.array[A+
|
|
|
-3]=X.w;z.array[A+4]=Y.x;z.array[A+5]=Y.y;z.array[A+6]=Y.z;z.array[A+7]=Y.w;z.array[A+8]=Z.x;z.array[A+9]=Z.y;z.array[A+10]=Z.z;z.array[A+11]=Z.w;z.array[A+12]=qa.x;z.array[A+13]=qa.y;z.array[A+14]=qa.z;z.array[A+15]=qa.w;A=A+16}}else if(z.boundTo==="faces"){I=0;for(V=na.length;I<V;I++){Z=Y=X=fb=z.value[na[I]];z.array[A]=X.x;z.array[A+1]=X.y;z.array[A+2]=X.z;z.array[A+3]=X.w;z.array[A+4]=Y.x;z.array[A+5]=Y.y;z.array[A+6]=Y.z;z.array[A+7]=Y.w;z.array[A+8]=Z.x;z.array[A+9]=Z.y;z.array[A+10]=Z.z;z.array[A+
|
|
|
-11]=Z.w;A=A+12}I=0;for(V=oa.length;I<V;I++){qa=Z=Y=X=fb=z.value[oa[I]];z.array[A]=X.x;z.array[A+1]=X.y;z.array[A+2]=X.z;z.array[A+3]=X.w;z.array[A+4]=Y.x;z.array[A+5]=Y.y;z.array[A+6]=Y.z;z.array[A+7]=Y.w;z.array[A+8]=Z.x;z.array[A+9]=Z.y;z.array[A+10]=Z.z;z.array[A+11]=Z.w;z.array[A+12]=qa.x;z.array[A+13]=qa.y;z.array[A+14]=qa.z;z.array[A+15]=qa.w;A=A+16}}i.bindBuffer(i.ARRAY_BUFFER,z.buffer);i.bufferData(i.ARRAY_BUFFER,z.array,eb)}}}if(qd){delete ga.__inittedArrays;delete ga.__colorArray;delete ga.__normalArray;
|
|
|
-delete ga.__tangentArray;delete ga.__uvArray;delete ga.__uv2Array;delete ga.__faceArray;delete ga.__vertexArray;delete ga.__lineArray;delete ga.__skinVertexAArray;delete ga.__skinVertexBArray;delete ga.__skinIndexArray;delete ga.__skinWeightArray}}}}ka.__dirtyVertices=false;ka.__dirtyMorphTargets=false;ka.__dirtyElements=false;ka.__dirtyUvs=false;ka.__dirtyNormals=false;ka.__dirtyColors=false;ka.__dirtyTangents=false;bb.attributes&&m(bb)}else if(nb instanceof THREE.Ribbon){if(ka.__dirtyVertices||
|
|
|
-ka.__dirtyColors){var Zb=ka,id=i.DYNAMIC_DRAW,yc=void 0,zc=void 0,Kc=void 0,$b=void 0,Lc=void 0,jd=Zb.vertices,kd=Zb.colors,wd=jd.length,xd=kd.length,Mc=Zb.__vertexArray,Nc=Zb.__colorArray,yd=Zb.__dirtyColors;if(Zb.__dirtyVertices){for(yc=0;yc<wd;yc++){Kc=jd[yc].position;$b=yc*3;Mc[$b]=Kc.x;Mc[$b+1]=Kc.y;Mc[$b+2]=Kc.z}i.bindBuffer(i.ARRAY_BUFFER,Zb.__webglVertexBuffer);i.bufferData(i.ARRAY_BUFFER,Mc,id)}if(yd){for(zc=0;zc<xd;zc++){Lc=kd[zc];$b=zc*3;Nc[$b]=Lc.r;Nc[$b+1]=Lc.g;Nc[$b+2]=Lc.b}i.bindBuffer(i.ARRAY_BUFFER,
|
|
|
-Zb.__webglColorBuffer);i.bufferData(i.ARRAY_BUFFER,Nc,id)}}ka.__dirtyVertices=false;ka.__dirtyColors=false}else if(nb instanceof THREE.Line){bb=c(nb,qc);ic=bb.attributes&&p(bb);if(ka.__dirtyVertices||ka.__dirtyColors||ic){var Lb=ka,ad=i.DYNAMIC_DRAW,Ac=void 0,Bc=void 0,Oc=void 0,Da=void 0,Pc=void 0,ld=Lb.vertices,md=Lb.colors,zd=ld.length,Ad=md.length,Qc=Lb.__vertexArray,Rc=Lb.__colorArray,Bd=Lb.__dirtyColors,bd=Lb.__webglCustomAttributesList,Sc=void 0,nd=void 0,Ua=void 0,oc=void 0,cb=void 0,va=void 0;
|
|
|
-if(Lb.__dirtyVertices){for(Ac=0;Ac<zd;Ac++){Oc=ld[Ac].position;Da=Ac*3;Qc[Da]=Oc.x;Qc[Da+1]=Oc.y;Qc[Da+2]=Oc.z}i.bindBuffer(i.ARRAY_BUFFER,Lb.__webglVertexBuffer);i.bufferData(i.ARRAY_BUFFER,Qc,ad)}if(Bd){for(Bc=0;Bc<Ad;Bc++){Pc=md[Bc];Da=Bc*3;Rc[Da]=Pc.r;Rc[Da+1]=Pc.g;Rc[Da+2]=Pc.b}i.bindBuffer(i.ARRAY_BUFFER,Lb.__webglColorBuffer);i.bufferData(i.ARRAY_BUFFER,Rc,ad)}if(bd){Sc=0;for(nd=bd.length;Sc<nd;Sc++){va=bd[Sc];if(va.needsUpdate&&(va.boundTo===void 0||va.boundTo==="vertices")){Da=0;oc=va.value.length;
|
|
|
-if(va.size===1)for(Ua=0;Ua<oc;Ua++)va.array[Ua]=va.value[Ua];else if(va.size===2)for(Ua=0;Ua<oc;Ua++){cb=va.value[Ua];va.array[Da]=cb.x;va.array[Da+1]=cb.y;Da=Da+2}else if(va.size===3)if(va.type==="c")for(Ua=0;Ua<oc;Ua++){cb=va.value[Ua];va.array[Da]=cb.r;va.array[Da+1]=cb.g;va.array[Da+2]=cb.b;Da=Da+3}else for(Ua=0;Ua<oc;Ua++){cb=va.value[Ua];va.array[Da]=cb.x;va.array[Da+1]=cb.y;va.array[Da+2]=cb.z;Da=Da+3}else if(va.size===4)for(Ua=0;Ua<oc;Ua++){cb=va.value[Ua];va.array[Da]=cb.x;va.array[Da+1]=
|
|
|
-cb.y;va.array[Da+2]=cb.z;va.array[Da+3]=cb.w;Da=Da+4}i.bindBuffer(i.ARRAY_BUFFER,va.buffer);i.bufferData(i.ARRAY_BUFFER,va.array,ad)}}}}ka.__dirtyVertices=false;ka.__dirtyColors=false;bb.attributes&&m(bb)}else if(nb instanceof THREE.ParticleSystem){bb=c(nb,qc);ic=bb.attributes&&p(bb);(ka.__dirtyVertices||ka.__dirtyColors||nb.sortParticles||ic)&&f(ka,i.DYNAMIC_DRAW,nb);ka.__dirtyVertices=false;ka.__dirtyColors=false;bb.attributes&&m(bb)}}};this.initMaterial=function(a,b,c,d){var e,f,g;a instanceof
|
|
|
-THREE.MeshDepthMaterial?g="depth":a instanceof THREE.MeshNormalMaterial?g="normal":a instanceof THREE.MeshBasicMaterial?g="basic":a instanceof THREE.MeshLambertMaterial?g="lambert":a instanceof THREE.MeshPhongMaterial?g="phong":a instanceof THREE.LineBasicMaterial?g="basic":a instanceof THREE.ParticleBasicMaterial&&(g="particle_basic");if(g){var h=THREE.ShaderLib[g];a.uniforms=THREE.UniformsUtils.clone(h.uniforms);a.vertexShader=h.vertexShader;a.fragmentShader=h.fragmentShader}var j,k,l,m;j=m=h=0;
|
|
|
-for(k=b.length;j<k;j++){l=b[j];if(!l.onlyShadow){l instanceof THREE.DirectionalLight&&m++;l instanceof THREE.PointLight&&h++;l instanceof THREE.SpotLight&&h++}}if(h+m<=N){l=m;m=h}else{l=Math.ceil(N*m/(h+m));m=N-l}var n=0,h=0;for(j=b.length;h<j;h++){k=b[h];if(k.castShadow){k instanceof THREE.SpotLight&&n++;k instanceof THREE.DirectionalLight&&!k.shadowCascade&&n++}}var p=50;if(d!==void 0&&d instanceof THREE.SkinnedMesh)p=d.bones.length;var o;a:{j=a.fragmentShader;k=a.vertexShader;var h=a.uniforms,
|
|
|
-b=a.attributes,c={map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap,vertexColors:a.vertexColors,fog:c,useFog:a.fog,sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,morphTargets:a.morphTargets,morphNormals:a.morphNormals,maxMorphTargets:this.maxMorphTargets,maxMorphNormals:this.maxMorphNormals,maxDirLights:l,maxPointLights:m,maxBones:p,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapDebug:this.shadowMapDebug,shadowMapCascade:this.shadowMapCascade,
|
|
|
-maxShadows:n,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel,wrapAround:a.wrapAround,doubleSided:d&&d.doubleSided},r,d=[];if(g)d.push(g);else{d.push(j);d.push(k)}for(r in c){d.push(r);d.push(c[r])}g=d.join();r=0;for(d=U.length;r<d;r++)if(U[r].code===g){o=U[r].program;break a}r=i.createProgram();d=["precision "+w+" float;",Xa>0?"#define VERTEX_TEXTURES":"",F.gammaInput?"#define GAMMA_INPUT":"",F.gammaOutput?"#define GAMMA_OUTPUT":"",F.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":
|
|
|
-"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,"#define MAX_BONES "+c.maxBones,c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.skinning?"#define USE_SKINNING":"",c.morphTargets?"#define USE_MORPHTARGETS":"",c.morphNormals?"#define USE_MORPHNORMALS":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.wrapAround?"#define WRAP_AROUND":"",c.doubleSided?
|
|
|
-"#define DOUBLE_SIDED":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"",c.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\n#ifdef USE_MORPHNORMALS\nattribute vec3 morphNormal0;\nattribute vec3 morphNormal1;\nattribute vec3 morphNormal2;\nattribute vec3 morphNormal3;\n#else\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
|
|
|
+z=void 0,Eb=ga.__faceArray,gb=ga.__lineArray,$a=pd.geometry,rd=$a.__dirtyElements,hd=$a.__dirtyUvs,sd=$a.__dirtyNormals,td=$a.__dirtyTangents,ud=$a.__dirtyColors,vd=$a.__dirtyMorphTargets,cc=$a.vertices,na=ga.faces3,oa=ga.faces4,Ga=$a.faces,Zc=$a.faceVertexUvs[0],$c=$a.faceVertexUvs[1],dc=$a.skinVerticesA,ec=$a.skinVerticesB,fc=$a.skinIndices,Xb=$a.skinWeights,Yb=$a.morphTargets,Jc=$a.morphNormals;if($a.__dirtyVertices){I=0;for(V=na.length;I<V;I++){O=Ga[na[I]];X=cc[O.a];Y=cc[O.b];Z=cc[O.c];Ra[Ja]=
|
|
|
+X.x;Ra[Ja+1]=X.y;Ra[Ja+2]=X.z;Ra[Ja+3]=Y.x;Ra[Ja+4]=Y.y;Ra[Ja+5]=Y.z;Ra[Ja+6]=Z.x;Ra[Ja+7]=Z.y;Ra[Ja+8]=Z.z;Ja=Ja+9}I=0;for(V=oa.length;I<V;I++){O=Ga[oa[I]];X=cc[O.a];Y=cc[O.b];Z=cc[O.c];qa=cc[O.d];Ra[Ja]=X.x;Ra[Ja+1]=X.y;Ra[Ja+2]=X.z;Ra[Ja+3]=Y.x;Ra[Ja+4]=Y.y;Ra[Ja+5]=Y.z;Ra[Ja+6]=Z.x;Ra[Ja+7]=Z.y;Ra[Ja+8]=Z.z;Ra[Ja+9]=qa.x;Ra[Ja+10]=qa.y;Ra[Ja+11]=qa.z;Ja=Ja+12}i.bindBuffer(i.ARRAY_BUFFER,ga.__webglVertexBuffer);i.bufferData(i.ARRAY_BUFFER,Ra,eb)}if(vd){Qa=0;for(gd=Yb.length;Qa<gd;Qa++){I=da=0;
|
|
|
+for(V=na.length;I<V;I++){Wb=na[I];O=Ga[Wb];X=Yb[Qa].vertices[O.a];Y=Yb[Qa].vertices[O.b];Z=Yb[Qa].vertices[O.c];La=Wc[Qa];La[da]=X.x;La[da+1]=X.y;La[da+2]=X.z;La[da+3]=Y.x;La[da+4]=Y.y;La[da+5]=Y.z;La[da+6]=Z.x;La[da+7]=Z.y;La[da+8]=Z.z;if(bc.morphNormals){if(Fc){Ib=Jc[Qa].vertexNormals[Wb];sb=Ib.a;tb=Ib.b;ub=Ib.c}else ub=tb=sb=Jc[Qa].faceNormals[Wb];Ma=Xc[Qa];Ma[da]=sb.x;Ma[da+1]=sb.y;Ma[da+2]=sb.z;Ma[da+3]=tb.x;Ma[da+4]=tb.y;Ma[da+5]=tb.z;Ma[da+6]=ub.x;Ma[da+7]=ub.y;Ma[da+8]=ub.z}da=da+9}I=0;for(V=
|
|
|
+oa.length;I<V;I++){Wb=oa[I];O=Ga[Wb];X=Yb[Qa].vertices[O.a];Y=Yb[Qa].vertices[O.b];Z=Yb[Qa].vertices[O.c];qa=Yb[Qa].vertices[O.d];La=Wc[Qa];La[da]=X.x;La[da+1]=X.y;La[da+2]=X.z;La[da+3]=Y.x;La[da+4]=Y.y;La[da+5]=Y.z;La[da+6]=Z.x;La[da+7]=Z.y;La[da+8]=Z.z;La[da+9]=qa.x;La[da+10]=qa.y;La[da+11]=qa.z;if(bc.morphNormals){if(Fc){Ib=Jc[Qa].vertexNormals[Wb];sb=Ib.a;tb=Ib.b;ub=Ib.c;sc=Ib.d}else sc=ub=tb=sb=Jc[Qa].faceNormals[Wb];Ma=Xc[Qa];Ma[da]=sb.x;Ma[da+1]=sb.y;Ma[da+2]=sb.z;Ma[da+3]=tb.x;Ma[da+4]=tb.y;
|
|
|
+Ma[da+5]=tb.z;Ma[da+6]=ub.x;Ma[da+7]=ub.y;Ma[da+8]=ub.z;Ma[da+9]=sc.x;Ma[da+10]=sc.y;Ma[da+11]=sc.z}da=da+12}i.bindBuffer(i.ARRAY_BUFFER,ga.__webglMorphTargetsBuffers[Qa]);i.bufferData(i.ARRAY_BUFFER,Wc[Qa],eb);if(bc.morphNormals){i.bindBuffer(i.ARRAY_BUFFER,ga.__webglMorphNormalsBuffers[Qa]);i.bufferData(i.ARRAY_BUFFER,Xc[Qa],eb)}}}if(Xb.length){I=0;for(V=na.length;I<V;I++){O=Ga[na[I]];yb=Xb[O.a];zb=Xb[O.b];Ab=Xb[O.c];Ca[M]=yb.x;Ca[M+1]=yb.y;Ca[M+2]=yb.z;Ca[M+3]=yb.w;Ca[M+4]=zb.x;Ca[M+5]=zb.y;Ca[M+
|
|
|
+6]=zb.z;Ca[M+7]=zb.w;Ca[M+8]=Ab.x;Ca[M+9]=Ab.y;Ca[M+10]=Ab.z;Ca[M+11]=Ab.w;Bb=fc[O.a];Cb=fc[O.b];Db=fc[O.c];Ba[M]=Bb.x;Ba[M+1]=Bb.y;Ba[M+2]=Bb.z;Ba[M+3]=Bb.w;Ba[M+4]=Cb.x;Ba[M+5]=Cb.y;Ba[M+6]=Cb.z;Ba[M+7]=Cb.w;Ba[M+8]=Db.x;Ba[M+9]=Db.y;Ba[M+10]=Db.z;Ba[M+11]=Db.w;Pb=dc[O.a];Qb=dc[O.b];Rb=dc[O.c];za[M]=Pb.x;za[M+1]=Pb.y;za[M+2]=Pb.z;za[M+3]=1;za[M+4]=Qb.x;za[M+5]=Qb.y;za[M+6]=Qb.z;za[M+7]=1;za[M+8]=Rb.x;za[M+9]=Rb.y;za[M+10]=Rb.z;za[M+11]=1;Sb=ec[O.a];Tb=ec[O.b];Ub=ec[O.c];Aa[M]=Sb.x;Aa[M+1]=Sb.y;
|
|
|
+Aa[M+2]=Sb.z;Aa[M+3]=1;Aa[M+4]=Tb.x;Aa[M+5]=Tb.y;Aa[M+6]=Tb.z;Aa[M+7]=1;Aa[M+8]=Ub.x;Aa[M+9]=Ub.y;Aa[M+10]=Ub.z;Aa[M+11]=1;M=M+12}I=0;for(V=oa.length;I<V;I++){O=Ga[oa[I]];yb=Xb[O.a];zb=Xb[O.b];Ab=Xb[O.c];uc=Xb[O.d];Ca[M]=yb.x;Ca[M+1]=yb.y;Ca[M+2]=yb.z;Ca[M+3]=yb.w;Ca[M+4]=zb.x;Ca[M+5]=zb.y;Ca[M+6]=zb.z;Ca[M+7]=zb.w;Ca[M+8]=Ab.x;Ca[M+9]=Ab.y;Ca[M+10]=Ab.z;Ca[M+11]=Ab.w;Ca[M+12]=uc.x;Ca[M+13]=uc.y;Ca[M+14]=uc.z;Ca[M+15]=uc.w;Bb=fc[O.a];Cb=fc[O.b];Db=fc[O.c];vc=fc[O.d];Ba[M]=Bb.x;Ba[M+1]=Bb.y;Ba[M+2]=
|
|
|
+Bb.z;Ba[M+3]=Bb.w;Ba[M+4]=Cb.x;Ba[M+5]=Cb.y;Ba[M+6]=Cb.z;Ba[M+7]=Cb.w;Ba[M+8]=Db.x;Ba[M+9]=Db.y;Ba[M+10]=Db.z;Ba[M+11]=Db.w;Ba[M+12]=vc.x;Ba[M+13]=vc.y;Ba[M+14]=vc.z;Ba[M+15]=vc.w;Pb=dc[O.a];Qb=dc[O.b];Rb=dc[O.c];Hc=dc[O.d];za[M]=Pb.x;za[M+1]=Pb.y;za[M+2]=Pb.z;za[M+3]=1;za[M+4]=Qb.x;za[M+5]=Qb.y;za[M+6]=Qb.z;za[M+7]=1;za[M+8]=Rb.x;za[M+9]=Rb.y;za[M+10]=Rb.z;za[M+11]=1;za[M+12]=Hc.x;za[M+13]=Hc.y;za[M+14]=Hc.z;za[M+15]=1;Sb=ec[O.a];Tb=ec[O.b];Ub=ec[O.c];Ic=ec[O.d];Aa[M]=Sb.x;Aa[M+1]=Sb.y;Aa[M+2]=Sb.z;
|
|
|
+Aa[M+3]=1;Aa[M+4]=Tb.x;Aa[M+5]=Tb.y;Aa[M+6]=Tb.z;Aa[M+7]=1;Aa[M+8]=Ub.x;Aa[M+9]=Ub.y;Aa[M+10]=Ub.z;Aa[M+11]=1;Aa[M+12]=Ic.x;Aa[M+13]=Ic.y;Aa[M+14]=Ic.z;Aa[M+15]=1;M=M+16}if(M>0){i.bindBuffer(i.ARRAY_BUFFER,ga.__webglSkinVertexABuffer);i.bufferData(i.ARRAY_BUFFER,za,eb);i.bindBuffer(i.ARRAY_BUFFER,ga.__webglSkinVertexBBuffer);i.bufferData(i.ARRAY_BUFFER,Aa,eb);i.bindBuffer(i.ARRAY_BUFFER,ga.__webglSkinIndicesBuffer);i.bufferData(i.ARRAY_BUFFER,Ba,eb);i.bindBuffer(i.ARRAY_BUFFER,ga.__webglSkinWeightsBuffer);
|
|
|
+i.bufferData(i.ARRAY_BUFFER,Ca,eb)}}if(ud&&Vc){I=0;for(V=na.length;I<V;I++){O=Ga[na[I]];ob=O.vertexColors;Gc=O.color;if(ob.length===3&&Vc===THREE.VertexColors){vb=ob[0];wb=ob[1];xb=ob[2]}else xb=wb=vb=Gc;Sa[Fa]=vb.r;Sa[Fa+1]=vb.g;Sa[Fa+2]=vb.b;Sa[Fa+3]=wb.r;Sa[Fa+4]=wb.g;Sa[Fa+5]=wb.b;Sa[Fa+6]=xb.r;Sa[Fa+7]=xb.g;Sa[Fa+8]=xb.b;Fa=Fa+9}I=0;for(V=oa.length;I<V;I++){O=Ga[oa[I]];ob=O.vertexColors;Gc=O.color;if(ob.length===4&&Vc===THREE.VertexColors){vb=ob[0];wb=ob[1];xb=ob[2];tc=ob[3]}else tc=xb=wb=vb=
|
|
|
+Gc;Sa[Fa]=vb.r;Sa[Fa+1]=vb.g;Sa[Fa+2]=vb.b;Sa[Fa+3]=wb.r;Sa[Fa+4]=wb.g;Sa[Fa+5]=wb.b;Sa[Fa+6]=xb.r;Sa[Fa+7]=xb.g;Sa[Fa+8]=xb.b;Sa[Fa+9]=tc.r;Sa[Fa+10]=tc.g;Sa[Fa+11]=tc.b;Fa=Fa+12}if(Fa>0){i.bindBuffer(i.ARRAY_BUFFER,ga.__webglColorBuffer);i.bufferData(i.ARRAY_BUFFER,Sa,eb)}}if(td&&$a.hasTangents){I=0;for(V=na.length;I<V;I++){O=Ga[na[I]];Hb=O.vertexTangents;pb=Hb[0];qb=Hb[1];rb=Hb[2];ya[ra]=pb.x;ya[ra+1]=pb.y;ya[ra+2]=pb.z;ya[ra+3]=pb.w;ya[ra+4]=qb.x;ya[ra+5]=qb.y;ya[ra+6]=qb.z;ya[ra+7]=qb.w;ya[ra+
|
|
|
+8]=rb.x;ya[ra+9]=rb.y;ya[ra+10]=rb.z;ya[ra+11]=rb.w;ra=ra+12}I=0;for(V=oa.length;I<V;I++){O=Ga[oa[I]];Hb=O.vertexTangents;pb=Hb[0];qb=Hb[1];rb=Hb[2];rc=Hb[3];ya[ra]=pb.x;ya[ra+1]=pb.y;ya[ra+2]=pb.z;ya[ra+3]=pb.w;ya[ra+4]=qb.x;ya[ra+5]=qb.y;ya[ra+6]=qb.z;ya[ra+7]=qb.w;ya[ra+8]=rb.x;ya[ra+9]=rb.y;ya[ra+10]=rb.z;ya[ra+11]=rb.w;ya[ra+12]=rc.x;ya[ra+13]=rc.y;ya[ra+14]=rc.z;ya[ra+15]=rc.w;ra=ra+16}i.bindBuffer(i.ARRAY_BUFFER,ga.__webglTangentBuffer);i.bufferData(i.ARRAY_BUFFER,ya,eb)}if(sd&&dd){I=0;for(V=
|
|
|
+na.length;I<V;I++){O=Ga[na[I]];jc=O.vertexNormals;Ob=O.normal;if(jc.length===3&&Fc)for(ma=0;ma<3;ma++){Vb=jc[ma];jb[Va]=Vb.x;jb[Va+1]=Vb.y;jb[Va+2]=Vb.z;Va=Va+3}else for(ma=0;ma<3;ma++){jb[Va]=Ob.x;jb[Va+1]=Ob.y;jb[Va+2]=Ob.z;Va=Va+3}}I=0;for(V=oa.length;I<V;I++){O=Ga[oa[I]];jc=O.vertexNormals;Ob=O.normal;if(jc.length===4&&Fc)for(ma=0;ma<4;ma++){Vb=jc[ma];jb[Va]=Vb.x;jb[Va+1]=Vb.y;jb[Va+2]=Vb.z;Va=Va+3}else for(ma=0;ma<4;ma++){jb[Va]=Ob.x;jb[Va+1]=Ob.y;jb[Va+2]=Ob.z;Va=Va+3}}i.bindBuffer(i.ARRAY_BUFFER,
|
|
|
+ga.__webglNormalBuffer);i.bufferData(i.ARRAY_BUFFER,jb,eb)}if(hd&&Zc&&ed){I=0;for(V=na.length;I<V;I++){lb=na[I];O=Ga[lb];kc=Zc[lb];if(kc!==void 0)for(ma=0;ma<3;ma++){mc=kc[ma];wc[Jb]=mc.u;wc[Jb+1]=mc.v;Jb=Jb+2}}I=0;for(V=oa.length;I<V;I++){lb=oa[I];O=Ga[lb];kc=Zc[lb];if(kc!==void 0)for(ma=0;ma<4;ma++){mc=kc[ma];wc[Jb]=mc.u;wc[Jb+1]=mc.v;Jb=Jb+2}}if(Jb>0){i.bindBuffer(i.ARRAY_BUFFER,ga.__webglUVBuffer);i.bufferData(i.ARRAY_BUFFER,wc,eb)}}if(hd&&$c&&ed){I=0;for(V=na.length;I<V;I++){lb=na[I];O=Ga[lb];
|
|
|
+lc=$c[lb];if(lc!==void 0)for(ma=0;ma<3;ma++){nc=lc[ma];xc[Kb]=nc.u;xc[Kb+1]=nc.v;Kb=Kb+2}}I=0;for(V=oa.length;I<V;I++){lb=oa[I];O=Ga[lb];lc=$c[lb];if(lc!==void 0)for(ma=0;ma<4;ma++){nc=lc[ma];xc[Kb]=nc.u;xc[Kb+1]=nc.v;Kb=Kb+2}}if(Kb>0){i.bindBuffer(i.ARRAY_BUFFER,ga.__webglUV2Buffer);i.bufferData(i.ARRAY_BUFFER,xc,eb)}}if(rd){I=0;for(V=na.length;I<V;I++){O=Ga[na[I]];Eb[ib]=Ea;Eb[ib+1]=Ea+1;Eb[ib+2]=Ea+2;ib=ib+3;gb[Za]=Ea;gb[Za+1]=Ea+1;gb[Za+2]=Ea;gb[Za+3]=Ea+2;gb[Za+4]=Ea+1;gb[Za+5]=Ea+2;Za=Za+6;
|
|
|
+Ea=Ea+3}I=0;for(V=oa.length;I<V;I++){O=Ga[oa[I]];Eb[ib]=Ea;Eb[ib+1]=Ea+1;Eb[ib+2]=Ea+3;Eb[ib+3]=Ea+1;Eb[ib+4]=Ea+2;Eb[ib+5]=Ea+3;ib=ib+6;gb[Za]=Ea;gb[Za+1]=Ea+1;gb[Za+2]=Ea;gb[Za+3]=Ea+3;gb[Za+4]=Ea+1;gb[Za+5]=Ea+2;gb[Za+6]=Ea+2;gb[Za+7]=Ea+3;Za=Za+8;Ea=Ea+4}i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,ga.__webglFaceBuffer);i.bufferData(i.ELEMENT_ARRAY_BUFFER,Eb,eb);i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,ga.__webglLineBuffer);i.bufferData(i.ELEMENT_ARRAY_BUFFER,gb,eb)}if(Yc){ma=0;for(fd=Yc.length;ma<fd;ma++){z=
|
|
|
+Yc[ma];if(z.__original.needsUpdate){A=0;if(z.size===1)if(z.boundTo===void 0||z.boundTo==="vertices"){I=0;for(V=na.length;I<V;I++){O=Ga[na[I]];z.array[A]=z.value[O.a];z.array[A+1]=z.value[O.b];z.array[A+2]=z.value[O.c];A=A+3}I=0;for(V=oa.length;I<V;I++){O=Ga[oa[I]];z.array[A]=z.value[O.a];z.array[A+1]=z.value[O.b];z.array[A+2]=z.value[O.c];z.array[A+3]=z.value[O.d];A=A+4}}else{if(z.boundTo==="faces"){I=0;for(V=na.length;I<V;I++){fb=z.value[na[I]];z.array[A]=fb;z.array[A+1]=fb;z.array[A+2]=fb;A=A+3}I=
|
|
|
+0;for(V=oa.length;I<V;I++){fb=z.value[oa[I]];z.array[A]=fb;z.array[A+1]=fb;z.array[A+2]=fb;z.array[A+3]=fb;A=A+4}}}else if(z.size===2)if(z.boundTo===void 0||z.boundTo==="vertices"){I=0;for(V=na.length;I<V;I++){O=Ga[na[I]];X=z.value[O.a];Y=z.value[O.b];Z=z.value[O.c];z.array[A]=X.x;z.array[A+1]=X.y;z.array[A+2]=Y.x;z.array[A+3]=Y.y;z.array[A+4]=Z.x;z.array[A+5]=Z.y;A=A+6}I=0;for(V=oa.length;I<V;I++){O=Ga[oa[I]];X=z.value[O.a];Y=z.value[O.b];Z=z.value[O.c];qa=z.value[O.d];z.array[A]=X.x;z.array[A+1]=
|
|
|
+X.y;z.array[A+2]=Y.x;z.array[A+3]=Y.y;z.array[A+4]=Z.x;z.array[A+5]=Z.y;z.array[A+6]=qa.x;z.array[A+7]=qa.y;A=A+8}}else{if(z.boundTo==="faces"){I=0;for(V=na.length;I<V;I++){Z=Y=X=fb=z.value[na[I]];z.array[A]=X.x;z.array[A+1]=X.y;z.array[A+2]=Y.x;z.array[A+3]=Y.y;z.array[A+4]=Z.x;z.array[A+5]=Z.y;A=A+6}I=0;for(V=oa.length;I<V;I++){qa=Z=Y=X=fb=z.value[oa[I]];z.array[A]=X.x;z.array[A+1]=X.y;z.array[A+2]=Y.x;z.array[A+3]=Y.y;z.array[A+4]=Z.x;z.array[A+5]=Z.y;z.array[A+6]=qa.x;z.array[A+7]=qa.y;A=A+8}}}else if(z.size===
|
|
|
+3){var ia;ia=z.type==="c"?["r","g","b"]:["x","y","z"];if(z.boundTo===void 0||z.boundTo==="vertices"){I=0;for(V=na.length;I<V;I++){O=Ga[na[I]];X=z.value[O.a];Y=z.value[O.b];Z=z.value[O.c];z.array[A]=X[ia[0]];z.array[A+1]=X[ia[1]];z.array[A+2]=X[ia[2]];z.array[A+3]=Y[ia[0]];z.array[A+4]=Y[ia[1]];z.array[A+5]=Y[ia[2]];z.array[A+6]=Z[ia[0]];z.array[A+7]=Z[ia[1]];z.array[A+8]=Z[ia[2]];A=A+9}I=0;for(V=oa.length;I<V;I++){O=Ga[oa[I]];X=z.value[O.a];Y=z.value[O.b];Z=z.value[O.c];qa=z.value[O.d];z.array[A]=
|
|
|
+X[ia[0]];z.array[A+1]=X[ia[1]];z.array[A+2]=X[ia[2]];z.array[A+3]=Y[ia[0]];z.array[A+4]=Y[ia[1]];z.array[A+5]=Y[ia[2]];z.array[A+6]=Z[ia[0]];z.array[A+7]=Z[ia[1]];z.array[A+8]=Z[ia[2]];z.array[A+9]=qa[ia[0]];z.array[A+10]=qa[ia[1]];z.array[A+11]=qa[ia[2]];A=A+12}}else if(z.boundTo==="faces"){I=0;for(V=na.length;I<V;I++){Z=Y=X=fb=z.value[na[I]];z.array[A]=X[ia[0]];z.array[A+1]=X[ia[1]];z.array[A+2]=X[ia[2]];z.array[A+3]=Y[ia[0]];z.array[A+4]=Y[ia[1]];z.array[A+5]=Y[ia[2]];z.array[A+6]=Z[ia[0]];z.array[A+
|
|
|
+7]=Z[ia[1]];z.array[A+8]=Z[ia[2]];A=A+9}I=0;for(V=oa.length;I<V;I++){qa=Z=Y=X=fb=z.value[oa[I]];z.array[A]=X[ia[0]];z.array[A+1]=X[ia[1]];z.array[A+2]=X[ia[2]];z.array[A+3]=Y[ia[0]];z.array[A+4]=Y[ia[1]];z.array[A+5]=Y[ia[2]];z.array[A+6]=Z[ia[0]];z.array[A+7]=Z[ia[1]];z.array[A+8]=Z[ia[2]];z.array[A+9]=qa[ia[0]];z.array[A+10]=qa[ia[1]];z.array[A+11]=qa[ia[2]];A=A+12}}}else if(z.size===4)if(z.boundTo===void 0||z.boundTo==="vertices"){I=0;for(V=na.length;I<V;I++){O=Ga[na[I]];X=z.value[O.a];Y=z.value[O.b];
|
|
|
+Z=z.value[O.c];z.array[A]=X.x;z.array[A+1]=X.y;z.array[A+2]=X.z;z.array[A+3]=X.w;z.array[A+4]=Y.x;z.array[A+5]=Y.y;z.array[A+6]=Y.z;z.array[A+7]=Y.w;z.array[A+8]=Z.x;z.array[A+9]=Z.y;z.array[A+10]=Z.z;z.array[A+11]=Z.w;A=A+12}I=0;for(V=oa.length;I<V;I++){O=Ga[oa[I]];X=z.value[O.a];Y=z.value[O.b];Z=z.value[O.c];qa=z.value[O.d];z.array[A]=X.x;z.array[A+1]=X.y;z.array[A+2]=X.z;z.array[A+3]=X.w;z.array[A+4]=Y.x;z.array[A+5]=Y.y;z.array[A+6]=Y.z;z.array[A+7]=Y.w;z.array[A+8]=Z.x;z.array[A+9]=Z.y;z.array[A+
|
|
|
+10]=Z.z;z.array[A+11]=Z.w;z.array[A+12]=qa.x;z.array[A+13]=qa.y;z.array[A+14]=qa.z;z.array[A+15]=qa.w;A=A+16}}else if(z.boundTo==="faces"){I=0;for(V=na.length;I<V;I++){Z=Y=X=fb=z.value[na[I]];z.array[A]=X.x;z.array[A+1]=X.y;z.array[A+2]=X.z;z.array[A+3]=X.w;z.array[A+4]=Y.x;z.array[A+5]=Y.y;z.array[A+6]=Y.z;z.array[A+7]=Y.w;z.array[A+8]=Z.x;z.array[A+9]=Z.y;z.array[A+10]=Z.z;z.array[A+11]=Z.w;A=A+12}I=0;for(V=oa.length;I<V;I++){qa=Z=Y=X=fb=z.value[oa[I]];z.array[A]=X.x;z.array[A+1]=X.y;z.array[A+
|
|
|
+2]=X.z;z.array[A+3]=X.w;z.array[A+4]=Y.x;z.array[A+5]=Y.y;z.array[A+6]=Y.z;z.array[A+7]=Y.w;z.array[A+8]=Z.x;z.array[A+9]=Z.y;z.array[A+10]=Z.z;z.array[A+11]=Z.w;z.array[A+12]=qa.x;z.array[A+13]=qa.y;z.array[A+14]=qa.z;z.array[A+15]=qa.w;A=A+16}}i.bindBuffer(i.ARRAY_BUFFER,z.buffer);i.bufferData(i.ARRAY_BUFFER,z.array,eb)}}}if(qd){delete ga.__inittedArrays;delete ga.__colorArray;delete ga.__normalArray;delete ga.__tangentArray;delete ga.__uvArray;delete ga.__uv2Array;delete ga.__faceArray;delete ga.__vertexArray;
|
|
|
+delete ga.__lineArray;delete ga.__skinVertexAArray;delete ga.__skinVertexBArray;delete ga.__skinIndexArray;delete ga.__skinWeightArray}}}}ka.__dirtyVertices=false;ka.__dirtyMorphTargets=false;ka.__dirtyElements=false;ka.__dirtyUvs=false;ka.__dirtyNormals=false;ka.__dirtyColors=false;ka.__dirtyTangents=false;bb.attributes&&m(bb)}else if(nb instanceof THREE.Ribbon){if(ka.__dirtyVertices||ka.__dirtyColors){var Zb=ka,id=i.DYNAMIC_DRAW,yc=void 0,zc=void 0,Kc=void 0,$b=void 0,Lc=void 0,jd=Zb.vertices,kd=
|
|
|
+Zb.colors,wd=jd.length,xd=kd.length,Mc=Zb.__vertexArray,Nc=Zb.__colorArray,yd=Zb.__dirtyColors;if(Zb.__dirtyVertices){for(yc=0;yc<wd;yc++){Kc=jd[yc];$b=yc*3;Mc[$b]=Kc.x;Mc[$b+1]=Kc.y;Mc[$b+2]=Kc.z}i.bindBuffer(i.ARRAY_BUFFER,Zb.__webglVertexBuffer);i.bufferData(i.ARRAY_BUFFER,Mc,id)}if(yd){for(zc=0;zc<xd;zc++){Lc=kd[zc];$b=zc*3;Nc[$b]=Lc.r;Nc[$b+1]=Lc.g;Nc[$b+2]=Lc.b}i.bindBuffer(i.ARRAY_BUFFER,Zb.__webglColorBuffer);i.bufferData(i.ARRAY_BUFFER,Nc,id)}}ka.__dirtyVertices=false;ka.__dirtyColors=false}else if(nb instanceof
|
|
|
+THREE.Line){bb=c(nb,qc);ic=bb.attributes&&p(bb);if(ka.__dirtyVertices||ka.__dirtyColors||ic){var Lb=ka,ad=i.DYNAMIC_DRAW,Ac=void 0,Bc=void 0,Oc=void 0,Da=void 0,Pc=void 0,ld=Lb.vertices,md=Lb.colors,zd=ld.length,Ad=md.length,Qc=Lb.__vertexArray,Rc=Lb.__colorArray,Bd=Lb.__dirtyColors,bd=Lb.__webglCustomAttributesList,Sc=void 0,nd=void 0,Ua=void 0,oc=void 0,cb=void 0,va=void 0;if(Lb.__dirtyVertices){for(Ac=0;Ac<zd;Ac++){Oc=ld[Ac];Da=Ac*3;Qc[Da]=Oc.x;Qc[Da+1]=Oc.y;Qc[Da+2]=Oc.z}i.bindBuffer(i.ARRAY_BUFFER,
|
|
|
+Lb.__webglVertexBuffer);i.bufferData(i.ARRAY_BUFFER,Qc,ad)}if(Bd){for(Bc=0;Bc<Ad;Bc++){Pc=md[Bc];Da=Bc*3;Rc[Da]=Pc.r;Rc[Da+1]=Pc.g;Rc[Da+2]=Pc.b}i.bindBuffer(i.ARRAY_BUFFER,Lb.__webglColorBuffer);i.bufferData(i.ARRAY_BUFFER,Rc,ad)}if(bd){Sc=0;for(nd=bd.length;Sc<nd;Sc++){va=bd[Sc];if(va.needsUpdate&&(va.boundTo===void 0||va.boundTo==="vertices")){Da=0;oc=va.value.length;if(va.size===1)for(Ua=0;Ua<oc;Ua++)va.array[Ua]=va.value[Ua];else if(va.size===2)for(Ua=0;Ua<oc;Ua++){cb=va.value[Ua];va.array[Da]=
|
|
|
+cb.x;va.array[Da+1]=cb.y;Da=Da+2}else if(va.size===3)if(va.type==="c")for(Ua=0;Ua<oc;Ua++){cb=va.value[Ua];va.array[Da]=cb.r;va.array[Da+1]=cb.g;va.array[Da+2]=cb.b;Da=Da+3}else for(Ua=0;Ua<oc;Ua++){cb=va.value[Ua];va.array[Da]=cb.x;va.array[Da+1]=cb.y;va.array[Da+2]=cb.z;Da=Da+3}else if(va.size===4)for(Ua=0;Ua<oc;Ua++){cb=va.value[Ua];va.array[Da]=cb.x;va.array[Da+1]=cb.y;va.array[Da+2]=cb.z;va.array[Da+3]=cb.w;Da=Da+4}i.bindBuffer(i.ARRAY_BUFFER,va.buffer);i.bufferData(i.ARRAY_BUFFER,va.array,ad)}}}}ka.__dirtyVertices=
|
|
|
+false;ka.__dirtyColors=false;bb.attributes&&m(bb)}else if(nb instanceof THREE.ParticleSystem){bb=c(nb,qc);ic=bb.attributes&&p(bb);(ka.__dirtyVertices||ka.__dirtyColors||nb.sortParticles||ic)&&f(ka,i.DYNAMIC_DRAW,nb);ka.__dirtyVertices=false;ka.__dirtyColors=false;bb.attributes&&m(bb)}}};this.initMaterial=function(a,b,c,d){var e,f,g;a instanceof THREE.MeshDepthMaterial?g="depth":a instanceof THREE.MeshNormalMaterial?g="normal":a instanceof THREE.MeshBasicMaterial?g="basic":a instanceof THREE.MeshLambertMaterial?
|
|
|
+g="lambert":a instanceof THREE.MeshPhongMaterial?g="phong":a instanceof THREE.LineBasicMaterial?g="basic":a instanceof THREE.ParticleBasicMaterial&&(g="particle_basic");if(g){var h=THREE.ShaderLib[g];a.uniforms=THREE.UniformsUtils.clone(h.uniforms);a.vertexShader=h.vertexShader;a.fragmentShader=h.fragmentShader}var j,k,l,m;j=m=h=0;for(k=b.length;j<k;j++){l=b[j];if(!l.onlyShadow){l instanceof THREE.DirectionalLight&&m++;l instanceof THREE.PointLight&&h++;l instanceof THREE.SpotLight&&h++}}if(h+m<=
|
|
|
+N){l=m;m=h}else{l=Math.ceil(N*m/(h+m));m=N-l}var n=0,h=0;for(j=b.length;h<j;h++){k=b[h];if(k.castShadow){k instanceof THREE.SpotLight&&n++;k instanceof THREE.DirectionalLight&&!k.shadowCascade&&n++}}var p=50;if(d!==void 0&&d instanceof THREE.SkinnedMesh)p=d.bones.length;var o;a:{j=a.fragmentShader;k=a.vertexShader;var h=a.uniforms,b=a.attributes,c={map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap,vertexColors:a.vertexColors,fog:c,useFog:a.fog,sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,
|
|
|
+morphTargets:a.morphTargets,morphNormals:a.morphNormals,maxMorphTargets:this.maxMorphTargets,maxMorphNormals:this.maxMorphNormals,maxDirLights:l,maxPointLights:m,maxBones:p,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapDebug:this.shadowMapDebug,shadowMapCascade:this.shadowMapCascade,maxShadows:n,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel,wrapAround:a.wrapAround,doubleSided:d&&d.doubleSided},r,d=[];if(g)d.push(g);else{d.push(j);d.push(k)}for(r in c){d.push(r);
|
|
|
+d.push(c[r])}g=d.join();r=0;for(d=U.length;r<d;r++)if(U[r].code===g){o=U[r].program;break a}r=i.createProgram();d=["precision "+w+" float;",Xa>0?"#define VERTEX_TEXTURES":"",F.gammaInput?"#define GAMMA_INPUT":"",F.gammaOutput?"#define GAMMA_OUTPUT":"",F.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,"#define MAX_BONES "+c.maxBones,c.map?"#define USE_MAP":"",c.envMap?
|
|
|
+"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.skinning?"#define USE_SKINNING":"",c.morphTargets?"#define USE_MORPHTARGETS":"",c.morphNormals?"#define USE_MORPHNORMALS":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.wrapAround?"#define WRAP_AROUND":"",c.doubleSided?"#define DOUBLE_SIDED":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":
|
|
|
+"",c.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\n#ifdef USE_MORPHNORMALS\nattribute vec3 morphNormal0;\nattribute vec3 morphNormal1;\nattribute vec3 morphNormal2;\nattribute vec3 morphNormal3;\n#else\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
|
|
|
l=["precision "+w+" float;","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",F.gammaInput?"#define GAMMA_INPUT":"",F.gammaOutput?"#define GAMMA_OUTPUT":"",F.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"",c.useFog&&c.fog?"#define USE_FOG":"",c.useFog&&c.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?
|
|
|
"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.metal?"#define METAL":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.wrapAround?"#define WRAP_AROUND":"",c.doubleSided?"#define DOUBLE_SIDED":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");i.attachShader(r,t("fragment",l+j));
|
|
|
i.attachShader(r,t("vertex",d+k));i.linkProgram(r);i.getProgramParameter(r,i.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+i.getProgramParameter(r,i.VALIDATE_STATUS)+", gl error ["+i.getError()+"]");r.uniforms={};r.attributes={};var q,d=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","boneGlobalMatrices","morphTargetInfluences"];for(q in h)d.push(q);q=d;d=0;for(h=q.length;d<h;d++){j=q[d];r.uniforms[j]=i.getUniformLocation(r,
|
|
@@ -385,27 +384,27 @@ THREE.RenderableFace4=function(){this.v1=new THREE.RenderableVertex;this.v2=new
|
|
|
THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.material=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.material=null};
|
|
|
THREE.ColorUtils={adjustHSV:function(a,b,c,d){var e=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(a,e);e.h=THREE.Math.clamp(e.h+b,0,1);e.s=THREE.Math.clamp(e.s+c,0,1);e.v=THREE.Math.clamp(e.v+d,0,1);a.setHSV(e.h,e.s,e.v)},rgbToHsv:function(a,b){var c=a.r,d=a.g,e=a.b,f=Math.max(Math.max(c,d),e),g=Math.min(Math.min(c,d),e);if(g===f)g=c=0;else{var h=f-g,g=h/f,c=(c===f?(d-e)/h:d===f?2+(e-c)/h:4+(c-d)/h)/6;c<0&&(c=c+1);c>1&&(c=c-1)}b===void 0&&(b={h:0,s:0,v:0});b.h=c;b.s=g;b.v=f;return b}};
|
|
|
THREE.ColorUtils.__hsv={h:0,s:0,v:0};
|
|
|
-THREE.GeometryUtils={merge:function(a,b){for(var c,d,e=a.vertices.length,f=b instanceof THREE.Mesh?b.geometry:b,g=a.vertices,h=f.vertices,j=a.faces,k=f.faces,l=a.faceVertexUvs[0],p=f.faceVertexUvs[0],m={},o=0;o<a.materials.length;o++)m[a.materials[o].id]=o;if(b instanceof THREE.Mesh){b.matrixAutoUpdate&&b.updateMatrix();c=b.matrix;d=new THREE.Matrix4;d.extractRotation(c,b.scale)}for(var o=0,r=h.length;o<r;o++){var n=h[o].clone();c&&c.multiplyVector3(n.position);g.push(n)}o=0;for(r=k.length;o<r;o++){var g=
|
|
|
+THREE.GeometryUtils={merge:function(a,b){for(var c,d,e=a.vertices.length,f=b instanceof THREE.Mesh?b.geometry:b,g=a.vertices,h=f.vertices,j=a.faces,k=f.faces,l=a.faceVertexUvs[0],p=f.faceVertexUvs[0],m={},o=0;o<a.materials.length;o++)m[a.materials[o].id]=o;if(b instanceof THREE.Mesh){b.matrixAutoUpdate&&b.updateMatrix();c=b.matrix;d=new THREE.Matrix4;d.extractRotation(c,b.scale)}for(var o=0,r=h.length;o<r;o++){var n=h[o].clone();c&&c.multiplyVector3(n);g.push(n)}o=0;for(r=k.length;o<r;o++){var g=
|
|
|
k[o],q,u,t=g.vertexNormals,y=g.vertexColors;g instanceof THREE.Face3?q=new THREE.Face3(g.a+e,g.b+e,g.c+e):g instanceof THREE.Face4&&(q=new THREE.Face4(g.a+e,g.b+e,g.c+e,g.d+e));q.normal.copy(g.normal);d&&d.multiplyVector3(q.normal);h=0;for(n=t.length;h<n;h++){u=t[h].clone();d&&d.multiplyVector3(u);q.vertexNormals.push(u)}q.color.copy(g.color);h=0;for(n=y.length;h<n;h++){u=y[h];q.vertexColors.push(u.clone())}if(g.materialIndex!==void 0){h=f.materials[g.materialIndex];n=h.id;y=m[n];if(y===void 0){y=
|
|
|
a.materials.length;m[n]=y;a.materials.push(h)}q.materialIndex=y}q.centroid.copy(g.centroid);c&&c.multiplyVector3(q.centroid);j.push(q)}o=0;for(r=p.length;o<r;o++){c=p[o];d=[];h=0;for(n=c.length;h<n;h++)d.push(new THREE.UV(c[h].u,c[h].v));l.push(d)}},clone:function(a){var b=new THREE.Geometry,c,d=a.vertices,e=a.faces,f=a.faceVertexUvs[0];if(a.materials)b.materials=a.materials.slice();a=0;for(c=d.length;a<c;a++)b.vertices.push(d[a].clone());a=0;for(c=e.length;a<c;a++)b.faces.push(e[a].clone());a=0;
|
|
|
for(c=f.length;a<c;a++){for(var d=f[a],e=[],g=0,h=d.length;g<h;g++)e.push(new THREE.UV(d[g].u,d[g].v));b.faceVertexUvs[0].push(e)}return b},randomPointInTriangle:function(a,b,c){var d,e,f,g=new THREE.Vector3,h=THREE.GeometryUtils.__v1;d=THREE.GeometryUtils.random();e=THREE.GeometryUtils.random();if(d+e>1){d=1-d;e=1-e}f=1-d-e;g.copy(a);g.multiplyScalar(d);h.copy(b);h.multiplyScalar(e);g.addSelf(h);h.copy(c);h.multiplyScalar(f);g.addSelf(h);return g},randomPointInFace:function(a,b,c){var d,e,f;if(a instanceof
|
|
|
-THREE.Face3){d=b.vertices[a.a].position;e=b.vertices[a.b].position;f=b.vertices[a.c].position;return THREE.GeometryUtils.randomPointInTriangle(d,e,f)}if(a instanceof THREE.Face4){d=b.vertices[a.a].position;e=b.vertices[a.b].position;f=b.vertices[a.c].position;var b=b.vertices[a.d].position,g;if(c)if(a._area1&&a._area2){c=a._area1;g=a._area2}else{c=THREE.GeometryUtils.triangleArea(d,e,b);g=THREE.GeometryUtils.triangleArea(e,f,b);a._area1=c;a._area2=g}else{c=THREE.GeometryUtils.triangleArea(d,e,b);
|
|
|
-g=THREE.GeometryUtils.triangleArea(e,f,b)}return THREE.GeometryUtils.random()*(c+g)<c?THREE.GeometryUtils.randomPointInTriangle(d,e,b):THREE.GeometryUtils.randomPointInTriangle(e,f,b)}},randomPointsInGeometry:function(a,b){function c(a){function b(c,d){if(d<c)return c;var e=c+Math.floor((d-c)/2);return k[e]>a?b(c,e-1):k[e]<a?b(e+1,d):e}return b(0,k.length-1)}var d,e,f=a.faces,g=a.vertices,h=f.length,j=0,k=[],l,p,m,o;for(e=0;e<h;e++){d=f[e];if(d instanceof THREE.Face3){l=g[d.a].position;p=g[d.b].position;
|
|
|
-m=g[d.c].position;d._area=THREE.GeometryUtils.triangleArea(l,p,m)}else if(d instanceof THREE.Face4){l=g[d.a].position;p=g[d.b].position;m=g[d.c].position;o=g[d.d].position;d._area1=THREE.GeometryUtils.triangleArea(l,p,o);d._area2=THREE.GeometryUtils.triangleArea(p,m,o);d._area=d._area1+d._area2}j=j+d._area;k[e]=j}d=[];for(e=0;e<b;e++){g=THREE.GeometryUtils.random()*j;g=c(g);d[e]=THREE.GeometryUtils.randomPointInFace(f[g],a,true)}return d},triangleArea:function(a,b,c){var d,e=THREE.GeometryUtils.__v1;
|
|
|
-e.sub(a,b);d=e.length();e.sub(a,c);a=e.length();e.sub(b,c);c=e.length();b=0.5*(d+a+c);return Math.sqrt(b*(b-d)*(b-a)*(b-c))},center:function(a){a.computeBoundingBox();var b=a.boundingBox,c=new THREE.Vector3;c.add(b.min,b.max);c.multiplyScalar(-0.5);a.applyMatrix((new THREE.Matrix4).makeTranslation(c.x,c.y,c.z));a.computeBoundingBox();return c},normalizeUVs:function(a){for(var a=a.faceVertexUvs[0],b=0,c=a.length;b<c;b++)for(var d=a[b],e=0,f=d.length;e<f;e++){if(d[e].u!==1)d[e].u=d[e].u-Math.floor(d[e].u);
|
|
|
-if(d[e].v!==1)d[e].v=d[e].v-Math.floor(d[e].v)}},triangulateQuads:function(a){var b,c,d,e,f=[],g=[],h=[];b=0;for(c=a.faceUvs.length;b<c;b++)g[b]=[];b=0;for(c=a.faceVertexUvs.length;b<c;b++)h[b]=[];b=0;for(c=a.faces.length;b<c;b++){d=a.faces[b];if(d instanceof THREE.Face4){e=d.a;var j=d.b,k=d.c,l=d.d,p=new THREE.Face3,m=new THREE.Face3;p.color.copy(d.color);m.color.copy(d.color);p.materialIndex=d.materialIndex;m.materialIndex=d.materialIndex;p.a=e;p.b=j;p.c=l;m.a=j;m.b=k;m.c=l;if(d.vertexColors.length===
|
|
|
-4){p.vertexColors[0]=d.vertexColors[0].clone();p.vertexColors[1]=d.vertexColors[1].clone();p.vertexColors[2]=d.vertexColors[3].clone();m.vertexColors[0]=d.vertexColors[1].clone();m.vertexColors[1]=d.vertexColors[2].clone();m.vertexColors[2]=d.vertexColors[3].clone()}f.push(p,m);d=0;for(e=a.faceVertexUvs.length;d<e;d++)if(a.faceVertexUvs[d].length){p=a.faceVertexUvs[d][b];j=p[1];k=p[2];l=p[3];p=[p[0].clone(),j.clone(),l.clone()];j=[j.clone(),k.clone(),l.clone()];h[d].push(p,j)}d=0;for(e=a.faceUvs.length;d<
|
|
|
-e;d++)if(a.faceUvs[d].length){j=a.faceUvs[d][b];g[d].push(j,j)}}else{f.push(d);d=0;for(e=a.faceUvs.length;d<e;d++)g[d].push(a.faceUvs[d]);d=0;for(e=a.faceVertexUvs.length;d<e;d++)h[d].push(a.faceVertexUvs[d])}}a.faces=f;a.faceUvs=g;a.faceVertexUvs=h;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals();a.hasTangents&&a.computeTangents()},explode:function(a){for(var b=[],c=0,d=a.faces.length;c<d;c++){var e=b.length,f=a.faces[c];if(f instanceof THREE.Face4){var g=f.a,h=f.b,j=f.c,g=a.vertices[g],
|
|
|
-h=a.vertices[h],j=a.vertices[j],k=a.vertices[f.d];b.push(g.clone());b.push(h.clone());b.push(j.clone());b.push(k.clone());f.a=e;f.b=e+1;f.c=e+2;f.d=e+3}else{g=f.a;h=f.b;j=f.c;g=a.vertices[g];h=a.vertices[h];j=a.vertices[j];b.push(g.clone());b.push(h.clone());b.push(j.clone());f.a=e;f.b=e+1;f.c=e+2}}a.vertices=b;delete a.__tmpVertices},tessellate:function(a,b){var c,d,e,f,g,h,j,k,l,p,m,o,r,n,q,u,t,y,s,x=[],D=[];c=0;for(d=a.faceVertexUvs.length;c<d;c++)D[c]=[];c=0;for(d=a.faces.length;c<d;c++){e=a.faces[c];
|
|
|
-if(e instanceof THREE.Face3){f=e.a;g=e.b;h=e.c;k=a.vertices[f];l=a.vertices[g];p=a.vertices[h];o=k.position.distanceTo(l.position);r=l.position.distanceTo(p.position);m=k.position.distanceTo(p.position);if(o>b||r>b||m>b){j=a.vertices.length;y=e.clone();s=e.clone();if(o>=r&&o>=m){k=k.clone();k.position.lerpSelf(l.position,0.5);y.a=f;y.b=j;y.c=h;s.a=j;s.b=g;s.c=h;if(e.vertexNormals.length===3){f=e.vertexNormals[0].clone();f.lerpSelf(e.vertexNormals[1],0.5);y.vertexNormals[1].copy(f);s.vertexNormals[0].copy(f)}if(e.vertexColors.length===
|
|
|
-3){f=e.vertexColors[0].clone();f.lerpSelf(e.vertexColors[1],0.5);y.vertexColors[1].copy(f);s.vertexColors[0].copy(f)}e=0}else if(r>=o&&r>=m){k=l.clone();k.position.lerpSelf(p.position,0.5);y.a=f;y.b=g;y.c=j;s.a=j;s.b=h;s.c=f;if(e.vertexNormals.length===3){f=e.vertexNormals[1].clone();f.lerpSelf(e.vertexNormals[2],0.5);y.vertexNormals[2].copy(f);s.vertexNormals[0].copy(f);s.vertexNormals[1].copy(e.vertexNormals[2]);s.vertexNormals[2].copy(e.vertexNormals[0])}if(e.vertexColors.length===3){f=e.vertexColors[1].clone();
|
|
|
-f.lerpSelf(e.vertexColors[2],0.5);y.vertexColors[2].copy(f);s.vertexColors[0].copy(f);s.vertexColors[1].copy(e.vertexColors[2]);s.vertexColors[2].copy(e.vertexColors[0])}e=1}else{k=k.clone();k.position.lerpSelf(p.position,0.5);y.a=f;y.b=g;y.c=j;s.a=j;s.b=g;s.c=h;if(e.vertexNormals.length===3){f=e.vertexNormals[0].clone();f.lerpSelf(e.vertexNormals[2],0.5);y.vertexNormals[2].copy(f);s.vertexNormals[0].copy(f)}if(e.vertexColors.length===3){f=e.vertexColors[0].clone();f.lerpSelf(e.vertexColors[2],0.5);
|
|
|
-y.vertexColors[2].copy(f);s.vertexColors[0].copy(f)}e=2}x.push(y,s);a.vertices.push(k);f=0;for(g=a.faceVertexUvs.length;f<g;f++)if(a.faceVertexUvs[f].length){k=a.faceVertexUvs[f][c];s=k[0];h=k[1];y=k[2];if(e===0){l=s.clone();l.lerpSelf(h,0.5);k=[s.clone(),l.clone(),y.clone()];h=[l.clone(),h.clone(),y.clone()]}else if(e===1){l=h.clone();l.lerpSelf(y,0.5);k=[s.clone(),h.clone(),l.clone()];h=[l.clone(),y.clone(),s.clone()]}else{l=s.clone();l.lerpSelf(y,0.5);k=[s.clone(),h.clone(),l.clone()];h=[l.clone(),
|
|
|
-h.clone(),y.clone()]}D[f].push(k,h)}}else{x.push(e);f=0;for(g=a.faceVertexUvs.length;f<g;f++)D[f].push(a.faceVertexUvs[f][c])}}else{f=e.a;g=e.b;h=e.c;j=e.d;k=a.vertices[f];l=a.vertices[g];p=a.vertices[h];m=a.vertices[j];o=k.position.distanceTo(l.position);r=l.position.distanceTo(p.position);n=p.position.distanceTo(m.position);q=k.position.distanceTo(m.position);if(o>b||r>b||n>b||q>b){u=a.vertices.length;t=a.vertices.length+1;y=e.clone();s=e.clone();if(o>=r&&o>=n&&o>=q||n>=r&&n>=o&&n>=q){o=k.clone();
|
|
|
-o.position.lerpSelf(l.position,0.5);l=p.clone();l.position.lerpSelf(m.position,0.5);y.a=f;y.b=u;y.c=t;y.d=j;s.a=u;s.b=g;s.c=h;s.d=t;if(e.vertexNormals.length===4){f=e.vertexNormals[0].clone();f.lerpSelf(e.vertexNormals[1],0.5);g=e.vertexNormals[2].clone();g.lerpSelf(e.vertexNormals[3],0.5);y.vertexNormals[1].copy(f);y.vertexNormals[2].copy(g);s.vertexNormals[0].copy(f);s.vertexNormals[3].copy(g)}if(e.vertexColors.length===4){f=e.vertexColors[0].clone();f.lerpSelf(e.vertexColors[1],0.5);g=e.vertexColors[2].clone();
|
|
|
-g.lerpSelf(e.vertexColors[3],0.5);y.vertexColors[1].copy(f);y.vertexColors[2].copy(g);s.vertexColors[0].copy(f);s.vertexColors[3].copy(g)}e=0}else{o=l.clone();o.position.lerpSelf(p.position,0.5);l=m.clone();l.position.lerpSelf(k.position,0.5);y.a=f;y.b=g;y.c=u;y.d=t;s.a=t;s.b=u;s.c=h;s.d=j;if(e.vertexNormals.length===4){f=e.vertexNormals[1].clone();f.lerpSelf(e.vertexNormals[2],0.5);g=e.vertexNormals[3].clone();g.lerpSelf(e.vertexNormals[0],0.5);y.vertexNormals[2].copy(f);y.vertexNormals[3].copy(g);
|
|
|
-s.vertexNormals[0].copy(g);s.vertexNormals[1].copy(f)}if(e.vertexColors.length===4){f=e.vertexColors[1].clone();f.lerpSelf(e.vertexColors[2],0.5);g=e.vertexColors[3].clone();g.lerpSelf(e.vertexColors[0],0.5);y.vertexColors[2].copy(f);y.vertexColors[3].copy(g);s.vertexColors[0].copy(g);s.vertexColors[1].copy(f)}e=1}x.push(y,s);a.vertices.push(o,l);f=0;for(g=a.faceVertexUvs.length;f<g;f++)if(a.faceVertexUvs[f].length){k=a.faceVertexUvs[f][c];s=k[0];h=k[1];y=k[2];k=k[3];if(e===0){l=s.clone();l.lerpSelf(h,
|
|
|
-0.5);p=y.clone();p.lerpSelf(k,0.5);s=[s.clone(),l.clone(),p.clone(),k.clone()];h=[l.clone(),h.clone(),y.clone(),p.clone()]}else{l=h.clone();l.lerpSelf(y,0.5);p=k.clone();p.lerpSelf(s,0.5);s=[s.clone(),h.clone(),l.clone(),p.clone()];h=[p.clone(),l.clone(),y.clone(),k.clone()]}D[f].push(s,h)}}else{x.push(e);f=0;for(g=a.faceVertexUvs.length;f<g;f++)D[f].push(a.faceVertexUvs[f][c])}}}a.faces=x;a.faceVertexUvs=D}};THREE.GeometryUtils.random=THREE.Math.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;
|
|
|
+THREE.Face3){d=b.vertices[a.a];e=b.vertices[a.b];f=b.vertices[a.c];return THREE.GeometryUtils.randomPointInTriangle(d,e,f)}if(a instanceof THREE.Face4){d=b.vertices[a.a];e=b.vertices[a.b];f=b.vertices[a.c];var b=b.vertices[a.d],g;if(c)if(a._area1&&a._area2){c=a._area1;g=a._area2}else{c=THREE.GeometryUtils.triangleArea(d,e,b);g=THREE.GeometryUtils.triangleArea(e,f,b);a._area1=c;a._area2=g}else{c=THREE.GeometryUtils.triangleArea(d,e,b);g=THREE.GeometryUtils.triangleArea(e,f,b)}return THREE.GeometryUtils.random()*
|
|
|
+(c+g)<c?THREE.GeometryUtils.randomPointInTriangle(d,e,b):THREE.GeometryUtils.randomPointInTriangle(e,f,b)}},randomPointsInGeometry:function(a,b){function c(a){function b(c,d){if(d<c)return c;var e=c+Math.floor((d-c)/2);return k[e]>a?b(c,e-1):k[e]<a?b(e+1,d):e}return b(0,k.length-1)}var d,e,f=a.faces,g=a.vertices,h=f.length,j=0,k=[],l,p,m,o;for(e=0;e<h;e++){d=f[e];if(d instanceof THREE.Face3){l=g[d.a];p=g[d.b];m=g[d.c];d._area=THREE.GeometryUtils.triangleArea(l,p,m)}else if(d instanceof THREE.Face4){l=
|
|
|
+g[d.a];p=g[d.b];m=g[d.c];o=g[d.d];d._area1=THREE.GeometryUtils.triangleArea(l,p,o);d._area2=THREE.GeometryUtils.triangleArea(p,m,o);d._area=d._area1+d._area2}j=j+d._area;k[e]=j}d=[];for(e=0;e<b;e++){g=THREE.GeometryUtils.random()*j;g=c(g);d[e]=THREE.GeometryUtils.randomPointInFace(f[g],a,true)}return d},triangleArea:function(a,b,c){var d,e=THREE.GeometryUtils.__v1;e.sub(a,b);d=e.length();e.sub(a,c);a=e.length();e.sub(b,c);c=e.length();b=0.5*(d+a+c);return Math.sqrt(b*(b-d)*(b-a)*(b-c))},center:function(a){a.computeBoundingBox();
|
|
|
+var b=a.boundingBox,c=new THREE.Vector3;c.add(b.min,b.max);c.multiplyScalar(-0.5);a.applyMatrix((new THREE.Matrix4).makeTranslation(c.x,c.y,c.z));a.computeBoundingBox();return c},normalizeUVs:function(a){for(var a=a.faceVertexUvs[0],b=0,c=a.length;b<c;b++)for(var d=a[b],e=0,f=d.length;e<f;e++){if(d[e].u!==1)d[e].u=d[e].u-Math.floor(d[e].u);if(d[e].v!==1)d[e].v=d[e].v-Math.floor(d[e].v)}},triangulateQuads:function(a){var b,c,d,e,f=[],g=[],h=[];b=0;for(c=a.faceUvs.length;b<c;b++)g[b]=[];b=0;for(c=a.faceVertexUvs.length;b<
|
|
|
+c;b++)h[b]=[];b=0;for(c=a.faces.length;b<c;b++){d=a.faces[b];if(d instanceof THREE.Face4){e=d.a;var j=d.b,k=d.c,l=d.d,p=new THREE.Face3,m=new THREE.Face3;p.color.copy(d.color);m.color.copy(d.color);p.materialIndex=d.materialIndex;m.materialIndex=d.materialIndex;p.a=e;p.b=j;p.c=l;m.a=j;m.b=k;m.c=l;if(d.vertexColors.length===4){p.vertexColors[0]=d.vertexColors[0].clone();p.vertexColors[1]=d.vertexColors[1].clone();p.vertexColors[2]=d.vertexColors[3].clone();m.vertexColors[0]=d.vertexColors[1].clone();
|
|
|
+m.vertexColors[1]=d.vertexColors[2].clone();m.vertexColors[2]=d.vertexColors[3].clone()}f.push(p,m);d=0;for(e=a.faceVertexUvs.length;d<e;d++)if(a.faceVertexUvs[d].length){p=a.faceVertexUvs[d][b];j=p[1];k=p[2];l=p[3];p=[p[0].clone(),j.clone(),l.clone()];j=[j.clone(),k.clone(),l.clone()];h[d].push(p,j)}d=0;for(e=a.faceUvs.length;d<e;d++)if(a.faceUvs[d].length){j=a.faceUvs[d][b];g[d].push(j,j)}}else{f.push(d);d=0;for(e=a.faceUvs.length;d<e;d++)g[d].push(a.faceUvs[d]);d=0;for(e=a.faceVertexUvs.length;d<
|
|
|
+e;d++)h[d].push(a.faceVertexUvs[d])}}a.faces=f;a.faceUvs=g;a.faceVertexUvs=h;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals();a.hasTangents&&a.computeTangents()},explode:function(a){for(var b=[],c=0,d=a.faces.length;c<d;c++){var e=b.length,f=a.faces[c];if(f instanceof THREE.Face4){var g=f.a,h=f.b,j=f.c,g=a.vertices[g],h=a.vertices[h],j=a.vertices[j],k=a.vertices[f.d];b.push(g.clone());b.push(h.clone());b.push(j.clone());b.push(k.clone());f.a=e;f.b=e+1;f.c=e+2;f.d=e+3}else{g=f.a;
|
|
|
+h=f.b;j=f.c;g=a.vertices[g];h=a.vertices[h];j=a.vertices[j];b.push(g.clone());b.push(h.clone());b.push(j.clone());f.a=e;f.b=e+1;f.c=e+2}}a.vertices=b;delete a.__tmpVertices},tessellate:function(a,b){var c,d,e,f,g,h,j,k,l,p,m,o,r,n,q,u,t,y,s,x=[],D=[];c=0;for(d=a.faceVertexUvs.length;c<d;c++)D[c]=[];c=0;for(d=a.faces.length;c<d;c++){e=a.faces[c];if(e instanceof THREE.Face3){f=e.a;g=e.b;h=e.c;k=a.vertices[f];l=a.vertices[g];p=a.vertices[h];o=k.distanceTo(l);r=l.distanceTo(p);m=k.distanceTo(p);if(o>
|
|
|
+b||r>b||m>b){j=a.vertices.length;y=e.clone();s=e.clone();if(o>=r&&o>=m){k=k.clone();k.lerpSelf(l,0.5);y.a=f;y.b=j;y.c=h;s.a=j;s.b=g;s.c=h;if(e.vertexNormals.length===3){f=e.vertexNormals[0].clone();f.lerpSelf(e.vertexNormals[1],0.5);y.vertexNormals[1].copy(f);s.vertexNormals[0].copy(f)}if(e.vertexColors.length===3){f=e.vertexColors[0].clone();f.lerpSelf(e.vertexColors[1],0.5);y.vertexColors[1].copy(f);s.vertexColors[0].copy(f)}e=0}else if(r>=o&&r>=m){k=l.clone();k.lerpSelf(p,0.5);y.a=f;y.b=g;y.c=
|
|
|
+j;s.a=j;s.b=h;s.c=f;if(e.vertexNormals.length===3){f=e.vertexNormals[1].clone();f.lerpSelf(e.vertexNormals[2],0.5);y.vertexNormals[2].copy(f);s.vertexNormals[0].copy(f);s.vertexNormals[1].copy(e.vertexNormals[2]);s.vertexNormals[2].copy(e.vertexNormals[0])}if(e.vertexColors.length===3){f=e.vertexColors[1].clone();f.lerpSelf(e.vertexColors[2],0.5);y.vertexColors[2].copy(f);s.vertexColors[0].copy(f);s.vertexColors[1].copy(e.vertexColors[2]);s.vertexColors[2].copy(e.vertexColors[0])}e=1}else{k=k.clone();
|
|
|
+k.lerpSelf(p,0.5);y.a=f;y.b=g;y.c=j;s.a=j;s.b=g;s.c=h;if(e.vertexNormals.length===3){f=e.vertexNormals[0].clone();f.lerpSelf(e.vertexNormals[2],0.5);y.vertexNormals[2].copy(f);s.vertexNormals[0].copy(f)}if(e.vertexColors.length===3){f=e.vertexColors[0].clone();f.lerpSelf(e.vertexColors[2],0.5);y.vertexColors[2].copy(f);s.vertexColors[0].copy(f)}e=2}x.push(y,s);a.vertices.push(k);f=0;for(g=a.faceVertexUvs.length;f<g;f++)if(a.faceVertexUvs[f].length){k=a.faceVertexUvs[f][c];s=k[0];h=k[1];y=k[2];if(e===
|
|
|
+0){l=s.clone();l.lerpSelf(h,0.5);k=[s.clone(),l.clone(),y.clone()];h=[l.clone(),h.clone(),y.clone()]}else if(e===1){l=h.clone();l.lerpSelf(y,0.5);k=[s.clone(),h.clone(),l.clone()];h=[l.clone(),y.clone(),s.clone()]}else{l=s.clone();l.lerpSelf(y,0.5);k=[s.clone(),h.clone(),l.clone()];h=[l.clone(),h.clone(),y.clone()]}D[f].push(k,h)}}else{x.push(e);f=0;for(g=a.faceVertexUvs.length;f<g;f++)D[f].push(a.faceVertexUvs[f][c])}}else{f=e.a;g=e.b;h=e.c;j=e.d;k=a.vertices[f];l=a.vertices[g];p=a.vertices[h];m=
|
|
|
+a.vertices[j];o=k.distanceTo(l);r=l.distanceTo(p);n=p.distanceTo(m);q=k.distanceTo(m);if(o>b||r>b||n>b||q>b){u=a.vertices.length;t=a.vertices.length+1;y=e.clone();s=e.clone();if(o>=r&&o>=n&&o>=q||n>=r&&n>=o&&n>=q){o=k.clone();o.lerpSelf(l,0.5);l=p.clone();l.lerpSelf(m,0.5);y.a=f;y.b=u;y.c=t;y.d=j;s.a=u;s.b=g;s.c=h;s.d=t;if(e.vertexNormals.length===4){f=e.vertexNormals[0].clone();f.lerpSelf(e.vertexNormals[1],0.5);g=e.vertexNormals[2].clone();g.lerpSelf(e.vertexNormals[3],0.5);y.vertexNormals[1].copy(f);
|
|
|
+y.vertexNormals[2].copy(g);s.vertexNormals[0].copy(f);s.vertexNormals[3].copy(g)}if(e.vertexColors.length===4){f=e.vertexColors[0].clone();f.lerpSelf(e.vertexColors[1],0.5);g=e.vertexColors[2].clone();g.lerpSelf(e.vertexColors[3],0.5);y.vertexColors[1].copy(f);y.vertexColors[2].copy(g);s.vertexColors[0].copy(f);s.vertexColors[3].copy(g)}e=0}else{o=l.clone();o.lerpSelf(p,0.5);l=m.clone();l.lerpSelf(k,0.5);y.a=f;y.b=g;y.c=u;y.d=t;s.a=t;s.b=u;s.c=h;s.d=j;if(e.vertexNormals.length===4){f=e.vertexNormals[1].clone();
|
|
|
+f.lerpSelf(e.vertexNormals[2],0.5);g=e.vertexNormals[3].clone();g.lerpSelf(e.vertexNormals[0],0.5);y.vertexNormals[2].copy(f);y.vertexNormals[3].copy(g);s.vertexNormals[0].copy(g);s.vertexNormals[1].copy(f)}if(e.vertexColors.length===4){f=e.vertexColors[1].clone();f.lerpSelf(e.vertexColors[2],0.5);g=e.vertexColors[3].clone();g.lerpSelf(e.vertexColors[0],0.5);y.vertexColors[2].copy(f);y.vertexColors[3].copy(g);s.vertexColors[0].copy(g);s.vertexColors[1].copy(f)}e=1}x.push(y,s);a.vertices.push(o,l);
|
|
|
+f=0;for(g=a.faceVertexUvs.length;f<g;f++)if(a.faceVertexUvs[f].length){k=a.faceVertexUvs[f][c];s=k[0];h=k[1];y=k[2];k=k[3];if(e===0){l=s.clone();l.lerpSelf(h,0.5);p=y.clone();p.lerpSelf(k,0.5);s=[s.clone(),l.clone(),p.clone(),k.clone()];h=[l.clone(),h.clone(),y.clone(),p.clone()]}else{l=h.clone();l.lerpSelf(y,0.5);p=k.clone();p.lerpSelf(s,0.5);s=[s.clone(),h.clone(),l.clone(),p.clone()];h=[p.clone(),l.clone(),y.clone(),k.clone()]}D[f].push(s,h)}}else{x.push(e);f=0;for(g=a.faceVertexUvs.length;f<g;f++)D[f].push(a.faceVertexUvs[f][c])}}}a.faces=
|
|
|
+x;a.faceVertexUvs=D}};THREE.GeometryUtils.random=THREE.Math.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;
|
|
|
THREE.ImageUtils={crossOrigin:"anonymous",loadTexture:function(a,b,c){var d=new Image,e=new THREE.Texture(d,b);d.onload=function(){e.needsUpdate=true;c&&c(this)};d.crossOrigin=this.crossOrigin;d.src=a;return e},loadTextureCube:function(a,b,c){var d,e=[],f=new THREE.Texture(e,b),b=e.loadCount=0;for(d=a.length;b<d;++b){e[b]=new Image;e[b].onload=function(){e.loadCount=e.loadCount+1;if(e.loadCount===6)f.needsUpdate=true;c&&c(this)};e[b].crossOrigin=this.crossOrigin;e[b].src=a[b]}return f},getNormalMap:function(a,
|
|
|
b){var c=function(a){var b=Math.sqrt(a[0]*a[0]+a[1]*a[1]+a[2]*a[2]);return[a[0]/b,a[1]/b,a[2]/b]},b=b|1,d=a.width,e=a.height,f=document.createElement("canvas");f.width=d;f.height=e;var g=f.getContext("2d");g.drawImage(a,0,0);for(var h=g.getImageData(0,0,d,e).data,j=g.createImageData(d,e),k=j.data,l=0;l<d;l++)for(var p=1;p<e;p++){var m=p-1<0?e-1:p-1,o=(p+1)%e,r=l-1<0?d-1:l-1,n=(l+1)%d,q=[],u=[0,0,h[(p*d+l)*4]/255*b];q.push([-1,0,h[(p*d+r)*4]/255*b]);q.push([-1,-1,h[(m*d+r)*4]/255*b]);q.push([0,-1,
|
|
|
h[(m*d+l)*4]/255*b]);q.push([1,-1,h[(m*d+n)*4]/255*b]);q.push([1,0,h[(p*d+n)*4]/255*b]);q.push([1,1,h[(o*d+n)*4]/255*b]);q.push([0,1,h[(o*d+l)*4]/255*b]);q.push([-1,1,h[(o*d+r)*4]/255*b]);m=[];r=q.length;for(o=0;o<r;o++){var n=q[o],t=q[(o+1)%r],n=[n[0]-u[0],n[1]-u[1],n[2]-u[2]],t=[t[0]-u[0],t[1]-u[1],t[2]-u[2]];m.push(c([n[1]*t[2]-n[2]*t[1],n[2]*t[0]-n[0]*t[2],n[0]*t[1]-n[1]*t[0]]))}q=[0,0,0];for(o=0;o<m.length;o++){q[0]=q[0]+m[o][0];q[1]=q[1]+m[o][1];q[2]=q[2]+m[o][2]}q[0]=q[0]/m.length;q[1]=q[1]/
|
|
@@ -446,7 +445,7 @@ d[c[1]].z,d[c[2]].z,d[c[3]].z,e);return b});THREE.CurvePath=function(){this.curv
|
|
|
THREE.CurvePath.prototype.closePath=function(){var a=this.curves[0].getPoint(0),b=this.curves[this.curves.length-1].getPoint(1);a.equals(b)||this.curves.push(new THREE.LineCurve(b,a))};THREE.CurvePath.prototype.getPoint=function(a){for(var b=a*this.getLength(),c=this.getCurveLengths(),a=0;a<c.length;){if(c[a]>=b){b=c[a]-b;a=this.curves[a];b=1-b/a.getLength();return a.getPointAt(b)}a++}return null};THREE.CurvePath.prototype.getLength=function(){var a=this.getCurveLengths();return a[a.length-1]};
|
|
|
THREE.CurvePath.prototype.getCurveLengths=function(){if(this.cacheLengths&&this.cacheLengths.length==this.curves.length)return this.cacheLengths;var a=[],b=0,c,d=this.curves.length;for(c=0;c<d;c++){b=b+this.curves[c].getLength();a.push(b)}return this.cacheLengths=a};
|
|
|
THREE.CurvePath.prototype.getBoundingBox=function(){var a=this.getPoints(),b,c,d,e;b=c=Number.NEGATIVE_INFINITY;d=e=Number.POSITIVE_INFINITY;var f,g,h,j;j=new THREE.Vector2;g=0;for(h=a.length;g<h;g++){f=a[g];if(f.x>b)b=f.x;else if(f.x<d)d=f.x;if(f.y>c)c=f.y;else if(f.y<c)e=f.y;j.addSelf(f.x,f.y)}return{minX:d,minY:e,maxX:b,maxY:c,centroid:j.divideScalar(h)}};THREE.CurvePath.prototype.createPointsGeometry=function(a){return this.createGeometry(this.getPoints(a,true))};
|
|
|
-THREE.CurvePath.prototype.createSpacedPointsGeometry=function(a){return this.createGeometry(this.getSpacedPoints(a,true))};THREE.CurvePath.prototype.createGeometry=function(a){for(var b=new THREE.Geometry,c=0;c<a.length;c++)b.vertices.push(new THREE.Vertex(new THREE.Vector3(a[c].x,a[c].y,0)));return b};THREE.CurvePath.prototype.addWrapPath=function(a){this.bends.push(a)};
|
|
|
+THREE.CurvePath.prototype.createSpacedPointsGeometry=function(a){return this.createGeometry(this.getSpacedPoints(a,true))};THREE.CurvePath.prototype.createGeometry=function(a){for(var b=new THREE.Geometry,c=0;c<a.length;c++)b.vertices.push(new THREE.Vertex(a[c].x,a[c].y,0));return b};THREE.CurvePath.prototype.addWrapPath=function(a){this.bends.push(a)};
|
|
|
THREE.CurvePath.prototype.getTransformedPoints=function(a,b){var c=this.getPoints(a),d,e;if(!b)b=this.bends;d=0;for(e=b.length;d<e;d++)c=this.getWrapPoints(c,b[d]);return c};THREE.CurvePath.prototype.getTransformedSpacedPoints=function(a,b){var c=this.getSpacedPoints(a),d,e;if(!b)b=this.bends;d=0;for(e=b.length;d<e;d++)c=this.getWrapPoints(c,b[d]);return c};
|
|
|
THREE.CurvePath.prototype.getWrapPoints=function(a,b){var c=this.getBoundingBox(),d,e,f,g,h,j;d=0;for(e=a.length;d<e;d++){f=a[d];g=f.x;h=f.y;j=g/c.maxX;j=b.getUtoTmapping(j,g);g=b.getPoint(j);h=b.getNormalVector(j).multiplyScalar(h);f.x=g.x+h.x;f.y=g.y+h.y}return a};
|
|
|
THREE.EventTarget=function(){var a={};this.addEventListener=function(b,c){a[b]==void 0&&(a[b]=[]);a[b].indexOf(c)===-1&&a[b].push(c)};this.dispatchEvent=function(b){for(var c in a[b.type])a[b.type][c](b)};this.removeEventListener=function(b,c){var d=a[b].indexOf(c);d!==-1&&a[b].splice(d,1)}};THREE.Gyroscope=function(){THREE.Object3D.call(this)};THREE.Gyroscope.prototype=new THREE.Object3D;THREE.Gyroscope.prototype.constructor=THREE.Gyroscope;
|
|
@@ -522,9 +521,9 @@ Math.sin(this.theta);b=1;this.constrainVertical&&(b=Math.PI/(this.verticalMax-th
|
|
|
100*Math.cos(this.phi);b.z=c.z+100*Math.sin(this.phi)*Math.sin(this.theta);this.object.lookAt(b)}};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},false);this.domElement.addEventListener("mousemove",c(this,this.onMouseMove),false);this.domElement.addEventListener("mousedown",c(this,this.onMouseDown),false);this.domElement.addEventListener("mouseup",c(this,this.onMouseUp),false);this.domElement.addEventListener("keydown",c(this,this.onKeyDown),false);this.domElement.addEventListener("keyup",
|
|
|
c(this,this.onKeyUp),false)};
|
|
|
THREE.PathControls=function(a,b){function c(a){return(a=a*2)<1?0.5*a*a:-0.5*(--a*(a-2)-1)}function d(a,b){return function(){b.apply(a,arguments)}}function e(a,b,c,d){var e={name:c,fps:0.6,length:d,hierarchy:[]},f,g=b.getControlPointsArray(),h=b.getLength(),q=g.length,u=0;f=q-1;b={parent:-1,keys:[]};b.keys[0]={time:0,pos:g[0],rot:[0,0,0,1],scl:[1,1,1]};b.keys[f]={time:d,pos:g[f],rot:[0,0,0,1],scl:[1,1,1]};for(f=1;f<q-1;f++){u=d*h.chunks[f]/h.total;b.keys[f]={time:u,pos:g[f]}}e.hierarchy[0]=b;THREE.AnimationHandler.add(e);
|
|
|
-return new THREE.Animation(a,c,THREE.AnimationHandler.CATMULLROM_FORWARD,false)}function f(a,b){var c,d,e=new THREE.Geometry;for(c=0;c<a.points.length*b;c++){d=c/(a.points.length*b);d=a.getPoint(d);e.vertices[c]=new THREE.Vertex(new THREE.Vector3(d.x,d.y,d.z))}return e}this.object=a;this.domElement=b!==void 0?b:document;this.id="PathControls"+THREE.PathControlsIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=true;this.resamplingCoef=50;this.debugPath=new THREE.Object3D;this.debugDummy=
|
|
|
-new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.005;this.lookHorizontal=this.lookVertical=true;this.verticalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.horizontalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.target=new THREE.Object3D;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;if(this.domElement===document){this.viewHalfX=window.innerWidth/2;this.viewHalfY=window.innerHeight/2}else{this.viewHalfX=this.domElement.offsetWidth/
|
|
|
-2;this.viewHalfY=this.domElement.offsetHeight/2;this.domElement.setAttribute("tabindex",-1)}var g=Math.PI*2,h=Math.PI/180;this.update=function(a){var b;if(this.lookHorizontal)this.lon=this.lon+this.mouseX*this.lookSpeed*a;if(this.lookVertical)this.lat=this.lat-this.mouseY*this.lookSpeed*a;this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*h;this.theta=this.lon*h;a=this.phi%g;this.phi=a>=0?a:a+g;b=this.verticalAngleMap.srcRange;a=this.verticalAngleMap.dstRange;
|
|
|
+return new THREE.Animation(a,c,THREE.AnimationHandler.CATMULLROM_FORWARD,false)}function f(a,b){var c,d,e=new THREE.Geometry;for(c=0;c<a.points.length*b;c++){d=c/(a.points.length*b);d=a.getPoint(d);e.vertices[c]=new THREE.Vertex(d.x,d.y,d.z)}return e}this.object=a;this.domElement=b!==void 0?b:document;this.id="PathControls"+THREE.PathControlsIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=true;this.resamplingCoef=50;this.debugPath=new THREE.Object3D;this.debugDummy=new THREE.Object3D;
|
|
|
+this.animationParent=new THREE.Object3D;this.lookSpeed=0.005;this.lookHorizontal=this.lookVertical=true;this.verticalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.horizontalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.target=new THREE.Object3D;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;if(this.domElement===document){this.viewHalfX=window.innerWidth/2;this.viewHalfY=window.innerHeight/2}else{this.viewHalfX=this.domElement.offsetWidth/2;this.viewHalfY=
|
|
|
+this.domElement.offsetHeight/2;this.domElement.setAttribute("tabindex",-1)}var g=Math.PI*2,h=Math.PI/180;this.update=function(a){var b;if(this.lookHorizontal)this.lon=this.lon+this.mouseX*this.lookSpeed*a;if(this.lookVertical)this.lat=this.lat-this.mouseY*this.lookSpeed*a;this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*h;this.theta=this.lon*h;a=this.phi%g;this.phi=a>=0?a:a+g;b=this.verticalAngleMap.srcRange;a=this.verticalAngleMap.dstRange;
|
|
|
b=THREE.Math.mapLinear(this.phi,b[0],b[1],a[0],a[1]);var d=a[1]-a[0];this.phi=c((b-a[0])/d)*d+a[0];b=this.horizontalAngleMap.srcRange;a=this.horizontalAngleMap.dstRange;b=THREE.Math.mapLinear(this.theta,b[0],b[1],a[0],a[1]);d=a[1]-a[0];this.theta=c((b-a[0])/d)*d+a[0];a=this.target.position;a.x=100*Math.sin(this.phi)*Math.cos(this.theta);a.y=100*Math.cos(this.phi);a.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.object.lookAt(this.target.position)};this.onMouseMove=function(a){if(this.domElement===
|
|
|
document){this.mouseX=a.pageX-this.viewHalfX;this.mouseY=a.pageY-this.viewHalfY}else{this.mouseX=a.pageX-this.domElement.offsetLeft-this.viewHalfX;this.mouseY=a.pageY-this.domElement.offsetTop-this.viewHalfY}};this.init=function(){this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){var a=new THREE.MeshLambertMaterial({color:30719}),b=new THREE.MeshLambertMaterial({color:65280}),
|
|
|
c=new THREE.CubeGeometry(10,10,20),g=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(c,a);a=new THREE.Mesh(g,b);a.position.set(0,10,0);this.animation=e(this.animationParent,this.spline,this.id,this.duration);this.animationParent.add(this.object);this.animationParent.add(this.target);this.animationParent.add(a)}else{this.animation=e(this.animationParent,this.spline,this.id,this.duration);this.animationParent.add(this.target);this.animationParent.add(this.object)}if(this.createDebugPath){var a=
|
|
@@ -555,33 +554,33 @@ b.addSelf(c.object.up.clone().setLength(a.y));c.object.position.addSelf(b);c.tar
|
|
|
c.noRotate||c.rotateCamera();c.noZoom||c.zoomCamera();c.noPan||c.panCamera();c.object.position.add(c.target,g);c.checkDistances();c.object.lookAt(c.target);if(d.distanceTo(c.object.position)>0){c.dispatchEvent(o);d.copy(c.object.position)}};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},false);this.domElement.addEventListener("mousemove",function(a){if(c.enabled){if(e){h=j=c.getMouseProjectionOnBall(a.clientX,a.clientY);k=l=c.getMouseOnScreen(a.clientX,a.clientY);p=
|
|
|
m=c.getMouseOnScreen(a.clientX,a.clientY);e=false}f!==-1&&(f===0&&!c.noRotate?j=c.getMouseProjectionOnBall(a.clientX,a.clientY):f===1&&!c.noZoom?l=c.getMouseOnScreen(a.clientX,a.clientY):f===2&&!c.noPan&&(m=c.getMouseOnScreen(a.clientX,a.clientY)))}},false);this.domElement.addEventListener("mousedown",function(a){if(c.enabled){a.preventDefault();a.stopPropagation();if(f===-1){f=a.button;f===0&&!c.noRotate?h=j=c.getMouseProjectionOnBall(a.clientX,a.clientY):f===1&&!c.noZoom?k=l=c.getMouseOnScreen(a.clientX,
|
|
|
a.clientY):this.noPan||(p=m=c.getMouseOnScreen(a.clientX,a.clientY))}}},false);this.domElement.addEventListener("mouseup",function(a){if(c.enabled){a.preventDefault();a.stopPropagation();f=-1}},false);window.addEventListener("keydown",function(a){if(c.enabled&&f===-1){a.keyCode===c.keys[0]&&!c.noRotate?f=0:a.keyCode===c.keys[1]&&!c.noZoom?f=1:a.keyCode===c.keys[2]&&!c.noPan&&(f=2);f!==-1&&(e=true)}},false);window.addEventListener("keyup",function(){c.enabled&&f!==-1&&(f=-1)},false)};
|
|
|
-THREE.CubeGeometry=function(a,b,c,d,e,f,g,h){function j(a,b,c,g,h,j,l,m){var n,o=d||1,p=e||1,r=h/2,q=j/2,t=k.vertices.length;if(a==="x"&&b==="y"||a==="y"&&b==="x")n="z";else if(a==="x"&&b==="z"||a==="z"&&b==="x"){n="y";p=f||1}else if(a==="z"&&b==="y"||a==="y"&&b==="z"){n="x";o=f||1}var i=o+1,u=p+1,y=h/o,H=j/p,W=new THREE.Vector3;W[n]=l>0?1:-1;for(h=0;h<u;h++)for(j=0;j<i;j++){var G=new THREE.Vector3;G[a]=(j*y-r)*c;G[b]=(h*H-q)*g;G[n]=l;k.vertices.push(new THREE.Vertex(G))}for(h=0;h<p;h++)for(j=0;j<
|
|
|
-o;j++){a=new THREE.Face4(j+i*h+t,j+i*(h+1)+t,j+1+i*(h+1)+t,j+1+i*h+t);a.normal.copy(W);a.vertexNormals.push(W.clone(),W.clone(),W.clone(),W.clone());a.materialIndex=m;k.faces.push(a);k.faceVertexUvs[0].push([new THREE.UV(j/o,h/p),new THREE.UV(j/o,(h+1)/p),new THREE.UV((j+1)/o,(h+1)/p),new THREE.UV((j+1)/o,h/p)])}}THREE.Geometry.call(this);var k=this,l=a/2,p=b/2,m=c/2,o,r,n,q,u,t;if(g!==void 0){if(g instanceof Array)this.materials=g;else{this.materials=[];for(o=0;o<6;o++)this.materials.push(g)}o=0;
|
|
|
-q=1;r=2;u=3;n=4;t=5}else this.materials=[];this.sides={px:true,nx:true,py:true,ny:true,pz:true,nz:true};if(h!=void 0)for(var y in h)this.sides[y]!==void 0&&(this.sides[y]=h[y]);this.sides.px&&j("z","y",-1,-1,c,b,l,o);this.sides.nx&&j("z","y",1,-1,c,b,-l,q);this.sides.py&&j("x","z",1,1,a,c,p,r);this.sides.ny&&j("x","z",1,-1,a,c,-p,u);this.sides.pz&&j("x","y",1,-1,a,b,m,n);this.sides.nz&&j("x","y",-1,-1,a,b,-m,t);this.computeCentroids();this.mergeVertices()};THREE.CubeGeometry.prototype=new THREE.Geometry;
|
|
|
+THREE.CubeGeometry=function(a,b,c,d,e,f,g,h){function j(a,b,c,g,h,j,l,m){var n,o=d||1,p=e||1,r=h/2,q=j/2,t=k.vertices.length;if(a==="x"&&b==="y"||a==="y"&&b==="x")n="z";else if(a==="x"&&b==="z"||a==="z"&&b==="x"){n="y";p=f||1}else if(a==="z"&&b==="y"||a==="y"&&b==="z"){n="x";o=f||1}var i=o+1,u=p+1,y=h/o,H=j/p,W=new THREE.Vector3;W[n]=l>0?1:-1;for(h=0;h<u;h++)for(j=0;j<i;j++){var G=new THREE.Vertex;G[a]=(j*y-r)*c;G[b]=(h*H-q)*g;G[n]=l;k.vertices.push(G)}for(h=0;h<p;h++)for(j=0;j<o;j++){a=new THREE.Face4(j+
|
|
|
+i*h+t,j+i*(h+1)+t,j+1+i*(h+1)+t,j+1+i*h+t);a.normal.copy(W);a.vertexNormals.push(W.clone(),W.clone(),W.clone(),W.clone());a.materialIndex=m;k.faces.push(a);k.faceVertexUvs[0].push([new THREE.UV(j/o,h/p),new THREE.UV(j/o,(h+1)/p),new THREE.UV((j+1)/o,(h+1)/p),new THREE.UV((j+1)/o,h/p)])}}THREE.Geometry.call(this);var k=this,l=a/2,p=b/2,m=c/2,o,r,n,q,u,t;if(g!==void 0){if(g instanceof Array)this.materials=g;else{this.materials=[];for(o=0;o<6;o++)this.materials.push(g)}o=0;q=1;r=2;u=3;n=4;t=5}else this.materials=
|
|
|
+[];this.sides={px:true,nx:true,py:true,ny:true,pz:true,nz:true};if(h!=void 0)for(var y in h)this.sides[y]!==void 0&&(this.sides[y]=h[y]);this.sides.px&&j("z","y",-1,-1,c,b,l,o);this.sides.nx&&j("z","y",1,-1,c,b,-l,q);this.sides.py&&j("x","z",1,1,a,c,p,r);this.sides.ny&&j("x","z",1,-1,a,c,-p,u);this.sides.pz&&j("x","y",1,-1,a,b,m,n);this.sides.nz&&j("x","y",-1,-1,a,b,-m,t);this.computeCentroids();this.mergeVertices()};THREE.CubeGeometry.prototype=new THREE.Geometry;
|
|
|
THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
|
|
|
-THREE.CylinderGeometry=function(a,b,c,d,e,f){THREE.Geometry.call(this);var a=a!==void 0?a:20,b=b!==void 0?b:20,c=c!==void 0?c:100,g=c/2,d=d||8,e=e||1,h,j,k=[],l=[];for(j=0;j<=e;j++){var p=[],m=[],o=j/e,r=o*(b-a)+a;for(h=0;h<=d;h++){var n=h/d,q=r*Math.sin(n*Math.PI*2),u=-o*c+g,t=r*Math.cos(n*Math.PI*2);this.vertices.push(new THREE.Vertex(new THREE.Vector3(q,u,t)));p.push(this.vertices.length-1);m.push(new THREE.UV(n,o))}k.push(p);l.push(m)}for(j=0;j<e;j++)for(h=0;h<d;h++){var c=k[j][h],p=k[j+1][h],
|
|
|
-m=k[j+1][h+1],o=k[j][h+1],r=this.vertices[c].position.clone().setY(0).normalize(),n=this.vertices[p].position.clone().setY(0).normalize(),q=this.vertices[m].position.clone().setY(0).normalize(),u=this.vertices[o].position.clone().setY(0).normalize(),t=l[j][h].clone(),y=l[j+1][h].clone(),s=l[j+1][h+1].clone(),x=l[j][h+1].clone();this.faces.push(new THREE.Face4(c,p,m,o,[r,n,q,u]));this.faceVertexUvs[0].push([t,y,s,x])}if(!f&&a>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,g,0)));for(h=
|
|
|
-0;h<d;h++){c=k[0][h];p=k[0][h+1];m=this.vertices.length-1;r=new THREE.Vector3(0,1,0);n=new THREE.Vector3(0,1,0);q=new THREE.Vector3(0,1,0);t=l[0][h].clone();y=l[0][h+1].clone();s=new THREE.UV(y.u,0);this.faces.push(new THREE.Face3(c,p,m,[r,n,q]));this.faceVertexUvs[0].push([t,y,s])}}if(!f&&b>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-g,0)));for(h=0;h<d;h++){c=k[j][h+1];p=k[j][h];m=this.vertices.length-1;r=new THREE.Vector3(0,-1,0);n=new THREE.Vector3(0,-1,0);q=new THREE.Vector3(0,
|
|
|
--1,0);t=l[j][h+1].clone();y=l[j][h].clone();s=new THREE.UV(y.u,1);this.faces.push(new THREE.Face3(c,p,m,[r,n,q]));this.faceVertexUvs[0].push([t,y,s])}}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
|
|
|
-THREE.ExtrudeGeometry=function(a,b){if(typeof a!=="undefined"){THREE.Geometry.call(this);a=a instanceof Array?a:[a];this.shapebb=a[a.length-1].getBoundingBox();this.addShapeList(a,b);this.computeCentroids();this.computeFaceNormals()}};THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;THREE.ExtrudeGeometry.prototype.addShapeList=function(a,b){for(var c=a.length,d=0;d<c;d++)this.addShape(a[d],b)};
|
|
|
+THREE.CylinderGeometry=function(a,b,c,d,e,f){THREE.Geometry.call(this);var a=a!==void 0?a:20,b=b!==void 0?b:20,c=c!==void 0?c:100,g=c/2,d=d||8,e=e||1,h,j,k=[],l=[];for(j=0;j<=e;j++){var p=[],m=[],o=j/e,r=o*(b-a)+a;for(h=0;h<=d;h++){var n=h/d,q=r*Math.sin(n*Math.PI*2),u=-o*c+g,t=r*Math.cos(n*Math.PI*2);this.vertices.push(new THREE.Vertex(q,u,t));p.push(this.vertices.length-1);m.push(new THREE.UV(n,o))}k.push(p);l.push(m)}for(j=0;j<e;j++)for(h=0;h<d;h++){var c=k[j][h],p=k[j+1][h],m=k[j+1][h+1],o=k[j][h+
|
|
|
+1],r=this.vertices[c].clone().setY(0).normalize(),n=this.vertices[p].clone().setY(0).normalize(),q=this.vertices[m].clone().setY(0).normalize(),u=this.vertices[o].clone().setY(0).normalize(),t=l[j][h].clone(),y=l[j+1][h].clone(),s=l[j+1][h+1].clone(),x=l[j][h+1].clone();this.faces.push(new THREE.Face4(c,p,m,o,[r,n,q,u]));this.faceVertexUvs[0].push([t,y,s,x])}if(!f&&a>0){this.vertices.push(new THREE.Vertex(0,g,0));for(h=0;h<d;h++){c=k[0][h];p=k[0][h+1];m=this.vertices.length-1;r=new THREE.Vector3(0,
|
|
|
+1,0);n=new THREE.Vector3(0,1,0);q=new THREE.Vector3(0,1,0);t=l[0][h].clone();y=l[0][h+1].clone();s=new THREE.UV(y.u,0);this.faces.push(new THREE.Face3(c,p,m,[r,n,q]));this.faceVertexUvs[0].push([t,y,s])}}if(!f&&b>0){this.vertices.push(new THREE.Vertex(0,-g,0));for(h=0;h<d;h++){c=k[j][h+1];p=k[j][h];m=this.vertices.length-1;r=new THREE.Vector3(0,-1,0);n=new THREE.Vector3(0,-1,0);q=new THREE.Vector3(0,-1,0);t=l[j][h+1].clone();y=l[j][h].clone();s=new THREE.UV(y.u,1);this.faces.push(new THREE.Face3(c,
|
|
|
+p,m,[r,n,q]));this.faceVertexUvs[0].push([t,y,s])}}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;THREE.ExtrudeGeometry=function(a,b){if(typeof a!=="undefined"){THREE.Geometry.call(this);a=a instanceof Array?a:[a];this.shapebb=a[a.length-1].getBoundingBox();this.addShapeList(a,b);this.computeCentroids();this.computeFaceNormals()}};THREE.ExtrudeGeometry.prototype=new THREE.Geometry;
|
|
|
+THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;THREE.ExtrudeGeometry.prototype.addShapeList=function(a,b){for(var c=a.length,d=0;d<c;d++)this.addShape(a[d],b)};
|
|
|
THREE.ExtrudeGeometry.prototype.addShape=function(a,b){function c(a,b,c){b||console.log("die");return b.clone().multiplyScalar(c).addSelf(a)}function d(a,b,c){var d=THREE.ExtrudeGeometry.__v1,e=THREE.ExtrudeGeometry.__v2,f=THREE.ExtrudeGeometry.__v3,g=THREE.ExtrudeGeometry.__v4,h=THREE.ExtrudeGeometry.__v5,i=THREE.ExtrudeGeometry.__v6;d.set(a.x-b.x,a.y-b.y);e.set(a.x-c.x,a.y-c.y);d=d.normalize();e=e.normalize();f.set(-d.y,d.x);g.set(e.y,-e.x);h.copy(a).addSelf(f);i.copy(a).addSelf(g);if(h.equals(i))return g.clone();
|
|
|
h.copy(b).addSelf(f);i.copy(c).addSelf(g);f=d.dot(g);g=i.subSelf(h).dot(g);if(f===0){console.log("Either infinite or no solutions!");g===0?console.log("Its finite solutions."):console.log("Too bad, no solutions.")}g=g/f;if(g<0){b=Math.atan2(b.y-a.y,b.x-a.x);a=Math.atan2(c.y-a.y,c.x-a.x);b>a&&(a=a+Math.PI*2);c=(b+a)/2;a=-Math.cos(c);c=-Math.sin(c);return new THREE.Vector2(a,c)}return d.multiplyScalar(g).addSelf(h).subSelf(a).clone()}function e(c,d){var e,f;for(G=c.length;--G>=0;){e=G;f=G-1;f<0&&(f=
|
|
|
-c.length-1);for(var g=0,h=m+l*2,g=0;g<h;g++){var i=E*g,j=E*(g+1),k=d+e+i,i=d+f+i,n=d+f+j,j=d+e+j,o=c,p=g,r=h,k=k+K,i=i+K,n=n+K,j=j+K;C.faces.push(new THREE.Face4(k,i,n,j,null,null,t));k=R.generateSideWallUV(C,a,o,b,k,i,n,j,p,r);C.faceVertexUvs[0].push(k)}}}function f(a,b,c){C.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function g(c,d,e,f){c=c+K;d=d+K;e=e+K;C.faces.push(new THREE.Face3(c,d,e,null,null,u));c=f?R.generateBottomUV(C,a,b,c,d,e):R.generateTopUV(C,a,b,c,d,e);C.faceVertexUvs[0].push(c)}
|
|
|
-var h=b.amount!==void 0?b.amount:100,j=b.bevelThickness!==void 0?b.bevelThickness:6,k=b.bevelSize!==void 0?b.bevelSize:j-2,l=b.bevelSegments!==void 0?b.bevelSegments:3,p=b.bevelEnabled!==void 0?b.bevelEnabled:true,m=b.steps!==void 0?b.steps:1,o=b.bendPath,r=b.extrudePath,n,q=false,u=b.material,t=b.extrudeMaterial,y,s,x,D;if(r){n=r.getSpacedPoints(m);q=true;p=false;y=new THREE.TubeGeometry.FrenetFrames(r,m,false);s=new THREE.Vector3;x=new THREE.Vector3;D=new THREE.Vector3}if(!p)k=j=l=0;var B,w,v,C=
|
|
|
-this,K=this.vertices.length;o&&a.addWrapPath(o);var r=a.extractPoints(),o=r.shape,L=r.holes;if(r=!THREE.Shape.Utils.isClockWise(o)){o=o.reverse();w=0;for(v=L.length;w<v;w++){B=L[w];THREE.Shape.Utils.isClockWise(B)&&(L[w]=B.reverse())}r=false}var T=THREE.Shape.Utils.triangulateShape(o,L),P=o;w=0;for(v=L.length;w<v;w++){B=L[w];o=o.concat(B)}var J,N,F,i,U,E=o.length,H,W=T.length,r=[],G=0;F=P.length;J=F-1;for(N=G+1;G<F;G++,J++,N++){J===F&&(J=0);N===F&&(N=0);r[G]=d(P[G],P[J],P[N])}var ha=[],fa,la=r.concat();
|
|
|
+c.length-1);for(var g=0,h=m+l*2,g=0;g<h;g++){var i=E*g,j=E*(g+1),k=d+e+i,i=d+f+i,n=d+f+j,j=d+e+j,o=c,p=g,r=h,k=k+K,i=i+K,n=n+K,j=j+K;C.faces.push(new THREE.Face4(k,i,n,j,null,null,t));k=R.generateSideWallUV(C,a,o,b,k,i,n,j,p,r);C.faceVertexUvs[0].push(k)}}}function f(a,b,c){C.vertices.push(new THREE.Vertex(a,b,c))}function g(c,d,e,f){c=c+K;d=d+K;e=e+K;C.faces.push(new THREE.Face3(c,d,e,null,null,u));c=f?R.generateBottomUV(C,a,b,c,d,e):R.generateTopUV(C,a,b,c,d,e);C.faceVertexUvs[0].push(c)}var h=
|
|
|
+b.amount!==void 0?b.amount:100,j=b.bevelThickness!==void 0?b.bevelThickness:6,k=b.bevelSize!==void 0?b.bevelSize:j-2,l=b.bevelSegments!==void 0?b.bevelSegments:3,p=b.bevelEnabled!==void 0?b.bevelEnabled:true,m=b.steps!==void 0?b.steps:1,o=b.bendPath,r=b.extrudePath,n,q=false,u=b.material,t=b.extrudeMaterial,y,s,x,D;if(r){n=r.getSpacedPoints(m);q=true;p=false;y=new THREE.TubeGeometry.FrenetFrames(r,m,false);s=new THREE.Vector3;x=new THREE.Vector3;D=new THREE.Vector3}if(!p)k=j=l=0;var B,w,v,C=this,
|
|
|
+K=this.vertices.length;o&&a.addWrapPath(o);var r=a.extractPoints(),o=r.shape,L=r.holes;if(r=!THREE.Shape.Utils.isClockWise(o)){o=o.reverse();w=0;for(v=L.length;w<v;w++){B=L[w];THREE.Shape.Utils.isClockWise(B)&&(L[w]=B.reverse())}r=false}var T=THREE.Shape.Utils.triangulateShape(o,L),P=o;w=0;for(v=L.length;w<v;w++){B=L[w];o=o.concat(B)}var J,N,F,i,U,E=o.length,H,W=T.length,r=[],G=0;F=P.length;J=F-1;for(N=G+1;G<F;G++,J++,N++){J===F&&(J=0);N===F&&(N=0);r[G]=d(P[G],P[J],P[N])}var ha=[],fa,la=r.concat();
|
|
|
w=0;for(v=L.length;w<v;w++){B=L[w];fa=[];G=0;F=B.length;J=F-1;for(N=G+1;G<F;G++,J++,N++){J===F&&(J=0);N===F&&(N=0);fa[G]=d(B[G],B[J],B[N])}ha.push(fa);la=la.concat(fa)}for(J=0;J<l;J++){F=J/l;i=j*(1-F);N=k*Math.sin(F*Math.PI/2);G=0;for(F=P.length;G<F;G++){U=c(P[G],r[G],N);f(U.x,U.y,-i)}w=0;for(v=L.length;w<v;w++){B=L[w];fa=ha[w];G=0;for(F=B.length;G<F;G++){U=c(B[G],fa[G],N);f(U.x,U.y,-i)}}}N=k;for(G=0;G<E;G++){U=p?c(o[G],la[G],N):o[G];if(q){x.copy(y.normals[0]).multiplyScalar(U.x);s.copy(y.binormals[0]).multiplyScalar(U.y);
|
|
|
D.copy(n[0]).addSelf(x).addSelf(s);f(D.x,D.y,D.z)}else f(U.x,U.y,0)}for(F=1;F<=m;F++)for(G=0;G<E;G++){U=p?c(o[G],la[G],N):o[G];if(q){x.copy(y.normals[F]).multiplyScalar(U.x);s.copy(y.binormals[F]).multiplyScalar(U.y);D.copy(n[F]).addSelf(x).addSelf(s);f(D.x,D.y,D.z)}else f(U.x,U.y,h/m*F)}for(J=l-1;J>=0;J--){F=J/l;i=j*(1-F);N=k*Math.sin(F*Math.PI/2);G=0;for(F=P.length;G<F;G++){U=c(P[G],r[G],N);f(U.x,U.y,h+i)}w=0;for(v=L.length;w<v;w++){B=L[w];fa=ha[w];G=0;for(F=B.length;G<F;G++){U=c(B[G],fa[G],N);
|
|
|
q?f(U.x,U.y+n[m-1].y,n[m-1].x+i):f(U.x,U.y,h+i)}}}var R=THREE.ExtrudeGeometry.WorldUVGenerator;(function(){if(p){var a;a=E*0;for(G=0;G<W;G++){H=T[G];g(H[2]+a,H[1]+a,H[0]+a,true)}a=m+l*2;a=E*a;for(G=0;G<W;G++){H=T[G];g(H[0]+a,H[1]+a,H[2]+a,false)}}else{for(G=0;G<W;G++){H=T[G];g(H[2],H[1],H[0],true)}for(G=0;G<W;G++){H=T[G];g(H[0]+E*m,H[1]+E*m,H[2]+E*m,false)}}})();(function(){var a=0;e(P,a);a=a+P.length;w=0;for(v=L.length;w<v;w++){B=L[w];e(B,a);a=a+B.length}})()};
|
|
|
-THREE.ExtrudeGeometry.WorldUVGenerator={generateTopUV:function(a,b,c,d,e,f){b=a.vertices[e].position.x;e=a.vertices[e].position.y;c=a.vertices[f].position.x;f=a.vertices[f].position.y;return[new THREE.UV(a.vertices[d].position.x,1-a.vertices[d].position.y),new THREE.UV(b,1-e),new THREE.UV(c,1-f)]},generateBottomUV:function(a,b,c,d,e,f){return this.generateTopUV(a,b,c,d,e,f)},generateSideWallUV:function(a,b,c,d,e,f,g,h){var b=a.vertices[e].position.x,c=a.vertices[e].position.y,e=a.vertices[e].position.z,
|
|
|
-d=a.vertices[f].position.x,j=a.vertices[f].position.y,f=a.vertices[f].position.z,k=a.vertices[g].position.x,l=a.vertices[g].position.y,g=a.vertices[g].position.z,p=a.vertices[h].position.x,m=a.vertices[h].position.y,a=a.vertices[h].position.z;return Math.abs(c-j)<0.01?[new THREE.UV(b,e),new THREE.UV(d,f),new THREE.UV(k,g),new THREE.UV(p,a)]:[new THREE.UV(c,e),new THREE.UV(j,f),new THREE.UV(l,g),new THREE.UV(m,a)]}};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2;
|
|
|
-THREE.ExtrudeGeometry.__v3=new THREE.Vector2;THREE.ExtrudeGeometry.__v4=new THREE.Vector2;THREE.ExtrudeGeometry.__v5=new THREE.Vector2;THREE.ExtrudeGeometry.__v6=new THREE.Vector2;
|
|
|
-THREE.LatheGeometry=function(a,b,c){THREE.Geometry.call(this);for(var b=b||12,c=c||2*Math.PI,d=[],e=(new THREE.Matrix4).makeRotationZ(c/b),f=0;f<a.length;f++){d[f]=a[f].clone();this.vertices.push(new THREE.Vertex(d[f]))}for(var g=b+1,c=0;c<g;c++)for(f=0;f<d.length;f++){d[f]=e.multiplyVector3(d[f].clone());this.vertices.push(new THREE.Vertex(d[f]))}for(c=0;c<b;c++){d=0;for(e=a.length;d<e-1;d++){this.faces.push(new THREE.Face4(c*e+d,(c+1)%g*e+d,(c+1)%g*e+(d+1)%e,c*e+(d+1)%e));this.faceVertexUvs[0].push([new THREE.UV(1-
|
|
|
+THREE.ExtrudeGeometry.WorldUVGenerator={generateTopUV:function(a,b,c,d,e,f){b=a.vertices[e].x;e=a.vertices[e].y;c=a.vertices[f].x;f=a.vertices[f].y;return[new THREE.UV(a.vertices[d].x,1-a.vertices[d].y),new THREE.UV(b,1-e),new THREE.UV(c,1-f)]},generateBottomUV:function(a,b,c,d,e,f){return this.generateTopUV(a,b,c,d,e,f)},generateSideWallUV:function(a,b,c,d,e,f,g,h){var b=a.vertices[e].x,c=a.vertices[e].y,e=a.vertices[e].z,d=a.vertices[f].x,j=a.vertices[f].y,f=a.vertices[f].z,k=a.vertices[g].x,l=
|
|
|
+a.vertices[g].y,g=a.vertices[g].z,p=a.vertices[h].x,m=a.vertices[h].y,a=a.vertices[h].z;return Math.abs(c-j)<0.01?[new THREE.UV(b,e),new THREE.UV(d,f),new THREE.UV(k,g),new THREE.UV(p,a)]:[new THREE.UV(c,e),new THREE.UV(j,f),new THREE.UV(l,g),new THREE.UV(m,a)]}};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2;THREE.ExtrudeGeometry.__v3=new THREE.Vector2;THREE.ExtrudeGeometry.__v4=new THREE.Vector2;THREE.ExtrudeGeometry.__v5=new THREE.Vector2;
|
|
|
+THREE.ExtrudeGeometry.__v6=new THREE.Vector2;
|
|
|
+THREE.LatheGeometry=function(a,b,c){THREE.Geometry.call(this);for(var b=b||12,c=c||2*Math.PI,d=[],e=(new THREE.Matrix4).makeRotationZ(c/b),f=0;f<a.length;f++){d[f]=a[f].clone();this.vertices.push((new THREE.Vertex).copy(d[f]))}for(var g=b+1,c=0;c<g;c++)for(f=0;f<d.length;f++){d[f]=e.multiplyVector3(d[f].clone());this.vertices.push((new THREE.Vertex).copy(d[f]))}for(c=0;c<b;c++){d=0;for(e=a.length;d<e-1;d++){this.faces.push(new THREE.Face4(c*e+d,(c+1)%g*e+d,(c+1)%g*e+(d+1)%e,c*e+(d+1)%e));this.faceVertexUvs[0].push([new THREE.UV(1-
|
|
|
c/b,d/e),new THREE.UV(1-(c+1)/b,d/e),new THREE.UV(1-(c+1)/b,(d+1)/e),new THREE.UV(1-c/b,(d+1)/e)])}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=new THREE.Geometry;THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry;
|
|
|
-THREE.PlaneGeometry=function(a,b,c,d){THREE.Geometry.call(this);for(var e=a/2,f=b/2,c=c||1,d=d||1,g=c+1,h=d+1,j=a/c,k=b/d,l=new THREE.Vector3(0,1,0),a=0;a<h;a++)for(b=0;b<g;b++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(b*j-e,0,a*k-f)));for(a=0;a<d;a++)for(b=0;b<c;b++){e=new THREE.Face4(b+g*a,b+g*(a+1),b+1+g*(a+1),b+1+g*a);e.normal.copy(l);e.vertexNormals.push(l.clone(),l.clone(),l.clone(),l.clone());this.faces.push(e);this.faceVertexUvs[0].push([new THREE.UV(b/c,a/d),new THREE.UV(b/c,
|
|
|
-(a+1)/d),new THREE.UV((b+1)/c,(a+1)/d),new THREE.UV((b+1)/c,a/d)])}this.computeCentroids()};THREE.PlaneGeometry.prototype=new THREE.Geometry;THREE.PlaneGeometry.prototype.constructor=THREE.PlaneGeometry;
|
|
|
-THREE.SphereGeometry=function(a,b,c,d,e,f,g){THREE.Geometry.call(this);var a=a||50,d=d!==void 0?d:0,e=e!==void 0?e:Math.PI*2,f=f!==void 0?f:0,g=g!==void 0?g:Math.PI,b=Math.max(3,Math.floor(b)||8),c=Math.max(2,Math.floor(c)||6),h,j,k=[],l=[];for(j=0;j<=c;j++){var p=[],m=[];for(h=0;h<=b;h++){var o=h/b,r=j/c,n=-a*Math.cos(d+o*e)*Math.sin(f+r*g),q=a*Math.cos(f+r*g),u=a*Math.sin(d+o*e)*Math.sin(f+r*g);this.vertices.push(new THREE.Vertex(new THREE.Vector3(n,q,u)));p.push(this.vertices.length-1);m.push(new THREE.UV(o,
|
|
|
-r))}k.push(p);l.push(m)}for(j=0;j<c;j++)for(h=0;h<b;h++){var d=k[j][h+1],e=k[j][h],f=k[j+1][h],g=k[j+1][h+1],p=this.vertices[d].position.clone().normalize(),m=this.vertices[e].position.clone().normalize(),o=this.vertices[f].position.clone().normalize(),r=this.vertices[g].position.clone().normalize(),n=l[j][h+1].clone(),q=l[j][h].clone(),u=l[j+1][h].clone(),t=l[j+1][h+1].clone();if(Math.abs(this.vertices[d].position.y)==a){this.faces.push(new THREE.Face3(d,f,g,[p,o,r]));this.faceVertexUvs[0].push([n,
|
|
|
-u,t])}else if(Math.abs(this.vertices[f].position.y)==a){this.faces.push(new THREE.Face3(d,e,f,[p,m,o]));this.faceVertexUvs[0].push([n,q,u])}else{this.faces.push(new THREE.Face4(d,e,f,g,[p,m,o,r]));this.faceVertexUvs[0].push([n,q,u,t])}}this.computeCentroids();this.computeFaceNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=new THREE.Geometry;THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry;
|
|
|
+THREE.PlaneGeometry=function(a,b,c,d){THREE.Geometry.call(this);for(var e=a/2,f=b/2,c=c||1,d=d||1,g=c+1,h=d+1,j=a/c,k=b/d,l=new THREE.Vector3(0,1,0),a=0;a<h;a++)for(b=0;b<g;b++)this.vertices.push(new THREE.Vertex(b*j-e,0,a*k-f));for(a=0;a<d;a++)for(b=0;b<c;b++){e=new THREE.Face4(b+g*a,b+g*(a+1),b+1+g*(a+1),b+1+g*a);e.normal.copy(l);e.vertexNormals.push(l.clone(),l.clone(),l.clone(),l.clone());this.faces.push(e);this.faceVertexUvs[0].push([new THREE.UV(b/c,a/d),new THREE.UV(b/c,(a+1)/d),new THREE.UV((b+
|
|
|
+1)/c,(a+1)/d),new THREE.UV((b+1)/c,a/d)])}this.computeCentroids()};THREE.PlaneGeometry.prototype=new THREE.Geometry;THREE.PlaneGeometry.prototype.constructor=THREE.PlaneGeometry;
|
|
|
+THREE.SphereGeometry=function(a,b,c,d,e,f,g){THREE.Geometry.call(this);var a=a||50,d=d!==void 0?d:0,e=e!==void 0?e:Math.PI*2,f=f!==void 0?f:0,g=g!==void 0?g:Math.PI,b=Math.max(3,Math.floor(b)||8),c=Math.max(2,Math.floor(c)||6),h,j,k=[],l=[];for(j=0;j<=c;j++){var p=[],m=[];for(h=0;h<=b;h++){var o=h/b,r=j/c,n=-a*Math.cos(d+o*e)*Math.sin(f+r*g),q=a*Math.cos(f+r*g),u=a*Math.sin(d+o*e)*Math.sin(f+r*g);this.vertices.push(new THREE.Vertex(n,q,u));p.push(this.vertices.length-1);m.push(new THREE.UV(o,r))}k.push(p);
|
|
|
+l.push(m)}for(j=0;j<c;j++)for(h=0;h<b;h++){var d=k[j][h+1],e=k[j][h],f=k[j+1][h],g=k[j+1][h+1],p=this.vertices[d].clone().normalize(),m=this.vertices[e].clone().normalize(),o=this.vertices[f].clone().normalize(),r=this.vertices[g].clone().normalize(),n=l[j][h+1].clone(),q=l[j][h].clone(),u=l[j+1][h].clone(),t=l[j+1][h+1].clone();if(Math.abs(this.vertices[d].y)==a){this.faces.push(new THREE.Face3(d,f,g,[p,o,r]));this.faceVertexUvs[0].push([n,u,t])}else if(Math.abs(this.vertices[f].y)==a){this.faces.push(new THREE.Face3(d,
|
|
|
+e,f,[p,m,o]));this.faceVertexUvs[0].push([n,q,u])}else{this.faces.push(new THREE.Face4(d,e,f,g,[p,m,o,r]));this.faceVertexUvs[0].push([n,q,u,t])}}this.computeCentroids();this.computeFaceNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=new THREE.Geometry;THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry;
|
|
|
THREE.TextGeometry=function(a,b){var c=(new THREE.TextPath(a,b)).toShapes();b.amount=b.height!==void 0?b.height:50;if(b.bevelThickness===void 0)b.bevelThickness=10;if(b.bevelSize===void 0)b.bevelSize=8;if(b.bevelEnabled===void 0)b.bevelEnabled=false;if(b.bend){var d=c[c.length-1].getBoundingBox().maxX;b.bendPath=new THREE.QuadraticBezierCurve(new THREE.Vector2(0,0),new THREE.Vector2(d/2,120),new THREE.Vector2(d,0))}THREE.ExtrudeGeometry.call(this,c,b)};THREE.TextGeometry.prototype=new THREE.ExtrudeGeometry;
|
|
|
THREE.TextGeometry.prototype.constructor=THREE.TextGeometry;
|
|
|
THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){return this.faces[this.face][this.weight][this.style]},loadFace:function(a){var b=a.familyName.toLowerCase();this.faces[b]=this.faces[b]||{};this.faces[b][a.cssFontWeight]=this.faces[b][a.cssFontWeight]||{};this.faces[b][a.cssFontWeight][a.cssFontStyle]=a;return this.faces[b][a.cssFontWeight][a.cssFontStyle]=a},drawText:function(a){for(var b=this.getFace(),c=this.size/b.resolution,d=
|
|
@@ -591,46 +590,45 @@ n,j);t=THREE.Shape.Utils.b3(t,m,r,q,l);f.push(new THREE.Vector2(y,t))}}}}}return
|
|
|
(function(a){var b=function(a){for(var b=a.length,e=0,f=b-1,g=0;g<b;f=g++)e=e+(a[f].x*a[g].y-a[g].x*a[f].y);return e*0.5};a.Triangulate=function(a,d){var e=a.length;if(e<3)return null;var f=[],g=[],h=[],j,k,l;if(b(a)>0)for(k=0;k<e;k++)g[k]=k;else for(k=0;k<e;k++)g[k]=e-1-k;var p=2*e;for(k=e-1;e>2;){if(p--<=0){console.log("Warning, unable to triangulate polygon!");break}j=k;e<=j&&(j=0);k=j+1;e<=k&&(k=0);l=k+1;e<=l&&(l=0);var m;a:{m=a;var o=j,r=k,n=l,q=e,u=g,t=void 0,y=void 0,s=void 0,x=void 0,D=void 0,
|
|
|
B=void 0,w=void 0,v=void 0,C=void 0,y=m[u[o]].x,s=m[u[o]].y,x=m[u[r]].x,D=m[u[r]].y,B=m[u[n]].x,w=m[u[n]].y;if(1.0E-10>(x-y)*(w-s)-(D-s)*(B-y))m=false;else{for(t=0;t<q;t++)if(!(t==o||t==r||t==n)){var v=m[u[t]].x,C=m[u[t]].y,K=void 0,L=void 0,T=void 0,P=void 0,J=void 0,N=void 0,F=void 0,i=void 0,U=void 0,E=void 0,H=void 0,W=void 0,K=T=J=void 0,K=B-x,L=w-D,T=y-B,P=s-w,J=x-y,N=D-s,F=v-y,i=C-s,U=v-x,E=C-D,H=v-B,W=C-w,K=K*E-L*U,J=J*i-N*F,T=T*W-P*H;if(K>=0&&T>=0&&J>=0){m=false;break a}}m=true}}if(m){f.push([a[g[j]],
|
|
|
a[g[k]],a[g[l]]]);h.push([g[j],g[k],g[l]]);j=k;for(l=k+1;l<e;j++,l++)g[j]=g[l];e--;p=2*e}}return d?h:f};a.Triangulate.area=b;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
|
|
|
-THREE.TorusGeometry=function(a,b,c,d,e){THREE.Geometry.call(this);this.radius=a||100;this.tube=b||40;this.segmentsR=c||8;this.segmentsT=d||6;this.arc=e||Math.PI*2;e=new THREE.Vector3;a=[];b=[];for(c=0;c<=this.segmentsR;c++)for(d=0;d<=this.segmentsT;d++){var f=d/this.segmentsT*this.arc,g=c/this.segmentsR*Math.PI*2;e.x=this.radius*Math.cos(f);e.y=this.radius*Math.sin(f);var h=new THREE.Vector3;h.x=(this.radius+this.tube*Math.cos(g))*Math.cos(f);h.y=(this.radius+this.tube*Math.cos(g))*Math.sin(f);h.z=
|
|
|
-this.tube*Math.sin(g);this.vertices.push(new THREE.Vertex(h));a.push(new THREE.UV(d/this.segmentsT,1-c/this.segmentsR));b.push(h.clone().subSelf(e).normalize())}for(c=1;c<=this.segmentsR;c++)for(d=1;d<=this.segmentsT;d++){var e=(this.segmentsT+1)*c+d-1,f=(this.segmentsT+1)*(c-1)+d-1,g=(this.segmentsT+1)*(c-1)+d,h=(this.segmentsT+1)*c+d,j=new THREE.Face4(e,f,g,h,[b[e],b[f],b[g],b[h]]);j.normal.addSelf(b[e]);j.normal.addSelf(b[f]);j.normal.addSelf(b[g]);j.normal.addSelf(b[h]);j.normal.normalize();this.faces.push(j);
|
|
|
+THREE.TorusGeometry=function(a,b,c,d,e){THREE.Geometry.call(this);this.radius=a||100;this.tube=b||40;this.segmentsR=c||8;this.segmentsT=d||6;this.arc=e||Math.PI*2;e=new THREE.Vector3;a=[];b=[];for(c=0;c<=this.segmentsR;c++)for(d=0;d<=this.segmentsT;d++){var f=d/this.segmentsT*this.arc,g=c/this.segmentsR*Math.PI*2;e.x=this.radius*Math.cos(f);e.y=this.radius*Math.sin(f);var h=new THREE.Vertex;h.x=(this.radius+this.tube*Math.cos(g))*Math.cos(f);h.y=(this.radius+this.tube*Math.cos(g))*Math.sin(f);h.z=
|
|
|
+this.tube*Math.sin(g);this.vertices.push(h);a.push(new THREE.UV(d/this.segmentsT,1-c/this.segmentsR));b.push(h.clone().subSelf(e).normalize())}for(c=1;c<=this.segmentsR;c++)for(d=1;d<=this.segmentsT;d++){var e=(this.segmentsT+1)*c+d-1,f=(this.segmentsT+1)*(c-1)+d-1,g=(this.segmentsT+1)*(c-1)+d,h=(this.segmentsT+1)*c+d,j=new THREE.Face4(e,f,g,h,[b[e],b[f],b[g],b[h]]);j.normal.addSelf(b[e]);j.normal.addSelf(b[f]);j.normal.addSelf(b[g]);j.normal.addSelf(b[h]);j.normal.normalize();this.faces.push(j);
|
|
|
this.faceVertexUvs[0].push([a[e].clone(),a[f].clone(),a[g].clone(),a[h].clone()])}this.computeCentroids()};THREE.TorusGeometry.prototype=new THREE.Geometry;THREE.TorusGeometry.prototype.constructor=THREE.TorusGeometry;
|
|
|
THREE.TorusKnotGeometry=function(a,b,c,d,e,f,g){function h(a,b,c,d,e,f){var g=Math.cos(a);Math.cos(b);b=Math.sin(a);a=c/d*a;c=Math.cos(a);g=e*(2+c)*0.5*g;b=e*(2+c)*b*0.5;e=f*e*Math.sin(a)*0.5;return new THREE.Vector3(g,b,e)}THREE.Geometry.call(this);this.radius=a||200;this.tube=b||40;this.segmentsR=c||64;this.segmentsT=d||8;this.p=e||2;this.q=f||3;this.heightScale=g||1;this.grid=Array(this.segmentsR);c=new THREE.Vector3;d=new THREE.Vector3;e=new THREE.Vector3;for(a=0;a<this.segmentsR;++a){this.grid[a]=
|
|
|
-Array(this.segmentsT);for(b=0;b<this.segmentsT;++b){var j=a/this.segmentsR*2*this.p*Math.PI,g=b/this.segmentsT*2*Math.PI,f=h(j,g,this.q,this.p,this.radius,this.heightScale),j=h(j+0.01,g,this.q,this.p,this.radius,this.heightScale);c.sub(j,f);d.add(j,f);e.cross(c,d);d.cross(e,c);e.normalize();d.normalize();j=-this.tube*Math.cos(g);g=this.tube*Math.sin(g);f.x=f.x+(j*d.x+g*e.x);f.y=f.y+(j*d.y+g*e.y);f.z=f.z+(j*d.z+g*e.z);this.grid[a][b]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(f.x,f.y,f.z)))-
|
|
|
-1}}for(a=0;a<this.segmentsR;++a)for(b=0;b<this.segmentsT;++b){var e=(a+1)%this.segmentsR,f=(b+1)%this.segmentsT,c=this.grid[a][b],d=this.grid[e][b],e=this.grid[e][f],f=this.grid[a][f],g=new THREE.UV(a/this.segmentsR,b/this.segmentsT),j=new THREE.UV((a+1)/this.segmentsR,b/this.segmentsT),k=new THREE.UV((a+1)/this.segmentsR,(b+1)/this.segmentsT),l=new THREE.UV(a/this.segmentsR,(b+1)/this.segmentsT);this.faces.push(new THREE.Face4(c,d,e,f));this.faceVertexUvs[0].push([g,j,k,l])}this.computeCentroids();
|
|
|
-this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=new THREE.Geometry;THREE.TorusKnotGeometry.prototype.constructor=THREE.TorusKnotGeometry;
|
|
|
+Array(this.segmentsT);for(b=0;b<this.segmentsT;++b){var j=a/this.segmentsR*2*this.p*Math.PI,g=b/this.segmentsT*2*Math.PI,f=h(j,g,this.q,this.p,this.radius,this.heightScale),j=h(j+0.01,g,this.q,this.p,this.radius,this.heightScale);c.sub(j,f);d.add(j,f);e.cross(c,d);d.cross(e,c);e.normalize();d.normalize();j=-this.tube*Math.cos(g);g=this.tube*Math.sin(g);f.x=f.x+(j*d.x+g*e.x);f.y=f.y+(j*d.y+g*e.y);f.z=f.z+(j*d.z+g*e.z);this.grid[a][b]=this.vertices.push(new THREE.Vertex(f.x,f.y,f.z))-1}}for(a=0;a<this.segmentsR;++a)for(b=
|
|
|
+0;b<this.segmentsT;++b){var e=(a+1)%this.segmentsR,f=(b+1)%this.segmentsT,c=this.grid[a][b],d=this.grid[e][b],e=this.grid[e][f],f=this.grid[a][f],g=new THREE.UV(a/this.segmentsR,b/this.segmentsT),j=new THREE.UV((a+1)/this.segmentsR,b/this.segmentsT),k=new THREE.UV((a+1)/this.segmentsR,(b+1)/this.segmentsT),l=new THREE.UV(a/this.segmentsR,(b+1)/this.segmentsT);this.faces.push(new THREE.Face4(c,d,e,f));this.faceVertexUvs[0].push([g,j,k,l])}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};
|
|
|
+THREE.TorusKnotGeometry.prototype=new THREE.Geometry;THREE.TorusKnotGeometry.prototype.constructor=THREE.TorusKnotGeometry;
|
|
|
THREE.TubeGeometry=function(a,b,c,d,e,f){THREE.Geometry.call(this);this.path=a;this.segments=b||64;this.radius=c||1;this.segmentsRadius=d||8;this.closed=e||false;if(f)this.debug=new THREE.Object3D;this.grid=[];var g,h,f=this.segments+1,j,k,l,p=new THREE.Vector3,m,o,r,b=new THREE.TubeGeometry.FrenetFrames(a,b,e);m=b.tangents;o=b.normals;r=b.binormals;this.tangents=m;this.normals=o;this.binormals=r;for(b=0;b<f;b++){this.grid[b]=[];d=b/(f-1);l=a.getPointAt(d);d=m[b];g=o[b];h=r[b];if(this.debug){this.debug.add(new THREE.ArrowHelper(d,
|
|
|
-l,c,255));this.debug.add(new THREE.ArrowHelper(g,l,c,16711680));this.debug.add(new THREE.ArrowHelper(h,l,c,65280))}for(d=0;d<this.segmentsRadius;d++){j=d/this.segmentsRadius*2*Math.PI;k=-this.radius*Math.cos(j);j=this.radius*Math.sin(j);p.copy(l);p.x=p.x+(k*g.x+j*h.x);p.y=p.y+(k*g.y+j*h.y);p.z=p.z+(k*g.z+j*h.z);this.grid[b][d]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(p.x,p.y,p.z)))-1}}for(b=0;b<this.segments;b++)for(d=0;d<this.segmentsRadius;d++){f=e?(b+1)%this.segments:b+1;p=(d+1)%this.segmentsRadius;
|
|
|
+l,c,255));this.debug.add(new THREE.ArrowHelper(g,l,c,16711680));this.debug.add(new THREE.ArrowHelper(h,l,c,65280))}for(d=0;d<this.segmentsRadius;d++){j=d/this.segmentsRadius*2*Math.PI;k=-this.radius*Math.cos(j);j=this.radius*Math.sin(j);p.copy(l);p.x=p.x+(k*g.x+j*h.x);p.y=p.y+(k*g.y+j*h.y);p.z=p.z+(k*g.z+j*h.z);this.grid[b][d]=this.vertices.push(new THREE.Vertex(p.x,p.y,p.z))-1}}for(b=0;b<this.segments;b++)for(d=0;d<this.segmentsRadius;d++){f=e?(b+1)%this.segments:b+1;p=(d+1)%this.segmentsRadius;
|
|
|
a=this.grid[b][d];c=this.grid[f][d];f=this.grid[f][p];p=this.grid[b][p];m=new THREE.UV(b/this.segments,d/this.segmentsRadius);o=new THREE.UV((b+1)/this.segments,d/this.segmentsRadius);r=new THREE.UV((b+1)/this.segments,(d+1)/this.segmentsRadius);g=new THREE.UV(b/this.segments,(d+1)/this.segmentsRadius);this.faces.push(new THREE.Face4(a,c,f,p));this.faceVertexUvs[0].push([m,o,r,g])}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.TubeGeometry.prototype=new THREE.Geometry;
|
|
|
THREE.TubeGeometry.prototype.constructor=THREE.TubeGeometry;
|
|
|
THREE.TubeGeometry.FrenetFrames=function(a,b,c){new THREE.Vector3;var d=new THREE.Vector3;new THREE.Vector3;var e=[],f=[],g=[],h=new THREE.Vector3,j=new THREE.Matrix4,b=b+1,k,l,p;this.tangents=e;this.normals=f;this.binormals=g;for(k=0;k<b;k++){l=k/(b-1);e[k]=a.getTangentAt(l);e[k].normalize()}f[0]=new THREE.Vector3;g[0]=new THREE.Vector3;a=Number.MAX_VALUE;k=Math.abs(e[0].x);l=Math.abs(e[0].y);p=Math.abs(e[0].z);if(k<=a){a=k;d.set(1,0,0)}if(l<=a){a=l;d.set(0,1,0)}p<=a&&d.set(0,0,1);h.cross(e[0],d).normalize();
|
|
|
f[0].cross(e[0],h);g[0].cross(e[0],f[0]);for(k=1;k<b;k++){f[k]=f[k-1].clone();g[k]=g[k-1].clone();h.cross(e[k-1],e[k]);if(h.length()>1.0E-4){h.normalize();d=Math.acos(e[k-1].dot(e[k]));j.makeRotationAxis(h,d).multiplyVector3(f[k])}g[k].cross(e[k],f[k])}if(c){d=Math.acos(f[0].dot(f[b-1]));d=d/(b-1);e[0].dot(h.cross(f[0],f[b-1]))>0&&(d=-d);for(k=1;k<b;k++){j.makeRotationAxis(e[k],d*k).multiplyVector3(f[k]);g[k].cross(e[k],f[k])}}};
|
|
|
-THREE.PolyhedronGeometry=function(a,b,c,d){function e(a){var b=new THREE.Vertex(a.normalize());b.index=j.vertices.push(b)-1;var c=Math.atan2(a.z,-a.x)/2/Math.PI+0.5,a=Math.atan2(-a.y,Math.sqrt(a.x*a.x+a.z*a.z))/Math.PI+0.5;b.uv=new THREE.UV(c,a);return b}function f(a,b,c,d){if(d<1){d=new THREE.Face3(a.index,b.index,c.index,[a.position.clone(),b.position.clone(),c.position.clone()]);d.centroid.addSelf(a.position).addSelf(b.position).addSelf(c.position).divideScalar(3);d.normal=d.centroid.clone().normalize();
|
|
|
-j.faces.push(d);d=Math.atan2(d.centroid.z,-d.centroid.x);j.faceVertexUvs[0].push([h(a.uv,a.position,d),h(b.uv,b.position,d),h(c.uv,c.position,d)])}else{d=d-1;f(a,g(a,b),g(a,c),d);f(g(a,b),b,g(b,c),d);f(g(a,c),g(b,c),c,d);f(g(a,b),g(b,c),g(a,c),d)}}function g(a,b){p[a.index]||(p[a.index]=[]);p[b.index]||(p[b.index]=[]);var c=p[a.index][b.index];c===void 0&&(p[a.index][b.index]=p[b.index][a.index]=c=e((new THREE.Vector3).add(a.position,b.position).divideScalar(2)));return c}function h(a,b,c){c<0&&a.u===
|
|
|
-1&&(a=new THREE.UV(a.u-1,a.v));b.x===0&&b.z===0&&(a=new THREE.UV(c/2/Math.PI+0.5,a.v));return a}THREE.Geometry.call(this);for(var c=c||1,d=d||0,j=this,k=0,l=a.length;k<l;k++)e(new THREE.Vector3(a[k][0],a[k][1],a[k][2]));for(var p=[],a=this.vertices,k=0,l=b.length;k<l;k++)f(a[b[k][0]],a[b[k][1]],a[b[k][2]],d);this.mergeVertices();k=0;for(l=this.vertices.length;k<l;k++)this.vertices[k].position.multiplyScalar(c);this.computeCentroids();this.boundingSphere={radius:c}};
|
|
|
-THREE.PolyhedronGeometry.prototype=new THREE.Geometry;THREE.PolyhedronGeometry.prototype.constructor=THREE.PolyhedronGeometry;
|
|
|
+THREE.PolyhedronGeometry=function(a,b,c,d){function e(a){var b=(new THREE.Vertex).copy(a.normalize());b.index=j.vertices.push(b)-1;var c=Math.atan2(a.z,-a.x)/2/Math.PI+0.5,a=Math.atan2(-a.y,Math.sqrt(a.x*a.x+a.z*a.z))/Math.PI+0.5;b.uv=new THREE.UV(c,a);return b}function f(a,b,c,d){if(d<1){d=new THREE.Face3(a.index,b.index,c.index,[a.clone(),b.clone(),c.clone()]);d.centroid.addSelf(a).addSelf(b).addSelf(c).divideScalar(3);d.normal=d.centroid.clone().normalize();j.faces.push(d);d=Math.atan2(d.centroid.z,
|
|
|
+-d.centroid.x);j.faceVertexUvs[0].push([h(a.uv,a,d),h(b.uv,b,d),h(c.uv,c,d)])}else{d=d-1;f(a,g(a,b),g(a,c),d);f(g(a,b),b,g(b,c),d);f(g(a,c),g(b,c),c,d);f(g(a,b),g(b,c),g(a,c),d)}}function g(a,b){p[a.index]||(p[a.index]=[]);p[b.index]||(p[b.index]=[]);var c=p[a.index][b.index];c===void 0&&(p[a.index][b.index]=p[b.index][a.index]=c=e((new THREE.Vector3).add(a,b).divideScalar(2)));return c}function h(a,b,c){c<0&&a.u===1&&(a=new THREE.UV(a.u-1,a.v));b.x===0&&b.z===0&&(a=new THREE.UV(c/2/Math.PI+0.5,a.v));
|
|
|
+return a}THREE.Geometry.call(this);for(var c=c||1,d=d||0,j=this,k=0,l=a.length;k<l;k++)e(new THREE.Vector3(a[k][0],a[k][1],a[k][2]));for(var p=[],a=this.vertices,k=0,l=b.length;k<l;k++)f(a[b[k][0]],a[b[k][1]],a[b[k][2]],d);this.mergeVertices();k=0;for(l=this.vertices.length;k<l;k++)this.vertices[k].multiplyScalar(c);this.computeCentroids();this.boundingSphere={radius:c}};THREE.PolyhedronGeometry.prototype=new THREE.Geometry;THREE.PolyhedronGeometry.prototype.constructor=THREE.PolyhedronGeometry;
|
|
|
THREE.IcosahedronGeometry=function(a,b){var c=(1+Math.sqrt(5))/2;THREE.PolyhedronGeometry.call(this,[[-1,c,0],[1,c,0],[-1,-c,0],[1,-c,0],[0,-1,c],[0,1,c],[0,-1,-c],[0,1,-c],[c,0,-1],[c,0,1],[-c,0,-1],[-c,0,1]],[[0,11,5],[0,5,1],[0,1,7],[0,7,10],[0,10,11],[1,5,9],[5,11,4],[11,10,2],[10,7,6],[7,1,8],[3,9,4],[3,4,2],[3,2,6],[3,6,8],[3,8,9],[4,9,5],[2,4,11],[6,2,10],[8,6,7],[9,8,1]],a,b)};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
|
|
|
THREE.OctahedronGeometry=function(a,b){THREE.PolyhedronGeometry.call(this,[[1,0,0],[-1,0,0],[0,1,0],[0,-1,0],[0,0,1],[0,0,-1]],[[0,2,4],[0,4,3],[0,3,5],[0,5,2],[1,2,5],[1,5,3],[1,3,4],[1,4,2]],a,b)};THREE.OctahedronGeometry.prototype=new THREE.Geometry;THREE.OctahedronGeometry.prototype.constructor=THREE.OctahedronGeometry;THREE.TetrahedronGeometry=function(a,b){THREE.PolyhedronGeometry.call(this,[[1,1,1],[-1,-1,1],[-1,1,-1],[1,-1,-1]],[[2,1,0],[0,3,2],[1,3,0],[2,3,1]],a,b)};
|
|
|
THREE.TetrahedronGeometry.prototype=new THREE.Geometry;THREE.TetrahedronGeometry.prototype.constructor=THREE.TetrahedronGeometry;
|
|
|
-THREE.AxisHelper=function(){THREE.Object3D.call(this);var a=new THREE.Geometry;a.vertices.push(new THREE.Vertex);a.vertices.push(new THREE.Vertex(new THREE.Vector3(0,100,0)));var b=new THREE.CylinderGeometry(0,5,25,5,1),c;c=new THREE.Line(a,new THREE.LineBasicMaterial({color:16711680}));c.rotation.z=-Math.PI/2;this.add(c);c=new THREE.Mesh(b,new THREE.MeshBasicMaterial({color:16711680}));c.position.x=100;c.rotation.z=-Math.PI/2;this.add(c);c=new THREE.Line(a,new THREE.LineBasicMaterial({color:65280}));
|
|
|
-this.add(c);c=new THREE.Mesh(b,new THREE.MeshBasicMaterial({color:65280}));c.position.y=100;this.add(c);c=new THREE.Line(a,new THREE.LineBasicMaterial({color:255}));c.rotation.x=Math.PI/2;this.add(c);c=new THREE.Mesh(b,new THREE.MeshBasicMaterial({color:255}));c.position.z=100;c.rotation.x=Math.PI/2;this.add(c)};THREE.AxisHelper.prototype=new THREE.Object3D;THREE.AxisHelper.prototype.constructor=THREE.AxisHelper;
|
|
|
-THREE.ArrowHelper=function(a,b,c,d){THREE.Object3D.call(this);d===void 0&&(d=16776960);c===void 0&&(c=20);var e=new THREE.Geometry;e.vertices.push(new THREE.Vertex(new THREE.Vector3(0,0,0)));e.vertices.push(new THREE.Vertex(new THREE.Vector3(0,1,0)));this.line=new THREE.Line(e,new THREE.LineBasicMaterial({color:d}));this.add(this.line);e=new THREE.CylinderGeometry(0,0.05,0.25,5,1);this.cone=new THREE.Mesh(e,new THREE.MeshBasicMaterial({color:d}));this.cone.position.set(0,1,0);this.add(this.cone);
|
|
|
-if(b instanceof THREE.Vector3)this.position=b;this.setDirection(a);this.setLength(c)};THREE.ArrowHelper.prototype=new THREE.Object3D;THREE.ArrowHelper.prototype.constructor=THREE.ArrowHelper;THREE.ArrowHelper.prototype.setDirection=function(a){var b=(new THREE.Vector3(0,1,0)).crossSelf(a),a=Math.acos((new THREE.Vector3(0,1,0)).dot(a.clone().normalize()));this.matrix=(new THREE.Matrix4).makeRotationAxis(b.normalize(),a);this.rotation.getRotationFromMatrix(this.matrix,this.scale)};
|
|
|
+THREE.AxisHelper=function(){THREE.Object3D.call(this);var a=new THREE.Geometry;a.vertices.push(new THREE.Vertex);a.vertices.push(new THREE.Vertex(0,100,0));var b=new THREE.CylinderGeometry(0,5,25,5,1),c;c=new THREE.Line(a,new THREE.LineBasicMaterial({color:16711680}));c.rotation.z=-Math.PI/2;this.add(c);c=new THREE.Mesh(b,new THREE.MeshBasicMaterial({color:16711680}));c.position.x=100;c.rotation.z=-Math.PI/2;this.add(c);c=new THREE.Line(a,new THREE.LineBasicMaterial({color:65280}));this.add(c);c=
|
|
|
+new THREE.Mesh(b,new THREE.MeshBasicMaterial({color:65280}));c.position.y=100;this.add(c);c=new THREE.Line(a,new THREE.LineBasicMaterial({color:255}));c.rotation.x=Math.PI/2;this.add(c);c=new THREE.Mesh(b,new THREE.MeshBasicMaterial({color:255}));c.position.z=100;c.rotation.x=Math.PI/2;this.add(c)};THREE.AxisHelper.prototype=new THREE.Object3D;THREE.AxisHelper.prototype.constructor=THREE.AxisHelper;
|
|
|
+THREE.ArrowHelper=function(a,b,c,d){THREE.Object3D.call(this);d===void 0&&(d=16776960);c===void 0&&(c=20);var e=new THREE.Geometry;e.vertices.push(new THREE.Vertex(0,0,0));e.vertices.push(new THREE.Vertex(0,1,0));this.line=new THREE.Line(e,new THREE.LineBasicMaterial({color:d}));this.add(this.line);e=new THREE.CylinderGeometry(0,0.05,0.25,5,1);this.cone=new THREE.Mesh(e,new THREE.MeshBasicMaterial({color:d}));this.cone.position.set(0,1,0);this.add(this.cone);if(b instanceof THREE.Vector3)this.position=
|
|
|
+b;this.setDirection(a);this.setLength(c)};THREE.ArrowHelper.prototype=new THREE.Object3D;THREE.ArrowHelper.prototype.constructor=THREE.ArrowHelper;THREE.ArrowHelper.prototype.setDirection=function(a){var b=(new THREE.Vector3(0,1,0)).crossSelf(a),a=Math.acos((new THREE.Vector3(0,1,0)).dot(a.clone().normalize()));this.matrix=(new THREE.Matrix4).makeRotationAxis(b.normalize(),a);this.rotation.getRotationFromMatrix(this.matrix,this.scale)};
|
|
|
THREE.ArrowHelper.prototype.setLength=function(a){this.scale.set(a,a,a)};THREE.ArrowHelper.prototype.setColor=function(a){this.line.material.color.setHex(a);this.cone.material.color.setHex(a)};
|
|
|
-THREE.CameraHelper=function(a){function b(a,b,d){c(a,d);c(b,d)}function c(a,b){d.lineGeometry.vertices.push(new THREE.Vertex(new THREE.Vector3));d.lineGeometry.colors.push(new THREE.Color(b));d.pointMap[a]===void 0&&(d.pointMap[a]=[]);d.pointMap[a].push(d.lineGeometry.vertices.length-1)}THREE.Object3D.call(this);var d=this;this.lineGeometry=new THREE.Geometry;this.lineMaterial=new THREE.LineBasicMaterial({color:16777215,vertexColors:THREE.FaceColors});this.pointMap={};b("n1","n2",16755200);b("n2",
|
|
|
-"n4",16755200);b("n4","n3",16755200);b("n3","n1",16755200);b("f1","f2",16755200);b("f2","f4",16755200);b("f4","f3",16755200);b("f3","f1",16755200);b("n1","f1",16755200);b("n2","f2",16755200);b("n3","f3",16755200);b("n4","f4",16755200);b("p","n1",16711680);b("p","n2",16711680);b("p","n3",16711680);b("p","n4",16711680);b("u1","u2",43775);b("u2","u3",43775);b("u3","u1",43775);b("c","t",16777215);b("p","c",3355443);b("cn1","cn2",3355443);b("cn3","cn4",3355443);b("cf1","cf2",3355443);b("cf3","cf4",3355443);
|
|
|
-this.camera=a;this.update(a);this.lines=new THREE.Line(this.lineGeometry,this.lineMaterial,THREE.LinePieces);this.add(this.lines)};THREE.CameraHelper.prototype=new THREE.Object3D;THREE.CameraHelper.prototype.constructor=THREE.CameraHelper;
|
|
|
-THREE.CameraHelper.prototype.update=function(){function a(a,d,e,f){THREE.CameraHelper.__v.set(d,e,f);THREE.CameraHelper.__projector.unprojectVector(THREE.CameraHelper.__v,THREE.CameraHelper.__c);a=b.pointMap[a];if(a!==void 0){d=0;for(e=a.length;d<e;d++)b.lineGeometry.vertices[a[d]].position.copy(THREE.CameraHelper.__v)}}var b=this;THREE.CameraHelper.__c.projectionMatrix.copy(this.camera.projectionMatrix);a("c",0,0,-1);a("t",0,0,1);a("n1",-1,-1,-1);a("n2",1,-1,-1);a("n3",-1,1,-1);a("n4",1,1,-1);a("f1",
|
|
|
--1,-1,1);a("f2",1,-1,1);a("f3",-1,1,1);a("f4",1,1,1);a("u1",0.7,1.1,-1);a("u2",-0.7,1.1,-1);a("u3",0,2,-1);a("cf1",-1,0,1);a("cf2",1,0,1);a("cf3",0,-1,1);a("cf4",0,1,1);a("cn1",-1,0,-1);a("cn2",1,0,-1);a("cn3",0,-1,-1);a("cn4",0,1,-1);this.lineGeometry.__dirtyVertices=true};THREE.CameraHelper.__projector=new THREE.Projector;THREE.CameraHelper.__v=new THREE.Vector3;THREE.CameraHelper.__c=new THREE.Camera;
|
|
|
+THREE.CameraHelper=function(a){function b(a,b,d){c(a,d);c(b,d)}function c(a,b){d.lineGeometry.vertices.push(new THREE.Vertex);d.lineGeometry.colors.push(new THREE.Color(b));d.pointMap[a]===void 0&&(d.pointMap[a]=[]);d.pointMap[a].push(d.lineGeometry.vertices.length-1)}THREE.Object3D.call(this);var d=this;this.lineGeometry=new THREE.Geometry;this.lineMaterial=new THREE.LineBasicMaterial({color:16777215,vertexColors:THREE.FaceColors});this.pointMap={};b("n1","n2",16755200);b("n2","n4",16755200);b("n4",
|
|
|
+"n3",16755200);b("n3","n1",16755200);b("f1","f2",16755200);b("f2","f4",16755200);b("f4","f3",16755200);b("f3","f1",16755200);b("n1","f1",16755200);b("n2","f2",16755200);b("n3","f3",16755200);b("n4","f4",16755200);b("p","n1",16711680);b("p","n2",16711680);b("p","n3",16711680);b("p","n4",16711680);b("u1","u2",43775);b("u2","u3",43775);b("u3","u1",43775);b("c","t",16777215);b("p","c",3355443);b("cn1","cn2",3355443);b("cn3","cn4",3355443);b("cf1","cf2",3355443);b("cf3","cf4",3355443);this.camera=a;this.update(a);
|
|
|
+this.lines=new THREE.Line(this.lineGeometry,this.lineMaterial,THREE.LinePieces);this.add(this.lines)};THREE.CameraHelper.prototype=new THREE.Object3D;THREE.CameraHelper.prototype.constructor=THREE.CameraHelper;
|
|
|
+THREE.CameraHelper.prototype.update=function(){function a(a,d,e,f){THREE.CameraHelper.__v.set(d,e,f);THREE.CameraHelper.__projector.unprojectVector(THREE.CameraHelper.__v,THREE.CameraHelper.__c);a=b.pointMap[a];if(a!==void 0){d=0;for(e=a.length;d<e;d++)b.lineGeometry.vertices[a[d]].copy(THREE.CameraHelper.__v)}}var b=this;THREE.CameraHelper.__c.projectionMatrix.copy(this.camera.projectionMatrix);a("c",0,0,-1);a("t",0,0,1);a("n1",-1,-1,-1);a("n2",1,-1,-1);a("n3",-1,1,-1);a("n4",1,1,-1);a("f1",-1,-1,
|
|
|
+1);a("f2",1,-1,1);a("f3",-1,1,1);a("f4",1,1,1);a("u1",0.7,1.1,-1);a("u2",-0.7,1.1,-1);a("u3",0,2,-1);a("cf1",-1,0,1);a("cf2",1,0,1);a("cf3",0,-1,1);a("cf4",0,1,1);a("cn1",-1,0,-1);a("cn2",1,0,-1);a("cn3",0,-1,-1);a("cn4",0,1,-1);this.lineGeometry.__dirtyVertices=true};THREE.CameraHelper.__projector=new THREE.Projector;THREE.CameraHelper.__v=new THREE.Vector3;THREE.CameraHelper.__c=new THREE.Camera;
|
|
|
THREE.SubdivisionModifier=function(a){this.subdivisions=a===void 0?1:a;this.useOldVertexColors=false;this.supportUVs=true;this.debug=false};THREE.SubdivisionModifier.prototype.constructor=THREE.SubdivisionModifier;THREE.SubdivisionModifier.prototype.modify=function(a){for(var b=this.subdivisions;b-- >0;)this.smooth(a)};
|
|
|
THREE.SubdivisionModifier.prototype.smooth=function(a){function b(){m.debug&&console.log.apply(console,arguments)}function c(){console&&console.log.apply(console,arguments)}function d(a,c,d,e,g,h,i){var j=new THREE.Face4(a,c,d,e,null,g.color,g.material);if(m.useOldVertexColors){j.vertexColors=[];for(var k,n,o,r=0;r<4;r++){o=h[r];k=new THREE.Color;k.setRGB(0,0,0);for(var q=0;q<o.length;q++){n=g.vertexColors[o[q]-1];k.r=k.r+n.r;k.g=k.g+n.g;k.b=k.b+n.b}k.r=k.r/o.length;k.g=k.g/o.length;k.b=k.b/o.length;
|
|
|
j.vertexColors[r]=k}}l.push(j);if(m.supportUVs){g=[f(a,""),f(c,i),f(d,i),f(e,i)];g[0]?g[1]?g[2]?g[3]?p.push(g):b("d :( ",e+":"+i):b("c :( ",d+":"+i):b("b :( ",c+":"+i):b("a :( ",a+":"+i)}}function e(a,b){return Math.min(a,b)+"_"+Math.max(a,b)}function f(a,d){var e=a+":"+d,f=t[e];if(!f){a>=y&&a<y+r.length?b("face pt"):b("edge pt");c("warning, UV not found for",e);return null}return f}function g(a,b,d){var e=a+":"+b;e in t?c("dup vertexNo",a,"oldFaceNo",b,"value",d,"key",e,t[e]):t[e]=d}function h(a,
|
|
|
b){T[a]===void 0&&(T[a]=[]);T[a].push(b)}function j(a,b,c){P[a]===void 0&&(P[a]={});P[a][b]=c}var k=[],l=[],p=[],m=this,o=a.vertices,r=a.faces,k=o.concat(),n=[],q={},u={},t={},y=o.length,s,x,D,B,w,v=a.faceVertexUvs[0],C;b("originalFaces, uvs, originalVerticesLength",r.length,v.length,y);if(m.supportUVs){s=0;for(x=v.length;s<x;s++){D=0;for(B=v[s].length;D<B;D++){C=r[s]["abcd".charAt(D)];g(C,s,v[s][D])}}}if(v.length==0)m.supportUVs=false;s=0;for(w in t)s++;if(!s){m.supportUVs=false;b("no uvs")}b("-- Original Faces + Vertices UVs completed",
|
|
|
-t,"vs",v.length);s=0;for(x=r.length;s<x;s++){w=r[s];n.push(w.centroid);k.push(new THREE.Vertex(w.centroid));if(m.supportUVs){v=new THREE.UV;if(w instanceof THREE.Face3){v.u=f(w.a,s).u+f(w.b,s).u+f(w.c,s).u;v.v=f(w.a,s).v+f(w.b,s).v+f(w.c,s).v;v.u=v.u/3;v.v=v.v/3}else if(w instanceof THREE.Face4){v.u=f(w.a,s).u+f(w.b,s).u+f(w.c,s).u+f(w.d,s).u;v.v=f(w.a,s).v+f(w.b,s).v+f(w.c,s).v+f(w.d,s).v;v.u=v.u/4;v.v=v.v/4}g(y+s,"",v)}}b("-- added UVs for new Faces",t);x=function(a){function b(a,c){h[a]===void 0&&
|
|
|
-(h[a]=[]);h[a].push(c)}var c,d,f,g,h={};c=0;for(d=a.faces.length;c<d;c++){f=a.faces[c];if(f instanceof THREE.Face3){g=e(f.a,f.b);b(g,c);g=e(f.b,f.c);b(g,c);g=e(f.c,f.a);b(g,c)}else if(f instanceof THREE.Face4){g=e(f.a,f.b);b(g,c);g=e(f.b,f.c);b(g,c);g=e(f.c,f.d);b(g,c);g=e(f.d,f.a);b(g,c)}}return h}(a);C=0;var K,L,T={},P={};for(s in x){v=x[s];K=s.split("_");L=K[0];K=K[1];h(L,[L,K]);h(K,[L,K]);D=0;for(B=v.length;D<B;D++){w=v[D];j(L,w,s);j(K,w,s)}v.length<2&&(u[s]=true)}b("vertexEdgeMap",T,"vertexFaceMap",
|
|
|
-P);for(s in x){v=x[s];w=v[0];B=v[1];K=s.split("_");L=K[0];K=K[1];v=new THREE.Vector3;if(u[s]){v.addSelf(o[L].position);v.addSelf(o[K].position);v.multiplyScalar(0.5)}else{v.addSelf(n[w]);v.addSelf(n[B]);v.addSelf(o[L].position);v.addSelf(o[K].position);v.multiplyScalar(0.25)}q[s]=y+r.length+C;k.push(new THREE.Vertex(v));C++;if(m.supportUVs){v=new THREE.UV;v.u=f(L,w).u+f(K,w).u;v.v=f(L,w).v+f(K,w).v;v.u=v.u/2;v.v=v.v/2;g(q[s],w,v);if(!u[s]){v=new THREE.UV;v.u=f(L,B).u+f(K,B).u;v.v=f(L,B).v+f(K,B).v;
|
|
|
-v.u=v.u/2;v.v=v.v/2;g(q[s],B,v)}}}b("-- Step 2 done");var J,N;B=["123","12","2","23"];K=["123","23","3","31"];var F=["123","31","1","12"],i=["1234","12","2","23"],U=["1234","23","3","34"],E=["1234","34","4","41"],H=["1234","41","1","12"];s=0;for(x=n.length;s<x;s++){w=r[s];v=y+s;if(w instanceof THREE.Face3){C=e(w.a,w.b);L=e(w.b,w.c);J=e(w.c,w.a);d(v,q[C],w.b,q[L],w,B,s);d(v,q[L],w.c,q[J],w,K,s);d(v,q[J],w.a,q[C],w,F,s)}else if(w instanceof THREE.Face4){C=e(w.a,w.b);L=e(w.b,w.c);J=e(w.c,w.d);N=e(w.d,
|
|
|
-w.a);d(v,q[C],w.b,q[L],w,i,s);d(v,q[L],w.c,q[J],w,U,s);d(v,q[J],w.d,q[N],w,E,s);d(v,q[N],w.a,q[C],w,H,s)}else b("face should be a face!",w)}q=new THREE.Vector3;w=new THREE.Vector3;s=0;for(x=o.length;s<x;s++)if(T[s]!==void 0){q.set(0,0,0);w.set(0,0,0);L=new THREE.Vector3(0,0,0);v=0;for(D in P[s]){q.addSelf(n[D]);v++}B=0;C=T[s].length;for(D=0;D<C;D++)u[e(T[s][D][0],T[s][D][1])]&&B++;if(B!=2){q.divideScalar(v);for(D=0;D<C;D++){v=T[s][D];v=o[v[0]].position.clone().addSelf(o[v[1]].position).divideScalar(2);
|
|
|
-w.addSelf(v)}w.divideScalar(C);L.addSelf(o[s].position);L.multiplyScalar(C-3);L.addSelf(q);L.addSelf(w.multiplyScalar(2));L.divideScalar(C);k[s].position=L}}a.vertices=k;a.faces=l;a.faceVertexUvs[0]=p;delete a.__tmpVertices;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals()};THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
|
|
|
+t,"vs",v.length);s=0;for(x=r.length;s<x;s++){w=r[s];n.push(w.centroid);k.push((new THREE.Vertex).copy(w.centroid));if(m.supportUVs){v=new THREE.UV;if(w instanceof THREE.Face3){v.u=f(w.a,s).u+f(w.b,s).u+f(w.c,s).u;v.v=f(w.a,s).v+f(w.b,s).v+f(w.c,s).v;v.u=v.u/3;v.v=v.v/3}else if(w instanceof THREE.Face4){v.u=f(w.a,s).u+f(w.b,s).u+f(w.c,s).u+f(w.d,s).u;v.v=f(w.a,s).v+f(w.b,s).v+f(w.c,s).v+f(w.d,s).v;v.u=v.u/4;v.v=v.v/4}g(y+s,"",v)}}b("-- added UVs for new Faces",t);x=function(a){function b(a,c){h[a]===
|
|
|
+void 0&&(h[a]=[]);h[a].push(c)}var c,d,f,g,h={};c=0;for(d=a.faces.length;c<d;c++){f=a.faces[c];if(f instanceof THREE.Face3){g=e(f.a,f.b);b(g,c);g=e(f.b,f.c);b(g,c);g=e(f.c,f.a);b(g,c)}else if(f instanceof THREE.Face4){g=e(f.a,f.b);b(g,c);g=e(f.b,f.c);b(g,c);g=e(f.c,f.d);b(g,c);g=e(f.d,f.a);b(g,c)}}return h}(a);C=0;var K,L,T={},P={};for(s in x){v=x[s];K=s.split("_");L=K[0];K=K[1];h(L,[L,K]);h(K,[L,K]);D=0;for(B=v.length;D<B;D++){w=v[D];j(L,w,s);j(K,w,s)}v.length<2&&(u[s]=true)}b("vertexEdgeMap",T,
|
|
|
+"vertexFaceMap",P);for(s in x){v=x[s];w=v[0];B=v[1];K=s.split("_");L=K[0];K=K[1];v=new THREE.Vector3;if(u[s]){v.addSelf(o[L]);v.addSelf(o[K]);v.multiplyScalar(0.5)}else{v.addSelf(n[w]);v.addSelf(n[B]);v.addSelf(o[L]);v.addSelf(o[K]);v.multiplyScalar(0.25)}q[s]=y+r.length+C;k.push((new THREE.Vertex).copy(v));C++;if(m.supportUVs){v=new THREE.UV;v.u=f(L,w).u+f(K,w).u;v.v=f(L,w).v+f(K,w).v;v.u=v.u/2;v.v=v.v/2;g(q[s],w,v);if(!u[s]){v=new THREE.UV;v.u=f(L,B).u+f(K,B).u;v.v=f(L,B).v+f(K,B).v;v.u=v.u/2;v.v=
|
|
|
+v.v/2;g(q[s],B,v)}}}b("-- Step 2 done");var J,N;B=["123","12","2","23"];K=["123","23","3","31"];var F=["123","31","1","12"],i=["1234","12","2","23"],U=["1234","23","3","34"],E=["1234","34","4","41"],H=["1234","41","1","12"];s=0;for(x=n.length;s<x;s++){w=r[s];v=y+s;if(w instanceof THREE.Face3){C=e(w.a,w.b);L=e(w.b,w.c);J=e(w.c,w.a);d(v,q[C],w.b,q[L],w,B,s);d(v,q[L],w.c,q[J],w,K,s);d(v,q[J],w.a,q[C],w,F,s)}else if(w instanceof THREE.Face4){C=e(w.a,w.b);L=e(w.b,w.c);J=e(w.c,w.d);N=e(w.d,w.a);d(v,q[C],
|
|
|
+w.b,q[L],w,i,s);d(v,q[L],w.c,q[J],w,U,s);d(v,q[J],w.d,q[N],w,E,s);d(v,q[N],w.a,q[C],w,H,s)}else b("face should be a face!",w)}q=new THREE.Vector3;w=new THREE.Vector3;s=0;for(x=o.length;s<x;s++)if(T[s]!==void 0){q.set(0,0,0);w.set(0,0,0);L=new THREE.Vector3(0,0,0);v=0;for(D in P[s]){q.addSelf(n[D]);v++}B=0;C=T[s].length;for(D=0;D<C;D++)u[e(T[s][D][0],T[s][D][1])]&&B++;if(B!=2){q.divideScalar(v);for(D=0;D<C;D++){v=T[s][D];v=o[v[0]].clone().addSelf(o[v[1]]).divideScalar(2);w.addSelf(v)}w.divideScalar(C);
|
|
|
+L.addSelf(o[s]);L.multiplyScalar(C-3);L.addSelf(q);L.addSelf(w.multiplyScalar(2));L.divideScalar(C);k[s]=L}}a.vertices=k;a.faces=l;a.faceVertexUvs[0]=p;delete a.__tmpVertices;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals()};THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
|
|
|
THREE.Loader.prototype={constructor:THREE.Loader,crossOrigin:"anonymous",addStatusElement:function(){var a=document.createElement("div");a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="rgba(0,0,0,0.25)";a.style.color="#fff";a.style.width="120px";a.style.padding="0.5em 0.5em 0.5em 0.5em";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var b="Loaded ",b=a.total?b+((100*a.loaded/
|
|
|
a.total).toFixed(0)+"%"):b+((a.loaded/1E3).toFixed(2)+" KB");this.statusDomElement.innerHTML=b},extractUrlBase:function(a){a=a.split("/");a.pop();return(a.length<1?".":a.join("/"))+"/"},initMaterials:function(a,b,c){a.materials=[];for(var d=0;d<b.length;++d)a.materials[d]=THREE.Loader.prototype.createMaterial(b[d],c)},hasNormals:function(a){var b,c,d=a.materials.length;for(c=0;c<d;c++){b=a.materials[c];if(b instanceof THREE.ShaderMaterial)return true}return false},createMaterial:function(a,b){function c(a){a=
|
|
|
Math.log(a)/Math.LN2;return Math.floor(a)==a}function d(a){a=Math.log(a)/Math.LN2;return Math.pow(2,Math.round(a))}function e(a,b){var e=new Image;e.onload=function(){if(!c(this.width)||!c(this.height)){var b=d(this.width),e=d(this.height);a.image.width=b;a.image.height=e;a.image.getContext("2d").drawImage(this,0,0,b,e)}else a.image=this;a.needsUpdate=true};e.crossOrigin=h.crossOrigin;e.src=b}function f(a,c,d,f,g,h){var j=document.createElement("canvas");a[c]=new THREE.Texture(j);a[c].sourceFile=
|
|
@@ -648,9 +646,9 @@ k));g.push(m)}}function v(b,c){var d,e,f,g,h,i,j,k,l,m,n=new Uint32Array(a,c,4*b
|
|
|
P.faces.push(new THREE.Face3(e,f,g,null,null,h))}}function K(b,c,d){for(var e,f,g,h,i,c=new Uint32Array(a,c,4*b),j=new Uint16Array(a,d,b),d=0;d<b;d++){e=c[d*4];f=c[d*4+1];g=c[d*4+2];h=c[d*4+3];i=j[d];P.faces.push(new THREE.Face4(e,f,g,h,null,null,i))}}function L(b,c,d,e){for(var f,g,h,i,j,k,l,c=new Uint32Array(a,c,3*b),d=new Uint32Array(a,d,3*b),m=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[e*3];g=c[e*3+1];h=c[e*3+2];j=d[e*3];k=d[e*3+1];l=d[e*3+2];i=m[e];var n=N[k*3],o=N[k*3+1];k=N[k*3+2];var p=N[l*3],
|
|
|
r=N[l*3+1];l=N[l*3+2];P.faces.push(new THREE.Face3(f,g,h,[new THREE.Vector3(N[j*3],N[j*3+1],N[j*3+2]),new THREE.Vector3(n,o,k),new THREE.Vector3(p,r,l)],null,i))}}function T(b,c,d,e){for(var f,g,h,i,j,k,l,m,n,c=new Uint32Array(a,c,4*b),d=new Uint32Array(a,d,4*b),o=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[e*4];g=c[e*4+1];h=c[e*4+2];i=c[e*4+3];k=d[e*4];l=d[e*4+1];m=d[e*4+2];n=d[e*4+3];j=o[e];var p=N[l*3],r=N[l*3+1];l=N[l*3+2];var q=N[m*3],s=N[m*3+1];m=N[m*3+2];var t=N[n*3],u=N[n*3+1];n=N[n*3+2];P.faces.push(new THREE.Face4(f,
|
|
|
g,h,i,[new THREE.Vector3(N[k*3],N[k*3+1],N[k*3+2]),new THREE.Vector3(p,r,l),new THREE.Vector3(q,s,m),new THREE.Vector3(t,u,n)],null,j))}}var P=this,J=0,N=[],F=[],i,U,E;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(P,d,b);(function(a,b,c){for(var a=new Uint8Array(a,b,c),d="",e=0;e<c;e++)d=d+String.fromCharCode(a[b+e]);return d})(a,J,12);c=D(a,J+12);D(a,J+13);D(a,J+14);D(a,J+15);e=D(a,J+16);j=D(a,J+17);k=D(a,J+18);l=D(a,J+19);p=B(a,J+20);m=B(a,J+20+4);o=B(a,J+20+8);b=B(a,J+20+12);r=
|
|
|
-B(a,J+20+16);n=B(a,J+20+20);q=B(a,J+20+24);u=B(a,J+20+28);t=B(a,J+20+32);y=B(a,J+20+36);s=B(a,J+20+40);J=J+c;c=e*3+l;E=e*4+l;i=b*c;U=r*(c+j*3);e=n*(c+k*3);l=q*(c+j*3+k*3);c=u*E;j=t*(E+j*4);k=y*(E+k*4);J=J+function(b){var b=new Float32Array(a,b,p*3),c,d,e,f;for(c=0;c<p;c++){d=b[c*3];e=b[c*3+1];f=b[c*3+2];P.vertices.push(new THREE.Vertex(new THREE.Vector3(d,e,f)))}return p*3*Float32Array.BYTES_PER_ELEMENT}(J);J=J+function(b){if(m){var b=new Int8Array(a,b,m*3),c,d,e,f;for(c=0;c<m;c++){d=b[c*3];e=b[c*
|
|
|
-3+1];f=b[c*3+2];N.push(d/127,e/127,f/127)}}return m*3*Int8Array.BYTES_PER_ELEMENT}(J);J=J+x(m*3);J=J+function(b){if(o){var b=new Float32Array(a,b,o*2),c,d,e;for(c=0;c<o;c++){d=b[c*2];e=b[c*2+1];F.push(d,e)}}return o*2*Float32Array.BYTES_PER_ELEMENT}(J);i=J+i+x(b*2);U=i+U+x(r*2);e=U+e+x(n*2);l=e+l+x(q*2);c=l+c+x(u*2);j=c+j+x(t*2);k=j+k+x(y*2);(function(a){if(n){var b=a+n*Uint32Array.BYTES_PER_ELEMENT*3;C(n,a,b+n*Uint32Array.BYTES_PER_ELEMENT*3);w(n,b)}})(U);(function(a){if(q){var b=a+q*Uint32Array.BYTES_PER_ELEMENT*
|
|
|
-3,c=b+q*Uint32Array.BYTES_PER_ELEMENT*3;L(q,a,b,c+q*Uint32Array.BYTES_PER_ELEMENT*3);w(q,c)}})(e);(function(a){if(y){var b=a+y*Uint32Array.BYTES_PER_ELEMENT*4;K(y,a,b+y*Uint32Array.BYTES_PER_ELEMENT*4);v(y,b)}})(j);(function(a){if(s){var b=a+s*Uint32Array.BYTES_PER_ELEMENT*4,c=b+s*Uint32Array.BYTES_PER_ELEMENT*4;T(s,a,b,c+s*Uint32Array.BYTES_PER_ELEMENT*4);v(s,c)}})(k);b&&C(b,J,J+b*Uint32Array.BYTES_PER_ELEMENT*3);(function(a){if(r){var b=a+r*Uint32Array.BYTES_PER_ELEMENT*3;L(r,a,b,b+r*Uint32Array.BYTES_PER_ELEMENT*
|
|
|
+B(a,J+20+16);n=B(a,J+20+20);q=B(a,J+20+24);u=B(a,J+20+28);t=B(a,J+20+32);y=B(a,J+20+36);s=B(a,J+20+40);J=J+c;c=e*3+l;E=e*4+l;i=b*c;U=r*(c+j*3);e=n*(c+k*3);l=q*(c+j*3+k*3);c=u*E;j=t*(E+j*4);k=y*(E+k*4);J=J+function(b){var b=new Float32Array(a,b,p*3),c,d,e,f;for(c=0;c<p;c++){d=b[c*3];e=b[c*3+1];f=b[c*3+2];P.vertices.push(new THREE.Vertex(d,e,f))}return p*3*Float32Array.BYTES_PER_ELEMENT}(J);J=J+function(b){if(m){var b=new Int8Array(a,b,m*3),c,d,e,f;for(c=0;c<m;c++){d=b[c*3];e=b[c*3+1];f=b[c*3+2];N.push(d/
|
|
|
+127,e/127,f/127)}}return m*3*Int8Array.BYTES_PER_ELEMENT}(J);J=J+x(m*3);J=J+function(b){if(o){var b=new Float32Array(a,b,o*2),c,d,e;for(c=0;c<o;c++){d=b[c*2];e=b[c*2+1];F.push(d,e)}}return o*2*Float32Array.BYTES_PER_ELEMENT}(J);i=J+i+x(b*2);U=i+U+x(r*2);e=U+e+x(n*2);l=e+l+x(q*2);c=l+c+x(u*2);j=c+j+x(t*2);k=j+k+x(y*2);(function(a){if(n){var b=a+n*Uint32Array.BYTES_PER_ELEMENT*3;C(n,a,b+n*Uint32Array.BYTES_PER_ELEMENT*3);w(n,b)}})(U);(function(a){if(q){var b=a+q*Uint32Array.BYTES_PER_ELEMENT*3,c=b+
|
|
|
+q*Uint32Array.BYTES_PER_ELEMENT*3;L(q,a,b,c+q*Uint32Array.BYTES_PER_ELEMENT*3);w(q,c)}})(e);(function(a){if(y){var b=a+y*Uint32Array.BYTES_PER_ELEMENT*4;K(y,a,b+y*Uint32Array.BYTES_PER_ELEMENT*4);v(y,b)}})(j);(function(a){if(s){var b=a+s*Uint32Array.BYTES_PER_ELEMENT*4,c=b+s*Uint32Array.BYTES_PER_ELEMENT*4;T(s,a,b,c+s*Uint32Array.BYTES_PER_ELEMENT*4);v(s,c)}})(k);b&&C(b,J,J+b*Uint32Array.BYTES_PER_ELEMENT*3);(function(a){if(r){var b=a+r*Uint32Array.BYTES_PER_ELEMENT*3;L(r,a,b,b+r*Uint32Array.BYTES_PER_ELEMENT*
|
|
|
3)}})(i);u&&K(u,l,l+u*Uint32Array.BYTES_PER_ELEMENT*4);(function(a){if(t){var b=a+t*Uint32Array.BYTES_PER_ELEMENT*4;T(t,a,b,b+t*Uint32Array.BYTES_PER_ELEMENT*4)}})(c);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};e.prototype=new THREE.Geometry;e.prototype.constructor=e;b(new e(c))};
|
|
|
THREE.ColladaLoader=function(){function a(a,d,e){ea=a;d=d||sa;if(e!==void 0){a=e.split("/");a.pop();ta=(a.length<1?".":a.join("/"))+"/"}if((a=ea.evaluate("//dae:asset",ea,W,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&a.childNodes)for(e=0;e<a.childNodes.length;e++){var i=a.childNodes[e];switch(i.nodeName){case "unit":(i=i.getAttribute("meter"))&&parseFloat(i);break;case "up_axis":Xa=i.textContent.charAt(0)}}if(!Ia.convertUpAxis||Xa===Ia.upAxis)ja=null;else switch(Xa){case "X":ja=Ia.upAxis===
|
|
|
"Y"?"XtoY":"XtoZ";break;case "Y":ja=Ia.upAxis==="X"?"YtoX":"YtoZ";break;case "Z":ja=Ia.upAxis==="X"?"ZtoX":"ZtoY"}Ha=b("//dae:library_images/dae:image",g,"image");Ka=b("//dae:library_materials/dae:material",v,"material");db=b("//dae:library_effects/dae:effect",P,"effect");Ya=b("//dae:library_geometries/dae:geometry",q,"geometry");hb=b(".//dae:library_cameras/dae:camera",E,"camera");Wa=b("//dae:library_controllers/dae:controller",h,"controller");xa=b("//dae:library_animations/dae:animation",N,"animation");
|
|
@@ -658,80 +656,79 @@ Pa=b(".//dae:library_visual_scenes/dae:visual_scene",l,"visual_scene");ua=[];ab=
|
|
|
animations:xa,visualScenes:Pa,scene:wa}};d&&d(a);return a}function b(a,b,c){for(var a=ea.evaluate(a,ea,W,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null),d={},e=a.iterateNext(),f=0;e;){e=(new b).parse(e);if(!e.id||e.id.length==0)e.id=c+f++;d[e.id]=e;e=a.iterateNext()}return d}function c(a){var b=wa.getChildById(a.name,true),d=null;if(b&&b.keys){d={fps:60,hierarchy:[{node:b,keys:b.keys,sids:b.sids}],node:a,name:"animation_"+a.name,length:0};mb.push(d);for(var e=0,f=b.keys.length;e<f;e++)d.length=Math.max(d.length,
|
|
|
b.keys[e].time)}else d={hierarchy:[{keys:[],sids:[]}]};e=0;for(f=a.children.length;e<f;e++)for(var b=0,g=c(a.children[e]).hierarchy.length;b<g;b++)d.hierarchy.push({keys:[],sids:[]});return d}function d(a,b,c,e){a.world=a.world||new THREE.Matrix4;a.world.copy(a.matrix);if(a.channels&&a.channels.length){var f=a.channels[0].sampler.output[c];f instanceof THREE.Matrix4&&a.world.copy(f)}e&&a.world.multiply(e,a.world);b.push(a);for(e=0;e<a.nodes.length;e++)d(a.nodes[e],b,c,a.world)}function e(a,b,c){var e,
|
|
|
f=Wa[b.url];if(!f||!f.skin)console.log("ColladaLoader: Could not find skin controller.");else if(!b.skeleton||!b.skeleton.length)console.log("ColladaLoader: Could not find the skeleton for the skin. ");else{var c=1E6,g=-c,h=0;for(e in xa)for(var i=xa[e],j=0;j<i.sampler.length;j++){var k=i.sampler[j];k.create();c=Math.min(c,k.startTime);g=Math.max(g,k.endTime);h=Math.max(h,k.input.length)}e=h;for(var b=wa.getChildById(b.skeleton[0],true)||wa.getChildBySid(b.skeleton[0],true),l,m,g=new THREE.Vector3,
|
|
|
-n,j=0;j<a.vertices.length;j++)f.skin.bindShapeMatrix.multiplyVector3(a.vertices[j].position);for(c=0;c<e;c++){h=[];i=[];for(j=0;j<a.vertices.length;j++)i.push(new THREE.Vertex(new THREE.Vector3));d(b,h,c);j=h;k=f.skin;for(m=0;m<j.length;m++){l=j[m];n=-1;if(l.type=="JOINT"){for(var o=0;o<k.joints.length;o++)if(l.sid==k.joints[o]){n=o;break}if(n>=0){o=k.invBindMatrices[n];l.invBindMatrix=o;l.skinningMatrix=new THREE.Matrix4;l.skinningMatrix.multiply(l.world,o);l.weights=[];for(o=0;o<k.weights.length;o++)for(var p=
|
|
|
-0;p<k.weights[o].length;p++){var r=k.weights[o][p];r.joint==n&&l.weights.push(r)}}else throw"ColladaLoader: Could not find joint '"+l.sid+"'.";}}for(j=0;j<h.length;j++)if(h[j].type=="JOINT")for(k=0;k<h[j].weights.length;k++){l=h[j].weights[k];m=l.index;l=l.weight;n=a.vertices[m];m=i[m];g.x=n.position.x;g.y=n.position.y;g.z=n.position.z;h[j].skinningMatrix.multiplyVector3(g);m.position.x=m.position.x+g.x*l;m.position.y=m.position.y+g.y*l;m.position.z=m.position.z+g.z*l}a.morphTargets.push({name:"target_"+
|
|
|
-c,vertices:i})}}}function f(a){var b=new THREE.Object3D,c,d,g,h;for(g=0;g<a.controllers.length;g++){var i=Wa[a.controllers[g].url];switch(i.type){case "skin":if(Ya[i.skin.source]){var j=new n;j.url=i.skin.source;j.instance_material=a.controllers[g].instance_material;a.geometries.push(j);c=a.controllers[g]}else if(Wa[i.skin.source]){d=i=Wa[i.skin.source];if(i.morph&&Ya[i.morph.source]){j=new n;j.url=i.morph.source;j.instance_material=a.controllers[g].instance_material;a.geometries.push(j)}}break;case "morph":if(Ya[i.morph.source]){j=
|
|
|
-new n;j.url=i.morph.source;j.instance_material=a.controllers[g].instance_material;a.geometries.push(j);d=a.controllers[g]}console.log("ColladaLoader: Morph-controller partially supported.")}}for(g=0;g<a.geometries.length;g++){var i=a.geometries[g],j=i.instance_material,i=Ya[i.url],k={},l=[],m=0,p;if(i&&i.mesh&&i.mesh.primitives){if(b.name.length==0)b.name=i.id;if(j)for(h=0;h<j.length;h++){p=j[h];var r=Ka[p.target],q=db[r.instance_effect.url].shader;q.material.opacity=!q.material.opacity?1:q.material.opacity;
|
|
|
-k[p.symbol]=m;l.push(q.material);p=q.material;p.name=r.name==null||r.name===""?r.id:r.name;m++}j=p||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});i=i.mesh.geometry3js;if(m>1){j=new THREE.MeshFaceMaterial;i.materials=l;for(h=0;h<i.faces.length;h++){l=i.faces[h];l.materialIndex=k[l.daeMaterial]}}if(c!==void 0){e(i,c);j.morphTargets=true;j=new THREE.SkinnedMesh(i,j);j.skeleton=c.skeleton;j.skinController=Wa[c.url];j.skinInstanceController=c;j.name="skin_"+ab.length;ab.push(j)}else if(d!==
|
|
|
-void 0){h=i;k=d instanceof o?Wa[d.url]:d;if(!k||!k.morph)console.log("could not find morph controller!");else{k=k.morph;for(l=0;l<k.targets.length;l++){m=Ya[k.targets[l]];if(m.mesh&&m.mesh.primitives&&m.mesh.primitives.length){m=m.mesh.primitives[0].geometry;m.vertices.length===h.vertices.length&&h.morphTargets.push({name:"target_1",vertices:m.vertices})}}h.morphTargets.push({name:"target_Z",vertices:h.vertices})}j.morphTargets=true;j=new THREE.Mesh(i,j);j.name="morph_"+ua.length;ua.push(j)}else j=
|
|
|
-new THREE.Mesh(i,j);a.geometries.length>1?b.add(j):b=j}}for(g=0;g<a.cameras.length;g++){b=hb[a.cameras[g].url];b=new THREE.PerspectiveCamera(b.fov,b.aspect_ratio,b.znear,b.zfar)}b.name=a.id||"";b.matrix=a.matrix;g=a.matrix.decompose();b.position=g[0];b.quaternion=g[1];b.useQuaternion=true;b.scale=g[2];if(Ia.centerGeometry&&b.geometry){g=THREE.GeometryUtils.center(b.geometry);b.quaternion.multiplyVector3(g.multiplySelf(b.scale));b.position.subSelf(g)}for(g=0;g<a.nodes.length;g++)b.add(f(a.nodes[g],
|
|
|
-a));return b}function g(){this.init_from=this.id=""}function h(){this.type=this.name=this.id="";this.morph=this.skin=null}function j(){this.weights=this.targets=this.source=this.method=null}function k(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function l(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function p(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=[];this.transforms=[];this.geometries=[];this.channels=
|
|
|
-[];this.matrix=new THREE.Matrix4}function m(){this.type=this.sid="";this.data=[];this.obj=null}function o(){this.url="";this.skeleton=[];this.instance_material=[]}function r(){this.target=this.symbol=""}function n(){this.url="";this.instance_material=[]}function q(){this.id="";this.mesh=null}function u(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function t(){this.material="";this.count=0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function y(){t.call(this);
|
|
|
-this.vcount=[]}function s(){t.call(this);this.vcount=3}function x(){this.source="";this.stride=this.count=0;this.params=[]}function D(){this.input={}}function B(){this.semantic="";this.offset=0;this.source="";this.set=0}function w(a){this.id=a;this.type=null}function v(){this.name=this.id="";this.instance_effect=null}function C(){this.color=new THREE.Color(0);this.color.setRGB(Math.random(),Math.random(),Math.random());this.color.a=1;this.texOpts=this.texcoord=this.texture=null}function K(a,b){this.type=
|
|
|
-a;this.effect=b;this.material=null}function L(a){this.effect=a;this.format=this.init_from=null}function T(a){this.effect=a;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=this.source=null}function P(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function J(){this.url=""}function N(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function F(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=this.dotSyntax=
|
|
|
-this.sid=this.fullSid=null}function i(a){this.id="";this.animation=a;this.inputs=[];this.endTime=this.startTime=this.interpolation=this.strideOut=this.output=this.input=null;this.duration=0}function U(a){this.targets=[];this.time=a}function E(){this.technique=this.name=this.id=""}function H(){this.url=""}function W(a){return a=="dae"?"http://www.collada.org/2005/11/COLLADASchema":null}function G(a){for(var a=fa(a),b=[],c=0,d=a.length;c<d;c++)b.push(parseFloat(a[c]));return b}function ha(a){for(var a=
|
|
|
-fa(a),b=[],c=0,d=a.length;c<d;c++)b.push(parseInt(a[c],10));return b}function fa(a){return a.length>0?a.replace(/^\s+/,"").replace(/\s+$/,"").split(/\s+/):[]}function la(a,b,c){return a.hasAttribute(b)?parseInt(a.getAttribute(b),10):c}function R(a,b){if(Ia.convertUpAxis&&Xa!==Ia.upAxis)switch(ja){case "XtoY":var c=a[0];a[0]=b*a[1];a[1]=c;break;case "XtoZ":c=a[2];a[2]=a[1];a[1]=a[0];a[0]=c;break;case "YtoX":c=a[0];a[0]=a[1];a[1]=b*c;break;case "YtoZ":c=a[1];a[1]=b*a[2];a[2]=c;break;case "ZtoX":c=a[0];
|
|
|
-a[0]=a[1];a[1]=a[2];a[2]=c;break;case "ZtoY":c=a[1];a[1]=a[2];a[2]=b*c}}function $(a,b){var c=[a[b],a[b+1],a[b+2]];R(c,-1);return new THREE.Vector3(c[0],c[1],c[2])}function ba(a){if(Ia.convertUpAxis){var b=[a[0],a[4],a[8]];R(b,-1);a[0]=b[0];a[4]=b[1];a[8]=b[2];b=[a[1],a[5],a[9]];R(b,-1);a[1]=b[0];a[5]=b[1];a[9]=b[2];b=[a[2],a[6],a[10]];R(b,-1);a[2]=b[0];a[6]=b[1];a[10]=b[2];b=[a[0],a[1],a[2]];R(b,-1);a[0]=b[0];a[1]=b[1];a[2]=b[2];b=[a[4],a[5],a[6]];R(b,-1);a[4]=b[0];a[5]=b[1];a[6]=b[2];b=[a[8],a[9],
|
|
|
-a[10]];R(b,-1);a[8]=b[0];a[9]=b[1];a[10]=b[2];b=[a[3],a[7],a[11]];R(b,-1);a[3]=b[0];a[7]=b[1];a[11]=b[2]}return new THREE.Matrix4(a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8],a[9],a[10],a[11],a[12],a[13],a[14],a[15])}function aa(a){if(Ia.convertUpAxis)switch(a){case "X":switch(ja){case "XtoY":case "XtoZ":case "YtoX":a="Y";break;case "ZtoX":a="Z"}break;case "Y":switch(ja){case "XtoY":case "YtoX":case "ZtoX":a="X";break;case "XtoZ":case "YtoZ":case "ZtoY":a="Z"}break;case "Z":switch(ja){case "XtoZ":a=
|
|
|
-"X";break;case "YtoZ":case "ZtoX":case "ZtoY":a="Y"}}return a}var ea=null,Na=null,wa,sa=null,Oa={},Ha={},xa={},Wa={},Ya={},Ka={},db={},hb={},mb,Pa,ta,ua,ab,pa=THREE.SmoothShading,Ia={centerGeometry:false,convertUpAxis:false,subdivideFaces:true,upAxis:"Y"},Xa="Y",ja=null,Fb=Math.PI/180;g.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="init_from")this.init_from=c.textContent}return this};h.prototype.parse=function(a){this.id=
|
|
|
-a.getAttribute("id");this.name=a.getAttribute("name");this.type="none";for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "skin":this.skin=(new k).parse(c);this.type=c.nodeName;break;case "morph":this.morph=(new j).parse(c);this.type=c.nodeName}}return this};j.prototype.parse=function(a){var b={},c=[],d;this.method=a.getAttribute("method");this.source=a.getAttribute("source").replace(/^#/,"");for(d=0;d<a.childNodes.length;d++){var e=a.childNodes[d];if(e.nodeType==
|
|
|
-1)switch(e.nodeName){case "source":e=(new w).parse(e);b[e.id]=e;break;case "targets":c=this.parseInputs(e);break;default:console.log(e.nodeName)}}for(d=0;d<c.length;d++){a=c[d];e=b[a.source];switch(a.semantic){case "MORPH_TARGET":this.targets=e.read();break;case "MORPH_WEIGHT":this.weights=e.read()}}return this};j.prototype.parseInputs=function(a){for(var b=[],c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "input":b.push((new B).parse(d))}}return b};
|
|
|
-k.prototype.parse=function(a){var b={},c,d;this.source=a.getAttribute("source").replace(/^#/,"");this.invBindMatrices=[];this.joints=[];this.weights=[];for(var e=0;e<a.childNodes.length;e++){var f=a.childNodes[e];if(f.nodeType==1)switch(f.nodeName){case "bind_shape_matrix":f=G(f.textContent);this.bindShapeMatrix=ba(f);break;case "source":f=(new w).parse(f);b[f.id]=f;break;case "joints":c=f;break;case "vertex_weights":d=f;break;default:console.log(f.nodeName)}}this.parseJoints(c,b);this.parseWeights(d,
|
|
|
-b);return this};k.prototype.parseJoints=function(a,b){for(var c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "input":var d=(new B).parse(d),e=b[d.source];if(d.semantic=="JOINT")this.joints=e.read();else if(d.semantic=="INV_BIND_MATRIX")this.invBindMatrices=e.read()}}};k.prototype.parseWeights=function(a,b){for(var c,d,e=[],f=0;f<a.childNodes.length;f++){var g=a.childNodes[f];if(g.nodeType==1)switch(g.nodeName){case "input":e.push((new B).parse(g));break;
|
|
|
-case "v":c=ha(g.textContent);break;case "vcount":d=ha(g.textContent)}}for(f=g=0;f<d.length;f++){for(var h=d[f],i=[],j=0;j<h;j++){for(var k={},l=0;l<e.length;l++){var m=e[l],n=c[g+m.offset];switch(m.semantic){case "JOINT":k.joint=n;break;case "WEIGHT":k.weight=b[m.source].data[n]}}i.push(k);g=g+e.length}for(j=0;j<i.length;j++)i[j].index=f;this.weights.push(i)}};l.prototype.getChildById=function(a,b){for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildById(a,b);if(d)return d}return null};
|
|
|
-l.prototype.getChildBySid=function(a,b){for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildBySid(a,b);if(d)return d}return null};l.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.nodes=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "node":this.nodes.push((new p).parse(c))}}return this};p.prototype.getChannelForTransform=function(a){for(var b=0;b<this.channels.length;b++){var c=this.channels[b],
|
|
|
-d=c.target.split("/");d.shift();var e=d.shift(),f=e.indexOf(".")>=0,g=e.indexOf("(")>=0,h;if(f){d=e.split(".");e=d.shift();d.shift()}else if(g){h=e.split("(");e=h.shift();for(d=0;d<h.length;d++)h[d]=parseInt(h[d].replace(/\)/,""))}if(e==a){c.info={sid:e,dotSyntax:f,arrSyntax:g,arrIndices:h};return c}}return null};p.prototype.getChildById=function(a,b){if(this.id==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildById(a,b);if(d)return d}return null};p.prototype.getChildBySid=
|
|
|
-function(a,b){if(this.sid==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildBySid(a,b);if(d)return d}return null};p.prototype.getTransformBySid=function(a){for(var b=0;b<this.transforms.length;b++)if(this.transforms[b].sid==a)return this.transforms[b];return null};p.prototype.parse=function(a){var b;this.id=a.getAttribute("id");this.sid=a.getAttribute("sid");this.name=a.getAttribute("name");this.type=a.getAttribute("type");this.type=this.type=="JOINT"?this.type:
|
|
|
-"NODE";this.nodes=[];this.transforms=[];this.geometries=[];this.cameras=[];this.controllers=[];this.matrix=new THREE.Matrix4;for(var c=0;c<a.childNodes.length;c++){b=a.childNodes[c];if(b.nodeType==1)switch(b.nodeName){case "node":this.nodes.push((new p).parse(b));break;case "instance_camera":this.cameras.push((new H).parse(b));break;case "instance_controller":this.controllers.push((new o).parse(b));break;case "instance_geometry":this.geometries.push((new n).parse(b));break;case "instance_light":break;
|
|
|
-case "instance_node":b=b.getAttribute("url").replace(/^#/,"");(b=ea.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",ea,W,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new p).parse(b));break;case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new m).parse(b));break;case "extra":break;default:console.log(b.nodeName)}}a=[];c=1E6;b=-1E6;for(var d in xa)for(var e=xa[d],f=0;f<e.channel.length;f++){var g=e.channel[f],
|
|
|
-h=e.sampler[f];d=g.target.split("/")[0];if(d==this.id){h.create();g.sampler=h;c=Math.min(c,h.startTime);b=Math.max(b,h.endTime);a.push(g)}}if(a.length){this.startTime=c;this.endTime=b}if((this.channels=a)&&this.channels.length){d=[];a=[];c=0;for(e=this.channels.length;c<e;c++){var i=this.channels[c],f=i.fullSid,g=i.sampler,h=g.input,j=this.getTransformBySid(i.sid),k;if(i.arrIndices){k=[];b=0;for(var l=i.arrIndices.length;b<l;b++){var r=k,q=b,s=i.arrIndices[b];if(s>-1&&s<3){s=aa(["X","Y","Z"][s]);
|
|
|
-s={X:0,Y:1,Z:2}[s]}r[q]=s}}else k=aa(i.member);if(j){a.indexOf(f)===-1&&a.push(f);b=0;for(l=h.length;b<l;b++){for(var r=h[b],i=g.getData(j.type,b),q=null,s=0,t=d.length;s<t&&q==null;s++){var u=d[s];if(u.time===r)q=u;else if(u.time>r)break}if(!q){q=new U(r);s=-1;t=0;for(u=d.length;t<u&&s==-1;t++)d[t].time>=r&&(s=t);r=s;d.splice(r==-1?d.length:r,0,q)}q.addTarget(f,j,k,i)}}else console.log('Could not find transform "'+i.sid+'" in node '+this.id)}for(c=0;c<a.length;c++){e=a[c];for(b=0;b<d.length;b++){q=
|
|
|
-d[b];if(!q.hasTarget(e)){h=d;f=q;k=b;g=e;j=void 0;a:{j=k?k-1:0;for(j=j>=0?j:j+h.length;j>=0;j--){l=h[j];if(l.hasTarget(g)){j=l;break a}}j=null}l=void 0;a:{for(k=k+1;k<h.length;k++){l=h[k];if(l.hasTarget(g))break a}l=null}if(j&&l){h=(f.time-j.time)/(l.time-j.time);j=j.getTarget(g);k=l.getTarget(g).data;l=j.data;i=void 0;if(j.type==="matrix")i=l;else if(l.length){i=[];for(r=0;r<l.length;++r)i[r]=l[r]+(k[r]-l[r])*h}else i=l+(k-l)*h;f.addTarget(g,j.transform,j.member,i)}}}}this.keys=d;this.sids=a}this.updateMatrix();
|
|
|
-return this};p.prototype.updateMatrix=function(){this.matrix.identity();for(var a=0;a<this.transforms.length;a++)this.transforms[a].apply(this.matrix)};m.prototype.parse=function(a){this.sid=a.getAttribute("sid");this.type=a.nodeName;this.data=G(a.textContent);this.convert();return this};m.prototype.convert=function(){switch(this.type){case "matrix":this.obj=ba(this.data);break;case "rotate":this.angle=this.data[3]*Fb;case "translate":R(this.data,-1);this.obj=new THREE.Vector3(this.data[0],this.data[1],
|
|
|
-this.data[2]);break;case "scale":R(this.data,1);this.obj=new THREE.Vector3(this.data[0],this.data[1],this.data[2]);break;default:console.log("Can not convert Transform of type "+this.type)}};m.prototype.apply=function(a){switch(this.type){case "matrix":a.multiplySelf(this.obj);break;case "translate":a.translate(this.obj);break;case "rotate":a.rotateByAxis(this.obj,this.angle);break;case "scale":a.scale(this.obj)}};m.prototype.update=function(a,b){var c=["X","Y","Z","ANGLE"];switch(this.type){case "matrix":if(b)if(b.length===
|
|
|
-1)switch(b[0]){case 0:this.obj.n11=a[0];this.obj.n21=a[1];this.obj.n31=a[2];this.obj.n41=a[3];break;case 1:this.obj.n12=a[0];this.obj.n22=a[1];this.obj.n32=a[2];this.obj.n42=a[3];break;case 2:this.obj.n13=a[0];this.obj.n23=a[1];this.obj.n33=a[2];this.obj.n43=a[3];break;case 3:this.obj.n14=a[0];this.obj.n24=a[1];this.obj.n34=a[2];this.obj.n44=a[3]}else b.length===2?this.obj["n"+(b[0]+1)+(b[1]+1)]=a:console.log("Incorrect addressing of matrix in transform.");else this.obj.copy(a);break;case "translate":case "scale":Object.prototype.toString.call(b)===
|
|
|
-"[object Array]"&&(b=c[b[0]]);switch(b){case "X":this.obj.x=a;break;case "Y":this.obj.y=a;break;case "Z":this.obj.z=a;break;default:this.obj.x=a[0];this.obj.y=a[1];this.obj.z=a[2]}break;case "rotate":Object.prototype.toString.call(b)==="[object Array]"&&(b=c[b[0]]);switch(b){case "X":this.obj.x=a;break;case "Y":this.obj.y=a;break;case "Z":this.obj.z=a;break;case "ANGLE":this.angle=a*Fb;break;default:this.obj.x=a[0];this.obj.y=a[1];this.obj.z=a[2];this.angle=a[3]*Fb}}};o.prototype.parse=function(a){this.url=
|
|
|
-a.getAttribute("url").replace(/^#/,"");this.skeleton=[];this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "skeleton":this.skeleton.push(c.textContent.replace(/^#/,""));break;case "bind_material":if(c=ea.evaluate(".//dae:instance_material",c,W,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(var d=c.iterateNext();d;){this.instance_material.push((new r).parse(d));d=c.iterateNext()}}}return this};r.prototype.parse=function(a){this.symbol=
|
|
|
-a.getAttribute("symbol");this.target=a.getAttribute("target").replace(/^#/,"");return this};n.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1&&c.nodeName=="bind_material"){if(a=ea.evaluate(".//dae:instance_material",c,W,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(b=a.iterateNext();b;){this.instance_material.push((new r).parse(b));b=a.iterateNext()}break}}return this};
|
|
|
-q.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "mesh":this.mesh=(new u(this)).parse(c)}}return this};u.prototype.parse=function(a){this.primitives=[];var b;for(b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "source":var d=c.getAttribute("id");Oa[d]==void 0&&(Oa[d]=(new w(d)).parse(c));break;case "vertices":this.vertices=(new D).parse(c);break;case "triangles":this.primitives.push((new s).parse(c));
|
|
|
-break;case "polygons":this.primitives.push((new t).parse(c));break;case "polylist":this.primitives.push((new y).parse(c))}}this.geometry3js=new THREE.Geometry;a=Oa[this.vertices.input.POSITION.source].data;for(b=0;b<a.length;b=b+3)this.geometry3js.vertices.push(new THREE.Vertex($(a,b)));for(b=0;b<this.primitives.length;b++){a=this.primitives[b];a.setVertices(this.vertices);this.handlePrimitive(a,this.geometry3js)}this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();if(this.geometry3js.calcNormals){this.geometry3js.computeVertexNormals();
|
|
|
-delete this.geometry3js.calcNormals}this.geometry3js.computeBoundingBox();return this};u.prototype.handlePrimitive=function(a,b){var c,d,e=a.p,f=a.inputs,g,h,i,j,k=0,l=3,m=0,n=[];for(c=0;c<f.length;c++){g=f[c];l=g.offset+1;m=m<l?l:m;switch(g.semantic){case "TEXCOORD":n.push(g.set)}}for(var o=0;o<e.length;++o)for(var p=e[o],r=0;r<p.length;){var q=[],s=[],t={},u=[],l=a.vcount?a.vcount.length?a.vcount[k++]:a.vcount:p.length/m;for(c=0;c<l;c++)for(d=0;d<f.length;d++){g=f[d];j=Oa[g.source];h=p[r+c*m+g.offset];
|
|
|
-i=j.accessor.params.length;i=h*i;switch(g.semantic){case "VERTEX":q.push(h);break;case "NORMAL":s.push($(j.data,i));break;case "TEXCOORD":t[g.set]===void 0&&(t[g.set]=[]);t[g.set].push(new THREE.UV(j.data[i],1-j.data[i+1]));break;case "COLOR":u.push((new THREE.Color).setRGB(j.data[i],j.data[i+1],j.data[i+2]))}}d=null;c=[];if(s.length==0)if(g=this.vertices.input.NORMAL){j=Oa[g.source];i=j.accessor.params.length;g=0;for(h=q.length;g<h;g++)s.push($(j.data,q[g]*i))}else b.calcNormals=true;if(l===3)c.push(new THREE.Face3(q[0],
|
|
|
-q[1],q[2],s,u.length?u:new THREE.Color));else if(l===4)c.push(new THREE.Face4(q[0],q[1],q[2],q[3],s,u.length?u:new THREE.Color));else if(l>4&&Ia.subdivideFaces){u=u.length?u:new THREE.Color;for(d=1;d<l-1;)c.push(new THREE.Face3(q[0],q[d],q[d+1],[s[0],s[d++],s[d]],u))}if(c.length){g=0;for(h=c.length;g<h;g++){d=c[g];d.daeMaterial=a.material;b.faces.push(d);for(d=0;d<n.length;d++){q=t[n[d]];q=l>4?[q[0],q[g+1],q[g+2]]:l===4?[q[0],q[1],q[2],q[3]]:[q[0],q[1],q[2]];b.faceVertexUvs[d]||(b.faceVertexUvs[d]=
|
|
|
-[]);b.faceVertexUvs[d].push(q)}}}else console.log("dropped face with vcount "+l+" for geometry with id: "+b.id);r=r+m*l}};t.prototype.setVertices=function(a){for(var b=0;b<this.inputs.length;b++)if(this.inputs[b].source==a.id)this.inputs[b].source=a.input.POSITION.source};t.prototype.parse=function(a){this.material=a.getAttribute("material");this.count=la(a,"count",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "input":this.inputs.push((new B).parse(a.childNodes[b]));
|
|
|
-break;case "vcount":this.vcount=ha(c.textContent);break;case "p":this.p.push(ha(c.textContent));break;case "ph":console.warn("polygon holes not yet supported!")}}return this};y.prototype=new t;y.prototype.constructor=y;s.prototype=new t;s.prototype.constructor=s;x.prototype.parse=function(a){this.params=[];this.source=a.getAttribute("source");this.count=la(a,"count",0);this.stride=la(a,"stride",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="param"){var d={};d.name=
|
|
|
-c.getAttribute("name");d.type=c.getAttribute("type");this.params.push(d)}}return this};D.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++)if(a.childNodes[b].nodeName=="input"){var c=(new B).parse(a.childNodes[b]);this.input[c.semantic]=c}return this};B.prototype.parse=function(a){this.semantic=a.getAttribute("semantic");this.source=a.getAttribute("source").replace(/^#/,"");this.set=la(a,"set",-1);this.offset=la(a,"offset",0);if(this.semantic=="TEXCOORD"&&
|
|
|
-this.set<0)this.set=0;return this};w.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "bool_array":for(var d=fa(c.textContent),e=[],f=0,g=d.length;f<g;f++)e.push(d[f]=="true"||d[f]=="1"?true:false);this.data=e;this.type=c.nodeName;break;case "float_array":this.data=G(c.textContent);this.type=c.nodeName;break;case "int_array":this.data=ha(c.textContent);this.type=c.nodeName;break;case "IDREF_array":case "Name_array":this.data=
|
|
|
-fa(c.textContent);this.type=c.nodeName;break;case "technique_common":for(d=0;d<c.childNodes.length;d++)if(c.childNodes[d].nodeName=="accessor"){this.accessor=(new x).parse(c.childNodes[d]);break}}}return this};w.prototype.read=function(){var a=[],b=this.accessor.params[0];switch(b.type){case "IDREF":case "Name":case "name":case "float":return this.data;case "float4x4":for(b=0;b<this.data.length;b=b+16){var c=this.data.slice(b,b+16),c=ba(c);a.push(c)}break;default:console.log("ColladaLoader: Source: Read dont know how to read "+
|
|
|
-b.type+".")}return a};v.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");for(var b=0;b<a.childNodes.length;b++)if(a.childNodes[b].nodeName=="instance_effect"){this.instance_effect=(new J).parse(a.childNodes[b]);break}return this};C.prototype.isColor=function(){return this.texture==null};C.prototype.isTexture=function(){return this.texture!=null};C.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "color":c=
|
|
|
-G(c.textContent);this.color=new THREE.Color(0);this.color.setRGB(c[0],c[1],c[2]);this.color.a=c[3];break;case "texture":this.texture=c.getAttribute("texture");this.texcoord=c.getAttribute("texcoord");this.texOpts={offsetU:0,offsetV:0,repeatU:1,repeatV:1,wrapU:1,wrapV:1};this.parseTexture(c)}}return this};C.prototype.parseTexture=function(a){if(!a.childNodes)return this;if(a.childNodes[1]&&a.childNodes[1].nodeName==="extra"){a=a.childNodes[1];a.childNodes[1]&&a.childNodes[1].nodeName==="technique"&&
|
|
|
-(a=a.childNodes[1])}for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "offsetU":case "offsetV":case "repeatU":case "repeatV":this.texOpts[c.nodeName]=parseFloat(c.textContent);break;case "wrapU":case "wrapV":this.texOpts[c.nodeName]=parseInt(c.textContent);break;default:this.texOpts[c.nodeName]=c.textContent}}return this};K.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[c.nodeName]=
|
|
|
-(new C).parse(c);break;case "shininess":case "reflectivity":case "transparency":var d;d=ea.evaluate(".//dae:float",c,W,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);for(var e=d.iterateNext(),f=[];e;){f.push(e);e=d.iterateNext()}d=f;d.length>0&&(this[c.nodeName]=parseFloat(d[0].textContent))}}this.create();return this};K.prototype.create=function(){var a={},b=this.transparency!==void 0&&this.transparency<1,c;for(c in this)switch(c){case "ambient":case "emission":case "diffuse":case "specular":var d=
|
|
|
-this[c];if(d instanceof C)if(d.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid){var e=Ha[this.effect.surface.init_from];if(e){e=THREE.ImageUtils.loadTexture(ta+e.init_from);e.wrapS=d.texOpts.wrapU?THREE.RepeatWrapping:THREE.ClampToEdgeWrapping;e.wrapT=d.texOpts.wrapV?THREE.RepeatWrapping:THREE.ClampToEdgeWrapping;e.offset.x=d.texOpts.offsetU;e.offset.y=d.texOpts.offsetV;e.repeat.x=d.texOpts.repeatU;e.repeat.y=d.texOpts.repeatV;a.map=e;
|
|
|
-c=="emission"&&(a.emissive=16777215)}}}else if(c=="diffuse"||!b)c=="emission"?a.emissive=d.color.getHex():a[c]=d.color.getHex();break;case "shininess":case "reflectivity":a[c]=this[c];break;case "transparency":if(b){a.transparent=true;a.opacity=this[c];b=true}}a.shading=pa;switch(this.type){case "constant":a.color=a.emission;this.material=new THREE.MeshBasicMaterial(a);break;case "phong":case "blinn":a.color=a.diffuse;this.material=new THREE.MeshPhongMaterial(a);break;default:a.color=a.diffuse;this.material=
|
|
|
-new THREE.MeshLambertMaterial(a)}return this.material};L.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "init_from":this.init_from=c.textContent;break;case "format":this.format=c.textContent;break;default:console.log("unhandled Surface prop: "+c.nodeName)}}return this};T.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "source":this.source=
|
|
|
-c.textContent;break;case "minfilter":this.minfilter=c.textContent;break;case "magfilter":this.magfilter=c.textContent;break;case "mipfilter":this.mipfilter=c.textContent;break;case "wrap_s":this.wrap_s=c.textContent;break;case "wrap_t":this.wrap_t=c.textContent;break;default:console.log("unhandled Sampler2D prop: "+c.nodeName)}}return this};P.prototype.create=function(){if(this.shader==null)return null};P.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.shader=
|
|
|
-null;for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "profile_COMMON":this.parseTechnique(this.parseProfileCOMMON(c))}}return this};P.prototype.parseNewparam=function(a){for(var b=a.getAttribute("sid"),c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "surface":this.surface=(new L(this)).parse(d);this.surface.sid=b;break;case "sampler2D":this.sampler=(new T(this)).parse(d);this.sampler.sid=b;break;case "extra":break;
|
|
|
-default:console.log(d.nodeName)}}};P.prototype.parseProfileCOMMON=function(a){for(var b,c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "profile_COMMON":this.parseProfileCOMMON(d);break;case "technique":b=d;break;case "newparam":this.parseNewparam(d);break;case "image":d=(new g).parse(d);Ha[d.id]=d;break;case "extra":break;default:console.log(d.nodeName)}}return b};P.prototype.parseTechnique=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];
|
|
|
-if(c.nodeType==1)switch(c.nodeName){case "constant":case "lambert":case "blinn":case "phong":this.shader=(new K(c.nodeName,this)).parse(c)}}};J.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};N.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.source={};for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "animation":var c=(new N).parse(c),d;for(d in c.source)this.source[d]=
|
|
|
-c.source[d];for(var e=0;e<c.channel.length;e++){this.channel.push(c.channel[e]);this.sampler.push(c.sampler[e])}break;case "source":d=(new w).parse(c);this.source[d.id]=d;break;case "sampler":this.sampler.push((new i(this)).parse(c));break;case "channel":this.channel.push((new F(this)).parse(c))}}return this};F.prototype.parse=function(a){this.source=a.getAttribute("source").replace(/^#/,"");this.target=a.getAttribute("target");var b=this.target.split("/");b.shift();var a=b.shift(),c=a.indexOf(".")>=
|
|
|
-0,d=a.indexOf("(")>=0;if(c){b=a.split(".");this.sid=b.shift();this.member=b.shift()}else if(d){b=a.split("(");this.sid=b.shift();for(var e=0;e<b.length;e++)b[e]=parseInt(b[e].replace(/\)/,""));this.arrIndices=b}else this.sid=a;this.fullSid=a;this.dotSyntax=c;this.arrSyntax=d;return this};i.prototype.parse=function(a){this.id=a.getAttribute("id");this.inputs=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "input":this.inputs.push((new B).parse(c))}}return this};
|
|
|
-i.prototype.create=function(){for(var a=0;a<this.inputs.length;a++){var b=this.inputs[a],c=this.animation.source[b.source];switch(b.semantic){case "INPUT":this.input=c.read();break;case "OUTPUT":this.output=c.read();this.strideOut=c.accessor.stride;break;case "INTERPOLATION":this.interpolation=c.read();break;case "IN_TANGENT":break;case "OUT_TANGENT":break;default:console.log(b.semantic)}}this.duration=this.endTime=this.startTime=0;if(this.input.length){this.startTime=1E8;this.endTime=-1E8;for(a=
|
|
|
-0;a<this.input.length;a++){this.startTime=Math.min(this.startTime,this.input[a]);this.endTime=Math.max(this.endTime,this.input[a])}this.duration=this.endTime-this.startTime}};i.prototype.getData=function(a,b){var c;if(a==="matrix"&&this.strideOut===16)c=this.output[b];else if(this.strideOut>1){c=[];for(var b=b*this.strideOut,d=0;d<this.strideOut;++d)c[d]=this.output[b+d];if(this.strideOut===3)switch(a){case "rotate":case "translate":R(c,-1);break;case "scale":R(c,1)}else this.strideOut===4&&a==="matrix"&&
|
|
|
-R(c,-1)}else c=this.output[b];return c};U.prototype.addTarget=function(a,b,c,d){this.targets.push({sid:a,member:c,transform:b,data:d})};U.prototype.apply=function(a){for(var b=0;b<this.targets.length;++b){var c=this.targets[b];(!a||c.sid===a)&&c.transform.update(c.data,c.member)}};U.prototype.getTarget=function(a){for(var b=0;b<this.targets.length;++b)if(this.targets[b].sid===a)return this.targets[b];return null};U.prototype.hasTarget=function(a){for(var b=0;b<this.targets.length;++b)if(this.targets[b].sid===
|
|
|
-a)return true;return false};U.prototype.interpolate=function(a,b){for(var c=0;c<this.targets.length;++c){var d=this.targets[c],e=a.getTarget(d.sid);if(d.transform.type!=="matrix"&&e){var f=(b-this.time)/(a.time-this.time),g=e.data,h=d.data;if(f<0||f>1){console.log("Key.interpolate: Warning! Scale out of bounds:"+f);f=f<0?0:1}if(h.length)for(var e=[],i=0;i<h.length;++i)e[i]=h[i]+(g[i]-h[i])*f;else e=h+(g-h)*f}else e=d.data;d.transform.update(e,d.member)}};E.prototype.parse=function(a){this.id=a.getAttribute("id");
|
|
|
-this.name=a.getAttribute("name");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "optics":this.parseOptics(c)}}return this};E.prototype.parseOptics=function(a){for(var b=0;b<a.childNodes.length;b++)if(a.childNodes[b].nodeName=="technique_common")for(var c=a.childNodes[b],d=0;d<c.childNodes.length;d++){this.technique=c.childNodes[d].nodeName;if(this.technique=="perspective")for(var e=c.childNodes[d],f=0;f<e.childNodes.length;f++){var g=e.childNodes[f];
|
|
|
-switch(g.nodeName){case "yfov":this.yfov=g.textContent;break;case "xfov":this.xfov=g.textContent;break;case "znear":this.znear=g.textContent;break;case "zfar":this.zfar=g.textContent;break;case "aspect_ratio":this.aspect_ratio=g.textContent}}else if(this.technique=="orthographic"){e=c.childNodes[d];for(f=0;f<e.childNodes.length;f++){g=e.childNodes[f];switch(g.nodeName){case "xmag":this.xmag=g.textContent;break;case "ymag":this.ymag=g.textContent;break;case "znear":this.znear=g.textContent;break;case "zfar":this.zfar=
|
|
|
-g.textContent;break;case "aspect_ratio":this.aspect_ratio=g.textContent}}}}return this};H.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};return{load:function(b,c,d){var e=0;if(document.implementation&&document.implementation.createDocument){var f=new XMLHttpRequest;f.overrideMimeType&&f.overrideMimeType("text/xml");f.onreadystatechange=function(){if(f.readyState==4){if(f.status==0||f.status==200)if(f.responseXML){sa=c;a(f.responseXML,void 0,b)}else console.error("ColladaLoader: Empty or non-existing file ("+
|
|
|
-b+")")}else if(f.readyState==3&&d){e==0&&(e=f.getResponseHeader("Content-Length"));d({total:e,loaded:f.responseText.length})}};f.open("GET",b,true);f.send(null)}else alert("Don't know how to parse XML!")},parse:a,setPreferredShading:function(a){pa=a},applySkin:e,geometries:Ya,options:Ia}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;
|
|
|
-THREE.JSONLoader.prototype.load=function(a,b,c){c=c?c:this.extractUrlBase(a);this.onLoadStart();this.loadAjaxJSON(this,a,b,c)};
|
|
|
+n,j=0;j<a.vertices.length;j++)f.skin.bindShapeMatrix.multiplyVector3(a.vertices[j]);for(c=0;c<e;c++){h=[];i=[];for(j=0;j<a.vertices.length;j++)i.push(new THREE.Vertex);d(b,h,c);j=h;k=f.skin;for(m=0;m<j.length;m++){l=j[m];n=-1;if(l.type=="JOINT"){for(var o=0;o<k.joints.length;o++)if(l.sid==k.joints[o]){n=o;break}if(n>=0){o=k.invBindMatrices[n];l.invBindMatrix=o;l.skinningMatrix=new THREE.Matrix4;l.skinningMatrix.multiply(l.world,o);l.weights=[];for(o=0;o<k.weights.length;o++)for(var p=0;p<k.weights[o].length;p++){var r=
|
|
|
+k.weights[o][p];r.joint==n&&l.weights.push(r)}}else throw"ColladaLoader: Could not find joint '"+l.sid+"'.";}}for(j=0;j<h.length;j++)if(h[j].type=="JOINT")for(k=0;k<h[j].weights.length;k++){l=h[j].weights[k];m=l.index;l=l.weight;n=a.vertices[m];m=i[m];g.x=n.x;g.y=n.y;g.z=n.z;h[j].skinningMatrix.multiplyVector3(g);m.x=m.x+g.x*l;m.y=m.y+g.y*l;m.z=m.z+g.z*l}a.morphTargets.push({name:"target_"+c,vertices:i})}}}function f(a){var b=new THREE.Object3D,c,d,g,h;for(g=0;g<a.controllers.length;g++){var i=Wa[a.controllers[g].url];
|
|
|
+switch(i.type){case "skin":if(Ya[i.skin.source]){var j=new n;j.url=i.skin.source;j.instance_material=a.controllers[g].instance_material;a.geometries.push(j);c=a.controllers[g]}else if(Wa[i.skin.source]){d=i=Wa[i.skin.source];if(i.morph&&Ya[i.morph.source]){j=new n;j.url=i.morph.source;j.instance_material=a.controllers[g].instance_material;a.geometries.push(j)}}break;case "morph":if(Ya[i.morph.source]){j=new n;j.url=i.morph.source;j.instance_material=a.controllers[g].instance_material;a.geometries.push(j);
|
|
|
+d=a.controllers[g]}console.log("ColladaLoader: Morph-controller partially supported.")}}for(g=0;g<a.geometries.length;g++){var i=a.geometries[g],j=i.instance_material,i=Ya[i.url],k={},l=[],m=0,p;if(i&&i.mesh&&i.mesh.primitives){if(b.name.length==0)b.name=i.id;if(j)for(h=0;h<j.length;h++){p=j[h];var r=Ka[p.target],q=db[r.instance_effect.url].shader;q.material.opacity=!q.material.opacity?1:q.material.opacity;k[p.symbol]=m;l.push(q.material);p=q.material;p.name=r.name==null||r.name===""?r.id:r.name;
|
|
|
+m++}j=p||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});i=i.mesh.geometry3js;if(m>1){j=new THREE.MeshFaceMaterial;i.materials=l;for(h=0;h<i.faces.length;h++){l=i.faces[h];l.materialIndex=k[l.daeMaterial]}}if(c!==void 0){e(i,c);j.morphTargets=true;j=new THREE.SkinnedMesh(i,j);j.skeleton=c.skeleton;j.skinController=Wa[c.url];j.skinInstanceController=c;j.name="skin_"+ab.length;ab.push(j)}else if(d!==void 0){h=i;k=d instanceof o?Wa[d.url]:d;if(!k||!k.morph)console.log("could not find morph controller!");
|
|
|
+else{k=k.morph;for(l=0;l<k.targets.length;l++){m=Ya[k.targets[l]];if(m.mesh&&m.mesh.primitives&&m.mesh.primitives.length){m=m.mesh.primitives[0].geometry;m.vertices.length===h.vertices.length&&h.morphTargets.push({name:"target_1",vertices:m.vertices})}}h.morphTargets.push({name:"target_Z",vertices:h.vertices})}j.morphTargets=true;j=new THREE.Mesh(i,j);j.name="morph_"+ua.length;ua.push(j)}else j=new THREE.Mesh(i,j);a.geometries.length>1?b.add(j):b=j}}for(g=0;g<a.cameras.length;g++){b=hb[a.cameras[g].url];
|
|
|
+b=new THREE.PerspectiveCamera(b.fov,b.aspect_ratio,b.znear,b.zfar)}b.name=a.id||"";b.matrix=a.matrix;g=a.matrix.decompose();b.position=g[0];b.quaternion=g[1];b.useQuaternion=true;b.scale=g[2];if(Ia.centerGeometry&&b.geometry){g=THREE.GeometryUtils.center(b.geometry);b.quaternion.multiplyVector3(g.multiplySelf(b.scale));b.position.subSelf(g)}for(g=0;g<a.nodes.length;g++)b.add(f(a.nodes[g],a));return b}function g(){this.init_from=this.id=""}function h(){this.type=this.name=this.id="";this.morph=this.skin=
|
|
|
+null}function j(){this.weights=this.targets=this.source=this.method=null}function k(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function l(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function p(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function m(){this.type=this.sid="";this.data=[];this.obj=null}function o(){this.url=
|
|
|
+"";this.skeleton=[];this.instance_material=[]}function r(){this.target=this.symbol=""}function n(){this.url="";this.instance_material=[]}function q(){this.id="";this.mesh=null}function u(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function t(){this.material="";this.count=0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function y(){t.call(this);this.vcount=[]}function s(){t.call(this);this.vcount=3}function x(){this.source="";this.stride=
|
|
|
+this.count=0;this.params=[]}function D(){this.input={}}function B(){this.semantic="";this.offset=0;this.source="";this.set=0}function w(a){this.id=a;this.type=null}function v(){this.name=this.id="";this.instance_effect=null}function C(){this.color=new THREE.Color(0);this.color.setRGB(Math.random(),Math.random(),Math.random());this.color.a=1;this.texOpts=this.texcoord=this.texture=null}function K(a,b){this.type=a;this.effect=b;this.material=null}function L(a){this.effect=a;this.format=this.init_from=
|
|
|
+null}function T(a){this.effect=a;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=this.source=null}function P(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function J(){this.url=""}function N(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function F(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=this.dotSyntax=this.sid=this.fullSid=null}function i(a){this.id="";this.animation=a;this.inputs=[];
|
|
|
+this.endTime=this.startTime=this.interpolation=this.strideOut=this.output=this.input=null;this.duration=0}function U(a){this.targets=[];this.time=a}function E(){this.technique=this.name=this.id=""}function H(){this.url=""}function W(a){return a=="dae"?"http://www.collada.org/2005/11/COLLADASchema":null}function G(a){for(var a=fa(a),b=[],c=0,d=a.length;c<d;c++)b.push(parseFloat(a[c]));return b}function ha(a){for(var a=fa(a),b=[],c=0,d=a.length;c<d;c++)b.push(parseInt(a[c],10));return b}function fa(a){return a.length>
|
|
|
+0?a.replace(/^\s+/,"").replace(/\s+$/,"").split(/\s+/):[]}function la(a,b,c){return a.hasAttribute(b)?parseInt(a.getAttribute(b),10):c}function R(a,b){if(Ia.convertUpAxis&&Xa!==Ia.upAxis)switch(ja){case "XtoY":var c=a[0];a[0]=b*a[1];a[1]=c;break;case "XtoZ":c=a[2];a[2]=a[1];a[1]=a[0];a[0]=c;break;case "YtoX":c=a[0];a[0]=a[1];a[1]=b*c;break;case "YtoZ":c=a[1];a[1]=b*a[2];a[2]=c;break;case "ZtoX":c=a[0];a[0]=a[1];a[1]=a[2];a[2]=c;break;case "ZtoY":c=a[1];a[1]=a[2];a[2]=b*c}}function $(a,b){var c=[a[b],
|
|
|
+a[b+1],a[b+2]];R(c,-1);return new THREE.Vector3(c[0],c[1],c[2])}function ba(a){if(Ia.convertUpAxis){var b=[a[0],a[4],a[8]];R(b,-1);a[0]=b[0];a[4]=b[1];a[8]=b[2];b=[a[1],a[5],a[9]];R(b,-1);a[1]=b[0];a[5]=b[1];a[9]=b[2];b=[a[2],a[6],a[10]];R(b,-1);a[2]=b[0];a[6]=b[1];a[10]=b[2];b=[a[0],a[1],a[2]];R(b,-1);a[0]=b[0];a[1]=b[1];a[2]=b[2];b=[a[4],a[5],a[6]];R(b,-1);a[4]=b[0];a[5]=b[1];a[6]=b[2];b=[a[8],a[9],a[10]];R(b,-1);a[8]=b[0];a[9]=b[1];a[10]=b[2];b=[a[3],a[7],a[11]];R(b,-1);a[3]=b[0];a[7]=b[1];a[11]=
|
|
|
+b[2]}return new THREE.Matrix4(a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8],a[9],a[10],a[11],a[12],a[13],a[14],a[15])}function aa(a){if(Ia.convertUpAxis)switch(a){case "X":switch(ja){case "XtoY":case "XtoZ":case "YtoX":a="Y";break;case "ZtoX":a="Z"}break;case "Y":switch(ja){case "XtoY":case "YtoX":case "ZtoX":a="X";break;case "XtoZ":case "YtoZ":case "ZtoY":a="Z"}break;case "Z":switch(ja){case "XtoZ":a="X";break;case "YtoZ":case "ZtoX":case "ZtoY":a="Y"}}return a}var ea=null,Na=null,wa,sa=null,Oa={},
|
|
|
+Ha={},xa={},Wa={},Ya={},Ka={},db={},hb={},mb,Pa,ta,ua,ab,pa=THREE.SmoothShading,Ia={centerGeometry:false,convertUpAxis:false,subdivideFaces:true,upAxis:"Y"},Xa="Y",ja=null,Fb=Math.PI/180;g.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="init_from")this.init_from=c.textContent}return this};h.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.type="none";for(var b=0;b<a.childNodes.length;b++){var c=
|
|
|
+a.childNodes[b];switch(c.nodeName){case "skin":this.skin=(new k).parse(c);this.type=c.nodeName;break;case "morph":this.morph=(new j).parse(c);this.type=c.nodeName}}return this};j.prototype.parse=function(a){var b={},c=[],d;this.method=a.getAttribute("method");this.source=a.getAttribute("source").replace(/^#/,"");for(d=0;d<a.childNodes.length;d++){var e=a.childNodes[d];if(e.nodeType==1)switch(e.nodeName){case "source":e=(new w).parse(e);b[e.id]=e;break;case "targets":c=this.parseInputs(e);break;default:console.log(e.nodeName)}}for(d=
|
|
|
+0;d<c.length;d++){a=c[d];e=b[a.source];switch(a.semantic){case "MORPH_TARGET":this.targets=e.read();break;case "MORPH_WEIGHT":this.weights=e.read()}}return this};j.prototype.parseInputs=function(a){for(var b=[],c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "input":b.push((new B).parse(d))}}return b};k.prototype.parse=function(a){var b={},c,d;this.source=a.getAttribute("source").replace(/^#/,"");this.invBindMatrices=[];this.joints=[];this.weights=[];
|
|
|
+for(var e=0;e<a.childNodes.length;e++){var f=a.childNodes[e];if(f.nodeType==1)switch(f.nodeName){case "bind_shape_matrix":f=G(f.textContent);this.bindShapeMatrix=ba(f);break;case "source":f=(new w).parse(f);b[f.id]=f;break;case "joints":c=f;break;case "vertex_weights":d=f;break;default:console.log(f.nodeName)}}this.parseJoints(c,b);this.parseWeights(d,b);return this};k.prototype.parseJoints=function(a,b){for(var c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "input":var d=
|
|
|
+(new B).parse(d),e=b[d.source];if(d.semantic=="JOINT")this.joints=e.read();else if(d.semantic=="INV_BIND_MATRIX")this.invBindMatrices=e.read()}}};k.prototype.parseWeights=function(a,b){for(var c,d,e=[],f=0;f<a.childNodes.length;f++){var g=a.childNodes[f];if(g.nodeType==1)switch(g.nodeName){case "input":e.push((new B).parse(g));break;case "v":c=ha(g.textContent);break;case "vcount":d=ha(g.textContent)}}for(f=g=0;f<d.length;f++){for(var h=d[f],i=[],j=0;j<h;j++){for(var k={},l=0;l<e.length;l++){var m=
|
|
|
+e[l],n=c[g+m.offset];switch(m.semantic){case "JOINT":k.joint=n;break;case "WEIGHT":k.weight=b[m.source].data[n]}}i.push(k);g=g+e.length}for(j=0;j<i.length;j++)i[j].index=f;this.weights.push(i)}};l.prototype.getChildById=function(a,b){for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildById(a,b);if(d)return d}return null};l.prototype.getChildBySid=function(a,b){for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildBySid(a,b);if(d)return d}return null};l.prototype.parse=function(a){this.id=
|
|
|
+a.getAttribute("id");this.name=a.getAttribute("name");this.nodes=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "node":this.nodes.push((new p).parse(c))}}return this};p.prototype.getChannelForTransform=function(a){for(var b=0;b<this.channels.length;b++){var c=this.channels[b],d=c.target.split("/");d.shift();var e=d.shift(),f=e.indexOf(".")>=0,g=e.indexOf("(")>=0,h;if(f){d=e.split(".");e=d.shift();d.shift()}else if(g){h=e.split("(");e=h.shift();
|
|
|
+for(d=0;d<h.length;d++)h[d]=parseInt(h[d].replace(/\)/,""))}if(e==a){c.info={sid:e,dotSyntax:f,arrSyntax:g,arrIndices:h};return c}}return null};p.prototype.getChildById=function(a,b){if(this.id==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildById(a,b);if(d)return d}return null};p.prototype.getChildBySid=function(a,b){if(this.sid==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildBySid(a,b);if(d)return d}return null};p.prototype.getTransformBySid=
|
|
|
+function(a){for(var b=0;b<this.transforms.length;b++)if(this.transforms[b].sid==a)return this.transforms[b];return null};p.prototype.parse=function(a){var b;this.id=a.getAttribute("id");this.sid=a.getAttribute("sid");this.name=a.getAttribute("name");this.type=a.getAttribute("type");this.type=this.type=="JOINT"?this.type:"NODE";this.nodes=[];this.transforms=[];this.geometries=[];this.cameras=[];this.controllers=[];this.matrix=new THREE.Matrix4;for(var c=0;c<a.childNodes.length;c++){b=a.childNodes[c];
|
|
|
+if(b.nodeType==1)switch(b.nodeName){case "node":this.nodes.push((new p).parse(b));break;case "instance_camera":this.cameras.push((new H).parse(b));break;case "instance_controller":this.controllers.push((new o).parse(b));break;case "instance_geometry":this.geometries.push((new n).parse(b));break;case "instance_light":break;case "instance_node":b=b.getAttribute("url").replace(/^#/,"");(b=ea.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",ea,W,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&
|
|
|
+this.nodes.push((new p).parse(b));break;case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new m).parse(b));break;case "extra":break;default:console.log(b.nodeName)}}a=[];c=1E6;b=-1E6;for(var d in xa)for(var e=xa[d],f=0;f<e.channel.length;f++){var g=e.channel[f],h=e.sampler[f];d=g.target.split("/")[0];if(d==this.id){h.create();g.sampler=h;c=Math.min(c,h.startTime);b=Math.max(b,h.endTime);a.push(g)}}if(a.length){this.startTime=c;this.endTime=b}if((this.channels=
|
|
|
+a)&&this.channels.length){d=[];a=[];c=0;for(e=this.channels.length;c<e;c++){var i=this.channels[c],f=i.fullSid,g=i.sampler,h=g.input,j=this.getTransformBySid(i.sid),k;if(i.arrIndices){k=[];b=0;for(var l=i.arrIndices.length;b<l;b++){var r=k,q=b,s=i.arrIndices[b];if(s>-1&&s<3){s=aa(["X","Y","Z"][s]);s={X:0,Y:1,Z:2}[s]}r[q]=s}}else k=aa(i.member);if(j){a.indexOf(f)===-1&&a.push(f);b=0;for(l=h.length;b<l;b++){for(var r=h[b],i=g.getData(j.type,b),q=null,s=0,t=d.length;s<t&&q==null;s++){var u=d[s];if(u.time===
|
|
|
+r)q=u;else if(u.time>r)break}if(!q){q=new U(r);s=-1;t=0;for(u=d.length;t<u&&s==-1;t++)d[t].time>=r&&(s=t);r=s;d.splice(r==-1?d.length:r,0,q)}q.addTarget(f,j,k,i)}}else console.log('Could not find transform "'+i.sid+'" in node '+this.id)}for(c=0;c<a.length;c++){e=a[c];for(b=0;b<d.length;b++){q=d[b];if(!q.hasTarget(e)){h=d;f=q;k=b;g=e;j=void 0;a:{j=k?k-1:0;for(j=j>=0?j:j+h.length;j>=0;j--){l=h[j];if(l.hasTarget(g)){j=l;break a}}j=null}l=void 0;a:{for(k=k+1;k<h.length;k++){l=h[k];if(l.hasTarget(g))break a}l=
|
|
|
+null}if(j&&l){h=(f.time-j.time)/(l.time-j.time);j=j.getTarget(g);k=l.getTarget(g).data;l=j.data;i=void 0;if(j.type==="matrix")i=l;else if(l.length){i=[];for(r=0;r<l.length;++r)i[r]=l[r]+(k[r]-l[r])*h}else i=l+(k-l)*h;f.addTarget(g,j.transform,j.member,i)}}}}this.keys=d;this.sids=a}this.updateMatrix();return this};p.prototype.updateMatrix=function(){this.matrix.identity();for(var a=0;a<this.transforms.length;a++)this.transforms[a].apply(this.matrix)};m.prototype.parse=function(a){this.sid=a.getAttribute("sid");
|
|
|
+this.type=a.nodeName;this.data=G(a.textContent);this.convert();return this};m.prototype.convert=function(){switch(this.type){case "matrix":this.obj=ba(this.data);break;case "rotate":this.angle=this.data[3]*Fb;case "translate":R(this.data,-1);this.obj=new THREE.Vector3(this.data[0],this.data[1],this.data[2]);break;case "scale":R(this.data,1);this.obj=new THREE.Vector3(this.data[0],this.data[1],this.data[2]);break;default:console.log("Can not convert Transform of type "+this.type)}};m.prototype.apply=
|
|
|
+function(a){switch(this.type){case "matrix":a.multiplySelf(this.obj);break;case "translate":a.translate(this.obj);break;case "rotate":a.rotateByAxis(this.obj,this.angle);break;case "scale":a.scale(this.obj)}};m.prototype.update=function(a,b){var c=["X","Y","Z","ANGLE"];switch(this.type){case "matrix":if(b)if(b.length===1)switch(b[0]){case 0:this.obj.n11=a[0];this.obj.n21=a[1];this.obj.n31=a[2];this.obj.n41=a[3];break;case 1:this.obj.n12=a[0];this.obj.n22=a[1];this.obj.n32=a[2];this.obj.n42=a[3];break;
|
|
|
+case 2:this.obj.n13=a[0];this.obj.n23=a[1];this.obj.n33=a[2];this.obj.n43=a[3];break;case 3:this.obj.n14=a[0];this.obj.n24=a[1];this.obj.n34=a[2];this.obj.n44=a[3]}else b.length===2?this.obj["n"+(b[0]+1)+(b[1]+1)]=a:console.log("Incorrect addressing of matrix in transform.");else this.obj.copy(a);break;case "translate":case "scale":Object.prototype.toString.call(b)==="[object Array]"&&(b=c[b[0]]);switch(b){case "X":this.obj.x=a;break;case "Y":this.obj.y=a;break;case "Z":this.obj.z=a;break;default:this.obj.x=
|
|
|
+a[0];this.obj.y=a[1];this.obj.z=a[2]}break;case "rotate":Object.prototype.toString.call(b)==="[object Array]"&&(b=c[b[0]]);switch(b){case "X":this.obj.x=a;break;case "Y":this.obj.y=a;break;case "Z":this.obj.z=a;break;case "ANGLE":this.angle=a*Fb;break;default:this.obj.x=a[0];this.obj.y=a[1];this.obj.z=a[2];this.angle=a[3]*Fb}}};o.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.skeleton=[];this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];
|
|
|
+if(c.nodeType==1)switch(c.nodeName){case "skeleton":this.skeleton.push(c.textContent.replace(/^#/,""));break;case "bind_material":if(c=ea.evaluate(".//dae:instance_material",c,W,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(var d=c.iterateNext();d;){this.instance_material.push((new r).parse(d));d=c.iterateNext()}}}return this};r.prototype.parse=function(a){this.symbol=a.getAttribute("symbol");this.target=a.getAttribute("target").replace(/^#/,"");return this};n.prototype.parse=function(a){this.url=
|
|
|
+a.getAttribute("url").replace(/^#/,"");this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1&&c.nodeName=="bind_material"){if(a=ea.evaluate(".//dae:instance_material",c,W,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(b=a.iterateNext();b;){this.instance_material.push((new r).parse(b));b=a.iterateNext()}break}}return this};q.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "mesh":this.mesh=
|
|
|
+(new u(this)).parse(c)}}return this};u.prototype.parse=function(a){this.primitives=[];var b;for(b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "source":var d=c.getAttribute("id");Oa[d]==void 0&&(Oa[d]=(new w(d)).parse(c));break;case "vertices":this.vertices=(new D).parse(c);break;case "triangles":this.primitives.push((new s).parse(c));break;case "polygons":this.primitives.push((new t).parse(c));break;case "polylist":this.primitives.push((new y).parse(c))}}this.geometry3js=
|
|
|
+new THREE.Geometry;a=Oa[this.vertices.input.POSITION.source].data;for(b=0;b<a.length;b=b+3)this.geometry3js.vertices.push((new THREE.Vertex).copy($(a,b)));for(b=0;b<this.primitives.length;b++){a=this.primitives[b];a.setVertices(this.vertices);this.handlePrimitive(a,this.geometry3js)}this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();if(this.geometry3js.calcNormals){this.geometry3js.computeVertexNormals();delete this.geometry3js.calcNormals}this.geometry3js.computeBoundingBox();
|
|
|
+return this};u.prototype.handlePrimitive=function(a,b){var c,d,e=a.p,f=a.inputs,g,h,i,j,k=0,l=3,m=0,n=[];for(c=0;c<f.length;c++){g=f[c];l=g.offset+1;m=m<l?l:m;switch(g.semantic){case "TEXCOORD":n.push(g.set)}}for(var o=0;o<e.length;++o)for(var p=e[o],r=0;r<p.length;){var q=[],s=[],t={},u=[],l=a.vcount?a.vcount.length?a.vcount[k++]:a.vcount:p.length/m;for(c=0;c<l;c++)for(d=0;d<f.length;d++){g=f[d];j=Oa[g.source];h=p[r+c*m+g.offset];i=j.accessor.params.length;i=h*i;switch(g.semantic){case "VERTEX":q.push(h);
|
|
|
+break;case "NORMAL":s.push($(j.data,i));break;case "TEXCOORD":t[g.set]===void 0&&(t[g.set]=[]);t[g.set].push(new THREE.UV(j.data[i],1-j.data[i+1]));break;case "COLOR":u.push((new THREE.Color).setRGB(j.data[i],j.data[i+1],j.data[i+2]))}}d=null;c=[];if(s.length==0)if(g=this.vertices.input.NORMAL){j=Oa[g.source];i=j.accessor.params.length;g=0;for(h=q.length;g<h;g++)s.push($(j.data,q[g]*i))}else b.calcNormals=true;if(l===3)c.push(new THREE.Face3(q[0],q[1],q[2],s,u.length?u:new THREE.Color));else if(l===
|
|
|
+4)c.push(new THREE.Face4(q[0],q[1],q[2],q[3],s,u.length?u:new THREE.Color));else if(l>4&&Ia.subdivideFaces){u=u.length?u:new THREE.Color;for(d=1;d<l-1;)c.push(new THREE.Face3(q[0],q[d],q[d+1],[s[0],s[d++],s[d]],u))}if(c.length){g=0;for(h=c.length;g<h;g++){d=c[g];d.daeMaterial=a.material;b.faces.push(d);for(d=0;d<n.length;d++){q=t[n[d]];q=l>4?[q[0],q[g+1],q[g+2]]:l===4?[q[0],q[1],q[2],q[3]]:[q[0],q[1],q[2]];b.faceVertexUvs[d]||(b.faceVertexUvs[d]=[]);b.faceVertexUvs[d].push(q)}}}else console.log("dropped face with vcount "+
|
|
|
+l+" for geometry with id: "+b.id);r=r+m*l}};t.prototype.setVertices=function(a){for(var b=0;b<this.inputs.length;b++)if(this.inputs[b].source==a.id)this.inputs[b].source=a.input.POSITION.source};t.prototype.parse=function(a){this.material=a.getAttribute("material");this.count=la(a,"count",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "input":this.inputs.push((new B).parse(a.childNodes[b]));break;case "vcount":this.vcount=ha(c.textContent);break;case "p":this.p.push(ha(c.textContent));
|
|
|
+break;case "ph":console.warn("polygon holes not yet supported!")}}return this};y.prototype=new t;y.prototype.constructor=y;s.prototype=new t;s.prototype.constructor=s;x.prototype.parse=function(a){this.params=[];this.source=a.getAttribute("source");this.count=la(a,"count",0);this.stride=la(a,"stride",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="param"){var d={};d.name=c.getAttribute("name");d.type=c.getAttribute("type");this.params.push(d)}}return this};D.prototype.parse=
|
|
|
+function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++)if(a.childNodes[b].nodeName=="input"){var c=(new B).parse(a.childNodes[b]);this.input[c.semantic]=c}return this};B.prototype.parse=function(a){this.semantic=a.getAttribute("semantic");this.source=a.getAttribute("source").replace(/^#/,"");this.set=la(a,"set",-1);this.offset=la(a,"offset",0);if(this.semantic=="TEXCOORD"&&this.set<0)this.set=0;return this};w.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=
|
|
|
+0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "bool_array":for(var d=fa(c.textContent),e=[],f=0,g=d.length;f<g;f++)e.push(d[f]=="true"||d[f]=="1"?true:false);this.data=e;this.type=c.nodeName;break;case "float_array":this.data=G(c.textContent);this.type=c.nodeName;break;case "int_array":this.data=ha(c.textContent);this.type=c.nodeName;break;case "IDREF_array":case "Name_array":this.data=fa(c.textContent);this.type=c.nodeName;break;case "technique_common":for(d=0;d<c.childNodes.length;d++)if(c.childNodes[d].nodeName==
|
|
|
+"accessor"){this.accessor=(new x).parse(c.childNodes[d]);break}}}return this};w.prototype.read=function(){var a=[],b=this.accessor.params[0];switch(b.type){case "IDREF":case "Name":case "name":case "float":return this.data;case "float4x4":for(b=0;b<this.data.length;b=b+16){var c=this.data.slice(b,b+16),c=ba(c);a.push(c)}break;default:console.log("ColladaLoader: Source: Read dont know how to read "+b.type+".")}return a};v.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");
|
|
|
+for(var b=0;b<a.childNodes.length;b++)if(a.childNodes[b].nodeName=="instance_effect"){this.instance_effect=(new J).parse(a.childNodes[b]);break}return this};C.prototype.isColor=function(){return this.texture==null};C.prototype.isTexture=function(){return this.texture!=null};C.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "color":c=G(c.textContent);this.color=new THREE.Color(0);this.color.setRGB(c[0],c[1],c[2]);this.color.a=
|
|
|
+c[3];break;case "texture":this.texture=c.getAttribute("texture");this.texcoord=c.getAttribute("texcoord");this.texOpts={offsetU:0,offsetV:0,repeatU:1,repeatV:1,wrapU:1,wrapV:1};this.parseTexture(c)}}return this};C.prototype.parseTexture=function(a){if(!a.childNodes)return this;if(a.childNodes[1]&&a.childNodes[1].nodeName==="extra"){a=a.childNodes[1];a.childNodes[1]&&a.childNodes[1].nodeName==="technique"&&(a=a.childNodes[1])}for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "offsetU":case "offsetV":case "repeatU":case "repeatV":this.texOpts[c.nodeName]=
|
|
|
+parseFloat(c.textContent);break;case "wrapU":case "wrapV":this.texOpts[c.nodeName]=parseInt(c.textContent);break;default:this.texOpts[c.nodeName]=c.textContent}}return this};K.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[c.nodeName]=(new C).parse(c);break;case "shininess":case "reflectivity":case "transparency":var d;d=ea.evaluate(".//dae:float",
|
|
|
+c,W,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);for(var e=d.iterateNext(),f=[];e;){f.push(e);e=d.iterateNext()}d=f;d.length>0&&(this[c.nodeName]=parseFloat(d[0].textContent))}}this.create();return this};K.prototype.create=function(){var a={},b=this.transparency!==void 0&&this.transparency<1,c;for(c in this)switch(c){case "ambient":case "emission":case "diffuse":case "specular":var d=this[c];if(d instanceof C)if(d.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==
|
|
|
+this.effect.surface.sid){var e=Ha[this.effect.surface.init_from];if(e){e=THREE.ImageUtils.loadTexture(ta+e.init_from);e.wrapS=d.texOpts.wrapU?THREE.RepeatWrapping:THREE.ClampToEdgeWrapping;e.wrapT=d.texOpts.wrapV?THREE.RepeatWrapping:THREE.ClampToEdgeWrapping;e.offset.x=d.texOpts.offsetU;e.offset.y=d.texOpts.offsetV;e.repeat.x=d.texOpts.repeatU;e.repeat.y=d.texOpts.repeatV;a.map=e;c=="emission"&&(a.emissive=16777215)}}}else if(c=="diffuse"||!b)c=="emission"?a.emissive=d.color.getHex():a[c]=d.color.getHex();
|
|
|
+break;case "shininess":case "reflectivity":a[c]=this[c];break;case "transparency":if(b){a.transparent=true;a.opacity=this[c];b=true}}a.shading=pa;switch(this.type){case "constant":a.color=a.emission;this.material=new THREE.MeshBasicMaterial(a);break;case "phong":case "blinn":a.color=a.diffuse;this.material=new THREE.MeshPhongMaterial(a);break;default:a.color=a.diffuse;this.material=new THREE.MeshLambertMaterial(a)}return this.material};L.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=
|
|
|
+a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "init_from":this.init_from=c.textContent;break;case "format":this.format=c.textContent;break;default:console.log("unhandled Surface prop: "+c.nodeName)}}return this};T.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "source":this.source=c.textContent;break;case "minfilter":this.minfilter=c.textContent;break;case "magfilter":this.magfilter=c.textContent;break;case "mipfilter":this.mipfilter=
|
|
|
+c.textContent;break;case "wrap_s":this.wrap_s=c.textContent;break;case "wrap_t":this.wrap_t=c.textContent;break;default:console.log("unhandled Sampler2D prop: "+c.nodeName)}}return this};P.prototype.create=function(){if(this.shader==null)return null};P.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.shader=null;for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "profile_COMMON":this.parseTechnique(this.parseProfileCOMMON(c))}}return this};
|
|
|
+P.prototype.parseNewparam=function(a){for(var b=a.getAttribute("sid"),c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "surface":this.surface=(new L(this)).parse(d);this.surface.sid=b;break;case "sampler2D":this.sampler=(new T(this)).parse(d);this.sampler.sid=b;break;case "extra":break;default:console.log(d.nodeName)}}};P.prototype.parseProfileCOMMON=function(a){for(var b,c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "profile_COMMON":this.parseProfileCOMMON(d);
|
|
|
+break;case "technique":b=d;break;case "newparam":this.parseNewparam(d);break;case "image":d=(new g).parse(d);Ha[d.id]=d;break;case "extra":break;default:console.log(d.nodeName)}}return b};P.prototype.parseTechnique=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "constant":case "lambert":case "blinn":case "phong":this.shader=(new K(c.nodeName,this)).parse(c)}}};J.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,
|
|
|
+"");return this};N.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.source={};for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "animation":var c=(new N).parse(c),d;for(d in c.source)this.source[d]=c.source[d];for(var e=0;e<c.channel.length;e++){this.channel.push(c.channel[e]);this.sampler.push(c.sampler[e])}break;case "source":d=(new w).parse(c);this.source[d.id]=d;break;case "sampler":this.sampler.push((new i(this)).parse(c));
|
|
|
+break;case "channel":this.channel.push((new F(this)).parse(c))}}return this};F.prototype.parse=function(a){this.source=a.getAttribute("source").replace(/^#/,"");this.target=a.getAttribute("target");var b=this.target.split("/");b.shift();var a=b.shift(),c=a.indexOf(".")>=0,d=a.indexOf("(")>=0;if(c){b=a.split(".");this.sid=b.shift();this.member=b.shift()}else if(d){b=a.split("(");this.sid=b.shift();for(var e=0;e<b.length;e++)b[e]=parseInt(b[e].replace(/\)/,""));this.arrIndices=b}else this.sid=a;this.fullSid=
|
|
|
+a;this.dotSyntax=c;this.arrSyntax=d;return this};i.prototype.parse=function(a){this.id=a.getAttribute("id");this.inputs=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "input":this.inputs.push((new B).parse(c))}}return this};i.prototype.create=function(){for(var a=0;a<this.inputs.length;a++){var b=this.inputs[a],c=this.animation.source[b.source];switch(b.semantic){case "INPUT":this.input=c.read();break;case "OUTPUT":this.output=c.read();this.strideOut=
|
|
|
+c.accessor.stride;break;case "INTERPOLATION":this.interpolation=c.read();break;case "IN_TANGENT":break;case "OUT_TANGENT":break;default:console.log(b.semantic)}}this.duration=this.endTime=this.startTime=0;if(this.input.length){this.startTime=1E8;this.endTime=-1E8;for(a=0;a<this.input.length;a++){this.startTime=Math.min(this.startTime,this.input[a]);this.endTime=Math.max(this.endTime,this.input[a])}this.duration=this.endTime-this.startTime}};i.prototype.getData=function(a,b){var c;if(a==="matrix"&&
|
|
|
+this.strideOut===16)c=this.output[b];else if(this.strideOut>1){c=[];for(var b=b*this.strideOut,d=0;d<this.strideOut;++d)c[d]=this.output[b+d];if(this.strideOut===3)switch(a){case "rotate":case "translate":R(c,-1);break;case "scale":R(c,1)}else this.strideOut===4&&a==="matrix"&&R(c,-1)}else c=this.output[b];return c};U.prototype.addTarget=function(a,b,c,d){this.targets.push({sid:a,member:c,transform:b,data:d})};U.prototype.apply=function(a){for(var b=0;b<this.targets.length;++b){var c=this.targets[b];
|
|
|
+(!a||c.sid===a)&&c.transform.update(c.data,c.member)}};U.prototype.getTarget=function(a){for(var b=0;b<this.targets.length;++b)if(this.targets[b].sid===a)return this.targets[b];return null};U.prototype.hasTarget=function(a){for(var b=0;b<this.targets.length;++b)if(this.targets[b].sid===a)return true;return false};U.prototype.interpolate=function(a,b){for(var c=0;c<this.targets.length;++c){var d=this.targets[c],e=a.getTarget(d.sid);if(d.transform.type!=="matrix"&&e){var f=(b-this.time)/(a.time-this.time),
|
|
|
+g=e.data,h=d.data;if(f<0||f>1){console.log("Key.interpolate: Warning! Scale out of bounds:"+f);f=f<0?0:1}if(h.length)for(var e=[],i=0;i<h.length;++i)e[i]=h[i]+(g[i]-h[i])*f;else e=h+(g-h)*f}else e=d.data;d.transform.update(e,d.member)}};E.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "optics":this.parseOptics(c)}}return this};E.prototype.parseOptics=function(a){for(var b=
|
|
|
+0;b<a.childNodes.length;b++)if(a.childNodes[b].nodeName=="technique_common")for(var c=a.childNodes[b],d=0;d<c.childNodes.length;d++){this.technique=c.childNodes[d].nodeName;if(this.technique=="perspective")for(var e=c.childNodes[d],f=0;f<e.childNodes.length;f++){var g=e.childNodes[f];switch(g.nodeName){case "yfov":this.yfov=g.textContent;break;case "xfov":this.xfov=g.textContent;break;case "znear":this.znear=g.textContent;break;case "zfar":this.zfar=g.textContent;break;case "aspect_ratio":this.aspect_ratio=
|
|
|
+g.textContent}}else if(this.technique=="orthographic"){e=c.childNodes[d];for(f=0;f<e.childNodes.length;f++){g=e.childNodes[f];switch(g.nodeName){case "xmag":this.xmag=g.textContent;break;case "ymag":this.ymag=g.textContent;break;case "znear":this.znear=g.textContent;break;case "zfar":this.zfar=g.textContent;break;case "aspect_ratio":this.aspect_ratio=g.textContent}}}}return this};H.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};return{load:function(b,c,d){var e=
|
|
|
+0;if(document.implementation&&document.implementation.createDocument){var f=new XMLHttpRequest;f.overrideMimeType&&f.overrideMimeType("text/xml");f.onreadystatechange=function(){if(f.readyState==4){if(f.status==0||f.status==200)if(f.responseXML){sa=c;a(f.responseXML,void 0,b)}else console.error("ColladaLoader: Empty or non-existing file ("+b+")")}else if(f.readyState==3&&d){e==0&&(e=f.getResponseHeader("Content-Length"));d({total:e,loaded:f.responseText.length})}};f.open("GET",b,true);f.send(null)}else alert("Don't know how to parse XML!")},
|
|
|
+parse:a,setPreferredShading:function(a){pa=a},applySkin:e,geometries:Ya,options:Ia}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;THREE.JSONLoader.prototype.load=function(a,b,c){c=c?c:this.extractUrlBase(a);this.onLoadStart();this.loadAjaxJSON(this,a,b,c)};
|
|
|
THREE.JSONLoader.prototype.loadAjaxJSON=function(a,b,c,d,e){var f=new XMLHttpRequest,g=0;f.onreadystatechange=function(){if(f.readyState===f.DONE)if(f.status===200||f.status===0){if(f.responseText){var h=JSON.parse(f.responseText);a.createModel(h,c,d)}else console.warn("THREE.JSONLoader: ["+b+"] seems to be unreachable or file there is empty");a.onLoadComplete()}else console.error("THREE.JSONLoader: Couldn't load ["+b+"] ["+f.status+"]");else if(f.readyState===f.LOADING){if(e){g===0&&(g=f.getResponseHeader("Content-Length"));
|
|
|
e({total:g,loaded:f.responseText.length})}}else f.readyState===f.HEADERS_RECEIVED&&(g=f.getResponseHeader("Content-Length"))};f.open("GET",b,true);f.overrideMimeType&&f.overrideMimeType("text/plain; charset=x-user-defined");f.setRequestHeader("Content-Type","text/plain");f.send(null)};
|
|
|
-THREE.JSONLoader.prototype.createModel=function(a,b,c){var d=new THREE.Geometry,e=a.scale!==void 0?1/a.scale:1;this.initMaterials(d,a.materials,c);(function(b){var c,e,j,k,l,p,m,o,r,n,q,u,t,y,s=a.faces;p=a.vertices;var x=a.normals,D=a.colors,B=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&B++;for(c=0;c<B;c++){d.faceUvs[c]=[];d.faceVertexUvs[c]=[]}k=0;for(l=p.length;k<l;){m=new THREE.Vertex;m.position.x=p[k++]*b;m.position.y=p[k++]*b;m.position.z=p[k++]*b;d.vertices.push(m)}k=0;for(l=s.length;k<l;){b=
|
|
|
-s[k++];p=b&1;j=b&2;c=b&4;e=b&8;o=b&16;m=b&32;n=b&64;b=b&128;if(p){q=new THREE.Face4;q.a=s[k++];q.b=s[k++];q.c=s[k++];q.d=s[k++];p=4}else{q=new THREE.Face3;q.a=s[k++];q.b=s[k++];q.c=s[k++];p=3}if(j){j=s[k++];q.materialIndex=j}j=d.faces.length;if(c)for(c=0;c<B;c++){u=a.uvs[c];r=s[k++];y=u[r*2];r=u[r*2+1];d.faceUvs[c][j]=new THREE.UV(y,r)}if(e)for(c=0;c<B;c++){u=a.uvs[c];t=[];for(e=0;e<p;e++){r=s[k++];y=u[r*2];r=u[r*2+1];t[e]=new THREE.UV(y,r)}d.faceVertexUvs[c][j]=t}if(o){o=s[k++]*3;e=new THREE.Vector3;
|
|
|
-e.x=x[o++];e.y=x[o++];e.z=x[o];q.normal=e}if(m)for(c=0;c<p;c++){o=s[k++]*3;e=new THREE.Vector3;e.x=x[o++];e.y=x[o++];e.z=x[o];q.vertexNormals.push(e)}if(n){m=s[k++];m=new THREE.Color(D[m]);q.color=m}if(b)for(c=0;c<p;c++){m=s[k++];m=new THREE.Color(D[m]);q.vertexColors.push(m)}d.faces.push(q)}})(e);(function(){var b,c,e,j;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b=b+2){e=a.skinWeights[b];j=a.skinWeights[b+1];d.skinWeights.push(new THREE.Vector4(e,j,0,0))}}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<
|
|
|
-c;b=b+2){e=a.skinIndices[b];j=a.skinIndices[b+1];d.skinIndices.push(new THREE.Vector4(e,j,0,0))}}d.bones=a.bones;d.animation=a.animation})();(function(b){if(a.morphTargets!==void 0){var c,e,j,k,l,p,m,o,r;c=0;for(e=a.morphTargets.length;c<e;c++){d.morphTargets[c]={};d.morphTargets[c].name=a.morphTargets[c].name;d.morphTargets[c].vertices=[];o=d.morphTargets[c].vertices;r=a.morphTargets[c].vertices;j=0;for(k=r.length;j<k;j=j+3){l=r[j]*b;p=r[j+1]*b;m=r[j+2]*b;o.push(new THREE.Vertex(new THREE.Vector3(l,
|
|
|
-p,m)))}}}if(a.morphColors!==void 0){c=0;for(e=a.morphColors.length;c<e;c++){d.morphColors[c]={};d.morphColors[c].name=a.morphColors[c].name;d.morphColors[c].colors=[];k=d.morphColors[c].colors;l=a.morphColors[c].colors;b=0;for(j=l.length;b<j;b=b+3){p=new THREE.Color(16755200);p.setRGB(l[b],l[b+1],l[b+2]);k.push(p)}}}})(e);d.computeCentroids();d.computeFaceNormals();this.hasNormals(d)&&d.computeTangents();b(d)};
|
|
|
+THREE.JSONLoader.prototype.createModel=function(a,b,c){var d=new THREE.Geometry,e=a.scale!==void 0?1/a.scale:1;this.initMaterials(d,a.materials,c);(function(b){var c,e,j,k,l,p,m,o,r,n,q,u,t,y,s=a.faces;p=a.vertices;var x=a.normals,D=a.colors,B=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&B++;for(c=0;c<B;c++){d.faceUvs[c]=[];d.faceVertexUvs[c]=[]}k=0;for(l=p.length;k<l;){m=new THREE.Vertex;m.x=p[k++]*b;m.y=p[k++]*b;m.z=p[k++]*b;d.vertices.push(m)}k=0;for(l=s.length;k<l;){b=s[k++];p=b&1;j=b&2;c=b&
|
|
|
+4;e=b&8;o=b&16;m=b&32;n=b&64;b=b&128;if(p){q=new THREE.Face4;q.a=s[k++];q.b=s[k++];q.c=s[k++];q.d=s[k++];p=4}else{q=new THREE.Face3;q.a=s[k++];q.b=s[k++];q.c=s[k++];p=3}if(j){j=s[k++];q.materialIndex=j}j=d.faces.length;if(c)for(c=0;c<B;c++){u=a.uvs[c];r=s[k++];y=u[r*2];r=u[r*2+1];d.faceUvs[c][j]=new THREE.UV(y,r)}if(e)for(c=0;c<B;c++){u=a.uvs[c];t=[];for(e=0;e<p;e++){r=s[k++];y=u[r*2];r=u[r*2+1];t[e]=new THREE.UV(y,r)}d.faceVertexUvs[c][j]=t}if(o){o=s[k++]*3;e=new THREE.Vector3;e.x=x[o++];e.y=x[o++];
|
|
|
+e.z=x[o];q.normal=e}if(m)for(c=0;c<p;c++){o=s[k++]*3;e=new THREE.Vector3;e.x=x[o++];e.y=x[o++];e.z=x[o];q.vertexNormals.push(e)}if(n){m=s[k++];m=new THREE.Color(D[m]);q.color=m}if(b)for(c=0;c<p;c++){m=s[k++];m=new THREE.Color(D[m]);q.vertexColors.push(m)}d.faces.push(q)}})(e);(function(){var b,c,e,j;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b=b+2){e=a.skinWeights[b];j=a.skinWeights[b+1];d.skinWeights.push(new THREE.Vector4(e,j,0,0))}}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<c;b=
|
|
|
+b+2){e=a.skinIndices[b];j=a.skinIndices[b+1];d.skinIndices.push(new THREE.Vector4(e,j,0,0))}}d.bones=a.bones;d.animation=a.animation})();(function(b){if(a.morphTargets!==void 0){var c,e,j,k,l,p,m,o,r;c=0;for(e=a.morphTargets.length;c<e;c++){d.morphTargets[c]={};d.morphTargets[c].name=a.morphTargets[c].name;d.morphTargets[c].vertices=[];o=d.morphTargets[c].vertices;r=a.morphTargets[c].vertices;j=0;for(k=r.length;j<k;j=j+3){l=r[j]*b;p=r[j+1]*b;m=r[j+2]*b;o.push(new THREE.Vertex(l,p,m))}}}if(a.morphColors!==
|
|
|
+void 0){c=0;for(e=a.morphColors.length;c<e;c++){d.morphColors[c]={};d.morphColors[c].name=a.morphColors[c].name;d.morphColors[c].colors=[];k=d.morphColors[c].colors;l=a.morphColors[c].colors;b=0;for(j=l.length;b<j;b=b+3){p=new THREE.Color(16755200);p.setRGB(l[b],l[b+1],l[b+2]);k.push(p)}}}})(e);d.computeCentroids();d.computeFaceNormals();this.hasNormals(d)&&d.computeTangents();b(d)};
|
|
|
THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};THREE.SceneLoader.prototype.constructor=THREE.SceneLoader;
|
|
|
THREE.SceneLoader.prototype.load=function(a,b){var c=this,d=new XMLHttpRequest;d.onreadystatechange=function(){if(d.readyState==4)if(d.status==200||d.status==0){var e=JSON.parse(d.responseText);c.createScene(e,b,a)}else console.error("THREE.SceneLoader: Couldn't load ["+a+"] ["+d.status+"]")};d.open("GET",a,true);d.overrideMimeType&&d.overrideMimeType("text/plain; charset=x-user-defined");d.setRequestHeader("Content-Type","text/plain");d.send(null)};
|
|
|
THREE.SceneLoader.prototype.createScene=function(a,b,c){function d(a,b){return b=="relativeToHTML"?a:k+"/"+a}function e(){var a;for(m in P.objects)if(!E.objects[m]){u=P.objects[m];if(u.geometry!==void 0){if(C=E.geometries[u.geometry]){a=false;K=E.materials[u.materials[0]];(a=K instanceof THREE.ShaderMaterial)&&C.computeTangents();s=u.position;x=u.rotation;D=u.quaternion;B=u.scale;D=0;u.materials.length==0&&(K=new THREE.MeshFaceMaterial);u.materials.length>1&&(K=new THREE.MeshFaceMaterial);a=new THREE.Mesh(C,
|
|
@@ -750,9 +747,9 @@ n=q.parameters.color;T=q.parameters.specular;c=q.parameters.ambient;J=q.paramete
|
|
|
true}l.uDiffuseColor.value.setHex(n);l.uSpecularColor.value.setHex(T);l.uAmbientColor.value.setHex(c);l.uShininess.value=J;if(q.parameters.opacity)l.uOpacity.value=q.parameters.opacity;K=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:l,lights:true,fog:true})}else K=new THREE[q.type](q.parameters);E.materials[p]=K}e();j.callbackSync(E);h()};THREE.UTF8Loader=function(){};
|
|
|
THREE.UTF8Loader.prototype.load=function(a,b,c){var d=new XMLHttpRequest,e=c.scale!==void 0?c.scale:1,f=c.offsetX!==void 0?c.offsetX:0,g=c.offsetY!==void 0?c.offsetY:0,h=c.offsetZ!==void 0?c.offsetZ:0;d.onreadystatechange=function(){d.readyState==4?d.status==200||d.status==0?THREE.UTF8Loader.prototype.createModel(d.responseText,b,e,f,g,h):console.error("THREE.UTF8Loader: Couldn't load ["+a+"] ["+d.status+"]"):d.readyState!=3&&d.readyState==2&&d.getResponseHeader("Content-Length")};d.open("GET",a,
|
|
|
true);d.send(null)};THREE.UTF8Loader.prototype.decompressMesh=function(a){var b=a.charCodeAt(0);b>=57344&&(b=b-2048);b++;for(var c=new Float32Array(8*b),d=1,e=0;e<8;e++){for(var f=0,g=0;g<b;++g){var h=a.charCodeAt(g+d),f=f+(h>>1^-(h&1));c[8*g+e]=f}d=d+b}b=a.length-d;f=new Uint16Array(b);for(e=g=0;e<b;e++){h=a.charCodeAt(e+d);f[e]=g-h;h==0&&g++}return[c,f]};
|
|
|
-THREE.UTF8Loader.prototype.createModel=function(a,b,c,d,e,f){var g=function(){var b=this;b.materials=[];THREE.Geometry.call(this);var g=THREE.UTF8Loader.prototype.decompressMesh(a),k=[],l=[];(function(a,g,j){for(var k,l,q,u=a.length;j<u;j=j+g){k=a[j];l=a[j+1];q=a[j+2];k=k/16383*c;l=l/16383*c;q=q/16383*c;k=k+d;l=l+e;q=q+f;b.vertices.push(new THREE.Vertex(new THREE.Vector3(k,l,q)))}})(g[0],8,0);(function(a,b,c){for(var d,e,f=a.length;c<f;c=c+b){d=a[c];e=a[c+1];d=d/1023;e=e/1023;l.push(d,1-e)}})(g[0],
|
|
|
-8,3);(function(a,b,c){for(var d,e,f,g=a.length;c<g;c=c+b){d=a[c];e=a[c+1];f=a[c+2];d=(d-512)/511;e=(e-512)/511;f=(f-512)/511;k.push(d,e,f)}})(g[0],8,5);(function(a){var c,d,e,f,g,j,t,y,s,x=a.length;for(c=0;c<x;c=c+3){d=a[c];e=a[c+1];f=a[c+2];g=b;y=d;s=e;j=f;var D=k[e*3],B=k[e*3+1],w=k[e*3+2],v=k[f*3],C=k[f*3+1],K=k[f*3+2];t=new THREE.Vector3(k[d*3],k[d*3+1],k[d*3+2]);D=new THREE.Vector3(D,B,w);v=new THREE.Vector3(v,C,K);g.faces.push(new THREE.Face3(y,s,j,[t,D,v],null,0));g=l[d*2];d=l[d*2+1];j=l[e*
|
|
|
-2];t=l[e*2+1];y=l[f*2];s=l[f*2+1];f=b.faceVertexUvs[0];e=j;j=t;t=[];t.push(new THREE.UV(g,d));t.push(new THREE.UV(e,j));t.push(new THREE.UV(y,s));f.push(t)}})(g[1]);this.computeCentroids();this.computeFaceNormals()};g.prototype=new THREE.Geometry;g.prototype.constructor=g;b(new g)};THREE.ImmediateRenderObject=function(){THREE.Object3D.call(this);this.render=function(){}};THREE.ImmediateRenderObject.prototype=new THREE.Object3D;THREE.ImmediateRenderObject.prototype.constructor=THREE.ImmediateRenderObject;
|
|
|
+THREE.UTF8Loader.prototype.createModel=function(a,b,c,d,e,f){var g=function(){var b=this;b.materials=[];THREE.Geometry.call(this);var g=THREE.UTF8Loader.prototype.decompressMesh(a),k=[],l=[];(function(a,g,j){for(var k,l,q,u=a.length;j<u;j=j+g){k=a[j];l=a[j+1];q=a[j+2];k=k/16383*c;l=l/16383*c;q=q/16383*c;k=k+d;l=l+e;q=q+f;b.vertices.push(new THREE.Vertex(k,l,q))}})(g[0],8,0);(function(a,b,c){for(var d,e,f=a.length;c<f;c=c+b){d=a[c];e=a[c+1];d=d/1023;e=e/1023;l.push(d,1-e)}})(g[0],8,3);(function(a,
|
|
|
+b,c){for(var d,e,f,g=a.length;c<g;c=c+b){d=a[c];e=a[c+1];f=a[c+2];d=(d-512)/511;e=(e-512)/511;f=(f-512)/511;k.push(d,e,f)}})(g[0],8,5);(function(a){var c,d,e,f,g,j,t,y,s,x=a.length;for(c=0;c<x;c=c+3){d=a[c];e=a[c+1];f=a[c+2];g=b;y=d;s=e;j=f;var D=k[e*3],B=k[e*3+1],w=k[e*3+2],v=k[f*3],C=k[f*3+1],K=k[f*3+2];t=new THREE.Vector3(k[d*3],k[d*3+1],k[d*3+2]);D=new THREE.Vector3(D,B,w);v=new THREE.Vector3(v,C,K);g.faces.push(new THREE.Face3(y,s,j,[t,D,v],null,0));g=l[d*2];d=l[d*2+1];j=l[e*2];t=l[e*2+1];y=
|
|
|
+l[f*2];s=l[f*2+1];f=b.faceVertexUvs[0];e=j;j=t;t=[];t.push(new THREE.UV(g,d));t.push(new THREE.UV(e,j));t.push(new THREE.UV(y,s));f.push(t)}})(g[1]);this.computeCentroids();this.computeFaceNormals()};g.prototype=new THREE.Geometry;g.prototype.constructor=g;b(new g)};THREE.ImmediateRenderObject=function(){THREE.Object3D.call(this);this.render=function(){}};THREE.ImmediateRenderObject.prototype=new THREE.Object3D;THREE.ImmediateRenderObject.prototype.constructor=THREE.ImmediateRenderObject;
|
|
|
THREE.LensFlare=function(a,b,c,d,e){THREE.Object3D.call(this);this.lensFlares=[];this.positionScreen=new THREE.Vector3;this.customUpdateCallback=void 0;a!==void 0&&this.add(a,b,c,d,e)};THREE.LensFlare.prototype=new THREE.Object3D;THREE.LensFlare.prototype.constructor=THREE.LensFlare;THREE.LensFlare.prototype.supr=THREE.Object3D.prototype;
|
|
|
THREE.LensFlare.prototype.add=function(a,b,c,d,e,f){b===void 0&&(b=-1);c===void 0&&(c=0);f===void 0&&(f=1);e===void 0&&(e=new THREE.Color(16777215));if(d===void 0)d=THREE.NormalBlending;c=Math.min(c,Math.max(0,c));this.lensFlares.push({texture:a,size:b,distance:c,x:0,y:0,z:0,scale:1,rotation:1,opacity:f,color:e,blending:d})};
|
|
|
THREE.LensFlare.prototype.updateLensFlares=function(){var a,b=this.lensFlares.length,c,d=-this.positionScreen.x*2,e=-this.positionScreen.y*2;for(a=0;a<b;a++){c=this.lensFlares[a];c.x=this.positionScreen.x+d*c.distance;c.y=this.positionScreen.y+e*c.distance;c.wantedRotation=c.x*Math.PI*0.25;c.rotation=c.rotation+(c.wantedRotation-c.rotation)*0.25}};
|