Browse Source

Refactored Shape API: replaced bool parameter in extractAllPoints with two named methods.

(per Qt API design suggestions http://developer.qt.nokia.com/wiki/API_Design_Principles)

Also some more whitespace cleanup.
alteredq 14 years ago
parent
commit
e52edb5d1a

+ 20 - 20
build/Three.js

@@ -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,

+ 6 - 6
build/custom/ThreeExtras.js

@@ -103,8 +103,8 @@ THREE.Path.prototype.createPathGeometry=function(a,c){var b=this.getPoints(a),f,
 THREE.Path.prototype.transform=function(a){a=new THREE.Path;a.moveTo(0,0);a.quadraticCurveTo(100,20,140,80);console.log(a.cacheArcLengths());var c=this.getMinAndMax(),b=this.getPoints(),f,e,g,h,j,k;f=0;for(e=b.length;f<e;f++)g=b[f],h=g.x,j=g.y,k=h/c.maxX,h=a.getPoint(k),j=a.getNormalVector(k).multiplyScalar(j),g.x=h.x+j.x,g.y=h.y+j.y;return b};
 THREE.Path.prototype.nltransform=function(a,c,b,f,e,g){var h=this.getPoints(),j,k,l,m,n;j=0;for(k=h.length;j<k;j++)l=h[j],m=l.x,n=l.y,l.x=a*m+c*n+b,l.y=f*n+e*m+g;return h};
 THREE.Path.prototype.debug=function(a){var c=this.getMinAndMax();a||(a=document.createElement("canvas"),a.setAttribute("width",c.maxX+100),a.setAttribute("height",c.maxY+100),document.body.appendChild(a));c=a.getContext("2d");c.fillStyle="white";c.fillRect(0,0,a.width,a.height);c.strokeStyle="black";c.beginPath();var b,f,e,a=0;for(b=this.actions.length;a<b;a++)f=this.actions[a],e=f.args,f=f.action,f!=THREE.PathActions.CSPLINE_THRU&&c[f].apply(c,e);c.stroke();c.closePath();c.strokeStyle="red";f=this.transform(0.866,
--0.866,0,0.5,0.5,-50);a=0;for(b=f.length;a<b;a++)e=f[a],c.beginPath(),c.arc(e.x,e.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(a){return new THREE.ExtrudeGeometry(this,a)};
-THREE.Shape.prototype.getHoles=function(a){var a=a?"getSpacedPoints":"getPoints",c,b=this.holes.length,f=[];for(c=0;c<b;c++)f[c]=this.holes[c][a]();return f};THREE.Shape.prototype.extractAllPoints=function(a){return{shape:this[a?"getSpacedPoints":"getPoints"](),holes:this.getHoles(a)}};
+-0.866,0,0.5,0.5,-50);a=0;for(b=f.length;a<b;a++)e=f[a],c.beginPath(),c.arc(e.x,e.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(a){return new THREE.ExtrudeGeometry(this,a)};THREE.Shape.prototype.getPointsHoles=function(){var a,c=this.holes.length,b=[];for(a=0;a<c;a++)b[a]=this.holes[a].getPoints();return b};
+THREE.Shape.prototype.getSpacedPointsHoles=function(){var a,c=this.holes.length,b=[];for(a=0;a<c;a++)b[a]=this.holes[a].getSpacedPoints();return b};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(a,c){var b=a.concat(),f=b.concat(),e,g,h,j,k,l,m,n,o,p,v=[];for(k=0;k<c.length;k++){l=c[k];f=f.concat(l);g=Number.POSITIVE_INFINITY;for(e=0;e<l.length;e++){o=l[e];p=[];for(n=0;n<b.length;n++)m=b[n],m=o.distanceTo(m),p.push(m),m<g&&(g=m,h=e,j=n)}e=j-1>=0?j-1:b.length-1;g=h-1>=0?h-1:l.length-1;var u=[l[h],b[j],b[e]];n=THREE.FontUtils.Triangulate.area(u);var w=[l[h],l[g],b[j]];o=THREE.FontUtils.Triangulate.area(w);p=j;m=h;j+=1;h+=-1;j<0&&(j+=b.length);j%=b.length;
 h<0&&(h+=l.length);h%=l.length;e=j-1>=0?j-1:b.length-1;g=h-1>=0?h-1:l.length-1;u=[l[h],b[j],b[e]];u=THREE.FontUtils.Triangulate.area(u);w=[l[h],l[g],b[j]];w=THREE.FontUtils.Triangulate.area(w);n+o>u+w&&(j=p,h=m,j<0&&(j+=b.length),j%=b.length,h<0&&(h+=l.length),h%=l.length,e=j-1>=0?j-1:b.length-1,g=h-1>=0?h-1:l.length-1);n=b.slice(0,j);o=b.slice(j);p=l.slice(h);m=l.slice(0,h);g=[l[h],l[g],b[j]];v.push([l[h],b[j],b[e]]);v.push(g);b=n.concat(p).concat(m).concat(o)}return{shape:b,isolatedPts:v,allpoints:f}},
 triangulateShape:function(a,c){var b=THREE.Shape.Utils.removeHoles(a,c),f=b.allpoints,e=b.isolatedPts,b=THREE.FontUtils.Triangulate(b.shape,!1),g,h,j,k;for(g=0;g<b.length;g++){k=b[g];for(h=0;h<3;h++)for(j=0;j<f.length;j++)f[j].equals(k[h])&&(k[h]=j)}for(g=0;g<e.length;g++){k=e[g];for(h=0;h<3;h++)for(j=0;j<f.length;j++)f[j].equals(k[h])&&(k[h]=j)}return b.concat(e)},isClockWise:function(a){return THREE.FontUtils.Triangulate.area(a)<0}};
@@ -116,10 +116,10 @@ THREE.CylinderGeometry=function(a,c,b,f,e,g){function h(a,b,c){j.vertices.push(n
 (e||0));for(k=a+a/2;k<2*a;k++)j.faces.push(new THREE.Face4(2*a+1,(2*k-2*a+2)%a+a,(2*k-2*a+1)%a+a,(2*k-2*a)%a+a))}k=0;for(a=this.faces.length;k<a;k++){var c=[],b=this.faces[k],e=this.vertices[b.a],g=this.vertices[b.b],m=this.vertices[b.c],n=this.vertices[b.d];c.push(new THREE.UV(0.5+Math.atan2(e.position.x,e.position.y)/l,0.5+e.position.z/f));c.push(new THREE.UV(0.5+Math.atan2(g.position.x,g.position.y)/l,0.5+g.position.z/f));c.push(new THREE.UV(0.5+Math.atan2(m.position.x,m.position.y)/l,0.5+m.position.z/
 f));b instanceof THREE.Face4&&c.push(new THREE.UV(0.5+Math.atan2(n.position.x,n.position.y)/l,0.5+n.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(a,c){function b(a,b,c,f){a=a.clone().subSelf(b);c/=a.length();return a.multiplyScalar(f?1+c:1-c).addSelf(b)}function f(a){for(A=a.length;--A>=0;){O=A;M=A-1;M<0&&(M=a.length-1);for(var b=0,b=0;b<n+m*2;b++){var c=I*b,f=I*(b+1);y.faces.push(new THREE.Face4(C+O+c,C+M+c,C+M+f,C+O+f))}}}function e(a,b,c){y.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function g(a,b,c){y.faces.push(new THREE.Face3(a,b,c))}var h=c.amount!==void 0?c.amount:100,j=c.bevelThickness!==
-void 0?c.bevelThickness:8,k=c.bevelSize!==void 0?c.bevelSize:j,l=c.bevelEnabled!==void 0?c.bevelEnabled:!0,m=c.bevelSegments!==void 0?c.bevelSegments:3;l||(m=0);var n=c.steps!==void 0?c.steps:1,o=c.path!==void 0?c.path:null,p,v=!1;if(o)p=o.getPoints(),n=p.length,v=!0;THREE.Geometry.call(this);var u,w,x,y=this,o=a.extractAllPoints(!1),t=o.shape,o=o.holes,z=!THREE.Shape.Utils.isClockWise(t);if(z){t=t.reverse();w=0;for(x=o.length;w<x;w++)u=o[w],THREE.Shape.Utils.isClockWise(u)&&(o[w]=u.reverse());z=
-!1}var z=THREE.Shape.Utils.triangulateShape(t,o),B=t;w=0;for(x=o.length;w<x;w++)u=o[w],t=t.concat(u);var A,E,G=new THREE.Vector2;A=0;for(E=B.length;A<E;A++)G.addSelf(B[A]);var H=G.divideScalar(B.length),L=[];w=0;for(x=o.length;w<x;w++){G=new THREE.Vector2;u=o[w];A=0;for(E=u.length;A<E;A++)G.addSelf(u[A]);L[w]=G.divideScalar(u.length)}var J,D,K,F,I=t.length,G=z.length;for(J=m;J>0;J--){u=J/m;K=j*u;D=k*(1-Math.sin((1-u)*Math.PI/2));A=0;for(E=B.length;A<E;A++)F=b(B[A],H,D,!1),e(F.x,F.y,-K);w=0;for(x=
-o.length;w<x;w++){u=o[w];A=0;for(E=u.length;A<E;A++)F=b(u[A],L[w],D,!0),e(F.x,F.y,-K)}}for(A=0;A<I;A++)F=t[A],v?e(F.x,F.y+p[0].y,p[0].x):e(F.x,F.y,0);for(u=1;u<=n;u++)for(A=0;A<I;A++)F=t[A],v?e(F.x,F.y+p[u-1].y,p[u-1].x):e(F.x,F.y,h/n*u);for(J=1;J<=m;J++){u=J/m;K=j*u;D=k*(1-Math.sin((1-u)*Math.PI/2));A=0;for(E=B.length;A<E;A++)F=b(B[A],H,D,!1),e(F.x,F.y,h+K);w=0;for(x=o.length;w<x;w++){u=o[w];A=0;for(E=u.length;A<E;A++)F=b(u[A],L[w],D,!0),v?e(F.x,F.y+p[n-1].y,p[n-1].x+K):e(F.x,F.y,h+K)}}if(l){j=I*
-0;for(A=0;A<G;A++)h=z[A],g(h[2]+j,h[1]+j,h[0]+j);j=I*(n+m*2);for(A=0;A<G;A++)h=z[A],g(h[0]+j,h[1]+j,h[2]+j)}else{for(A=0;A<G;A++)h=z[A],g(h[2],h[1],h[0]);for(A=0;A<G;A++)h=z[A],g(h[0]+I*n,h[1]+I*n,h[2]+I*n)}var O,M,C=0;f(B);C+=B.length;w=0;for(x=o.length;w<x;w++)u=o[w],f(u),C+=u.length;this.computeCentroids();this.computeFaceNormals()};THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;
+void 0?c.bevelThickness:8,k=c.bevelSize!==void 0?c.bevelSize:j,l=c.bevelEnabled!==void 0?c.bevelEnabled:!0,m=c.bevelSegments!==void 0?c.bevelSegments:3;l||(m=0);var n=c.steps!==void 0?c.steps:1,o=c.path!==void 0?c.path:null,p,v=!1;if(o)p=o.getPoints(),n=p.length,v=!0;THREE.Geometry.call(this);var u,w,x,y=this,o=a.extractAllPoints(),t=o.shape,o=o.holes,z=!THREE.Shape.Utils.isClockWise(t);if(z){t=t.reverse();w=0;for(x=o.length;w<x;w++)u=o[w],THREE.Shape.Utils.isClockWise(u)&&(o[w]=u.reverse());z=!1}var z=
+THREE.Shape.Utils.triangulateShape(t,o),B=t;w=0;for(x=o.length;w<x;w++)u=o[w],t=t.concat(u);var A,E,G=new THREE.Vector2;A=0;for(E=B.length;A<E;A++)G.addSelf(B[A]);var H=G.divideScalar(B.length),L=[];w=0;for(x=o.length;w<x;w++){G=new THREE.Vector2;u=o[w];A=0;for(E=u.length;A<E;A++)G.addSelf(u[A]);L[w]=G.divideScalar(u.length)}var J,D,K,F,I=t.length,G=z.length;for(J=m;J>0;J--){u=J/m;K=j*u;D=k*(1-Math.sin((1-u)*Math.PI/2));A=0;for(E=B.length;A<E;A++)F=b(B[A],H,D,!1),e(F.x,F.y,-K);w=0;for(x=o.length;w<
+x;w++){u=o[w];A=0;for(E=u.length;A<E;A++)F=b(u[A],L[w],D,!0),e(F.x,F.y,-K)}}for(A=0;A<I;A++)F=t[A],v?e(F.x,F.y+p[0].y,p[0].x):e(F.x,F.y,0);for(u=1;u<=n;u++)for(A=0;A<I;A++)F=t[A],v?e(F.x,F.y+p[u-1].y,p[u-1].x):e(F.x,F.y,h/n*u);for(J=1;J<=m;J++){u=J/m;K=j*u;D=k*(1-Math.sin((1-u)*Math.PI/2));A=0;for(E=B.length;A<E;A++)F=b(B[A],H,D,!1),e(F.x,F.y,h+K);w=0;for(x=o.length;w<x;w++){u=o[w];A=0;for(E=u.length;A<E;A++)F=b(u[A],L[w],D,!0),v?e(F.x,F.y+p[n-1].y,p[n-1].x+K):e(F.x,F.y,h+K)}}if(l){j=I*0;for(A=0;A<
+G;A++)h=z[A],g(h[2]+j,h[1]+j,h[0]+j);j=I*(n+m*2);for(A=0;A<G;A++)h=z[A],g(h[0]+j,h[1]+j,h[2]+j)}else{for(A=0;A<G;A++)h=z[A],g(h[2],h[1],h[0]);for(A=0;A<G;A++)h=z[A],g(h[0]+I*n,h[1]+I*n,h[2]+I*n)}var O,M,C=0;f(B);C+=B.length;w=0;for(x=o.length;w<x;w++)u=o[w],f(u),C+=u.length;this.computeCentroids();this.computeFaceNormals()};THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;
 THREE.IcosahedronGeometry=function(a){function c(a,b,c){var f=Math.sqrt(a*a+b*b+c*c);return e.vertices.push(new THREE.Vertex(new THREE.Vector3(a/f,b/f,c/f)))-1}function b(a,b,c,f){f.faces.push(new THREE.Face3(a,b,c))}function f(a,b){var f=e.vertices[a].position,g=e.vertices[b].position;return c((f.x+g.x)/2,(f.y+g.y)/2,(f.z+g.z)/2)}var e=this,g=new THREE.Geometry,h;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;c(-1,a,0);c(1,a,0);c(-1,-a,0);c(1,-a,0);c(0,-1,a);c(0,1,a);c(0,-1,
 -a);c(0,1,-a);c(a,0,-1);c(a,0,1);c(-a,0,-1);c(-a,0,1);b(0,11,5,g);b(0,5,1,g);b(0,1,7,g);b(0,7,10,g);b(0,10,11,g);b(1,5,9,g);b(5,11,4,g);b(11,10,2,g);b(10,7,6,g);b(7,1,8,g);b(3,9,4,g);b(3,4,2,g);b(3,2,6,g);b(3,6,8,g);b(3,8,9,g);b(4,9,5,g);b(2,4,11,g);b(6,2,10,g);b(8,6,7,g);b(9,8,1,g);for(a=0;a<this.subdivisions;a++){h=new THREE.Geometry;for(var j in g.faces){var k=f(g.faces[j].a,g.faces[j].b),l=f(g.faces[j].b,g.faces[j].c),m=f(g.faces[j].c,g.faces[j].a);b(g.faces[j].a,k,m,h);b(g.faces[j].b,l,k,h);
 b(g.faces[j].c,m,l,h);b(k,l,m,h)}g.faces=h.faces}e.faces=g.faces;delete g;delete h;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;

+ 8 - 0
src/core/Matrix4.js

@@ -518,7 +518,9 @@ THREE.Matrix4.prototype = {
 		e = Math.cos( z ), f = Math.sin( z );
 
 		switch ( order ) {
+
 			case 'YXZ':
+
 				var ce = c * e, cf = c * f, de = d * e, df = d * f;
 
 				this.n11 = ce + df * b;
@@ -535,6 +537,7 @@ THREE.Matrix4.prototype = {
 				break;
 
 			case 'ZXY':
+
 				var ce = c * e, cf = c * f, de = d * e, df = d * f;
 
 				this.n11 = ce - df * b;
@@ -551,6 +554,7 @@ THREE.Matrix4.prototype = {
 				break;
 
 			case 'ZYX':
+
 				var ae = a * e, af = a * f, be = b * e, bf = b * f;
 
 				this.n11 = c * e;
@@ -567,6 +571,7 @@ THREE.Matrix4.prototype = {
 				break;
 
 			case 'YZX':
+
 				var ac = a * c, ad = a * d, bc = b * c, bd = b * d;
 
 				this.n11 = c * e;
@@ -583,6 +588,7 @@ THREE.Matrix4.prototype = {
 				break;
 
 			case 'XZY':
+
 				var ac = a * c, ad = a * d, bc = b * c, bd = b * d;
 
 				this.n11 = c * e;
@@ -599,6 +605,7 @@ THREE.Matrix4.prototype = {
 				break;
 
 			default: // 'XYZ'
+
 				var ae = a * e, af = a * f, be = b * e, bf = b * f;
 
 				this.n11 = c * e;
@@ -613,6 +620,7 @@ THREE.Matrix4.prototype = {
 				this.n32 = be + af * d;
 				this.n33 = a * c;
 				break;
+
 		}
 
 		return this;

+ 3 - 3
src/extras/geometries/Curve.js

@@ -17,7 +17,7 @@
  *	Abstract Curve base class
  **************************************************************/
 
-THREE.Curve = function() {
+THREE.Curve = function () {
 
 };
 
@@ -88,7 +88,7 @@ THREE.Curve.prototype.getLength = function () {
 
 // Get list of cumulative segment lengths
 
-THREE.Curve.prototype.getLengths = function( divisions ) {
+THREE.Curve.prototype.getLengths = function ( divisions ) {
 
 	if ( !divisions ) divisions = 200;
 
@@ -119,7 +119,7 @@ THREE.Curve.prototype.getLengths = function( divisions ) {
 
 // Given u ( 0 .. 1 ), get a t to find p. This gives you points which are equi distance
 
-THREE.Curve.prototype.getUtoTmapping = function( u, distance ) {
+THREE.Curve.prototype.getUtoTmapping = function ( u, distance ) {
 
 	var lengths = this.getLengths();
 	var i = 0, il = lengths.length;

+ 9 - 13
src/extras/geometries/ExtrudeGeometry.js

@@ -3,7 +3,7 @@
  * Creates extruded geometry from a path shape.
  **/
 
-THREE.ExtrudeGeometry = function( shape, options ) {
+THREE.ExtrudeGeometry = function ( shape, options ) {
 
 	var amount = options.amount !== undefined ? options.amount : 100;
 
@@ -43,11 +43,7 @@ THREE.ExtrudeGeometry = function( shape, options ) {
 	var scope = this;
 	var bevelPoints = [];
 
-
-	// getPoints
-	// false for getPoints | true for getSpacedPoints() for points with equal divisions
-
-	var shapePoints = shape.extractAllPoints( false );
+	var shapePoints = shape.extractAllPoints(); // use shape.extractAllSpacedPoints() for points with equal divisions
 
     var vertices = shapePoints.shape;
 	var holes = shapePoints.holes;
@@ -60,7 +56,7 @@ THREE.ExtrudeGeometry = function( shape, options ) {
 
 		// Maybe we should also check if holes are in the opposite direction, just to be safe ...
 
-		for ( h = 0, hl = holes.length;  h < hl; h++ ) {
+		for ( h = 0, hl = holes.length;  h < hl; h ++ ) {
 
 			ahole = holes[ h ];
 
@@ -77,7 +73,7 @@ THREE.ExtrudeGeometry = function( shape, options ) {
 	}
 
 
-	var faces = THREE.Shape.Utils.triangulateShape( vertices, holes );
+	var faces = THREE.Shape.Utils.triangulateShape ( vertices, holes );
 	//var faces = THREE.Shape.Utils.triangulate2( vertices, holes );
 
 	//console.log(faces);
@@ -153,7 +149,7 @@ THREE.ExtrudeGeometry = function( shape, options ) {
 
 	// Loop bevelSegments, 1 for the front, 1 for the back
 
-	for ( b = bevelSegments; b > 0; b-- ) {
+	for ( b = bevelSegments; b > 0; b -- ) {
 
 		t = b / bevelSegments;
 		z = bevelThickness * t;
@@ -191,7 +187,7 @@ THREE.ExtrudeGeometry = function( shape, options ) {
 
 	// Back facing vertices
 
-	for ( i = 0; i < vlen; i++ ) {
+	for ( i = 0; i < vlen; i ++ ) {
 
 		vert = vertices[ i ];
 		//v( vert.x, vert.y, 0 );
@@ -213,7 +209,7 @@ THREE.ExtrudeGeometry = function( shape, options ) {
 
 	var s;
 
-	for ( s = 1; s <= steps; s++ ) {
+	for ( s = 1; s <= steps; s ++ ) {
 
 		for ( i = 0; i < vlen; i ++ ) {
 
@@ -221,7 +217,7 @@ THREE.ExtrudeGeometry = function( shape, options ) {
 
 			if ( !extrudeByPath ) {
 
-				v( vert.x, vert.y, amount/steps * s );
+				v( vert.x, vert.y, amount / steps * s );
 
 			} else {
 
@@ -236,7 +232,7 @@ THREE.ExtrudeGeometry = function( shape, options ) {
 
 	// Add bevel segments planes
 
-	for ( b = 1; b <= bevelSegments; b++ ) {
+	for ( b = 1; b <= bevelSegments; b ++ ) {
 
 		t = b / bevelSegments;
 		z = bevelThickness * t;

+ 9 - 9
src/extras/geometries/Path.js

@@ -33,7 +33,7 @@ THREE.PathActions = {
 // Create path using straight lines to connect all points
 // - vectors: array of Vector2
 
-THREE.Path.prototype.fromPoints = function( vectors ) {
+THREE.Path.prototype.fromPoints = function ( vectors ) {
 
 	this.moveTo( vectors[ 0 ].x, vectors[ 0 ].y );
 
@@ -49,14 +49,14 @@ THREE.Path.prototype.fromPoints = function( vectors ) {
 
 // startPath() endPath()?
 
-THREE.Path.prototype.moveTo = function( x, y ) {
+THREE.Path.prototype.moveTo = function ( x, y ) {
 
 	var args = Array.prototype.slice.call( arguments );
 	this.actions.push( { action: THREE.PathActions.MOVE_TO, args: args } );
 
 };
 
-THREE.Path.prototype.lineTo = function( x, y ) {
+THREE.Path.prototype.lineTo = function ( x, y ) {
 
 	var args = Array.prototype.slice.call( arguments );
 
@@ -86,8 +86,8 @@ THREE.Path.prototype.quadraticCurveTo = function( aCPx, aCPy, aX, aY ) {
 
 	this.actions.push( { action: THREE.PathActions.QUADRATIC_CURVE_TO, args: args, curve: curve } );
 
-	//console.log(curve, curve.getPoints(), curve.getSpacedPoints());
-	//console.log(curve.getPointAt(0), curve.getPointAt(0),curve.getUtoTmapping(0), curve.getSpacedPoints());
+	//console.log( curve, curve.getPoints(), curve.getSpacedPoints() );
+	//console.log( curve.getPointAt(0), curve.getPointAt(0), curve.getUtoTmapping(0), curve.getSpacedPoints() );
 
 };
 
@@ -134,8 +134,8 @@ THREE.Path.prototype.splineThru = function( pts /*Array of Vector*/ ) {
 // FUTURE: Change the API or follow canvas API?
 // TODO ARC ( x, y, x - radius, y - radius, startAngle, endAngle )
 
-THREE.Path.prototype.arc = function(aX, aY, aRadius,
-									aStartAngle, aEndAngle, aClockwise ) {
+THREE.Path.prototype.arc = function ( aX, aY, aRadius,
+									  aStartAngle, aEndAngle, aClockwise ) {
 
 	var args = Array.prototype.slice.call( arguments );
 	var curve = new THREE.ArcCurve( aX, aY, aRadius,
@@ -162,7 +162,7 @@ THREE.Path.prototype.arc = function(aX, aY, aRadius,
 */
 
 
-THREE.Path.prototype.getSpacedPoints = function( divisions ) {
+THREE.Path.prototype.getSpacedPoints = function ( divisions ) {
 
 	if ( !divisions ) divisions = 40;
 
@@ -369,7 +369,7 @@ THREE.Path.prototype.getPoints = function( divisions ) {
 
 };
 
-THREE.Path.prototype.getMinAndMax = function() {
+THREE.Path.prototype.getMinAndMax = function () {
 
 	var points = this.getPoints();
 

+ 39 - 17
src/extras/geometries/Shape.js

@@ -19,26 +19,24 @@ THREE.Shape = function ( ) {
 THREE.Shape.prototype = new THREE.Path();
 THREE.Shape.prototype.constructor = THREE.Path;
 
-/* Convenience method to return ExtrudeGeometry */
+// Convenience method to return ExtrudeGeometry
 
-THREE.Shape.prototype.extrude = function( options ) {
+THREE.Shape.prototype.extrude = function ( options ) {
 
 	var extruded = new THREE.ExtrudeGeometry( this, options );
 	return extruded;
 
 };
 
-/* Return array of holes' getPoints() */
+// Get points of holes
 
-THREE.Shape.prototype.getHoles = function( spaced ) {
-
-	var getPoints = spaced ? 'getSpacedPoints' : 'getPoints';
+THREE.Shape.prototype.getPointsHoles = function () {
 
 	var i, il = this.holes.length, holesPts = [];
 
 	for ( i = 0; i < il; i ++ ) {
 
-		holesPts[ i ] = this.holes[ i ][ getPoints ](); // getSpacedPoints getPoints
+		holesPts[ i ] = this.holes[ i ].getPoints();
 
 	}
 
@@ -46,24 +44,47 @@ THREE.Shape.prototype.getHoles = function( spaced ) {
 
 };
 
-/* Returns points of shape and holes
-   spaced, when true returns points spaced by regular distances
-   otherwise return keypoints based on segments paramater
-*/
+// Get points of holes (spaced by regular distance)
+
+THREE.Shape.prototype.getSpacedPointsHoles = function () {
+
+	var i, il = this.holes.length, holesPts = [];
+
+	for ( i = 0; i < il; i ++ ) {
+
+		holesPts[ i ] = this.holes[ i ].getSpacedPoints();
+
+	}
+
+	return holesPts;
+
+};
 
-THREE.Shape.prototype.extractAllPoints = function( spaced ) {
+// Get points of shape and holes (keypoints based on segments parameter)
 
-	var getPoints = spaced ? 'getSpacedPoints' : 'getPoints';
+THREE.Shape.prototype.extractAllPoints = function () {
 
 	return {
 
-		shape: this[ getPoints ](),
-		holes: this.getHoles( spaced )
+		shape: this.getPoints(),
+		holes: this.getPointsHoles()
 
 	};
 
 };
 
+// Get points of shape and holes (spaced by regular distance)
+
+THREE.Shape.prototype.extractAllSpacedPoints = function () {
+
+	return {
+
+		shape: this.getSpacedPoints(),
+		holes: this.getSpacedPointsHoles()
+
+	};
+
+};
 
 THREE.Shape.Utils = {
 
@@ -71,7 +92,8 @@ THREE.Shape.Utils = {
 		contour - array of vector2 for contour
 		holes   - array of array of vector2
 	*/
-	removeHoles: function( contour, holes ) {
+
+	removeHoles: function ( contour, holes ) {
 
 		var shape = contour.concat(); // work on this shape
 		var allpoints = shape.concat();
@@ -263,7 +285,7 @@ THREE.Shape.Utils = {
 
 	},
 
-	triangulateShape: function( contour, holes ) {
+	triangulateShape: function ( contour, holes ) {
 
 		var shapeWithoutHoles = THREE.Shape.Utils.removeHoles( contour, holes );