|
@@ -486,10 +486,10 @@ THREE.SphereGeometry=function(b,c,e){THREE.Geometry.call(this);for(var b=b||50,f
|
|
|
j-1:f];p=c[e-1][p?0:f+1];v=e/(h-1);u=(e-1)/(h-1);w=(f+1)/j;var t=f/j,n=new THREE.UV(1-w,v),v=new THREE.UV(1-t,v),t=new THREE.UV(1-t,u),y=new THREE.UV(1-w,u);e<c.length-1&&(u=this.vertices[g].position.clone(),w=this.vertices[m].position.clone(),A=this.vertices[o].position.clone(),u.normalize(),w.normalize(),A.normalize(),this.faces.push(new THREE.Face3(g,m,o,[new THREE.Vector3(u.x,u.y,u.z),new THREE.Vector3(w.x,w.y,w.z),new THREE.Vector3(A.x,A.y,A.z)])),this.faceVertexUvs[0].push([n,v,t]));e>1&&(u=
|
|
|
this.vertices[g].position.clone(),w=this.vertices[o].position.clone(),A=this.vertices[p].position.clone(),u.normalize(),w.normalize(),A.normalize(),this.faces.push(new THREE.Face3(g,o,p,[new THREE.Vector3(u.x,u.y,u.z),new THREE.Vector3(w.x,w.y,w.z),new THREE.Vector3(A.x,A.y,A.z)])),this.faceVertexUvs[0].push([n,t,y]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:b}};THREE.SphereGeometry.prototype=new THREE.Geometry;
|
|
|
THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry;THREE.TextGeometry=function(b,c){var e=(new THREE.TextPath(b,c)).toShapes();THREE.ExtrudeGeometry.call(this,e,c)};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]},getTextShapes:function(b,c){return(new TextPath(b,c)).toShapes()},loadFace:function(b){var c=b.familyName.toLowerCase();this.faces[c]=this.faces[c]||{};this.faces[c][b.cssFontWeight]=this.faces[c][b.cssFontWeight]||{};this.faces[c][b.cssFontWeight][b.cssFontStyle]=b;return this.faces[c][b.cssFontWeight][b.cssFontStyle]=b},drawText:function(b){var c,
|
|
|
-e=this.getFace(),f=this.size/e.resolution,h=0,j=String(b).split(""),g=j.length,b=[];for(c=0;c<g;c++){var m=new THREE.Path,m=this.extractGlyphPoints(j[c],e,f,h,m);h+=m.offset;b.push(m.path)}e=h/2;f=this.extractPoints([],[]);f.paths=b;f.offset=e;return f},extractGlyphPoints:function(b,c,e,f,h){var j=[],g,m,o,p,n,t,v,u,w,A,y=c.glyphs[b]||c.glyphs[ctxt.options.fallbackCharacter];if(y){if(y.o){c=y._cachedOutline||(y._cachedOutline=y.o.split(" "));o=c.length;for(b=0;b<o;)switch(m=c[b++],m){case "m":m=c[b++]*
|
|
|
-e+f;p=c[b++]*e;j.push(new THREE.Vector2(m,p));h.moveTo(m,p);break;case "l":m=c[b++]*e+f;p=c[b++]*e;j.push(new THREE.Vector2(m,p));h.lineTo(m,p);break;case "q":m=c[b++]*e+f;p=c[b++]*e;v=c[b++]*e+f;u=c[b++]*e;h.quadraticCurveTo(v,u,m,p);if(g=j[j.length-1]){n=g.x;t=g.y;g=1;for(divisions=this.divisions;g<=divisions;g++){var x=g/divisions,I=THREE.Shape.Utils.b2(x,n,v,m),x=THREE.Shape.Utils.b2(x,t,u,p);j.push(new THREE.Vector2(I,x))}}break;case "b":if(m=c[b++]*e+f,p=c[b++]*e,v=c[b++]*e+f,u=c[b++]*-e,w=
|
|
|
-c[b++]*e+f,A=c[b++]*-e,h.bezierCurveTo(m,p,v,u,w,A),g=j[j.length-1]){n=g.x;t=g.y;g=1;for(divisions=this.divisions;g<=divisions;g++)x=g/divisions,I=THREE.Shape.Utils.b3(x,n,v,w,m),x=THREE.Shape.Utils.b3(x,t,u,A,p),j.push(new THREE.Vector2(I,x))}}}return{offset:y.ha*e,points:j,path:h}}}};
|
|
|
+THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){return this.faces[this.face][this.weight][this.style]},getTextShapes:function(b,c){return(new TextPath(b,c)).toShapes()},loadFace:function(b){var c=b.familyName.toLowerCase();this.faces[c]=this.faces[c]||{};this.faces[c][b.cssFontWeight]=this.faces[c][b.cssFontWeight]||{};this.faces[c][b.cssFontWeight][b.cssFontStyle]=b;return this.faces[c][b.cssFontWeight][b.cssFontStyle]=b},drawText:function(b){for(var c=
|
|
|
+this.getFace(),e=this.size/c.resolution,f=0,h=String(b).split(""),j=h.length,g=[],b=0;b<j;b++){var m=new THREE.Path,m=this.extractGlyphPoints(h[b],c,e,f,m);f+=m.offset;g.push(m.path)}return{paths:g,offset:f/2}},extractGlyphPoints:function(b,c,e,f,h){var j=[],g,m,o,p,n,t,v,u,w,A,y=c.glyphs[b]||c.glyphs[ctxt.options.fallbackCharacter];if(y){if(y.o){c=y._cachedOutline||(y._cachedOutline=y.o.split(" "));o=c.length;for(b=0;b<o;)switch(m=c[b++],m){case "m":m=c[b++]*e+f;p=c[b++]*e;j.push(new THREE.Vector2(m,
|
|
|
+p));h.moveTo(m,p);break;case "l":m=c[b++]*e+f;p=c[b++]*e;j.push(new THREE.Vector2(m,p));h.lineTo(m,p);break;case "q":m=c[b++]*e+f;p=c[b++]*e;v=c[b++]*e+f;u=c[b++]*e;h.quadraticCurveTo(v,u,m,p);if(g=j[j.length-1]){n=g.x;t=g.y;g=1;for(divisions=this.divisions;g<=divisions;g++){var x=g/divisions,I=THREE.Shape.Utils.b2(x,n,v,m),x=THREE.Shape.Utils.b2(x,t,u,p);j.push(new THREE.Vector2(I,x))}}break;case "b":if(m=c[b++]*e+f,p=c[b++]*e,v=c[b++]*e+f,u=c[b++]*-e,w=c[b++]*e+f,A=c[b++]*-e,h.bezierCurveTo(m,p,
|
|
|
+v,u,w,A),g=j[j.length-1]){n=g.x;t=g.y;g=1;for(divisions=this.divisions;g<=divisions;g++)x=g/divisions,I=THREE.Shape.Utils.b3(x,n,v,w,m),x=THREE.Shape.Utils.b3(x,t,u,A,p),j.push(new THREE.Vector2(I,x))}}}return{offset:y.ha*e,points:j,path:h}}}};
|
|
|
(function(b){var c=function(b){for(var c=b.length,h=0,j=c-1,g=0;g<c;j=g++)h+=b[j].x*b[g].y-b[g].x*b[j].y;return h*0.5};b.Triangulate=function(b,f){var h=b.length;if(h<3)return null;var j=[],g=[],m=[],o,p,n;if(c(b)>0)for(p=0;p<h;p++)g[p]=p;else for(p=0;p<h;p++)g[p]=h-1-p;var t=2*h;for(p=h-1;h>2;){if(t--<=0){console.log("Warning, unable to triangulate polygon!");if(f)return m;return j}o=p;h<=o&&(o=0);p=o+1;h<=p&&(p=0);n=p+1;h<=n&&(n=0);var v;a:{v=b;var u=o,w=p,A=n,y=h,x=g,I=void 0,B=void 0,E=void 0,
|
|
|
G=void 0,H=void 0,Q=void 0,F=void 0,C=void 0,N=void 0,B=v[x[u]].x,E=v[x[u]].y,G=v[x[w]].x,H=v[x[w]].y,Q=v[x[A]].x,F=v[x[A]].y;if(1.0E-10>(G-B)*(F-E)-(H-E)*(Q-B))v=!1;else{for(I=0;I<y;I++)if(!(I==u||I==w||I==A)){var C=v[x[I]].x,N=v[x[I]].y,W=void 0,K=void 0,X=void 0,L=void 0,U=void 0,k=void 0,Z=void 0,P=void 0,aa=void 0,ea=void 0,Y=void 0,$=void 0,W=X=U=void 0,W=Q-G,K=F-H,X=B-Q,L=E-F,U=G-B,k=H-E,Z=C-B,P=N-E,aa=C-G,ea=N-H,Y=C-Q,$=N-F,W=W*ea-K*aa,U=U*P-k*Z,X=X*$-L*Y;if(W>=0&&X>=0&&U>=0){v=!1;break a}}v=
|
|
|
!0}}if(v){j.push([b[g[o]],b[g[p]],b[g[n]]]);m.push([g[o],g[p],g[n]]);o=p;for(n=p+1;n<h;o++,n++)g[o]=g[n];h--;t=2*h}}if(f)return m;return j};b.Triangulate.area=c;return b})(THREE.FontUtils);window._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
|