|
@@ -1,20 +1,20 @@
|
|
|
// ThreeExtras.js r47dev - http://github.com/mrdoob/three.js
|
|
|
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,g=Math.max(Math.max(c,d),e),f=Math.min(Math.min(c,d),e);if(f===g)f=c=0;else{var h=g-f,f=h/g,c=c===g?(d-e)/h:d===g?2+(e-c)/h:4+(c-d)/h;c/=6;c<0&&(c+=1);c>1&&(c-=1)}b===void 0&&(b={h:0,s:0,v:0});b.h=c;b.s=f;b.v=g;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,g=b instanceof THREE.Mesh?b.geometry:b,f=a.vertices,h=g.vertices,i=a.faces,k=g.faces,j=a.faceVertexUvs[0],q=g.faceVertexUvs[0],p={},m=0;m<a.materials.length;m++)p[a.materials[m].id]=m;if(b instanceof THREE.Mesh)b.matrixAutoUpdate&&b.updateMatrix(),c=b.matrix,d=new THREE.Matrix4,d.extractRotation(c,b.scale);for(var m=0,l=h.length;m<l;m++){var n=new THREE.Vertex(h[m].position.clone());c&&c.multiplyVector3(n.position);f.push(n)}m=
|
|
|
-0;for(l=k.length;m<l;m++){var f=k[m],r,o,s=f.vertexNormals,t=f.vertexColors;f instanceof THREE.Face3?r=new THREE.Face3(f.a+e,f.b+e,f.c+e):f instanceof THREE.Face4&&(r=new THREE.Face4(f.a+e,f.b+e,f.c+e,f.d+e));r.normal.copy(f.normal);d&&d.multiplyVector3(r.normal);h=0;for(n=s.length;h<n;h++)o=s[h].clone(),d&&d.multiplyVector3(o),r.vertexNormals.push(o);r.color.copy(f.color);h=0;for(n=t.length;h<n;h++)o=t[h],r.vertexColors.push(o.clone());if(f.materialIndex!==void 0){h=g.materials[f.materialIndex];
|
|
|
-n=h.id;t=p[n];if(t===void 0)t=a.materials.length,p[n]=t,a.materials.push(h);r.materialIndex=t}r.centroid.copy(f.centroid);c&&c.multiplyVector3(r.centroid);i.push(r)}m=0;for(l=q.length;m<l;m++){c=q[m];d=[];h=0;for(n=c.length;h<n;h++)d.push(new THREE.UV(c[h].u,c[h].v));j.push(d)}},clone:function(a){var b=new THREE.Geometry,c,d=a.vertices,e=a.faces,g=a.faceVertexUvs[0];if(a.materials)b.materials=a.materials.slice();a=0;for(c=d.length;a<c;a++){var f=new THREE.Vertex(d[a].position.clone());b.vertices.push(f)}a=
|
|
|
+THREE.GeometryUtils={merge:function(a,b){for(var c,d,e=a.vertices.length,g=b instanceof THREE.Mesh?b.geometry:b,f=a.vertices,h=g.vertices,i=a.faces,k=g.faces,j=a.faceVertexUvs[0],q=g.faceVertexUvs[0],n={},m=0;m<a.materials.length;m++)n[a.materials[m].id]=m;if(b instanceof THREE.Mesh)b.matrixAutoUpdate&&b.updateMatrix(),c=b.matrix,d=new THREE.Matrix4,d.extractRotation(c,b.scale);for(var m=0,l=h.length;m<l;m++){var o=new THREE.Vertex(h[m].position.clone());c&&c.multiplyVector3(o.position);f.push(o)}m=
|
|
|
+0;for(l=k.length;m<l;m++){var f=k[m],r,p,s=f.vertexNormals,t=f.vertexColors;f instanceof THREE.Face3?r=new THREE.Face3(f.a+e,f.b+e,f.c+e):f instanceof THREE.Face4&&(r=new THREE.Face4(f.a+e,f.b+e,f.c+e,f.d+e));r.normal.copy(f.normal);d&&d.multiplyVector3(r.normal);h=0;for(o=s.length;h<o;h++)p=s[h].clone(),d&&d.multiplyVector3(p),r.vertexNormals.push(p);r.color.copy(f.color);h=0;for(o=t.length;h<o;h++)p=t[h],r.vertexColors.push(p.clone());if(f.materialIndex!==void 0){h=g.materials[f.materialIndex];
|
|
|
+o=h.id;t=n[o];if(t===void 0)t=a.materials.length,n[o]=t,a.materials.push(h);r.materialIndex=t}r.centroid.copy(f.centroid);c&&c.multiplyVector3(r.centroid);i.push(r)}m=0;for(l=q.length;m<l;m++){c=q[m];d=[];h=0;for(o=c.length;h<o;h++)d.push(new THREE.UV(c[h].u,c[h].v));j.push(d)}},clone:function(a){var b=new THREE.Geometry,c,d=a.vertices,e=a.faces,g=a.faceVertexUvs[0];if(a.materials)b.materials=a.materials.slice();a=0;for(c=d.length;a<c;a++){var f=new THREE.Vertex(d[a].position.clone());b.vertices.push(f)}a=
|
|
|
0;for(c=e.length;a<c;a++){var h=e[a],i,k,j=h.vertexNormals,q=h.vertexColors;h instanceof THREE.Face3?i=new THREE.Face3(h.a,h.b,h.c):h instanceof THREE.Face4&&(i=new THREE.Face4(h.a,h.b,h.c,h.d));i.normal.copy(h.normal);d=0;for(f=j.length;d<f;d++)k=j[d],i.vertexNormals.push(k.clone());i.color.copy(h.color);d=0;for(f=q.length;d<f;d++)k=q[d],i.vertexColors.push(k.clone());i.materialIndex=h.materialIndex;i.centroid.copy(h.centroid);b.faces.push(i)}a=0;for(c=g.length;a<c;a++){e=g[a];i=[];d=0;for(f=e.length;d<
|
|
|
f;d++)i.push(new THREE.UV(e[d].u,e[d].v));b.faceVertexUvs[0].push(i)}return b},randomPointInTriangle:function(a,b,c){var d,e,g,f=new THREE.Vector3,h=THREE.GeometryUtils.__v1;d=THREE.GeometryUtils.random();e=THREE.GeometryUtils.random();d+e>1&&(d=1-d,e=1-e);g=1-d-e;f.copy(a);f.multiplyScalar(d);h.copy(b);h.multiplyScalar(e);f.addSelf(h);h.copy(c);h.multiplyScalar(g);f.addSelf(h);return f},randomPointInFace:function(a,b,c){var d,e,g;if(a instanceof THREE.Face3)return d=b.vertices[a.a].position,e=b.vertices[a.b].position,
|
|
|
g=b.vertices[a.c].position,THREE.GeometryUtils.randomPointInTriangle(d,e,g);else if(a instanceof THREE.Face4){d=b.vertices[a.a].position;e=b.vertices[a.b].position;g=b.vertices[a.c].position;var b=b.vertices[a.d].position,f;c?a._area1&&a._area2?(c=a._area1,f=a._area2):(c=THREE.GeometryUtils.triangleArea(d,e,b),f=THREE.GeometryUtils.triangleArea(e,g,b),a._area1=c,a._area2=f):(c=THREE.GeometryUtils.triangleArea(d,e,b),f=THREE.GeometryUtils.triangleArea(e,g,b));return THREE.GeometryUtils.random()*(c+
|
|
|
-f)<c?THREE.GeometryUtils.randomPointInTriangle(d,e,b):THREE.GeometryUtils.randomPointInTriangle(e,g,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,g=a.faces,f=a.vertices,h=g.length,i=0,k=[],j,q,p,m;for(e=0;e<h;e++){d=g[e];if(d instanceof THREE.Face3)j=f[d.a].position,q=f[d.b].position,p=f[d.c].position,d._area=THREE.GeometryUtils.triangleArea(j,q,p);else if(d instanceof
|
|
|
-THREE.Face4)j=f[d.a].position,q=f[d.b].position,p=f[d.c].position,m=f[d.d].position,d._area1=THREE.GeometryUtils.triangleArea(j,q,m),d._area2=THREE.GeometryUtils.triangleArea(q,p,m),d._area=d._area1+d._area2;i+=d._area;k[e]=i}d=[];f={};for(e=0;e<b;e++)h=THREE.GeometryUtils.random()*i,h=c(h),d[e]=THREE.GeometryUtils.randomPointInFace(g[h],a,!0),f[h]?f[h]+=1:f[h]=1;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();
|
|
|
+f)<c?THREE.GeometryUtils.randomPointInTriangle(d,e,b):THREE.GeometryUtils.randomPointInTriangle(e,g,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,g=a.faces,f=a.vertices,h=g.length,i=0,k=[],j,q,n,m;for(e=0;e<h;e++){d=g[e];if(d instanceof THREE.Face3)j=f[d.a].position,q=f[d.b].position,n=f[d.c].position,d._area=THREE.GeometryUtils.triangleArea(j,q,n);else if(d instanceof
|
|
|
+THREE.Face4)j=f[d.a].position,q=f[d.b].position,n=f[d.c].position,m=f[d.d].position,d._area1=THREE.GeometryUtils.triangleArea(j,q,m),d._area2=THREE.GeometryUtils.triangleArea(q,n,m),d._area=d._area1+d._area2;i+=d._area;k[e]=i}d=[];f={};for(e=0;e<b;e++)h=THREE.GeometryUtils.random()*i,h=c(h),d[e]=THREE.GeometryUtils.randomPointInFace(g[h],a,!0),f[h]?f[h]+=1:f[h]=1;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).setTranslation(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,g=d.length;e<g;e++)d[e].u!==1&&(d[e].u-=Math.floor(d[e].u)),d[e].v!==1&&(d[e].v-=Math.floor(d[e].v))}};THREE.GeometryUtils.random=THREE.Math.random16;
|
|
|
THREE.GeometryUtils.__v1=new THREE.Vector3;
|
|
|
THREE.ImageUtils={crossOrigin:"",loadTexture:function(a,b,c){var d=new Image,e=new THREE.Texture(d,b);d.onload=function(){e.needsUpdate=!0;c&&c(this)};d.crossOrigin=this.crossOrigin;d.src=a;return e},loadTextureCube:function(a,b,c){var d,e=[],g=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+=1;if(e.loadCount===6)g.needsUpdate=!0;c&&c(this)},e[b].crossOrigin="",e[b].src=a[b];return g},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|=1;var d=a.width,e=a.height,g=document.createElement("canvas");g.width=d;g.height=e;var f=g.getContext("2d");f.drawImage(a,0,0);for(var h=f.getImageData(0,0,d,e).data,i=f.createImageData(d,e),k=i.data,j=0;j<d;j++)for(var q=1;q<e;q++){var p=q-1<0?e-1:q-1,m=(q+1)%e,l=j-1<0?d-1:j-1,n=(j+1)%d,r=[],o=[0,0,h[(q*d+j)*4]/255*b];r.push([-1,0,h[(q*d+l)*4]/255*b]);r.push([-1,-1,h[(p*d+l)*4]/255*b]);r.push([0,-1,h[(p*d+j)*4]/255*b]);r.push([1,
|
|
|
--1,h[(p*d+n)*4]/255*b]);r.push([1,0,h[(q*d+n)*4]/255*b]);r.push([1,1,h[(m*d+n)*4]/255*b]);r.push([0,1,h[(m*d+j)*4]/255*b]);r.push([-1,1,h[(m*d+l)*4]/255*b]);p=[];l=r.length;for(m=0;m<l;m++){var n=r[m],s=r[(m+1)%l],n=[n[0]-o[0],n[1]-o[1],n[2]-o[2]],s=[s[0]-o[0],s[1]-o[1],s[2]-o[2]];p.push(c([n[1]*s[2]-n[2]*s[1],n[2]*s[0]-n[0]*s[2],n[0]*s[1]-n[1]*s[0]]))}r=[0,0,0];for(m=0;m<p.length;m++)r[0]+=p[m][0],r[1]+=p[m][1],r[2]+=p[m][2];r[0]/=p.length;r[1]/=p.length;r[2]/=p.length;o=(q*d+j)*4;k[o]=(r[0]+1)/
|
|
|
-2*255|0;k[o+1]=(r[1]+0.5)*255|0;k[o+2]=r[2]*255|0;k[o+3]=255}f.putImageData(i,0,0);return g}};
|
|
|
+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|=1;var d=a.width,e=a.height,g=document.createElement("canvas");g.width=d;g.height=e;var f=g.getContext("2d");f.drawImage(a,0,0);for(var h=f.getImageData(0,0,d,e).data,i=f.createImageData(d,e),k=i.data,j=0;j<d;j++)for(var q=1;q<e;q++){var n=q-1<0?e-1:q-1,m=(q+1)%e,l=j-1<0?d-1:j-1,o=(j+1)%d,r=[],p=[0,0,h[(q*d+j)*4]/255*b];r.push([-1,0,h[(q*d+l)*4]/255*b]);r.push([-1,-1,h[(n*d+l)*4]/255*b]);r.push([0,-1,h[(n*d+j)*4]/255*b]);r.push([1,
|
|
|
+-1,h[(n*d+o)*4]/255*b]);r.push([1,0,h[(q*d+o)*4]/255*b]);r.push([1,1,h[(m*d+o)*4]/255*b]);r.push([0,1,h[(m*d+j)*4]/255*b]);r.push([-1,1,h[(m*d+l)*4]/255*b]);n=[];l=r.length;for(m=0;m<l;m++){var o=r[m],s=r[(m+1)%l],o=[o[0]-p[0],o[1]-p[1],o[2]-p[2]],s=[s[0]-p[0],s[1]-p[1],s[2]-p[2]];n.push(c([o[1]*s[2]-o[2]*s[1],o[2]*s[0]-o[0]*s[2],o[0]*s[1]-o[1]*s[0]]))}r=[0,0,0];for(m=0;m<n.length;m++)r[0]+=n[m][0],r[1]+=n[m][1],r[2]+=n[m][2];r[0]/=n.length;r[1]/=n.length;r[2]/=n.length;p=(q*d+j)*4;k[p]=(r[0]+1)/
|
|
|
+2*255|0;k[p+1]=(r[1]+0.5)*255|0;k[p+2]=r[2]*255|0;k[p+3]=255}f.putImageData(i,0,0);return g}};
|
|
|
THREE.SceneUtils={showHierarchy:function(a,b){THREE.SceneUtils.traverseHierarchy(a,function(a){a.visible=b})},traverseHierarchy:function(a,b){var c,d,e=a.children.length;for(d=0;d<e;d++)c=a.children[d],b(c),THREE.SceneUtils.traverseHierarchy(c,b)},createMultiMaterialObject:function(a,b){var c,d=b.length,e=new THREE.Object3D;for(c=0;c<d;c++){var g=new THREE.Mesh(a,b[c]);e.add(g)}return e},cloneObject:function(a){var b;a instanceof THREE.MorphAnimMesh?(b=new THREE.MorphAnimMesh(a.geometry,a.material),
|
|
|
b.duration=a.duration,b.mirroredLoop=a.mirroredLoop,b.time=a.time,b.lastKeyframe=a.lastKeyframe,b.currentKeyframe=a.currentKeyframe,b.direction=a.direction,b.directionBackwards=a.directionBackwards):a instanceof THREE.SkinnedMesh?b=new THREE.SkinnedMesh(a.geometry,a.material):a instanceof THREE.Mesh?b=new THREE.Mesh(a.geometry,a.material):a instanceof THREE.Line?b=new THREE.Line(a.geometry,a.material,a.type):a instanceof THREE.Ribbon?b=new THREE.Ribbon(a.geometry,a.material):a instanceof THREE.ParticleSystem?
|
|
|
(b=new THREE.ParticleSystem(a.geometry,a.material),b.sortParticles=a.sortParticles):a instanceof THREE.Particle?b=new THREE.Particle(a.material):a instanceof THREE.Sprite?(b=new THREE.Sprite({}),b.color.copy(a.color),b.map=a.map,b.blending=a.blending,b.useScreenCoordinates=a.useScreenCoordinates,b.mergeWith3D=a.mergeWith3D,b.affectedByDistance=a.affectedByDistance,b.scaleByViewport=a.scaleByViewport,b.alignment=a.alignment,b.rotation3d.copy(a.rotation3d),b.rotation=a.rotation,b.opacity=a.opacity,
|
|
@@ -60,9 +60,9 @@ THREE.Path.prototype.quadraticCurveTo=function(a,b,c,d){var e=Array.prototype.sl
|
|
|
THREE.Path.prototype.bezierCurveTo=function(a,b,c,d,e,g){var f=Array.prototype.slice.call(arguments),h=this.actions[this.actions.length-1].args;this.curves.push(new THREE.CubicBezierCurve(new THREE.Vector2(h[h.length-2],h[h.length-1]),new THREE.Vector2(a,b),new THREE.Vector2(c,d),new THREE.Vector2(e,g)));this.actions.push({action:THREE.PathActions.BEZIER_CURVE_TO,args:f})};
|
|
|
THREE.Path.prototype.splineThru=function(a){var b=Array.prototype.slice.call(arguments),c=this.actions[this.actions.length-1].args,c=[new THREE.Vector2(c[c.length-2],c[c.length-1])];Array.prototype.push.apply(c,a);this.curves.push(new THREE.SplineCurve(c));this.actions.push({action:THREE.PathActions.CSPLINE_THRU,args:b})};
|
|
|
THREE.Path.prototype.arc=function(a,b,c,d,e,g){var f=Array.prototype.slice.call(arguments);this.curves.push(new THREE.ArcCurve(a,b,c,d,e,g));this.actions.push({action:THREE.PathActions.ARC,args:f})};THREE.Path.prototype.getSpacedPoints=function(a){a||(a=40);for(var b=[],c=0;c<a;c++)b.push(this.getPoint(c/a));return b};
|
|
|
-THREE.Path.prototype.getPoints=function(a,b){var a=a||12,c=[],d,e,g,f,h,i,k,j,q,p,m,l,n;d=0;for(e=this.actions.length;d<e;d++)switch(g=this.actions[d],f=g.action,g=g.args,f){case THREE.PathActions.LINE_TO:c.push(new THREE.Vector2(g[0],g[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:h=g[2];i=g[3];q=g[0];p=g[1];c.length>0?(f=c[c.length-1],m=f.x,l=f.y):(f=this.actions[d-1].args,m=f[f.length-2],l=f[f.length-1]);for(f=1;f<=a;f++)n=f/a,g=THREE.Shape.Utils.b2(n,m,q,h),n=THREE.Shape.Utils.b2(n,l,p,
|
|
|
-i),c.push(new THREE.Vector2(g,n));break;case THREE.PathActions.BEZIER_CURVE_TO:h=g[4];i=g[5];q=g[0];p=g[1];k=g[2];j=g[3];c.length>0?(f=c[c.length-1],m=f.x,l=f.y):(f=this.actions[d-1].args,m=f[f.length-2],l=f[f.length-1]);for(f=1;f<=a;f++)n=f/a,g=THREE.Shape.Utils.b3(n,m,q,k,h),n=THREE.Shape.Utils.b3(n,l,p,j,i),c.push(new THREE.Vector2(g,n));break;case THREE.PathActions.CSPLINE_THRU:f=this.actions[d-1].args;f=[new THREE.Vector2(f[f.length-2],f[f.length-1])];n=a*g[0].length;f=f.concat(g[0]);g=new THREE.SplineCurve(f);
|
|
|
-for(f=1;f<=n;f++)c.push(g.getPointAt(f/n));break;case THREE.PathActions.ARC:f=this.actions[d-1].args;h=g[0];i=g[1];k=g[2];q=g[3];n=g[4];p=!!g[5];j=f[f.length-2];m=f[f.length-1];f.length==0&&(j=m=0);l=n-q;var r=a*2;for(f=1;f<=r;f++)n=f/r,p||(n=1-n),n=q+n*l,g=j+h+k*Math.cos(n),n=m+i+k*Math.sin(n),c.push(new THREE.Vector2(g,n))}b&&c.push(c[0]);return c};THREE.Path.prototype.transform=function(a,b){this.getBoundingBox();return this.getWrapPoints(this.getPoints(b),a)};
|
|
|
+THREE.Path.prototype.getPoints=function(a,b){var a=a||12,c=[],d,e,g,f,h,i,k,j,q,n,m,l,o;d=0;for(e=this.actions.length;d<e;d++)switch(g=this.actions[d],f=g.action,g=g.args,f){case THREE.PathActions.LINE_TO:c.push(new THREE.Vector2(g[0],g[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:h=g[2];i=g[3];q=g[0];n=g[1];c.length>0?(f=c[c.length-1],m=f.x,l=f.y):(f=this.actions[d-1].args,m=f[f.length-2],l=f[f.length-1]);for(f=1;f<=a;f++)o=f/a,g=THREE.Shape.Utils.b2(o,m,q,h),o=THREE.Shape.Utils.b2(o,l,n,
|
|
|
+i),c.push(new THREE.Vector2(g,o));break;case THREE.PathActions.BEZIER_CURVE_TO:h=g[4];i=g[5];q=g[0];n=g[1];k=g[2];j=g[3];c.length>0?(f=c[c.length-1],m=f.x,l=f.y):(f=this.actions[d-1].args,m=f[f.length-2],l=f[f.length-1]);for(f=1;f<=a;f++)o=f/a,g=THREE.Shape.Utils.b3(o,m,q,k,h),o=THREE.Shape.Utils.b3(o,l,n,j,i),c.push(new THREE.Vector2(g,o));break;case THREE.PathActions.CSPLINE_THRU:f=this.actions[d-1].args;f=[new THREE.Vector2(f[f.length-2],f[f.length-1])];o=a*g[0].length;f=f.concat(g[0]);g=new THREE.SplineCurve(f);
|
|
|
+for(f=1;f<=o;f++)c.push(g.getPointAt(f/o));break;case THREE.PathActions.ARC:f=this.actions[d-1].args;h=g[0];i=g[1];k=g[2];q=g[3];o=g[4];n=!!g[5];j=f[f.length-2];m=f[f.length-1];f.length==0&&(j=m=0);l=o-q;var r=a*2;for(f=1;f<=r;f++)o=f/r,n||(o=1-o),o=q+o*l,g=j+h+k*Math.cos(o),o=m+i+k*Math.sin(o),c.push(new THREE.Vector2(g,o))}b&&c.push(c[0]);return c};THREE.Path.prototype.transform=function(a,b){this.getBoundingBox();return this.getWrapPoints(this.getPoints(b),a)};
|
|
|
THREE.Path.prototype.nltransform=function(a,b,c,d,e,g){var f=this.getPoints(),h,i,k,j,q;h=0;for(i=f.length;h<i;h++)k=f[h],j=k.x,q=k.y,k.x=a*j+b*q+c,k.y=d*q+e*j+g;return f};
|
|
|
THREE.Path.prototype.debug=function(a){var b=this.getBoundingBox();a||(a=document.createElement("canvas"),a.setAttribute("width",b.maxX+100),a.setAttribute("height",b.maxY+100),document.body.appendChild(a));b=a.getContext("2d");b.fillStyle="white";b.fillRect(0,0,a.width,a.height);b.strokeStyle="black";b.beginPath();var c,d,e,a=0;for(c=this.actions.length;a<c;a++)d=this.actions[a],e=d.args,d=d.action,d!=THREE.PathActions.CSPLINE_THRU&&b[d].apply(b,e);b.stroke();b.closePath();b.strokeStyle="red";d=
|
|
|
this.getPoints();a=0;for(c=d.length;a<c;a++)e=d[a],b.beginPath(),b.arc(e.x,e.y,1.5,0,Math.PI*2,!1),b.stroke(),b.closePath()};
|
|
@@ -70,8 +70,8 @@ THREE.Path.prototype.toShapes=function(){var a,b,c,d,e=[],g=new THREE.Path;a=0;f
|
|
|
d.curves):f.holes.push(d);g.push(f)}else{f=new THREE.Shape;a=0;for(b=e.length;a<b;a++)d=e[a],THREE.Shape.Utils.isClockWise(d.getPoints())?(f.actions=d.actions,f.curves=d.curves,g.push(f),f=new THREE.Shape):f.holes.push(d)}return g};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(a){var b,c=this.holes.length,d=[];for(b=0;b<c;b++)d[b]=this.holes[b].getTransformedPoints(a,this.bends);return d};THREE.Shape.prototype.getSpacedPointsHoles=function(a){var b,c=this.holes.length,d=[];for(b=0;b<c;b++)d[b]=this.holes[b].getTransformedSpacedPoints(a,this.bends);return d};THREE.Shape.prototype.extractAllPoints=function(a){return{shape:this.getTransformedPoints(a),holes:this.getPointsHoles(a)}};
|
|
|
THREE.Shape.prototype.extractAllSpacedPoints=function(a){return{shape:this.getTransformedSpacedPoints(a),holes:this.getSpacedPointsHoles(a)}};
|
|
|
-THREE.Shape.Utils={removeHoles:function(a,b){var c=a.concat(),d=c.concat(),e,g,f,h,i,k,j,q,p,m,l=[];for(i=0;i<b.length;i++){k=b[i];Array.prototype.push.apply(d,k);g=Number.POSITIVE_INFINITY;for(e=0;e<k.length;e++){p=k[e];m=[];for(q=0;q<c.length;q++)j=c[q],j=p.distanceToSquared(j),m.push(j),j<g&&(g=j,f=e,h=q)}e=h-1>=0?h-1:c.length-1;g=f-1>=0?f-1:k.length-1;var n=[k[f],c[h],c[e]];q=THREE.FontUtils.Triangulate.area(n);var r=[k[f],k[g],c[h]];p=THREE.FontUtils.Triangulate.area(r);m=h;j=f;h+=1;f+=-1;h<
|
|
|
-0&&(h+=c.length);h%=c.length;f<0&&(f+=k.length);f%=k.length;e=h-1>=0?h-1:c.length-1;g=f-1>=0?f-1:k.length-1;n=[k[f],c[h],c[e]];n=THREE.FontUtils.Triangulate.area(n);r=[k[f],k[g],c[h]];r=THREE.FontUtils.Triangulate.area(r);q+p>n+r&&(h=m,f=j,h<0&&(h+=c.length),h%=c.length,f<0&&(f+=k.length),f%=k.length,e=h-1>=0?h-1:c.length-1,g=f-1>=0?f-1:k.length-1);q=c.slice(0,h);p=c.slice(h);m=k.slice(f);j=k.slice(0,f);g=[k[f],k[g],c[h]];l.push([k[f],c[h],c[e]]);l.push(g);c=q.concat(m).concat(j).concat(p)}return{shape:c,
|
|
|
+THREE.Shape.Utils={removeHoles:function(a,b){var c=a.concat(),d=c.concat(),e,g,f,h,i,k,j,q,n,m,l=[];for(i=0;i<b.length;i++){k=b[i];Array.prototype.push.apply(d,k);g=Number.POSITIVE_INFINITY;for(e=0;e<k.length;e++){n=k[e];m=[];for(q=0;q<c.length;q++)j=c[q],j=n.distanceToSquared(j),m.push(j),j<g&&(g=j,f=e,h=q)}e=h-1>=0?h-1:c.length-1;g=f-1>=0?f-1:k.length-1;var o=[k[f],c[h],c[e]];q=THREE.FontUtils.Triangulate.area(o);var r=[k[f],k[g],c[h]];n=THREE.FontUtils.Triangulate.area(r);m=h;j=f;h+=1;f+=-1;h<
|
|
|
+0&&(h+=c.length);h%=c.length;f<0&&(f+=k.length);f%=k.length;e=h-1>=0?h-1:c.length-1;g=f-1>=0?f-1:k.length-1;o=[k[f],c[h],c[e]];o=THREE.FontUtils.Triangulate.area(o);r=[k[f],k[g],c[h]];r=THREE.FontUtils.Triangulate.area(r);q+n>o+r&&(h=m,f=j,h<0&&(h+=c.length),h%=c.length,f<0&&(f+=k.length),f%=k.length,e=h-1>=0?h-1:c.length-1,g=f-1>=0?f-1:k.length-1);q=c.slice(0,h);n=c.slice(h);m=k.slice(f);j=k.slice(0,f);g=[k[f],k[g],c[h]];l.push([k[f],c[h],c[e]]);l.push(g);c=q.concat(m).concat(j).concat(n)}return{shape:c,
|
|
|
isolatedPts:l,allpoints:d}},triangulateShape:function(a,b){var c=THREE.Shape.Utils.removeHoles(a,b),d=c.allpoints,e=c.isolatedPts,c=THREE.FontUtils.Triangulate(c.shape,!1),g,f,h,i,k={};g=0;for(f=d.length;g<f;g++)i=d[g].x+":"+d[g].y,k[i]!==void 0&&console.log("Duplicate point",i),k[i]=g;g=0;for(f=c.length;g<f;g++){h=c[g];for(d=0;d<3;d++)i=h[d].x+":"+h[d].y,i=k[i],i!==void 0&&(h[d]=i)}g=0;for(f=e.length;g<f;g++){h=e[g];for(d=0;d<3;d++)i=h[d].x+":"+h[d].y,i=k[i],i!==void 0&&(h[d]=i)}return c.concat(e)},
|
|
|
isClockWise:function(a){return THREE.FontUtils.Triangulate.area(a)<0},b2p0:function(a,b){var c=1-a;return c*c*b},b2p1:function(a,b){return 2*(1-a)*a*b},b2p2:function(a,b){return a*a*b},b2:function(a,b,c,d){return this.b2p0(a,b)+this.b2p1(a,c)+this.b2p2(a,d)},b3p0:function(a,b){var c=1-a;return c*c*c*b},b3p1:function(a,b){var c=1-a;return 3*c*c*a*b},b3p2:function(a,b){return 3*(1-a)*a*a*b},b3p3:function(a,b){return a*a*a*b},b3:function(a,b,c,d,e){return this.b3p0(a,b)+this.b3p1(a,c)+this.b3p2(a,d)+
|
|
|
this.b3p3(a,e)}};THREE.TextPath=function(a,b){THREE.Path.call(this);this.parameters=b||{};this.set(a)};THREE.TextPath.prototype.set=function(a,b){this.text=a;var b=b||this.parameters,c=b.curveSegments!==void 0?b.curveSegments:4,d=b.font!==void 0?b.font:"helvetiker",e=b.weight!==void 0?b.weight:"normal",g=b.style!==void 0?b.style:"normal";THREE.FontUtils.size=b.size!==void 0?b.size:100;THREE.FontUtils.divisions=c;THREE.FontUtils.face=d;THREE.FontUtils.weight=e;THREE.FontUtils.style=g};
|
|
@@ -85,8 +85,8 @@ THREE.Animation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=
|
|
|
THREE.Bone?e.skinMatrix:e.matrix;var g=e.animationCache.prevKey;e=e.animationCache.nextKey;g.pos=this.data.hierarchy[c].keys[0];g.rot=this.data.hierarchy[c].keys[0];g.scl=this.data.hierarchy[c].keys[0];e.pos=this.getNextKeyWith("pos",c,1);e.rot=this.getNextKeyWith("rot",c,1);e.scl=this.getNextKeyWith("scl",c,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
|
|
|
THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
|
|
|
THREE.Animation.prototype.stop=function(){this.isPaused=this.isPlaying=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.hierarchy.length;a++)if(this.hierarchy[a].animationCache!==void 0)this.hierarchy[a]instanceof THREE.Bone?this.hierarchy[a].skinMatrix=this.hierarchy[a].animationCache.originalMatrix:this.hierarchy[a].matrix=this.hierarchy[a].animationCache.originalMatrix,delete this.hierarchy[a].animationCache};
|
|
|
-THREE.Animation.prototype.update=function(a){if(this.isPlaying){var b=["pos","rot","scl"],c,d,e,g,f,h,i,k,j=this.data.JIT.hierarchy,q,p;this.currentTime+=a*this.timeScale;p=this.currentTime;q=this.currentTime%=this.data.length;k=parseInt(Math.min(q*this.data.fps,this.data.length*this.data.fps),10);for(var m=0,l=this.hierarchy.length;m<l;m++)if(a=this.hierarchy[m],i=a.animationCache,this.JITCompile&&j[m][k]!==void 0)a instanceof THREE.Bone?(a.skinMatrix=j[m][k],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=
|
|
|
-!1):(a.matrix=j[m][k],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=!0);else{if(this.JITCompile)a instanceof THREE.Bone?a.skinMatrix=a.animationCache.originalMatrix:a.matrix=a.animationCache.originalMatrix;for(var n=0;n<3;n++){c=b[n];f=i.prevKey[c];h=i.nextKey[c];if(h.time<=p){if(q<p)if(this.loop){f=this.data.hierarchy[m].keys[0];for(h=this.getNextKeyWith(c,m,1);h.time<q;)f=h,h=this.getNextKeyWith(c,m,h.index+1)}else{this.stop();return}else{do f=h,h=this.getNextKeyWith(c,m,h.index+1);while(h.time<
|
|
|
+THREE.Animation.prototype.update=function(a){if(this.isPlaying){var b=["pos","rot","scl"],c,d,e,g,f,h,i,k,j=this.data.JIT.hierarchy,q,n;this.currentTime+=a*this.timeScale;n=this.currentTime;q=this.currentTime%=this.data.length;k=parseInt(Math.min(q*this.data.fps,this.data.length*this.data.fps),10);for(var m=0,l=this.hierarchy.length;m<l;m++)if(a=this.hierarchy[m],i=a.animationCache,this.JITCompile&&j[m][k]!==void 0)a instanceof THREE.Bone?(a.skinMatrix=j[m][k],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=
|
|
|
+!1):(a.matrix=j[m][k],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=!0);else{if(this.JITCompile)a instanceof THREE.Bone?a.skinMatrix=a.animationCache.originalMatrix:a.matrix=a.animationCache.originalMatrix;for(var o=0;o<3;o++){c=b[o];f=i.prevKey[c];h=i.nextKey[c];if(h.time<=n){if(q<n)if(this.loop){f=this.data.hierarchy[m].keys[0];for(h=this.getNextKeyWith(c,m,1);h.time<q;)f=h,h=this.getNextKeyWith(c,m,h.index+1)}else{this.stop();return}else{do f=h,h=this.getNextKeyWith(c,m,h.index+1);while(h.time<
|
|
|
q)}i.prevKey[c]=f;i.nextKey[c]=h}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;d=(q-f.time)/(h.time-f.time);e=f[c];g=h[c];if(d<0||d>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+m),d=d<0?0:1;if(c==="pos")if(c=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)c.x=e[0]+(g[0]-e[0])*d,c.y=e[1]+(g[1]-e[1])*d,c.z=e[2]+(g[2]-e[2])*d;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
|
|
|
this.getPrevKeyWith("pos",m,f.index-1).pos,this.points[1]=e,this.points[2]=g,this.points[3]=this.getNextKeyWith("pos",m,h.index+1).pos,d=d*0.33+0.33,e=this.interpolateCatmullRom(this.points,d),c.x=e[0],c.y=e[1],c.z=e[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)d=this.interpolateCatmullRom(this.points,d*1.01),this.target.set(d[0],d[1],d[2]),this.target.subSelf(c),this.target.y=0,this.target.normalize(),d=Math.atan2(this.target.x,this.target.z),a.rotation.set(0,d,0)}else if(c===
|
|
|
"rot")THREE.Quaternion.slerp(e,g,a.quaternion,d);else if(c==="scl")c=a.scale,c.x=e[0]+(g[0]-e[0])*d,c.y=e[1]+(g[1]-e[1])*d,c.z=e[2]+(g[2]-e[2])*d}}if(this.JITCompile&&j[0][k]===void 0){this.hierarchy[0].updateMatrixWorld(!0);for(m=0;m<this.hierarchy.length;m++)j[m][k]=this.hierarchy[m]instanceof THREE.Bone?this.hierarchy[m].skinMatrix.clone():this.hierarchy[m].matrix.clone()}}};
|
|
@@ -100,7 +100,7 @@ e.matrix;e=this.data.hierarchy[c].keys;if(e.length)g.animationCache.prevKey=e[0]
|
|
|
THREE.KeyFrameAnimation.prototype.stop=function(){this.isPaused=this.isPlaying=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.hierarchy.length;a++){var b=this.hierarchy[a];if(b.animationCache!==void 0){var c=b.animationCache.originalMatrix;b instanceof THREE.Bone?(c.copy(b.skinMatrix),b.skinMatrix=c):(c.copy(b.matrix),b.matrix=c);delete b.animationCache}}};
|
|
|
THREE.KeyFrameAnimation.prototype.update=function(a){if(this.isPlaying){var b,c,d,e,g=this.data.JIT.hierarchy,f,h,i;this.currentTime+=a*this.timeScale;h=this.currentTime;f=this.currentTime%=this.data.length;if(f<this.startTimeMs)f=this.currentTime=this.startTimeMs+f;e=parseInt(Math.min(f*this.data.fps,this.data.length*this.data.fps),10);if((i=f<h)&&!this.loop){for(var a=0,k=this.hierarchy.length;a<k;a++){var j=this.data.hierarchy[a].keys,g=this.data.hierarchy[a].sids;d=j.length-1;e=this.hierarchy[a];
|
|
|
if(j.length){for(j=0;j<g.length;j++)f=g[j],(h=this.getPrevKeyWith(f,a,d))&&h.apply(f);this.data.hierarchy[a].node.updateMatrix();e.matrixWorldNeedsUpdate=!0}}this.stop()}else if(!(f<this.startTime)){a=0;for(k=this.hierarchy.length;a<k;a++){d=this.hierarchy[a];b=this.data.hierarchy[a];var j=b.keys,q=b.animationCache;if(this.JITCompile&&g[a][e]!==void 0)d instanceof THREE.Bone?(d.skinMatrix=g[a][e],d.matrixWorldNeedsUpdate=!1):(d.matrix=g[a][e],d.matrixWorldNeedsUpdate=!0);else if(j.length){if(this.JITCompile&&
|
|
|
-q)d instanceof THREE.Bone?d.skinMatrix=q.originalMatrix:d.matrix=q.originalMatrix;b=q.prevKey;c=q.nextKey;if(b&&c){if(c.time<=h){if(i&&this.loop){b=j[0];for(c=j[1];c.time<f;)b=c,c=j[b.index+1]}else if(!i)for(var p=j.length-1;c.time<f&&c.index!==p;)b=c,c=j[b.index+1];q.prevKey=b;q.nextKey=c}b.interpolate(c,f)}this.data.hierarchy[a].node.updateMatrix();d.matrixWorldNeedsUpdate=!0}}if(this.JITCompile&&g[0][e]===void 0){this.hierarchy[0].updateMatrixWorld(!0);for(a=0;a<this.hierarchy.length;a++)g[a][e]=
|
|
|
+q)d instanceof THREE.Bone?d.skinMatrix=q.originalMatrix:d.matrix=q.originalMatrix;b=q.prevKey;c=q.nextKey;if(b&&c){if(c.time<=h){if(i&&this.loop){b=j[0];for(c=j[1];c.time<f;)b=c,c=j[b.index+1]}else if(!i)for(var n=j.length-1;c.time<f&&c.index!==n;)b=c,c=j[b.index+1];q.prevKey=b;q.nextKey=c}b.interpolate(c,f)}this.data.hierarchy[a].node.updateMatrix();d.matrixWorldNeedsUpdate=!0}}if(this.JITCompile&&g[0][e]===void 0){this.hierarchy[0].updateMatrixWorld(!0);for(a=0;a<this.hierarchy.length;a++)g[a][e]=
|
|
|
this.hierarchy[a]instanceof THREE.Bone?this.hierarchy[a].skinMatrix.clone():this.hierarchy[a].matrix.clone()}}}};THREE.KeyFrameAnimation.prototype.getNextKeyWith=function(a,b,c){b=this.data.hierarchy[b].keys;for(c%=b.length;c<b.length;c++)if(b[c].hasTarget(a))return b[c];return b[0]};THREE.KeyFrameAnimation.prototype.getPrevKeyWith=function(a,b,c){b=this.data.hierarchy[b].keys;for(c=c>=0?c:c+b.length;c>=0;c--)if(b[c].hasTarget(a))return b[c];return b[b.length-1]};
|
|
|
THREE.CubeCamera=function(a,b,c,d){this.heightOffset=c;this.position=new THREE.Vector3(0,c,0);this.cameraPX=new THREE.PerspectiveCamera(90,1,a,b);this.cameraNX=new THREE.PerspectiveCamera(90,1,a,b);this.cameraPY=new THREE.PerspectiveCamera(90,1,a,b);this.cameraNY=new THREE.PerspectiveCamera(90,1,a,b);this.cameraPZ=new THREE.PerspectiveCamera(90,1,a,b);this.cameraNZ=new THREE.PerspectiveCamera(90,1,a,b);this.cameraPX.position=this.position;this.cameraNX.position=this.position;this.cameraPY.position=
|
|
|
this.position;this.cameraNY.position=this.position;this.cameraPZ.position=this.position;this.cameraNZ.position=this.position;this.cameraPX.up.set(0,-1,0);this.cameraNX.up.set(0,-1,0);this.cameraPY.up.set(0,0,1);this.cameraNY.up.set(0,0,-1);this.cameraPZ.up.set(0,-1,0);this.cameraNZ.up.set(0,-1,0);this.targetPX=new THREE.Vector3(0,0,0);this.targetNX=new THREE.Vector3(0,0,0);this.targetPY=new THREE.Vector3(0,0,0);this.targetNY=new THREE.Vector3(0,0,0);this.targetPZ=new THREE.Vector3(0,0,0);this.targetNZ=
|
|
@@ -121,7 +121,7 @@ function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!0;break;case 37:
|
|
|
this.object.translateX(b);this.moveUp&&this.object.translateY(b);this.moveDown&&this.object.translateY(-b);c=a*this.lookSpeed;this.activeLook||(c=0);this.lon+=this.mouseX*c;this.lookVertical&&(this.lat-=this.mouseY*c);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;a=this.target;b=this.object.position;a.x=b.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=b.y+100*Math.cos(this.phi);a.z=b.z+100*Math.sin(this.phi)*Math.sin(this.theta)}a=
|
|
|
1;this.constrainVertical&&(a=Math.PI/(this.verticalMax-this.verticalMin));this.lon+=this.mouseX*c;this.lookVertical&&(this.lat-=this.mouseY*c*a);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;if(this.constrainVertical)this.phi=THREE.Math.mapLinear(this.phi,0,Math.PI,this.verticalMin,this.verticalMax);a=this.target;b=this.object.position;a.x=b.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=b.y+100*Math.cos(this.phi);a.z=b.z+100*Math.sin(this.phi)*
|
|
|
Math.sin(this.theta);this.object.lookAt(a)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",c(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",c(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",c(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",c(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",c(this,this.onKeyUp),!1)};
|
|
|
-THREE.PathControls=function(a,b){function c(a){if((a*=2)<1)return 0.5*a*a;return-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:[]},g,f=b.getControlPointsArray(),h=b.getLength(),r=f.length,o=0;g=r-1;b={parent:-1,keys:[]};b.keys[0]={time:0,pos:f[0],rot:[0,0,0,1],scl:[1,1,1]};b.keys[g]={time:d,pos:f[g],rot:[0,0,0,1],scl:[1,1,1]};for(g=1;g<r-1;g++)o=d*h.chunks[g]/h.total,b.keys[g]={time:o,pos:f[g]};e.hierarchy[0]=
|
|
|
+THREE.PathControls=function(a,b){function c(a){if((a*=2)<1)return 0.5*a*a;return-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:[]},g,f=b.getControlPointsArray(),h=b.getLength(),r=f.length,p=0;g=r-1;b={parent:-1,keys:[]};b.keys[0]={time:0,pos:f[0],rot:[0,0,0,1],scl:[1,1,1]};b.keys[g]={time:d,pos:f[g],rot:[0,0,0,1],scl:[1,1,1]};for(g=1;g<r-1;g++)p=d*h.chunks[g]/h.total,b.keys[g]={time:p,pos:f[g]};e.hierarchy[0]=
|
|
|
b;THREE.AnimationHandler.add(e);return new THREE.Animation(a,c,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function g(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=!0;this.resamplingCoef=50;this.debugPath=
|
|
|
new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.0050;this.lookHorizontal=this.lookVertical=!0;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;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=
|
|
|
this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));var f=Math.PI*2,h=Math.PI/180;this.update=function(a){var b;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed*a);this.lookVertical&&(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%f;this.phi=a>=0?a:a+f;b=this.verticalAngleMap.srcRange;
|
|
@@ -139,38 +139,38 @@ THREE.FlyControls=function(a,b){function c(a,b){return function(){b.apply(a,argu
|
|
|
this.object.matrixWorldNeedsUpdate=!0};this.updateMovementVector=function(){var a=this.moveState.forward||this.autoForward&&!this.moveState.back?1:0;this.moveVector.x=-this.moveState.left+this.moveState.right;this.moveVector.y=-this.moveState.down+this.moveState.up;this.moveVector.z=-a+this.moveState.back};this.updateRotationVector=function(){this.rotationVector.x=-this.moveState.pitchDown+this.moveState.pitchUp;this.rotationVector.y=-this.moveState.yawRight+this.moveState.yawLeft;this.rotationVector.z=
|
|
|
-this.moveState.rollRight+this.moveState.rollLeft};this.getContainerDimensions=function(){return this.domElement!=document?{size:[this.domElement.offsetWidth,this.domElement.offsetHeight],offset:[this.domElement.offsetLeft,this.domElement.offsetTop]}:{size:[window.innerWidth,window.innerHeight],offset:[0,0]}};this.domElement.addEventListener("mousemove",c(this,this.mousemove),!1);this.domElement.addEventListener("mousedown",c(this,this.mousedown),!1);this.domElement.addEventListener("mouseup",c(this,
|
|
|
this.mouseup),!1);this.domElement.addEventListener("keydown",c(this,this.keydown),!1);this.domElement.addEventListener("keyup",c(this,this.keyup),!1);this.updateMovementVector();this.updateRotationVector()};
|
|
|
-THREE.RollControls=function(a,b){this.object=a;this.domElement=b!==void 0?b:document;this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.object.matrixAutoUpdate=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;var c=new THREE.Vector3,d=new THREE.Vector3,e=new THREE.Vector3,g=new THREE.Matrix4,f=!1,h=1,i=0,k=0,j=0,q=0,p=0,m=window.innerWidth/2,l=window.innerHeight/2;this.update=function(a){if(this.mouseLook){var b=a*this.lookSpeed;
|
|
|
-this.rotateHorizontally(b*q);this.rotateVertically(b*p)}b=a*this.movementSpeed;this.object.translateZ(-b*(i>0||this.autoForward&&!(i<0)?1:i));this.object.translateX(b*k);this.object.translateY(b*j);f&&(this.roll+=this.rollSpeed*a*h);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize();else if(this.forward.y<this.constrainVertical[0])this.forward.y=this.constrainVertical[0],this.forward.normalize();e.copy(this.forward);d.set(0,1,0);c.cross(d,
|
|
|
+THREE.RollControls=function(a,b){this.object=a;this.domElement=b!==void 0?b:document;this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.object.matrixAutoUpdate=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;var c=new THREE.Vector3,d=new THREE.Vector3,e=new THREE.Vector3,g=new THREE.Matrix4,f=!1,h=1,i=0,k=0,j=0,q=0,n=0,m=window.innerWidth/2,l=window.innerHeight/2;this.update=function(a){if(this.mouseLook){var b=a*this.lookSpeed;
|
|
|
+this.rotateHorizontally(b*q);this.rotateVertically(b*n)}b=a*this.movementSpeed;this.object.translateZ(-b*(i>0||this.autoForward&&!(i<0)?1:i));this.object.translateX(b*k);this.object.translateY(b*j);f&&(this.roll+=this.rollSpeed*a*h);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize();else if(this.forward.y<this.constrainVertical[0])this.forward.y=this.constrainVertical[0],this.forward.normalize();e.copy(this.forward);d.set(0,1,0);c.cross(d,
|
|
|
e).normalize();d.cross(e,c).normalize();this.object.matrix.n11=c.x;this.object.matrix.n12=d.x;this.object.matrix.n13=e.x;this.object.matrix.n21=c.y;this.object.matrix.n22=d.y;this.object.matrix.n23=e.y;this.object.matrix.n31=c.z;this.object.matrix.n32=d.z;this.object.matrix.n33=e.z;g.identity();g.n11=Math.cos(this.roll);g.n12=-Math.sin(this.roll);g.n21=Math.sin(this.roll);g.n22=Math.cos(this.roll);this.object.matrix.multiplySelf(g);this.object.matrixWorldNeedsUpdate=!0;this.object.matrix.n14=this.object.position.x;
|
|
|
this.object.matrix.n24=this.object.position.y;this.object.matrix.n34=this.object.position.z};this.translateX=function(a){this.object.position.x+=this.object.matrix.n11*a;this.object.position.y+=this.object.matrix.n21*a;this.object.position.z+=this.object.matrix.n31*a};this.translateY=function(a){this.object.position.x+=this.object.matrix.n12*a;this.object.position.y+=this.object.matrix.n22*a;this.object.position.z+=this.object.matrix.n32*a};this.translateZ=function(a){this.object.position.x-=this.object.matrix.n13*
|
|
|
a;this.object.position.y-=this.object.matrix.n23*a;this.object.position.z-=this.object.matrix.n33*a};this.rotateHorizontally=function(a){c.set(this.object.matrix.n11,this.object.matrix.n21,this.object.matrix.n31);c.multiplyScalar(a);this.forward.subSelf(c);this.forward.normalize()};this.rotateVertically=function(a){d.set(this.object.matrix.n12,this.object.matrix.n22,this.object.matrix.n32);d.multiplyScalar(a);this.forward.addSelf(d);this.forward.normalize()};this.domElement.addEventListener("contextmenu",
|
|
|
-function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){q=(a.clientX-m)/window.innerWidth;p=(a.clientY-l)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=1;break;case 2:i=-1}},!1);this.domElement.addEventListener("mouseup",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=0;break;case 2:i=0}},!1);this.domElement.addEventListener("keydown",
|
|
|
+function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){q=(a.clientX-m)/window.innerWidth;n=(a.clientY-l)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=1;break;case 2:i=-1}},!1);this.domElement.addEventListener("mouseup",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=0;break;case 2:i=0}},!1);this.domElement.addEventListener("keydown",
|
|
|
function(a){switch(a.keyCode){case 38:case 87:i=1;break;case 37:case 65:k=-1;break;case 40:case 83:i=-1;break;case 39:case 68:k=1;break;case 81:f=!0;h=1;break;case 69:f=!0;h=-1;break;case 82:j=1;break;case 70:j=-1}},!1);this.domElement.addEventListener("keyup",function(a){switch(a.keyCode){case 38:case 87:i=0;break;case 37:case 65:k=0;break;case 40:case 83:i=0;break;case 39:case 68:k=0;break;case 81:f=!1;break;case 69:f=!1;break;case 82:j=0;break;case 70:j=0}},!1)};
|
|
|
THREE.TrackballControls=function(a,b){var c=this,d={NONE:-1,ROTATE:0,ZOOM:1,PAN:2};this.object=a;this.domElement=b!==void 0?b:document;this.enabled=!0;this.screen={width:window.innerWidth,height:window.innerHeight,offsetLeft:0,offsetTop:0};this.radius=(this.screen.width+this.screen.height)/4;this.rotateSpeed=1;this.zoomSpeed=1.2;this.panSpeed=0.3;this.staticMoving=this.noPan=this.noZoom=this.noRotate=!1;this.dynamicDampingFactor=0.2;this.minDistance=0;this.maxDistance=Infinity;this.keys=[65,83,68];
|
|
|
-this.target=new THREE.Vector3(0,0,0);var e=!1,g=d.NONE,f=new THREE.Vector3,h=new THREE.Vector3,i=new THREE.Vector3,k=new THREE.Vector2,j=new THREE.Vector2,q=new THREE.Vector2,p=new THREE.Vector2;this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.getMouseOnScreen=function(a,b){return new THREE.Vector2((a-c.screen.offsetLeft)/c.radius*0.5,(b-c.screen.offsetTop)/c.radius*0.5)};this.getMouseProjectionOnBall=function(a,b){var d=new THREE.Vector3((a-c.screen.width*0.5-
|
|
|
+this.target=new THREE.Vector3(0,0,0);var e=!1,g=d.NONE,f=new THREE.Vector3,h=new THREE.Vector3,i=new THREE.Vector3,k=new THREE.Vector2,j=new THREE.Vector2,q=new THREE.Vector2,n=new THREE.Vector2;this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.getMouseOnScreen=function(a,b){return new THREE.Vector2((a-c.screen.offsetLeft)/c.radius*0.5,(b-c.screen.offsetTop)/c.radius*0.5)};this.getMouseProjectionOnBall=function(a,b){var d=new THREE.Vector3((a-c.screen.width*0.5-
|
|
|
c.screen.offsetLeft)/c.radius,(c.screen.height*0.5+c.screen.offsetTop-b)/c.radius,0),e=d.length();e>1?d.normalize():d.z=Math.sqrt(1-e*e);f.copy(c.object.position).subSelf(c.target);e=c.object.up.clone().setLength(d.y);e.addSelf(c.object.up.clone().crossSelf(f).setLength(d.x));e.addSelf(f.setLength(d.z));return e};this.rotateCamera=function(){var a=Math.acos(h.dot(i)/h.length()/i.length());if(a){var b=(new THREE.Vector3).cross(h,i).normalize(),d=new THREE.Quaternion;a*=c.rotateSpeed;d.setFromAxisAngle(b,
|
|
|
--a);d.multiplyVector3(f);d.multiplyVector3(c.object.up);d.multiplyVector3(i);c.staticMoving?h=i:(d.setFromAxisAngle(b,a*(c.dynamicDampingFactor-1)),d.multiplyVector3(h))}};this.zoomCamera=function(){var a=1+(j.y-k.y)*c.zoomSpeed;a!==1&&a>0&&(f.multiplyScalar(a),c.staticMoving?k=j:k.y+=(j.y-k.y)*this.dynamicDampingFactor)};this.panCamera=function(){var a=p.clone().subSelf(q);if(a.lengthSq()){a.multiplyScalar(f.length()*c.panSpeed);var b=f.clone().crossSelf(c.object.up).setLength(a.x);b.addSelf(c.object.up.clone().setLength(a.y));
|
|
|
-c.object.position.addSelf(b);c.target.addSelf(b);c.staticMoving?q=p:q.addSelf(a.sub(p,q).multiplyScalar(c.dynamicDampingFactor))}};this.checkDistances=function(){if(!c.noZoom||!c.noPan)c.object.position.lengthSq()>c.maxDistance*c.maxDistance&&c.object.position.setLength(c.maxDistance),f.lengthSq()<c.minDistance*c.minDistance&&c.object.position.add(c.target,f.setLength(c.minDistance))};this.update=function(){f.copy(c.object.position).subSelf(this.target);c.noRotate||c.rotateCamera();c.noZoom||c.zoomCamera();
|
|
|
-c.noPan||c.panCamera();c.object.position.add(c.target,f);c.checkDistances();c.object.lookAt(c.target)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){c.enabled&&(e&&(h=i=c.getMouseProjectionOnBall(a.clientX,a.clientY),k=j=c.getMouseOnScreen(a.clientX,a.clientY),q=p=c.getMouseOnScreen(a.clientX,a.clientY),e=!1),g!==d.NONE&&(g===d.ROTATE&&!c.noRotate?i=c.getMouseProjectionOnBall(a.clientX,a.clientY):g===d.ZOOM&&
|
|
|
-!c.noZoom?j=c.getMouseOnScreen(a.clientX,a.clientY):g===d.PAN&&!c.noPan&&(p=c.getMouseOnScreen(a.clientX,a.clientY))))},!1);this.domElement.addEventListener("mousedown",function(a){if(c.enabled&&(a.preventDefault(),a.stopPropagation(),g===d.NONE))g=a.button,g===d.ROTATE&&!c.noRotate?h=i=c.getMouseProjectionOnBall(a.clientX,a.clientY):g===d.ZOOM&&!c.noZoom?k=j=c.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(q=p=c.getMouseOnScreen(a.clientX,a.clientY))},!1);this.domElement.addEventListener("mouseup",
|
|
|
+-a);d.multiplyVector3(f);d.multiplyVector3(c.object.up);d.multiplyVector3(i);c.staticMoving?h=i:(d.setFromAxisAngle(b,a*(c.dynamicDampingFactor-1)),d.multiplyVector3(h))}};this.zoomCamera=function(){var a=1+(j.y-k.y)*c.zoomSpeed;a!==1&&a>0&&(f.multiplyScalar(a),c.staticMoving?k=j:k.y+=(j.y-k.y)*this.dynamicDampingFactor)};this.panCamera=function(){var a=n.clone().subSelf(q);if(a.lengthSq()){a.multiplyScalar(f.length()*c.panSpeed);var b=f.clone().crossSelf(c.object.up).setLength(a.x);b.addSelf(c.object.up.clone().setLength(a.y));
|
|
|
+c.object.position.addSelf(b);c.target.addSelf(b);c.staticMoving?q=n:q.addSelf(a.sub(n,q).multiplyScalar(c.dynamicDampingFactor))}};this.checkDistances=function(){if(!c.noZoom||!c.noPan)c.object.position.lengthSq()>c.maxDistance*c.maxDistance&&c.object.position.setLength(c.maxDistance),f.lengthSq()<c.minDistance*c.minDistance&&c.object.position.add(c.target,f.setLength(c.minDistance))};this.update=function(){f.copy(c.object.position).subSelf(this.target);c.noRotate||c.rotateCamera();c.noZoom||c.zoomCamera();
|
|
|
+c.noPan||c.panCamera();c.object.position.add(c.target,f);c.checkDistances();c.object.lookAt(c.target)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){c.enabled&&(e&&(h=i=c.getMouseProjectionOnBall(a.clientX,a.clientY),k=j=c.getMouseOnScreen(a.clientX,a.clientY),q=n=c.getMouseOnScreen(a.clientX,a.clientY),e=!1),g!==d.NONE&&(g===d.ROTATE&&!c.noRotate?i=c.getMouseProjectionOnBall(a.clientX,a.clientY):g===d.ZOOM&&
|
|
|
+!c.noZoom?j=c.getMouseOnScreen(a.clientX,a.clientY):g===d.PAN&&!c.noPan&&(n=c.getMouseOnScreen(a.clientX,a.clientY))))},!1);this.domElement.addEventListener("mousedown",function(a){if(c.enabled&&(a.preventDefault(),a.stopPropagation(),g===d.NONE))g=a.button,g===d.ROTATE&&!c.noRotate?h=i=c.getMouseProjectionOnBall(a.clientX,a.clientY):g===d.ZOOM&&!c.noZoom?k=j=c.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(q=n=c.getMouseOnScreen(a.clientX,a.clientY))},!1);this.domElement.addEventListener("mouseup",
|
|
|
function(a){if(c.enabled)a.preventDefault(),a.stopPropagation(),g=d.NONE},!1);window.addEventListener("keydown",function(a){if(c.enabled&&g===d.NONE){if(a.keyCode===c.keys[d.ROTATE]&&!c.noRotate)g=d.ROTATE;else if(a.keyCode===c.keys[d.ZOOM]&&!c.noZoom)g=d.ZOOM;else if(a.keyCode===c.keys[d.PAN]&&!c.noPan)g=d.PAN;g!==d.NONE&&(e=!0)}},!1);window.addEventListener("keyup",function(){if(c.enabled&&g!==d.NONE)g=d.NONE},!1)};
|
|
|
-THREE.CubeGeometry=function(a,b,c,d,e,g,f,h){function i(a,b,c,f,h,i,j,n){var l,p=d||1,m=e||1,o=h/2,q=i/2,r=k.vertices.length;if(a==="x"&&b==="y"||a==="y"&&b==="x")l="z";else if(a==="x"&&b==="z"||a==="z"&&b==="x")l="y",m=g||1;else if(a==="z"&&b==="y"||a==="y"&&b==="z")l="x",p=g||1;var s=p+1,t=m+1,B=h/p,H=i/m,N=new THREE.Vector3;N[l]=j>0?1:-1;for(h=0;h<t;h++)for(i=0;i<s;i++){var L=new THREE.Vector3;L[a]=(i*B-o)*c;L[b]=(h*H-q)*f;L[l]=j;k.vertices.push(new THREE.Vertex(L))}for(h=0;h<m;h++)for(i=0;i<p;i++)a=
|
|
|
-new THREE.Face4(i+s*h+r,i+s*(h+1)+r,i+1+s*(h+1)+r,i+1+s*h+r),a.normal.copy(N),a.vertexNormals.push(N.clone(),N.clone(),N.clone(),N.clone()),a.materialIndex=n,k.faces.push(a),k.faceVertexUvs[0].push([new THREE.UV(i/p,h/m),new THREE.UV(i/p,(h+1)/m),new THREE.UV((i+1)/p,(h+1)/m),new THREE.UV((i+1)/p,h/m)])}THREE.Geometry.call(this);var k=this,j=a/2,q=b/2,p=c/2,m,l,n,r,o,s;if(f!==void 0){if(f instanceof Array)this.materials=f;else{this.materials=[];for(m=0;m<6;m++)this.materials.push(f)}m=0;r=1;l=2;o=
|
|
|
-3;n=4;s=5}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(h!=void 0)for(var t in h)this.sides[t]!==void 0&&(this.sides[t]=h[t]);this.sides.px&&i("z","y",-1,-1,c,b,j,m);this.sides.nx&&i("z","y",1,-1,c,b,-j,r);this.sides.py&&i("x","z",1,1,a,c,q,l);this.sides.ny&&i("x","z",1,-1,a,c,-q,o);this.sides.pz&&i("x","y",1,-1,a,b,p,n);this.sides.nz&&i("x","y",-1,-1,a,b,-p,s);this.computeCentroids();this.mergeVertices()};THREE.CubeGeometry.prototype=new THREE.Geometry;
|
|
|
+THREE.CubeGeometry=function(a,b,c,d,e,g,f,h){function i(a,b,c,f,h,i,j,o){var l,n=d||1,m=e||1,p=h/2,q=i/2,r=k.vertices.length;if(a==="x"&&b==="y"||a==="y"&&b==="x")l="z";else if(a==="x"&&b==="z"||a==="z"&&b==="x")l="y",m=g||1;else if(a==="z"&&b==="y"||a==="y"&&b==="z")l="x",n=g||1;var s=n+1,t=m+1,B=h/n,H=i/m,N=new THREE.Vector3;N[l]=j>0?1:-1;for(h=0;h<t;h++)for(i=0;i<s;i++){var L=new THREE.Vector3;L[a]=(i*B-p)*c;L[b]=(h*H-q)*f;L[l]=j;k.vertices.push(new THREE.Vertex(L))}for(h=0;h<m;h++)for(i=0;i<n;i++)a=
|
|
|
+new THREE.Face4(i+s*h+r,i+s*(h+1)+r,i+1+s*(h+1)+r,i+1+s*h+r),a.normal.copy(N),a.vertexNormals.push(N.clone(),N.clone(),N.clone(),N.clone()),a.materialIndex=o,k.faces.push(a),k.faceVertexUvs[0].push([new THREE.UV(i/n,h/m),new THREE.UV(i/n,(h+1)/m),new THREE.UV((i+1)/n,(h+1)/m),new THREE.UV((i+1)/n,h/m)])}THREE.Geometry.call(this);var k=this,j=a/2,q=b/2,n=c/2,m,l,o,r,p,s;if(f!==void 0){if(f instanceof Array)this.materials=f;else{this.materials=[];for(m=0;m<6;m++)this.materials.push(f)}m=0;r=1;l=2;p=
|
|
|
+3;o=4;s=5}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(h!=void 0)for(var t in h)this.sides[t]!==void 0&&(this.sides[t]=h[t]);this.sides.px&&i("z","y",-1,-1,c,b,j,m);this.sides.nx&&i("z","y",1,-1,c,b,-j,r);this.sides.py&&i("x","z",1,1,a,c,q,l);this.sides.ny&&i("x","z",1,-1,a,c,-q,p);this.sides.pz&&i("x","y",1,-1,a,b,n,o);this.sides.nz&&i("x","y",-1,-1,a,b,-n,s);this.computeCentroids();this.mergeVertices()};THREE.CubeGeometry.prototype=new THREE.Geometry;
|
|
|
THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
|
|
|
-THREE.CylinderGeometry=function(a,b,c,d,e,g){THREE.Geometry.call(this);var a=a!=null?a:20,b=b!=null?b:20,c=c||100,f=c/2,d=d||8,e=e||1,h,i,k=[],j=[];for(i=0;i<=e;i++){var q=[],p=[],m=i/e,l=m*(b-a)+a;for(h=0;h<=d;h++){var n=h/d;this.vertices.push(new THREE.Vertex(new THREE.Vector3(l*Math.sin(n*Math.PI*2),-m*c+f,l*Math.cos(n*Math.PI*2))));q.push(this.vertices.length-1);p.push(new THREE.UV(n,m))}k.push(q);j.push(p)}for(i=0;i<e;i++)for(h=0;h<d;h++){var c=k[i][h],q=k[i+1][h],p=k[i+1][h+1],m=k[i][h+1],l=
|
|
|
-this.vertices[c].position.clone().setY(0).normalize(),n=this.vertices[q].position.clone().setY(0).normalize(),r=this.vertices[p].position.clone().setY(0).normalize(),o=this.vertices[m].position.clone().setY(0).normalize(),s=j[i][h].clone(),t=j[i+1][h].clone(),w=j[i+1][h+1].clone(),z=j[i][h+1].clone();this.faces.push(new THREE.Face4(c,q,p,m,[l,n,r,o]));this.faceVertexUvs[0].push([s,t,w,z])}if(!g&&a>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,f,0)));for(h=0;h<d;h++)c=k[0][h],q=k[0][h+
|
|
|
-1],p=this.vertices.length-1,l=new THREE.Vector3(0,1,0),n=new THREE.Vector3(0,1,0),r=new THREE.Vector3(0,1,0),s=j[0][h].clone(),t=j[0][h+1].clone(),w=new THREE.UV(t.u,0),this.faces.push(new THREE.Face3(c,q,p,[l,n,r])),this.faceVertexUvs[0].push([s,t,w])}if(!g&&b>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-f,0)));for(h=0;h<d;h++)c=k[i][h+1],q=k[i][h],p=this.vertices.length-1,l=new THREE.Vector3(0,-1,0),n=new THREE.Vector3(0,-1,0),r=new THREE.Vector3(0,-1,0),s=j[i][h+1].clone(),t=j[i][h].clone(),
|
|
|
-w=new THREE.UV(t.u,1),this.faces.push(new THREE.Face3(c,q,p,[l,n,r])),this.faceVertexUvs[0].push([s,t,w])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
|
|
|
+THREE.CylinderGeometry=function(a,b,c,d,e,g){THREE.Geometry.call(this);var a=a!=null?a:20,b=b!=null?b:20,c=c||100,f=c/2,d=d||8,e=e||1,h,i,k=[],j=[];for(i=0;i<=e;i++){var q=[],n=[],m=i/e,l=m*(b-a)+a;for(h=0;h<=d;h++){var o=h/d;this.vertices.push(new THREE.Vertex(new THREE.Vector3(l*Math.sin(o*Math.PI*2),-m*c+f,l*Math.cos(o*Math.PI*2))));q.push(this.vertices.length-1);n.push(new THREE.UV(o,m))}k.push(q);j.push(n)}for(i=0;i<e;i++)for(h=0;h<d;h++){var c=k[i][h],q=k[i+1][h],n=k[i+1][h+1],m=k[i][h+1],l=
|
|
|
+this.vertices[c].position.clone().setY(0).normalize(),o=this.vertices[q].position.clone().setY(0).normalize(),r=this.vertices[n].position.clone().setY(0).normalize(),p=this.vertices[m].position.clone().setY(0).normalize(),s=j[i][h].clone(),t=j[i+1][h].clone(),w=j[i+1][h+1].clone(),z=j[i][h+1].clone();this.faces.push(new THREE.Face4(c,q,n,m,[l,o,r,p]));this.faceVertexUvs[0].push([s,t,w,z])}if(!g&&a>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,f,0)));for(h=0;h<d;h++)c=k[0][h],q=k[0][h+
|
|
|
+1],n=this.vertices.length-1,l=new THREE.Vector3(0,1,0),o=new THREE.Vector3(0,1,0),r=new THREE.Vector3(0,1,0),s=j[0][h].clone(),t=j[0][h+1].clone(),w=new THREE.UV(t.u,0),this.faces.push(new THREE.Face3(c,q,n,[l,o,r])),this.faceVertexUvs[0].push([s,t,w])}if(!g&&b>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-f,0)));for(h=0;h<d;h++)c=k[i][h+1],q=k[i][h],n=this.vertices.length-1,l=new THREE.Vector3(0,-1,0),o=new THREE.Vector3(0,-1,0),r=new THREE.Vector3(0,-1,0),s=j[i][h+1].clone(),t=j[i][h].clone(),
|
|
|
+w=new THREE.UV(t.u,1),this.faces.push(new THREE.Face3(c,q,n,[l,o,r])),this.faceVertexUvs[0].push([s,t,w])}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);var a=a instanceof Array?a:[a],c,d=a.length,e;this.shapebb=a[d-1].getBoundingBox();for(c=0;c<d;c++)e=a[c],this.addShape(e,b);this.computeCentroids();this.computeFaceNormals()}};THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;
|
|
|
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,g=THREE.ExtrudeGeometry.__v3,f=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();g.set(-d.y,d.x);f.set(e.y,-e.x);h.copy(a).addSelf(g);i.copy(a).addSelf(f);if(h.equals(i))return f.clone();
|
|
|
h.copy(b).addSelf(g);i.copy(c).addSelf(f);g=d.dot(f);f=i.subSelf(h).dot(f);g===0&&(console.log("Either infinite or no solutions!"),f===0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));f/=g;if(f<0)return 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+=Math.PI*2),a=(b+a)/2,new THREE.Vector2(-Math.cos(a),-Math.sin(a));return d.multiplyScalar(f).addSelf(h).subSelf(a).clone()}function e(a){for(v=a.length;--v>=0;){L=v;I=v-1;I<0&&(I=a.length-1);for(var b=
|
|
|
-0,c=m+j*2,b=0;b<c;b++){var d=J*b,e=J*(b+1),g=R+L+d,f=R+L+e,k=g,d=R+I+d,e=R+I+e,n=f;k+=D;d+=D;e+=D;n+=D;A.faces.push(new THREE.Face4(k,d,e,n,null,null,w));w!==void 0&&(k=b/c,d=(b+1)/c,e=h+i*2,g=(A.vertices[g].position.z+i)/e,f=(A.vertices[f].position.z+i)/e,A.faceVertexUvs[0].push([new THREE.UV(g,k),new THREE.UV(f,k),new THREE.UV(f,d),new THREE.UV(g,d)]))}}}function g(a,b,c){A.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function f(a,b,c){a+=D;b+=D;c+=D;A.faces.push(new THREE.Face3(a,
|
|
|
+0,c=m+j*2,b=0;b<c;b++){var d=J*b,e=J*(b+1),g=R+L+d,f=R+L+e,k=g,d=R+I+d,e=R+I+e,o=f;k+=D;d+=D;e+=D;o+=D;A.faces.push(new THREE.Face4(k,d,e,o,null,null,w));w!==void 0&&(k=b/c,d=(b+1)/c,e=h+i*2,g=(A.vertices[g].position.z+i)/e,f=(A.vertices[f].position.z+i)/e,A.faceVertexUvs[0].push([new THREE.UV(g,k),new THREE.UV(f,k),new THREE.UV(f,d),new THREE.UV(g,d)]))}}}function g(a,b,c){A.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function f(a,b,c){a+=D;b+=D;c+=D;A.faces.push(new THREE.Face3(a,
|
|
|
b,c,null,null,t));if(t!==void 0){var d=z.minX,e=z.minY,g=z.maxY,f=z.maxX,h=A.vertices[b].position.x-d,b=A.vertices[b].position.y-e,i=A.vertices[c].position.x-d,c=A.vertices[c].position.y-e;A.faceVertexUvs[0].push([new THREE.UV((A.vertices[a].position.x-d)/f,(A.vertices[a].position.y-e)/g),new THREE.UV(h/f,b/g),new THREE.UV(i/f,c/g)])}}var h=b.amount!==void 0?b.amount:100,i=b.bevelThickness!==void 0?b.bevelThickness:6,k=b.bevelSize!==void 0?b.bevelSize:i-2,j=b.bevelSegments!==void 0?b.bevelSegments:
|
|
|
-3,q=b.bevelEnabled!==void 0?b.bevelEnabled:!0,p=b.curveSegments!==void 0?b.curveSegments:12,m=b.steps!==void 0?b.steps:1,l=b.bendPath,n=b.extrudePath,r,o=!1,s=b.useSpacedPoints!==void 0?b.useSpacedPoints:!1,t=b.material,w=b.extrudeMaterial,z=this.shapebb;if(n)r=n.getPoints(p),m=r.length,o=!0,q=!1;q||(k=i=j=0);var u,y,x,A=this,D=this.vertices.length;l&&a.addWrapPath(l);p=s?a.extractAllSpacedPoints(p):a.extractAllPoints(p);l=p.shape;p=p.holes;if(n=!THREE.Shape.Utils.isClockWise(l)){l=l.reverse();y=
|
|
|
-0;for(x=p.length;y<x;y++)u=p[y],THREE.Shape.Utils.isClockWise(u)&&(p[y]=u.reverse());n=!1}n=THREE.Shape.Utils.triangulateShape(l,p);s=l;y=0;for(x=p.length;y<x;y++)u=p[y],l=l.concat(u);var v,E,F,C,K,G,J=l.length,O=n.length,M=[];v=0;E=s.length;L=E-1;for(I=v+1;v<E;v++,L++,I++)L===E&&(L=0),I===E&&(I=0),M[v]=d(s[v],s[L],s[I]);var B=[],H,N=M.concat();y=0;for(x=p.length;y<x;y++){u=p[y];H=[];v=0;E=u.length;L=E-1;for(I=v+1;v<E;v++,L++,I++)L===E&&(L=0),I===E&&(I=0),H[v]=d(u[v],u[L],u[I]);B.push(H);N=N.concat(H)}for(F=
|
|
|
-0;F<j;F++){C=F/j;K=i*(1-C);C=k*Math.sin(C*Math.PI/2);v=0;for(E=s.length;v<E;v++)G=c(s[v],M[v],C),g(G.x,G.y,-K);y=0;for(x=p.length;y<x;y++){u=p[y];H=B[y];v=0;for(E=u.length;v<E;v++)G=c(u[v],H[v],C),g(G.x,G.y,-K)}}C=k;for(v=0;v<J;v++)G=q?c(l[v],N[v],C):l[v],o?g(G.x,G.y+r[0].y,r[0].x):g(G.x,G.y,0);for(F=1;F<=m;F++)for(v=0;v<J;v++)G=q?c(l[v],N[v],C):l[v],o?g(G.x,G.y+r[F-1].y,r[F-1].x):g(G.x,G.y,h/m*F);for(F=j-1;F>=0;F--){C=F/j;K=i*(1-C);C=k*Math.sin(C*Math.PI/2);v=0;for(E=s.length;v<E;v++)G=c(s[v],M[v],
|
|
|
-C),g(G.x,G.y,h+K);y=0;for(x=p.length;y<x;y++){u=p[y];H=B[y];v=0;for(E=u.length;v<E;v++)G=c(u[v],H[v],C),o?g(G.x,G.y+r[m-1].y,r[m-1].x+K):g(G.x,G.y,h+K)}}if(q){q=J*0;for(v=0;v<O;v++)k=n[v],f(k[2]+q,k[1]+q,k[0]+q);q=J*(m+j*2);for(v=0;v<O;v++)k=n[v],f(k[0]+q,k[1]+q,k[2]+q)}else{for(v=0;v<O;v++)k=n[v],f(k[2],k[1],k[0]);for(v=0;v<O;v++)k=n[v],f(k[0]+J*m,k[1]+J*m,k[2]+J*m)}var L,I,R=0;e(s);R+=s.length;y=0;for(x=p.length;y<x;y++)u=p[y],e(u),R+=u.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;
|
|
|
+3,q=b.bevelEnabled!==void 0?b.bevelEnabled:!0,n=b.curveSegments!==void 0?b.curveSegments:12,m=b.steps!==void 0?b.steps:1,l=b.bendPath,o=b.extrudePath,r,p=!1,s=b.useSpacedPoints!==void 0?b.useSpacedPoints:!1,t=b.material,w=b.extrudeMaterial,z=this.shapebb;if(o)r=o.getPoints(n),m=r.length,p=!0,q=!1;q||(k=i=j=0);var u,y,x,A=this,D=this.vertices.length;l&&a.addWrapPath(l);n=s?a.extractAllSpacedPoints(n):a.extractAllPoints(n);l=n.shape;n=n.holes;if(o=!THREE.Shape.Utils.isClockWise(l)){l=l.reverse();y=
|
|
|
+0;for(x=n.length;y<x;y++)u=n[y],THREE.Shape.Utils.isClockWise(u)&&(n[y]=u.reverse());o=!1}o=THREE.Shape.Utils.triangulateShape(l,n);s=l;y=0;for(x=n.length;y<x;y++)u=n[y],l=l.concat(u);var v,E,F,C,K,G,J=l.length,O=o.length,M=[];v=0;E=s.length;L=E-1;for(I=v+1;v<E;v++,L++,I++)L===E&&(L=0),I===E&&(I=0),M[v]=d(s[v],s[L],s[I]);var B=[],H,N=M.concat();y=0;for(x=n.length;y<x;y++){u=n[y];H=[];v=0;E=u.length;L=E-1;for(I=v+1;v<E;v++,L++,I++)L===E&&(L=0),I===E&&(I=0),H[v]=d(u[v],u[L],u[I]);B.push(H);N=N.concat(H)}for(F=
|
|
|
+0;F<j;F++){C=F/j;K=i*(1-C);C=k*Math.sin(C*Math.PI/2);v=0;for(E=s.length;v<E;v++)G=c(s[v],M[v],C),g(G.x,G.y,-K);y=0;for(x=n.length;y<x;y++){u=n[y];H=B[y];v=0;for(E=u.length;v<E;v++)G=c(u[v],H[v],C),g(G.x,G.y,-K)}}C=k;for(v=0;v<J;v++)G=q?c(l[v],N[v],C):l[v],p?g(G.x,G.y+r[0].y,r[0].x):g(G.x,G.y,0);for(F=1;F<=m;F++)for(v=0;v<J;v++)G=q?c(l[v],N[v],C):l[v],p?g(G.x,G.y+r[F-1].y,r[F-1].x):g(G.x,G.y,h/m*F);for(F=j-1;F>=0;F--){C=F/j;K=i*(1-C);C=k*Math.sin(C*Math.PI/2);v=0;for(E=s.length;v<E;v++)G=c(s[v],M[v],
|
|
|
+C),g(G.x,G.y,h+K);y=0;for(x=n.length;y<x;y++){u=n[y];H=B[y];v=0;for(E=u.length;v<E;v++)G=c(u[v],H[v],C),p?g(G.x,G.y+r[m-1].y,r[m-1].x+K):g(G.x,G.y,h+K)}}if(q){q=J*0;for(v=0;v<O;v++)k=o[v],f(k[2]+q,k[1]+q,k[0]+q);q=J*(m+j*2);for(v=0;v<O;v++)k=o[v],f(k[0]+q,k[1]+q,k[2]+q)}else{for(v=0;v<O;v++)k=o[v],f(k[2],k[1],k[0]);for(v=0;v<O;v++)k=o[v],f(k[0]+J*m,k[1]+J*m,k[2]+J*m)}var L,I,R=0;e(s);R+=s.length;y=0;for(x=n.length;y<x;y++)u=n[y],e(u),R+=u.length};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.IcosahedronGeometry=function(a){function b(a,b,c){var d=Math.sqrt(a*a+b*b+c*c);return e.vertices.push(new THREE.Vertex(new THREE.Vector3(a/d,b/d,c/d)))-1}function c(a,b,c,d){var g=e.vertices[a].position,f=e.vertices[b].position,h=e.vertices[c].position,a=new THREE.Face3(a,b,c);a.vertexNormals.push(g.clone().normalize(),f.clone().normalize(),h.clone().normalize());d.faces.push(a);d.faceVertexUvs[0].push([new THREE.UV(1-(Math.atan2(g.z,g.x)+Math.PI)%Math.PI/Math.PI*0.5,0.5-g.y/2),new THREE.UV(1-
|
|
|
(Math.atan2(f.z,f.x)+Math.PI)%Math.PI/Math.PI*0.5,0.5-f.y/2),new THREE.UV(1-(Math.atan2(h.z,h.x)+Math.PI)%Math.PI/Math.PI*0.5,0.5-h.y/2)])}function d(a,c){var d=e.vertices[a].position,g=e.vertices[c].position;return b((d.x+g.x)/2,(d.y+g.y)/2,(d.z+g.z)/2)}var e=this,g=new THREE.Geometry;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;b(-1,a,0);b(1,a,0);b(-1,-a,0);b(1,-a,0);b(0,-1,a);b(0,1,a);b(0,-1,-a);b(0,1,-a);b(a,0,-1);b(a,0,1);b(-a,0,-1);b(-a,0,1);c(0,11,5,g);c(0,5,1,g);c(0,
|
|
@@ -184,17 +184,17 @@ f.faces.push(h),h=Math.atan2(h.centroid.z,-h.centroid.x),f.faceVertexUvs[0].push
|
|
|
{radius:a}};THREE.OctahedronGeometry.prototype=new THREE.Geometry;THREE.OctahedronGeometry.prototype.constructor=THREE.OctahedronGeometry;
|
|
|
THREE.PlaneGeometry=function(a,b,c,d){THREE.Geometry.call(this);for(var e=a/2,g=b/2,c=c||1,d=d||1,f=c+1,h=d+1,i=a/c,k=b/d,j=new THREE.Vector3(0,0,1),a=0;a<h;a++)for(b=0;b<f;b++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(b*i-e,-(a*k-g),0)));for(a=0;a<d;a++)for(b=0;b<c;b++)e=new THREE.Face4(b+f*a,b+f*(a+1),b+1+f*(a+1),b+1+f*a),e.normal.copy(j),e.vertexNormals.push(j.clone(),j.clone(),j.clone(),j.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,g,f){THREE.Geometry.call(this);var a=a||50,b=Math.max(3,Math.floor(b)||8),c=Math.max(2,Math.floor(c)||6),d=d!=void 0?d:0,e=e!=void 0?e:Math.PI*2,g=g!=void 0?g:0,f=f!=void 0?f:Math.PI,h,i,k=[],j=[];for(i=0;i<=c;i++){var q=[],p=[];for(h=0;h<=b;h++){var m=h/b,l=i/c;this.vertices.push(new THREE.Vertex(new THREE.Vector3(-a*Math.cos(d+m*e)*Math.sin(g+l*f),a*Math.cos(g+l*f),a*Math.sin(d+m*e)*Math.sin(g+l*f))));q.push(this.vertices.length-1);p.push(new THREE.UV(m,l))}k.push(q);
|
|
|
-j.push(p)}for(i=0;i<c;i++)for(h=0;h<b;h++){var d=k[i][h+1],e=k[i][h],g=k[i+1][h],f=k[i+1][h+1],q=this.vertices[d].position.clone().normalize(),p=this.vertices[e].position.clone().normalize(),m=this.vertices[g].position.clone().normalize(),l=this.vertices[f].position.clone().normalize(),n=j[i][h+1].clone(),r=j[i][h].clone(),o=j[i+1][h].clone(),s=j[i+1][h+1].clone();Math.abs(this.vertices[d].position.y)==a?(this.faces.push(new THREE.Face3(d,g,f,[q,m,l])),this.faceVertexUvs[0].push([n,o,s])):Math.abs(this.vertices[g].position.y)==
|
|
|
-a?(this.faces.push(new THREE.Face3(d,e,g,[q,p,m])),this.faceVertexUvs[0].push([n,r,o])):(this.faces.push(new THREE.Face4(d,e,g,f,[q,p,m,l])),this.faceVertexUvs[0].push([n,r,o,s]))}this.computeCentroids();this.computeFaceNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=new THREE.Geometry;THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry;
|
|
|
+THREE.SphereGeometry=function(a,b,c,d,e,g,f){THREE.Geometry.call(this);var a=a||50,b=Math.max(3,Math.floor(b)||8),c=Math.max(2,Math.floor(c)||6),d=d!=void 0?d:0,e=e!=void 0?e:Math.PI*2,g=g!=void 0?g:0,f=f!=void 0?f:Math.PI,h,i,k=[],j=[];for(i=0;i<=c;i++){var q=[],n=[];for(h=0;h<=b;h++){var m=h/b,l=i/c;this.vertices.push(new THREE.Vertex(new THREE.Vector3(-a*Math.cos(d+m*e)*Math.sin(g+l*f),a*Math.cos(g+l*f),a*Math.sin(d+m*e)*Math.sin(g+l*f))));q.push(this.vertices.length-1);n.push(new THREE.UV(m,l))}k.push(q);
|
|
|
+j.push(n)}for(i=0;i<c;i++)for(h=0;h<b;h++){var d=k[i][h+1],e=k[i][h],g=k[i+1][h],f=k[i+1][h+1],q=this.vertices[d].position.clone().normalize(),n=this.vertices[e].position.clone().normalize(),m=this.vertices[g].position.clone().normalize(),l=this.vertices[f].position.clone().normalize(),o=j[i][h+1].clone(),r=j[i][h].clone(),p=j[i+1][h].clone(),s=j[i+1][h+1].clone();Math.abs(this.vertices[d].position.y)==a?(this.faces.push(new THREE.Face3(d,g,f,[q,m,l])),this.faceVertexUvs[0].push([o,p,s])):Math.abs(this.vertices[g].position.y)==
|
|
|
+a?(this.faces.push(new THREE.Face3(d,e,g,[q,n,m])),this.faceVertexUvs[0].push([o,r,p])):(this.faces.push(new THREE.Face4(d,e,g,f,[q,n,m,l])),this.faceVertexUvs[0].push([o,r,p,s]))}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=!1;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=
|
|
|
-0,e=String(a).split(""),g=e.length,f=[],a=0;a<g;a++){var h=new THREE.Path,h=this.extractGlyphPoints(e[a],b,c,d,h);d+=h.offset;f.push(h.path)}return{paths:f,offset:d/2}},extractGlyphPoints:function(a,b,c,d,e){var g=[],f,h,i,k,j,q,p,m,l,n,r,o=b.glyphs[a]||b.glyphs["?"];if(o){if(o.o){b=o._cachedOutline||(o._cachedOutline=o.o.split(" "));k=b.length;for(a=0;a<k;)switch(i=b[a++],i){case "m":i=b[a++]*c+d;j=b[a++]*c;g.push(new THREE.Vector2(i,j));e.moveTo(i,j);break;case "l":i=b[a++]*c+d;j=b[a++]*c;g.push(new THREE.Vector2(i,
|
|
|
-j));e.lineTo(i,j);break;case "q":i=b[a++]*c+d;j=b[a++]*c;m=b[a++]*c+d;l=b[a++]*c;e.quadraticCurveTo(m,l,i,j);if(f=g[g.length-1]){q=f.x;p=f.y;f=1;for(h=this.divisions;f<=h;f++){var s=f/h,t=THREE.Shape.Utils.b2(s,q,m,i),s=THREE.Shape.Utils.b2(s,p,l,j);g.push(new THREE.Vector2(t,s))}}break;case "b":if(i=b[a++]*c+d,j=b[a++]*c,m=b[a++]*c+d,l=b[a++]*-c,n=b[a++]*c+d,r=b[a++]*-c,e.bezierCurveTo(i,j,m,l,n,r),f=g[g.length-1]){q=f.x;p=f.y;f=1;for(h=this.divisions;f<=h;f++)s=f/h,t=THREE.Shape.Utils.b3(s,q,m,
|
|
|
-n,i),s=THREE.Shape.Utils.b3(s,p,l,r,j),g.push(new THREE.Vector2(t,s))}}}return{offset:o.ha*c,points:g,path:e}}}};
|
|
|
-(function(a){var b=function(a){for(var b=a.length,e=0,g=b-1,f=0;f<b;g=f++)e+=a[g].x*a[f].y-a[f].x*a[g].y;return e*0.5};a.Triangulate=function(a,d){var e=a.length;if(e<3)return null;var g=[],f=[],h=[],i,k,j;if(b(a)>0)for(k=0;k<e;k++)f[k]=k;else for(k=0;k<e;k++)f[k]=e-1-k;var q=2*e;for(k=e-1;e>2;){if(q--<=0){console.log("Warning, unable to triangulate polygon!");if(d)return h;return g}i=k;e<=i&&(i=0);k=i+1;e<=k&&(k=0);j=k+1;e<=j&&(j=0);var p;a:{p=a;var m=i,l=k,n=j,r=e,o=f,s=void 0,t=void 0,w=void 0,
|
|
|
-z=void 0,u=void 0,y=void 0,x=void 0,A=void 0,D=void 0,t=p[o[m]].x,w=p[o[m]].y,z=p[o[l]].x,u=p[o[l]].y,y=p[o[n]].x,x=p[o[n]].y;if(1.0E-10>(z-t)*(x-w)-(u-w)*(y-t))p=!1;else{for(s=0;s<r;s++)if(!(s==m||s==l||s==n)){var A=p[o[s]].x,D=p[o[s]].y,v=void 0,E=void 0,F=void 0,C=void 0,K=void 0,G=void 0,J=void 0,O=void 0,M=void 0,B=void 0,H=void 0,N=void 0,v=F=K=void 0,v=y-z,E=x-u,F=t-y,C=w-x,K=z-t,G=u-w,J=A-t,O=D-w,M=A-z,B=D-u,H=A-y,N=D-x,v=v*B-E*M,K=K*O-G*J,F=F*N-C*H;if(v>=0&&F>=0&&K>=0){p=!1;break a}}p=!0}}if(p){g.push([a[f[i]],
|
|
|
+0,e=String(a).split(""),g=e.length,f=[],a=0;a<g;a++){var h=new THREE.Path,h=this.extractGlyphPoints(e[a],b,c,d,h);d+=h.offset;f.push(h.path)}return{paths:f,offset:d/2}},extractGlyphPoints:function(a,b,c,d,e){var g=[],f,h,i,k,j,q,n,m,l,o,r,p=b.glyphs[a]||b.glyphs["?"];if(p){if(p.o){b=p._cachedOutline||(p._cachedOutline=p.o.split(" "));k=b.length;for(a=0;a<k;)switch(i=b[a++],i){case "m":i=b[a++]*c+d;j=b[a++]*c;g.push(new THREE.Vector2(i,j));e.moveTo(i,j);break;case "l":i=b[a++]*c+d;j=b[a++]*c;g.push(new THREE.Vector2(i,
|
|
|
+j));e.lineTo(i,j);break;case "q":i=b[a++]*c+d;j=b[a++]*c;m=b[a++]*c+d;l=b[a++]*c;e.quadraticCurveTo(m,l,i,j);if(f=g[g.length-1]){q=f.x;n=f.y;f=1;for(h=this.divisions;f<=h;f++){var s=f/h,t=THREE.Shape.Utils.b2(s,q,m,i),s=THREE.Shape.Utils.b2(s,n,l,j);g.push(new THREE.Vector2(t,s))}}break;case "b":if(i=b[a++]*c+d,j=b[a++]*c,m=b[a++]*c+d,l=b[a++]*-c,o=b[a++]*c+d,r=b[a++]*-c,e.bezierCurveTo(i,j,m,l,o,r),f=g[g.length-1]){q=f.x;n=f.y;f=1;for(h=this.divisions;f<=h;f++)s=f/h,t=THREE.Shape.Utils.b3(s,q,m,
|
|
|
+o,i),s=THREE.Shape.Utils.b3(s,n,l,r,j),g.push(new THREE.Vector2(t,s))}}}return{offset:p.ha*c,points:g,path:e}}}};
|
|
|
+(function(a){var b=function(a){for(var b=a.length,e=0,g=b-1,f=0;f<b;g=f++)e+=a[g].x*a[f].y-a[f].x*a[g].y;return e*0.5};a.Triangulate=function(a,d){var e=a.length;if(e<3)return null;var g=[],f=[],h=[],i,k,j;if(b(a)>0)for(k=0;k<e;k++)f[k]=k;else for(k=0;k<e;k++)f[k]=e-1-k;var q=2*e;for(k=e-1;e>2;){if(q--<=0){console.log("Warning, unable to triangulate polygon!");if(d)return h;return g}i=k;e<=i&&(i=0);k=i+1;e<=k&&(k=0);j=k+1;e<=j&&(j=0);var n;a:{n=a;var m=i,l=k,o=j,r=e,p=f,s=void 0,t=void 0,w=void 0,
|
|
|
+z=void 0,u=void 0,y=void 0,x=void 0,A=void 0,D=void 0,t=n[p[m]].x,w=n[p[m]].y,z=n[p[l]].x,u=n[p[l]].y,y=n[p[o]].x,x=n[p[o]].y;if(1.0E-10>(z-t)*(x-w)-(u-w)*(y-t))n=!1;else{for(s=0;s<r;s++)if(!(s==m||s==l||s==o)){var A=n[p[s]].x,D=n[p[s]].y,v=void 0,E=void 0,F=void 0,C=void 0,K=void 0,G=void 0,J=void 0,O=void 0,M=void 0,B=void 0,H=void 0,N=void 0,v=F=K=void 0,v=y-z,E=x-u,F=t-y,C=w-x,K=z-t,G=u-w,J=A-t,O=D-w,M=A-z,B=D-u,H=A-y,N=D-x,v=v*B-E*M,K=K*O-G*J,F=F*N-C*H;if(v>=0&&F>=0&&K>=0){n=!1;break a}}n=!0}}if(n){g.push([a[f[i]],
|
|
|
a[f[k]],a[f[j]]]);h.push([f[i],f[k],f[j]]);i=k;for(j=k+1;j<e;i++,j++)f[i]=f[j];e--;q=2*e}}if(d)return h;return g};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 g=d/this.segmentsT*this.arc,f=c/this.segmentsR*Math.PI*2;e.x=this.radius*Math.cos(g);e.y=this.radius*Math.sin(g);var h=new THREE.Vector3;h.x=(this.radius+this.tube*Math.cos(f))*Math.cos(g);h.y=(this.radius+this.tube*Math.cos(f))*Math.sin(g);h.z=
|
|
|
this.tube*Math.sin(f);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,g=(this.segmentsT+1)*(c-1)+d-1,f=(this.segmentsT+1)*(c-1)+d,h=(this.segmentsT+1)*c+d,i=new THREE.Face4(e,g,f,h,[b[e],b[g],b[f],b[h]]);i.normal.addSelf(b[e]);i.normal.addSelf(b[g]);i.normal.addSelf(b[f]);i.normal.addSelf(b[h]);i.normal.normalize();this.faces.push(i);
|
|
@@ -203,13 +203,13 @@ THREE.TorusKnotGeometry=function(a,b,c,d,e,g,f){function h(a,b,c,d,e,g){b=c/d*a;
|
|
|
this.segmentsT;++b){var i=a/this.segmentsR*2*this.p*Math.PI,f=b/this.segmentsT*2*Math.PI,e=h(i,f,this.q,this.p,this.radius,this.heightScale),i=h(i+0.01,f,this.q,this.p,this.radius,this.heightScale);c.x=i.x-e.x;c.y=i.y-e.y;c.z=i.z-e.z;d.x=i.x+e.x;d.y=i.y+e.y;d.z=i.z+e.z;g.cross(c,d);d.cross(g,c);g.normalize();d.normalize();i=-this.tube*Math.cos(f);f=this.tube*Math.sin(f);e.x+=i*d.x+f*g.x;e.y+=i*d.y+f*g.y;e.z+=i*d.z+f*g.z;this.grid[a][b]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(e.x,e.y,
|
|
|
e.z)))-1}}for(a=0;a<this.segmentsR;++a)for(b=0;b<this.segmentsT;++b){var d=(a+1)%this.segmentsR,g=(b+1)%this.segmentsT,e=this.grid[a][b],c=this.grid[d][b],d=this.grid[d][g],g=this.grid[a][g],f=new THREE.UV(a/this.segmentsR,b/this.segmentsT),i=new THREE.UV((a+1)/this.segmentsR,b/this.segmentsT),k=new THREE.UV((a+1)/this.segmentsR,(b+1)/this.segmentsT),j=new THREE.UV(a/this.segmentsR,(b+1)/this.segmentsT);this.faces.push(new THREE.Face4(e,c,d,g));this.faceVertexUvs[0].push([f,i,k,j])}this.computeCentroids();
|
|
|
this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=new THREE.Geometry;THREE.TorusKnotGeometry.prototype.constructor=THREE.TorusKnotGeometry;THREE.SubdivisionModifier=function(a){this.subdivisions=a===void 0?1:a;this.useOldVertexColors=!1;this.supportUVs=!0};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(a,b,c,d,h,i){var j=new THREE.Face4(a,b,c,d,null,h.color,h.material);if(f.useOldVertexColors){j.vertexColors=[];for(var k,n,l,m=0;m<4;m++){l=i[m];k=new THREE.Color;k.setRGB(0,0,0);for(var o=0;o<l.length;o++)n=h.vertexColors[l[o]-1],k.r+=n.r,k.g+=n.g,k.b+=n.b;k.r/=l.length;k.g/=l.length;k.b/=l.length;j.vertexColors[m]=k}}e.push(j);(!f.supportUVs||p.length!=0)&&g.push([p[a],p[b],p[c],p[d]])}function c(a,b){return Math.min(a,b)+"_"+Math.max(a,
|
|
|
-b)}var d=[],e=[],g=[],f=this,h=a.vertices,d=a.faces,i=h.concat(),k=[],j={},q={},p=[],m,l,n,r,o,s=a.faceVertexUvs[0];m=0;for(l=s.length;m<l;m++){n=0;for(r=s[m].length;n<r;n++)o=d[m]["abcd".charAt(n)],p[o]||(p[o]=s[m][n])}var t;m=0;for(l=d.length;m<l;m++)if(o=d[m],k.push(o.centroid),i.push(new THREE.Vertex(o.centroid)),f.supportUVs&&p.length!=0){t=new THREE.UV;if(o instanceof THREE.Face3)t.u=p[o.a].u+p[o.b].u+p[o.c].u,t.v=p[o.a].v+p[o.b].v+p[o.c].v,t.u/=3,t.v/=3;else if(o instanceof THREE.Face4)t.u=
|
|
|
-p[o.a].u+p[o.b].u+p[o.c].u+p[o.d].u,t.v=p[o.a].v+p[o.b].v+p[o.c].v+p[o.d].v,t.u/=4,t.v/=4;p.push(t)}l=function(a){function b(a,c,d){a[c]===void 0&&(a[c]=[]);a[c].push(d)}var d,e,g,f,h={};d=0;for(e=a.faces.length;d<e;d++)g=a.faces[d],g instanceof THREE.Face3?(f=c(g.a,g.b),b(h,f,d),f=c(g.b,g.c),b(h,f,d),f=c(g.c,g.a),b(h,f,d)):g instanceof THREE.Face4&&(f=c(g.a,g.b),b(h,f,d),f=c(g.b,g.c),b(h,f,d),f=c(g.c,g.d),b(h,f,d),f=c(g.d,g.a),b(h,f,d));return h}(a);var w=0,s=h.length,z,u,y={},x={},A=function(a,
|
|
|
-b){y[a]===void 0&&(y[a]=[]);y[a].push(b)},D=function(a,b){x[a]===void 0&&(x[a]={});x[a][b]=null};for(m in l){t=l[m];z=m.split("_");u=z[0];z=z[1];A(u,[u,z]);A(z,[u,z]);n=0;for(r=t.length;n<r;n++)o=t[n],D(u,o,m),D(z,o,m);t.length<2&&(q[m]=!0)}for(m in l)if(t=l[m],o=t[0],t=t[1],z=m.split("_"),u=z[0],z=z[1],r=new THREE.Vector3,q[m]?(r.addSelf(h[u].position),r.addSelf(h[z].position),r.multiplyScalar(0.5)):(r.addSelf(k[o]),r.addSelf(k[t]),r.addSelf(h[u].position),r.addSelf(h[z].position),r.multiplyScalar(0.25)),
|
|
|
-j[m]=s+d.length+w,i.push(new THREE.Vertex(r)),w++,f.supportUVs&&p.length!=0)t=new THREE.UV,t.u=p[u].u+p[z].u,t.v=p[u].v+p[z].v,t.u/=2,t.v/=2,p.push(t);var v,E;z=["123","12","2","23"];r=["123","23","3","31"];var A=["123","31","1","12"],D=["1234","12","2","23"],F=["1234","23","3","34"],C=["1234","34","4","41"],K=["1234","41","1","12"];m=0;for(l=k.length;m<l;m++)o=d[m],t=s+m,o instanceof THREE.Face3?(w=c(o.a,o.b),u=c(o.b,o.c),v=c(o.c,o.a),b(t,j[w],o.b,j[u],o,z),b(t,j[u],o.c,j[v],o,r),b(t,j[v],o.a,j[w],
|
|
|
-o,A)):o instanceof THREE.Face4?(w=c(o.a,o.b),u=c(o.b,o.c),v=c(o.c,o.d),E=c(o.d,o.a),b(t,j[w],o.b,j[u],o,D),b(t,j[u],o.c,j[v],o,F),b(t,j[v],o.d,j[E],o,C),b(t,j[E],o.a,j[w],o,K)):console.log("face should be a face!",o);d=i;i=new THREE.Vector3;j=new THREE.Vector3;m=0;for(l=h.length;m<l;m++)if(y[m]!==void 0){i.set(0,0,0);j.set(0,0,0);o=new THREE.Vector3(0,0,0);t=0;for(n in x[m])i.addSelf(k[n]),t++;w=0;s=y[m].length;for(n=0;n<s;n++)q[c(y[m][n][0],y[m][n][1])]&&w++;if(w!=2){i.divideScalar(t);for(n=0;n<
|
|
|
-s;n++)t=y[m][n],t=h[t[0]].position.clone().addSelf(h[t[1]].position).divideScalar(2),j.addSelf(t);j.divideScalar(s);o.addSelf(h[m].position);o.multiplyScalar(s-3);o.addSelf(i);o.addSelf(j.multiplyScalar(2));o.divideScalar(s);d[m].position=o}}a.vertices=d;a.faces=e;a.faceVertexUvs[0]=g;delete a.__tmpVertices;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals()};
|
|
|
+THREE.SubdivisionModifier.prototype.smooth=function(a){function b(a,b,c,d,h,i){var j=new THREE.Face4(a,b,c,d,null,h.color,h.material);if(f.useOldVertexColors){j.vertexColors=[];for(var k,o,l,m=0;m<4;m++){l=i[m];k=new THREE.Color;k.setRGB(0,0,0);for(var p=0;p<l.length;p++)o=h.vertexColors[l[p]-1],k.r+=o.r,k.g+=o.g,k.b+=o.b;k.r/=l.length;k.g/=l.length;k.b/=l.length;j.vertexColors[m]=k}}e.push(j);(!f.supportUVs||n.length!=0)&&g.push([n[a],n[b],n[c],n[d]])}function c(a,b){return Math.min(a,b)+"_"+Math.max(a,
|
|
|
+b)}var d=[],e=[],g=[],f=this,h=a.vertices,d=a.faces,i=h.concat(),k=[],j={},q={},n=[],m,l,o,r,p,s=a.faceVertexUvs[0];m=0;for(l=s.length;m<l;m++){o=0;for(r=s[m].length;o<r;o++)p=d[m]["abcd".charAt(o)],n[p]||(n[p]=s[m][o])}var t;m=0;for(l=d.length;m<l;m++)if(p=d[m],k.push(p.centroid),i.push(new THREE.Vertex(p.centroid)),f.supportUVs&&n.length!=0){t=new THREE.UV;if(p instanceof THREE.Face3)t.u=n[p.a].u+n[p.b].u+n[p.c].u,t.v=n[p.a].v+n[p.b].v+n[p.c].v,t.u/=3,t.v/=3;else if(p instanceof THREE.Face4)t.u=
|
|
|
+n[p.a].u+n[p.b].u+n[p.c].u+n[p.d].u,t.v=n[p.a].v+n[p.b].v+n[p.c].v+n[p.d].v,t.u/=4,t.v/=4;n.push(t)}l=function(a){function b(a,c,d){a[c]===void 0&&(a[c]=[]);a[c].push(d)}var d,e,g,f,h={};d=0;for(e=a.faces.length;d<e;d++)g=a.faces[d],g instanceof THREE.Face3?(f=c(g.a,g.b),b(h,f,d),f=c(g.b,g.c),b(h,f,d),f=c(g.c,g.a),b(h,f,d)):g instanceof THREE.Face4&&(f=c(g.a,g.b),b(h,f,d),f=c(g.b,g.c),b(h,f,d),f=c(g.c,g.d),b(h,f,d),f=c(g.d,g.a),b(h,f,d));return h}(a);var w=0,s=h.length,z,u,y={},x={},A=function(a,
|
|
|
+b){y[a]===void 0&&(y[a]=[]);y[a].push(b)},D=function(a,b){x[a]===void 0&&(x[a]={});x[a][b]=null};for(m in l){t=l[m];z=m.split("_");u=z[0];z=z[1];A(u,[u,z]);A(z,[u,z]);o=0;for(r=t.length;o<r;o++)p=t[o],D(u,p,m),D(z,p,m);t.length<2&&(q[m]=!0)}for(m in l)if(t=l[m],p=t[0],t=t[1],z=m.split("_"),u=z[0],z=z[1],r=new THREE.Vector3,q[m]?(r.addSelf(h[u].position),r.addSelf(h[z].position),r.multiplyScalar(0.5)):(r.addSelf(k[p]),r.addSelf(k[t]),r.addSelf(h[u].position),r.addSelf(h[z].position),r.multiplyScalar(0.25)),
|
|
|
+j[m]=s+d.length+w,i.push(new THREE.Vertex(r)),w++,f.supportUVs&&n.length!=0)t=new THREE.UV,t.u=n[u].u+n[z].u,t.v=n[u].v+n[z].v,t.u/=2,t.v/=2,n.push(t);var v,E;z=["123","12","2","23"];r=["123","23","3","31"];var A=["123","31","1","12"],D=["1234","12","2","23"],F=["1234","23","3","34"],C=["1234","34","4","41"],K=["1234","41","1","12"];m=0;for(l=k.length;m<l;m++)p=d[m],t=s+m,p instanceof THREE.Face3?(w=c(p.a,p.b),u=c(p.b,p.c),v=c(p.c,p.a),b(t,j[w],p.b,j[u],p,z),b(t,j[u],p.c,j[v],p,r),b(t,j[v],p.a,j[w],
|
|
|
+p,A)):p instanceof THREE.Face4?(w=c(p.a,p.b),u=c(p.b,p.c),v=c(p.c,p.d),E=c(p.d,p.a),b(t,j[w],p.b,j[u],p,D),b(t,j[u],p.c,j[v],p,F),b(t,j[v],p.d,j[E],p,C),b(t,j[E],p.a,j[w],p,K)):console.log("face should be a face!",p);d=i;i=new THREE.Vector3;j=new THREE.Vector3;m=0;for(l=h.length;m<l;m++)if(y[m]!==void 0){i.set(0,0,0);j.set(0,0,0);p=new THREE.Vector3(0,0,0);t=0;for(o in x[m])i.addSelf(k[o]),t++;w=0;s=y[m].length;for(o=0;o<s;o++)q[c(y[m][o][0],y[m][o][1])]&&w++;if(w!=2){i.divideScalar(t);for(o=0;o<
|
|
|
+s;o++)t=y[m][o],t=h[t[0]].position.clone().addSelf(h[t[1]].position).divideScalar(2),j.addSelf(t);j.divideScalar(s);p.addSelf(h[m].position);p.multiplyScalar(s-3);p.addSelf(i);p.addSelf(j.multiplyScalar(2));p.divideScalar(s);d[m].position=p}}a.vertices=d;a.faces=e;a.faceVertexUvs[0]=g;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:"",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?(100*a.loaded/a.total).toFixed(0)+
|
|
|
"%":(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++)if(b=a.materials[c],b instanceof THREE.ShaderMaterial)return!0;return!1},createMaterial:function(a,b){function c(a){a=Math.log(a)/Math.LN2;return Math.floor(a)==
|
|
@@ -217,39 +217,39 @@ a}function d(a,b){var d=new Image;d.onload=function(){if(!c(this.width)||!c(this
|
|
|
if(g[0]!=1)a[c].wrapS=THREE.RepeatWrapping;if(g[1]!=1)a[c].wrapT=THREE.RepeatWrapping}f&&a[c].offset.set(f[0],f[1]);if(h){g={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(g[h[0]]!==void 0)a[c].wrapS=g[h[0]];if(g[h[1]]!==void 0)a[c].wrapT=g[h[1]]}d(a[c],b+"/"+e)}function g(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255}var f=this,h,i,k;i="MeshLambertMaterial";h={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:a.wireframe};a.shading&&(a.shading=="Phong"?
|
|
|
i="MeshPhongMaterial":a.shading=="Basic"&&(i="MeshBasicMaterial"));if(a.blending)if(a.blending=="Additive")h.blending=THREE.AdditiveBlending;else if(a.blending=="Subtractive")h.blending=THREE.SubtractiveBlending;else if(a.blending=="Multiply")h.blending=THREE.MultiplyBlending;if(a.transparent!==void 0||a.opacity<1)h.transparent=a.transparent;if(a.depthTest!==void 0)h.depthTest=a.depthTest;if(a.vertexColors!==void 0)if(a.vertexColors=="face")h.vertexColors=THREE.FaceColors;else if(a.vertexColors)h.vertexColors=
|
|
|
THREE.VertexColors;if(a.colorDiffuse)h.color=g(a.colorDiffuse);else if(a.DbgColor)h.color=a.DbgColor;if(a.colorSpecular)h.specular=g(a.colorSpecular);if(a.colorAmbient)h.ambient=g(a.colorAmbient);if(a.transparency)h.opacity=a.transparency;if(a.specularCoef)h.shininess=a.specularCoef;a.mapDiffuse&&b&&e(h,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap);a.mapLight&&b&&e(h,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap);a.mapNormal&&b&&e(h,"normalMap",
|
|
|
-a.mapNormal,a.mapNormalRepeat,a.mapNormalOffset,a.mapNormalWrap);a.mapSpecular&&b&&e(h,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){var j=THREE.ShaderUtils.lib.normal,q=THREE.UniformsUtils.clone(j.uniforms),p=h.color;i=h.specular;k=h.ambient;var m=h.shininess;q.tNormal.texture=h.normalMap;if(a.mapNormalFactor)q.uNormalScale.value=a.mapNormalFactor;if(h.map)q.tDiffuse.texture=h.map,q.enableDiffuse.value=!0;if(h.specularMap)q.tSpecular.texture=
|
|
|
-h.specularMap,q.enableSpecular.value=!0;if(h.lightMap)q.tAO.texture=h.lightMap,q.enableAO.value=!0;q.uDiffuseColor.value.setHex(p);q.uSpecularColor.value.setHex(i);q.uAmbientColor.value.setHex(k);q.uShininess.value=m;if(h.opacity)q.uOpacity.value=h.opacity;h=new THREE.ShaderMaterial({fragmentShader:j.fragmentShader,vertexShader:j.vertexShader,uniforms:q,lights:!0,fog:!0})}else h=new THREE[i](h);if(a.DbgName!==void 0)h.name=a.DbgName;return h}};
|
|
|
+a.mapNormal,a.mapNormalRepeat,a.mapNormalOffset,a.mapNormalWrap);a.mapSpecular&&b&&e(h,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){var j=THREE.ShaderUtils.lib.normal,q=THREE.UniformsUtils.clone(j.uniforms),n=h.color;i=h.specular;k=h.ambient;var m=h.shininess;q.tNormal.texture=h.normalMap;if(a.mapNormalFactor)q.uNormalScale.value=a.mapNormalFactor;if(h.map)q.tDiffuse.texture=h.map,q.enableDiffuse.value=!0;if(h.specularMap)q.tSpecular.texture=
|
|
|
+h.specularMap,q.enableSpecular.value=!0;if(h.lightMap)q.tAO.texture=h.lightMap,q.enableAO.value=!0;q.uDiffuseColor.value.setHex(n);q.uSpecularColor.value.setHex(i);q.uAmbientColor.value.setHex(k);q.uShininess.value=m;if(h.opacity)q.uOpacity.value=h.opacity;h=new THREE.ShaderMaterial({fragmentShader:j.fragmentShader,vertexShader:j.vertexShader,uniforms:q,lights:!0,fog:!0})}else h=new THREE[i](h);if(a.DbgName!==void 0)h.name=a.DbgName;return h}};
|
|
|
THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;
|
|
|
THREE.BinaryLoader.prototype.load=function(a,b,c,d){if(a instanceof Object)console.warn("DEPRECATED: BinaryLoader( parameters ) is now BinaryLoader( url, callback, texturePath, binaryPath )."),d=a,a=d.model,b=d.callback,c=d.texture_path,d=d.bin_path;var c=c?c:this.extractUrlbase(a),d=d?d:this.extractUrlbase(a),e=this.showProgress?THREE.Loader.prototype.updateProgress:null;this.onLoadStart();this.loadAjaxJSON(this,a,b,c,d,e)};
|
|
|
THREE.BinaryLoader.prototype.loadAjaxJSON=function(a,b,c,d,e,g){var f=new XMLHttpRequest;f.onreadystatechange=function(){if(f.readyState==4)if(f.status==200||f.status==0)try{var h=JSON.parse(f.responseText);h.metadata===void 0||h.metadata.formatVersion===void 0||h.metadata.formatVersion!==3?console.error("Deprecated file format."):a.loadAjaxBuffers(h,c,e,d,g)}catch(i){console.error(i),console.warn("DEPRECATED: ["+b+"] seems to be using old model format")}else console.error("Couldn't load ["+b+"] ["+
|
|
|
f.status+"]")};f.open("GET",b,!0);f.overrideMimeType("text/plain; charset=x-user-defined");f.setRequestHeader("Content-Type","text/plain");f.send(null)};
|
|
|
THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,b,c,d,e){var g=new XMLHttpRequest,f=c+"/"+a.buffers,h=0;g.onreadystatechange=function(){g.readyState==4?g.status==200||g.status==0?THREE.BinaryLoader.prototype.createBinModel(g.response,b,d,a.materials):console.error("Couldn't load ["+f+"] ["+g.status+"]"):g.readyState==3?e&&(h==0&&(h=g.getResponseHeader("Content-Length")),e({total:h,loaded:g.responseText.length})):g.readyState==2&&(h=g.getResponseHeader("Content-Length"))};g.open("GET",f,!0);
|
|
|
g.responseType="arraybuffer";g.send(null)};
|
|
|
-THREE.BinaryLoader.prototype.createBinModel=function(a,b,c,d){var e=function(b){function c(a){return a%4?4-a%4:0}function e(a,b){return(new Uint8Array(a,b,1))[0]}function i(a,b){return(new Uint32Array(a,b,1))[0]}function k(b,c){var d,e,g,f,h,i,j,k,m=new Uint32Array(a,c,3*b);for(d=0;d<b;d++){e=m[d*3];g=m[d*3+1];f=m[d*3+2];h=t[e*2];e=t[e*2+1];i=t[g*2];j=t[g*2+1];g=t[f*2];k=t[f*2+1];f=n.faceVertexUvs[0];var l=[];l.push(new THREE.UV(h,e));l.push(new THREE.UV(i,j));l.push(new THREE.UV(g,k));f.push(l)}}
|
|
|
-function j(b,c){var d,e,g,f,h,i,j,k,m,l,o=new Uint32Array(a,c,4*b);for(d=0;d<b;d++){e=o[d*4];g=o[d*4+1];f=o[d*4+2];h=o[d*4+3];i=t[e*2];e=t[e*2+1];j=t[g*2];m=t[g*2+1];k=t[f*2];l=t[f*2+1];f=t[h*2];g=t[h*2+1];h=n.faceVertexUvs[0];var p=[];p.push(new THREE.UV(i,e));p.push(new THREE.UV(j,m));p.push(new THREE.UV(k,l));p.push(new THREE.UV(f,g));h.push(p)}}function q(b,c,d){for(var e,g,f,h,c=new Uint32Array(a,c,3*b),i=new Uint16Array(a,d,b),d=0;d<b;d++)e=c[d*3],g=c[d*3+1],f=c[d*3+2],h=i[d],n.faces.push(new THREE.Face3(e,
|
|
|
-g,f,null,null,h))}function p(b,c,d){for(var e,g,f,h,i,c=new Uint32Array(a,c,4*b),j=new Uint16Array(a,d,b),d=0;d<b;d++)e=c[d*4],g=c[d*4+1],f=c[d*4+2],h=c[d*4+3],i=j[d],n.faces.push(new THREE.Face4(e,g,f,h,null,null,i))}function m(b,c,d,e){for(var g,f,h,i,j,k,m,c=new Uint32Array(a,c,3*b),d=new Uint32Array(a,d,3*b),l=new Uint16Array(a,e,b),e=0;e<b;e++){g=c[e*3];f=c[e*3+1];h=c[e*3+2];j=d[e*3];k=d[e*3+1];m=d[e*3+2];i=l[e];var o=s[k*3],p=s[k*3+1];k=s[k*3+2];var q=s[m*3],r=s[m*3+1];m=s[m*3+2];n.faces.push(new THREE.Face3(g,
|
|
|
-f,h,[new THREE.Vector3(s[j*3],s[j*3+1],s[j*3+2]),new THREE.Vector3(o,p,k),new THREE.Vector3(q,r,m)],null,i))}}function l(b,c,d,e){for(var g,f,h,i,j,k,m,l,o,c=new Uint32Array(a,c,4*b),d=new Uint32Array(a,d,4*b),p=new Uint16Array(a,e,b),e=0;e<b;e++){g=c[e*4];f=c[e*4+1];h=c[e*4+2];i=c[e*4+3];k=d[e*4];m=d[e*4+1];l=d[e*4+2];o=d[e*4+3];j=p[e];var q=s[m*3],r=s[m*3+1];m=s[m*3+2];var t=s[l*3],u=s[l*3+1];l=s[l*3+2];var w=s[o*3],x=s[o*3+1];o=s[o*3+2];n.faces.push(new THREE.Face4(g,f,h,i,[new THREE.Vector3(s[k*
|
|
|
-3],s[k*3+1],s[k*3+2]),new THREE.Vector3(q,r,m),new THREE.Vector3(t,u,l),new THREE.Vector3(w,x,o)],null,j))}}var n=this,r=0,o,s=[],t=[],w,z,u,y,x,A;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(n,d,b);o={signature:function(a,b,c){for(var a=new Uint8Array(a,b,c),d="",e=0;e<c;e++)d+=String.fromCharCode(a[b+e]);return d}(a,r,12),header_bytes:e(a,r+12),vertex_coordinate_bytes:e(a,r+13),normal_coordinate_bytes:e(a,r+14),uv_coordinate_bytes:e(a,r+15),vertex_index_bytes:e(a,r+16),normal_index_bytes:e(a,
|
|
|
-r+17),uv_index_bytes:e(a,r+18),material_index_bytes:e(a,r+19),nvertices:i(a,r+20),nnormals:i(a,r+20+4),nuvs:i(a,r+20+8),ntri_flat:i(a,r+20+12),ntri_smooth:i(a,r+20+16),ntri_flat_uv:i(a,r+20+20),ntri_smooth_uv:i(a,r+20+24),nquad_flat:i(a,r+20+28),nquad_smooth:i(a,r+20+32),nquad_flat_uv:i(a,r+20+36),nquad_smooth_uv:i(a,r+20+40)};o.signature!=="Three.js 003"&&console.warn("DEPRECATED: binary model seems to be using old format");r+=o.header_bytes;b=o.vertex_index_bytes*3+o.material_index_bytes;A=o.vertex_index_bytes*
|
|
|
-4+o.material_index_bytes;w=o.ntri_flat*b;z=o.ntri_smooth*(b+o.normal_index_bytes*3);u=o.ntri_flat_uv*(b+o.uv_index_bytes*3);y=o.ntri_smooth_uv*(b+o.normal_index_bytes*3+o.uv_index_bytes*3);x=o.nquad_flat*A;b=o.nquad_smooth*(A+o.normal_index_bytes*4);A=o.nquad_flat_uv*(A+o.uv_index_bytes*4);r+=function(b){var c=o.nvertices,b=new Float32Array(a,b,c*3),d,e,g,f;for(d=0;d<c;d++)e=b[d*3],g=b[d*3+1],f=b[d*3+2],n.vertices.push(new THREE.Vertex(new THREE.Vector3(e,g,f)));return c*3*Float32Array.BYTES_PER_ELEMENT}(r);
|
|
|
-r+=function(b){var c=o.nnormals;if(c){var b=new Int8Array(a,b,c*3),d,e,g,f;for(d=0;d<c;d++)e=b[d*3],g=b[d*3+1],f=b[d*3+2],s.push(e/127,g/127,f/127)}return c*3*Int8Array.BYTES_PER_ELEMENT}(r);r+=c(o.nnormals*3);r+=function(b){var c=o.nuvs;if(c){var b=new Float32Array(a,b,c*2),d,e,g;for(d=0;d<c;d++)e=b[d*2],g=b[d*2+1],t.push(e,g)}return c*2*Float32Array.BYTES_PER_ELEMENT}(r);w=r+w+c(o.ntri_flat*2);z=w+z+c(o.ntri_smooth*2);u=z+u+c(o.ntri_flat_uv*2);y=u+y+c(o.ntri_smooth_uv*2);x=y+x+c(o.nquad_flat*2);
|
|
|
-b=x+b+c(o.nquad_smooth*2);A=b+A+c(o.nquad_flat_uv*2);(function(a){var b=o.ntri_flat_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*3;q(b,a,c+b*Uint32Array.BYTES_PER_ELEMENT*3);k(b,c)}})(z);(function(a){var b=o.ntri_smooth_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*3,d=c+b*Uint32Array.BYTES_PER_ELEMENT*3;m(b,a,c,d+b*Uint32Array.BYTES_PER_ELEMENT*3);k(b,d)}})(u);(function(a){var b=o.nquad_flat_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*4;p(b,a,c+b*Uint32Array.BYTES_PER_ELEMENT*4);j(b,
|
|
|
-c)}})(b);(function(a){var b=o.nquad_smooth_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*4,d=c+b*Uint32Array.BYTES_PER_ELEMENT*4;l(b,a,c,d+b*Uint32Array.BYTES_PER_ELEMENT*4);j(b,d)}})(A);(function(a){var b=o.ntri_flat;b&&q(b,a,a+b*Uint32Array.BYTES_PER_ELEMENT*3)})(r);(function(a){var b=o.ntri_smooth;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*3;m(b,a,c,c+b*Uint32Array.BYTES_PER_ELEMENT*3)}})(w);(function(a){var b=o.nquad_flat;b&&p(b,a,a+b*Uint32Array.BYTES_PER_ELEMENT*4)})(y);(function(a){var b=
|
|
|
-o.nquad_smooth;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*4;l(b,a,c,c+b*Uint32Array.BYTES_PER_ELEMENT*4)}})(x);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.BinaryLoader.prototype.createBinModel=function(a,b,c,d){var e=function(b){function c(a){return a%4?4-a%4:0}function e(a,b){return(new Uint8Array(a,b,1))[0]}function i(a,b){return(new Uint32Array(a,b,1))[0]}function k(b,c){var d,e,g,f,h,i,j,k,m=new Uint32Array(a,c,3*b);for(d=0;d<b;d++){e=m[d*3];g=m[d*3+1];f=m[d*3+2];h=t[e*2];e=t[e*2+1];i=t[g*2];j=t[g*2+1];g=t[f*2];k=t[f*2+1];f=o.faceVertexUvs[0];var l=[];l.push(new THREE.UV(h,e));l.push(new THREE.UV(i,j));l.push(new THREE.UV(g,k));f.push(l)}}
|
|
|
+function j(b,c){var d,e,g,f,h,i,j,k,m,l,p=new Uint32Array(a,c,4*b);for(d=0;d<b;d++){e=p[d*4];g=p[d*4+1];f=p[d*4+2];h=p[d*4+3];i=t[e*2];e=t[e*2+1];j=t[g*2];m=t[g*2+1];k=t[f*2];l=t[f*2+1];f=t[h*2];g=t[h*2+1];h=o.faceVertexUvs[0];var n=[];n.push(new THREE.UV(i,e));n.push(new THREE.UV(j,m));n.push(new THREE.UV(k,l));n.push(new THREE.UV(f,g));h.push(n)}}function q(b,c,d){for(var e,g,f,h,c=new Uint32Array(a,c,3*b),i=new Uint16Array(a,d,b),d=0;d<b;d++)e=c[d*3],g=c[d*3+1],f=c[d*3+2],h=i[d],o.faces.push(new THREE.Face3(e,
|
|
|
+g,f,null,null,h))}function n(b,c,d){for(var e,g,f,h,i,c=new Uint32Array(a,c,4*b),j=new Uint16Array(a,d,b),d=0;d<b;d++)e=c[d*4],g=c[d*4+1],f=c[d*4+2],h=c[d*4+3],i=j[d],o.faces.push(new THREE.Face4(e,g,f,h,null,null,i))}function m(b,c,d,e){for(var g,f,h,i,j,k,m,c=new Uint32Array(a,c,3*b),d=new Uint32Array(a,d,3*b),l=new Uint16Array(a,e,b),e=0;e<b;e++){g=c[e*3];f=c[e*3+1];h=c[e*3+2];j=d[e*3];k=d[e*3+1];m=d[e*3+2];i=l[e];var n=s[k*3],p=s[k*3+1];k=s[k*3+2];var q=s[m*3],r=s[m*3+1];m=s[m*3+2];o.faces.push(new THREE.Face3(g,
|
|
|
+f,h,[new THREE.Vector3(s[j*3],s[j*3+1],s[j*3+2]),new THREE.Vector3(n,p,k),new THREE.Vector3(q,r,m)],null,i))}}function l(b,c,d,e){for(var g,f,h,i,j,k,m,l,n,c=new Uint32Array(a,c,4*b),d=new Uint32Array(a,d,4*b),p=new Uint16Array(a,e,b),e=0;e<b;e++){g=c[e*4];f=c[e*4+1];h=c[e*4+2];i=c[e*4+3];k=d[e*4];m=d[e*4+1];l=d[e*4+2];n=d[e*4+3];j=p[e];var q=s[m*3],r=s[m*3+1];m=s[m*3+2];var t=s[l*3],u=s[l*3+1];l=s[l*3+2];var w=s[n*3],x=s[n*3+1];n=s[n*3+2];o.faces.push(new THREE.Face4(g,f,h,i,[new THREE.Vector3(s[k*
|
|
|
+3],s[k*3+1],s[k*3+2]),new THREE.Vector3(q,r,m),new THREE.Vector3(t,u,l),new THREE.Vector3(w,x,n)],null,j))}}var o=this,r=0,p,s=[],t=[],w,z,u,y,x,A;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(o,d,b);p={signature:function(a,b,c){for(var a=new Uint8Array(a,b,c),d="",e=0;e<c;e++)d+=String.fromCharCode(a[b+e]);return d}(a,r,12),header_bytes:e(a,r+12),vertex_coordinate_bytes:e(a,r+13),normal_coordinate_bytes:e(a,r+14),uv_coordinate_bytes:e(a,r+15),vertex_index_bytes:e(a,r+16),normal_index_bytes:e(a,
|
|
|
+r+17),uv_index_bytes:e(a,r+18),material_index_bytes:e(a,r+19),nvertices:i(a,r+20),nnormals:i(a,r+20+4),nuvs:i(a,r+20+8),ntri_flat:i(a,r+20+12),ntri_smooth:i(a,r+20+16),ntri_flat_uv:i(a,r+20+20),ntri_smooth_uv:i(a,r+20+24),nquad_flat:i(a,r+20+28),nquad_smooth:i(a,r+20+32),nquad_flat_uv:i(a,r+20+36),nquad_smooth_uv:i(a,r+20+40)};p.signature!=="Three.js 003"&&console.warn("DEPRECATED: binary model seems to be using old format");r+=p.header_bytes;b=p.vertex_index_bytes*3+p.material_index_bytes;A=p.vertex_index_bytes*
|
|
|
+4+p.material_index_bytes;w=p.ntri_flat*b;z=p.ntri_smooth*(b+p.normal_index_bytes*3);u=p.ntri_flat_uv*(b+p.uv_index_bytes*3);y=p.ntri_smooth_uv*(b+p.normal_index_bytes*3+p.uv_index_bytes*3);x=p.nquad_flat*A;b=p.nquad_smooth*(A+p.normal_index_bytes*4);A=p.nquad_flat_uv*(A+p.uv_index_bytes*4);r+=function(b){var c=p.nvertices,b=new Float32Array(a,b,c*3),d,e,g,f;for(d=0;d<c;d++)e=b[d*3],g=b[d*3+1],f=b[d*3+2],o.vertices.push(new THREE.Vertex(new THREE.Vector3(e,g,f)));return c*3*Float32Array.BYTES_PER_ELEMENT}(r);
|
|
|
+r+=function(b){var c=p.nnormals;if(c){var b=new Int8Array(a,b,c*3),d,e,g,f;for(d=0;d<c;d++)e=b[d*3],g=b[d*3+1],f=b[d*3+2],s.push(e/127,g/127,f/127)}return c*3*Int8Array.BYTES_PER_ELEMENT}(r);r+=c(p.nnormals*3);r+=function(b){var c=p.nuvs;if(c){var b=new Float32Array(a,b,c*2),d,e,g;for(d=0;d<c;d++)e=b[d*2],g=b[d*2+1],t.push(e,g)}return c*2*Float32Array.BYTES_PER_ELEMENT}(r);w=r+w+c(p.ntri_flat*2);z=w+z+c(p.ntri_smooth*2);u=z+u+c(p.ntri_flat_uv*2);y=u+y+c(p.ntri_smooth_uv*2);x=y+x+c(p.nquad_flat*2);
|
|
|
+b=x+b+c(p.nquad_smooth*2);A=b+A+c(p.nquad_flat_uv*2);(function(a){var b=p.ntri_flat_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*3;q(b,a,c+b*Uint32Array.BYTES_PER_ELEMENT*3);k(b,c)}})(z);(function(a){var b=p.ntri_smooth_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*3,d=c+b*Uint32Array.BYTES_PER_ELEMENT*3;m(b,a,c,d+b*Uint32Array.BYTES_PER_ELEMENT*3);k(b,d)}})(u);(function(a){var b=p.nquad_flat_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*4;n(b,a,c+b*Uint32Array.BYTES_PER_ELEMENT*4);j(b,
|
|
|
+c)}})(b);(function(a){var b=p.nquad_smooth_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*4,d=c+b*Uint32Array.BYTES_PER_ELEMENT*4;l(b,a,c,d+b*Uint32Array.BYTES_PER_ELEMENT*4);j(b,d)}})(A);(function(a){var b=p.ntri_flat;b&&q(b,a,a+b*Uint32Array.BYTES_PER_ELEMENT*3)})(r);(function(a){var b=p.ntri_smooth;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*3;m(b,a,c,c+b*Uint32Array.BYTES_PER_ELEMENT*3)}})(w);(function(a){var b=p.nquad_flat;b&&n(b,a,a+b*Uint32Array.BYTES_PER_ELEMENT*4)})(y);(function(a){var b=
|
|
|
+p.nquad_smooth;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*4;l(b,a,c,c+b*Uint32Array.BYTES_PER_ELEMENT*4)}})(x);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){P=a;d=d||ia;e!==void 0&&(a=e.split("/"),a.pop(),ja=a.length<1?"":a.join("/")+"/");if((a=P.evaluate("//dae:asset",P,M,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":Z=i.textContent.charAt(0)}}if(!Q.convertUpAxis||Z===Q.upAxis)U=null;else switch(Z){case "X":U=Q.upAxis==="Y"?
|
|
|
"XtoY":"XtoZ";break;case "Y":U=Q.upAxis==="X"?"YtoX":"YtoZ";break;case "Z":U=Q.upAxis==="X"?"ZtoX":"ZtoY"}ca=b("//dae:library_images/dae:image",f,"image");da=b("//dae:library_materials/dae:material",x,"material");ea=b("//dae:library_effects/dae:effect",F,"effect");V=b("//dae:library_geometries/dae:geometry",r,"geometry");T=b("//dae:library_controllers/dae:controller",h,"controller");W=b("//dae:library_animations/dae:animation",K,"animation");fa=b(".//dae:library_visual_scenes/dae:visual_scene",j,
|
|
|
"visual_scene");$=[];aa=[];(a=P.evaluate(".//dae:scene/dae:instance_visual_scene",P,M,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(a=a.getAttribute("url").replace(/^#/,""),S=fa[a]):S=null;X=new THREE.Object3D;for(a=0;a<S.nodes.length;a++)X.add(g(S.nodes[a]));ga=[];c(X);a={scene:X,morphs:$,skins:aa,animations:ga,dae:{images:ca,materials:da,effects:ea,geometries:V,controllers:T,animations:W,visualScenes:fa,scene:S}};d&&d(a);return a}function b(a,b,c){for(var a=P.evaluate(a,P,M,XPathResult.ORDERED_NODE_ITERATOR_TYPE,
|
|
|
null),d={},e=a.iterateNext(),g=0;e;){e=(new b).parse(e);if(!e.id||e.id.length==0)e.id=c+g++;d[e.id]=e;e=a.iterateNext()}return d}function c(a){var b=S.getChildById(a.name,!0),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};ga.push(d);for(var e=0,g=b.keys.length;e<g;e++)d.length=Math.max(d.length,b.keys[e].time)}else d={hierarchy:[{keys:[],sids:[]}]};e=0;for(g=a.children.length;e<g;e++)for(var b=0,f=c(a.children[e]).hierarchy.length;b<
|
|
|
f;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 g=a.channels[0].sampler.output[c];g instanceof THREE.Matrix4&&a.world.copy(g)}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=T[b.url];if(!e||!e.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 g,c=1E6,f=-c,h=0;for(g in W)for(var i=W[g],j=0;j<i.sampler.length;j++){var k=i.sampler[j];k.create();c=Math.min(c,k.startTime);f=Math.max(f,k.endTime);h=Math.max(h,k.input.length)}g={start:c,end:f,frames:h};for(var b=S.getChildById(b.skeleton[0],!0)||S.getChildBySid(b.skeleton[0],!0),m,n,f=new THREE.Vector3,l,j=0;j<a.vertices.length;j++)e.skin.bindShapeMatrix.multiplyVector3(a.vertices[j].position);for(c=0;c<g.frames;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=e.skin;for(n=0;n<j.length;n++)if(m=j[n],l=-1,m.type=="JOINT"){for(var o=0;o<k.joints.length;o++)if(m.sid==k.joints[o]){l=o;break}if(l>=0){o=k.invBindMatrices[l];m.invBindMatrix=o;m.skinningMatrix=new THREE.Matrix4;m.skinningMatrix.multiply(m.world,o);m.weights=[];for(o=0;o<k.weights.length;o++)for(var p=0;p<k.weights[o].length;p++){var q=k.weights[o][p];q.joint==l&&m.weights.push(q)}}else throw"ColladaLoader: Could not find joint '"+m.sid+"'.";}for(j=0;j<h.length;j++)if(h[j].type==
|
|
|
-"JOINT")for(k=0;k<h[j].weights.length;k++)m=h[j].weights[k],n=m.index,m=m.weight,l=a.vertices[n],n=i[n],f.x=l.position.x,f.y=l.position.y,f.z=l.position.z,h[j].skinningMatrix.multiplyVector3(f),n.position.x+=f.x*m,n.position.y+=f.y*m,n.position.z+=f.z*m;a.morphTargets.push({name:"target_"+c,vertices:i})}}}function g(a){var b=new THREE.Object3D,c,d,f,h;for(f=0;f<a.controllers.length;f++){var i=T[a.controllers[f].url];switch(i.type){case "skin":if(V[i.skin.source]){var j=new n;j.url=i.skin.source;j.instance_material=
|
|
|
-a.controllers[f].instance_material;a.geometries.push(j);c=a.controllers[f]}else if(T[i.skin.source]&&(d=i=T[i.skin.source],i.morph&&V[i.morph.source]))j=new n,j.url=i.morph.source,j.instance_material=a.controllers[f].instance_material,a.geometries.push(j);break;case "morph":if(V[i.morph.source])j=new n,j.url=i.morph.source,j.instance_material=a.controllers[f].instance_material,a.geometries.push(j),d=a.controllers[f];console.log("ColladaLoader: Morph-controller partially supported.")}}for(f=0;f<a.geometries.length;f++){var i=
|
|
|
-a.geometries[f],j=i.instance_material,i=V[i.url],k={},l=[],o=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 q=ea[da[p.target].instance_effect.url].shader;q.material.opacity=!q.material.opacity?1:q.material.opacity;k[p.symbol]=o;l.push(q.material);p=q.material;o++}j=p||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});i=i.mesh.geometry3js;if(o>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=!0,j=new THREE.SkinnedMesh(i,j),j.skeleton=c.skeleton,j.skinController=T[c.url],j.skinInstanceController=c,j.name="skin_"+aa.length,aa.push(j);else if(d!==void 0){h=i;k=d instanceof m?T[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++)if(o=V[k.targets[l]],o.mesh&&o.mesh.primitives&&o.mesh.primitives.length)o=o.mesh.primitives[0].geometry,o.vertices.length===
|
|
|
-h.vertices.length&&h.morphTargets.push({name:"target_1",vertices:o.vertices});h.morphTargets.push({name:"target_Z",vertices:h.vertices})}j.morphTargets=!0;j=new THREE.Mesh(i,j);j.name="morph_"+$.length;$.push(j)}else j=new THREE.Mesh(i,j);a.geometries.length>1?b.add(j):b=j}}b.name=a.id||"";b.matrix=a.matrix;c=a.matrix.decompose();b.position=c[0];b.quaternion=c[1];b.useQuaternion=!0;b.scale=c[2];Q.centerGeometry&&b.geometry&&(c=THREE.GeometryUtils.center(b.geometry),b.quaternion.multiplyVector3(c.multiplySelf(b.scale)),
|
|
|
+else{var g,c=1E6,f=-c,h=0;for(g in W)for(var i=W[g],j=0;j<i.sampler.length;j++){var k=i.sampler[j];k.create();c=Math.min(c,k.startTime);f=Math.max(f,k.endTime);h=Math.max(h,k.input.length)}g={start:c,end:f,frames:h};for(var b=S.getChildById(b.skeleton[0],!0)||S.getChildBySid(b.skeleton[0],!0),m,o,f=new THREE.Vector3,l,j=0;j<a.vertices.length;j++)e.skin.bindShapeMatrix.multiplyVector3(a.vertices[j].position);for(c=0;c<g.frames;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=e.skin;for(o=0;o<j.length;o++)if(m=j[o],l=-1,m.type=="JOINT"){for(var n=0;n<k.joints.length;n++)if(m.sid==k.joints[n]){l=n;break}if(l>=0){n=k.invBindMatrices[l];m.invBindMatrix=n;m.skinningMatrix=new THREE.Matrix4;m.skinningMatrix.multiply(m.world,n);m.weights=[];for(n=0;n<k.weights.length;n++)for(var p=0;p<k.weights[n].length;p++){var q=k.weights[n][p];q.joint==l&&m.weights.push(q)}}else throw"ColladaLoader: Could not find joint '"+m.sid+"'.";}for(j=0;j<h.length;j++)if(h[j].type==
|
|
|
+"JOINT")for(k=0;k<h[j].weights.length;k++)m=h[j].weights[k],o=m.index,m=m.weight,l=a.vertices[o],o=i[o],f.x=l.position.x,f.y=l.position.y,f.z=l.position.z,h[j].skinningMatrix.multiplyVector3(f),o.position.x+=f.x*m,o.position.y+=f.y*m,o.position.z+=f.z*m;a.morphTargets.push({name:"target_"+c,vertices:i})}}}function g(a){var b=new THREE.Object3D,c,d,f,h;for(f=0;f<a.controllers.length;f++){var i=T[a.controllers[f].url];switch(i.type){case "skin":if(V[i.skin.source]){var j=new o;j.url=i.skin.source;j.instance_material=
|
|
|
+a.controllers[f].instance_material;a.geometries.push(j);c=a.controllers[f]}else if(T[i.skin.source]&&(d=i=T[i.skin.source],i.morph&&V[i.morph.source]))j=new o,j.url=i.morph.source,j.instance_material=a.controllers[f].instance_material,a.geometries.push(j);break;case "morph":if(V[i.morph.source])j=new o,j.url=i.morph.source,j.instance_material=a.controllers[f].instance_material,a.geometries.push(j),d=a.controllers[f];console.log("ColladaLoader: Morph-controller partially supported.")}}for(f=0;f<a.geometries.length;f++){var i=
|
|
|
+a.geometries[f],j=i.instance_material,i=V[i.url],k={},l=[],n=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 q=ea[da[p.target].instance_effect.url].shader;q.material.opacity=!q.material.opacity?1:q.material.opacity;k[p.symbol]=n;l.push(q.material);p=q.material;n++}j=p||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});i=i.mesh.geometry3js;if(n>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=!0,j=new THREE.SkinnedMesh(i,j),j.skeleton=c.skeleton,j.skinController=T[c.url],j.skinInstanceController=c,j.name="skin_"+aa.length,aa.push(j);else if(d!==void 0){h=i;k=d instanceof m?T[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++)if(n=V[k.targets[l]],n.mesh&&n.mesh.primitives&&n.mesh.primitives.length)n=n.mesh.primitives[0].geometry,n.vertices.length===
|
|
|
+h.vertices.length&&h.morphTargets.push({name:"target_1",vertices:n.vertices});h.morphTargets.push({name:"target_Z",vertices:h.vertices})}j.morphTargets=!0;j=new THREE.Mesh(i,j);j.name="morph_"+$.length;$.push(j)}else j=new THREE.Mesh(i,j);a.geometries.length>1?b.add(j):b=j}}b.name=a.id||"";b.matrix=a.matrix;c=a.matrix.decompose();b.position=c[0];b.quaternion=c[1];b.useQuaternion=!0;b.scale=c[2];Q.centerGeometry&&b.geometry&&(c=THREE.GeometryUtils.center(b.geometry),b.quaternion.multiplyVector3(c.multiplySelf(b.scale)),
|
|
|
b.position.subSelf(c));for(f=0;f<a.nodes.length;f++)b.add(g(a.nodes[f],a));return b}function f(){this.init_from=this.id=""}function h(){this.type=this.name=this.id="";this.morph=this.skin=null}function i(){this.weights=this.targets=this.source=this.method=null}function k(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function j(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function q(){this.sid=this.name=this.id="";this.nodes=
|
|
|
-[];this.controllers=[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function p(){this.type=this.sid="";this.data=[];this.obj=null}function m(){this.url="";this.skeleton=[];this.instance_material=[]}function l(){this.target=this.symbol=""}function n(){this.url="";this.instance_material=[]}function r(){this.id="";this.mesh=null}function o(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function s(){}function t(){this.material="";this.count=
|
|
|
+[];this.controllers=[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function n(){this.type=this.sid="";this.data=[];this.obj=null}function m(){this.url="";this.skeleton=[];this.instance_material=[]}function l(){this.target=this.symbol=""}function o(){this.url="";this.instance_material=[]}function r(){this.id="";this.mesh=null}function p(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function s(){}function t(){this.material="";this.count=
|
|
|
0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function w(){this.source="";this.stride=this.count=0;this.params=[]}function z(){this.input={}}function u(){this.semantic="";this.offset=0;this.source="";this.set=0}function y(a){this.id=a;this.type=null}function x(){this.name=this.id="";this.instance_effect=null}function A(){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 D(a,b){this.type=a;this.effect=b;this.material=null}function v(a){this.effect=a;this.format=this.init_from=null}function E(a){this.effect=a;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=this.source=null}function F(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function C(){this.url=""}function K(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function G(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=
|
|
|
this.arrSyntax=this.dotSyntax=this.sid=this.fullSid=null}function J(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 O(a){this.targets=[];this.time=a}function M(a){if(a=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function B(a){for(var a=N(a).split(/\s+/),b=[],c=0;c<a.length;c++)b.push(parseFloat(a[c]));return b}function H(a){for(var a=N(a).split(/\s+/),b=[],c=
|
|
@@ -260,25 +260,25 @@ b=[a[3],a[7],a[11]];I(b,-1);a[3]=b[0];a[7]=b[1];a[11]=b[2]}return new THREE.Matr
|
|
|
"");for(d=0;d<a.childNodes.length;d++){var e=a.childNodes[d];if(e.nodeType==1)switch(e.nodeName){case "source":e=(new y).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++)switch(a=c[d],e=b[a.source],a.semantic){case "MORPH_TARGET":this.targets=e.read();break;case "MORPH_WEIGHT":this.weights=e.read()}return this};i.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 u).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=B(f.textContent);this.bindShapeMatrix=ba(f);break;case "source":f=(new y).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 u).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 u).parse(g));break;case "v":c=H(g.textContent);break;case "vcount":d=H(g.textContent)}}for(f=g=0;f<d.length;f++){for(var h=d[f],i=[],j=0;j<h;j++){for(var k={},m=0;m<e.length;m++){var l=e[m],o=c[g+l.offset];switch(l.semantic){case "JOINT":k.joint=o;break;case "WEIGHT":k.weight=b[l.source].data[o]}}i.push(k);g+=e.length}for(j=0;j<i.length;j++)i[j].index=f;this.weights.push(i)}};j.prototype.getChildById=function(a,b){for(var c=0;c<this.nodes.length;c++){var d=
|
|
|
+1)switch(g.nodeName){case "input":e.push((new u).parse(g));break;case "v":c=H(g.textContent);break;case "vcount":d=H(g.textContent)}}for(f=g=0;f<d.length;f++){for(var h=d[f],i=[],j=0;j<h;j++){for(var k={},m=0;m<e.length;m++){var n=e[m],l=c[g+n.offset];switch(n.semantic){case "JOINT":k.joint=l;break;case "WEIGHT":k.weight=b[n.source].data[l]}}i.push(k);g+=e.length}for(j=0;j<i.length;j++)i[j].index=f;this.weights.push(i)}};j.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};j.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};j.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 q).parse(c))}}return this};q.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)return c.info={sid:e,dotSyntax:f,arrSyntax:g,arrIndices:h},c}return null};q.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};q.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};q.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};q.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.controllers=[];this.matrix=new THREE.Matrix4;for(var c=0;c<a.childNodes.length;c++)if(b=a.childNodes[c],b.nodeType==1)switch(b.nodeName){case "node":this.nodes.push((new q).parse(b));break;case "instance_camera":break;case "instance_controller":this.controllers.push((new m).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=P.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",P,M,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new q).parse(b));break;case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new p).parse(b));break;case "extra":break;default:console.log(b.nodeName)}a=[];c=1E6;b=-1E6;for(var d in W)for(var e=W[d],f=0;f<e.channel.length;f++){var g=e.channel[f],h=e.sampler[f];d=g.target.split("/")[0];
|
|
|
+this.type=this.type=="JOINT"?this.type:"NODE";this.nodes=[];this.transforms=[];this.geometries=[];this.controllers=[];this.matrix=new THREE.Matrix4;for(var c=0;c<a.childNodes.length;c++)if(b=a.childNodes[c],b.nodeType==1)switch(b.nodeName){case "node":this.nodes.push((new q).parse(b));break;case "instance_camera":break;case "instance_controller":this.controllers.push((new m).parse(b));break;case "instance_geometry":this.geometries.push((new o).parse(b));break;case "instance_light":break;case "instance_node":b=
|
|
|
+b.getAttribute("url").replace(/^#/,"");(b=P.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",P,M,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new q).parse(b));break;case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new n).parse(b));break;case "extra":break;default:console.log(b.nodeName)}a=[];c=1E6;b=-1E6;for(var d in W)for(var e=W[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++){b=this.channels[c];f=b.fullSid;g=b.member;if(Q.convertUpAxis)switch(g){case "X":switch(U){case "XtoY":case "XtoZ":case "YtoX":g="Y";break;case "ZtoX":g="Z"}break;case "Y":switch(U){case "XtoY":case "YtoX":case "ZtoX":g="X";break;case "XtoZ":case "YtoZ":case "ZtoY":g=
|
|
|
-"Z"}break;case "Z":switch(U){case "XtoZ":g="X";break;case "YtoZ":case "ZtoX":case "ZtoY":g="Y"}}var h=b.sampler,i=h.input,j=this.getTransformBySid(b.sid);if(j){a.indexOf(f)===-1&&a.push(f);b=0;for(var k=i.length;b<k;b++){var l=i[b],o=h.getData(j.type,b),r;r=null;for(var s=0,t=d.length;s<t&&r==null;s++){var u=d[s];if(u.time===l)r=u;else if(u.time>l)break}if(!r){r=new O(l);s=-1;t=0;for(u=d.length;t<u&&s==-1;t++)d[t].time>=l&&(s=t);l=s;d.splice(l==-1?d.length:l,0,r)}r.addTarget(f,j,g,o)}}else console.log('Could not find transform "'+
|
|
|
-b.sid+'" in node '+this.id)}for(c=0;c<a.length;c++){e=a[c];for(b=0;b<d.length;b++)if(r=d[b],!r.hasTarget(e)){h=d;f=r;j=b;g=e;i=void 0;a:{i=j?j-1:0;for(i=i>=0?i:i+h.length;i>=0;i--)if(k=h[i],k.hasTarget(g)){i=k;break a}i=null}k=void 0;a:{for(j+=1;j<h.length;j++)if(k=h[j],k.hasTarget(g))break a;k=null}if(i&&k){h=(f.time-i.time)/(k.time-i.time);i=i.getTarget(g);j=k.getTarget(g).data;k=i.data;o=void 0;if(k.length){o=[];for(l=0;l<k.length;++l)o[l]=k[l]+(j[l]-k[l])*h}else o=k+(j-k)*h;f.addTarget(g,i.transform,
|
|
|
-i.member,o)}}}this.keys=d;this.sids=a}this.updateMatrix();return this};q.prototype.updateMatrix=function(){this.matrix.identity();for(var a=0;a<this.transforms.length;a++)this.transforms[a].apply(this.matrix)};p.prototype.parse=function(a){this.sid=a.getAttribute("sid");this.type=a.nodeName;this.data=B(a.textContent);this.convert();return this};p.prototype.convert=function(){switch(this.type){case "matrix":this.obj=ba(this.data);break;case "rotate":this.angle=this.data[3]*ha;case "translate":I(this.data,
|
|
|
--1);this.obj=new THREE.Vector3(this.data[0],this.data[1],this.data[2]);break;case "scale":I(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)}};p.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)}};p.prototype.update=function(a,
|
|
|
+"Z"}break;case "Z":switch(U){case "XtoZ":g="X";break;case "YtoZ":case "ZtoX":case "ZtoY":g="Y"}}var h=b.sampler,i=h.input,j=this.getTransformBySid(b.sid);if(j){a.indexOf(f)===-1&&a.push(f);b=0;for(var k=i.length;b<k;b++){var l=i[b],p=h.getData(j.type,b),r;r=null;for(var s=0,t=d.length;s<t&&r==null;s++){var u=d[s];if(u.time===l)r=u;else if(u.time>l)break}if(!r){r=new O(l);s=-1;t=0;for(u=d.length;t<u&&s==-1;t++)d[t].time>=l&&(s=t);l=s;d.splice(l==-1?d.length:l,0,r)}r.addTarget(f,j,g,p)}}else console.log('Could not find transform "'+
|
|
|
+b.sid+'" in node '+this.id)}for(c=0;c<a.length;c++){e=a[c];for(b=0;b<d.length;b++)if(r=d[b],!r.hasTarget(e)){h=d;f=r;j=b;g=e;i=void 0;a:{i=j?j-1:0;for(i=i>=0?i:i+h.length;i>=0;i--)if(k=h[i],k.hasTarget(g)){i=k;break a}i=null}k=void 0;a:{for(j+=1;j<h.length;j++)if(k=h[j],k.hasTarget(g))break a;k=null}if(i&&k){h=(f.time-i.time)/(k.time-i.time);i=i.getTarget(g);j=k.getTarget(g).data;k=i.data;p=void 0;if(k.length){p=[];for(l=0;l<k.length;++l)p[l]=k[l]+(j[l]-k[l])*h}else p=k+(j-k)*h;f.addTarget(g,i.transform,
|
|
|
+i.member,p)}}}this.keys=d;this.sids=a}this.updateMatrix();return this};q.prototype.updateMatrix=function(){this.matrix.identity();for(var a=0;a<this.transforms.length;a++)this.transforms[a].apply(this.matrix)};n.prototype.parse=function(a){this.sid=a.getAttribute("sid");this.type=a.nodeName;this.data=B(a.textContent);this.convert();return this};n.prototype.convert=function(){switch(this.type){case "matrix":this.obj=ba(this.data);break;case "rotate":this.angle=this.data[3]*ha;case "translate":I(this.data,
|
|
|
+-1);this.obj=new THREE.Vector3(this.data[0],this.data[1],this.data[2]);break;case "scale":I(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)}};n.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)}};n.prototype.update=function(a,
|
|
|
b){switch(this.type){case "matrix":console.log("Currently not handling matrix transform updates");break;case "translate":case "scale":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":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*ha;break;default:this.obj.x=a[0],this.obj.y=a[1],this.obj.z=a[2],this.angle=a[3]*
|
|
|
ha}}};m.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=P.evaluate(".//dae:instance_material",c,M,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(var d=c.iterateNext();d;)this.instance_material.push((new l).parse(d)),d=c.iterateNext()}}return this};
|
|
|
-l.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=P.evaluate(".//dae:instance_material",c,M,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(b=a.iterateNext();b;)this.instance_material.push((new l).parse(b)),
|
|
|
-b=a.iterateNext();break}}return this};r.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 o(this)).parse(c)}}return this};o.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");Y[d]==void 0&&(Y[d]=(new y(d)).parse(c));break;case "vertices":this.vertices=(new z).parse(c);
|
|
|
+l.prototype.parse=function(a){this.symbol=a.getAttribute("symbol");this.target=a.getAttribute("target").replace(/^#/,"");return this};o.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=P.evaluate(".//dae:instance_material",c,M,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(b=a.iterateNext();b;)this.instance_material.push((new l).parse(b)),
|
|
|
+b=a.iterateNext();break}}return this};r.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 p(this)).parse(c)}}return this};p.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");Y[d]==void 0&&(Y[d]=(new y(d)).parse(c));break;case "vertices":this.vertices=(new z).parse(c);
|
|
|
break;case "triangles":this.primitives.push((new t).parse(c));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new s).parse(c))}}this.geometry3js=new THREE.Geometry;a=Y[this.vertices.input.POSITION.source].data;for(b=0;b<a.length;b+=3)this.geometry3js.vertices.push(new THREE.Vertex(R(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();this.geometry3js.computeVertexNormals();this.geometry3js.computeBoundingBox();return this};o.prototype.handlePrimitive=function(a,b){var c=0,d,e,f=a.p,g=a.inputs,h,i,j,k,m=0,l=3,o=[];for(d=0;d<g.length;d++)switch(h=g[d],h.semantic){case "TEXCOORD":o.push(h.set)}for(;c<f.length;){var n=[],p=[],r={},q=[];a.vcount&&(l=a.vcount[m++]);for(d=0;d<l;d++)for(e=0;e<g.length;e++)switch(h=g[e],k=Y[h.source],i=f[c+d*g.length+h.offset],j=k.accessor.params.length,j*=i,h.semantic){case "VERTEX":n.push(i);
|
|
|
-break;case "NORMAL":p.push(R(k.data,j));break;case "TEXCOORD":r[h.set]===void 0&&(r[h.set]=[]);r[h.set].push(new THREE.UV(k.data[j],1-k.data[j+1]));break;case "COLOR":q.push((new THREE.Color).setRGB(k.data[j],k.data[j+1],k.data[j+2]))}e=null;d=[];if(l===3)d.push(new THREE.Face3(n[0],n[1],n[2],[p[0],p[1],p[2]],q.length?q:new THREE.Color));else if(l===4)d.push(new THREE.Face4(n[0],n[1],n[2],n[3],[p[0],p[1],p[2],p[3]],q.length?q:new THREE.Color));else if(l>4&&Q.subdivideFaces){q=q.length?q:new THREE.Color;
|
|
|
-for(e=1;e<l-1;)d.push(new THREE.Face3(n[0],n[e],n[e+1],[p[0],p[e++],p[e]],q))}if(d.length){n=0;for(p=d.length;n<p;n++){e=d[n];e.daeMaterial=a.material;b.faces.push(e);for(e=0;e<o.length;e++)q=r[o[e]],q=l>4?[q[0],q[n+1],q[n+2]]:l===4?[q[0],q[1],q[2],q[3]]:[q[0],q[1],q[2]],b.faceVertexUvs[e]||(b.faceVertexUvs[e]=[]),b.faceVertexUvs[e].push(q)}}else console.log("dropped face with vcount "+l+" for geometry with id: "+b.id);c+=g.length*l}};s.prototype=new t;s.prototype.constructor=s;t.prototype.setVertices=
|
|
|
+this.geometry3js.computeFaceNormals();this.geometry3js.computeVertexNormals();this.geometry3js.computeBoundingBox();return this};p.prototype.handlePrimitive=function(a,b){var c=0,d,e,f=a.p,g=a.inputs,h,i,j,k,m=0,l=3,n=[];for(d=0;d<g.length;d++)switch(h=g[d],h.semantic){case "TEXCOORD":n.push(h.set)}for(;c<f.length;){var o=[],p=[],r={},q=[];a.vcount&&(l=a.vcount[m++]);for(d=0;d<l;d++)for(e=0;e<g.length;e++)switch(h=g[e],k=Y[h.source],i=f[c+d*g.length+h.offset],j=k.accessor.params.length,j*=i,h.semantic){case "VERTEX":o.push(i);
|
|
|
+break;case "NORMAL":p.push(R(k.data,j));break;case "TEXCOORD":r[h.set]===void 0&&(r[h.set]=[]);r[h.set].push(new THREE.UV(k.data[j],1-k.data[j+1]));break;case "COLOR":q.push((new THREE.Color).setRGB(k.data[j],k.data[j+1],k.data[j+2]))}e=null;d=[];if(l===3)d.push(new THREE.Face3(o[0],o[1],o[2],[p[0],p[1],p[2]],q.length?q:new THREE.Color));else if(l===4)d.push(new THREE.Face4(o[0],o[1],o[2],o[3],[p[0],p[1],p[2],p[3]],q.length?q:new THREE.Color));else if(l>4&&Q.subdivideFaces){q=q.length?q:new THREE.Color;
|
|
|
+for(e=1;e<l-1;)d.push(new THREE.Face3(o[0],o[e],o[e+1],[p[0],p[e++],p[e]],q))}if(d.length){o=0;for(p=d.length;o<p;o++){e=d[o];e.daeMaterial=a.material;b.faces.push(e);for(e=0;e<n.length;e++)q=r[n[e]],q=l>4?[q[0],q[o+1],q[o+2]]:l===4?[q[0],q[1],q[2],q[3]]:[q[0],q[1],q[2]],b.faceVertexUvs[e]||(b.faceVertexUvs[e]=[]),b.faceVertexUvs[e].push(q)}}else console.log("dropped face with vcount "+l+" for geometry with id: "+b.id);c+=g.length*l}};s.prototype=new t;s.prototype.constructor=s;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.inputs=[];this.material=a.getAttribute("material");this.count=L(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 u).parse(a.childNodes[b]));break;case "vcount":this.vcount=H(c.textContent);break;case "p":this.p=H(c.textContent)}}return this};w.prototype.parse=
|
|
|
function(a){this.params=[];this.source=a.getAttribute("source");this.count=L(a,"count",0);this.stride=L(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};z.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 u).parse(a.childNodes[b]);this.input[c.semantic]=
|
|
|
c}return this};u.prototype.parse=function(a){this.semantic=a.getAttribute("semantic");this.source=a.getAttribute("source").replace(/^#/,"");this.set=L(a,"set",-1);this.offset=L(a,"offset",0);if(this.semantic=="TEXCOORD"&&this.set<0)this.set=0;return this};y.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=N(c.textContent).split(/\s+/),e=[],f=0;f<d.length;f++)e.push(d[f]=="true"||d[f]==
|
|
@@ -304,32 +304,32 @@ f.open("GET",b,!0);f.send(null)}else alert("Don't know how to parse XML!")},pars
|
|
|
THREE.JSONLoader.prototype.load=function(a,b,c){if(a instanceof Object)console.warn("DEPRECATED: JSONLoader( parameters ) is now JSONLoader( url, callback, texturePath )."),c=a,a=c.model,b=c.callback,c=c.texture_path;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 g=new XMLHttpRequest,f=0;g.onreadystatechange=function(){if(g.readyState==4)if(g.status==200||g.status==0){try{var h=JSON.parse(g.responseText)}catch(i){console.warn("DEPRECATED: ["+b+"] seems to be using old model format")}a.createModel(h,c,d);a.onLoadComplete()}else console.error("Couldn't load ["+b+"] ["+g.status+"]");else g.readyState==3?e&&(f==0&&(f=g.getResponseHeader("Content-Length")),e({total:f,loaded:g.responseText.length})):
|
|
|
g.readyState==2&&(f=g.getResponseHeader("Content-Length"))};g.open("GET",b,!0);g.overrideMimeType("text/plain; charset=x-user-defined");g.setRequestHeader("Content-Type","text/plain");g.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){if(a.metadata===void 0||a.metadata.formatVersion===void 0||a.metadata.formatVersion!==3)console.error("Deprecated file format.");else{var c,e,i,k,j,q,p,m,l,n,r,o,s,t,w=a.faces;q=a.vertices;var z=a.normals,u=a.colors,y=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&y++;for(c=0;c<y;c++)d.faceUvs[c]=[],d.faceVertexUvs[c]=[];k=0;for(j=q.length;k<
|
|
|
-j;)p=new THREE.Vertex,p.position.x=q[k++]*b,p.position.y=q[k++]*b,p.position.z=q[k++]*b,d.vertices.push(p);k=0;for(j=w.length;k<j;){b=w[k++];q=b&1;i=b&2;c=b&4;e=b&8;m=b&16;p=b&32;n=b&64;b&=128;q?(r=new THREE.Face4,r.a=w[k++],r.b=w[k++],r.c=w[k++],r.d=w[k++],q=4):(r=new THREE.Face3,r.a=w[k++],r.b=w[k++],r.c=w[k++],q=3);if(i)i=w[k++],r.materialIndex=i;i=d.faces.length;if(c)for(c=0;c<y;c++)o=a.uvs[c],l=w[k++],t=o[l*2],l=o[l*2+1],d.faceUvs[c][i]=new THREE.UV(t,l);if(e)for(c=0;c<y;c++){o=a.uvs[c];s=[];
|
|
|
-for(e=0;e<q;e++)l=w[k++],t=o[l*2],l=o[l*2+1],s[e]=new THREE.UV(t,l);d.faceVertexUvs[c][i]=s}if(m)m=w[k++]*3,e=new THREE.Vector3,e.x=z[m++],e.y=z[m++],e.z=z[m],r.normal=e;if(p)for(c=0;c<q;c++)m=w[k++]*3,e=new THREE.Vector3,e.x=z[m++],e.y=z[m++],e.z=z[m],r.vertexNormals.push(e);if(n)p=w[k++],p=new THREE.Color(u[p]),r.color=p;if(b)for(c=0;c<q;c++)p=w[k++],p=new THREE.Color(u[p]),r.vertexColors.push(p);d.faces.push(r)}}})(e);(function(){var b,c,e,i;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b+=
|
|
|
-2)e=a.skinWeights[b],i=a.skinWeights[b+1],d.skinWeights.push(new THREE.Vector4(e,i,0,0))}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<c;b+=2)e=a.skinIndices[b],i=a.skinIndices[b+1],d.skinIndices.push(new THREE.Vector4(e,i,0,0))}d.bones=a.bones;d.animation=a.animation})();(function(b){if(a.morphTargets!==void 0){var c,e,i,k,j,q,p,m,l;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=[];m=d.morphTargets[c].vertices;
|
|
|
-l=a.morphTargets[c].vertices;i=0;for(k=l.length;i<k;i+=3)j=l[i]*b,q=l[i+1]*b,p=l[i+2]*b,m.push(new THREE.Vertex(new THREE.Vector3(j,q,p)))}}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;j=a.morphColors[c].colors;b=0;for(i=j.length;b<i;b+=3)q=new THREE.Color(16755200),q.setRGB(j[b],j[b+1],j[b+2]),k.push(q)}}})(e);d.computeCentroids();d.computeFaceNormals();this.hasNormals(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){if(a.metadata===void 0||a.metadata.formatVersion===void 0||a.metadata.formatVersion!==3)console.error("Deprecated file format.");else{var c,e,i,k,j,q,n,m,l,o,r,p,s,t,w=a.faces;q=a.vertices;var z=a.normals,u=a.colors,y=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&y++;for(c=0;c<y;c++)d.faceUvs[c]=[],d.faceVertexUvs[c]=[];k=0;for(j=q.length;k<
|
|
|
+j;)n=new THREE.Vertex,n.position.x=q[k++]*b,n.position.y=q[k++]*b,n.position.z=q[k++]*b,d.vertices.push(n);k=0;for(j=w.length;k<j;){b=w[k++];q=b&1;i=b&2;c=b&4;e=b&8;m=b&16;n=b&32;o=b&64;b&=128;q?(r=new THREE.Face4,r.a=w[k++],r.b=w[k++],r.c=w[k++],r.d=w[k++],q=4):(r=new THREE.Face3,r.a=w[k++],r.b=w[k++],r.c=w[k++],q=3);if(i)i=w[k++],r.materialIndex=i;i=d.faces.length;if(c)for(c=0;c<y;c++)p=a.uvs[c],l=w[k++],t=p[l*2],l=p[l*2+1],d.faceUvs[c][i]=new THREE.UV(t,l);if(e)for(c=0;c<y;c++){p=a.uvs[c];s=[];
|
|
|
+for(e=0;e<q;e++)l=w[k++],t=p[l*2],l=p[l*2+1],s[e]=new THREE.UV(t,l);d.faceVertexUvs[c][i]=s}if(m)m=w[k++]*3,e=new THREE.Vector3,e.x=z[m++],e.y=z[m++],e.z=z[m],r.normal=e;if(n)for(c=0;c<q;c++)m=w[k++]*3,e=new THREE.Vector3,e.x=z[m++],e.y=z[m++],e.z=z[m],r.vertexNormals.push(e);if(o)n=w[k++],n=new THREE.Color(u[n]),r.color=n;if(b)for(c=0;c<q;c++)n=w[k++],n=new THREE.Color(u[n]),r.vertexColors.push(n);d.faces.push(r)}}})(e);(function(){var b,c,e,i;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b+=
|
|
|
+2)e=a.skinWeights[b],i=a.skinWeights[b+1],d.skinWeights.push(new THREE.Vector4(e,i,0,0))}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<c;b+=2)e=a.skinIndices[b],i=a.skinIndices[b+1],d.skinIndices.push(new THREE.Vector4(e,i,0,0))}d.bones=a.bones;d.animation=a.animation})();(function(b){if(a.morphTargets!==void 0){var c,e,i,k,j,q,n,m,l;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=[];m=d.morphTargets[c].vertices;
|
|
|
+l=a.morphTargets[c].vertices;i=0;for(k=l.length;i<k;i+=3)j=l[i]*b,q=l[i+1]*b,n=l[i+2]*b,m.push(new THREE.Vertex(new THREE.Vector3(j,q,n)))}}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;j=a.morphColors[c].colors;b=0;for(i=j.length;b<i;b+=3)q=new THREE.Color(16755200),q.setRGB(j[b],j[b+1],j[b+2]),k.push(q)}}})(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)try{var e=JSON.parse(d.responseText);e.metadata===void 0||e.metadata.formatVersion===void 0||e.metadata.formatVersion!==3?console.error("Deprecated file format."):c.createScene(e,b,a)}catch(g){console.error(g),console.warn("DEPRECATED: ["+a+"] seems to be using old model format")}else console.error("Couldn't load ["+a+"] ["+d.status+"]")};
|
|
|
d.open("GET",a,!0);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(p in C.objects)if(!B.objects[p])if(o=C.objects[p],o.geometry!==void 0){if(D=B.geometries[o.geometry]){a=!1;for(H=0;H<o.materials.length;H++)F=B.materials[o.materials[H]],a=F instanceof THREE.ShaderMaterial;a&&D.computeTangents();w=o.position;z=o.rotation;u=o.quaternion;y=o.scale;u=0;F.length==0&&(F=new THREE.MeshFaceMaterial);F.length>1&&(F=new THREE.MeshFaceMaterial);
|
|
|
-a=new THREE.Mesh(D,F);a.name=p;a.position.set(w[0],w[1],w[2]);u?(a.quaternion.set(u[0],u[1],u[2],u[3]),a.useQuaternion=!0):a.rotation.set(z[0],z[1],z[2]);a.scale.set(y[0],y[1],y[2]);a.visible=o.visible;B.scene.add(a);B.objects[p]=a;if(o.meshCollider){var b=THREE.CollisionUtils.MeshColliderWBox(a);B.scene.collisions.colliders.push(b)}if(o.castsShadow)b=new THREE.ShadowVolume(D),B.scene.add(b),b.position=a.position,b.rotation=a.rotation,b.scale=a.scale;o.trigger&&o.trigger.toLowerCase()!="none"&&(b=
|
|
|
-{type:o.trigger,object:o},B.triggers[a.name]=b)}}else w=o.position,z=o.rotation,u=o.quaternion,y=o.scale,u=0,a=new THREE.Object3D,a.name=p,a.position.set(w[0],w[1],w[2]),u?(a.quaternion.set(u[0],u[1],u[2],u[3]),a.useQuaternion=!0):a.rotation.set(z[0],z[1],z[2]),a.scale.set(y[0],y[1],y[2]),a.visible=o.visible!==void 0?o.visible:!1,B.scene.add(a),B.objects[p]=a,B.empties[p]=a,o.trigger&&o.trigger.toLowerCase()!="none"&&(b={type:o.trigger,object:o},B.triggers[a.name]=b)}function g(a){return function(b){B.geometries[a]=
|
|
|
-b;e();G-=1;i.onLoadComplete();h()}}function f(a){return function(b){B.geometries[a]=b}}function h(){i.callbackProgress({totalModels:O,totalTextures:M,loadedModels:O-G,loadedTextures:M-J},B);i.onLoadProgress();G==0&&J==0&&b(B)}var i=this,k=THREE.Loader.prototype.extractUrlbase(c),j,q,p,m,l,n,r,o,s,t,w,z,u,y,x,A,D,v,E,F,C,K,G,J,O,M,B;C=a;c=new THREE.BinaryLoader;K=new THREE.JSONLoader;J=G=0;B={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},
|
|
|
-empties:{}};a=!1;for(p in C.objects)if(o=C.objects[p],o.meshCollider){a=!0;break}if(a)B.scene.collisions=new THREE.CollisionSystem;if(C.transform)a=C.transform.position,s=C.transform.rotation,x=C.transform.scale,a&&B.scene.position.set(a[0],a[1],a[2]),s&&B.scene.rotation.set(s[0],s[1],s[2]),x&&B.scene.scale.set(x[0],x[1],x[2]),(a||s||x)&&B.scene.updateMatrix();a=function(){J-=1;h();i.onLoadComplete()};for(l in C.cameras)x=C.cameras[l],x.type=="perspective"?v=new THREE.PerspectiveCamera(x.fov,x.aspect,
|
|
|
+THREE.SceneLoader.prototype.createScene=function(a,b,c){function d(a,b){return b=="relativeToHTML"?a:k+"/"+a}function e(){var a;for(n in C.objects)if(!B.objects[n])if(p=C.objects[n],p.geometry!==void 0){if(D=B.geometries[p.geometry]){a=!1;for(H=0;H<p.materials.length;H++)F=B.materials[p.materials[H]],a=F instanceof THREE.ShaderMaterial;a&&D.computeTangents();w=p.position;z=p.rotation;u=p.quaternion;y=p.scale;u=0;F.length==0&&(F=new THREE.MeshFaceMaterial);F.length>1&&(F=new THREE.MeshFaceMaterial);
|
|
|
+a=new THREE.Mesh(D,F);a.name=n;a.position.set(w[0],w[1],w[2]);u?(a.quaternion.set(u[0],u[1],u[2],u[3]),a.useQuaternion=!0):a.rotation.set(z[0],z[1],z[2]);a.scale.set(y[0],y[1],y[2]);a.visible=p.visible;B.scene.add(a);B.objects[n]=a;if(p.meshCollider){var b=THREE.CollisionUtils.MeshColliderWBox(a);B.scene.collisions.colliders.push(b)}if(p.castsShadow)b=new THREE.ShadowVolume(D),B.scene.add(b),b.position=a.position,b.rotation=a.rotation,b.scale=a.scale;p.trigger&&p.trigger.toLowerCase()!="none"&&(b=
|
|
|
+{type:p.trigger,object:p},B.triggers[a.name]=b)}}else w=p.position,z=p.rotation,u=p.quaternion,y=p.scale,u=0,a=new THREE.Object3D,a.name=n,a.position.set(w[0],w[1],w[2]),u?(a.quaternion.set(u[0],u[1],u[2],u[3]),a.useQuaternion=!0):a.rotation.set(z[0],z[1],z[2]),a.scale.set(y[0],y[1],y[2]),a.visible=p.visible!==void 0?p.visible:!1,B.scene.add(a),B.objects[n]=a,B.empties[n]=a,p.trigger&&p.trigger.toLowerCase()!="none"&&(b={type:p.trigger,object:p},B.triggers[a.name]=b)}function g(a){return function(b){B.geometries[a]=
|
|
|
+b;e();G-=1;i.onLoadComplete();h()}}function f(a){return function(b){B.geometries[a]=b}}function h(){i.callbackProgress({totalModels:O,totalTextures:M,loadedModels:O-G,loadedTextures:M-J},B);i.onLoadProgress();G==0&&J==0&&b(B)}var i=this,k=THREE.Loader.prototype.extractUrlbase(c),j,q,n,m,l,o,r,p,s,t,w,z,u,y,x,A,D,v,E,F,C,K,G,J,O,M,B;C=a;c=new THREE.BinaryLoader;K=new THREE.JSONLoader;J=G=0;B={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},
|
|
|
+empties:{}};a=!1;for(n in C.objects)if(p=C.objects[n],p.meshCollider){a=!0;break}if(a)B.scene.collisions=new THREE.CollisionSystem;if(C.transform)a=C.transform.position,s=C.transform.rotation,x=C.transform.scale,a&&B.scene.position.set(a[0],a[1],a[2]),s&&B.scene.rotation.set(s[0],s[1],s[2]),x&&B.scene.scale.set(x[0],x[1],x[2]),(a||s||x)&&B.scene.updateMatrix();a=function(){J-=1;h();i.onLoadComplete()};for(l in C.cameras)x=C.cameras[l],x.type=="perspective"?v=new THREE.PerspectiveCamera(x.fov,x.aspect,
|
|
|
x.near,x.far):x.type=="ortho"&&(v=new THREE.OrthographicCamera(x.left,x.right,x.top,x.bottom,x.near,x.far)),w=x.position,s=x.target,x=x.up,v.position.set(w[0],w[1],w[2]),v.target=new THREE.Vector3(s[0],s[1],s[2]),x&&v.up.set(x[0],x[1],x[2]),B.cameras[l]=v;for(m in C.lights)s=C.lights[m],l=s.color!==void 0?s.color:16777215,v=s.intensity!==void 0?s.intensity:1,s.type=="directional"?(w=s.direction,t=new THREE.DirectionalLight(l,v),t.position.set(w[0],w[1],w[2]),t.position.normalize()):s.type=="point"?
|
|
|
-(w=s.position,t=s.distance,t=new THREE.PointLight(l,v,t),t.position.set(w[0],w[1],w[2])):s.type=="ambient"&&(t=new THREE.AmbientLight(l)),B.scene.add(t),B.lights[m]=t;for(n in C.fogs)m=C.fogs[n],m.type=="linear"?E=new THREE.Fog(0,m.near,m.far):m.type=="exp2"&&(E=new THREE.FogExp2(0,m.density)),x=m.color,E.color.setRGB(x[0],x[1],x[2]),B.fogs[n]=E;if(B.cameras&&C.defaults.camera)B.currentCamera=B.cameras[C.defaults.camera];if(B.fogs&&C.defaults.fog)B.scene.fog=B.fogs[C.defaults.fog];x=C.defaults.bgcolor;
|
|
|
-B.bgColor=new THREE.Color;B.bgColor.setRGB(x[0],x[1],x[2]);B.bgColorAlpha=C.defaults.bgalpha;for(j in C.geometries)if(n=C.geometries[j],n.type=="bin_mesh"||n.type=="ascii_mesh")G+=1,i.onLoadStart();O=G;for(j in C.geometries)n=C.geometries[j],n.type=="cube"?(D=new THREE.CubeGeometry(n.width,n.height,n.depth,n.segmentsWidth,n.segmentsHeight,n.segmentsDepth,null,n.flipped,n.sides),B.geometries[j]=D):n.type=="plane"?(D=new THREE.PlaneGeometry(n.width,n.height,n.segmentsWidth,n.segmentsHeight),B.geometries[j]=
|
|
|
-D):n.type=="sphere"?(D=new THREE.SphereGeometry(n.radius,n.segmentsWidth,n.segmentsHeight),B.geometries[j]=D):n.type=="cylinder"?(D=new THREE.CylinderGeometry(n.topRad,n.botRad,n.height,n.radSegs,n.heightSegs),B.geometries[j]=D):n.type=="torus"?(D=new THREE.TorusGeometry(n.radius,n.tube,n.segmentsR,n.segmentsT),B.geometries[j]=D):n.type=="icosahedron"?(D=new THREE.IcosahedronGeometry(n.subdivisions),B.geometries[j]=D):n.type=="bin_mesh"?c.load(d(n.url,C.urlBaseType),g(j)):n.type=="ascii_mesh"?K.load(d(n.url,
|
|
|
-C.urlBaseType),g(j)):n.type=="embedded_mesh"&&(n=C.embeds[n.id])&&K.createModel(n,f(j),"");for(r in C.textures)if(j=C.textures[r],j.url instanceof Array){J+=j.url.length;for(n=0;n<j.url.length;n++)i.onLoadStart()}else J+=1,i.onLoadStart();M=J;for(r in C.textures){j=C.textures[r];if(j.mapping!=void 0&&THREE[j.mapping]!=void 0)j.mapping=new THREE[j.mapping];if(j.url instanceof Array){n=[];for(var H=0;H<j.url.length;H++)n[H]=d(j.url[H],C.urlBaseType);n=THREE.ImageUtils.loadTextureCube(n,j.mapping,a)}else{n=
|
|
|
-THREE.ImageUtils.loadTexture(d(j.url,C.urlBaseType),j.mapping,a);if(THREE[j.minFilter]!=void 0)n.minFilter=THREE[j.minFilter];if(THREE[j.magFilter]!=void 0)n.magFilter=THREE[j.magFilter];if(j.repeat){n.repeat.set(j.repeat[0],j.repeat[1]);if(j.repeat[0]!=1)n.wrapS=THREE.RepeatWrapping;if(j.repeat[1]!=1)n.wrapT=THREE.RepeatWrapping}j.offset&&n.offset.set(j.offset[0],j.offset[1]);if(j.wrap){E={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(E[j.wrap[0]]!==void 0)n.wrapS=E[j.wrap[0]];
|
|
|
-if(E[j.wrap[1]]!==void 0)n.wrapT=E[j.wrap[1]]}}B.textures[r]=n}for(q in C.materials){r=C.materials[q];for(A in r.parameters)if(A=="envMap"||A=="map"||A=="lightMap")r.parameters[A]=B.textures[r.parameters[A]];else if(A=="shading")r.parameters[A]=r.parameters[A]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(A=="blending")r.parameters[A]=THREE[r.parameters[A]]?THREE[r.parameters[A]]:THREE.NormalBlending;else if(A=="combine")r.parameters[A]=r.parameters[A]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;
|
|
|
-else if(A=="vertexColors")if(r.parameters[A]=="face")r.parameters[A]=THREE.FaceColors;else if(r.parameters[A])r.parameters[A]=THREE.VertexColors;if(r.parameters.opacity!==void 0&&r.parameters.opacity<1)r.parameters.transparent=!0;if(r.parameters.normalMap){j=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(j.uniforms);n=r.parameters.color;E=r.parameters.specular;c=r.parameters.ambient;K=r.parameters.shininess;a.tNormal.texture=B.textures[r.parameters.normalMap];if(r.parameters.normalMapFactor)a.uNormalScale.value=
|
|
|
-r.parameters.normalMapFactor;if(r.parameters.map)a.tDiffuse.texture=r.parameters.map,a.enableDiffuse.value=!0;if(r.parameters.lightMap)a.tAO.texture=r.parameters.lightMap,a.enableAO.value=!0;if(r.parameters.specularMap)a.tSpecular.texture=B.textures[r.parameters.specularMap],a.enableSpecular.value=!0;a.uDiffuseColor.value.setHex(n);a.uSpecularColor.value.setHex(E);a.uAmbientColor.value.setHex(c);a.uShininess.value=K;if(r.parameters.opacity)a.uOpacity.value=r.parameters.opacity;r=new THREE.ShaderMaterial({fragmentShader:j.fragmentShader,
|
|
|
+(w=s.position,t=s.distance,t=new THREE.PointLight(l,v,t),t.position.set(w[0],w[1],w[2])):s.type=="ambient"&&(t=new THREE.AmbientLight(l)),B.scene.add(t),B.lights[m]=t;for(o in C.fogs)m=C.fogs[o],m.type=="linear"?E=new THREE.Fog(0,m.near,m.far):m.type=="exp2"&&(E=new THREE.FogExp2(0,m.density)),x=m.color,E.color.setRGB(x[0],x[1],x[2]),B.fogs[o]=E;if(B.cameras&&C.defaults.camera)B.currentCamera=B.cameras[C.defaults.camera];if(B.fogs&&C.defaults.fog)B.scene.fog=B.fogs[C.defaults.fog];x=C.defaults.bgcolor;
|
|
|
+B.bgColor=new THREE.Color;B.bgColor.setRGB(x[0],x[1],x[2]);B.bgColorAlpha=C.defaults.bgalpha;for(j in C.geometries)if(o=C.geometries[j],o.type=="bin_mesh"||o.type=="ascii_mesh")G+=1,i.onLoadStart();O=G;for(j in C.geometries)o=C.geometries[j],o.type=="cube"?(D=new THREE.CubeGeometry(o.width,o.height,o.depth,o.segmentsWidth,o.segmentsHeight,o.segmentsDepth,null,o.flipped,o.sides),B.geometries[j]=D):o.type=="plane"?(D=new THREE.PlaneGeometry(o.width,o.height,o.segmentsWidth,o.segmentsHeight),B.geometries[j]=
|
|
|
+D):o.type=="sphere"?(D=new THREE.SphereGeometry(o.radius,o.segmentsWidth,o.segmentsHeight),B.geometries[j]=D):o.type=="cylinder"?(D=new THREE.CylinderGeometry(o.topRad,o.botRad,o.height,o.radSegs,o.heightSegs),B.geometries[j]=D):o.type=="torus"?(D=new THREE.TorusGeometry(o.radius,o.tube,o.segmentsR,o.segmentsT),B.geometries[j]=D):o.type=="icosahedron"?(D=new THREE.IcosahedronGeometry(o.subdivisions),B.geometries[j]=D):o.type=="bin_mesh"?c.load(d(o.url,C.urlBaseType),g(j)):o.type=="ascii_mesh"?K.load(d(o.url,
|
|
|
+C.urlBaseType),g(j)):o.type=="embedded_mesh"&&(o=C.embeds[o.id])&&K.createModel(o,f(j),"");for(r in C.textures)if(j=C.textures[r],j.url instanceof Array){J+=j.url.length;for(o=0;o<j.url.length;o++)i.onLoadStart()}else J+=1,i.onLoadStart();M=J;for(r in C.textures){j=C.textures[r];if(j.mapping!=void 0&&THREE[j.mapping]!=void 0)j.mapping=new THREE[j.mapping];if(j.url instanceof Array){o=[];for(var H=0;H<j.url.length;H++)o[H]=d(j.url[H],C.urlBaseType);o=THREE.ImageUtils.loadTextureCube(o,j.mapping,a)}else{o=
|
|
|
+THREE.ImageUtils.loadTexture(d(j.url,C.urlBaseType),j.mapping,a);if(THREE[j.minFilter]!=void 0)o.minFilter=THREE[j.minFilter];if(THREE[j.magFilter]!=void 0)o.magFilter=THREE[j.magFilter];if(j.repeat){o.repeat.set(j.repeat[0],j.repeat[1]);if(j.repeat[0]!=1)o.wrapS=THREE.RepeatWrapping;if(j.repeat[1]!=1)o.wrapT=THREE.RepeatWrapping}j.offset&&o.offset.set(j.offset[0],j.offset[1]);if(j.wrap){E={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(E[j.wrap[0]]!==void 0)o.wrapS=E[j.wrap[0]];
|
|
|
+if(E[j.wrap[1]]!==void 0)o.wrapT=E[j.wrap[1]]}}B.textures[r]=o}for(q in C.materials){r=C.materials[q];for(A in r.parameters)if(A=="envMap"||A=="map"||A=="lightMap")r.parameters[A]=B.textures[r.parameters[A]];else if(A=="shading")r.parameters[A]=r.parameters[A]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(A=="blending")r.parameters[A]=THREE[r.parameters[A]]?THREE[r.parameters[A]]:THREE.NormalBlending;else if(A=="combine")r.parameters[A]=r.parameters[A]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;
|
|
|
+else if(A=="vertexColors")if(r.parameters[A]=="face")r.parameters[A]=THREE.FaceColors;else if(r.parameters[A])r.parameters[A]=THREE.VertexColors;if(r.parameters.opacity!==void 0&&r.parameters.opacity<1)r.parameters.transparent=!0;if(r.parameters.normalMap){j=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(j.uniforms);o=r.parameters.color;E=r.parameters.specular;c=r.parameters.ambient;K=r.parameters.shininess;a.tNormal.texture=B.textures[r.parameters.normalMap];if(r.parameters.normalMapFactor)a.uNormalScale.value=
|
|
|
+r.parameters.normalMapFactor;if(r.parameters.map)a.tDiffuse.texture=r.parameters.map,a.enableDiffuse.value=!0;if(r.parameters.lightMap)a.tAO.texture=r.parameters.lightMap,a.enableAO.value=!0;if(r.parameters.specularMap)a.tSpecular.texture=B.textures[r.parameters.specularMap],a.enableSpecular.value=!0;a.uDiffuseColor.value.setHex(o);a.uSpecularColor.value.setHex(E);a.uAmbientColor.value.setHex(c);a.uShininess.value=K;if(r.parameters.opacity)a.uOpacity.value=r.parameters.opacity;r=new THREE.ShaderMaterial({fragmentShader:j.fragmentShader,
|
|
|
vertexShader:j.vertexShader,uniforms:a,lights:!0,fog:!0})}else r=new THREE[r.type](r.parameters);B.materials[q]=r}e();i.callbackSync(B);h()};THREE.UTF8Loader=function(){};THREE.UTF8Loader.prototype=new THREE.UTF8Loader;THREE.UTF8Loader.prototype.constructor=THREE.UTF8Loader;
|
|
|
THREE.UTF8Loader.prototype.load=function(a,b,c){if(a instanceof Object)console.warn("DEPRECATED: UTF8Loader( parameters ) is now UTF8Loader( url, callback, metaData )."),c=a,a=c.model,b=c.callback,c={scale:c.scale,offsetX:c.offsetX,offsetY:c.offsetY,offsetZ:c.offsetZ};var d=new XMLHttpRequest,e=c.scale!==void 0?c.scale:1,g=c.offsetX!==void 0?c.offsetX:0,f=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,g,f,h):alert("Couldn't load ["+a+"] ["+d.status+"]"):d.readyState!=3&&d.readyState==2&&d.getResponseHeader("Content-Length")};d.open("GET",a,!0);d.send(null)};THREE.UTF8Loader.prototype.decompressMesh=function(a){var b=a.charCodeAt(0);b>=57344&&(b-=2048);b++;for(var c=new Float32Array(8*b),d=1,e=0;e<8;e++){for(var g=0,f=0;f<b;++f){var h=a.charCodeAt(f+d);g+=h>>1^-(h&1);c[8*f+e]=g}d+=b}b=a.length-d;g=new Uint16Array(b);for(e=f=0;e<b;e++)h=a.charCodeAt(e+d),g[e]=f-h,h==0&&f++;return[c,g]};
|
|
|
-THREE.UTF8Loader.prototype.createModel=function(a,b,c,d,e,g){var f=function(){var b=this;b.materials=[];THREE.Geometry.call(this);var f=THREE.UTF8Loader.prototype.decompressMesh(a),k=[],j=[];(function(a,f,i){for(var j,k,r,o=a.length;i<o;i+=f)j=a[i],k=a[i+1],r=a[i+2],j=j/16383*c,k=k/16383*c,r=r/16383*c,j+=d,k+=e,r+=g,b.vertices.push(new THREE.Vertex(new THREE.Vector3(j,k,r)))})(f[0],8,0);(function(a,b,c){for(var d,e,f=a.length;c<f;c+=b)d=a[c],e=a[c+1],d/=1023,e/=1023,j.push(d,1-e)})(f[0],8,3);(function(a,
|
|
|
+THREE.UTF8Loader.prototype.createModel=function(a,b,c,d,e,g){var f=function(){var b=this;b.materials=[];THREE.Geometry.call(this);var f=THREE.UTF8Loader.prototype.decompressMesh(a),k=[],j=[];(function(a,f,i){for(var j,k,r,p=a.length;i<p;i+=f)j=a[i],k=a[i+1],r=a[i+2],j=j/16383*c,k=k/16383*c,r=r/16383*c,j+=d,k+=e,r+=g,b.vertices.push(new THREE.Vertex(new THREE.Vector3(j,k,r)))})(f[0],8,0);(function(a,b,c){for(var d,e,f=a.length;c<f;c+=b)d=a[c],e=a[c+1],d/=1023,e/=1023,j.push(d,1-e)})(f[0],8,3);(function(a,
|
|
|
b,c){for(var d,e,f,g=a.length;c<g;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)})(f[0],8,5);(function(a){var c,d,e,f,g,i,s,t,w,z=a.length;for(c=0;c<z;c+=3){d=a[c];e=a[c+1];f=a[c+2];g=b;t=d;w=e;i=f;s=d;var u=e,y=f,x=k[u*3],A=k[u*3+1],u=k[u*3+2],D=k[y*3],v=k[y*3+1],y=k[y*3+2];s=new THREE.Vector3(k[s*3],k[s*3+1],k[s*3+2]);u=new THREE.Vector3(x,A,u);y=new THREE.Vector3(D,v,y);g.faces.push(new THREE.Face3(t,w,i,[s,u,y],null,0));g=j[d*2];d=j[d*2+1];i=j[e*2];s=j[e*
|
|
|
2+1];t=j[f*2];w=j[f*2+1];f=b.faceVertexUvs[0];e=i;i=s;s=[];s.push(new THREE.UV(g,d));s.push(new THREE.UV(e,i));s.push(new THREE.UV(t,w));f.push(s)}})(f[1]);this.computeCentroids();this.computeFaceNormals()};f.prototype=new THREE.Geometry;f.prototype.constructor=f;b(new f)};
|
|
|
THREE.Axes=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=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);
|
|
@@ -337,16 +337,16 @@ c=new THREE.Mesh(b,new THREE.MeshBasicMaterial({color:65280}));c.position.y=100;
|
|
|
THREE.MarchingCubes=function(a,b){THREE.Object3D.call(this);this.material=b;this.init=function(a){this.resolution=a;this.isolation=80;this.size=a;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(this.size3*3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=!0;this.maxCount=4096;this.count=0;this.hasNormal=
|
|
|
this.hasPos=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(a,b,e){return a+(b-a)*e};this.VIntX=function(a,b,e,g,f,h,i,k,j,q){f=(f-j)/(q-j);j=this.normal_cache;b[g]=h+f*this.delta;b[g+1]=i;b[g+2]=k;e[g]=this.lerp(j[a],j[a+3],f);e[g+1]=this.lerp(j[a+1],j[a+4],f);e[g+2]=this.lerp(j[a+2],j[a+5],f)};this.VIntY=function(a,b,e,g,f,h,i,k,j,q){f=(f-j)/(q-j);j=this.normal_cache;b[g]=h;b[g+1]=i+f*this.delta;b[g+2]=k;b=a+this.yd*
|
|
|
3;e[g]=this.lerp(j[a],j[b],f);e[g+1]=this.lerp(j[a+1],j[b+1],f);e[g+2]=this.lerp(j[a+2],j[b+2],f)};this.VIntZ=function(a,b,e,g,f,h,i,k,j,q){f=(f-j)/(q-j);j=this.normal_cache;b[g]=h;b[g+1]=i;b[g+2]=k+f*this.delta;b=a+this.zd*3;e[g]=this.lerp(j[a],j[b],f);e[g+1]=this.lerp(j[a+1],j[b+1],f);e[g+2]=this.lerp(j[a+2],j[b+2],f)};this.compNorm=function(a){var b=a*3;this.normal_cache[b]===0&&(this.normal_cache[b]=this.field[a-1]-this.field[a+1],this.normal_cache[b+1]=this.field[a-this.yd]-this.field[a+this.yd],
|
|
|
-this.normal_cache[b+2]=this.field[a-this.zd]-this.field[a+this.zd])};this.polygonize=function(a,b,e,g,f,h){var i=g+1,k=g+this.yd,j=g+this.zd,q=i+this.yd,p=i+this.zd,m=g+this.yd+this.zd,l=i+this.yd+this.zd,n=0,r=this.field[g],o=this.field[i],s=this.field[k],t=this.field[q],w=this.field[j],z=this.field[p],u=this.field[m],y=this.field[l];r<f&&(n|=1);o<f&&(n|=2);s<f&&(n|=8);t<f&&(n|=4);w<f&&(n|=16);z<f&&(n|=32);u<f&&(n|=128);y<f&&(n|=64);var x=THREE.edgeTable[n];if(x===0)return 0;var A=this.delta,D=a+
|
|
|
-A,v=b+A,A=e+A;x&1&&(this.compNorm(g),this.compNorm(i),this.VIntX(g*3,this.vlist,this.nlist,0,f,a,b,e,r,o));x&2&&(this.compNorm(i),this.compNorm(q),this.VIntY(i*3,this.vlist,this.nlist,3,f,D,b,e,o,t));x&4&&(this.compNorm(k),this.compNorm(q),this.VIntX(k*3,this.vlist,this.nlist,6,f,a,v,e,s,t));x&8&&(this.compNorm(g),this.compNorm(k),this.VIntY(g*3,this.vlist,this.nlist,9,f,a,b,e,r,s));x&16&&(this.compNorm(j),this.compNorm(p),this.VIntX(j*3,this.vlist,this.nlist,12,f,a,b,A,w,z));x&32&&(this.compNorm(p),
|
|
|
-this.compNorm(l),this.VIntY(p*3,this.vlist,this.nlist,15,f,D,b,A,z,y));x&64&&(this.compNorm(m),this.compNorm(l),this.VIntX(m*3,this.vlist,this.nlist,18,f,a,v,A,u,y));x&128&&(this.compNorm(j),this.compNorm(m),this.VIntY(j*3,this.vlist,this.nlist,21,f,a,b,A,w,u));x&256&&(this.compNorm(g),this.compNorm(j),this.VIntZ(g*3,this.vlist,this.nlist,24,f,a,b,e,r,w));x&512&&(this.compNorm(i),this.compNorm(p),this.VIntZ(i*3,this.vlist,this.nlist,27,f,D,b,e,o,z));x&1024&&(this.compNorm(q),this.compNorm(l),this.VIntZ(q*
|
|
|
-3,this.vlist,this.nlist,30,f,D,v,e,t,y));x&2048&&(this.compNorm(k),this.compNorm(m),this.VIntZ(k*3,this.vlist,this.nlist,33,f,a,v,e,s,u));n<<=4;for(f=g=0;THREE.triTable[n+f]!=-1;)a=n+f,b=a+1,e=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[b],3*THREE.triTable[e],h),f+=3,g++;return g};this.posnormtriv=function(a,b,e,g,f,h){var i=this.count*3;this.positionArray[i]=a[e];this.positionArray[i+1]=a[e+1];this.positionArray[i+2]=a[e+2];this.positionArray[i+3]=a[g];this.positionArray[i+
|
|
|
+this.normal_cache[b+2]=this.field[a-this.zd]-this.field[a+this.zd])};this.polygonize=function(a,b,e,g,f,h){var i=g+1,k=g+this.yd,j=g+this.zd,q=i+this.yd,n=i+this.zd,m=g+this.yd+this.zd,l=i+this.yd+this.zd,o=0,r=this.field[g],p=this.field[i],s=this.field[k],t=this.field[q],w=this.field[j],z=this.field[n],u=this.field[m],y=this.field[l];r<f&&(o|=1);p<f&&(o|=2);s<f&&(o|=8);t<f&&(o|=4);w<f&&(o|=16);z<f&&(o|=32);u<f&&(o|=128);y<f&&(o|=64);var x=THREE.edgeTable[o];if(x===0)return 0;var A=this.delta,D=a+
|
|
|
+A,v=b+A,A=e+A;x&1&&(this.compNorm(g),this.compNorm(i),this.VIntX(g*3,this.vlist,this.nlist,0,f,a,b,e,r,p));x&2&&(this.compNorm(i),this.compNorm(q),this.VIntY(i*3,this.vlist,this.nlist,3,f,D,b,e,p,t));x&4&&(this.compNorm(k),this.compNorm(q),this.VIntX(k*3,this.vlist,this.nlist,6,f,a,v,e,s,t));x&8&&(this.compNorm(g),this.compNorm(k),this.VIntY(g*3,this.vlist,this.nlist,9,f,a,b,e,r,s));x&16&&(this.compNorm(j),this.compNorm(n),this.VIntX(j*3,this.vlist,this.nlist,12,f,a,b,A,w,z));x&32&&(this.compNorm(n),
|
|
|
+this.compNorm(l),this.VIntY(n*3,this.vlist,this.nlist,15,f,D,b,A,z,y));x&64&&(this.compNorm(m),this.compNorm(l),this.VIntX(m*3,this.vlist,this.nlist,18,f,a,v,A,u,y));x&128&&(this.compNorm(j),this.compNorm(m),this.VIntY(j*3,this.vlist,this.nlist,21,f,a,b,A,w,u));x&256&&(this.compNorm(g),this.compNorm(j),this.VIntZ(g*3,this.vlist,this.nlist,24,f,a,b,e,r,w));x&512&&(this.compNorm(i),this.compNorm(n),this.VIntZ(i*3,this.vlist,this.nlist,27,f,D,b,e,p,z));x&1024&&(this.compNorm(q),this.compNorm(l),this.VIntZ(q*
|
|
|
+3,this.vlist,this.nlist,30,f,D,v,e,t,y));x&2048&&(this.compNorm(k),this.compNorm(m),this.VIntZ(k*3,this.vlist,this.nlist,33,f,a,v,e,s,u));o<<=4;for(f=g=0;THREE.triTable[o+f]!=-1;)a=o+f,b=a+1,e=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[b],3*THREE.triTable[e],h),f+=3,g++;return g};this.posnormtriv=function(a,b,e,g,f,h){var i=this.count*3;this.positionArray[i]=a[e];this.positionArray[i+1]=a[e+1];this.positionArray[i+2]=a[e+2];this.positionArray[i+3]=a[g];this.positionArray[i+
|
|
|
4]=a[g+1];this.positionArray[i+5]=a[g+2];this.positionArray[i+6]=a[f];this.positionArray[i+7]=a[f+1];this.positionArray[i+8]=a[f+2];this.normalArray[i]=b[e];this.normalArray[i+1]=b[e+1];this.normalArray[i+2]=b[e+2];this.normalArray[i+3]=b[g];this.normalArray[i+4]=b[g+1];this.normalArray[i+5]=b[g+2];this.normalArray[i+6]=b[f];this.normalArray[i+7]=b[f+1];this.normalArray[i+8]=b[f+2];this.hasNormal=this.hasPos=!0;this.count+=3;this.count>=this.maxCount-3&&h(this)};this.begin=function(){this.count=0;
|
|
|
-this.hasNormal=this.hasPos=!1};this.end=function(a){if(this.count!==0){for(var b=this.count*3;b<this.positionArray.length;b++)this.positionArray[b]=0;a(this)}};this.addBall=function(a,b,e,g,f){var h=this.size*Math.sqrt(g/f),i=e*this.size,k=b*this.size,j=a*this.size,q=Math.floor(i-h);q<1&&(q=1);i=Math.floor(i+h);i>this.size-1&&(i=this.size-1);var p=Math.floor(k-h);p<1&&(p=1);k=Math.floor(k+h);k>this.size-1&&(k=this.size-1);var m=Math.floor(j-h);m<1&&(m=1);h=Math.floor(j+h);h>this.size-1&&(h=this.size-
|
|
|
-1);for(var l,n,r,o,s,t;q<i;q++){j=this.size2*q;n=q/this.size-e;s=n*n;for(n=p;n<k;n++){r=j+this.size*n;l=n/this.size-b;t=l*l;for(l=m;l<h;l++)o=l/this.size-a,o=g/(1.0E-6+o*o+t+s)-f,o>0&&(this.field[r+l]+=o)}}};this.addPlaneX=function(a,b){var e,g,f,h,i,k=this.size,j=this.yd,q=this.zd,p=this.field,m=k*Math.sqrt(a/b);m>k&&(m=k);for(e=0;e<m;e++)if(g=e/k,g*=g,h=a/(1.0E-4+g)-b,h>0)for(g=0;g<k;g++){i=e+g*j;for(f=0;f<k;f++)p[q*f+i]+=h}};this.addPlaneY=function(a,b){var e,g,f,h,i,k,j=this.size,q=this.yd,p=
|
|
|
-this.zd,m=this.field,l=j*Math.sqrt(a/b);l>j&&(l=j);for(g=0;g<l;g++)if(e=g/j,e*=e,h=a/(1.0E-4+e)-b,h>0){i=g*q;for(e=0;e<j;e++){k=i+e;for(f=0;f<j;f++)m[p*f+k]+=h}}};this.addPlaneZ=function(a,b){var e,g,f,h,i,k,j=this.size,q=this.yd,p=this.zd,m=this.field,l=j*Math.sqrt(a/b);l>j&&(l=j);for(f=0;f<l;f++)if(e=f/j,e*=e,h=a/(1.0E-4+e)-b,h>0){i=p*f;for(g=0;g<j;g++){k=i+g*q;for(e=0;e<j;e++)m[k+e]+=h}}};this.reset=function(){var a;for(a=0;a<this.size3;a++)this.normal_cache[a*3]=0,this.field[a]=0};this.render=
|
|
|
-function(a){this.begin();var b,e,g,f,h,i,k,j,q,p=this.size-2;for(f=1;f<p;f++){q=this.size2*f;k=(f-this.halfsize)/this.halfsize;for(g=1;g<p;g++){j=q+this.size*g;i=(g-this.halfsize)/this.halfsize;for(e=1;e<p;e++)h=(e-this.halfsize)/this.halfsize,b=j+e,this.polygonize(h,i,k,b,this.isolation,a)}}this.end(a)};this.generateGeometry=function(){var a=0,b=new THREE.Geometry,e=[];this.render(function(g){var f,h,i,k,j,q,p,m;for(f=0;f<g.count;f++)p=f*3,j=p+1,m=p+2,h=g.positionArray[p],i=g.positionArray[j],k=
|
|
|
-g.positionArray[m],q=new THREE.Vector3(h,i,k),h=g.normalArray[p],i=g.normalArray[j],k=g.normalArray[m],p=new THREE.Vector3(h,i,k),p.normalize(),j=new THREE.Vertex(q),b.vertices.push(j),e.push(p);q=g.count/3;for(f=0;f<q;f++)p=(a+f)*3,j=p+1,m=p+2,h=e[p],i=e[j],k=e[m],p=new THREE.Face3(p,j,m,[h,i,k]),b.faces.push(p);a+=q;g.count=0});return b};this.init(a)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
|
|
|
+this.hasNormal=this.hasPos=!1};this.end=function(a){if(this.count!==0){for(var b=this.count*3;b<this.positionArray.length;b++)this.positionArray[b]=0;a(this)}};this.addBall=function(a,b,e,g,f){var h=this.size*Math.sqrt(g/f),i=e*this.size,k=b*this.size,j=a*this.size,q=Math.floor(i-h);q<1&&(q=1);i=Math.floor(i+h);i>this.size-1&&(i=this.size-1);var n=Math.floor(k-h);n<1&&(n=1);k=Math.floor(k+h);k>this.size-1&&(k=this.size-1);var m=Math.floor(j-h);m<1&&(m=1);h=Math.floor(j+h);h>this.size-1&&(h=this.size-
|
|
|
+1);for(var l,o,r,p,s,t;q<i;q++){j=this.size2*q;o=q/this.size-e;s=o*o;for(o=n;o<k;o++){r=j+this.size*o;l=o/this.size-b;t=l*l;for(l=m;l<h;l++)p=l/this.size-a,p=g/(1.0E-6+p*p+t+s)-f,p>0&&(this.field[r+l]+=p)}}};this.addPlaneX=function(a,b){var e,g,f,h,i,k=this.size,j=this.yd,q=this.zd,n=this.field,m=k*Math.sqrt(a/b);m>k&&(m=k);for(e=0;e<m;e++)if(g=e/k,g*=g,h=a/(1.0E-4+g)-b,h>0)for(g=0;g<k;g++){i=e+g*j;for(f=0;f<k;f++)n[q*f+i]+=h}};this.addPlaneY=function(a,b){var e,g,f,h,i,k,j=this.size,q=this.yd,n=
|
|
|
+this.zd,m=this.field,l=j*Math.sqrt(a/b);l>j&&(l=j);for(g=0;g<l;g++)if(e=g/j,e*=e,h=a/(1.0E-4+e)-b,h>0){i=g*q;for(e=0;e<j;e++){k=i+e;for(f=0;f<j;f++)m[n*f+k]+=h}}};this.addPlaneZ=function(a,b){var e,g,f,h,i,k,j=this.size,q=this.yd,n=this.zd,m=this.field,l=j*Math.sqrt(a/b);l>j&&(l=j);for(f=0;f<l;f++)if(e=f/j,e*=e,h=a/(1.0E-4+e)-b,h>0){i=n*f;for(g=0;g<j;g++){k=i+g*q;for(e=0;e<j;e++)m[k+e]+=h}}};this.reset=function(){var a;for(a=0;a<this.size3;a++)this.normal_cache[a*3]=0,this.field[a]=0};this.render=
|
|
|
+function(a){this.begin();var b,e,g,f,h,i,k,j,q,n=this.size-2;for(f=1;f<n;f++){q=this.size2*f;k=(f-this.halfsize)/this.halfsize;for(g=1;g<n;g++){j=q+this.size*g;i=(g-this.halfsize)/this.halfsize;for(e=1;e<n;e++)h=(e-this.halfsize)/this.halfsize,b=j+e,this.polygonize(h,i,k,b,this.isolation,a)}}this.end(a)};this.generateGeometry=function(){var a=0,b=new THREE.Geometry,e=[];this.render(function(g){var f,h,i,k,j,q,n,m;for(f=0;f<g.count;f++)n=f*3,j=n+1,m=n+2,h=g.positionArray[n],i=g.positionArray[j],k=
|
|
|
+g.positionArray[m],q=new THREE.Vector3(h,i,k),h=g.normalArray[n],i=g.normalArray[j],k=g.normalArray[m],n=new THREE.Vector3(h,i,k),n.normalize(),j=new THREE.Vertex(q),b.vertices.push(j),e.push(n);q=g.count/3;for(f=0;f<q;f++)n=(a+f)*3,j=n+1,m=n+2,h=e[n],i=e[j],k=e[m],n=new THREE.Face3(n,j,m,[h,i,k]),b.faces.push(n);a+=q;g.count=0});return b};this.init(a)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
|
|
|
THREE.edgeTable=new Int32Array([0,265,515,778,1030,1295,1541,1804,2060,2309,2575,2822,3082,3331,3593,3840,400,153,915,666,1430,1183,1941,1692,2460,2197,2975,2710,3482,3219,3993,3728,560,825,51,314,1590,1855,1077,1340,2620,2869,2111,2358,3642,3891,3129,3376,928,681,419,170,1958,1711,1445,1196,2988,2725,2479,2214,4010,3747,3497,3232,1120,1385,1635,1898,102,367,613,876,3180,3429,3695,3942,2154,2403,2665,2912,1520,1273,2035,1786,502,255,1013,764,3580,3317,4095,3830,2554,2291,3065,2800,1616,1881,1107,
|
|
|
1370,598,863,85,348,3676,3925,3167,3414,2650,2899,2137,2384,1984,1737,1475,1226,966,719,453,204,4044,3781,3535,3270,3018,2755,2505,2240,2240,2505,2755,3018,3270,3535,3781,4044,204,453,719,966,1226,1475,1737,1984,2384,2137,2899,2650,3414,3167,3925,3676,348,85,863,598,1370,1107,1881,1616,2800,3065,2291,2554,3830,4095,3317,3580,764,1013,255,502,1786,2035,1273,1520,2912,2665,2403,2154,3942,3695,3429,3180,876,613,367,102,1898,1635,1385,1120,3232,3497,3747,4010,2214,2479,2725,2988,1196,1445,1711,1958,170,
|
|
|
419,681,928,3376,3129,3891,3642,2358,2111,2869,2620,1340,1077,1855,1590,314,51,825,560,3728,3993,3219,3482,2710,2975,2197,2460,1692,1941,1183,1430,666,915,153,400,3840,3593,3331,3082,2822,2575,2309,2060,1804,1541,1295,1030,778,515,265,0]);
|
|
@@ -378,29 +378,29 @@ d.vertices[e++]=1;d.vertices[e++]=-1;d.vertices[e++]=1;d.vertices[e++]=0;d.verti
|
|
|
d.elementBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,d.faces,b.STATIC_DRAW);d.tempTexture=b.createTexture();d.occlusionTexture=b.createTexture();b.bindTexture(b.TEXTURE_2D,d.tempTexture);b.texImage2D(b.TEXTURE_2D,0,b.RGB,16,16,0,b.RGB,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);
|
|
|
b.bindTexture(b.TEXTURE_2D,d.occlusionTexture);b.texImage2D(b.TEXTURE_2D,0,b.RGBA,16,16,0,b.RGBA,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)<=0?(d.hasVertexTexture=!1,d.program=a(THREE.ShaderFlares.lensFlare)):(d.hasVertexTexture=
|
|
|
!0,d.program=a(THREE.ShaderFlares.lensFlareVertexTexture));d.attributes={};d.uniforms={};d.attributes.vertex=b.getAttribLocation(d.program,"position");d.attributes.uv=b.getAttribLocation(d.program,"uv");d.uniforms.renderType=b.getUniformLocation(d.program,"renderType");d.uniforms.map=b.getUniformLocation(d.program,"map");d.uniforms.occlusionMap=b.getUniformLocation(d.program,"occlusionMap");d.uniforms.opacity=b.getUniformLocation(d.program,"opacity");d.uniforms.color=b.getUniformLocation(d.program,
|
|
|
-"color");d.uniforms.scale=b.getUniformLocation(d.program,"scale");d.uniforms.rotation=b.getUniformLocation(d.program,"rotation");d.uniforms.screenPosition=b.getUniformLocation(d.program,"screenPosition");d.attributesEnabled=!1};this.render=function(a,g,f,h){var a=a.__webglFlares,i=a.length;if(i){var k=new THREE.Vector3,j=h/f,q=f*0.5,p=h*0.5,m=16/h,l=new THREE.Vector2(m*j,m),n=new THREE.Vector3(1,1,0),r=new THREE.Vector2(1,1),o=d.uniforms,m=d.attributes;b.useProgram(d.program);if(!d.attributesEnabled)b.enableVertexAttribArray(d.attributes.vertex),
|
|
|
-b.enableVertexAttribArray(d.attributes.uv),d.attributesEnabled=!0;b.uniform1i(o.occlusionMap,0);b.uniform1i(o.map,1);b.bindBuffer(b.ARRAY_BUFFER,d.vertexBuffer);b.vertexAttribPointer(m.vertex,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(m.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,d.elementBuffer);b.disable(b.CULL_FACE);b.depthMask(!1);var s,t,w,z,u;for(s=0;s<i;s++)if(m=16/h,l.set(m*j,m),z=a[s],k.set(z.matrixWorld.n14,z.matrixWorld.n24,z.matrixWorld.n34),g.matrixWorldInverse.multiplyVector3(k),
|
|
|
-g.projectionMatrix.multiplyVector3(k),n.copy(k),r.x=n.x*q+q,r.y=n.y*p+p,d.hasVertexTexture||r.x>0&&r.x<f&&r.y>0&&r.y<h){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,d.tempTexture);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,r.x-8,r.y-8,16,16,0);b.uniform1i(o.renderType,0);b.uniform2f(o.scale,l.x,l.y);b.uniform3f(o.screenPosition,n.x,n.y,n.z);b.disable(b.BLEND);b.enable(b.DEPTH_TEST);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);b.activeTexture(b.TEXTURE0);b.bindTexture(b.TEXTURE_2D,d.occlusionTexture);
|
|
|
-b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,r.x-8,r.y-8,16,16,0);b.uniform1i(o.renderType,1);b.disable(b.DEPTH_TEST);b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,d.tempTexture);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);z.positionScreen.copy(n);z.customUpdateCallback?z.customUpdateCallback(z):z.updateLensFlares();b.uniform1i(o.renderType,2);b.enable(b.BLEND);t=0;for(w=z.lensFlares.length;t<w;t++)if(u=z.lensFlares[t],u.opacity>0.0010&&u.scale>0.0010)n.x=u.x,n.y=u.y,n.z=u.z,m=u.size*u.scale/
|
|
|
-h,l.x=m*j,l.y=m,b.uniform3f(o.screenPosition,n.x,n.y,n.z),b.uniform2f(o.scale,l.x,l.y),b.uniform1f(o.rotation,u.rotation),b.uniform1f(o.opacity,u.opacity),b.uniform3f(o.color,u.color.r,u.color.g,u.color.b),c.setBlending(u.blending),c.setTexture(u.texture,1),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0)}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(!0)}}};
|
|
|
+"color");d.uniforms.scale=b.getUniformLocation(d.program,"scale");d.uniforms.rotation=b.getUniformLocation(d.program,"rotation");d.uniforms.screenPosition=b.getUniformLocation(d.program,"screenPosition");d.attributesEnabled=!1};this.render=function(a,g,f,h){var a=a.__webglFlares,i=a.length;if(i){var k=new THREE.Vector3,j=h/f,q=f*0.5,n=h*0.5,m=16/h,l=new THREE.Vector2(m*j,m),o=new THREE.Vector3(1,1,0),r=new THREE.Vector2(1,1),p=d.uniforms,m=d.attributes;b.useProgram(d.program);if(!d.attributesEnabled)b.enableVertexAttribArray(d.attributes.vertex),
|
|
|
+b.enableVertexAttribArray(d.attributes.uv),d.attributesEnabled=!0;b.uniform1i(p.occlusionMap,0);b.uniform1i(p.map,1);b.bindBuffer(b.ARRAY_BUFFER,d.vertexBuffer);b.vertexAttribPointer(m.vertex,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(m.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,d.elementBuffer);b.disable(b.CULL_FACE);b.depthMask(!1);var s,t,w,z,u;for(s=0;s<i;s++)if(m=16/h,l.set(m*j,m),z=a[s],k.set(z.matrixWorld.n14,z.matrixWorld.n24,z.matrixWorld.n34),g.matrixWorldInverse.multiplyVector3(k),
|
|
|
+g.projectionMatrix.multiplyVector3(k),o.copy(k),r.x=o.x*q+q,r.y=o.y*n+n,d.hasVertexTexture||r.x>0&&r.x<f&&r.y>0&&r.y<h){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,d.tempTexture);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,r.x-8,r.y-8,16,16,0);b.uniform1i(p.renderType,0);b.uniform2f(p.scale,l.x,l.y);b.uniform3f(p.screenPosition,o.x,o.y,o.z);b.disable(b.BLEND);b.enable(b.DEPTH_TEST);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);b.activeTexture(b.TEXTURE0);b.bindTexture(b.TEXTURE_2D,d.occlusionTexture);
|
|
|
+b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,r.x-8,r.y-8,16,16,0);b.uniform1i(p.renderType,1);b.disable(b.DEPTH_TEST);b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,d.tempTexture);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);z.positionScreen.copy(o);z.customUpdateCallback?z.customUpdateCallback(z):z.updateLensFlares();b.uniform1i(p.renderType,2);b.enable(b.BLEND);t=0;for(w=z.lensFlares.length;t<w;t++)if(u=z.lensFlares[t],u.opacity>0.0010&&u.scale>0.0010)o.x=u.x,o.y=u.y,o.z=u.z,m=u.size*u.scale/
|
|
|
+h,l.x=m*j,l.y=m,b.uniform3f(p.screenPosition,o.x,o.y,o.z),b.uniform2f(p.scale,l.x,l.y),b.uniform1f(p.rotation,u.rotation),b.uniform1f(p.opacity,u.opacity),b.uniform3f(p.color,u.color.r,u.color.g,u.color.b),c.setBlending(u.blending),c.setTexture(u.texture,1),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0)}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(!0)}}};
|
|
|
THREE.ShadowMapPlugin=function(){var a,b,c,d,e,g=new THREE.Frustum,f=new THREE.Matrix4;this.shadowMatrix=[];this.shadowMap=[];this.init=function(e){a=e.context;b=e;var e=THREE.ShaderLib.depthRGBA,f=THREE.UniformsUtils.clone(e.uniforms);c=new THREE.ShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:f});d=new THREE.ShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:f,morphTargets:!0});c._shadowPass=!0;d._shadowPass=!0};this.render=
|
|
|
-function(a,c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(h){var i,k,j,q,p,m,l,n,r=0,o=h.lights;e||(e=new THREE.PerspectiveCamera(b.shadowCameraFov,b.shadowMapWidth/b.shadowMapHeight,b.shadowCameraNear,b.shadowCameraFar));i=0;for(k=o.length;i<k;i++)if(l=o[i],l.castShadow&&l instanceof THREE.SpotLight){this.shadowMap[r]||(this.shadowMap[r]=new THREE.WebGLRenderTarget(b.shadowMapWidth,b.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,
|
|
|
+function(a,c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(h){var i,k,j,q,n,m,l,o,r=0,p=h.lights;e||(e=new THREE.PerspectiveCamera(b.shadowCameraFov,b.shadowMapWidth/b.shadowMapHeight,b.shadowCameraNear,b.shadowCameraFar));i=0;for(k=p.length;i<k;i++)if(l=p[i],l.castShadow&&l instanceof THREE.SpotLight){this.shadowMap[r]||(this.shadowMap[r]=new THREE.WebGLRenderTarget(b.shadowMapWidth,b.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,
|
|
|
format:THREE.RGBAFormat}),this.shadowMatrix[r]=new THREE.Matrix4);j=this.shadowMap[r];q=this.shadowMatrix[r];e.position.copy(l.position);e.lookAt(l.target.position);e.parent==null&&(console.warn("Camera is not on the Scene. Adding it..."),h.add(e),b.autoUpdateScene&&h.updateMatrixWorld());e.matrixWorldInverse.getInverse(e.matrixWorld);q.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);q.multiplySelf(e.projectionMatrix);q.multiplySelf(e.matrixWorldInverse);if(!e._viewMatrixArray)e._viewMatrixArray=
|
|
|
-new Float32Array(16);e.matrixWorldInverse.flattenToArray(e._viewMatrixArray);if(!e._projectionMatrixArray)e._projectionMatrixArray=new Float32Array(16);e.projectionMatrix.flattenToArray(e._projectionMatrixArray);f.multiply(e.projectionMatrix,e.matrixWorldInverse);g.setFromMatrix(f);b.setRenderTarget(j);a.clearColor(1,0,1,1);b.clear();j=b.getClearColor();q=b.getClearAlpha();a.clearColor(j.r,j.g,j.b,q);n=h.__webglObjects;j=0;for(q=n.length;j<q;j++)if(p=n[j],l=p.object,p.render=!1,l.visible&&l.castShadow&&
|
|
|
-(!(l instanceof THREE.Mesh)||!l.frustumCulled||g.contains(l)))l.matrixWorld.flattenToArray(l._objectMatrixArray),l._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,l.matrixWorld,l._modelViewMatrixArray),p.render=!0;b.setDepthTest(!0);b.setBlending(THREE.NormalBlending);j=0;for(q=n.length;j<q;j++)if(p=n[j],p.render)l=p.object,p=p.buffer,b.setObjectFaces(l),m=l.customDepthMaterial?l.customDepthMaterial:l.geometry.morphTargets.length?d:c,b.renderBuffer(e,o,null,m,p,l);n=h.__webglObjectsImmediate;
|
|
|
-j=0;for(q=n.length;j<q;j++)p=n[j],l=p.object,l.visible&&l.castShadow&&(l.matrixAutoUpdate&&l.matrixWorld.flattenToArray(l._objectMatrixArray),l._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,l.matrixWorld,l._modelViewMatrixArray),b.renderImmediateObject(e,o,null,c,l));r++}}};
|
|
|
+new Float32Array(16);e.matrixWorldInverse.flattenToArray(e._viewMatrixArray);if(!e._projectionMatrixArray)e._projectionMatrixArray=new Float32Array(16);e.projectionMatrix.flattenToArray(e._projectionMatrixArray);f.multiply(e.projectionMatrix,e.matrixWorldInverse);g.setFromMatrix(f);b.setRenderTarget(j);a.clearColor(1,0,1,1);b.clear();j=b.getClearColor();q=b.getClearAlpha();a.clearColor(j.r,j.g,j.b,q);o=h.__webglObjects;j=0;for(q=o.length;j<q;j++)if(n=o[j],l=n.object,n.render=!1,l.visible&&l.castShadow&&
|
|
|
+(!(l instanceof THREE.Mesh)||!l.frustumCulled||g.contains(l)))l.matrixWorld.flattenToArray(l._objectMatrixArray),l._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,l.matrixWorld,l._modelViewMatrixArray),n.render=!0;b.setDepthTest(!0);b.setBlending(THREE.NormalBlending);j=0;for(q=o.length;j<q;j++)if(n=o[j],n.render)l=n.object,n=n.buffer,b.setObjectFaces(l),m=l.customDepthMaterial?l.customDepthMaterial:l.geometry.morphTargets.length?d:c,n instanceof THREE.BufferGeometry?b.renderBufferDirect(e,
|
|
|
+p,null,m,n,l):b.renderBuffer(e,p,null,m,n,l);o=h.__webglObjectsImmediate;j=0;for(q=o.length;j<q;j++)n=o[j],l=n.object,l.visible&&l.castShadow&&(l.matrixAutoUpdate&&l.matrixWorld.flattenToArray(l._objectMatrixArray),l._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,l.matrixWorld,l._modelViewMatrixArray),b.renderImmediateObject(e,p,null,c,l));r++}}};
|
|
|
THREE.SpritePlugin=function(){function a(a,b){return b.z-a.z}var b,c,d={};this.init=function(a){b=a.context;c=a;d.vertices=new Float32Array(16);d.faces=new Uint16Array(6);a=0;d.vertices[a++]=-1;d.vertices[a++]=-1;d.vertices[a++]=0;d.vertices[a++]=1;d.vertices[a++]=1;d.vertices[a++]=-1;d.vertices[a++]=1;d.vertices[a++]=1;d.vertices[a++]=1;d.vertices[a++]=1;d.vertices[a++]=1;d.vertices[a++]=0;d.vertices[a++]=-1;d.vertices[a++]=1;d.vertices[a++]=0;a=d.vertices[a++]=0;d.faces[a++]=0;d.faces[a++]=1;d.faces[a++]=
|
|
|
2;d.faces[a++]=0;d.faces[a++]=2;d.faces[a++]=3;d.vertexBuffer=b.createBuffer();d.elementBuffer=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,d.vertexBuffer);b.bufferData(b.ARRAY_BUFFER,d.vertices,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,d.elementBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,d.faces,b.STATIC_DRAW);var a=THREE.ShaderSprite.sprite,g=b.createProgram(),f=b.createShader(b.FRAGMENT_SHADER),h=b.createShader(b.VERTEX_SHADER);b.shaderSource(f,a.fragmentShader);b.shaderSource(h,a.vertexShader);
|
|
|
b.compileShader(f);b.compileShader(h);b.attachShader(g,f);b.attachShader(g,h);b.linkProgram(g);d.program=g;d.attributes={};d.uniforms={};d.attributes.position=b.getAttribLocation(d.program,"position");d.attributes.uv=b.getAttribLocation(d.program,"uv");d.uniforms.uvOffset=b.getUniformLocation(d.program,"uvOffset");d.uniforms.uvScale=b.getUniformLocation(d.program,"uvScale");d.uniforms.rotation=b.getUniformLocation(d.program,"rotation");d.uniforms.scale=b.getUniformLocation(d.program,"scale");d.uniforms.alignment=
|
|
|
b.getUniformLocation(d.program,"alignment");d.uniforms.color=b.getUniformLocation(d.program,"color");d.uniforms.map=b.getUniformLocation(d.program,"map");d.uniforms.opacity=b.getUniformLocation(d.program,"opacity");d.uniforms.useScreenCoordinates=b.getUniformLocation(d.program,"useScreenCoordinates");d.uniforms.affectedByDistance=b.getUniformLocation(d.program,"affectedByDistance");d.uniforms.screenPosition=b.getUniformLocation(d.program,"screenPosition");d.uniforms.modelViewMatrix=b.getUniformLocation(d.program,
|
|
|
-"modelViewMatrix");d.uniforms.projectionMatrix=b.getUniformLocation(d.program,"projectionMatrix");d.attributesEnabled=!1};this.render=function(e,g,f,h){var e=e.__webglSprites,i=e.length;if(i){var k=d.attributes,j=d.uniforms,q=h/f;f*=0.5;var p=h*0.5,m=!0;b.useProgram(d.program);if(!d.attributesEnabled)b.enableVertexAttribArray(k.position),b.enableVertexAttribArray(k.uv),d.attributesEnabled=!0;b.disable(b.CULL_FACE);b.enable(b.BLEND);b.depthMask(!0);b.bindBuffer(b.ARRAY_BUFFER,d.vertexBuffer);b.vertexAttribPointer(k.position,
|
|
|
-2,b.FLOAT,!1,16,0);b.vertexAttribPointer(k.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,d.elementBuffer);b.uniformMatrix4fv(j.projectionMatrix,!1,g._projectionMatrixArray);b.activeTexture(b.TEXTURE0);b.uniform1i(j.map,0);for(var l,n=[],k=0;k<i;k++)if(l=e[k],l.visible&&l.opacity!==0)l.useScreenCoordinates?l.z=-l.position.z:(l._modelViewMatrix.multiplyToArray(g.matrixWorldInverse,l.matrixWorld,l._modelViewMatrixArray),l.z=-l._modelViewMatrix.n34);e.sort(a);for(k=0;k<i;k++)l=e[k],l.visible&&
|
|
|
-l.opacity!==0&&l.map&&l.map.image&&l.map.image.width&&(l.useScreenCoordinates?(b.uniform1i(j.useScreenCoordinates,1),b.uniform3f(j.screenPosition,(l.position.x-f)/f,(p-l.position.y)/p,Math.max(0,Math.min(1,l.position.z)))):(b.uniform1i(j.useScreenCoordinates,0),b.uniform1i(j.affectedByDistance,l.affectedByDistance?1:0),b.uniformMatrix4fv(j.modelViewMatrix,!1,l._modelViewMatrixArray)),g=l.map.image.width/(l.scaleByViewport?h:1),n[0]=g*q*l.scale.x,n[1]=g*l.scale.y,b.uniform2f(j.uvScale,l.uvScale.x,
|
|
|
-l.uvScale.y),b.uniform2f(j.uvOffset,l.uvOffset.x,l.uvOffset.y),b.uniform2f(j.alignment,l.alignment.x,l.alignment.y),b.uniform1f(j.opacity,l.opacity),b.uniform3f(j.color,l.color.r,l.color.g,l.color.b),b.uniform1f(j.rotation,l.rotation),b.uniform2fv(j.scale,n),l.mergeWith3D&&!m?(b.enable(b.DEPTH_TEST),m=!0):!l.mergeWith3D&&m&&(b.disable(b.DEPTH_TEST),m=!1),c.setBlending(l.blending),c.setTexture(l.map,0),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0));b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(!0)}}};
|
|
|
-if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoUpdateScene=!1;var b=this,c=this.setSize,d=this.render,e=new THREE.PerspectiveCamera,g=new THREE.PerspectiveCamera,f=new THREE.Matrix4,h=new THREE.Matrix4,i,k,j,q;e.matrixAutoUpdate=g.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},p=new THREE.WebGLRenderTarget(512,512,a),m=new THREE.WebGLRenderTarget(512,512,a),l=new THREE.PerspectiveCamera(53,
|
|
|
-1,1,1E4);l.position.z=2;var a=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:p},mapRight:{type:"t",value:1,texture:m}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"}),
|
|
|
-n=new THREE.Scene;n.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),a));n.add(l);this.setSize=function(a,d){c.call(b,a,d);p.width=a;p.height=d;m.width=a;m.height=d};this.render=function(a,c){a.updateMatrixWorld();if(i!==c.aspect||k!==c.near||j!==c.far||q!==c.fov){i=c.aspect;k=c.near;j=c.far;q=c.fov;var s=c.projectionMatrix.clone(),t=125/30*0.5,w=t*k/125,z=k*Math.tan(q*Math.PI/360),u;f.n14=t;h.n14=-t;t=-z*i+w;u=z*i+w;s.n11=2*k/(u-t);s.n13=(u+t)/(u-t);e.projectionMatrix.copy(s);t=-z*i-w;u=z*i-w;s.n11=
|
|
|
-2*k/(u-t);s.n13=(u+t)/(u-t);g.projectionMatrix.copy(s)}e.matrixWorld.copy(c.matrixWorld).multiplySelf(h);e.position.copy(c.position);e.near=c.near;e.far=c.far;d.call(b,a,e,p,!0);g.matrixWorld.copy(c.matrixWorld).multiplySelf(f);g.position.copy(c.position);g.near=c.near;g.far=c.far;d.call(b,a,g,m,!0);n.updateMatrixWorld();d.call(b,n,l)}};
|
|
|
+"modelViewMatrix");d.uniforms.projectionMatrix=b.getUniformLocation(d.program,"projectionMatrix");d.attributesEnabled=!1};this.render=function(e,g,f,h){var e=e.__webglSprites,i=e.length;if(i){var k=d.attributes,j=d.uniforms,q=h/f;f*=0.5;var n=h*0.5,m=!0;b.useProgram(d.program);if(!d.attributesEnabled)b.enableVertexAttribArray(k.position),b.enableVertexAttribArray(k.uv),d.attributesEnabled=!0;b.disable(b.CULL_FACE);b.enable(b.BLEND);b.depthMask(!0);b.bindBuffer(b.ARRAY_BUFFER,d.vertexBuffer);b.vertexAttribPointer(k.position,
|
|
|
+2,b.FLOAT,!1,16,0);b.vertexAttribPointer(k.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,d.elementBuffer);b.uniformMatrix4fv(j.projectionMatrix,!1,g._projectionMatrixArray);b.activeTexture(b.TEXTURE0);b.uniform1i(j.map,0);for(var l,o=[],k=0;k<i;k++)if(l=e[k],l.visible&&l.opacity!==0)l.useScreenCoordinates?l.z=-l.position.z:(l._modelViewMatrix.multiplyToArray(g.matrixWorldInverse,l.matrixWorld,l._modelViewMatrixArray),l.z=-l._modelViewMatrix.n34);e.sort(a);for(k=0;k<i;k++)l=e[k],l.visible&&
|
|
|
+l.opacity!==0&&l.map&&l.map.image&&l.map.image.width&&(l.useScreenCoordinates?(b.uniform1i(j.useScreenCoordinates,1),b.uniform3f(j.screenPosition,(l.position.x-f)/f,(n-l.position.y)/n,Math.max(0,Math.min(1,l.position.z)))):(b.uniform1i(j.useScreenCoordinates,0),b.uniform1i(j.affectedByDistance,l.affectedByDistance?1:0),b.uniformMatrix4fv(j.modelViewMatrix,!1,l._modelViewMatrixArray)),g=l.map.image.width/(l.scaleByViewport?h:1),o[0]=g*q*l.scale.x,o[1]=g*l.scale.y,b.uniform2f(j.uvScale,l.uvScale.x,
|
|
|
+l.uvScale.y),b.uniform2f(j.uvOffset,l.uvOffset.x,l.uvOffset.y),b.uniform2f(j.alignment,l.alignment.x,l.alignment.y),b.uniform1f(j.opacity,l.opacity),b.uniform3f(j.color,l.color.r,l.color.g,l.color.b),b.uniform1f(j.rotation,l.rotation),b.uniform2fv(j.scale,o),l.mergeWith3D&&!m?(b.enable(b.DEPTH_TEST),m=!0):!l.mergeWith3D&&m&&(b.disable(b.DEPTH_TEST),m=!1),c.setBlending(l.blending),c.setTexture(l.map,0),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0));b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(!0)}}};
|
|
|
+if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoUpdateScene=!1;var b=this,c=this.setSize,d=this.render,e=new THREE.PerspectiveCamera,g=new THREE.PerspectiveCamera,f=new THREE.Matrix4,h=new THREE.Matrix4,i,k,j,q;e.matrixAutoUpdate=g.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},n=new THREE.WebGLRenderTarget(512,512,a),m=new THREE.WebGLRenderTarget(512,512,a),l=new THREE.PerspectiveCamera(53,
|
|
|
+1,1,1E4);l.position.z=2;var a=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:n},mapRight:{type:"t",value:1,texture:m}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"}),
|
|
|
+o=new THREE.Scene;o.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),a));o.add(l);this.setSize=function(a,d){c.call(b,a,d);n.width=a;n.height=d;m.width=a;m.height=d};this.render=function(a,c){a.updateMatrixWorld();if(i!==c.aspect||k!==c.near||j!==c.far||q!==c.fov){i=c.aspect;k=c.near;j=c.far;q=c.fov;var s=c.projectionMatrix.clone(),t=125/30*0.5,w=t*k/125,z=k*Math.tan(q*Math.PI/360),u;f.n14=t;h.n14=-t;t=-z*i+w;u=z*i+w;s.n11=2*k/(u-t);s.n13=(u+t)/(u-t);e.projectionMatrix.copy(s);t=-z*i-w;u=z*i-w;s.n11=
|
|
|
+2*k/(u-t);s.n13=(u+t)/(u-t);g.projectionMatrix.copy(s)}e.matrixWorld.copy(c.matrixWorld).multiplySelf(h);e.position.copy(c.position);e.near=c.near;e.far=c.far;d.call(b,a,e,n,!0);g.matrixWorld.copy(c.matrixWorld).multiplySelf(f);g.position.copy(c.position);g.near=c.near;g.far=c.far;d.call(b,a,g,m,!0);o.updateMatrixWorld();d.call(b,o,l)}};
|
|
|
if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoClear=!1;var b=this,c=this.setSize,d=this.render,e,g,f=new THREE.PerspectiveCamera;f.target=new THREE.Vector3(0,0,0);var h=new THREE.PerspectiveCamera;h.target=new THREE.Vector3(0,0,0);b.separation=10;if(a&&a.separation!==void 0)b.separation=a.separation;this.setSize=function(a,d){c.call(b,a,d);e=a/2;g=d};this.render=function(a,c){this.clear();f.fov=c.fov;f.aspect=0.5*c.aspect;f.near=c.near;f.far=
|
|
|
c.far;f.updateProjectionMatrix();f.position.copy(c.position);f.target.copy(c.target);f.translateX(b.separation);f.lookAt(f.target);h.projectionMatrix=f.projectionMatrix;h.position.copy(c.position);h.target.copy(c.target);h.translateX(-b.separation);h.lookAt(h.target);this.setViewport(0,0,e,g);d.call(b,a,f);this.setViewport(e,0,e,g);d.call(b,a,h,!1)}};
|
|
|
THREE.ShaderFlares={lensFlareVertexTexture:{vertexShader:"uniform vec3 screenPosition;\nuniform vec2 scale;\nuniform float rotation;\nuniform int renderType;\nuniform sampler2D occlusionMap;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nvUV = uv;\nvec2 pos = position;\nif( renderType == 2 ) {\nvec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.5 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.1, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.1, 0.5 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.5 ) );\nvVisibility = ( visibility.r / 9.0 ) *\n( 1.0 - visibility.g / 9.0 ) *\n( visibility.b / 9.0 ) *\n( 1.0 - visibility.a / 9.0 );\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",fragmentShader:"precision mediump float;\nuniform sampler2D map;\nuniform float opacity;\nuniform int renderType;\nuniform vec3 color;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nif( renderType == 0 ) {\ngl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );\n} else if( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nvec4 texture = texture2D( map, vUV );\ntexture.a *= opacity * vVisibility;\ngl_FragColor = texture;\ngl_FragColor.rgb *= color;\n}\n}"},
|