|
@@ -1,21 +1,21 @@
|
|
|
// 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}};
|
|
|
+'use strict';THREE.ColorUtils={adjustHSV:function(a,b,c,d){var e=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(a,e);e.h=THREE.Math.clamp(e.h+b,0,1);e.s=THREE.Math.clamp(e.s+c,0,1);e.v=THREE.Math.clamp(e.v+d,0,1);a.setHSV(e.h,e.s,e.v)},rgbToHsv:function(a,b){var c=a.r,d=a.g,e=a.b,f=Math.max(Math.max(c,d),e),g=Math.min(Math.min(c,d),e);if(g===f)g=c=0;else{var h=f-g,g=h/f,c=(c===f?(d-e)/h:d===f?2+(e-c)/h:4+(c-d)/h)/6;0>c&&(c+=1);1<c&&(c-=1)}void 0===b&&(b={h:0,s:0,v:0});b.h=c;b.s=g;b.v=f;return b}};
|
|
|
THREE.ColorUtils.__hsv={h:0,s:0,v:0};
|
|
|
-THREE.GeometryUtils={merge:function(a,b){for(var c,d,e=a.vertices.length,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,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={merge:function(a,b){for(var c,d,e=a.vertices.length,f=b instanceof THREE.Mesh?b.geometry:b,g=a.vertices,h=f.vertices,i=a.faces,k=f.faces,j=a.faceVertexUvs[0],o=f.faceVertexUvs[0],l={},n=0;n<a.materials.length;n++)l[a.materials[n].id]=n;if(b instanceof THREE.Mesh)b.matrixAutoUpdate&&b.updateMatrix(),c=b.matrix,d=new THREE.Matrix4,d.extractRotation(c,b.scale);for(var n=0,p=h.length;n<p;n++){var m=new THREE.Vertex(h[n].position.clone());c&&c.multiplyVector3(m.position);g.push(m)}for(n=
|
|
|
+0,p=k.length;n<p;n++){var g=k[n],q,r,t=g.vertexNormals,s=g.vertexColors;g instanceof THREE.Face3?q=new THREE.Face3(g.a+e,g.b+e,g.c+e):g instanceof THREE.Face4&&(q=new THREE.Face4(g.a+e,g.b+e,g.c+e,g.d+e));q.normal.copy(g.normal);d&&d.multiplyVector3(q.normal);h=0;for(m=t.length;h<m;h++)r=t[h].clone(),d&&d.multiplyVector3(r),q.vertexNormals.push(r);q.color.copy(g.color);h=0;for(m=s.length;h<m;h++)r=s[h],q.vertexColors.push(r.clone());if(void 0!==g.materialIndex){h=f.materials[g.materialIndex];m=h.id;
|
|
|
+s=l[m];if(void 0===s)s=a.materials.length,l[m]=s,a.materials.push(h);q.materialIndex=s}q.centroid.copy(g.centroid);c&&c.multiplyVector3(q.centroid);i.push(q)}for(n=0,p=o.length;n<p;n++){c=o[n];d=[];h=0;for(m=c.length;h<m;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,f=a.faceVertexUvs[0];if(a.materials)b.materials=a.materials.slice();for(a=0,c=d.length;a<c;a++){var g=new THREE.Vertex(d[a].position.clone());b.vertices.push(g)}for(a=
|
|
|
+0,c=e.length;a<c;a++){var h=e[a],i,k,j=h.vertexNormals,o=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(g=j.length;d<g;d++)k=j[d],i.vertexNormals.push(k.clone());i.color.copy(h.color);d=0;for(g=o.length;d<g;d++)k=o[d],i.vertexColors.push(k.clone());i.materialIndex=h.materialIndex;i.centroid.copy(h.centroid);b.faces.push(i)}for(a=0,c=f.length;a<c;a++){e=f[a];i=[];d=0;for(g=e.length;d<
|
|
|
+g;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,f,g=new THREE.Vector3,h=THREE.GeometryUtils.__v1;d=THREE.GeometryUtils.random();e=THREE.GeometryUtils.random();1<d+e&&(d=1-d,e=1-e);f=1-d-e;g.copy(a);g.multiplyScalar(d);h.copy(b);h.multiplyScalar(e);g.addSelf(h);h.copy(c);h.multiplyScalar(f);g.addSelf(h);return g},randomPointInFace:function(a,b,c){var d,e,f;if(a instanceof THREE.Face3)return d=b.vertices[a.a].position,e=b.vertices[a.b].position,
|
|
|
+f=b.vertices[a.c].position,THREE.GeometryUtils.randomPointInTriangle(d,e,f);if(a instanceof THREE.Face4){d=b.vertices[a.a].position;e=b.vertices[a.b].position;f=b.vertices[a.c].position;var b=b.vertices[a.d].position,g;c?a._area1&&a._area2?(c=a._area1,g=a._area2):(c=THREE.GeometryUtils.triangleArea(d,e,b),g=THREE.GeometryUtils.triangleArea(e,f,b),a._area1=c,a._area2=g):(c=THREE.GeometryUtils.triangleArea(d,e,b),g=THREE.GeometryUtils.triangleArea(e,f,b));return THREE.GeometryUtils.random()*(c+g)<c?
|
|
|
+THREE.GeometryUtils.randomPointInTriangle(d,e,b):THREE.GeometryUtils.randomPointInTriangle(e,f,b)}},randomPointsInGeometry:function(a,b){function c(a){function b(c,d){if(d<c)return c;var e=c+Math.floor((d-c)/2);return k[e]>a?b(c,e-1):k[e]<a?b(e+1,d):e}return b(0,k.length-1)}var d,e,f=a.faces,g=a.vertices,h=f.length,i=0,k=[],j,o,l,n;for(e=0;e<h;e++){d=f[e];if(d instanceof THREE.Face3)j=g[d.a].position,o=g[d.b].position,l=g[d.c].position,d._area=THREE.GeometryUtils.triangleArea(j,o,l);else if(d instanceof
|
|
|
+THREE.Face4)j=g[d.a].position,o=g[d.b].position,l=g[d.c].position,n=g[d.d].position,d._area1=THREE.GeometryUtils.triangleArea(j,o,n),d._area2=THREE.GeometryUtils.triangleArea(o,l,n),d._area=d._area1+d._area2;i+=d._area;k[e]=i}d=[];for(e=0;e<b;e++)g=THREE.GeometryUtils.random()*i,g=c(g),d[e]=THREE.GeometryUtils.randomPointInFace(f[g],a,!0);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,f=d.length;e<f;e++)1!==d[e].u&&(d[e].u-=Math.floor(d[e].u)),1!==d[e].v&&(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 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),
|
|
|
+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=[],f=new THREE.Texture(e,b);e.loadCount=0;for(b=0,d=a.length;b<d;++b)e[b]=new Image,e[b].onload=function(){e.loadCount+=1;if(6===e.loadCount)f.needsUpdate=!0;c&&c(this)},e[b].crossOrigin="",e[b].src=a[b];return f},getNormalMap:function(a,b){var c=function(a){var b=
|
|
|
+Math.sqrt(a[0]*a[0]+a[1]*a[1]+a[2]*a[2]);return[a[0]/b,a[1]/b,a[2]/b]},b=b|1,d=a.width,e=a.height,f=document.createElement("canvas");f.width=d;f.height=e;var g=f.getContext("2d");g.drawImage(a,0,0);for(var h=g.getImageData(0,0,d,e).data,i=g.createImageData(d,e),k=i.data,j=0;j<d;j++)for(var o=1;o<e;o++){var l=0>o-1?e-1:o-1,n=(o+1)%e,p=0>j-1?d-1:j-1,m=(j+1)%d,q=[],r=[0,0,h[4*(o*d+j)]/255*b];q.push([-1,0,h[4*(o*d+p)]/255*b]);q.push([-1,-1,h[4*(l*d+p)]/255*b]);q.push([0,-1,h[4*(l*d+j)]/255*b]);q.push([1,
|
|
|
+-1,h[4*(l*d+m)]/255*b]);q.push([1,0,h[4*(o*d+m)]/255*b]);q.push([1,1,h[4*(n*d+m)]/255*b]);q.push([0,1,h[4*(n*d+j)]/255*b]);q.push([-1,1,h[4*(n*d+p)]/255*b]);l=[];p=q.length;for(n=0;n<p;n++){var m=q[n],t=q[(n+1)%p],m=[m[0]-r[0],m[1]-r[1],m[2]-r[2]],t=[t[0]-r[0],t[1]-r[1],t[2]-r[2]];l.push(c([m[1]*t[2]-m[2]*t[1],m[2]*t[0]-m[0]*t[2],m[0]*t[1]-m[1]*t[0]]))}q=[0,0,0];for(n=0;n<l.length;n++)q[0]+=l[n][0],q[1]+=l[n][1],q[2]+=l[n][2];q[0]/=l.length;q[1]/=l.length;q[2]/=l.length;r=4*(o*d+j);k[r]=255*((q[0]+
|
|
|
+1)/2)|0;k[r+1]=255*(q[1]+0.5)|0;k[r+2]=255*q[2]|0;k[r+3]=255}g.putImageData(i,0,0);return f}};
|
|
|
+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 f=new THREE.Mesh(a,b[c]);e.add(f)}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,
|
|
|
b.uvOffset.copy(a.uvOffset),b.uvScale.copy(a.uvScale)):a instanceof THREE.LOD?b=new THREE.LOD:a instanceof THREE.MarchingCubes?(b=new THREE.MarchingCubes(a.resolution,a.material),b.field.set(a.field),b.isolation=a.isolation):a instanceof THREE.Object3D&&(b=new THREE.Object3D);b.name=a.name;b.parent=a.parent;b.up.copy(a.up);b.position.copy(a.position);b.rotation instanceof THREE.Vector3&&b.rotation.copy(a.rotation);b.eulerOrder=a.eulerOrder;b.scale.copy(a.scale);b.dynamic=a.dynamic;b.doubleSided=a.doubleSided;
|
|
@@ -31,89 +31,89 @@ THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {\nvec4 mvPosition = modelV
|
|
|
THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n")},cube:{uniforms:{tCube:{type:"t",value:1,texture:null},tFlip:{type:"f",value:-1}},vertexShader:"varying vec3 vViewPosition;\nvoid main() {\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvViewPosition = cameraPosition - mPosition.xyz;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform samplerCube tCube;\nuniform float tFlip;\nvarying vec3 vViewPosition;\nvoid main() {\nvec3 wPos = cameraPosition - vViewPosition;\ngl_FragColor = textureCube( tCube, vec3( tFlip * wPos.x, wPos.yz ) );\n}"}}};
|
|
|
THREE.BufferGeometry=function(){this.id=THREE.GeometryCount++;this.vertexColorArray=this.vertexUvArray=this.vertexNormalArray=this.vertexPositionArray=this.vertexIndexArray=this.vertexColorBuffer=this.vertexUvBuffer=this.vertexNormalBuffer=this.vertexPositionBuffer=this.vertexIndexBuffer=null;this.dynamic=!1;this.boundingSphere=this.boundingBox=null;this.morphTargets=[]};THREE.BufferGeometry.prototype={constructor:THREE.BufferGeometry,computeBoundingBox:function(){},computeBoundingSphere:function(){}};
|
|
|
THREE.Curve=function(){};THREE.Curve.prototype.getPoint=function(){console.log("Warning, getPoint() not implemented!");return null};THREE.Curve.prototype.getPointAt=function(a){return this.getPoint(this.getUtoTmapping(a))};THREE.Curve.prototype.getPoints=function(a){a||(a=5);var b,c=[];for(b=0;b<=a;b++)c.push(this.getPoint(b/a));return c};THREE.Curve.prototype.getSpacedPoints=function(a){a||(a=5);var b,c=[];for(b=0;b<=a;b++)c.push(this.getPointAt(b/a));return c};
|
|
|
-THREE.Curve.prototype.getLength=function(){var a=this.getLengths();return a[a.length-1]};THREE.Curve.prototype.getLengths=function(a){a||(a=200);if(this.cacheArcLengths&&this.cacheArcLengths.length==a+1)return this.cacheArcLengths;var b=[],c,d=this.getPoint(0),e,g=0;b.push(0);for(e=1;e<=a;e++)c=this.getPoint(e/a),g+=c.distanceTo(d),b.push(g),d=c;return this.cacheArcLengths=b};
|
|
|
-THREE.Curve.prototype.getUtoTmapping=function(a,b){var c=this.getLengths(),d=0,e=c.length,g;g=b?b:a*c[e-1];for(var f=0,h=e-1,i;f<=h;)if(d=Math.floor(f+(h-f)/2),i=c[d]-g,i<0)f=d+1;else if(i>0)h=d-1;else{h=d;break}d=h;if(c[d]==g)return d/(e-1);f=c[d];return c=(d+(g-f)/(c[d+1]-f))/(e-1)};THREE.Curve.prototype.getNormalVector=function(a){a=this.getTangent(a);return new THREE.Vector2(-a.y,a.x)};
|
|
|
-THREE.Curve.prototype.getTangent=function(a){var b=a-1.0E-4;a+=1.0E-4;b<0&&(b=0);a>1&&(a=1);b=this.getPoint(b);a=this.getPoint(a);return b.clone().subSelf(a).normalize()};THREE.Curve.prototype.getTangentAt=function(a){return this.getTangent(this.getUtoTmapping(a))};THREE.LineCurve=function(a,b){a instanceof THREE.Vector2?(this.v1=a,this.v2=b):THREE.LineCurve.oldConstructor.apply(this,arguments)};
|
|
|
+THREE.Curve.prototype.getLength=function(){var a=this.getLengths();return a[a.length-1]};THREE.Curve.prototype.getLengths=function(a){a||(a=200);if(this.cacheArcLengths&&this.cacheArcLengths.length==a+1)return this.cacheArcLengths;var b=[],c,d=this.getPoint(0),e,f=0;b.push(0);for(e=1;e<=a;e++)c=this.getPoint(e/a),f+=c.distanceTo(d),b.push(f),d=c;return this.cacheArcLengths=b};
|
|
|
+THREE.Curve.prototype.getUtoTmapping=function(a,b){var c=this.getLengths(),d=0,e=c.length,f;f=b?b:a*c[e-1];for(var g=0,h=e-1,i;g<=h;)if(d=Math.floor(g+(h-g)/2),i=c[d]-f,0>i)g=d+1;else if(0<i)h=d-1;else{h=d;break}d=h;if(c[d]==f)return d/(e-1);g=c[d];return c=(d+(f-g)/(c[d+1]-g))/(e-1)};THREE.Curve.prototype.getNormalVector=function(a){a=this.getTangent(a);return new THREE.Vector2(-a.y,a.x)};
|
|
|
+THREE.Curve.prototype.getTangent=function(a){var b=a-1.0E-4,a=a+1.0E-4;0>b&&(b=0);1<a&&(a=1);b=this.getPoint(b);a=this.getPoint(a);return b.clone().subSelf(a).normalize()};THREE.Curve.prototype.getTangentAt=function(a){return this.getTangent(this.getUtoTmapping(a))};THREE.LineCurve=function(a,b){a instanceof THREE.Vector2?(this.v1=a,this.v2=b):THREE.LineCurve.oldConstructor.apply(this,arguments)};
|
|
|
THREE.LineCurve.oldConstructor=function(a,b,c,d){this.constructor(new THREE.Vector2(a,b),new THREE.Vector2(c,d))};THREE.LineCurve.prototype=new THREE.Curve;THREE.LineCurve.prototype.constructor=THREE.LineCurve;THREE.LineCurve.prototype.getPoint=function(a){var b=new THREE.Vector2;b.sub(this.v2,this.v1);b.multiplyScalar(a).addSelf(this.v1);return b};THREE.LineCurve.prototype.getPointAt=function(a){return this.getPoint(a)};
|
|
|
THREE.LineCurve.prototype.getTangent=function(){var a=new THREE.Vector2;a.sub(this.v2,this.v1);a.normalize();return a};THREE.QuadraticBezierCurve=function(a,b,c){if(!(b instanceof THREE.Vector2))var d=Array.prototype.slice.call(arguments),a=new THREE.Vector2(d[0],d[1]),b=new THREE.Vector2(d[2],d[3]),c=new THREE.Vector2(d[4],d[5]);this.v0=a;this.v1=b;this.v2=c};THREE.QuadraticBezierCurve.prototype=new THREE.Curve;THREE.QuadraticBezierCurve.prototype.constructor=THREE.QuadraticBezierCurve;
|
|
|
THREE.QuadraticBezierCurve.prototype.getPoint=function(a){var b;b=THREE.Shape.Utils.b2(a,this.v0.x,this.v1.x,this.v2.x);a=THREE.Shape.Utils.b2(a,this.v0.y,this.v1.y,this.v2.y);return new THREE.Vector2(b,a)};THREE.QuadraticBezierCurve.prototype.getTangent=function(a){var b;b=THREE.Curve.Utils.tangentQuadraticBezier(a,this.v0.x,this.v1.x,this.v2.x);a=THREE.Curve.Utils.tangentQuadraticBezier(a,this.v0.y,this.v1.y,this.v2.y);b=new THREE.Vector2(b,a);b.normalize();return b};
|
|
|
THREE.CubicBezierCurve=function(a,b,c,d){if(!(b instanceof THREE.Vector2))var e=Array.prototype.slice.call(arguments),a=new THREE.Vector2(e[0],e[1]),b=new THREE.Vector2(e[2],e[3]),c=new THREE.Vector2(e[4],e[5]),d=new THREE.Vector2(e[6],e[7]);this.v0=a;this.v1=b;this.v2=c;this.v3=d};THREE.CubicBezierCurve.prototype=new THREE.Curve;THREE.CubicBezierCurve.prototype.constructor=THREE.CubicBezierCurve;
|
|
|
THREE.CubicBezierCurve.prototype.getPoint=function(a){var b;b=THREE.Shape.Utils.b3(a,this.v0.x,this.v1.x,this.v2.x,this.v3.x);a=THREE.Shape.Utils.b3(a,this.v0.y,this.v1.y,this.v2.y,this.v3.y);return new THREE.Vector2(b,a)};THREE.CubicBezierCurve.prototype.getTangent=function(a){var b;b=THREE.Curve.Utils.tangentCubicBezier(a,this.v0.x,this.v1.x,this.v2.x,this.v3.x);a=THREE.Curve.Utils.tangentCubicBezier(a,this.v0.y,this.v1.y,this.v2.y,this.v3.y);b=new THREE.Vector2(b,a);b.normalize();return b};
|
|
|
-THREE.SplineCurve=function(a){this.points=a==void 0?[]:a};THREE.SplineCurve.prototype=new THREE.Curve;THREE.SplineCurve.prototype.constructor=THREE.SplineCurve;
|
|
|
-THREE.SplineCurve.prototype.getPoint=function(a){var b=new THREE.Vector2,c=[],d=this.points,e;e=(d.length-1)*a;a=Math.floor(e);e-=a;c[0]=a==0?a:a-1;c[1]=a;c[2]=a>d.length-2?a:a+1;c[3]=a>d.length-3?a:a+2;b.x=THREE.Curve.Utils.interpolate(d[c[0]].x,d[c[1]].x,d[c[2]].x,d[c[3]].x,e);b.y=THREE.Curve.Utils.interpolate(d[c[0]].y,d[c[1]].y,d[c[2]].y,d[c[3]].y,e);return b};THREE.ArcCurve=function(a,b,c,d,e,g){this.aX=a;this.aY=b;this.aRadius=c;this.aStartAngle=d;this.aEndAngle=e;this.aClockwise=g};
|
|
|
-THREE.ArcCurve.prototype=new THREE.Curve;THREE.ArcCurve.prototype.constructor=THREE.ArcCurve;THREE.ArcCurve.prototype.getPoint=function(a){var b=this.aEndAngle-this.aStartAngle;this.aClockwise||(a=1-a);a=this.aStartAngle+a*b;return new THREE.Vector2(this.aX+this.aRadius*Math.cos(a),this.aY+this.aRadius*Math.sin(a))};
|
|
|
-THREE.Curve.Utils={tangentQuadraticBezier:function(a,b,c,d){return 2*(1-a)*(c-b)+2*a*(d-c)},tangentCubicBezier:function(a,b,c,d,e){return-3*b*(1-a)*(1-a)+3*c*(1-a)*(1-a)-6*a*c*(1-a)+6*a*d*(1-a)-3*a*a*d+3*a*a*e},tangentSpline:function(a){return 6*a*a-6*a+(3*a*a-4*a+1)+(-6*a*a+6*a)+(3*a*a-2*a)},interpolate:function(a,b,c,d,e){var a=(c-a)*0.5,d=(d-b)*0.5,g=e*e;return(2*b-2*c+a+d)*e*g+(-3*b+3*c-2*a-d)*g+a*e+b}};
|
|
|
+THREE.SplineCurve=function(a){this.points=void 0==a?[]:a};THREE.SplineCurve.prototype=new THREE.Curve;THREE.SplineCurve.prototype.constructor=THREE.SplineCurve;
|
|
|
+THREE.SplineCurve.prototype.getPoint=function(a){var b=new THREE.Vector2,c=[],d=this.points,e;e=(d.length-1)*a;a=Math.floor(e);e-=a;c[0]=0==a?a:a-1;c[1]=a;c[2]=a>d.length-2?a:a+1;c[3]=a>d.length-3?a:a+2;b.x=THREE.Curve.Utils.interpolate(d[c[0]].x,d[c[1]].x,d[c[2]].x,d[c[3]].x,e);b.y=THREE.Curve.Utils.interpolate(d[c[0]].y,d[c[1]].y,d[c[2]].y,d[c[3]].y,e);return b};THREE.ArcCurve=function(a,b,c,d,e,f){this.aX=a;this.aY=b;this.aRadius=c;this.aStartAngle=d;this.aEndAngle=e;this.aClockwise=f};
|
|
|
+THREE.ArcCurve.prototype=new THREE.Curve;THREE.ArcCurve.prototype.constructor=THREE.ArcCurve;THREE.ArcCurve.prototype.getPoint=function(a){var b=this.aEndAngle-this.aStartAngle;this.aClockwise||(a=1-a);b=this.aStartAngle+a*b;a=this.aX+this.aRadius*Math.cos(b);b=this.aY+this.aRadius*Math.sin(b);return new THREE.Vector2(a,b)};
|
|
|
+THREE.Curve.Utils={tangentQuadraticBezier:function(a,b,c,d){return 2*(1-a)*(c-b)+2*a*(d-c)},tangentCubicBezier:function(a,b,c,d,e){return-3*b*(1-a)*(1-a)+3*c*(1-a)*(1-a)-6*a*c*(1-a)+6*a*d*(1-a)-3*a*a*d+3*a*a*e},tangentSpline:function(a){return 6*a*a-6*a+(3*a*a-4*a+1)+(-6*a*a+6*a)+(3*a*a-2*a)},interpolate:function(a,b,c,d,e){var a=0.5*(c-a),d=0.5*(d-b),f=e*e;return(2*b-2*c+a+d)*e*f+(-3*b+3*c-2*a-d)*f+a*e+b}};
|
|
|
THREE.Curve.create=function(a,b){a.prototype=new THREE.Curve;a.prototype.constructor=a;a.prototype.getPoint=b;return a};THREE.LineCurve3=THREE.Curve.create(function(a,b){this.v1=a;this.v2=b},function(a){var b=new THREE.Vector3;b.sub(this.v2,this.v1);b.multiplyScalar(a);b.addSelf(this.v1);return b});
|
|
|
THREE.QuadraticBezierCurve3=THREE.Curve.create(function(a,b,c){this.v0=a;this.v1=b;this.v2=c},function(a){var b,c;b=THREE.Shape.Utils.b2(a,this.v0.x,this.v1.x,this.v2.x);c=THREE.Shape.Utils.b2(a,this.v0.y,this.v1.y,this.v2.y);a=THREE.Shape.Utils.b2(a,this.v0.z,this.v1.z,this.v2.z);return new THREE.Vector3(b,c,a)});
|
|
|
THREE.CubicBezierCurve3=THREE.Curve.create(function(a,b,c,d){this.v0=a;this.v1=b;this.v2=c;this.v3=d},function(a){var b,c;b=THREE.Shape.Utils.b3(a,this.v0.x,this.v1.x,this.v2.x,this.v3.x);c=THREE.Shape.Utils.b3(a,this.v0.y,this.v1.y,this.v2.y,this.v3.y);a=THREE.Shape.Utils.b3(a,this.v0.z,this.v1.z,this.v2.z,this.v3.z);return new THREE.Vector3(b,c,a)});
|
|
|
-THREE.SplineCurve3=THREE.Curve.create(function(a){this.points=a==void 0?[]:a},function(a){var b=new THREE.Vector3,c=[],d=this.points,e;e=(d.length-1)*a;a=Math.floor(e);e-=a;c[0]=a==0?a:a-1;c[1]=a;c[2]=a>d.length-2?a:a+1;c[3]=a>d.length-3?a:a+2;b.x=THREE.Curve.Utils.interpolate(d[c[0]].x,d[c[1]].x,d[c[2]].x,d[c[3]].x,e);b.y=THREE.Curve.Utils.interpolate(d[c[0]].y,d[c[1]].y,d[c[2]].y,d[c[3]].y,e);b.z=THREE.Curve.Utils.interpolate(d[c[0]].z,d[c[1]].z,d[c[2]].z,d[c[3]].z,e);return b});
|
|
|
+THREE.SplineCurve3=THREE.Curve.create(function(a){this.points=void 0==a?[]:a},function(a){var b=new THREE.Vector3,c=[],d=this.points,e;e=(d.length-1)*a;a=Math.floor(e);e-=a;c[0]=0==a?a:a-1;c[1]=a;c[2]=a>d.length-2?a:a+1;c[3]=a>d.length-3?a:a+2;b.x=THREE.Curve.Utils.interpolate(d[c[0]].x,d[c[1]].x,d[c[2]].x,d[c[3]].x,e);b.y=THREE.Curve.Utils.interpolate(d[c[0]].y,d[c[1]].y,d[c[2]].y,d[c[3]].y,e);b.z=THREE.Curve.Utils.interpolate(d[c[0]].z,d[c[1]].z,d[c[2]].z,d[c[3]].z,e);return b});
|
|
|
THREE.CurvePath=function(){this.curves=[];this.bends=[]};THREE.CurvePath.prototype=new THREE.Curve;THREE.CurvePath.prototype.constructor=THREE.CurvePath;THREE.CurvePath.prototype.add=function(a){this.curves.push(a)};THREE.CurvePath.prototype.checkConnection=function(){};THREE.CurvePath.prototype.closePath=function(){};
|
|
|
THREE.CurvePath.prototype.getPoint=function(a){for(var b=a*this.getLength(),c=this.getCurveLengths(),a=0;a<c.length;){if(c[a]>=b)return b=c[a]-b,a=this.curves[a],b=1-b/a.getLength(),a.getPointAt(b);a++}return null};THREE.CurvePath.prototype.getLength=function(){var a=this.getCurveLengths();return a[a.length-1]};
|
|
|
THREE.CurvePath.prototype.getCurveLengths=function(){if(this.cacheLengths&&this.cacheLengths.length==this.curves.length)return this.cacheLengths;var a=[],b=0,c,d=this.curves.length;for(c=0;c<d;c++)b+=this.curves[c].getLength(),a.push(b);return this.cacheLengths=a};
|
|
|
-THREE.CurvePath.prototype.getBoundingBox=function(){var a=this.getPoints(),b,c,d,e;b=c=Number.NEGATIVE_INFINITY;d=e=Number.POSITIVE_INFINITY;var g,f,h,i;i=new THREE.Vector2;f=0;for(h=a.length;f<h;f++){g=a[f];if(g.x>b)b=g.x;else if(g.x<d)d=g.x;if(g.y>c)c=g.y;else if(g.y<c)e=g.y;i.addSelf(g.x,g.y)}return{minX:d,minY:e,maxX:b,maxY:c,centroid:i.divideScalar(h)}};THREE.CurvePath.prototype.createPointsGeometry=function(a){return this.createGeometry(this.getPoints(a,!0))};
|
|
|
+THREE.CurvePath.prototype.getBoundingBox=function(){var a=this.getPoints(),b,c,d,e;b=c=Number.NEGATIVE_INFINITY;d=e=Number.POSITIVE_INFINITY;var f,g,h,i;i=new THREE.Vector2;for(g=0,h=a.length;g<h;g++){f=a[g];if(f.x>b)b=f.x;else if(f.x<d)d=f.x;if(f.y>c)c=f.y;else if(f.y<c)e=f.y;i.addSelf(f.x,f.y)}return{minX:d,minY:e,maxX:b,maxY:c,centroid:i.divideScalar(h)}};THREE.CurvePath.prototype.createPointsGeometry=function(a){return this.createGeometry(this.getPoints(a,!0))};
|
|
|
THREE.CurvePath.prototype.createSpacedPointsGeometry=function(a){return this.createGeometry(this.getSpacedPoints(a,!0))};THREE.CurvePath.prototype.createGeometry=function(a){for(var b=new THREE.Geometry,c=0;c<a.length;c++)b.vertices.push(new THREE.Vertex(new THREE.Vector3(a[c].x,a[c].y,0)));return b};THREE.CurvePath.prototype.addWrapPath=function(a){this.bends.push(a)};
|
|
|
-THREE.CurvePath.prototype.getTransformedPoints=function(a,b){var c=this.getPoints(a),d,e;if(!b)b=this.bends;d=0;for(e=b.length;d<e;d++)c=this.getWrapPoints(c,b[d]);return c};THREE.CurvePath.prototype.getTransformedSpacedPoints=function(a,b){var c=this.getSpacedPoints(a),d,e;if(!b)b=this.bends;d=0;for(e=b.length;d<e;d++)c=this.getWrapPoints(c,b[d]);return c};
|
|
|
-THREE.CurvePath.prototype.getWrapPoints=function(a,b){var c=this.getBoundingBox(),d,e,g,f,h,i;d=0;for(e=a.length;d<e;d++)g=a[d],f=g.x,h=g.y,i=f/c.maxX,i=b.getUtoTmapping(i,f),f=b.getPoint(i),h=b.getNormalVector(i).multiplyScalar(h),g.x=f.x+h.x,g.y=f.y+h.y;return a};THREE.Path=function(a){THREE.CurvePath.call(this);this.actions=[];a&&this.fromPoints(a)};THREE.Path.prototype=new THREE.CurvePath;THREE.Path.prototype.constructor=THREE.Path;
|
|
|
-THREE.PathActions={MOVE_TO:"moveTo",LINE_TO:"lineTo",QUADRATIC_CURVE_TO:"quadraticCurveTo",BEZIER_CURVE_TO:"bezierCurveTo",CSPLINE_THRU:"splineThru",ARC:"arc"};THREE.Path.prototype.fromPoints=function(a){this.moveTo(a[0].x,a[0].y);var b,c=a.length;for(b=1;b<c;b++)this.lineTo(a[b].x,a[b].y)};THREE.Path.prototype.moveTo=function(){var a=Array.prototype.slice.call(arguments);this.actions.push({action:THREE.PathActions.MOVE_TO,args:a})};
|
|
|
+THREE.CurvePath.prototype.getTransformedPoints=function(a,b){var c=this.getPoints(a),d,e;if(!b)b=this.bends;for(d=0,e=b.length;d<e;d++)c=this.getWrapPoints(c,b[d]);return c};THREE.CurvePath.prototype.getTransformedSpacedPoints=function(a,b){var c=this.getSpacedPoints(a),d,e;if(!b)b=this.bends;for(d=0,e=b.length;d<e;d++)c=this.getWrapPoints(c,b[d]);return c};
|
|
|
+THREE.CurvePath.prototype.getWrapPoints=function(a,b){var c=this.getBoundingBox(),d,e,f,g,h,i;for(d=0,e=a.length;d<e;d++)f=a[d],g=f.x,h=f.y,i=g/c.maxX,i=b.getUtoTmapping(i,g),g=b.getPoint(i),h=b.getNormalVector(i).multiplyScalar(h),f.x=g.x+h.x,f.y=g.y+h.y;return a};THREE.Path=function(a){THREE.CurvePath.call(this);this.actions=[];a&&this.fromPoints(a)};THREE.Path.prototype=new THREE.CurvePath;THREE.Path.prototype.constructor=THREE.Path;
|
|
|
+THREE.PathActions={MOVE_TO:"moveTo",LINE_TO:"lineTo",QUADRATIC_CURVE_TO:"quadraticCurveTo",BEZIER_CURVE_TO:"bezierCurveTo",CSPLINE_THRU:"splineThru",ARC:"arc"};THREE.Path.prototype.fromPoints=function(a){this.moveTo(a[0].x,a[0].y);for(var b=1,c=a.length;b<c;b++)this.lineTo(a[b].x,a[b].y)};THREE.Path.prototype.moveTo=function(a,b){var c=Array.prototype.slice.call(arguments);this.actions.push({action:THREE.PathActions.MOVE_TO,args:c})};
|
|
|
THREE.Path.prototype.lineTo=function(a,b){var c=Array.prototype.slice.call(arguments),d=this.actions[this.actions.length-1].args;this.curves.push(new THREE.LineCurve(new THREE.Vector2(d[d.length-2],d[d.length-1]),new THREE.Vector2(a,b)));this.actions.push({action:THREE.PathActions.LINE_TO,args:c})};
|
|
|
-THREE.Path.prototype.quadraticCurveTo=function(a,b,c,d){var e=Array.prototype.slice.call(arguments),g=this.actions[this.actions.length-1].args;this.curves.push(new THREE.QuadraticBezierCurve(new THREE.Vector2(g[g.length-2],g[g.length-1]),new THREE.Vector2(a,b),new THREE.Vector2(c,d)));this.actions.push({action:THREE.PathActions.QUADRATIC_CURVE_TO,args:e})};
|
|
|
-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.quadraticCurveTo=function(a,b,c,d){var e=Array.prototype.slice.call(arguments),f=this.actions[this.actions.length-1].args;this.curves.push(new THREE.QuadraticBezierCurve(new THREE.Vector2(f[f.length-2],f[f.length-1]),new THREE.Vector2(a,b),new THREE.Vector2(c,d)));this.actions.push({action:THREE.PathActions.QUADRATIC_CURVE_TO,args:e})};
|
|
|
+THREE.Path.prototype.bezierCurveTo=function(a,b,c,d,e,f){var g=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,f)));this.actions.push({action:THREE.PathActions.BEZIER_CURVE_TO,args:g})};
|
|
|
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,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()};
|
|
|
-THREE.Path.prototype.toShapes=function(){var a,b,c,d,e=[],g=new THREE.Path;a=0;for(b=this.actions.length;a<b;a++)c=this.actions[a],d=c.args,c=c.action,c==THREE.PathActions.MOVE_TO&&g.actions.length!=0&&(e.push(g),g=new THREE.Path),g[c].apply(g,d);g.actions.length!=0&&e.push(g);if(e.length==0)return[];var f,g=[];if(THREE.Shape.Utils.isClockWise(e[0].getPoints())){a=0;for(b=e.length;a<b;a++)d=e[a],THREE.Shape.Utils.isClockWise(d.getPoints())?(f&&g.push(f),f=new THREE.Shape,f.actions=d.actions,f.curves=
|
|
|
-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.Path.prototype.arc=function(a,b,c,d,e,f){var g=Array.prototype.slice.call(arguments);this.curves.push(new THREE.ArcCurve(a,b,c,d,e,f));this.actions.push({action:THREE.PathActions.ARC,args:g})};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,f,g,h,i,k,j,o,l,n,p,m;for(d=0,e=this.actions.length;d<e;d++)switch(f=this.actions[d],g=f.action,f=f.args,g){case THREE.PathActions.LINE_TO:c.push(new THREE.Vector2(f[0],f[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:h=f[2];i=f[3];o=f[0];l=f[1];0<c.length?(g=c[c.length-1],n=g.x,p=g.y):(g=this.actions[d-1].args,n=g[g.length-2],p=g[g.length-1]);for(g=1;g<=a;g++)m=g/a,f=THREE.Shape.Utils.b2(m,n,o,h),m=THREE.Shape.Utils.b2(m,p,l,
|
|
|
+i),c.push(new THREE.Vector2(f,m));break;case THREE.PathActions.BEZIER_CURVE_TO:h=f[4];i=f[5];o=f[0];l=f[1];k=f[2];j=f[3];0<c.length?(g=c[c.length-1],n=g.x,p=g.y):(g=this.actions[d-1].args,n=g[g.length-2],p=g[g.length-1]);for(g=1;g<=a;g++)m=g/a,f=THREE.Shape.Utils.b3(m,n,o,k,h),m=THREE.Shape.Utils.b3(m,p,l,j,i),c.push(new THREE.Vector2(f,m));break;case THREE.PathActions.CSPLINE_THRU:g=this.actions[d-1].args;g=[new THREE.Vector2(g[g.length-2],g[g.length-1])];m=a*f[0].length;g=g.concat(f[0]);f=new THREE.SplineCurve(g);
|
|
|
+for(g=1;g<=m;g++)c.push(f.getPointAt(g/m));break;case THREE.PathActions.ARC:g=this.actions[d-1].args;h=f[0];i=f[1];k=f[2];o=f[3];m=f[4];l=!!f[5];j=g[g.length-2];n=g[g.length-1];0==g.length&&(j=n=0);p=m-o;var q=2*a;for(g=1;g<=q;g++)m=g/q,l||(m=1-m),m=o+m*p,f=j+h+k*Math.cos(m),m=n+i+k*Math.sin(m),c.push(new THREE.Vector2(f,m))}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,f){var g=this.getPoints(),h,i,k,j,o;for(h=0,i=g.length;h<i;h++)k=g[h],j=k.x,o=k.y,k.x=a*j+b*o+c,k.y=d*o+e*j+f;return g};
|
|
|
+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;for(a=0,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();for(a=0,c=d.length;a<c;a++)e=d[a],b.beginPath(),b.arc(e.x,e.y,1.5,0,2*Math.PI,!1),b.stroke(),b.closePath()};
|
|
|
+THREE.Path.prototype.toShapes=function(){var a,b,c,d,e=[],f=new THREE.Path;for(a=0,b=this.actions.length;a<b;a++)c=this.actions[a],d=c.args,c=c.action,c==THREE.PathActions.MOVE_TO&&0!=f.actions.length&&(e.push(f),f=new THREE.Path),f[c].apply(f,d);0!=f.actions.length&&e.push(f);if(0==e.length)return[];var g,f=[];if(THREE.Shape.Utils.isClockWise(e[0].getPoints())){for(a=0,b=e.length;a<b;a++)d=e[a],THREE.Shape.Utils.isClockWise(d.getPoints())?(g&&f.push(g),g=new THREE.Shape,g.actions=d.actions,g.curves=
|
|
|
+d.curves):g.holes.push(d);f.push(g)}else{g=new THREE.Shape;for(a=0,b=e.length;a<b;a++)d=e[a],THREE.Shape.Utils.isClockWise(d.getPoints())?(g.actions=d.actions,g.curves=d.curves,f.push(g),g=new THREE.Shape):g.holes.push(d)}return f};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,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};
|
|
|
+THREE.Shape.Utils={removeHoles:function(a,b){var c=a.concat(),d=c.concat(),e,f,g,h,i,k,j,o,l,n,p=[];for(i=0;i<b.length;i++){k=b[i];Array.prototype.push.apply(d,k);f=Number.POSITIVE_INFINITY;for(e=0;e<k.length;e++){l=k[e];n=[];for(o=0;o<c.length;o++)j=c[o],j=l.distanceToSquared(j),n.push(j),j<f&&(f=j,g=e,h=o)}e=0<=h-1?h-1:c.length-1;f=0<=g-1?g-1:k.length-1;var m=[k[g],c[h],c[e]];o=THREE.FontUtils.Triangulate.area(m);var q=[k[g],k[f],c[h]];l=THREE.FontUtils.Triangulate.area(q);n=h;j=g;h+=1;g+=-1;0>
|
|
|
+h&&(h+=c.length);h%=c.length;0>g&&(g+=k.length);g%=k.length;e=0<=h-1?h-1:c.length-1;f=0<=g-1?g-1:k.length-1;m=[k[g],c[h],c[e]];m=THREE.FontUtils.Triangulate.area(m);q=[k[g],k[f],c[h]];q=THREE.FontUtils.Triangulate.area(q);o+l>m+q&&(h=n,g=j,0>h&&(h+=c.length),h%=c.length,0>g&&(g+=k.length),g%=k.length,e=0<=h-1?h-1:c.length-1,f=0<=g-1?g-1:k.length-1);o=c.slice(0,h);l=c.slice(h);n=k.slice(g);j=k.slice(0,g);f=[k[g],k[f],c[h]];p.push([k[g],c[h],c[e]]);p.push(f);c=o.concat(n).concat(j).concat(l)}return{shape:c,
|
|
|
+isolatedPts:p,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),f,g,h,i,k={};for(f=0,g=d.length;f<g;f++)i=d[f].x+":"+d[f].y,void 0!==k[i]&&console.log("Duplicate point",i),k[i]=f;for(f=0,g=c.length;f<g;f++){h=c[f];for(d=0;3>d;d++)i=h[d].x+":"+h[d].y,i=k[i],void 0!==i&&(h[d]=i)}for(f=0,g=e.length;f<g;f++){h=e[f];for(d=0;3>d;d++)i=h[d].x+":"+h[d].y,i=k[i],void 0!==i&&(h[d]=i)}return c.concat(e)},
|
|
|
+isClockWise:function(a){return 0>THREE.FontUtils.Triangulate.area(a)},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){b=b||this.parameters;this.text=a;var c=void 0!==b.curveSegments?b.curveSegments:4,d=void 0!==b.font?b.font:"helvetiker",e=void 0!==b.weight?b.weight:"normal",f=void 0!==b.style?b.style:"normal";THREE.FontUtils.size=void 0!==b.size?b.size:100;THREE.FontUtils.divisions=c;THREE.FontUtils.face=d;THREE.FontUtils.weight=e;THREE.FontUtils.style=f};
|
|
|
THREE.TextPath.prototype.toShapes=function(){for(var a=THREE.FontUtils.drawText(this.text).paths,b=[],c=0,d=a.length;c<d;c++)Array.prototype.push.apply(b,a[c].toShapes());return b};
|
|
|
-THREE.AnimationHandler=function(){var a=[],b={},c={update:function(b){for(var c=0;c<a.length;c++)a[c].update(b)},addToUpdate:function(b){a.indexOf(b)===-1&&a.push(b)},removeFromUpdate:function(b){b=a.indexOf(b);b!==-1&&a.splice(b,1)},add:function(a){b[a.name]!==void 0&&console.log("THREE.AnimationHandler.add: Warning! "+a.name+" already exists in library. Overwriting.");b[a.name]=a;if(a.initialized!==!0){for(var c=0;c<a.hierarchy.length;c++){for(var d=0;d<a.hierarchy[c].keys.length;d++){if(a.hierarchy[c].keys[d].time<
|
|
|
-0)a.hierarchy[c].keys[d].time=0;if(a.hierarchy[c].keys[d].rot!==void 0&&!(a.hierarchy[c].keys[d].rot instanceof THREE.Quaternion)){var h=a.hierarchy[c].keys[d].rot;a.hierarchy[c].keys[d].rot=new THREE.Quaternion(h[0],h[1],h[2],h[3])}}if(a.hierarchy[c].keys.length&&a.hierarchy[c].keys[0].morphTargets!==void 0){h={};for(d=0;d<a.hierarchy[c].keys.length;d++)for(var i=0;i<a.hierarchy[c].keys[d].morphTargets.length;i++){var k=a.hierarchy[c].keys[d].morphTargets[i];h[k]=-1}a.hierarchy[c].usedMorphTargets=
|
|
|
-h;for(d=0;d<a.hierarchy[c].keys.length;d++){var j={};for(k in h){for(i=0;i<a.hierarchy[c].keys[d].morphTargets.length;i++)if(a.hierarchy[c].keys[d].morphTargets[i]===k){j[k]=a.hierarchy[c].keys[d].morphTargetsInfluences[i];break}i===a.hierarchy[c].keys[d].morphTargets.length&&(j[k]=0)}a.hierarchy[c].keys[d].morphTargetsInfluences=j}}for(d=1;d<a.hierarchy[c].keys.length;d++)a.hierarchy[c].keys[d].time===a.hierarchy[c].keys[d-1].time&&(a.hierarchy[c].keys.splice(d,1),d--);for(d=0;d<a.hierarchy[c].keys.length;d++)a.hierarchy[c].keys[d].index=
|
|
|
-d}d=parseInt(a.length*a.fps,10);a.JIT={};a.JIT.hierarchy=[];for(c=0;c<a.hierarchy.length;c++)a.JIT.hierarchy.push(Array(d));a.initialized=!0}},get:function(a){if(typeof a==="string")return b[a]?b[a]:(console.log("THREE.AnimationHandler.get: Couldn't find animation "+a),null)},parse:function(a){var b=[];if(a instanceof THREE.SkinnedMesh)for(var c=0;c<a.bones.length;c++)b.push(a.bones[c]);else d(a,b);return b}},d=function(a,b){b.push(a);for(var c=0;c<a.children.length;c++)d(a.children[c],b)};c.LINEAR=
|
|
|
-0;c.CATMULLROM=1;c.CATMULLROM_FORWARD=2;return c}();THREE.Animation=function(a,b,c,d){this.root=a;this.data=THREE.AnimationHandler.get(b);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.loop=this.isPaused=!0;this.interpolationType=c!==void 0?c:THREE.AnimationHandler.LINEAR;this.JITCompile=d!==void 0?d:!0;this.points=[];this.target=new THREE.Vector3};
|
|
|
-THREE.Animation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=!0;this.loop=a!==void 0?a:!0;this.currentTime=b!==void 0?b:0;var c,d=this.hierarchy.length,e;for(c=0;c<d;c++){e=this.hierarchy[c];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)e.useQuaternion=!0;e.matrixAutoUpdate=!0;if(e.animationCache===void 0)e.animationCache={},e.animationCache.prevKey={pos:0,rot:0,scl:0},e.animationCache.nextKey={pos:0,rot:0,scl:0},e.animationCache.originalMatrix=e instanceof
|
|
|
-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.AnimationHandler=function(){var a=[],b={},c={update:function(b){for(var c=0;c<a.length;c++)a[c].update(b)},addToUpdate:function(b){-1===a.indexOf(b)&&a.push(b)},removeFromUpdate:function(b){b=a.indexOf(b);-1!==b&&a.splice(b,1)},add:function(a){void 0!==b[a.name]&&console.log("THREE.AnimationHandler.add: Warning! "+a.name+" already exists in library. Overwriting.");b[a.name]=a;if(!0!==a.initialized){for(var c=0;c<a.hierarchy.length;c++){for(var d=0;d<a.hierarchy[c].keys.length;d++){if(0>a.hierarchy[c].keys[d].time)a.hierarchy[c].keys[d].time=
|
|
|
+0;if(void 0!==a.hierarchy[c].keys[d].rot&&!(a.hierarchy[c].keys[d].rot instanceof THREE.Quaternion)){var h=a.hierarchy[c].keys[d].rot;a.hierarchy[c].keys[d].rot=new THREE.Quaternion(h[0],h[1],h[2],h[3])}}if(a.hierarchy[c].keys.length&&void 0!==a.hierarchy[c].keys[0].morphTargets){h={};for(d=0;d<a.hierarchy[c].keys.length;d++)for(var i=0;i<a.hierarchy[c].keys[d].morphTargets.length;i++){var k=a.hierarchy[c].keys[d].morphTargets[i];h[k]=-1}a.hierarchy[c].usedMorphTargets=h;for(d=0;d<a.hierarchy[c].keys.length;d++){var j=
|
|
|
+{};for(k in h){for(i=0;i<a.hierarchy[c].keys[d].morphTargets.length;i++)if(a.hierarchy[c].keys[d].morphTargets[i]===k){j[k]=a.hierarchy[c].keys[d].morphTargetsInfluences[i];break}i===a.hierarchy[c].keys[d].morphTargets.length&&(j[k]=0)}a.hierarchy[c].keys[d].morphTargetsInfluences=j}}for(d=1;d<a.hierarchy[c].keys.length;d++)a.hierarchy[c].keys[d].time===a.hierarchy[c].keys[d-1].time&&(a.hierarchy[c].keys.splice(d,1),d--);for(d=0;d<a.hierarchy[c].keys.length;d++)a.hierarchy[c].keys[d].index=d}d=parseInt(a.length*
|
|
|
+a.fps,10);a.JIT={};a.JIT.hierarchy=[];for(c=0;c<a.hierarchy.length;c++)a.JIT.hierarchy.push(Array(d));a.initialized=!0}},get:function(a){if("string"===typeof a){if(b[a])return b[a];console.log("THREE.AnimationHandler.get: Couldn't find animation "+a);return null}},parse:function(a){var b=[];if(a instanceof THREE.SkinnedMesh)for(var c=0;c<a.bones.length;c++)b.push(a.bones[c]);else d(a,b);return b}},d=function(a,b){b.push(a);for(var c=0;c<a.children.length;c++)d(a.children[c],b)};c.LINEAR=0;c.CATMULLROM=
|
|
|
+1;c.CATMULLROM_FORWARD=2;return c}();THREE.Animation=function(a,b,c,d){this.root=a;this.data=THREE.AnimationHandler.get(b);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.loop=this.isPaused=!0;this.interpolationType=void 0!==c?c:THREE.AnimationHandler.LINEAR;this.JITCompile=void 0!==d?d:!0;this.points=[];this.target=new THREE.Vector3};
|
|
|
+THREE.Animation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=!0;this.loop=void 0!==a?a:!0;this.currentTime=void 0!==b?b:0;var c,d=this.hierarchy.length,e;for(c=0;c<d;c++){e=this.hierarchy[c];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)e.useQuaternion=!0;e.matrixAutoUpdate=!0;if(void 0===e.animationCache)e.animationCache={},e.animationCache.prevKey={pos:0,rot:0,scl:0},e.animationCache.nextKey={pos:0,rot:0,scl:0},e.animationCache.originalMatrix=e instanceof
|
|
|
+THREE.Bone?e.skinMatrix:e.matrix;var f=e.animationCache.prevKey;e=e.animationCache.nextKey;f.pos=this.data.hierarchy[c].keys[0];f.rot=this.data.hierarchy[c].keys[0];f.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,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()}}};
|
|
|
-THREE.Animation.prototype.interpolateCatmullRom=function(a,b){var c=[],d=[],e,g,f,h,i,k;e=(a.length-1)*b;g=Math.floor(e);e-=g;c[0]=g===0?g:g-1;c[1]=g;c[2]=g>a.length-2?g:g+1;c[3]=g>a.length-3?g:g+2;g=a[c[0]];h=a[c[1]];i=a[c[2]];k=a[c[3]];c=e*e;f=e*c;d[0]=this.interpolate(g[0],h[0],i[0],k[0],e,c,f);d[1]=this.interpolate(g[1],h[1],i[1],k[1],e,c,f);d[2]=this.interpolate(g[2],h[2],i[2],k[2],e,c,f);return d};
|
|
|
-THREE.Animation.prototype.interpolate=function(a,b,c,d,e,g,f){a=(c-a)*0.5;d=(d-b)*0.5;return(2*(b-c)+a+d)*f+(-3*(b-c)-2*a-d)*g+a*e+b};THREE.Animation.prototype.getNextKeyWith=function(a,b,c){var d=this.data.hierarchy[b].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c=c<d.length-1?c:d.length-1:c%=d.length;c<d.length;c++)if(d[c][a]!==void 0)return d[c];return this.data.hierarchy[b].keys[0]};
|
|
|
-THREE.Animation.prototype.getPrevKeyWith=function(a,b,c){for(var d=this.data.hierarchy[b].keys,c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c>0?c:0:c>=0?c:c+d.length;c>=0;c--)if(d[c][a]!==void 0)return d[c];return this.data.hierarchy[b].keys[d.length-1]};
|
|
|
-THREE.KeyFrameAnimation=function(a,b,c){this.root=a;this.data=THREE.AnimationHandler.get(b);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=0.0010;this.isPlaying=!1;this.loop=this.isPaused=!0;this.JITCompile=c!==void 0?c:!0;a=0;for(b=this.hierarchy.length;a<b;a++){var c=this.data.hierarchy[a].sids,d=this.hierarchy[a];if(this.data.hierarchy[a].keys.length&&c){for(var e=0;e<c.length;e++){var g=c[e],f=this.getNextKeyWith(g,a,0);f&&f.apply(g)}d.matrixAutoUpdate=!1;this.data.hierarchy[a].node.updateMatrix();
|
|
|
+THREE.Animation.prototype.stop=function(){this.isPaused=this.isPlaying=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.hierarchy.length;a++)if(void 0!==this.hierarchy[a].animationCache)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,f,g,h,i,k,j=this.data.JIT.hierarchy,o,l;l=this.currentTime+=a*this.timeScale;o=this.currentTime%=this.data.length;k=parseInt(Math.min(o*this.data.fps,this.data.length*this.data.fps),10);for(var n=0,p=this.hierarchy.length;n<p;n++)if(a=this.hierarchy[n],i=a.animationCache,this.JITCompile&&void 0!==j[n][k])a instanceof THREE.Bone?(a.skinMatrix=j[n][k],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=!1):(a.matrix=
|
|
|
+j[n][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 m=0;3>m;m++){c=b[m];g=i.prevKey[c];h=i.nextKey[c];if(h.time<=l){if(o<l)if(this.loop){g=this.data.hierarchy[n].keys[0];for(h=this.getNextKeyWith(c,n,1);h.time<o;)g=h,h=this.getNextKeyWith(c,n,h.index+1)}else{this.stop();return}else{do g=h,h=this.getNextKeyWith(c,n,h.index+1);while(h.time<o)}i.prevKey[c]=
|
|
|
+g;i.nextKey[c]=h}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;d=(o-g.time)/(h.time-g.time);e=g[c];f=h[c];if(0>d||1<d)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+n),d=0>d?0:1;if("pos"===c)if(c=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)c.x=e[0]+(f[0]-e[0])*d,c.y=e[1]+(f[1]-e[1])*d,c.z=e[2]+(f[2]-e[2])*d;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
|
|
|
+this.getPrevKeyWith("pos",n,g.index-1).pos,this.points[1]=e,this.points[2]=f,this.points[3]=this.getNextKeyWith("pos",n,h.index+1).pos,d=0.33*d+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,1.01*d),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("rot"===
|
|
|
+c)THREE.Quaternion.slerp(e,f,a.quaternion,d);else if("scl"===c)c=a.scale,c.x=e[0]+(f[0]-e[0])*d,c.y=e[1]+(f[1]-e[1])*d,c.z=e[2]+(f[2]-e[2])*d}}if(this.JITCompile&&void 0===j[0][k]){this.hierarchy[0].updateMatrixWorld(!0);for(n=0;n<this.hierarchy.length;n++)j[n][k]=this.hierarchy[n]instanceof THREE.Bone?this.hierarchy[n].skinMatrix.clone():this.hierarchy[n].matrix.clone()}}};
|
|
|
+THREE.Animation.prototype.interpolateCatmullRom=function(a,b){var c=[],d=[],e,f,g,h,i,k;e=(a.length-1)*b;f=Math.floor(e);e-=f;c[0]=0===f?f:f-1;c[1]=f;c[2]=f>a.length-2?f:f+1;c[3]=f>a.length-3?f:f+2;f=a[c[0]];h=a[c[1]];i=a[c[2]];k=a[c[3]];c=e*e;g=e*c;d[0]=this.interpolate(f[0],h[0],i[0],k[0],e,c,g);d[1]=this.interpolate(f[1],h[1],i[1],k[1],e,c,g);d[2]=this.interpolate(f[2],h[2],i[2],k[2],e,c,g);return d};
|
|
|
+THREE.Animation.prototype.interpolate=function(a,b,c,d,e,f,g){a=0.5*(c-a);d=0.5*(d-b);return(2*(b-c)+a+d)*g+(-3*(b-c)-2*a-d)*f+a*e+b};THREE.Animation.prototype.getNextKeyWith=function(a,b,c){for(var d=this.data.hierarchy[b].keys,c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c<d.length-1?c:d.length-1:c%d.length;c<d.length;c++)if(void 0!==d[c][a])return d[c];return this.data.hierarchy[b].keys[0]};
|
|
|
+THREE.Animation.prototype.getPrevKeyWith=function(a,b,c){for(var d=this.data.hierarchy[b].keys,c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?0<c?c:0:0<=c?c:c+d.length;0<=c;c--)if(void 0!==d[c][a])return d[c];return this.data.hierarchy[b].keys[d.length-1]};
|
|
|
+THREE.KeyFrameAnimation=function(a,b,c){this.root=a;this.data=THREE.AnimationHandler.get(b);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=0.0010;this.isPlaying=!1;this.loop=this.isPaused=!0;this.JITCompile=void 0!==c?c:!0;a=0;for(b=this.hierarchy.length;a<b;a++){var c=this.data.hierarchy[a].sids,d=this.hierarchy[a];if(this.data.hierarchy[a].keys.length&&c){for(var e=0;e<c.length;e++){var f=c[e],g=this.getNextKeyWith(f,a,0);g&&g.apply(f)}d.matrixAutoUpdate=!1;this.data.hierarchy[a].node.updateMatrix();
|
|
|
d.matrixWorldNeedsUpdate=!0}}};
|
|
|
-THREE.KeyFrameAnimation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=!0;this.loop=a!==void 0?a:!0;this.currentTime=b!==void 0?b:0;this.startTimeMs=b;this.startTime=1E7;this.endTime=-this.startTime;var c,d=this.hierarchy.length,e,g;for(c=0;c<d;c++){e=this.hierarchy[c];g=this.data.hierarchy[c];e.useQuaternion=!0;if(g.animationCache===void 0)g.animationCache={},g.animationCache.prevKey=null,g.animationCache.nextKey=null,g.animationCache.originalMatrix=e instanceof THREE.Bone?e.skinMatrix:
|
|
|
-e.matrix;e=this.data.hierarchy[c].keys;if(e.length)g.animationCache.prevKey=e[0],g.animationCache.nextKey=e[1],this.startTime=Math.min(e[0].time,this.startTime),this.endTime=Math.max(e[e.length-1].time,this.endTime)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};THREE.KeyFrameAnimation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
|
|
|
-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 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.KeyFrameAnimation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=!0;this.loop=void 0!==a?a:!0;this.currentTime=void 0!==b?b:0;this.startTimeMs=b;this.startTime=1E7;this.endTime=-this.startTime;var c,d=this.hierarchy.length,e,f;for(c=0;c<d;c++){e=this.hierarchy[c];f=this.data.hierarchy[c];e.useQuaternion=!0;if(void 0===f.animationCache)f.animationCache={},f.animationCache.prevKey=null,f.animationCache.nextKey=null,f.animationCache.originalMatrix=e instanceof THREE.Bone?e.skinMatrix:
|
|
|
+e.matrix;e=this.data.hierarchy[c].keys;if(e.length)f.animationCache.prevKey=e[0],f.animationCache.nextKey=e[1],this.startTime=Math.min(e[0].time,this.startTime),this.endTime=Math.max(e[e.length-1].time,this.endTime)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};THREE.KeyFrameAnimation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
|
|
|
+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(void 0!==b.animationCache){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,f=this.data.JIT.hierarchy,g,h,i;h=this.currentTime+=a*this.timeScale;g=this.currentTime%=this.data.length;if(g<this.startTimeMs)g=this.currentTime=this.startTimeMs+g;e=parseInt(Math.min(g*this.data.fps,this.data.length*this.data.fps),10);if((i=g<h)&&!this.loop){for(var a=0,k=this.hierarchy.length;a<k;a++){var j=this.data.hierarchy[a].keys,f=this.data.hierarchy[a].sids;d=j.length-1;e=this.hierarchy[a];if(j.length){for(j=
|
|
|
+0;j<f.length;j++)g=f[j],(h=this.getPrevKeyWith(g,a,d))&&h.apply(g);this.data.hierarchy[a].node.updateMatrix();e.matrixWorldNeedsUpdate=!0}}this.stop()}else if(!(g<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,o=b.animationCache;if(this.JITCompile&&void 0!==f[a][e])d instanceof THREE.Bone?(d.skinMatrix=f[a][e],d.matrixWorldNeedsUpdate=!1):(d.matrix=f[a][e],d.matrixWorldNeedsUpdate=!0);else if(j.length){if(this.JITCompile&&o)d instanceof
|
|
|
+THREE.Bone?d.skinMatrix=o.originalMatrix:d.matrix=o.originalMatrix;b=o.prevKey;c=o.nextKey;if(b&&c){if(c.time<=h){if(i&&this.loop){b=j[0];for(c=j[1];c.time<g;)b=c,c=j[b.index+1]}else if(!i)for(var l=j.length-1;c.time<g&&c.index!==l;)b=c,c=j[b.index+1];o.prevKey=b;o.nextKey=c}b.interpolate(c,g)}this.data.hierarchy[a].node.updateMatrix();d.matrixWorldNeedsUpdate=!0}}if(this.JITCompile&&void 0===f[0][e]){this.hierarchy[0].updateMatrixWorld(!0);for(a=0;a<this.hierarchy.length;a++)f[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=0<=c?c:c+b.length;0<=c;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=
|
|
|
new THREE.Vector3(0,0,0);this.renderTarget=new THREE.WebGLRenderTargetCube(d,d,{format:THREE.RGBFormat,magFilter:THREE.LinearFilter,minFilter:THREE.LinearFilter});this.updatePosition=function(a){this.position.copy(a);this.position.y+=this.heightOffset;this.targetPX.copy(this.position);this.targetNX.copy(this.position);this.targetPY.copy(this.position);this.targetNY.copy(this.position);this.targetPZ.copy(this.position);this.targetNZ.copy(this.position);this.targetPX.x+=1;this.targetNX.x-=1;this.targetPY.y+=
|
|
|
1;this.targetNY.y-=1;this.targetPZ.z+=1;this.targetNZ.z-=1;this.cameraPX.lookAt(this.targetPX);this.cameraNX.lookAt(this.targetNX);this.cameraPY.lookAt(this.targetPY);this.cameraNY.lookAt(this.targetNY);this.cameraPZ.lookAt(this.targetPZ);this.cameraNZ.lookAt(this.targetNZ)};this.updateCubeMap=function(a,b){var c=this.renderTarget;c.activeCubeFace=0;a.render(b,this.cameraPX,c);c.activeCubeFace=1;a.render(b,this.cameraNX,c);c.activeCubeFace=2;a.render(b,this.cameraPY,c);c.activeCubeFace=3;a.render(b,
|
|
|
this.cameraNY,c);c.activeCubeFace=4;a.render(b,this.cameraPZ,c);c.activeCubeFace=5;a.render(b,this.cameraNZ,c)}};THREE.FirstPersonCamera=function(){console.warn("DEPRECATED: FirstPersonCamera() is FirstPersonControls().")};THREE.PathCamera=function(){console.warn("DEPRECATED: PathCamera() is PathControls().")};THREE.FlyCamera=function(){console.warn("DEPRECATED: FlyCamera() is FlyControls().")};THREE.RollCamera=function(){console.warn("DEPRECATED: RollCamera() is RollControls().")};
|
|
|
-THREE.TrackballCamera=function(){console.warn("DEPRECATED: TrackballCamera() is TrackballControls().")};THREE.CombinedCamera=function(a,b,c,d,e,g,f){THREE.Camera.call(this);this.fov=c;this.left=-a/2;this.right=a/2;this.top=b/2;this.bottom=-b/2;this.cameraO=new THREE.OrthographicCamera(a/-2,a/2,b/2,b/-2,g,f);this.cameraP=new THREE.PerspectiveCamera(c,a/b,d,e);this.zoom=1;this.toPerspective()};THREE.CombinedCamera.prototype=new THREE.Camera;THREE.CombinedCamera.prototype.constructor=THREE.CoolCamera;
|
|
|
+THREE.TrackballCamera=function(){console.warn("DEPRECATED: TrackballCamera() is TrackballControls().")};THREE.CombinedCamera=function(a,b,c,d,e,f,g){THREE.Camera.call(this);this.fov=c;this.left=-a/2;this.right=a/2;this.top=b/2;this.bottom=-b/2;this.cameraO=new THREE.OrthographicCamera(a/-2,a/2,b/2,b/-2,f,g);this.cameraP=new THREE.PerspectiveCamera(c,a/b,d,e);this.zoom=1;this.toPerspective()};THREE.CombinedCamera.prototype=new THREE.Camera;THREE.CombinedCamera.prototype.constructor=THREE.CoolCamera;
|
|
|
THREE.CombinedCamera.prototype.toPerspective=function(){this.near=this.cameraP.near;this.far=this.cameraP.far;this.cameraP.fov=this.fov/this.zoom;this.cameraP.updateProjectionMatrix();this.projectionMatrix=this.cameraP.projectionMatrix;this.inPersepectiveMode=!0;this.inOrthographicMode=!1};
|
|
|
-THREE.CombinedCamera.prototype.toOrthographic=function(){var a=Math.tan(this.fov/2)*((this.cameraP.near+this.cameraP.far)/2),b=2*a*this.cameraP.aspect/2;a/=this.zoom;b/=this.zoom;this.cameraO.left=-b;this.cameraO.right=b;this.cameraO.top=a;this.cameraO.bottom=-a;this.cameraO.updateProjectionMatrix();this.near=this.cameraO.near;this.far=this.cameraO.far;this.projectionMatrix=this.cameraO.projectionMatrix;this.inPersepectiveMode=!1;this.inOrthographicMode=!0};
|
|
|
-THREE.CombinedCamera.prototype.setFov=function(a){this.fov=a;this.inPersepectiveMode?this.toPerspective():this.toOrthographic()};THREE.CombinedCamera.prototype.setLens=function(a,b){b||(b=43.25);var c=2*Math.atan(b/(a*2));c*=180/Math.PI;this.setFov(c);return c};THREE.CombinedCamera.prototype.setZoom=function(a){this.zoom=a;this.inPersepectiveMode?this.toPerspective():this.toOrthographic()};
|
|
|
+THREE.CombinedCamera.prototype.toOrthographic=function(){var a=this.cameraP.aspect,b=(this.cameraP.near+this.cameraP.far)/2,b=Math.tan(this.fov/2)*b,a=2*b*a/2,b=b/this.zoom,a=a/this.zoom;this.cameraO.left=-a;this.cameraO.right=a;this.cameraO.top=b;this.cameraO.bottom=-b;this.cameraO.updateProjectionMatrix();this.near=this.cameraO.near;this.far=this.cameraO.far;this.projectionMatrix=this.cameraO.projectionMatrix;this.inPersepectiveMode=!1;this.inOrthographicMode=!0};
|
|
|
+THREE.CombinedCamera.prototype.setFov=function(a){this.fov=a;this.inPersepectiveMode?this.toPerspective():this.toOrthographic()};THREE.CombinedCamera.prototype.setLens=function(a,b){b||(b=43.25);var c=2*Math.atan(b/(2*a)),c=180/Math.PI*c;this.setFov(c);return c};THREE.CombinedCamera.prototype.setZoom=function(a){this.zoom=a;this.inPersepectiveMode?this.toPerspective():this.toOrthographic()};
|
|
|
THREE.CombinedCamera.prototype.toFrontView=function(){this.rotation.x=0;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toBackView=function(){this.rotation.x=0;this.rotation.y=Math.PI;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toLeftView=function(){this.rotation.x=0;this.rotation.y=-Math.PI/2;this.rotation.z=0;this.rotationAutoUpdate=!1};
|
|
|
THREE.CombinedCamera.prototype.toRightView=function(){this.rotation.x=0;this.rotation.y=Math.PI/2;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toTopView=function(){this.rotation.x=-Math.PI/2;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toBottomView=function(){this.rotation.x=Math.PI/2;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};
|
|
|
-THREE.FirstPersonControls=function(a,b){function c(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.target=new THREE.Vector3(0,0,0);this.domElement=b!==void 0?b:document;this.movementSpeed=1;this.lookSpeed=0.0050;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=Math.PI;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=this.autoSpeedFactor=
|
|
|
+THREE.FirstPersonControls=function(a,b){function c(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.target=new THREE.Vector3(0,0,0);this.domElement=void 0!==b?b:document;this.movementSpeed=1;this.lookSpeed=0.0050;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=Math.PI;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=this.autoSpeedFactor=
|
|
|
0;this.mouseDragOn=this.freeze=this.moveRight=this.moveLeft=this.moveBackward=this.moveForward=!1;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));this.onMouseDown=function(a){this.domElement!==document&&this.domElement.focus();a.preventDefault();a.stopPropagation();if(this.activeLook)switch(a.button){case 0:this.moveForward=
|
|
|
!0;break;case 2:this.moveBackward=!0}this.mouseDragOn=!0};this.onMouseUp=function(a){a.preventDefault();a.stopPropagation();if(this.activeLook)switch(a.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}this.mouseDragOn=!1};this.onMouseMove=function(a){this.domElement===document?(this.mouseX=a.pageX-this.viewHalfX,this.mouseY=a.pageY-this.viewHalfY):(this.mouseX=a.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=a.pageY-this.domElement.offsetTop-this.viewHalfY)};this.onKeyDown=
|
|
|
function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!0;break;case 37:case 65:this.moveLeft=!0;break;case 40:case 83:this.moveBackward=!0;break;case 39:case 68:this.moveRight=!0;break;case 82:this.moveUp=!0;break;case 70:this.moveDown=!0;break;case 81:this.freeze=!this.freeze}};this.onKeyUp=function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!1;break;case 37:case 65:this.moveLeft=!1;break;case 40:case 83:this.moveBackward=!1;break;case 39:case 68:this.moveRight=!1;break;case 82:this.moveUp=
|
|
@@ -121,232 +121,230 @@ 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,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;
|
|
|
-a=this.verticalAngleMap.dstRange;b=THREE.Math.mapLinear(this.phi,b[0],b[1],a[0],a[1]);var d=a[1]-a[0];this.phi=c((b-a[0])/d)*d+a[0];b=this.horizontalAngleMap.srcRange;a=this.horizontalAngleMap.dstRange;b=THREE.Math.mapLinear(this.theta,b[0],b[1],a[0],a[1]);d=a[1]-a[0];this.theta=c((b-a[0])/d)*d+a[0];a=this.target.position;a.x=100*Math.sin(this.phi)*Math.cos(this.theta);a.y=100*Math.cos(this.phi);a.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.object.lookAt(this.target.position)};this.onMouseMove=
|
|
|
-function(a){this.domElement===document?(this.mouseX=a.pageX-this.viewHalfX,this.mouseY=a.pageY-this.viewHalfY):(this.mouseX=a.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=a.pageY-this.domElement.offsetTop-this.viewHalfY)};this.init=function(){this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){var a=new THREE.MeshLambertMaterial({color:30719}),b=new THREE.MeshLambertMaterial({color:65280}),
|
|
|
-c=new THREE.CubeGeometry(10,10,20),f=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(c,a);a=new THREE.Mesh(f,b);a.position.set(0,10,0);this.animation=e(this.animationParent,this.spline,this.id,this.duration);this.animationParent.add(this.object);this.animationParent.add(this.target);this.animationParent.add(a)}else this.animation=e(this.animationParent,this.spline,this.id,this.duration),this.animationParent.add(this.target),this.animationParent.add(this.object);if(this.createDebugPath){var a=
|
|
|
-this.debugPath,b=this.spline,f=g(b,10),c=g(b,10),h=new THREE.LineBasicMaterial({color:16711680,linewidth:3}),f=new THREE.Line(f,h),c=new THREE.ParticleSystem(c,new THREE.ParticleBasicMaterial({color:16755200,size:3}));f.scale.set(1,1,1);a.add(f);c.scale.set(1,1,1);a.add(c);for(var f=new THREE.SphereGeometry(1,16,8),h=new THREE.MeshBasicMaterial({color:65280}),m=0;m<b.points.length;m++)c=new THREE.Mesh(f,h),c.position.copy(b.points[m]),a.add(c)}this.domElement.addEventListener("mousemove",d(this,this.onMouseMove),
|
|
|
+THREE.PathControls=function(a,b){function c(a){return 1>(a*=2)?0.5*a*a:-0.5*(--a*(a-2)-1)}function d(a,b){return function(){b.apply(a,arguments)}}function e(a,b,c,d){var e={name:c,fps:0.6,length:d,hierarchy:[]},f,g=b.getControlPointsArray(),h=b.getLength(),q=g.length,r=0;f=q-1;b={parent:-1,keys:[]};b.keys[0]={time:0,pos:g[0],rot:[0,0,0,1],scl:[1,1,1]};b.keys[f]={time:d,pos:g[f],rot:[0,0,0,1],scl:[1,1,1]};for(f=1;f<q-1;f++)r=d*h.chunks[f]/h.total,b.keys[f]={time:r,pos:g[f]};e.hierarchy[0]=b;THREE.AnimationHandler.add(e);
|
|
|
+return new THREE.Animation(a,c,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function f(a,b){var c,d,e=new THREE.Geometry;for(c=0;c<a.points.length*b;c++)d=c/(a.points.length*b),d=a.getPoint(d),e.vertices[c]=new THREE.Vertex(new THREE.Vector3(d.x,d.y,d.z));return e}this.object=a;this.domElement=void 0!==b?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 g=2*Math.PI,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%g;this.phi=0<=a?a:a+g;b=this.verticalAngleMap.srcRange;a=this.verticalAngleMap.dstRange;
|
|
|
+b=THREE.Math.mapLinear(this.phi,b[0],b[1],a[0],a[1]);var d=a[1]-a[0];this.phi=c((b-a[0])/d)*d+a[0];b=this.horizontalAngleMap.srcRange;a=this.horizontalAngleMap.dstRange;b=THREE.Math.mapLinear(this.theta,b[0],b[1],a[0],a[1]);d=a[1]-a[0];this.theta=c((b-a[0])/d)*d+a[0];a=this.target.position;a.x=100*Math.sin(this.phi)*Math.cos(this.theta);a.y=100*Math.cos(this.phi);a.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.object.lookAt(this.target.position)};this.onMouseMove=function(a){this.domElement===
|
|
|
+document?(this.mouseX=a.pageX-this.viewHalfX,this.mouseY=a.pageY-this.viewHalfY):(this.mouseX=a.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=a.pageY-this.domElement.offsetTop-this.viewHalfY)};this.init=function(){this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){var a=new THREE.MeshLambertMaterial({color:30719}),b=new THREE.MeshLambertMaterial({color:65280}),
|
|
|
+c=new THREE.CubeGeometry(10,10,20),g=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(c,a);a=new THREE.Mesh(g,b);a.position.set(0,10,0);this.animation=e(this.animationParent,this.spline,this.id,this.duration);this.animationParent.add(this.object);this.animationParent.add(this.target);this.animationParent.add(a)}else this.animation=e(this.animationParent,this.spline,this.id,this.duration),this.animationParent.add(this.target),this.animationParent.add(this.object);if(this.createDebugPath){var a=
|
|
|
+this.debugPath,b=this.spline,g=f(b,10),c=f(b,10),h=new THREE.LineBasicMaterial({color:16711680,linewidth:3}),g=new THREE.Line(g,h),c=new THREE.ParticleSystem(c,new THREE.ParticleBasicMaterial({color:16755200,size:3}));g.scale.set(1,1,1);a.add(g);c.scale.set(1,1,1);a.add(c);for(var g=new THREE.SphereGeometry(1,16,8),h=new THREE.MeshBasicMaterial({color:65280}),n=0;n<b.points.length;n++)c=new THREE.Mesh(g,h),c.position.copy(b.points[n]),a.add(c)}this.domElement.addEventListener("mousemove",d(this,this.onMouseMove),
|
|
|
!1)}};THREE.PathControlsIdCounter=0;
|
|
|
-THREE.FlyControls=function(a,b){function c(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.domElement=b!==void 0?b:document;b&&this.domElement.setAttribute("tabindex",-1);this.movementSpeed=1;this.rollSpeed=0.0050;this.autoForward=this.dragToLook=!1;this.object.useQuaternion=!0;this.tmpQuaternion=new THREE.Quaternion;this.mouseStatus=0;this.moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0};this.moveVector=new THREE.Vector3(0,
|
|
|
-0,0);this.rotationVector=new THREE.Vector3(0,0,0);this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.keydown=function(a){if(!a.altKey){switch(a.keyCode){case 16:this.movementSpeedMultiplier=0.1;break;case 87:this.moveState.forward=1;break;case 83:this.moveState.back=1;break;case 65:this.moveState.left=1;break;case 68:this.moveState.right=1;break;case 82:this.moveState.up=1;break;case 70:this.moveState.down=1;break;case 38:this.moveState.pitchUp=1;break;case 40:this.moveState.pitchDown=
|
|
|
+THREE.FlyControls=function(a,b){function c(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.domElement=void 0!==b?b:document;b&&this.domElement.setAttribute("tabindex",-1);this.movementSpeed=1;this.rollSpeed=0.0050;this.autoForward=this.dragToLook=!1;this.object.useQuaternion=!0;this.tmpQuaternion=new THREE.Quaternion;this.mouseStatus=0;this.moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0};this.moveVector=new THREE.Vector3(0,
|
|
|
+0,0);this.rotationVector=new THREE.Vector3(0,0,0);this.handleEvent=function(a){if("function"==typeof this[a.type])this[a.type](a)};this.keydown=function(a){if(!a.altKey){switch(a.keyCode){case 16:this.movementSpeedMultiplier=0.1;break;case 87:this.moveState.forward=1;break;case 83:this.moveState.back=1;break;case 65:this.moveState.left=1;break;case 68:this.moveState.right=1;break;case 82:this.moveState.up=1;break;case 70:this.moveState.down=1;break;case 38:this.moveState.pitchUp=1;break;case 40:this.moveState.pitchDown=
|
|
|
1;break;case 37:this.moveState.yawLeft=1;break;case 39:this.moveState.yawRight=1;break;case 81:this.moveState.rollLeft=1;break;case 69:this.moveState.rollRight=1}this.updateMovementVector();this.updateRotationVector()}};this.keyup=function(a){switch(a.keyCode){case 16:this.movementSpeedMultiplier=1;break;case 87:this.moveState.forward=0;break;case 83:this.moveState.back=0;break;case 65:this.moveState.left=0;break;case 68:this.moveState.right=0;break;case 82:this.moveState.up=0;break;case 70:this.moveState.down=
|
|
|
0;break;case 38:this.moveState.pitchUp=0;break;case 40:this.moveState.pitchDown=0;break;case 37:this.moveState.yawLeft=0;break;case 39:this.moveState.yawRight=0;break;case 81:this.moveState.rollLeft=0;break;case 69:this.moveState.rollRight=0}this.updateMovementVector();this.updateRotationVector()};this.mousedown=function(a){this.domElement!==document&&this.domElement.focus();a.preventDefault();a.stopPropagation();if(this.dragToLook)this.mouseStatus++;else switch(a.button){case 0:this.object.moveForward=
|
|
|
-!0;break;case 2:this.object.moveBackward=!0}};this.mousemove=function(a){if(!this.dragToLook||this.mouseStatus>0){var b=this.getContainerDimensions(),c=b.size[0]/2,f=b.size[1]/2;this.moveState.yawLeft=-(a.pageX-b.offset[0]-c)/c;this.moveState.pitchDown=(a.pageY-b.offset[1]-f)/f;this.updateRotationVector()}};this.mouseup=function(a){a.preventDefault();a.stopPropagation();if(this.dragToLook)this.mouseStatus--,this.moveState.yawLeft=this.moveState.pitchDown=0;else switch(a.button){case 0:this.moveForward=
|
|
|
-!1;break;case 2:this.moveBackward=!1}this.updateRotationVector()};this.update=function(a){var b=a*this.movementSpeed;a*=this.rollSpeed;this.object.translateX(this.moveVector.x*b);this.object.translateY(this.moveVector.y*b);this.object.translateZ(this.moveVector.z*b);this.tmpQuaternion.set(this.rotationVector.x*a,this.rotationVector.y*a,this.rotationVector.z*a,1).normalize();this.object.quaternion.multiplySelf(this.tmpQuaternion);this.object.matrix.setPosition(this.object.position);this.object.matrix.setRotationFromQuaternion(this.object.quaternion);
|
|
|
+!0;break;case 2:this.object.moveBackward=!0}};this.mousemove=function(a){if(!this.dragToLook||0<this.mouseStatus){var b=this.getContainerDimensions(),c=b.size[0]/2,g=b.size[1]/2;this.moveState.yawLeft=-(a.pageX-b.offset[0]-c)/c;this.moveState.pitchDown=(a.pageY-b.offset[1]-g)/g;this.updateRotationVector()}};this.mouseup=function(a){a.preventDefault();a.stopPropagation();if(this.dragToLook)this.mouseStatus--,this.moveState.yawLeft=this.moveState.pitchDown=0;else switch(a.button){case 0:this.moveForward=
|
|
|
+!1;break;case 2:this.moveBackward=!1}this.updateRotationVector()};this.update=function(a){var b=a*this.movementSpeed,a=a*this.rollSpeed;this.object.translateX(this.moveVector.x*b);this.object.translateY(this.moveVector.y*b);this.object.translateZ(this.moveVector.z*b);this.tmpQuaternion.set(this.rotationVector.x*a,this.rotationVector.y*a,this.rotationVector.z*a,1).normalize();this.object.quaternion.multiplySelf(this.tmpQuaternion);this.object.matrix.setPosition(this.object.position);this.object.matrix.setRotationFromQuaternion(this.object.quaternion);
|
|
|
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,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;
|
|
|
+THREE.RollControls=function(a,b){this.object=a;this.domElement=void 0!==b?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,f=new THREE.Matrix4,g=!1,h=1,i=0,k=0,j=0,o=0,l=0,n=window.innerWidth/2,p=window.innerHeight/2;this.update=function(a){if(this.mouseLook){var b=a*this.lookSpeed;
|
|
|
+this.rotateHorizontally(b*o);this.rotateVertically(b*l)}b=a*this.movementSpeed;this.object.translateZ(-b*(0<i||this.autoForward&&!(0>i)?1:i));this.object.translateX(b*k);this.object.translateY(b*j);g&&(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;f.identity();f.n11=Math.cos(this.roll);f.n12=-Math.sin(this.roll);f.n21=Math.sin(this.roll);f.n22=Math.cos(this.roll);this.object.matrix.multiplySelf(f);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;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,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=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,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;
|
|
|
+function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){o=(a.clientX-n)/window.innerWidth;l=(a.clientY-p)/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:g=!0;h=1;break;case 69:g=!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:g=!1;break;case 69:g=!1;break;case 82:j=0;break;case 70:j=0}},!1)};
|
|
|
+THREE.TrackballControls=function(a,b){var c=this;this.object=a;this.domElement=void 0!==b?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 d=!1,e=-1,f=new THREE.Vector3,g=new THREE.Vector3,h=new THREE.Vector3,i=new THREE.Vector2,k=new THREE.Vector2,j=new THREE.Vector2,o=new THREE.Vector2;this.handleEvent=function(a){if("function"==typeof this[a.type])this[a.type](a)};this.getMouseOnScreen=function(a,b){return new THREE.Vector2(0.5*((a-c.screen.offsetLeft)/c.radius),0.5*((b-c.screen.offsetTop)/c.radius))};this.getMouseProjectionOnBall=function(a,b){var d=new THREE.Vector3((a-0.5*c.screen.width-c.screen.offsetLeft)/c.radius,(0.5*
|
|
|
+c.screen.height+c.screen.offsetTop-b)/c.radius,0),e=d.length();1<e?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(g.dot(h)/g.length()/h.length());if(a){var b=(new THREE.Vector3).cross(g,h).normalize(),d=new THREE.Quaternion,a=a*c.rotateSpeed;d.setFromAxisAngle(b,-a);d.multiplyVector3(f);d.multiplyVector3(c.object.up);
|
|
|
+d.multiplyVector3(h);c.staticMoving?g=h:(d.setFromAxisAngle(b,a*(c.dynamicDampingFactor-1)),d.multiplyVector3(g))}};this.zoomCamera=function(){var a=1+(k.y-i.y)*c.zoomSpeed;1!==a&&0<a&&(f.multiplyScalar(a),c.staticMoving?i=k:i.y+=(k.y-i.y)*this.dynamicDampingFactor)};this.panCamera=function(){var a=o.clone().subSelf(j);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?j=o:j.addSelf(a.sub(o,j).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&&(d&&(g=h=c.getMouseProjectionOnBall(a.clientX,a.clientY),i=k=c.getMouseOnScreen(a.clientX,a.clientY),j=o=c.getMouseOnScreen(a.clientX,a.clientY),d=!1),-1!==e&&(0===e&&!c.noRotate?h=c.getMouseProjectionOnBall(a.clientX,a.clientY):1===e&&!c.noZoom?k=c.getMouseOnScreen(a.clientX,
|
|
|
+a.clientY):2===e&&!c.noPan&&(o=c.getMouseOnScreen(a.clientX,a.clientY))))},!1);this.domElement.addEventListener("mousedown",function(a){if(c.enabled&&(a.preventDefault(),a.stopPropagation(),-1===e))e=a.button,0===e&&!c.noRotate?g=h=c.getMouseProjectionOnBall(a.clientX,a.clientY):1===e&&!c.noZoom?i=k=c.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(j=o=c.getMouseOnScreen(a.clientX,a.clientY))},!1);this.domElement.addEventListener("mouseup",function(a){c.enabled&&(a.preventDefault(),a.stopPropagation(),
|
|
|
+e=-1)},!1);window.addEventListener("keydown",function(a){c.enabled&&-1===e&&(a.keyCode===c.keys[0]&&!c.noRotate?e=0:a.keyCode===c.keys[1]&&!c.noZoom?e=1:a.keyCode===c.keys[2]&&!c.noPan&&(e=2),-1!==e&&(d=!0))},!1);window.addEventListener("keyup",function(){c.enabled&&-1!==e&&(e=-1)},!1)};
|
|
|
+THREE.CubeGeometry=function(a,b,c,d,e,f,g,h){function i(a,b,c,g,h,i,j,o){var l,m=d||1,n=e||1,p=h/2,r=i/2,q=k.vertices.length;if("x"===a&&"y"===b||"y"===a&&"x"===b)l="z";else if("x"===a&&"z"===b||"z"===a&&"x"===b)l="y",n=f||1;else if("z"===a&&"y"===b||"y"===a&&"z"===b)l="x",m=f||1;var s=m+1,t=n+1,C=h/m,L=i/n,N=new THREE.Vector3;N[l]=0<j?1:-1;for(h=0;h<t;h++)for(i=0;i<s;i++){var M=new THREE.Vector3;M[a]=(i*C-p)*c;M[b]=(h*L-r)*g;M[l]=j;k.vertices.push(new THREE.Vertex(M))}for(h=0;h<n;h++)for(i=0;i<m;i++)a=
|
|
|
+new THREE.Face4(i+s*h+q,i+s*(h+1)+q,i+1+s*(h+1)+q,i+1+s*h+q),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/m,h/n),new THREE.UV(i/m,(h+1)/n),new THREE.UV((i+1)/m,(h+1)/n),new THREE.UV((i+1)/m,h/n)])}THREE.Geometry.call(this);var k=this,j=a/2,o=b/2,l=c/2,n,p,m,q,r,t;if(void 0!==g){if(g instanceof Array)this.materials=g;else{this.materials=[];for(n=0;6>n;n++)this.materials.push(g)}n=0;q=1;p=2;r=
|
|
|
+3;m=4;t=5}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(void 0!=h)for(var s in h)void 0!==this.sides[s]&&(this.sides[s]=h[s]);this.sides.px&&i("z","y",-1,-1,c,b,j,n);this.sides.nx&&i("z","y",1,-1,c,b,-j,q);this.sides.py&&i("x","z",1,1,a,c,o,p);this.sides.ny&&i("x","z",1,-1,a,c,-o,r);this.sides.pz&&i("x","y",1,-1,a,b,l,m);this.sides.nz&&i("x","y",-1,-1,a,b,-l,t);this.computeCentroids();this.mergeVertices()};THREE.CubeGeometry.prototype=new THREE.Geometry;
|
|
|
THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
|
|
|
-THREE.CylinderGeometry=function(a,b,c,d,e,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.CylinderGeometry=function(a,b,c,d,e,f){THREE.Geometry.call(this);var a=void 0!==a?a:20,b=void 0!==b?b:20,c=void 0!==c?c:100,g=c/2,d=d||8,e=e||1,h,i,k=[],j=[];for(i=0;i<=e;i++){var o=[],l=[],n=i/e,p=n*(b-a)+a;for(h=0;h<=d;h++){var m=h/d,q=p*Math.sin(2*m*Math.PI),r=-n*c+g,t=p*Math.cos(2*m*Math.PI);this.vertices.push(new THREE.Vertex(new THREE.Vector3(q,r,t)));o.push(this.vertices.length-1);l.push(new THREE.UV(m,n))}k.push(o);j.push(l)}for(i=0;i<e;i++)for(h=0;h<d;h++){var c=k[i][h],o=k[i+1][h],
|
|
|
+l=k[i+1][h+1],n=k[i][h+1],p=this.vertices[c].position.clone().setY(0).normalize(),m=this.vertices[o].position.clone().setY(0).normalize(),q=this.vertices[l].position.clone().setY(0).normalize(),r=this.vertices[n].position.clone().setY(0).normalize(),t=j[i][h].clone(),s=j[i+1][h].clone(),v=j[i+1][h+1].clone(),u=j[i][h+1].clone();this.faces.push(new THREE.Face4(c,o,l,n,[p,m,q,r]));this.faceVertexUvs[0].push([t,s,v,u])}if(!f&&0<a){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,g,0)));for(h=
|
|
|
+0;h<d;h++)c=k[0][h],o=k[0][h+1],l=this.vertices.length-1,p=new THREE.Vector3(0,1,0),m=new THREE.Vector3(0,1,0),q=new THREE.Vector3(0,1,0),t=j[0][h].clone(),s=j[0][h+1].clone(),v=new THREE.UV(s.u,0),this.faces.push(new THREE.Face3(c,o,l,[p,m,q])),this.faceVertexUvs[0].push([t,s,v])}if(!f&&0<b){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-g,0)));for(h=0;h<d;h++)c=k[i][h+1],o=k[i][h],l=this.vertices.length-1,p=new THREE.Vector3(0,-1,0),m=new THREE.Vector3(0,-1,0),q=new THREE.Vector3(0,-1,
|
|
|
+0),t=j[i][h+1].clone(),s=j[i][h].clone(),v=new THREE.UV(s.u,1),this.faces.push(new THREE.Face3(c,o,l,[p,m,q])),this.faceVertexUvs[0].push([t,s,v])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
|
|
|
+THREE.ExtrudeGeometry=function(a,b){if("undefined"!==typeof a){THREE.Geometry.call(this);var a=a instanceof Array?a:[a],c,d,e=a.length;this.shapebb=a[e-1].getBoundingBox();for(d=0;d<e;d++)c=a[d],this.addShape(c,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,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,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;
|
|
|
+h.copy(b).addSelf(g);i.copy(c).addSelf(f);g=d.dot(f);f=i.subSelf(h).dot(f);0===g&&(console.log("Either infinite or no solutions!"),0===f?console.log("Its finite solutions."):console.log("Too bad, no solutions."));f/=g;return 0>f?(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+=2*Math.PI),c=(b+a)/2,a=-Math.cos(c),c=-Math.sin(c),new THREE.Vector2(a,c)):d.multiplyScalar(f).addSelf(h).subSelf(a).clone()}function e(a){for(y=a.length;0<=--y;){C=y;L=y-1;0>L&&(L=a.length-1);for(var b=
|
|
|
+0,c=n+2*j,b=0;b<c;b++){var d=G*b,e=G*(b+1),f=R+C+d,g=R+C+e,k=f,d=R+L+d,e=R+L+e,o=g,k=k+F,d=d+F,e=e+F,o=o+F;A.faces.push(new THREE.Face4(k,d,e,o,null,null,v));void 0!==v&&(k=b/c,d=(b+1)/c,e=h+2*i,f=(A.vertices[f].position.z+i)/e,g=(A.vertices[g].position.z+i)/e,A.faceVertexUvs[0].push([new THREE.UV(f,k),new THREE.UV(g,k),new THREE.UV(g,d),new THREE.UV(f,d)]))}}}function f(a,b,c){A.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function g(a,b,c){a+=F;b+=F;c+=F;A.faces.push(new THREE.Face3(a,
|
|
|
+b,c,null,null,s));if(void 0!==s){var d=u.minX,e=u.minY,f=u.maxY,g=u.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)/g,(A.vertices[a].position.y-e)/f),new THREE.UV(h/g,b/f),new THREE.UV(i/g,c/f)])}}var h=void 0!==b.amount?b.amount:100,i=void 0!==b.bevelThickness?b.bevelThickness:6,k=void 0!==b.bevelSize?b.bevelSize:i-2,j=void 0!==b.bevelSegments?b.bevelSegments:
|
|
|
+3,o=void 0!==b.bevelEnabled?b.bevelEnabled:!0,l=void 0!==b.curveSegments?b.curveSegments:12,n=void 0!==b.steps?b.steps:1,p=b.bendPath,m=b.extrudePath,q,r=!1,t=void 0!==b.useSpacedPoints?b.useSpacedPoints:!1,s=b.material,v=b.extrudeMaterial,u=this.shapebb;if(m)q=m.getPoints(l),n=q.length,r=!0,o=!1;o||(k=i=j=0);var w,z,x,A=this,F=this.vertices.length;p&&a.addWrapPath(p);l=t?a.extractAllSpacedPoints(l):a.extractAllPoints(l);p=l.shape;l=l.holes;if(m=!THREE.Shape.Utils.isClockWise(p)){p=p.reverse();for(z=
|
|
|
+0,x=l.length;z<x;z++)w=l[z],THREE.Shape.Utils.isClockWise(w)&&(l[z]=w.reverse());m=!1}m=THREE.Shape.Utils.triangulateShape(p,l);t=p;for(z=0,x=l.length;z<x;z++)w=l[z],p=p.concat(w);for(var E,I,J,B,G=p.length,D=m.length,H=[],y=0,K=t.length,C=K-1,L=y+1;y<K;y++,C++,L++)C===K&&(C=0),L===K&&(L=0),H[y]=d(t[y],t[C],t[L]);var N=[],M,O=H.concat();for(z=0,x=l.length;z<x;z++){w=l[z];M=[];for(y=0,K=w.length,C=K-1,L=y+1;y<K;y++,C++,L++)C===K&&(C=0),L===K&&(L=0),M[y]=d(w[y],w[C],w[L]);N.push(M);O=O.concat(M)}for(E=
|
|
|
+0;E<j;E++){I=E/j;J=i*(1-I);I=k*Math.sin(I*Math.PI/2);for(y=0,K=t.length;y<K;y++)B=c(t[y],H[y],I),f(B.x,B.y,-J);for(z=0,x=l.length;z<x;z++){w=l[z];M=N[z];for(y=0,K=w.length;y<K;y++)B=c(w[y],M[y],I),f(B.x,B.y,-J)}}I=k;for(y=0;y<G;y++)B=o?c(p[y],O[y],I):p[y],r?f(B.x,B.y+q[0].y,q[0].x):f(B.x,B.y,0);for(E=1;E<=n;E++)for(y=0;y<G;y++)B=o?c(p[y],O[y],I):p[y],r?f(B.x,B.y+q[E-1].y,q[E-1].x):f(B.x,B.y,h/n*E);for(E=j-1;0<=E;E--){I=E/j;J=i*(1-I);I=k*Math.sin(I*Math.PI/2);for(y=0,K=t.length;y<K;y++)B=c(t[y],H[y],
|
|
|
+I),f(B.x,B.y,h+J);for(z=0,x=l.length;z<x;z++){w=l[z];M=N[z];for(y=0,K=w.length;y<K;y++)B=c(w[y],M[y],I),r?f(B.x,B.y+q[n-1].y,q[n-1].x+J):f(B.x,B.y,h+J)}}if(o){o=0*G;for(y=0;y<D;y++)k=m[y],g(k[2]+o,k[1]+o,k[0]+o);o=G*(n+2*j);for(y=0;y<D;y++)k=m[y],g(k[0]+o,k[1]+o,k[2]+o)}else{for(y=0;y<D;y++)k=m[y],g(k[2],k[1],k[0]);for(y=0;y<D;y++)k=m[y],g(k[0]+G*n,k[1]+G*n,k[2]+G*n)}var R=0;e(t);R+=t.length;for(z=0,x=l.length;z<x;z++)w=l[z],e(w),R+=w.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,
|
|
|
-1,7,g);c(0,7,10,g);c(0,10,11,g);c(1,5,9,g);c(5,11,4,g);c(11,10,2,g);c(10,7,6,g);c(7,1,8,g);c(3,9,4,g);c(3,4,2,g);c(3,2,6,g);c(3,6,8,g);c(3,8,9,g);c(4,9,5,g);c(2,4,11,g);c(6,2,10,g);c(8,6,7,g);c(9,8,1,g);for(var f=0;f<this.subdivisions;f++){var a=new THREE.Geometry,h;for(h in g.faces){var i=d(g.faces[h].a,g.faces[h].b),k=d(g.faces[h].b,g.faces[h].c),j=d(g.faces[h].c,g.faces[h].a);c(g.faces[h].a,i,j,a);c(g.faces[h].b,k,i,a);c(g.faces[h].c,j,k,a);c(i,k,j,a)}g.faces=a.faces;g.faceVertexUvs[0]=a.faceVertexUvs[0]}e.faces=
|
|
|
-g.faces;e.faceVertexUvs[0]=g.faceVertexUvs[0];this.computeCentroids();this.computeFaceNormals()};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
|
|
|
-THREE.LatheGeometry=function(a,b,c){THREE.Geometry.call(this);this.steps=b||12;this.angle=c||2*Math.PI;for(var b=this.angle/this.steps,c=[],d=[],e=[],g=[],f=(new THREE.Matrix4).setRotationZ(b),h=0;h<a.length;h++)this.vertices.push(new THREE.Vertex(a[h])),c[h]=a[h].clone(),d[h]=this.vertices.length-1;for(var i=0;i<=this.angle+0.0010;i+=b){for(h=0;h<c.length;h++)i<this.angle?(c[h]=f.multiplyVector3(c[h].clone()),this.vertices.push(new THREE.Vertex(c[h])),e[h]=this.vertices.length-1):e=g;i==0&&(g=d);
|
|
|
+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 f=e.vertices[a].position,g=e.vertices[b].position,h=e.vertices[c].position,a=new THREE.Face3(a,b,c);a.vertexNormals.push(f.clone().normalize(),g.clone().normalize(),h.clone().normalize());d.faces.push(a);d.faceVertexUvs[0].push([new THREE.UV(1-0.5*((Math.atan2(f.z,f.x)+Math.PI)%Math.PI/Math.PI),0.5-f.y/2),new THREE.UV(1-
|
|
|
+0.5*((Math.atan2(g.z,g.x)+Math.PI)%Math.PI/Math.PI),0.5-g.y/2),new THREE.UV(1-0.5*((Math.atan2(h.z,h.x)+Math.PI)%Math.PI/Math.PI),0.5-h.y/2)])}function d(a,c){var d=e.vertices[a].position,f=e.vertices[c].position;return b((d.x+f.x)/2,(d.y+f.y)/2,(d.z+f.z)/2)}var e=this,f=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,f);c(0,5,1,
|
|
|
+f);c(0,1,7,f);c(0,7,10,f);c(0,10,11,f);c(1,5,9,f);c(5,11,4,f);c(11,10,2,f);c(10,7,6,f);c(7,1,8,f);c(3,9,4,f);c(3,4,2,f);c(3,2,6,f);c(3,6,8,f);c(3,8,9,f);c(4,9,5,f);c(2,4,11,f);c(6,2,10,f);c(8,6,7,f);c(9,8,1,f);for(var g=0;g<this.subdivisions;g++){var a=new THREE.Geometry,h;for(h in f.faces){var i=d(f.faces[h].a,f.faces[h].b),k=d(f.faces[h].b,f.faces[h].c),j=d(f.faces[h].c,f.faces[h].a);c(f.faces[h].a,i,j,a);c(f.faces[h].b,k,i,a);c(f.faces[h].c,j,k,a);c(i,k,j,a)}f.faces=a.faces;f.faceVertexUvs[0]=
|
|
|
+a.faceVertexUvs[0]}e.faces=f.faces;e.faceVertexUvs[0]=f.faceVertexUvs[0];this.computeCentroids();this.computeFaceNormals()};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
|
|
|
+THREE.LatheGeometry=function(a,b,c){THREE.Geometry.call(this);this.steps=b||12;this.angle=c||2*Math.PI;for(var b=this.angle/this.steps,c=[],d=[],e=[],f=[],g=(new THREE.Matrix4).setRotationZ(b),h=0;h<a.length;h++)this.vertices.push(new THREE.Vertex(a[h])),c[h]=a[h].clone(),d[h]=this.vertices.length-1;for(var i=0;i<=this.angle+0.0010;i+=b){for(h=0;h<c.length;h++)i<this.angle?(c[h]=g.multiplyVector3(c[h].clone()),this.vertices.push(new THREE.Vertex(c[h])),e[h]=this.vertices.length-1):e=f;0==i&&(f=d);
|
|
|
for(h=0;h<d.length-1;h++)this.faces.push(new THREE.Face4(e[h],e[h+1],d[h+1],d[h])),this.faceVertexUvs[0].push([new THREE.UV(1-i/this.angle,h/a.length),new THREE.UV(1-i/this.angle,(h+1)/a.length),new THREE.UV(1-(i-b)/this.angle,(h+1)/a.length),new THREE.UV(1-(i-b)/this.angle,h/a.length)]);d=e;e=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=new THREE.Geometry;THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry;
|
|
|
-THREE.OctahedronGeometry=function(a,b){function c(b){var c=b.clone().normalize(),c=new THREE.Vertex(c.clone().multiplyScalar(a));c.index=f.vertices.push(c)-1;c.uv=new THREE.UV(Math.atan2(b.z,-b.x)/2/Math.PI+0.5,Math.atan2(-b.y,Math.sqrt(b.x*b.x+b.z*b.z))/Math.PI+0.5);return c}function d(a,b,c,h){h<1?(h=new THREE.Face3(a.index,b.index,c.index,[a.position,b.position,c.position]),h.centroid.addSelf(a.position).addSelf(b.position).addSelf(c.position).divideScalar(3),h.normal=h.centroid.clone().normalize(),
|
|
|
-f.faces.push(h),h=Math.atan2(h.centroid.z,-h.centroid.x),f.faceVertexUvs[0].push([g(a.uv,a.position,h),g(b.uv,b.position,h),g(c.uv,c.position,h)])):(h-=1,d(a,e(a,b),e(a,c),h),d(e(a,b),b,e(b,c),h),d(e(a,c),e(b,c),c,h),d(e(a,b),e(b,c),e(a,c),h))}function e(a,b){h[a.index]||(h[a.index]=[]);h[b.index]||(h[b.index]=[]);var d=h[a.index][b.index];d===void 0&&(h[a.index][b.index]=h[b.index][a.index]=d=c((new THREE.Vector3).add(a.position,b.position).divideScalar(2)));return d}function g(a,b,c){c<0&&a.u===
|
|
|
-1&&(a=new THREE.UV(a.u-1,a.v));b.x===0&&b.z===0&&(a=new THREE.UV(c/2/Math.PI+0.5,a.v));return a}THREE.Geometry.call(this);var b=b||0,f=this;c(new THREE.Vector3(1,0,0));c(new THREE.Vector3(-1,0,0));c(new THREE.Vector3(0,1,0));c(new THREE.Vector3(0,-1,0));c(new THREE.Vector3(0,0,1));c(new THREE.Vector3(0,0,-1));var h=[],i=this.vertices;d(i[0],i[2],i[4],b);d(i[0],i[4],i[3],b);d(i[0],i[3],i[5],b);d(i[0],i[5],i[2],b);d(i[1],i[2],i[5],b);d(i[1],i[5],i[3],b);d(i[1],i[3],i[4],b);d(i[1],i[4],i[2],b);this.boundingSphere=
|
|
|
+THREE.OctahedronGeometry=function(a,b){function c(b){var c=b.clone().normalize(),c=new THREE.Vertex(c.clone().multiplyScalar(a));c.index=g.vertices.push(c)-1;var d=Math.atan2(b.z,-b.x)/2/Math.PI+0.5,b=Math.atan2(-b.y,Math.sqrt(b.x*b.x+b.z*b.z))/Math.PI+0.5;c.uv=new THREE.UV(d,b);return c}function d(a,b,c,h){1>h?(h=new THREE.Face3(a.index,b.index,c.index,[a.position,b.position,c.position]),h.centroid.addSelf(a.position).addSelf(b.position).addSelf(c.position).divideScalar(3),h.normal=h.centroid.clone().normalize(),
|
|
|
+g.faces.push(h),h=Math.atan2(h.centroid.z,-h.centroid.x),g.faceVertexUvs[0].push([f(a.uv,a.position,h),f(b.uv,b.position,h),f(c.uv,c.position,h)])):(h-=1,d(a,e(a,b),e(a,c),h),d(e(a,b),b,e(b,c),h),d(e(a,c),e(b,c),c,h),d(e(a,b),e(b,c),e(a,c),h))}function e(a,b){h[a.index]||(h[a.index]=[]);h[b.index]||(h[b.index]=[]);var d=h[a.index][b.index];void 0===d&&(h[a.index][b.index]=h[b.index][a.index]=d=c((new THREE.Vector3).add(a.position,b.position).divideScalar(2)));return d}function f(a,b,c){0>c&&1===a.u&&
|
|
|
+(a=new THREE.UV(a.u-1,a.v));0===b.x&&0===b.z&&(a=new THREE.UV(c/2/Math.PI+0.5,a.v));return a}THREE.Geometry.call(this);var b=b||0,g=this;c(new THREE.Vector3(1,0,0));c(new THREE.Vector3(-1,0,0));c(new THREE.Vector3(0,1,0));c(new THREE.Vector3(0,-1,0));c(new THREE.Vector3(0,0,1));c(new THREE.Vector3(0,0,-1));var h=[],i=this.vertices;d(i[0],i[2],i[4],b);d(i[0],i[4],i[3],b);d(i[0],i[3],i[5],b);d(i[0],i[5],i[2],b);d(i[1],i[2],i[5],b);d(i[1],i[5],i[3],b);d(i[1],i[3],i[4],b);d(i[1],i[4],i[2],b);this.boundingSphere=
|
|
|
{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/
|
|
|
+THREE.PlaneGeometry=function(a,b,c,d){THREE.Geometry.call(this);for(var e=a/2,f=b/2,c=c||1,d=d||1,g=c+1,h=d+1,i=a/c,k=b/d,j=new THREE.Vector3(0,0,1),a=0;a<h;a++)for(b=0;b<g;b++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(b*i-e,-(a*k-f),0)));for(a=0;a<d;a++)for(b=0;b<c;b++)e=new THREE.Face4(b+g*a,b+g*(a+1),b+1+g*(a+1),b+1+g*a),e.normal.copy(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=[],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.SphereGeometry=function(a,b,c,d,e,f,g){THREE.Geometry.call(this);var a=a||50,d=void 0!==d?d:0,e=void 0!==e?e:2*Math.PI,f=void 0!==f?f:0,g=void 0!==g?g:Math.PI,b=Math.max(3,Math.floor(b)||8),c=Math.max(2,Math.floor(c)||6),h,i,k=[],j=[];for(i=0;i<=c;i++){var o=[],l=[];for(h=0;h<=b;h++){var n=h/b,p=i/c,m=-a*Math.cos(d+n*e)*Math.sin(f+p*g),q=a*Math.cos(f+p*g),r=a*Math.sin(d+n*e)*Math.sin(f+p*g);this.vertices.push(new THREE.Vertex(new THREE.Vector3(m,q,r)));o.push(this.vertices.length-1);l.push(new THREE.UV(n,
|
|
|
+p))}k.push(o);j.push(l)}for(i=0;i<c;i++)for(h=0;h<b;h++){var d=k[i][h+1],e=k[i][h],f=k[i+1][h],g=k[i+1][h+1],o=this.vertices[d].position.clone().normalize(),l=this.vertices[e].position.clone().normalize(),n=this.vertices[f].position.clone().normalize(),p=this.vertices[g].position.clone().normalize(),m=j[i][h+1].clone(),q=j[i][h].clone(),r=j[i+1][h].clone(),t=j[i+1][h+1].clone();Math.abs(this.vertices[d].position.y)==a?(this.faces.push(new THREE.Face3(d,f,g,[o,n,p])),this.faceVertexUvs[0].push([m,
|
|
|
+r,t])):Math.abs(this.vertices[f].position.y)==a?(this.faces.push(new THREE.Face3(d,e,f,[o,l,n])),this.faceVertexUvs[0].push([m,q,r])):(this.faces.push(new THREE.Face4(d,e,f,g,[o,l,n,p])),this.faceVertexUvs[0].push([m,q,r,t]))}this.computeCentroids();this.computeFaceNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=new THREE.Geometry;THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry;
|
|
|
+THREE.TextGeometry=function(a,b){var c=(new THREE.TextPath(a,b)).toShapes();b.amount=void 0!==b.height?b.height:50;if(void 0===b.bevelThickness)b.bevelThickness=10;if(void 0===b.bevelSize)b.bevelSize=8;if(void 0===b.bevelEnabled)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,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);
|
|
|
-this.faceVertexUvs[0].push([a[e].clone(),a[g].clone(),a[f].clone(),a[h].clone()])}this.computeCentroids()};THREE.TorusGeometry.prototype=new THREE.Geometry;THREE.TorusGeometry.prototype.constructor=THREE.TorusGeometry;
|
|
|
-THREE.TorusKnotGeometry=function(a,b,c,d,e,g,f){function h(a,b,c,d,e,g){b=c/d*a;c=Math.cos(b);return new THREE.Vector3(e*(2+c)*0.5*Math.cos(a),e*(2+c)*Math.sin(a)*0.5,g*e*Math.sin(b)*0.5)}THREE.Geometry.call(this);this.radius=a||200;this.tube=b||40;this.segmentsR=c||64;this.segmentsT=d||8;this.p=e||2;this.q=g||3;this.heightScale=f||1;this.grid=Array(this.segmentsR);c=new THREE.Vector3;d=new THREE.Vector3;g=new THREE.Vector3;for(a=0;a<this.segmentsR;++a){this.grid[a]=Array(this.segmentsT);for(b=0;b<
|
|
|
-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,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()};
|
|
|
+0,e=(""+a).split(""),f=e.length,g=[],a=0;a<f;a++){var h=new THREE.Path,h=this.extractGlyphPoints(e[a],b,c,d,h),d=d+h.offset;g.push(h.path)}return{paths:g,offset:d/2}},extractGlyphPoints:function(a,b,c,d,e){var f=[],g,h,i,k,j,o,l,n,p,m,q,r=b.glyphs[a]||b.glyphs["?"];if(r){if(r.o){b=r._cachedOutline||(r._cachedOutline=r.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;f.push(new THREE.Vector2(i,j));e.moveTo(i,j);break;case "l":i=b[a++]*c+d;j=b[a++]*c;f.push(new THREE.Vector2(i,
|
|
|
+j));e.lineTo(i,j);break;case "q":i=b[a++]*c+d;j=b[a++]*c;n=b[a++]*c+d;p=b[a++]*c;e.quadraticCurveTo(n,p,i,j);if(g=f[f.length-1]){o=g.x;l=g.y;for(g=1,h=this.divisions;g<=h;g++){var t=g/h,s=THREE.Shape.Utils.b2(t,o,n,i),t=THREE.Shape.Utils.b2(t,l,p,j);f.push(new THREE.Vector2(s,t))}}break;case "b":if(i=b[a++]*c+d,j=b[a++]*c,n=b[a++]*c+d,p=b[a++]*-c,m=b[a++]*c+d,q=b[a++]*-c,e.bezierCurveTo(i,j,n,p,m,q),g=f[f.length-1]){o=g.x;l=g.y;for(g=1,h=this.divisions;g<=h;g++)t=g/h,s=THREE.Shape.Utils.b3(t,o,n,
|
|
|
+m,i),t=THREE.Shape.Utils.b3(t,l,p,q,j),f.push(new THREE.Vector2(s,t))}}}return{offset:r.ha*c,points:f,path:e}}}};
|
|
|
+(function(a){var b=function(a){for(var b=a.length,e=0,f=b-1,g=0;g<b;f=g++)e+=a[f].x*a[g].y-a[g].x*a[f].y;return 0.5*e};a.Triangulate=function(a,d){var e=a.length;if(3>e)return null;var f=[],g=[],h=[],i,k,j;if(0<b(a))for(k=0;k<e;k++)g[k]=k;else for(k=0;k<e;k++)g[k]=e-1-k;var o=2*e;for(k=e-1;2<e;){if(0>=o--){console.log("Warning, unable to triangulate polygon!");break}i=k;e<=i&&(i=0);k=i+1;e<=k&&(k=0);j=k+1;e<=j&&(j=0);var l;a:{l=a;var n=i,p=k,m=j,q=e,r=g,t=void 0,s=void 0,v=void 0,u=void 0,w=void 0,
|
|
|
+z=void 0,x=void 0,A=void 0,F=void 0,s=l[r[n]].x,v=l[r[n]].y,u=l[r[p]].x,w=l[r[p]].y,z=l[r[m]].x,x=l[r[m]].y;if(1.0E-10>(u-s)*(x-v)-(w-v)*(z-s))l=!1;else{for(t=0;t<q;t++)if(!(t==n||t==p||t==m)){var A=l[r[t]].x,F=l[r[t]].y,E=void 0,I=void 0,J=void 0,B=void 0,G=void 0,D=void 0,H=void 0,y=void 0,K=void 0,C=void 0,L=void 0,N=void 0,E=J=G=void 0,E=z-u,I=x-w,J=s-z,B=v-x,G=u-s,D=w-v,H=A-s,y=F-v,K=A-u,C=F-w,L=A-z,N=F-x,E=E*C-I*K,G=G*y-D*H,J=J*N-B*L;if(0<=E&&0<=J&&0<=G){l=!1;break a}}l=!0}}if(l){f.push([a[g[i]],
|
|
|
+a[g[k]],a[g[j]]]);h.push([g[i],g[k],g[j]]);for(i=k,j=k+1;j<e;i++,j++)g[i]=g[j];e--;o=2*e}}return d?h:f};a.Triangulate.area=b;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
|
|
|
+THREE.TorusGeometry=function(a,b,c,d,e){THREE.Geometry.call(this);this.radius=a||100;this.tube=b||40;this.segmentsR=c||8;this.segmentsT=d||6;this.arc=e||2*Math.PI;e=new THREE.Vector3;a=[];b=[];for(c=0;c<=this.segmentsR;c++)for(d=0;d<=this.segmentsT;d++){var f=d/this.segmentsT*this.arc,g=2*c/this.segmentsR*Math.PI;e.x=this.radius*Math.cos(f);e.y=this.radius*Math.sin(f);var h=new THREE.Vector3;h.x=(this.radius+this.tube*Math.cos(g))*Math.cos(f);h.y=(this.radius+this.tube*Math.cos(g))*Math.sin(f);h.z=
|
|
|
+this.tube*Math.sin(g);this.vertices.push(new THREE.Vertex(h));a.push(new THREE.UV(d/this.segmentsT,1-c/this.segmentsR));b.push(h.clone().subSelf(e).normalize())}for(c=1;c<=this.segmentsR;c++)for(d=1;d<=this.segmentsT;d++){var e=(this.segmentsT+1)*c+d-1,f=(this.segmentsT+1)*(c-1)+d-1,g=(this.segmentsT+1)*(c-1)+d,h=(this.segmentsT+1)*c+d,i=new THREE.Face4(e,f,g,h,[b[e],b[f],b[g],b[h]]);i.normal.addSelf(b[e]);i.normal.addSelf(b[f]);i.normal.addSelf(b[g]);i.normal.addSelf(b[h]);i.normal.normalize();this.faces.push(i);
|
|
|
+this.faceVertexUvs[0].push([a[e].clone(),a[f].clone(),a[g].clone(),a[h].clone()])}this.computeCentroids()};THREE.TorusGeometry.prototype=new THREE.Geometry;THREE.TorusGeometry.prototype.constructor=THREE.TorusGeometry;
|
|
|
+THREE.TorusKnotGeometry=function(a,b,c,d,e,f,g){function h(a,b,c,d,e,f){var g=Math.cos(a);Math.cos(b);b=Math.sin(a);a*=c/d;c=Math.cos(a);g*=0.5*e*(2+c);b=0.5*e*(2+c)*b;e=0.5*f*e*Math.sin(a);return new THREE.Vector3(g,b,e)}THREE.Geometry.call(this);this.radius=a||200;this.tube=b||40;this.segmentsR=c||64;this.segmentsT=d||8;this.p=e||2;this.q=f||3;this.heightScale=g||1;this.grid=Array(this.segmentsR);c=new THREE.Vector3;d=new THREE.Vector3;e=new THREE.Vector3;for(a=0;a<this.segmentsR;++a){this.grid[a]=
|
|
|
+Array(this.segmentsT);for(b=0;b<this.segmentsT;++b){var i=2*(a/this.segmentsR)*this.p*Math.PI,g=2*(b/this.segmentsT)*Math.PI,f=h(i,g,this.q,this.p,this.radius,this.heightScale),i=h(i+0.01,g,this.q,this.p,this.radius,this.heightScale);c.sub(i,f);d.add(i,f);e.cross(c,d);d.cross(e,c);e.normalize();d.normalize();i=-this.tube*Math.cos(g);g=this.tube*Math.sin(g);f.x+=i*d.x+g*e.x;f.y+=i*d.y+g*e.y;f.z+=i*d.z+g*e.z;this.grid[a][b]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(f.x,f.y,f.z)))-1}}for(a=
|
|
|
+0;a<this.segmentsR;++a)for(b=0;b<this.segmentsT;++b){var e=(a+1)%this.segmentsR,f=(b+1)%this.segmentsT,c=this.grid[a][b],d=this.grid[e][b],e=this.grid[e][f],f=this.grid[a][f],g=new THREE.UV(a/this.segmentsR,b/this.segmentsT),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(c,d,e,f));this.faceVertexUvs[0].push([g,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=void 0===a?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;0<b--;)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(g.useOldVertexColors){j.vertexColors=[];for(var k,o,m,n=0;4>n;n++){m=i[n];k=new THREE.Color;k.setRGB(0,0,0);for(var p=0;p<m.length;p++)o=h.vertexColors[m[p]-1],k.r+=o.r,k.g+=o.g,k.b+=o.b;k.r/=m.length;k.g/=m.length;k.b/=m.length;j.vertexColors[n]=k}}e.push(j);(!g.supportUVs||0!=l.length)&&f.push([l[a],l[b],l[c],l[d]])}function c(a,b){return Math.min(a,b)+"_"+Math.max(a,
|
|
|
+b)}var d=[],e=[],f=[],g=this,h=a.vertices,d=a.faces,i=h.concat(),k=[],j={},o={},l=[],n,p,m,q,r,t=a.faceVertexUvs[0];for(n=0,p=t.length;n<p;n++)for(m=0,q=t[n].length;m<q;m++)r=d[n]["abcd".charAt(m)],l[r]||(l[r]=t[n][m]);var s;for(n=0,p=d.length;n<p;n++)if(r=d[n],k.push(r.centroid),i.push(new THREE.Vertex(r.centroid)),g.supportUVs&&0!=l.length){s=new THREE.UV;if(r instanceof THREE.Face3)s.u=l[r.a].u+l[r.b].u+l[r.c].u,s.v=l[r.a].v+l[r.b].v+l[r.c].v,s.u/=3,s.v/=3;else if(r instanceof THREE.Face4)s.u=
|
|
|
+l[r.a].u+l[r.b].u+l[r.c].u+l[r.d].u,s.v=l[r.a].v+l[r.b].v+l[r.c].v+l[r.d].v,s.u/=4,s.v/=4;l.push(s)}p=function(a){function b(a,c,d){void 0===a[c]&&(a[c]=[]);a[c].push(d)}var d,e,f,g,h={};for(d=0,e=a.faces.length;d<e;d++)f=a.faces[d],f instanceof THREE.Face3?(g=c(f.a,f.b),b(h,g,d),g=c(f.b,f.c),b(h,g,d),g=c(f.c,f.a),b(h,g,d)):f instanceof THREE.Face4&&(g=c(f.a,f.b),b(h,g,d),g=c(f.b,f.c),b(h,g,d),g=c(f.c,f.d),b(h,g,d),g=c(f.d,f.a),b(h,g,d));return h}(a);var v=0,t=h.length,u,w,z={},x={},A=function(a,
|
|
|
+b){void 0===z[a]&&(z[a]=[]);z[a].push(b)},F=function(a,b){void 0===x[a]&&(x[a]={});x[a][b]=null};for(n in p){s=p[n];u=n.split("_");w=u[0];u=u[1];A(w,[w,u]);A(u,[w,u]);for(m=0,q=s.length;m<q;m++)r=s[m],F(w,r,n),F(u,r,n);2>s.length&&(o[n]=!0)}for(n in p)if(s=p[n],r=s[0],s=s[1],u=n.split("_"),w=u[0],u=u[1],q=new THREE.Vector3,o[n]?(q.addSelf(h[w].position),q.addSelf(h[u].position),q.multiplyScalar(0.5)):(q.addSelf(k[r]),q.addSelf(k[s]),q.addSelf(h[w].position),q.addSelf(h[u].position),q.multiplyScalar(0.25)),
|
|
|
+j[n]=t+d.length+v,i.push(new THREE.Vertex(q)),v++,g.supportUVs&&0!=l.length)s=new THREE.UV,s.u=l[w].u+l[u].u,s.v=l[w].v+l[u].v,s.u/=2,s.v/=2,l.push(s);var E,I;u=["123","12","2","23"];q=["123","23","3","31"];var A=["123","31","1","12"],F=["1234","12","2","23"],J=["1234","23","3","34"],B=["1234","34","4","41"],G=["1234","41","1","12"];for(n=0,p=k.length;n<p;n++)r=d[n],s=t+n,r instanceof THREE.Face3?(v=c(r.a,r.b),w=c(r.b,r.c),E=c(r.c,r.a),b(s,j[v],r.b,j[w],r,u),b(s,j[w],r.c,j[E],r,q),b(s,j[E],r.a,j[v],
|
|
|
+r,A)):r instanceof THREE.Face4?(v=c(r.a,r.b),w=c(r.b,r.c),E=c(r.c,r.d),I=c(r.d,r.a),b(s,j[v],r.b,j[w],r,F),b(s,j[w],r.c,j[E],r,J),b(s,j[E],r.d,j[I],r,B),b(s,j[I],r.a,j[v],r,G)):console.log("face should be a face!",r);d=i;i=new THREE.Vector3;j=new THREE.Vector3;for(n=0,p=h.length;n<p;n++)if(void 0!==z[n]){i.set(0,0,0);j.set(0,0,0);r=new THREE.Vector3(0,0,0);s=0;for(m in x[n])i.addSelf(k[m]),s++;v=0;t=z[n].length;for(m=0;m<t;m++)o[c(z[n][m][0],z[n][m][1])]&&v++;if(2!=v){i.divideScalar(s);for(m=0;m<
|
|
|
+t;m++)s=z[n][m],s=h[s[0]].position.clone().addSelf(h[s[1]].position).divideScalar(2),j.addSelf(s);j.divideScalar(t);r.addSelf(h[n].position);r.multiplyScalar(t-3);r.addSelf(i);r.addSelf(j.multiplyScalar(2));r.divideScalar(t);d[n].position=r}}a.vertices=d;a.faces=e;a.faceVertexUvs[0]=f;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)==
|
|
|
-a}function d(a,b){var d=new Image;d.onload=function(){if(!c(this.width)||!c(this.height)){var b=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),d=Math.pow(2,Math.round(Math.log(this.height)/Math.LN2));a.image.width=b;a.image.height=d;a.image.getContext("2d").drawImage(this,0,0,b,d)}else a.image=this;a.needsUpdate=!0};d.crossOrigin=f.crossOrigin;d.src=b}function e(a,c,e,g,f,h){var i=document.createElement("canvas");a[c]=new THREE.Texture(i);a[c].sourceFile=e;if(g){a[c].repeat.set(g[0],g[1]);
|
|
|
-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),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.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?b+((100*a.loaded/a.total).toFixed(0)+
|
|
|
+"%"):b+((a.loaded/1E3).toFixed(2)+" KB");this.statusDomElement.innerHTML=b},extractUrlbase:function(a){a=a.split("/");a.pop();return 1>a.length?"":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)==a}function d(a){a=Math.log(a)/Math.LN2;return Math.pow(2,Math.round(a))}function e(a,b){var e=new Image;e.onload=function(){if(!c(this.width)||!c(this.height)){var b=d(this.width),e=d(this.height);a.image.width=b;a.image.height=e;a.image.getContext("2d").drawImage(this,0,0,b,e)}else a.image=this;a.needsUpdate=!0};e.crossOrigin=h.crossOrigin;e.src=b}function f(a,c,d,f,g,h){var i=document.createElement("canvas");a[c]=new THREE.Texture(i);a[c].sourceFile=d;if(f){a[c].repeat.set(f[0],
|
|
|
+f[1]);if(1!=f[0])a[c].wrapS=THREE.RepeatWrapping;if(1!=f[1])a[c].wrapT=THREE.RepeatWrapping}g&&a[c].offset.set(g[0],g[1]);if(h){f={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(void 0!==f[h[0]])a[c].wrapS=f[h[0]];if(void 0!==f[h[1]])a[c].wrapT=f[h[1]]}e(a[c],b+"/"+d)}function g(a){return(255*a[0]<<16)+(255*a[1]<<8)+255*a[2]}var h=this,i="MeshLambertMaterial",k={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:a.wireframe};a.shading&&("Phong"==a.shading?
|
|
|
+i="MeshPhongMaterial":"Basic"==a.shading&&(i="MeshBasicMaterial"));if(a.blending)if("Additive"==a.blending)k.blending=THREE.AdditiveBlending;else if("Subtractive"==a.blending)k.blending=THREE.SubtractiveBlending;else if("Multiply"==a.blending)k.blending=THREE.MultiplyBlending;if(void 0!==a.transparent||1>a.opacity)k.transparent=a.transparent;if(void 0!==a.depthTest)k.depthTest=a.depthTest;if(void 0!==a.vertexColors)if("face"==a.vertexColors)k.vertexColors=THREE.FaceColors;else if(a.vertexColors)k.vertexColors=
|
|
|
+THREE.VertexColors;if(a.colorDiffuse)k.color=g(a.colorDiffuse);else if(a.DbgColor)k.color=a.DbgColor;if(a.colorSpecular)k.specular=g(a.colorSpecular);if(a.colorAmbient)k.ambient=g(a.colorAmbient);if(a.transparency)k.opacity=a.transparency;if(a.specularCoef)k.shininess=a.specularCoef;a.mapDiffuse&&b&&f(k,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap);a.mapLight&&b&&f(k,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap);a.mapNormal&&b&&f(k,"normalMap",
|
|
|
+a.mapNormal,a.mapNormalRepeat,a.mapNormalOffset,a.mapNormalWrap);a.mapSpecular&&b&&f(k,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){var i=THREE.ShaderUtils.lib.normal,j=THREE.UniformsUtils.clone(i.uniforms);j.tNormal.texture=k.normalMap;if(a.mapNormalFactor)j.uNormalScale.value=a.mapNormalFactor;if(k.map)j.tDiffuse.texture=k.map,j.enableDiffuse.value=!0;if(k.specularMap)j.tSpecular.texture=k.specularMap,j.enableSpecular.value=!0;if(k.lightMap)j.tAO.texture=
|
|
|
+k.lightMap,j.enableAO.value=!0;j.uDiffuseColor.value.setHex(k.color);j.uSpecularColor.value.setHex(k.specular);j.uAmbientColor.value.setHex(k.ambient);j.uShininess.value=k.shininess;if(void 0!==k.opacity)j.uOpacity.value=k.opacity;k=new THREE.ShaderMaterial({fragmentShader:i.fragmentShader,vertexShader:i.vertexShader,uniforms:j,lights:!0,fog:!0})}else k=new THREE[i](k);if(void 0!==a.DbgName)k.name=a.DbgName;return k}};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=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,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 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=
|
|
|
-0;c<a.length;c++)b.push(parseInt(a[c],10));return b}function N(a){return a.replace(/^\s+/,"").replace(/\s+$/,"")}function L(a,b,c){return a.hasAttribute(b)?parseInt(a.getAttribute(b),10):c}function I(a,b){if(Q.convertUpAxis&&Z!==Q.upAxis)switch(U){case "XtoY":var c=a[0];a[0]=b*a[1];a[1]=c;break;case "XtoZ":c=a[2];a[2]=a[1];a[1]=a[0];a[0]=c;break;case "YtoX":c=a[0];a[0]=a[1];a[1]=b*c;break;case "YtoZ":c=a[1];a[1]=b*a[2];a[2]=c;break;case "ZtoX":c=a[0];a[0]=a[1];a[1]=a[2];a[2]=c;break;case "ZtoY":c=
|
|
|
-a[1],a[1]=a[2],a[2]=b*c}}function R(a,b){var c=[a[b],a[b+1],a[b+2]];I(c,-1);return new THREE.Vector3(c[0],c[1],c[2])}function ba(a){if(Q.convertUpAxis){var b=[a[0],a[4],a[8]];I(b,-1);a[0]=b[0];a[4]=b[1];a[8]=b[2];b=[a[1],a[5],a[9]];I(b,-1);a[1]=b[0];a[5]=b[1];a[9]=b[2];b=[a[2],a[6],a[10]];I(b,-1);a[2]=b[0];a[6]=b[1];a[10]=b[2];b=[a[0],a[1],a[2]];I(b,-1);a[0]=b[0];a[1]=b[1];a[2]=b[2];b=[a[4],a[5],a[6]];I(b,-1);a[4]=b[0];a[5]=b[1];a[6]=b[2];b=[a[8],a[9],a[10]];I(b,-1);a[8]=b[0];a[9]=b[1];a[10]=b[2];
|
|
|
-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.Matrix4(a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8],a[9],a[10],a[11],a[12],a[13],a[14],a[15])}var P=null,X=null,S,ia=null,Y={},ca={},W={},T={},V={},da={},ea={},ga,fa,ja,$,aa,ka=THREE.SmoothShading,Q={centerGeometry:!1,convertUpAxis:!1,subdivideFaces:!0,upAxis:"Y"},Z="Y",U=null,ha=Math.PI/180;f.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName==
|
|
|
-"init_from")this.init_from=c.textContent}return this};h.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.type="none";for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "skin":this.skin=(new k).parse(c);this.type=c.nodeName;break;case "morph":this.morph=(new i).parse(c),this.type=c.nodeName}}return this};i.prototype.parse=function(a){var b={},c=[],d;this.method=a.getAttribute("method");this.source=a.getAttribute("source").replace(/^#/,
|
|
|
-"");for(d=0;d<a.childNodes.length;d++){var e=a.childNodes[d];if(e.nodeType==1)switch(e.nodeName){case "source":e=(new 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 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 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],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};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};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]==
|
|
|
-"1"?!0:!1);this.data=e;this.type=c.nodeName;break;case "float_array":this.data=B(c.textContent);this.type=c.nodeName;break;case "int_array":this.data=H(c.textContent);this.type=c.nodeName;break;case "IDREF_array":case "Name_array":this.data=N(c.textContent).split(/\s+/);this.type=c.nodeName;break;case "technique_common":for(d=0;d<c.childNodes.length;d++)if(c.childNodes[d].nodeName=="accessor"){this.accessor=(new w).parse(c.childNodes[d]);break}}}return this};y.prototype.read=function(){var a=[],b=
|
|
|
-this.accessor.params[0];switch(b.type){case "IDREF":case "Name":case "name":case "float":return this.data;case "float4x4":for(b=0;b<this.data.length;b+=16){var c=this.data.slice(b,b+16),c=ba(c);a.push(c)}break;default:console.log("ColladaLoader: Source: Read dont know how to read "+b.type+".")}return a};x.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");for(var b=0;b<a.childNodes.length;b++)if(a.childNodes[b].nodeName=="instance_effect"){this.instance_effect=
|
|
|
-(new C).parse(a.childNodes[b]);break}return this};A.prototype.isColor=function(){return this.texture==null};A.prototype.isTexture=function(){return this.texture!=null};A.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "color":c=B(c.textContent);this.color=new THREE.Color(0);this.color.setRGB(c[0],c[1],c[2]);this.color.a=c[3];break;case "texture":this.texture=c.getAttribute("texture"),this.texcoord=c.getAttribute("texcoord"),
|
|
|
-this.texOpts={offsetU:0,offsetV:0,repeatU:1,repeatV:1,wrapU:1,wrapV:1},this.parseTexture(c)}}return this};A.prototype.parseTexture=function(a){if(!a.childNodes)return this;a.childNodes[1]&&a.childNodes[1].nodeName==="extra"&&(a=a.childNodes[1],a.childNodes[1]&&a.childNodes[1].nodeName==="technique"&&(a=a.childNodes[1]));for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "offsetU":case "offsetV":case "repeatU":case "repeatV":this.texOpts[c.nodeName]=parseFloat(c.textContent);
|
|
|
-break;case "wrapU":case "wrapV":this.texOpts[c.nodeName]=parseInt(c.textContent);break;default:this.texOpts[c.nodeName]=c.textContent}}return this};D.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[c.nodeName]=(new A).parse(c);break;case "shininess":case "reflectivity":case "transparency":var d;d=P.evaluate(".//dae:float",c,M,XPathResult.ORDERED_NODE_ITERATOR_TYPE,
|
|
|
-null);for(var e=d.iterateNext(),f=[];e;)f.push(e),e=d.iterateNext();d=f;d.length>0&&(this[c.nodeName]=parseFloat(d[0].textContent))}}this.create();return this};D.prototype.create=function(){var a={},b=this.transparency!==void 0&&this.transparency<1,c;for(c in this)switch(c){case "ambient":case "emission":case "diffuse":case "specular":var d=this[c];if(d instanceof A)if(d.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid){var e=ca[this.effect.surface.init_from];
|
|
|
-if(e)e=THREE.ImageUtils.loadTexture(ja+e.init_from),e.wrapS=d.texOpts.wrapU?THREE.RepeatWrapping:THREE.ClampToEdgeWrapping,e.wrapT=d.texOpts.wrapV?THREE.RepeatWrapping:THREE.ClampToEdgeWrapping,e.offset.x=d.texOpts.offsetU,e.offset.y=d.texOpts.offsetV,e.repeat.x=d.texOpts.repeatU,e.repeat.y=d.texOpts.repeatV,a.map=e}}else c=="diffuse"?a.color=d.color.getHex():b||(a[c]=d.color.getHex());break;case "shininess":case "reflectivity":a[c]=this[c];break;case "transparency":if(b)a.transparent=!0,a.opacity=
|
|
|
-this[c],b=!0}a.shading=ka;return this.material=new THREE.MeshLambertMaterial(a)};v.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "init_from":this.init_from=c.textContent;break;case "format":this.format=c.textContent;break;default:console.log("unhandled Surface prop: "+c.nodeName)}}return this};E.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "source":this.source=
|
|
|
-c.textContent;break;case "minfilter":this.minfilter=c.textContent;break;case "magfilter":this.magfilter=c.textContent;break;case "mipfilter":this.mipfilter=c.textContent;break;case "wrap_s":this.wrap_s=c.textContent;break;case "wrap_t":this.wrap_t=c.textContent;break;default:console.log("unhandled Sampler2D prop: "+c.nodeName)}}return this};F.prototype.create=function(){if(this.shader==null)return null};F.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.shader=
|
|
|
-null;for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "profile_COMMON":this.parseTechnique(this.parseProfileCOMMON(c))}}return this};F.prototype.parseNewparam=function(a){for(var b=a.getAttribute("sid"),c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "surface":this.surface=(new v(this)).parse(d);this.surface.sid=b;break;case "sampler2D":this.sampler=(new E(this)).parse(d);this.sampler.sid=b;break;case "extra":break;
|
|
|
-default:console.log(d.nodeName)}}};F.prototype.parseProfileCOMMON=function(a){for(var b,c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "profile_COMMON":this.parseProfileCOMMON(d);break;case "technique":b=d;break;case "newparam":this.parseNewparam(d);break;case "extra":break;default:console.log(d.nodeName)}}return b};F.prototype.parseTechnique=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "constant":case "lambert":case "blinn":case "phong":this.shader=
|
|
|
-(new D(c.nodeName,this)).parse(c)}}};C.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};K.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.source={};for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "source":c=(new y).parse(c);this.source[c.id]=c;break;case "sampler":this.sampler.push((new J(this)).parse(c));break;case "channel":this.channel.push((new G(this)).parse(c))}}return this};
|
|
|
-G.prototype.parse=function(a){this.source=a.getAttribute("source").replace(/^#/,"");this.target=a.getAttribute("target");var b=this.target.split("/");b.shift();var a=b.shift(),c=a.indexOf(".")>=0,d=a.indexOf("(")>=0;if(c)b=a.split("."),this.sid=b.shift(),this.member=b.shift();else if(d){b=a.split("(");this.sid=b.shift();for(var e=0;e<b.length;e++)b[e]=parseInt(b[e].replace(/\)/,""));this.arrIndices=b}else this.sid=a;this.fullSid=a;this.dotSyntax=c;this.arrSyntax=d;return this};J.prototype.parse=function(a){this.id=
|
|
|
-a.getAttribute("id");this.inputs=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "input":this.inputs.push((new u).parse(c))}}return this};J.prototype.create=function(){for(var a=0;a<this.inputs.length;a++){var b=this.inputs[a],c=this.animation.source[b.source];switch(b.semantic){case "INPUT":this.input=c.read();break;case "OUTPUT":this.output=c.read();this.strideOut=c.accessor.stride;break;case "INTERPOLATION":this.interpolation=c.read();break;
|
|
|
-case "IN_TANGENT":break;case "OUT_TANGENT":break;default:console.log(b.semantic)}}this.duration=this.endTime=this.startTime=0;if(this.input.length){this.startTime=1E8;this.endTime=-1E8;for(a=0;a<this.input.length;a++)this.startTime=Math.min(this.startTime,this.input[a]),this.endTime=Math.max(this.endTime,this.input[a]);this.duration=this.endTime-this.startTime}};J.prototype.getData=function(a,b){var c;if(this.strideOut>1){c=[];b*=this.strideOut;for(var d=0;d<this.strideOut;++d)c[d]=this.output[b+
|
|
|
-d];if(this.strideOut===3)switch(a){case "rotate":case "translate":I(c,-1);break;case "scale":I(c,1)}}else c=this.output[b];return c};O.prototype.addTarget=function(a,b,c,d){this.targets.push({sid:a,member:c,transform:b,data:d})};O.prototype.apply=function(a){for(var b=0;b<this.targets.length;++b){var c=this.targets[b];(!a||c.sid===a)&&c.transform.update(c.data,c.member)}};O.prototype.getTarget=function(a){for(var b=0;b<this.targets.length;++b)if(this.targets[b].sid===a)return this.targets[b];return null};
|
|
|
-O.prototype.hasTarget=function(a){for(var b=0;b<this.targets.length;++b)if(this.targets[b].sid===a)return!0;return!1};O.prototype.interpolate=function(a,b){for(var c=0;c<this.targets.length;++c){var d=this.targets[c],e=a.getTarget(d.sid);if(e){var f=(b-this.time)/(a.time-this.time),g=e.data,h=d.data;if(f<0||f>1)console.log("Key.interpolate: Warning! Scale out of bounds:"+f),f=f<0?0:1;if(h.length)for(var e=[],i=0;i<h.length;++i)e[i]=h[i]+(g[i]-h[i])*f;else e=h+(g-h)*f}else e=d.data;d.transform.update(e,
|
|
|
-d.member)}};return{load:function(b,c,d){var e=0;if(document.implementation&&document.implementation.createDocument){var f=new XMLHttpRequest;f.overrideMimeType&&f.overrideMimeType("text/xml");f.onreadystatechange=function(){if(f.readyState==4){if(f.status==0||f.status==200)f.responseXML?(ia=c,a(f.responseXML,void 0,b)):console.error("ColladaLoader: Empty or non-existing file ("+b+")")}else f.readyState==3&&d&&(e==0&&(e=f.getResponseHeader("Content-Length")),d({total:e,loaded:f.responseText.length}))};
|
|
|
-f.open("GET",b,!0);f.send(null)}else alert("Don't know how to parse XML!")},parse:a,setPreferredShading:function(a){ka=a},applySkin:e,geometries:V,options:Q}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;
|
|
|
+THREE.BinaryLoader.prototype.loadAjaxJSON=function(a,b,c,d,e,f){var g=new XMLHttpRequest;g.onreadystatechange=function(){if(4==g.readyState)if(200==g.status||0==g.status)try{var h=JSON.parse(g.responseText);void 0===h.metadata||void 0===h.metadata.formatVersion||3!==h.metadata.formatVersion?console.error("Deprecated file format."):a.loadAjaxBuffers(h,c,e,d,f)}catch(i){console.error(i),console.warn("DEPRECATED: ["+b+"] seems to be using old model format")}else console.error("Couldn't load ["+b+"] ["+
|
|
|
+g.status+"]")};g.open("GET",b,!0);g.overrideMimeType("text/plain; charset=x-user-defined");g.setRequestHeader("Content-Type","text/plain");g.send(null)};
|
|
|
+THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,b,c,d,e){var f=new XMLHttpRequest,g=c+"/"+a.buffers,h=0;f.onreadystatechange=function(){4==f.readyState?200==f.status||0==f.status?THREE.BinaryLoader.prototype.createBinModel(f.response,b,d,a.materials):console.error("Couldn't load ["+g+"] ["+f.status+"]"):3==f.readyState?e&&(0==h&&(h=f.getResponseHeader("Content-Length")),e({total:h,loaded:f.responseText.length})):2==f.readyState&&(h=f.getResponseHeader("Content-Length"))};f.open("GET",g,!0);
|
|
|
+f.responseType="arraybuffer";f.send(null)};
|
|
|
+THREE.BinaryLoader.prototype.createBinModel=function(a,b,c,d){var e=function(b){var c,e,i,k,j,o,l,n,p,m,q,r,t,s,v,u;function w(a){return a%4?4-a%4:0}function z(a,b){return(new Uint8Array(a,b,1))[0]}function x(a,b){return(new Uint32Array(a,b,1))[0]}function A(b,c){var d,e,f,g,h,i,j,k,m=new Uint32Array(a,c,3*b);for(d=0;d<b;d++){e=m[3*d];f=m[3*d+1];g=m[3*d+2];h=y[2*e];e=y[2*e+1];i=y[2*f];j=y[2*f+1];f=y[2*g];k=y[2*g+1];g=G.faceVertexUvs[0];var n=[];n.push(new THREE.UV(h,e));n.push(new THREE.UV(i,j));
|
|
|
+n.push(new THREE.UV(f,k));g.push(n)}}function F(b,c){var d,e,f,g,h,i,j,k,m,n,o=new Uint32Array(a,c,4*b);for(d=0;d<b;d++){e=o[4*d];f=o[4*d+1];g=o[4*d+2];h=o[4*d+3];i=y[2*e];e=y[2*e+1];j=y[2*f];m=y[2*f+1];k=y[2*g];n=y[2*g+1];g=y[2*h];f=y[2*h+1];h=G.faceVertexUvs[0];var l=[];l.push(new THREE.UV(i,e));l.push(new THREE.UV(j,m));l.push(new THREE.UV(k,n));l.push(new THREE.UV(g,f));h.push(l)}}function E(b,c,d){for(var e,f,g,h,c=new Uint32Array(a,c,3*b),i=new Uint16Array(a,d,b),d=0;d<b;d++)e=c[3*d],f=c[3*
|
|
|
+d+1],g=c[3*d+2],h=i[d],G.faces.push(new THREE.Face3(e,f,g,null,null,h))}function I(b,c,d){for(var e,f,g,h,i,c=new Uint32Array(a,c,4*b),j=new Uint16Array(a,d,b),d=0;d<b;d++)e=c[4*d],f=c[4*d+1],g=c[4*d+2],h=c[4*d+3],i=j[d],G.faces.push(new THREE.Face4(e,f,g,h,null,null,i))}function J(b,c,d,e){for(var f,g,h,i,j,k,m,c=new Uint32Array(a,c,3*b),d=new Uint32Array(a,d,3*b),n=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[3*e];g=c[3*e+1];h=c[3*e+2];j=d[3*e];k=d[3*e+1];m=d[3*e+2];i=n[e];var o=H[3*k],l=H[3*k+1];k=
|
|
|
+H[3*k+2];var p=H[3*m],r=H[3*m+1];m=H[3*m+2];G.faces.push(new THREE.Face3(f,g,h,[new THREE.Vector3(H[3*j],H[3*j+1],H[3*j+2]),new THREE.Vector3(o,l,k),new THREE.Vector3(p,r,m)],null,i))}}function B(b,c,d,e){for(var f,g,h,i,j,k,m,n,o,c=new Uint32Array(a,c,4*b),d=new Uint32Array(a,d,4*b),l=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[4*e];g=c[4*e+1];h=c[4*e+2];i=c[4*e+3];k=d[4*e];m=d[4*e+1];n=d[4*e+2];o=d[4*e+3];j=l[e];var p=H[3*m],r=H[3*m+1];m=H[3*m+2];var q=H[3*n],s=H[3*n+1];n=H[3*n+2];var t=H[3*o],u=H[3*
|
|
|
+o+1];o=H[3*o+2];G.faces.push(new THREE.Face4(f,g,h,i,[new THREE.Vector3(H[3*k],H[3*k+1],H[3*k+2]),new THREE.Vector3(p,r,m),new THREE.Vector3(q,s,n),new THREE.Vector3(t,u,o)],null,j))}}var G=this,D=0,H=[],y=[],K,C;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(G,d,b);c=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,D,12);e=z(a,D+12);z(a,D+13);z(a,D+14);z(a,D+15);i=z(a,D+16);k=z(a,D+17);j=z(a,D+18);o=z(a,D+19);l=x(a,D+20);
|
|
|
+n=x(a,D+20+4);p=x(a,D+20+8);b=x(a,D+20+12);m=x(a,D+20+16);q=x(a,D+20+20);r=x(a,D+20+24);t=x(a,D+20+28);s=x(a,D+20+32);v=x(a,D+20+36);u=x(a,D+20+40);"Three.js 003"!==c&&console.warn("DEPRECATED: binary model seems to be using old format");D+=e;c=3*i+o;C=4*i+o;e=b*c;K=m*(c+3*k);i=q*(c+3*j);o=r*(c+3*k+3*j);c=t*C;k=s*(C+4*k);j=v*(C+4*j);D+=function(b){var b=new Float32Array(a,b,3*l),c,d,e,f;for(c=0;c<l;c++)d=b[3*c],e=b[3*c+1],f=b[3*c+2],G.vertices.push(new THREE.Vertex(new THREE.Vector3(d,e,f)));return 3*
|
|
|
+l*Float32Array.BYTES_PER_ELEMENT}(D);D+=function(b){if(n){var b=new Int8Array(a,b,3*n),c,d,e,f;for(c=0;c<n;c++)d=b[3*c],e=b[3*c+1],f=b[3*c+2],H.push(d/127,e/127,f/127)}return 3*n*Int8Array.BYTES_PER_ELEMENT}(D);D+=w(3*n);D+=function(b){if(p){var b=new Float32Array(a,b,2*p),c,d,e;for(c=0;c<p;c++)d=b[2*c],e=b[2*c+1],y.push(d,e)}return 2*p*Float32Array.BYTES_PER_ELEMENT}(D);e=D+e+w(2*b);K=e+K+w(2*m);i=K+i+w(2*q);o=i+o+w(2*r);c=o+c+w(2*t);k=c+k+w(2*s);j=k+j+w(2*v);(function(a){if(q){var b=a+3*q*Uint32Array.BYTES_PER_ELEMENT;
|
|
|
+E(q,a,b+3*q*Uint32Array.BYTES_PER_ELEMENT);A(q,b)}})(K);(function(a){if(r){var b=a+3*r*Uint32Array.BYTES_PER_ELEMENT,c=b+3*r*Uint32Array.BYTES_PER_ELEMENT;J(r,a,b,c+3*r*Uint32Array.BYTES_PER_ELEMENT);A(r,c)}})(i);(function(a){if(v){var b=a+4*v*Uint32Array.BYTES_PER_ELEMENT;I(v,a,b+4*v*Uint32Array.BYTES_PER_ELEMENT);F(v,b)}})(k);(function(a){if(u){var b=a+4*u*Uint32Array.BYTES_PER_ELEMENT,c=b+4*u*Uint32Array.BYTES_PER_ELEMENT;B(u,a,b,c+4*u*Uint32Array.BYTES_PER_ELEMENT);F(u,c)}})(j);b&&E(b,D,D+3*b*
|
|
|
+Uint32Array.BYTES_PER_ELEMENT);(function(a){if(m){var b=a+3*m*Uint32Array.BYTES_PER_ELEMENT;J(m,a,b,b+3*m*Uint32Array.BYTES_PER_ELEMENT)}})(e);t&&I(t,o,o+4*t*Uint32Array.BYTES_PER_ELEMENT);(function(a){if(s){var b=a+4*s*Uint32Array.BYTES_PER_ELEMENT;B(s,a,b,b+4*s*Uint32Array.BYTES_PER_ELEMENT)}})(c);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};e.prototype=new THREE.Geometry;e.prototype.constructor=e;b(new e(c))};
|
|
|
+THREE.ColladaLoader=function(){function a(a,d,e){P=a;d=d||ia;void 0!==e&&(a=e.split("/"),a.pop(),ja=1>a.length?"":a.join("/")+"/");if((a=P.evaluate("//dae:asset",P,K,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)V=null;else switch(Z){case "X":V="Y"===Q.upAxis?
|
|
|
+"XtoY":"XtoZ";break;case "Y":V="X"===Q.upAxis?"YtoX":"YtoZ";break;case "Z":V="X"===Q.upAxis?"ZtoX":"ZtoY"}ca=b("//dae:library_images/dae:image",g,"image");da=b("//dae:library_materials/dae:material",x,"material");ea=b("//dae:library_effects/dae:effect",J,"effect");U=b("//dae:library_geometries/dae:geometry",q,"geometry");T=b("//dae:library_controllers/dae:controller",h,"controller");W=b("//dae:library_animations/dae:animation",G,"animation");ga=b(".//dae:library_visual_scenes/dae:visual_scene",j,
|
|
|
+"visual_scene");$=[];aa=[];(a=P.evaluate(".//dae:scene/dae:instance_visual_scene",P,K,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(a=a.getAttribute("url").replace(/^#/,""),S=ga[a]):S=null;X=new THREE.Object3D;for(a=0;a<S.nodes.length;a++)X.add(f(S.nodes[a]));fa=[];c(X);a={scene:X,morphs:$,skins:aa,animations:fa,dae:{images:ca,materials:da,effects:ea,geometries:U,controllers:T,animations:W,visualScenes:ga,scene:S}};d&&d(a);return a}function b(a,b,c){for(var a=P.evaluate(a,P,K,XPathResult.ORDERED_NODE_ITERATOR_TYPE,
|
|
|
+null),d={},e=a.iterateNext(),f=0;e;){e=(new b).parse(e);if(!e.id||0==e.id.length)e.id=c+f++;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};fa.push(d);for(var e=0,f=b.keys.length;e<f;e++)d.length=Math.max(d.length,b.keys[e].time)}else d={hierarchy:[{keys:[],sids:[]}]};e=0;for(f=a.children.length;e<f;e++)for(var b=0,g=c(a.children[e]).hierarchy.length;b<
|
|
|
+g;b++)d.hierarchy.push({keys:[],sids:[]});return d}function d(a,b,c,e){a.world=a.world||new THREE.Matrix4;a.world.copy(a.matrix);if(a.channels&&a.channels.length){var f=a.channels[0].sampler.output[c];f instanceof THREE.Matrix4&&a.world.copy(f)}e&&a.world.multiply(e,a.world);b.push(a);for(e=0;e<a.nodes.length;e++)d(a.nodes[e],b,c,a.world)}function e(a,b,c){var e,f=T[b.url];if(!f||!f.skin)console.log("ColladaLoader: Could not find skin controller.");else if(!b.skeleton||!b.skeleton.length)console.log("ColladaLoader: Could not find the skeleton for the skin. ");
|
|
|
+else{var c=1E6,g=-c,h=0;for(e in W)for(var i=W[e],j=0;j<i.sampler.length;j++){var k=i.sampler[j];k.create();c=Math.min(c,k.startTime);g=Math.max(g,k.endTime);h=Math.max(h,k.input.length)}e=h;for(var b=S.getChildById(b.skeleton[0],!0)||S.getChildBySid(b.skeleton[0],!0),m,n,g=new THREE.Vector3,o,j=0;j<a.vertices.length;j++)f.skin.bindShapeMatrix.multiplyVector3(a.vertices[j].position);for(c=0;c<e;c++){h=[];i=[];for(j=0;j<a.vertices.length;j++)i.push(new THREE.Vertex(new THREE.Vector3));d(b,h,c);j=h;
|
|
|
+k=f.skin;for(n=0;n<j.length;n++)if(m=j[n],o=-1,"JOINT"==m.type){for(var l=0;l<k.joints.length;l++)if(m.sid==k.joints[l]){o=l;break}if(0<=o){l=k.invBindMatrices[o];m.invBindMatrix=l;m.skinningMatrix=new THREE.Matrix4;m.skinningMatrix.multiply(m.world,l);m.weights=[];for(l=0;l<k.weights.length;l++)for(var p=0;p<k.weights[l].length;p++){var r=k.weights[l][p];r.joint==o&&m.weights.push(r)}}else throw"ColladaLoader: Could not find joint '"+m.sid+"'.";}for(j=0;j<h.length;j++)if("JOINT"==h[j].type)for(k=
|
|
|
+0;k<h[j].weights.length;k++)m=h[j].weights[k],n=m.index,m=m.weight,o=a.vertices[n],n=i[n],g.x=o.position.x,g.y=o.position.y,g.z=o.position.z,h[j].skinningMatrix.multiplyVector3(g),n.position.x+=g.x*m,n.position.y+=g.y*m,n.position.z+=g.z*m;a.morphTargets.push({name:"target_"+c,vertices:i})}}}function f(a){var b=new THREE.Object3D,c,d,g,h;for(g=0;g<a.controllers.length;g++){var i=T[a.controllers[g].url];switch(i.type){case "skin":if(U[i.skin.source]){var j=new m;j.url=i.skin.source;j.instance_material=
|
|
|
+a.controllers[g].instance_material;a.geometries.push(j);c=a.controllers[g]}else if(T[i.skin.source]&&(d=i=T[i.skin.source],i.morph&&U[i.morph.source]))j=new m,j.url=i.morph.source,j.instance_material=a.controllers[g].instance_material,a.geometries.push(j);break;case "morph":if(U[i.morph.source])j=new m,j.url=i.morph.source,j.instance_material=a.controllers[g].instance_material,a.geometries.push(j),d=a.controllers[g];console.log("ColladaLoader: Morph-controller partially supported.")}}for(g=0;g<a.geometries.length;g++){var i=
|
|
|
+a.geometries[g],j=i.instance_material,i=U[i.url],k={},o=[],l=0,p;if(i&&i.mesh&&i.mesh.primitives){if(0==b.name.length)b.name=i.id;if(j)for(h=0;h<j.length;h++){p=j[h];var r=ea[da[p.target].instance_effect.url].shader;r.material.opacity=!r.material.opacity?1:r.material.opacity;k[p.symbol]=l;o.push(r.material);p=r.material;l++}j=p||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});i=i.mesh.geometry3js;if(1<l){j=new THREE.MeshFaceMaterial;i.materials=o;for(h=0;h<i.faces.length;h++)o=
|
|
|
+i.faces[h],o.materialIndex=k[o.daeMaterial]}if(void 0!==c)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(void 0!==d){h=i;k=d instanceof n?T[d.url]:d;if(!k||!k.morph)console.log("could not find morph controller!");else{k=k.morph;for(o=0;o<k.targets.length;o++)if(l=U[k.targets[o]],l.mesh&&l.mesh.primitives&&l.mesh.primitives.length)l=l.mesh.primitives[0].geometry,l.vertices.length===
|
|
|
+h.vertices.length&&h.morphTargets.push({name:"target_1",vertices:l.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);1<a.geometries.length?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(g=0;g<a.nodes.length;g++)b.add(f(a.nodes[g],a));return b}function g(){this.init_from=this.id=""}function h(){this.type=this.name=this.id="";this.morph=this.skin=null}function 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 o(){this.sid=this.name=this.id="";this.nodes=
|
|
|
+[];this.controllers=[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function l(){this.type=this.sid="";this.data=[];this.obj=null}function n(){this.url="";this.skeleton=[];this.instance_material=[]}function p(){this.target=this.symbol=""}function m(){this.url="";this.instance_material=[]}function q(){this.id="";this.mesh=null}function r(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function t(){}function s(){this.material="";this.count=
|
|
|
+0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function v(){this.source="";this.stride=this.count=0;this.params=[]}function u(){this.input={}}function w(){this.semantic="";this.offset=0;this.source="";this.set=0}function z(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 F(a,b){this.type=a;this.effect=b;this.material=null}function E(a){this.effect=a;this.format=this.init_from=null}function I(a){this.effect=a;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=this.source=null}function J(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function B(){this.url=""}function G(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function D(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=
|
|
|
+this.arrSyntax=this.dotSyntax=this.sid=this.fullSid=null}function H(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 y(a){this.targets=[];this.time=a}function K(a){return"dae"==a?"http://www.collada.org/2005/11/COLLADASchema":null}function C(a){for(var a=N(a).split(/\s+/),b=[],c=0;c<a.length;c++)b.push(parseFloat(a[c]));return b}function L(a){for(var a=N(a).split(/\s+/),b=[],c=0;c<a.length;c++)b.push(parseInt(a[c],
|
|
|
+10));return b}function N(a){return a.replace(/^\s+/,"").replace(/\s+$/,"")}function M(a,b,c){return a.hasAttribute(b)?parseInt(a.getAttribute(b),10):c}function O(a,b){if(Q.convertUpAxis&&Z!==Q.upAxis)switch(V){case "XtoY":var c=a[0];a[0]=b*a[1];a[1]=c;break;case "XtoZ":c=a[2];a[2]=a[1];a[1]=a[0];a[0]=c;break;case "YtoX":c=a[0];a[0]=a[1];a[1]=b*c;break;case "YtoZ":c=a[1];a[1]=b*a[2];a[2]=c;break;case "ZtoX":c=a[0];a[0]=a[1];a[1]=a[2];a[2]=c;break;case "ZtoY":c=a[1],a[1]=a[2],a[2]=b*c}}function R(a,
|
|
|
+b){var c=[a[b],a[b+1],a[b+2]];O(c,-1);return new THREE.Vector3(c[0],c[1],c[2])}function ba(a){if(Q.convertUpAxis){var b=[a[0],a[4],a[8]];O(b,-1);a[0]=b[0];a[4]=b[1];a[8]=b[2];b=[a[1],a[5],a[9]];O(b,-1);a[1]=b[0];a[5]=b[1];a[9]=b[2];b=[a[2],a[6],a[10]];O(b,-1);a[2]=b[0];a[6]=b[1];a[10]=b[2];b=[a[0],a[1],a[2]];O(b,-1);a[0]=b[0];a[1]=b[1];a[2]=b[2];b=[a[4],a[5],a[6]];O(b,-1);a[4]=b[0];a[5]=b[1];a[6]=b[2];b=[a[8],a[9],a[10]];O(b,-1);a[8]=b[0];a[9]=b[1];a[10]=b[2];b=[a[3],a[7],a[11]];O(b,-1);a[3]=b[0];
|
|
|
+a[7]=b[1];a[11]=b[2]}return new THREE.Matrix4(a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8],a[9],a[10],a[11],a[12],a[13],a[14],a[15])}var P=null,X=null,S,ia=null,Y={},ca={},W={},T={},U={},da={},ea={},fa,ga,ja,$,aa,ka=THREE.SmoothShading,Q={centerGeometry:!1,convertUpAxis:!1,subdivideFaces:!0,upAxis:"Y"},Z="Y",V=null,ha=Math.PI/180;g.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if("init_from"==c.nodeName)this.init_from=c.textContent}return this};
|
|
|
+h.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.type="none";for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "skin":this.skin=(new k).parse(c);this.type=c.nodeName;break;case "morph":this.morph=(new i).parse(c),this.type=c.nodeName}}return this};i.prototype.parse=function(a){var b={},c=[],d;this.method=a.getAttribute("method");this.source=a.getAttribute("source").replace(/^#/,"");for(d=0;d<a.childNodes.length;d++){var e=
|
|
|
+a.childNodes[d];if(1==e.nodeType)switch(e.nodeName){case "source":e=(new z).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(1==d.nodeType)switch(d.nodeName){case "input":b.push((new w).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(1==f.nodeType)switch(f.nodeName){case "bind_shape_matrix":f=C(f.textContent);this.bindShapeMatrix=ba(f);break;case "source":f=(new z).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(1==d.nodeType)switch(d.nodeName){case "input":var d=(new w).parse(d),e=b[d.source];if("JOINT"==d.semantic)this.joints=e.read();else if("INV_BIND_MATRIX"==d.semantic)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(1==g.nodeType)switch(g.nodeName){case "input":e.push((new w).parse(g));break;
|
|
|
+case "v":c=L(g.textContent);break;case "vcount":d=L(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],o=c[g+n.offset];switch(n.semantic){case "JOINT":k.joint=o;break;case "WEIGHT":k.weight=b[n.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=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(1==c.nodeType)switch(c.nodeName){case "node":this.nodes.push((new o).parse(c))}}return this};o.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=0<=e.indexOf("."),g=0<=e.indexOf("("),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};o.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};o.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};o.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};o.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="JOINT"==this.type?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],1==b.nodeType)switch(b.nodeName){case "node":this.nodes.push((new o).parse(b));break;case "instance_camera":break;case "instance_controller":this.controllers.push((new n).parse(b));break;case "instance_geometry":this.geometries.push((new m).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,K,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new o).parse(b));break;case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new l).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(V){case "XtoY":case "XtoZ":case "YtoX":g="Y";break;case "ZtoX":g="Z"}break;case "Y":switch(V){case "XtoY":case "YtoX":case "ZtoX":g="X";break;case "XtoZ":case "YtoZ":case "ZtoY":g="Z"}break;case "Z":switch(V){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){-1===a.indexOf(f)&&a.push(f);b=0;for(var k=i.length;b<k;b++){var p=i[b],r=h.getData(j.type,b),q;q=null;for(var s=0,t=d.length;s<t&&null==q;s++){var u=d[s];if(u.time===p)q=u;else if(u.time>p)break}if(!q){q=new y(p);s=-1;t=0;for(u=d.length;t<u&&-1==s;t++)d[t].time>=p&&(s=t);p=s;d.splice(-1==p?d.length:p,0,q)}q.addTarget(f,j,g,r)}}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(q=d[b],!q.hasTarget(e)){h=d;f=q;j=b;g=e;i=void 0;a:{i=j?j-1:0;for(i=0<=i?i:i+h.length;0<=i;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;r=void 0;if(k.length){r=[];for(p=0;p<k.length;++p)r[p]=k[p]+(j[p]-k[p])*h}else r=k+(j-k)*h;f.addTarget(g,i.transform,i.member,r)}}}this.keys=
|
|
|
+d;this.sids=a}this.updateMatrix();return this};o.prototype.updateMatrix=function(){this.matrix.identity();for(var a=0;a<this.transforms.length;a++)this.transforms[a].apply(this.matrix)};l.prototype.parse=function(a){this.sid=a.getAttribute("sid");this.type=a.nodeName;this.data=C(a.textContent);this.convert();return this};l.prototype.convert=function(){switch(this.type){case "matrix":this.obj=ba(this.data);break;case "rotate":this.angle=this.data[3]*ha;case "translate":O(this.data,-1);this.obj=new THREE.Vector3(this.data[0],
|
|
|
+this.data[1],this.data[2]);break;case "scale":O(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)}};l.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)}};l.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}}};n.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(1==c.nodeType)switch(c.nodeName){case "skeleton":this.skeleton.push(c.textContent.replace(/^#/,""));break;case "bind_material":if(c=P.evaluate(".//dae:instance_material",c,K,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(var d=c.iterateNext();d;)this.instance_material.push((new p).parse(d)),d=c.iterateNext()}}return this};p.prototype.parse=function(a){this.symbol=a.getAttribute("symbol");this.target=a.getAttribute("target").replace(/^#/,
|
|
|
+"");return this};m.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(1==c.nodeType&&"bind_material"==c.nodeName){if(a=P.evaluate(".//dae:instance_material",c,K,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(b=a.iterateNext();b;)this.instance_material.push((new p).parse(b)),b=a.iterateNext();break}}return this};q.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<
|
|
|
+a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "mesh":this.mesh=(new r(this)).parse(c)}}return this};r.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");void 0==Y[d]&&(Y[d]=(new z(d)).parse(c));break;case "vertices":this.vertices=(new u).parse(c);break;case "triangles":this.primitives.push((new s).parse(c));break;case "polygons":console.warn("polygon holes not yet supported!");
|
|
|
+case "polylist":this.primitives.push((new t).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};
|
|
|
+r.prototype.handlePrimitive=function(a,b){var c=0,d,e,f=a.p,g=a.inputs,h,i,j,k,m=0,n=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 l=[],p=[],r={},q=[];a.vcount&&(n=a.vcount[m++]);for(d=0;d<n;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":l.push(i);break;case "NORMAL":p.push(R(k.data,j));break;case "TEXCOORD":void 0===r[h.set]&&(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(3===n)d.push(new THREE.Face3(l[0],l[1],l[2],[p[0],p[1],p[2]],q.length?q:new THREE.Color));else if(4===n)d.push(new THREE.Face4(l[0],l[1],l[2],l[3],[p[0],p[1],p[2],p[3]],q.length?q:new THREE.Color));else if(4<n&&Q.subdivideFaces){q=q.length?q:new THREE.Color;for(e=1;e<n-1;)d.push(new THREE.Face3(l[0],l[e],l[e+1],[p[0],p[e++],p[e]],q))}if(d.length){l=0;for(p=d.length;l<p;l++){e=d[l];
|
|
|
+e.daeMaterial=a.material;b.faces.push(e);for(e=0;e<o.length;e++)q=r[o[e]],q=4<n?[q[0],q[l+1],q[l+2]]:4===n?[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 "+n+" for geometry with id: "+b.id);c+=g.length*n}};t.prototype=new s;t.prototype.constructor=t;s.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};
|
|
|
+s.prototype.parse=function(a){this.inputs=[];this.material=a.getAttribute("material");this.count=M(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 w).parse(a.childNodes[b]));break;case "vcount":this.vcount=L(c.textContent);break;case "p":this.p=L(c.textContent)}}return this};v.prototype.parse=function(a){this.params=[];this.source=a.getAttribute("source");this.count=M(a,"count",0);this.stride=M(a,"stride",0);for(var b=
|
|
|
+0;b<a.childNodes.length;b++){var c=a.childNodes[b];if("param"==c.nodeName){var d={};d.name=c.getAttribute("name");d.type=c.getAttribute("type");this.params.push(d)}}return this};u.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++)if("input"==a.childNodes[b].nodeName){var c=(new w).parse(a.childNodes[b]);this.input[c.semantic]=c}return this};w.prototype.parse=function(a){this.semantic=a.getAttribute("semantic");this.source=a.getAttribute("source").replace(/^#/,
|
|
|
+"");this.set=M(a,"set",-1);this.offset=M(a,"offset",0);if("TEXCOORD"==this.semantic&&0>this.set)this.set=0;return this};z.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("true"==d[f]||"1"==d[f]?!0:!1);this.data=e;this.type=c.nodeName;break;case "float_array":this.data=C(c.textContent);this.type=c.nodeName;break;case "int_array":this.data=
|
|
|
+L(c.textContent);this.type=c.nodeName;break;case "IDREF_array":case "Name_array":this.data=N(c.textContent).split(/\s+/);this.type=c.nodeName;break;case "technique_common":for(d=0;d<c.childNodes.length;d++)if("accessor"==c.childNodes[d].nodeName){this.accessor=(new v).parse(c.childNodes[d]);break}}}return this};z.prototype.read=function(){var a=[],b=this.accessor.params[0];switch(b.type){case "IDREF":case "Name":case "name":case "float":return this.data;case "float4x4":for(b=0;b<this.data.length;b+=
|
|
|
+16){var c=this.data.slice(b,b+16),c=ba(c);a.push(c)}break;default:console.log("ColladaLoader: Source: Read dont know how to read "+b.type+".")}return a};x.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");for(var b=0;b<a.childNodes.length;b++)if("instance_effect"==a.childNodes[b].nodeName){this.instance_effect=(new B).parse(a.childNodes[b]);break}return this};A.prototype.isColor=function(){return null==this.texture};A.prototype.isTexture=function(){return null!=
|
|
|
+this.texture};A.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "color":c=C(c.textContent);this.color=new THREE.Color(0);this.color.setRGB(c[0],c[1],c[2]);this.color.a=c[3];break;case "texture":this.texture=c.getAttribute("texture"),this.texcoord=c.getAttribute("texcoord"),this.texOpts={offsetU:0,offsetV:0,repeatU:1,repeatV:1,wrapU:1,wrapV:1},this.parseTexture(c)}}return this};A.prototype.parseTexture=function(a){if(!a.childNodes)return this;
|
|
|
+a.childNodes[1]&&"extra"===a.childNodes[1].nodeName&&(a=a.childNodes[1],a.childNodes[1]&&"technique"===a.childNodes[1].nodeName&&(a=a.childNodes[1]));for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "offsetU":case "offsetV":case "repeatU":case "repeatV":this.texOpts[c.nodeName]=parseFloat(c.textContent);break;case "wrapU":case "wrapV":this.texOpts[c.nodeName]=parseInt(c.textContent);break;default:this.texOpts[c.nodeName]=c.textContent}}return this};F.prototype.parse=
|
|
|
+function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[c.nodeName]=(new A).parse(c);break;case "shininess":case "reflectivity":case "transparency":var d;d=P.evaluate(".//dae:float",c,K,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);for(var e=d.iterateNext(),f=[];e;)f.push(e),e=d.iterateNext();d=f;0<d.length&&(this[c.nodeName]=parseFloat(d[0].textContent))}}this.create();
|
|
|
+return this};F.prototype.create=function(){var a={},b=void 0!==this.transparency&&1>this.transparency,c;for(c in this)switch(c){case "ambient":case "emission":case "diffuse":case "specular":var d=this[c];if(d instanceof A)if(d.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid){var e=ca[this.effect.surface.init_from];if(e)e=THREE.ImageUtils.loadTexture(ja+e.init_from),e.wrapS=d.texOpts.wrapU?THREE.RepeatWrapping:THREE.ClampToEdgeWrapping,
|
|
|
+e.wrapT=d.texOpts.wrapV?THREE.RepeatWrapping:THREE.ClampToEdgeWrapping,e.offset.x=d.texOpts.offsetU,e.offset.y=d.texOpts.offsetV,e.repeat.x=d.texOpts.repeatU,e.repeat.y=d.texOpts.repeatV,a.map=e}}else"diffuse"==c?a.color=d.color.getHex():b||(a[c]=d.color.getHex());break;case "shininess":case "reflectivity":a[c]=this[c];break;case "transparency":if(b)a.transparent=!0,a.opacity=this[c],b=!0}a.shading=ka;return this.material=new THREE.MeshLambertMaterial(a)};E.prototype.parse=function(a){for(var b=0;b<
|
|
|
+a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "init_from":this.init_from=c.textContent;break;case "format":this.format=c.textContent;break;default:console.log("unhandled Surface prop: "+c.nodeName)}}return this};I.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "source":this.source=c.textContent;break;case "minfilter":this.minfilter=c.textContent;break;case "magfilter":this.magfilter=
|
|
|
+c.textContent;break;case "mipfilter":this.mipfilter=c.textContent;break;case "wrap_s":this.wrap_s=c.textContent;break;case "wrap_t":this.wrap_t=c.textContent;break;default:console.log("unhandled Sampler2D prop: "+c.nodeName)}}return this};J.prototype.create=function(){if(null==this.shader)return null};J.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.shader=null;for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "profile_COMMON":this.parseTechnique(this.parseProfileCOMMON(c))}}return this};
|
|
|
+J.prototype.parseNewparam=function(a){for(var b=a.getAttribute("sid"),c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(1==d.nodeType)switch(d.nodeName){case "surface":this.surface=(new E(this)).parse(d);this.surface.sid=b;break;case "sampler2D":this.sampler=(new I(this)).parse(d);this.sampler.sid=b;break;case "extra":break;default:console.log(d.nodeName)}}};J.prototype.parseProfileCOMMON=function(a){for(var b,c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(1==d.nodeType)switch(d.nodeName){case "profile_COMMON":this.parseProfileCOMMON(d);
|
|
|
+break;case "technique":b=d;break;case "newparam":this.parseNewparam(d);break;case "extra":break;default:console.log(d.nodeName)}}return b};J.prototype.parseTechnique=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "constant":case "lambert":case "blinn":case "phong":this.shader=(new F(c.nodeName,this)).parse(c)}}};B.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};G.prototype.parse=function(a){this.id=
|
|
|
+a.getAttribute("id");this.name=a.getAttribute("name");this.source={};for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "source":c=(new z).parse(c);this.source[c.id]=c;break;case "sampler":this.sampler.push((new H(this)).parse(c));break;case "channel":this.channel.push((new D(this)).parse(c))}}return this};D.prototype.parse=function(a){this.source=a.getAttribute("source").replace(/^#/,"");this.target=a.getAttribute("target");var b=this.target.split("/");
|
|
|
+b.shift();var a=b.shift(),c=0<=a.indexOf("."),d=0<=a.indexOf("(");if(c)b=a.split("."),this.sid=b.shift(),this.member=b.shift();else if(d){b=a.split("(");this.sid=b.shift();for(var e=0;e<b.length;e++)b[e]=parseInt(b[e].replace(/\)/,""));this.arrIndices=b}else this.sid=a;this.fullSid=a;this.dotSyntax=c;this.arrSyntax=d;return this};H.prototype.parse=function(a){this.id=a.getAttribute("id");this.inputs=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "input":this.inputs.push((new w).parse(c))}}return this};
|
|
|
+H.prototype.create=function(){for(var a=0;a<this.inputs.length;a++){var b=this.inputs[a],c=this.animation.source[b.source];switch(b.semantic){case "INPUT":this.input=c.read();break;case "OUTPUT":this.output=c.read();this.strideOut=c.accessor.stride;break;case "INTERPOLATION":this.interpolation=c.read();break;case "IN_TANGENT":break;case "OUT_TANGENT":break;default:console.log(b.semantic)}}this.duration=this.endTime=this.startTime=0;if(this.input.length){this.startTime=1E8;this.endTime=-1E8;for(a=
|
|
|
+0;a<this.input.length;a++)this.startTime=Math.min(this.startTime,this.input[a]),this.endTime=Math.max(this.endTime,this.input[a]);this.duration=this.endTime-this.startTime}};H.prototype.getData=function(a,b){var c;if(1<this.strideOut){c=[];for(var b=b*this.strideOut,d=0;d<this.strideOut;++d)c[d]=this.output[b+d];if(3===this.strideOut)switch(a){case "rotate":case "translate":O(c,-1);break;case "scale":O(c,1)}}else c=this.output[b];return c};y.prototype.addTarget=function(a,b,c,d){this.targets.push({sid:a,
|
|
|
+member:c,transform:b,data:d})};y.prototype.apply=function(a){for(var b=0;b<this.targets.length;++b){var c=this.targets[b];(!a||c.sid===a)&&c.transform.update(c.data,c.member)}};y.prototype.getTarget=function(a){for(var b=0;b<this.targets.length;++b)if(this.targets[b].sid===a)return this.targets[b];return null};y.prototype.hasTarget=function(a){for(var b=0;b<this.targets.length;++b)if(this.targets[b].sid===a)return!0;return!1};y.prototype.interpolate=function(a,b){for(var c=0;c<this.targets.length;++c){var d=
|
|
|
+this.targets[c],e=a.getTarget(d.sid);if(e){var f=(b-this.time)/(a.time-this.time),g=e.data,h=d.data;if(0>f||1<f)console.log("Key.interpolate: Warning! Scale out of bounds:"+f),f=0>f?0:1;if(h.length)for(var e=[],i=0;i<h.length;++i)e[i]=h[i]+(g[i]-h[i])*f;else e=h+(g-h)*f}else e=d.data;d.transform.update(e,d.member)}};return{load:function(b,c,d){var e=0;if(document.implementation&&document.implementation.createDocument){var f=new XMLHttpRequest;f.overrideMimeType&&f.overrideMimeType("text/xml");f.onreadystatechange=
|
|
|
+function(){if(4==f.readyState){if(0==f.status||200==f.status)f.responseXML?(ia=c,a(f.responseXML,void 0,b)):console.error("ColladaLoader: Empty or non-existing file ("+b+")")}else 3==f.readyState&&d&&(0==e&&(e=f.getResponseHeader("Content-Length")),d({total:e,loaded:f.responseText.length}))};f.open("GET",b,!0);f.send(null)}else alert("Don't know how to parse XML!")},parse:a,setPreferredShading:function(a){ka=a},applySkin:e,geometries:U,options:Q}};
|
|
|
+THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;
|
|
|
THREE.JSONLoader.prototype.load=function(a,b,c){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,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)&&
|
|
|
+THREE.JSONLoader.prototype.loadAjaxJSON=function(a,b,c,d,e){var f=new XMLHttpRequest,g=0;f.onreadystatechange=function(){if(4==f.readyState)if(200==f.status||0==f.status){try{var h=JSON.parse(f.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+"] ["+f.status+"]");else 3==f.readyState?e&&(0==g&&(g=f.getResponseHeader("Content-Length")),e({total:g,loaded:f.responseText.length})):
|
|
|
+2==f.readyState&&(g=f.getResponseHeader("Content-Length"))};f.open("GET",b,!0);f.overrideMimeType("text/plain; charset=x-user-defined");f.setRequestHeader("Content-Type","text/plain");f.send(null)};
|
|
|
+THREE.JSONLoader.prototype.createModel=function(a,b,c){var d=new THREE.Geometry,e=void 0!==a.scale?1/a.scale:1;this.initMaterials(d,a.materials,c);(function(b){if(void 0===a.metadata||void 0===a.metadata.formatVersion||3!==a.metadata.formatVersion)console.error("Deprecated file format.");else{var c,e,i,k,j,o,l,n,p,m,q,r,t,s,v=a.faces;o=a.vertices;var u=a.normals,w=a.colors,z=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&z++;for(c=0;c<z;c++)d.faceUvs[c]=[],d.faceVertexUvs[c]=[];k=0;for(j=o.length;k<
|
|
|
+j;)l=new THREE.Vertex,l.position.x=o[k++]*b,l.position.y=o[k++]*b,l.position.z=o[k++]*b,d.vertices.push(l);k=0;for(j=v.length;k<j;){b=v[k++];o=b&1;i=b&2;c=b&4;e=b&8;n=b&16;l=b&32;m=b&64;b&=128;o?(q=new THREE.Face4,q.a=v[k++],q.b=v[k++],q.c=v[k++],q.d=v[k++],o=4):(q=new THREE.Face3,q.a=v[k++],q.b=v[k++],q.c=v[k++],o=3);if(i)i=v[k++],q.materialIndex=i;i=d.faces.length;if(c)for(c=0;c<z;c++)r=a.uvs[c],p=v[k++],s=r[2*p],p=r[2*p+1],d.faceUvs[c][i]=new THREE.UV(s,p);if(e)for(c=0;c<z;c++){r=a.uvs[c];t=[];
|
|
|
+for(e=0;e<o;e++)p=v[k++],s=r[2*p],p=r[2*p+1],t[e]=new THREE.UV(s,p);d.faceVertexUvs[c][i]=t}if(n)n=3*v[k++],e=new THREE.Vector3,e.x=u[n++],e.y=u[n++],e.z=u[n],q.normal=e;if(l)for(c=0;c<o;c++)n=3*v[k++],e=new THREE.Vector3,e.x=u[n++],e.y=u[n++],e.z=u[n],q.vertexNormals.push(e);if(m)l=v[k++],l=new THREE.Color(w[l]),q.color=l;if(b)for(c=0;c<o;c++)l=v[k++],l=new THREE.Color(w[l]),q.vertexColors.push(l);d.faces.push(q)}}})(e);(function(){var b,c,e,i;if(a.skinWeights)for(b=0,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)for(b=0,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(void 0!==a.morphTargets){var c,e,i,k,j,o,l,n,p;for(c=0,e=a.morphTargets.length;c<e;c++){d.morphTargets[c]={};d.morphTargets[c].name=a.morphTargets[c].name;d.morphTargets[c].vertices=[];n=d.morphTargets[c].vertices;
|
|
|
+p=a.morphTargets[c].vertices;for(i=0,k=p.length;i<k;i+=3)j=p[i]*b,o=p[i+1]*b,l=p[i+2]*b,n.push(new THREE.Vertex(new THREE.Vector3(j,o,l)))}}if(void 0!==a.morphColors)for(c=0,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;for(b=0,i=j.length;b<i;b+=3)o=new THREE.Color(16755200),o.setRGB(j[b],j[b+1],j[b+2]),k.push(o)}})(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+"]")};
|
|
|
+THREE.SceneLoader.prototype.load=function(a,b){var c=this,d=new XMLHttpRequest;d.onreadystatechange=function(){if(4==d.readyState)if(200==d.status||0==d.status)try{var e=JSON.parse(d.responseText);void 0===e.metadata||void 0===e.metadata.formatVersion||3!==e.metadata.formatVersion?console.error("Deprecated file format."):c.createScene(e,b,a)}catch(f){console.error(f),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(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(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,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);
|
|
|
+THREE.SceneLoader.prototype.createScene=function(a,b,c){function d(a,b){return"relativeToHTML"==b?a:k+"/"+a}function e(){var a;for(l in B.objects)if(!C.objects[l])if(r=B.objects[l],void 0!==r.geometry){if(F=C.geometries[r.geometry]){a=!1;for(L=0;L<r.materials.length;L++)J=C.materials[r.materials[L]],a=J instanceof THREE.ShaderMaterial;a&&F.computeTangents();v=r.position;u=r.rotation;w=r.quaternion;z=r.scale;w=0;0==J.length&&(J=new THREE.MeshFaceMaterial);1<J.length&&(J=new THREE.MeshFaceMaterial);
|
|
|
+a=new THREE.Mesh(F,J);a.name=l;a.position.set(v[0],v[1],v[2]);w?(a.quaternion.set(w[0],w[1],w[2],w[3]),a.useQuaternion=!0):a.rotation.set(u[0],u[1],u[2]);a.scale.set(z[0],z[1],z[2]);a.visible=r.visible;C.scene.add(a);C.objects[l]=a;if(r.meshCollider){var b=THREE.CollisionUtils.MeshColliderWBox(a);C.scene.collisions.colliders.push(b)}if(r.castsShadow)b=new THREE.ShadowVolume(F),C.scene.add(b),b.position=a.position,b.rotation=a.rotation,b.scale=a.scale;r.trigger&&"none"!=r.trigger.toLowerCase()&&(b=
|
|
|
+{type:r.trigger,object:r},C.triggers[a.name]=b)}}else v=r.position,u=r.rotation,w=r.quaternion,z=r.scale,w=0,a=new THREE.Object3D,a.name=l,a.position.set(v[0],v[1],v[2]),w?(a.quaternion.set(w[0],w[1],w[2],w[3]),a.useQuaternion=!0):a.rotation.set(u[0],u[1],u[2]),a.scale.set(z[0],z[1],z[2]),a.visible=void 0!==r.visible?r.visible:!1,C.scene.add(a),C.objects[l]=a,C.empties[l]=a,r.trigger&&"none"!=r.trigger.toLowerCase()&&(b={type:r.trigger,object:r},C.triggers[a.name]=b)}function f(a){return function(b){C.geometries[a]=
|
|
|
+b;e();D-=1;i.onLoadComplete();h()}}function g(a){return function(b){C.geometries[a]=b}}function h(){i.callbackProgress({totalModels:y,totalTextures:K,loadedModels:y-D,loadedTextures:K-H},C);i.onLoadProgress();0==D&&0==H&&b(C)}var i=this,k=THREE.Loader.prototype.extractUrlbase(c),j,o,l,n,p,m,q,r,t,s,v,u,w,z,x,A,F,E,I,J,B,G,D,H,y,K,C;B=a;c=new THREE.BinaryLoader;G=new THREE.JSONLoader;H=D=0;C={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},
|
|
|
+empties:{}};a=!1;for(l in B.objects)if(r=B.objects[l],r.meshCollider){a=!0;break}if(a)C.scene.collisions=new THREE.CollisionSystem;if(B.transform)a=B.transform.position,t=B.transform.rotation,x=B.transform.scale,a&&C.scene.position.set(a[0],a[1],a[2]),t&&C.scene.rotation.set(t[0],t[1],t[2]),x&&C.scene.scale.set(x[0],x[1],x[2]),(a||t||x)&&C.scene.updateMatrix();a=function(){H-=1;h();i.onLoadComplete()};for(p in B.cameras)x=B.cameras[p],"perspective"==x.type?E=new THREE.PerspectiveCamera(x.fov,x.aspect,
|
|
|
+x.near,x.far):"ortho"==x.type&&(E=new THREE.OrthographicCamera(x.left,x.right,x.top,x.bottom,x.near,x.far)),v=x.position,t=x.target,x=x.up,E.position.set(v[0],v[1],v[2]),E.target=new THREE.Vector3(t[0],t[1],t[2]),x&&E.up.set(x[0],x[1],x[2]),C.cameras[p]=E;for(n in B.lights)t=B.lights[n],p=void 0!==t.color?t.color:16777215,E=void 0!==t.intensity?t.intensity:1,"directional"==t.type?(v=t.direction,s=new THREE.DirectionalLight(p,E),s.position.set(v[0],v[1],v[2]),s.position.normalize()):"point"==t.type?
|
|
|
+(v=t.position,s=t.distance,s=new THREE.PointLight(p,E,s),s.position.set(v[0],v[1],v[2])):"ambient"==t.type&&(s=new THREE.AmbientLight(p)),C.scene.add(s),C.lights[n]=s;for(m in B.fogs)n=B.fogs[m],"linear"==n.type?I=new THREE.Fog(0,n.near,n.far):"exp2"==n.type&&(I=new THREE.FogExp2(0,n.density)),x=n.color,I.color.setRGB(x[0],x[1],x[2]),C.fogs[m]=I;if(C.cameras&&B.defaults.camera)C.currentCamera=C.cameras[B.defaults.camera];if(C.fogs&&B.defaults.fog)C.scene.fog=C.fogs[B.defaults.fog];x=B.defaults.bgcolor;
|
|
|
+C.bgColor=new THREE.Color;C.bgColor.setRGB(x[0],x[1],x[2]);C.bgColorAlpha=B.defaults.bgalpha;for(j in B.geometries)if(m=B.geometries[j],"bin_mesh"==m.type||"ascii_mesh"==m.type)D+=1,i.onLoadStart();y=D;for(j in B.geometries)m=B.geometries[j],"cube"==m.type?(F=new THREE.CubeGeometry(m.width,m.height,m.depth,m.segmentsWidth,m.segmentsHeight,m.segmentsDepth,null,m.flipped,m.sides),C.geometries[j]=F):"plane"==m.type?(F=new THREE.PlaneGeometry(m.width,m.height,m.segmentsWidth,m.segmentsHeight),C.geometries[j]=
|
|
|
+F):"sphere"==m.type?(F=new THREE.SphereGeometry(m.radius,m.segmentsWidth,m.segmentsHeight),C.geometries[j]=F):"cylinder"==m.type?(F=new THREE.CylinderGeometry(m.topRad,m.botRad,m.height,m.radSegs,m.heightSegs),C.geometries[j]=F):"torus"==m.type?(F=new THREE.TorusGeometry(m.radius,m.tube,m.segmentsR,m.segmentsT),C.geometries[j]=F):"icosahedron"==m.type?(F=new THREE.IcosahedronGeometry(m.subdivisions),C.geometries[j]=F):"bin_mesh"==m.type?c.load(d(m.url,B.urlBaseType),f(j)):"ascii_mesh"==m.type?G.load(d(m.url,
|
|
|
+B.urlBaseType),f(j)):"embedded_mesh"==m.type&&(m=B.embeds[m.id])&&G.createModel(m,g(j),"");for(q in B.textures)if(j=B.textures[q],j.url instanceof Array){H+=j.url.length;for(m=0;m<j.url.length;m++)i.onLoadStart()}else H+=1,i.onLoadStart();K=H;for(q in B.textures){j=B.textures[q];if(void 0!=j.mapping&&void 0!=THREE[j.mapping])j.mapping=new THREE[j.mapping];if(j.url instanceof Array){m=[];for(var L=0;L<j.url.length;L++)m[L]=d(j.url[L],B.urlBaseType);m=THREE.ImageUtils.loadTextureCube(m,j.mapping,a)}else{m=
|
|
|
+THREE.ImageUtils.loadTexture(d(j.url,B.urlBaseType),j.mapping,a);if(void 0!=THREE[j.minFilter])m.minFilter=THREE[j.minFilter];if(void 0!=THREE[j.magFilter])m.magFilter=THREE[j.magFilter];if(j.repeat){m.repeat.set(j.repeat[0],j.repeat[1]);if(1!=j.repeat[0])m.wrapS=THREE.RepeatWrapping;if(1!=j.repeat[1])m.wrapT=THREE.RepeatWrapping}j.offset&&m.offset.set(j.offset[0],j.offset[1]);if(j.wrap){I={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(void 0!==I[j.wrap[0]])m.wrapS=I[j.wrap[0]];
|
|
|
+if(void 0!==I[j.wrap[1]])m.wrapT=I[j.wrap[1]]}}C.textures[q]=m}for(o in B.materials){q=B.materials[o];for(A in q.parameters)if("envMap"==A||"map"==A||"lightMap"==A)q.parameters[A]=C.textures[q.parameters[A]];else if("shading"==A)q.parameters[A]="flat"==q.parameters[A]?THREE.FlatShading:THREE.SmoothShading;else if("blending"==A)q.parameters[A]=THREE[q.parameters[A]]?THREE[q.parameters[A]]:THREE.NormalBlending;else if("combine"==A)q.parameters[A]="MixOperation"==q.parameters[A]?THREE.MixOperation:THREE.MultiplyOperation;
|
|
|
+else if("vertexColors"==A)if("face"==q.parameters[A])q.parameters[A]=THREE.FaceColors;else if(q.parameters[A])q.parameters[A]=THREE.VertexColors;if(void 0!==q.parameters.opacity&&1>q.parameters.opacity)q.parameters.transparent=!0;if(q.parameters.normalMap){j=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(j.uniforms);m=q.parameters.color;I=q.parameters.specular;c=q.parameters.ambient;G=q.parameters.shininess;a.tNormal.texture=C.textures[q.parameters.normalMap];if(q.parameters.normalMapFactor)a.uNormalScale.value=
|
|
|
+q.parameters.normalMapFactor;if(q.parameters.map)a.tDiffuse.texture=q.parameters.map,a.enableDiffuse.value=!0;if(q.parameters.lightMap)a.tAO.texture=q.parameters.lightMap,a.enableAO.value=!0;if(q.parameters.specularMap)a.tSpecular.texture=C.textures[q.parameters.specularMap],a.enableSpecular.value=!0;a.uDiffuseColor.value.setHex(m);a.uSpecularColor.value.setHex(I);a.uAmbientColor.value.setHex(c);a.uShininess.value=G;if(q.parameters.opacity)a.uOpacity.value=q.parameters.opacity;q=new THREE.ShaderMaterial({fragmentShader:j.fragmentShader,
|
|
|
+vertexShader:j.vertexShader,uniforms:a,lights:!0,fog:!0})}else q=new THREE[q.type](q.parameters);C.materials[o]=q}e();i.callbackSync(C);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=void 0!==c.scale?c.scale:1,f=void 0!==c.offsetX?c.offsetX:0,g=void 0!==c.offsetY?c.offsetY:0,h=void 0!==c.offsetZ?c.offsetZ:0;d.onreadystatechange=function(){4==d.readyState?200==d.status||0==d.status?THREE.UTF8Loader.prototype.createModel(d.responseText,
|
|
|
+b,e,f,g,h):alert("Couldn't load ["+a+"] ["+d.status+"]"):3!=d.readyState&&2==d.readyState&&d.getResponseHeader("Content-Length")};d.open("GET",a,!0);d.send(null)};THREE.UTF8Loader.prototype.decompressMesh=function(a){var b=a.charCodeAt(0);57344<=b&&(b-=2048);b++;for(var c=new Float32Array(8*b),d=1,e=0;8>e;e++){for(var f=0,g=0;g<b;++g){var h=a.charCodeAt(g+d),f=f+(h>>1^-(h&1));c[8*g+e]=f}d+=b}b=a.length-d;f=new Uint16Array(b);for(e=g=0;e<b;e++)h=a.charCodeAt(e+d),f[e]=g-h,0==h&&g++;return[c,f]};
|
|
|
+THREE.UTF8Loader.prototype.createModel=function(a,b,c,d,e,f){var g=function(){var b=this;b.materials=[];THREE.Geometry.call(this);var g=THREE.UTF8Loader.prototype.decompressMesh(a),k=[],j=[];(function(a,g,i){for(var j,k,q,r=a.length;i<r;i+=g)j=a[i],k=a[i+1],q=a[i+2],j=j/16383*c,k=k/16383*c,q=q/16383*c,j+=d,k+=e,q+=f,b.vertices.push(new THREE.Vertex(new THREE.Vector3(j,k,q)))})(g[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)})(g[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)})(g[0],8,5);(function(a){var c,d,e,f,g,i,t,s,v,u=a.length;for(c=0;c<u;c+=3){d=a[c];e=a[c+1];f=a[c+2];g=b;s=d;v=e;i=f;var w=k[3*e],z=k[3*e+1],x=k[3*e+2],A=k[3*f],F=k[3*f+1],E=k[3*f+2];t=new THREE.Vector3(k[3*d],k[3*d+1],k[3*d+2]);w=new THREE.Vector3(w,z,x);A=new THREE.Vector3(A,F,E);g.faces.push(new THREE.Face3(s,v,i,[t,w,A],null,0));g=j[2*d];d=j[2*d+1];i=j[2*e];t=j[2*e+1];s=j[2*
|
|
|
+f];v=j[2*f+1];f=b.faceVertexUvs[0];e=i;i=t;t=[];t.push(new THREE.UV(g,d));t.push(new THREE.UV(e,i));t.push(new THREE.UV(s,v));f.push(t)}})(g[1]);this.computeCentroids();this.computeFaceNormals()};g.prototype=new THREE.Geometry;g.prototype.constructor=g;b(new g)};
|
|
|
+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;c=new THREE.Line(a,new THREE.LineBasicMaterial({color:16711680}));c.rotation.z=-Math.PI/2;this.add(c);c=new THREE.Mesh(b,new THREE.MeshBasicMaterial({color:16711680}));c.position.x=100;c.rotation.z=-Math.PI/2;this.add(c);c=new THREE.Line(a,new THREE.LineBasicMaterial({color:65280}));this.add(c);
|
|
|
c=new THREE.Mesh(b,new THREE.MeshBasicMaterial({color:65280}));c.position.y=100;this.add(c);c=new THREE.Line(a,new THREE.LineBasicMaterial({color:255}));c.rotation.x=Math.PI/2;this.add(c);c=new THREE.Mesh(b,new THREE.MeshBasicMaterial({color:255}));c.position.z=100;c.rotation.x=Math.PI/2;this.add(c)};THREE.Axes.prototype=new THREE.Object3D;THREE.Axes.prototype.constructor=THREE.Axes;
|
|
|
-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,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 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.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(3*this.size3);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(3*this.maxCount);this.normalArray=new Float32Array(3*this.maxCount)};this.lerp=function(a,b,e){return a+(b-a)*e};this.VIntX=function(a,b,e,f,g,h,i,k,j,o){g=(g-j)/(o-j);j=this.normal_cache;b[f]=h+g*this.delta;b[f+1]=i;b[f+2]=k;e[f]=this.lerp(j[a],j[a+3],g);e[f+1]=this.lerp(j[a+1],j[a+4],g);e[f+2]=this.lerp(j[a+2],j[a+5],g)};this.VIntY=function(a,b,e,f,g,h,i,k,j,o){g=(g-j)/(o-j);j=this.normal_cache;b[f]=h;b[f+1]=i+g*this.delta;b[f+2]=k;b=a+3*this.yd;
|
|
|
+e[f]=this.lerp(j[a],j[b],g);e[f+1]=this.lerp(j[a+1],j[b+1],g);e[f+2]=this.lerp(j[a+2],j[b+2],g)};this.VIntZ=function(a,b,e,f,g,h,i,k,j,o){g=(g-j)/(o-j);j=this.normal_cache;b[f]=h;b[f+1]=i;b[f+2]=k+g*this.delta;b=a+3*this.zd;e[f]=this.lerp(j[a],j[b],g);e[f+1]=this.lerp(j[a+1],j[b+1],g);e[f+2]=this.lerp(j[a+2],j[b+2],g)};this.compNorm=function(a){var b=3*a;0===this.normal_cache[b]&&(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,f,g,h){var i=f+1,k=f+this.yd,j=f+this.zd,o=i+this.yd,l=i+this.zd,n=f+this.yd+this.zd,p=i+this.yd+this.zd,m=0,q=this.field[f],r=this.field[i],t=this.field[k],s=this.field[o],v=this.field[j],u=this.field[l],w=this.field[n],z=this.field[p];q<g&&(m|=1);r<g&&(m|=2);t<g&&(m|=8);s<g&&(m|=4);v<g&&(m|=16);u<g&&(m|=32);w<g&&(m|=128);z<g&&(m|=64);var x=THREE.edgeTable[m];if(0===x)return 0;var A=this.delta,F=a+
|
|
|
+A,E=b+A,A=e+A;x&1&&(this.compNorm(f),this.compNorm(i),this.VIntX(3*f,this.vlist,this.nlist,0,g,a,b,e,q,r));x&2&&(this.compNorm(i),this.compNorm(o),this.VIntY(3*i,this.vlist,this.nlist,3,g,F,b,e,r,s));x&4&&(this.compNorm(k),this.compNorm(o),this.VIntX(3*k,this.vlist,this.nlist,6,g,a,E,e,t,s));x&8&&(this.compNorm(f),this.compNorm(k),this.VIntY(3*f,this.vlist,this.nlist,9,g,a,b,e,q,t));x&16&&(this.compNorm(j),this.compNorm(l),this.VIntX(3*j,this.vlist,this.nlist,12,g,a,b,A,v,u));x&32&&(this.compNorm(l),
|
|
|
+this.compNorm(p),this.VIntY(3*l,this.vlist,this.nlist,15,g,F,b,A,u,z));x&64&&(this.compNorm(n),this.compNorm(p),this.VIntX(3*n,this.vlist,this.nlist,18,g,a,E,A,w,z));x&128&&(this.compNorm(j),this.compNorm(n),this.VIntY(3*j,this.vlist,this.nlist,21,g,a,b,A,v,w));x&256&&(this.compNorm(f),this.compNorm(j),this.VIntZ(3*f,this.vlist,this.nlist,24,g,a,b,e,q,v));x&512&&(this.compNorm(i),this.compNorm(l),this.VIntZ(3*i,this.vlist,this.nlist,27,g,F,b,e,r,u));x&1024&&(this.compNorm(o),this.compNorm(p),this.VIntZ(3*
|
|
|
+o,this.vlist,this.nlist,30,g,F,E,e,s,z));x&2048&&(this.compNorm(k),this.compNorm(n),this.VIntZ(3*k,this.vlist,this.nlist,33,g,a,E,e,t,w));m<<=4;for(g=f=0;-1!=THREE.triTable[m+g];)a=m+g,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),g+=3,f++;return f};this.posnormtriv=function(a,b,e,f,g,h){var i=3*this.count;this.positionArray[i]=a[e];this.positionArray[i+1]=a[e+1];this.positionArray[i+2]=a[e+2];this.positionArray[i+3]=a[f];this.positionArray[i+
|
|
|
+4]=a[f+1];this.positionArray[i+5]=a[f+2];this.positionArray[i+6]=a[g];this.positionArray[i+7]=a[g+1];this.positionArray[i+8]=a[g+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[f];this.normalArray[i+4]=b[f+1];this.normalArray[i+5]=b[f+2];this.normalArray[i+6]=b[g];this.normalArray[i+7]=b[g+1];this.normalArray[i+8]=b[g+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(0!==this.count){for(var b=3*this.count;b<this.positionArray.length;b++)this.positionArray[b]=0;a(this)}};this.addBall=function(a,b,e,f,g){var h=this.size*Math.sqrt(f/g),i=e*this.size,k=b*this.size,j=a*this.size,o=Math.floor(i-h);1>o&&(o=1);i=Math.floor(i+h);i>this.size-1&&(i=this.size-1);var l=Math.floor(k-h);1>l&&(l=1);k=Math.floor(k+h);k>this.size-1&&(k=this.size-1);var n=Math.floor(j-h);1>n&&(n=1);h=Math.floor(j+h);h>this.size-1&&(h=this.size-
|
|
|
+1);for(var p,m,q,r,t,s,v,j=o;j<i;j++){q=this.size2*j;t=j/this.size-e;s=t*t;for(o=l;o<k;o++){m=q+this.size*o;p=o/this.size-b;v=p*p;for(p=n;p<h;p++)r=p/this.size-a,r=f/(1.0E-6+r*r+v+s)-g,0<r&&(this.field[m+p]+=r)}}};this.addPlaneX=function(a,b){var e,f,g,h,i,k=this.size,j=this.yd,o=this.zd,l=this.field,n=k*Math.sqrt(a/b);n>k&&(n=k);for(e=0;e<n;e++)if(f=e/k,f*=f,h=a/(1.0E-4+f)-b,0<h)for(f=0;f<k;f++){i=e+f*j;for(g=0;g<k;g++)l[o*g+i]+=h}};this.addPlaneY=function(a,b){var e,f,g,h,i,k,j=this.size,o=this.yd,
|
|
|
+l=this.zd,n=this.field,p=j*Math.sqrt(a/b);p>j&&(p=j);for(f=0;f<p;f++)if(e=f/j,e*=e,h=a/(1.0E-4+e)-b,0<h){i=f*o;for(e=0;e<j;e++){k=i+e;for(g=0;g<j;g++)n[l*g+k]+=h}}};this.addPlaneZ=function(a,b){var e,f,g,h,i,k,j=this.size,o=this.yd,l=this.zd,n=this.field,p=j*Math.sqrt(a/b);p>j&&(p=j);for(g=0;g<p;g++)if(e=g/j,e*=e,h=a/(1.0E-4+e)-b,0<h){i=l*g;for(f=0;f<j;f++){k=i+f*o;for(e=0;e<j;e++)n[k+e]+=h}}};this.reset=function(){var a;for(a=0;a<this.size3;a++)this.normal_cache[3*a]=0,this.field[a]=0};this.render=
|
|
|
+function(a){this.begin();var b,e,f,g,h,i,k,j,o,l=this.size-2;for(g=1;g<l;g++){o=this.size2*g;k=(g-this.halfsize)/this.halfsize;for(f=1;f<l;f++){j=o+this.size*f;i=(f-this.halfsize)/this.halfsize;for(e=1;e<l;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(f){var g,h,i,k,j,o,l,n;for(g=0;g<f.count;g++)l=3*g,j=l+1,n=l+2,h=f.positionArray[l],i=f.positionArray[j],k=
|
|
|
+f.positionArray[n],o=new THREE.Vector3(h,i,k),h=f.normalArray[l],i=f.normalArray[j],k=f.normalArray[n],l=new THREE.Vector3(h,i,k),l.normalize(),j=new THREE.Vertex(o),b.vertices.push(j),e.push(l);o=f.count/3;for(g=0;g<o;g++)l=3*(a+g),j=l+1,n=l+2,h=e[l],i=e[j],k=e[n],l=new THREE.Face3(l,j,n,[h,i,k]),b.faces.push(l);a+=o;f.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]);
|
|
@@ -370,39 +368,37 @@ THREE.triTable=new Int32Array([-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0
|
|
|
2,11,1,5,1,11,-1,0,2,5,0,5,9,2,11,5,4,5,8,11,8,5,-1,9,4,5,2,11,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,5,10,3,5,2,3,4,5,3,8,4,-1,-1,-1,-1,5,10,2,5,2,4,4,2,0,-1,-1,-1,-1,-1,-1,-1,3,10,2,3,5,10,3,8,5,4,5,8,0,1,9,-1,5,10,2,5,2,4,1,9,2,9,4,2,-1,-1,-1,-1,8,4,5,8,5,3,3,5,1,-1,-1,-1,-1,-1,-1,-1,0,4,5,1,0,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8,4,5,8,5,3,9,0,5,0,3,5,-1,-1,-1,-1,9,4,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,11,7,4,9,11,9,10,11,-1,-1,-1,-1,-1,-1,-1,0,8,3,4,9,7,9,11,7,9,10,11,-1,-1,-1,-1,1,10,11,1,11,
|
|
|
4,1,4,0,7,4,11,-1,-1,-1,-1,3,1,4,3,4,8,1,10,4,7,4,11,10,11,4,-1,4,11,7,9,11,4,9,2,11,9,1,2,-1,-1,-1,-1,9,7,4,9,11,7,9,1,11,2,11,1,0,8,3,-1,11,7,4,11,4,2,2,4,0,-1,-1,-1,-1,-1,-1,-1,11,7,4,11,4,2,8,3,4,3,2,4,-1,-1,-1,-1,2,9,10,2,7,9,2,3,7,7,4,9,-1,-1,-1,-1,9,10,7,9,7,4,10,2,7,8,7,0,2,0,7,-1,3,7,10,3,10,2,7,4,10,1,10,0,4,0,10,-1,1,10,2,8,7,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,9,1,4,1,7,7,1,3,-1,-1,-1,-1,-1,-1,-1,4,9,1,4,1,7,0,8,1,8,7,1,-1,-1,-1,-1,4,0,3,7,4,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,8,7,-1,-1,-1,
|
|
|
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,10,8,10,11,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,0,9,3,9,11,11,9,10,-1,-1,-1,-1,-1,-1,-1,0,1,10,0,10,8,8,10,11,-1,-1,-1,-1,-1,-1,-1,3,1,10,11,3,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,2,11,1,11,9,9,11,8,-1,-1,-1,-1,-1,-1,-1,3,0,9,3,9,11,1,2,9,2,11,9,-1,-1,-1,-1,0,2,11,8,0,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,2,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,3,8,2,8,10,10,8,9,-1,-1,-1,-1,-1,-1,-1,9,10,2,0,9,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,3,8,2,8,10,0,1,8,1,10,8,-1,-1,-1,-1,1,10,
|
|
|
-2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,3,8,9,1,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,9,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,3,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1]);THREE.LensFlare=function(a,b,c,d,e){THREE.Object3D.call(this);this.lensFlares=[];this.positionScreen=new THREE.Vector3;this.customUpdateCallback=void 0;a!==void 0&&this.add(a,b,c,d,e)};THREE.LensFlare.prototype=new THREE.Object3D;THREE.LensFlare.prototype.constructor=THREE.LensFlare;
|
|
|
-THREE.LensFlare.prototype.supr=THREE.Object3D.prototype;THREE.LensFlare.prototype.add=function(a,b,c,d,e,g){b===void 0&&(b=-1);c===void 0&&(c=0);g===void 0&&(g=1);e===void 0&&(e=new THREE.Color(16777215));if(d===void 0)d=THREE.BillboardBlending;c=Math.min(c,Math.max(0,c));this.lensFlares.push({texture:a,size:b,distance:c,x:0,y:0,z:0,scale:1,rotation:1,opacity:g,color:e,blending:d})};
|
|
|
-THREE.LensFlare.prototype.updateLensFlares=function(){var a,b=this.lensFlares.length,c,d=-this.positionScreen.x*2,e=-this.positionScreen.y*2;for(a=0;a<b;a++)c=this.lensFlares[a],c.x=this.positionScreen.x+d*c.distance,c.y=this.positionScreen.y+e*c.distance,c.wantedRotation=c.x*Math.PI*0.25,c.rotation+=(c.wantedRotation-c.rotation)*0.25};
|
|
|
-THREE.LensFlarePlugin=function(){function a(a){var c=b.createProgram(),d=b.createShader(b.FRAGMENT_SHADER),h=b.createShader(b.VERTEX_SHADER);b.shaderSource(d,a.fragmentShader);b.shaderSource(h,a.vertexShader);b.compileShader(d);b.compileShader(h);b.attachShader(c,d);b.attachShader(c,h);b.linkProgram(c);return c}var b,c,d={};this.init=function(e){b=e.context;c=e;d.vertices=new Float32Array(16);d.faces=new Uint16Array(6);e=0;d.vertices[e++]=-1;d.vertices[e++]=-1;d.vertices[e++]=0;d.vertices[e++]=0;
|
|
|
-d.vertices[e++]=1;d.vertices[e++]=-1;d.vertices[e++]=1;d.vertices[e++]=0;d.vertices[e++]=1;d.vertices[e++]=1;d.vertices[e++]=1;d.vertices[e++]=1;d.vertices[e++]=-1;d.vertices[e++]=1;d.vertices[e++]=0;d.vertices[e++]=1;e=0;d.faces[e++]=0;d.faces[e++]=1;d.faces[e++]=2;d.faces[e++]=0;d.faces[e++]=2;d.faces[e++]=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);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,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,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);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 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)}};
|
|
|
+2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,3,8,9,1,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,9,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,3,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1]);THREE.LensFlare=function(a,b,c,d,e){THREE.Object3D.call(this);this.lensFlares=[];this.positionScreen=new THREE.Vector3;this.customUpdateCallback=void 0;void 0!==a&&this.add(a,b,c,d,e)};THREE.LensFlare.prototype=new THREE.Object3D;THREE.LensFlare.prototype.constructor=THREE.LensFlare;
|
|
|
+THREE.LensFlare.prototype.supr=THREE.Object3D.prototype;THREE.LensFlare.prototype.add=function(a,b,c,d,e,f){void 0===b&&(b=-1);void 0===c&&(c=0);void 0===f&&(f=1);void 0===e&&(e=new THREE.Color(16777215));if(void 0===d)d=THREE.NormalBlending;c=Math.min(c,Math.max(0,c));this.lensFlares.push({texture:a,size:b,distance:c,x:0,y:0,z:0,scale:1,rotation:1,opacity:f,color:e,blending:d})};
|
|
|
+THREE.LensFlare.prototype.updateLensFlares=function(){var a,b=this.lensFlares.length,c,d=2*-this.positionScreen.x,e=2*-this.positionScreen.y;for(a=0;a<b;a++)c=this.lensFlares[a],c.x=this.positionScreen.x+d*c.distance,c.y=this.positionScreen.y+e*c.distance,c.wantedRotation=0.25*c.x*Math.PI,c.rotation+=0.25*(c.wantedRotation-c.rotation)};
|
|
|
+THREE.LensFlarePlugin=function(){function a(a){var c=b.createProgram(),d=b.createShader(b.FRAGMENT_SHADER),e=b.createShader(b.VERTEX_SHADER);b.shaderSource(d,a.fragmentShader);b.shaderSource(e,a.vertexShader);b.compileShader(d);b.compileShader(e);b.attachShader(c,d);b.attachShader(c,e);b.linkProgram(c);return c}var b,c,d,e,f,g,h,i,k,j,o,l,n;this.init=function(p){b=p.context;c=p;d=new Float32Array(16);e=new Uint16Array(6);p=0;d[p++]=-1;d[p++]=-1;d[p++]=0;d[p++]=0;d[p++]=1;d[p++]=-1;d[p++]=1;d[p++]=
|
|
|
+0;d[p++]=1;d[p++]=1;d[p++]=1;d[p++]=1;d[p++]=-1;d[p++]=1;d[p++]=0;d[p++]=1;p=0;e[p++]=0;e[p++]=1;e[p++]=2;e[p++]=0;e[p++]=2;e[p++]=3;f=b.createBuffer();g=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,f);b.bufferData(b.ARRAY_BUFFER,d,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.bufferData(b.ELEMENT_ARRAY_BUFFER,e,b.STATIC_DRAW);h=b.createTexture();i=b.createTexture();b.bindTexture(b.TEXTURE_2D,h);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,i);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);0>=b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)?(k=!1,j=a(THREE.ShaderFlares.lensFlare)):(k=!0,j=a(THREE.ShaderFlares.lensFlareVertexTexture));o={};l={};o.vertex=b.getAttribLocation(j,"position");o.uv=b.getAttribLocation(j,"uv");l.renderType=b.getUniformLocation(j,"renderType");l.map=b.getUniformLocation(j,"map");l.occlusionMap=b.getUniformLocation(j,"occlusionMap");l.opacity=b.getUniformLocation(j,"opacity");l.color=b.getUniformLocation(j,
|
|
|
+"color");l.scale=b.getUniformLocation(j,"scale");l.rotation=b.getUniformLocation(j,"rotation");l.screenPosition=b.getUniformLocation(j,"screenPosition");n=!1};this.render=function(a,d,e,r){var a=a.__webglFlares,t=a.length;if(t){var s=new THREE.Vector3,v=r/e,u=0.5*e,w=0.5*r,z=16/r,x=new THREE.Vector2(z*v,z),A=new THREE.Vector3(1,1,0),F=new THREE.Vector2(1,1),E=l,z=o;b.useProgram(j);n||(b.enableVertexAttribArray(o.vertex),b.enableVertexAttribArray(o.uv),n=!0);b.uniform1i(E.occlusionMap,0);b.uniform1i(E.map,
|
|
|
+1);b.bindBuffer(b.ARRAY_BUFFER,f);b.vertexAttribPointer(z.vertex,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(z.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.disable(b.CULL_FACE);b.depthMask(!1);var I,J,B,G,D;for(I=0;I<t;I++)if(z=16/r,x.set(z*v,z),G=a[I],s.set(G.matrixWorld.n14,G.matrixWorld.n24,G.matrixWorld.n34),d.matrixWorldInverse.multiplyVector3(s),d.projectionMatrix.multiplyVector3(s),A.copy(s),F.x=A.x*u+u,F.y=A.y*w+w,k||0<F.x&&F.x<e&&0<F.y&&F.y<r){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,
|
|
|
+h);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,F.x-8,F.y-8,16,16,0);b.uniform1i(E.renderType,0);b.uniform2f(E.scale,x.x,x.y);b.uniform3f(E.screenPosition,A.x,A.y,A.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,i);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,F.x-8,F.y-8,16,16,0);b.uniform1i(E.renderType,1);b.disable(b.DEPTH_TEST);b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,h);b.drawElements(b.TRIANGLES,
|
|
|
+6,b.UNSIGNED_SHORT,0);G.positionScreen.copy(A);G.customUpdateCallback?G.customUpdateCallback(G):G.updateLensFlares();b.uniform1i(E.renderType,2);b.enable(b.BLEND);for(J=0,B=G.lensFlares.length;J<B;J++)if(D=G.lensFlares[J],0.0010<D.opacity&&0.0010<D.scale)A.x=D.x,A.y=D.y,A.z=D.z,z=D.size*D.scale/r,x.x=z*v,x.y=z,b.uniform3f(E.screenPosition,A.x,A.y,A.z),b.uniform2f(E.scale,x.x,x.y),b.uniform1f(E.rotation,D.rotation),b.uniform1f(E.opacity,D.opacity),b.uniform3f(E.color,D.color.r,D.color.g,D.color.b),
|
|
|
+c.setBlending(D.blending),c.setTexture(D.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,f=new THREE.Frustum,g=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,o,l,n,p,m,q=0,r=h.lights;e||(e=new THREE.PerspectiveCamera(b.shadowCameraFov,b.shadowMapWidth/b.shadowMapHeight,b.shadowCameraNear,b.shadowCameraFar));for(i=0,k=r.length;i<k;i++)if(p=r[i],p.castShadow&&p instanceof THREE.SpotLight){this.shadowMap[q]||(this.shadowMap[q]=new THREE.WebGLRenderTarget(b.shadowMapWidth,b.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,
|
|
|
+format:THREE.RGBAFormat}),this.shadowMatrix[q]=new THREE.Matrix4);j=this.shadowMap[q];o=this.shadowMatrix[q];e.position.copy(p.position);e.lookAt(p.target.position);null==e.parent&&(h.add(e),b.autoUpdateScene&&h.updateMatrixWorld());e.matrixWorldInverse.getInverse(e.matrixWorld);o.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);o.multiplySelf(e.projectionMatrix);o.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);g.multiply(e.projectionMatrix,e.matrixWorldInverse);f.setFromMatrix(g);b.setRenderTarget(j);a.clearColor(1,0,1,1);b.clear();j=b.getClearColor();o=b.getClearAlpha();a.clearColor(j.r,j.g,j.b,o);m=h.__webglObjects;for(j=0,o=m.length;j<o;j++)if(l=m[j],p=l.object,l.render=!1,p.visible&&p.castShadow&&(!(p instanceof THREE.Mesh)||!p.frustumCulled||f.contains(p)))p.matrixWorld.flattenToArray(p._objectMatrixArray),
|
|
|
+p._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,p.matrixWorld,p._modelViewMatrixArray),l.render=!0;b.setDepthTest(!0);b.setBlending(THREE.NormalBlending);for(j=0,o=m.length;j<o;j++)if(l=m[j],l.render)p=l.object,l=l.buffer,b.setObjectFaces(p),n=p.customDepthMaterial?p.customDepthMaterial:p.geometry.morphTargets.length?d:c,l instanceof THREE.BufferGeometry?b.renderBufferDirect(e,r,null,n,l,p):b.renderBuffer(e,r,null,n,l,p);m=h.__webglObjectsImmediate;for(j=0,o=m.length;j<o;j++)l=m[j],p=l.object,
|
|
|
+p.visible&&p.castShadow&&(p.matrixAutoUpdate&&p.matrixWorld.flattenToArray(p._objectMatrixArray),p._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,p.matrixWorld,p._modelViewMatrixArray),b.renderImmediateObject(e,r,null,c,p));q++}}};
|
|
|
+THREE.SpritePlugin=function(){function a(a,b){return b.z-a.z}var b,c,d,e,f,g,h,i,k,j;this.init=function(a){b=a.context;c=a;d=new Float32Array(16);e=new Uint16Array(6);a=0;d[a++]=-1;d[a++]=-1;d[a++]=0;d[a++]=1;d[a++]=1;d[a++]=-1;d[a++]=1;d[a++]=1;d[a++]=1;d[a++]=1;d[a++]=1;d[a++]=0;d[a++]=-1;d[a++]=1;d[a++]=0;a=d[a++]=0;e[a++]=0;e[a++]=1;e[a++]=2;e[a++]=0;e[a++]=2;e[a++]=3;f=b.createBuffer();g=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,f);b.bufferData(b.ARRAY_BUFFER,d,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,
|
|
|
+g);b.bufferData(b.ELEMENT_ARRAY_BUFFER,e,b.STATIC_DRAW);var a=THREE.ShaderSprite.sprite,l=b.createProgram(),n=b.createShader(b.FRAGMENT_SHADER),p=b.createShader(b.VERTEX_SHADER);b.shaderSource(n,a.fragmentShader);b.shaderSource(p,a.vertexShader);b.compileShader(n);b.compileShader(p);b.attachShader(l,n);b.attachShader(l,p);b.linkProgram(l);h=l;i={};k={};i.position=b.getAttribLocation(h,"position");i.uv=b.getAttribLocation(h,"uv");k.uvOffset=b.getUniformLocation(h,"uvOffset");k.uvScale=b.getUniformLocation(h,
|
|
|
+"uvScale");k.rotation=b.getUniformLocation(h,"rotation");k.scale=b.getUniformLocation(h,"scale");k.alignment=b.getUniformLocation(h,"alignment");k.color=b.getUniformLocation(h,"color");k.map=b.getUniformLocation(h,"map");k.opacity=b.getUniformLocation(h,"opacity");k.useScreenCoordinates=b.getUniformLocation(h,"useScreenCoordinates");k.affectedByDistance=b.getUniformLocation(h,"affectedByDistance");k.screenPosition=b.getUniformLocation(h,"screenPosition");k.modelViewMatrix=b.getUniformLocation(h,"modelViewMatrix");
|
|
|
+k.projectionMatrix=b.getUniformLocation(h,"projectionMatrix");j=!1};this.render=function(d,e,n,p){var d=d.__webglSprites,m=d.length;if(m){var q=i,r=k,t=p/n,n=0.5*n,s=0.5*p,v=!0;b.useProgram(h);j||(b.enableVertexAttribArray(q.position),b.enableVertexAttribArray(q.uv),j=!0);b.disable(b.CULL_FACE);b.enable(b.BLEND);b.depthMask(!0);b.bindBuffer(b.ARRAY_BUFFER,f);b.vertexAttribPointer(q.position,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(q.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.uniformMatrix4fv(r.projectionMatrix,
|
|
|
+!1,e._projectionMatrixArray);b.activeTexture(b.TEXTURE0);b.uniform1i(r.map,0);for(var u,w=[],q=0;q<m;q++)if(u=d[q],u.visible&&0!==u.opacity)u.useScreenCoordinates?u.z=-u.position.z:(u._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,u.matrixWorld,u._modelViewMatrixArray),u.z=-u._modelViewMatrix.n34);d.sort(a);for(q=0;q<m;q++)u=d[q],u.visible&&0!==u.opacity&&u.map&&u.map.image&&u.map.image.width&&(u.useScreenCoordinates?(b.uniform1i(r.useScreenCoordinates,1),b.uniform3f(r.screenPosition,(u.position.x-
|
|
|
+n)/n,(s-u.position.y)/s,Math.max(0,Math.min(1,u.position.z)))):(b.uniform1i(r.useScreenCoordinates,0),b.uniform1i(r.affectedByDistance,u.affectedByDistance?1:0),b.uniformMatrix4fv(r.modelViewMatrix,!1,u._modelViewMatrixArray)),e=u.map.image.width/(u.scaleByViewport?p:1),w[0]=e*t*u.scale.x,w[1]=e*u.scale.y,b.uniform2f(r.uvScale,u.uvScale.x,u.uvScale.y),b.uniform2f(r.uvOffset,u.uvOffset.x,u.uvOffset.y),b.uniform2f(r.alignment,u.alignment.x,u.alignment.y),b.uniform1f(r.opacity,u.opacity),b.uniform3f(r.color,
|
|
|
+u.color.r,u.color.g,u.color.b),b.uniform1f(r.rotation,u.rotation),b.uniform2fv(r.scale,w),u.mergeWith3D&&!v?(b.enable(b.DEPTH_TEST),v=!0):!u.mergeWith3D&&v&&(b.disable(b.DEPTH_TEST),v=!1),c.setBlending(u.blending),c.setTexture(u.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,f=new THREE.PerspectiveCamera,g=new THREE.Matrix4,h=new THREE.Matrix4,i,k,j,o;e.matrixAutoUpdate=f.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},l=new THREE.WebGLRenderTarget(512,512,a),n=new THREE.WebGLRenderTarget(512,512,a),p=new THREE.PerspectiveCamera(53,
|
|
|
+1,1,1E4);p.position.z=2;var a=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:l},mapRight:{type:"t",value:1,texture:n}},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}"}),
|
|
|
+m=new THREE.Scene;m.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),a));m.add(p);this.setSize=function(a,d){c.call(b,a,d);l.width=a;l.height=d;n.width=a;n.height=d};this.render=function(a,c){a.updateMatrixWorld();if(i!==c.aspect||k!==c.near||j!==c.far||o!==c.fov){i=c.aspect;k=c.near;j=c.far;o=c.fov;var t=c.projectionMatrix.clone(),s=0.5*(125/30),v=s*k/125,u=k*Math.tan(o*Math.PI/360),w;g.n14=s;h.n14=-s;s=-u*i+v;w=u*i+v;t.n11=2*k/(w-s);t.n13=(w+s)/(w-s);e.projectionMatrix.copy(t);s=-u*i-v;w=u*i-v;t.n11=
|
|
|
+2*k/(w-s);t.n13=(w+s)/(w-s);f.projectionMatrix.copy(t)}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,l,!0);f.matrixWorld.copy(c.matrixWorld).multiplySelf(g);f.position.copy(c.position);f.near=c.near;f.far=c.far;d.call(b,a,f,n,!0);m.updateMatrixWorld();d.call(b,m,p)}};
|
|
|
+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,f,g=new THREE.PerspectiveCamera;g.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&&void 0!==a.separation)b.separation=a.separation;this.setSize=function(a,d){c.call(b,a,d);e=a/2;f=d};this.render=function(a,c){this.clear();g.fov=c.fov;g.aspect=0.5*c.aspect;g.near=c.near;g.far=
|
|
|
+c.far;g.updateProjectionMatrix();g.position.copy(c.position);g.target.copy(c.target);g.translateX(b.separation);g.lookAt(g.target);h.projectionMatrix=g.projectionMatrix;h.position.copy(c.position);h.target.copy(c.target);h.translateX(-b.separation);h.lookAt(h.target);this.setViewport(0,0,e,f);d.call(b,a,g);this.setViewport(e,0,e,f);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}"},
|
|
|
lensFlare:{vertexShader:"uniform vec3 screenPosition;\nuniform vec2 scale;\nuniform float rotation;\nuniform int renderType;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvoid main() {\nvUV = uv;\nvec2 pos = position;\nif( renderType == 2 ) {\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 sampler2D occlusionMap;\nuniform float opacity;\nuniform int renderType;\nuniform vec3 color;\nvarying vec2 vUV;\nvoid main() {\nif( renderType == 0 ) {\ngl_FragColor = vec4( texture2D( map, vUV ).rgb, 0.0 );\n} else if( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nfloat visibility = texture2D( occlusionMap, vec2( 0.5, 0.1 ) ).a +\ntexture2D( occlusionMap, vec2( 0.9, 0.5 ) ).a +\ntexture2D( occlusionMap, vec2( 0.5, 0.9 ) ).a +\ntexture2D( occlusionMap, vec2( 0.1, 0.5 ) ).a;\nvisibility = ( 1.0 - visibility / 4.0 );\nvec4 texture = texture2D( map, vUV );\ntexture.a *= opacity * visibility;\ngl_FragColor = texture;\ngl_FragColor.rgb *= color;\n}\n}"}};
|
|
|
THREE.ShaderSprite={sprite:{vertexShader:"uniform int useScreenCoordinates;\nuniform int affectedByDistance;\nuniform vec3 screenPosition;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform float rotation;\nuniform vec2 scale;\nuniform vec2 alignment;\nuniform vec2 uvOffset;\nuniform vec2 uvScale;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvoid main() {\nvUV = uvOffset + uv * uvScale;\nvec2 alignedPosition = position + alignment;\nvec2 rotatedPosition;\nrotatedPosition.x = ( cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y ) * scale.x;\nrotatedPosition.y = ( sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y ) * scale.y;\nvec4 finalPosition;\nif( useScreenCoordinates != 0 ) {\nfinalPosition = vec4( screenPosition.xy + rotatedPosition, screenPosition.z, 1.0 );\n} else {\nfinalPosition = projectionMatrix * modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\nfinalPosition.xy += rotatedPosition * ( affectedByDistance == 1 ? 1.0 : finalPosition.z );\n}\ngl_Position = finalPosition;\n}",
|