|
@@ -445,8 +445,8 @@ THREE.Path.prototype.createPathGeometry=function(b,c){var e=this.getPoints(b),f,
|
|
|
THREE.Path.prototype.transform=function(b){b=new THREE.Path;b.moveTo(0,0);b.quadraticCurveTo(100,20,140,80);console.log(b.cacheArcLengths());var c=this.getMinAndMax(),e=this.getPoints(),f,g,h,j,m,n;f=0;for(g=e.length;f<g;f++)h=e[f],j=h.x,m=h.y,n=j/c.maxX,j=b.getPoint(n),m=b.getNormalVector(n).multiplyScalar(m),h.x=j.x+m.x,h.y=j.y+m.y;return e};
|
|
|
THREE.Path.prototype.nltransform=function(b,c,e,f,g,h){var j=this.getPoints(),m,n,p,o,t;m=0;for(n=j.length;m<n;m++)p=j[m],o=p.x,t=p.y,p.x=b*o+c*t+e,p.y=f*t+g*o+h;return j};
|
|
|
THREE.Path.prototype.debug=function(b){var c=this.getMinAndMax();b||(b=document.createElement("canvas"),b.setAttribute("width",c.maxX+100),b.setAttribute("height",c.maxY+100),document.body.appendChild(b));c=b.getContext("2d");c.fillStyle="white";c.fillRect(0,0,b.width,b.height);c.strokeStyle="black";c.beginPath();var e,f,g,b=0;for(e=this.actions.length;b<e;b++)f=this.actions[b],g=f.args,f=f.action,f!=THREE.PathActions.CSPLINE_THRU&&c[f].apply(c,g);c.stroke();c.closePath();c.strokeStyle="red";f=this.transform(0.866,
|
|
|
--0.866,0,0.5,0.5,-50);b=0;for(e=f.length;b<e;b++)g=f[b],c.beginPath(),c.arc(g.x,g.y,1.5,0,Math.PI*2,!1),c.stroke(),c.closePath()};THREE.Shape=function(){THREE.Path.apply(this,arguments);this.holes=[]};THREE.Shape.prototype=new THREE.Path;THREE.Shape.prototype.constructor=THREE.Path;THREE.Shape.prototype.extrude=function(b){return new THREE.ExtrudeGeometry(this,b)};
|
|
|
-THREE.Shape.prototype.getHoles=function(b){var b=b?"getSpacedPoints":"getPoints",c,e=this.holes.length,f=[];for(c=0;c<e;c++)f[c]=this.holes[c][b]();return f};THREE.Shape.prototype.extractAllPoints=function(b){return{shape:this[b?"getSpacedPoints":"getPoints"](),holes:this.getHoles(b)}};
|
|
|
+-0.866,0,0.5,0.5,-50);b=0;for(e=f.length;b<e;b++)g=f[b],c.beginPath(),c.arc(g.x,g.y,1.5,0,Math.PI*2,!1),c.stroke(),c.closePath()};THREE.Shape=function(){THREE.Path.apply(this,arguments);this.holes=[]};THREE.Shape.prototype=new THREE.Path;THREE.Shape.prototype.constructor=THREE.Path;THREE.Shape.prototype.extrude=function(b){return new THREE.ExtrudeGeometry(this,b)};THREE.Shape.prototype.getPointsHoles=function(){var b,c=this.holes.length,e=[];for(b=0;b<c;b++)e[b]=this.holes[b].getPoints();return e};
|
|
|
+THREE.Shape.prototype.getSpacedPointsHoles=function(){var b,c=this.holes.length,e=[];for(b=0;b<c;b++)e[b]=this.holes[b].getSpacedPoints();return e};THREE.Shape.prototype.extractAllPoints=function(){return{shape:this.getPoints(),holes:this.getPointsHoles()}};THREE.Shape.prototype.extractAllSpacedPoints=function(){return{shape:this.getSpacedPoints(),holes:this.getSpacedPointsHoles()}};
|
|
|
THREE.Shape.Utils={removeHoles:function(b,c){var e=b.concat(),f=e.concat(),g,h,j,m,n,p,o,t,u,v,w=[];for(n=0;n<c.length;n++){p=c[n];f=f.concat(p);h=Number.POSITIVE_INFINITY;for(g=0;g<p.length;g++){u=p[g];v=[];for(t=0;t<e.length;t++)o=e[t],o=u.distanceTo(o),v.push(o),o<h&&(h=o,j=g,m=t)}g=m-1>=0?m-1:e.length-1;h=j-1>=0?j-1:p.length-1;var z=[p[j],e[m],e[g]];t=THREE.FontUtils.Triangulate.area(z);var x=[p[j],p[h],e[m]];u=THREE.FontUtils.Triangulate.area(x);v=m;o=j;m+=1;j+=-1;m<0&&(m+=e.length);m%=e.length;
|
|
|
j<0&&(j+=p.length);j%=p.length;g=m-1>=0?m-1:e.length-1;h=j-1>=0?j-1:p.length-1;z=[p[j],e[m],e[g]];z=THREE.FontUtils.Triangulate.area(z);x=[p[j],p[h],e[m]];x=THREE.FontUtils.Triangulate.area(x);t+u>z+x&&(m=v,j=o,m<0&&(m+=e.length),m%=e.length,j<0&&(j+=p.length),j%=p.length,g=m-1>=0?m-1:e.length-1,h=j-1>=0?j-1:p.length-1);t=e.slice(0,m);u=e.slice(m);v=p.slice(j);o=p.slice(0,j);h=[p[j],p[h],e[m]];w.push([p[j],e[m],e[g]]);w.push(h);e=t.concat(v).concat(o).concat(u)}return{shape:e,isolatedPts:w,allpoints:f}},
|
|
|
triangulateShape:function(b,c){var e=THREE.Shape.Utils.removeHoles(b,c),f=e.allpoints,g=e.isolatedPts,e=THREE.FontUtils.Triangulate(e.shape,!1),h,j,m,n;for(h=0;h<e.length;h++){n=e[h];for(j=0;j<3;j++)for(m=0;m<f.length;m++)f[m].equals(n[j])&&(n[j]=m)}for(h=0;h<g.length;h++){n=g[h];for(j=0;j<3;j++)for(m=0;m<f.length;m++)f[m].equals(n[j])&&(n[j]=m)}return e.concat(g)},isClockWise:function(b){return THREE.FontUtils.Triangulate.area(b)<0}};
|
|
@@ -458,10 +458,10 @@ THREE.CylinderGeometry=function(b,c,e,f,g,h){function j(b,e,c){m.vertices.push(n
|
|
|
(g||0));for(n=b+b/2;n<2*b;n++)m.faces.push(new THREE.Face4(2*b+1,(2*n-2*b+2)%b+b,(2*n-2*b+1)%b+b,(2*n-2*b)%b+b))}n=0;for(b=this.faces.length;n<b;n++){var c=[],e=this.faces[n],g=this.vertices[e.a],h=this.vertices[e.b],o=this.vertices[e.c],t=this.vertices[e.d];c.push(new THREE.UV(0.5+Math.atan2(g.position.x,g.position.y)/p,0.5+g.position.z/f));c.push(new THREE.UV(0.5+Math.atan2(h.position.x,h.position.y)/p,0.5+h.position.z/f));c.push(new THREE.UV(0.5+Math.atan2(o.position.x,o.position.y)/p,0.5+o.position.z/
|
|
|
f));e instanceof THREE.Face4&&c.push(new THREE.UV(0.5+Math.atan2(t.position.x,t.position.y)/p,0.5+t.position.z/f));this.faceVertexUvs[0].push(c)}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
|
|
|
THREE.ExtrudeGeometry=function(b,c){function e(b,e,c,f){b=b.clone().subSelf(e);c/=b.length();return b.multiplyScalar(f?1+c:1-c).addSelf(e)}function f(b){for(B=b.length;--B>=0;){k=B;V=B-1;V<0&&(V=b.length-1);for(var e=0,e=0;e<t+o*2;e++){var c=S*e,f=S*(e+1);F.faces.push(new THREE.Face4(O+k+c,O+V+c,O+V+f,O+k+f))}}}function g(b,e,c){F.vertices.push(new THREE.Vertex(new THREE.Vector3(b,e,c)))}function h(b,e,c){F.faces.push(new THREE.Face3(b,e,c))}var j=c.amount!==void 0?c.amount:100,m=c.bevelThickness!==
|
|
|
-void 0?c.bevelThickness:8,n=c.bevelSize!==void 0?c.bevelSize:m,p=c.bevelEnabled!==void 0?c.bevelEnabled:!0,o=c.bevelSegments!==void 0?c.bevelSegments:3;p||(o=0);var t=c.steps!==void 0?c.steps:1,u=c.path!==void 0?c.path:null,v,w=!1;if(u)v=u.getPoints(),t=v.length,w=!0;THREE.Geometry.call(this);var z,x,y,F=this,u=b.extractAllPoints(!1),C=u.shape,u=u.holes,E=!THREE.Shape.Utils.isClockWise(C);if(E){C=C.reverse();x=0;for(y=u.length;x<y;x++)z=u[x],THREE.Shape.Utils.isClockWise(z)&&(u[x]=z.reverse());E=
|
|
|
-!1}var E=THREE.Shape.Utils.triangulateShape(C,u),G=C;x=0;for(y=u.length;x<y;x++)z=u[x],C=C.concat(z);var B,P,I=new THREE.Vector2;B=0;for(P=G.length;B<P;B++)I.addSelf(G[B]);var H=I.divideScalar(G.length),T=[];x=0;for(y=u.length;x<y;x++){I=new THREE.Vector2;z=u[x];B=0;for(P=z.length;B<P;B++)I.addSelf(z[B]);T[x]=I.divideScalar(z.length)}var U,J,Y,K,S=C.length,I=E.length;for(U=o;U>0;U--){z=U/o;Y=m*z;J=n*(1-Math.sin((1-z)*Math.PI/2));B=0;for(P=G.length;B<P;B++)K=e(G[B],H,J,!1),g(K.x,K.y,-Y);x=0;for(y=
|
|
|
-u.length;x<y;x++){z=u[x];B=0;for(P=z.length;B<P;B++)K=e(z[B],T[x],J,!0),g(K.x,K.y,-Y)}}for(B=0;B<S;B++)K=C[B],w?g(K.x,K.y+v[0].y,v[0].x):g(K.x,K.y,0);for(z=1;z<=t;z++)for(B=0;B<S;B++)K=C[B],w?g(K.x,K.y+v[z-1].y,v[z-1].x):g(K.x,K.y,j/t*z);for(U=1;U<=o;U++){z=U/o;Y=m*z;J=n*(1-Math.sin((1-z)*Math.PI/2));B=0;for(P=G.length;B<P;B++)K=e(G[B],H,J,!1),g(K.x,K.y,j+Y);x=0;for(y=u.length;x<y;x++){z=u[x];B=0;for(P=z.length;B<P;B++)K=e(z[B],T[x],J,!0),w?g(K.x,K.y+v[t-1].y,v[t-1].x+Y):g(K.x,K.y,j+Y)}}if(p){m=S*
|
|
|
-0;for(B=0;B<I;B++)j=E[B],h(j[2]+m,j[1]+m,j[0]+m);m=S*(t+o*2);for(B=0;B<I;B++)j=E[B],h(j[0]+m,j[1]+m,j[2]+m)}else{for(B=0;B<I;B++)j=E[B],h(j[2],j[1],j[0]);for(B=0;B<I;B++)j=E[B],h(j[0]+S*t,j[1]+S*t,j[2]+S*t)}var k,V,O=0;f(G);O+=G.length;x=0;for(y=u.length;x<y;x++)z=u[x],f(z),O+=z.length;this.computeCentroids();this.computeFaceNormals()};THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;
|
|
|
+void 0?c.bevelThickness:8,n=c.bevelSize!==void 0?c.bevelSize:m,p=c.bevelEnabled!==void 0?c.bevelEnabled:!0,o=c.bevelSegments!==void 0?c.bevelSegments:3;p||(o=0);var t=c.steps!==void 0?c.steps:1,u=c.path!==void 0?c.path:null,v,w=!1;if(u)v=u.getPoints(),t=v.length,w=!0;THREE.Geometry.call(this);var z,x,y,F=this,u=b.extractAllPoints(),C=u.shape,u=u.holes,E=!THREE.Shape.Utils.isClockWise(C);if(E){C=C.reverse();x=0;for(y=u.length;x<y;x++)z=u[x],THREE.Shape.Utils.isClockWise(z)&&(u[x]=z.reverse());E=!1}var E=
|
|
|
+THREE.Shape.Utils.triangulateShape(C,u),G=C;x=0;for(y=u.length;x<y;x++)z=u[x],C=C.concat(z);var B,P,I=new THREE.Vector2;B=0;for(P=G.length;B<P;B++)I.addSelf(G[B]);var H=I.divideScalar(G.length),T=[];x=0;for(y=u.length;x<y;x++){I=new THREE.Vector2;z=u[x];B=0;for(P=z.length;B<P;B++)I.addSelf(z[B]);T[x]=I.divideScalar(z.length)}var U,J,Y,K,S=C.length,I=E.length;for(U=o;U>0;U--){z=U/o;Y=m*z;J=n*(1-Math.sin((1-z)*Math.PI/2));B=0;for(P=G.length;B<P;B++)K=e(G[B],H,J,!1),g(K.x,K.y,-Y);x=0;for(y=u.length;x<
|
|
|
+y;x++){z=u[x];B=0;for(P=z.length;B<P;B++)K=e(z[B],T[x],J,!0),g(K.x,K.y,-Y)}}for(B=0;B<S;B++)K=C[B],w?g(K.x,K.y+v[0].y,v[0].x):g(K.x,K.y,0);for(z=1;z<=t;z++)for(B=0;B<S;B++)K=C[B],w?g(K.x,K.y+v[z-1].y,v[z-1].x):g(K.x,K.y,j/t*z);for(U=1;U<=o;U++){z=U/o;Y=m*z;J=n*(1-Math.sin((1-z)*Math.PI/2));B=0;for(P=G.length;B<P;B++)K=e(G[B],H,J,!1),g(K.x,K.y,j+Y);x=0;for(y=u.length;x<y;x++){z=u[x];B=0;for(P=z.length;B<P;B++)K=e(z[B],T[x],J,!0),w?g(K.x,K.y+v[t-1].y,v[t-1].x+Y):g(K.x,K.y,j+Y)}}if(p){m=S*0;for(B=0;B<
|
|
|
+I;B++)j=E[B],h(j[2]+m,j[1]+m,j[0]+m);m=S*(t+o*2);for(B=0;B<I;B++)j=E[B],h(j[0]+m,j[1]+m,j[2]+m)}else{for(B=0;B<I;B++)j=E[B],h(j[2],j[1],j[0]);for(B=0;B<I;B++)j=E[B],h(j[0]+S*t,j[1]+S*t,j[2]+S*t)}var k,V,O=0;f(G);O+=G.length;x=0;for(y=u.length;x<y;x++)z=u[x],f(z),O+=z.length;this.computeCentroids();this.computeFaceNormals()};THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;
|
|
|
THREE.IcosahedronGeometry=function(b){function c(b,e,c){var f=Math.sqrt(b*b+e*e+c*c);return g.vertices.push(new THREE.Vertex(new THREE.Vector3(b/f,e/f,c/f)))-1}function e(b,e,c,f){f.faces.push(new THREE.Face3(b,e,c))}function f(b,e){var f=g.vertices[b].position,h=g.vertices[e].position;return c((f.x+h.x)/2,(f.y+h.y)/2,(f.z+h.z)/2)}var g=this,h=new THREE.Geometry,j;this.subdivisions=b||0;THREE.Geometry.call(this);b=(1+Math.sqrt(5))/2;c(-1,b,0);c(1,b,0);c(-1,-b,0);c(1,-b,0);c(0,-1,b);c(0,1,b);c(0,-1,
|
|
|
-b);c(0,1,-b);c(b,0,-1);c(b,0,1);c(-b,0,-1);c(-b,0,1);e(0,11,5,h);e(0,5,1,h);e(0,1,7,h);e(0,7,10,h);e(0,10,11,h);e(1,5,9,h);e(5,11,4,h);e(11,10,2,h);e(10,7,6,h);e(7,1,8,h);e(3,9,4,h);e(3,4,2,h);e(3,2,6,h);e(3,6,8,h);e(3,8,9,h);e(4,9,5,h);e(2,4,11,h);e(6,2,10,h);e(8,6,7,h);e(9,8,1,h);for(b=0;b<this.subdivisions;b++){j=new THREE.Geometry;for(var m in h.faces){var n=f(h.faces[m].a,h.faces[m].b),p=f(h.faces[m].b,h.faces[m].c),o=f(h.faces[m].c,h.faces[m].a);e(h.faces[m].a,n,o,j);e(h.faces[m].b,p,n,j);
|
|
|
e(h.faces[m].c,o,p,j);e(n,p,o,j)}h.faces=j.faces}g.faces=h.faces;delete h;delete j;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
|
|
@@ -510,28 +510,28 @@ THREE.JSONLoader.prototype.createModel=function(b,c,e){var f=new THREE.Geometry,
|
|
|
t[p++]*e,u.position.z=t[p++]*e,f.vertices.push(u);p=0;for(o=E.length;p<o;){e=E[p++];t=e&1;n=e&2;c=e&4;g=e&8;v=e&16;u=e&32;z=e&64;e&=128;t?(x=new THREE.Face4,x.a=E[p++],x.b=E[p++],x.c=E[p++],x.d=E[p++],t=4):(x=new THREE.Face3,x.a=E[p++],x.b=E[p++],x.c=E[p++],t=3);if(n)n=E[p++],x.materials=f.materials[n];n=f.faces.length;if(c)for(c=0;c<P;c++)y=b.uvs[c],w=E[p++],C=y[w*2],w=y[w*2+1],f.faceUvs[c][n]=new THREE.UV(C,w);if(g)for(c=0;c<P;c++){y=b.uvs[c];F=[];for(g=0;g<t;g++)w=E[p++],C=y[w*2],w=y[w*2+1],F[g]=
|
|
|
new THREE.UV(C,w);f.faceVertexUvs[c][n]=F}if(v)v=E[p++]*3,g=new THREE.Vector3,g.x=G[v++],g.y=G[v++],g.z=G[v],x.normal=g;if(u)for(c=0;c<t;c++)v=E[p++]*3,g=new THREE.Vector3,g.x=G[v++],g.y=G[v++],g.z=G[v],x.vertexNormals.push(g);if(z)u=E[p++],u=new THREE.Color(B[u]),x.color=u;if(e)for(c=0;c<t;c++)u=E[p++],u=new THREE.Color(B[u]),x.vertexColors.push(u);f.faces.push(x)}}})(g);(function(){var c,e,g,n;if(b.skinWeights){c=0;for(e=b.skinWeights.length;c<e;c+=2)g=b.skinWeights[c],n=b.skinWeights[c+1],f.skinWeights.push(new THREE.Vector4(g,
|
|
|
n,0,0))}if(b.skinIndices){c=0;for(e=b.skinIndices.length;c<e;c+=2)g=b.skinIndices[c],n=b.skinIndices[c+1],f.skinIndices.push(new THREE.Vector4(g,n,0,0))}f.bones=b.bones;f.animation=b.animation})();(function(c){if(b.morphTargets!==void 0){var e,g,n,p,o,t,u,v,w;e=0;for(g=b.morphTargets.length;e<g;e++){f.morphTargets[e]={};f.morphTargets[e].name=b.morphTargets[e].name;f.morphTargets[e].vertices=[];v=f.morphTargets[e].vertices;w=b.morphTargets[e].vertices;n=0;for(p=w.length;n<p;n+=3)o=w[n]*c,t=w[n+1]*
|
|
|
-c,u=w[n+2]*c,v.push(new THREE.Vertex(new THREE.Vector3(o,t,u)))}}if(b.morphColors!==void 0){e=0;for(g=b.morphColors.length;e<g;e++){f.morphColors[e]={};f.morphColors[e].name=b.morphColors[e].name;f.morphColors[e].colors=[];p=f.morphColors[e].colors;o=b.morphColors[e].colors;c=0;for(n=o.length;c<n;c+=3)t=new THREE.Color(16755200),t.setRGB(o[c],o[c+1],o[c+2]),p.push(t)}}})(g);(function(){if(b.edges!==void 0){var c,e,g;for(c=0;c<b.edges.length;c+=2)e=b.edges[c],g=b.edges[c+1],f.edges.push(new THREE.Edge(f.vertices[e],
|
|
|
-f.vertices[g],e,g))}})();f.computeCentroids();f.computeFaceNormals();this.hasNormals(f)&&f.computeTangents();c(f)};THREE.BinaryLoader=function(b){THREE.Loader.call(this,b)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;
|
|
|
+c,u=w[n+2]*c,v.push(new THREE.Vertex(new THREE.Vector3(o,t,u)))}}if(b.morphColors!==void 0){e=0;for(g=b.morphColors.length;e<g;e++){f.morphColors[e]={};f.morphColors[e].name=b.morphColors[e].name;f.morphColors[e].colors=[];p=f.morphColors[e].colors;o=b.morphColors[e].colors;c=0;for(n=o.length;c<n;c+=3)t=new THREE.Color(16755200),t.setRGB(o[c],o[c+1],o[c+2]),p.push(t)}}})(g);(function(){if(b.edges!==void 0){var e,c,g;for(e=0;e<b.edges.length;e+=2)c=b.edges[e],g=b.edges[e+1],f.edges.push(new THREE.Edge(f.vertices[c],
|
|
|
+f.vertices[g],c,g))}})();f.computeCentroids();f.computeFaceNormals();this.hasNormals(f)&&f.computeTangents();c(f)};THREE.BinaryLoader=function(b){THREE.Loader.call(this,b)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;
|
|
|
THREE.BinaryLoader.prototype={load:function(b){var c=b.model,e=b.callback,f=b.texture_path?b.texture_path:THREE.Loader.prototype.extractUrlbase(c),g=b.bin_path?b.bin_path:THREE.Loader.prototype.extractUrlbase(c),b=(new Date).getTime(),c=new Worker(c),h=this.showProgress?THREE.Loader.prototype.updateProgress:null;c.onmessage=function(b){THREE.BinaryLoader.prototype.loadAjaxBuffers(b.data.buffers,b.data.materials,e,g,f,h)};c.onerror=function(b){alert("worker.onerror: "+b.message+"\n"+b.data);b.preventDefault()};
|
|
|
c.postMessage(b)},loadAjaxBuffers:function(b,c,e,f,g,h){var j=new XMLHttpRequest,m=f+"/"+b,n=0;j.onreadystatechange=function(){j.readyState==4?j.status==200||j.status==0?THREE.BinaryLoader.prototype.createBinModel(j.responseText,e,g,c):alert("Couldn't load ["+m+"] ["+j.status+"]"):j.readyState==3?h&&(n==0&&(n=j.getResponseHeader("Content-Length")),h({total:n,loaded:j.responseText.length})):j.readyState==2&&(n=j.getResponseHeader("Content-Length"))};j.open("GET",m,!0);j.overrideMimeType("text/plain; charset=x-user-defined");
|
|
|
-j.setRequestHeader("Content-Type","text/plain");j.send(null)},createBinModel:function(b,c,e,f){var g=function(c){function e(b,c){var f=o(b,c),g=o(b,c+1),h=o(b,c+2),j=o(b,c+3),k=(j<<1&255|h>>7)-127;f|=(h&127)<<16|g<<8;if(f==0&&k==-127)return 0;return(1-2*(j>>7))*(1+f*Math.pow(2,-23))*Math.pow(2,k)}function g(b,c){var e=o(b,c),f=o(b,c+1),h=o(b,c+2);return(o(b,c+3)<<24)+(h<<16)+(f<<8)+e}function n(b,c){var e=o(b,c);return(o(b,c+1)<<8)+e}function p(b,c){var e=o(b,c);return e>127?e-256:e}function o(b,
|
|
|
-c){return b.charCodeAt(c)&255}function t(c){var e,f,h;e=g(b,c);f=g(b,c+B);h=g(b,c+P);c=n(b,c+I);THREE.BinaryLoader.prototype.f3(y,e,f,h,c)}function u(c){var e,f,h,j,k,o;e=g(b,c);f=g(b,c+B);h=g(b,c+P);j=n(b,c+I);k=g(b,c+H);o=g(b,c+T);c=g(b,c+U);THREE.BinaryLoader.prototype.f3n(y,E,e,f,h,j,k,o,c)}function v(c){var e,f,h,j;e=g(b,c);f=g(b,c+J);h=g(b,c+Y);j=g(b,c+K);c=n(b,c+S);THREE.BinaryLoader.prototype.f4(y,e,f,h,j,c)}function w(c){var e,f,h,j,o,p,t,u;e=g(b,c);f=g(b,c+J);h=g(b,c+Y);j=g(b,c+K);o=n(b,
|
|
|
-c+S);p=g(b,c+k);t=g(b,c+V);u=g(b,c+O);c=g(b,c+fa);THREE.BinaryLoader.prototype.f4n(y,E,e,f,h,j,o,p,t,u,c)}function z(c){var e,f;e=g(b,c);f=g(b,c+ea);c=g(b,c+W);THREE.BinaryLoader.prototype.uv3(y.faceVertexUvs[0],G[e*2],G[e*2+1],G[f*2],G[f*2+1],G[c*2],G[c*2+1])}function x(c){var e,f,h;e=g(b,c);f=g(b,c+da);h=g(b,c+ga);c=g(b,c+ka);THREE.BinaryLoader.prototype.uv4(y.faceVertexUvs[0],G[e*2],G[e*2+1],G[f*2],G[f*2+1],G[h*2],G[h*2+1],G[c*2],G[c*2+1])}var y=this,F=0,C,E=[],G=[],B,P,I,H,T,U,J,Y,K,S,k,V,O,fa,
|
|
|
-ea,W,da,ga,ka,pa,R,ha,$,ma,aa;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(y,f,c);C={signature:b.substr(F,8),header_bytes:o(b,F+8),vertex_coordinate_bytes:o(b,F+9),normal_coordinate_bytes:o(b,F+10),uv_coordinate_bytes:o(b,F+11),vertex_index_bytes:o(b,F+12),normal_index_bytes:o(b,F+13),uv_index_bytes:o(b,F+14),material_index_bytes:o(b,F+15),nvertices:g(b,F+16),nnormals:g(b,F+16+4),nuvs:g(b,F+16+8),ntri_flat:g(b,F+16+12),ntri_smooth:g(b,F+16+16),ntri_flat_uv:g(b,F+16+20),ntri_smooth_uv:g(b,
|
|
|
+j.setRequestHeader("Content-Type","text/plain");j.send(null)},createBinModel:function(b,c,e,f){var g=function(e){function c(b,e){var f=o(b,e),g=o(b,e+1),h=o(b,e+2),j=o(b,e+3),k=(j<<1&255|h>>7)-127;f|=(h&127)<<16|g<<8;if(f==0&&k==-127)return 0;return(1-2*(j>>7))*(1+f*Math.pow(2,-23))*Math.pow(2,k)}function g(b,e){var c=o(b,e),f=o(b,e+1),h=o(b,e+2);return(o(b,e+3)<<24)+(h<<16)+(f<<8)+c}function n(b,e){var c=o(b,e);return(o(b,e+1)<<8)+c}function p(b,e){var c=o(b,e);return c>127?c-256:c}function o(b,
|
|
|
+e){return b.charCodeAt(e)&255}function t(e){var c,f,h;c=g(b,e);f=g(b,e+B);h=g(b,e+P);e=n(b,e+I);THREE.BinaryLoader.prototype.f3(y,c,f,h,e)}function u(e){var c,f,h,j,k,o;c=g(b,e);f=g(b,e+B);h=g(b,e+P);j=n(b,e+I);k=g(b,e+H);o=g(b,e+T);e=g(b,e+U);THREE.BinaryLoader.prototype.f3n(y,E,c,f,h,j,k,o,e)}function v(e){var c,f,h,j;c=g(b,e);f=g(b,e+J);h=g(b,e+Y);j=g(b,e+K);e=n(b,e+S);THREE.BinaryLoader.prototype.f4(y,c,f,h,j,e)}function w(e){var c,f,h,j,o,p,t,u;c=g(b,e);f=g(b,e+J);h=g(b,e+Y);j=g(b,e+K);o=n(b,
|
|
|
+e+S);p=g(b,e+k);t=g(b,e+V);u=g(b,e+O);e=g(b,e+fa);THREE.BinaryLoader.prototype.f4n(y,E,c,f,h,j,o,p,t,u,e)}function z(e){var c,f;c=g(b,e);f=g(b,e+ea);e=g(b,e+W);THREE.BinaryLoader.prototype.uv3(y.faceVertexUvs[0],G[c*2],G[c*2+1],G[f*2],G[f*2+1],G[e*2],G[e*2+1])}function x(e){var c,f,h;c=g(b,e);f=g(b,e+da);h=g(b,e+ga);e=g(b,e+ka);THREE.BinaryLoader.prototype.uv4(y.faceVertexUvs[0],G[c*2],G[c*2+1],G[f*2],G[f*2+1],G[h*2],G[h*2+1],G[e*2],G[e*2+1])}var y=this,F=0,C,E=[],G=[],B,P,I,H,T,U,J,Y,K,S,k,V,O,fa,
|
|
|
+ea,W,da,ga,ka,pa,R,ha,$,ma,aa;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(y,f,e);C={signature:b.substr(F,8),header_bytes:o(b,F+8),vertex_coordinate_bytes:o(b,F+9),normal_coordinate_bytes:o(b,F+10),uv_coordinate_bytes:o(b,F+11),vertex_index_bytes:o(b,F+12),normal_index_bytes:o(b,F+13),uv_index_bytes:o(b,F+14),material_index_bytes:o(b,F+15),nvertices:g(b,F+16),nnormals:g(b,F+16+4),nuvs:g(b,F+16+8),ntri_flat:g(b,F+16+12),ntri_smooth:g(b,F+16+16),ntri_flat_uv:g(b,F+16+20),ntri_smooth_uv:g(b,
|
|
|
F+16+24),nquad_flat:g(b,F+16+28),nquad_smooth:g(b,F+16+32),nquad_flat_uv:g(b,F+16+36),nquad_smooth_uv:g(b,F+16+40)};F+=C.header_bytes;B=C.vertex_index_bytes;P=C.vertex_index_bytes*2;I=C.vertex_index_bytes*3;H=C.vertex_index_bytes*3+C.material_index_bytes;T=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes;U=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes*2;J=C.vertex_index_bytes;Y=C.vertex_index_bytes*2;K=C.vertex_index_bytes*3;S=C.vertex_index_bytes*4;k=C.vertex_index_bytes*
|
|
|
-4+C.material_index_bytes;V=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes;O=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes*2;fa=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes*3;ea=C.uv_index_bytes;W=C.uv_index_bytes*2;da=C.uv_index_bytes;ga=C.uv_index_bytes*2;ka=C.uv_index_bytes*3;c=C.vertex_index_bytes*3+C.material_index_bytes;aa=C.vertex_index_bytes*4+C.material_index_bytes;pa=C.ntri_flat*c;R=C.ntri_smooth*(c+C.normal_index_bytes*3);ha=
|
|
|
-C.ntri_flat_uv*(c+C.uv_index_bytes*3);$=C.ntri_smooth_uv*(c+C.normal_index_bytes*3+C.uv_index_bytes*3);ma=C.nquad_flat*aa;c=C.nquad_smooth*(aa+C.normal_index_bytes*4);aa=C.nquad_flat_uv*(aa+C.uv_index_bytes*4);F+=function(c){for(var f,g,h,k=C.vertex_coordinate_bytes*3,m=c+C.nvertices*k;c<m;c+=k)f=e(b,c),g=e(b,c+C.vertex_coordinate_bytes),h=e(b,c+C.vertex_coordinate_bytes*2),THREE.BinaryLoader.prototype.v(y,f,g,h);return C.nvertices*k}(F);F+=function(c){for(var e,f,g,h=C.normal_coordinate_bytes*3,
|
|
|
-j=c+C.nnormals*h;c<j;c+=h)e=p(b,c),f=p(b,c+C.normal_coordinate_bytes),g=p(b,c+C.normal_coordinate_bytes*2),E.push(e/127,f/127,g/127);return C.nnormals*h}(F);F+=function(c){for(var f,g,h=C.uv_coordinate_bytes*2,k=c+C.nuvs*h;c<k;c+=h)f=e(b,c),g=e(b,c+C.uv_coordinate_bytes),G.push(f,g);return C.nuvs*h}(F);pa=F+pa;R=pa+R;ha=R+ha;$=ha+$;ma=$+ma;c=ma+c;aa=c+aa;(function(b){var c,e=C.vertex_index_bytes*3+C.material_index_bytes,f=e+C.uv_index_bytes*3,g=b+C.ntri_flat_uv*f;for(c=b;c<g;c+=f)t(c),z(c+e);return g-
|
|
|
-b})(R);(function(b){var c,e=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes*3,f=e+C.uv_index_bytes*3,g=b+C.ntri_smooth_uv*f;for(c=b;c<g;c+=f)u(c),z(c+e);return g-b})(ha);(function(b){var c,e=C.vertex_index_bytes*4+C.material_index_bytes,f=e+C.uv_index_bytes*4,g=b+C.nquad_flat_uv*f;for(c=b;c<g;c+=f)v(c),x(c+e);return g-b})(c);(function(b){var c,e=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes*4,f=e+C.uv_index_bytes*4,g=b+C.nquad_smooth_uv*f;for(c=b;c<g;c+=f)w(c),
|
|
|
-x(c+e);return g-b})(aa);(function(b){var c,e=C.vertex_index_bytes*3+C.material_index_bytes,f=b+C.ntri_flat*e;for(c=b;c<f;c+=e)t(c);return f-b})(F);(function(b){var c,e=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes*3,f=b+C.ntri_smooth*e;for(c=b;c<f;c+=e)u(c);return f-b})(pa);(function(b){var c,e=C.vertex_index_bytes*4+C.material_index_bytes,f=b+C.nquad_flat*e;for(c=b;c<f;c+=e)v(c);return f-b})($);(function(b){var c,e=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes*
|
|
|
-4,f=b+C.nquad_smooth*e;for(c=b;c<f;c+=e)w(c);return f-b})(ma);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};g.prototype=new THREE.Geometry;g.prototype.constructor=g;c(new g(e))},v:function(b,c,e,f){b.vertices.push(new THREE.Vertex(new THREE.Vector3(c,e,f)))},f3:function(b,c,e,f,g){b.faces.push(new THREE.Face3(c,e,f,null,null,b.materials[g]))},f4:function(b,c,e,f,g,h){b.faces.push(new THREE.Face4(c,e,f,g,null,null,b.materials[h]))},
|
|
|
+4+C.material_index_bytes;V=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes;O=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes*2;fa=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes*3;ea=C.uv_index_bytes;W=C.uv_index_bytes*2;da=C.uv_index_bytes;ga=C.uv_index_bytes*2;ka=C.uv_index_bytes*3;e=C.vertex_index_bytes*3+C.material_index_bytes;aa=C.vertex_index_bytes*4+C.material_index_bytes;pa=C.ntri_flat*e;R=C.ntri_smooth*(e+C.normal_index_bytes*3);ha=
|
|
|
+C.ntri_flat_uv*(e+C.uv_index_bytes*3);$=C.ntri_smooth_uv*(e+C.normal_index_bytes*3+C.uv_index_bytes*3);ma=C.nquad_flat*aa;e=C.nquad_smooth*(aa+C.normal_index_bytes*4);aa=C.nquad_flat_uv*(aa+C.uv_index_bytes*4);F+=function(e){for(var f,g,h,k=C.vertex_coordinate_bytes*3,m=e+C.nvertices*k;e<m;e+=k)f=c(b,e),g=c(b,e+C.vertex_coordinate_bytes),h=c(b,e+C.vertex_coordinate_bytes*2),THREE.BinaryLoader.prototype.v(y,f,g,h);return C.nvertices*k}(F);F+=function(e){for(var c,f,g,h=C.normal_coordinate_bytes*3,
|
|
|
+j=e+C.nnormals*h;e<j;e+=h)c=p(b,e),f=p(b,e+C.normal_coordinate_bytes),g=p(b,e+C.normal_coordinate_bytes*2),E.push(c/127,f/127,g/127);return C.nnormals*h}(F);F+=function(e){for(var f,g,h=C.uv_coordinate_bytes*2,k=e+C.nuvs*h;e<k;e+=h)f=c(b,e),g=c(b,e+C.uv_coordinate_bytes),G.push(f,g);return C.nuvs*h}(F);pa=F+pa;R=pa+R;ha=R+ha;$=ha+$;ma=$+ma;e=ma+e;aa=e+aa;(function(b){var e,c=C.vertex_index_bytes*3+C.material_index_bytes,f=c+C.uv_index_bytes*3,g=b+C.ntri_flat_uv*f;for(e=b;e<g;e+=f)t(e),z(e+c);return g-
|
|
|
+b})(R);(function(b){var e,c=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes*3,f=c+C.uv_index_bytes*3,g=b+C.ntri_smooth_uv*f;for(e=b;e<g;e+=f)u(e),z(e+c);return g-b})(ha);(function(b){var e,c=C.vertex_index_bytes*4+C.material_index_bytes,f=c+C.uv_index_bytes*4,g=b+C.nquad_flat_uv*f;for(e=b;e<g;e+=f)v(e),x(e+c);return g-b})(e);(function(b){var e,c=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes*4,f=c+C.uv_index_bytes*4,g=b+C.nquad_smooth_uv*f;for(e=b;e<g;e+=f)w(e),
|
|
|
+x(e+c);return g-b})(aa);(function(b){var e,c=C.vertex_index_bytes*3+C.material_index_bytes,f=b+C.ntri_flat*c;for(e=b;e<f;e+=c)t(e);return f-b})(F);(function(b){var e,c=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes*3,f=b+C.ntri_smooth*c;for(e=b;e<f;e+=c)u(e);return f-b})(pa);(function(b){var e,c=C.vertex_index_bytes*4+C.material_index_bytes,f=b+C.nquad_flat*c;for(e=b;e<f;e+=c)v(e);return f-b})($);(function(b){var e,c=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes*
|
|
|
+4,f=b+C.nquad_smooth*c;for(e=b;e<f;e+=c)w(e);return f-b})(ma);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};g.prototype=new THREE.Geometry;g.prototype.constructor=g;c(new g(e))},v:function(b,c,e,f){b.vertices.push(new THREE.Vertex(new THREE.Vector3(c,e,f)))},f3:function(b,c,e,f,g){b.faces.push(new THREE.Face3(c,e,f,null,null,b.materials[g]))},f4:function(b,c,e,f,g,h){b.faces.push(new THREE.Face4(c,e,f,g,null,null,b.materials[h]))},
|
|
|
f3n:function(b,c,e,f,g,h,j,m,n){var h=b.materials[h],p=c[m*3],o=c[m*3+1],m=c[m*3+2],t=c[n*3],u=c[n*3+1],n=c[n*3+2];b.faces.push(new THREE.Face3(e,f,g,[new THREE.Vector3(c[j*3],c[j*3+1],c[j*3+2]),new THREE.Vector3(p,o,m),new THREE.Vector3(t,u,n)],null,h))},f4n:function(b,c,e,f,g,h,j,m,n,p,o){var j=b.materials[j],t=c[n*3],u=c[n*3+1],n=c[n*3+2],v=c[p*3],w=c[p*3+1],p=c[p*3+2],z=c[o*3],x=c[o*3+1],o=c[o*3+2];b.faces.push(new THREE.Face4(e,f,g,h,[new THREE.Vector3(c[m*3],c[m*3+1],c[m*3+2]),new THREE.Vector3(t,
|
|
|
u,n),new THREE.Vector3(v,w,p),new THREE.Vector3(z,x,o)],null,j))},uv3:function(b,c,e,f,g,h,j){var m=[];m.push(new THREE.UV(c,e));m.push(new THREE.UV(f,g));m.push(new THREE.UV(h,j));b.push(m)},uv4:function(b,c,e,f,g,h,j,m,n){var p=[];p.push(new THREE.UV(c,e));p.push(new THREE.UV(f,g));p.push(new THREE.UV(h,j));p.push(new THREE.UV(m,n));b.push(p)}};
|
|
|
THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};
|
|
|
-THREE.SceneLoader.prototype={load:function(b,c){var e=this,f=new Worker(b);f.postMessage(0);var g=THREE.Loader.prototype.extractUrlbase(b);f.onmessage=function(b){function f(b,c){return c=="relativeToHTML"?b:g+"/"+b}function m(){for(v in J.objects)if(!O.objects[v])if(F=J.objects[v],F.geometry!==void 0){if(B=O.geometries[F.geometry]){var b=!1;T=[];for(ea=0;ea<F.materials.length;ea++)T[ea]=O.materials[F.materials[ea]],b=T[ea]instanceof THREE.MeshShaderMaterial;b&&B.computeTangents();C=F.position;r=
|
|
|
+THREE.SceneLoader.prototype={load:function(b,c){var e=this,f=new Worker(b);f.postMessage(0);var g=THREE.Loader.prototype.extractUrlbase(b);f.onmessage=function(b){function f(b,e){return e=="relativeToHTML"?b:g+"/"+b}function m(){for(v in J.objects)if(!O.objects[v])if(F=J.objects[v],F.geometry!==void 0){if(B=O.geometries[F.geometry]){var b=!1;T=[];for(ea=0;ea<F.materials.length;ea++)T[ea]=O.materials[F.materials[ea]],b=T[ea]instanceof THREE.MeshShaderMaterial;b&&B.computeTangents();C=F.position;r=
|
|
|
F.rotation;q=F.quaternion;s=F.scale;q=0;T.length==0&&(T[0]=new THREE.MeshFaceMaterial);T.length>1&&(T=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(B,T);object.name=v;object.position.set(C[0],C[1],C[2]);q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=F.visible;O.scene.addObject(object);O.objects[v]=object;F.meshCollider&&(b=THREE.CollisionUtils.MeshColliderWBox(object),O.scene.collisions.colliders.push(b));
|
|
|
if(F.castsShadow)b=new THREE.ShadowVolume(B),O.scene.addChild(b),b.position=object.position,b.rotation=object.rotation,b.scale=object.scale;F.trigger&&F.trigger.toLowerCase()!="none"&&(b={type:F.trigger,object:F},O.triggers[object.name]=b)}}else C=F.position,r=F.rotation,q=F.quaternion,s=F.scale,q=0,object=new THREE.Object3D,object.name=v,object.position.set(C[0],C[1],C[2]),q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]),object.scale.set(s[0],
|
|
|
-s[1],s[2]),object.visible=F.visible!==void 0?F.visible:!1,O.scene.addObject(object),O.objects[v]=object,O.empties[v]=object,F.trigger&&F.trigger.toLowerCase()!="none"&&(b={type:F.trigger,object:F},O.triggers[object.name]=b)}function n(b){return function(c){O.geometries[b]=c;m();K-=1;e.onLoadComplete();o()}}function p(b){return function(c){O.geometries[b]=c}}function o(){e.callbackProgress({totalModels:k,totalTextures:V,loadedModels:k-K,loadedTextures:V-S},O);e.onLoadProgress();K==0&&S==0&&c(O)}var t,
|
|
|
+s[1],s[2]),object.visible=F.visible!==void 0?F.visible:!1,O.scene.addObject(object),O.objects[v]=object,O.empties[v]=object,F.trigger&&F.trigger.toLowerCase()!="none"&&(b={type:F.trigger,object:F},O.triggers[object.name]=b)}function n(b){return function(c){O.geometries[b]=c;m();K-=1;e.onLoadComplete();o()}}function p(b){return function(e){O.geometries[b]=e}}function o(){e.callbackProgress({totalModels:k,totalTextures:V,loadedModels:k-K,loadedTextures:V-S},O);e.onLoadProgress();K==0&&S==0&&c(O)}var t,
|
|
|
u,v,w,z,x,y,F,C,E,G,B,P,I,H,T,U,J,Y,K,S,k,V,O;J=b.data;H=new THREE.BinaryLoader;Y=new THREE.JSONLoader;S=K=0;O={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};b=!1;for(v in J.objects)if(F=J.objects[v],F.meshCollider){b=!0;break}if(b)O.scene.collisions=new THREE.CollisionSystem;if(J.transform){b=J.transform.position;E=J.transform.rotation;var fa=J.transform.scale;b&&O.scene.position.set(b[0],b[1],b[2]);E&&O.scene.rotation.set(E[0],
|
|
|
E[1],E[2]);fa&&O.scene.scale.set(fa[0],fa[1],fa[2]);(b||E||fa)&&O.scene.updateMatrix()}b=function(){S-=1;o();e.onLoadComplete()};for(z in J.cameras){E=J.cameras[z];if(E.type=="perspective")P=new THREE.Camera(E.fov,E.aspect,E.near,E.far);else if(E.type=="ortho")P=new THREE.Camera,P.projectionMatrix=THREE.Matrix4.makeOrtho(E.left,E.right,E.top,E.bottom,E.near,E.far);C=E.position;E=E.target;P.position.set(C[0],C[1],C[2]);P.target.position.set(E[0],E[1],E[2]);O.cameras[z]=P}for(w in J.lights)z=J.lights[w],
|
|
|
P=z.color!==void 0?z.color:16777215,E=z.intensity!==void 0?z.intensity:1,z.type=="directional"?(C=z.direction,U=new THREE.DirectionalLight(P,E),U.position.set(C[0],C[1],C[2]),U.position.normalize()):z.type=="point"?(C=z.position,d=z.distance,U=new THREE.PointLight(P,E,d),U.position.set(C[0],C[1],C[2])):z.type=="ambient"&&(U=new THREE.AmbientLight(P)),O.scene.addLight(U),O.lights[w]=U;for(x in J.fogs)w=J.fogs[x],w.type=="linear"?I=new THREE.Fog(0,w.near,w.far):w.type=="exp2"&&(I=new THREE.FogExp2(0,
|